Core/Spells: Corrected spell visual fallback logic for spell difficulty entries

This commit is contained in:
Shauren
2021-10-10 19:02:52 +02:00
parent 2965d201ab
commit 8147a42aef
3 changed files with 33 additions and 13 deletions

View File

@@ -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)

View File

@@ -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();

View File

@@ -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));