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