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

Port From (https://github.com/TrinityCore/TrinityCore/commit/c7306439e7004288fb85890d6a5f730cf1761d71)
This commit is contained in:
hondacrx
2020-06-18 12:39:39 -04:00
parent f0942a257e
commit d7954f4fc7
89 changed files with 1738 additions and 1893 deletions
+38 -49
View File
@@ -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;
+28 -28
View File
@@ -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)
{
+7 -2
View File
@@ -17,6 +17,7 @@
using Framework.Constants;
using Framework.Database;
using Game.DataStorage;
using Game.Entities;
using System.Collections.Generic;
using System.Linq;
@@ -62,7 +63,7 @@ namespace Game.Spells
if (reqSkillOrSpell > 0) // spell case
{
uint absReqSkillOrSpell = (uint)reqSkillOrSpell;
SpellInfo reqSpellInfo = Global.SpellMgr.GetSpellInfo(absReqSkillOrSpell);
SpellInfo reqSpellInfo = Global.SpellMgr.GetSpellInfo(absReqSkillOrSpell, Difficulty.None);
if (reqSpellInfo == null)
{
if (!reportedReqSpells.Contains(absReqSkillOrSpell))
@@ -117,8 +118,12 @@ namespace Game.Spells
Log.outError(LogFilter.Sql, "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n{0}", ssNonDiscoverableEntries.ToString());
// report about empty data for explicit discovery spells
foreach (var spellEntry in Global.SpellMgr.GetSpellInfoStorage().Values)
foreach (SpellNameRecord spellNameEntry in CliDB.SpellNameStorage.Values)
{
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(spellNameEntry.Id, Difficulty.None);
if (spellEntry == null)
continue;
// skip not explicit discovery spells
if (!spellEntry.IsExplicitDiscovery())
continue;
+4 -4
View File
@@ -44,14 +44,14 @@ namespace Game.Spells
{
uint spellId = result.Read<uint>(0);
if (!Global.SpellMgr.HasSpellInfo(spellId))
if (!Global.SpellMgr.HasSpellInfo(spellId, Framework.Constants.Difficulty.None))
{
Log.outError(LogFilter.Sql, "Skill specialization {0} has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint requiredSpecialization = result.Read<uint>(1);
if (!Global.SpellMgr.HasSpellInfo(requiredSpecialization))
if (!Global.SpellMgr.HasSpellInfo(requiredSpecialization, Framework.Constants.Difficulty.None))
{
Log.outError(LogFilter.Sql, "Skill specialization {0} have not existed required specialization spell id {1} in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
@@ -144,14 +144,14 @@ namespace Game.Spells
do
{
uint spellId = result.Read<uint>(0);
if (!Global.SpellMgr.HasSpellInfo(spellId))
if (!Global.SpellMgr.HasSpellInfo(spellId, Framework.Constants.Difficulty.None))
{
Log.outError(LogFilter.Sql, "Skill perfection data for spell {0} has non-existent spell id in `skill_perfect_item_template`!", spellId);
continue;
}
uint requiredSpecialization = result.Read<uint>(1);
if (!Global.SpellMgr.HasSpellInfo(requiredSpecialization))
if (!Global.SpellMgr.HasSpellInfo(requiredSpecialization, Framework.Constants.Difficulty.None))
{
Log.outError(LogFilter.Sql, "Skill perfection data for spell {0} has non-existent required specialization spell id {1} in `skill_perfect_item_template`!", spellId, requiredSpecialization);
continue;
+65 -85
View File
@@ -40,10 +40,9 @@ namespace Game.Spells
{
m_spellInfo = info;
m_caster = (info.HasAttribute(SpellAttr6.CastByCharmer) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster);
m_spellValue = new SpellValue(caster.GetMap().GetDifficultyID(), m_spellInfo, caster);
m_spellValue = new SpellValue(m_spellInfo, caster);
m_preGeneratedPath = new PathGenerator(m_caster);
m_castItemLevel = -1;
_effects = info.GetEffectsForDifficulty(caster.GetMap().GetDifficultyID());
m_castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, m_caster.GetMapId(), m_spellInfo.Id, m_caster.GetMap().GenerateLowGuid(HighGuid.Cast));
m_SpellVisual = caster.GetCastSpellXSpellVisualId(m_spellInfo);
@@ -235,7 +234,7 @@ namespace Game.Spells
SelectExplicitTargets();
uint processedAreaEffectsMask = 0;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -330,11 +329,11 @@ namespace Game.Spells
// targets for effect already selected
if (Convert.ToBoolean(effectMask & processedEffectMask))
return;
SpellEffectInfo _effect = GetEffect(effIndex);
SpellEffectInfo _effect = m_spellInfo.GetEffect(effIndex);
if (_effect != null)
{
// choose which targets we can select at once
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null || effect.EffectIndex <= effIndex)
continue;
@@ -509,7 +508,7 @@ namespace Game.Spells
return;
}
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return;
@@ -644,7 +643,7 @@ namespace Game.Spells
List<WorldObject> targets = new List<WorldObject>();
SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return;
@@ -732,7 +731,7 @@ namespace Game.Spells
return;
}
List<WorldObject> targets = new List<WorldObject>();
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return;
@@ -830,7 +829,7 @@ namespace Game.Spells
break;
}
default:
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect != null)
{
float dist = effect.CalcRadius(m_caster);
@@ -882,11 +881,11 @@ namespace Game.Spells
switch (targetType.GetTarget())
{
case Targets.DestEnemy:
case Targets.DestTargetEnemy:
case Targets.DestAny:
break;
default:
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect != null)
{
float angle = targetType.CalcDirectionAngle();
@@ -927,7 +926,7 @@ namespace Game.Spells
case Targets.DestDest:
return;
default:
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect != null)
{
float angle = targetType.CalcDirectionAngle();
@@ -1018,7 +1017,7 @@ namespace Game.Spells
void SelectImplicitChainTargets(uint effIndex, SpellImplicitTargetInfo targetType, WorldObject target, uint effMask)
{
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return;
@@ -1030,7 +1029,7 @@ namespace Game.Spells
if (maxTargets > 1)
{
// mark damage multipliers as used
foreach (SpellEffectInfo eff in GetEffects())
foreach (SpellEffectInfo eff in m_spellInfo.GetEffects())
if (eff != null && Convert.ToBoolean(effMask & (1 << (int)eff.EffectIndex)))
m_damageMultipliers[eff.EffectIndex] = 1.0f;
m_applyMultiplierMask |= (byte)effMask;
@@ -1090,7 +1089,7 @@ namespace Game.Spells
// We should check if triggered spell has greater range (which is true in many cases, and initial spell has too short max range)
// limit max range to 300 yards, sometimes triggered spells can have 50000yds
float bestDist = m_spellInfo.GetMaxRange(false);
SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell);
SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, GetCastDifficulty());
if (triggerSpellInfo != null)
bestDist = Math.Min(Math.Max(bestDist, triggerSpellInfo.GetMaxRange(false)), Math.Min(dist2d, 300.0f));
@@ -1153,7 +1152,7 @@ namespace Game.Spells
{
// special case for SPELL_EFFECT_SUMMON_RAF_FRIEND and SPELL_EFFECT_SUMMON_PLAYER
// @todo this is a workaround - target shouldn't be stored in target map for those spells
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return;
switch (effect.Effect)
@@ -1505,7 +1504,7 @@ namespace Game.Spells
void AddUnitTarget(Unit target, uint effectMask, bool checkIfValid = true, bool Implicit = true, Position losPosition = null)
{
uint validEffectMask = 0;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && (effectMask & (1 << (int)effect.EffectIndex)) != 0 && CheckEffectTarget(target, effect, losPosition))
validEffectMask |= 1u << (int)effect.EffectIndex;
@@ -1520,7 +1519,7 @@ namespace Game.Spells
return;
// Check for effect immune skip if immuned
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && target.IsImmunedToSpellEffect(m_spellInfo, effect.EffectIndex, m_caster))
effectMask &= ~(uint)(1 << (int)effect.EffectIndex);
@@ -1603,7 +1602,7 @@ namespace Game.Spells
void AddGOTarget(GameObject go, uint effectMask)
{
uint validEffectMask = 0;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && (effectMask & (1 << (int)effect.EffectIndex)) != 0 && CheckEffectTarget(go, effect))
validEffectMask |= (uint)(1 << (int)effect.EffectIndex);
@@ -1660,7 +1659,7 @@ namespace Game.Spells
void AddItemTarget(Item item, uint effectMask)
{
uint validEffectMask = 0;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && (effectMask & (1 << (int)effect.EffectIndex)) != 0 && CheckEffectTarget(item, effect))
validEffectMask |= 1u << (int)effect.EffectIndex;
@@ -1709,7 +1708,7 @@ namespace Game.Spells
{
uint farMask = 0;
// create far target mask
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect != null && effect.IsFarUnitTargetEffect())
if (Convert.ToBoolean((1 << (int)effect.EffectIndex) & mask))
@@ -1726,7 +1725,7 @@ namespace Game.Spells
// do far effects on the unit
// can't use default call because of threading, do stuff as fast as possible
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && Convert.ToBoolean(farMask & (1 << (int)effect.EffectIndex)))
HandleEffects(unit, null, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
return;
@@ -1885,7 +1884,7 @@ namespace Game.Spells
else if (m_damage > 0)
{
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo.Id, m_SpellVisual, m_spellSchoolMask, m_castId);
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellSchoolMask, m_castId);
// Check damage immunity
if (unitTarget.IsImmunedToDamage(m_spellInfo))
@@ -1926,7 +1925,7 @@ namespace Game.Spells
else
{
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo.Id, m_SpellVisual, m_spellSchoolMask);
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellSchoolMask);
hitMask |= Unit.CreateProcHitMask(damageInfo, missInfo);
// Do triggers for unit
if (canEffectTrigger)
@@ -1996,7 +1995,7 @@ namespace Game.Spells
// disable effects to which unit is immune
SpellMissInfo returnVal = SpellMissInfo.Immune;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
if (unit.IsImmunedToSpellEffect(m_spellInfo, effect.EffectIndex, m_caster))
effectMask &= (uint)~(1 << (int)effect.EffectIndex);
@@ -2051,7 +2050,7 @@ namespace Game.Spells
}
uint aura_effmask = 0;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && (Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)) && effect.IsUnitOwnedAuraEffect()))
aura_effmask |= (1u << (int)effect.EffectIndex);
@@ -2075,7 +2074,7 @@ namespace Game.Spells
if (m_originalCaster != null)
{
int[] basePoints = new int[SpellConst.MaxEffects];
foreach (SpellEffectInfo auraSpellEffect in GetEffects())
foreach (SpellEffectInfo auraSpellEffect in m_spellInfo.GetEffects())
if (auraSpellEffect != null)
basePoints[auraSpellEffect.EffectIndex] = (m_spellValue.CustomBasePointsMask & (1 << (int)auraSpellEffect.EffectIndex)) != 0 ?
m_spellValue.EffectBasePoints[auraSpellEffect.EffectIndex] : auraSpellEffect.CalcBaseValue(m_originalCaster, unit, m_castItemEntry, m_castItemLevel);
@@ -2083,7 +2082,7 @@ namespace Game.Spells
bool refresh = false;
bool resetPeriodicTimer = !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontResetPeriodicTimer);
m_spellAura = Aura.TryRefreshStackOrCreate(m_spellInfo, m_castId, (byte)effectMask, unit,
m_originalCaster, out refresh, basePoints, m_CastItem, ObjectGuid.Empty, resetPeriodicTimer, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
m_originalCaster, GetCastDifficulty(), out refresh, basePoints, m_CastItem, ObjectGuid.Empty, resetPeriodicTimer, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
if (m_spellAura != null)
{
// Set aura stack amount to desired value
@@ -2117,7 +2116,7 @@ namespace Game.Spells
{
m_spellAura.Remove();
bool found = false;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && (Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)) && effect.Effect != SpellEffectName.ApplyAura))
found = true;
if (!found)
@@ -2137,7 +2136,7 @@ namespace Game.Spells
{
int origDuration = duration;
duration = 0;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect != null)
{
@@ -2168,7 +2167,7 @@ namespace Game.Spells
}
}
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
HandleEffects(unit, null, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
@@ -2244,7 +2243,7 @@ namespace Game.Spells
PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers(SpellMissInfo.None);
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
HandleEffects(null, null, go, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
@@ -2264,7 +2263,7 @@ namespace Game.Spells
PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers(SpellMissInfo.None);
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
HandleEffects(null, target.item, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
@@ -2281,7 +2280,7 @@ namespace Game.Spells
uint channelTargetEffectMask = m_channelTargetEffectMask;
uint channelAuraMask = 0;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && effect.Effect == SpellEffectName.ApplyAura)
channelAuraMask |= (1u << (int)effect.EffectIndex);
@@ -2481,7 +2480,7 @@ namespace Game.Spells
if (!_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreAuraInterruptFlags) && m_spellInfo.IsBreakingStealth())
{
m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Cast);
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect != null && effect.GetUsedTargetObjectType() == SpellTargetObjectTypes.Unit)
{
@@ -2999,7 +2998,7 @@ namespace Game.Spells
PrepareScriptHitHandlers();
// handle effects with SPELL_EFFECT_HANDLE_HIT mode
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
// don't do anything for empty effect
if (effect == null || !effect.IsEffect())
@@ -3078,7 +3077,7 @@ namespace Game.Spells
// check if the player caster has moved before the spell finished
// with the exception of spells affected with SPELL_AURA_CAST_WHILE_WALKING effect
SpellEffectInfo effect = GetEffect(0);
SpellEffectInfo effect = m_spellInfo.GetEffect(0);
if ((m_caster.IsTypeId(TypeId.Player) && m_timer != 0) &&
m_caster.IsMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) &&
((effect != null && effect.Effect != SpellEffectName.Stuck) || !m_caster.HasUnitMovementFlag(MovementFlag.FallingFar)) &&
@@ -3187,7 +3186,7 @@ namespace Game.Spells
{
// Unsummon statue
uint spell = m_caster.m_unitData.CreatedBySpell;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell, GetCastDifficulty());
if (spellInfo != null && spellInfo.IconFileDataId == 134230)
{
Log.outDebug(LogFilter.Spells, "Statue {0} is unsummoned in spell {1} finish", m_caster.GetGUID().ToString(), m_spellInfo.Id);
@@ -3325,7 +3324,7 @@ namespace Game.Spells
else
{
uint item = 0;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(caster.GetMap().GetDifficultyID()))
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (effect.ItemType != 0)
item = effect.ItemType;
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(item);
@@ -3799,7 +3798,7 @@ namespace Game.Spells
spellExecuteLog.Caster = m_caster.GetGUID();
spellExecuteLog.SpellID = m_spellInfo.Id;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -4321,7 +4320,7 @@ namespace Game.Spells
gameObjTarget = pGOTarget;
destTarget = m_destTargets[i].Position;
effectInfo = GetEffect(i);
effectInfo = m_spellInfo.GetEffect(i);
if (effectInfo == null)
{
Log.outError(LogFilter.Spells, "Spell: {0} HandleEffects at EffectIndex: {1} missing effect", m_spellInfo.Id, i);
@@ -4477,7 +4476,7 @@ namespace Game.Spells
if (m_caster.IsTypeId(TypeId.Player) && m_caster.ToPlayer().IsMoving() && (!m_caster.IsCharmed() || !m_caster.GetCharmerGUID().IsCreature()) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo))
{
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
SpellEffectInfo effect = GetEffect(0);
SpellEffectInfo effect = m_spellInfo.GetEffect(0);
if ((!m_caster.HasUnitMovementFlag(MovementFlag.FallingFar) || (effect != null && effect.Effect != SpellEffectName.Stuck)) &&
(IsAutoRepeat() || m_spellInfo.HasAuraInterruptFlag(SpellAuraInterruptFlags.NotSeated)))
return SpellCastResult.Moving;
@@ -4584,7 +4583,7 @@ namespace Game.Spells
}
// check pet presence
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect != null && effect.TargetA.GetTarget() == Targets.UnitPet)
{
@@ -4678,7 +4677,7 @@ namespace Game.Spells
if (castResult != SpellCastResult.SpellCastOk)
return castResult;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -4712,11 +4711,10 @@ namespace Game.Spells
break;
Pet pet = m_caster.ToPlayer().GetPet();
if (pet == null)
return SpellCastResult.NoPet;
SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell);
SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, Difficulty.None);
if (learn_spellproto == null)
return SpellCastResult.NotKnown;
@@ -4749,7 +4747,7 @@ namespace Game.Spells
if (pet == null || pet.GetOwner() != m_caster)
return SpellCastResult.BadTargets;
SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell);
SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, Difficulty.None);
if (learn_spellproto == null)
return SpellCastResult.NotKnown;
@@ -5194,7 +5192,7 @@ namespace Game.Spells
}
}
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -5255,7 +5253,7 @@ namespace Game.Spells
}
case AuraType.Mounted:
{
if (m_caster.IsInWater() && m_spellInfo.HasAura(m_caster.GetMap().GetDifficultyID(), AuraType.ModIncreaseMountedFlightSpeed))
if (m_caster.IsInWater() && m_spellInfo.HasAura(AuraType.ModIncreaseMountedFlightSpeed))
return SpellCastResult.OnlyAbovewater;
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
@@ -5613,7 +5611,7 @@ namespace Game.Spells
ObjectGuid targetguid = target.GetGUID();
// check if target already has the same or a more powerful aura
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -5837,7 +5835,7 @@ namespace Game.Spells
{
// such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example
SpellCastResult failReason = SpellCastResult.SpellCastOk;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
// skip check, pet not required like checks, and for TARGET_UNIT_PET m_targets.GetUnitTarget() is not the real target but the caster
if (effect == null || effect.TargetA.GetTarget() == Targets.UnitPet)
@@ -5993,7 +5991,7 @@ namespace Game.Spells
}
// special checks for spell effects
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -6028,7 +6026,7 @@ namespace Game.Spells
player.SendEquipError(msg, null, null, effect.ItemType);
return SpellCastResult.DontReport;
}
else if ((efi = GetEffect(1)) != null)
else if ((efi = m_spellInfo.GetEffect(1)) != null)
player.CastSpell(m_caster, (uint)efi.CalcValue(), false); // move this to anywhere
return SpellCastResult.DontReport;
}
@@ -6437,7 +6435,7 @@ namespace Game.Spells
WorldObject transport = null;
// update effect destinations (in case of moved transport dest target)
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -6471,6 +6469,11 @@ namespace Game.Spells
return CurrentSpellTypes.Generic;
}
public Difficulty GetCastDifficulty()
{
return m_caster.GetMap().GetDifficultyID();
}
bool CheckEffectTarget(Unit target, SpellEffectInfo effect, Position losPosition)
{
if (!effect.IsEffect())
@@ -6632,7 +6635,7 @@ namespace Game.Spells
void HandleLaunchPhase()
{
// handle effects with SPELL_EFFECT_HANDLE_LAUNCH mode
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
// don't do anything for empty effect
if (effect == null || !effect.IsEffect())
@@ -6642,7 +6645,7 @@ namespace Game.Spells
}
float[] multiplier = new float[SpellConst.MaxEffects];
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && Convert.ToBoolean(m_applyMultiplierMask & (1 << (int)effect.EffectIndex)))
multiplier[effect.EffectIndex] = effect.CalcDamageMultiplier(m_originalCaster, this);
@@ -6674,7 +6677,7 @@ namespace Game.Spells
if (unit == null)
return;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect != null && Convert.ToBoolean(targetInfo.effectMask & (1 << (int)effect.EffectIndex)))
{
@@ -6723,7 +6726,7 @@ namespace Game.Spells
if (lockInfo == null)
return SpellCastResult.BadTargets;
SpellEffectInfo effect = GetEffect(effIndex);
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return SpellCastResult.BadTargets; // no idea about correct error
@@ -7054,7 +7057,7 @@ namespace Game.Spells
{
bool only_on_caster = (triggeredByAura != null && triggeredByAura.HasAttribute(SpellAttr4.ProcOnlyOnCaster));
// If triggeredByAura has SPELL_ATTR4_PROC_ONLY_ON_CASTER then it can only proc on a casted spell with TARGET_UNIT_CASTER
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect != null && (Convert.ToBoolean(effMask & (1 << (int)effect.EffectIndex)) && (!only_on_caster || (effect.TargetA.GetTarget() == Targets.UnitCaster))))
return true;
@@ -7073,7 +7076,7 @@ namespace Game.Spells
if (!aurEff.IsAffectingSpell(m_spellInfo))
continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(aurEff.GetSpellEffectInfo().TriggerSpell);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(aurEff.GetSpellEffectInfo().TriggerSpell, GetCastDifficulty());
if (spellInfo != null)
{
// calculate the chance using spell base amount, because aura amount is not updated on combo-points change
@@ -7279,25 +7282,6 @@ namespace Game.Spells
public SpellInfo GetTriggeredByAuraSpell() { return m_triggeredByAuraSpell; }
SpellEffectInfo[] GetEffects() { return _effects; }
public SpellEffectInfo GetEffect(uint index)
{
if (index >= _effects.Length)
return null;
return _effects[index];
}
bool HasEffect(SpellEffectName effect)
{
foreach (SpellEffectInfo eff in GetEffects())
{
if (eff != null && eff.IsEffect(effect))
return true;
}
return false;
}
public static implicit operator bool(Spell spell)
{
return spell != null;
@@ -7412,8 +7396,6 @@ namespace Game.Spells
// and in same time need aura data and after aura deleting.
public SpellInfo m_triggeredByAuraSpell;
SpellEffectInfo[] _effects = new SpellEffectInfo[SpellConst.MaxEffects];
bool m_skipCheck;
#endregion
}
@@ -7605,11 +7587,9 @@ namespace Game.Spells
public class SpellValue
{
public SpellValue(Difficulty difficulty, SpellInfo proto, Unit caster)
public SpellValue(SpellInfo proto, Unit caster)
{
var effects = proto.GetEffectsForDifficulty(difficulty);
Cypher.Assert(effects.Length <= SpellConst.MaxEffects);
foreach (SpellEffectInfo effect in effects)
foreach (SpellEffectInfo effect in proto.GetEffects())
if (effect != null)
EffectBasePoints[effect.EffectIndex] = effect.CalcBaseValue(caster, null, 0, -1);
+27 -85
View File
@@ -133,7 +133,7 @@ namespace Game.Spells
DamageInfo damageInfo = new DamageInfo(m_caster, unitTarget, (uint)damage, m_spellInfo, m_spellInfo.GetSchoolMask(), DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack);
m_caster.CalcAbsorbResist(damageInfo);
SpellNonMeleeDamage log = new SpellNonMeleeDamage(m_caster, unitTarget, m_spellInfo.Id, m_SpellVisual, m_spellInfo.GetSchoolMask(), m_castId);
SpellNonMeleeDamage log = new SpellNonMeleeDamage(m_caster, unitTarget, m_spellInfo, m_SpellVisual, m_spellInfo.GetSchoolMask(), m_castId);
log.damage = damageInfo.GetDamage();
log.originalDamage = (uint)damage;
log.absorb = damageInfo.GetAbsorb();
@@ -359,7 +359,7 @@ namespace Game.Spells
case 29284:
{
// Brittle Armor
SpellInfo spell = Global.SpellMgr.GetSpellInfo(24575);
SpellInfo spell = Global.SpellMgr.GetSpellInfo(24575, GetCastDifficulty());
if (spell == null)
return;
@@ -371,7 +371,7 @@ namespace Game.Spells
case 29286:
{
// Mercurial Shield
SpellInfo spell = Global.SpellMgr.GetSpellInfo(26464);
SpellInfo spell = Global.SpellMgr.GetSpellInfo(26464, GetCastDifficulty());
if (spell == null)
return;
@@ -401,7 +401,7 @@ namespace Game.Spells
}
// normal case
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id, GetCastDifficulty());
if (spellInfo == null)
{
Log.outDebug(LogFilter.Spells, "Spell.EffectTriggerSpell spell {0} tried to trigger unknown spell {1}", m_spellInfo.Id, triggered_spell_id);
@@ -411,13 +411,13 @@ namespace Game.Spells
SpellCastTargets targets = new SpellCastTargets();
if (effectHandleMode == SpellEffectHandleMode.LaunchTarget)
{
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, m_caster.GetMap().GetDifficultyID()))
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
return;
targets.SetUnitTarget(unitTarget);
}
else //if (effectHandleMode == SpellEffectHandleMode.Launch)
{
if (spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, m_caster.GetMap().GetDifficultyID()) && effectInfo.GetProvidedTargetMask().HasAnyFlag(SpellCastTargetFlags.UnitMask))
if (spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) && effectInfo.GetProvidedTargetMask().HasAnyFlag(SpellCastTargetFlags.UnitMask))
return;
if (spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.DestLocation))
@@ -450,7 +450,7 @@ namespace Game.Spells
uint triggered_spell_id = effectInfo.TriggerSpell;
// normal case
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id, GetCastDifficulty());
if (spellInfo == null)
{
Log.outDebug(LogFilter.Spells, "Spell.EffectTriggerMissileSpell spell {0} tried to trigger unknown spell {1}", m_spellInfo.Id, triggered_spell_id);
@@ -460,13 +460,13 @@ namespace Game.Spells
SpellCastTargets targets = new SpellCastTargets();
if (effectHandleMode == SpellEffectHandleMode.HitTarget)
{
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, m_caster.GetMap().GetDifficultyID()))
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
return;
targets.SetUnitTarget(unitTarget);
}
else //if (effectHandleMode == SpellEffectHandleMode.Hit)
{
if (spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, m_caster.GetMap().GetDifficultyID()) && effectInfo.GetProvidedTargetMask().HasAnyFlag(SpellCastTargetFlags.UnitMask))
if (spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) && effectInfo.GetProvidedTargetMask().HasAnyFlag(SpellCastTargetFlags.UnitMask))
return;
if (spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.DestLocation))
@@ -503,7 +503,7 @@ namespace Game.Spells
uint triggered_spell_id = effectInfo.TriggerSpell;
// normal case
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id, GetCastDifficulty());
if (spellInfo == null)
{
Log.outError(LogFilter.Spells, "Spell.EffectForceCast of spell {0}: triggering unknown spell id {1}", m_spellInfo.Id, triggered_spell_id);
@@ -548,7 +548,7 @@ namespace Game.Spells
return;
uint triggered_spell_id = effectInfo.TriggerSpell;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id, GetCastDifficulty());
if (spellInfo == null)
{
Log.outError(LogFilter.Spells, "EffectTriggerRitualOfSummoning of spell {0}: triggering unknown spell id {1}", m_spellInfo.Id, triggered_spell_id);
@@ -1217,7 +1217,7 @@ namespace Game.Spells
if (!dynObj.CreateDynamicObject(caster.GetMap().GenerateLowGuid(HighGuid.DynamicObject), caster, m_spellInfo, destTarget, radius, DynamicObjectType.AreaSpell, m_SpellVisual))
return;
Aura aura = Aura.TryCreate(m_spellInfo, m_castId, SpellConst.MaxEffectMask, dynObj, caster, m_spellValue.EffectBasePoints, null, ObjectGuid.Empty, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
Aura aura = Aura.TryCreate(m_spellInfo, m_castId, SpellConst.MaxEffectMask, dynObj, caster, GetCastDifficulty(), m_spellValue.EffectBasePoints, null, ObjectGuid.Empty, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
if (aura != null)
{
m_spellAura = aura;
@@ -1775,8 +1775,8 @@ namespace Game.Spells
int basePoints = effectInfo.CalcValue();
if (basePoints > SharedConst.MaxVehicleSeats)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)basePoints);
if (spellInfo != null && spellInfo.HasAura(m_originalCaster.GetMap().GetDifficultyID(), AuraType.ControlVehicle))
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)basePoints, GetCastDifficulty());
if (spellInfo != null && spellInfo.HasAura(AuraType.ControlVehicle))
spellId = spellInfo.Id;
}
@@ -2435,7 +2435,7 @@ namespace Game.Spells
if (pet == null)
return;
SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effectInfo.TriggerSpell);
SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effectInfo.TriggerSpell, Difficulty.None);
if (learn_spellproto == null)
return;
@@ -2497,7 +2497,7 @@ namespace Game.Spells
// and handle all effects at once
for (var i = effIndex + 1; i < SpellConst.MaxEffects; ++i)
{
var effect = GetEffect(i);
var effect = m_spellInfo.GetEffect(i);
if (effect == null)
continue;
@@ -2588,7 +2588,7 @@ namespace Game.Spells
// Blood Strike
if (m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x400000u))
{
SpellEffectInfo effect = GetEffect(2);
SpellEffectInfo effect = m_spellInfo.GetEffect(2);
if (effect != null)
{
float bonusPct = effect.CalcValue(m_caster) * unitTarget.GetDiseasesByCaster(m_caster.GetGUID()) / 2.0f;
@@ -2606,7 +2606,7 @@ namespace Game.Spells
bool normalized = false;
float weaponDamagePercentMod = 1.0f;
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -2659,7 +2659,7 @@ namespace Game.Spells
uint weaponDamage = m_caster.CalculateDamage(m_attackType, normalized, addPctMods);
// Sequence is important
foreach (SpellEffectInfo effect in GetEffects())
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
@@ -3118,8 +3118,8 @@ namespace Game.Spells
if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Player) || effIndex != 0)
return;
uint spellID = (uint)GetEffect(0).CalcValue();
uint questID = (uint)GetEffect(1).CalcValue();
uint spellID = (uint)m_spellInfo.GetEffect(0).CalcValue();
uint questID = (uint)m_spellInfo.GetEffect(1).CalcValue();
if (unitTarget.ToPlayer().GetQuestStatus(questID) == QuestStatus.Complete)
unitTarget.CastSpell(unitTarget, spellID, true);
@@ -3192,7 +3192,7 @@ namespace Game.Spells
{
// @todo a hack, range = 11, should after some time cast, otherwise too far
m_caster.CastSpell(parent, 62496, true);
unitTarget.CastSpell(parent, (uint)GetEffect(0).CalcValue());
unitTarget.CastSpell(parent, (uint)m_spellInfo.GetEffect(0).CalcValue());
}
}
}
@@ -3289,64 +3289,6 @@ namespace Game.Spells
}
break;
}
case SpellFamilyNames.Paladin:
{
// Judgement (seal trigger)
if (m_spellInfo.GetCategory() == (int)SpellCategories.Judgement)
{
if (unitTarget == null || !unitTarget.IsAlive())
return;
uint spellId1;
uint spellId2 = 0;
// Judgement self add switch
switch (m_spellInfo.Id)
{
case 53407: spellId1 = 20184; break; // Judgement of Justice
case 20271: // Judgement of Light
case 57774: spellId1 = 20185; break; // Judgement of Light
case 53408: spellId1 = 20186; break; // Judgement of Wisdom
default:
Log.outError(LogFilter.Spells, "Unsupported Judgement (seal trigger) spell (Id: {0}) in Spell.EffectScriptEffect", m_spellInfo.Id);
return;
}
// all seals have aura dummy in 2 effect
foreach (var app in m_caster.GetAppliedAuras())
{
Aura aura = app.Value.GetBase();
if (aura.GetSpellInfo().GetSpellSpecific() == SpellSpecificType.Seal)
{
AuraEffect aureff = aura.GetEffect(2);
if (aureff != null)
if (aureff.GetAuraType() == AuraType.Dummy)
{
if (Global.SpellMgr.GetSpellInfo((uint)aureff.GetAmount()) != null)
spellId2 = (uint)aureff.GetAmount();
break;
}
if (spellId2 == 0)
{
switch (app.Key)
{
// Seal of light, Seal of wisdom, Seal of justice
case 20165:
case 20166:
case 20164:
spellId2 = 54158;
break;
}
}
break;
}
}
if (spellId1 != 0)
m_caster.CastSpell(unitTarget, spellId1, true);
if (spellId2 != 0)
m_caster.CastSpell(unitTarget, spellId2, true);
return;
}
break;
}
}
// normal DB scripted effect
@@ -3535,7 +3477,7 @@ namespace Game.Spells
player.TeleportTo(player.GetHomebind(), TeleportToOptions.Spell);
// Stuck spell trigger Hearthstone cooldown
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(8690);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(8690, GetCastDifficulty());
if (spellInfo == null)
return;
@@ -4399,7 +4341,7 @@ namespace Game.Spells
if (totem != null && totem.IsTotem())
{
uint spell_id = totem.m_unitData.CreatedBySpell;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id, GetCastDifficulty());
if (spellInfo != null)
{
var costs = spellInfo.CalcPowerCost(m_caster, spellInfo.GetSchoolMask());
@@ -5244,7 +5186,7 @@ namespace Game.Spells
if (spell_id == 0)
continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id, GetCastDifficulty());
if (spellInfo == null)
continue;
@@ -5255,7 +5197,7 @@ namespace Game.Spells
continue;
TriggerCastFlags triggerFlags = (TriggerCastFlags.IgnoreGCD | TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.CastDirectly | TriggerCastFlags.DontReportCastError);
m_caster.CastSpell(m_caster, spell_id, triggerFlags);
m_caster.CastSpell(m_caster, spellInfo, triggerFlags);
}
}
@@ -5365,7 +5307,7 @@ namespace Game.Spells
uint health = (uint)target.CountPctFromMaxHealth(damage);
uint mana = (uint)MathFunctions.CalculatePct(target.GetMaxPower(PowerType.Mana), damage);
uint resurrectAura = 0;
if (Global.SpellMgr.GetSpellInfo(effectInfo.TriggerSpell) != null)
if (Global.SpellMgr.HasSpellInfo(effectInfo.TriggerSpell, Difficulty.None))
resurrectAura = effectInfo.TriggerSpell;
if (resurrectAura != 0 && target.HasAura(resurrectAura))
+6 -6
View File
@@ -40,7 +40,7 @@ namespace Game.Spells
do
{
uint spellId = cooldownsResult.Read<uint>(0);
if (!Global.SpellMgr.HasSpellInfo(spellId))
if (!Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
continue;
int index = (typeof(T) == typeof(Pet) ? 1 : 2);
@@ -222,7 +222,7 @@ namespace Game.Spells
if (IsSchoolLocked(spellInfo.GetSchoolMask()))
return false;
if (HasCooldown(spellInfo.Id, itemId, ignoreCategoryCooldown))
if (HasCooldown(spellInfo, itemId, ignoreCategoryCooldown))
return false;
if (!HasCharge(spellInfo.ChargeCategoryId))
@@ -459,7 +459,7 @@ namespace Game.Spells
player.SendPacket(new CooldownEvent(player != _owner, categoryEntry.SpellId));
if (startCooldown)
StartCooldown(Global.SpellMgr.GetSpellInfo(categoryEntry.SpellId), itemId, spell);
StartCooldown(Global.SpellMgr.GetSpellInfo(categoryEntry.SpellId, _owner.GetMap().GetDifficultyID()), itemId, spell);
}
player.SendPacket(new CooldownEvent(player != _owner, spellInfo.Id));
@@ -581,7 +581,7 @@ namespace Game.Spells
public bool HasCooldown(uint spellId, uint itemId = 0, bool ignoreCategoryCooldown = false)
{
return HasCooldown(Global.SpellMgr.GetSpellInfo(spellId), itemId, ignoreCategoryCooldown);
return HasCooldown(Global.SpellMgr.GetSpellInfo(spellId, _owner.GetMap().GetDifficultyID()), itemId, ignoreCategoryCooldown);
}
public bool HasCooldown(SpellInfo spellInfo, uint itemId = 0, bool ignoreCategoryCooldown = false)
@@ -663,7 +663,7 @@ namespace Game.Spells
spellCooldown.Flags = SpellCooldownFlags.None;
foreach (uint spellId in knownSpells)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, _owner.GetMap().GetDifficultyID());
if (spellInfo.IsCooldownStartedOnEvent())
continue;
@@ -904,7 +904,7 @@ namespace Game.Spells
// add all profession CDs created while in duel (if any)
foreach (var c in _spellCooldowns)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(c.Key);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(c.Key, Difficulty.None);
if (spellInfo.RecoveryTime > 10 * Time.Minute * Time.InMilliseconds || spellInfo.CategoryRecoveryTime > 10 * Time.Minute * Time.InMilliseconds)
_spellCooldownsBeforeDuel[c.Key] = _spellCooldowns[c.Key];
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff