View Single Post
  #1  
Old 08-22-2015, 10:22 AM
AdrianD
Discordant
 
Join Date: Dec 2013
Posts: 297
Default Start_zones: Titanium input through an SoF query

I am having issues with characters being placed at the locations specified in the start_zones table. Upon creation, the characters are placed at the default bind point in most circumstances. I do not have a rule_values entry for `TitaniumStartZoneID` and I don't understand how it could find one.

Code:
[08-22-2015 :: 05:13:11] [World Server] Found 'TitaniumStartZoneID' rule setting: -1
[08-22-2015 :: 05:13:11] [Status] SoF Start zone query: SELECT x, y, z, heading, start_zone, bind_id FROM start_zones WHERE zone_id = 1 AND player_class = 1 AND player_deity = 396 AND player_race = 1

No start_zones entry in database, using defaults
I've played around with the table quite a bit to see if the above query would select `zone_id` instead of `player_choice`. I found it isn't the case with Titanium clients.
Code:
bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc,bool isTitanium)
{
	// SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead.
	//
	// For SoF, search for an entry in start_zones with a matching zone_id, class, race and deity.
	//
	// For now, if no row matching row is found, send them to Crescent Reach, as that is probably the most likely
	// reason for no match being found.
	//
	if(!in_pp || !in_cc)
		return false;

	in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0;
	in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0;
	// see if we have an entry for start_zone. We can support both titanium & SOF+ by having two entries per class/race/deity combo with different zone_ids
	std::string query = StringFormat("SELECT x, y, z, heading, start_zone, bind_id FROM start_zones WHERE zone_id = %i "
		"AND player_class = %i AND player_deity = %i AND player_race = %i",
		in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race);
    auto results = QueryDatabase(query);
	if(!results.Success()) {
		return false;
	}

	Log.Out(Logs::General, Logs::Status, "SoF Start zone query: %s\n", query.c_str());

    if (results.RowCount() == 0) {
        printf("No start_zones entry in database, using defaults\n");
		isTitanium ? SetTitaniumDefaultStartZone(in_pp, in_cc) : SetSoFDefaultStartZone(in_pp, in_cc);
    }
If you haven't gathered my conundrum, I will spell it out.

When the choice is made on the Titanium client, it does not choose the actual `zone_id` as the query is attempting to find. The query is incorrect for a titanium client. It "thinks" it's an SoF client, from what I can tell.

Advice?

PS. Whoever puts comments in the code, THANK YOU! It's a big help in understanding it and learning.
Reply With Quote