Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-12-05 00:08:25 +08:00
121 changed files with 4818 additions and 1413 deletions

View File

@@ -813,7 +813,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
return MINUTE * IN_MILLISECONDS;
case BREATH_TIMER:
{
if (!IsAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSession()->GetSecurity() >= AccountTypes(sWorld->getIntConfig(CONFIG_DISABLE_BREATHING)))
if (!IsAlive() || HasWaterBreathingAura() || GetSession()->GetSecurity() >= AccountTypes(sWorld->getIntConfig(CONFIG_DISABLE_BREATHING)))
return DISABLED_MIRROR_TIMER;
int32 UnderWaterTime = sWorld->getIntConfig(CONFIG_WATER_BREATH_TIMER);
AuraEffectList const& mModWaterBreathing = GetAuraEffectsByType(SPELL_AURA_MOD_WATER_BREATHING);
@@ -1787,8 +1787,8 @@ void Player::RegenerateAll()
{
// Not in combat or they have regeneration
if (!IsInCombat() || IsPolymorphed() || m_baseHealthRegen ||
HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT))
HasRegenDuringCombatAura() ||
HasHealthRegenInCombatAura())
{
RegenerateHealth();
}
@@ -1882,7 +1882,7 @@ void Player::Regenerate(Powers power)
break;
case POWER_RAGE: // Regenerate rage
{
if (!IsInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
if (!IsInCombat() && !HasInterruptRegenAura())
{
float RageDecreaseRate = sWorld->getRate(RATE_POWER_RAGE_LOSS);
addvalue += -20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
@@ -1894,7 +1894,7 @@ void Player::Regenerate(Powers power)
break;
case POWER_RUNIC_POWER:
{
if (!IsInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
if (!IsInCombat() && !HasInterruptRegenAura())
{
float RunicPowerDecreaseRate = sWorld->getRate(RATE_POWER_RUNICPOWER_LOSS);
addvalue += -30 * RunicPowerDecreaseRate; // 3 RunicPower by tick
@@ -2000,7 +2000,7 @@ void Player::RegenerateHealth()
if (IsPolymorphed())
addvalue = (float)GetMaxHealth() / 3;
// normal regen case (maybe partly in combat case)
else if (!IsInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
else if (!IsInCombat() || HasRegenDuringCombatAura())
{
addvalue = OCTRegenHPPerSpirit() * HealthIncreaseRate;
@@ -2019,7 +2019,7 @@ void Player::RegenerateHealth()
{
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2 * IN_MILLISECONDS / (5 * IN_MILLISECONDS);
}
else if (HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
else if (HasRegenDuringCombatAura())
{
ApplyPct(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
}
@@ -2507,14 +2507,17 @@ void Player::GiveLevel(uint8 level)
_ApplyAllLevelScaleItemMods(true);
// set current level health and mana/energy to maximum after applying all mods.
SetFullHealth();
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
if (!isDead())
{
// set current level health and mana/energy to maximum after applying all mods.
SetFullHealth();
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
}
// update level to hunter/summon pet
if (Pet* pet = GetPet())
@@ -4556,7 +4559,7 @@ void Player::KillPlayer()
//SetUnitFlag(UNIT_FLAG_NOT_IN_PVP);
ReplaceAllDynamicFlags(UNIT_DYNFLAG_NONE);
ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION));
ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable() && !HasPreventResurectionAura());
// 6 minutes until repop at graveyard
m_deathTimer = 6 * MINUTE * IN_MILLISECONDS;
@@ -4781,10 +4784,8 @@ void Player::DurabilityPointsLossAll(int32 points, bool inventory)
void Player::DurabilityPointsLoss(Item* item, int32 points)
{
if (HasAuraType(SPELL_AURA_PREVENT_DURABILITY_LOSS))
{
if (HasPreventDurabilityLossAura())
return;
}
int32 pMaxDurability = item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
int32 pOldDurability = item->GetUInt32Value(ITEM_FIELD_DURABILITY);
@@ -6121,7 +6122,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
if (honor_f <= 0)
{
if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
if (!uVictim || uVictim == this || uVictim->HasNoPVPCreditAura())
return false;
victim_guid = uVictim->GetGUID();
@@ -6234,7 +6235,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE))
{
if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
if (!uVictim || uVictim == this || uVictim->HasNoPVPCreditAura())
return true;
if (uVictim->IsPlayer())
@@ -9029,7 +9030,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->GetCharmInfo()->SetPetNumber(pet_number, false);
}
pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
pet->SetFullHealth();
@@ -11677,7 +11677,7 @@ void Player::SendInitialPacketsAfterAddToMap()
// Fix mount, update block gets messed somewhere
{
if (!isBeingLoaded() && GetMountBlockId() && !HasAuraType(SPELL_AURA_MOUNTED))
if (!isBeingLoaded() && GetMountBlockId() && !HasMountedAura())
{
AddAura(GetMountBlockId(), this);
SetMountBlockId(0);
@@ -11689,11 +11689,11 @@ void Player::SendInitialPacketsAfterAddToMap()
GetZoneAndAreaId(newzone, newarea);
UpdateZone(newzone, newarea); // also call SendInitWorldStates();
if (HasAuraType(SPELL_AURA_MOD_STUN))
if (HasStunAura())
SetMovement(MOVE_ROOT);
// manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that must not be re-applied.
if (HasAuraType(SPELL_AURA_MOD_ROOT))
if (HasRootAura())
{
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
data2 << GetPackGUID();
@@ -12083,13 +12083,13 @@ void Player::GetAurasForTarget(Unit* target, bool force /*= false*/)
/*! Blizz sends certain movement packets sometimes even before CreateObject
These movement packets are usually found in SMSG_COMPRESSED_MOVES
*/
if (target->HasAuraType(SPELL_AURA_FEATHER_FALL))
if (target->HasFeatherFallAura())
target->SendMovementFeatherFall(this);
if (target->HasAuraType(SPELL_AURA_WATER_WALK))
if (target->HasWaterWalkAura())
target->SendMovementWaterWalking(this);
if (target->HasAuraType(SPELL_AURA_HOVER))
if (target->HasHoverAura())
target->SendMovementHover(this);
WorldPacket data(SMSG_AURA_UPDATE_ALL);
@@ -13874,8 +13874,8 @@ void Player::HandleFall(MovementInfo const& movementInfo)
//Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
// 14.57 can be calculated by resolving damageperc formula below to 0
if (z_diff >= 14.57f && !isDead() && !IsGameMaster() && !GetCommandStatus(CHEAT_GOD) &&
!HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) &&
!HasAuraType(SPELL_AURA_FLY))
!HasHoverAura() && !HasFeatherFallAura() &&
!HasFlyAura())
{
//Safe fall, fall height reduction
int32 safe_fall = GetTotalAuraModifier(SPELL_AURA_SAFE_FALL);