From 0e51131d678fbc33aa071a78da13f110a5816290 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 12 Feb 2023 22:56:25 -0500 Subject: [PATCH] [Quest API] (Performance) Check event exists before export and execute EVENT_GROUP_CHANGE (#2884) * [Quest API] Optionally parse EVENT_GROUP_CHANGE # Notes - Optionally parse this event instead of always doing so. * Update embparser.cpp --- zone/embparser.cpp | 1 - zone/mob.cpp | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 48a22f4b9..bac16d42e 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -1746,7 +1746,6 @@ void PerlembParser::ExportEventVariables( break; } - case EVENT_SPELL_EFFECT_BUFF_TIC_BOT: case EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT: case EVENT_SPELL_EFFECT_BUFF_TIC_NPC: diff --git a/zone/mob.cpp b/zone/mob.cpp index dd1222a35..d7e5e5ac0 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -5355,32 +5355,35 @@ int16 Mob::GetCritDmgMod(uint16 skill, Mob* owner) void Mob::SetGrouped(bool v) { - if(v) - { + if (v) { israidgrouped = false; } + isgrouped = v; - if(IsClient()) - { + if (IsClient()) { + if (parse->PlayerHasQuestSub(EVENT_GROUP_CHANGE)) { parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0); + } - if(!v) + if (!v) { CastToClient()->RemoveGroupXTargets(); + } } } void Mob::SetRaidGrouped(bool v) { - if(v) - { + if (v) { isgrouped = false; } + israidgrouped = v; - if(IsClient()) - { - parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0); + if (IsClient()) { + if (parse->PlayerHasQuestSub(EVENT_GROUP_CHANGE)) { + parse->EventPlayer(EVENT_GROUP_CHANGE, CastToClient(), "", 0); + } } }