mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 15:58:36 +00:00
[Quest API] Export target to EVENT_TARGET_CHANGE in Perl/Lua. (#2870)
* [Quest API] Export target to EVENT_TARGET_CHANGE in Perl/Lua. - Export `$target` to `EVENT_TARGET_CHANGE`. - Export `e.other` to `event_target_change`. - Allows operators to not have to grab bot, Client, or NPC's target in Perl with `GetTarget()`. - Allows operators to not have to grab Client's target in Lua with `GetTarget()`. * Update mob.cpp * Update mob.cpp * Update mob.cpp
This commit is contained in:
+28
-11
@@ -4259,19 +4259,36 @@ void Mob::SetTarget(Mob *mob)
|
||||
target = mob;
|
||||
entity_list.UpdateHoTT(this);
|
||||
|
||||
if (IsNPC()) {
|
||||
parse->EventNPC(EVENT_TARGET_CHANGE, CastToNPC(), mob, "", 0);
|
||||
}
|
||||
else if (IsClient()) {
|
||||
parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0);
|
||||
const auto has_target_change_event = (
|
||||
parse->HasQuestSub(GetNPCTypeID(), EVENT_TARGET_CHANGE) ||
|
||||
parse->PlayerHasQuestSub(EVENT_TARGET_CHANGE) ||
|
||||
parse->BotHasQuestSub(EVENT_TARGET_CHANGE)
|
||||
);
|
||||
|
||||
if (CastToClient()->admin > AccountStatus::GMMgmt) {
|
||||
DisplayInfo(mob);
|
||||
if (has_target_change_event) {
|
||||
std::vector<std::any> args;
|
||||
|
||||
args.emplace_back(mob);
|
||||
|
||||
if (IsNPC()) {
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_TARGET_CHANGE)) {
|
||||
parse->EventNPC(EVENT_TARGET_CHANGE, CastToNPC(), mob, "", 0, &args);
|
||||
}
|
||||
} else if (IsClient()) {
|
||||
if (parse->PlayerHasQuestSub(EVENT_TARGET_CHANGE)) {
|
||||
parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0, &args);
|
||||
}
|
||||
|
||||
if (CastToClient()->admin > AccountStatus::GMMgmt) {
|
||||
DisplayInfo(mob);
|
||||
}
|
||||
|
||||
CastToClient()->SetBotPrecombat(false); // Any change in target will nullify this flag (target == mob checked above)
|
||||
} else if (IsBot()) {
|
||||
if (parse->BotHasQuestSub(EVENT_TARGET_CHANGE)) {
|
||||
parse->EventBot(EVENT_TARGET_CHANGE, CastToBot(), mob, "", 0, &args);
|
||||
}
|
||||
}
|
||||
|
||||
CastToClient()->SetBotPrecombat(false); // Any change in target will nullify this flag (target == mob checked above)
|
||||
} else if (IsBot()) {
|
||||
parse->EventBot(EVENT_TARGET_CHANGE, CastToBot(), mob, "", 0);
|
||||
}
|
||||
|
||||
if (IsPet() && GetOwner() && GetOwner()->IsClient()) {
|
||||
|
||||
Reference in New Issue
Block a user