mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Fix character creation tenancy operations
This commit is contained in:
+48
-26
@@ -215,7 +215,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
float x = atof(row_d[2]);
|
||||
float y = atof(row_d[3]);
|
||||
float z = atof(row_d[4]);
|
||||
if (x == 0 && y == 0 && z == 0) { GetSafePoints(player_profile_struct.binds[4].zoneId, 0, &x, &y, &z); }
|
||||
if (x == 0 && y == 0 && z == 0) { content_db.GetSafePoints(player_profile_struct.binds[4].zoneId, 0, &x, &y, &z); }
|
||||
player_profile_struct.binds[4].x = x;
|
||||
player_profile_struct.binds[4].y = y;
|
||||
player_profile_struct.binds[4].z = z;
|
||||
@@ -392,7 +392,11 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum)
|
||||
return zone_id;
|
||||
}
|
||||
|
||||
bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc,bool isTitanium)
|
||||
bool WorldDatabase::GetStartZone(
|
||||
PlayerProfile_Struct *p_player_profile_struct,
|
||||
CharCreate_Struct *p_char_create_struct,
|
||||
bool is_titanium
|
||||
)
|
||||
{
|
||||
// SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead.
|
||||
//
|
||||
@@ -401,45 +405,63 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
|
||||
// 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)
|
||||
if (!p_player_profile_struct || !p_char_create_struct) {
|
||||
return false;
|
||||
}
|
||||
|
||||
p_player_profile_struct->x = 0;
|
||||
p_player_profile_struct->y = 0;
|
||||
p_player_profile_struct->z = 0;
|
||||
p_player_profile_struct->heading = 0;
|
||||
p_player_profile_struct->zone_id = 0;
|
||||
p_player_profile_struct->binds[0].x = 0;
|
||||
p_player_profile_struct->binds[0].y = 0;
|
||||
p_player_profile_struct->binds[0].z = 0;
|
||||
p_player_profile_struct->binds[0].zoneId = 0;
|
||||
p_player_profile_struct->binds[0].instance_id = 0;
|
||||
|
||||
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, bind_x, bind_y, bind_z FROM start_zones WHERE zone_id = %i "
|
||||
std::string query = StringFormat(
|
||||
"SELECT x, y, z, heading, start_zone, bind_id, bind_x, bind_y, bind_z 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()) {
|
||||
p_char_create_struct->start_zone,
|
||||
p_char_create_struct->class_,
|
||||
p_char_create_struct->deity,
|
||||
p_char_create_struct->race
|
||||
);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LogInfo("SoF Start zone query: [{}]\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 (results.RowCount() == 0) {
|
||||
printf("No start_zones entry in database, using defaults\n");
|
||||
is_titanium ? SetTitaniumDefaultStartZone(p_player_profile_struct, p_char_create_struct) : SetSoFDefaultStartZone(p_player_profile_struct, p_char_create_struct);
|
||||
}
|
||||
else {
|
||||
LogInfo("Found starting location in start_zones");
|
||||
auto row = results.begin();
|
||||
in_pp->x = atof(row[0]);
|
||||
in_pp->y = atof(row[1]);
|
||||
in_pp->z = atof(row[2]);
|
||||
in_pp->heading = atof(row[3]);
|
||||
in_pp->zone_id = atoi(row[4]);
|
||||
in_pp->binds[0].zoneId = atoi(row[5]);
|
||||
in_pp->binds[0].x = atof(row[6]);
|
||||
in_pp->binds[0].y = atof(row[7]);
|
||||
in_pp->binds[0].z = atof(row[8]);
|
||||
p_player_profile_struct->x = atof(row[0]);
|
||||
p_player_profile_struct->y = atof(row[1]);
|
||||
p_player_profile_struct->z = atof(row[2]);
|
||||
p_player_profile_struct->heading = atof(row[3]);
|
||||
p_player_profile_struct->zone_id = atoi(row[4]);
|
||||
p_player_profile_struct->binds[0].zoneId = atoi(row[5]);
|
||||
p_player_profile_struct->binds[0].x = atof(row[6]);
|
||||
p_player_profile_struct->binds[0].y = atof(row[7]);
|
||||
p_player_profile_struct->binds[0].z = atof(row[8]);
|
||||
}
|
||||
|
||||
if(in_pp->x == 0 && in_pp->y == 0 && in_pp->z == 0)
|
||||
database.GetSafePoints(in_pp->zone_id, 0, &in_pp->x, &in_pp->y, &in_pp->z);
|
||||
if (p_player_profile_struct->x == 0 && p_player_profile_struct->y == 0 && p_player_profile_struct->z == 0) {
|
||||
content_db.GetSafePoints(p_player_profile_struct->zone_id, 0, &p_player_profile_struct->x, &p_player_profile_struct->y, &p_player_profile_struct->z);
|
||||
}
|
||||
|
||||
if(in_pp->binds[0].x == 0 && in_pp->binds[0].y == 0 && in_pp->binds[0].z == 0)
|
||||
database.GetSafePoints(in_pp->binds[0].zoneId, 0, &in_pp->binds[0].x, &in_pp->binds[0].y, &in_pp->binds[0].z);
|
||||
if (p_player_profile_struct->binds[0].x == 0 && p_player_profile_struct->binds[0].y == 0 && p_player_profile_struct->binds[0].z == 0) {
|
||||
content_db.GetSafePoints(p_player_profile_struct->binds[0].zoneId, 0, &p_player_profile_struct->binds[0].x, &p_player_profile_struct->binds[0].y, &p_player_profile_struct->binds[0].z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -783,4 +805,4 @@ bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQEmu::In
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user