This commit is contained in:
Kinglykrab 2025-05-31 21:17:09 -04:00
parent 54c53ce389
commit aae810e616
7 changed files with 192 additions and 102 deletions

View File

@ -222,6 +222,8 @@ PerlembParser::PerlembParser() : perl(nullptr)
global_bot_quest_status_ = questUnloaded; global_bot_quest_status_ = questUnloaded;
merc_quest_status_ = questUnloaded; merc_quest_status_ = questUnloaded;
global_merc_quest_status_ = questUnloaded; global_merc_quest_status_ = questUnloaded;
zone_quest_status_ = questUnloaded;
global_zone_quest_status_ = questUnloaded;
} }
PerlembParser::~PerlembParser() PerlembParser::~PerlembParser()
@ -265,6 +267,8 @@ void PerlembParser::ReloadQuests()
global_bot_quest_status_ = questUnloaded; global_bot_quest_status_ = questUnloaded;
merc_quest_status_ = questUnloaded; merc_quest_status_ = questUnloaded;
global_merc_quest_status_ = questUnloaded; global_merc_quest_status_ = questUnloaded;
zone_quest_status_ = questUnloaded;
global_zone_quest_status_ = questUnloaded;
item_quest_status_.clear(); item_quest_status_.clear();
spell_quest_status_.clear(); spell_quest_status_.clear();
@ -353,21 +357,21 @@ int PerlembParser::EventCommon(
} }
if (quest_type == QuestType::Player || quest_type == QuestType::PlayerGlobal) { if (quest_type == QuestType::Player || quest_type == QuestType::PlayerGlobal) {
return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, mob, mob, nullptr, nullptr); return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, mob, mob, nullptr, nullptr, nullptr);
} else if ( } else if (
quest_type == QuestType::Bot || quest_type == QuestType::Bot ||
quest_type == QuestType::BotGlobal || quest_type == QuestType::BotGlobal ||
quest_type == QuestType::Merc || quest_type == QuestType::Merc ||
quest_type == QuestType::MercGlobal quest_type == QuestType::MercGlobal
) { ) {
return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, npc_mob, mob, nullptr, nullptr); return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, npc_mob, mob, nullptr, nullptr, nullptr);
} else if (quest_type == QuestType::Item || quest_type == QuestType::ItemGlobal) { } else if (quest_type == QuestType::Item || quest_type == QuestType::ItemGlobal) {
return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, mob, mob, inst, nullptr); return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, mob, mob, inst, nullptr, nullptr);
} else if (quest_type == QuestType::Spell || quest_type == QuestType::SpellGlobal) { } else if (quest_type == QuestType::Spell || quest_type == QuestType::SpellGlobal) {
if (mob) { if (mob) {
return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, mob, mob, nullptr, spell); return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, mob, mob, nullptr, spell, nullptr);
} else { } else {
return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, npc_mob, mob, nullptr, spell); return SendCommands(package_name.c_str(), QuestEventSubroutines[event_id], 0, npc_mob, mob, nullptr, spell, nullptr);
} }
} else if (quest_type == QuestType::NPC || quest_type == QuestType::NPCGlobal) { } else if (quest_type == QuestType::NPC || quest_type == QuestType::NPCGlobal) {
return SendCommands( return SendCommands(
@ -377,8 +381,20 @@ int PerlembParser::EventCommon(
npc_mob, npc_mob,
mob, mob,
nullptr, nullptr,
nullptr,
nullptr nullptr
); );
} else if (quest_type == QuestType::Zone || quest_type == QuestType::ZoneGlobal) {
return SendCommands(
package_name.c_str(),
QuestEventSubroutines[event_id],
0,
nullptr,
nullptr,
nullptr,
nullptr,
zone
);
} }
} }
@ -972,7 +988,8 @@ int PerlembParser::SendCommands(
Mob* other, Mob* other,
Mob* mob, Mob* mob,
EQ::ItemInstance* inst, EQ::ItemInstance* inst,
const SPDat_Spell_Struct* spell const SPDat_Spell_Struct* spell,
Zone* zone
) )
{ {
if (!perl) { if (!perl) {
@ -980,12 +997,20 @@ int PerlembParser::SendCommands(
} }
int ret_value = 0; int ret_value = 0;
QuestManager::RunningQuest q;
if (mob && mob->IsClient()) { if (mob && mob->IsClient()) {
quest_manager.StartQuest(other, mob->CastToClient(), inst, spell); q.owner = other;
} else { q.initiator = mob->CastToClient();
quest_manager.StartQuest(other); q.questitem = inst;
q.questspell = spell;
} }
if (zone) {
q.zone = zone;
}
quest_manager.StartQuest(q);
try { try {
perl->eval(fmt::format("package {};", prefix).c_str()); perl->eval(fmt::format("package {};", prefix).c_str());
@ -1024,21 +1049,23 @@ int PerlembParser::SendCommands(
sv_setsv(client, _empty_sv); sv_setsv(client, _empty_sv);
} }
if (other->IsBot()) { if (other) {
Bot* b = quest_manager.GetBot(); if (other->IsBot()) {
buf = fmt::format("{}::bot", prefix); Bot* b = quest_manager.GetBot();
SV* bot = get_sv(buf.c_str(), true); buf = fmt::format("{}::bot", prefix);
sv_setref_pv(bot, "Bot", b); SV* bot = get_sv(buf.c_str(), true);
} else if (other->IsMerc()) { sv_setref_pv(bot, "Bot", b);
Merc* m = quest_manager.GetMerc(); } else if (other->IsMerc()) {
buf = fmt::format("{}::merc", prefix); Merc* m = quest_manager.GetMerc();
SV* merc = get_sv(buf.c_str(), true); buf = fmt::format("{}::merc", prefix);
sv_setref_pv(merc, "Merc", m); SV* merc = get_sv(buf.c_str(), true);
} else if (other->IsNPC()) { sv_setref_pv(merc, "Merc", m);
NPC* n = quest_manager.GetNPC(); } else if (other->IsNPC()) {
buf = fmt::format("{}::npc", prefix); NPC* n = quest_manager.GetNPC();
SV* npc = get_sv(buf.c_str(), true); buf = fmt::format("{}::npc", prefix);
sv_setref_pv(npc, "NPC", n); SV* npc = get_sv(buf.c_str(), true);
sv_setref_pv(npc, "NPC", n);
}
} }
//only export QuestItem if it's an inst quest //only export QuestItem if it's an inst quest
@ -2724,7 +2751,7 @@ void PerlembParser::LoadGlobalZoneScript(std::string filename)
} catch (std::string e) { } catch (std::string e) {
AddError( AddError(
fmt::format( fmt::format(
"Error Compiling Global Zone uest File [{}] Error [{}]", "Error Compiling Global Zone Quest File [{}] Error [{}]",
filename, filename,
e e
) )

View File

@ -232,7 +232,8 @@ private:
Mob* other, Mob* other,
Mob* mob, Mob* mob,
EQ::ItemInstance* inst, EQ::ItemInstance* inst,
const SPDat_Spell_Struct* spell const SPDat_Spell_Struct* spell,
Zone* zone
); );
void MapFunctions(); void MapFunctions();

View File

@ -489,7 +489,13 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
arg_function(this, L, npc, init, data, extra_data, extra_pointers); arg_function(this, L, npc, init, data, extra_data, extra_pointers);
Client *c = (init && init->IsClient()) ? init->CastToClient() : nullptr; Client *c = (init && init->IsClient()) ? init->CastToClient() : nullptr;
quest_manager.StartQuest(npc, c); QuestManager::RunningQuest q;
q.owner = npc;
q.initiator = c;
quest_manager.StartQuest(q);
if(lua_pcall(L, 1, 1, start + 1)) { if(lua_pcall(L, 1, 1, start + 1)) {
std::string error = lua_tostring(L, -1); std::string error = lua_tostring(L, -1);
AddError(error); AddError(error);
@ -582,7 +588,13 @@ int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client *
auto arg_function = PlayerArgumentDispatch[evt]; auto arg_function = PlayerArgumentDispatch[evt];
arg_function(this, L, client, data, extra_data, extra_pointers); arg_function(this, L, client, data, extra_data, extra_pointers);
quest_manager.StartQuest(client, client); QuestManager::RunningQuest q;
q.owner = client;
q.initiator = client;
quest_manager.StartQuest(q);
if(lua_pcall(L, 1, 1, start + 1)) { if(lua_pcall(L, 1, 1, start + 1)) {
std::string error = lua_tostring(L, -1); std::string error = lua_tostring(L, -1);
AddError(error); AddError(error);
@ -666,7 +678,14 @@ int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *cl
auto arg_function = ItemArgumentDispatch[evt]; auto arg_function = ItemArgumentDispatch[evt];
arg_function(this, L, client, item, mob, data, extra_data, extra_pointers); arg_function(this, L, client, item, mob, data, extra_data, extra_pointers);
quest_manager.StartQuest(client, client, item); QuestManager::RunningQuest q;
q.owner = client;
q.initiator = client;
q.questitem = item;
quest_manager.StartQuest(q);
if(lua_pcall(L, 1, 1, start + 1)) { if(lua_pcall(L, 1, 1, start + 1)) {
std::string error = lua_tostring(L, -1); std::string error = lua_tostring(L, -1);
AddError(error); AddError(error);
@ -748,7 +767,14 @@ int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, Mob* mob,
auto arg_function = SpellArgumentDispatch[evt]; auto arg_function = SpellArgumentDispatch[evt];
arg_function(this, L, mob, client, spell_id, data, extra_data, extra_pointers); arg_function(this, L, mob, client, spell_id, data, extra_data, extra_pointers);
quest_manager.StartQuest(mob, client, nullptr, const_cast<SPDat_Spell_Struct*>(&spells[spell_id])); QuestManager::RunningQuest q;
q.owner = client;
q.initiator = client;
q.questspell = const_cast<SPDat_Spell_Struct*>(&spells[spell_id]);
quest_manager.StartQuest(q);
if(lua_pcall(L, 1, 1, start + 1)) { if(lua_pcall(L, 1, 1, start + 1)) {
std::string error = lua_tostring(L, -1); std::string error = lua_tostring(L, -1);
AddError(error); AddError(error);
@ -814,7 +840,13 @@ int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::
auto arg_function = EncounterArgumentDispatch[evt]; auto arg_function = EncounterArgumentDispatch[evt];
arg_function(this, L, enc, data, extra_data, extra_pointers); arg_function(this, L, enc, data, extra_data, extra_pointers);
quest_manager.StartQuest(enc, nullptr, nullptr, nullptr, encounter_name); QuestManager::RunningQuest q;
q.owner = enc;
q.encounter = encounter_name;
quest_manager.StartQuest(q);
if(lua_pcall(L, 1, 1, start + 1)) { if(lua_pcall(L, 1, 1, start + 1)) {
std::string error = lua_tostring(L, -1); std::string error = lua_tostring(L, -1);
AddError(error); AddError(error);
@ -1757,7 +1789,13 @@ int LuaParser::_EventBot(
arg_function(this, L, bot, init, data, extra_data, extra_pointers); arg_function(this, L, bot, init, data, extra_data, extra_pointers);
auto* c = (init && init->IsClient()) ? init->CastToClient() : nullptr; auto* c = (init && init->IsClient()) ? init->CastToClient() : nullptr;
quest_manager.StartQuest(bot, c); QuestManager::RunningQuest q;
q.owner = bot;
q.initiator = c;
quest_manager.StartQuest(q);
if(lua_pcall(L, 1, 1, start + 1)) { if(lua_pcall(L, 1, 1, start + 1)) {
std::string error = lua_tostring(L, -1); std::string error = lua_tostring(L, -1);
AddError(error); AddError(error);
@ -1936,7 +1974,13 @@ int LuaParser::_EventMerc(
arg_function(this, L, merc, init, data, extra_data, extra_pointers); arg_function(this, L, merc, init, data, extra_data, extra_pointers);
auto* c = (init && init->IsClient()) ? init->CastToClient() : nullptr; auto* c = (init && init->IsClient()) ? init->CastToClient() : nullptr;
quest_manager.StartQuest(merc, c); QuestManager::RunningQuest q;
q.owner = merc;
q.initiator = c;
quest_manager.StartQuest(q);
if(lua_pcall(L, 1, 1, start + 1)) { if(lua_pcall(L, 1, 1, start + 1)) {
std::string error = lua_tostring(L, -1); std::string error = lua_tostring(L, -1);
AddError(error); AddError(error);

View File

@ -87,6 +87,7 @@ void QuestParserCollection::ReloadQuests(bool reset_timers)
{ {
if (reset_timers) { if (reset_timers) {
quest_manager.ClearAllTimers(); quest_manager.ClearAllTimers();
zone->StopAllTimers();
} }
MapOpcodes(); MapOpcodes();

View File

@ -64,10 +64,10 @@ QuestManager quest_manager;
EQ::ItemInstance* questitem = nullptr; \ EQ::ItemInstance* questitem = nullptr; \
const SPDat_Spell_Struct* questspell = nullptr; \ const SPDat_Spell_Struct* questspell = nullptr; \
bool depop_npc = false; \ bool depop_npc = false; \
std::string encounter; \ std::string encounter = ""; \
do { \ do { \
if(!quests_running_.empty()) { \ if(!m_running_quests.empty()) { \
running_quest e = quests_running_.top(); \ RunningQuest e = m_running_quests.top(); \
owner = e.owner; \ owner = e.owner; \
initiator = e.initiator; \ initiator = e.initiator; \
questitem = e.questitem; \ questitem = e.questitem; \
@ -124,33 +124,34 @@ void QuestManager::Process() {
} }
} }
void QuestManager::StartQuest(Mob *_owner, Client *_initiator, EQ::ItemInstance* _questitem, const SPDat_Spell_Struct* _questspell, std::string encounter) { void QuestManager::StartQuest(RunningQuest q)
running_quest run; {
run.owner = _owner; m_running_quests.push(q);
run.initiator = _initiator;
run.questitem = _questitem;
run.questspell = _questspell;
run.depop_npc = false;
run.encounter = encounter;
quests_running_.push(run);
} }
void QuestManager::EndQuest() { void QuestManager::EndQuest() {
running_quest run = quests_running_.top(); RunningQuest run = m_running_quests.top();
if(run.depop_npc && run.owner->IsNPC()) {
if (run.depop_npc && run.owner->IsNPC()) {
//clear out any timers for them... //clear out any timers for them...
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end; std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
end = QTimerList.end(); end = QTimerList.end();
while (cur != end) { while (cur != end) {
if (cur->mob == run.owner) if (cur->mob == run.owner) {
cur = QTimerList.erase(cur); cur = QTimerList.erase(cur);
else } else {
++cur; ++cur;
}
} }
run.owner->Depop(); run.owner->Depop();
} }
quests_running_.pop();
if (run.zone && run.zone == zone) {
zone->StopAllTimers();
}
m_running_quests.pop();
} }
void QuestManager::ClearAllTimers() { void QuestManager::ClearAllTimers() {
@ -1098,18 +1099,18 @@ void QuestManager::depop(int npc_type) {
tmp->CastToNPC()->Depop(); tmp->CastToNPC()->Depop();
} }
else { else {
running_quest e = quests_running_.top(); RunningQuest e = m_running_quests.top();
e.depop_npc = true; e.depop_npc = true;
quests_running_.pop(); m_running_quests.pop();
quests_running_.push(e); m_running_quests.push(e);
} }
} }
} }
else { //depop self else { //depop self
running_quest e = quests_running_.top(); RunningQuest e = m_running_quests.top();
e.depop_npc = true; e.depop_npc = true;
quests_running_.pop(); m_running_quests.pop();
quests_running_.push(e); m_running_quests.push(e);
} }
} }
} }
@ -1606,7 +1607,7 @@ void QuestManager::save() {
void QuestManager::faction(int faction_id, int faction_value, int temp) { void QuestManager::faction(int faction_id, int faction_value, int temp) {
QuestManagerCurrentQuestVars(); QuestManagerCurrentQuestVars();
running_quest run = quests_running_.top(); RunningQuest run = m_running_quests.top();
if(run.owner->IsCharmed() == false && initiator) { if(run.owner->IsCharmed() == false && initiator) {
if(faction_id != 0 && faction_value != 0) { if(faction_id != 0 && faction_value != 0) {
initiator->SetFactionLevel2( initiator->SetFactionLevel2(
@ -2077,10 +2078,10 @@ void QuestManager::respawn(int npcTypeID, int grid) {
if (!owner || !owner->IsNPC()) if (!owner || !owner->IsNPC())
return; return;
running_quest e = quests_running_.top(); RunningQuest e = m_running_quests.top();
e.depop_npc = true; e.depop_npc = true;
quests_running_.pop(); m_running_quests.pop();
quests_running_.push(e); m_running_quests.push(e);
const NPCType* npcType = nullptr; const NPCType* npcType = nullptr;
if ((npcType = content_db.LoadNPCTypesData(npcTypeID))) if ((npcType = content_db.LoadNPCTypesData(npcTypeID)))
@ -3980,81 +3981,90 @@ void QuestManager::ReloadZoneStaticData()
} }
} }
Client *QuestManager::GetInitiator() const { Client* QuestManager::GetInitiator() const
if(!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return e.initiator; return e.initiator;
} }
return nullptr; return nullptr;
} }
NPC *QuestManager::GetNPC() const { NPC* QuestManager::GetNPC() const
if(!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return (e.owner && e.owner->IsNPC()) ? e.owner->CastToNPC() : nullptr; return (e.owner && e.owner->IsNPC()) ? e.owner->CastToNPC() : nullptr;
} }
return nullptr; return nullptr;
} }
Bot *QuestManager::GetBot() const { Bot* QuestManager::GetBot() const
if (!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return (e.owner && e.owner->IsBot()) ? e.owner->CastToBot() : nullptr; return (e.owner && e.owner->IsBot()) ? e.owner->CastToBot() : nullptr;
} }
return nullptr; return nullptr;
} }
Merc *QuestManager::GetMerc() const { Merc* QuestManager::GetMerc() const
if (!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return (e.owner && e.owner->IsMerc()) ? e.owner->CastToMerc() : nullptr; return (e.owner && e.owner->IsMerc()) ? e.owner->CastToMerc() : nullptr;
} }
return nullptr; return nullptr;
} }
Mob *QuestManager::GetOwner() const { Mob* QuestManager::GetOwner() const
if(!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return e.owner; return e.owner;
} }
return nullptr; return nullptr;
} }
EQ::InventoryProfile *QuestManager::GetInventory() const { EQ::InventoryProfile* QuestManager::GetInventory() const
if(!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return &e.initiator->GetInv(); return &e.initiator->GetInv();
} }
return nullptr; return nullptr;
} }
EQ::ItemInstance *QuestManager::GetQuestItem() const { EQ::ItemInstance* QuestManager::GetQuestItem() const
if(!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return e.questitem; return e.questitem;
} }
return nullptr; return nullptr;
} }
const SPDat_Spell_Struct *QuestManager::GetQuestSpell() { const SPDat_Spell_Struct* QuestManager::GetQuestSpell()
if(!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return e.questspell; return e.questspell;
} }
return nullptr; return nullptr;
} }
std::string QuestManager::GetEncounter() const { std::string QuestManager::GetEncounter() const
if(!quests_running_.empty()) { {
running_quest e = quests_running_.top(); if (!m_running_quests.empty()) {
RunningQuest e = m_running_quests.top();
return e.encounter; return e.encounter;
} }

View File

@ -34,14 +34,6 @@ namespace EQ
} }
class QuestManager { class QuestManager {
struct running_quest {
Mob *owner;
Client *initiator;
EQ::ItemInstance* questitem;
const SPDat_Spell_Struct* questspell;
bool depop_npc;
std::string encounter;
};
struct PausedTimer { struct PausedTimer {
Mob* owner; Mob* owner;
@ -49,12 +41,23 @@ class QuestManager {
uint32 time; uint32 time;
}; };
public: public:
struct RunningQuest {
Mob *owner = nullptr;
Client *initiator = nullptr;
EQ::ItemInstance* questitem = nullptr;
const SPDat_Spell_Struct* questspell = nullptr;
bool depop_npc = false;
std::string encounter = "";
Zone* zone = nullptr;
};
QuestManager(); QuestManager();
virtual ~QuestManager(); virtual ~QuestManager();
void StartQuest(Mob *_owner, Client *_initiator = nullptr, EQ::ItemInstance* _questitem = nullptr, const SPDat_Spell_Struct* _questspell = nullptr, std::string encounter = ""); void StartQuest(RunningQuest q);
void EndQuest(); void EndQuest();
bool QuestsRunning() { return !quests_running_.empty(); } bool QuestsRunning() { return !m_running_quests.empty(); }
void Process(); void Process();
@ -381,7 +384,7 @@ public:
bool handin(std::map<std::string, uint32> required); bool handin(std::map<std::string, uint32> required);
private: private:
std::stack<running_quest> quests_running_; std::stack<RunningQuest> m_running_quests;
bool HaveProximitySays; bool HaveProximitySays;

View File

@ -1696,7 +1696,6 @@ bool Zone::Process() {
const bool has_timer_event = parse->ZoneHasQuestSub(EVENT_TIMER); const bool has_timer_event = parse->ZoneHasQuestSub(EVENT_TIMER);
for (auto e : zone_timers) { for (auto e : zone_timers) {
LogError("has_timer_event [{}]", has_timer_event ? "y" : "n");
if (e.timer_.Enabled() && e.timer_.Check()) { if (e.timer_.Enabled() && e.timer_.Check()) {
if (has_timer_event) { if (has_timer_event) {
parse->EventZone(EVENT_TIMER, this, e.name); parse->EventZone(EVENT_TIMER, this, e.name);
@ -1946,6 +1945,8 @@ void Zone::Repop(bool is_forced)
quest_manager.ClearAllTimers(); quest_manager.ClearAllTimers();
StopAllTimers();
LogInfo("Loading spawn groups"); LogInfo("Loading spawn groups");
if (!content_db.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { if (!content_db.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) {
LogError("Loading spawn groups failed"); LogError("Loading spawn groups failed");
@ -3457,7 +3458,8 @@ void Zone::SetTimer(std::string name, uint32 duration)
zone_timers.emplace_back(ZoneTimer(name, duration)); zone_timers.emplace_back(ZoneTimer(name, duration));
if (parse->ZoneHasQuestSub(EVENT_TIMER_START)) { if (parse->ZoneHasQuestSub(EVENT_TIMER_START)) {
parse->EventZone(EVENT_TIMER_START, this, name); const std::string& export_string = fmt::format("{} {}", name, duration);
parse->EventZone(EVENT_TIMER_START, this, export_string);
} }
} }
@ -3483,6 +3485,10 @@ void Zone::StopTimer(std::string name)
void Zone::StopAllTimers() void Zone::StopAllTimers()
{ {
if (!IsLoaded()) {
return;
}
if (zone_timers.empty()) { if (zone_timers.empty()) {
return; return;
} }
@ -3493,8 +3499,6 @@ void Zone::StopAllTimers()
if (has_stop_event) { if (has_stop_event) {
parse->EventZone(EVENT_TIMER_STOP, this, e->name); parse->EventZone(EVENT_TIMER_STOP, this, e->name);
} }
e = zone_timers.erase(e);
} }
} }