MoveInZone was causing inconsistencies since client was desyncing, we will do a full zone, fixed CheckTransporters to not send you to safe location

This commit is contained in:
Emagi 2025-06-21 21:13:14 -04:00
parent 6f3dc5119a
commit 31e8f782ce
3 changed files with 38 additions and 83 deletions

View File

@ -4893,35 +4893,6 @@ bool Client::GotoSpawn(const char* search_name, bool forceTarget) {
return true; return true;
} }
void Client::MoveInZone(float x, float y, float z, float h) {
SetReloadingZone(true);
GetPlayer()->SetX(x);
GetPlayer()->SetY(y);
GetPlayer()->SetZ(z);
GetPlayer()->SetHeading(h);
GetPlayer()->SetSpawnOrigX(x);
GetPlayer()->SetSpawnOrigY(y);
GetPlayer()->SetSpawnOrigZ(z);
GetPlayer()->SetSpawnOrigHeading(h);
SetZoningCoords(x,y,z,h);
EQ2Packet* pack = GetPlayer()->Move(x, y, z, GetVersion());
if(pack)
QueuePacket(pack);
PacketStruct* packet = configReader.getStruct("WS_TeleportWithinZone", GetVersion());
if (packet)
{
packet->setDataByName("x", x);
packet->setDataByName("y", y);
packet->setDataByName("z", z);
QueuePacket(packet->serialize());
safe_delete(packet);
}
}
bool Client::CheckZoneAccess(const char* zoneName) { bool Client::CheckZoneAccess(const char* zoneName) {
LogWrite(CCLIENT__DEBUG, 0, "Client", "Zone access check for %s (%u), client: %u", zoneName, database.GetZoneID(zoneName), GetVersion()); LogWrite(CCLIENT__DEBUG, 0, "Client", "Zone access check for %s (%u), client: %u", zoneName, database.GetZoneID(zoneName), GetVersion());
@ -10197,14 +10168,19 @@ void Client::ProcessTeleport(Spawn* spawn, vector<TransportDestination*>* destin
} }
} }
else { else {
if (destination->destination_zone_id == GetCurrentZone()->GetZoneID() && destination->type == TRANSPORT_TYPE_FORCEZONE) { // determine if this is an instanced zone that already exists
MoveInZone(destination->destination_x, destination->destination_y, destination->destination_z, destination->destination_heading); ZoneChangeDetails zone_details;
bool foundZone = world.GetGroupManager()->IdentifyMemberInGroupOrRaid(&zone_details, this, destination->destination_zone_id);
if (foundZone) {
GetPlayer()->SetX(destination->destination_x);
GetPlayer()->SetY(destination->destination_y);
GetPlayer()->SetZ(destination->destination_z);
GetPlayer()->SetHeading(destination->destination_heading);
Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false, is_spell);
} }
else { else {
// determine if this is an instanced zone that already exists bool isZone = zone_list.GetZone(&zone_details, destination->destination_zone_id);
ZoneChangeDetails zone_details; if (isZone) {
bool foundZone = world.GetGroupManager()->IdentifyMemberInGroupOrRaid(&zone_details, this, destination->destination_zone_id);
if (foundZone) {
GetPlayer()->SetX(destination->destination_x); GetPlayer()->SetX(destination->destination_x);
GetPlayer()->SetY(destination->destination_y); GetPlayer()->SetY(destination->destination_y);
GetPlayer()->SetZ(destination->destination_z); GetPlayer()->SetZ(destination->destination_z);
@ -10212,17 +10188,7 @@ void Client::ProcessTeleport(Spawn* spawn, vector<TransportDestination*>* destin
Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false, is_spell); Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false, is_spell);
} }
else { else {
bool isZone = zone_list.GetZone(&zone_details, destination->destination_zone_id); SimpleMessage(CHANNEL_COLOR_RED, "Error establishing a zone destination");
if (isZone) {
GetPlayer()->SetX(destination->destination_x);
GetPlayer()->SetY(destination->destination_y);
GetPlayer()->SetZ(destination->destination_z);
GetPlayer()->SetHeading(destination->destination_heading);
Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false, is_spell);
}
else {
SimpleMessage(CHANNEL_COLOR_RED, "Error establishing a zone destination");
}
} }
} }
} }
@ -10364,30 +10330,25 @@ void Client::ProcessTeleportLocation(EQApplicationPacket* app) {
} }
} }
else { else {
if((destination->destination_zone_id == GetCurrentZone()->GetZoneID() && destination->type == TRANSPORT_TYPE_FORCEZONE)) { GetPlayer()->SetX(destination->destination_x);
MoveInZone(destination->destination_x, destination->destination_y, destination->destination_z, destination->destination_heading); GetPlayer()->SetY(destination->destination_y);
} GetPlayer()->SetZ(destination->destination_z);
else { GetPlayer()->SetHeading(destination->destination_heading);
GetPlayer()->SetX(destination->destination_x);
GetPlayer()->SetY(destination->destination_y);
GetPlayer()->SetZ(destination->destination_z);
GetPlayer()->SetHeading(destination->destination_heading);
// Test if where we're going is an Instanced zone // Test if where we're going is an Instanced zone
if (!TryZoneInstance(destination->destination_zone_id, false)) { if (!TryZoneInstance(destination->destination_zone_id, false)) {
LogWrite(INSTANCE__DEBUG, 0, "Instance", "Attempting to zone normally"); LogWrite(INSTANCE__DEBUG, 0, "Instance", "Attempting to zone normally");
ZoneChangeDetails zone_details; ZoneChangeDetails zone_details;
bool foundDupeZone = false; bool foundDupeZone = false;
duplicate_zoning_id = 0; duplicate_zoning_id = 0;
int32 additional_zones = zone_list.GetHighestDuplicateID("", destination->destination_zone_id, false); int32 additional_zones = zone_list.GetHighestDuplicateID("", destination->destination_zone_id, false);
if(additional_zones) { if(additional_zones) {
if(foundDupeZone = zone_list.GetDuplicateZoneDetails(&zone_details, "", destination->destination_zone_id, duplicateId)) if(foundDupeZone = zone_list.GetDuplicateZoneDetails(&zone_details, "", destination->destination_zone_id, duplicateId))
duplicate_zoning_id = duplicateId; duplicate_zoning_id = duplicateId;
} }
if (foundDupeZone || zone_list.GetZone(&zone_details, destination->destination_zone_id)) { if (foundDupeZone || zone_list.GetZone(&zone_details, destination->destination_zone_id)) {
Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false); Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false);
}
} }
} }
} }

