View Single Post
  #11  
Old 01-11-2015, 06:20 PM
iluvseq
Sarnak
 
Join Date: Aug 2009
Location: Somewhere
Posts: 53
Default

Ok, here's the deal:

If you configure the startzone variable, then the start_zones table is ignored completely. Also, the starting location will be the safe point of the zone. This is hard coded.

The documentation for the start_zones table is incorrect. The way the code works, it queries start_zones using zone_id, player_class, player_deity and player_race. Most guides say to set zone_id and start_zone to the zone you want players to start in, and this is incorrect. You should instead ONLY set start_zone, leaving zone_id and player_choice set as default in the PEQ tables, otherwise the various queries against start_zone will fail and your characters will end up in the default (hard-coded by class/race for Titanium and older clients, and hard-coded to Crescent Reach for SoF and newer clients.)

Additionally, for SoF+ clients, only the x,y,z, heading and bind_id are actually pulled from the start_zones table, not the start_zone (this is probably a bug). So with the default code base, it is not possible to over-ride the start zone for SoF+ clients in any way other than using the startzone variable (which has the issue of always using the safe point of the zone).

This patch fixes that issue, so that the start_zone set in start_zones works for both Titanium and SoF+ clients.

Code:
diff --git a/world/worlddb.cpp b/world/worlddb.cpp
index 91406b5..23d6722 100644
--- a/world/worlddb.cpp
+++ b/world/worlddb.cpp
@@ -429,7 +429,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru
        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;
 
-    std::string query = StringFormat("SELECT x, y, z, heading, bind_id FROM start_zones WHERE zone_id = %i "
+    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);
@@ -459,8 +459,8 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru
                in_pp->y = atof(row[1]);
                in_pp->z = atof(row[2]);
                in_pp->heading = atof(row[3]);
-               in_pp->zone_id = in_cc->start_zone;
-               in_pp->binds[0].zoneId = atoi(row[4]);
+               in_pp->zone_id = atoi(row[4]);
+               in_pp->binds[0].zoneId = atoi(row[5]);
        }
 
        if(in_pp->x == 0 && in_pp->y == 0 && in_pp->z == 0)
Reply With Quote