mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-02 10:33:46 +00:00
Merge branch 'azerothcore:master' into Playerbot
This commit is contained in:
@@ -316,6 +316,8 @@ Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject),
|
||||
|
||||
_oldFactionId = 0;
|
||||
|
||||
_isWalkingBeforeCharm = false;
|
||||
|
||||
_lastExtraAttackSpell = 0;
|
||||
}
|
||||
|
||||
@@ -10482,8 +10484,12 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
|
||||
LOG_FATAL("entities.unit", "Unit {} is being charmed, but it already has a charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
|
||||
|
||||
if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
|
||||
_isWalkingBeforeCharm = charm->IsWalking();
|
||||
if (_isWalkingBeforeCharm)
|
||||
{
|
||||
charm->SetWalk(false);
|
||||
charm->SendMovementFlagUpdate();
|
||||
}
|
||||
|
||||
m_Controlled.insert(charm);
|
||||
}
|
||||
@@ -10521,6 +10527,12 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
|
||||
}
|
||||
|
||||
if (charm->IsWalking() != _isWalkingBeforeCharm)
|
||||
{
|
||||
charm->SetWalk(_isWalkingBeforeCharm);
|
||||
charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
|
||||
}
|
||||
|
||||
m_Controlled.erase(charm);
|
||||
}
|
||||
}
|
||||
@@ -13168,7 +13180,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)
|
||||
creature->AI()->EnterCombat(enemy);
|
||||
|
||||
if (creature->GetFormation())
|
||||
creature->GetFormation()->MemberAttackStart(creature, enemy);
|
||||
creature->GetFormation()->MemberEngagingTarget(creature, enemy);
|
||||
}
|
||||
|
||||
creature->RefreshSwimmingFlag();
|
||||
|
||||
@@ -1326,6 +1326,7 @@ public:
|
||||
bool IsWithinCombatRange(Unit const* obj, float dist2compare) const;
|
||||
bool IsWithinMeleeRange(Unit const* obj, float dist = 0.f) const;
|
||||
float GetMeleeRange(Unit const* target) const;
|
||||
[[nodiscard]] virtual SpellSchoolMask GetMeleeDamageSchoolMask() const;
|
||||
bool GetRandomContactPoint(Unit const* target, float& x, float& y, float& z, bool force = false) const;
|
||||
uint32 m_extraAttacks;
|
||||
bool m_canDualWield;
|
||||
@@ -1343,6 +1344,9 @@ public:
|
||||
if (GetVictim() != nullptr)
|
||||
return GetVictim();
|
||||
|
||||
if (!IsEngaged())
|
||||
return nullptr;
|
||||
|
||||
if (!m_attackers.empty())
|
||||
return *(m_attackers.begin());
|
||||
|
||||
@@ -1644,6 +1648,9 @@ public:
|
||||
|
||||
[[nodiscard]] bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); }
|
||||
|
||||
bool IsEngaged() const { return IsInCombat(); }
|
||||
bool IsEngagedBy(Unit const* who) const { return IsInCombatWith(who); }
|
||||
|
||||
[[nodiscard]] bool IsInCombat() const { return HasUnitFlag(UNIT_FLAG_IN_COMBAT); }
|
||||
bool IsInCombatWith(Unit const* who) const;
|
||||
|
||||
@@ -2105,6 +2112,7 @@ public:
|
||||
void TauntApply(Unit* victim);
|
||||
void TauntFadeOut(Unit* taunter);
|
||||
ThreatMgr& GetThreatMgr() { return m_ThreatMgr; }
|
||||
ThreatMgr const& GetThreatMgr() const { return m_ThreatMgr; }
|
||||
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefMgr.insertFirst(pHostileReference); };
|
||||
void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ }
|
||||
HostileRefMgr& getHostileRefMgr() { return m_HostileRefMgr; }
|
||||
@@ -2478,8 +2486,6 @@ protected:
|
||||
CharmInfo* m_charmInfo;
|
||||
SharedVisionList m_sharedVision;
|
||||
|
||||
[[nodiscard]] virtual SpellSchoolMask GetMeleeDamageSchoolMask() const;
|
||||
|
||||
MotionMaster* i_motionMaster;
|
||||
|
||||
uint32 m_reactiveTimer[MAX_REACTIVE];
|
||||
@@ -2549,6 +2555,7 @@ private:
|
||||
bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
|
||||
|
||||
uint32 _oldFactionId; ///< faction before charm
|
||||
bool _isWalkingBeforeCharm; ///< Are we walking before we were charmed?
|
||||
|
||||
[[nodiscard]] float processDummyAuras(float TakenTotalMod) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user