View File

@ -292,7 +292,6 @@ public:
bool IdentifyInstance(ZoneChangeDetails* zone_details, int32 zoneID); bool IdentifyInstance(ZoneChangeDetails* zone_details, int32 zoneID);
bool TryZoneInstance(int32 zoneID, bool zone_coords_valid = false); bool TryZoneInstance(int32 zoneID, bool zone_coords_valid = false);
bool GotoSpawn(const char* search_name, bool forceTarget = false); bool GotoSpawn(const char* search_name, bool forceTarget = false);
void MoveInZone(float x, float y, float z, float h);
void DisplayDeadWindow(); void DisplayDeadWindow();
void HandlePlayerRevive(int32 point_id); void HandlePlayerRevive(int32 point_id);

View File

@ -3395,19 +3395,14 @@ void ZoneServer::CheckTransporters(Client* client) {
client->QueuePacket(packet); client->QueuePacket(packet);
} }
else{ else{
if(loc->force_zone && loc->destination_zone_id == GetZoneID()) { ZoneChangeDetails zone_details;
client->MoveInZone(loc->destination_x, loc->destination_y, loc->destination_z, loc->destination_heading); bool foundZone = zone_list.GetZone(&zone_details, loc->destination_zone_id);
} if(foundZone){
else { client->GetPlayer()->SetX(loc->destination_x);
ZoneChangeDetails zone_details; client->GetPlayer()->SetY(loc->destination_y);
bool foundZone = zone_list.GetZone(&zone_details, loc->destination_zone_id); client->GetPlayer()->SetZ(loc->destination_z);
if(foundZone){ client->GetPlayer()->SetHeading(loc->destination_heading);
client->GetPlayer()->SetX(loc->destination_x); client->Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false);
client->GetPlayer()->SetY(loc->destination_y);
client->GetPlayer()->SetZ(loc->destination_z);
client->GetPlayer()->SetHeading(loc->destination_heading);
client->Zone(&zone_details, (ZoneServer*)zone_details.zonePtr);
}
} }
} }
break; break;