mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-30 02:31:29 +00:00
[Quest API] (Performance) Check event exists before export and execute EVENT_TIMER (#2903)
# Notes - Parse this event optionally instead of always doing so.
This commit is contained in:
parent
71b2bf6a64
commit
fd0764d4cb
@ -8161,7 +8161,9 @@ void Client::TryItemTimer(int slot)
|
||||
auto it_iter = item_timers.begin();
|
||||
while(it_iter != item_timers.end()) {
|
||||
if(it_iter->second.Check()) {
|
||||
parse->EventItem(EVENT_TIMER, this, inst, nullptr, it_iter->first, 0);
|
||||
if (parse->ItemHasQuestSub(inst, EVENT_TIMER)) {
|
||||
parse->EventItem(EVENT_TIMER, this, inst, nullptr, it_iter->first, 0);
|
||||
}
|
||||
}
|
||||
++it_iter;
|
||||
}
|
||||
@ -8181,7 +8183,9 @@ void Client::TryItemTimer(int slot)
|
||||
auto it_iter = item_timers.begin();
|
||||
while(it_iter != item_timers.end()) {
|
||||
if(it_iter->second.Check()) {
|
||||
parse->EventItem(EVENT_TIMER, this, a_inst, nullptr, it_iter->first, 0);
|
||||
if (parse->ItemHasQuestSub(a_inst, EVENT_TIMER)) {
|
||||
parse->EventItem(EVENT_TIMER, this, a_inst, nullptr, it_iter->first, 0);
|
||||
}
|
||||
}
|
||||
++it_iter;
|
||||
}
|
||||
|
||||
@ -90,15 +90,20 @@ void QuestManager::Process() {
|
||||
if (cur->Timer_.Enabled() && cur->Timer_.Check()) {
|
||||
if(entity_list.IsMobInZone(cur->mob)) {
|
||||
if(cur->mob->IsNPC()) {
|
||||
parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0);
|
||||
if (parse->HasQuestSub(cur->mob->GetNPCTypeID(), EVENT_TIMER)) {
|
||||
parse->EventNPC(EVENT_TIMER, cur->mob->CastToNPC(), nullptr, cur->name, 0);
|
||||
}
|
||||
} else if (cur->mob->IsEncounter()) {
|
||||
parse->EventEncounter(EVENT_TIMER, cur->mob->CastToEncounter()->GetEncounterName(), cur->name, 0, nullptr);
|
||||
} else if (cur->mob->IsClient()) {
|
||||
//this is inheriently unsafe if we ever make it so more than npc/client start timers
|
||||
parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0);
|
||||
}
|
||||
else if (cur->mob->IsBot()) {
|
||||
parse->EventBot(EVENT_TIMER, cur->mob->CastToBot(), nullptr, cur->name, 0);
|
||||
if (parse->PlayerHasQuestSub(EVENT_TIMER)) {
|
||||
//this is inheriently unsafe if we ever make it so more than npc/client start timers
|
||||
parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0);
|
||||
}
|
||||
} else if (cur->mob->IsBot()) {
|
||||
if (parse->BotHasQuestSub(EVENT_TIMER)) {
|
||||
parse->EventBot(EVENT_TIMER, cur->mob->CastToBot(), nullptr, cur->name, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//we MUST reset our iterator since the quest could have removed/added any
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user