Core/Spells: Implement using different difficulty data from all spell related db2s, not just SpellEffect and SpellPower

Port From (https://github.com/TrinityCore/TrinityCore/commit/c7306439e7004288fb85890d6a5f730cf1761d71)
This commit is contained in:
hondacrx
2020-06-18 12:39:39 -04:00
parent f0942a257e
commit d7954f4fc7
89 changed files with 1738 additions and 1893 deletions
+16 -8
View File
@@ -499,20 +499,27 @@ namespace Game.Entities
itemGuid.SetRawValue(auraResult.Read<byte[]>(1));
AuraKey key = new AuraKey(casterGuid, itemGuid, auraResult.Read<uint>(2), auraResult.Read<uint>(3));
uint recalculateMask = auraResult.Read<uint>(4);
byte stackCount = auraResult.Read<byte>(5);
int maxDuration = auraResult.Read<int>(6);
int remainTime = auraResult.Read<int>(7);
byte remainCharges = auraResult.Read<byte>(8);
uint castItemId = auraResult.Read<uint>(9);
int castItemLevel = auraResult.Read<int>(10);
Difficulty difficulty = (Difficulty)auraResult.Read<byte>(5);
byte stackCount = auraResult.Read<byte>(6);
int maxDuration = auraResult.Read<int>(7);
int remainTime = auraResult.Read<int>(8);
byte remainCharges = auraResult.Read<byte>(9);
uint castItemId = auraResult.Read<uint>(10);
int castItemLevel = auraResult.Read<int>(11);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId, difficulty);
if (spellInfo == null)
{
Log.outError(LogFilter.Player, "Unknown aura (spellid {0}), ignore.", key.SpellId);
continue;
}
if (difficulty != Difficulty.None && !CliDB.DifficultyStorage.ContainsKey(difficulty))
{
Log.outError(LogFilter.Player, $"Player._LoadAuras: Player '{GetName()}' ({GetGUID()}) has an invalid aura difficulty {difficulty} (SpellID: {key.SpellId}), ignoring.");
continue;
}
// negative effects should continue counting down after logout
if (remainTime != -1 && !spellInfo.IsPositive())
{
@@ -535,7 +542,7 @@ namespace Game.Entities
AuraLoadEffectInfo info = effectInfo[key];
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast));
Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, info.BaseAmounts, null, casterGuid, itemGuid, castItemId, castItemLevel);
Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, difficulty, info.BaseAmounts, null, casterGuid, itemGuid, castItemId, castItemLevel);
if (aura != null)
{
if (!aura.CanBeSaved())
@@ -1738,6 +1745,7 @@ namespace Game.Entities
stmt.AddValue(index++, key.SpellId);
stmt.AddValue(index++, key.EffectMask);
stmt.AddValue(index++, recalculateMask);
stmt.AddValue(index++, aura.GetCastDifficulty());
stmt.AddValue(index++, aura.GetStackAmount());
stmt.AddValue(index++, aura.GetMaxDuration());
stmt.AddValue(index++, aura.GetDuration());