Skip to content

Commit

Permalink
Merge TrinityCore 3.3.5 to ElunaTrinityWotlk [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Rochet2 committed Sep 10, 2024
2 parents 336b898 + fcfb576 commit 52a8b27
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 56 deletions.
45 changes: 22 additions & 23 deletions src/server/game/Entities/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,15 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
ASSERT(unit);
unit->BuildMovementPacket(data);

*data << unit->GetSpeed(MOVE_WALK)
<< unit->GetSpeed(MOVE_RUN)
<< unit->GetSpeed(MOVE_RUN_BACK)
<< unit->GetSpeed(MOVE_SWIM)
<< unit->GetSpeed(MOVE_SWIM_BACK)
<< unit->GetSpeed(MOVE_FLIGHT)
<< unit->GetSpeed(MOVE_FLIGHT_BACK)
<< unit->GetSpeed(MOVE_TURN_RATE)
<< unit->GetSpeed(MOVE_PITCH_RATE);
*data << float(unit->GetSpeed(MOVE_WALK));
*data << float(unit->GetSpeed(MOVE_RUN));
*data << float(unit->GetSpeed(MOVE_RUN_BACK));
*data << float(unit->GetSpeed(MOVE_SWIM));
*data << float(unit->GetSpeed(MOVE_SWIM_BACK));
*data << float(unit->GetSpeed(MOVE_FLIGHT));
*data << float(unit->GetSpeed(MOVE_FLIGHT_BACK));
*data << float(unit->GetSpeed(MOVE_TURN_RATE));
*data << float(unit->GetSpeed(MOVE_PITCH_RATE));

// 0x08000000
if (unit->m_movementInfo.GetMovementFlags() & MOVEMENTFLAG_SPLINE_ENABLED)
Expand All @@ -346,21 +346,21 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
else
*data << uint8(0);

*data << object->GetPositionX();
*data << object->GetPositionY();
*data << object->GetPositionZ();
*data << float(object->GetPositionX());
*data << float(object->GetPositionY());
*data << float(object->GetPositionZ());

if (transport)
{
*data << object->GetTransOffsetX();
*data << object->GetTransOffsetY();
*data << object->GetTransOffsetZ();
*data << float(object->GetTransOffsetX());
*data << float(object->GetTransOffsetY());
*data << float(object->GetTransOffsetZ());
}
else
{
*data << object->GetPositionX();
*data << object->GetPositionY();
*data << object->GetPositionZ();
*data << float(object->GetPositionX());
*data << float(object->GetPositionY());
*data << float(object->GetPositionZ());
}

*data << object->GetOrientation();
Expand All @@ -376,10 +376,10 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
if (flags & UPDATEFLAG_STATIONARY_POSITION)
{
ASSERT(object);
*data << object->GetStationaryX();
*data << object->GetStationaryY();
*data << object->GetStationaryZ();
*data << object->GetStationaryO();
*data << float(object->GetStationaryX());
*data << float(object->GetStationaryY());
*data << float(object->GetStationaryZ());
*data << float(object->GetStationaryO());
}
}
}
Expand Down Expand Up @@ -448,7 +448,6 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
// 0x80
if (flags & UPDATEFLAG_VEHICLE)
{
/// @todo Allow players to aquire this updateflag.
ASSERT(unit);
ASSERT(unit->GetVehicleKit());
ASSERT(unit->GetVehicleKit()->GetVehicleInfo());
Expand Down
16 changes: 11 additions & 5 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3699,14 +3699,20 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
}
}

if (spell_id == 46917 && m_canTitanGrip)
if (m_canTitanGrip)
{
RemoveAurasDueToSpell(m_titanGripPenaltySpellId);
SetCanTitanGrip(false);
if (spellInfo && spellInfo->IsPassive() && spellInfo->HasEffect(SPELL_EFFECT_TITAN_GRIP))
{
RemoveAurasDueToSpell(m_titanGripPenaltySpellId);
SetCanTitanGrip(false);
}
}

