mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 07:38:36 +00:00
[Dynamic Zones] Implement dz switch id (#2343)
This adds the `dz_switch_id` field to doors and dynamic_zones. It will allow for compasses to be automatically added to dz entrances and will support moving clients to the dz on use without needing to script it. These can be imported for switches/doors from live packet dumps. Also removes compass packet encoders (same struct in all clients)
This commit is contained in:
@@ -363,6 +363,16 @@ void DynamicZone::HandleWorldMessage(ServerPacket* pack)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSetSwitchID:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzSwitchID_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
dz->ProcessSetSwitchID(buf->dz_switch_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzGetMemberStatuses:
|
||||
{
|
||||
// reply from world for online member statuses request for async zone member updates
|
||||
@@ -414,6 +424,20 @@ void DynamicZone::HandleWorldMessage(ServerPacket* pack)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzMovePC:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMovePC_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
Client* client = entity_list.GetClientByCharID(buf->character_id);
|
||||
if (client)
|
||||
{
|
||||
dz->MovePCInto(client, false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,6 +541,12 @@ void DynamicZone::SendCompassUpdateToZoneMembers()
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZone::ProcessSetSwitchID(int dz_switch_id)
|
||||
{
|
||||
DynamicZoneBase::ProcessSetSwitchID(dz_switch_id);
|
||||
SendCompassUpdateToZoneMembers();
|
||||
}
|
||||
|
||||
void DynamicZone::SendLeaderNameToZoneMembers()
|
||||
{
|
||||
auto outapp_leader = CreateLeaderNamePacket();
|
||||
@@ -777,3 +807,23 @@ bool DynamicZone::CanClientLootCorpse(Client* client, uint32_t npc_type_id, uint
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DynamicZone::MovePCInto(Client* client, bool world_verify) const
|
||||
{
|
||||
if (!world_verify)
|
||||
{
|
||||
DynamicZoneLocation zonein = GetZoneInLocation();
|
||||
ZoneMode zone_mode = HasZoneInLocation() ? ZoneMode::ZoneSolicited : ZoneMode::ZoneToSafeCoords;
|
||||
client->MovePC(GetZoneID(), GetInstanceID(), zonein.x, zonein.y, zonein.z, zonein.heading, 0, zone_mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerPacket pack(ServerOP_DzMovePC, sizeof(ServerDzMovePC_Struct));
|
||||
auto buf = reinterpret_cast<ServerDzMovePC_Struct*>(pack.pBuffer);
|
||||
buf->dz_id = GetID();
|
||||
buf->sender_zone_id = static_cast<uint16_t>(zone->GetZoneID());
|
||||
buf->sender_instance_id = static_cast<uint16_t>(zone->GetInstanceID());
|
||||
buf->character_id = client->CharacterID();
|
||||
worldserver.SendPacket(&pack);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user