mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Combat: Some more sanity check asserts to try and track down #21187.
Also, some anti-annoyance treatment for dot tele.
(cherry picked from commit fdacf12739)
This commit is contained in:
@@ -125,6 +125,12 @@ void PvPCombatReference::SuppressFor(Unit* who)
|
||||
who->GetAI()->JustExitedCombat();
|
||||
}
|
||||
|
||||
CombatManager::~CombatManager()
|
||||
{
|
||||
ASSERT(_pveRefs.empty(), "CombatManager::~CombatManager - %s: we still have %zu PvE combat references, one of them is with %s", _owner->GetGUID().ToString().c_str(), _pveRefs.size(), _pveRefs.begin()->first.ToString().c_str());
|
||||
ASSERT(_pvpRefs.empty(), "CombatManager::~CombatManager - %s: we still have %zu PvP combat references, one of them is with %s", _owner->GetGUID().ToString().c_str(), _pvpRefs.size(), _pvpRefs.begin()->first.ToString().c_str());
|
||||
}
|
||||
|
||||
void CombatManager::Update(uint32 tdiff)
|
||||
{
|
||||
auto it = _pvpRefs.begin(), end = _pvpRefs.end();
|
||||
|
||||
@@ -100,6 +100,7 @@ class TC_GAME_API CombatManager
|
||||
static bool CanBeginCombat(Unit const* a, Unit const* b);
|
||||
|
||||
CombatManager(Unit* owner) : _owner(owner) { }
|
||||
~CombatManager();
|
||||
void Update(uint32 tdiff); // called from Unit::Update
|
||||
|
||||
Unit* GetOwner() const { return _owner; }
|
||||
|
||||
@@ -159,6 +159,13 @@ ThreatManager::ThreatManager(Unit* owner) : _owner(owner), _ownerCanHaveThreatLi
|
||||
_singleSchoolModifiers[i] = 1.0f;
|
||||
}
|
||||
|
||||
ThreatManager::~ThreatManager()
|
||||
{
|
||||
ASSERT(_myThreatListEntries.empty(), "ThreatManager::~ThreatManager - %s: we still have %zu things threatening us, one of them is %s.", _owner->GetGUID().ToString().c_str(), _myThreatListEntries.size(), _myThreatListEntries.begin()->first.ToString().c_str());
|
||||
ASSERT(_sortedThreatList.empty(), "ThreatManager::~ThreatManager - %s: we still have %zu things threatening us, one of them is %s.", _owner->GetGUID().ToString().c_str(), _sortedThreatList.size(), (*_sortedThreatList.begin())->GetVictim()->GetGUID().ToString().c_str());
|
||||
ASSERT(_threatenedByMe.empty(), "ThreatManager::~ThreatManager - %s: we are still threatening %zu things, one of them is %s.", _owner->GetGUID().ToString().c_str(), _threatenedByMe.size(), _threatenedByMe.begin()->first.ToString().c_str());
|
||||
}
|
||||
|
||||
void ThreatManager::Initialize()
|
||||
{
|
||||
_ownerCanHaveThreatList = ThreatManager::CanHaveThreatList(_owner);
|
||||
|
||||
@@ -89,6 +89,7 @@ class TC_GAME_API ThreatManager
|
||||
static bool CanHaveThreatList(Unit const* who);
|
||||
|
||||
ThreatManager(Unit* owner);
|
||||
~ThreatManager();
|
||||
// called from ::Create methods just after construction (once all fields on owner have been populated)
|
||||
// should not be called from anywhere else
|
||||
void Initialize();
|
||||
|
||||
@@ -9968,7 +9968,6 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
|
||||
|
||||
m_Events.KillAllEvents(false); // non-delatable (currently cast spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
|
||||
CombatStop();
|
||||
GetThreatManager().ClearAllThreat();
|
||||
}
|
||||
|
||||
void Unit::CleanupsBeforeDelete(bool finalCleanup)
|
||||
|
||||
@@ -307,7 +307,6 @@ public:
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
|
||||
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
@@ -315,7 +314,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (me->IsInCombat())
|
||||
if (me->IsInCombat() && !handler->GetSession()->HasPermission(rbac::RBAC_PERM_COMMAND_TELE_NAME))
|
||||
{
|
||||
handler->SendSysMessage(LANG_YOU_IN_COMBAT);
|
||||
handler->SetSentErrorMessage(true);
|
||||
|
||||
Reference in New Issue
Block a user