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;
}
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<TransportDestination*>* 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<TransportDestination*>* 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);
}
}
}

View File

@ -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);

View File

@ -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;