diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 90abea3aee..3aa3e063cd 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -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) @@ -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(); @@ -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()); } } } @@ -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()); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 48076ade7c..26f956e32c 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -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(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8bb69f4455..28c3bb16e1 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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())); } @@ -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; }); @@ -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; @@ -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()) @@ -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; } @@ -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; @@ -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; }); @@ -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; }); @@ -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; }); @@ -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; }); @@ -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()) @@ -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()) @@ -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; }); @@ -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; @@ -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; }); @@ -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()) @@ -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()) @@ -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; }); @@ -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()) @@ -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; }); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 18eac17751..ea55ba434d 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -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) @@ -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; @@ -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(); @@ -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); 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 e04f57fb50..1823482d90 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -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; @@ -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; @@ -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) @@ -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();