Skip to content

Commit

Permalink
[Quest API] (Performance) Check event exists before export and execut…
Browse files Browse the repository at this point in the history
…e EVENT_POPUP_RESPONSE (#2881)

# Notes
- Optionally parses this event instead of always doing so.
  • Loading branch information
Kinglykrab authored Feb 13, 2023
1 parent 9644f14 commit 9e16cd8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions zone/client_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11334,16 +11334,20 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app)
break;
}

const auto export_string = fmt::format("{}", popup_response->popupid);

parse->EventPlayer(EVENT_POPUP_RESPONSE, this, export_string, 0);
if (parse->PlayerHasQuestSub(EVENT_POPUP_RESPONSE)) {
parse->EventPlayer(EVENT_POPUP_RESPONSE, this, std::to_string(popup_response->popupid), 0);
}

auto t = GetTarget();
if (t) {
if (t->IsNPC()) {
parse->EventNPC(EVENT_POPUP_RESPONSE, t->CastToNPC(), this, export_string, 0);
if (parse->HasQuestSub(t->GetNPCTypeID(), EVENT_POPUP_RESPONSE)) {
parse->EventNPC(EVENT_POPUP_RESPONSE, t->CastToNPC(), this, std::to_string(popup_response->popupid), 0);
}
} else if (t->IsBot()) {
parse->EventBot(EVENT_POPUP_RESPONSE, t->CastToBot(), this, export_string, 0);
if (parse->BotHasQuestSub(EVENT_POPUP_RESPONSE)) {
parse->EventBot(EVENT_POPUP_RESPONSE, t->CastToBot(), this, std::to_string(popup_response->popupid), 0);
}
}
}
}
Expand Down

0 comments on commit 9e16cd8

Please sign in to comment.