Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-05-19 12:55:28 -06:00
committed by GitHub
80 changed files with 280 additions and 175 deletions

View File

@@ -423,7 +423,7 @@ void Unit::Update(uint32 p_time)
_UpdateSpells( p_time );
if (CanHaveThreatList() && getThreatMgr().isNeedUpdateToClient(p_time))
if (CanHaveThreatList() && GetThreatMgr().isNeedUpdateToClient(p_time))
SendThreatListUpdate();
// update combat timer only for players and pets (only pets with PetAI)
@@ -8916,7 +8916,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
if (victim && victim->IsAlive())
victim->getThreatMgr().modifyThreatPercent(this, -10);
victim->GetThreatMgr().modifyThreatPercent(this, -10);
basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
trigger_spell_id = 31616;
@@ -17961,7 +17961,18 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
StopMoving();
ToCreature()->AI()->OnCharmed(true);
if (charmer->GetTypeId() == TYPEID_PLAYER &&
charmer->getClass() == CLASS_WARLOCK)
{
// Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock
Creature* charmed = ToCreature();
charmed->NeedChangeAI = true;
charmed->IsAIEnabled = false;
}
else
{
ToCreature()->AI()->OnCharmed(true);
}
// Xinef: If creature can fly, add normal player flying flag (fixes speed)
if (charmer->GetTypeId() == TYPEID_PLAYER && ToCreature()->CanFly())
@@ -18590,8 +18601,8 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
// modify threat lists for new phasemask
if (GetTypeId() != TYPEID_PLAYER)
{
ThreatContainer::StorageType threatList = getThreatMgr().getThreatList();
ThreatContainer::StorageType offlineThreatList = getThreatMgr().getOfflineThreatList();
ThreatContainer::StorageType threatList = GetThreatMgr().getThreatList();
ThreatContainer::StorageType offlineThreatList = GetThreatMgr().getOfflineThreatList();
// merge expects sorted lists
threatList.sort();
@@ -19542,15 +19553,15 @@ void Unit::UpdateHeight(float newZ)
void Unit::SendThreatListUpdate()
{
if (!getThreatMgr().isThreatListEmpty())
if (!GetThreatMgr().isThreatListEmpty())
{
uint32 count = getThreatMgr().getThreatList().size();
uint32 count = GetThreatMgr().getThreatList().size();
//LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data << GetPackGUID();
data << uint32(count);
ThreatContainer::StorageType const& tlist = getThreatMgr().getThreatList();
ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data << (*itr)->getUnitGuid().WriteAsPacked();
@@ -19562,16 +19573,16 @@ void Unit::SendThreatListUpdate()
void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
{
if (!getThreatMgr().isThreatListEmpty())
if (!GetThreatMgr().isThreatListEmpty())
{
uint32 count = getThreatMgr().getThreatList().size();
uint32 count = GetThreatMgr().getThreatList().size();
LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
data << GetPackGUID();
data << pHostileReference->getUnitGuid().WriteAsPacked();
data << uint32(count);
ThreatContainer::StorageType const& tlist = getThreatMgr().getThreatList();
ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data << (*itr)->getUnitGuid().WriteAsPacked();

View File

@@ -2110,7 +2110,7 @@ public:
void DeleteThreatList();
void TauntApply(Unit* victim);
void TauntFadeOut(Unit* taunter);
ThreatMgr& getThreatMgr() { return m_ThreatMgr; }
ThreatMgr& GetThreatMgr() { return m_ThreatMgr; }
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefMgr.insertFirst(pHostileReference); };
void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ }
HostileRefMgr& getHostileRefMgr() { return m_HostileRefMgr; }