[Quest API] (Performance) Check event EVENT_FEIGN_DEATH exists before export and execute (#2916)

* [Quest API] Optionally parse EVENT_FEIGN_DEATH

# Notes
- Optionally parse this event instead of always doing so.

* Remove unused reference, fix other PR

* Update task_client_state.cpp

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King 2023-02-12 23:59:14 -05:00 committed by GitHub
parent 9836b5cf67
commit de047fb851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 11 deletions

View File

@ -81,10 +81,10 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
position1.z position1.z
); );
parse->EventPlayer(EVENT_WARP, m_target, export_string, 0);; parse->EventPlayer(EVENT_WARP, m_target, export_string, 0);
} }
m_time_since_last_warp_detection.Start(2500) m_time_since_last_warp_detection.Start(2500);
} }
break; break;
case MQWarpShadowStep: case MQWarpShadowStep:

View File

@ -3662,15 +3662,18 @@ void EntityList::ClearFeignAggro(Mob *targ)
} }
if (targ->IsClient()) { if (targ->IsClient()) {
std::vector<std::any> args; if (parse->PlayerHasQuestSub(EVENT_FEIGN_DEATH)) {
args.push_back(it->second); std::vector<std::any> args = { it->second };
int i = parse->EventPlayer(EVENT_FEIGN_DEATH, targ->CastToClient(), "", 0, &args); int i = parse->EventPlayer(EVENT_FEIGN_DEATH, targ->CastToClient(), "", 0, &args);
if (i != 0) { if (i != 0) {
++it; ++it;
continue; continue;
} }
}
if (it->second->IsNPC()) { if (it->second->IsNPC()) {
if (parse->HasQuestSub(it->second->GetNPCTypeID(), EVENT_FEIGN_DEATH)) {
int i = parse->EventNPC(EVENT_FEIGN_DEATH, it->second->CastToNPC(), targ, "", 0); int i = parse->EventNPC(EVENT_FEIGN_DEATH, it->second->CastToNPC(), targ, "", 0);
if (i != 0) { if (i != 0) {
++it; ++it;
@ -3678,6 +3681,7 @@ void EntityList::ClearFeignAggro(Mob *targ)
} }
} }
} }
}
it->second->RemoveFromHateList(targ); it->second->RemoveFromHateList(targ);
if (targ->IsClient()) { if (targ->IsClient()) {

View File

@ -2203,6 +2203,7 @@ void ClientTaskState::AcceptNewTask(
}; };
RecordPlayerEventLogWithClient(client, PlayerEvent::TASK_ACCEPT, e); RecordPlayerEventLogWithClient(client, PlayerEvent::TASK_ACCEPT, e);
} }
}
if (parse->PlayerHasQuestSub(EVENT_TASK_ACCEPTED)) { if (parse->PlayerHasQuestSub(EVENT_TASK_ACCEPTED)) {
parse->EventPlayer(EVENT_TASK_ACCEPTED, client, std::to_string(task_id), 0); parse->EventPlayer(EVENT_TASK_ACCEPTED, client, std::to_string(task_id), 0);