mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 22:56:37 +00:00
[Zone] Zone Routing Improvements (#4142)
* Routing changes * Update world_content_service.cpp * Cleanup routing logic * Tweaks
This commit is contained in:
+11
-1
@@ -6285,7 +6285,17 @@ void Client::SendZonePoints()
|
||||
zp->zpe[i].z = data->target_z;
|
||||
zp->zpe[i].heading = data->target_heading;
|
||||
zp->zpe[i].zoneid = data->target_zone_id;
|
||||
zp->zpe[i].zoneinstance = data->target_zone_instance;
|
||||
|
||||
// if the target zone is the same as the current zone, use the instance of the current zone
|
||||
// if we don't use the same instance_id that the client was sent, the client will forcefully
|
||||
// issue a zone change request when they should be simply moving to a different point in the same zone
|
||||
// because the client will think the zone point target is different from the current instance
|
||||
auto target_instance = data->target_zone_instance;
|
||||
if (data->target_zone_id == zone->GetZoneID() && data->target_zone_instance == 0) {
|
||||
target_instance = zone->GetInstanceID();
|
||||
}
|
||||
|
||||
zp->zpe[i].zoneinstance = target_instance;
|
||||
i++;
|
||||
}
|
||||
iterator.Advance();
|
||||
|
||||
@@ -73,6 +73,15 @@ Doors::Doors(const DoorsRepository::Doors &door) :
|
||||
m_door_param = door.door_param;
|
||||
m_size = door.size;
|
||||
m_invert_state = door.invert_state;
|
||||
|
||||
// if the target zone is the same as the current zone, use the instance of the current zone
|
||||
// if we don't use the same instance_id that the client was sent, the client will forcefully
|
||||
// issue a zone change request when they should be simply moving to a different point in the same zone
|
||||
// because the client will think the zone point target is different from the current instance
|
||||
if (door.dest_zone == zone->GetShortName() && m_destination_instance_id == 0) {
|
||||
m_destination_instance_id = zone->GetInstanceID();
|
||||
}
|
||||
|
||||
m_destination_instance_id = door.dest_instance;
|
||||
m_is_ldon_door = door.is_ldon_door;
|
||||
m_dz_switch_id = door.dz_switch_id;
|
||||
|
||||
@@ -403,7 +403,6 @@ int main(int argc, char **argv)
|
||||
|
||||
content_service.SetDatabase(&database)
|
||||
->SetContentDatabase(&content_db)
|
||||
->SetContentZones(zone_store.GetZones())
|
||||
->SetExpansionContext()
|
||||
->ReloadContentFlags();
|
||||
|
||||
|
||||
+56
-7
@@ -405,11 +405,23 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) {
|
||||
zc->success
|
||||
);
|
||||
|
||||
strcpy(zc2->char_name, zc->char_name);
|
||||
strn0cpy(zc2->char_name, zc->char_name, 64);
|
||||
zc2->zoneID = zone->GetZoneID();
|
||||
zc2->success = 1;
|
||||
outapp->priority = 6;
|
||||
FastQueuePacket(&outapp);
|
||||
zc2->instanceID = zone->GetInstanceID();
|
||||
|
||||
// this fixes an issue where when we do a zone cancel what often ends up happening is we are sending
|
||||
// the client the wrong coordinates to zone back to. Often times it is the x,y,z of the destination zone
|
||||
// because we saved the destination x,y,z on the client profile before we rejected the zone request.
|
||||
// we're using rewind location because it should be where the client relatively was before we rejected the zone request.
|
||||
// it also prevents the client from getting caught up in a zone loop because if we sent them exactly back to where they
|
||||
// originated the request we could end up in a situation where the client is caught in a zone loop.
|
||||
m_Position.x = m_RewindLocation.x;
|
||||
m_Position.y = m_RewindLocation.y;
|
||||
m_Position.z = m_RewindLocation.z;
|
||||
zc2->x = m_Position.x;
|
||||
zc2->y = m_Position.y;
|
||||
zc2->z = m_Position.z;
|
||||
|
||||
LogZoning(
|
||||
"(zc2) Client [{}] char_name [{}] zoning to [{}] ({}) cancelled instance_id [{}] x [{}] y [{}] z [{}] zone_reason [{}] success [{}]",
|
||||
@@ -425,6 +437,9 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) {
|
||||
zc2->success
|
||||
);
|
||||
|
||||
outapp->priority = 6;
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
//reset to unsolicited.
|
||||
zone_mode = ZoneUnsolicited;
|
||||
// reset since we're not zoning anymore
|
||||
@@ -740,10 +755,34 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
|
||||
pZoneName = strcpy(new char[zd->long_name.length() + 1], zd->long_name.c_str());
|
||||
}
|
||||
|
||||
// If we are zoning to the same zone, we need to use the current instance ID if it is not specified.
|
||||
if (zoneID == zone->GetZoneID() && instance_id == 0) {
|
||||
instance_id = zone->GetInstanceID();
|
||||
}
|
||||
|
||||
auto r = content_service.FindZone(zoneID, instance_id);
|
||||
if (r.zone_id) {
|
||||
zoneID = r.zone_id;
|
||||
instance_id = r.instance.id;
|
||||
LogZoning(
|
||||
"Client caught HandleZoneRoutingMiddleware [{}] zone_id [{}] instance_id [{}] x [{}] y [{}] z [{}] heading [{}] ignorerestrictions [{}] zone_mode [{}]",
|
||||
GetCleanName(),
|
||||
zoneID,
|
||||
instance_id,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
heading,
|
||||
ignorerestrictions,
|
||||
static_cast<int>(zm)
|
||||
);
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Client [{}] zone_id [{}] x [{}] y [{}] z [{}] heading [{}] ignorerestrictions [{}] zone_mode [{}]",
|
||||
"Client [{}] zone_id [{}] instance_id [{}] x [{}] y [{}] z [{}] heading [{}] ignorerestrictions [{}] zone_mode [{}]",
|
||||
GetCleanName(),
|
||||
zoneID,
|
||||
instance_id,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
@@ -867,9 +906,8 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
|
||||
outapp->priority = 6;
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
else if(zm == ZoneSolicited || zm == ZoneToSafeCoords) {
|
||||
auto outapp =
|
||||
new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct));
|
||||
else if (zm == ZoneSolicited || zm == ZoneToSafeCoords) {
|
||||
auto outapp = new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct));
|
||||
RequestClientZoneChange_Struct* gmg = (RequestClientZoneChange_Struct*) outapp->pBuffer;
|
||||
|
||||
gmg->zone_id = zoneID;
|
||||
@@ -880,6 +918,17 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
|
||||
gmg->instance_id = instance_id;
|
||||
gmg->type = 0x01; //an observed value, not sure of meaning
|
||||
|
||||
LogZoning(
|
||||
"Player [{}] has requested zoning to zone_id [{}] instance_id [{}] x [{}] y [{}] z [{}] heading [{}]",
|
||||
GetCleanName(),
|
||||
zoneID,
|
||||
instance_id,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
heading
|
||||
);
|
||||
|
||||
outapp->priority = 6;
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user