diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-10-10 19:02:52 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-10-10 19:02:52 +0200 |
commit | 8147a42aefb5c94fb70205141e611d3100cbd99d (patch) | |
tree | a15dd7c89f1f3e8c2c76e697ea8a0300b73a1c34 /src | |
parent | 2965d201ab5580a7c71279701b8523064a159077 (diff) |
Core/Spells: Corrected spell visual fallback logic for spell difficulty entries
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 9 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.h | 3 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 34 |
3 files changed, 33 insertions, 13 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 5c1606cd731..61e04f1c8e4 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1072,8 +1072,7 @@ SpellEffectInfo::StaticData SpellEffectInfo::_data[TOTAL_SPELL_EFFECTS] = {EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 285 SPELL_EFFECT_MODIFY_KEYSTONE_2 }; -SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, SpellInfoLoadHelper const& data, - std::vector<SpellLabelEntry const*> const& labels, SpellVisualVector&& visuals) +SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, SpellInfoLoadHelper const& data) : Id(spellName->ID), Difficulty(difficulty) { _effects.reserve(32); @@ -1119,8 +1118,6 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S ShowFutureSpellPlayerConditionID = _misc->ShowFutureSpellPlayerConditionID; } - _visuals = std::move(visuals); - // SpellScalingEntry if (SpellScalingEntry const* _scaling = data.Scaling) { @@ -1210,7 +1207,7 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S ChannelInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->ChannelInterruptFlags[1]); } - for (SpellLabelEntry const* label : labels) + for (SpellLabelEntry const* label : data.Labels) Labels.insert(label->LabelID); // SpellLevelsEntry @@ -1255,6 +1252,8 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S std::copy(std::begin(_totem->RequiredTotemCategoryID), std::end(_totem->RequiredTotemCategoryID), TotemCategory.begin()); std::copy(std::begin(_totem->Totem), std::end(_totem->Totem), Totem.begin()); } + + _visuals = data.Visuals; } SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, std::vector<SpellEffectEntry> const& effects) diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 181b6c8ea87..fbd18c7eb07 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -434,8 +434,7 @@ class TC_GAME_API SpellInfo uint32 ExplicitTargetMask = 0; SpellChainNode const* ChainEntry = nullptr; - SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, SpellInfoLoadHelper const& data, - std::vector<SpellLabelEntry const*> const& labels, SpellVisualVector&& visuals); + SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, SpellInfoLoadHelper const& data); SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, std::vector<SpellEffectEntry> const& effects); ~SpellInfo(); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index bd2f23c1132..8425b6a1a5f 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2588,9 +2588,6 @@ void SpellMgr::LoadSpellInfoStore() if (!spellNameEntry) continue; - std::vector<SpellLabelEntry const*> labels = data.second.Labels; // copy, need to ensure source remains unmodified - SpellVisualVector visuals = data.second.Visuals; // copy, need to ensure source remains unmodified - // fill blanks if (DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(data.first.second)) { @@ -2604,9 +2601,15 @@ void SpellMgr::LoadSpellInfoStore() if (!data.second.AuraRestrictions) data.second.AuraRestrictions = fallbackData->AuraRestrictions; + if (!data.second.CastingRequirements) + data.second.CastingRequirements = fallbackData->CastingRequirements; + if (!data.second.Categories) data.second.Categories = fallbackData->Categories; + if (!data.second.ClassOptions) + data.second.ClassOptions = fallbackData->ClassOptions; + if (!data.second.Cooldowns) data.second.Cooldowns = fallbackData->Cooldowns; @@ -2614,10 +2617,14 @@ void SpellMgr::LoadSpellInfoStore() if (!data.second.Effects[i]) data.second.Effects[i] = fallbackData->Effects[i]; + if (!data.second.EquippedItems) + data.second.EquippedItems = fallbackData->EquippedItems; + if (!data.second.Interrupts) data.second.Interrupts = fallbackData->Interrupts; - labels.insert(labels.end(), fallbackData->Labels.begin(), fallbackData->Labels.end()); + if (data.second.Labels.empty()) + data.second.Labels = fallbackData->Labels; if (!data.second.Levels) data.second.Levels = fallbackData->Levels; @@ -2629,17 +2636,32 @@ void SpellMgr::LoadSpellInfoStore() if (!data.second.Powers[i]) data.second.Powers[i] = fallbackData->Powers[i]; + if (!data.second.Reagents) + data.second.Reagents = fallbackData->Reagents; + + if (!data.second.Scaling) + data.second.Scaling = fallbackData->Scaling; + + if (!data.second.Shapeshift) + data.second.Shapeshift = fallbackData->Shapeshift; + if (!data.second.TargetRestrictions) data.second.TargetRestrictions = fallbackData->TargetRestrictions; - visuals.insert(visuals.end(), fallbackData->Visuals.begin(), fallbackData->Visuals.end()); + if (!data.second.Totems) + data.second.Totems = fallbackData->Totems; + + // visuals fall back only to first difficulty that defines any visual + // they do not stack all difficulties in fallback chain + if (data.second.Visuals.empty()) + data.second.Visuals = fallbackData->Visuals; } difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID); } while (difficultyEntry); } - mSpellInfoMap.emplace(spellNameEntry, data.first.second, data.second, labels, std::move(visuals)); + mSpellInfoMap.emplace(spellNameEntry, data.first.second, data.second); } TC_LOG_INFO("server.loading", ">> Loaded SpellInfo store in %u ms", GetMSTimeDiffToNow(oldMSTime)); |