mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
[Quest API] (Performance) Check event EVENT_WAYPOINT_ARRIVE or EVENT_WAYPOINT_DEPART exist before export and execute (#2905)
* [Quest API] Optionally parse EVENT_WAYPOINT_ARRIVE and EVENT_WAYPOINT_DEPART # Notes - Optionally parse these events instead of always doing so. * [Quest API] Optionally parse EVENT_WARP # Notes - Optionally parse this event instead of always doing so. * Revert "[Quest API] Optionally parse EVENT_WARP" This reverts commit d8acb9883d5547ab473391d2e8639f923a486cef.
This commit is contained in:
parent
90def9b882
commit
57d0420399
@ -1753,9 +1753,10 @@ void NPC::AI_DoMovement() {
|
|||||||
RotateTo(m_CurrentWayPoint.w);
|
RotateTo(m_CurrentWayPoint.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
//kick off event_waypoint arrive
|
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_WAYPOINT_ARRIVE)) {
|
||||||
std::string export_string = fmt::format("{}", cur_wp);
|
parse->EventNPC(EVENT_WAYPOINT_ARRIVE, CastToNPC(), nullptr, std::to_string(cur_wp), 0);
|
||||||
parse->EventNPC(EVENT_WAYPOINT_ARRIVE, CastToNPC(), nullptr, export_string, 0);
|
}
|
||||||
|
|
||||||
// No need to move as we are there. Next loop will
|
// No need to move as we are there. Next loop will
|
||||||
// take care of normal grids, even at pause 0.
|
// take care of normal grids, even at pause 0.
|
||||||
// We do need to call and setup a wp if we're cur_wp=-2
|
// We do need to call and setup a wp if we're cur_wp=-2
|
||||||
@ -1871,9 +1872,9 @@ void NPC::AI_SetupNextWaypoint() {
|
|||||||
entity_list.OpenDoorsNear(this);
|
entity_list.OpenDoorsNear(this);
|
||||||
|
|
||||||
if (!DistractedFromGrid) {
|
if (!DistractedFromGrid) {
|
||||||
//kick off event_waypoint depart
|
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_WAYPOINT_DEPART)) {
|
||||||
std::string export_string = fmt::format("{}", cur_wp);
|
parse->EventNPC(EVENT_WAYPOINT_DEPART, CastToNPC(), nullptr, std::to_string(cur_wp), 0);
|
||||||
parse->EventNPC(EVENT_WAYPOINT_DEPART, CastToNPC(), nullptr, export_string, 0);
|
}
|
||||||
|
|
||||||
//setup our next waypoint, if we are still on our normal grid
|
//setup our next waypoint, if we are still on our normal grid
|
||||||
//remember that the quest event above could have done anything it wanted with our grid
|
//remember that the quest event above could have done anything it wanted with our grid
|
||||||
|
|||||||
@ -165,10 +165,12 @@ void NPC::ResumeWandering()
|
|||||||
|
|
||||||
if (m_CurrentWayPoint.x == GetX() && m_CurrentWayPoint.y == GetY())
|
if (m_CurrentWayPoint.x == GetX() && m_CurrentWayPoint.y == GetY())
|
||||||
{ // are we we at a waypoint? if so, trigger event and start to next
|
{ // are we we at a waypoint? if so, trigger event and start to next
|
||||||
std::string export_string = fmt::format("{}", cur_wp);
|
|
||||||
CalculateNewWaypoint();
|
CalculateNewWaypoint();
|
||||||
SetAppearance(eaStanding, false);
|
SetAppearance(eaStanding, false);
|
||||||
parse->EventNPC(EVENT_WAYPOINT_DEPART, this, nullptr, export_string, 0);
|
|
||||||
|
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_WAYPOINT_DEPART)) {
|
||||||
|
parse->EventNPC(EVENT_WAYPOINT_DEPART, this, nullptr, std::to_string(cur_wp), 0);
|
||||||
|
}
|
||||||
} // if not currently at a waypoint, we continue on to the one we were headed to before the stop
|
} // if not currently at a waypoint, we continue on to the one we were headed to before the stop
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user