mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-12 12:05:12 +00:00
Merge branch 'master' into Playerbot
This commit is contained in:
@@ -1058,7 +1058,7 @@ void Creature::DoFleeToGetAssistance()
|
||||
if (!GetVictim())
|
||||
return;
|
||||
|
||||
if (HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||
if (HasPreventsFleeingAura())
|
||||
return;
|
||||
|
||||
float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
|
||||
@@ -1201,8 +1201,10 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
|
||||
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
|
||||
}
|
||||
else if (cinfo->type_flags & CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS) // Xinef: Add ghost visibility for ghost units
|
||||
{
|
||||
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
|
||||
|
||||
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
|
||||
}
|
||||
if (Entry == VISUAL_WAYPOINT)
|
||||
SetVisible(false);
|
||||
|
||||
@@ -2668,7 +2670,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
||||
|
||||
// pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!)
|
||||
// xinef: this should include taunt auras
|
||||
if (!isWorldBoss() && (GetLastLeashExtensionTime() + 12 > GameTime::GetGameTime().count() || HasAuraType(SPELL_AURA_MOD_TAUNT)))
|
||||
if (!isWorldBoss() && (GetLastLeashExtensionTime() + 12 > GameTime::GetGameTime().count() || HasTauntAura()))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3458,14 +3460,14 @@ void Creature::UpdateMovementFlags()
|
||||
else
|
||||
SetDisableGravity(true);
|
||||
|
||||
if (!HasAuraType(SPELL_AURA_HOVER))
|
||||
if (!HasHoverAura())
|
||||
SetHover(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCanFly(false);
|
||||
SetDisableGravity(false);
|
||||
if (IsAlive() && (CanHover() || HasAuraType(SPELL_AURA_HOVER)))
|
||||
if (IsAlive() && (CanHover() || HasHoverAura()))
|
||||
SetHover(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -3128,7 +3128,7 @@ float WorldObject::GetMapHeight(float x, float y, float z, bool vmap/* = true*/,
|
||||
float WorldObject::GetMapWaterOrGroundLevel(float x, float y, float z, float* ground/* = nullptr*/) const
|
||||
{
|
||||
return GetMap()->GetWaterOrGroundLevel(GetPhaseMask(), x, y, z, ground,
|
||||
IsUnit() ? !static_cast<Unit const*>(this)->HasAuraType(SPELL_AURA_WATER_WALK) : false,
|
||||
IsUnit() ? !static_cast<Unit const*>(this)->HasWaterWalkAura() : false,
|
||||
std::max(GetCollisionHeight(), Z_OFFSET_FIND_HEIGHT));
|
||||
}
|
||||
|
||||
|
||||
@@ -306,12 +306,6 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
|
||||
{
|
||||
case SUMMON_PET:
|
||||
petlevel = owner->GetLevel();
|
||||
|
||||
if (IsPetGhoul())
|
||||
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x400); // class = rogue
|
||||
else
|
||||
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x800); // class = mage
|
||||
|
||||
ReplaceAllUnitFlags(UNIT_FLAG_PLAYER_CONTROLLED); // this enables popup window (pet dismiss, cancel)
|
||||
break;
|
||||
case HUNTER_PET:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -5132,7 +5132,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
|
||||
{
|
||||
// xinef: resurrect player, cant log in dead without corpse
|
||||
{
|
||||
if (HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (HasSpiritOfRedemptionAura())
|
||||
RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
if (!IsAlive())
|
||||
ResurrectPlayer(1.0f);
|
||||
|
||||
@@ -356,7 +356,7 @@ void Player::Update(uint32 p_time)
|
||||
|
||||
// not auto-free ghost from body in instances
|
||||
if (m_deathTimer > 0 && !GetMap()->Instanceable() &&
|
||||
!HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
|
||||
!HasPreventResurectionAura())
|
||||
{
|
||||
if (p_time >= m_deathTimer)
|
||||
{
|
||||
@@ -1716,7 +1716,7 @@ void Player::UpdateTriggerVisibility()
|
||||
// Update fields of triggers, transformed units or unselectable
|
||||
// units (values dependent on GM state)
|
||||
if (!creature || (!creature->IsTrigger() &&
|
||||
!creature->HasAuraType(SPELL_AURA_TRANSFORM) &&
|
||||
!creature->HasTransformAura() &&
|
||||
!creature->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE)))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -2836,7 +2836,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
|
||||
// Dodge chance
|
||||
|
||||
// only players can't dodge if attacker is behind
|
||||
if (victim->IsPlayer() && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||
if (victim->IsPlayer() && !victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
|
||||
{
|
||||
//LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
|
||||
}
|
||||
@@ -2871,7 +2871,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
|
||||
// parry & block chances
|
||||
|
||||
// check if attack comes from behind, nobody can parry or block if attacker is behind
|
||||
if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||
if (!victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
|
||||
{
|
||||
LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind.");
|
||||
}
|
||||
@@ -3103,7 +3103,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac
|
||||
if (spellProto && spellProto->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
|
||||
return false;
|
||||
|
||||
if (victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION) || victim->HasInArc(M_PI, this))
|
||||
if (victim->HasIgnoreHitDirectionAura() || victim->HasInArc(M_PI, this))
|
||||
{
|
||||
// Check creatures flags_extra for disable block
|
||||
if (victim->IsCreature() &&
|
||||
@@ -3201,7 +3201,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
|
||||
if (attType == RANGED_ATTACK)
|
||||
{
|
||||
// only if in front
|
||||
if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)))
|
||||
if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasIgnoreHitDirectionAura()))
|
||||
{
|
||||
int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
|
||||
tmp += deflect_chance;
|
||||
@@ -3217,7 +3217,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
|
||||
// xinef: if from behind or spell requires cast from behind
|
||||
if (!victim->HasInArc(M_PI, this))
|
||||
{
|
||||
if (!victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION) || spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET))
|
||||
if (!victim->HasIgnoreHitDirectionAura() || spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET))
|
||||
{
|
||||
// Can`t dodge from behind in PvP (but its possible in PvE)
|
||||
if (victim->IsPlayer())
|
||||
@@ -3448,7 +3448,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
|
||||
return SPELL_MISS_RESIST;
|
||||
|
||||
// cast by caster in front of victim
|
||||
if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)))
|
||||
if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasIgnoreHitDirectionAura()))
|
||||
{
|
||||
int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
|
||||
tmp += deflect_chance;
|
||||
@@ -9028,7 +9028,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
if (!victim)
|
||||
return false;
|
||||
|
||||
if (Creature* cr = ObjectAccessor::GetCreature(*this, m_SummonSlot[SUMMON_SLOT_MINIPET]))
|
||||
if (Creature* cr = GetCompanionPet())
|
||||
cr->CastSpell(victim, 50101, true);
|
||||
|
||||
return false;
|
||||
@@ -10332,11 +10332,11 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
||||
}
|
||||
|
||||
// Unit with SPELL_AURA_SPIRIT_OF_REDEMPTION can not attack
|
||||
if (HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (HasSpiritOfRedemptionAura())
|
||||
return false;
|
||||
|
||||
// remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
|
||||
if (HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
|
||||
if (HasUnattackableAura())
|
||||
RemoveAurasByType(SPELL_AURA_MOD_UNATTACKABLE);
|
||||
|
||||
if (m_attacking)
|
||||
@@ -10680,6 +10680,11 @@ Guardian* Unit::GetGuardianPet() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Creature* Unit::GetCompanionPet() const
|
||||
{
|
||||
return ObjectAccessor::GetCreature(*this, m_SummonSlot[SUMMON_SLOT_MINIPET]);
|
||||
}
|
||||
|
||||
Unit* Unit::GetCharm() const
|
||||
{
|
||||
if (ObjectGuid charm_guid = GetCharmGUID())
|
||||
@@ -11013,7 +11018,7 @@ bool RedirectSpellEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
if (Unit* auraOwner = ObjectAccessor::GetUnit(_self, _auraOwnerGUID))
|
||||
{
|
||||
// Xinef: already removed
|
||||
if (!auraOwner->HasAuraType(SPELL_AURA_SPELL_MAGNET))
|
||||
if (!auraOwner->HasSpellMagnetAura())
|
||||
return true;
|
||||
|
||||
Unit::AuraEffectList const& magnetAuras = auraOwner->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET);
|
||||
@@ -11890,7 +11895,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
|
||||
}
|
||||
|
||||
// xinef: sanctified wrath talent
|
||||
if (caster && TakenTotalMod < 1.0f && caster->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST))
|
||||
if (caster && TakenTotalMod < 1.0f && caster->HasIgnoreTargetResistAura())
|
||||
{
|
||||
float ignoreModifier = 1.0f - TakenTotalMod;
|
||||
bool addModifier = false;
|
||||
@@ -12097,7 +12102,7 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto
|
||||
{
|
||||
// Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
|
||||
// xinef: apply max and min only
|
||||
if (HasAuraType(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE))
|
||||
if (HasAttackerSpellCritChanceAura())
|
||||
{
|
||||
crit_chance += GetMaxNegativeAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
|
||||
crit_chance += GetMaxPositiveAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
|
||||
@@ -12779,7 +12784,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -12812,7 +12817,7 @@ bool Unit::IsImmunedToDamage(Spell const* spell) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -12859,7 +12864,7 @@ bool Unit::IsImmunedToSchool(SpellSchoolMask meleeSchoolMask) const
|
||||
|
||||
bool Unit::IsImmunedToSchool(SpellInfo const* spellInfo) const
|
||||
{
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
|
||||
return false;
|
||||
|
||||
uint32 schoolMask = spellInfo->GetSchoolMask();
|
||||
@@ -12883,7 +12888,7 @@ bool Unit::IsImmunedToSchool(SpellInfo const* spellInfo) const
|
||||
bool Unit::IsImmunedToSchool(Spell const* spell) const
|
||||
{
|
||||
SpellInfo const* spellInfo = spell->GetSpellInfo();
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -12946,7 +12951,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
|
||||
return false;
|
||||
|
||||
if (spellInfo->Dispel)
|
||||
@@ -13024,7 +13029,7 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING))
|
||||
return false;
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
|
||||
return false;
|
||||
|
||||
//If m_immuneToEffect type contain this effect type, IMMUNE effect.
|
||||
@@ -13366,7 +13371,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
|
||||
}
|
||||
|
||||
// xinef: sanctified wrath talent
|
||||
if (TakenTotalMod < 1.0f && attacker->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST))
|
||||
if (TakenTotalMod < 1.0f && attacker->HasIgnoreTargetResistAura())
|
||||
{
|
||||
float ignoreModifier = 1.0f - TakenTotalMod;
|
||||
bool addModifier = false;
|
||||
@@ -14652,7 +14657,7 @@ bool Unit::CanHaveThreatList(bool skipAliveCheck) const
|
||||
|
||||
float Unit::ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask)
|
||||
{
|
||||
if (!HasAuraType(SPELL_AURA_MOD_THREAT) || fThreat < 0)
|
||||
if (!HasThreatAura() || fThreat < 0)
|
||||
return fThreat;
|
||||
|
||||
SpellSchools school = GetFirstSchoolInMask(schoolMask);
|
||||
@@ -17855,7 +17860,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
|
||||
if (AuraEffect* aurEff = victim->GetAuraEffectDummy(20711))
|
||||
{
|
||||
// Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift
|
||||
if (victim->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) || victim->HasAura(27827))
|
||||
if (victim->HasSpiritOfRedemptionAura() || victim->HasAura(27827))
|
||||
{
|
||||
/*LOG_INFO("misc", "Player ({}) died with spirit of redemption. Killer (Entry: {}, Name: {}), Map: {}, x: {}, y: {}, z: {}",
|
||||
victim->GetGUID().ToString(), killer ? killer->GetEntry() : 1, killer ? killer->GetName() : "", victim->GetMapId(), victim->GetPositionX(),
|
||||
@@ -18101,7 +18106,7 @@ void Unit::SetControlled(bool apply, UnitState state, Unit* source /*= nullptr*/
|
||||
switch (state)
|
||||
{
|
||||
case UNIT_STATE_STUNNED:
|
||||
if (HasAuraType(SPELL_AURA_MOD_STUN))
|
||||
if (HasStunAura())
|
||||
return;
|
||||
ClearUnitState(state);
|
||||
SetStunned(false);
|
||||
@@ -18116,19 +18121,19 @@ void Unit::SetControlled(bool apply, UnitState state, Unit* source /*= nullptr*/
|
||||
}
|
||||
}
|
||||
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle())
|
||||
if (HasRootAura() || GetVehicle())
|
||||
return;
|
||||
ClearUnitState(state);
|
||||
SetRooted(false);
|
||||
break;
|
||||
case UNIT_STATE_CONFUSED:
|
||||
if (HasAuraType(SPELL_AURA_MOD_CONFUSE))
|
||||
if (HasConfuseAura())
|
||||
return;
|
||||
ClearUnitState(state);
|
||||
SetConfused(false);
|
||||
break;
|
||||
case UNIT_STATE_FLEEING:
|
||||
if (HasAuraType(SPELL_AURA_MOD_FEAR))
|
||||
if (HasFearAura())
|
||||
return;
|
||||
ClearUnitState(state);
|
||||
SetFeared(false);
|
||||
@@ -18139,19 +18144,19 @@ void Unit::SetControlled(bool apply, UnitState state, Unit* source /*= nullptr*/
|
||||
|
||||
//ClearUnitState(state);
|
||||
|
||||
if (HasUnitState(UNIT_STATE_STUNNED) || HasAuraType(SPELL_AURA_MOD_STUN))
|
||||
if (HasUnitState(UNIT_STATE_STUNNED) || HasStunAura())
|
||||
SetStunned(true);
|
||||
else
|
||||
{
|
||||
if (HasUnitState(UNIT_STATE_ROOT) || HasAuraType(SPELL_AURA_MOD_ROOT))
|
||||
if (HasUnitState(UNIT_STATE_ROOT) || HasRootAura())
|
||||
SetRooted(true);
|
||||
|
||||
if (HasUnitState(UNIT_STATE_CONFUSED) || HasAuraType(SPELL_AURA_MOD_CONFUSE))
|
||||
if (HasUnitState(UNIT_STATE_CONFUSED) || HasConfuseAura())
|
||||
SetConfused(true);
|
||||
else if (HasUnitState(UNIT_STATE_FLEEING) || HasAuraType(SPELL_AURA_MOD_FEAR))
|
||||
else if (HasUnitState(UNIT_STATE_FLEEING) || HasFearAura())
|
||||
{
|
||||
bool isFear = false;
|
||||
if (HasAuraType(SPELL_AURA_MOD_FEAR))
|
||||
if (HasFearAura())
|
||||
{
|
||||
isFear = true;
|
||||
source = ObjectAccessor::GetUnit(*this, GetAuraEffectsByType(SPELL_AURA_MOD_FEAR).front()->GetCasterGUID());
|
||||
@@ -19199,7 +19204,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
|
||||
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
if (player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || player->HasAuraType(SPELL_AURA_FLY))
|
||||
if (player->HasIncreaseMountedFlightSpeedAura() || player->HasFlyAura())
|
||||
player->SetCanFly(true, true);
|
||||
|
||||
player->SetCanKnockback(true);
|
||||
|
||||
@@ -1567,8 +1567,6 @@ public:
|
||||
/*********************************************************/
|
||||
/*** METHODS RELATED TO MOVEMENTS ***/
|
||||
/*********************************************************/
|
||||
[[nodiscard]] bool isFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); }
|
||||
[[nodiscard]] bool isInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT); }
|
||||
[[nodiscard]] bool IsPolymorphed() const;
|
||||
[[nodiscard]] bool isFrozen() const;
|
||||
[[nodiscard]] bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); }
|
||||
@@ -1639,8 +1637,6 @@ public:
|
||||
// SheathState
|
||||
[[nodiscard]] SheathState GetSheath() const { return SheathState(GetByteValue(UNIT_FIELD_BYTES_2, 0)); }
|
||||
virtual void SetSheath(SheathState sheathed) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); }
|
||||
[[nodiscard]] bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
|
||||
[[nodiscard]] bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
|
||||
|
||||
// StandState
|
||||
[[nodiscard]] uint8 getStandState() const { return GetByteValue(UNIT_FIELD_BYTES_1, 0); }
|
||||
@@ -1659,6 +1655,55 @@ public:
|
||||
[[nodiscard]] bool isDying() const { return (m_deathState == DeathState::JustDied); };
|
||||
[[nodiscard]] bool isDead() const { return (m_deathState == DeathState::Dead || m_deathState == DeathState::Corpse); };
|
||||
|
||||
// Spell Aura helpers
|
||||
[[nodiscard]] bool HasGhostAura() const { return HasAuraType(SPELL_AURA_GHOST); };
|
||||
[[nodiscard]] bool HasMountedAura() const { return HasAuraType(SPELL_AURA_MOUNTED); };
|
||||
[[nodiscard]] bool HasWaterWalkAura() const { return HasAuraType(SPELL_AURA_WATER_WALK); };
|
||||
[[nodiscard]] bool HasFeatherFallAura() const { return HasAuraType(SPELL_AURA_FEATHER_FALL); };
|
||||
[[nodiscard]] bool HasHoverAura() const { return HasAuraType(SPELL_AURA_HOVER); };
|
||||
[[nodiscard]] bool HasFlyAura() const { return HasAuraType(SPELL_AURA_FLY); };
|
||||
[[nodiscard]] bool HasSpiritOfRedemptionAura() const { return HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION); };
|
||||
[[nodiscard]] bool HasPreventsFleeingAura() const { return HasAuraType(SPELL_AURA_PREVENTS_FLEEING); };
|
||||
[[nodiscard]] bool HasPreventDurabilityLossAura() const { return HasAuraType(SPELL_AURA_PREVENT_DURABILITY_LOSS); };
|
||||
[[nodiscard]] bool HasPreventResurectionAura() const { return HasAuraType(SPELL_AURA_PREVENT_RESURRECTION); };
|
||||
[[nodiscard]] bool HasTransformAura() const { return HasAuraType(SPELL_AURA_TRANSFORM); };
|
||||
[[nodiscard]] bool HasInterruptRegenAura() const { return HasAuraType(SPELL_AURA_INTERRUPT_REGEN); };
|
||||
[[nodiscard]] bool HasNoPVPCreditAura() const { return HasAuraType(SPELL_AURA_NO_PVP_CREDIT); };
|
||||
[[nodiscard]] bool HasWaterBreathingAura() const { return HasAuraType(SPELL_AURA_WATER_BREATHING); };
|
||||
[[nodiscard]] bool HasIgnoreHitDirectionAura() const { return HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION); };
|
||||
[[nodiscard]] bool HasSpellMagnetAura() const { return HasAuraType(SPELL_AURA_SPELL_MAGNET); };
|
||||
[[nodiscard]] bool HasOpenStableAura() const { return HasAuraType(SPELL_AURA_OPEN_STABLE); };
|
||||
[[nodiscard]] bool HasCloneCasterAura() const { return HasAuraType(SPELL_AURA_CLONE_CASTER); };
|
||||
[[nodiscard]] bool HasReflectSpellsAura() const { return HasAuraType(SPELL_AURA_REFLECT_SPELLS); };
|
||||
[[nodiscard]] bool HasDetectAmoreAura() const { return HasAuraType(SPELL_AURA_DETECT_AMORE); };
|
||||
[[nodiscard]] bool HasAllowOnlyAbilityAura() const { return HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY); };
|
||||
[[nodiscard]] bool HasPeriodicDummyAura() const { return HasAuraType(SPELL_AURA_PERIODIC_DUMMY); };
|
||||
[[nodiscard]] bool HasControlVehicleAura() const { return HasAuraType(SPELL_AURA_CONTROL_VEHICLE); };
|
||||
[[nodiscard]] bool HasAOECharmAura() const { return HasAuraType(SPELL_AURA_AOE_CHARM); };
|
||||
[[nodiscard]] bool HasDetectSpellsAura() const { return HasAuraType(SPELL_AURA_DEFLECT_SPELLS); };
|
||||
[[nodiscard]] bool HasPacifySilenceAura() const { return HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE); }
|
||||
[[nodiscard]] bool HasSilenceAura() const { return HasAuraType(SPELL_AURA_MOD_SILENCE); }
|
||||
[[nodiscard]] bool HasShapeshiftAura() const { return HasAuraType(SPELL_AURA_MOD_SHAPESHIFT); }
|
||||
[[nodiscard]] bool HasDecreaseSpeedAura() const { return HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED); }
|
||||
[[nodiscard]] bool HasPacifyAura() const { return HasAuraType(SPELL_AURA_MOD_PACIFY); }
|
||||
[[nodiscard]] bool HasIgnoreTargetResistAura() const { return HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); }
|
||||
[[nodiscard]] bool HasIncreaseMountedSpeedAura() const { return HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED); }
|
||||
[[nodiscard]] bool HasIncreaseMountedFlightSpeedAura() const { return HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED); }
|
||||
[[nodiscard]] bool HasThreatAura() const { return HasAuraType(SPELL_AURA_MOD_THREAT); }
|
||||
[[nodiscard]] bool HasAttackerSpellCritChanceAura() const { return HasAuraType(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE); }
|
||||
[[nodiscard]] bool HasUnattackableAura() const { return HasAuraType(SPELL_AURA_MOD_UNATTACKABLE); }
|
||||
[[nodiscard]] bool HasHealthRegenInCombatAura() const { return HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT); }
|
||||
[[nodiscard]] bool HasRegenDuringCombatAura() const { return HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT); }
|
||||
[[nodiscard]] bool HasFearAura() const { return HasAuraType(SPELL_AURA_MOD_FEAR); }
|
||||
[[nodiscard]] bool HasConfuseAura() const { return HasAuraType(SPELL_AURA_MOD_CONFUSE); }
|
||||
[[nodiscard]] bool HasRootAura() const { return HasAuraType(SPELL_AURA_MOD_ROOT); }
|
||||
[[nodiscard]] bool HasStunAura() const { return HasAuraType(SPELL_AURA_MOD_STUN); }
|
||||
[[nodiscard]] bool HasTauntAura() const { return HasAuraType(SPELL_AURA_MOD_TAUNT); }
|
||||
[[nodiscard]] bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
|
||||
[[nodiscard]] bool HasStealthDetectAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH_DETECT); }
|
||||
[[nodiscard]] bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
|
||||
[[nodiscard]] bool HasInvisibilityDetectAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY_DETECT); }
|
||||
|
||||
// React methods
|
||||
bool IsHostileTo(Unit const* unit) const;
|
||||
[[nodiscard]] bool IsHostileToPlayers() const;
|
||||
@@ -1714,6 +1759,7 @@ public:
|
||||
// Pets, guardians, minions...
|
||||
[[nodiscard]] Guardian* GetGuardianPet() const;
|
||||
[[nodiscard]] Minion* GetFirstMinion() const;
|
||||
[[nodiscard]] Creature* GetCompanionPet() const;
|
||||
|
||||
Pet* CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id = 0);
|
||||
Pet* CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id = 0);
|
||||
|
||||
Reference in New Issue
Block a user