From 31e8f782ce62597c62faf80a661915155d30c55c Mon Sep 17 00:00:00 2001 From: Emagi Date: Sat, 21 Jun 2025 21:13:14 -0400 Subject: [PATCH] MoveInZone was causing inconsistencies since client was desyncing, we will do a full zone, fixed CheckTransporters to not send you to safe location --- source/WorldServer/client.cpp | 99 ++++++++++--------------------- source/WorldServer/client.h | 1 - source/WorldServer/zoneserver.cpp | 21 +++---- 3 files changed, 38 insertions(+), 83 deletions(-) diff --git a/source/WorldServer/client.cpp b/source/WorldServer/client.cpp index 82b351f..8346a60 100644 --- a/source/WorldServer/client.cpp +++ b/source/WorldServer/client.cpp @@ -4893,35 +4893,6 @@ bool Client::GotoSpawn(const char* search_name, bool forceTarget) { 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) { 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* destin } } else { - if (destination->destination_zone_id == GetCurrentZone()->GetZoneID() && destination->type == TRANSPORT_TYPE_FORCEZONE) { - MoveInZone(destination->destination_x, destination->destination_y, destination->destination_z, destination->destination_heading); + // determine if this is an instanced zone that already exists + 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 { - // determine if this is an instanced zone that already exists - ZoneChangeDetails zone_details; - bool foundZone = world.GetGroupManager()->IdentifyMemberInGroupOrRaid(&zone_details, this, destination->destination_zone_id); - if (foundZone) { + bool isZone = zone_list.GetZone(&zone_details, destination->destination_zone_id); + if (isZone) { GetPlayer()->SetX(destination->destination_x); GetPlayer()->SetY(destination->destination_y); GetPlayer()->SetZ(destination->destination_z); @@ -10212,17 +10188,7 @@ void Client::ProcessTeleport(Spawn* spawn, vector* destin Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false, is_spell); } else { - bool isZone = zone_list.GetZone(&zone_details, destination->destination_zone_id); - 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"); - } + SimpleMessage(CHANNEL_COLOR_RED, "Error establishing a zone destination"); } } } @@ -10364,30 +10330,25 @@ void Client::ProcessTeleportLocation(EQApplicationPacket* app) { } } else { - if((destination->destination_zone_id == GetCurrentZone()->GetZoneID() && destination->type == TRANSPORT_TYPE_FORCEZONE)) { - MoveInZone(destination->destination_x, destination->destination_y, destination->destination_z, destination->destination_heading); - } - else { - GetPlayer()->SetX(destination->destination_x); - GetPlayer()->SetY(destination->destination_y); - GetPlayer()->SetZ(destination->destination_z); - 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 - if (!TryZoneInstance(destination->destination_zone_id, false)) { - LogWrite(INSTANCE__DEBUG, 0, "Instance", "Attempting to zone normally"); - ZoneChangeDetails zone_details; - bool foundDupeZone = false; - duplicate_zoning_id = 0; - int32 additional_zones = zone_list.GetHighestDuplicateID("", destination->destination_zone_id, false); - if(additional_zones) { - if(foundDupeZone = zone_list.GetDuplicateZoneDetails(&zone_details, "", destination->destination_zone_id, duplicateId)) - duplicate_zoning_id = duplicateId; - } - - if (foundDupeZone || zone_list.GetZone(&zone_details, destination->destination_zone_id)) { - Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false); - } + // Test if where we're going is an Instanced zone + if (!TryZoneInstance(destination->destination_zone_id, false)) { + LogWrite(INSTANCE__DEBUG, 0, "Instance", "Attempting to zone normally"); + ZoneChangeDetails zone_details; + bool foundDupeZone = false; + duplicate_zoning_id = 0; + int32 additional_zones = zone_list.GetHighestDuplicateID("", destination->destination_zone_id, false); + if(additional_zones) { + if(foundDupeZone = zone_list.GetDuplicateZoneDetails(&zone_details, "", destination->destination_zone_id, duplicateId)) + duplicate_zoning_id = duplicateId; + } + + if (foundDupeZone || zone_list.GetZone(&zone_details, destination->destination_zone_id)) { + Zone(&zone_details, (ZoneServer*)zone_details.zonePtr, false); } } } diff --git a/source/WorldServer/client.h b/source/WorldServer/client.h index 66095f9..6650e06 100644 --- a/source/WorldServer/client.h +++ b/source/WorldServer/client.h @@ -292,7 +292,6 @@ public: bool IdentifyInstance(ZoneChangeDetails* zone_details, int32 zoneID); bool TryZoneInstance(int32 zoneID, bool zone_coords_valid = false); bool GotoSpawn(const char* search_name, bool forceTarget = false); - void MoveInZone(float x, float y, float z, float h); void DisplayDeadWindow(); void HandlePlayerRevive(int32 point_id); diff --git a/source/WorldServer/zoneserver.cpp b/source/WorldServer/zoneserver.cpp index 165fa30..2fc5e64 100644 --- a/source/WorldServer/zoneserver.cpp +++ b/source/WorldServer/zoneserver.cpp @@ -3395,19 +3395,14 @@ void ZoneServer::CheckTransporters(Client* client) { client->QueuePacket(packet); } else{ - if(loc->force_zone && loc->destination_zone_id == GetZoneID()) { - client->MoveInZone(loc->destination_x, loc->destination_y, loc->destination_z, loc->destination_heading); - } - else { - ZoneChangeDetails zone_details; - bool foundZone = zone_list.GetZone(&zone_details, loc->destination_zone_id); - if(foundZone){ - client->GetPlayer()->SetX(loc->destination_x); - 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); - } + ZoneChangeDetails zone_details; + bool foundZone = zone_list.GetZone(&zone_details, loc->destination_zone_id); + if(foundZone){ + client->GetPlayer()->SetX(loc->destination_x); + 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, false); } } break;