[Quest API] Add GetNPCAggro() and SetNPCAggro() to Perl/Lua (#3781)

* [Quest API] Add GetNPCAggro() and SetNPCAggro() to Perl/Lua

# Perl
- Add `$npc->GetNPCAggro()`.
- Add `$npc->SetNPCAggro(in_npc_aggro)`.

# Lua
- Add `npc:GetNPCAggro()`.
- Add `npc:SetNPCAggro(in_npc_aggro)`.

# Notes
- Allows operators to enable or disable an NPC's NPC aggro capability dynamically.

* Update api_service.cpp
This commit is contained in:
Alex King
2023-12-17 20:34:06 -05:00
committed by GitHub
parent d3b46becd0
commit 2cd3d27c67
7 changed files with 36 additions and 6 deletions
+3 -3
View File
@@ -448,7 +448,7 @@ void Mob::AI_Start(uint32 iMoveDelay) {
hate_list_cleanup_timer.Disable();
}
if (CastToNPC()->WillAggroNPCs())
if (CastToNPC()->GetNPCAggro())
AI_scan_area_timer = std::make_unique<Timer>(RandomTimer(RuleI(NPC, NPCToNPCAggroTimerMin), RuleI(NPC, NPCToNPCAggroTimerMax)));
AI_check_signal_timer = std::make_unique<Timer>(AI_check_signal_timer_delay);
@@ -1066,7 +1066,7 @@ void Mob::AI_Process() {
IsNPC() &&
!CastToNPC()->GetSwarmInfo() &&
(!IsPet() || (HasOwner() && GetOwner()->IsNPC())) &&
!CastToNPC()->WillAggroNPCs()
!CastToNPC()->GetNPCAggro()
) {
WipeHateList(true); // wipe NPCs from hate list to prevent faction war
}
@@ -1386,7 +1386,7 @@ void Mob::AI_Process() {
StopNavigation();
}
}
else if (zone->CanDoCombat() && CastToNPC()->WillAggroNPCs() && AI_scan_area_timer->Check()) {
else if (zone->CanDoCombat() && CastToNPC()->GetNPCAggro() && AI_scan_area_timer->Check()) {
/**
* NPC to NPC aggro (npc_aggro flag set)