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:
@@ -539,9 +539,9 @@ namespace Game.Entities
|
||||
switch (action.TargetType)
|
||||
{
|
||||
case AreaTriggerActionUserTypes.Friend:
|
||||
return caster._IsValidAssistTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param));
|
||||
return caster._IsValidAssistTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param, caster.GetMap().GetDifficultyID()));
|
||||
case AreaTriggerActionUserTypes.Enemy:
|
||||
return caster._IsValidAttackTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param));
|
||||
return caster._IsValidAttackTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param, caster.GetMap().GetDifficultyID()));
|
||||
case AreaTriggerActionUserTypes.Raid:
|
||||
return caster.IsInRaidWith(unit);
|
||||
case AreaTriggerActionUserTypes.Party:
|
||||
|
||||
@@ -1760,7 +1760,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
bool immunedToAllEffects = true;
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
{
|
||||
if (effect == null || !effect.IsEffect())
|
||||
continue;
|
||||
@@ -1780,7 +1780,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)
|
||||
return true;
|
||||
|
||||
@@ -1816,7 +1816,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (m_spells[i] == 0)
|
||||
continue;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i]);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i], GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]);
|
||||
@@ -1824,7 +1824,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
bool bcontinue = true;
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
{
|
||||
if (effect != null && ((effect.Effect == SpellEffectName.SchoolDamage) || (effect.Effect == SpellEffectName.Instakill)
|
||||
|| (effect.Effect == SpellEffectName.EnvironmentalDamage) || (effect.Effect == SpellEffectName.HealthLeech)))
|
||||
@@ -1865,7 +1865,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (m_spells[i] == 0)
|
||||
continue;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i]);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i], GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]);
|
||||
@@ -1873,7 +1873,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
bool bcontinue = true;
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
{
|
||||
if (effect != null && effect.Effect == SpellEffectName.Heal)
|
||||
{
|
||||
@@ -2209,7 +2209,7 @@ namespace Game.Entities
|
||||
{
|
||||
foreach (var id in cainfo.auras)
|
||||
{
|
||||
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id);
|
||||
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id, GetMap().GetDifficultyID());
|
||||
if (AdditionalSpellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "Creature ({0}) has wrong spell {1} defined in `auras` field.", GetGUID().ToString(), id);
|
||||
@@ -2593,7 +2593,7 @@ namespace Game.Entities
|
||||
if (spellID == 0)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID, GetMap().GetDifficultyID());
|
||||
if (spellInfo != null)
|
||||
{
|
||||
if (spellInfo.GetRecoveryTime() == 0 // No cooldown
|
||||
@@ -2771,7 +2771,7 @@ namespace Game.Entities
|
||||
SpellInfo spellInfo = focusSpell.GetSpellInfo();
|
||||
|
||||
// don't use spell focus for vehicle spells
|
||||
if (spellInfo.HasAura(Difficulty.None, AuraType.ControlVehicle))
|
||||
if (spellInfo.HasAura(AuraType.ControlVehicle))
|
||||
return;
|
||||
|
||||
if ((!target || target == this) && focusSpell.GetCastTime() == 0) // instant cast, untargeted (or self-targeted) spell doesn't need any facing updates
|
||||
|
||||
@@ -442,18 +442,12 @@ namespace Game.Misc
|
||||
packet.SuggestedPartyMembers = quest.SuggestedPlayers;
|
||||
|
||||
// RewardSpell can teach multiple spells in trigger spell effects. But not all effects must be SPELL_EFFECT_LEARN_SPELL. See example spell 33950
|
||||
if (quest.RewardSpell != 0)
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell, Difficulty.None);
|
||||
if (spellInfo != null)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell);
|
||||
if (spellInfo.HasEffect(SpellEffectName.LearnSpell))
|
||||
{
|
||||
var effects = spellInfo.GetEffectsForDifficulty(Difficulty.None);
|
||||
foreach (var spellEffectInfo in effects)
|
||||
{
|
||||
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell))
|
||||
packet.LearnSpells.Add(spellEffectInfo.TriggerSpell);
|
||||
}
|
||||
}
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect.IsEffect(SpellEffectName.LearnSpell))
|
||||
packet.LearnSpells.Add(effect.TriggerSpell);
|
||||
}
|
||||
|
||||
quest.BuildQuestRewards(packet.Rewards, _session.GetPlayer());
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Game.Entities
|
||||
public Array<uint> ReqAbility = new Array<uint>(3);
|
||||
public byte ReqLevel;
|
||||
|
||||
public bool IsCastable() { return Global.SpellMgr.GetSpellInfo(SpellId).HasEffect(SpellEffectName.LearnSpell); }
|
||||
public bool IsCastable() { return Global.SpellMgr.GetSpellInfo(SpellId, Difficulty.None).HasEffect(SpellEffectName.LearnSpell); }
|
||||
}
|
||||
|
||||
public class Trainer
|
||||
@@ -98,7 +98,7 @@ namespace Game.Entities
|
||||
if (state != TrainerSpellState.Available)
|
||||
return false;
|
||||
|
||||
SpellInfo trainerSpellInfo = Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId);
|
||||
SpellInfo trainerSpellInfo = Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None);
|
||||
if (trainerSpellInfo.IsPrimaryProfessionFirstRank() && player.GetFreePrimaryProfessionPoints() == 0)
|
||||
return false;
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Game.Entities
|
||||
// check ranks
|
||||
bool hasLearnSpellEffect = false;
|
||||
bool knowsAllLearnedSpells = true;
|
||||
foreach (SpellEffectInfo spellEffect in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId).GetEffectsForDifficulty(Difficulty.None))
|
||||
foreach (SpellEffectInfo spellEffect in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None).GetEffects())
|
||||
{
|
||||
if (spellEffect == null || !spellEffect.IsEffect(SpellEffectName.LearnSpell))
|
||||
continue;
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace Game.Entities
|
||||
|
||||
public SpellInfo GetSpellInfo()
|
||||
{
|
||||
return Global.SpellMgr.GetSpellInfo(GetSpellId());
|
||||
return Global.SpellMgr.GetSpellInfo(GetSpellId(), GetMap().GetDifficultyID());
|
||||
}
|
||||
|
||||
public override void BuildValuesCreate(WorldPacket data, Player target)
|
||||
|
||||
@@ -1215,7 +1215,7 @@ namespace Game.Entities
|
||||
if (trapInfo == null || trapInfo.type != GameObjectTypes.Trap)
|
||||
return;
|
||||
|
||||
SpellInfo trapSpell = Global.SpellMgr.GetSpellInfo(trapInfo.Trap.spell);
|
||||
SpellInfo trapSpell = Global.SpellMgr.GetSpellInfo(trapInfo.Trap.spell, GetMap().GetDifficultyID());
|
||||
if (trapSpell == null) // checked at load already
|
||||
return;
|
||||
|
||||
@@ -1945,7 +1945,7 @@ namespace Game.Entities
|
||||
if (spellId == 0)
|
||||
return;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
{
|
||||
if (!user.IsTypeId(TypeId.Player) || !Global.OutdoorPvPMgr.HandleCustomSpell(user.ToPlayer(), spellId, this))
|
||||
@@ -1972,12 +1972,12 @@ namespace Game.Entities
|
||||
|
||||
public void CastSpell(Unit target, uint spellId, TriggerCastFlags triggered)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
bool self = false;
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
{
|
||||
if (effect != null && effect.TargetA.GetTarget() == Targets.UnitCaster)
|
||||
{
|
||||
|
||||
@@ -2340,7 +2340,7 @@ namespace Game.Entities
|
||||
if (eff.SetBonuses.Contains(itemSetSpell))
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "WORLD: unknown spell id {0} in items set {1} effects", itemSetSpell.SpellID, setid);
|
||||
@@ -2392,7 +2392,7 @@ namespace Game.Entities
|
||||
if (!eff.SetBonuses.Contains(itemSetSpell))
|
||||
continue;
|
||||
|
||||
player.ApplyEquipSpell(Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID), null, false);
|
||||
player.ApplyEquipSpell(Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID, Difficulty.None), null, false);
|
||||
eff.SetBonuses.Remove(itemSetSpell);
|
||||
}
|
||||
|
||||
|
||||
@@ -2093,10 +2093,10 @@ namespace Game.Entities
|
||||
CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate();
|
||||
|
||||
// this also applies for transform auras
|
||||
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm());
|
||||
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm(), unit.GetMap().GetDifficultyID());
|
||||
if (transform != null)
|
||||
{
|
||||
foreach (SpellEffectInfo effect in transform.GetEffectsForDifficulty(unit.GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in transform.GetEffects())
|
||||
{
|
||||
if (effect != null && effect.IsAura(AuraType.Transform))
|
||||
{
|
||||
|
||||
+21
-13
@@ -146,7 +146,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
uint summonSpellId = result.Read<uint>(14);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(summonSpellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(summonSpellId, owner.GetMap().GetDifficultyID());
|
||||
|
||||
bool isTemporarySummon = spellInfo != null && spellInfo.GetDuration() > 0;
|
||||
if (current && isTemporarySummon)
|
||||
@@ -887,15 +887,22 @@ namespace Game.Entities
|
||||
|
||||
AuraKey key = new AuraKey(casterGuid, itemGuid, result.Read<uint>(1), result.Read<uint>(2));
|
||||
uint recalculateMask = result.Read<uint>(3);
|
||||
byte stackCount = result.Read<byte>(4);
|
||||
int maxDuration = result.Read<int>(5);
|
||||
int remainTime = result.Read<int>(6);
|
||||
byte remainCharges = result.Read<byte>(7);
|
||||
Difficulty difficulty = (Difficulty)result.Read<byte>(4);
|
||||
byte stackCount = result.Read<byte>(5);
|
||||
int maxDuration = result.Read<int>(6);
|
||||
int remainTime = result.Read<int>(7);
|
||||
byte remainCharges = result.Read<byte>(8);
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId, difficulty);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Pet, "Unknown aura (spellid {0}), ignore.", key.SpellId);
|
||||
Log.outError(LogFilter.Pet, "Pet._LoadAuras: Unknown aura (spellid {0}), ignore.", key.SpellId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (difficulty != Difficulty.None && !CliDB.DifficultyStorage.ContainsKey(difficulty))
|
||||
{
|
||||
Log.outError(LogFilter.Pet, $"Pet._LoadAuras: Unknown difficulty {difficulty} (spellid {key.SpellId}), ignore.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -919,7 +926,7 @@ namespace Game.Entities
|
||||
|
||||
var 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);
|
||||
Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, difficulty, info.BaseAmounts, null, casterGuid);
|
||||
if (aura != null)
|
||||
{
|
||||
if (!aura.CanBeSaved())
|
||||
@@ -969,6 +976,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());
|
||||
@@ -996,7 +1004,7 @@ namespace Game.Entities
|
||||
|
||||
bool AddSpell(uint spellId, ActiveStates active = ActiveStates.Decide, PetSpellState state = PetSpellState.New, PetSpellType type = PetSpellType.Normal)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
// do pet spell book cleanup
|
||||
@@ -1062,7 +1070,7 @@ namespace Game.Entities
|
||||
if (pair.Value.state == PetSpellState.Removed)
|
||||
continue;
|
||||
|
||||
SpellInfo oldRankSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Key);
|
||||
SpellInfo oldRankSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
|
||||
|
||||
if (oldRankSpellInfo == null)
|
||||
continue;
|
||||
@@ -1156,7 +1164,7 @@ namespace Game.Entities
|
||||
{
|
||||
for (byte i = 0; i < SharedConst.MaxCreatureSpellDataSlots; ++i)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(defSpells.spellid[i]);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(defSpells.spellid[i], Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
continue;
|
||||
|
||||
@@ -1254,7 +1262,7 @@ namespace Game.Entities
|
||||
GetCharmInfo().SetActionBar(i, 0, ActiveStates.Passive);
|
||||
else if (ab.GetActiveState() == ActiveStates.Enabled)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ab.GetAction());
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ab.GetAction(), Difficulty.None);
|
||||
if (spellInfo != null)
|
||||
ToggleAutocast(spellInfo, true);
|
||||
}
|
||||
@@ -1518,7 +1526,7 @@ namespace Game.Entities
|
||||
{
|
||||
foreach (var specSpell in specSpells)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID, Difficulty.None);
|
||||
if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -913,12 +913,12 @@ namespace Game.Entities
|
||||
return 0;
|
||||
|
||||
int resistMech = 0;
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
{
|
||||
if (effect == null || !effect.IsEffect())
|
||||
break;
|
||||
|
||||
int effect_mech = (int)spellInfo.GetEffectMechanic(effect.EffectIndex, GetMap().GetDifficultyID());
|
||||
int effect_mech = (int)spellInfo.GetEffectMechanic(effect.EffectIndex);
|
||||
if (effect_mech != 0)
|
||||
{
|
||||
int temp = GetTotalAuraModifierByMiscValue(AuraType.ModMechanicResistance, effect_mech);
|
||||
@@ -1451,7 +1451,7 @@ namespace Game.Entities
|
||||
Aura aura = GetAura(chrSpec.MasterySpellID[i]);
|
||||
if (aura != null)
|
||||
{
|
||||
foreach (SpellEffectInfo effect in aura.GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in aura.GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect == null)
|
||||
continue;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Game.Entities
|
||||
base.InitStats(duration);
|
||||
|
||||
// Get spell cast by totem
|
||||
SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell());
|
||||
SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell(), GetMap().GetDifficultyID());
|
||||
if (totemSpell != null)
|
||||
if (totemSpell.CalcCastTime(GetLevel()) != 0) // If spell has cast time . its an active totem
|
||||
m_type = TotemType.Active;
|
||||
@@ -124,7 +124,7 @@ namespace Game.Entities
|
||||
{
|
||||
owner.SendAutoRepeatCancel(this);
|
||||
|
||||
SpellInfo spell = Global.SpellMgr.GetSpellInfo(m_unitData.CreatedBySpell);
|
||||
SpellInfo spell = Global.SpellMgr.GetSpellInfo(m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
|
||||
if (spell != null)
|
||||
GetSpellHistory().SendCooldownEvent(spell, 0, null, false);
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Game.Entities
|
||||
if (GetEntry() == 5925)
|
||||
return false;
|
||||
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index);
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(index);
|
||||
if (effect == null)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Game.Entities
|
||||
for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i)
|
||||
{
|
||||
uint spellId = _unit.ToCreature().m_spells[i];
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, _unit.GetMap().GetDifficultyID());
|
||||
if (spellInfo != null)
|
||||
{
|
||||
if (spellInfo.IsPassive())
|
||||
@@ -133,7 +133,7 @@ namespace Game.Entities
|
||||
for (uint x = 0; x < SharedConst.MaxSpellCharm; ++x)
|
||||
{
|
||||
uint spellId = _unit.ToCreature().m_spells[x];
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, _unit.GetMap().GetDifficultyID());
|
||||
|
||||
if (spellInfo == null)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ namespace Game.Entities
|
||||
// check correctness
|
||||
if (PetActionBar[index].IsActionBarForSpell())
|
||||
{
|
||||
SpellInfo spelInfo = Global.SpellMgr.GetSpellInfo(PetActionBar[index].GetAction());
|
||||
SpellInfo spelInfo = Global.SpellMgr.GetSpellInfo(PetActionBar[index].GetAction(), _unit.GetMap().GetDifficultyID());
|
||||
if (spelInfo == null)
|
||||
SetActionBar(index, 0, ActiveStates.Passive);
|
||||
else if (!spelInfo.IsAutocastable())
|
||||
|
||||
@@ -1108,7 +1108,7 @@ namespace Game.Entities
|
||||
if (!victim.IsTypeId(TypeId.Player))
|
||||
{
|
||||
// Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this
|
||||
if (damagetype != DamageEffectType.DOT && damage > 0 && !victim.GetOwnerGUID().IsPlayer() && (spellProto == null || !spellProto.HasAura(GetMap().GetDifficultyID(), AuraType.DamageShield)))
|
||||
if (damagetype != DamageEffectType.DOT && damage > 0 && !victim.GetOwnerGUID().IsPlayer() && (spellProto == null || !spellProto.HasAura(AuraType.DamageShield)))
|
||||
victim.ToCreature().SetLastDamagedTime(GameTime.GetGameTime() + SharedConst.MaxAggroResetTime);
|
||||
|
||||
victim.AddThreat(this, damage, damageSchoolMask, spellProto);
|
||||
@@ -2632,7 +2632,7 @@ namespace Game.Entities
|
||||
uint split_absorb = 0;
|
||||
DealDamageMods(caster, ref splitDamage, ref split_absorb);
|
||||
|
||||
SpellNonMeleeDamage log = new SpellNonMeleeDamage(this, caster, itr.GetSpellInfo().Id, itr.GetBase().GetSpellXSpellVisualId(), damageInfo.GetSchoolMask(), itr.GetBase().GetCastGUID());
|
||||
SpellNonMeleeDamage log = new SpellNonMeleeDamage(this, caster, itr.GetSpellInfo(), itr.GetBase().GetSpellXSpellVisualId(), damageInfo.GetSchoolMask(), itr.GetBase().GetCastGUID());
|
||||
CleanDamage cleanDamage = new CleanDamage(splitDamage, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
|
||||
DealDamage(caster, splitDamage, cleanDamage, DamageEffectType.Direct, damageInfo.GetSchoolMask(), itr.GetSpellInfo(), false);
|
||||
log.damage = splitDamage;
|
||||
@@ -2806,7 +2806,7 @@ namespace Game.Entities
|
||||
|
||||
if (APbonus != 0) // Can be negative
|
||||
{
|
||||
bool normalized = spellProto != null && spellProto.HasEffect(GetMap().GetDifficultyID(), SpellEffectName.NormalizedWeaponDmg);
|
||||
bool normalized = spellProto != null && spellProto.HasEffect(SpellEffectName.NormalizedWeaponDmg);
|
||||
DoneFlatBenefit += (int)(APbonus / 3.5f * GetAPMultiplier(attType, normalized));
|
||||
}
|
||||
|
||||
@@ -2986,7 +2986,7 @@ namespace Game.Entities
|
||||
if (!spellInfo.IsChanneled() && DotDuration > 0)
|
||||
DotFactor = DotDuration / 15000.0f;
|
||||
|
||||
uint DotTicks = spellInfo.GetMaxTicks(GetMap().GetDifficultyID());
|
||||
uint DotTicks = spellInfo.GetMaxTicks();
|
||||
if (DotTicks != 0)
|
||||
DotFactor /= DotTicks;
|
||||
}
|
||||
@@ -3051,12 +3051,12 @@ namespace Game.Entities
|
||||
// can't attack invisible
|
||||
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible))
|
||||
{
|
||||
if (obj && !obj.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())))
|
||||
if (obj && !obj.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea()))
|
||||
return false;
|
||||
else if (!obj)
|
||||
{
|
||||
// ignore stealth for aoe spells. Ignore stealth if target is player and unit in combat with same player
|
||||
bool ignoreStealthCheck = (bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())) ||
|
||||
bool ignoreStealthCheck = (bySpell != null && bySpell.IsAffectingArea()) ||
|
||||
(target.GetTypeId() == TypeId.Player && target.HasStealthAura() && target.IsInCombat() && IsInCombatWith(target));
|
||||
|
||||
if (!CanSeeOrDetect(target, ignoreStealthCheck))
|
||||
@@ -3185,7 +3185,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
// can't assist invisible
|
||||
if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())))
|
||||
if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea()))
|
||||
return false;
|
||||
|
||||
// can't assist dead
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace Game.Entities
|
||||
m_attacker = spellNonMeleeDamage.attacker;
|
||||
m_victim = spellNonMeleeDamage.target;
|
||||
m_damage = spellNonMeleeDamage.damage;
|
||||
m_spellInfo = Global.SpellMgr.GetSpellInfo(spellNonMeleeDamage.SpellId);
|
||||
m_spellInfo = spellNonMeleeDamage.Spell;
|
||||
m_schoolMask = spellNonMeleeDamage.schoolMask;
|
||||
m_damageType = damageType;
|
||||
m_attackType = attackType;
|
||||
@@ -450,11 +450,11 @@ namespace Game.Entities
|
||||
|
||||
public class SpellNonMeleeDamage
|
||||
{
|
||||
public SpellNonMeleeDamage(Unit _attacker, Unit _target, uint _SpellID, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default)
|
||||
public SpellNonMeleeDamage(Unit _attacker, Unit _target, SpellInfo _spellInfo, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default)
|
||||
{
|
||||
target = _target;
|
||||
attacker = _attacker;
|
||||
SpellId = _SpellID;
|
||||
Spell = _spellInfo;
|
||||
SpellXSpellVisualID = _SpellXSpellVisualID;
|
||||
schoolMask = _schoolMask;
|
||||
castId = _castId;
|
||||
@@ -464,7 +464,7 @@ namespace Game.Entities
|
||||
public Unit target;
|
||||
public Unit attacker;
|
||||
public ObjectGuid castId;
|
||||
public uint SpellId;
|
||||
public SpellInfo Spell;
|
||||
public uint SpellXSpellVisualID;
|
||||
public uint damage;
|
||||
public uint originalDamage;
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Game.Entities
|
||||
minion.SetSpeedRate(i, m_speed_rate[(int)i]);
|
||||
|
||||
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
|
||||
if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent())
|
||||
GetSpellHistory().StartCooldown(spellInfo, 0, null, true);
|
||||
}
|
||||
@@ -222,10 +222,10 @@ namespace Game.Entities
|
||||
else if (minion.IsTotem())
|
||||
{
|
||||
// All summoned by totem minions must disappear when it is removed.
|
||||
SpellInfo spInfo = Global.SpellMgr.GetSpellInfo(minion.ToTotem().GetSpell());
|
||||
SpellInfo spInfo = Global.SpellMgr.GetSpellInfo(minion.ToTotem().GetSpell(), GetMap().GetDifficultyID());
|
||||
if (spInfo != null)
|
||||
{
|
||||
foreach (SpellEffectInfo effect in spInfo.GetEffectsForDifficulty(Difficulty.None))
|
||||
foreach (SpellEffectInfo effect in spInfo.GetEffects())
|
||||
{
|
||||
if (effect == null || effect.Effect != SpellEffectName.Summon)
|
||||
continue;
|
||||
@@ -235,7 +235,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
|
||||
// Remove infinity cooldown
|
||||
if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent())
|
||||
GetSpellHistory().SendCooldownEvent(spellInfo);
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace Game.Entities
|
||||
// function uses real base points (typically value - 1)
|
||||
public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, int? basePoints = null, uint castItemId = 0, int itemLevel = -1)
|
||||
{
|
||||
SpellEffectInfo effect = spellProto.GetEffect(GetMap().GetDifficultyID(), effect_index);
|
||||
SpellEffectInfo effect = spellProto.GetEffect(effect_index);
|
||||
return effect != null ? effect.CalcValue(this, basePoints, target, castItemId, itemLevel) : 0;
|
||||
}
|
||||
public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, out float variance, int? basePoints = null, uint castItemId = 0, int itemLevel = -1)
|
||||
{
|
||||
SpellEffectInfo effect = spellProto.GetEffect(GetMap().GetDifficultyID(), effect_index);
|
||||
SpellEffectInfo effect = spellProto.GetEffect(effect_index);
|
||||
variance = 0.0f;
|
||||
return effect != null ? effect.CalcValue(out variance, this, basePoints, target, castItemId, itemLevel) : 0;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ namespace Game.Entities
|
||||
DoneTotal += (int)(DoneAdvertisedBenefit * coeff * stack);
|
||||
}
|
||||
|
||||
foreach (SpellEffectInfo eff in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo eff in spellProto.GetEffects())
|
||||
{
|
||||
if (eff == null)
|
||||
continue;
|
||||
@@ -586,7 +586,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
});
|
||||
|
||||
foreach (SpellEffectInfo eff in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo eff in spellProto.GetEffects())
|
||||
{
|
||||
if (eff == null)
|
||||
continue;
|
||||
@@ -1040,7 +1040,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void CastSpell(Unit victim, uint spellId, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Spells, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
|
||||
@@ -1061,7 +1061,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void CastSpell(float x, float y, float z, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
|
||||
@@ -1074,7 +1074,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void CastSpell(GameObject go, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
|
||||
@@ -1111,7 +1111,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void CastCustomSpell(uint spellId, Dictionary<SpellValueMod, int> values, Unit victim = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
|
||||
@@ -1152,7 +1152,7 @@ namespace Game.Entities
|
||||
bool DirectDamage = false;
|
||||
bool AreaEffect = false;
|
||||
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffects())
|
||||
{
|
||||
if (effect == null)
|
||||
continue;
|
||||
@@ -1213,7 +1213,7 @@ namespace Game.Entities
|
||||
CastingTime /= 2;
|
||||
|
||||
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffects())
|
||||
{
|
||||
if (effect != null && (effect.Effect == SpellEffectName.HealthLeech ||
|
||||
(effect.Effect == SpellEffectName.ApplyAura && effect.ApplyAuraName == AuraType.PeriodicLeech)))
|
||||
@@ -1239,7 +1239,7 @@ namespace Game.Entities
|
||||
bool matches = auraEffect.GetMiscValue() != 0 ? auraEffect.GetMiscValue() == spellInfo.Id : auraEffect.IsAffectingSpell(spellInfo);
|
||||
if (matches)
|
||||
{
|
||||
SpellInfo info = Global.SpellMgr.GetSpellInfo((uint)auraEffect.GetAmount());
|
||||
SpellInfo info = Global.SpellMgr.GetSpellInfo((uint)auraEffect.GetAmount(), GetMap().GetDifficultyID());
|
||||
if (info != null)
|
||||
return info;
|
||||
}
|
||||
@@ -1266,7 +1266,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (effect.GetMiscValue() == spellInfo.Id)
|
||||
{
|
||||
SpellInfo visualSpell = Global.SpellMgr.GetSpellInfo((uint)effect.GetMiscValueB());
|
||||
SpellInfo visualSpell = Global.SpellMgr.GetSpellInfo((uint)effect.GetMiscValueB(), GetMap().GetDifficultyID());
|
||||
if (visualSpell != null)
|
||||
{
|
||||
spellInfo = visualSpell;
|
||||
@@ -1512,7 +1512,7 @@ namespace Game.Entities
|
||||
int gain = victim.ModifyPower(powerType, damage);
|
||||
int overEnergize = damage - gain;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
victim.GetHostileRefManager().ThreatAssist(this, damage * 0.5f, spellInfo);
|
||||
|
||||
SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType);
|
||||
@@ -1583,7 +1583,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
bool immuneToAllEffects = true;
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
{
|
||||
// State/effect immunities applied by aura expect full spell immunity
|
||||
// Ignore effects with mechanic, they are supposed to be checked separately
|
||||
@@ -1610,7 +1610,7 @@ namespace Game.Entities
|
||||
if ((pair.Key & schoolMask) == 0)
|
||||
continue;
|
||||
|
||||
SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value);
|
||||
SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value, GetMap().GetDifficultyID());
|
||||
if (!(immuneSpellInfo != null && immuneSpellInfo.IsPositive() && spellInfo.IsPositive() && caster && IsFriendlyTo(caster)))
|
||||
if (!spellInfo.CanPierceImmuneAura(immuneSpellInfo))
|
||||
schoolImmunityMask |= pair.Key;
|
||||
@@ -1654,7 +1654,7 @@ namespace Game.Entities
|
||||
if (spellInfo == null)
|
||||
return false;
|
||||
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index);
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(index);
|
||||
if (effect == null || !effect.IsEffect())
|
||||
return false;
|
||||
|
||||
@@ -1731,7 +1731,7 @@ namespace Game.Entities
|
||||
uint schoolImmunityMask = 0;
|
||||
var schoolList = m_spellImmune[(int)SpellImmunity.School];
|
||||
foreach (var pair in schoolList)
|
||||
if (Convert.ToBoolean(pair.Key & schoolMask) && !spellInfo.CanPierceImmuneAura(Global.SpellMgr.GetSpellInfo(pair.Value)))
|
||||
if (Convert.ToBoolean(pair.Key & schoolMask) && !spellInfo.CanPierceImmuneAura(Global.SpellMgr.GetSpellInfo(pair.Value, GetMap().GetDifficultyID())))
|
||||
schoolImmunityMask |= pair.Key;
|
||||
|
||||
// // We need to be immune to all types
|
||||
@@ -2212,7 +2212,7 @@ namespace Game.Entities
|
||||
if (transformId == 0)
|
||||
return false;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(transformId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(transformId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
return false;
|
||||
|
||||
@@ -2465,16 +2465,15 @@ namespace Game.Entities
|
||||
if (!victim.IsAlive() || victim.HasUnitState(UnitState.InFlight) || (victim.IsTypeId(TypeId.Unit) && victim.ToCreature().IsEvadingAttacks()))
|
||||
return;
|
||||
|
||||
SpellInfo spellProto = Global.SpellMgr.GetSpellInfo(damageInfo.SpellId);
|
||||
if (spellProto == null)
|
||||
if (damageInfo.Spell == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Unit, "Unit.DealSpellDamage has wrong damageInfo.SpellID: {0}", damageInfo.SpellId);
|
||||
Log.outDebug(LogFilter.Unit, "Unit.DealSpellDamage has no spell");
|
||||
return;
|
||||
}
|
||||
|
||||
// Call default DealDamage
|
||||
CleanDamage cleanDamage = new CleanDamage(damageInfo.cleanDamage, damageInfo.absorb, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
|
||||
DealDamage(victim, damageInfo.damage, cleanDamage, DamageEffectType.SpellDirect, damageInfo.schoolMask, spellProto, durabilityLoss);
|
||||
DealDamage(victim, damageInfo.damage, cleanDamage, DamageEffectType.SpellDirect, damageInfo.schoolMask, damageInfo.Spell, durabilityLoss);
|
||||
}
|
||||
|
||||
public void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage log)
|
||||
@@ -2483,7 +2482,7 @@ namespace Game.Entities
|
||||
packet.Me = log.target.GetGUID();
|
||||
packet.CasterGUID = log.attacker.GetGUID();
|
||||
packet.CastID = log.castId;
|
||||
packet.SpellID = (int)log.SpellId;
|
||||
packet.SpellID = (int)(log.Spell != null ? log.Spell.Id : 0);
|
||||
packet.Damage = (int)log.damage;
|
||||
packet.OriginalDamage = (int)log.originalDamage;
|
||||
if (log.damage > log.preHitHealth)
|
||||
@@ -2622,7 +2621,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// turn off snare auras by setting amount to 0
|
||||
foreach (SpellEffectInfo effect in aura.GetSpellInfo().GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in aura.GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect == null || !effect.IsEffect())
|
||||
continue;
|
||||
@@ -2902,7 +2901,7 @@ namespace Game.Entities
|
||||
if (target == null)
|
||||
return null;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (spellInfo == null)
|
||||
return null;
|
||||
|
||||
@@ -2929,7 +2928,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast));
|
||||
Aura aura = Aura.TryRefreshStackOrCreate(spellInfo, castId, effMask, target, this);
|
||||
Aura aura = Aura.TryRefreshStackOrCreate(spellInfo, castId, effMask, target, this, GetMap().GetDifficultyID());
|
||||
if (aura != null)
|
||||
{
|
||||
aura.ApplyForTargets();
|
||||
@@ -2960,14 +2959,14 @@ namespace Game.Entities
|
||||
Unit target = Convert.ToBoolean(clickInfo.castFlags & (byte)SpellClickCastFlags.TargetClicker) ? clicker : this;
|
||||
ObjectGuid origCasterGUID = Convert.ToBoolean(clickInfo.castFlags & (byte)SpellClickCastFlags.OrigCasterOwner) ? GetOwnerGUID() : clicker.GetGUID();
|
||||
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(clickInfo.spellId);
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(clickInfo.spellId, caster.GetMap().GetDifficultyID());
|
||||
// if (!spellEntry) should be checked at npc_spellclick load
|
||||
|
||||
if (seatId > -1)
|
||||
{
|
||||
byte i = 0;
|
||||
bool valid = false;
|
||||
foreach (SpellEffectInfo effect in spellEntry.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellEntry.GetEffects())
|
||||
{
|
||||
if (effect == null)
|
||||
continue;
|
||||
@@ -2991,14 +2990,14 @@ namespace Game.Entities
|
||||
else // This can happen during Player._LoadAuras
|
||||
{
|
||||
int[] bp0 = new int[SpellConst.MaxEffects];
|
||||
foreach (SpellEffectInfo effect in spellEntry.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellEntry.GetEffects())
|
||||
{
|
||||
if (effect != null)
|
||||
bp0[effect.EffectIndex] = effect.BasePoints;
|
||||
}
|
||||
|
||||
bp0[i] = seatId;
|
||||
Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, bp0, null, origCasterGUID);
|
||||
Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, GetMap().GetDifficultyID(), bp0, null, origCasterGUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3006,7 +3005,7 @@ namespace Game.Entities
|
||||
if (IsInMap(caster))
|
||||
caster.CastSpell(target, spellEntry, flags, null, null, origCasterGUID);
|
||||
else
|
||||
Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, null, null, origCasterGUID);
|
||||
Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, GetMap().GetDifficultyID(), null, null, origCasterGUID);
|
||||
}
|
||||
|
||||
result = true;
|
||||
@@ -3045,7 +3044,7 @@ namespace Game.Entities
|
||||
if (spellInfo.Mechanic != 0 && Convert.ToBoolean(mechanicMask & (1 << (int)spellInfo.Mechanic)))
|
||||
return true;
|
||||
|
||||
foreach (SpellEffectInfo effect in pair.Value.GetBase().GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
|
||||
if (effect != null && effect.Effect != 0 && effect.Mechanic != 0)
|
||||
if (Convert.ToBoolean(mechanicMask & (1 << (int)effect.Mechanic)))
|
||||
return true;
|
||||
@@ -3331,10 +3330,10 @@ namespace Game.Entities
|
||||
if (aura.IsSingleTarget())
|
||||
aura.UnregisterSingleTarget();
|
||||
|
||||
Aura newAura = Aura.TryRefreshStackOrCreate(aura.GetSpellInfo(), aura.GetCastGUID(), effMask, stealer, null, baseDamage, null, aura.GetCasterGUID());
|
||||
Aura newAura = Aura.TryRefreshStackOrCreate(aura.GetSpellInfo(), aura.GetCastGUID(), effMask, stealer, null, aura.GetCastDifficulty(), baseDamage, null, aura.GetCasterGUID());
|
||||
if (newAura != null)
|
||||
{
|
||||
// created aura must not be single target aura,, so stealer won't loose it on recast
|
||||
// created aura must not be single target aura, so stealer won't loose it on recast
|
||||
if (newAura.IsSingleTarget())
|
||||
{
|
||||
newAura.UnregisterSingleTarget();
|
||||
@@ -3742,7 +3741,7 @@ namespace Game.Entities
|
||||
if (pair.Value == null)
|
||||
continue;
|
||||
Aura aura = pair.Value.GetBase();
|
||||
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type))
|
||||
if (!aura.GetSpellInfo().HasAura(type))
|
||||
_UnapplyAura(pair, AuraRemoveMode.Default);
|
||||
}
|
||||
|
||||
@@ -3752,7 +3751,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
Aura aura = pair.Value;
|
||||
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type))
|
||||
if (!aura.GetSpellInfo().HasAura(type))
|
||||
RemoveOwnedAura(pair, AuraRemoveMode.Default);
|
||||
}
|
||||
}
|
||||
@@ -3761,14 +3760,14 @@ namespace Game.Entities
|
||||
foreach (var pair in GetAppliedAuras())
|
||||
{
|
||||
Aura aura = pair.Value.GetBase();
|
||||
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type1) || !aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type2))
|
||||
if (!aura.GetSpellInfo().HasAura(type1) || !aura.GetSpellInfo().HasAura(type2))
|
||||
_UnapplyAura(pair, AuraRemoveMode.Default);
|
||||
}
|
||||
|
||||
foreach (var pair in GetOwnedAuras())
|
||||
{
|
||||
Aura aura = pair.Value;
|
||||
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type1) || !aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type2))
|
||||
if (!aura.GetSpellInfo().HasAura(type1) || !aura.GetSpellInfo().HasAura(type2))
|
||||
RemoveOwnedAura(pair, AuraRemoveMode.Default);
|
||||
}
|
||||
}
|
||||
@@ -3789,7 +3788,7 @@ namespace Game.Entities
|
||||
if (spell.Value.State == PlayerSpellState.Removed || spell.Value.Disabled)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key, Difficulty.None);
|
||||
if (spellInfo == null || !spellInfo.IsPassive())
|
||||
continue;
|
||||
|
||||
@@ -3804,7 +3803,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (spell.Value.state == PetSpellState.Removed)
|
||||
continue;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key, Difficulty.None);
|
||||
if (spellInfo == null || !spellInfo.IsPassive())
|
||||
continue;
|
||||
if (spellInfo.CasterAuraState == flag)
|
||||
@@ -4189,7 +4188,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
// update basepoints with new values - effect amount will be recalculated in ModStackAmount
|
||||
foreach (SpellEffectInfo effect in foundAura.GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in newAura.GetEffects())
|
||||
{
|
||||
if (effect == null)
|
||||
continue;
|
||||
@@ -4234,7 +4233,7 @@ namespace Game.Entities
|
||||
|
||||
if (!IsHighestExclusiveAura(aura))
|
||||
{
|
||||
if (!aura.GetSpellInfo().IsAffectingArea(GetMap().GetDifficultyID()))
|
||||
if (!aura.GetSpellInfo().IsAffectingArea())
|
||||
{
|
||||
Unit caster = aura.GetCaster();
|
||||
if (caster && caster.IsTypeId(TypeId.Player))
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId)
|
||||
{
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(GetTransForm());
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
if (transformSpellInfo != null)
|
||||
if (transformSpellInfo.HasAttribute(SpellAttr0.CastableWhileMounted))
|
||||
return false;
|
||||
@@ -601,7 +601,7 @@ namespace Game.Entities
|
||||
|
||||
if (gameObj.GetSpellId() != 0)
|
||||
{
|
||||
SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(gameObj.GetSpellId());
|
||||
SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(gameObj.GetSpellId(), GetMap().GetDifficultyID());
|
||||
// Need disable spell use for owner
|
||||
if (createBySpell != null && createBySpell.HasAttribute(SpellAttr0.DisabledWhileActive))
|
||||
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
|
||||
@@ -634,7 +634,7 @@ namespace Game.Entities
|
||||
{
|
||||
RemoveAurasDueToSpell(spellid);
|
||||
|
||||
SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(spellid);
|
||||
SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(spellid, GetMap().GetDifficultyID());
|
||||
// Need activate spell use for owner
|
||||
if (createBySpell != null && createBySpell.IsCooldownStartedOnEvent())
|
||||
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
|
||||
@@ -1772,7 +1772,7 @@ namespace Game.Entities
|
||||
Global.SpellMgr.IsSpellMemberOfSpellGroup(spellProto.Id, SpellGroup.ElixirBattle) ||
|
||||
Global.SpellMgr.IsSpellMemberOfSpellGroup(spellProto.Id, SpellGroup.ElixirGuardian)))
|
||||
{
|
||||
SpellEffectInfo effect = spellProto.GetEffect(Difficulty.None, 0);
|
||||
SpellEffectInfo effect = spellProto.GetEffect(0);
|
||||
if (target.HasAura(53042) && effect != null && target.HasSpell(effect.TriggerSpell))
|
||||
duration *= 2;
|
||||
}
|
||||
@@ -2674,7 +2674,7 @@ namespace Game.Entities
|
||||
if (effIndex != -1)
|
||||
{
|
||||
// bleeding effects are not reduced by armor
|
||||
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), (uint)effIndex);
|
||||
SpellEffectInfo effect = spellInfo.GetEffect((uint)effIndex);
|
||||
if (effect != null)
|
||||
{
|
||||
if (effect.ApplyAuraName == AuraType.PeriodicDamage || effect.Effect == SpellEffectName.SchoolDamage)
|
||||
|
||||
Reference in New Issue
Block a user