if (spell_id == 674 && m_canDualWield)
SetCanDualWield(false);
if (m_canDualWield)
{
if (spellInfo && spellInfo->IsPassive() && spellInfo->HasEffect(SPELL_EFFECT_DUAL_WIELD))
SetCanDualWield(false);
}

if (sWorld->getBoolConfig(CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN))
AutoUnequipOffhandIfNeed();
Expand Down
40 changes: 20 additions & 20 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ void Unit::HandleEmoteCommand(Emote emoteId)
AuraEffectList const& resIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
for (AuraEffect const* aurEff : resIgnoreAurasAb)
{
if (aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL && aurEff->IsAffectedOnSpell(spellInfo))
if (aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL && aurEff->IsAffectingSpell(spellInfo))
armor = std::floor(AddPct(armor, -aurEff->GetAmount()));
}

Expand Down Expand Up @@ -1700,7 +1700,7 @@ void Unit::HandleEmoteCommand(Emote emoteId)
{
ignoredResistance += attacker->GetTotalAuraModifier(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, [schoolMask, spellInfo](AuraEffect const* aurEff) -> bool
{
if ((aurEff->GetMiscValue() & schoolMask) && aurEff->IsAffectedOnSpell(spellInfo))
if ((aurEff->GetMiscValue() & schoolMask) && aurEff->IsAffectingSpell(spellInfo))
return true;
return false;
});
Expand Down Expand Up @@ -1786,7 +1786,7 @@ void Unit::HandleEmoteCommand(Emote emoteId)
if (!(aurEff->GetMiscValue() & damageInfo.GetSchoolMask()))
return false;

if (!aurEff->IsAffectedOnSpell(damageInfo.GetSpellInfo()))
if (!aurEff->IsAffectingSpell(damageInfo.GetSpellInfo()))
return false;

return true;
Expand Down Expand Up @@ -2488,7 +2488,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
AuraEffectList const& ignore = GetAuraEffectsByType(SPELL_AURA_IGNORE_COMBAT_RESULT);
for (AuraEffect const* aurEff : ignore)
{
if (!aurEff->IsAffectedOnSpell(spellInfo))
if (!aurEff->IsAffectingSpell(spellInfo))
continue;

switch (aurEff->GetMiscValue())
Expand Down Expand Up @@ -4567,7 +4567,7 @@ bool Unit::HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo const* affecte
{
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
if ((*i)->IsAffectedOnSpell(affectedSpell))
if ((*i)->IsAffectingSpell(affectedSpell))
return true;
return false;
}
Expand Down Expand Up @@ -4644,7 +4644,7 @@ AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const
for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
{
if ((*i)->GetMiscValue() == script)
if ((*i)->IsAffectedOnSpell(spell))
if ((*i)->IsAffectingSpell(spell))
return (*i);
}
return nullptr;
Expand Down Expand Up @@ -4895,7 +4895,7 @@ int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auraType, SpellInfo const*
{
return GetTotalAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
{
if (aurEff->IsAffectedOnSpell(affectedSpell))
if (aurEff->IsAffectingSpell(affectedSpell))
return true;
return false;
});
Expand All @@ -4905,7 +4905,7 @@ float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auraType, SpellInfo cons
{
return GetTotalAuraMultiplier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
{
if (aurEff->IsAffectedOnSpell(affectedSpell))
if (aurEff->IsAffectingSpell(affectedSpell))
return true;
return false;
});
Expand All @@ -4915,7 +4915,7 @@ int32 Unit::GetMaxPositiveAuraModifierByAffectMask(AuraType auraType, SpellInfo
{
return GetMaxPositiveAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
{
if (aurEff->IsAffectedOnSpell(affectedSpell))
if (aurEff->IsAffectingSpell(affectedSpell))
return true;
return false;
});
Expand All @@ -4925,7 +4925,7 @@ int32 Unit::GetMaxNegativeAuraModifierByAffectMask(AuraType auraType, SpellInfo
{
return GetMaxNegativeAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
{
if (aurEff->IsAffectedOnSpell(affectedSpell))
if (aurEff->IsAffectingSpell(affectedSpell))
return true;
return false;
});
Expand Down Expand Up @@ -6474,7 +6474,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
Unit const* owner = GetOwner() ? GetOwner() : this;
DoneTotal += owner->GetTotalAuraModifier(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, [spellProto](AuraEffect const* aurEff) -> bool
{
if (!aurEff->IsAffectedOnSpell(spellProto))
if (!aurEff->IsAffectingSpell(spellProto))
return false;

switch (aurEff->GetMiscValue())
Expand Down Expand Up @@ -6646,7 +6646,7 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage
AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
if (!(*i)->IsAffectedOnSpell(spellProto))
if (!(*i)->IsAffectingSpell(spellProto))
continue;

switch ((*i)->GetMiscValue())
Expand Down Expand Up @@ -6955,7 +6955,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
{
TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_FROM_CASTER, [caster, spellProto](AuraEffect const* aurEff) -> bool
{
if (aurEff->GetCasterGUID() == caster->GetGUID() && aurEff->IsAffectedOnSpell(spellProto))
if (aurEff->GetCasterGUID() == caster->GetGUID() && aurEff->IsAffectingSpell(spellProto))
return true;
return false;
});
Expand Down Expand Up @@ -7095,7 +7095,7 @@ float Unit::SpellCritChanceTaken(Unit const* caster, SpellInfo const* spellInfo,
AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffect const* aurEff : mOverrideClassScript)
{
if (!aurEff->IsAffectedOnSpell(spellInfo))
if (!aurEff->IsAffectingSpell(spellInfo))
continue;

float modChance = 0.f;
Expand Down Expand Up @@ -7243,7 +7243,7 @@ float Unit::SpellCritChanceTaken(Unit const* caster, SpellInfo const* spellInfo,
{
crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, [caster, spellInfo](AuraEffect const* aurEff) -> bool
{
if (aurEff->GetCasterGUID() == caster->GetGUID() && aurEff->IsAffectedOnSpell(spellInfo))
if (aurEff->GetCasterGUID() == caster->GetGUID() && aurEff->IsAffectingSpell(spellInfo))
return true;
return false;
});
Expand Down Expand Up @@ -7349,7 +7349,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffect const* aurEff : mOverrideClassScript)
{
if (!aurEff->IsAffectedOnSpell(spellProto))
if (!aurEff->IsAffectingSpell(spellProto))
continue;

switch (aurEff->GetMiscValue())
Expand Down Expand Up @@ -7502,7 +7502,7 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const
AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffect const* aurEff : mOverrideClassScript)
{
if (!aurEff->IsAffectedOnSpell(spellProto))
if (!aurEff->IsAffectingSpell(spellProto))
continue;

switch (aurEff->GetMiscValue())
Expand Down Expand Up @@ -7591,7 +7591,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
{
TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_RECEIVED, [caster, spellProto](AuraEffect const* aurEff) -> bool
{
if (caster->GetGUID() == aurEff->GetCasterGUID() && aurEff->IsAffectedOnSpell(spellProto))
if (caster->GetGUID() == aurEff->GetCasterGUID() && aurEff->IsAffectingSpell(spellProto))
return true;
return false;
});
Expand Down Expand Up @@ -7946,7 +7946,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
if (!(*i)->IsAffectedOnSpell(spellProto))
if (!(*i)->IsAffectingSpell(spellProto))
continue;

switch ((*i)->GetMiscValue())
Expand Down Expand Up @@ -8054,7 +8054,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
// From caster spells
TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_FROM_CASTER, [attacker, spellProto](AuraEffect const* aurEff) -> bool
{
if (aurEff->GetCasterGUID() == attacker->GetGUID() && aurEff->IsAffectedOnSpell(spellProto))
if (aurEff->GetCasterGUID() == attacker->GetGUID() && aurEff->IsAffectingSpell(spellProto))
return true;
return false;
});
Expand Down
9 changes: 6 additions & 3 deletions src/server/game/Spells/Auras/SpellAuraEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
Unit::AuraEffectList const& overrideClassScripts = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
{
if ((*itr)->IsAffectedOnSpell(m_spellInfo))
if ((*itr)->IsAffectingSpell(m_spellInfo))
{
// Glyph of Fear, Glyph of Frost nova and similar auras
if ((*itr)->GetMiscValue() == 7801)
Expand Down Expand Up @@ -845,7 +845,7 @@ float AuraEffect::GetCritChanceFor(Unit const* caster, Unit const* target) const
return target->SpellCritChanceTaken(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), GetBase()->GetCritChance(), GetSpellInfo()->GetAttackType(), true);
}

bool AuraEffect::IsAffectedOnSpell(SpellInfo const* spell) const
bool AuraEffect::IsAffectingSpell(SpellInfo const* spell) const
{
if (!spell)
return false;
Expand Down Expand Up @@ -4988,7 +4988,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,

Unit* target = aurApp->GetTarget();

if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
if (!target->IsInWorld())
return;

uint32 vehicleId = GetMiscValue();
Expand All @@ -5001,6 +5001,9 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,
else if (target->GetVehicleKit())
target->RemoveVehicleKit();

if (target->GetTypeId() != TYPEID_PLAYER)
return;

WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size()+4);
data << target->GetPackGUID();
data << uint32(apply ? vehicleId : 0);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Spells/Auras/SpellAuraEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class TC_GAME_API AuraEffect

bool IsPeriodic() const { return m_isPeriodic; }
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
bool IsAffectedOnSpell(SpellInfo const* spell) const;
bool IsAffectingSpell(SpellInfo const* spell) const;
bool HasSpellClassMask() const { return GetSpellEffectInfo().SpellClassMask; }

void SendTickImmune(Unit* target, Unit* caster) const;
Expand Down
8 changes: 4 additions & 4 deletions src/server/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3940,7 +3940,7 @@ void Spell::finish(bool ok)
Unit::AuraEffectList const& vIgnoreReset = unitCaster->GetAuraEffectsByType(SPELL_AURA_IGNORE_MELEE_RESET);
for (Unit::AuraEffectList::const_iterator i = vIgnoreReset.begin(); i != vIgnoreReset.end(); ++i)
{
if ((*i)->IsAffectedOnSpell(m_spellInfo))
if ((*i)->IsAffectingSpell(m_spellInfo))
{
found = true;
break;
Expand Down Expand Up @@ -5218,7 +5218,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
Unit::AuraEffectList const& ignore = unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_SHAPESHIFT);
for (AuraEffect const* aurEff : ignore)
{
if (!aurEff->IsAffectedOnSpell(m_spellInfo))
if (!aurEff->IsAffectingSpell(m_spellInfo))
continue;

checkForm = false;
Expand All @@ -5244,7 +5244,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
Unit::AuraEffectList const& stateAuras = unitCaster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
for (Unit::AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
{
if ((*j)->IsAffectedOnSpell(m_spellInfo))
if ((*j)->IsAffectingSpell(m_spellInfo))
{
m_needComboPoints = false;
if ((*j)->GetMiscValue() == 1)
Expand Down Expand Up @@ -8165,7 +8165,7 @@ void Spell::PrepareTriggersExecutedOnHit()
Unit::AuraEffectList const& targetTriggers = unitCaster->GetAuraEffectsByType(SPELL_AURA_ADD_TARGET_TRIGGER);
for (AuraEffect const* aurEff : targetTriggers)
{
if (!aurEff->IsAffectedOnSpell(m_spellInfo))
if (!aurEff->IsAffectingSpell(m_spellInfo))
continue;

SpellInfo const* auraSpellInfo = aurEff->GetSpellInfo();
Expand Down

0 comments on commit 52a8b27

Please sign in to comment.