diff options
-rw-r--r-- | src/server/game/Entities/AreaTrigger/AreaTrigger.cpp | 18 | ||||
-rw-r--r-- | src/server/game/Entities/AreaTrigger/AreaTrigger.h | 3 | ||||
-rw-r--r-- | src/server/game/Entities/DynamicObject/DynamicObject.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Entities/DynamicObject/DynamicObject.h | 3 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 18 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 1 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.h | 3 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 41 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.h | 4 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 48 |
14 files changed, 111 insertions, 61 deletions
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 68ee386be3f..568c0e39469 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -15,13 +15,14 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Unit.h" -#include "SpellInfo.h" +#include "AreaTrigger.h" +#include "DB2Stores.h" #include "Log.h" +#include "SpellInfo.h" +#include "Unit.h" #include "UpdateData.h" -#include "AreaTrigger.h" -AreaTrigger::AreaTrigger() : WorldObject(false), _duration(0) +AreaTrigger::AreaTrigger() : WorldObject(false), _duration(0), _spellXSpellVisualId(0) { m_objectType |= TYPEMASK_AREATRIGGER; m_objectTypeId = TYPEID_AREATRIGGER; @@ -56,8 +57,9 @@ void AreaTrigger::RemoveFromWorld() } } -bool AreaTrigger::CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos) +bool AreaTrigger::CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos, uint32 spellXSpellVisualId) { + _spellXSpellVisualId = spellXSpellVisualId; SetMap(caster->GetMap()); Relocate(pos); if (!IsPositionValid()) @@ -69,13 +71,17 @@ bool AreaTrigger::CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerE Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), triggerEntry, guidlow)); SetPhaseMask(caster->GetPhaseMask(), false); + uint32 spellVisual = 0; + if (SpellXSpellVisualEntry const* visual = sSpellXSpellVisualStore.LookupEntry(spellXSpellVisualId)) + spellVisual = visual->SpellVisualID[0]; + SetEntry(triggerEntry); SetDuration(spell->GetDuration()); SetObjectScale(1); SetGuidValue(AREATRIGGER_CASTER, caster->GetGUID()); SetUInt32Value(AREATRIGGER_SPELLID, spell->Id); - SetUInt32Value(AREATRIGGER_SPELLVISUALID, spell->GetSpellVisual(GetMap()->GetDifficultyID())); + SetUInt32Value(AREATRIGGER_SPELLVISUALID, spellVisual); SetUInt32Value(AREATRIGGER_DURATION, spell->GetDuration()); CopyPhaseFrom(caster); diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.h b/src/server/game/Entities/AreaTrigger/AreaTrigger.h index e3caa6d2e95..1b3e6f02a3e 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.h +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.h @@ -32,7 +32,7 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge void AddToWorld() override; void RemoveFromWorld() override; - bool CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos); + bool CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos, uint32 spellXSpellVisualId); void Update(uint32 p_time) override; void Remove(); uint32 GetSpellId() const { return GetUInt32Value(AREATRIGGER_SPELLID); } @@ -42,5 +42,6 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge protected: int32 _duration; + uint32 _spellXSpellVisualId; }; #endif diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index ea925148084..25684b44db6 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -28,7 +28,7 @@ #include "Transport.h" DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject), - _aura(NULL), _removedAura(NULL), _caster(NULL), _duration(0), _isViewpoint(false) + _aura(NULL), _removedAura(NULL), _caster(NULL), _duration(0), _spellXSpellVisualId(0), _isViewpoint(false) { m_objectType |= TYPEMASK_DYNAMICOBJECT; m_objectTypeId = TYPEID_DYNAMICOBJECT; @@ -80,8 +80,9 @@ void DynamicObject::RemoveFromWorld() } } -bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type) +bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type, uint32 spellXSpellVisualId) { + _spellXSpellVisualId = spellXSpellVisualId; SetMap(caster->GetMap()); Relocate(pos); if (!IsPositionValid()) @@ -93,10 +94,14 @@ bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caste WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow)); SetPhaseMask(caster->GetPhaseMask(), false); + uint32 spellVisual = 0; + if (SpellXSpellVisualEntry const* visual = sSpellXSpellVisualStore.LookupEntry(spellXSpellVisualId)) + spellVisual = visual->SpellVisualID[0]; + SetEntry(spell->Id); SetObjectScale(1.0f); SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID()); - SetUInt32Value(DYNAMICOBJECT_BYTES, spell->GetSpellVisual(GetMap()->GetDifficultyID()) | (type << 28)); + SetUInt32Value(DYNAMICOBJECT_BYTES, spellVisual | (type << 28)); SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id); SetFloatValue(DYNAMICOBJECT_RADIUS, radius); SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime()); diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h index 09426a3c044..4d1cdefdd48 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.h +++ b/src/server/game/Entities/DynamicObject/DynamicObject.h @@ -41,7 +41,7 @@ class TC_GAME_API DynamicObject : public WorldObject, public GridObject<DynamicO void AddToWorld() override; void RemoveFromWorld() override; - bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type); + bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type, uint32 spellXSpellVisualId); void Update(uint32 p_time) override; void Remove(); void SetDuration(int32 newDuration); @@ -63,6 +63,7 @@ class TC_GAME_API DynamicObject : public WorldObject, public GridObject<DynamicO Aura* _removedAura; Unit* _caster; int32 _duration; // for non-aura dynobjects + uint32 _spellXSpellVisualId; bool _isViewpoint; }; #endif diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 87bdcf3692a..9b95fe9b5a4 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16118,6 +16118,24 @@ SpellInfo const* Unit::GetCastSpellInfo(SpellInfo const* spellInfo) const return spellInfo; } +uint32 Unit::GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const +{ + Unit::AuraEffectList const& visualOverrides = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_SPELL_VISUAL); + for (AuraEffect const* effect : visualOverrides) + { + if (effect->GetMiscValue() == spellInfo->Id) + { + if (SpellInfo const* visualSpell = sSpellMgr->GetSpellInfo(effect->GetMiscValueB())) + { + spellInfo = visualSpell; + break; + } + } + } + + return spellInfo->GetSpellXSpellVisualId(this); +} + struct CombatLogSender { WorldObject const* i_source; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 5cbe29996dc..2ee0ea8873a 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1931,6 +1931,7 @@ class TC_GAME_API Unit : public WorldObject Spell* FindCurrentSpellBySpellId(uint32 spell_id) const; int32 GetCurrentSpellCastTime(uint32 spell_id) const; virtual SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const; + uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const; SpellHistory* GetSpellHistory() { return _spellHistory; } SpellHistory const* GetSpellHistory() const { return _spellHistory; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 9e46b2d1d35..136aea7a811 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -462,7 +462,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleAuraModSkill, //400 SPELL_AURA_MOD_SKILL_2 &AuraEffect::HandleNULL, //401 &AuraEffect::HandleNULL, //402 - &AuraEffect::HandleNULL, //403 + &AuraEffect::HandleNoImmediateEffect, //403 SPELL_AURA_OVERRIDE_SPELL_VISUAL implemented in Unit::GetCastSpellXSpellVisualId &AuraEffect::HandleOverrideAttackPowerBySpellPower, //404 SPELL_AURA_OVERRIDE_ATTACK_POWER_BY_SP_PCT &AuraEffect::HandleNULL, //405 SPELL_AURA_MOD_RATING_PCT &AuraEffect::HandleNULL, //406 diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index e7c932e8a3b..b337e4aca58 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -202,7 +202,7 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo WorldPackets::Spells::AuraDataInfo auraData; auraData.SpellID = aura->GetId(); - auraData.SpellXSpellVisualID = aura->GetSpellInfo()->GetSpellXSpellVisualId(_target->GetMap()->GetDifficultyID()); + auraData.SpellXSpellVisualID = aura->GetSpellXSpellVisualId(); auraData.Flags = GetFlags(); if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION)) auraData.Flags |= AFLAG_DURATION; @@ -365,7 +365,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint32 effMask, WorldObject* own Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID, int32 castItemLevel) : m_spellInfo(spellproto), m_casterGuid(!casterGUID.IsEmpty() ? casterGUID : caster->GetGUID()), -m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemLevel(castItemLevel), +m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemLevel(castItemLevel), m_spellXSpellVisualId(caster ? caster->GetCastSpellXSpellVisualId(spellproto) : spellproto->GetSpellXSpellVisualId()), m_applyTime(time(NULL)), m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0), m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1), m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr), diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 27e2333bd97..33b4f41c34d 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -133,6 +133,7 @@ class TC_GAME_API Aura ObjectGuid GetCastItemGUID() const { return m_castItemGuid; } int32 GetCastItemLevel() const { return m_castItemLevel; } ObjectGuid GetCasterGUID() const { return m_casterGuid; } + uint32 GetSpellXSpellVisualId() const { return m_spellXSpellVisualId; } Unit* GetCaster() const; WorldObject* GetOwner() const { return m_owner; } Unit* GetUnitOwner() const { ASSERT(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; } @@ -300,6 +301,7 @@ class TC_GAME_API Aura ObjectGuid const m_casterGuid; ObjectGuid const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted int32 m_castItemLevel; + uint32 const m_spellXSpellVisualId; time_t const m_applyTime; WorldObject* const m_owner; @@ -313,7 +315,6 @@ class TC_GAME_API Aura uint8 m_procCharges; // Aura charges (0 for infinite) uint8 m_stackAmount; // Aura stack amount - //AuraEffect* m_effects[3]; ApplicationMap m_applications; bool m_isRemoved; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 34261f4f0e2..a09d97b8e68 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -591,7 +591,7 @@ m_spellValue(new SpellValue(caster->GetMap()->GetDifficultyID(), m_spellInfo)), focusObject = NULL; m_cast_count = 0; memset(m_misc.Raw.Data, 0, sizeof(m_misc.Raw.Data)); - m_SpellVisual = m_spellInfo->GetSpellXSpellVisualId(caster->GetMap()->GetDifficultyID()); + m_SpellVisual = caster->GetCastSpellXSpellVisualId(m_spellInfo); m_preCastSpell = 0; m_triggeredByAuraSpell = NULL; m_spellAura = NULL; @@ -4355,7 +4355,7 @@ void Spell::SendChannelStart(uint32 duration) m_caster->SetChannelObjectGuid(channelTarget); m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id); - m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL_X_SPELL_VISUAL, m_spellInfo->GetSpellXSpellVisualId(m_caster->GetMap()->GetDifficultyID())); + m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL_X_SPELL_VISUAL, m_SpellVisual); } void Spell::SendResurrectRequest(Player* target) @@ -6763,7 +6763,7 @@ bool Spell::IsAutoActionResetSpell() const bool Spell::IsNeedSendToClient() const { - return m_spellInfo->GetSpellXSpellVisualId(m_caster->GetMap()->GetDifficultyID()) || m_spellInfo->IsChanneled() || + return m_SpellVisual || m_spellInfo->IsChanneled() || (m_spellInfo->HasAttribute(SPELL_ATTR8_AURA_SEND_AMOUNT)) || m_spellInfo->Speed > 0.0f || (!m_triggeredByAuraSpell && !IsTriggered()); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 9f457e5672a..193cdeb2c8f 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1542,7 +1542,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex) if (!caster->IsInWorld()) return; DynamicObject* dynObj = new DynamicObject(false); - if (!dynObj->CreateDynamicObject(caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL)) + if (!dynObj->CreateDynamicObject(caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL, m_SpellVisual)) { delete dynObj; return; @@ -2383,7 +2383,7 @@ void Spell::EffectAddFarsight(SpellEffIndex /*effIndex*/) return; DynamicObject* dynObj = new DynamicObject(true); - if (!dynObj->CreateDynamicObject(m_caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), m_caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS)) + if (!dynObj->CreateDynamicObject(m_caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), m_caster, m_spellInfo, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS, m_SpellVisual)) { delete dynObj; return; @@ -2642,10 +2642,10 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN) duration = 3600; // 30 mins // other cases with this SpellVisual already selected - else if (m_spellInfo->GetSpellVisual(DIFFICULTY_NONE) == 215) + else if (m_spellInfo->GetSpellVisual() == 215) duration = 1800; // 30 mins // some fishing pole bonuses except Glow Worm which lasts full hour - else if (m_spellInfo->GetSpellVisual(DIFFICULTY_NONE) == 563 && m_spellInfo->Id != 64401) + else if (m_spellInfo->GetSpellVisual() == 563 && m_spellInfo->Id != 64401) duration = 600; // 10 mins else if (m_spellInfo->Id == 29702) duration = 300; // 5 mins @@ -5693,7 +5693,7 @@ void Spell::EffectCreateAreaTrigger(SpellEffIndex /*effIndex*/) uint32 triggerEntry = effectInfo->MiscValue; AreaTrigger * areaTrigger = new AreaTrigger; - if (!areaTrigger->CreateAreaTrigger(GetCaster()->GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>(), triggerEntry, GetCaster(), GetSpellInfo(), pos)) + if (!areaTrigger->CreateAreaTrigger(GetCaster()->GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>(), triggerEntry, GetCaster(), GetSpellInfo(), pos, m_SpellVisual)) delete areaTrigger; } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 25a5c874a58..f38cf40dd96 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1039,6 +1039,9 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntryMap const& ef ActiveIconID = _misc ? _misc->ActiveIconID : 0; _visuals = std::move(visuals); + // sort all visuals so that the ones without a condition requirement are last on the list + for (auto& visualPair : _visuals) + std::sort(visualPair.second.begin(), visualPair.second.end(), [](SpellXSpellVisualEntry const* first, SpellXSpellVisualEntry const* second) { return first->PlayerConditionID > second->PlayerConditionID; }); // SpellScalingEntry SpellScalingEntry const* _scaling = GetSpellScaling(); @@ -2935,32 +2938,46 @@ bool SpellInfo::IsHighRankOf(SpellInfo const* spellInfo) const return false; } -uint32 SpellInfo::GetSpellXSpellVisualId(Difficulty difficulty) const +uint32 SpellInfo::GetSpellXSpellVisualId(Unit const* caster /*= nullptr*/) const { - DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty); - while (difficultyEntry) + if (caster) { - auto itr = _visuals.find(difficulty); - if (itr != _visuals.end()) - for (SpellXSpellVisualEntry const* visual : itr->second) - if (!visual->PlayerConditionID) - return visual->ID; + Difficulty difficulty = caster->GetMap()->GetDifficultyID(); + DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty); + while (difficultyEntry) + { + auto itr = _visuals.find(difficulty); + if (itr != _visuals.end()) + { + for (SpellXSpellVisualEntry const* visual : itr->second) + { + PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->PlayerConditionID); + if (!playerCondition || (caster->GetTypeId() == TYPEID_PLAYER && sConditionMgr->IsPlayerMeetingCondition(caster->ToPlayer(), playerCondition))) + return visual->ID; + } + } - difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID); + difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID); + } } auto itr = _visuals.find(DIFFICULTY_NONE); if (itr != _visuals.end()) + { for (SpellXSpellVisualEntry const* visual : itr->second) - if (!visual->PlayerConditionID) + { + PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(visual->PlayerConditionID); + if (!playerCondition || (caster && caster->GetTypeId() == TYPEID_PLAYER && sConditionMgr->IsPlayerMeetingCondition(caster->ToPlayer(), playerCondition))) return visual->ID; + } + } return 0; } -uint32 SpellInfo::GetSpellVisual(Difficulty difficulty, Player* /*forPlayer*/ /*= nullptr*/) const +uint32 SpellInfo::GetSpellVisual(Unit const* caster /*= nullptr*/) const { - if (SpellXSpellVisualEntry const* visual = sSpellXSpellVisualStore.LookupEntry(GetSpellXSpellVisualId(difficulty))) + if (SpellXSpellVisualEntry const* visual = sSpellXSpellVisualStore.LookupEntry(GetSpellXSpellVisualId(caster))) { //if (visual->SpellVisualID[1] && forPlayer->GetViolenceLevel() operator 2) // return visual->SpellVisualID[1]; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 3ca96b3c0e9..f749539f51f 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -573,8 +573,8 @@ public: bool IsDifferentRankOf(SpellInfo const* spellInfo) const; bool IsHighRankOf(SpellInfo const* spellInfo) const; - uint32 GetSpellXSpellVisualId(Difficulty difficulty) const; - uint32 GetSpellVisual(Difficulty difficulty, Player* forPlayer = nullptr) const; + uint32 GetSpellXSpellVisualId(Unit const* caster = nullptr) const; + uint32 GetSpellVisual(Unit const* caster = nullptr) const; // loading helpers void _InitializeExplicitTargetMask(); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index d001705bc79..6768eb10b46 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -69,24 +69,24 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) case SPELLFAMILY_GENERIC: { // Entrapment -- 135373 - if (spellproto->SpellIconID == 20 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39588) + if (spellproto->SpellIconID == 20 && spellproto->GetSpellVisual() == 39588) return DIMINISHING_ROOT; // Intimidation -- 24394 - if (spellproto->SpellIconID == 166 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 2816) + if (spellproto->SpellIconID == 166 && spellproto->GetSpellVisual() == 2816) return DIMINISHING_STUN; // Pulverize (Primal Earth Elemental) -- 118345 - if (spellproto->SpellIconID == 4507 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39877) + if (spellproto->SpellIconID == 4507 && spellproto->GetSpellVisual() == 39877) return DIMINISHING_STUN; // Static Charge (Capacitor Totem) -- 118905 - if (spellproto->SpellIconID == 54 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 24442) + if (spellproto->SpellIconID == 54 && spellproto->GetSpellVisual() == 24442) return DIMINISHING_STUN; // Remorseless Winter -- 115001 - if (spellproto->SpellIconID == 5744 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 23514) + if (spellproto->SpellIconID == 5744 && spellproto->GetSpellVisual() == 23514) return DIMINISHING_STUN; // Gorefiend's Grasp -- 108199 - if (spellproto->SpellIconID == 5743 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 28937) + if (spellproto->SpellIconID == 5743 && spellproto->GetSpellVisual() == 28937) return DIMINISHING_AOE_KNOCKBACK; break; } @@ -151,7 +151,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) if (spellproto->SpellFamilyFlags[1] & 0x8000000) return DIMINISHING_INCAPACITATE; // Blood Horror -- 137143, no flags (17986) - if (spellproto->SpellIconID == 6447 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 26758) + if (spellproto->SpellIconID == 6447 && spellproto->GetSpellVisual() == 26758) return DIMINISHING_INCAPACITATE; // Fear -- 118699 @@ -195,11 +195,11 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) if (spellproto->SpellFamilyFlags[0] & 0x2000) return DIMINISHING_STUN; // Rake -- 163505 -- no flags on the stun, 20490 - if (spellproto->SpellIconID == 494 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38283) + if (spellproto->SpellIconID == 494 && spellproto->GetSpellVisual() == 38283) return DIMINISHING_STUN; // Incapacitating Roar -- 99, no flags on the stun, 14 - if (spellproto->SpellIconID == 960 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38528) + if (spellproto->SpellIconID == 960 && spellproto->GetSpellVisual() == 38528) return DIMINISHING_INCAPACITATE; // Cyclone -- 33786 @@ -221,7 +221,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) if (spellproto->SpellFamilyFlags[0] & 0x200) return DIMINISHING_ROOT; // Mass Entanglement -- 102359, no flags on the root, 13535 - if (spellproto->SpellIconID == 5782 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38269) + if (spellproto->SpellIconID == 5782 && spellproto->GetSpellVisual() == 38269) return DIMINISHING_ROOT; // Faerie Fire -- 770, 20 seconds in PvP (6.0) @@ -260,14 +260,14 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) // return DIMINISHING_AOE_KNOCKBACK; // Charge (Tenacity pet) -- 53148, no flags (5526) - if (spellproto->SpellIconID == 1559 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39480) + if (spellproto->SpellIconID == 1559 && spellproto->GetSpellVisual() == 39480) return DIMINISHING_ROOT; // Narrow Escape -- 136634, no flags (17964) if (spellproto->SpellIconID == 3342 && spellproto->SchoolMask == 8) return DIMINISHING_ROOT; // Binding Shot -- 117526, no flags (15581) - if (spellproto->SpellIconID == 4612 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 6859) + if (spellproto->SpellIconID == 4612 && spellproto->GetSpellVisual() == 6859) return DIMINISHING_STUN; // Freezing Trap -- 3355 @@ -314,7 +314,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) if (spellproto->SpellFamilyFlags[2] & 0x4000) return DIMINISHING_ROOT; // Frost Shock (with Frozen Power) -- 63685, no flags (6918) - if (spellproto->SpellIconID == 193 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39876) + if (spellproto->SpellIconID == 193 && spellproto->GetSpellVisual() == 39876) return DIMINISHING_ROOT; break; } @@ -325,31 +325,31 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) return DIMINISHING_SILENCE; // Chains of Ice (with Chilblains) -- 96294, no flags (13020) - if (spellproto->SpellIconID == 180 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 20135) + if (spellproto->SpellIconID == 180 && spellproto->GetSpellVisual() == 20135) return DIMINISHING_ROOT; // Asphyxiate -- 108194 if (spellproto->SpellFamilyFlags[2] & 0x100000) return DIMINISHING_STUN; // Gnaw (Ghoul) -- 91800, no flags (12511) - if (spellproto->SpellIconID == 3010 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38760) + if (spellproto->SpellIconID == 3010 && spellproto->GetSpellVisual() == 38760) return DIMINISHING_STUN; // Monstrous Blow (Ghoul w/ Dark Transformation active) -- 91797, no flags (12510) - if (spellproto->SpellIconID == 15 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38761) + if (spellproto->SpellIconID == 15 && spellproto->GetSpellVisual() == 38761) return DIMINISHING_STUN; break; } case SPELLFAMILY_PRIEST: { // Glyph of Mind Blast -- 87194, no flags (10092) - if (spellproto->SpellIconID == 2114 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38927) + if (spellproto->SpellIconID == 2114 && spellproto->GetSpellVisual() == 38927) return DIMINISHING_ROOT; // Void Tendrils -- 114404, no flags (15067) - if (spellproto->SpellIconID == 5816 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 25199) + if (spellproto->SpellIconID == 5816 && spellproto->GetSpellVisual() == 25199) return DIMINISHING_ROOT; // Dominate Mind -- 605 - if (spellproto->SpellFamilyFlags[0] & 0x20000 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39068) + if (spellproto->SpellFamilyFlags[0] & 0x20000 && spellproto->GetSpellVisual() == 39068) return DIMINISHING_INCAPACITATE; // Holy Word: Chastise -- 88625 if (spellproto->SpellFamilyFlags[2] & 0x20) @@ -370,7 +370,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) case SPELLFAMILY_MONK: { // Disable -- 116706, no flags (15483) - if (spellproto->SpellIconID == 23 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39984) + if (spellproto->SpellIconID == 23 && spellproto->GetSpellVisual() == 39984) return DIMINISHING_ROOT; // Charging Ox Wave -- 119392 @@ -384,13 +384,13 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto) return DIMINISHING_STUN; // Glyph of Breath of Fire -- 123393, no flags (16504) - if (spellproto->SpellIconID == 15 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 25408) + if (spellproto->SpellIconID == 15 && spellproto->GetSpellVisual() == 25408) return DIMINISHING_INCAPACITATE; // Paralysis -- 115078 if (spellproto->SpellFamilyFlags[2] & 0x800000) return DIMINISHING_INCAPACITATE; // Ring of Peace -- 137460, no flags (18006) - if (spellproto->SpellIconID == 7195 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39999) + if (spellproto->SpellIconID == 7195 && spellproto->GetSpellVisual() == 39999) return DIMINISHING_INCAPACITATE; break; } @@ -444,7 +444,7 @@ int32 GetDiminishingReturnsLimitDuration(SpellInfo const* spellproto) case SPELLFAMILY_HUNTER: { // Binding Shot - 3 seconds in PvP (6.0) - if (spellproto->SpellIconID == 4612 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 6859) + if (spellproto->SpellIconID == 4612 && spellproto->GetSpellVisual() == 6859) return 3 * IN_MILLISECONDS; // Wyvern Sting - 6 seconds in PvP (6.0) if (spellproto->SpellFamilyFlags[1] & 0x1000) @@ -2835,7 +2835,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes() if (!spellInfo->_IsPositiveEffect(EFFECT_2, false)) spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF2; - if (spellInfo->GetSpellVisual(DIFFICULTY_NONE) == 3879) + if (spellInfo->GetSpellVisual() == 3879) spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_BACK; if (talentSpells.count(spellInfo->Id)) |