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:
@@ -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());
|
||||
|
||||
@@ -1634,7 +1634,7 @@ namespace Game.Entities
|
||||
if (pProto != null && IsInCombat() && (pProto.GetClass() == ItemClass.Weapon || pProto.GetInventoryType() == InventoryType.Relic) && m_weaponChangeTimer == 0)
|
||||
{
|
||||
uint cooldownSpell = (uint)(GetClass() == Class.Rogue ? 6123 : 6119);
|
||||
var spellProto = Global.SpellMgr.GetSpellInfo(cooldownSpell);
|
||||
var spellProto = Global.SpellMgr.GetSpellInfo(cooldownSpell, Difficulty.None);
|
||||
|
||||
if (spellProto == null)
|
||||
Log.outError(LogFilter.Player, "Weapon switch cooldown spell {0} couldn't be found in Spell.dbc", cooldownSpell);
|
||||
@@ -4272,11 +4272,11 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
// check if it is valid spell
|
||||
SpellInfo spellproto = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID);
|
||||
SpellInfo spellproto = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
|
||||
if (spellproto == null)
|
||||
continue;
|
||||
|
||||
if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), GetLevel())
|
||||
if (spellproto.HasAura(AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), GetLevel())
|
||||
&& Global.DB2Mgr.GetHeirloomByItemId(item.GetEntry()) != null)
|
||||
continue;
|
||||
|
||||
@@ -4336,10 +4336,11 @@ namespace Game.Entities
|
||||
DateTime now = GameTime.GetGameTimeSteadyPoint();
|
||||
foreach (ItemEffectRecord effectData in pItem.GetEffects())
|
||||
{
|
||||
SpellInfo effectSpellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
|
||||
// apply proc cooldown to equip auras if we have any
|
||||
if (effectData.TriggerType == ItemSpelltriggerType.OnEquip)
|
||||
{
|
||||
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry((uint)effectData.SpellID);
|
||||
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(effectSpellInfo);
|
||||
if (procEntry == null)
|
||||
continue;
|
||||
|
||||
@@ -4358,7 +4359,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
// Don't replace longer cooldowns by equip cooldown if we have any.
|
||||
if (GetSpellHistory().GetRemainingCooldown(Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID)) > 30 * Time.InMilliseconds)
|
||||
if (GetSpellHistory().GetRemainingCooldown(effectSpellInfo) > 30 * Time.InMilliseconds)
|
||||
continue;
|
||||
|
||||
GetSpellHistory().AddCooldown((uint)effectData.SpellID, pItem.GetEntry(), TimeSpan.FromSeconds(30));
|
||||
@@ -5468,7 +5469,7 @@ namespace Game.Entities
|
||||
|
||||
public void ApplyArtifactPowerRank(Item artifact, ArtifactPowerRankRecord artifactPowerRank, bool apply)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(artifactPowerRank.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(artifactPowerRank.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
@@ -5597,7 +5598,7 @@ namespace Game.Entities
|
||||
|
||||
void ApplyAzeriteEssencePower(AzeriteItem item, AzeriteEssencePowerRecord azeriteEssencePower, bool major, bool apply)
|
||||
{
|
||||
SpellInfo powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MinorPowerDescription);
|
||||
SpellInfo powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MinorPowerDescription, Difficulty.None);
|
||||
if (powerSpell != null)
|
||||
{
|
||||
if (apply)
|
||||
@@ -5608,7 +5609,7 @@ namespace Game.Entities
|
||||
|
||||
if (major)
|
||||
{
|
||||
powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MajorPowerDescription);
|
||||
powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MajorPowerDescription, Difficulty.None);
|
||||
if (powerSpell != null)
|
||||
{
|
||||
if (powerSpell.IsPassive())
|
||||
|
||||
@@ -379,7 +379,7 @@ namespace Game.Entities
|
||||
bool AddPvpTalent(PvpTalentRecord talent, byte activeTalentGroup, byte slot)
|
||||
{
|
||||
//ASSERT(talent);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Spells, $"Player.AddPvpTalent: Spell (ID: {talent.SpellID}) does not exist.");
|
||||
@@ -406,7 +406,7 @@ namespace Game.Entities
|
||||
|
||||
void RemovePvpTalent(PvpTalentRecord talent)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -93,13 +93,13 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)spell_id);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)spell_id, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
// check learned spells state
|
||||
bool found = false;
|
||||
foreach (SpellEffectInfo eff in spellInfo.GetEffectsForDifficulty(Difficulty.None))
|
||||
foreach (SpellEffectInfo eff in spellInfo.GetEffects())
|
||||
{
|
||||
if (eff != null && eff.Effect == SpellEffectName.LearnSpell && !HasSpell(eff.TriggerSpell))
|
||||
{
|
||||
@@ -784,16 +784,16 @@ namespace Game.Entities
|
||||
|
||||
if (quest.SourceSpellID > 0)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID, GetMap().GetDifficultyID());
|
||||
Unit caster = this;
|
||||
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon))
|
||||
{
|
||||
Unit unit = questGiver.ToUnit();
|
||||
if (unit != null)
|
||||
unit.CastSpell(this, quest.SourceSpellID, true);
|
||||
caster = unit;
|
||||
}
|
||||
|
||||
caster.CastSpell(this, quest.SourceSpellID, true);
|
||||
caster.CastSpell(this, spellInfo, true);
|
||||
}
|
||||
|
||||
SetQuestSlot(log_slot, quest_id, qtime);
|
||||
@@ -1092,7 +1092,7 @@ namespace Game.Entities
|
||||
// cast spells after mark quest complete (some spells have quest completed state requirements in spell_area data)
|
||||
if (quest.RewardSpell > 0)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell, GetMap().GetDifficultyID());
|
||||
Unit caster = this;
|
||||
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
|
||||
{
|
||||
@@ -1101,7 +1101,7 @@ namespace Game.Entities
|
||||
caster = unit;
|
||||
}
|
||||
|
||||
caster.CastSpell(this, quest.RewardSpell, true);
|
||||
caster.CastSpell(this, spellInfo, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1109,7 +1109,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (quest.RewardDisplaySpell[i] > 0)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i]);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i], GetMap().GetDifficultyID());
|
||||
Unit caster = this;
|
||||
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
|
||||
{
|
||||
@@ -1118,7 +1118,7 @@ namespace Game.Entities
|
||||
caster = unit;
|
||||
}
|
||||
|
||||
caster.CastSpell(this, quest.RewardDisplaySpell[i], true);
|
||||
caster.CastSpell(this, spellInfo, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace Game.Entities
|
||||
{
|
||||
foreach (uint spellId in overrides)
|
||||
{
|
||||
SpellInfo newInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo newInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (newInfo != null)
|
||||
return GetCastSpellInfo(newInfo);
|
||||
}
|
||||
@@ -338,7 +338,7 @@ namespace Game.Entities
|
||||
for (int j = 0; j < specSpells.Count; ++j)
|
||||
{
|
||||
SpecializationSpellsRecord specSpell = specSpells[j];
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID, Difficulty.None);
|
||||
if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
|
||||
continue;
|
||||
|
||||
@@ -1027,7 +1027,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (proto.Effects[idx].SpellID != 0 && proto.Effects[idx].TriggerType == ItemSpelltriggerType.OnUse)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)proto.Effects[idx].SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)proto.Effects[idx].SpellID, Difficulty.None);
|
||||
if (spellInfo != null)
|
||||
GetSpellHistory().SendCooldownEvent(spellInfo, m_lastPotionId);
|
||||
}
|
||||
@@ -1267,7 +1267,7 @@ namespace Game.Entities
|
||||
uint SkillValue = GetPureSkillValue((SkillType)_spell_idx.SkillupSkillLineID);
|
||||
|
||||
// Alchemy Discoveries here
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(spellid);
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(spellid, Difficulty.None);
|
||||
if (spellEntry != null && spellEntry.Mechanic == Mechanics.Discovery)
|
||||
{
|
||||
uint discoveredSpell = SkillDiscovery.GetSkillDiscoverySpell(_spell_idx.SkillupSkillLineID, spellid, this);
|
||||
@@ -1507,7 +1507,7 @@ namespace Game.Entities
|
||||
uint learn_spell_id = (uint)item.GetEffect(0).SpellID;
|
||||
uint learning_spell_id = (uint)item.GetEffect(1).SpellID;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(learn_spell_id);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(learn_spell_id, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player.CastItemUseSpell: Item (Entry: {0}) in have wrong spell id {1}, ignoring ", item.GetEntry(), learn_spell_id);
|
||||
@@ -1537,7 +1537,7 @@ namespace Game.Entities
|
||||
if (effectData.TriggerType != ItemSpelltriggerType.OnUse)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player.CastItemUseSpell: Item (Entry: {0}) in have wrong spell id {1}, ignoring", item.GetEntry(), effectData.SpellID);
|
||||
@@ -1571,7 +1571,7 @@ namespace Game.Entities
|
||||
if (pEnchant.Effect[s] != ItemEnchantmentType.UseSpell)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s]);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s], Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player.CastItemUseSpell Enchant {0}, cast unknown spell {1}", enchant_id, pEnchant.EffectArg[s]);
|
||||
@@ -1609,7 +1609,7 @@ namespace Game.Entities
|
||||
if (ability.SkillLine != skillId)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ability.Spell);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ability.Spell, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
continue;
|
||||
|
||||
@@ -1855,7 +1855,7 @@ namespace Game.Entities
|
||||
if (pair.Value.State == PlayerSpellState.Removed || pair.Value.Disabled)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
|
||||
if (spellInfo == null || !spellInfo.IsPassive() || spellInfo.EquippedItemClass < 0)
|
||||
continue;
|
||||
|
||||
@@ -2107,7 +2107,7 @@ namespace Game.Entities
|
||||
uint nextSpell = Global.SpellMgr.GetNextSpellInChain(spellId);
|
||||
if (nextSpell != 0)
|
||||
{
|
||||
SpellInfo spellInfo1 = Global.SpellMgr.GetSpellInfo(nextSpell);
|
||||
SpellInfo spellInfo1 = Global.SpellMgr.GetSpellInfo(nextSpell, Difficulty.None);
|
||||
if (HasSpell(nextSpell) && !spellInfo1.HasAttribute(SpellCustomAttributes.IsTalent))
|
||||
RemoveSpell(nextSpell, disabled, false);
|
||||
}
|
||||
@@ -2149,7 +2149,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning)
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||
if (spellInfo != null && spellInfo.IsPrimaryProfessionFirstRank())
|
||||
{
|
||||
uint freeProfs = GetFreePrimaryProfessionPoints() + 1;
|
||||
@@ -2283,7 +2283,7 @@ namespace Game.Entities
|
||||
// passive spells which apply aura and have an item requirement are to be added manually, instead of casted
|
||||
if (spellInfo.EquippedItemClass >= 0)
|
||||
{
|
||||
foreach (SpellEffectInfo effectInfo in spellInfo.GetEffectsForDifficulty(Difficulty.None))
|
||||
foreach (SpellEffectInfo effectInfo in spellInfo.GetEffects())
|
||||
{
|
||||
if (effectInfo != null && effectInfo.IsAura())
|
||||
{
|
||||
@@ -2309,7 +2309,7 @@ namespace Game.Entities
|
||||
|
||||
bool AddSpell(uint spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, uint fromSkill = 0)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
// do character spell book cleanup (all characters)
|
||||
@@ -2476,7 +2476,7 @@ namespace Game.Entities
|
||||
if (_spell.Value.State == PlayerSpellState.Removed)
|
||||
continue;
|
||||
|
||||
SpellInfo i_spellInfo = Global.SpellMgr.GetSpellInfo(_spell.Key);
|
||||
SpellInfo i_spellInfo = Global.SpellMgr.GetSpellInfo(_spell.Key, Difficulty.None);
|
||||
if (i_spellInfo == null)
|
||||
continue;
|
||||
|
||||
@@ -2708,7 +2708,7 @@ namespace Game.Entities
|
||||
|
||||
public void ApplySpellMod(uint spellId, SpellModOp op, ref int basevalue, Spell spell = null)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
@@ -2807,7 +2807,7 @@ namespace Game.Entities
|
||||
|
||||
public void ApplySpellMod(uint spellId, SpellModOp op, ref uint basevalue, Spell spell = null)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
@@ -2906,7 +2906,7 @@ namespace Game.Entities
|
||||
|
||||
public void ApplySpellMod(uint spellId, SpellModOp op, ref float basevalue, Spell spell = null)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
@@ -3117,7 +3117,7 @@ namespace Game.Entities
|
||||
|
||||
foreach (ItemSetSpellRecord itemSetSpell in eff.SetBonuses)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID, Difficulty.None);
|
||||
|
||||
if (itemSetSpell.ChrSpecID != 0 && itemSetSpell.ChrSpecID != GetPrimarySpecialization())
|
||||
ApplyEquipSpell(spellInfo, null, false, false); // item set aura is not for current spec
|
||||
@@ -3137,7 +3137,7 @@ namespace Game.Entities
|
||||
// remove cooldowns on spells that have < 10 min CD
|
||||
GetSpellHistory().ResetCooldowns(p =>
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key, Difficulty.None);
|
||||
return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds && spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds;
|
||||
}, true);
|
||||
|
||||
@@ -3329,7 +3329,7 @@ namespace Game.Entities
|
||||
if (effectData.TriggerType != ItemSpelltriggerType.ChanceOnHit)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "WORLD: unknown Item spellid {0}", effectData.SpellID);
|
||||
@@ -3387,7 +3387,7 @@ namespace Game.Entities
|
||||
if (entry != null && entry.AttributesMask.HasAnyFlag(EnchantProcAttributes.WhiteHit) && damageInfo.GetSpellInfo() != null)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s]);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s], Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player.CastItemCombatSpell(GUID: {0}, name: {1}, enchant: {2}): unknown spell {3} is casted, ignoring...",
|
||||
@@ -3435,8 +3435,8 @@ namespace Game.Entities
|
||||
|
||||
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
{
|
||||
if (spellInfo.GetEffect(Difficulty.None, i).IsEffect())
|
||||
values.Add(SpellValueMod.BasePoint0 + i, MathFunctions.CalculatePct(spellInfo.GetEffect(Difficulty.None, i).CalcValue(this), effectPct));
|
||||
if (spellInfo.GetEffect(i).IsEffect())
|
||||
values.Add(SpellValueMod.BasePoint0 + i, MathFunctions.CalculatePct(spellInfo.GetEffect(i).CalcValue(this), effectPct));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3478,7 +3478,7 @@ namespace Game.Entities
|
||||
|
||||
foreach (var spellId in smap.Keys)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Game.Entities
|
||||
|
||||
public bool AddTalent(TalentRecord talent, byte spec, bool learning)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Spells, "Player.AddTalent: Spell (ID: {0}) does not exist.", talent.SpellID);
|
||||
@@ -84,14 +84,14 @@ namespace Game.Entities
|
||||
|
||||
public void RemoveTalent(TalentRecord talent)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
RemoveSpell(talent.SpellID, true);
|
||||
|
||||
// search for spells that the talent teaches and unlearn them
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
|
||||
RemoveSpell(effect.TriggerSpell, true);
|
||||
|
||||
@@ -294,14 +294,14 @@ namespace Game.Entities
|
||||
if (talentInfo.SpellID == 0)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
continue;
|
||||
|
||||
RemoveSpell(talentInfo.SpellID, true);
|
||||
|
||||
// search for spells that the talent teaches and unlearn them
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
|
||||
RemoveSpell(effect.TriggerSpell, true);
|
||||
|
||||
@@ -311,14 +311,14 @@ namespace Game.Entities
|
||||
|
||||
foreach (var talentInfo in CliDB.PvpTalentStorage.Values)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
continue;
|
||||
|
||||
RemoveSpell(talentInfo.SpellID, true);
|
||||
|
||||
// search for spells that the talent teaches and unlearn them
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
|
||||
RemoveSpell(effect.TriggerSpell, true);
|
||||
|
||||
@@ -575,7 +575,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID);
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
|
||||
if (spellEntry == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player {0} has unknown talent spell: {1}", GetName(), talentInfo.SpellID);
|
||||
@@ -597,7 +597,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID);
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
|
||||
if (spellEntry == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, $"Player.SendTalentsInfoData: Player '{GetName()}' ({GetGUID()}) has unknown pvp talent spell: {talentInfo.SpellID}");
|
||||
|
||||
@@ -1182,7 +1182,7 @@ namespace Game.Entities
|
||||
for (uint i = 0; i < SharedConst.MaxCreatureSpells; ++i)
|
||||
{
|
||||
uint spellId = vehicle.m_spells[i];
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
continue;
|
||||
|
||||
@@ -1193,7 +1193,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
if (spellInfo.IsPassive())
|
||||
vehicle.CastSpell(vehicle, spellId, true);
|
||||
vehicle.CastSpell(vehicle, spellInfo, true);
|
||||
|
||||
petSpells.ActionButtons[i] = UnitActionBarEntry.MAKE_UNIT_ACTION_BUTTON(spellId, i + 8);
|
||||
}
|
||||
@@ -1429,7 +1429,7 @@ namespace Game.Entities
|
||||
switch ((ActionButtonType)type)
|
||||
{
|
||||
case ActionButtonType.Spell:
|
||||
if (Global.SpellMgr.GetSpellInfo(action) == null)
|
||||
if (!Global.SpellMgr.HasSpellInfo(action, Difficulty.None))
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Spell action {0} not added into button {1} for player {2} (GUID: {3}): spell not exist", action, button, GetName(), GetGUID());
|
||||
return false;
|
||||
@@ -3723,7 +3723,7 @@ namespace Game.Entities
|
||||
|
||||
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster)
|
||||
{
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index);
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(index);
|
||||
if (effect == null || !effect.IsEffect())
|
||||
return false;
|
||||
|
||||
@@ -4937,7 +4937,7 @@ namespace Game.Entities
|
||||
{
|
||||
//returning of reagents only for players, so best done here
|
||||
uint spellId = pet ? pet.m_unitData.CreatedBySpell : m_oldpetspell;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
|
||||
if (spellInfo != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user