From a99e0a4b2cb9b58965dd61ef9bec87446c926b38 Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Mon, 16 Jan 2023 21:32:19 -0600 Subject: [PATCH] =?UTF-8?q?[Bug=20Fix]=20Move=20EVENT=5FSPAWN=20for=20addi?= =?UTF-8?q?ng=20NPCs=20back=20to=20original=20spot,=20also=20add=20NPCs?= =?UTF-8?q?=E2=80=A6=20(#2749)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move EVENT_SPAWN for adding NPCs back to original spot, also add NPCs to npc/mob list before parsing * Adjust bots EVENT_SPAWN before spawn packet --- zone/bot.cpp | 8 +++----- zone/entity.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 836e642a5..86b075174 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8521,6 +8521,9 @@ Client* EntityList::GetBotOwnerByBotID(const uint32 bot_id) { void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) { if (new_bot) { new_bot->SetID(GetFreeID()); + bot_list.push_back(new_bot); + mob_list.insert(std::pair(new_bot->GetID(), new_bot)); + parse->EventBot(EVENT_SPAWN, new_bot, nullptr, "", 0); new_bot->SetSpawned(); if (send_spawn_packet) { if (dont_queue) { @@ -8538,11 +8541,6 @@ void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) { } } - bot_list.push_back(new_bot); - mob_list.insert(std::pair(new_bot->GetID(), new_bot)); - - parse->EventBot(EVENT_SPAWN, new_bot, nullptr, "", 0); - new_bot->DispatchZoneControllerEvent(EVENT_SPAWN_ZONE, new_bot, "", 0, nullptr); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index f4691b9e5..49594bcb2 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -697,7 +697,12 @@ void EntityList::AddNPC(NPC *npc, bool send_spawn_packet, bool dont_queue) owner->SetPetID(npc->GetID()); } } - + + npc_list.insert(std::pair(npc->GetID(), npc)); + mob_list.insert(std::pair(npc->GetID(), npc)); + + parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0); + const auto emote_id = npc->GetEmoteID(); if (emote_id != 0) { npc->DoNPCEmote(EQ::constants::EmoteEventTypes::OnSpawn, emote_id); @@ -731,11 +736,6 @@ void EntityList::AddNPC(NPC *npc, bool send_spawn_packet, bool dont_queue) } } - npc_list.insert(std::pair(npc->GetID(), npc)); - mob_list.insert(std::pair(npc->GetID(), npc)); - - parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0); - entity_list.ScanCloseMobs(npc->close_mobs, npc, true); npc->DispatchZoneControllerEvent(EVENT_SPAWN_ZONE, npc, "", 0, nullptr);