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

Port From (https://github.com/TrinityCore/TrinityCore/commit/8147a42aefb5c94fb70205141e611d3100cbd99d)
This commit is contained in:
hondacrx
2021-10-10 16:38:45 -04:00
parent bb234fa4bd
commit feec594e98
2 changed files with 32 additions and 11 deletions
+4 -5
View File
@@ -31,7 +31,7 @@ namespace Game.Spells
{ {
public class SpellInfo public class SpellInfo
{ {
public SpellInfo(SpellNameRecord spellName, Difficulty difficulty, SpellInfoLoadHelper data, List<SpellLabelRecord> labels, List<SpellXSpellVisualRecord> visuals) public SpellInfo(SpellNameRecord spellName, Difficulty difficulty, SpellInfoLoadHelper data)
{ {
Id = spellName.Id; Id = spellName.Id;
Difficulty = difficulty; Difficulty = difficulty;
@@ -77,9 +77,6 @@ namespace Game.Spells
ShowFutureSpellPlayerConditionID = (uint)_misc.ShowFutureSpellPlayerConditionID; ShowFutureSpellPlayerConditionID = (uint)_misc.ShowFutureSpellPlayerConditionID;
} }
if (visuals != null)
_visuals = visuals;
// SpellScalingEntry // SpellScalingEntry
SpellScalingRecord _scaling = data.Scaling; SpellScalingRecord _scaling = data.Scaling;
if (_scaling != null) if (_scaling != null)
@@ -185,7 +182,7 @@ namespace Game.Spells
ChannelInterruptFlags2 = (SpellAuraInterruptFlags2)_interrupt.ChannelInterruptFlags[1]; ChannelInterruptFlags2 = (SpellAuraInterruptFlags2)_interrupt.ChannelInterruptFlags[1];
} }
foreach (var label in labels) foreach (var label in data.Labels)
Labels.Add(label.LabelID); Labels.Add(label.LabelID);
// SpellLevelsEntry // SpellLevelsEntry
@@ -242,6 +239,8 @@ namespace Game.Spells
} }
} }
_visuals = data.Visuals;
_spellSpecific = SpellSpecificType.Normal; _spellSpecific = SpellSpecificType.Normal;
_auraState = AuraStateType.None; _auraState = AuraStateType.None;
} }
+28 -6
View File
@@ -2283,9 +2283,6 @@ namespace Game.Entities
if (spellNameEntry == null) if (spellNameEntry == null)
continue; continue;
var labels = new List<SpellLabelRecord>(data.Value.Labels); // copy, need to ensure source remains unmodified
var visuals = new List<SpellXSpellVisualRecord>(data.Value.Visuals); // copy, need to ensure source remains unmodified
// fill blanks // fill blanks
DifficultyRecord difficultyEntry = CliDB.DifficultyStorage.LookupByKey(data.Key.difficulty); DifficultyRecord difficultyEntry = CliDB.DifficultyStorage.LookupByKey(data.Key.difficulty);
if (difficultyEntry != null) if (difficultyEntry != null)
@@ -2301,9 +2298,15 @@ namespace Game.Entities
if (data.Value.AuraRestrictions == null) if (data.Value.AuraRestrictions == null)
data.Value.AuraRestrictions = fallbackData.AuraRestrictions; data.Value.AuraRestrictions = fallbackData.AuraRestrictions;
if (data.Value.CastingRequirements == null)
data.Value.CastingRequirements = fallbackData.CastingRequirements;
if (data.Value.Categories == null) if (data.Value.Categories == null)
data.Value.Categories = fallbackData.Categories; data.Value.Categories = fallbackData.Categories;
if (data.Value.ClassOptions == null)
data.Value.ClassOptions = fallbackData.ClassOptions;
if (data.Value.Cooldowns == null) if (data.Value.Cooldowns == null)
data.Value.Cooldowns = fallbackData.Cooldowns; data.Value.Cooldowns = fallbackData.Cooldowns;
@@ -2311,10 +2314,14 @@ namespace Game.Entities
if (data.Value.Effects[i] == null) if (data.Value.Effects[i] == null)
data.Value.Effects[i] = fallbackData.Effects[i]; data.Value.Effects[i] = fallbackData.Effects[i];
if (data.Value.EquippedItems == null)
data.Value.EquippedItems = fallbackData.EquippedItems;
if (data.Value.Interrupts == null) if (data.Value.Interrupts == null)
data.Value.Interrupts = fallbackData.Interrupts; data.Value.Interrupts = fallbackData.Interrupts;
labels.AddRange(fallbackData.Labels); if (data.Value.Labels.Empty())
data.Value.Labels = fallbackData.Labels;
if (data.Value.Levels == null) if (data.Value.Levels == null)
data.Value.Levels = fallbackData.Levels; data.Value.Levels = fallbackData.Levels;
@@ -2326,10 +2333,25 @@ namespace Game.Entities
if (data.Value.Powers[i] == null) if (data.Value.Powers[i] == null)
data.Value.Powers[i] = fallbackData.Powers[i]; data.Value.Powers[i] = fallbackData.Powers[i];
if (data.Value.Reagents == null)
data.Value.Reagents = fallbackData.Reagents;
if (data.Value.Scaling == null)
data.Value.Scaling = fallbackData.Scaling;
if (data.Value.Shapeshift == null)
data.Value.Shapeshift = fallbackData.Shapeshift;
if (data.Value.TargetRestrictions == null) if (data.Value.TargetRestrictions == null)
data.Value.TargetRestrictions = fallbackData.TargetRestrictions; data.Value.TargetRestrictions = fallbackData.TargetRestrictions;
visuals.AddRange(fallbackData.Visuals); if (data.Value.Totems == null)
data.Value.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.Value.Visuals.Empty())
data.Value.Visuals = fallbackData.Visuals;
} }
difficultyEntry = CliDB.DifficultyStorage.LookupByKey(difficultyEntry.FallbackDifficultyID); difficultyEntry = CliDB.DifficultyStorage.LookupByKey(difficultyEntry.FallbackDifficultyID);
@@ -2340,7 +2362,7 @@ namespace Game.Entities
//second key = id //second key = id
mSpellInfoMap.Add(spellNameEntry.Id, new SpellInfo(spellNameEntry, data.Key.difficulty, data.Value, labels, visuals)); mSpellInfoMap.Add(spellNameEntry.Id, new SpellInfo(spellNameEntry, data.Key.difficulty, data.Value));
} }
Log.outInfo(LogFilter.ServerLoading, "Loaded SpellInfo store in {0} ms", Time.GetMSTimeDiffToNow(oldMSTime)); Log.outInfo(LogFilter.ServerLoading, "Loaded SpellInfo store in {0} ms", Time.GetMSTimeDiffToNow(oldMSTime));