[Quest API] (Performance) Check event EVENT_PAYLOAD or EVENT_SIGNAL exist before export and execute (#2902)

* [Quest API] Optionally parse EVENT_PAYLOAD and EVENT_SIGNAL

# Notes
- Optionally parse these events instead of always doing so.

* Update bot.cpp
This commit is contained in:
Alex King
2023-02-12 23:28:50 -05:00
committed by GitHub
parent 4a339d49df
commit bad44f35e2
4 changed files with 25 additions and 12 deletions
+8 -4
View File
@@ -9224,14 +9224,18 @@ void Bot::SpawnBotGroupByName(Client* c, std::string botgroup_name, uint32 leade
void Bot::Signal(int signal_id)
{
const auto export_string = fmt::format("{}", signal_id);
parse->EventBot(EVENT_SIGNAL, this, nullptr, export_string, 0);
if (parse->BotHasQuestSub(EVENT_SIGNAL)) {
parse->EventBot(EVENT_SIGNAL, this, nullptr, std::to_string(signal_id), 0);
}
}
void Bot::SendPayload(int payload_id, std::string payload_value)
{
const auto export_string = fmt::format("{} {}", payload_id, payload_value);
parse->EventBot(EVENT_PAYLOAD, this, nullptr, export_string, 0);
if (parse->BotHasQuestSub(EVENT_PAYLOAD)) {
const auto& export_string = fmt::format("{} {}", payload_id, payload_value);
parse->EventBot(EVENT_PAYLOAD, this, nullptr, export_string, 0);
}
}
void Bot::OwnerMessage(std::string message)