aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2019-06-23 00:32:13 +0200
committerTreeston <treeston.mmoc@gmail.com>2019-06-23 00:32:13 +0200
commitdbe3bbefe734f8824e8f07c302e256f0d446b974 (patch)
tree9c6e801e779b752bf15512c7bfac9efea7c5c8ff /src/server/scripts
parentc06330acf2b307604c97bdd7ad5dfd34b97bbf23 (diff)
Core/Entities: Kick engagement logic upstairs to Unit (from ThreatManager), since all Units with AI need it (not just those with threat list). Fixes #17981.
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 9e54c1986e7..ac1c9570e80 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -863,17 +863,17 @@ public:
ThreatManager& mgr = target->GetThreatManager();
if (!target->IsAlive())
{
- handler->PSendSysMessage("%s (guid %u) is not alive.", target->GetName().c_str(), target->GetGUID().GetCounter());
+ handler->PSendSysMessage("%s (GUID %u) is not alive.", target->GetName().c_str(), target->GetGUID().GetCounter());
return true;
}
uint32 count = 0;
auto const& threatenedByMe = target->GetThreatManager().GetThreatenedByMeList();
if (threatenedByMe.empty())
- handler->PSendSysMessage("%s (guid %u) does not threaten any units.", target->GetName().c_str(), target->GetGUID().GetCounter());
+ handler->PSendSysMessage("%s (GUID %u) does not threaten any units.", target->GetName().c_str(), target->GetGUID().GetCounter());
else
{
- handler->PSendSysMessage("List of units threatened by %s (guid %u)", target->GetName().c_str(), target->GetGUID().GetCounter());
+ handler->PSendSysMessage("List of units threatened by %s (GUID %u)", target->GetName().c_str(), target->GetGUID().GetCounter());
for (auto const& pair : threatenedByMe)
{
Unit* unit = pair.second->GetOwner();
@@ -886,7 +886,7 @@ public:
{
if (!mgr.IsThreatListEmpty(true))
{
- if (mgr.IsEngaged())
+ if (target->IsEngaged())
handler->PSendSysMessage("Threat list of %s (GUID %u, SpawnID %u):", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0);
else
handler->PSendSysMessage("%s (GUID %u, SpawnID %u) is not engaged, but still has a threat list? Well, here it is:", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0);
@@ -927,13 +927,15 @@ public:
}
handler->SendSysMessage("End of threat list.");
}
- else if (!mgr.IsEngaged())
+ else if (!target->IsEngaged())
handler->PSendSysMessage("%s (GUID %u, SpawnID %u) is not currently engaged.", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0);
else
handler->PSendSysMessage("%s (GUID %u, SpawnID %u) seems to be engaged, but does not have a threat list??", target->GetName().c_str(), target->GetGUID().GetCounter(), target->GetTypeId() == TYPEID_UNIT ? target->ToCreature()->GetSpawnId() : 0);
}
+ else if (target->IsEngaged())
+ handler->PSendSysMessage("%s (GUID %u) is currently engaged. (This unit cannot have a threat list.)", target->GetName().c_str(), target->GetGUID().GetCounter());
else
- handler->PSendSysMessage("%s (GUID %u) cannot have a threat list.", target->GetName().c_str(), target->GetGUID().GetCounter());
+ handler->PSendSysMessage("%s (GUID %u) is not currently engaged. (This unit cannot have a threat list.)", target->GetName().c_str(), target->GetGUID().GetCounter());
return true;
}