Make sure packet stuff is aware of instance_id

This commit is contained in:
Akkadius
2023-10-29 23:47:27 -05:00
parent 8b132f6abc
commit 80f539e8c1
3 changed files with 21 additions and 19 deletions
+3 -3
View File
@@ -1142,10 +1142,10 @@ struct ServerInstanceUpdateTime_Struct
uint32 new_duration; uint32 new_duration;
}; };
struct ServerSpawnStatusChange_Struct struct ServerSpawnStatusChange_Struct {
{
uint32 id; uint32 id;
bool new_status; bool new_status;
uint32 instance_id;
}; };
struct ServerQGlobalUpdate_Struct struct ServerQGlobalUpdate_Struct
+7 -4
View File
@@ -362,8 +362,9 @@ void QuestManager::enable_spawn2(uint32 spawn2_id)
database.UpdateSpawn2Status(spawn2_id, 1, zone->GetInstanceID()); database.UpdateSpawn2Status(spawn2_id, 1, zone->GetInstanceID());
auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct)); auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct));
auto *ssc = (ServerSpawnStatusChange_Struct *) pack->pBuffer; auto *ssc = (ServerSpawnStatusChange_Struct *) pack->pBuffer;
ssc->id = spawn2_id; ssc->id = spawn2_id;
ssc->new_status = true; ssc->new_status = true;
scc->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
} }
@@ -373,8 +374,10 @@ void QuestManager::disable_spawn2(uint32 spawn2_id)
database.UpdateSpawn2Status(spawn2_id, 0, zone->GetInstanceID()); database.UpdateSpawn2Status(spawn2_id, 0, zone->GetInstanceID());
auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct)); auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct));
auto *ssc = (ServerSpawnStatusChange_Struct *) pack->pBuffer; auto *ssc = (ServerSpawnStatusChange_Struct *) pack->pBuffer;
ssc->id = spawn2_id; ssc->id = spawn2_id;
ssc->new_status = false; ssc->new_status = false;
scc->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
} }
+11 -12
View File
@@ -1729,28 +1729,27 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
if (zone) if (zone)
{ {
ServerSpawnStatusChange_Struct *ssc = (ServerSpawnStatusChange_Struct*)pack->pBuffer; ServerSpawnStatusChange_Struct *ssc = (ServerSpawnStatusChange_Struct*)pack->pBuffer;
LinkedListIterator<Spawn2*> iterator(zone->spawn2_list); if (ssc->instance_id != zone->GetInstanceID()) {
break;
}
LinkedListIterator<Spawn2 *> iterator(zone->spawn2_list);
iterator.Reset(); iterator.Reset();
Spawn2 *found_spawn = nullptr; Spawn2 *found_spawn = nullptr;
while (iterator.MoreElements()) while (iterator.MoreElements()) {
{ Spawn2 *cur = iterator.GetData();
Spawn2* cur = iterator.GetData(); if (cur->GetID() == ssc->id) {
if (cur->GetID() == ssc->id)
{
found_spawn = cur; found_spawn = cur;
break; break;
} }
iterator.Advance(); iterator.Advance();
} }
if (found_spawn) if (found_spawn) {
{ if (ssc->new_status == 0) {
if (ssc->new_status == 0)
{
found_spawn->Disable(); found_spawn->Disable();
} }
else else {
{
found_spawn->Enable(); found_spawn->Enable();
} }
} }