Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2025-05-02 16:50:45 +08:00
138 changed files with 4062 additions and 3707 deletions

View File

@@ -1938,17 +1938,8 @@ bool Creature::CanStartAttack(Unit const* who) const
if (!_IsTargetAcceptable(who))
return false;
// pussywizard: at this point we are either hostile to who or friendly to who->getAttackerForHelper()
// pussywizard: if who is in combat and has an attacker, help him if the distance is right (help because who is hostile or help because attacker is friendly)
bool assist = false;
if (who->IsEngaged() && IsWithinDist(who, ATTACK_DISTANCE))
if (Unit* victim = who->getAttackerForHelper())
if (IsWithinDistInMap(victim, sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
assist = true;
if (!assist)
if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar
return false;
if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar
return false;
if (!CanCreatureAttack(who))
return false;
@@ -1956,6 +1947,9 @@ bool Creature::CanStartAttack(Unit const* who) const
if (HasUnitState(UNIT_STATE_STUNNED))
return false;
if (!IsHostileTo(who))
return false;
return IsWithinLOSInMap(who);
}
@@ -2538,6 +2532,9 @@ bool Creature::CanAssistTo(Unit const* u, Unit const* enemy, bool checkfaction /
{
if (GetFaction() != u->GetFaction())
return false;
if (!RespondsToCallForHelp())
return false;
}
else
{

File diff suppressed because it is too large Load Diff

View File

@@ -187,6 +187,7 @@ struct SpellModifier
flag96 mask;
uint32 spellId{0};
Aura* const ownerAura;
uint32 priority{0};
};
typedef std::unordered_map<uint32, PlayerTalent*> PlayerTalentMap;
@@ -2877,6 +2878,9 @@ protected:
uint8 m_swingErrorMsg;
float m_ammoDPS;
float m_Expertise;
float m_OffhandExpertise;
////////////////////Rest System/////////////////////
time_t _restTime;
uint32 _innTriggerId;

View File

@@ -879,7 +879,7 @@ void Player::UpdateExpertise(WeaponAttackType attack)
if (attack == RANGED_ATTACK)
return;
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
float expertise = GetRatingBonusValue(CR_EXPERTISE);
Item* weapon = GetWeaponForAttack(attack, true);
@@ -900,10 +900,12 @@ void Player::UpdateExpertise(WeaponAttackType attack)
switch (attack)
{
case BASE_ATTACK:
SetUInt32Value(PLAYER_EXPERTISE, expertise);
m_Expertise = expertise;
SetUInt32Value(PLAYER_EXPERTISE, int32(expertise));
break;
case OFF_ATTACK:
SetUInt32Value(PLAYER_OFFHAND_EXPERTISE, expertise);
m_OffhandExpertise = expertise;
SetUInt32Value(PLAYER_OFFHAND_EXPERTISE, int32(expertise));
break;
default:
break;

View File

@@ -986,6 +986,13 @@ public:
return false;
}
[[nodiscard]] bool RespondsToCallForHelp() const
{
if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
return entry->FactionRespondsToCallForHelp();
return false;
}
[[nodiscard]] bool IsInSanctuary() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); }
[[nodiscard]] bool IsPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); }
[[nodiscard]] bool IsFFAPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); }