[Zoning] Fix zoning logic issues (#2412)

* [Zoning] Fix various zoning issues, flag logic, #zone etc

* Enforce character restrictions later in the connection process so we don't end up in a loop race condition in world
This commit is contained in:
Chris Miles
2022-09-03 00:57:57 -05:00
committed by GitHub
parent 034667f03b
commit ec857cefae
4 changed files with 85 additions and 61 deletions
+11 -10
View File
@@ -780,13 +780,6 @@ void Client::CompleteConnect()
conn_state = ClientConnectFinished;
//enforce some rules..
if (!CanBeInZone()) {
LogDebug("[CLIENT] Kicking char from zone, not allowed here");
GoToSafeCoords(ZoneID("arena"), 0);
return;
}
if (zone)
zone->weatherSend(this);
@@ -918,6 +911,13 @@ void Client::CompleteConnect()
}
heroforge_wearchange_timer.Start(250);
// enforce some rules..
if (!CanBeInZone()) {
LogInfo("Kicking character [{}] from zone, not allowed here (missing requirements)", GetCleanName());
GoToSafeCoords(ZoneID("arena"), 0);
return;
}
}
// connecting opcode handlers
@@ -6621,7 +6621,7 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
return;
}
GMZoneRequest_Struct* gmzr = (GMZoneRequest_Struct*)app->pBuffer;
auto* gmzr = (GMZoneRequest_Struct*)app->pBuffer;
float target_x = -1, target_y = -1, target_z = -1, target_heading;
int16 min_status = AccountStatus::Player;
@@ -6640,15 +6640,16 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
// this both loads the safe points and does a sanity check on zone name
auto z = GetZone(target_zone, 0);
if (z) {
target_zone[0] = 0;
target_x = z->safe_x;
target_y = z->safe_y;
target_z = z->safe_z;
target_heading = z->safe_heading;
} else {
target_zone[0] = 0;
}
auto outapp = new EQApplicationPacket(OP_GMZoneRequest, sizeof(GMZoneRequest_Struct));
GMZoneRequest_Struct* gmzr2 = (GMZoneRequest_Struct*)outapp->pBuffer;
auto* gmzr2 = (GMZoneRequest_Struct*)outapp->pBuffer;
strcpy(gmzr2->charname, GetName());
gmzr2->zone_id = gmzr->zone_id;
gmzr2->x = target_x;