mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Quest API] (Performance) Check event EVENT_AGGRO, EVENT_ATTACK, or EVENT_COMBAT exist before export and execute (#2901)
* [Quest API] Optionally parse EVENT_COMBAT # Notes - Optionally parse this event instead of always doing so. * Optional EVENT_ATTACK * Update attack.cpp
This commit is contained in:
+15
-4
@@ -1923,7 +1923,10 @@ void Mob::AI_Event_Engaged(Mob *attacker, bool yell_for_help)
|
||||
//if the target dies before it goes off
|
||||
if (attacker->GetHP() > 0) {
|
||||
if (!CastToNPC()->GetCombatEvent() && GetHP() > 0) {
|
||||
parse->EventNPC(EVENT_COMBAT, CastToNPC(), attacker, "1", 0);
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_COMBAT)) {
|
||||
parse->EventNPC(EVENT_COMBAT, CastToNPC(), attacker, "1", 0);
|
||||
}
|
||||
|
||||
auto emote_id = GetEmoteID();
|
||||
if (emote_id) {
|
||||
CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::EnterCombat, emoteid);
|
||||
@@ -1938,7 +1941,9 @@ void Mob::AI_Event_Engaged(Mob *attacker, bool yell_for_help)
|
||||
}
|
||||
|
||||
if (IsBot()) {
|
||||
parse->EventBot(EVENT_COMBAT, CastToBot(), attacker, "1", 0);
|
||||
if (parse->BotHasQuestSub(EVENT_COMBAT)) {
|
||||
parse->EventBot(EVENT_COMBAT, CastToBot(), attacker, "1", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1966,7 +1971,11 @@ void Mob::AI_Event_NoLongerEngaged() {
|
||||
if (CastToNPC()->GetCombatEvent() && GetHP() > 0) {
|
||||
if (entity_list.GetNPCByID(GetID())) {
|
||||
auto emote_id = CastToNPC()->GetEmoteID();
|
||||
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
|
||||
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_COMBAT)) {
|
||||
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
|
||||
}
|
||||
|
||||
if (emote_id) {
|
||||
CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::LeaveCombat, emoteid);
|
||||
}
|
||||
@@ -1976,7 +1985,9 @@ void Mob::AI_Event_NoLongerEngaged() {
|
||||
}
|
||||
}
|
||||
} else if (IsBot()) {
|
||||
parse->EventBot(EVENT_COMBAT, CastToBot(), nullptr, "0", 0);
|
||||
if (parse->BotHasQuestSub(EVENT_COMBAT)) {
|
||||
parse->EventBot(EVENT_COMBAT, CastToBot(), nullptr, "0", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user