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:
@@ -123,7 +123,7 @@ namespace Game.Spells
|
||||
if (IsSelfcasted() || caster == null || !caster.IsFriendlyTo(GetTarget()))
|
||||
{
|
||||
bool negativeFound = false;
|
||||
foreach (SpellEffectInfo effect in GetBase().GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetBase().GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect != null && (Convert.ToBoolean((1 << (int)effect.EffectIndex) & effMask) && !GetBase().GetSpellInfo().IsPositiveEffect(effect.EffectIndex)))
|
||||
{
|
||||
@@ -138,7 +138,7 @@ namespace Game.Spells
|
||||
else
|
||||
{
|
||||
bool positiveFound = false;
|
||||
foreach (SpellEffectInfo effect in GetBase().GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetBase().GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect != null && (Convert.ToBoolean((1 << (int)effect.EffectIndex) & effMask) && GetBase().GetSpellInfo().IsPositiveEffect(effect.EffectIndex)))
|
||||
{
|
||||
@@ -284,9 +284,10 @@ namespace Game.Spells
|
||||
{
|
||||
const int UPDATE_TARGET_MAP_INTERVAL = 500;
|
||||
|
||||
public Aura(SpellInfo spellproto, ObjectGuid castId, WorldObject owner, Unit caster, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
public Aura(SpellInfo spellproto, ObjectGuid castId, WorldObject owner, Unit caster, Difficulty castDifficulty, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
{
|
||||
m_spellInfo = spellproto;
|
||||
m_castDifficulty = castDifficulty;
|
||||
m_castGuid = castId;
|
||||
m_casterGuid = !casterGUID.IsEmpty() ? casterGUID : caster.GetGUID();
|
||||
m_castItemGuid = castItem != null ? castItem.GetGUID() : castItemGuid;
|
||||
@@ -306,9 +307,8 @@ namespace Game.Spells
|
||||
m_lastProcAttemptTime = (DateTime.Now - TimeSpan.FromSeconds(10));
|
||||
m_lastProcSuccessTime = (DateTime.Now - TimeSpan.FromSeconds(120));
|
||||
|
||||
var powers = Global.DB2Mgr.GetSpellPowers(GetId(), caster ? caster.GetMap().GetDifficultyID() : Difficulty.None);
|
||||
foreach (var power in powers)
|
||||
if (power.ManaPerSecond != 0 || power.PowerPctPerSecond > 0.0f)
|
||||
foreach (SpellPowerRecord power in m_spellInfo.PowerCosts)
|
||||
if (power != null && (power.ManaPerSecond != 0 || power.PowerPctPerSecond > 0.0f))
|
||||
m_periodicCosts.Add(power);
|
||||
|
||||
if (!m_periodicCosts.Empty())
|
||||
@@ -337,11 +337,9 @@ namespace Game.Spells
|
||||
public void _InitEffects(uint effMask, Unit caster, int[] baseAmount)
|
||||
{
|
||||
// shouldn't be in constructor - functions in AuraEffect.AuraEffect use polymorphism
|
||||
_spellEffectInfos = m_spellInfo.GetEffectsForDifficulty(GetOwner().GetMap().GetDifficultyID());
|
||||
_effects = new AuraEffect[GetSpellInfo().GetEffects().Count];
|
||||
|
||||
_effects = new AuraEffect[GetSpellEffectInfos().Length];
|
||||
|
||||
foreach (SpellEffectInfo effect in GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect != null && Convert.ToBoolean(effMask & (1 << (int)effect.EffectIndex)))
|
||||
_effects[effect.EffectIndex] = new AuraEffect(this, effect.EffectIndex, baseAmount != null ? baseAmount[effect.EffectIndex] : (int?)null, caster);
|
||||
@@ -897,7 +895,7 @@ namespace Game.Spells
|
||||
public bool HasMoreThanOneEffectForType(AuraType auraType)
|
||||
{
|
||||
uint count = 0;
|
||||
foreach (SpellEffectInfo effect in GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect != null && HasEffect(effect.EffectIndex) && effect.ApplyAuraName == auraType)
|
||||
++count;
|
||||
@@ -908,7 +906,7 @@ namespace Game.Spells
|
||||
|
||||
public bool IsArea()
|
||||
{
|
||||
foreach (SpellEffectInfo effect in GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect != null && HasEffect(effect.EffectIndex) && effect.IsAreaAuraEffect())
|
||||
return true;
|
||||
@@ -1287,7 +1285,7 @@ namespace Game.Spells
|
||||
// check cooldown
|
||||
if (caster.IsTypeId(TypeId.Player))
|
||||
{
|
||||
if (caster.GetSpellHistory().HasCooldown(aura.GetId()))
|
||||
if (caster.GetSpellHistory().HasCooldown(aura.GetSpellInfo()))
|
||||
{
|
||||
// This additional check is needed to add a minimal delay before cooldown in in effect
|
||||
// to allow all bubbles broken by a single damage source proc mana return
|
||||
@@ -1502,14 +1500,14 @@ namespace Game.Spells
|
||||
if (IsPassive() && sameCaster && (m_spellInfo.IsDifferentRankOf(existingSpellInfo) || (m_spellInfo.Id == existingSpellInfo.Id && m_castItemGuid.IsEmpty())))
|
||||
return false;
|
||||
|
||||
foreach (SpellEffectInfo effect in existingAura.GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in existingSpellInfo.GetEffects())
|
||||
{
|
||||
// prevent remove triggering aura by triggered aura
|
||||
if (effect != null && effect.TriggerSpell == GetId())
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (SpellEffectInfo effect in GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
{
|
||||
// prevent remove triggered aura by triggering aura refresh
|
||||
if (effect != null && effect.TriggerSpell == existingAura.GetId())
|
||||
@@ -1552,7 +1550,7 @@ namespace Game.Spells
|
||||
// check same periodic auras
|
||||
for (byte i = 0; i < SpellConst.MaxEffects; i++)
|
||||
{
|
||||
SpellEffectInfo effect = GetSpellEffectInfo(i);
|
||||
SpellEffectInfo effect = m_spellInfo.GetEffect(i);
|
||||
if (effect == null)
|
||||
continue;
|
||||
|
||||
@@ -1570,7 +1568,7 @@ namespace Game.Spells
|
||||
case AuraType.ObsModPower:
|
||||
case AuraType.ObsModHealth:
|
||||
case AuraType.PeriodicTriggerSpellWithValue:
|
||||
SpellEffectInfo existingEffect = GetSpellEffectInfo(i);
|
||||
SpellEffectInfo existingEffect = m_spellInfo.GetEffect(i);
|
||||
// periodic auras which target areas are not allowed to stack this way (replenishment for example)
|
||||
if (effect.IsTargetingArea() || (existingEffect != null && existingEffect.IsTargetingArea()))
|
||||
break;
|
||||
@@ -1639,7 +1637,7 @@ namespace Game.Spells
|
||||
SetNeedClientUpdateForTargets();
|
||||
}
|
||||
|
||||
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetId());
|
||||
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
|
||||
|
||||
Cypher.Assert(procEntry != null);
|
||||
|
||||
@@ -1651,7 +1649,7 @@ namespace Game.Spells
|
||||
|
||||
public uint GetProcEffectMask(AuraApplication aurApp, ProcEventInfo eventInfo, DateTime now)
|
||||
{
|
||||
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetId());
|
||||
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
|
||||
// only auras with spell proc entry can trigger proc
|
||||
if (procEntry == null)
|
||||
return 0;
|
||||
@@ -1671,7 +1669,7 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
// check don't break stealth attr present
|
||||
if (m_spellInfo.HasAura(Difficulty.None, AuraType.ModStealth))
|
||||
if (m_spellInfo.HasAura(AuraType.ModStealth))
|
||||
{
|
||||
SpellInfo eventSpellInfo = eventInfo.GetSpellInfo();
|
||||
if (eventSpellInfo != null)
|
||||
@@ -2240,6 +2238,7 @@ namespace Game.Spells
|
||||
|
||||
public SpellInfo GetSpellInfo() { return m_spellInfo; }
|
||||
public uint GetId() { return m_spellInfo.Id; }
|
||||
public Difficulty GetCastDifficulty() { return m_castDifficulty; }
|
||||
public ObjectGuid GetCastGUID() { return m_castGuid; }
|
||||
public ObjectGuid GetCasterGUID() { return m_casterGuid; }
|
||||
public ObjectGuid GetCastItemGUID() { return m_castItemGuid; }
|
||||
@@ -2297,7 +2296,7 @@ namespace Game.Spells
|
||||
byte CalcMaxCharges(Unit caster)
|
||||
{
|
||||
uint maxProcCharges = m_spellInfo.ProcCharges;
|
||||
var procEntry = Global.SpellMgr.GetSpellProcEntry(GetId());
|
||||
var procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
|
||||
if (procEntry != null)
|
||||
maxProcCharges = procEntry.Charges;
|
||||
|
||||
@@ -2357,15 +2356,6 @@ namespace Game.Spells
|
||||
|
||||
public AuraEffect[] GetAuraEffects() { return _effects; }
|
||||
|
||||
public SpellEffectInfo[] GetSpellEffectInfos() { return _spellEffectInfos; }
|
||||
public SpellEffectInfo GetSpellEffectInfo(uint index)
|
||||
{
|
||||
if (index >= _spellEffectInfos.Length)
|
||||
return null;
|
||||
|
||||
return _spellEffectInfos[index];
|
||||
}
|
||||
|
||||
public void SetLastProcAttemptTime(DateTime lastProcAttemptTime) { m_lastProcAttemptTime = lastProcAttemptTime; }
|
||||
public void SetLastProcSuccessTime(DateTime lastProcSuccessTime) { m_lastProcSuccessTime = lastProcSuccessTime; }
|
||||
|
||||
@@ -2379,14 +2369,14 @@ namespace Game.Spells
|
||||
{
|
||||
case TypeId.Unit:
|
||||
case TypeId.Player:
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffectsForDifficulty(owner.GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffects())
|
||||
{
|
||||
if (effect != null && effect.IsUnitOwnedAuraEffect())
|
||||
effMask |= (uint)(1 << (int)effect.EffectIndex);
|
||||
}
|
||||
break;
|
||||
case TypeId.DynamicObject:
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffectsForDifficulty(owner.GetMap().GetDifficultyID()))
|
||||
foreach (SpellEffectInfo effect in spellProto.GetEffects())
|
||||
{
|
||||
if (effect != null && effect.Effect == SpellEffectName.PersistentAreaAura)
|
||||
effMask |= (uint)(1 << (int)effect.EffectIndex);
|
||||
@@ -2397,12 +2387,11 @@ namespace Game.Spells
|
||||
}
|
||||
return (effMask & availableEffectMask);
|
||||
}
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, uint castItemId = 0, int castItemLevel = -1)
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, Difficulty castDifficulty, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, uint castItemId = 0, int castItemLevel = -1)
|
||||
{
|
||||
bool throwway;
|
||||
return TryRefreshStackOrCreate(spellproto, castId, tryEffMask, owner, caster, out throwway, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, castItemId, castItemLevel);
|
||||
return TryRefreshStackOrCreate(spellproto, castId, tryEffMask, owner, caster, castDifficulty, out _, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, castItemId, castItemLevel);
|
||||
}
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, uint castItemId = 0, int castItemLevel = -1)
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, Difficulty castDifficulty, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, uint castItemId = 0, int castItemLevel = -1)
|
||||
{
|
||||
Cypher.Assert(spellproto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
@@ -2425,9 +2414,9 @@ namespace Game.Spells
|
||||
return foundAura;
|
||||
}
|
||||
else
|
||||
return Create(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
return Create(spellproto, castId, effMask, owner, caster, castDifficulty, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
}
|
||||
public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, ObjectGuid castItemGuid = default, uint castItemId = 0, int castItemLevel = -1)
|
||||
public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, Difficulty castDifficulty, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, ObjectGuid castItemGuid = default, uint castItemId = 0, int castItemLevel = -1)
|
||||
{
|
||||
Cypher.Assert(spellproto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
@@ -2436,9 +2425,9 @@ namespace Game.Spells
|
||||
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
|
||||
if (effMask == 0)
|
||||
return null;
|
||||
return Create(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
return Create(spellproto, castId, effMask, owner, caster, castDifficulty, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
}
|
||||
public static Aura Create(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
public static Aura Create(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, Difficulty castDifficulty, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
{
|
||||
Cypher.Assert(effMask != 0);
|
||||
Cypher.Assert(spellproto != null);
|
||||
@@ -2468,10 +2457,10 @@ namespace Game.Spells
|
||||
{
|
||||
case TypeId.Unit:
|
||||
case TypeId.Player:
|
||||
aura = new UnitAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
aura = new UnitAura(spellproto, castId, effMask, owner, caster, castDifficulty, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
break;
|
||||
case TypeId.DynamicObject:
|
||||
aura = new DynObjAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
aura = new DynObjAura(spellproto, castId, effMask, owner, caster, castDifficulty, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
|
||||
break;
|
||||
default:
|
||||
Cypher.Assert(false);
|
||||
@@ -2486,6 +2475,7 @@ namespace Game.Spells
|
||||
#region Fields
|
||||
List<AuraScript> m_loadedScripts = new List<AuraScript>();
|
||||
SpellInfo m_spellInfo;
|
||||
Difficulty m_castDifficulty;
|
||||
ObjectGuid m_castGuid;
|
||||
ObjectGuid m_casterGuid;
|
||||
ObjectGuid m_castItemGuid;
|
||||
@@ -2506,7 +2496,6 @@ namespace Game.Spells
|
||||
byte m_stackAmount; // Aura stack amount
|
||||
|
||||
//might need to be arrays still
|
||||
SpellEffectInfo[] _spellEffectInfos;
|
||||
AuraEffect[] _effects;
|
||||
Dictionary<ObjectGuid, AuraApplication> m_applications = new Dictionary<ObjectGuid, AuraApplication>();
|
||||
|
||||
@@ -2526,8 +2515,8 @@ namespace Game.Spells
|
||||
|
||||
public class UnitAura : Aura
|
||||
{
|
||||
public UnitAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
|
||||
public UnitAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, Difficulty castDifficulty, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
: base(spellproto, castId, owner, caster, castDifficulty, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
|
||||
{
|
||||
m_AuraDRGroup = DiminishingGroup.None;
|
||||
LoadScripts();
|
||||
@@ -2560,7 +2549,7 @@ namespace Game.Spells
|
||||
|
||||
public override void FillTargetMap(ref Dictionary<Unit, uint> targets, Unit caster)
|
||||
{
|
||||
foreach (SpellEffectInfo effect in GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect == null || !HasEffect(effect.EffectIndex))
|
||||
continue;
|
||||
@@ -2637,8 +2626,8 @@ namespace Game.Spells
|
||||
|
||||
public class DynObjAura : Aura
|
||||
{
|
||||
public DynObjAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
|
||||
public DynObjAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, Difficulty castDifficulty, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
|
||||
: base(spellproto, castId, owner, caster, castDifficulty, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
|
||||
{
|
||||
LoadScripts();
|
||||
Cypher.Assert(GetDynobjOwner() != null);
|
||||
@@ -2661,7 +2650,7 @@ namespace Game.Spells
|
||||
Unit dynObjOwnerCaster = GetDynobjOwner().GetCaster();
|
||||
float radius = GetDynobjOwner().GetRadius();
|
||||
|
||||
foreach (SpellEffectInfo effect in GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect == null || !HasEffect(effect.EffectIndex))
|
||||
continue;
|
||||
|
||||
@@ -32,14 +32,14 @@ namespace Game.Spells
|
||||
{
|
||||
public class AuraEffect
|
||||
{
|
||||
public AuraEffect(Aura baseAura, uint effindex, int? baseAmount, Unit caster)
|
||||
public AuraEffect(Aura baseAura, uint effIndex, int? baseAmount, Unit caster)
|
||||
{
|
||||
auraBase = baseAura;
|
||||
m_spellInfo = baseAura.GetSpellInfo();
|
||||
_effectInfo = baseAura.GetSpellEffectInfo(effindex);
|
||||
_effectInfo = m_spellInfo.GetEffect(effIndex);
|
||||
m_baseAmount = baseAmount.HasValue ? baseAmount.Value : _effectInfo.CalcBaseValue(caster, baseAura.GetAuraType() == AuraObjectType.Unit ? baseAura.GetOwner().ToUnit() : null, baseAura.GetCastItemId(), baseAura.GetCastItemLevel());
|
||||
m_donePct = 1.0f;
|
||||
m_effIndex = (byte)effindex;
|
||||
m_effIndex = (byte)effIndex;
|
||||
m_canBeRecalculated = true;
|
||||
m_isPeriodic = false;
|
||||
|
||||
@@ -683,7 +683,7 @@ namespace Game.Spells
|
||||
{
|
||||
// Don't proc extra attacks while already processing extra attack spell
|
||||
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId);
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
|
||||
if (triggeredSpellInfo != null)
|
||||
if (aurApp.GetTarget().ExtraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
|
||||
return false;
|
||||
@@ -818,7 +818,7 @@ namespace Game.Spells
|
||||
if (pair.Key == spellId || pair.Key == spellId2 || pair.Key == spellId3 || pair.Key == spellId4)
|
||||
continue;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
|
||||
if (spellInfo == null || !(spellInfo.IsPassive() || spellInfo.HasAttribute(SpellAttr0.HiddenClientside)))
|
||||
continue;
|
||||
|
||||
@@ -1340,7 +1340,7 @@ namespace Game.Spells
|
||||
|
||||
if (modelid > 0)
|
||||
{
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm());
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm(), GetBase().GetCastDifficulty());
|
||||
if (transformSpellInfo == null || !GetSpellInfo().IsPositive())
|
||||
target.SetDisplayId(modelid);
|
||||
}
|
||||
@@ -1438,7 +1438,7 @@ namespace Game.Spells
|
||||
if (apply)
|
||||
{
|
||||
// update active transform spell only when transform not set or not overwriting negative by positive case
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm());
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm(), GetBase().GetCastDifficulty());
|
||||
if (transformSpellInfo == null || !GetSpellInfo().IsPositive() || transformSpellInfo.IsPositive())
|
||||
{
|
||||
target.SetTransForm(GetId());
|
||||
@@ -2168,7 +2168,7 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
//some spell has one aura of mount and one of vehicle
|
||||
foreach (SpellEffectInfo effect in GetBase().GetSpellEffectInfos())
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
if (effect != null && GetSpellEffectInfo().Effect == SpellEffectName.Summon && effect.MiscValue == GetMiscValue())
|
||||
displayId = 0;
|
||||
}
|
||||
@@ -4464,10 +4464,10 @@ namespace Game.Spells
|
||||
uint spellId = 24659;
|
||||
if (apply && caster != null)
|
||||
{
|
||||
SpellInfo spell = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spell = Global.SpellMgr.GetSpellInfo(spellId, GetBase().GetCastDifficulty());
|
||||
|
||||
for (uint i = 0; i < spell.StackAmount; ++i)
|
||||
caster.CastSpell(target, spell.Id, true, null, null, GetCasterGUID());
|
||||
caster.CastSpell(target, spell, true, null, null, GetCasterGUID());
|
||||
break;
|
||||
}
|
||||
target.RemoveAurasDueToSpell(spellId);
|
||||
@@ -4479,9 +4479,9 @@ namespace Game.Spells
|
||||
uint spellId = 24662;
|
||||
if (apply && caster != null)
|
||||
{
|
||||
SpellInfo spell = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
SpellInfo spell = Global.SpellMgr.GetSpellInfo(spellId, GetBase().GetCastDifficulty());
|
||||
for (uint i = 0; i < spell.StackAmount; ++i)
|
||||
caster.CastSpell(target, spell.Id, true, null, null, GetCasterGUID());
|
||||
caster.CastSpell(target, spell, true, null, null, GetCasterGUID());
|
||||
break;
|
||||
}
|
||||
target.RemoveAurasDueToSpell(spellId);
|
||||
@@ -4720,11 +4720,11 @@ namespace Game.Spells
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
uint triggeredSpellId = GetSpellEffectInfo().TriggerSpell;
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggeredSpellId);
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggeredSpellId, GetBase().GetCastDifficulty());
|
||||
if (triggeredSpellInfo == null)
|
||||
return;
|
||||
|
||||
Unit caster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, target.GetMap().GetDifficultyID()) ? GetCaster() : target;
|
||||
Unit caster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCaster() : target;
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
@@ -4740,13 +4740,13 @@ namespace Game.Spells
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjectGuid casterGUID = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, caster.GetMap().GetDifficultyID()) ? GetCasterGUID() : target.GetGUID();
|
||||
ObjectGuid casterGUID = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target.GetGUID();
|
||||
target.RemoveAura(triggeredSpellId, casterGUID, 0, aurApp.GetRemoveMode());
|
||||
}
|
||||
}
|
||||
else if (mode.HasAnyFlag(AuraEffectHandleModes.Reapply) && apply)
|
||||
{
|
||||
ObjectGuid casterGUID = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, caster.GetMap().GetDifficultyID()) ? GetCasterGUID() : target.GetGUID();
|
||||
ObjectGuid casterGUID = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target.GetGUID();
|
||||
// change the stack amount to be equal to stack amount of our aura
|
||||
Aura triggeredAura = target.GetAura(triggeredSpellId, casterGUID);
|
||||
if (triggeredAura != null)
|
||||
@@ -5054,7 +5054,7 @@ namespace Game.Spells
|
||||
// generic casting code with custom spells and target/caster customs
|
||||
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
|
||||
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId);
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
|
||||
SpellInfo auraSpellInfo = GetSpellInfo();
|
||||
uint auraId = auraSpellInfo.Id;
|
||||
|
||||
@@ -5320,11 +5320,11 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
// Reget trigger spell proto
|
||||
triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId);
|
||||
triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
|
||||
|
||||
if (triggeredSpellInfo != null)
|
||||
{
|
||||
Unit triggerCaster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, target.GetMap().GetDifficultyID()) ? caster : target;
|
||||
Unit triggerCaster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target;
|
||||
if (triggerCaster != null)
|
||||
{
|
||||
triggerCaster.CastSpell(target, triggeredSpellInfo, true, null, this);
|
||||
@@ -5338,10 +5338,10 @@ namespace Game.Spells
|
||||
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit target, Unit caster)
|
||||
{
|
||||
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId);
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
|
||||
if (triggeredSpellInfo != null)
|
||||
{
|
||||
Unit triggerCaster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, target.GetMap().GetDifficultyID()) ? caster : target;
|
||||
Unit triggerCaster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target;
|
||||
if (triggerCaster != null)
|
||||
{
|
||||
int basepoints = GetAmount();
|
||||
@@ -5571,7 +5571,7 @@ namespace Game.Spells
|
||||
uint resist = damageInfo.GetResist();
|
||||
|
||||
// SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage
|
||||
SpellNonMeleeDamage log = new SpellNonMeleeDamage(caster, target, GetId(), GetBase().GetSpellXSpellVisualId(), GetSpellInfo().GetSchoolMask(), GetBase().GetCastGUID());
|
||||
SpellNonMeleeDamage log = new SpellNonMeleeDamage(caster, target, GetSpellInfo(), GetBase().GetSpellXSpellVisualId(), GetSpellInfo().GetSchoolMask(), GetBase().GetCastGUID());
|
||||
log.damage = damage;
|
||||
log.originalDamage = dmg;
|
||||
log.absorb = absorb;
|
||||
@@ -5876,7 +5876,7 @@ namespace Game.Spells
|
||||
|
||||
SpellInfo spellProto = GetSpellInfo();
|
||||
// maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
|
||||
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, target, spellProto.Id, GetBase().GetSpellXSpellVisualId(), spellProto.SchoolMask, GetBase().GetCastGUID());
|
||||
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, target, spellProto, GetBase().GetSpellXSpellVisualId(), spellProto.SchoolMask, GetBase().GetCastGUID());
|
||||
// no SpellDamageBonus for burn mana
|
||||
caster.CalculateSpellDamageTaken(damageInfo, (int)(gain * dmgMultiplier), spellProto);
|
||||
|
||||
@@ -5917,7 +5917,7 @@ namespace Game.Spells
|
||||
Unit triggerTarget = eventInfo.GetProcTarget();
|
||||
|
||||
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId);
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
|
||||
if (triggeredSpellInfo != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Spells, "AuraEffect.HandleProcTriggerSpellAuraProc: Triggering spell {0} from aura {1} proc", triggeredSpellInfo.Id, GetId());
|
||||
@@ -5933,7 +5933,7 @@ namespace Game.Spells
|
||||
Unit triggerTarget = eventInfo.GetProcTarget();
|
||||
|
||||
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId);
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
|
||||
if (triggeredSpellInfo != null)
|
||||
{
|
||||
int basepoints0 = GetAmount();
|
||||
@@ -5954,7 +5954,7 @@ namespace Game.Spells
|
||||
return;
|
||||
}
|
||||
|
||||
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(target, triggerTarget, GetId(), GetBase().GetSpellXSpellVisualId(), GetSpellInfo().SchoolMask, GetBase().GetCastGUID());
|
||||
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(target, triggerTarget, GetSpellInfo(), GetBase().GetSpellXSpellVisualId(), GetSpellInfo().SchoolMask, GetBase().GetCastGUID());
|
||||
int damage = (int)target.SpellDamageBonusDone(triggerTarget, GetSpellInfo(), (uint)GetAmount(), DamageEffectType.SpellDirect, GetSpellEffectInfo());
|
||||
damage = (int)triggerTarget.SpellDamageBonusTaken(target, GetSpellInfo(), (uint)damage, DamageEffectType.SpellDirect, GetSpellEffectInfo());
|
||||
target.CalculateSpellDamageTaken(damageInfo, damage, GetSpellInfo());
|
||||
@@ -6128,7 +6128,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Unit target = aurApp.GetTarget();
|
||||
SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(GetSpellEffectInfo().TriggerSpell);
|
||||
SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(GetSpellEffectInfo().TriggerSpell, GetBase().GetCastDifficulty());
|
||||
if (triggerSpellInfo == null)
|
||||
return;
|
||||
|
||||
@@ -6139,7 +6139,7 @@ namespace Game.Spells
|
||||
else
|
||||
{
|
||||
List<uint> summonedEntries = new List<uint>();
|
||||
foreach (var spellEffect in triggerSpellInfo.GetEffectsForDifficulty(target.GetMap().GetDifficultyID()))
|
||||
foreach (var spellEffect in triggerSpellInfo.GetEffects())
|
||||
{
|
||||
if (spellEffect != null && spellEffect.Effect == SpellEffectName.Summon)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user