From 4ea21dab05391fb6362c3e8332903beadf7f2a4e Mon Sep 17 00:00:00 2001 From: Shocker Date: Sat, 26 Nov 2011 22:37:02 +0200 Subject: [PATCH 1/4] Core/Spells: Allow SPELL_AURA_SET_VEHICLE_ID to be used on creatures too (cherry picked from commit 8160e6e30392d946f29c6eccbcca1ff3bfadbdef) --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a40e18f013..119249b39a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4985,7 +4985,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(); @@ -4998,6 +4998,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); From 7d38a614bdd7b822b7eb38e3027258d72c9baa70 Mon Sep 17 00:00:00 2001 From: Shocker Date: Sat, 26 Nov 2011 23:38:06 +0200 Subject: [PATCH 2/4] Core/Spells: Rename AuraEffect::IsAffectedOnSpell to IsAffectingSpell (cherry picked from commit ef9101ea83a577dbf605402b04047a91dfd2c4d6) --- src/server/game/Entities/Unit/Unit.cpp | 40 +++++++++---------- .../game/Spells/Auras/SpellAuraEffects.cpp | 4 +- .../game/Spells/Auras/SpellAuraEffects.h | 2 +- src/server/game/Spells/Spell.cpp | 8 ++-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8fb57bafe9..091ea40b9f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1592,7 +1592,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())); } @@ -1691,7 +1691,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; }); @@ -1777,7 +1777,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; @@ -2479,7 +2479,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()) @@ -4558,7 +4558,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; } @@ -4635,7 +4635,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; @@ -4886,7 +4886,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; }); @@ -4896,7 +4896,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; }); @@ -4906,7 +4906,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; }); @@ -4916,7 +4916,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; }); @@ -6465,7 +6465,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()) @@ -6637,7 +6637,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()) @@ -6946,7 +6946,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; }); @@ -7086,7 +7086,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; @@ -7234,7 +7234,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; }); @@ -7340,7 +7340,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()) @@ -7493,7 +7493,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()) @@ -7582,7 +7582,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; }); @@ -7937,7 +7937,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()) @@ -8045,7 +8045,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; }); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 119249b39a..ca0770b6a0 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -480,7 +480,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) @@ -842,7 +842,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; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 27c1ef275e..419f4abdef 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -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; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 7f0dbe517d..e4a923f51f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3933,7 +3933,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; @@ -5211,7 +5211,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; @@ -5237,7 +5237,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) @@ -8158,7 +8158,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(); From 29e7cbbd05a41a183b9487dc410be87dcfd2c32f Mon Sep 17 00:00:00 2001 From: Shocker Date: Sun, 27 Nov 2011 00:13:50 +0200 Subject: [PATCH 3/4] Core/Spells: Remove hardcoded value for dual wield talent removal and handle them for all classes (cherry picked from commit 5b6b8dd5772f842f7524ac2a2468313c642313f0) --- src/server/game/Entities/Player/Player.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 88bcafa829..507ad40013 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3686,14 +3686,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(); From fcfb5763ea137af601a7c76923999d58cb19e5b0 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 9 Sep 2024 18:15:51 +0200 Subject: [PATCH 4/4] Core/Misc: Reduce differences between branches --- src/server/game/Entities/Object/Object.cpp | 45 +++++++++++----------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 21f296fcad..059fb6ebce 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -315,15 +315,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) @@ -341,21 +341,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(); @@ -371,10 +371,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()); } } } @@ -443,7 +443,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());