[Quest API] (Performance) Check event exists before export and execute EVENT_DESPAWN and EVENT_DESPAWN_ZONE (#2887)

# Notes
- Optionally parse these events instead of always doing so.
This commit is contained in:
Alex King authored and GitHub committed 2023-02-12 21:59:01 -06:00
1 parent 0e51131d67
commit 5ac5beb456
1 file changed
+14 -4
+14 -4
View File
@@ -1114,11 +1114,21 @@ void NPC::Depop(bool start_spawn_timer) {
}
if (IsNPC()) {
parse->EventNPC(EVENT_DESPAWN, this, nullptr, "", 0);
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_DESPAWN)) {
parse->EventNPC(EVENT_DESPAWN, this, nullptr, "", 0);
}
if (parse->HasQuestSub(ZONE_CONTROLLER_NPC_ID, EVENT_DESPAWN_ZONE)) {
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
}
} else if (IsBot()) {
parse->EventBot(EVENT_DESPAWN, CastToBot(), nullptr, "", 0);
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
if (parse->BotHasQuestSub(EVENT_DESPAWN)) {
parse->EventBot(EVENT_DESPAWN, CastToBot(), nullptr, "", 0);
}
if (parse->HasQuestSub(ZONE_CONTROLLER_NPC_ID, EVENT_DESPAWN_ZONE)) {
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
}
}
p_depop = true;