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
+1 -1
View File
@@ -169,7 +169,7 @@ namespace Framework.Constants
PassengerRemoved = 28, // Cooldownmin, Cooldownmax PassengerRemoved = 28, // Cooldownmin, Cooldownmax
Charmed = 29, // onRemove (0 - on apply, 1 - on remove) Charmed = 29, // onRemove (0 - on apply, 1 - on remove)
CharmedTarget = 30, // None CharmedTarget = 30, // None
SpellhitTarget = 31, // Spellid, School, Cooldownmin, Cooldownmax SpellHitTarget = 31, // Spellid, School, Cooldownmin, Cooldownmax
Damaged = 32, // Mindmg, Maxdmg, Cooldownmin, Cooldownmax Damaged = 32, // Mindmg, Maxdmg, Cooldownmin, Cooldownmax
DamagedTarget = 33, // Mindmg, Maxdmg, Cooldownmin, Cooldownmax DamagedTarget = 33, // Mindmg, Maxdmg, Cooldownmin, Cooldownmax
Movementinform = 34, // Movementtype(Any), Pointid Movementinform = 34, // Movementtype(Any), Pointid
@@ -442,8 +442,8 @@ namespace Framework.Constants
ModMaxPower = 418, // NYI ModMaxPower = 418, // NYI
ModBaseManaPct = 419, ModBaseManaPct = 419,
ModBattlePetXpPct = 420, ModBattlePetXpPct = 420,
ModAbsorbEffectsAmountPct = 421, // NYI ModAbsorbEffectsDonePct = 421, // NYI
Unk422 = 422, ModAbsorbEffectsTakenPct = 422, //NYI
Unk423 = 423, Unk423 = 423,
Unk424 = 424, Unk424 = 424,
Unk425 = 425, Unk425 = 425,
@@ -32,6 +32,8 @@ namespace Framework.Constants
public const int EffectAll = 255; public const int EffectAll = 255;
public const float TrajectoryMissileSize = 3.0f; public const float TrajectoryMissileSize = 3.0f;
public const int MaxPowersPerSpell = 4;
} }
@@ -2323,7 +2325,7 @@ namespace Framework.Constants
UnitNearbyParty = 3, UnitNearbyParty = 3,
UnitNearbyAlly = 4, UnitNearbyAlly = 4,
UnitPet = 5, UnitPet = 5,
UnitEnemy = 6, UnitTargetEnemy = 6,
UnitSrcAreaEntry = 7, UnitSrcAreaEntry = 7,
UnitDestAreaEntry = 8, UnitDestAreaEntry = 8,
DestHome = 9, DestHome = 9,
@@ -2333,11 +2335,11 @@ namespace Framework.Constants
DestDb = 17, DestDb = 17,
DestCaster = 18, DestCaster = 18,
UnitCasterAreaParty = 20, UnitCasterAreaParty = 20,
UnitAlly = 21, UnitTargetAlly = 21,
SrcCaster = 22, SrcCaster = 22,
GameobjectTarget = 23, GameobjectTarget = 23,
UnitConeEnemy24 = 24, UnitConeEnemy24 = 24,
UnitAny = 25, UnitTargetAny = 25,
GameobjectItemTarget = 26, GameobjectItemTarget = 26,
UnitMaster = 27, UnitMaster = 27,
DestDynobjEnemy = 28, DestDynobjEnemy = 28,
@@ -2347,9 +2349,9 @@ namespace Framework.Constants
DestCasterSummon = 32, // Front Left, Doesn'T Use Radius DestCasterSummon = 32, // Front Left, Doesn'T Use Radius
UnitSrcAreaParty = 33, UnitSrcAreaParty = 33,
UnitDestAreaParty = 34, UnitDestAreaParty = 34,
UnitParty = 35, UnitTargetParty = 35,
DestCasterUnk36 = 36, DestCasterUnk36 = 36,
UnitLastAreaParty = 37, UnitLastTargetAreaParty = 37,
UnitNearbyEntry = 38, UnitNearbyEntry = 38,
DestCasterFishing = 39, DestCasterFishing = 39,
GameobjectNearbyEntry = 40, GameobjectNearbyEntry = 40,
@@ -2365,7 +2367,7 @@ namespace Framework.Constants
DestCasterLeft = 50, DestCasterLeft = 50,
GameobjectSrcArea = 51, GameobjectSrcArea = 51,
GameobjectDestArea = 52, GameobjectDestArea = 52,
DestEnemy = 53, DestTargetEnemy = 53,
UnitConeEnemy54 = 54, UnitConeEnemy54 = 54,
DestCasterFrontLeap = 55, // For A Leap Spell DestCasterFrontLeap = 55, // For A Leap Spell
UnitCasterAreaRaid = 56, UnitCasterAreaRaid = 56,
@@ -83,7 +83,7 @@ namespace Framework.Database
PrepareStatement(CharStatements.SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?"); PrepareStatement(CharStatements.SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?");
PrepareStatement(CharStatements.SEL_CHARACTER_INSTANCE, "SELECT id, permanent, map, difficulty, extendState, resettime, entranceId FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = ?"); PrepareStatement(CharStatements.SEL_CHARACTER_INSTANCE, "SELECT id, permanent, map, difficulty, extendState, resettime, entranceId FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = ?");
PrepareStatement(CharStatements.SEL_CHARACTER_AURAS, "SELECT casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges, castItemId, castItemLevel FROM character_aura WHERE guid = ?"); PrepareStatement(CharStatements.SEL_CHARACTER_AURAS, "SELECT casterGuid, itemGuid, spell, effectMask, recalculateMask, difficulty, stackCount, maxDuration, remainTime, remainCharges, castItemId, castItemLevel FROM character_aura WHERE guid = ?");
PrepareStatement(CharStatements.SEL_CHARACTER_AURA_EFFECTS, "SELECT casterGuid, itemGuid, spell, effectMask, effectIndex, amount, baseAmount FROM character_aura_effect WHERE guid = ?"); PrepareStatement(CharStatements.SEL_CHARACTER_AURA_EFFECTS, "SELECT casterGuid, itemGuid, spell, effectMask, effectIndex, amount, baseAmount FROM character_aura_effect WHERE guid = ?");
PrepareStatement(CharStatements.SEL_CHARACTER_SPELL, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?"); PrepareStatement(CharStatements.SEL_CHARACTER_SPELL, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?");
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, timer FROM character_queststatus WHERE guid = ? AND status <> 0"); PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, timer FROM character_queststatus WHERE guid = ? AND status <> 0");
@@ -339,8 +339,8 @@ namespace Framework.Database
PrepareStatement(CharStatements.DEL_TRANSMOG_OUTFIT, "DELETE FROM character_transmog_outfits WHERE setguid=?"); PrepareStatement(CharStatements.DEL_TRANSMOG_OUTFIT, "DELETE FROM character_transmog_outfits WHERE setguid=?");
// Auras // Auras
PrepareStatement(CharStatements.INS_AURA, "INSERT INTO character_aura (guid, casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges, castItemId, castItemLevel) " + PrepareStatement(CharStatements.INS_AURA, "INSERT INTO character_aura (guid, casterGuid, itemGuid, spell, effectMask, recalculateMask, difficulty, stackCount, maxDuration, remainTime, remainCharges, castItemId, castItemLevel) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.INS_AURA_EFFECT, "INSERT INTO character_aura_effect (guid, casterGuid, itemGuid, spell, effectMask, effectIndex, amount, baseAmount) " + PrepareStatement(CharStatements.INS_AURA_EFFECT, "INSERT INTO character_aura_effect (guid, casterGuid, itemGuid, spell, effectMask, effectIndex, amount, baseAmount) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); "VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
@@ -708,7 +708,7 @@ namespace Framework.Database
PrepareStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME_BY_OWNER, "DELETE FROM character_pet_declinedname WHERE owner = ?"); PrepareStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME_BY_OWNER, "DELETE FROM character_pet_declinedname WHERE owner = ?");
PrepareStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME, "DELETE FROM character_pet_declinedname WHERE id = ?"); PrepareStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME, "DELETE FROM character_pet_declinedname WHERE id = ?");
PrepareStatement(CharStatements.INS_CHAR_PET_DECLINEDNAME, "INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES (?, ?, ?, ?, ?, ?, ?)"); PrepareStatement(CharStatements.INS_CHAR_PET_DECLINEDNAME, "INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES (?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.SEL_PET_AURA, "SELECT casterGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges FROM pet_aura WHERE guid = ?"); PrepareStatement(CharStatements.SEL_PET_AURA, "SELECT casterGuid, spell, effectMask, recalculateMask, difficulty, stackCount, maxDuration, remainTime, remainCharges FROM pet_aura WHERE guid = ?");
PrepareStatement(CharStatements.SEL_PET_AURA_EFFECT, "SELECT casterGuid, spell, effectMask, effectIndex, amount, baseAmount FROM pet_aura_effect WHERE guid = ?"); PrepareStatement(CharStatements.SEL_PET_AURA_EFFECT, "SELECT casterGuid, spell, effectMask, effectIndex, amount, baseAmount FROM pet_aura_effect WHERE guid = ?");
PrepareStatement(CharStatements.SEL_PET_SPELL, "SELECT spell, active FROM pet_spell WHERE guid = ?"); PrepareStatement(CharStatements.SEL_PET_SPELL, "SELECT spell, active FROM pet_spell WHERE guid = ?");
PrepareStatement(CharStatements.SEL_PET_SPELL_COOLDOWN, "SELECT spell, time, categoryId, categoryEnd FROM pet_spell_cooldown WHERE guid = ? AND time > UNIX_TIMESTAMP()"); PrepareStatement(CharStatements.SEL_PET_SPELL_COOLDOWN, "SELECT spell, time, categoryId, categoryEnd FROM pet_spell_cooldown WHERE guid = ? AND time > UNIX_TIMESTAMP()");
@@ -723,8 +723,8 @@ namespace Framework.Database
PrepareStatement(CharStatements.INS_PET_SPELL_CHARGES, "INSERT INTO pet_spell_charges (guid, categoryId, rechargeStart, rechargeEnd) VALUES (?, ?, ?, ?)"); PrepareStatement(CharStatements.INS_PET_SPELL_CHARGES, "INSERT INTO pet_spell_charges (guid, categoryId, rechargeStart, rechargeEnd) VALUES (?, ?, ?, ?)");
PrepareStatement(CharStatements.DEL_PET_SPELL_BY_SPELL, "DELETE FROM pet_spell WHERE guid = ? and spell = ?"); PrepareStatement(CharStatements.DEL_PET_SPELL_BY_SPELL, "DELETE FROM pet_spell WHERE guid = ? and spell = ?");
PrepareStatement(CharStatements.INS_PET_SPELL, "INSERT INTO pet_spell (guid, spell, active) VALUES (?, ?, ?)"); PrepareStatement(CharStatements.INS_PET_SPELL, "INSERT INTO pet_spell (guid, spell, active) VALUES (?, ?, ?)");
PrepareStatement(CharStatements.INS_PET_AURA, "INSERT INTO pet_aura (guid, casterGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges) " + PrepareStatement(CharStatements.INS_PET_AURA, "INSERT INTO pet_aura (guid, casterGuid, spell, effectMask, recalculateMask, difficulty, stackCount, maxDuration, remainTime, remainCharges) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.INS_PET_AURA_EFFECT, "INSERT INTO pet_aura_effect (guid, casterGuid, spell, effectMask, effectIndex, amount, baseAmount) " + PrepareStatement(CharStatements.INS_PET_AURA_EFFECT, "INSERT INTO pet_aura_effect (guid, casterGuid, spell, effectMask, effectIndex, amount, baseAmount) " +
"VALUES (?, ?, ?, ?, ?, ?, ?)"); "VALUES (?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.SEL_CHAR_PET_BY_ENTRY, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType, specialization FROM character_pet WHERE owner = ? AND id = ?"); PrepareStatement(CharStatements.SEL_CHAR_PET_BY_ENTRY, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType, specialization FROM character_pet WHERE owner = ? AND id = ?");
+27 -17
View File
@@ -28,7 +28,7 @@ namespace Game.AI
public override void InitializeAI() public override void InitializeAI()
{ {
for (var i = 0; i < SharedConst.MaxCreatureSpells; ++i) for (var i = 0; i < SharedConst.MaxCreatureSpells; ++i)
if (me.m_spells[i] != 0 && Global.SpellMgr.GetSpellInfo(me.m_spells[i]) != null) if (me.m_spells[i] != 0 && Global.SpellMgr.HasSpellInfo(me.m_spells[i], me.GetMap().GetDifficultyID()))
spells.Add(me.m_spells[i]); spells.Add(me.m_spells[i]);
base.InitializeAI(); base.InitializeAI();
@@ -42,18 +42,22 @@ namespace Game.AI
public override void JustDied(Unit killer) public override void JustDied(Unit killer)
{ {
foreach (var id in spells) foreach (var id in spells)
if (AISpellInfo[id].condition == AICondition.Die) {
AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID());
if (info.condition == AICondition.Die)
me.CastSpell(killer, id, true); me.CastSpell(killer, id, true);
}
} }
public override void EnterCombat(Unit victim) public override void EnterCombat(Unit victim)
{ {
foreach (var id in spells) foreach (var id in spells)
{ {
if (AISpellInfo[id].condition == AICondition.Aggro) AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID());
if (info.condition == AICondition.Aggro)
me.CastSpell(victim, id, false); me.CastSpell(victim, id, false);
else if (AISpellInfo[id].condition == AICondition.Combat) else if (info.condition == AICondition.Combat)
_events.ScheduleEvent(id, AISpellInfo[id].cooldown + RandomHelper.Rand32() % AISpellInfo[id].cooldown); _events.ScheduleEvent(id, info.cooldown + RandomHelper.Rand32() % info.cooldown);
} }
} }
@@ -71,10 +75,11 @@ namespace Game.AI
if (spellId != 0) if (spellId != 0)
{ {
DoCast(spellId); DoCast(spellId);
_events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + RandomHelper.Rand32() % AISpellInfo[spellId].cooldown); AISpellInfoType info = GetAISpellInfo(spellId, me.GetMap().GetDifficultyID());
_events.ScheduleEvent(spellId, info.cooldown + RandomHelper.Rand32() % info.cooldown);
} }
else
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
public override void SpellInterrupted(uint spellId, uint unTimeMs) public override void SpellInterrupted(uint spellId, uint unTimeMs)
@@ -112,8 +117,12 @@ namespace Game.AI
m_attackDist = 30.0f; m_attackDist = 30.0f;
foreach (var id in spells) foreach (var id in spells)
if (AISpellInfo[id].condition == AICondition.Combat && m_attackDist > AISpellInfo[id].maxRange) {
m_attackDist = AISpellInfo[id].maxRange; AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID());
if (info.condition == AICondition.Combat && m_attackDist > info.maxRange)
m_attackDist = info.maxRange;
}
if (m_attackDist == 30.0f) if (m_attackDist == 30.0f)
m_attackDist = SharedConst.MeleeRange; m_attackDist = SharedConst.MeleeRange;
} }
@@ -132,12 +141,12 @@ namespace Game.AI
uint count = 0; uint count = 0;
foreach (var id in spells) foreach (var id in spells)
{ {
AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID());
if (AISpellInfo[id].condition == AICondition.Aggro) if (info.condition == AICondition.Aggro)
me.CastSpell(victim, id, false); me.CastSpell(victim, id, false);
else if (AISpellInfo[id].condition == AICondition.Combat) else if (info.condition == AICondition.Combat)
{ {
uint cooldown = AISpellInfo[id].realCooldown; uint cooldown = info.realCooldown;
if (count == spell) if (count == spell)
{ {
DoCast(spells[spell]); DoCast(spells[spell]);
@@ -169,7 +178,8 @@ namespace Game.AI
{ {
DoCast(spellId); DoCast(spellId);
uint casttime = (uint)me.GetCurrentSpellCastTime(spellId); uint casttime = (uint)me.GetCurrentSpellCastTime(spellId);
_events.ScheduleEvent(spellId, (casttime != 0 ? casttime : 500) + AISpellInfo[spellId].realCooldown); AISpellInfoType info = GetAISpellInfo(spellId, me.GetMap().GetDifficultyID());
_events.ScheduleEvent(spellId, (casttime != 0 ? casttime : 500) + info.realCooldown);
} }
} }
@@ -184,7 +194,7 @@ namespace Game.AI
if (me.m_spells[0] == 0) if (me.m_spells[0] == 0)
Log.outError(LogFilter.ScriptsAi, "ArcherAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry()); Log.outError(LogFilter.ScriptsAi, "ArcherAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry());
var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0]); var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID());
m_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0; m_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0;
if (m_minRange == 0) if (m_minRange == 0)
@@ -234,7 +244,7 @@ namespace Game.AI
if (me.m_spells[0] == 0) if (me.m_spells[0] == 0)
Log.outError(LogFilter.Server, "TurretAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry()); Log.outError(LogFilter.Server, "TurretAI set for creature (entry = {0}) with spell1=0. AI will do nothing", me.GetEntry());
var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0]); var spellInfo = Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID());
m_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0; m_minRange = spellInfo != null ? spellInfo.GetMinRange(false) : 0;
me.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0; me.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0;
me.m_SightDistance = me.m_CombatDistance; me.m_SightDistance = me.m_CombatDistance;
+3
View File
@@ -492,6 +492,9 @@ namespace Game.AI
public uint cooldown; public uint cooldown;
public uint realCooldown; public uint realCooldown;
public float maxRange; public float maxRange;
public byte Targets; // set of enum SelectTarget
public byte Effects; // set of enum SelectEffect
} }
public enum AITarget public enum AITarget
+1 -1
View File
@@ -138,7 +138,7 @@ namespace Game.AI
if (spellID == 0) if (spellID == 0)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID, me.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
continue; continue;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Game.AI
return; return;
// Search spell // Search spell
var spellInfo = Global.SpellMgr.GetSpellInfo(me.ToTotem().GetSpell()); var spellInfo = Global.SpellMgr.GetSpellInfo(me.ToTotem().GetSpell(), me.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return; return;
+105 -25
View File
@@ -31,7 +31,7 @@ namespace Game.AI
{ {
me = _unit; me = _unit;
} }
public virtual void AttackStart(Unit victim) public virtual void AttackStart(Unit victim)
{ {
if (victim != null && me.Attack(victim, true)) if (victim != null && me.Attack(victim, true))
@@ -99,7 +99,7 @@ namespace Game.AI
if (me.HasUnitState(UnitState.Casting) || !me.IsAttackReady()) if (me.HasUnitState(UnitState.Casting) || !me.IsAttackReady())
return true; return true;
var spellInfo = Global.SpellMgr.GetSpellInfo(spell); var spellInfo = Global.SpellMgr.GetSpellInfo(spell, me.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
if (me.IsWithinCombatRange(me.GetVictim(), spellInfo.GetMaxRange(false))) if (me.IsWithinCombatRange(me.GetVictim(), spellInfo.GetMaxRange(false)))
@@ -156,18 +156,18 @@ namespace Game.AI
{ {
case SelectAggroTarget.Nearest: case SelectAggroTarget.Nearest:
case SelectAggroTarget.TopAggro: case SelectAggroTarget.TopAggro:
{ {
return targetList.First(); return targetList.First();
} }
case SelectAggroTarget.Farthest: case SelectAggroTarget.Farthest:
case SelectAggroTarget.BottomAggro: case SelectAggroTarget.BottomAggro:
{ {
return targetList.Last(); return targetList.Last();
} }
case SelectAggroTarget.Random: case SelectAggroTarget.Random:
{ {
return targetList.SelectRandom(); return targetList.SelectRandom();
} }
default: default:
break; break;
} }
@@ -179,7 +179,7 @@ namespace Game.AI
{ {
return SelectTargetList(new DefaultTargetSelector(me, dist, playerOnly, aura), num, targetType); return SelectTargetList(new DefaultTargetSelector(me, dist, playerOnly, aura), num, targetType);
} }
// Select the targets satifying the predicate. // Select the targets satifying the predicate.
// predicate shall extend std.unary_function<Unit*, bool> // predicate shall extend std.unary_function<Unit*, bool>
public List<Unit> SelectTargetList(ISelector selector, uint maxTargets, SelectAggroTarget targetType) public List<Unit> SelectTargetList(ISelector selector, uint maxTargets, SelectAggroTarget targetType)
@@ -215,7 +215,8 @@ namespace Game.AI
{ {
Unit target = null; Unit target = null;
switch (AISpellInfo[spellId].target) AISpellInfoType info = GetAISpellInfo(spellId, me.GetMap().GetDifficultyID());
switch (info.target)
{ {
default: default:
case AITarget.Self: case AITarget.Self:
@@ -226,7 +227,7 @@ namespace Game.AI
break; break;
case AITarget.Enemy: case AITarget.Enemy:
{ {
var spellInfo = Global.SpellMgr.GetSpellInfo(spellId); var spellInfo = Global.SpellMgr.GetSpellInfo(spellId, me.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
bool playerOnly = spellInfo.HasAttribute(SpellAttr3.OnlyTargetPlayers); bool playerOnly = spellInfo.HasAttribute(SpellAttr3.OnlyTargetPlayers);
@@ -240,7 +241,7 @@ namespace Game.AI
break; break;
case AITarget.Debuff: case AITarget.Debuff:
{ {
var spellInfo = Global.SpellMgr.GetSpellInfo(spellId); var spellInfo = Global.SpellMgr.GetSpellInfo(spellId, me.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
bool playerOnly = spellInfo.HasAttribute(SpellAttr3.OnlyTargetPlayers); bool playerOnly = spellInfo.HasAttribute(SpellAttr3.OnlyTargetPlayers);
@@ -289,12 +290,11 @@ namespace Game.AI
public static void FillAISpellInfo() public static void FillAISpellInfo()
{ {
var spellStorage = Global.SpellMgr.GetSpellInfoStorage(); //AISpellInfo = new AISpellInfoType[spellStorage.Keys.Max() + 1];
AISpellInfo = new AISpellInfoType[spellStorage.Keys.Max() + 1];
foreach (var spellInfo in spellStorage.Values) Global.SpellMgr.ForEachSpellInfo(spellInfo =>
{ {
AISpellInfoType AIInfo = AISpellInfo[spellInfo.Id]; AISpellInfoType AIInfo = new AISpellInfoType();
if (spellInfo.HasAttribute(SpellAttr0.CastableWhileDead)) if (spellInfo.HasAttribute(SpellAttr0.CastableWhileDead))
AIInfo.condition = AICondition.Die; AIInfo.condition = AICondition.Die;
else if (spellInfo.IsPassive() || spellInfo.GetDuration() == -1) else if (spellInfo.IsPassive() || spellInfo.GetDuration() == -1)
@@ -312,14 +312,14 @@ namespace Game.AI
} }
else else
{ {
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
var targetType = effect.TargetA.GetTarget(); var targetType = effect.TargetA.GetTarget();
if (targetType == Targets.UnitEnemy || targetType == Targets.DestEnemy) if (targetType == Targets.UnitTargetEnemy || targetType == Targets.DestTargetEnemy)
{ {
if (AIInfo.target < AITarget.Victim) if (AIInfo.target < AITarget.Victim)
AIInfo.target = AITarget.Victim; AIInfo.target = AITarget.Victim;
@@ -332,7 +332,7 @@ namespace Game.AI
if (effect.Effect == SpellEffectName.ApplyAura) if (effect.Effect == SpellEffectName.ApplyAura)
{ {
if (targetType == Targets.UnitEnemy) if (targetType == Targets.UnitTargetEnemy)
{ {
if (AIInfo.target < AITarget.Debuff) if (AIInfo.target < AITarget.Debuff)
AIInfo.target = AITarget.Debuff; AIInfo.target = AITarget.Debuff;
@@ -347,7 +347,82 @@ namespace Game.AI
} }
AIInfo.realCooldown = spellInfo.RecoveryTime + spellInfo.StartRecoveryTime; AIInfo.realCooldown = spellInfo.RecoveryTime + spellInfo.StartRecoveryTime;
AIInfo.maxRange = spellInfo.GetMaxRange(false) * 3 / 4; AIInfo.maxRange = spellInfo.GetMaxRange(false) * 3 / 4;
}
AIInfo.Effects = 0;
AIInfo.Targets = 0;
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{
if (effect == null)
continue;
// Spell targets self.
if (effect.TargetA.GetTarget() == Targets.UnitCaster)
AIInfo.Targets |= 1 << ((int)SelectTargetType.Self - 1);
// Spell targets a single enemy.
if (effect.TargetA.GetTarget() == Targets.UnitTargetEnemy ||
effect.TargetA.GetTarget() == Targets.DestTargetEnemy)
AIInfo.Targets |= 1 << ((int)SelectTargetType.SingleEnemy - 1);
// Spell targets AoE at enemy.
if (effect.TargetA.GetTarget() == Targets.UnitSrcAreaEnemy ||
effect.TargetA.GetTarget() == Targets.UnitDestAreaEnemy ||
effect.TargetA.GetTarget() == Targets.SrcCaster ||
effect.TargetA.GetTarget() == Targets.DestDynobjEnemy)
AIInfo.Targets |= 1 << ((int)SelectTargetType.AoeEnemy - 1);
// Spell targets an enemy.
if (effect.TargetA.GetTarget() == Targets.UnitTargetEnemy ||
effect.TargetA.GetTarget() == Targets.DestTargetEnemy ||
effect.TargetA.GetTarget() == Targets.UnitSrcAreaEnemy ||
effect.TargetA.GetTarget() == Targets.UnitDestAreaEnemy ||
effect.TargetA.GetTarget() == Targets.SrcCaster ||
effect.TargetA.GetTarget() == Targets.DestDynobjEnemy)
AIInfo.Targets |= 1 << ((int)SelectTargetType.AnyEnemy - 1);
// Spell targets a single friend (or self).
if (effect.TargetA.GetTarget() == Targets.UnitCaster ||
effect.TargetA.GetTarget() == Targets.UnitTargetAlly ||
effect.TargetA.GetTarget() == Targets.UnitTargetParty)
AIInfo.Targets |= 1 << ((int)SelectTargetType.SingleFriend - 1);
// Spell targets AoE friends.
if (effect.TargetA.GetTarget() == Targets.UnitCasterAreaParty ||
effect.TargetA.GetTarget() == Targets.UnitLastTargetAreaParty ||
effect.TargetA.GetTarget() == Targets.SrcCaster)
AIInfo.Targets |= 1 << ((int)SelectTargetType.AoeFriend - 1);
// Spell targets any friend (or self).
if (effect.TargetA.GetTarget() == Targets.UnitCaster ||
effect.TargetA.GetTarget() == Targets.UnitTargetAlly ||
effect.TargetA.GetTarget() == Targets.UnitTargetParty ||
effect.TargetA.GetTarget() == Targets.UnitCasterAreaParty ||
effect.TargetA.GetTarget() == Targets.UnitLastTargetAreaParty ||
effect.TargetA.GetTarget() == Targets.SrcCaster)
AIInfo.Targets |= 1 << ((int)SelectTargetType.AnyFriend - 1);
// Make sure that this spell includes a damage effect.
if (effect.Effect == SpellEffectName.SchoolDamage ||
effect.Effect == SpellEffectName.Instakill ||
effect.Effect == SpellEffectName.EnvironmentalDamage ||
effect.Effect == SpellEffectName.HealthLeech)
AIInfo.Effects |= 1 << ((int)SelectEffect.Damage - 1);
// Make sure that this spell includes a healing effect (or an apply aura with a periodic heal).
if (effect.Effect == SpellEffectName.Heal ||
effect.Effect == SpellEffectName.HealMaxHealth ||
effect.Effect == SpellEffectName.HealMechanical ||
(effect.Effect == SpellEffectName.ApplyAura && effect.ApplyAuraName == AuraType.PeriodicHeal))
AIInfo.Effects |= 1 << ((int)SelectEffect.Healing - 1);
// Make sure that this spell applies an aura.
if (effect.Effect == SpellEffectName.ApplyAura)
AIInfo.Effects |= 1 << ((int)SelectEffect.Aura - 1);
}
AISpellInfo[(spellInfo.Id, spellInfo.Difficulty)] = AIInfo;
});
} }
public virtual bool CanAIAttack(Unit victim) { return true; } public virtual bool CanAIAttack(Unit victim) { return true; }
@@ -411,7 +486,12 @@ namespace Game.AI
// Called when the dialog status between a player and the creature is requested. // Called when the dialog status between a player and the creature is requested.
public virtual QuestGiverStatus GetDialogStatus(Player player) { return QuestGiverStatus.ScriptedNoStatus; } public virtual QuestGiverStatus GetDialogStatus(Player player) { return QuestGiverStatus.ScriptedNoStatus; }
public static AISpellInfoType[] AISpellInfo; public AISpellInfoType GetAISpellInfo(uint spellId, Difficulty difficulty)
{
return AISpellInfo.LookupByKey((spellId, difficulty));
}
public static Dictionary<(uint id, Difficulty difficulty), AISpellInfoType> AISpellInfo = new Dictionary<(uint id, Difficulty difficulty), AISpellInfoType>();
protected Unit me { get; private set; } protected Unit me { get; private set; }
} }
@@ -493,7 +573,7 @@ namespace Game.AI
public SpellTargetSelector(Unit caster, uint spellId) public SpellTargetSelector(Unit caster, uint spellId)
{ {
_caster = caster; _caster = caster;
_spellInfo = Global.SpellMgr.GetSpellInfo(spellId); _spellInfo = Global.SpellMgr.GetSpellInfo(spellId, caster.GetMap().GetDifficultyID());
Cypher.Assert(_spellInfo != null); Cypher.Assert(_spellInfo != null);
} }
+1 -1
View File
@@ -487,7 +487,7 @@ namespace Game.AI
if (knownRank == 0) if (knownRank == 0)
return null; return null;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(knownRank); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(knownRank, me.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return null; return null;
+4 -3
View File
@@ -136,7 +136,8 @@ namespace Game.AI
//Check if each spell is viable(set it to null if not) //Check if each spell is viable(set it to null if not)
for (uint i = 0; i < SharedConst.MaxCreatureSpells; i++) for (uint i = 0; i < SharedConst.MaxCreatureSpells; i++)
{ {
SpellInfo tempSpell = Global.SpellMgr.GetSpellInfo(me.m_spells[i]); SpellInfo tempSpell = Global.SpellMgr.GetSpellInfo(me.m_spells[i], me.GetMap().GetDifficultyID());
AISpellInfoType aiSpell = GetAISpellInfo(me.m_spells[i], me.GetMap().GetDifficultyID());
//This spell doesn't exist //This spell doesn't exist
if (tempSpell == null) if (tempSpell == null)
@@ -144,11 +145,11 @@ namespace Game.AI
// Targets and Effects checked first as most used restrictions // Targets and Effects checked first as most used restrictions
//Check the spell targets if specified //Check the spell targets if specified
if (targets != 0 && !Convert.ToBoolean(Global.ScriptMgr.spellSummaryStorage[me.m_spells[i]].Targets & (1 << ((int)targets - 1)))) if (targets != 0 && !Convert.ToBoolean(aiSpell.Targets & (1 << ((int)targets - 1))))
continue; continue;
//Check the type of spell if we are looking for a specific spell type //Check the type of spell if we are looking for a specific spell type
if (effect != 0 && !Convert.ToBoolean(Global.ScriptMgr.spellSummaryStorage[me.m_spells[i]].Effects & (1 << ((int)effect - 1)))) if (effect != 0 && !Convert.ToBoolean(aiSpell.Effects & (1 << ((int)effect - 1))))
continue; continue;
//Check for school if specified //Check for school if specified
+1 -1
View File
@@ -656,7 +656,7 @@ namespace Game.AI
public override void SpellHitTarget(Unit target, SpellInfo spell) public override void SpellHitTarget(Unit target, SpellInfo spell)
{ {
GetScript().ProcessEventsFor(SmartEvents.SpellhitTarget, target, 0, 0, false, spell); GetScript().ProcessEventsFor(SmartEvents.SpellHitTarget, target, 0, 0, false, spell);
} }
public override void DamageTaken(Unit attacker, ref uint damage) public override void DamageTaken(Unit attacker, ref uint damage)
+16 -7
View File
@@ -102,7 +102,7 @@ namespace Game.AI
} }
case SmartScriptType.Spell: case SmartScriptType.Spell:
{ {
if (!Global.SpellMgr.HasSpellInfo((uint)temp.entryOrGuid)) if (!Global.SpellMgr.HasSpellInfo((uint)temp.entryOrGuid, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAIFromDB: Scene id ({0}) does not exist, skipped loading.", temp.entryOrGuid); Log.outError(LogFilter.Sql, "SmartAIMgr.LoadSmartAIFromDB: Scene id ({0}) does not exist, skipped loading.", temp.entryOrGuid);
continue; continue;
@@ -505,10 +505,10 @@ namespace Game.AI
return false; return false;
break; break;
case SmartEvents.SpellHit: case SmartEvents.SpellHit:
case SmartEvents.SpellhitTarget: case SmartEvents.SpellHitTarget:
if (e.Event.spellHit.spell != 0) if (e.Event.spellHit.spell != 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Event.spellHit.spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Event.spellHit.spell, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.spellHit.spell); Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Event.spellHit.spell);
@@ -571,6 +571,15 @@ namespace Game.AI
return false; return false;
break; break;
case SmartEvents.VictimCasting: case SmartEvents.VictimCasting:
if (e.Event.targetCasting.spellId > 0 && !Global.SpellMgr.HasSpellInfo(e.Event.targetCasting.spellId, Difficulty.None))
{
Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses non-existent Spell entry {e.Event.spellHit.spell}, skipped.");
return false;
}
if (!IsMinMaxValid(e, e.Event.minMax.repeatMin, e.Event.minMax.repeatMax))
return false;
break;
case SmartEvents.PassengerBoarded: case SmartEvents.PassengerBoarded:
case SmartEvents.PassengerRemoved: case SmartEvents.PassengerRemoved:
if (!IsMinMaxValid(e, e.Event.minMax.repeatMin, e.Event.minMax.repeatMax)) if (!IsMinMaxValid(e, e.Event.minMax.repeatMin, e.Event.minMax.repeatMax))
@@ -912,8 +921,8 @@ namespace Game.AI
if (!IsSpellValid(e, e.Action.cast.spell)) if (!IsSpellValid(e, e.Action.cast.spell))
return false; return false;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell, Difficulty.None);
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect != null && (effect.IsEffect(SpellEffectName.KillCredit) || effect.IsEffect(SpellEffectName.KillCredit2))) if (effect != null && (effect.IsEffect(SpellEffectName.KillCredit) || effect.IsEffect(SpellEffectName.KillCredit2)))
{ {
@@ -1437,7 +1446,7 @@ namespace Game.AI
} }
bool IsSpellValid(SmartScriptHolder e, uint entry) bool IsSpellValid(SmartScriptHolder e, uint entry)
{ {
if (!Global.SpellMgr.HasSpellInfo(entry)) if (!Global.SpellMgr.HasSpellInfo(entry, Difficulty.None))
{ {
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent Spell entry {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false; return false;
@@ -1599,7 +1608,7 @@ namespace Game.AI
{ SmartEvents.PassengerRemoved, SmartScriptTypeMaskId.Creature }, { SmartEvents.PassengerRemoved, SmartScriptTypeMaskId.Creature },
{ SmartEvents.Charmed, SmartScriptTypeMaskId.Creature }, { SmartEvents.Charmed, SmartScriptTypeMaskId.Creature },
{ SmartEvents.CharmedTarget, SmartScriptTypeMaskId.Creature }, { SmartEvents.CharmedTarget, SmartScriptTypeMaskId.Creature },
{ SmartEvents.SpellhitTarget, SmartScriptTypeMaskId.Creature }, { SmartEvents.SpellHitTarget, SmartScriptTypeMaskId.Creature },
{ SmartEvents.Damaged, SmartScriptTypeMaskId.Creature }, { SmartEvents.Damaged, SmartScriptTypeMaskId.Creature },
{ SmartEvents.DamagedTarget, SmartScriptTypeMaskId.Creature }, { SmartEvents.DamagedTarget, SmartScriptTypeMaskId.Creature },
{ SmartEvents.Movementinform, SmartScriptTypeMaskId.Creature }, { SmartEvents.Movementinform, SmartScriptTypeMaskId.Creature },
+2 -2
View File
@@ -501,7 +501,7 @@ namespace Game.AI
// unless target is outside spell range, out of mana, or LOS. // unless target is outside spell range, out of mana, or LOS.
bool _allowMove = false; bool _allowMove = false;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(e.Action.cast.spell, me.GetMap().GetDifficultyID());
var costs = spellInfo.CalcPowerCost(me, spellInfo.GetSchoolMask()); var costs = spellInfo.CalcPowerCost(me, spellInfo.GetSchoolMask());
bool hasPower = true; bool hasPower = true;
foreach (var cost in costs) foreach (var cost in costs)
@@ -3438,7 +3438,7 @@ namespace Game.AI
RecalcTimer(e, e.Event.kill.cooldownMin, e.Event.kill.cooldownMax); RecalcTimer(e, e.Event.kill.cooldownMin, e.Event.kill.cooldownMax);
break; break;
} }
case SmartEvents.SpellhitTarget: case SmartEvents.SpellHitTarget:
case SmartEvents.SpellHit: case SmartEvents.SpellHit:
{ {
if (spell == null) if (spell == null)
+2 -2
View File
@@ -3046,14 +3046,14 @@ namespace Game.Achievements
case CriteriaDataType.SAura: case CriteriaDataType.SAura:
case CriteriaDataType.TAura: case CriteriaDataType.TAura:
{ {
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(Aura.SpellId); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(Aura.SpellId, Difficulty.None);
if (spellEntry == null) if (spellEntry == null)
{ {
Log.outError(LogFilter.Sql, "Table `criteria_data` (Entry: {0} Type: {1}) for data type {2} has wrong spell id in value1 ({3}), ignored.", Log.outError(LogFilter.Sql, "Table `criteria_data` (Entry: {0} Type: {1}) for data type {2} has wrong spell id in value1 ({3}), ignored.",
criteria.Id, criteria.Entry.Type, DataType, Aura.SpellId); criteria.Id, criteria.Entry.Type, DataType, Aura.SpellId);
return false; return false;
} }
SpellEffectInfo effect = spellEntry.GetEffect(Difficulty.None, Aura.EffectIndex); SpellEffectInfo effect = spellEntry.GetEffect(Aura.EffectIndex);
if (effect == null) if (effect == null)
{ {
Log.outError(LogFilter.Sql, "Table `criteria_data` (Entry: {0} Type: {1}) for data type {2} has wrong spell effect index in value2 ({3}), ignored.", Log.outError(LogFilter.Sql, "Table `criteria_data` (Entry: {0} Type: {1}) for data type {2} has wrong spell effect index in value2 ({3}), ignored.",
+1 -1
View File
@@ -228,7 +228,7 @@ namespace Game.Chat
static bool CheckSpellExistsAndIsValid(CommandHandler handler, uint spellId) static bool CheckSpellExistsAndIsValid(CommandHandler handler, uint spellId)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
handler.SendSysMessage(CypherStrings.CommandNospellfound); handler.SendSysMessage(CypherStrings.CommandNospellfound);
+1 -1
View File
@@ -45,7 +45,7 @@ namespace Game.Chat.Commands
{ {
case DisableType.Spell: case DisableType.Spell:
{ {
if (!Global.SpellMgr.HasSpellInfo(entry)) if (!Global.SpellMgr.HasSpellInfo(entry, Difficulty.None))
{ {
handler.SendSysMessage(CypherStrings.CommandNospellfound); handler.SendSysMessage(CypherStrings.CommandNospellfound);
return false; return false;
+8 -10
View File
@@ -41,13 +41,13 @@ namespace Game.Chat.Commands
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spell = handler.ExtractSpellIdFromLink(args); uint spell = handler.ExtractSpellIdFromLink(args);
if (spell == 0 || !Global.SpellMgr.HasSpellInfo(spell)) if (spell == 0 || !Global.SpellMgr.HasSpellInfo(spell, Difficulty.None))
return false; return false;
string all = args.NextString(); string all = args.NextString();
bool allRanks = !string.IsNullOrEmpty(all) && all == "all"; bool allRanks = !string.IsNullOrEmpty(all) && all == "all";
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell, Difficulty.None);
if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, handler.GetSession().GetPlayer())) if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, handler.GetSession().GetPlayer()))
{ {
handler.SendSysMessage(CypherStrings.CommandSpellBroken, spell); handler.SendSysMessage(CypherStrings.CommandSpellBroken, spell);
@@ -78,15 +78,13 @@ namespace Game.Chat.Commands
[Command("gm", RBACPermissions.CommandLearnAllGm)] [Command("gm", RBACPermissions.CommandLearnAllGm)]
static bool HandleLearnAllGMCommand(StringArguments args, CommandHandler handler) static bool HandleLearnAllGMCommand(StringArguments args, CommandHandler handler)
{ {
foreach (var spellInfo in Global.SpellMgr.GetSpellInfoStorage().Values) foreach (var skillSpell in Global.SpellMgr.GetSkillLineAbilityMapBounds((uint)SkillType.Internal))
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(skillSpell.Spell, Difficulty.None);
if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, handler.GetSession().GetPlayer(), false)) if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, handler.GetSession().GetPlayer(), false))
continue; continue;
if (!spellInfo.IsAbilityOfSkillType(SkillType.Internal)) handler.GetSession().GetPlayer().LearnSpell(skillSpell.Spell, false);
continue;
handler.GetSession().GetPlayer().LearnSpell(spellInfo.Id, false);
} }
handler.SendSysMessage(CypherStrings.LearningGmSkills); handler.SendSysMessage(CypherStrings.LearningGmSkills);
@@ -228,7 +226,7 @@ namespace Game.Chat.Commands
if (skillLine.ClassMask != 0 && (skillLine.ClassMask & classmask) == 0) if (skillLine.ClassMask != 0 && (skillLine.ClassMask & classmask) == 0)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(skillLine.Spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(skillLine.Spell, Difficulty.None);
if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, player, false)) if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, player, false))
continue; continue;
@@ -257,7 +255,7 @@ namespace Game.Chat.Commands
foreach (var entry in CliDB.SkillLineAbilityStorage.Values) foreach (var entry in CliDB.SkillLineAbilityStorage.Values)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(entry.Spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(entry.Spell, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
continue; continue;
@@ -295,7 +293,7 @@ namespace Game.Chat.Commands
if (playerClass != talentInfo.ClassID) if (playerClass != talentInfo.ClassID)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, handler.GetSession().GetPlayer(), false)) if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo, handler.GetSession().GetPlayer(), false))
continue; continue;
+66 -63
View File
@@ -1065,84 +1065,87 @@ namespace Game.Chat
bool found = false; bool found = false;
uint count = 0; uint count = 0;
// Search in Spell.dbc // Search in SpellName.dbc
foreach (var spellInfo in Global.SpellMgr.GetSpellInfoStorage().Values) foreach (SpellNameRecord spellName in CliDB.SpellNameStorage.Values)
{ {
LocaleConstant locale = handler.GetSessionDbcLocale(); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellName.Id, Difficulty.None);
string name = spellInfo.SpellName[locale]; if (spellInfo != null)
if (name.IsEmpty())
continue;
if (!name.Like(namePart))
{ {
locale = 0; LocaleConstant locale = handler.GetSessionDbcLocale();
for (; locale < LocaleConstant.Total; ++locale) string name = spellInfo.SpellName[locale];
if (name.IsEmpty())
continue;
if (!name.Like(namePart))
{ {
if (locale == handler.GetSessionDbcLocale()) locale = 0;
continue; for (; locale < LocaleConstant.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
name = spellInfo.SpellName[locale]; name = spellInfo.SpellName[locale];
if (name.IsEmpty()) if (name.IsEmpty())
continue; continue;
if (name.Like(namePart)) if (name.Like(namePart))
break; break;
} }
}
if (locale < LocaleConstant.Total)
{
if (maxlookup != 0 && count++ == maxlookup)
{
handler.SendSysMessage(CypherStrings.CommandLookupMaxResults, maxlookup);
return true;
} }
bool known = target && target.HasSpell(spellInfo.Id); if (locale < LocaleConstant.Total)
SpellEffectInfo effect = spellInfo.GetEffect(0); {
bool learn = (effect.Effect == SpellEffectName.LearnSpell); if (maxlookup != 0 && count++ == maxlookup)
{
handler.SendSysMessage(CypherStrings.CommandLookupMaxResults, maxlookup);
return true;
}
SpellInfo learnSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell); bool known = target && target.HasSpell(spellInfo.Id);
SpellEffectInfo effect = spellInfo.GetEffect(0);
bool learn = (effect.Effect == SpellEffectName.LearnSpell);
bool talent = spellInfo.HasAttribute(SpellCustomAttributes.IsTalent); SpellInfo learnSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, spellInfo.Difficulty);
bool passive = spellInfo.IsPassive();
bool active = target && target.HasAura(spellInfo.Id);
// unit32 used to prevent interpreting public byte as char at output bool talent = spellInfo.HasAttribute(SpellCustomAttributes.IsTalent);
// find rank of learned spell for learning spell, or talent rank bool passive = spellInfo.IsPassive();
uint rank = learn && learnSpellInfo != null ? learnSpellInfo.GetRank() : spellInfo.GetRank(); bool active = target && target.HasAura(spellInfo.Id);
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format // unit32 used to prevent interpreting public byte as char at output
StringBuilder ss = new StringBuilder(); // find rank of learned spell for learning spell, or talent rank
if (handler.GetSession() != null) uint rank = learn && learnSpellInfo != null ? learnSpellInfo.GetRank() : spellInfo.GetRank();
ss.Append(spellInfo.Id + " - |cffffffff|Hspell:" + spellInfo.Id + "|h[" + name);
else
ss.Append(spellInfo.Id + " - " + name);
// include rank in link name // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
if (rank != 0) StringBuilder ss = new StringBuilder();
ss.Append(handler.GetCypherString(CypherStrings.SpellRank) + rank); if (handler.GetSession() != null)
ss.Append(spellInfo.Id + " - |cffffffff|Hspell:" + spellInfo.Id + "|h[" + name);
else
ss.Append(spellInfo.Id + " - " + name);
if (handler.GetSession() != null) // include rank in link name
ss.Append("]|h|r"); if (rank != 0)
ss.Append(handler.GetCypherString(CypherStrings.SpellRank) + rank);
if (talent) if (handler.GetSession() != null)
ss.Append(handler.GetCypherString(CypherStrings.Talent)); ss.Append("]|h|r");
if (passive)
ss.Append(handler.GetCypherString(CypherStrings.Passive));
if (learn)
ss.Append(handler.GetCypherString(CypherStrings.Learn));
if (known)
ss.Append(handler.GetCypherString(CypherStrings.Known));
if (active)
ss.Append(handler.GetCypherString(CypherStrings.Active));
handler.SendSysMessage(ss.ToString()); if (talent)
ss.Append(handler.GetCypherString(CypherStrings.Talent));
if (passive)
ss.Append(handler.GetCypherString(CypherStrings.Passive));
if (learn)
ss.Append(handler.GetCypherString(CypherStrings.Learn));
if (known)
ss.Append(handler.GetCypherString(CypherStrings.Known));
if (active)
ss.Append(handler.GetCypherString(CypherStrings.Active));
if (!found) handler.SendSysMessage(ss.ToString());
found = true;
if (!found)
found = true;
}
} }
} }
if (!found) if (!found)
handler.SendSysMessage(CypherStrings.CommandNospellfound); handler.SendSysMessage(CypherStrings.CommandNospellfound);
@@ -1161,7 +1164,7 @@ namespace Game.Chat
uint id = args.NextUInt32(); uint id = args.NextUInt32();
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(id, Difficulty.None);
if (spellInfo != null) if (spellInfo != null)
{ {
LocaleConstant locale = handler.GetSessionDbcLocale(); LocaleConstant locale = handler.GetSessionDbcLocale();
@@ -1176,7 +1179,7 @@ namespace Game.Chat
SpellEffectInfo effect = spellInfo.GetEffect(0); SpellEffectInfo effect = spellInfo.GetEffect(0);
bool learn = (effect.Effect == SpellEffectName.LearnSpell); bool learn = (effect.Effect == SpellEffectName.LearnSpell);
SpellInfo learnSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell); SpellInfo learnSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, Difficulty.None);
bool talent = spellInfo.HasAttribute(SpellCustomAttributes.IsTalent); bool talent = spellInfo.HasAttribute(SpellCustomAttributes.IsTalent);
bool passive = spellInfo.IsPassive(); bool passive = spellInfo.IsPassive();
+3 -3
View File
@@ -1009,7 +1009,7 @@ namespace Game.Chat
if (player.IsInFlight() || player.IsInCombat()) if (player.IsInFlight() || player.IsInCombat())
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SPELL_UNSTUCK_ID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SPELL_UNSTUCK_ID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
return false; return false;
@@ -2065,11 +2065,11 @@ namespace Game.Chat
if (spellid == 0) if (spellid == 0)
return false; return false;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellid); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellid, attacker.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return false; return false;
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(attacker, target, spellid, spellInfo.GetSpellXSpellVisualId(attacker), spellInfo.SchoolMask); SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(attacker, target, spellInfo, spellInfo.GetSpellXSpellVisualId(attacker), spellInfo.SchoolMask);
damageInfo.damage = damage_; damageInfo.damage = damage_;
attacker.DealDamageMods(damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb); attacker.DealDamageMods(damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
target.DealSpellDamage(damageInfo, true); target.DealSpellDamage(damageInfo, true);
+2 -2
View File
@@ -107,7 +107,7 @@ namespace Game.Chat
} }
uint spellId = handler.ExtractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0 || !Global.SpellMgr.HasSpellInfo(spellId)) if (spellId == 0 || !Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
return false; return false;
// Check if pet already has it // Check if pet already has it
@@ -118,7 +118,7 @@ namespace Game.Chat
} }
// Check if spell is valid // Check if spell is valid
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo)) if (spellInfo == null || !Global.SpellMgr.IsSpellValid(spellInfo))
{ {
handler.SendSysMessage(CypherStrings.CommandSpellBroken, spellId); handler.SendSysMessage(CypherStrings.CommandSpellBroken, spellId);
+4 -4
View File
@@ -57,7 +57,7 @@ namespace Game.Chat
if (spellIid == 0) if (spellIid == 0)
return false; return false;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellIid); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellIid, target.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
handler.SendSysMessage(CypherStrings.UnknownSpell, owner == handler.GetSession().GetPlayer() ? handler.GetCypherString(CypherStrings.You) : nameLink); handler.SendSysMessage(CypherStrings.UnknownSpell, owner == handler.GetSession().GetPlayer() ? handler.GetCypherString(CypherStrings.You) : nameLink);
@@ -72,7 +72,7 @@ namespace Game.Chat
} }
[CommandNonGroup("aura", RBACPermissions.CommandAura)] [CommandNonGroup("aura", RBACPermissions.CommandAura)]
static bool Auracommand(StringArguments args, CommandHandler handler) static bool HandleAuraCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.GetSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
@@ -85,11 +85,11 @@ namespace Game.Chat
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.ExtractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, target.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, target.GetMapId(), spellId, target.GetMap().GenerateLowGuid(HighGuid.Cast)); ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, target.GetMapId(), spellId, target.GetMap().GenerateLowGuid(HighGuid.Cast));
Aura.TryRefreshStackOrCreate(spellInfo, castId, SpellConst.MaxEffectMask, target, target); Aura.TryRefreshStackOrCreate(spellInfo, castId, SpellConst.MaxEffectMask, target, target, target.GetMap().GetDifficultyID());
} }
return true; return true;
+1 -1
View File
@@ -275,7 +275,7 @@ namespace Game.Combat
threat *= threatEntry.pctMod; threat *= threatEntry.pctMod;
// Energize is not affected by Mods // Energize is not affected by Mods
foreach (SpellEffectInfo effect in threatSpell.GetEffectsForDifficulty(hatedUnit.GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in threatSpell.GetEffects())
if (effect != null && (effect.Effect == SpellEffectName.Energize || effect.ApplyAuraName == AuraType.PeriodicEnergize)) if (effect != null && (effect.Effect == SpellEffectName.Energize || effect.ApplyAuraName == AuraType.PeriodicEnergize))
return threat; return threat;
+88 -86
View File
@@ -576,101 +576,103 @@ namespace Game
bool AddToSpellImplicitTargetConditions(Condition cond) bool AddToSpellImplicitTargetConditions(Condition cond)
{ {
uint conditionEffMask = cond.SourceGroup; Global.SpellMgr.ForEachSpellInfoDifficulty((uint)cond.SourceEntry, spellInfo =>
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry);
Cypher.Assert(spellInfo != null);
List<uint> sharedMasks = new List<uint>();
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
{ {
SpellEffectInfo effect = spellInfo.GetEffect(i); uint conditionEffMask = cond.SourceGroup;
if (effect == null) List<uint> sharedMasks = new List<uint>();
continue; for (byte i = 0; i < SpellConst.MaxEffects; ++i)
// check if effect is already a part of some shared mask
bool found = false;
foreach (var value in sharedMasks)
{ {
if (((1 << i) & value) != 0) SpellEffectInfo effect = spellInfo.GetEffect(i);
{
found = true;
break;
}
}
if (found)
continue;
// build new shared mask with found effect
uint sharedMask = (uint)(1 << i);
List<Condition> cmp = effect.ImplicitTargetConditions;
for (byte effIndex = (byte)(i + 1); effIndex < SpellConst.MaxEffects; ++effIndex)
{
SpellEffectInfo inner = spellInfo.GetEffect(effIndex);
if (inner == null)
continue;
if (inner.ImplicitTargetConditions == cmp)
sharedMask |= (uint)(1 << effIndex);
}
sharedMasks.Add(sharedMask);
}
foreach (var value in sharedMasks)
{
// some effect indexes should have same data
uint commonMask = (value & conditionEffMask);
if (commonMask != 0)
{
byte firstEffIndex = 0;
for (; firstEffIndex < SpellConst.MaxEffects; ++firstEffIndex)
if (((1 << firstEffIndex) & value) != 0)
break;
if (firstEffIndex >= SpellConst.MaxEffects)
return false;
SpellEffectInfo effect = spellInfo.GetEffect(firstEffIndex);
if (effect == null) if (effect == null)
continue; continue;
// get shared data // check if effect is already a part of some shared mask
List<Condition> sharedList = effect.ImplicitTargetConditions; bool found = false;
foreach (var value in sharedMasks)
// there's already data entry for that sharedMask
if (sharedList != null)
{ {
// we have overlapping masks in db if (((1 << i) & value) != 0)
if (conditionEffMask != value)
{ {
Log.outError(LogFilter.Sql, "{0} in `condition` table, has incorrect SourceGroup {1} (spell effectMask) set - " + found = true;
"effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond.ToString(), cond.SourceGroup); break;
return false;
} }
} }
// no data for shared mask, we can create new submask if (found)
else continue;
{
// add new list, create new shared mask
sharedList = new List<Condition>();
bool assigned = false;
for (byte i = firstEffIndex; i < SpellConst.MaxEffects; ++i)
{
SpellEffectInfo eff = spellInfo.GetEffect(i);
if (eff == null)
continue;
if (((1 << i) & commonMask) != 0) // build new shared mask with found effect
uint sharedMask = (uint)(1 << i);
List<Condition> cmp = effect.ImplicitTargetConditions;
for (byte effIndex = (byte)(i + 1); effIndex < SpellConst.MaxEffects; ++effIndex)
{
SpellEffectInfo inner = spellInfo.GetEffect(effIndex);
if (inner == null)
continue;
if (inner.ImplicitTargetConditions == cmp)
sharedMask |= (uint)(1 << effIndex);
}
sharedMasks.Add(sharedMask);
}
foreach (var value in sharedMasks)
{
// some effect indexes should have same data
uint commonMask = (value & conditionEffMask);
if (commonMask != 0)
{
byte firstEffIndex = 0;
for (; firstEffIndex < SpellConst.MaxEffects; ++firstEffIndex)
if (((1 << firstEffIndex) & value) != 0)
break;
if (firstEffIndex >= SpellConst.MaxEffects)
return;
SpellEffectInfo effect = spellInfo.GetEffect(firstEffIndex);
if (effect == null)
continue;
// get shared data
List<Condition> sharedList = effect.ImplicitTargetConditions;
// there's already data entry for that sharedMask
if (sharedList != null)
{
// we have overlapping masks in db
if (conditionEffMask != value)
{ {
eff.ImplicitTargetConditions = sharedList; Log.outError(LogFilter.Sql, "{0} in `condition` table, has incorrect SourceGroup {1} (spell effectMask) set - " +
assigned = true; "effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond.ToString(), cond.SourceGroup);
return;
} }
} }
// no data for shared mask, we can create new submask
else
{
// add new list, create new shared mask
sharedList = new List<Condition>();
bool assigned = false;
for (byte i = firstEffIndex; i < SpellConst.MaxEffects; ++i)
{
SpellEffectInfo eff = spellInfo.GetEffect(i);
if (eff == null)
continue;
if (!assigned) if (((1 << i) & commonMask) != 0)
break; {
eff.ImplicitTargetConditions = sharedList;
assigned = true;
}
}
if (!assigned)
break;
}
sharedList.Add(cond);
break;
} }
sharedList.Add(cond);
break;
} }
} });
return true; return true;
} }
@@ -929,7 +931,7 @@ namespace Game
} }
case ConditionSourceType.SpellImplicitTarget: case ConditionSourceType.SpellImplicitTarget:
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString());
@@ -949,7 +951,7 @@ namespace Game
if (((1 << i) & cond.SourceGroup) == 0) if (((1 << i) & cond.SourceGroup) == 0)
continue; continue;
SpellEffectInfo effect = spellInfo.GetEffect(Difficulty.None, i); SpellEffectInfo effect = spellInfo.GetEffect(i);
if (effect == null) if (effect == null)
continue; continue;
@@ -998,7 +1000,7 @@ namespace Game
case ConditionSourceType.Spell: case ConditionSourceType.Spell:
case ConditionSourceType.SpellProc: case ConditionSourceType.SpellProc:
{ {
SpellInfo spellProto = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry); SpellInfo spellProto = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry, Difficulty.None);
if (spellProto == null) if (spellProto == null)
{ {
Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString());
@@ -1020,7 +1022,7 @@ namespace Game
return false; return false;
} }
if (!Global.SpellMgr.HasSpellInfo((uint)cond.SourceEntry)) if (!Global.SpellMgr.HasSpellInfo((uint)cond.SourceEntry, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString());
return false; return false;
@@ -1033,7 +1035,7 @@ namespace Game
return false; return false;
} }
if (!Global.SpellMgr.HasSpellInfo((uint)cond.SourceEntry)) if (!Global.SpellMgr.HasSpellInfo((uint)cond.SourceEntry, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceEntry in `condition` table does not exist in `spell.dbc`, ignoring.", cond.ToString());
return false; return false;
@@ -1093,7 +1095,7 @@ namespace Game
{ {
case ConditionTypes.Aura: case ConditionTypes.Aura:
{ {
if (!Global.SpellMgr.HasSpellInfo(cond.ConditionValue1)) if (!Global.SpellMgr.HasSpellInfo(cond.ConditionValue1, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "{0} has non existing spell (Id: {1}), skipped", cond.ToString(), cond.ConditionValue1); Log.outError(LogFilter.Sql, "{0} has non existing spell (Id: {1}), skipped", cond.ToString(), cond.ConditionValue1);
return false; return false;
@@ -1268,7 +1270,7 @@ namespace Game
} }
case ConditionTypes.Spell: case ConditionTypes.Spell:
{ {
if (!Global.SpellMgr.HasSpellInfo(cond.ConditionValue1)) if (!Global.SpellMgr.HasSpellInfo(cond.ConditionValue1, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "{0} has non existing spell (Id: {1}), skipped", cond.ToString(true), cond.ConditionValue1); Log.outError(LogFilter.Sql, "{0} has non existing spell (Id: {1}), skipped", cond.ToString(true), cond.ConditionValue1);
return false; return false;
+1 -1
View File
@@ -73,7 +73,7 @@ namespace Game
switch (type) switch (type)
{ {
case DisableType.Spell: case DisableType.Spell:
if (!(Global.SpellMgr.HasSpellInfo(entry) || flags.HasAnyFlag<byte>(DisableFlags.SpellDeprecatedSpell))) if (!(Global.SpellMgr.HasSpellInfo(entry, Difficulty.None) || flags.HasAnyFlag<byte>(DisableFlags.SpellDeprecatedSpell)))
{ {
Log.outError(LogFilter.Sql, "Spell entry {0} from `disables` doesn't exist in dbc, skipped.", entry); Log.outError(LogFilter.Sql, "Spell entry {0} from `disables` doesn't exist in dbc, skipped.", entry);
continue; continue;
-73
View File
@@ -473,30 +473,6 @@ namespace Game.DataStorage
foreach (SpellClassOptionsRecord classOption in CliDB.SpellClassOptionsStorage.Values) foreach (SpellClassOptionsRecord classOption in CliDB.SpellClassOptionsStorage.Values)
_spellFamilyNames.Add(classOption.SpellClassSet); _spellFamilyNames.Add(classOption.SpellClassSet);
foreach (SpellPowerRecord power in CliDB.SpellPowerStorage.Values)
{
SpellPowerDifficultyRecord powerDifficulty = CliDB.SpellPowerDifficultyStorage.LookupByKey(power.Id);
if (powerDifficulty != null)
{
if (!_spellPowerDifficulties.ContainsKey(power.SpellID))
_spellPowerDifficulties[power.SpellID] = new Dictionary<uint, List<SpellPowerRecord>>();
if (!_spellPowerDifficulties[power.SpellID].ContainsKey(powerDifficulty.DifficultyID))
_spellPowerDifficulties[power.SpellID][powerDifficulty.DifficultyID] = new List<SpellPowerRecord>();
_spellPowerDifficulties[power.SpellID][powerDifficulty.DifficultyID].Insert(powerDifficulty.OrderIndex, power);
}
else
{
if (!_spellPowers.ContainsKey(power.SpellID))
_spellPowers[power.SpellID] = new List<SpellPowerRecord>();
_spellPowers[power.SpellID].Insert(power.OrderIndex, power);
}
}
CliDB.SpellPowerStorage.Clear();
foreach (SpellProcsPerMinuteModRecord ppmMod in CliDB.SpellProcsPerMinuteModStorage.Values) foreach (SpellProcsPerMinuteModRecord ppmMod in CliDB.SpellProcsPerMinuteModStorage.Values)
_spellProcsPerMinuteMods.Add(ppmMod.SpellProcsPerMinuteID, ppmMod); _spellProcsPerMinuteMods.Add(ppmMod.SpellProcsPerMinuteID, ppmMod);
@@ -1745,53 +1721,6 @@ namespace Game.DataStorage
return _spellFamilyNames.Contains((byte)family); return _spellFamilyNames.Contains((byte)family);
} }
public List<SpellPowerRecord> GetSpellPowers(uint spellId, Difficulty difficulty = Difficulty.None)
{
return GetSpellPowers(spellId, difficulty, out _);
}
public List<SpellPowerRecord> GetSpellPowers(uint spellId, Difficulty difficulty, out bool hasDifficultyPowers)
{
SpellPowerRecord[] powers = new SpellPowerRecord[0];
hasDifficultyPowers = false;
var difficultyDic = _spellPowerDifficulties.LookupByKey(spellId);
if (difficultyDic != null)
{
hasDifficultyPowers = true;
DifficultyRecord difficultyEntry = CliDB.DifficultyStorage.LookupByKey(difficulty);
while (difficultyEntry != null)
{
var powerDifficultyList = difficultyDic.LookupByKey(difficultyEntry.Id);
if (powerDifficultyList != null)
{
if (powerDifficultyList.Count > powers.Length)
Array.Resize(ref powers, powerDifficultyList.Count);
foreach (SpellPowerRecord difficultyPower in powerDifficultyList)
if (powers[difficultyPower.OrderIndex] == null)
powers[difficultyPower.OrderIndex] = difficultyPower;
}
difficultyEntry = CliDB.DifficultyStorage.LookupByKey(difficultyEntry.FallbackDifficultyID);
}
}
var record = _spellPowers.LookupByKey(spellId);
if (record != null)
{
if (record.Count > powers.Length)
Array.Resize(ref powers, record.Count);
foreach (SpellPowerRecord power in record)
if (powers[power.OrderIndex] == null)
powers[power.OrderIndex] = power;
}
return powers.ToList();
}
public List<SpellProcsPerMinuteModRecord> GetSpellProcsPerMinuteMods(uint spellprocsPerMinuteId) public List<SpellProcsPerMinuteModRecord> GetSpellProcsPerMinuteMods(uint spellprocsPerMinuteId)
{ {
return _spellProcsPerMinuteMods.LookupByKey(spellprocsPerMinuteId); return _spellProcsPerMinuteMods.LookupByKey(spellprocsPerMinuteId);
@@ -2180,8 +2109,6 @@ namespace Game.DataStorage
MultiMap<uint, SpecializationSpellsRecord> _specializationSpellsBySpec = new MultiMap<uint, SpecializationSpellsRecord>(); MultiMap<uint, SpecializationSpellsRecord> _specializationSpellsBySpec = new MultiMap<uint, SpecializationSpellsRecord>();
List<Tuple<int, uint>> _specsBySpecSet = new List<Tuple<int, uint>>(); List<Tuple<int, uint>> _specsBySpecSet = new List<Tuple<int, uint>>();
List<byte> _spellFamilyNames = new List<byte>(); List<byte> _spellFamilyNames = new List<byte>();
Dictionary<uint, List<SpellPowerRecord>> _spellPowers = new Dictionary<uint, List<SpellPowerRecord>>();
Dictionary<uint, Dictionary<uint, List<SpellPowerRecord>>> _spellPowerDifficulties = new Dictionary<uint, Dictionary<uint, List<SpellPowerRecord>>>();
MultiMap<uint, SpellProcsPerMinuteModRecord> _spellProcsPerMinuteMods = new MultiMap<uint, SpellProcsPerMinuteModRecord>(); MultiMap<uint, SpellProcsPerMinuteModRecord> _spellProcsPerMinuteMods = new MultiMap<uint, SpellProcsPerMinuteModRecord>();
List<TalentRecord>[][][] _talentsByPosition = new List<TalentRecord>[(int)Class.Max][][]; List<TalentRecord>[][][] _talentsByPosition = new List<TalentRecord>[(int)Class.Max][][];
List<uint> _toys = new List<uint>(); List<uint> _toys = new List<uint>();
@@ -539,9 +539,9 @@ namespace Game.Entities
switch (action.TargetType) switch (action.TargetType)
{ {
case AreaTriggerActionUserTypes.Friend: case AreaTriggerActionUserTypes.Friend:
return caster._IsValidAssistTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param)); return caster._IsValidAssistTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param, caster.GetMap().GetDifficultyID()));
case AreaTriggerActionUserTypes.Enemy: case AreaTriggerActionUserTypes.Enemy:
return caster._IsValidAttackTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param)); return caster._IsValidAttackTarget(unit, Global.SpellMgr.GetSpellInfo(action.Param, caster.GetMap().GetDifficultyID()));
case AreaTriggerActionUserTypes.Raid: case AreaTriggerActionUserTypes.Raid:
return caster.IsInRaidWith(unit); return caster.IsInRaidWith(unit);
case AreaTriggerActionUserTypes.Party: case AreaTriggerActionUserTypes.Party:
+9 -9
View File
@@ -1760,7 +1760,7 @@ namespace Game.Entities
return false; return false;
bool immunedToAllEffects = true; bool immunedToAllEffects = true;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect == null || !effect.IsEffect()) if (effect == null || !effect.IsEffect())
continue; continue;
@@ -1780,7 +1780,7 @@ namespace Game.Entities
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster) public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster)
{ {
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index); SpellEffectInfo effect = spellInfo.GetEffect(index);
if (effect == null) if (effect == null)
return true; return true;
@@ -1816,7 +1816,7 @@ namespace Game.Entities
{ {
if (m_spells[i] == 0) if (m_spells[i] == 0)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i]); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i], GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]); Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]);
@@ -1824,7 +1824,7 @@ namespace Game.Entities
} }
bool bcontinue = true; bool bcontinue = true;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect != null && ((effect.Effect == SpellEffectName.SchoolDamage) || (effect.Effect == SpellEffectName.Instakill) if (effect != null && ((effect.Effect == SpellEffectName.SchoolDamage) || (effect.Effect == SpellEffectName.Instakill)
|| (effect.Effect == SpellEffectName.EnvironmentalDamage) || (effect.Effect == SpellEffectName.HealthLeech))) || (effect.Effect == SpellEffectName.EnvironmentalDamage) || (effect.Effect == SpellEffectName.HealthLeech)))
@@ -1865,7 +1865,7 @@ namespace Game.Entities
{ {
if (m_spells[i] == 0) if (m_spells[i] == 0)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i]); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i], GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]); Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]);
@@ -1873,7 +1873,7 @@ namespace Game.Entities
} }
bool bcontinue = true; bool bcontinue = true;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect != null && effect.Effect == SpellEffectName.Heal) if (effect != null && effect.Effect == SpellEffectName.Heal)
{ {
@@ -2209,7 +2209,7 @@ namespace Game.Entities
{ {
foreach (var id in cainfo.auras) foreach (var id in cainfo.auras)
{ {
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id); SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id, GetMap().GetDifficultyID());
if (AdditionalSpellInfo == null) if (AdditionalSpellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Creature ({0}) has wrong spell {1} defined in `auras` field.", GetGUID().ToString(), id); Log.outError(LogFilter.Sql, "Creature ({0}) has wrong spell {1} defined in `auras` field.", GetGUID().ToString(), id);
@@ -2593,7 +2593,7 @@ namespace Game.Entities
if (spellID == 0) if (spellID == 0)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID, GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
if (spellInfo.GetRecoveryTime() == 0 // No cooldown if (spellInfo.GetRecoveryTime() == 0 // No cooldown
@@ -2771,7 +2771,7 @@ namespace Game.Entities
SpellInfo spellInfo = focusSpell.GetSpellInfo(); SpellInfo spellInfo = focusSpell.GetSpellInfo();
// don't use spell focus for vehicle spells // don't use spell focus for vehicle spells
if (spellInfo.HasAura(Difficulty.None, AuraType.ControlVehicle)) if (spellInfo.HasAura(AuraType.ControlVehicle))
return; return;
if ((!target || target == this) && focusSpell.GetCastTime() == 0) // instant cast, untargeted (or self-targeted) spell doesn't need any facing updates if ((!target || target == this) && focusSpell.GetCastTime() == 0) // instant cast, untargeted (or self-targeted) spell doesn't need any facing updates
+5 -11
View File
@@ -442,18 +442,12 @@ namespace Game.Misc
packet.SuggestedPartyMembers = quest.SuggestedPlayers; packet.SuggestedPartyMembers = quest.SuggestedPlayers;
// RewardSpell can teach multiple spells in trigger spell effects. But not all effects must be SPELL_EFFECT_LEARN_SPELL. See example spell 33950 // RewardSpell can teach multiple spells in trigger spell effects. But not all effects must be SPELL_EFFECT_LEARN_SPELL. See example spell 33950
if (quest.RewardSpell != 0) SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell, Difficulty.None);
if (spellInfo != null)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell); foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (spellInfo.HasEffect(SpellEffectName.LearnSpell)) if (effect.IsEffect(SpellEffectName.LearnSpell))
{ packet.LearnSpells.Add(effect.TriggerSpell);
var effects = spellInfo.GetEffectsForDifficulty(Difficulty.None);
foreach (var spellEffectInfo in effects)
{
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell))
packet.LearnSpells.Add(spellEffectInfo.TriggerSpell);
}
}
} }
quest.BuildQuestRewards(packet.Rewards, _session.GetPlayer()); quest.BuildQuestRewards(packet.Rewards, _session.GetPlayer());
+3 -3
View File
@@ -15,7 +15,7 @@ namespace Game.Entities
public Array<uint> ReqAbility = new Array<uint>(3); public Array<uint> ReqAbility = new Array<uint>(3);
public byte ReqLevel; public byte ReqLevel;
public bool IsCastable() { return Global.SpellMgr.GetSpellInfo(SpellId).HasEffect(SpellEffectName.LearnSpell); } public bool IsCastable() { return Global.SpellMgr.GetSpellInfo(SpellId, Difficulty.None).HasEffect(SpellEffectName.LearnSpell); }
} }
public class Trainer public class Trainer
@@ -98,7 +98,7 @@ namespace Game.Entities
if (state != TrainerSpellState.Available) if (state != TrainerSpellState.Available)
return false; return false;
SpellInfo trainerSpellInfo = Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId); SpellInfo trainerSpellInfo = Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None);
if (trainerSpellInfo.IsPrimaryProfessionFirstRank() && player.GetFreePrimaryProfessionPoints() == 0) if (trainerSpellInfo.IsPrimaryProfessionFirstRank() && player.GetFreePrimaryProfessionPoints() == 0)
return false; return false;
@@ -129,7 +129,7 @@ namespace Game.Entities
// check ranks // check ranks
bool hasLearnSpellEffect = false; bool hasLearnSpellEffect = false;
bool knowsAllLearnedSpells = true; bool knowsAllLearnedSpells = true;
foreach (SpellEffectInfo spellEffect in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId).GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo spellEffect in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None).GetEffects())
{ {
if (spellEffect == null || !spellEffect.IsEffect(SpellEffectName.LearnSpell)) if (spellEffect == null || !spellEffect.IsEffect(SpellEffectName.LearnSpell))
continue; continue;
+1 -1
View File
@@ -239,7 +239,7 @@ namespace Game.Entities
public SpellInfo GetSpellInfo() public SpellInfo GetSpellInfo()
{ {
return Global.SpellMgr.GetSpellInfo(GetSpellId()); return Global.SpellMgr.GetSpellInfo(GetSpellId(), GetMap().GetDifficultyID());
} }
public override void BuildValuesCreate(WorldPacket data, Player target) public override void BuildValuesCreate(WorldPacket data, Player target)
@@ -1215,7 +1215,7 @@ namespace Game.Entities
if (trapInfo == null || trapInfo.type != GameObjectTypes.Trap) if (trapInfo == null || trapInfo.type != GameObjectTypes.Trap)
return; return;
SpellInfo trapSpell = Global.SpellMgr.GetSpellInfo(trapInfo.Trap.spell); SpellInfo trapSpell = Global.SpellMgr.GetSpellInfo(trapInfo.Trap.spell, GetMap().GetDifficultyID());
if (trapSpell == null) // checked at load already if (trapSpell == null) // checked at load already
return; return;
@@ -1945,7 +1945,7 @@ namespace Game.Entities
if (spellId == 0) if (spellId == 0)
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
if (!user.IsTypeId(TypeId.Player) || !Global.OutdoorPvPMgr.HandleCustomSpell(user.ToPlayer(), spellId, this)) if (!user.IsTypeId(TypeId.Player) || !Global.OutdoorPvPMgr.HandleCustomSpell(user.ToPlayer(), spellId, this))
@@ -1972,12 +1972,12 @@ namespace Game.Entities
public void CastSpell(Unit target, uint spellId, TriggerCastFlags triggered) public void CastSpell(Unit target, uint spellId, TriggerCastFlags triggered)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return; return;
bool self = false; bool self = false;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect != null && effect.TargetA.GetTarget() == Targets.UnitCaster) if (effect != null && effect.TargetA.GetTarget() == Targets.UnitCaster)
{ {
+2 -2
View File
@@ -2340,7 +2340,7 @@ namespace Game.Entities
if (eff.SetBonuses.Contains(itemSetSpell)) if (eff.SetBonuses.Contains(itemSetSpell))
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Player, "WORLD: unknown spell id {0} in items set {1} effects", itemSetSpell.SpellID, setid); Log.outError(LogFilter.Player, "WORLD: unknown spell id {0} in items set {1} effects", itemSetSpell.SpellID, setid);
@@ -2392,7 +2392,7 @@ namespace Game.Entities
if (!eff.SetBonuses.Contains(itemSetSpell)) if (!eff.SetBonuses.Contains(itemSetSpell))
continue; continue;
player.ApplyEquipSpell(Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID), null, false); player.ApplyEquipSpell(Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID, Difficulty.None), null, false);
eff.SetBonuses.Remove(itemSetSpell); eff.SetBonuses.Remove(itemSetSpell);
} }
@@ -2093,10 +2093,10 @@ namespace Game.Entities
CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate(); CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate();
// this also applies for transform auras // this also applies for transform auras
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm()); SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm(), unit.GetMap().GetDifficultyID());
if (transform != null) if (transform != null)
{ {
foreach (SpellEffectInfo effect in transform.GetEffectsForDifficulty(unit.GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in transform.GetEffects())
{ {
if (effect != null && effect.IsAura(AuraType.Transform)) if (effect != null && effect.IsAura(AuraType.Transform))
{ {
+21 -13
View File
@@ -146,7 +146,7 @@ namespace Game.Entities
return false; return false;
uint summonSpellId = result.Read<uint>(14); uint summonSpellId = result.Read<uint>(14);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(summonSpellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(summonSpellId, owner.GetMap().GetDifficultyID());
bool isTemporarySummon = spellInfo != null && spellInfo.GetDuration() > 0; bool isTemporarySummon = spellInfo != null && spellInfo.GetDuration() > 0;
if (current && isTemporarySummon) if (current && isTemporarySummon)
@@ -887,15 +887,22 @@ namespace Game.Entities
AuraKey key = new AuraKey(casterGuid, itemGuid, result.Read<uint>(1), result.Read<uint>(2)); AuraKey key = new AuraKey(casterGuid, itemGuid, result.Read<uint>(1), result.Read<uint>(2));
uint recalculateMask = result.Read<uint>(3); uint recalculateMask = result.Read<uint>(3);
byte stackCount = result.Read<byte>(4); Difficulty difficulty = (Difficulty)result.Read<byte>(4);
int maxDuration = result.Read<int>(5); byte stackCount = result.Read<byte>(5);
int remainTime = result.Read<int>(6); int maxDuration = result.Read<int>(6);
byte remainCharges = result.Read<byte>(7); int remainTime = result.Read<int>(7);
byte remainCharges = result.Read<byte>(8);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId, difficulty);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Pet, "Unknown aura (spellid {0}), ignore.", key.SpellId); Log.outError(LogFilter.Pet, "Pet._LoadAuras: Unknown aura (spellid {0}), ignore.", key.SpellId);
continue;
}
if (difficulty != Difficulty.None && !CliDB.DifficultyStorage.ContainsKey(difficulty))
{
Log.outError(LogFilter.Pet, $"Pet._LoadAuras: Unknown difficulty {difficulty} (spellid {key.SpellId}), ignore.");
continue; continue;
} }
@@ -919,7 +926,7 @@ namespace Game.Entities
var info = effectInfo[key]; var info = effectInfo[key];
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast)); ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast));
Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, info.BaseAmounts, null, casterGuid); Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, difficulty, info.BaseAmounts, null, casterGuid);
if (aura != null) if (aura != null)
{ {
if (!aura.CanBeSaved()) if (!aura.CanBeSaved())
@@ -969,6 +976,7 @@ namespace Game.Entities
stmt.AddValue(index++, key.SpellId); stmt.AddValue(index++, key.SpellId);
stmt.AddValue(index++, key.EffectMask); stmt.AddValue(index++, key.EffectMask);
stmt.AddValue(index++, recalculateMask); stmt.AddValue(index++, recalculateMask);
stmt.AddValue(index++, aura.GetCastDifficulty());
stmt.AddValue(index++, aura.GetStackAmount()); stmt.AddValue(index++, aura.GetStackAmount());
stmt.AddValue(index++, aura.GetMaxDuration()); stmt.AddValue(index++, aura.GetMaxDuration());
stmt.AddValue(index++, aura.GetDuration()); stmt.AddValue(index++, aura.GetDuration());
@@ -996,7 +1004,7 @@ namespace Game.Entities
bool AddSpell(uint spellId, ActiveStates active = ActiveStates.Decide, PetSpellState state = PetSpellState.New, PetSpellType type = PetSpellType.Normal) bool AddSpell(uint spellId, ActiveStates active = ActiveStates.Decide, PetSpellState state = PetSpellState.New, PetSpellType type = PetSpellType.Normal)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
// do pet spell book cleanup // do pet spell book cleanup
@@ -1062,7 +1070,7 @@ namespace Game.Entities
if (pair.Value.state == PetSpellState.Removed) if (pair.Value.state == PetSpellState.Removed)
continue; continue;
SpellInfo oldRankSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Key); SpellInfo oldRankSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
if (oldRankSpellInfo == null) if (oldRankSpellInfo == null)
continue; continue;
@@ -1156,7 +1164,7 @@ namespace Game.Entities
{ {
for (byte i = 0; i < SharedConst.MaxCreatureSpellDataSlots; ++i) for (byte i = 0; i < SharedConst.MaxCreatureSpellDataSlots; ++i)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(defSpells.spellid[i]); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(defSpells.spellid[i], Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
continue; continue;
@@ -1254,7 +1262,7 @@ namespace Game.Entities
GetCharmInfo().SetActionBar(i, 0, ActiveStates.Passive); GetCharmInfo().SetActionBar(i, 0, ActiveStates.Passive);
else if (ab.GetActiveState() == ActiveStates.Enabled) else if (ab.GetActiveState() == ActiveStates.Enabled)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ab.GetAction()); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ab.GetAction(), Difficulty.None);
if (spellInfo != null) if (spellInfo != null)
ToggleAutocast(spellInfo, true); ToggleAutocast(spellInfo, true);
} }
@@ -1518,7 +1526,7 @@ namespace Game.Entities
{ {
foreach (var specSpell in specSpells) foreach (var specSpell in specSpells)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID, Difficulty.None);
if (spellInfo == null || spellInfo.SpellLevel > GetLevel()) if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue; continue;
+16 -8
View File
@@ -499,20 +499,27 @@ namespace Game.Entities
itemGuid.SetRawValue(auraResult.Read<byte[]>(1)); itemGuid.SetRawValue(auraResult.Read<byte[]>(1));
AuraKey key = new AuraKey(casterGuid, itemGuid, auraResult.Read<uint>(2), auraResult.Read<uint>(3)); AuraKey key = new AuraKey(casterGuid, itemGuid, auraResult.Read<uint>(2), auraResult.Read<uint>(3));
uint recalculateMask = auraResult.Read<uint>(4); uint recalculateMask = auraResult.Read<uint>(4);
byte stackCount = auraResult.Read<byte>(5); Difficulty difficulty = (Difficulty)auraResult.Read<byte>(5);
int maxDuration = auraResult.Read<int>(6); byte stackCount = auraResult.Read<byte>(6);
int remainTime = auraResult.Read<int>(7); int maxDuration = auraResult.Read<int>(7);
byte remainCharges = auraResult.Read<byte>(8); int remainTime = auraResult.Read<int>(8);
uint castItemId = auraResult.Read<uint>(9); byte remainCharges = auraResult.Read<byte>(9);
int castItemLevel = auraResult.Read<int>(10); uint castItemId = auraResult.Read<uint>(10);
int castItemLevel = auraResult.Read<int>(11);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId, difficulty);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Player, "Unknown aura (spellid {0}), ignore.", key.SpellId); Log.outError(LogFilter.Player, "Unknown aura (spellid {0}), ignore.", key.SpellId);
continue; continue;
} }
if (difficulty != Difficulty.None && !CliDB.DifficultyStorage.ContainsKey(difficulty))
{
Log.outError(LogFilter.Player, $"Player._LoadAuras: Player '{GetName()}' ({GetGUID()}) has an invalid aura difficulty {difficulty} (SpellID: {key.SpellId}), ignoring.");
continue;
}
// negative effects should continue counting down after logout // negative effects should continue counting down after logout
if (remainTime != -1 && !spellInfo.IsPositive()) if (remainTime != -1 && !spellInfo.IsPositive())
{ {
@@ -535,7 +542,7 @@ namespace Game.Entities
AuraLoadEffectInfo info = effectInfo[key]; AuraLoadEffectInfo info = effectInfo[key];
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast)); ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast));
Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, info.BaseAmounts, null, casterGuid, itemGuid, castItemId, castItemLevel); Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, difficulty, info.BaseAmounts, null, casterGuid, itemGuid, castItemId, castItemLevel);
if (aura != null) if (aura != null)
{ {
if (!aura.CanBeSaved()) if (!aura.CanBeSaved())
@@ -1738,6 +1745,7 @@ namespace Game.Entities
stmt.AddValue(index++, key.SpellId); stmt.AddValue(index++, key.SpellId);
stmt.AddValue(index++, key.EffectMask); stmt.AddValue(index++, key.EffectMask);
stmt.AddValue(index++, recalculateMask); stmt.AddValue(index++, recalculateMask);
stmt.AddValue(index++, aura.GetCastDifficulty());
stmt.AddValue(index++, aura.GetStackAmount()); stmt.AddValue(index++, aura.GetStackAmount());
stmt.AddValue(index++, aura.GetMaxDuration()); stmt.AddValue(index++, aura.GetMaxDuration());
stmt.AddValue(index++, aura.GetDuration()); stmt.AddValue(index++, aura.GetDuration());
+9 -8
View File
@@ -1634,7 +1634,7 @@ namespace Game.Entities
if (pProto != null && IsInCombat() && (pProto.GetClass() == ItemClass.Weapon || pProto.GetInventoryType() == InventoryType.Relic) && m_weaponChangeTimer == 0) if (pProto != null && IsInCombat() && (pProto.GetClass() == ItemClass.Weapon || pProto.GetInventoryType() == InventoryType.Relic) && m_weaponChangeTimer == 0)
{ {
uint cooldownSpell = (uint)(GetClass() == Class.Rogue ? 6123 : 6119); uint cooldownSpell = (uint)(GetClass() == Class.Rogue ? 6123 : 6119);
var spellProto = Global.SpellMgr.GetSpellInfo(cooldownSpell); var spellProto = Global.SpellMgr.GetSpellInfo(cooldownSpell, Difficulty.None);
if (spellProto == null) if (spellProto == null)
Log.outError(LogFilter.Player, "Weapon switch cooldown spell {0} couldn't be found in Spell.dbc", cooldownSpell); Log.outError(LogFilter.Player, "Weapon switch cooldown spell {0} couldn't be found in Spell.dbc", cooldownSpell);
@@ -4272,11 +4272,11 @@ namespace Game.Entities
continue; continue;
// check if it is valid spell // check if it is valid spell
SpellInfo spellproto = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID); SpellInfo spellproto = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
if (spellproto == null) if (spellproto == null)
continue; continue;
if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), GetLevel()) if (spellproto.HasAura(AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), GetLevel())
&& Global.DB2Mgr.GetHeirloomByItemId(item.GetEntry()) != null) && Global.DB2Mgr.GetHeirloomByItemId(item.GetEntry()) != null)
continue; continue;
@@ -4336,10 +4336,11 @@ namespace Game.Entities
DateTime now = GameTime.GetGameTimeSteadyPoint(); DateTime now = GameTime.GetGameTimeSteadyPoint();
foreach (ItemEffectRecord effectData in pItem.GetEffects()) foreach (ItemEffectRecord effectData in pItem.GetEffects())
{ {
SpellInfo effectSpellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
// apply proc cooldown to equip auras if we have any // apply proc cooldown to equip auras if we have any
if (effectData.TriggerType == ItemSpelltriggerType.OnEquip) if (effectData.TriggerType == ItemSpelltriggerType.OnEquip)
{ {
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry((uint)effectData.SpellID); SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(effectSpellInfo);
if (procEntry == null) if (procEntry == null)
continue; continue;
@@ -4358,7 +4359,7 @@ namespace Game.Entities
continue; continue;
// Don't replace longer cooldowns by equip cooldown if we have any. // Don't replace longer cooldowns by equip cooldown if we have any.
if (GetSpellHistory().GetRemainingCooldown(Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID)) > 30 * Time.InMilliseconds) if (GetSpellHistory().GetRemainingCooldown(effectSpellInfo) > 30 * Time.InMilliseconds)
continue; continue;
GetSpellHistory().AddCooldown((uint)effectData.SpellID, pItem.GetEntry(), TimeSpan.FromSeconds(30)); GetSpellHistory().AddCooldown((uint)effectData.SpellID, pItem.GetEntry(), TimeSpan.FromSeconds(30));
@@ -5468,7 +5469,7 @@ namespace Game.Entities
public void ApplyArtifactPowerRank(Item artifact, ArtifactPowerRankRecord artifactPowerRank, bool apply) public void ApplyArtifactPowerRank(Item artifact, ArtifactPowerRankRecord artifactPowerRank, bool apply)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(artifactPowerRank.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(artifactPowerRank.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
return; return;
@@ -5597,7 +5598,7 @@ namespace Game.Entities
void ApplyAzeriteEssencePower(AzeriteItem item, AzeriteEssencePowerRecord azeriteEssencePower, bool major, bool apply) void ApplyAzeriteEssencePower(AzeriteItem item, AzeriteEssencePowerRecord azeriteEssencePower, bool major, bool apply)
{ {
SpellInfo powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MinorPowerDescription); SpellInfo powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MinorPowerDescription, Difficulty.None);
if (powerSpell != null) if (powerSpell != null)
{ {
if (apply) if (apply)
@@ -5608,7 +5609,7 @@ namespace Game.Entities
if (major) if (major)
{ {
powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MajorPowerDescription); powerSpell = Global.SpellMgr.GetSpellInfo(azeriteEssencePower.MajorPowerDescription, Difficulty.None);
if (powerSpell != null) if (powerSpell != null)
{ {
if (powerSpell.IsPassive()) if (powerSpell.IsPassive())
+2 -2
View File
@@ -379,7 +379,7 @@ namespace Game.Entities
bool AddPvpTalent(PvpTalentRecord talent, byte activeTalentGroup, byte slot) bool AddPvpTalent(PvpTalentRecord talent, byte activeTalentGroup, byte slot)
{ {
//ASSERT(talent); //ASSERT(talent);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Spells, $"Player.AddPvpTalent: Spell (ID: {talent.SpellID}) does not exist."); Log.outError(LogFilter.Spells, $"Player.AddPvpTalent: Spell (ID: {talent.SpellID}) does not exist.");
@@ -406,7 +406,7 @@ namespace Game.Entities
void RemovePvpTalent(PvpTalentRecord talent) void RemovePvpTalent(PvpTalentRecord talent)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
return; return;
+9 -9
View File
@@ -93,13 +93,13 @@ namespace Game.Entities
return; return;
} }
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)spell_id, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
return; return;
// check learned spells state // check learned spells state
bool found = false; bool found = false;
foreach (SpellEffectInfo eff in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo eff in spellInfo.GetEffects())
{ {
if (eff != null && eff.Effect == SpellEffectName.LearnSpell && !HasSpell(eff.TriggerSpell)) if (eff != null && eff.Effect == SpellEffectName.LearnSpell && !HasSpell(eff.TriggerSpell))
{ {
@@ -784,16 +784,16 @@ namespace Game.Entities
if (quest.SourceSpellID > 0) if (quest.SourceSpellID > 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID, GetMap().GetDifficultyID());
Unit caster = this; Unit caster = this;
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon)) if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon))
{ {
Unit unit = questGiver.ToUnit(); Unit unit = questGiver.ToUnit();
if (unit != null) if (unit != null)
unit.CastSpell(this, quest.SourceSpellID, true); caster = unit;
} }
caster.CastSpell(this, quest.SourceSpellID, true); caster.CastSpell(this, spellInfo, true);
} }
SetQuestSlot(log_slot, quest_id, qtime); SetQuestSlot(log_slot, quest_id, qtime);
@@ -1092,7 +1092,7 @@ namespace Game.Entities
// cast spells after mark quest complete (some spells have quest completed state requirements in spell_area data) // cast spells after mark quest complete (some spells have quest completed state requirements in spell_area data)
if (quest.RewardSpell > 0) if (quest.RewardSpell > 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell, GetMap().GetDifficultyID());
Unit caster = this; Unit caster = this;
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster)) if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
{ {
@@ -1101,7 +1101,7 @@ namespace Game.Entities
caster = unit; caster = unit;
} }
caster.CastSpell(this, quest.RewardSpell, true); caster.CastSpell(this, spellInfo, true);
} }
else else
{ {
@@ -1109,7 +1109,7 @@ namespace Game.Entities
{ {
if (quest.RewardDisplaySpell[i] > 0) if (quest.RewardDisplaySpell[i] > 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i]); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i], GetMap().GetDifficultyID());
Unit caster = this; Unit caster = this;
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster)) if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
{ {
@@ -1118,7 +1118,7 @@ namespace Game.Entities
caster = unit; caster = unit;
} }
caster.CastSpell(this, quest.RewardDisplaySpell[i], true); caster.CastSpell(this, spellInfo, true);
} }
} }
} }
+24 -24
View File
@@ -309,7 +309,7 @@ namespace Game.Entities
{ {
foreach (uint spellId in overrides) foreach (uint spellId in overrides)
{ {
SpellInfo newInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo newInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (newInfo != null) if (newInfo != null)
return GetCastSpellInfo(newInfo); return GetCastSpellInfo(newInfo);
} }
@@ -338,7 +338,7 @@ namespace Game.Entities
for (int j = 0; j < specSpells.Count; ++j) for (int j = 0; j < specSpells.Count; ++j)
{ {
SpecializationSpellsRecord specSpell = specSpells[j]; SpecializationSpellsRecord specSpell = specSpells[j];
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID, Difficulty.None);
if (spellInfo == null || spellInfo.SpellLevel > GetLevel()) if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue; continue;
@@ -1027,7 +1027,7 @@ namespace Game.Entities
{ {
if (proto.Effects[idx].SpellID != 0 && proto.Effects[idx].TriggerType == ItemSpelltriggerType.OnUse) if (proto.Effects[idx].SpellID != 0 && proto.Effects[idx].TriggerType == ItemSpelltriggerType.OnUse)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)proto.Effects[idx].SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)proto.Effects[idx].SpellID, Difficulty.None);
if (spellInfo != null) if (spellInfo != null)
GetSpellHistory().SendCooldownEvent(spellInfo, m_lastPotionId); GetSpellHistory().SendCooldownEvent(spellInfo, m_lastPotionId);
} }
@@ -1267,7 +1267,7 @@ namespace Game.Entities
uint SkillValue = GetPureSkillValue((SkillType)_spell_idx.SkillupSkillLineID); uint SkillValue = GetPureSkillValue((SkillType)_spell_idx.SkillupSkillLineID);
// Alchemy Discoveries here // Alchemy Discoveries here
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(spellid); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(spellid, Difficulty.None);
if (spellEntry != null && spellEntry.Mechanic == Mechanics.Discovery) if (spellEntry != null && spellEntry.Mechanic == Mechanics.Discovery)
{ {
uint discoveredSpell = SkillDiscovery.GetSkillDiscoverySpell(_spell_idx.SkillupSkillLineID, spellid, this); uint discoveredSpell = SkillDiscovery.GetSkillDiscoverySpell(_spell_idx.SkillupSkillLineID, spellid, this);
@@ -1507,7 +1507,7 @@ namespace Game.Entities
uint learn_spell_id = (uint)item.GetEffect(0).SpellID; uint learn_spell_id = (uint)item.GetEffect(0).SpellID;
uint learning_spell_id = (uint)item.GetEffect(1).SpellID; uint learning_spell_id = (uint)item.GetEffect(1).SpellID;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(learn_spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(learn_spell_id, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Player, "Player.CastItemUseSpell: Item (Entry: {0}) in have wrong spell id {1}, ignoring ", item.GetEntry(), learn_spell_id); Log.outError(LogFilter.Player, "Player.CastItemUseSpell: Item (Entry: {0}) in have wrong spell id {1}, ignoring ", item.GetEntry(), learn_spell_id);
@@ -1537,7 +1537,7 @@ namespace Game.Entities
if (effectData.TriggerType != ItemSpelltriggerType.OnUse) if (effectData.TriggerType != ItemSpelltriggerType.OnUse)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Player, "Player.CastItemUseSpell: Item (Entry: {0}) in have wrong spell id {1}, ignoring", item.GetEntry(), effectData.SpellID); Log.outError(LogFilter.Player, "Player.CastItemUseSpell: Item (Entry: {0}) in have wrong spell id {1}, ignoring", item.GetEntry(), effectData.SpellID);
@@ -1571,7 +1571,7 @@ namespace Game.Entities
if (pEnchant.Effect[s] != ItemEnchantmentType.UseSpell) if (pEnchant.Effect[s] != ItemEnchantmentType.UseSpell)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s]); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s], Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Player, "Player.CastItemUseSpell Enchant {0}, cast unknown spell {1}", enchant_id, pEnchant.EffectArg[s]); Log.outError(LogFilter.Player, "Player.CastItemUseSpell Enchant {0}, cast unknown spell {1}", enchant_id, pEnchant.EffectArg[s]);
@@ -1609,7 +1609,7 @@ namespace Game.Entities
if (ability.SkillLine != skillId) if (ability.SkillLine != skillId)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ability.Spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ability.Spell, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
continue; continue;
@@ -1855,7 +1855,7 @@ namespace Game.Entities
if (pair.Value.State == PlayerSpellState.Removed || pair.Value.Disabled) if (pair.Value.State == PlayerSpellState.Removed || pair.Value.Disabled)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
if (spellInfo == null || !spellInfo.IsPassive() || spellInfo.EquippedItemClass < 0) if (spellInfo == null || !spellInfo.IsPassive() || spellInfo.EquippedItemClass < 0)
continue; continue;
@@ -2107,7 +2107,7 @@ namespace Game.Entities
uint nextSpell = Global.SpellMgr.GetNextSpellInChain(spellId); uint nextSpell = Global.SpellMgr.GetNextSpellInChain(spellId);
if (nextSpell != 0) if (nextSpell != 0)
{ {
SpellInfo spellInfo1 = Global.SpellMgr.GetSpellInfo(nextSpell); SpellInfo spellInfo1 = Global.SpellMgr.GetSpellInfo(nextSpell, Difficulty.None);
if (HasSpell(nextSpell) && !spellInfo1.HasAttribute(SpellCustomAttributes.IsTalent)) if (HasSpell(nextSpell) && !spellInfo1.HasAttribute(SpellCustomAttributes.IsTalent))
RemoveSpell(nextSpell, disabled, false); RemoveSpell(nextSpell, disabled, false);
} }
@@ -2149,7 +2149,7 @@ namespace Game.Entities
} }
// update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning) // update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning)
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo != null && spellInfo.IsPrimaryProfessionFirstRank()) if (spellInfo != null && spellInfo.IsPrimaryProfessionFirstRank())
{ {
uint freeProfs = GetFreePrimaryProfessionPoints() + 1; uint freeProfs = GetFreePrimaryProfessionPoints() + 1;
@@ -2283,7 +2283,7 @@ namespace Game.Entities
// passive spells which apply aura and have an item requirement are to be added manually, instead of casted // passive spells which apply aura and have an item requirement are to be added manually, instead of casted
if (spellInfo.EquippedItemClass >= 0) if (spellInfo.EquippedItemClass >= 0)
{ {
foreach (SpellEffectInfo effectInfo in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effectInfo in spellInfo.GetEffects())
{ {
if (effectInfo != null && effectInfo.IsAura()) if (effectInfo != null && effectInfo.IsAura())
{ {
@@ -2309,7 +2309,7 @@ namespace Game.Entities
bool AddSpell(uint spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, uint fromSkill = 0) bool AddSpell(uint spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, uint fromSkill = 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
// do character spell book cleanup (all characters) // do character spell book cleanup (all characters)
@@ -2476,7 +2476,7 @@ namespace Game.Entities
if (_spell.Value.State == PlayerSpellState.Removed) if (_spell.Value.State == PlayerSpellState.Removed)
continue; continue;
SpellInfo i_spellInfo = Global.SpellMgr.GetSpellInfo(_spell.Key); SpellInfo i_spellInfo = Global.SpellMgr.GetSpellInfo(_spell.Key, Difficulty.None);
if (i_spellInfo == null) if (i_spellInfo == null)
continue; continue;
@@ -2708,7 +2708,7 @@ namespace Game.Entities
public void ApplySpellMod(uint spellId, SpellModOp op, ref int basevalue, Spell spell = null) public void ApplySpellMod(uint spellId, SpellModOp op, ref int basevalue, Spell spell = null)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return; return;
@@ -2807,7 +2807,7 @@ namespace Game.Entities
public void ApplySpellMod(uint spellId, SpellModOp op, ref uint basevalue, Spell spell = null) public void ApplySpellMod(uint spellId, SpellModOp op, ref uint basevalue, Spell spell = null)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return; return;
@@ -2906,7 +2906,7 @@ namespace Game.Entities
public void ApplySpellMod(uint spellId, SpellModOp op, ref float basevalue, Spell spell = null) public void ApplySpellMod(uint spellId, SpellModOp op, ref float basevalue, Spell spell = null)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return; return;
@@ -3117,7 +3117,7 @@ namespace Game.Entities
foreach (ItemSetSpellRecord itemSetSpell in eff.SetBonuses) foreach (ItemSetSpellRecord itemSetSpell in eff.SetBonuses)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itemSetSpell.SpellID, Difficulty.None);
if (itemSetSpell.ChrSpecID != 0 && itemSetSpell.ChrSpecID != GetPrimarySpecialization()) if (itemSetSpell.ChrSpecID != 0 && itemSetSpell.ChrSpecID != GetPrimarySpecialization())
ApplyEquipSpell(spellInfo, null, false, false); // item set aura is not for current spec ApplyEquipSpell(spellInfo, null, false, false); // item set aura is not for current spec
@@ -3137,7 +3137,7 @@ namespace Game.Entities
// remove cooldowns on spells that have < 10 min CD // remove cooldowns on spells that have < 10 min CD
GetSpellHistory().ResetCooldowns(p => GetSpellHistory().ResetCooldowns(p =>
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key, Difficulty.None);
return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds && spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds; return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds && spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds;
}, true); }, true);
@@ -3329,7 +3329,7 @@ namespace Game.Entities
if (effectData.TriggerType != ItemSpelltriggerType.ChanceOnHit) if (effectData.TriggerType != ItemSpelltriggerType.ChanceOnHit)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Player, "WORLD: unknown Item spellid {0}", effectData.SpellID); Log.outError(LogFilter.Player, "WORLD: unknown Item spellid {0}", effectData.SpellID);
@@ -3387,7 +3387,7 @@ namespace Game.Entities
if (entry != null && entry.AttributesMask.HasAnyFlag(EnchantProcAttributes.WhiteHit) && damageInfo.GetSpellInfo() != null) if (entry != null && entry.AttributesMask.HasAnyFlag(EnchantProcAttributes.WhiteHit) && damageInfo.GetSpellInfo() != null)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s]); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pEnchant.EffectArg[s], Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Player, "Player.CastItemCombatSpell(GUID: {0}, name: {1}, enchant: {2}): unknown spell {3} is casted, ignoring...", Log.outError(LogFilter.Player, "Player.CastItemCombatSpell(GUID: {0}, name: {1}, enchant: {2}): unknown spell {3} is casted, ignoring...",
@@ -3435,8 +3435,8 @@ namespace Game.Entities
for (byte i = 0; i < SpellConst.MaxEffects; ++i) for (byte i = 0; i < SpellConst.MaxEffects; ++i)
{ {
if (spellInfo.GetEffect(Difficulty.None, i).IsEffect()) if (spellInfo.GetEffect(i).IsEffect())
values.Add(SpellValueMod.BasePoint0 + i, MathFunctions.CalculatePct(spellInfo.GetEffect(Difficulty.None, i).CalcValue(this), effectPct)); values.Add(SpellValueMod.BasePoint0 + i, MathFunctions.CalculatePct(spellInfo.GetEffect(i).CalcValue(this), effectPct));
} }
} }
@@ -3478,7 +3478,7 @@ namespace Game.Entities
foreach (var spellId in smap.Keys) foreach (var spellId in smap.Keys)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
continue; continue;
@@ -58,7 +58,7 @@ namespace Game.Entities
public bool AddTalent(TalentRecord talent, byte spec, bool learning) public bool AddTalent(TalentRecord talent, byte spec, bool learning)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Spells, "Player.AddTalent: Spell (ID: {0}) does not exist.", talent.SpellID); Log.outError(LogFilter.Spells, "Player.AddTalent: Spell (ID: {0}) does not exist.", talent.SpellID);
@@ -84,14 +84,14 @@ namespace Game.Entities
public void RemoveTalent(TalentRecord talent) public void RemoveTalent(TalentRecord talent)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talent.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
return; return;
RemoveSpell(talent.SpellID, true); RemoveSpell(talent.SpellID, true);
// search for spells that the talent teaches and unlearn them // search for spells that the talent teaches and unlearn them
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell) if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
RemoveSpell(effect.TriggerSpell, true); RemoveSpell(effect.TriggerSpell, true);
@@ -294,14 +294,14 @@ namespace Game.Entities
if (talentInfo.SpellID == 0) if (talentInfo.SpellID == 0)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
continue; continue;
RemoveSpell(talentInfo.SpellID, true); RemoveSpell(talentInfo.SpellID, true);
// search for spells that the talent teaches and unlearn them // search for spells that the talent teaches and unlearn them
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell) if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
RemoveSpell(effect.TriggerSpell, true); RemoveSpell(effect.TriggerSpell, true);
@@ -311,14 +311,14 @@ namespace Game.Entities
foreach (var talentInfo in CliDB.PvpTalentStorage.Values) foreach (var talentInfo in CliDB.PvpTalentStorage.Values)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
continue; continue;
RemoveSpell(talentInfo.SpellID, true); RemoveSpell(talentInfo.SpellID, true);
// search for spells that the talent teaches and unlearn them // search for spells that the talent teaches and unlearn them
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell) if (effect != null && effect.TriggerSpell > 0 && effect.Effect == SpellEffectName.LearnSpell)
RemoveSpell(effect.TriggerSpell, true); RemoveSpell(effect.TriggerSpell, true);
@@ -575,7 +575,7 @@ namespace Game.Entities
continue; continue;
} }
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
if (spellEntry == null) if (spellEntry == null)
{ {
Log.outError(LogFilter.Player, "Player {0} has unknown talent spell: {1}", GetName(), talentInfo.SpellID); Log.outError(LogFilter.Player, "Player {0} has unknown talent spell: {1}", GetName(), talentInfo.SpellID);
@@ -597,7 +597,7 @@ namespace Game.Entities
continue; continue;
} }
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID, Difficulty.None);
if (spellEntry == null) if (spellEntry == null)
{ {
Log.outError(LogFilter.Player, $"Player.SendTalentsInfoData: Player '{GetName()}' ({GetGUID()}) has unknown pvp talent spell: {talentInfo.SpellID}"); Log.outError(LogFilter.Player, $"Player.SendTalentsInfoData: Player '{GetName()}' ({GetGUID()}) has unknown pvp talent spell: {talentInfo.SpellID}");
+5 -5
View File
@@ -1182,7 +1182,7 @@ namespace Game.Entities
for (uint i = 0; i < SharedConst.MaxCreatureSpells; ++i) for (uint i = 0; i < SharedConst.MaxCreatureSpells; ++i)
{ {
uint spellId = vehicle.m_spells[i]; uint spellId = vehicle.m_spells[i];
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
continue; continue;
@@ -1193,7 +1193,7 @@ namespace Game.Entities
} }
if (spellInfo.IsPassive()) if (spellInfo.IsPassive())
vehicle.CastSpell(vehicle, spellId, true); vehicle.CastSpell(vehicle, spellInfo, true);
petSpells.ActionButtons[i] = UnitActionBarEntry.MAKE_UNIT_ACTION_BUTTON(spellId, i + 8); petSpells.ActionButtons[i] = UnitActionBarEntry.MAKE_UNIT_ACTION_BUTTON(spellId, i + 8);
} }
@@ -1429,7 +1429,7 @@ namespace Game.Entities
switch ((ActionButtonType)type) switch ((ActionButtonType)type)
{ {
case ActionButtonType.Spell: case ActionButtonType.Spell:
if (Global.SpellMgr.GetSpellInfo(action) == null) if (!Global.SpellMgr.HasSpellInfo(action, Difficulty.None))
{ {
Log.outError(LogFilter.Player, "Spell action {0} not added into button {1} for player {2} (GUID: {3}): spell not exist", action, button, GetName(), GetGUID()); Log.outError(LogFilter.Player, "Spell action {0} not added into button {1} for player {2} (GUID: {3}): spell not exist", action, button, GetName(), GetGUID());
return false; return false;
@@ -3723,7 +3723,7 @@ namespace Game.Entities
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster) public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster)
{ {
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index); SpellEffectInfo effect = spellInfo.GetEffect(index);
if (effect == null || !effect.IsEffect()) if (effect == null || !effect.IsEffect())
return false; return false;
@@ -4937,7 +4937,7 @@ namespace Game.Entities
{ {
//returning of reagents only for players, so best done here //returning of reagents only for players, so best done here
uint spellId = pet ? pet.m_unitData.CreatedBySpell : m_oldpetspell; uint spellId = pet ? pet.m_unitData.CreatedBySpell : m_oldpetspell;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
+3 -3
View File
@@ -913,12 +913,12 @@ namespace Game.Entities
return 0; return 0;
int resistMech = 0; int resistMech = 0;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect == null || !effect.IsEffect()) if (effect == null || !effect.IsEffect())
break; break;
int effect_mech = (int)spellInfo.GetEffectMechanic(effect.EffectIndex, GetMap().GetDifficultyID()); int effect_mech = (int)spellInfo.GetEffectMechanic(effect.EffectIndex);
if (effect_mech != 0) if (effect_mech != 0)
{ {
int temp = GetTotalAuraModifierByMiscValue(AuraType.ModMechanicResistance, effect_mech); int temp = GetTotalAuraModifierByMiscValue(AuraType.ModMechanicResistance, effect_mech);
@@ -1451,7 +1451,7 @@ namespace Game.Entities
Aura aura = GetAura(chrSpec.MasterySpellID[i]); Aura aura = GetAura(chrSpec.MasterySpellID[i]);
if (aura != null) if (aura != null)
{ {
foreach (SpellEffectInfo effect in aura.GetSpellEffectInfos()) foreach (SpellEffectInfo effect in aura.GetSpellInfo().GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
+3 -3
View File
@@ -75,7 +75,7 @@ namespace Game.Entities
base.InitStats(duration); base.InitStats(duration);
// Get spell cast by totem // Get spell cast by totem
SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell()); SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell(), GetMap().GetDifficultyID());
if (totemSpell != null) if (totemSpell != null)
if (totemSpell.CalcCastTime(GetLevel()) != 0) // If spell has cast time . its an active totem if (totemSpell.CalcCastTime(GetLevel()) != 0) // If spell has cast time . its an active totem
m_type = TotemType.Active; m_type = TotemType.Active;
@@ -124,7 +124,7 @@ namespace Game.Entities
{ {
owner.SendAutoRepeatCancel(this); owner.SendAutoRepeatCancel(this);
SpellInfo spell = Global.SpellMgr.GetSpellInfo(m_unitData.CreatedBySpell); SpellInfo spell = Global.SpellMgr.GetSpellInfo(m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
if (spell != null) if (spell != null)
GetSpellHistory().SendCooldownEvent(spell, 0, null, false); GetSpellHistory().SendCooldownEvent(spell, 0, null, false);
@@ -149,7 +149,7 @@ namespace Game.Entities
if (GetEntry() == 5925) if (GetEntry() == 5925)
return false; return false;
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index); SpellEffectInfo effect = spellInfo.GetEffect(index);
if (effect == null) if (effect == null)
return true; return true;
+3 -3
View File
@@ -106,7 +106,7 @@ namespace Game.Entities
for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i) for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i)
{ {
uint spellId = _unit.ToCreature().m_spells[i]; uint spellId = _unit.ToCreature().m_spells[i];
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, _unit.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
if (spellInfo.IsPassive()) if (spellInfo.IsPassive())
@@ -133,7 +133,7 @@ namespace Game.Entities
for (uint x = 0; x < SharedConst.MaxSpellCharm; ++x) for (uint x = 0; x < SharedConst.MaxSpellCharm; ++x)
{ {
uint spellId = _unit.ToCreature().m_spells[x]; uint spellId = _unit.ToCreature().m_spells[x];
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, _unit.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
@@ -260,7 +260,7 @@ namespace Game.Entities
// check correctness // check correctness
if (PetActionBar[index].IsActionBarForSpell()) if (PetActionBar[index].IsActionBarForSpell())
{ {
SpellInfo spelInfo = Global.SpellMgr.GetSpellInfo(PetActionBar[index].GetAction()); SpellInfo spelInfo = Global.SpellMgr.GetSpellInfo(PetActionBar[index].GetAction(), _unit.GetMap().GetDifficultyID());
if (spelInfo == null) if (spelInfo == null)
SetActionBar(index, 0, ActiveStates.Passive); SetActionBar(index, 0, ActiveStates.Passive);
else if (!spelInfo.IsAutocastable()) else if (!spelInfo.IsAutocastable())
+7 -7
View File
@@ -1108,7 +1108,7 @@ namespace Game.Entities
if (!victim.IsTypeId(TypeId.Player)) if (!victim.IsTypeId(TypeId.Player))
{ {
// Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this // Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this
if (damagetype != DamageEffectType.DOT && damage > 0 && !victim.GetOwnerGUID().IsPlayer() && (spellProto == null || !spellProto.HasAura(GetMap().GetDifficultyID(), AuraType.DamageShield))) if (damagetype != DamageEffectType.DOT && damage > 0 && !victim.GetOwnerGUID().IsPlayer() && (spellProto == null || !spellProto.HasAura(AuraType.DamageShield)))
victim.ToCreature().SetLastDamagedTime(GameTime.GetGameTime() + SharedConst.MaxAggroResetTime); victim.ToCreature().SetLastDamagedTime(GameTime.GetGameTime() + SharedConst.MaxAggroResetTime);
victim.AddThreat(this, damage, damageSchoolMask, spellProto); victim.AddThreat(this, damage, damageSchoolMask, spellProto);
@@ -2632,7 +2632,7 @@ namespace Game.Entities
uint split_absorb = 0; uint split_absorb = 0;
DealDamageMods(caster, ref splitDamage, ref split_absorb); DealDamageMods(caster, ref splitDamage, ref split_absorb);
SpellNonMeleeDamage log = new SpellNonMeleeDamage(this, caster, itr.GetSpellInfo().Id, itr.GetBase().GetSpellXSpellVisualId(), damageInfo.GetSchoolMask(), itr.GetBase().GetCastGUID()); SpellNonMeleeDamage log = new SpellNonMeleeDamage(this, caster, itr.GetSpellInfo(), itr.GetBase().GetSpellXSpellVisualId(), damageInfo.GetSchoolMask(), itr.GetBase().GetCastGUID());
CleanDamage cleanDamage = new CleanDamage(splitDamage, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal); CleanDamage cleanDamage = new CleanDamage(splitDamage, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
DealDamage(caster, splitDamage, cleanDamage, DamageEffectType.Direct, damageInfo.GetSchoolMask(), itr.GetSpellInfo(), false); DealDamage(caster, splitDamage, cleanDamage, DamageEffectType.Direct, damageInfo.GetSchoolMask(), itr.GetSpellInfo(), false);
log.damage = splitDamage; log.damage = splitDamage;
@@ -2806,7 +2806,7 @@ namespace Game.Entities
if (APbonus != 0) // Can be negative if (APbonus != 0) // Can be negative
{ {
bool normalized = spellProto != null && spellProto.HasEffect(GetMap().GetDifficultyID(), SpellEffectName.NormalizedWeaponDmg); bool normalized = spellProto != null && spellProto.HasEffect(SpellEffectName.NormalizedWeaponDmg);
DoneFlatBenefit += (int)(APbonus / 3.5f * GetAPMultiplier(attType, normalized)); DoneFlatBenefit += (int)(APbonus / 3.5f * GetAPMultiplier(attType, normalized));
} }
@@ -2986,7 +2986,7 @@ namespace Game.Entities
if (!spellInfo.IsChanneled() && DotDuration > 0) if (!spellInfo.IsChanneled() && DotDuration > 0)
DotFactor = DotDuration / 15000.0f; DotFactor = DotDuration / 15000.0f;
uint DotTicks = spellInfo.GetMaxTicks(GetMap().GetDifficultyID()); uint DotTicks = spellInfo.GetMaxTicks();
if (DotTicks != 0) if (DotTicks != 0)
DotFactor /= DotTicks; DotFactor /= DotTicks;
} }
@@ -3051,12 +3051,12 @@ namespace Game.Entities
// can't attack invisible // can't attack invisible
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible))
{ {
if (obj && !obj.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID()))) if (obj && !obj.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea()))
return false; return false;
else if (!obj) else if (!obj)
{ {
// ignore stealth for aoe spells. Ignore stealth if target is player and unit in combat with same player // ignore stealth for aoe spells. Ignore stealth if target is player and unit in combat with same player
bool ignoreStealthCheck = (bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())) || bool ignoreStealthCheck = (bySpell != null && bySpell.IsAffectingArea()) ||
(target.GetTypeId() == TypeId.Player && target.HasStealthAura() && target.IsInCombat() && IsInCombatWith(target)); (target.GetTypeId() == TypeId.Player && target.HasStealthAura() && target.IsInCombat() && IsInCombatWith(target));
if (!CanSeeOrDetect(target, ignoreStealthCheck)) if (!CanSeeOrDetect(target, ignoreStealthCheck))
@@ -3185,7 +3185,7 @@ namespace Game.Entities
return false; return false;
// can't assist invisible // can't assist invisible
if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID()))) if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && !CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea()))
return false; return false;
// can't assist dead // can't assist dead
+4 -4
View File
@@ -306,7 +306,7 @@ namespace Game.Entities
m_attacker = spellNonMeleeDamage.attacker; m_attacker = spellNonMeleeDamage.attacker;
m_victim = spellNonMeleeDamage.target; m_victim = spellNonMeleeDamage.target;
m_damage = spellNonMeleeDamage.damage; m_damage = spellNonMeleeDamage.damage;
m_spellInfo = Global.SpellMgr.GetSpellInfo(spellNonMeleeDamage.SpellId); m_spellInfo = spellNonMeleeDamage.Spell;
m_schoolMask = spellNonMeleeDamage.schoolMask; m_schoolMask = spellNonMeleeDamage.schoolMask;
m_damageType = damageType; m_damageType = damageType;
m_attackType = attackType; m_attackType = attackType;
@@ -450,11 +450,11 @@ namespace Game.Entities
public class SpellNonMeleeDamage public class SpellNonMeleeDamage
{ {
public SpellNonMeleeDamage(Unit _attacker, Unit _target, uint _SpellID, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default) public SpellNonMeleeDamage(Unit _attacker, Unit _target, SpellInfo _spellInfo, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default)
{ {
target = _target; target = _target;
attacker = _attacker; attacker = _attacker;
SpellId = _SpellID; Spell = _spellInfo;
SpellXSpellVisualID = _SpellXSpellVisualID; SpellXSpellVisualID = _SpellXSpellVisualID;
schoolMask = _schoolMask; schoolMask = _schoolMask;
castId = _castId; castId = _castId;
@@ -464,7 +464,7 @@ namespace Game.Entities
public Unit target; public Unit target;
public Unit attacker; public Unit attacker;
public ObjectGuid castId; public ObjectGuid castId;
public uint SpellId; public SpellInfo Spell;
public uint SpellXSpellVisualID; public uint SpellXSpellVisualID;
public uint damage; public uint damage;
public uint originalDamage; public uint originalDamage;
+4 -4
View File
@@ -194,7 +194,7 @@ namespace Game.Entities
minion.SetSpeedRate(i, m_speed_rate[(int)i]); minion.SetSpeedRate(i, m_speed_rate[(int)i]);
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent()) if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent())
GetSpellHistory().StartCooldown(spellInfo, 0, null, true); GetSpellHistory().StartCooldown(spellInfo, 0, null, true);
} }
@@ -222,10 +222,10 @@ namespace Game.Entities
else if (minion.IsTotem()) else if (minion.IsTotem())
{ {
// All summoned by totem minions must disappear when it is removed. // All summoned by totem minions must disappear when it is removed.
SpellInfo spInfo = Global.SpellMgr.GetSpellInfo(minion.ToTotem().GetSpell()); SpellInfo spInfo = Global.SpellMgr.GetSpellInfo(minion.ToTotem().GetSpell(), GetMap().GetDifficultyID());
if (spInfo != null) if (spInfo != null)
{ {
foreach (SpellEffectInfo effect in spInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effect in spInfo.GetEffects())
{ {
if (effect == null || effect.Effect != SpellEffectName.Summon) if (effect == null || effect.Effect != SpellEffectName.Summon)
continue; continue;
@@ -235,7 +235,7 @@ namespace Game.Entities
} }
} }
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
// Remove infinity cooldown // Remove infinity cooldown
if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent()) if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent())
GetSpellHistory().SendCooldownEvent(spellInfo); GetSpellHistory().SendCooldownEvent(spellInfo);
+41 -42
View File
@@ -36,12 +36,12 @@ namespace Game.Entities
// function uses real base points (typically value - 1) // function uses real base points (typically value - 1)
public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, int? basePoints = null, uint castItemId = 0, int itemLevel = -1) public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, int? basePoints = null, uint castItemId = 0, int itemLevel = -1)
{ {
SpellEffectInfo effect = spellProto.GetEffect(GetMap().GetDifficultyID(), effect_index); SpellEffectInfo effect = spellProto.GetEffect(effect_index);
return effect != null ? effect.CalcValue(this, basePoints, target, castItemId, itemLevel) : 0; return effect != null ? effect.CalcValue(this, basePoints, target, castItemId, itemLevel) : 0;
} }
public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, out float variance, int? basePoints = null, uint castItemId = 0, int itemLevel = -1) public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, out float variance, int? basePoints = null, uint castItemId = 0, int itemLevel = -1)
{ {
SpellEffectInfo effect = spellProto.GetEffect(GetMap().GetDifficultyID(), effect_index); SpellEffectInfo effect = spellProto.GetEffect(effect_index);
variance = 0.0f; variance = 0.0f;
return effect != null ? effect.CalcValue(out variance, this, basePoints, target, castItemId, itemLevel) : 0; return effect != null ? effect.CalcValue(out variance, this, basePoints, target, castItemId, itemLevel) : 0;
} }
@@ -466,7 +466,7 @@ namespace Game.Entities
DoneTotal += (int)(DoneAdvertisedBenefit * coeff * stack); DoneTotal += (int)(DoneAdvertisedBenefit * coeff * stack);
} }
foreach (SpellEffectInfo eff in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo eff in spellProto.GetEffects())
{ {
if (eff == null) if (eff == null)
continue; continue;
@@ -586,7 +586,7 @@ namespace Game.Entities
return false; return false;
}); });
foreach (SpellEffectInfo eff in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo eff in spellProto.GetEffects())
{ {
if (eff == null) if (eff == null)
continue; continue;
@@ -1040,7 +1040,7 @@ namespace Game.Entities
} }
public void CastSpell(Unit victim, uint spellId, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) public void CastSpell(Unit victim, uint spellId, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Spells, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); Log.outError(LogFilter.Spells, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
@@ -1061,7 +1061,7 @@ namespace Game.Entities
} }
public void CastSpell(float x, float y, float z, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) public void CastSpell(float x, float y, float z, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
@@ -1074,7 +1074,7 @@ namespace Game.Entities
} }
public void CastSpell(GameObject go, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) public void CastSpell(GameObject go, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
@@ -1111,7 +1111,7 @@ namespace Game.Entities
} }
public void CastCustomSpell(uint spellId, Dictionary<SpellValueMod, int> values, Unit victim = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) public void CastCustomSpell(uint spellId, Dictionary<SpellValueMod, int> values, Unit victim = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString()); Log.outError(LogFilter.Unit, "CastSpell: unknown spell id {0} by caster: {1}", spellId, GetGUID().ToString());
@@ -1152,7 +1152,7 @@ namespace Game.Entities
bool DirectDamage = false; bool DirectDamage = false;
bool AreaEffect = false; bool AreaEffect = false;
foreach (SpellEffectInfo effect in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellProto.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -1213,7 +1213,7 @@ namespace Game.Entities
CastingTime /= 2; CastingTime /= 2;
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
foreach (SpellEffectInfo effect in spellProto.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellProto.GetEffects())
{ {
if (effect != null && (effect.Effect == SpellEffectName.HealthLeech || if (effect != null && (effect.Effect == SpellEffectName.HealthLeech ||
(effect.Effect == SpellEffectName.ApplyAura && effect.ApplyAuraName == AuraType.PeriodicLeech))) (effect.Effect == SpellEffectName.ApplyAura && effect.ApplyAuraName == AuraType.PeriodicLeech)))
@@ -1239,7 +1239,7 @@ namespace Game.Entities
bool matches = auraEffect.GetMiscValue() != 0 ? auraEffect.GetMiscValue() == spellInfo.Id : auraEffect.IsAffectingSpell(spellInfo); bool matches = auraEffect.GetMiscValue() != 0 ? auraEffect.GetMiscValue() == spellInfo.Id : auraEffect.IsAffectingSpell(spellInfo);
if (matches) if (matches)
{ {
SpellInfo info = Global.SpellMgr.GetSpellInfo((uint)auraEffect.GetAmount()); SpellInfo info = Global.SpellMgr.GetSpellInfo((uint)auraEffect.GetAmount(), GetMap().GetDifficultyID());
if (info != null) if (info != null)
return info; return info;
} }
@@ -1266,7 +1266,7 @@ namespace Game.Entities
{ {
if (effect.GetMiscValue() == spellInfo.Id) if (effect.GetMiscValue() == spellInfo.Id)
{ {
SpellInfo visualSpell = Global.SpellMgr.GetSpellInfo((uint)effect.GetMiscValueB()); SpellInfo visualSpell = Global.SpellMgr.GetSpellInfo((uint)effect.GetMiscValueB(), GetMap().GetDifficultyID());
if (visualSpell != null) if (visualSpell != null)
{ {
spellInfo = visualSpell; spellInfo = visualSpell;
@@ -1512,7 +1512,7 @@ namespace Game.Entities
int gain = victim.ModifyPower(powerType, damage); int gain = victim.ModifyPower(powerType, damage);
int overEnergize = damage - gain; int overEnergize = damage - gain;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
victim.GetHostileRefManager().ThreatAssist(this, damage * 0.5f, spellInfo); victim.GetHostileRefManager().ThreatAssist(this, damage * 0.5f, spellInfo);
SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType); SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType);
@@ -1583,7 +1583,7 @@ namespace Game.Entities
} }
bool immuneToAllEffects = true; bool immuneToAllEffects = true;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
// State/effect immunities applied by aura expect full spell immunity // State/effect immunities applied by aura expect full spell immunity
// Ignore effects with mechanic, they are supposed to be checked separately // Ignore effects with mechanic, they are supposed to be checked separately
@@ -1610,7 +1610,7 @@ namespace Game.Entities
if ((pair.Key & schoolMask) == 0) if ((pair.Key & schoolMask) == 0)
continue; continue;
SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value); SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value, GetMap().GetDifficultyID());
if (!(immuneSpellInfo != null && immuneSpellInfo.IsPositive() && spellInfo.IsPositive() && caster && IsFriendlyTo(caster))) if (!(immuneSpellInfo != null && immuneSpellInfo.IsPositive() && spellInfo.IsPositive() && caster && IsFriendlyTo(caster)))
if (!spellInfo.CanPierceImmuneAura(immuneSpellInfo)) if (!spellInfo.CanPierceImmuneAura(immuneSpellInfo))
schoolImmunityMask |= pair.Key; schoolImmunityMask |= pair.Key;
@@ -1654,7 +1654,7 @@ namespace Game.Entities
if (spellInfo == null) if (spellInfo == null)
return false; return false;
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index); SpellEffectInfo effect = spellInfo.GetEffect(index);
if (effect == null || !effect.IsEffect()) if (effect == null || !effect.IsEffect())
return false; return false;
@@ -1731,7 +1731,7 @@ namespace Game.Entities
uint schoolImmunityMask = 0; uint schoolImmunityMask = 0;
var schoolList = m_spellImmune[(int)SpellImmunity.School]; var schoolList = m_spellImmune[(int)SpellImmunity.School];
foreach (var pair in schoolList) foreach (var pair in schoolList)
if (Convert.ToBoolean(pair.Key & schoolMask) && !spellInfo.CanPierceImmuneAura(Global.SpellMgr.GetSpellInfo(pair.Value))) if (Convert.ToBoolean(pair.Key & schoolMask) && !spellInfo.CanPierceImmuneAura(Global.SpellMgr.GetSpellInfo(pair.Value, GetMap().GetDifficultyID())))
schoolImmunityMask |= pair.Key; schoolImmunityMask |= pair.Key;
// // We need to be immune to all types // // We need to be immune to all types
@@ -2212,7 +2212,7 @@ namespace Game.Entities
if (transformId == 0) if (transformId == 0)
return false; return false;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(transformId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(transformId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return false; return false;
@@ -2465,16 +2465,15 @@ namespace Game.Entities
if (!victim.IsAlive() || victim.HasUnitState(UnitState.InFlight) || (victim.IsTypeId(TypeId.Unit) && victim.ToCreature().IsEvadingAttacks())) if (!victim.IsAlive() || victim.HasUnitState(UnitState.InFlight) || (victim.IsTypeId(TypeId.Unit) && victim.ToCreature().IsEvadingAttacks()))
return; return;
SpellInfo spellProto = Global.SpellMgr.GetSpellInfo(damageInfo.SpellId); if (damageInfo.Spell == null)
if (spellProto == null)
{ {
Log.outDebug(LogFilter.Unit, "Unit.DealSpellDamage has wrong damageInfo.SpellID: {0}", damageInfo.SpellId); Log.outDebug(LogFilter.Unit, "Unit.DealSpellDamage has no spell");
return; return;
} }
// Call default DealDamage // Call default DealDamage
CleanDamage cleanDamage = new CleanDamage(damageInfo.cleanDamage, damageInfo.absorb, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal); CleanDamage cleanDamage = new CleanDamage(damageInfo.cleanDamage, damageInfo.absorb, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
DealDamage(victim, damageInfo.damage, cleanDamage, DamageEffectType.SpellDirect, damageInfo.schoolMask, spellProto, durabilityLoss); DealDamage(victim, damageInfo.damage, cleanDamage, DamageEffectType.SpellDirect, damageInfo.schoolMask, damageInfo.Spell, durabilityLoss);
} }
public void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage log) public void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage log)
@@ -2483,7 +2482,7 @@ namespace Game.Entities
packet.Me = log.target.GetGUID(); packet.Me = log.target.GetGUID();
packet.CasterGUID = log.attacker.GetGUID(); packet.CasterGUID = log.attacker.GetGUID();
packet.CastID = log.castId; packet.CastID = log.castId;
packet.SpellID = (int)log.SpellId; packet.SpellID = (int)(log.Spell != null ? log.Spell.Id : 0);
packet.Damage = (int)log.damage; packet.Damage = (int)log.damage;
packet.OriginalDamage = (int)log.originalDamage; packet.OriginalDamage = (int)log.originalDamage;
if (log.damage > log.preHitHealth) if (log.damage > log.preHitHealth)
@@ -2622,7 +2621,7 @@ namespace Game.Entities
} }
// turn off snare auras by setting amount to 0 // turn off snare auras by setting amount to 0
foreach (SpellEffectInfo effect in aura.GetSpellInfo().GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in aura.GetSpellInfo().GetEffects())
{ {
if (effect == null || !effect.IsEffect()) if (effect == null || !effect.IsEffect())
continue; continue;
@@ -2902,7 +2901,7 @@ namespace Game.Entities
if (target == null) if (target == null)
return null; return null;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return null; return null;
@@ -2929,7 +2928,7 @@ namespace Game.Entities
} }
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast)); ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellInfo.Id, GetMap().GenerateLowGuid(HighGuid.Cast));
Aura aura = Aura.TryRefreshStackOrCreate(spellInfo, castId, effMask, target, this); Aura aura = Aura.TryRefreshStackOrCreate(spellInfo, castId, effMask, target, this, GetMap().GetDifficultyID());
if (aura != null) if (aura != null)
{ {
aura.ApplyForTargets(); aura.ApplyForTargets();
@@ -2960,14 +2959,14 @@ namespace Game.Entities
Unit target = Convert.ToBoolean(clickInfo.castFlags & (byte)SpellClickCastFlags.TargetClicker) ? clicker : this; Unit target = Convert.ToBoolean(clickInfo.castFlags & (byte)SpellClickCastFlags.TargetClicker) ? clicker : this;
ObjectGuid origCasterGUID = Convert.ToBoolean(clickInfo.castFlags & (byte)SpellClickCastFlags.OrigCasterOwner) ? GetOwnerGUID() : clicker.GetGUID(); ObjectGuid origCasterGUID = Convert.ToBoolean(clickInfo.castFlags & (byte)SpellClickCastFlags.OrigCasterOwner) ? GetOwnerGUID() : clicker.GetGUID();
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(clickInfo.spellId); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(clickInfo.spellId, caster.GetMap().GetDifficultyID());
// if (!spellEntry) should be checked at npc_spellclick load // if (!spellEntry) should be checked at npc_spellclick load
if (seatId > -1) if (seatId > -1)
{ {
byte i = 0; byte i = 0;
bool valid = false; bool valid = false;
foreach (SpellEffectInfo effect in spellEntry.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellEntry.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -2991,14 +2990,14 @@ namespace Game.Entities
else // This can happen during Player._LoadAuras else // This can happen during Player._LoadAuras
{ {
int[] bp0 = new int[SpellConst.MaxEffects]; int[] bp0 = new int[SpellConst.MaxEffects];
foreach (SpellEffectInfo effect in spellEntry.GetEffectsForDifficulty(GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellEntry.GetEffects())
{ {
if (effect != null) if (effect != null)
bp0[effect.EffectIndex] = effect.BasePoints; bp0[effect.EffectIndex] = effect.BasePoints;
} }
bp0[i] = seatId; bp0[i] = seatId;
Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, bp0, null, origCasterGUID); Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, GetMap().GetDifficultyID(), bp0, null, origCasterGUID);
} }
} }
else else
@@ -3006,7 +3005,7 @@ namespace Game.Entities
if (IsInMap(caster)) if (IsInMap(caster))
caster.CastSpell(target, spellEntry, flags, null, null, origCasterGUID); caster.CastSpell(target, spellEntry, flags, null, null, origCasterGUID);
else else
Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, null, null, origCasterGUID); Aura.TryRefreshStackOrCreate(spellEntry, ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), SpellConst.MaxEffectMask, this, clicker, GetMap().GetDifficultyID(), null, null, origCasterGUID);
} }
result = true; result = true;
@@ -3045,7 +3044,7 @@ namespace Game.Entities
if (spellInfo.Mechanic != 0 && Convert.ToBoolean(mechanicMask & (1 << (int)spellInfo.Mechanic))) if (spellInfo.Mechanic != 0 && Convert.ToBoolean(mechanicMask & (1 << (int)spellInfo.Mechanic)))
return true; return true;
foreach (SpellEffectInfo effect in pair.Value.GetBase().GetSpellEffectInfos()) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (effect != null && effect.Effect != 0 && effect.Mechanic != 0) if (effect != null && effect.Effect != 0 && effect.Mechanic != 0)
if (Convert.ToBoolean(mechanicMask & (1 << (int)effect.Mechanic))) if (Convert.ToBoolean(mechanicMask & (1 << (int)effect.Mechanic)))
return true; return true;
@@ -3331,10 +3330,10 @@ namespace Game.Entities
if (aura.IsSingleTarget()) if (aura.IsSingleTarget())
aura.UnregisterSingleTarget(); aura.UnregisterSingleTarget();
Aura newAura = Aura.TryRefreshStackOrCreate(aura.GetSpellInfo(), aura.GetCastGUID(), effMask, stealer, null, baseDamage, null, aura.GetCasterGUID()); Aura newAura = Aura.TryRefreshStackOrCreate(aura.GetSpellInfo(), aura.GetCastGUID(), effMask, stealer, null, aura.GetCastDifficulty(), baseDamage, null, aura.GetCasterGUID());
if (newAura != null) if (newAura != null)
{ {
// created aura must not be single target aura,, so stealer won't loose it on recast // created aura must not be single target aura, so stealer won't loose it on recast
if (newAura.IsSingleTarget()) if (newAura.IsSingleTarget())
{ {
newAura.UnregisterSingleTarget(); newAura.UnregisterSingleTarget();
@@ -3742,7 +3741,7 @@ namespace Game.Entities
if (pair.Value == null) if (pair.Value == null)
continue; continue;
Aura aura = pair.Value.GetBase(); Aura aura = pair.Value.GetBase();
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type)) if (!aura.GetSpellInfo().HasAura(type))
_UnapplyAura(pair, AuraRemoveMode.Default); _UnapplyAura(pair, AuraRemoveMode.Default);
} }
@@ -3752,7 +3751,7 @@ namespace Game.Entities
continue; continue;
Aura aura = pair.Value; Aura aura = pair.Value;
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type)) if (!aura.GetSpellInfo().HasAura(type))
RemoveOwnedAura(pair, AuraRemoveMode.Default); RemoveOwnedAura(pair, AuraRemoveMode.Default);
} }
} }
@@ -3761,14 +3760,14 @@ namespace Game.Entities
foreach (var pair in GetAppliedAuras()) foreach (var pair in GetAppliedAuras())
{ {
Aura aura = pair.Value.GetBase(); Aura aura = pair.Value.GetBase();
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type1) || !aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type2)) if (!aura.GetSpellInfo().HasAura(type1) || !aura.GetSpellInfo().HasAura(type2))
_UnapplyAura(pair, AuraRemoveMode.Default); _UnapplyAura(pair, AuraRemoveMode.Default);
} }
foreach (var pair in GetOwnedAuras()) foreach (var pair in GetOwnedAuras())
{ {
Aura aura = pair.Value; Aura aura = pair.Value;
if (!aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type1) || !aura.GetSpellInfo().HasAura(GetMap().GetDifficultyID(), type2)) if (!aura.GetSpellInfo().HasAura(type1) || !aura.GetSpellInfo().HasAura(type2))
RemoveOwnedAura(pair, AuraRemoveMode.Default); RemoveOwnedAura(pair, AuraRemoveMode.Default);
} }
} }
@@ -3789,7 +3788,7 @@ namespace Game.Entities
if (spell.Value.State == PlayerSpellState.Removed || spell.Value.Disabled) if (spell.Value.State == PlayerSpellState.Removed || spell.Value.Disabled)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key, Difficulty.None);
if (spellInfo == null || !spellInfo.IsPassive()) if (spellInfo == null || !spellInfo.IsPassive())
continue; continue;
@@ -3804,7 +3803,7 @@ namespace Game.Entities
{ {
if (spell.Value.state == PetSpellState.Removed) if (spell.Value.state == PetSpellState.Removed)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.Key, Difficulty.None);
if (spellInfo == null || !spellInfo.IsPassive()) if (spellInfo == null || !spellInfo.IsPassive())
continue; continue;
if (spellInfo.CasterAuraState == flag) if (spellInfo.CasterAuraState == flag)
@@ -4189,7 +4188,7 @@ namespace Game.Entities
return null; return null;
// update basepoints with new values - effect amount will be recalculated in ModStackAmount // update basepoints with new values - effect amount will be recalculated in ModStackAmount
foreach (SpellEffectInfo effect in foundAura.GetSpellEffectInfos()) foreach (SpellEffectInfo effect in newAura.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -4234,7 +4233,7 @@ namespace Game.Entities
if (!IsHighestExclusiveAura(aura)) if (!IsHighestExclusiveAura(aura))
{ {
if (!aura.GetSpellInfo().IsAffectingArea(GetMap().GetDifficultyID())) if (!aura.GetSpellInfo().IsAffectingArea())
{ {
Unit caster = aura.GetCaster(); Unit caster = aura.GetCaster();
if (caster && caster.IsTypeId(TypeId.Player)) if (caster && caster.IsTypeId(TypeId.Player))
+5 -5
View File
@@ -269,7 +269,7 @@ namespace Game.Entities
public bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId) public bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId)
{ {
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(GetTransForm()); SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
if (transformSpellInfo != null) if (transformSpellInfo != null)
if (transformSpellInfo.HasAttribute(SpellAttr0.CastableWhileMounted)) if (transformSpellInfo.HasAttribute(SpellAttr0.CastableWhileMounted))
return false; return false;
@@ -601,7 +601,7 @@ namespace Game.Entities
if (gameObj.GetSpellId() != 0) if (gameObj.GetSpellId() != 0)
{ {
SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(gameObj.GetSpellId()); SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(gameObj.GetSpellId(), GetMap().GetDifficultyID());
// Need disable spell use for owner // Need disable spell use for owner
if (createBySpell != null && createBySpell.HasAttribute(SpellAttr0.DisabledWhileActive)) if (createBySpell != null && createBySpell.HasAttribute(SpellAttr0.DisabledWhileActive))
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
@@ -634,7 +634,7 @@ namespace Game.Entities
{ {
RemoveAurasDueToSpell(spellid); RemoveAurasDueToSpell(spellid);
SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(spellid); SpellInfo createBySpell = Global.SpellMgr.GetSpellInfo(spellid, GetMap().GetDifficultyID());
// Need activate spell use for owner // Need activate spell use for owner
if (createBySpell != null && createBySpell.IsCooldownStartedOnEvent()) if (createBySpell != null && createBySpell.IsCooldownStartedOnEvent())
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
@@ -1772,7 +1772,7 @@ namespace Game.Entities
Global.SpellMgr.IsSpellMemberOfSpellGroup(spellProto.Id, SpellGroup.ElixirBattle) || Global.SpellMgr.IsSpellMemberOfSpellGroup(spellProto.Id, SpellGroup.ElixirBattle) ||
Global.SpellMgr.IsSpellMemberOfSpellGroup(spellProto.Id, SpellGroup.ElixirGuardian))) Global.SpellMgr.IsSpellMemberOfSpellGroup(spellProto.Id, SpellGroup.ElixirGuardian)))
{ {
SpellEffectInfo effect = spellProto.GetEffect(Difficulty.None, 0); SpellEffectInfo effect = spellProto.GetEffect(0);
if (target.HasAura(53042) && effect != null && target.HasSpell(effect.TriggerSpell)) if (target.HasAura(53042) && effect != null && target.HasSpell(effect.TriggerSpell))
duration *= 2; duration *= 2;
} }
@@ -2674,7 +2674,7 @@ namespace Game.Entities
if (effIndex != -1) if (effIndex != -1)
{ {
// bleeding effects are not reduced by armor // bleeding effects are not reduced by armor
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), (uint)effIndex); SpellEffectInfo effect = spellInfo.GetEffect((uint)effIndex);
if (effect != null) if (effect != null)
{ {
if (effect.ApplyAuraName == AuraType.PeriodicDamage || effect.Effect == SpellEffectName.SchoolDamage) if (effect.ApplyAuraName == AuraType.PeriodicDamage || effect.Effect == SpellEffectName.SchoolDamage)
+36 -31
View File
@@ -1393,7 +1393,7 @@ namespace Game
case ScriptCommands.RemoveAura: case ScriptCommands.RemoveAura:
{ {
if (Global.SpellMgr.GetSpellInfo(tmp.RemoveAura.SpellID) == null) if (!Global.SpellMgr.HasSpellInfo(tmp.RemoveAura.SpellID, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "Table `{0}` using non-existent spell (id: {1}) in SCRIPT_COMMAND_REMOVE_AURA for script id {2}", Log.outError(LogFilter.Sql, "Table `{0}` using non-existent spell (id: {1}) in SCRIPT_COMMAND_REMOVE_AURA for script id {2}",
tableName, tmp.RemoveAura.SpellID, tmp.id); tableName, tmp.RemoveAura.SpellID, tmp.id);
@@ -1410,7 +1410,7 @@ namespace Game
case ScriptCommands.CastSpell: case ScriptCommands.CastSpell:
{ {
if (Global.SpellMgr.GetSpellInfo(tmp.CastSpell.SpellID) == null) if (!Global.SpellMgr.HasSpellInfo(tmp.CastSpell.SpellID, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "Table `{0}` using non-existent spell (id: {1}) in SCRIPT_COMMAND_CAST_SPELL for script id {2}", Log.outError(LogFilter.Sql, "Table `{0}` using non-existent spell (id: {1}) in SCRIPT_COMMAND_CAST_SPELL for script id {2}",
tableName, tmp.CastSpell.SpellID, tmp.id); tableName, tmp.CastSpell.SpellID, tmp.id);
@@ -1493,7 +1493,7 @@ namespace Game
foreach (var script in sSpellScripts) foreach (var script in sSpellScripts)
{ {
uint spellId = script.Key & 0x00FFFFFF; uint spellId = script.Key & 0x00FFFFFF;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Table `spell_scripts` has not existing spell (Id: {0}) as script id", spellId); Log.outError(LogFilter.Sql, "Table `spell_scripts` has not existing spell (Id: {0}) as script id", spellId);
@@ -1521,16 +1521,17 @@ namespace Game
} }
// Load all possible script entries from spells // Load all possible script entries from spells
foreach (var spell in Global.SpellMgr.GetSpellInfoStorage().Values) foreach (SpellNameRecord spellNameEntry in CliDB.SpellNameStorage.Values)
{ {
foreach (SpellEffectInfo effect in spell.GetEffectsForDifficulty(Difficulty.None)) SpellInfo spell = Global.SpellMgr.GetSpellInfo(spellNameEntry.Id, Difficulty.None);
if (spell != null)
{ {
if (effect == null) foreach (SpellEffectInfo effect in spell.GetEffects())
continue; {
if (effect != null && effect.Effect == SpellEffectName.SendEvent)
if (effect.Effect == SpellEffectName.SendEvent) if (effect.MiscValue != 0)
if (effect.MiscValue != 0) evt_scripts.Add((uint)effect.MiscValue);
evt_scripts.Add((uint)effect.MiscValue); }
} }
} }
@@ -1612,7 +1613,7 @@ namespace Game
spellId = -spellId; spellId = -spellId;
} }
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)spellId, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Scriptname: `{0}` spell (Id: {1}) does not exist.", scriptName, spellId); Log.outError(LogFilter.Sql, "Scriptname: `{0}` spell (Id: {1}) does not exist.", scriptName, spellId);
@@ -1663,7 +1664,7 @@ namespace Game
foreach (var script in spellScriptsStorage.KeyValueList) foreach (var script in spellScriptsStorage.KeyValueList)
{ {
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(script.Key); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(script.Key, Difficulty.None);
Dictionary<SpellScriptLoader, uint> SpellScriptLoaders = Global.ScriptMgr.CreateSpellScriptLoaders(script.Key); Dictionary<SpellScriptLoader, uint> SpellScriptLoaders = Global.ScriptMgr.CreateSpellScriptLoaders(script.Key);
foreach (var pair in SpellScriptLoaders) foreach (var pair in SpellScriptLoaders)
@@ -1973,14 +1974,14 @@ namespace Game
if (!uint.TryParse(id, out uint spellId)) if (!uint.TryParse(id, out uint spellId))
continue; continue;
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (AdditionalSpellInfo == null) if (AdditionalSpellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has wrong spell {1} defined in `auras` field in `creature_template_addon`.", entry, spellId); Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has wrong spell {1} defined in `auras` field in `creature_template_addon`.", entry, spellId);
continue; continue;
} }
if (AdditionalSpellInfo.HasAura(Difficulty.None, AuraType.ControlVehicle)) if (AdditionalSpellInfo.HasAura(AuraType.ControlVehicle))
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has SPELL_AURA_CONTROL_VEHICLE aura {1} defined in `auras` field in `creature_template_addon`.", entry, spellId); Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has SPELL_AURA_CONTROL_VEHICLE aura {1} defined in `auras` field in `creature_template_addon`.", entry, spellId);
if (creatureAddon.auras.Contains(spellId)) if (creatureAddon.auras.Contains(spellId))
@@ -2087,14 +2088,14 @@ namespace Game
if (!uint.TryParse(id, out uint spellId)) if (!uint.TryParse(id, out uint spellId))
continue; continue;
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (AdditionalSpellInfo == null) if (AdditionalSpellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has wrong spell {1} defined in `auras` field in `creatureaddon`.", guid, spellId); Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has wrong spell {1} defined in `auras` field in `creatureaddon`.", guid, spellId);
continue; continue;
} }
if (AdditionalSpellInfo.HasAura(Difficulty.None, AuraType.ControlVehicle)) if (AdditionalSpellInfo.HasAura(AuraType.ControlVehicle))
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has SPELL_AURA_CONTROL_VEHICLE aura {1} defined in `auras` field in `creature_addon`.", guid, spellId); Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has SPELL_AURA_CONTROL_VEHICLE aura {1} defined in `auras` field in `creature_addon`.", guid, spellId);
if (creatureAddon.auras.Contains(spellId)) if (creatureAddon.auras.Contains(spellId))
@@ -2677,7 +2678,7 @@ namespace Game
for (byte j = 0; j < SharedConst.MaxCreatureSpells; ++j) for (byte j = 0; j < SharedConst.MaxCreatureSpells; ++j)
{ {
if (cInfo.Spells[j] != 0 && !Global.SpellMgr.HasSpellInfo(cInfo.Spells[j])) if (cInfo.Spells[j] != 0 && !Global.SpellMgr.HasSpellInfo(cInfo.Spells[j], Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has non-existing Spell{1} ({2}), set to 0.", cInfo.Entry, j + 1, cInfo.Spells[j]); Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has non-existing Spell{1} ({2}), set to 0.", cInfo.Entry, j + 1, cInfo.Spells[j]);
cInfo.Spells[j] = 0; cInfo.Spells[j] = 0;
@@ -2991,7 +2992,7 @@ namespace Game
spell.ReqAbility[2] = trainerSpellsResult.Read<uint>(7); spell.ReqAbility[2] = trainerSpellsResult.Read<uint>(7);
spell.ReqLevel = trainerSpellsResult.Read<byte>(8); spell.ReqLevel = trainerSpellsResult.Read<byte>(8);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.SpellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell.SpellId, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Sql, $"Table `trainer_spell` references non-existing spell (SpellId: {spell.SpellId}) for TrainerId {trainerId}, ignoring"); Log.outError(LogFilter.Sql, $"Table `trainer_spell` references non-existing spell (SpellId: {spell.SpellId}) for TrainerId {trainerId}, ignoring");
@@ -3008,7 +3009,7 @@ namespace Game
for (var i = 0; i < spell.ReqAbility.Count; ++i) for (var i = 0; i < spell.ReqAbility.Count; ++i)
{ {
uint requiredSpell = spell.ReqAbility[i]; uint requiredSpell = spell.ReqAbility[i];
if (requiredSpell != 0 && !Global.SpellMgr.HasSpellInfo(requiredSpell)) if (requiredSpell != 0 && !Global.SpellMgr.HasSpellInfo(requiredSpell, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, $"Table `trainer_spell` references non-existing spell (ReqAbility {i + 1}: {requiredSpell}) for TrainerId {spell.SpellId} and SpellId {trainerId}, ignoring"); Log.outError(LogFilter.Sql, $"Table `trainer_spell` references non-existing spell (ReqAbility {i + 1}: {requiredSpell}) for TrainerId {spell.SpellId} and SpellId {trainerId}, ignoring");
allReqValid = false; allReqValid = false;
@@ -4439,7 +4440,7 @@ namespace Game
} }
void CheckGOSpellId(GameObjectTemplate goInfo, uint dataN, uint N) void CheckGOSpellId(GameObjectTemplate goInfo, uint dataN, uint N)
{ {
if (Global.SpellMgr.HasSpellInfo(dataN)) if (Global.SpellMgr.HasSpellInfo(dataN, Difficulty.None))
return; return;
Log.outError(LogFilter.Sql, "Gameobject (Entry: {0} GoType: {1}) have data{2}={3} but Spell (Entry {4}) not exist.", goInfo.entry, goInfo.type, N, dataN, dataN); Log.outError(LogFilter.Sql, "Gameobject (Entry: {0} GoType: {1}) have data{2}={3} but Spell (Entry {4}) not exist.", goInfo.entry, goInfo.type, N, dataN, dataN);
@@ -5225,7 +5226,7 @@ namespace Game
break; break;
} }
case EncounterCreditType.CastSpell: case EncounterCreditType.CastSpell:
if (!Global.SpellMgr.HasSpellInfo(creditEntry)) if (!Global.SpellMgr.HasSpellInfo(creditEntry, Difficulty.None))
{ {
Log.outError(LogFilter.Sql, "Table `instance_encounters` has an invalid spell (entry {0}) linked to the encounter {1} ({2}), skipped!", Log.outError(LogFilter.Sql, "Table `instance_encounters` has an invalid spell (entry {0}) linked to the encounter {1} ({2}), skipped!",
creditEntry, entry, dungeonEncounter.Name[Global.WorldMgr.GetDefaultDbcLocale()]); creditEntry, entry, dungeonEncounter.Name[Global.WorldMgr.GetDefaultDbcLocale()]);
@@ -6239,9 +6240,9 @@ namespace Game
uint alliance = result.Read<uint>(0); uint alliance = result.Read<uint>(0);
uint horde = result.Read<uint>(1); uint horde = result.Read<uint>(1);
if (!Global.SpellMgr.HasSpellInfo(alliance)) if (!Global.SpellMgr.HasSpellInfo(alliance, Difficulty.None))
Log.outError(LogFilter.Sql, "Spell {0} (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); Log.outError(LogFilter.Sql, "Spell {0} (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
else if (!Global.SpellMgr.HasSpellInfo(horde)) else if (!Global.SpellMgr.HasSpellInfo(horde, Difficulty.None))
Log.outError(LogFilter.Sql, "Spell {0} (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); Log.outError(LogFilter.Sql, "Spell {0} (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
else else
FactionChangeSpells[alliance] = horde; FactionChangeSpells[alliance] = horde;
@@ -6730,7 +6731,7 @@ namespace Game
if (qinfo.SourceSpellID != 0) if (qinfo.SourceSpellID != 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(qinfo.SourceSpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(qinfo.SourceSpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Quest {0} has `SourceSpellid` = {1} but spell {1} doesn't exist, quest can't be done.", Log.outError(LogFilter.Sql, "Quest {0} has `SourceSpellid` = {1} but spell {1} doesn't exist, quest can't be done.",
@@ -6810,7 +6811,7 @@ namespace Game
Log.outError(LogFilter.Sql, "Quest {0} objective {1} has invalid currency amount {2}", qinfo.Id, obj.Id, obj.Amount); Log.outError(LogFilter.Sql, "Quest {0} objective {1} has invalid currency amount {2}", qinfo.Id, obj.Id, obj.Amount);
break; break;
case QuestObjectiveType.LearnSpell: case QuestObjectiveType.LearnSpell:
if (!Global.SpellMgr.HasSpellInfo((uint)obj.ObjectID)) if (!Global.SpellMgr.HasSpellInfo((uint)obj.ObjectID, Difficulty.None))
Log.outError(LogFilter.Sql, "Quest {0} objective {1} has non existing spell id {2}", qinfo.Id, obj.Id, obj.ObjectID); Log.outError(LogFilter.Sql, "Quest {0} objective {1} has non existing spell id {2}", qinfo.Id, obj.Id, obj.ObjectID);
break; break;
case QuestObjectiveType.WinPetBattleAgainstNpc: case QuestObjectiveType.WinPetBattleAgainstNpc:
@@ -6943,7 +6944,7 @@ namespace Game
{ {
if (qinfo.RewardDisplaySpell[i] != 0) if (qinfo.RewardDisplaySpell[i] != 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(qinfo.RewardSpell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(qinfo.RewardSpell, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Quest {0} has `RewardSpell` = {1} but spell {2} does not exist, spell removed as display reward.", Log.outError(LogFilter.Sql, "Quest {0} has `RewardSpell` = {1} but spell {2} does not exist, spell removed as display reward.",
@@ -6961,7 +6962,7 @@ namespace Game
if (qinfo.RewardSpell > 0) if (qinfo.RewardSpell > 0)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(qinfo.RewardSpell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(qinfo.RewardSpell, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Sql, "Quest {0} has `RewardSpellCast` = {1} but spell {2} does not exist, quest will not have a spell reward.", Log.outError(LogFilter.Sql, "Quest {0} has `RewardSpellCast` = {1} but spell {2} does not exist, quest will not have a spell reward.",
@@ -7130,9 +7131,13 @@ namespace Game
} }
// check QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE // check QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
foreach (var spellInfo in Global.SpellMgr.GetSpellInfoStorage().Values) foreach (SpellNameRecord spellNameEntry in CliDB.SpellNameStorage.Values)
{ {
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellNameEntry.Id, Difficulty.None);
if (spellInfo == null)
continue;
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect == null || effect.Effect != SpellEffectName.QuestComplete) if (effect == null || effect.Effect != SpellEffectName.QuestComplete)
continue; continue;
@@ -7736,7 +7741,7 @@ namespace Game
} }
uint spellid = result.Read<uint>(1); uint spellid = result.Read<uint>(1);
SpellInfo spellinfo = Global.SpellMgr.GetSpellInfo(spellid); SpellInfo spellinfo = Global.SpellMgr.GetSpellInfo(spellid, Difficulty.None);
if (spellinfo == null) if (spellinfo == null)
{ {
Log.outError(LogFilter.Sql, "Table npc_spellclick_spells creature: {0} references unknown spellid {1}. Skipping entry.", npc_entry, spellid); Log.outError(LogFilter.Sql, "Table npc_spellclick_spells creature: {0} references unknown spellid {1}. Skipping entry.", npc_entry, spellid);
+12 -12
View File
@@ -75,7 +75,7 @@ namespace Game
if (!pet.IsAlive()) if (!pet.IsAlive())
{ {
SpellInfo spell = (flag == ActiveStates.Enabled || flag == ActiveStates.Passive) ? Global.SpellMgr.GetSpellInfo(spellid) : null; SpellInfo spell = (flag == ActiveStates.Enabled || flag == ActiveStates.Passive) ? Global.SpellMgr.GetSpellInfo(spellid, pet.GetMap().GetDifficultyID()) : null;
if (spell == null) if (spell == null)
return; return;
if (!spell.HasAttribute(SpellAttr0.CastableWhileDead)) if (!spell.HasAttribute(SpellAttr0.CastableWhileDead))
@@ -285,14 +285,14 @@ namespace Game
unit_target = Global.ObjAccessor.GetUnit(GetPlayer(), guid2); unit_target = Global.ObjAccessor.GetUnit(GetPlayer(), guid2);
// do not cast unknown spells // do not cast unknown spells
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellid); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellid, pet.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Network, "WORLD: unknown PET spell id {0}", spellid); Log.outError(LogFilter.Network, "WORLD: unknown PET spell id {0}", spellid);
return; return;
} }
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(Difficulty.None)) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{ {
if (effect != null && (effect.TargetA.GetTarget() == Targets.UnitSrcAreaEnemy || effect.TargetA.GetTarget() == Targets.UnitDestAreaEnemy || effect.TargetA.GetTarget() == Targets.DestDynobjEnemy)) if (effect != null && (effect.TargetA.GetTarget() == Targets.UnitSrcAreaEnemy || effect.TargetA.GetTarget() == Targets.UnitDestAreaEnemy || effect.TargetA.GetTarget() == Targets.DestDynobjEnemy))
return; return;
@@ -484,7 +484,7 @@ namespace Game
//if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
if (!((act_state == ActiveStates.Enabled || act_state == ActiveStates.Disabled || act_state == ActiveStates.Passive) && spell_id != 0 && !pet.HasSpell(spell_id))) if (!((act_state == ActiveStates.Enabled || act_state == ActiveStates.Disabled || act_state == ActiveStates.Passive) && spell_id != 0 && !pet.HasSpell(spell_id)))
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id, pet.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
//sign for autocast //sign for autocast
@@ -607,7 +607,7 @@ namespace Game
return; return;
} }
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(packet.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(packet.SpellID, pet.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Network, "WorldSession.HandlePetSpellAutocast: Unknown spell id {0} used by {1}.", packet.SpellID, packet.PetGUID.ToString()); Log.outError(LogFilter.Network, "WorldSession.HandlePetSpellAutocast: Unknown spell id {0} used by {1}.", packet.SpellID, packet.PetGUID.ToString());
@@ -636,13 +636,6 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.PetCastSpell)] [WorldPacketHandler(ClientOpcodes.PetCastSpell)]
void HandlePetCastSpell(PetCastSpell petCastSpell) void HandlePetCastSpell(PetCastSpell petCastSpell)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(petCastSpell.Cast.SpellID);
if (spellInfo == null)
{
Log.outError(LogFilter.Network, "WorldSession.HandlePetCastSpell: unknown spell id {0} tried to cast by {1}", petCastSpell.Cast.SpellID, petCastSpell.PetGUID.ToString());
return;
}
Unit caster = Global.ObjAccessor.GetUnit(GetPlayer(), petCastSpell.PetGUID); Unit caster = Global.ObjAccessor.GetUnit(GetPlayer(), petCastSpell.PetGUID);
if (!caster) if (!caster)
{ {
@@ -650,6 +643,13 @@ namespace Game
return; return;
} }
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(petCastSpell.Cast.SpellID, caster.GetMap().GetDifficultyID());
if (spellInfo == null)
{
Log.outError(LogFilter.Network, "WorldSession.HandlePetCastSpell: unknown spell id {0} tried to cast by {1}", petCastSpell.Cast.SpellID, petCastSpell.PetGUID.ToString());
return;
}
// This opcode is also sent from charmed and possessed units (players and creatures) // This opcode is also sent from charmed and possessed units (players and creatures)
if (caster != GetPlayer().GetGuardianPet() && caster != GetPlayer().GetCharm()) if (caster != GetPlayer().GetGuardianPet() && caster != GetPlayer().GetCharm())
{ {
+7 -8
View File
@@ -92,7 +92,7 @@ namespace Game
{ {
foreach (ItemEffectRecord effect in item.GetEffects()) foreach (ItemEffectRecord effect in item.GetEffects())
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effect.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)effect.SpellID, user.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
{ {
if (!spellInfo.CanBeUsedInCombat()) if (!spellInfo.CanBeUsedInCombat())
@@ -168,7 +168,7 @@ namespace Game
uint lockId = proto.GetLockID(); uint lockId = proto.GetLockID();
if (lockId != 0) if (lockId != 0)
{ {
LockRecord lockInfo = CliDB.LockStorage.LookupByKey(lockId); LockRecord lockInfo = CliDB.LockStorage.LookupByKey(lockId);
if (lockInfo == null) if (lockInfo == null)
{ {
player.SendEquipError(InventoryResult.ItemLocked, item); player.SendEquipError(InventoryResult.ItemLocked, item);
@@ -274,7 +274,7 @@ namespace Game
if (mover != GetPlayer() && mover.IsTypeId(TypeId.Player)) if (mover != GetPlayer() && mover.IsTypeId(TypeId.Player))
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(cast.Cast.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(cast.Cast.SpellID, mover.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Network, "WORLD: unknown spell id {0}", cast.Cast.SpellID); Log.outError(LogFilter.Network, "WORLD: unknown spell id {0}", cast.Cast.SpellID);
@@ -351,7 +351,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.CancelAura)] [WorldPacketHandler(ClientOpcodes.CancelAura)]
void HandleCancelAura(CancelAura cancelAura) void HandleCancelAura(CancelAura cancelAura)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(cancelAura.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(cancelAura.SpellID, _player.GetMap().GetDifficultyID());
if (spellInfo == null) if (spellInfo == null)
return; return;
@@ -401,14 +401,13 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.PetCancelAura)] [WorldPacketHandler(ClientOpcodes.PetCancelAura)]
void HandlePetCancelAura(PetCancelAura packet) void HandlePetCancelAura(PetCancelAura packet)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(packet.SpellID); if (!Global.SpellMgr.HasSpellInfo(packet.SpellID, Difficulty.None))
if (spellInfo == null)
{ {
Log.outError(LogFilter.Network, "WORLD: unknown PET spell id {0}", packet.SpellID); Log.outError(LogFilter.Network, "WORLD: unknown PET spell id {0}", packet.SpellID);
return; return;
} }
Creature pet= ObjectAccessor.GetCreatureOrPetOrVehicle(_player, packet.PetGUID); Creature pet = ObjectAccessor.GetCreatureOrPetOrVehicle(_player, packet.PetGUID);
if (pet == null) if (pet == null)
{ {
Log.outError(LogFilter.Network, "HandlePetCancelAura: Attempt to cancel an aura for non-existant {0} by player '{1}'", packet.PetGUID.ToString(), GetPlayer().GetName()); Log.outError(LogFilter.Network, "HandlePetCancelAura: Attempt to cancel an aura for non-existant {0} by player '{1}'", packet.PetGUID.ToString(), GetPlayer().GetName());
@@ -480,7 +479,7 @@ namespace Game
if (!selfResSpells.Contains(selfRes.SpellId)) if (!selfResSpells.Contains(selfRes.SpellId))
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(selfRes.SpellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(selfRes.SpellId, _player.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
_player.CastSpell(_player, spellInfo, false, null); _player.CastSpell(_player, spellInfo, false, null);
+1 -1
View File
@@ -67,7 +67,7 @@ namespace Game
if (effect == null) if (effect == null)
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(packet.Cast.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(packet.Cast.SpellID, Difficulty.None);
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Network, "HandleUseToy: unknown spell id: {0} used by Toy Item entry {1}", packet.Cast.SpellID, itemId); Log.outError(LogFilter.Network, "HandleUseToy: unknown spell id: {0} used by Toy Item entry {1}", packet.Cast.SpellID, itemId);
+2 -2
View File
@@ -341,7 +341,7 @@ namespace Game
uint my_spell_id = my_trade.GetSpell(); uint my_spell_id = my_trade.GetSpell();
if (my_spell_id != 0) if (my_spell_id != 0)
{ {
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(my_spell_id); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(my_spell_id, _player.GetMap().GetDifficultyID());
Item castItem = my_trade.GetSpellCastItem(); Item castItem = my_trade.GetSpellCastItem();
if (spellEntry == null || !his_trade.GetItem(TradeSlots.NonTraded) || if (spellEntry == null || !his_trade.GetItem(TradeSlots.NonTraded) ||
@@ -377,7 +377,7 @@ namespace Game
uint his_spell_id = his_trade.GetSpell(); uint his_spell_id = his_trade.GetSpell();
if (his_spell_id != 0) if (his_spell_id != 0)
{ {
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(his_spell_id); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(his_spell_id, trader.GetMap().GetDifficultyID());
Item castItem = his_trade.GetSpellCastItem(); Item castItem = his_trade.GetSpellCastItem();
if (spellEntry == null || !my_trade.GetItem(TradeSlots.NonTraded) || (his_trade.HasSpellCastItem() && !castItem)) if (spellEntry == null || !my_trade.GetItem(TradeSlots.NonTraded) || (his_trade.HasSpellCastItem() && !castItem))
+6 -1
View File
@@ -20,6 +20,7 @@ using Framework.Database;
using Game.Conditions; using Game.Conditions;
using Game.DataStorage; using Game.DataStorage;
using Game.Entities; using Game.Entities;
using Game.Spells;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -378,8 +379,12 @@ namespace Game.Loots
uint count = Spell.LoadAndCollectLootIds(out lootIdSet); uint count = Spell.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot // remove real entries and check existence loot
foreach (var spellInfo in Global.SpellMgr.GetSpellInfoStorage().Values) foreach (SpellNameRecord spellNameEntry in CliDB.SpellNameStorage.Values)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellNameEntry.Id, Difficulty.None);
if (spellInfo == null)
continue;
// possible cases // possible cases
if (!spellInfo.IsLootCrafting()) if (!spellInfo.IsLootCrafting())
continue; continue;
+1 -1
View File
@@ -139,7 +139,7 @@ namespace Game.Network.Packets
} }
public List<HotfixData> Hotfixes = new List<HotfixData>(); public List<HotfixData> Hotfixes = new List<HotfixData>();
public ByteBuffer HotfixContent; public ByteBuffer HotfixContent = new ByteBuffer();
public class HotfixData public class HotfixData
{ {
-67
View File
@@ -335,73 +335,6 @@ namespace Game.Scripting
public void FillSpellSummary() public void FillSpellSummary()
{ {
UnitAI.FillAISpellInfo(); UnitAI.FillAISpellInfo();
SpellInfo pTempSpell;
var spellStorage = Global.SpellMgr.GetSpellInfoStorage();
foreach (var i in spellStorage.Keys)
{
spellSummaryStorage[i] = new SpellSummary();
pTempSpell = spellStorage.LookupByKey(i);
// This spell doesn't exist.
if (pTempSpell == null)
continue;
foreach (SpellEffectInfo effect in pTempSpell.GetEffectsForDifficulty(Difficulty.None))
{
if (effect == null)
continue;
// Spell targets self.
if (effect.TargetA.GetTarget() == Targets.UnitCaster)
spellSummaryStorage[i].Targets |= 1 << ((int)SelectTargetType.Self - 1);
// Spell targets a single enemy.
if (effect.TargetA.GetTarget() == Targets.UnitEnemy || effect.TargetA.GetTarget() == Targets.DestEnemy)
spellSummaryStorage[i].Targets |= 1 << ((int)SelectTargetType.SingleEnemy - 1);
// Spell targets AoE at enemy.
if (effect.TargetA.GetTarget() == Targets.UnitSrcAreaEnemy || effect.TargetA.GetTarget() == Targets.UnitDestAreaEnemy ||
effect.TargetA.GetTarget() == Targets.SrcCaster || effect.TargetA.GetTarget() == Targets.DestDynobjEnemy)
spellSummaryStorage[i].Targets |= 1 << ((int)SelectTargetType.AoeEnemy - 1);
// Spell targets an enemy.
if (effect.TargetA.GetTarget() == Targets.UnitEnemy || effect.TargetA.GetTarget() == Targets.DestEnemy ||
effect.TargetA.GetTarget() == Targets.UnitSrcAreaEnemy || effect.TargetA.GetTarget() == Targets.UnitDestAreaEnemy ||
effect.TargetA.GetTarget() == Targets.SrcCaster || effect.TargetA.GetTarget() == Targets.DestDynobjEnemy)
spellSummaryStorage[i].Targets |= 1 << ((int)SelectTargetType.AnyEnemy - 1);
// Spell targets a single friend (or self).
if (effect.TargetA.GetTarget() == Targets.UnitCaster || effect.TargetA.GetTarget() == Targets.UnitAlly ||
effect.TargetA.GetTarget() == Targets.UnitParty)
spellSummaryStorage[i].Targets |= 1 << ((int)SelectTargetType.SingleFriend - 1);
// Spell targets AoE friends.
if (effect.TargetA.GetTarget() == Targets.UnitCasterAreaParty || effect.TargetA.GetTarget() == Targets.UnitLastAreaParty ||
effect.TargetA.GetTarget() == Targets.SrcCaster)
spellSummaryStorage[i].Targets |= 1 << ((int)SelectTargetType.AoeFriend - 1);
// Spell targets any friend (or self).
if (effect.TargetA.GetTarget() == Targets.UnitCaster || effect.TargetA.GetTarget() == Targets.UnitAlly ||
effect.TargetA.GetTarget() == Targets.UnitParty || effect.TargetA.GetTarget() == Targets.UnitCasterAreaParty ||
effect.TargetA.GetTarget() == Targets.UnitLastAreaParty || effect.TargetA.GetTarget() == Targets.SrcCaster)
spellSummaryStorage[i].Targets |= 1 << ((int)SelectTargetType.AnyFriend - 1);
// Make sure that this spell includes a damage effect.
if (effect.Effect == SpellEffectName.SchoolDamage || effect.Effect == SpellEffectName.Instakill ||
effect.Effect == SpellEffectName.EnvironmentalDamage || effect.Effect == SpellEffectName.HealthLeech)
spellSummaryStorage[i].Effects |= 1 << ((int)SelectEffect.Damage - 1);
// Make sure that this spell includes a healing effect (or an apply aura with a periodic heal).
if (effect.Effect == SpellEffectName.Heal || effect.Effect == SpellEffectName.HealMaxHealth ||
effect.Effect == SpellEffectName.HealMechanical || (effect.Effect == SpellEffectName.ApplyAura && effect.ApplyAuraName == AuraType.PeriodicHeal))
spellSummaryStorage[i].Effects |= 1 << ((int)SelectEffect.Healing - 1);
// Make sure that this spell applies an aura.
if (effect.Effect == SpellEffectName.ApplyAura)
spellSummaryStorage[i].Effects |= 1 << ((int)SelectEffect.Aura - 1);
}
}
} }
public List<SplineChainLink> GetSplineChain(Creature who, ushort chainId) public List<SplineChainLink> GetSplineChain(Creature who, ushort chainId)
+9 -3
View File
@@ -48,7 +48,7 @@ namespace Game.Scripting
bool allValid = true; bool allValid = true;
foreach (uint spellId in spellIds) foreach (uint spellId in spellIds)
{ {
if (!Global.SpellMgr.HasSpellInfo(spellId)) if (!Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
{ {
Log.outError(LogFilter.Scripts, "BaseSpellScript.ValidateSpellInfo: Spell {0} does not exist.", spellId); Log.outError(LogFilter.Scripts, "BaseSpellScript.ValidateSpellInfo: Spell {0} does not exist.", spellId);
allValid = false; allValid = false;
@@ -494,11 +494,12 @@ namespace Game.Scripting
public Unit GetCaster() { return m_spell.GetCaster(); } public Unit GetCaster() { return m_spell.GetCaster(); }
public Unit GetOriginalCaster() { return m_spell.GetOriginalCaster(); } public Unit GetOriginalCaster() { return m_spell.GetOriginalCaster(); }
public SpellInfo GetSpellInfo() { return m_spell.GetSpellInfo(); } public SpellInfo GetSpellInfo() { return m_spell.GetSpellInfo(); }
public Difficulty GetCastDifficulty() { return m_spell.GetCastDifficulty(); }
public SpellValue GetSpellValue() { return m_spell.m_spellValue; } public SpellValue GetSpellValue() { return m_spell.m_spellValue; }
public SpellEffectInfo GetEffectInfo(uint effIndex) public SpellEffectInfo GetEffectInfo(uint effIndex)
{ {
return m_spell.GetEffect(effIndex); return GetSpellInfo().GetEffect(effIndex);
} }
// methods useable after spell is prepared // methods useable after spell is prepared
@@ -773,7 +774,7 @@ namespace Game.Scripting
public delegate void AuraEffectAbsorbDelegate(AuraEffect aura, DamageInfo damageInfo, ref uint absorbAmount); public delegate void AuraEffectAbsorbDelegate(AuraEffect aura, DamageInfo damageInfo, ref uint absorbAmount);
public delegate void AuraEffectSplitDelegate(AuraEffect aura, DamageInfo damageInfo, uint splitAmount); public delegate void AuraEffectSplitDelegate(AuraEffect aura, DamageInfo damageInfo, uint splitAmount);
public delegate bool AuraCheckProcDelegate(ProcEventInfo info); public delegate bool AuraCheckProcDelegate(ProcEventInfo info);
public delegate bool AuraCheckEffectProcDelegate(AuraEffect aura , ProcEventInfo info); public delegate bool AuraCheckEffectProcDelegate(AuraEffect aura, ProcEventInfo info);
public delegate void AuraProcDelegate(ProcEventInfo info); public delegate void AuraProcDelegate(ProcEventInfo info);
public delegate void AuraEffectProcDelegate(AuraEffect aura, ProcEventInfo info); public delegate void AuraEffectProcDelegate(AuraEffect aura, ProcEventInfo info);
@@ -1422,5 +1423,10 @@ namespace Game.Scripting
} }
// returns AuraApplication object of currently processed target // returns AuraApplication object of currently processed target
public AuraApplication GetTargetApplication() { return m_auraApplication; } public AuraApplication GetTargetApplication() { return m_auraApplication; }
public Difficulty GetCastDifficulty()
{
return GetAura().GetCastDifficulty();
}
} }
} }
+38 -49
View File
@@ -123,7 +123,7 @@ namespace Game.Spells
if (IsSelfcasted() || caster == null || !caster.IsFriendlyTo(GetTarget())) if (IsSelfcasted() || caster == null || !caster.IsFriendlyTo(GetTarget()))
{ {
bool negativeFound = false; 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))) if (effect != null && (Convert.ToBoolean((1 << (int)effect.EffectIndex) & effMask) && !GetBase().GetSpellInfo().IsPositiveEffect(effect.EffectIndex)))
{ {
@@ -138,7 +138,7 @@ namespace Game.Spells
else else
{ {
bool positiveFound = false; 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))) 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; 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_spellInfo = spellproto;
m_castDifficulty = castDifficulty;
m_castGuid = castId; m_castGuid = castId;
m_casterGuid = !casterGUID.IsEmpty() ? casterGUID : caster.GetGUID(); m_casterGuid = !casterGUID.IsEmpty() ? casterGUID : caster.GetGUID();
m_castItemGuid = castItem != null ? castItem.GetGUID() : castItemGuid; m_castItemGuid = castItem != null ? castItem.GetGUID() : castItemGuid;
@@ -306,9 +307,8 @@ namespace Game.Spells
m_lastProcAttemptTime = (DateTime.Now - TimeSpan.FromSeconds(10)); m_lastProcAttemptTime = (DateTime.Now - TimeSpan.FromSeconds(10));
m_lastProcSuccessTime = (DateTime.Now - TimeSpan.FromSeconds(120)); m_lastProcSuccessTime = (DateTime.Now - TimeSpan.FromSeconds(120));
var powers = Global.DB2Mgr.GetSpellPowers(GetId(), caster ? caster.GetMap().GetDifficultyID() : Difficulty.None); foreach (SpellPowerRecord power in m_spellInfo.PowerCosts)
foreach (var power in powers) if (power != null && (power.ManaPerSecond != 0 || power.PowerPctPerSecond > 0.0f))
if (power.ManaPerSecond != 0 || power.PowerPctPerSecond > 0.0f)
m_periodicCosts.Add(power); m_periodicCosts.Add(power);
if (!m_periodicCosts.Empty()) if (!m_periodicCosts.Empty())
@@ -337,11 +337,9 @@ namespace Game.Spells
public void _InitEffects(uint effMask, Unit caster, int[] baseAmount) public void _InitEffects(uint effMask, Unit caster, int[] baseAmount)
{ {
// shouldn't be in constructor - functions in AuraEffect.AuraEffect use polymorphism // 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 GetSpellInfo().GetEffects())
foreach (SpellEffectInfo effect in GetSpellEffectInfos())
{ {
if (effect != null && Convert.ToBoolean(effMask & (1 << (int)effect.EffectIndex))) 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); _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) public bool HasMoreThanOneEffectForType(AuraType auraType)
{ {
uint count = 0; uint count = 0;
foreach (SpellEffectInfo effect in GetSpellEffectInfos()) foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
{ {
if (effect != null && HasEffect(effect.EffectIndex) && effect.ApplyAuraName == auraType) if (effect != null && HasEffect(effect.EffectIndex) && effect.ApplyAuraName == auraType)
++count; ++count;
@@ -908,7 +906,7 @@ namespace Game.Spells
public bool IsArea() public bool IsArea()
{ {
foreach (SpellEffectInfo effect in GetSpellEffectInfos()) foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
{ {
if (effect != null && HasEffect(effect.EffectIndex) && effect.IsAreaAuraEffect()) if (effect != null && HasEffect(effect.EffectIndex) && effect.IsAreaAuraEffect())
return true; return true;
@@ -1287,7 +1285,7 @@ namespace Game.Spells
// check cooldown // check cooldown
if (caster.IsTypeId(TypeId.Player)) 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 // 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 // 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()))) if (IsPassive() && sameCaster && (m_spellInfo.IsDifferentRankOf(existingSpellInfo) || (m_spellInfo.Id == existingSpellInfo.Id && m_castItemGuid.IsEmpty())))
return false; return false;
foreach (SpellEffectInfo effect in existingAura.GetSpellEffectInfos()) foreach (SpellEffectInfo effect in existingSpellInfo.GetEffects())
{ {
// prevent remove triggering aura by triggered aura // prevent remove triggering aura by triggered aura
if (effect != null && effect.TriggerSpell == GetId()) if (effect != null && effect.TriggerSpell == GetId())
return true; return true;
} }
foreach (SpellEffectInfo effect in GetSpellEffectInfos()) foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
{ {
// prevent remove triggered aura by triggering aura refresh // prevent remove triggered aura by triggering aura refresh
if (effect != null && effect.TriggerSpell == existingAura.GetId()) if (effect != null && effect.TriggerSpell == existingAura.GetId())
@@ -1552,7 +1550,7 @@ namespace Game.Spells
// check same periodic auras // check same periodic auras
for (byte i = 0; i < SpellConst.MaxEffects; i++) for (byte i = 0; i < SpellConst.MaxEffects; i++)
{ {
SpellEffectInfo effect = GetSpellEffectInfo(i); SpellEffectInfo effect = m_spellInfo.GetEffect(i);
if (effect == null) if (effect == null)
continue; continue;
@@ -1570,7 +1568,7 @@ namespace Game.Spells
case AuraType.ObsModPower: case AuraType.ObsModPower:
case AuraType.ObsModHealth: case AuraType.ObsModHealth:
case AuraType.PeriodicTriggerSpellWithValue: 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) // periodic auras which target areas are not allowed to stack this way (replenishment for example)
if (effect.IsTargetingArea() || (existingEffect != null && existingEffect.IsTargetingArea())) if (effect.IsTargetingArea() || (existingEffect != null && existingEffect.IsTargetingArea()))
break; break;
@@ -1639,7 +1637,7 @@ namespace Game.Spells
SetNeedClientUpdateForTargets(); SetNeedClientUpdateForTargets();
} }
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetId()); SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
Cypher.Assert(procEntry != null); Cypher.Assert(procEntry != null);
@@ -1651,7 +1649,7 @@ namespace Game.Spells
public uint GetProcEffectMask(AuraApplication aurApp, ProcEventInfo eventInfo, DateTime now) 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 // only auras with spell proc entry can trigger proc
if (procEntry == null) if (procEntry == null)
return 0; return 0;
@@ -1671,7 +1669,7 @@ namespace Game.Spells
} }
// check don't break stealth attr present // 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(); SpellInfo eventSpellInfo = eventInfo.GetSpellInfo();
if (eventSpellInfo != null) if (eventSpellInfo != null)
@@ -2240,6 +2238,7 @@ namespace Game.Spells
public SpellInfo GetSpellInfo() { return m_spellInfo; } public SpellInfo GetSpellInfo() { return m_spellInfo; }
public uint GetId() { return m_spellInfo.Id; } public uint GetId() { return m_spellInfo.Id; }
public Difficulty GetCastDifficulty() { return m_castDifficulty; }
public ObjectGuid GetCastGUID() { return m_castGuid; } public ObjectGuid GetCastGUID() { return m_castGuid; }
public ObjectGuid GetCasterGUID() { return m_casterGuid; } public ObjectGuid GetCasterGUID() { return m_casterGuid; }
public ObjectGuid GetCastItemGUID() { return m_castItemGuid; } public ObjectGuid GetCastItemGUID() { return m_castItemGuid; }
@@ -2297,7 +2296,7 @@ namespace Game.Spells
byte CalcMaxCharges(Unit caster) byte CalcMaxCharges(Unit caster)
{ {
uint maxProcCharges = m_spellInfo.ProcCharges; uint maxProcCharges = m_spellInfo.ProcCharges;
var procEntry = Global.SpellMgr.GetSpellProcEntry(GetId()); var procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
if (procEntry != null) if (procEntry != null)
maxProcCharges = procEntry.Charges; maxProcCharges = procEntry.Charges;
@@ -2357,15 +2356,6 @@ namespace Game.Spells
public AuraEffect[] GetAuraEffects() { return _effects; } 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 SetLastProcAttemptTime(DateTime lastProcAttemptTime) { m_lastProcAttemptTime = lastProcAttemptTime; }
public void SetLastProcSuccessTime(DateTime lastProcSuccessTime) { m_lastProcSuccessTime = lastProcSuccessTime; } public void SetLastProcSuccessTime(DateTime lastProcSuccessTime) { m_lastProcSuccessTime = lastProcSuccessTime; }
@@ -2379,14 +2369,14 @@ namespace Game.Spells
{ {
case TypeId.Unit: case TypeId.Unit:
case TypeId.Player: case TypeId.Player:
foreach (SpellEffectInfo effect in spellProto.GetEffectsForDifficulty(owner.GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellProto.GetEffects())
{ {
if (effect != null && effect.IsUnitOwnedAuraEffect()) if (effect != null && effect.IsUnitOwnedAuraEffect())
effMask |= (uint)(1 << (int)effect.EffectIndex); effMask |= (uint)(1 << (int)effect.EffectIndex);
} }
break; break;
case TypeId.DynamicObject: 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) if (effect != null && effect.Effect == SpellEffectName.PersistentAreaAura)
effMask |= (uint)(1 << (int)effect.EffectIndex); effMask |= (uint)(1 << (int)effect.EffectIndex);
@@ -2397,12 +2387,11 @@ namespace Game.Spells
} }
return (effMask & availableEffectMask); 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, castDifficulty, out _, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, castItemId, castItemLevel);
return TryRefreshStackOrCreate(spellproto, castId, tryEffMask, owner, caster, out throwway, 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(spellproto != null);
Cypher.Assert(owner != null); Cypher.Assert(owner != null);
@@ -2425,9 +2414,9 @@ namespace Game.Spells
return foundAura; return foundAura;
} }
else 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(spellproto != null);
Cypher.Assert(owner != null); Cypher.Assert(owner != null);
@@ -2436,9 +2425,9 @@ namespace Game.Spells
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner); uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
if (effMask == 0) if (effMask == 0)
return null; 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(effMask != 0);
Cypher.Assert(spellproto != null); Cypher.Assert(spellproto != null);
@@ -2468,10 +2457,10 @@ namespace Game.Spells
{ {
case TypeId.Unit: case TypeId.Unit:
case TypeId.Player: 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; break;
case TypeId.DynamicObject: 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; break;
default: default:
Cypher.Assert(false); Cypher.Assert(false);
@@ -2486,6 +2475,7 @@ namespace Game.Spells
#region Fields #region Fields
List<AuraScript> m_loadedScripts = new List<AuraScript>(); List<AuraScript> m_loadedScripts = new List<AuraScript>();
SpellInfo m_spellInfo; SpellInfo m_spellInfo;
Difficulty m_castDifficulty;
ObjectGuid m_castGuid; ObjectGuid m_castGuid;
ObjectGuid m_casterGuid; ObjectGuid m_casterGuid;
ObjectGuid m_castItemGuid; ObjectGuid m_castItemGuid;
@@ -2506,7 +2496,6 @@ namespace Game.Spells
byte m_stackAmount; // Aura stack amount byte m_stackAmount; // Aura stack amount
//might need to be arrays still //might need to be arrays still
SpellEffectInfo[] _spellEffectInfos;
AuraEffect[] _effects; AuraEffect[] _effects;
Dictionary<ObjectGuid, AuraApplication> m_applications = new Dictionary<ObjectGuid, AuraApplication>(); Dictionary<ObjectGuid, AuraApplication> m_applications = new Dictionary<ObjectGuid, AuraApplication>();
@@ -2526,8 +2515,8 @@ namespace Game.Spells
public class UnitAura : Aura 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) 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, castItem, casterGUID, castItemGuid, castItemId, castItemLevel) : base(spellproto, castId, owner, caster, castDifficulty, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
{ {
m_AuraDRGroup = DiminishingGroup.None; m_AuraDRGroup = DiminishingGroup.None;
LoadScripts(); LoadScripts();
@@ -2560,7 +2549,7 @@ namespace Game.Spells
public override void FillTargetMap(ref Dictionary<Unit, uint> targets, Unit caster) 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)) if (effect == null || !HasEffect(effect.EffectIndex))
continue; continue;
@@ -2637,8 +2626,8 @@ namespace Game.Spells
public class DynObjAura : Aura 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) 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, castItem, casterGUID, castItemGuid, castItemId, castItemLevel) : base(spellproto, castId, owner, caster, castDifficulty, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
{ {
LoadScripts(); LoadScripts();
Cypher.Assert(GetDynobjOwner() != null); Cypher.Assert(GetDynobjOwner() != null);
@@ -2661,7 +2650,7 @@ namespace Game.Spells
Unit dynObjOwnerCaster = GetDynobjOwner().GetCaster(); Unit dynObjOwnerCaster = GetDynobjOwner().GetCaster();
float radius = GetDynobjOwner().GetRadius(); float radius = GetDynobjOwner().GetRadius();
foreach (SpellEffectInfo effect in GetSpellEffectInfos()) foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
{ {
if (effect == null || !HasEffect(effect.EffectIndex)) if (effect == null || !HasEffect(effect.EffectIndex))
continue; continue;
+28 -28
View File
@@ -32,14 +32,14 @@ namespace Game.Spells
{ {
public class AuraEffect 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; auraBase = baseAura;
m_spellInfo = baseAura.GetSpellInfo(); 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_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_donePct = 1.0f;
m_effIndex = (byte)effindex; m_effIndex = (byte)effIndex;
m_canBeRecalculated = true; m_canBeRecalculated = true;
m_isPeriodic = false; m_isPeriodic = false;
@@ -683,7 +683,7 @@ namespace Game.Spells
{ {
// Don't proc extra attacks while already processing extra attack spell // Don't proc extra attacks while already processing extra attack spell
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell; uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId); SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
if (triggeredSpellInfo != null) if (triggeredSpellInfo != null)
if (aurApp.GetTarget().ExtraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks)) if (aurApp.GetTarget().ExtraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
return false; return false;
@@ -818,7 +818,7 @@ namespace Game.Spells
if (pair.Key == spellId || pair.Key == spellId2 || pair.Key == spellId3 || pair.Key == spellId4) if (pair.Key == spellId || pair.Key == spellId2 || pair.Key == spellId3 || pair.Key == spellId4)
continue; 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))) if (spellInfo == null || !(spellInfo.IsPassive() || spellInfo.HasAttribute(SpellAttr0.HiddenClientside)))
continue; continue;
@@ -1340,7 +1340,7 @@ namespace Game.Spells
if (modelid > 0) if (modelid > 0)
{ {
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm()); SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm(), GetBase().GetCastDifficulty());
if (transformSpellInfo == null || !GetSpellInfo().IsPositive()) if (transformSpellInfo == null || !GetSpellInfo().IsPositive())
target.SetDisplayId(modelid); target.SetDisplayId(modelid);
} }
@@ -1438,7 +1438,7 @@ namespace Game.Spells
if (apply) if (apply)
{ {
// update active transform spell only when transform not set or not overwriting negative by positive case // 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()) if (transformSpellInfo == null || !GetSpellInfo().IsPositive() || transformSpellInfo.IsPositive())
{ {
target.SetTransForm(GetId()); target.SetTransForm(GetId());
@@ -2168,7 +2168,7 @@ namespace Game.Spells
} }
//some spell has one aura of mount and one of vehicle //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()) if (effect != null && GetSpellEffectInfo().Effect == SpellEffectName.Summon && effect.MiscValue == GetMiscValue())
displayId = 0; displayId = 0;
} }
@@ -4464,10 +4464,10 @@ namespace Game.Spells
uint spellId = 24659; uint spellId = 24659;
if (apply && caster != null) 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) 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; break;
} }
target.RemoveAurasDueToSpell(spellId); target.RemoveAurasDueToSpell(spellId);
@@ -4479,9 +4479,9 @@ namespace Game.Spells
uint spellId = 24662; uint spellId = 24662;
if (apply && caster != null) 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) 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; break;
} }
target.RemoveAurasDueToSpell(spellId); target.RemoveAurasDueToSpell(spellId);
@@ -4720,11 +4720,11 @@ namespace Game.Spells
Unit target = aurApp.GetTarget(); Unit target = aurApp.GetTarget();
uint triggeredSpellId = GetSpellEffectInfo().TriggerSpell; uint triggeredSpellId = GetSpellEffectInfo().TriggerSpell;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggeredSpellId); SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggeredSpellId, GetBase().GetCastDifficulty());
if (triggeredSpellInfo == null) if (triggeredSpellInfo == null)
return; return;
Unit caster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, target.GetMap().GetDifficultyID()) ? GetCaster() : target; Unit caster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCaster() : target;
if (!caster) if (!caster)
return; return;
@@ -4740,13 +4740,13 @@ namespace Game.Spells
} }
else 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()); target.RemoveAura(triggeredSpellId, casterGUID, 0, aurApp.GetRemoveMode());
} }
} }
else if (mode.HasAnyFlag(AuraEffectHandleModes.Reapply) && apply) 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 // change the stack amount to be equal to stack amount of our aura
Aura triggeredAura = target.GetAura(triggeredSpellId, casterGUID); Aura triggeredAura = target.GetAura(triggeredSpellId, casterGUID);
if (triggeredAura != null) if (triggeredAura != null)
@@ -5054,7 +5054,7 @@ namespace Game.Spells
// generic casting code with custom spells and target/caster customs // generic casting code with custom spells and target/caster customs
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell; uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId); SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
SpellInfo auraSpellInfo = GetSpellInfo(); SpellInfo auraSpellInfo = GetSpellInfo();
uint auraId = auraSpellInfo.Id; uint auraId = auraSpellInfo.Id;
@@ -5320,11 +5320,11 @@ namespace Game.Spells
} }
// Reget trigger spell proto // Reget trigger spell proto
triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId); triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
if (triggeredSpellInfo != null) 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) if (triggerCaster != null)
{ {
triggerCaster.CastSpell(target, triggeredSpellInfo, true, null, this); triggerCaster.CastSpell(target, triggeredSpellInfo, true, null, this);
@@ -5338,10 +5338,10 @@ namespace Game.Spells
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit target, Unit caster) void HandlePeriodicTriggerSpellWithValueAuraTick(Unit target, Unit caster)
{ {
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell; uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId); SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
if (triggeredSpellInfo != null) 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) if (triggerCaster != null)
{ {
int basepoints = GetAmount(); int basepoints = GetAmount();
@@ -5571,7 +5571,7 @@ namespace Game.Spells
uint resist = damageInfo.GetResist(); uint resist = damageInfo.GetResist();
// SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage // 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.damage = damage;
log.originalDamage = dmg; log.originalDamage = dmg;
log.absorb = absorb; log.absorb = absorb;
@@ -5876,7 +5876,7 @@ namespace Game.Spells
SpellInfo spellProto = GetSpellInfo(); SpellInfo spellProto = GetSpellInfo();
// maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG // 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 // no SpellDamageBonus for burn mana
caster.CalculateSpellDamageTaken(damageInfo, (int)(gain * dmgMultiplier), spellProto); caster.CalculateSpellDamageTaken(damageInfo, (int)(gain * dmgMultiplier), spellProto);
@@ -5917,7 +5917,7 @@ namespace Game.Spells
Unit triggerTarget = eventInfo.GetProcTarget(); Unit triggerTarget = eventInfo.GetProcTarget();
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell; uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId); SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
if (triggeredSpellInfo != null) if (triggeredSpellInfo != null)
{ {
Log.outDebug(LogFilter.Spells, "AuraEffect.HandleProcTriggerSpellAuraProc: Triggering spell {0} from aura {1} proc", triggeredSpellInfo.Id, GetId()); 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(); Unit triggerTarget = eventInfo.GetProcTarget();
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell; uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId); SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
if (triggeredSpellInfo != null) if (triggeredSpellInfo != null)
{ {
int basepoints0 = GetAmount(); int basepoints0 = GetAmount();
@@ -5954,7 +5954,7 @@ namespace Game.Spells
return; 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()); int damage = (int)target.SpellDamageBonusDone(triggerTarget, GetSpellInfo(), (uint)GetAmount(), DamageEffectType.SpellDirect, GetSpellEffectInfo());
damage = (int)triggerTarget.SpellDamageBonusTaken(target, GetSpellInfo(), (uint)damage, DamageEffectType.SpellDirect, GetSpellEffectInfo()); damage = (int)triggerTarget.SpellDamageBonusTaken(target, GetSpellInfo(), (uint)damage, DamageEffectType.SpellDirect, GetSpellEffectInfo());
target.CalculateSpellDamageTaken(damageInfo, damage, GetSpellInfo()); target.CalculateSpellDamageTaken(damageInfo, damage, GetSpellInfo());
@@ -6128,7 +6128,7 @@ namespace Game.Spells
return; return;
Unit target = aurApp.GetTarget(); Unit target = aurApp.GetTarget();
SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(GetSpellEffectInfo().TriggerSpell); SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(GetSpellEffectInfo().TriggerSpell, GetBase().GetCastDifficulty());
if (triggerSpellInfo == null) if (triggerSpellInfo == null)
return; return;
@@ -6139,7 +6139,7 @@ namespace Game.Spells
else else
{ {
List<uint> summonedEntries = new List<uint>(); 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) if (spellEffect != null && spellEffect.Effect == SpellEffectName.Summon)
{ {
+7 -2
View File
@@ -17,6 +17,7 @@
using Framework.Constants; using Framework.Constants;
using Framework.Database; using Framework.Database;
using Game.DataStorage;
using Game.Entities; using Game.Entities;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -62,7 +63,7 @@ namespace Game.Spells
if (reqSkillOrSpell > 0) // spell case if (reqSkillOrSpell > 0) // spell case
{ {
uint absReqSkillOrSpell = (uint)reqSkillOrSpell; uint absReqSkillOrSpell = (uint)reqSkillOrSpell;
SpellInfo reqSpellInfo = Global.SpellMgr.GetSpellInfo(absReqSkillOrSpell); SpellInfo reqSpellInfo = Global.SpellMgr.GetSpellInfo(absReqSkillOrSpell, Difficulty.None);
if (reqSpellInfo == null) if (reqSpellInfo == null)
{ {
if (!reportedReqSpells.Contains(absReqSkillOrSpell)) 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()); 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 // 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 // skip not explicit discovery spells
if (!spellEntry.IsExplicitDiscovery()) if (!spellEntry.IsExplicitDiscovery())
continue; continue;
+4 -4
View File
@@ -44,14 +44,14 @@ namespace Game.Spells
{ {
uint spellId = result.Read<uint>(0); 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); Log.outError(LogFilter.Sql, "Skill specialization {0} has non-existent spell id in `skill_extra_item_template`!", spellId);
continue; continue;
} }
uint requiredSpecialization = result.Read<uint>(1); 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); Log.outError(LogFilter.Sql, "Skill specialization {0} have not existed required specialization spell id {1} in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue; continue;
@@ -144,14 +144,14 @@ namespace Game.Spells
do do
{ {
uint spellId = result.Read<uint>(0); 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); Log.outError(LogFilter.Sql, "Skill perfection data for spell {0} has non-existent spell id in `skill_perfect_item_template`!", spellId);
continue; continue;
} }
uint requiredSpecialization = result.Read<uint>(1); 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); 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; continue;
+65 -85
View File
@@ -40,10 +40,9 @@ namespace Game.Spells
{ {
m_spellInfo = info; m_spellInfo = info;
m_caster = (info.HasAttribute(SpellAttr6.CastByCharmer) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster); 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_preGeneratedPath = new PathGenerator(m_caster);
m_castItemLevel = -1; 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_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); m_SpellVisual = caster.GetCastSpellXSpellVisualId(m_spellInfo);
@@ -235,7 +234,7 @@ namespace Game.Spells
SelectExplicitTargets(); SelectExplicitTargets();
uint processedAreaEffectsMask = 0; uint processedAreaEffectsMask = 0;
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -330,11 +329,11 @@ namespace Game.Spells
// targets for effect already selected // targets for effect already selected
if (Convert.ToBoolean(effectMask & processedEffectMask)) if (Convert.ToBoolean(effectMask & processedEffectMask))
return; return;
SpellEffectInfo _effect = GetEffect(effIndex); SpellEffectInfo _effect = m_spellInfo.GetEffect(effIndex);
if (_effect != null) if (_effect != null)
{ {
// choose which targets we can select at once // 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) if (effect == null || effect.EffectIndex <= effIndex)
continue; continue;
@@ -509,7 +508,7 @@ namespace Game.Spells
return; return;
} }
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null) if (effect == null)
return; return;
@@ -644,7 +643,7 @@ namespace Game.Spells
List<WorldObject> targets = new List<WorldObject>(); List<WorldObject> targets = new List<WorldObject>();
SpellTargetObjectTypes objectType = targetType.GetObjectType(); SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType(); SpellTargetCheckTypes selectionType = targetType.GetCheckType();
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null) if (effect == null)
return; return;
@@ -732,7 +731,7 @@ namespace Game.Spells
return; return;
} }
List<WorldObject> targets = new List<WorldObject>(); List<WorldObject> targets = new List<WorldObject>();
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null) if (effect == null)
return; return;
@@ -830,7 +829,7 @@ namespace Game.Spells
break; break;
} }
default: default:
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect != null) if (effect != null)
{ {
float dist = effect.CalcRadius(m_caster); float dist = effect.CalcRadius(m_caster);
@@ -882,11 +881,11 @@ namespace Game.Spells
switch (targetType.GetTarget()) switch (targetType.GetTarget())
{ {
case Targets.DestEnemy: case Targets.DestTargetEnemy:
case Targets.DestAny: case Targets.DestAny:
break; break;
default: default:
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect != null) if (effect != null)
{ {
float angle = targetType.CalcDirectionAngle(); float angle = targetType.CalcDirectionAngle();
@@ -927,7 +926,7 @@ namespace Game.Spells
case Targets.DestDest: case Targets.DestDest:
return; return;
default: default:
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect != null) if (effect != null)
{ {
float angle = targetType.CalcDirectionAngle(); float angle = targetType.CalcDirectionAngle();
@@ -1018,7 +1017,7 @@ namespace Game.Spells
void SelectImplicitChainTargets(uint effIndex, SpellImplicitTargetInfo targetType, WorldObject target, uint effMask) void SelectImplicitChainTargets(uint effIndex, SpellImplicitTargetInfo targetType, WorldObject target, uint effMask)
{ {
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null) if (effect == null)
return; return;
@@ -1030,7 +1029,7 @@ namespace Game.Spells
if (maxTargets > 1) if (maxTargets > 1)
{ {
// mark damage multipliers as used // 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))) if (eff != null && Convert.ToBoolean(effMask & (1 << (int)eff.EffectIndex)))
m_damageMultipliers[eff.EffectIndex] = 1.0f; m_damageMultipliers[eff.EffectIndex] = 1.0f;
m_applyMultiplierMask |= (byte)effMask; 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) // 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 // limit max range to 300 yards, sometimes triggered spells can have 50000yds
float bestDist = m_spellInfo.GetMaxRange(false); float bestDist = m_spellInfo.GetMaxRange(false);
SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell); SpellInfo triggerSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, GetCastDifficulty());
if (triggerSpellInfo != null) if (triggerSpellInfo != null)
bestDist = Math.Min(Math.Max(bestDist, triggerSpellInfo.GetMaxRange(false)), Math.Min(dist2d, 300.0f)); 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 // 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 // @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) if (effect == null)
return; return;
switch (effect.Effect) 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) void AddUnitTarget(Unit target, uint effectMask, bool checkIfValid = true, bool Implicit = true, Position losPosition = null)
{ {
uint validEffectMask = 0; 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)) if (effect != null && (effectMask & (1 << (int)effect.EffectIndex)) != 0 && CheckEffectTarget(target, effect, losPosition))
validEffectMask |= 1u << (int)effect.EffectIndex; validEffectMask |= 1u << (int)effect.EffectIndex;
@@ -1520,7 +1519,7 @@ namespace Game.Spells
return; return;
// Check for effect immune skip if immuned // 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)) if (effect != null && target.IsImmunedToSpellEffect(m_spellInfo, effect.EffectIndex, m_caster))
effectMask &= ~(uint)(1 << (int)effect.EffectIndex); effectMask &= ~(uint)(1 << (int)effect.EffectIndex);
@@ -1603,7 +1602,7 @@ namespace Game.Spells
void AddGOTarget(GameObject go, uint effectMask) void AddGOTarget(GameObject go, uint effectMask)
{ {
uint validEffectMask = 0; 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)) if (effect != null && (effectMask & (1 << (int)effect.EffectIndex)) != 0 && CheckEffectTarget(go, effect))
validEffectMask |= (uint)(1 << (int)effect.EffectIndex); validEffectMask |= (uint)(1 << (int)effect.EffectIndex);
@@ -1660,7 +1659,7 @@ namespace Game.Spells
void AddItemTarget(Item item, uint effectMask) void AddItemTarget(Item item, uint effectMask)
{ {
uint validEffectMask = 0; 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)) if (effect != null && (effectMask & (1 << (int)effect.EffectIndex)) != 0 && CheckEffectTarget(item, effect))
validEffectMask |= 1u << (int)effect.EffectIndex; validEffectMask |= 1u << (int)effect.EffectIndex;
@@ -1709,7 +1708,7 @@ namespace Game.Spells
{ {
uint farMask = 0; uint farMask = 0;
// create far target mask // create far target mask
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect != null && effect.IsFarUnitTargetEffect()) if (effect != null && effect.IsFarUnitTargetEffect())
if (Convert.ToBoolean((1 << (int)effect.EffectIndex) & mask)) if (Convert.ToBoolean((1 << (int)effect.EffectIndex) & mask))
@@ -1726,7 +1725,7 @@ namespace Game.Spells
// do far effects on the unit // do far effects on the unit
// can't use default call because of threading, do stuff as fast as possible // 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))) if (effect != null && Convert.ToBoolean(farMask & (1 << (int)effect.EffectIndex)))
HandleEffects(unit, null, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget); HandleEffects(unit, null, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
return; return;
@@ -1885,7 +1884,7 @@ namespace Game.Spells
else if (m_damage > 0) else if (m_damage > 0)
{ {
// Fill base damage struct (unitTarget - is real spell target) // 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 // Check damage immunity
if (unitTarget.IsImmunedToDamage(m_spellInfo)) if (unitTarget.IsImmunedToDamage(m_spellInfo))
@@ -1926,7 +1925,7 @@ namespace Game.Spells
else else
{ {
// Fill base damage struct (unitTarget - is real spell target) // 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); hitMask |= Unit.CreateProcHitMask(damageInfo, missInfo);
// Do triggers for unit // Do triggers for unit
if (canEffectTrigger) if (canEffectTrigger)
@@ -1996,7 +1995,7 @@ namespace Game.Spells
// disable effects to which unit is immune // disable effects to which unit is immune
SpellMissInfo returnVal = SpellMissInfo.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 (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
if (unit.IsImmunedToSpellEffect(m_spellInfo, effect.EffectIndex, m_caster)) if (unit.IsImmunedToSpellEffect(m_spellInfo, effect.EffectIndex, m_caster))
effectMask &= (uint)~(1 << (int)effect.EffectIndex); effectMask &= (uint)~(1 << (int)effect.EffectIndex);
@@ -2051,7 +2050,7 @@ namespace Game.Spells
} }
uint aura_effmask = 0; 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())) if (effect != null && (Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)) && effect.IsUnitOwnedAuraEffect()))
aura_effmask |= (1u << (int)effect.EffectIndex); aura_effmask |= (1u << (int)effect.EffectIndex);
@@ -2075,7 +2074,7 @@ namespace Game.Spells
if (m_originalCaster != null) if (m_originalCaster != null)
{ {
int[] basePoints = new int[SpellConst.MaxEffects]; int[] basePoints = new int[SpellConst.MaxEffects];
foreach (SpellEffectInfo auraSpellEffect in GetEffects()) foreach (SpellEffectInfo auraSpellEffect in m_spellInfo.GetEffects())
if (auraSpellEffect != null) if (auraSpellEffect != null)
basePoints[auraSpellEffect.EffectIndex] = (m_spellValue.CustomBasePointsMask & (1 << (int)auraSpellEffect.EffectIndex)) != 0 ? 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); 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 refresh = false;
bool resetPeriodicTimer = !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontResetPeriodicTimer); bool resetPeriodicTimer = !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontResetPeriodicTimer);
m_spellAura = Aura.TryRefreshStackOrCreate(m_spellInfo, m_castId, (byte)effectMask, unit, 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) if (m_spellAura != null)
{ {
// Set aura stack amount to desired value // Set aura stack amount to desired value
@@ -2117,7 +2116,7 @@ namespace Game.Spells
{ {
m_spellAura.Remove(); m_spellAura.Remove();
bool found = false; 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)) if (effect != null && (Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)) && effect.Effect != SpellEffectName.ApplyAura))
found = true; found = true;
if (!found) if (!found)
@@ -2137,7 +2136,7 @@ namespace Game.Spells
{ {
int origDuration = duration; int origDuration = duration;
duration = 0; duration = 0;
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect != null) 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))) if (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
HandleEffects(unit, null, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget); HandleEffects(unit, null, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
@@ -2244,7 +2243,7 @@ namespace Game.Spells
PrepareScriptHitHandlers(); PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers(SpellMissInfo.None); 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))) if (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
HandleEffects(null, null, go, effect.EffectIndex, SpellEffectHandleMode.HitTarget); HandleEffects(null, null, go, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
@@ -2264,7 +2263,7 @@ namespace Game.Spells
PrepareScriptHitHandlers(); PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers(SpellMissInfo.None); 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))) if (effect != null && Convert.ToBoolean(effectMask & (1 << (int)effect.EffectIndex)))
HandleEffects(null, target.item, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget); HandleEffects(null, target.item, null, effect.EffectIndex, SpellEffectHandleMode.HitTarget);
@@ -2281,7 +2280,7 @@ namespace Game.Spells
uint channelTargetEffectMask = m_channelTargetEffectMask; uint channelTargetEffectMask = m_channelTargetEffectMask;
uint channelAuraMask = 0; uint channelAuraMask = 0;
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
if (effect != null && effect.Effect == SpellEffectName.ApplyAura) if (effect != null && effect.Effect == SpellEffectName.ApplyAura)
channelAuraMask |= (1u << (int)effect.EffectIndex); channelAuraMask |= (1u << (int)effect.EffectIndex);
@@ -2481,7 +2480,7 @@ namespace Game.Spells
if (!_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreAuraInterruptFlags) && m_spellInfo.IsBreakingStealth()) if (!_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreAuraInterruptFlags) && m_spellInfo.IsBreakingStealth())
{ {
m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Cast); m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Cast);
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect != null && effect.GetUsedTargetObjectType() == SpellTargetObjectTypes.Unit) if (effect != null && effect.GetUsedTargetObjectType() == SpellTargetObjectTypes.Unit)
{ {
@@ -2999,7 +2998,7 @@ namespace Game.Spells
PrepareScriptHitHandlers(); PrepareScriptHitHandlers();
// handle effects with SPELL_EFFECT_HANDLE_HIT mode // 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 // don't do anything for empty effect
if (effect == null || !effect.IsEffect()) if (effect == null || !effect.IsEffect())
@@ -3078,7 +3077,7 @@ namespace Game.Spells
// check if the player caster has moved before the spell finished // check if the player caster has moved before the spell finished
// with the exception of spells affected with SPELL_AURA_CAST_WHILE_WALKING effect // 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) && if ((m_caster.IsTypeId(TypeId.Player) && m_timer != 0) &&
m_caster.IsMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) && m_caster.IsMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) &&
((effect != null && effect.Effect != SpellEffectName.Stuck) || !m_caster.HasUnitMovementFlag(MovementFlag.FallingFar)) && ((effect != null && effect.Effect != SpellEffectName.Stuck) || !m_caster.HasUnitMovementFlag(MovementFlag.FallingFar)) &&
@@ -3187,7 +3186,7 @@ namespace Game.Spells
{ {
// Unsummon statue // Unsummon statue
uint spell = m_caster.m_unitData.CreatedBySpell; 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) 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); 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 else
{ {
uint item = 0; uint item = 0;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(caster.GetMap().GetDifficultyID())) foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (effect.ItemType != 0) if (effect.ItemType != 0)
item = effect.ItemType; item = effect.ItemType;
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(item); ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(item);
@@ -3799,7 +3798,7 @@ namespace Game.Spells
spellExecuteLog.Caster = m_caster.GetGUID(); spellExecuteLog.Caster = m_caster.GetGUID();
spellExecuteLog.SpellID = m_spellInfo.Id; spellExecuteLog.SpellID = m_spellInfo.Id;
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -4321,7 +4320,7 @@ namespace Game.Spells
gameObjTarget = pGOTarget; gameObjTarget = pGOTarget;
destTarget = m_destTargets[i].Position; destTarget = m_destTargets[i].Position;
effectInfo = GetEffect(i); effectInfo = m_spellInfo.GetEffect(i);
if (effectInfo == null) if (effectInfo == null)
{ {
Log.outError(LogFilter.Spells, "Spell: {0} HandleEffects at EffectIndex: {1} missing effect", m_spellInfo.Id, i); 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)) 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 // 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)) && if ((!m_caster.HasUnitMovementFlag(MovementFlag.FallingFar) || (effect != null && effect.Effect != SpellEffectName.Stuck)) &&
(IsAutoRepeat() || m_spellInfo.HasAuraInterruptFlag(SpellAuraInterruptFlags.NotSeated))) (IsAutoRepeat() || m_spellInfo.HasAuraInterruptFlag(SpellAuraInterruptFlags.NotSeated)))
return SpellCastResult.Moving; return SpellCastResult.Moving;
@@ -4584,7 +4583,7 @@ namespace Game.Spells
} }
// check pet presence // check pet presence
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect != null && effect.TargetA.GetTarget() == Targets.UnitPet) if (effect != null && effect.TargetA.GetTarget() == Targets.UnitPet)
{ {
@@ -4678,7 +4677,7 @@ namespace Game.Spells
if (castResult != SpellCastResult.SpellCastOk) if (castResult != SpellCastResult.SpellCastOk)
return castResult; return castResult;
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -4712,11 +4711,10 @@ namespace Game.Spells
break; break;
Pet pet = m_caster.ToPlayer().GetPet(); Pet pet = m_caster.ToPlayer().GetPet();
if (pet == null) if (pet == null)
return SpellCastResult.NoPet; 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) if (learn_spellproto == null)
return SpellCastResult.NotKnown; return SpellCastResult.NotKnown;
@@ -4749,7 +4747,7 @@ namespace Game.Spells
if (pet == null || pet.GetOwner() != m_caster) if (pet == null || pet.GetOwner() != m_caster)
return SpellCastResult.BadTargets; 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) if (learn_spellproto == null)
return SpellCastResult.NotKnown; 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) if (effect == null)
continue; continue;
@@ -5255,7 +5253,7 @@ namespace Game.Spells
} }
case AuraType.Mounted: 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; return SpellCastResult.OnlyAbovewater;
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells // 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(); ObjectGuid targetguid = target.GetGUID();
// check if target already has the same or a more powerful aura // 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) if (effect == null)
continue; 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 // such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example
SpellCastResult failReason = SpellCastResult.SpellCastOk; 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 // 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) if (effect == null || effect.TargetA.GetTarget() == Targets.UnitPet)
@@ -5993,7 +5991,7 @@ namespace Game.Spells
} }
// special checks for spell effects // special checks for spell effects
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -6028,7 +6026,7 @@ namespace Game.Spells
player.SendEquipError(msg, null, null, effect.ItemType); player.SendEquipError(msg, null, null, effect.ItemType);
return SpellCastResult.DontReport; 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 player.CastSpell(m_caster, (uint)efi.CalcValue(), false); // move this to anywhere
return SpellCastResult.DontReport; return SpellCastResult.DontReport;
} }
@@ -6437,7 +6435,7 @@ namespace Game.Spells
WorldObject transport = null; WorldObject transport = null;
// update effect destinations (in case of moved transport dest target) // 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) if (effect == null)
continue; continue;
@@ -6471,6 +6469,11 @@ namespace Game.Spells
return CurrentSpellTypes.Generic; return CurrentSpellTypes.Generic;
} }
public Difficulty GetCastDifficulty()
{
return m_caster.GetMap().GetDifficultyID();
}
bool CheckEffectTarget(Unit target, SpellEffectInfo effect, Position losPosition) bool CheckEffectTarget(Unit target, SpellEffectInfo effect, Position losPosition)
{ {
if (!effect.IsEffect()) if (!effect.IsEffect())
@@ -6632,7 +6635,7 @@ namespace Game.Spells
void HandleLaunchPhase() void HandleLaunchPhase()
{ {
// handle effects with SPELL_EFFECT_HANDLE_LAUNCH mode // 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 // don't do anything for empty effect
if (effect == null || !effect.IsEffect()) if (effect == null || !effect.IsEffect())
@@ -6642,7 +6645,7 @@ namespace Game.Spells
} }
float[] multiplier = new float[SpellConst.MaxEffects]; 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))) if (effect != null && Convert.ToBoolean(m_applyMultiplierMask & (1 << (int)effect.EffectIndex)))
multiplier[effect.EffectIndex] = effect.CalcDamageMultiplier(m_originalCaster, this); multiplier[effect.EffectIndex] = effect.CalcDamageMultiplier(m_originalCaster, this);
@@ -6674,7 +6677,7 @@ namespace Game.Spells
if (unit == null) if (unit == null)
return; return;
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect != null && Convert.ToBoolean(targetInfo.effectMask & (1 << (int)effect.EffectIndex))) if (effect != null && Convert.ToBoolean(targetInfo.effectMask & (1 << (int)effect.EffectIndex)))
{ {
@@ -6723,7 +6726,7 @@ namespace Game.Spells
if (lockInfo == null) if (lockInfo == null)
return SpellCastResult.BadTargets; return SpellCastResult.BadTargets;
SpellEffectInfo effect = GetEffect(effIndex); SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null) if (effect == null)
return SpellCastResult.BadTargets; // no idea about correct error 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)); 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 // 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)))) if (effect != null && (Convert.ToBoolean(effMask & (1 << (int)effect.EffectIndex)) && (!only_on_caster || (effect.TargetA.GetTarget() == Targets.UnitCaster))))
return true; return true;
@@ -7073,7 +7076,7 @@ namespace Game.Spells
if (!aurEff.IsAffectingSpell(m_spellInfo)) if (!aurEff.IsAffectingSpell(m_spellInfo))
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(aurEff.GetSpellEffectInfo().TriggerSpell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(aurEff.GetSpellEffectInfo().TriggerSpell, GetCastDifficulty());
if (spellInfo != null) if (spellInfo != null)
{ {
// calculate the chance using spell base amount, because aura amount is not updated on combo-points change // 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; } 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) public static implicit operator bool(Spell spell)
{ {
return spell != null; return spell != null;
@@ -7412,8 +7396,6 @@ namespace Game.Spells
// and in same time need aura data and after aura deleting. // and in same time need aura data and after aura deleting.
public SpellInfo m_triggeredByAuraSpell; public SpellInfo m_triggeredByAuraSpell;
SpellEffectInfo[] _effects = new SpellEffectInfo[SpellConst.MaxEffects];
bool m_skipCheck; bool m_skipCheck;
#endregion #endregion
} }
@@ -7605,11 +7587,9 @@ namespace Game.Spells
public class SpellValue public class SpellValue
{ {
public SpellValue(Difficulty difficulty, SpellInfo proto, Unit caster) public SpellValue(SpellInfo proto, Unit caster)
{ {
var effects = proto.GetEffectsForDifficulty(difficulty); foreach (SpellEffectInfo effect in proto.GetEffects())
Cypher.Assert(effects.Length <= SpellConst.MaxEffects);
foreach (SpellEffectInfo effect in effects)
if (effect != null) if (effect != null)
EffectBasePoints[effect.EffectIndex] = effect.CalcBaseValue(caster, null, 0, -1); 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); DamageInfo damageInfo = new DamageInfo(m_caster, unitTarget, (uint)damage, m_spellInfo, m_spellInfo.GetSchoolMask(), DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack);
m_caster.CalcAbsorbResist(damageInfo); 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.damage = damageInfo.GetDamage();
log.originalDamage = (uint)damage; log.originalDamage = (uint)damage;
log.absorb = damageInfo.GetAbsorb(); log.absorb = damageInfo.GetAbsorb();
@@ -359,7 +359,7 @@ namespace Game.Spells
case 29284: case 29284:
{ {
// Brittle Armor // Brittle Armor
SpellInfo spell = Global.SpellMgr.GetSpellInfo(24575); SpellInfo spell = Global.SpellMgr.GetSpellInfo(24575, GetCastDifficulty());
if (spell == null) if (spell == null)
return; return;
@@ -371,7 +371,7 @@ namespace Game.Spells
case 29286: case 29286:
{ {
// Mercurial Shield // Mercurial Shield
SpellInfo spell = Global.SpellMgr.GetSpellInfo(26464); SpellInfo spell = Global.SpellMgr.GetSpellInfo(26464, GetCastDifficulty());
if (spell == null) if (spell == null)
return; return;
@@ -401,7 +401,7 @@ namespace Game.Spells
} }
// normal case // normal case
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id, GetCastDifficulty());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outDebug(LogFilter.Spells, "Spell.EffectTriggerSpell spell {0} tried to trigger unknown spell {1}", m_spellInfo.Id, triggered_spell_id); 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(); SpellCastTargets targets = new SpellCastTargets();
if (effectHandleMode == SpellEffectHandleMode.LaunchTarget) if (effectHandleMode == SpellEffectHandleMode.LaunchTarget)
{ {
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, m_caster.GetMap().GetDifficultyID())) if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
return; return;
targets.SetUnitTarget(unitTarget); targets.SetUnitTarget(unitTarget);
} }
else //if (effectHandleMode == SpellEffectHandleMode.Launch) 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; return;
if (spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.DestLocation)) if (spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.DestLocation))
@@ -450,7 +450,7 @@ namespace Game.Spells
uint triggered_spell_id = effectInfo.TriggerSpell; uint triggered_spell_id = effectInfo.TriggerSpell;
// normal case // normal case
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id, GetCastDifficulty());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outDebug(LogFilter.Spells, "Spell.EffectTriggerMissileSpell spell {0} tried to trigger unknown spell {1}", m_spellInfo.Id, triggered_spell_id); 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(); SpellCastTargets targets = new SpellCastTargets();
if (effectHandleMode == SpellEffectHandleMode.HitTarget) if (effectHandleMode == SpellEffectHandleMode.HitTarget)
{ {
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo, m_caster.GetMap().GetDifficultyID())) if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
return; return;
targets.SetUnitTarget(unitTarget); targets.SetUnitTarget(unitTarget);
} }
else //if (effectHandleMode == SpellEffectHandleMode.Hit) 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; return;
if (spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.DestLocation)) if (spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.DestLocation))
@@ -503,7 +503,7 @@ namespace Game.Spells
uint triggered_spell_id = effectInfo.TriggerSpell; uint triggered_spell_id = effectInfo.TriggerSpell;
// normal case // normal case
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(triggered_spell_id, GetCastDifficulty());
if (spellInfo == null) if (spellInfo == null)
{ {
Log.outError(LogFilter.Spells, "Spell.EffectForceCast of spell {0}: triggering unknown spell id {1}", m_spellInfo.Id, triggered_spell_id); 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; return;
uint triggered_spell_id = effectInfo.TriggerSpell; 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) if (spellInfo == null)
{ {
Log.outError(LogFilter.Spells, "EffectTriggerRitualOfSummoning of spell {0}: triggering unknown spell id {1}", m_spellInfo.Id, triggered_spell_id); 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)) if (!dynObj.CreateDynamicObject(caster.GetMap().GenerateLowGuid(HighGuid.DynamicObject), caster, m_spellInfo, destTarget, radius, DynamicObjectType.AreaSpell, m_SpellVisual))
return; 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) if (aura != null)
{ {
m_spellAura = aura; m_spellAura = aura;
@@ -1775,8 +1775,8 @@ namespace Game.Spells
int basePoints = effectInfo.CalcValue(); int basePoints = effectInfo.CalcValue();
if (basePoints > SharedConst.MaxVehicleSeats) if (basePoints > SharedConst.MaxVehicleSeats)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)basePoints); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)basePoints, GetCastDifficulty());
if (spellInfo != null && spellInfo.HasAura(m_originalCaster.GetMap().GetDifficultyID(), AuraType.ControlVehicle)) if (spellInfo != null && spellInfo.HasAura(AuraType.ControlVehicle))
spellId = spellInfo.Id; spellId = spellInfo.Id;
} }
@@ -2435,7 +2435,7 @@ namespace Game.Spells
if (pet == null) if (pet == null)
return; return;
SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effectInfo.TriggerSpell); SpellInfo learn_spellproto = Global.SpellMgr.GetSpellInfo(effectInfo.TriggerSpell, Difficulty.None);
if (learn_spellproto == null) if (learn_spellproto == null)
return; return;
@@ -2497,7 +2497,7 @@ namespace Game.Spells
// and handle all effects at once // and handle all effects at once
for (var i = effIndex + 1; i < SpellConst.MaxEffects; ++i) for (var i = effIndex + 1; i < SpellConst.MaxEffects; ++i)
{ {
var effect = GetEffect(i); var effect = m_spellInfo.GetEffect(i);
if (effect == null) if (effect == null)
continue; continue;
@@ -2588,7 +2588,7 @@ namespace Game.Spells
// Blood Strike // Blood Strike
if (m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x400000u)) if (m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x400000u))
{ {
SpellEffectInfo effect = GetEffect(2); SpellEffectInfo effect = m_spellInfo.GetEffect(2);
if (effect != null) if (effect != null)
{ {
float bonusPct = effect.CalcValue(m_caster) * unitTarget.GetDiseasesByCaster(m_caster.GetGUID()) / 2.0f; float bonusPct = effect.CalcValue(m_caster) * unitTarget.GetDiseasesByCaster(m_caster.GetGUID()) / 2.0f;
@@ -2606,7 +2606,7 @@ namespace Game.Spells
bool normalized = false; bool normalized = false;
float weaponDamagePercentMod = 1.0f; float weaponDamagePercentMod = 1.0f;
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -2659,7 +2659,7 @@ namespace Game.Spells
uint weaponDamage = m_caster.CalculateDamage(m_attackType, normalized, addPctMods); uint weaponDamage = m_caster.CalculateDamage(m_attackType, normalized, addPctMods);
// Sequence is important // Sequence is important
foreach (SpellEffectInfo effect in GetEffects()) foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{ {
if (effect == null) if (effect == null)
continue; continue;
@@ -3118,8 +3118,8 @@ namespace Game.Spells
if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Player) || effIndex != 0) if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Player) || effIndex != 0)
return; return;
uint spellID = (uint)GetEffect(0).CalcValue(); uint spellID = (uint)m_spellInfo.GetEffect(0).CalcValue();
uint questID = (uint)GetEffect(1).CalcValue(); uint questID = (uint)m_spellInfo.GetEffect(1).CalcValue();
if (unitTarget.ToPlayer().GetQuestStatus(questID) == QuestStatus.Complete) if (unitTarget.ToPlayer().GetQuestStatus(questID) == QuestStatus.Complete)
unitTarget.CastSpell(unitTarget, spellID, true); 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 // @todo a hack, range = 11, should after some time cast, otherwise too far
m_caster.CastSpell(parent, 62496, true); 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; 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 // normal DB scripted effect
@@ -3535,7 +3477,7 @@ namespace Game.Spells
player.TeleportTo(player.GetHomebind(), TeleportToOptions.Spell); player.TeleportTo(player.GetHomebind(), TeleportToOptions.Spell);
// Stuck spell trigger Hearthstone cooldown // Stuck spell trigger Hearthstone cooldown
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(8690); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(8690, GetCastDifficulty());
if (spellInfo == null) if (spellInfo == null)
return; return;
@@ -4399,7 +4341,7 @@ namespace Game.Spells
if (totem != null && totem.IsTotem()) if (totem != null && totem.IsTotem())
{ {
uint spell_id = totem.m_unitData.CreatedBySpell; 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) if (spellInfo != null)
{ {
var costs = spellInfo.CalcPowerCost(m_caster, spellInfo.GetSchoolMask()); var costs = spellInfo.CalcPowerCost(m_caster, spellInfo.GetSchoolMask());
@@ -5244,7 +5186,7 @@ namespace Game.Spells
if (spell_id == 0) if (spell_id == 0)
continue; continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id, GetCastDifficulty());
if (spellInfo == null) if (spellInfo == null)
continue; continue;
@@ -5255,7 +5197,7 @@ namespace Game.Spells
continue; continue;
TriggerCastFlags triggerFlags = (TriggerCastFlags.IgnoreGCD | TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.CastDirectly | TriggerCastFlags.DontReportCastError); 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 health = (uint)target.CountPctFromMaxHealth(damage);
uint mana = (uint)MathFunctions.CalculatePct(target.GetMaxPower(PowerType.Mana), damage); uint mana = (uint)MathFunctions.CalculatePct(target.GetMaxPower(PowerType.Mana), damage);
uint resurrectAura = 0; uint resurrectAura = 0;
if (Global.SpellMgr.GetSpellInfo(effectInfo.TriggerSpell) != null) if (Global.SpellMgr.HasSpellInfo(effectInfo.TriggerSpell, Difficulty.None))
resurrectAura = effectInfo.TriggerSpell; resurrectAura = effectInfo.TriggerSpell;
if (resurrectAura != 0 && target.HasAura(resurrectAura)) if (resurrectAura != 0 && target.HasAura(resurrectAura))
+6 -6
View File
@@ -40,7 +40,7 @@ namespace Game.Spells
do do
{ {
uint spellId = cooldownsResult.Read<uint>(0); uint spellId = cooldownsResult.Read<uint>(0);
if (!Global.SpellMgr.HasSpellInfo(spellId)) if (!Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
continue; continue;
int index = (typeof(T) == typeof(Pet) ? 1 : 2); int index = (typeof(T) == typeof(Pet) ? 1 : 2);
@@ -222,7 +222,7 @@ namespace Game.Spells
if (IsSchoolLocked(spellInfo.GetSchoolMask())) if (IsSchoolLocked(spellInfo.GetSchoolMask()))
return false; return false;
if (HasCooldown(spellInfo.Id, itemId, ignoreCategoryCooldown)) if (HasCooldown(spellInfo, itemId, ignoreCategoryCooldown))
return false; return false;
if (!HasCharge(spellInfo.ChargeCategoryId)) if (!HasCharge(spellInfo.ChargeCategoryId))
@@ -459,7 +459,7 @@ namespace Game.Spells
player.SendPacket(new CooldownEvent(player != _owner, categoryEntry.SpellId)); player.SendPacket(new CooldownEvent(player != _owner, categoryEntry.SpellId));
if (startCooldown) 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)); 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) 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) public bool HasCooldown(SpellInfo spellInfo, uint itemId = 0, bool ignoreCategoryCooldown = false)
@@ -663,7 +663,7 @@ namespace Game.Spells
spellCooldown.Flags = SpellCooldownFlags.None; spellCooldown.Flags = SpellCooldownFlags.None;
foreach (uint spellId in knownSpells) foreach (uint spellId in knownSpells)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, _owner.GetMap().GetDifficultyID());
if (spellInfo.IsCooldownStartedOnEvent()) if (spellInfo.IsCooldownStartedOnEvent())
continue; continue;
@@ -904,7 +904,7 @@ namespace Game.Spells
// add all profession CDs created while in duel (if any) // add all profession CDs created while in duel (if any)
foreach (var c in _spellCooldowns) 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) if (spellInfo.RecoveryTime > 10 * Time.Minute * Time.InMilliseconds || spellInfo.CategoryRecoveryTime > 10 * Time.Minute * Time.InMilliseconds)
_spellCooldownsBeforeDuel[c.Key] = _spellCooldowns[c.Key]; _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
@@ -130,7 +130,7 @@ namespace Game
static bool SpellCheck(uint spell_id) static bool SpellCheck(uint spell_id)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id, Difficulty.None);
return spellInfo != null && !spellInfo.HasAttribute(SpellCustomAttributes.IsTalent); return spellInfo != null && !spellInfo.HasAttribute(SpellCustomAttributes.IsTalent);
} }
@@ -117,7 +117,7 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.HeraldVolazj
// phase the player // phase the player
target.CastSpell(target, SpellIds.InsanityTarget + insanityHandled, true); target.CastSpell(target, SpellIds.InsanityTarget + insanityHandled, true);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.InsanityTarget + insanityHandled); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.InsanityTarget + insanityHandled, GetDifficulty());
if (spellInfo == null) if (spellInfo == null)
return; return;
@@ -1719,7 +1719,7 @@ Fall Time: 824
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{ {
SpellInfo damageInfo = Global.SpellMgr.GetSpellInfo(GunshipSpells.RocketPackDamage); SpellInfo damageInfo = Global.SpellMgr.GetSpellInfo(GunshipSpells.RocketPackDamage, GetCastDifficulty());
GetTarget().CastCustomSpell(GunshipSpells.RocketPackDamage, SpellValueMod.BasePoint0, (int)(2 * (damageInfo.GetEffect(0).CalcValue() + aurEff.GetTickNumber() * aurEff.GetPeriod())), null, TriggerCastFlags.FullMask); GetTarget().CastCustomSpell(GunshipSpells.RocketPackDamage, SpellValueMod.BasePoint0, (int)(2 * (damageInfo.GetEffect(0).CalcValue() + aurEff.GetTickNumber() * aurEff.GetPeriod())), null, TriggerCastFlags.FullMask);
GetTarget().CastSpell(null, GunshipSpells.RocketBurst, TriggerCastFlags.FullMask); GetTarget().CastSpell(null, GunshipSpells.RocketBurst, TriggerCastFlags.FullMask);
} }
@@ -41,7 +41,7 @@ namespace Scripts.Northrend.IcecrownCitadel
player.PlayerTalkClass.ClearMenus(); player.PlayerTalkClass.ClearMenus();
player.CLOSE_GOSSIP_MENU(); player.CLOSE_GOSSIP_MENU();
SpellInfo spell = Global.SpellMgr.GetSpellInfo(TeleportSpells[gossipListId]); SpellInfo spell = Global.SpellMgr.GetSpellInfo(TeleportSpells[gossipListId], Difficulty.None);
if (spell == null) if (spell == null)
return false; return false;
@@ -84,7 +84,7 @@ namespace Scripts.Northrend.IcecrownCitadel
{ {
if (player.IsInCombat()) if (player.IsInCombat())
{ {
SpellInfo spell = Global.SpellMgr.GetSpellInfo(TeleporterSpells.FROZEN_THRONE_TELEPORT); SpellInfo spell = Global.SpellMgr.GetSpellInfo(TeleporterSpells.FROZEN_THRONE_TELEPORT, Difficulty.None);
if (spell != null) if (spell != null)
{ {
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, player.GetMapId(), spell.Id, player.GetMap().GenerateLowGuid(HighGuid.Cast)); ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, player.GetMapId(), spell.Id, player.GetMap().GenerateLowGuid(HighGuid.Cast));
@@ -519,7 +519,7 @@ namespace Scripts.Northrend.IcecrownCitadel
if (target.HasAura(Spells.Impaled)) if (target.HasAura(Spells.Impaled))
return false; return false;
SpellEffectInfo effect = GetSpellInfo().GetEffect(target.GetMap().GetDifficultyID(), 0); SpellEffectInfo effect = GetSpellInfo().GetEffect(0);
if (effect != null) if (effect != null)
if (target.GetExactDist2d(GetOwner()) > effect.CalcRadius()) if (target.GetExactDist2d(GetOwner()) > effect.CalcRadius())
return false; return false;
+1 -1
View File
@@ -263,7 +263,7 @@ namespace Scripts.Spells.DeathKnight
return; return;
int amount = (int)(damageInfo.GetDamage() / 2); int amount = (int)(damageInfo.GetDamage() / 2);
SpellNonMeleeDamage log = new SpellNonMeleeDamage(drw, drw.GetVictim(), spellInfo.Id, spellInfo.GetSpellXSpellVisualId(drw), spellInfo.GetSchoolMask()); SpellNonMeleeDamage log = new SpellNonMeleeDamage(drw, drw.GetVictim(), spellInfo, spellInfo.GetSpellXSpellVisualId(drw), spellInfo.GetSchoolMask());
log.damage = (uint)amount; log.damage = (uint)amount;
drw.DealDamage(drw.GetVictim(), (uint)amount, null, DamageEffectType.Direct, spellInfo.GetSchoolMask(), spellInfo, true); drw.DealDamage(drw.GetVictim(), (uint)amount, null, DamageEffectType.Direct, spellInfo.GetSchoolMask(), spellInfo, true);
drw.SendSpellNonMeleeDamageLog(log); drw.SendSpellNonMeleeDamageLog(log);
+5 -5
View File
@@ -701,7 +701,7 @@ namespace Scripts.Spells.Druid
if (player.GetSkillValue(SkillType.Riding) < 75) if (player.GetSkillValue(SkillType.Riding) < 75)
return SpellCastResult.ApprenticeRidingRequirement; return SpellCastResult.ApprenticeRidingRequirement;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(player.IsInWater() ? SpellIds.FormAquatic : SpellIds.FormStag); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(player.IsInWater() ? SpellIds.FormAquatic : SpellIds.FormStag, GetCastDifficulty());
return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player); return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player);
} }
@@ -758,7 +758,7 @@ namespace Scripts.Spells.Druid
SpellCastResult CheckLocationForForm(uint spell) SpellCastResult CheckLocationForForm(uint spell)
{ {
Player player = GetTarget().ToPlayer(); Player player = GetTarget().ToPlayer();
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell, GetCastDifficulty());
return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player); return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player);
} }
} }
@@ -821,7 +821,7 @@ namespace Scripts.Spells.Druid
SpellCastResult CheckLocationForForm(uint spell_id) SpellCastResult CheckLocationForForm(uint spell_id)
{ {
Player player = GetTarget().ToPlayer(); Player player = GetTarget().ToPlayer();
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id, GetCastDifficulty());
if (!player.GetMap().IsOutdoors(player.GetPhaseShift(), player.GetPositionX(), player.GetPositionY(), player.GetPositionZ())) if (!player.GetMap().IsOutdoors(player.GetPhaseShift(), player.GetPositionX(), player.GetPositionY(), player.GetPositionZ()))
return SpellCastResult.OnlyOutdoors; return SpellCastResult.OnlyOutdoors;
@@ -900,9 +900,9 @@ namespace Scripts.Spells.Druid
Unit caster = eventInfo.GetActor(); Unit caster = eventInfo.GetActor();
Unit target = eventInfo.GetProcTarget(); Unit target = eventInfo.GetProcTarget();
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.Languish); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.Languish, GetCastDifficulty());
int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()); int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None); amount /= (int)spellInfo.GetMaxTicks();
// Add remaining ticks to damage done // Add remaining ticks to damage done
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Languish, AuraType.PeriodicDamage); amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Languish, AuraType.PeriodicDamage);
+1 -1
View File
@@ -1628,7 +1628,7 @@ namespace Scripts.Spells.Generic
public override void Register() public override void Register()
{ {
SpellInfo spell = Global.SpellMgr.GetSpellInfo(m_scriptSpellId); SpellInfo spell = Global.SpellMgr.GetSpellInfo(m_scriptSpellId, Difficulty.None);
if (spell.HasEffect(SpellEffectName.ScriptEffect)) if (spell.HasEffect(SpellEffectName.ScriptEffect))
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, SpellConst.EffectFirstFound, SpellEffectName.ScriptEffect)); OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, SpellConst.EffectFirstFound, SpellEffectName.ScriptEffect));
+1 -1
View File
@@ -434,7 +434,7 @@ namespace Scripts.Spells.Hunter
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
GetCaster().GetSpellHistory().ResetCooldowns(p => GetCaster().GetSpellHistory().ResetCooldowns(p =>
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key, GetCastDifficulty());
//! If spellId in cooldown map isn't valid, the above will return a null pointer. //! If spellId in cooldown map isn't valid, the above will return a null pointer.
if (spellInfo.SpellFamilyName == SpellFamilyNames.Hunter && if (spellInfo.SpellFamilyName == SpellFamilyNames.Hunter &&
+3 -3
View File
@@ -555,9 +555,9 @@ namespace Scripts.Spells.Items
uint spellId = 0; uint spellId = 0;
int amount = (int)(eventInfo.GetDamageInfo().GetDamage() * 0.4f); int amount = (int)(eventInfo.GetDamageInfo().GetDamage() * 0.4f);
if (eventInfo.GetDamageInfo().GetSpellInfo().HasEffect(Difficulty.None, SpellEffectName.Heal)) if (eventInfo.GetDamageInfo().GetSpellInfo().HasEffect(SpellEffectName.Heal))
spellId = SpellIds.AlchemistStoneExtraHeal; spellId = SpellIds.AlchemistStoneExtraHeal;
else if (eventInfo.GetDamageInfo().GetSpellInfo().HasEffect(Difficulty.None, SpellEffectName.Energize)) else if (eventInfo.GetDamageInfo().GetSpellInfo().HasEffect(SpellEffectName.Energize))
spellId = SpellIds.AlchemistStoneExtraMana; spellId = SpellIds.AlchemistStoneExtraMana;
if (spellId == 0) if (spellId == 0)
@@ -779,7 +779,7 @@ namespace Scripts.Spells.Items
void HandleDummy(uint effIndex) void HandleDummy(uint effIndex)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DeadlyPrecision); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DeadlyPrecision, GetCastDifficulty());
GetCaster().CastCustomSpell(spellInfo.Id, SpellValueMod.AuraStack, (int)spellInfo.StackAmount, GetCaster(), true); GetCaster().CastCustomSpell(spellInfo.Id, SpellValueMod.AuraStack, (int)spellInfo.StackAmount, GetCaster(), true);
} }
+5 -5
View File
@@ -149,7 +149,7 @@ namespace Scripts.Spells.Mage
} }
GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(effect1.GetAmount())); GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(effect1.GetAmount()));
GetTarget().CastSpell(GetTarget(), GetAura().GetSpellEffectInfo(2).TriggerSpell, TriggerCastFlags.FullMask); GetTarget().CastSpell(GetTarget(), GetSpellInfo().GetEffect(2).TriggerSpell, TriggerCastFlags.FullMask);
GetTarget().CastSpell(GetTarget(), SpellIds.CauterizeDot, TriggerCastFlags.FullMask); GetTarget().CastSpell(GetTarget(), SpellIds.CauterizeDot, TriggerCastFlags.FullMask);
GetTarget().CastSpell(GetTarget(), SpellIds.Cauterized, TriggerCastFlags.FullMask); GetTarget().CastSpell(GetTarget(), SpellIds.Cauterized, TriggerCastFlags.FullMask);
} }
@@ -288,10 +288,10 @@ namespace Scripts.Spells.Mage
{ {
PreventDefaultAction(); PreventDefaultAction();
SpellInfo igniteDot = Global.SpellMgr.GetSpellInfo(SpellIds.Ignite); SpellInfo igniteDot = Global.SpellMgr.GetSpellInfo(SpellIds.Ignite, GetCastDifficulty());
int pct = aurEff.GetAmount(); int pct = aurEff.GetAmount();
int amount = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), pct) / igniteDot.GetMaxTicks(Difficulty.None)); int amount = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), pct) / igniteDot.GetMaxTicks());
amount += (int)eventInfo.GetProcTarget().GetRemainingPeriodicAmount(eventInfo.GetActor().GetGUID(), SpellIds.Ignite, AuraType.PeriodicDamage); amount += (int)eventInfo.GetProcTarget().GetRemainingPeriodicAmount(eventInfo.GetActor().GetGUID(), SpellIds.Ignite, AuraType.PeriodicDamage);
GetTarget().CastCustomSpell(SpellIds.Ignite, SpellValueMod.BasePoint0, amount, eventInfo.GetProcTarget(), true, null, aurEff); GetTarget().CastCustomSpell(SpellIds.Ignite, SpellValueMod.BasePoint0, amount, eventInfo.GetProcTarget(), true, null, aurEff);
} }
@@ -464,7 +464,7 @@ namespace Scripts.Spells.Mage
void Apply(AuraEffect aurEff, AuraEffectHandleModes mode) void Apply(AuraEffect aurEff, AuraEffectHandleModes mode)
{ {
List<TempSummon> minions = new List<TempSummon>(); List<TempSummon> minions = new List<TempSummon>();
GetTarget().GetAllMinionsByEntry(minions, (uint)Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon).GetEffect(0).MiscValue); GetTarget().GetAllMinionsByEntry(minions, (uint)Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).MiscValue);
// Get the last summoned RoF, save it and despawn older ones // Get the last summoned RoF, save it and despawn older ones
foreach (var summon in minions) foreach (var summon in minions)
@@ -513,7 +513,7 @@ namespace Scripts.Spells.Mage
void FilterTargets(List<WorldObject> targets) void FilterTargets(List<WorldObject> targets)
{ {
WorldLocation dest = GetExplTargetDest(); WorldLocation dest = GetExplTargetDest();
float outRadius = Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon).GetEffect(0).CalcRadius(); float outRadius = Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).CalcRadius();
float inRadius = 6.5f; float inRadius = 6.5f;
targets.RemoveAll(target => targets.RemoveAll(target =>
+1 -1
View File
@@ -110,7 +110,7 @@ namespace Scripts.Spells.Monk
{ {
if (GetExplTargetUnit().GetEntry() != BlackOxStatusEntry) if (GetExplTargetUnit().GetEntry() != BlackOxStatusEntry)
{ {
SpellInfo singleTarget = Global.SpellMgr.GetSpellInfo(SpellIds.ProvokeSingleTarget); SpellInfo singleTarget = Global.SpellMgr.GetSpellInfo(SpellIds.ProvokeSingleTarget, GetCastDifficulty());
SpellCastResult singleTargetExplicitResult = singleTarget.CheckExplicitTarget(GetCaster(), GetExplTargetUnit()); SpellCastResult singleTargetExplicitResult = singleTarget.CheckExplicitTarget(GetCaster(), GetExplTargetUnit());
if (singleTargetExplicitResult != SpellCastResult.SpellCastOk) if (singleTargetExplicitResult != SpellCastResult.SpellCastOk)
return singleTargetExplicitResult; return singleTargetExplicitResult;
+4 -4
View File
@@ -456,7 +456,7 @@ namespace Scripts.Spells.Paladin
{ {
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
SpellInfo firstRankSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyShockR1); SpellInfo firstRankSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyShockR1, Difficulty.None);
if (firstRankSpellInfo == null) if (firstRankSpellInfo == null)
return false; return false;
@@ -596,7 +596,7 @@ namespace Scripts.Spells.Paladin
{ {
if (eff.GetSpellInfo().GetSpellSpecific() == SpellSpecificType.Seal && eff.GetEffIndex() == 2) if (eff.GetSpellInfo().GetSpellSpecific() == SpellSpecificType.Seal && eff.GetEffIndex() == 2)
{ {
if (Global.SpellMgr.HasSpellInfo((uint)eff.GetAmount())) if (Global.SpellMgr.HasSpellInfo((uint)eff.GetAmount(), GetCastDifficulty()))
{ {
spellId = (uint)eff.GetAmount(); spellId = (uint)eff.GetAmount();
break; break;
@@ -923,9 +923,9 @@ namespace Scripts.Spells.Paladin
Unit caster = eventInfo.GetActor(); Unit caster = eventInfo.GetActor();
Unit target = eventInfo.GetProcTarget(); Unit target = eventInfo.GetProcTarget();
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyMending); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyMending, GetCastDifficulty());
int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()); int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None); amount /= (int)spellInfo.GetMaxTicks();
// Add remaining ticks to damage done // Add remaining ticks to damage done
amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.HolyMending, AuraType.PeriodicHeal); amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.HolyMending, AuraType.PeriodicHeal);
+7 -7
View File
@@ -409,8 +409,8 @@ namespace Scripts.Spells.Priest
if (healInfo == null || healInfo.GetHeal() == 0) if (healInfo == null || healInfo.GetHeal() == 0)
return; return;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.GlyphOfPrayerOfHealingHeal); SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.GlyphOfPrayerOfHealingHeal, GetCastDifficulty());
int heal = (int)(MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()) / triggeredSpellInfo.GetMaxTicks(Difficulty.None)); int heal = (int)(MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()) / triggeredSpellInfo.GetMaxTicks());
GetTarget().CastCustomSpell(SpellIds.GlyphOfPrayerOfHealingHeal, SpellValueMod.BasePoint0, heal, eventInfo.GetProcTarget(), true, null, aurEff); GetTarget().CastCustomSpell(SpellIds.GlyphOfPrayerOfHealingHeal, SpellValueMod.BasePoint0, heal, eventInfo.GetProcTarget(), true, null, aurEff);
} }
@@ -566,7 +566,7 @@ namespace Scripts.Spells.Priest
SpellCastTargets targets = new SpellCastTargets(); SpellCastTargets targets = new SpellCastTargets();
targets.SetDst(destPos); targets.SetDst(destPos);
targets.SetUnitTarget(GetCaster()); targets.SetUnitTarget(GetCaster());
GetHitUnit().CastSpell(targets, Global.SpellMgr.GetSpellInfo((uint)GetEffectValue()), null); GetHitUnit().CastSpell(targets, Global.SpellMgr.GetSpellInfo((uint)GetEffectValue(), GetCastDifficulty()), null);
} }
public override void Register() public override void Register()
@@ -702,7 +702,7 @@ namespace Scripts.Spells.Priest
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
SpellInfo firstRankSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.PenanceR1); SpellInfo firstRankSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.PenanceR1, Difficulty.None);
if (firstRankSpellInfo == null) if (firstRankSpellInfo == null)
return false; return false;
@@ -997,9 +997,9 @@ namespace Scripts.Spells.Priest
if (healInfo == null || healInfo.GetHeal() == 0) if (healInfo == null || healInfo.GetHeal() == 0)
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.BlessedHealing); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.BlessedHealing, GetCastDifficulty());
int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()); int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None); amount /= (int)spellInfo.GetMaxTicks();
// Add remaining ticks to healing done // Add remaining ticks to healing done
Unit caster = eventInfo.GetActor(); Unit caster = eventInfo.GetActor();
@@ -1134,7 +1134,7 @@ namespace Scripts.Spells.Priest
{ {
SpellCastTargets targets = new SpellCastTargets(); SpellCastTargets targets = new SpellCastTargets();
targets.SetDst(destPos); targets.SetDst(destPos);
GetCaster().CastSpell(targets, Global.SpellMgr.GetSpellInfo(SpellIds.AngelicFeatherAreatrigger), null); GetCaster().CastSpell(targets, Global.SpellMgr.GetSpellInfo(SpellIds.AngelicFeatherAreatrigger, GetCastDifficulty()), null);
} }
} }
+7 -7
View File
@@ -612,7 +612,7 @@ namespace Scripts.Spells.Shaman
void ResetCooldown() void ResetCooldown()
{ {
GetCaster().GetSpellHistory().RestoreCharge(Global.SpellMgr.GetSpellInfo(SpellIds.LavaBurst).ChargeCategoryId); GetCaster().GetSpellHistory().RestoreCharge(Global.SpellMgr.GetSpellInfo(SpellIds.LavaBurst, GetCastDifficulty()).ChargeCategoryId);
} }
public override void Register() public override void Register()
@@ -747,9 +747,9 @@ namespace Scripts.Spells.Shaman
if (damageInfo == null || damageInfo.GetDamage() == 0) if (damageInfo == null || damageInfo.GetDamage() == 0)
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.Electrified); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.Electrified, GetCastDifficulty());
int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()); int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None); amount /= (int)spellInfo.GetMaxTicks();
// Add remaining ticks to damage done // Add remaining ticks to damage done
Unit caster = eventInfo.GetActor(); Unit caster = eventInfo.GetActor();
@@ -781,9 +781,9 @@ namespace Scripts.Spells.Shaman
if (damageInfo == null || damageInfo.GetDamage() == 0) if (damageInfo == null || damageInfo.GetDamage() == 0)
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.LavaBurstBonusDamage); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.LavaBurstBonusDamage, GetCastDifficulty());
int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()); int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount());
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None); amount /= (int)spellInfo.GetMaxTicks();
// Add remaining ticks to damage done // Add remaining ticks to damage done
Unit caster = eventInfo.GetActor(); Unit caster = eventInfo.GetActor();
@@ -847,9 +847,9 @@ namespace Scripts.Spells.Shaman
if (healInfo == null || healInfo.GetHeal() == 0) if (healInfo == null || healInfo.GetHeal() == 0)
return; return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.ChainedHeal); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.ChainedHeal, GetCastDifficulty());
int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()); int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());
amount /= (int)spellInfo.GetMaxTicks(Difficulty.None); amount /= (int)spellInfo.GetMaxTicks();
// Add remaining ticks to healing done // Add remaining ticks to healing done
Unit caster = eventInfo.GetActor(); Unit caster = eventInfo.GetActor();
+3 -3
View File
@@ -226,7 +226,7 @@ namespace Scripts.Spells.Warlock
// WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT. // WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT.
// If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST. // If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST.
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DemonicCircleTeleport); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DemonicCircleTeleport, GetCastDifficulty());
if (GetTarget().IsWithinDist(circle, spellInfo.GetMaxRange(true))) if (GetTarget().IsWithinDist(circle, spellInfo.GetMaxRange(true)))
{ {
@@ -338,7 +338,7 @@ namespace Scripts.Spells.Warlock
break; break;
case CreatureFamily.Voidwalker: case CreatureFamily.Voidwalker:
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DemonicEmpowermentVoidwalker); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DemonicEmpowermentVoidwalker, GetCastDifficulty());
int hp = (int)targetCreature.CountPctFromMaxHealth(GetCaster().CalculateSpellDamage(targetCreature, spellInfo, 0)); int hp = (int)targetCreature.CountPctFromMaxHealth(GetCaster().CalculateSpellDamage(targetCreature, spellInfo, 0));
targetCreature.CastCustomSpell(targetCreature, SpellIds.DemonicEmpowermentVoidwalker, hp, 0, 0, true); targetCreature.CastCustomSpell(targetCreature, SpellIds.DemonicEmpowermentVoidwalker, hp, 0, 0, true);
break; break;
@@ -556,7 +556,7 @@ namespace Scripts.Spells.Warlock
if (modOwner) if (modOwner)
modOwner.ApplySpellMod(GetId(), SpellModOp.Cost, ref damage); modOwner.ApplySpellMod(GetId(), SpellModOp.Cost, ref damage);
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, caster, GetSpellInfo().Id, GetAura().GetSpellXSpellVisualId(), GetSpellInfo().SchoolMask, GetAura().GetCastGUID()); SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, caster, GetSpellInfo(), GetAura().GetSpellXSpellVisualId(), GetSpellInfo().SchoolMask, GetAura().GetCastGUID());
damageInfo.periodicLog = true; damageInfo.periodicLog = true;
damageInfo.damage = damage; damageInfo.damage = damage;
caster.DealSpellDamage(damageInfo, false); caster.DealSpellDamage(damageInfo, false);
+1 -1
View File
@@ -823,7 +823,7 @@ namespace Scripts.Spells.Warrior
//Get the Remaining Damage from the aura (if exist) //Get the Remaining Damage from the aura (if exist)
int remainingDamage = (int)target.GetRemainingPeriodicAmount(target.GetGUID(), SpellIds.TraumaEffect, AuraType.PeriodicDamage); int remainingDamage = (int)target.GetRemainingPeriodicAmount(target.GetGUID(), SpellIds.TraumaEffect, AuraType.PeriodicDamage);
//Get 25% of damage from the spell casted (Slam & Whirlwind) plus Remaining Damage from Aura //Get 25% of damage from the spell casted (Slam & Whirlwind) plus Remaining Damage from Aura
int damage = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()) / Global.SpellMgr.GetSpellInfo(SpellIds.TraumaEffect).GetMaxTicks(Difficulty.None)) + remainingDamage; int damage = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()) / Global.SpellMgr.GetSpellInfo(SpellIds.TraumaEffect, GetCastDifficulty()).GetMaxTicks()) + remainingDamage;
GetCaster().CastCustomSpell(SpellIds.TraumaEffect, SpellValueMod.BasePoint0, damage, target, true); GetCaster().CastCustomSpell(SpellIds.TraumaEffect, SpellValueMod.BasePoint0, damage, target, true);
} }
+2 -2
View File
@@ -99,7 +99,7 @@ namespace Scripts.World
{ {
DateTime now = GameTime.GetGameTimeSystemPoint(); DateTime now = GameTime.GetGameTimeSystemPoint();
uint cooldownDuration = pair.Value.CooldownEnd > now ? (uint)(pair.Value.CooldownEnd - now).TotalMilliseconds : 0; uint cooldownDuration = pair.Value.CooldownEnd > now ? (uint)(pair.Value.CooldownEnd - now).TotalMilliseconds : 0;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds
&& spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds && spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds
&& !pair.Value.OnHold && !pair.Value.OnHold
@@ -113,7 +113,7 @@ namespace Scripts.World
// remove cooldowns on spells that have < 10 min CD and has no onHold // remove cooldowns on spells that have < 10 min CD and has no onHold
player.GetSpellHistory().ResetCooldowns(pair => player.GetSpellHistory().ResetCooldowns(pair =>
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds
&& spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds && spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds
&& !pair.Value.OnHold; && !pair.Value.OnHold;
+2 -2
View File
@@ -126,7 +126,7 @@ namespace Scripts.World
disabled = true; disabled = true;
break; break;
case 34475: case 34475:
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ItemScriptConst.SpellArcaneCharges); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ItemScriptConst.SpellArcaneCharges, player.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
Spell.SendCastResult(player, spellInfo, 0, castId, SpellCastResult.NotOnGround); Spell.SendCastResult(player, spellInfo, 0, castId, SpellCastResult.NotOnGround);
break; break;
@@ -275,7 +275,7 @@ namespace Scripts.World
if (!player.GetTransport() || player.GetAreaId() != ItemScriptConst.AreaIdShatteredStraits) if (!player.GetTransport() || player.GetAreaId() != ItemScriptConst.AreaIdShatteredStraits)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ItemScriptConst.SpellPetrovBomb); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ItemScriptConst.SpellPetrovBomb, Difficulty.None);
if (spellInfo != null) if (spellInfo != null)
Spell.SendCastResult(player, spellInfo, 0, castId, SpellCastResult.NotHere); Spell.SendCastResult(player, spellInfo, 0, castId, SpellCastResult.NotHere);
+1 -1
View File
@@ -1907,7 +1907,7 @@ namespace Scripts.World.NpcSpecial
break; break;
} }
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
if (spellInfo != null && spellInfo.GetEffect(0).Effect == SpellEffectName.SummonObjectWild) if (spellInfo != null && spellInfo.GetEffect(0).Effect == SpellEffectName.SummonObjectWild)
return (uint)spellInfo.GetEffect(0).MiscValue; return (uint)spellInfo.GetEffect(0).MiscValue;
+64 -60
View File
@@ -1,8 +1,8 @@
-- MySQL dump 10.16 Distrib 10.1.6-MariaDB, for Win64 (AMD64) -- MySQL dump 10.13 Distrib 5.7.29, for Linux (x86_64)
-- --
-- Host: localhost Database: characters -- Host: localhost Database: characters
-- ------------------------------------------------------ -- ------------------------------------------------------
-- Server version 10.1.6-MariaDB -- Server version 5.7.29-0ubuntu0.18.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -166,8 +166,8 @@ DROP TABLE IF EXISTS `auction_bidders`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auction_bidders` ( CREATE TABLE `auction_bidders` (
`auctionId` int unsigned NOT NULL, `auctionId` int(10) unsigned NOT NULL,
`playerGuid` bigint unsigned NOT NULL, `playerGuid` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`auctionId`,`playerGuid`) PRIMARY KEY (`auctionId`,`playerGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@@ -189,8 +189,8 @@ DROP TABLE IF EXISTS `auction_items`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auction_items` ( CREATE TABLE `auction_items` (
`auctionId` int unsigned NOT NULL, `auctionId` int(10) unsigned NOT NULL,
`itemGuid` bigint unsigned NOT NULL, `itemGuid` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`auctionId`,`itemGuid`), PRIMARY KEY (`auctionId`,`itemGuid`),
UNIQUE KEY `idx_itemGuid` (`itemGuid`) UNIQUE KEY `idx_itemGuid` (`itemGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -511,6 +511,7 @@ CREATE TABLE `character_aura` (
`spell` int(10) unsigned NOT NULL, `spell` int(10) unsigned NOT NULL,
`effectMask` int(10) unsigned NOT NULL, `effectMask` int(10) unsigned NOT NULL,
`recalculateMask` int(10) unsigned NOT NULL DEFAULT '0', `recalculateMask` int(10) unsigned NOT NULL DEFAULT '0',
`difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
`stackCount` tinyint(3) unsigned NOT NULL DEFAULT '1', `stackCount` tinyint(3) unsigned NOT NULL DEFAULT '1',
`maxDuration` int(11) NOT NULL DEFAULT '0', `maxDuration` int(11) NOT NULL DEFAULT '0',
`remainTime` int(11) NOT NULL DEFAULT '0', `remainTime` int(11) NOT NULL DEFAULT '0',
@@ -2942,26 +2943,26 @@ CREATE TABLE `item_instance_azerite` (
`xp` bigint(20) unsigned NOT NULL DEFAULT '0', `xp` bigint(20) unsigned NOT NULL DEFAULT '0',
`level` int(10) unsigned NOT NULL DEFAULT '1', `level` int(10) unsigned NOT NULL DEFAULT '1',
`knowledgeLevel` int(10) unsigned NOT NULL DEFAULT '0', `knowledgeLevel` int(10) unsigned NOT NULL DEFAULT '0',
`selectedAzeriteEssences1specId` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences1specId` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences1azeriteEssenceId1` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences1azeriteEssenceId1` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences1azeriteEssenceId2` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences1azeriteEssenceId2` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences1azeriteEssenceId3` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences1azeriteEssenceId3` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences1azeriteEssenceId4` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences1azeriteEssenceId4` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences2specId` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences2specId` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences2azeriteEssenceId1` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences2azeriteEssenceId1` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences2azeriteEssenceId2` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences2azeriteEssenceId2` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences2azeriteEssenceId3` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences2azeriteEssenceId3` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences2azeriteEssenceId4` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences2azeriteEssenceId4` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences3specId` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences3specId` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences3azeriteEssenceId1` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences3azeriteEssenceId1` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences3azeriteEssenceId2` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences3azeriteEssenceId2` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences3azeriteEssenceId3` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences3azeriteEssenceId3` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences3azeriteEssenceId4` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences3azeriteEssenceId4` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences4specId` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences4specId` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences4azeriteEssenceId1` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences4azeriteEssenceId1` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences4azeriteEssenceId2` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences4azeriteEssenceId2` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences4azeriteEssenceId3` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences4azeriteEssenceId3` int(10) unsigned DEFAULT '0',
`selectedAzeriteEssences4azeriteEssenceId4` int(10) unsigned NULL DEFAULT '0', `selectedAzeriteEssences4azeriteEssenceId4` int(10) unsigned DEFAULT '0',
PRIMARY KEY (`itemGuid`) PRIMARY KEY (`itemGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@@ -3026,7 +3027,7 @@ LOCK TABLES `item_instance_azerite_milestone_power` WRITE;
UNLOCK TABLES; UNLOCK TABLES;
-- --
-- Table structure for table `item_instance_azerite` -- Table structure for table `item_instance_azerite_unlocked_essence`
-- --
DROP TABLE IF EXISTS `item_instance_azerite_unlocked_essence`; DROP TABLE IF EXISTS `item_instance_azerite_unlocked_essence`;
@@ -3342,6 +3343,7 @@ CREATE TABLE `pet_aura` (
`spell` int(10) unsigned NOT NULL, `spell` int(10) unsigned NOT NULL,
`effectMask` int(10) unsigned NOT NULL, `effectMask` int(10) unsigned NOT NULL,
`recalculateMask` int(10) unsigned NOT NULL DEFAULT '0', `recalculateMask` int(10) unsigned NOT NULL DEFAULT '0',
`difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
`stackCount` tinyint(3) unsigned NOT NULL DEFAULT '1', `stackCount` tinyint(3) unsigned NOT NULL DEFAULT '1',
`maxDuration` int(11) NOT NULL DEFAULT '0', `maxDuration` int(11) NOT NULL DEFAULT '0',
`remainTime` int(11) NOT NULL DEFAULT '0', `remainTime` int(11) NOT NULL DEFAULT '0',
@@ -3711,11 +3713,11 @@ INSERT INTO `updates` VALUES
('2015_09_10_00_characters.sql','4555A7F35C107E54C13D74D20F141039ED42943E','ARCHIVED','2015-09-10 22:50:42',0), ('2015_09_10_00_characters.sql','4555A7F35C107E54C13D74D20F141039ED42943E','ARCHIVED','2015-09-10 22:50:42',0),
('2015_10_16_00_characters.sql','E3A3FFF0CB42F04A8DCF0CE4362143C16E2083AF','ARCHIVED','2015-10-15 21:54:11',0), ('2015_10_16_00_characters.sql','E3A3FFF0CB42F04A8DCF0CE4362143C16E2083AF','ARCHIVED','2015-10-15 21:54:11',0),
('2015_11_06_00_characters_2015_10_12_00.sql','D6F9927BDED72AD0A81D6EC2C6500CBC34A39FA2','ARCHIVED','2015-11-06 23:43:27',0), ('2015_11_06_00_characters_2015_10_12_00.sql','D6F9927BDED72AD0A81D6EC2C6500CBC34A39FA2','ARCHIVED','2015-11-06 23:43:27',0),
('2015_11_08_00_characters.sql','0ACDD35EC9745231BCFA701B78056DEF94D0CC53','ARCHIVED','2015-11-08 00:51:45',15), ('2015_11_08_00_characters.sql','0ACDD35EC9745231BCFA701B78056DEF94D0CC53','ARCHIVED','2015-11-08 00:51:45',0),
('2015_11_23_00_characters.sql','9FC828E9E48E8E2E9B99A5A0073D6614C5BFC6B5','ARCHIVED','2015-11-22 23:27:34',0), ('2015_11_23_00_characters.sql','9FC828E9E48E8E2E9B99A5A0073D6614C5BFC6B5','ARCHIVED','2015-11-22 23:27:34',0),
('2016_01_05_00_characters.sql','0EAD24977F40DE2476B4567DA2B477867CC0DA1A','ARCHIVED','2016-01-04 23:07:40',0), ('2016_01_05_00_characters.sql','0EAD24977F40DE2476B4567DA2B477867CC0DA1A','ARCHIVED','2016-01-04 23:07:40',0),
('2016_04_05_00_characters_2016_02_10_00_characters.sql','F1B4DA202819CABC7319A4470A2D224A34609E97','ARCHIVED','2016-04-05 20:34:41',0), ('2016_04_05_00_characters_2016_02_10_00_characters.sql','F1B4DA202819CABC7319A4470A2D224A34609E97','ARCHIVED','2016-04-05 20:34:41',0),
('2016_04_11_00_characters.sql','0ACDD35EC9745231BCFA701B78056DEF94D0CC53','ARCHIVED','2016-04-11 02:24:14',30), ('2016_04_11_00_characters.sql','0ACDD35EC9745231BCFA701B78056DEF94D0CC53','ARCHIVED','2016-04-11 02:24:14',0),
('2016_04_11_01_characters.sql','CA90F6D99C1EEA7B25BD58BC8368A8D78234BBEF','ARCHIVED','2016-04-11 18:14:18',0), ('2016_04_11_01_characters.sql','CA90F6D99C1EEA7B25BD58BC8368A8D78234BBEF','ARCHIVED','2016-04-11 18:14:18',0),
('2016_05_07_00_characters.sql','D1DB5557B21A552C935564D829B4E98B98149077','ARCHIVED','2016-05-07 00:00:00',0), ('2016_05_07_00_characters.sql','D1DB5557B21A552C935564D829B4E98B98149077','ARCHIVED','2016-05-07 00:00:00',0),
('2016_05_26_00_characters.sql','4179ADC32B96FD8D7D4CF5509A470B1ACE00BE85','ARCHIVED','2016-05-26 17:06:16',0), ('2016_05_26_00_characters.sql','4179ADC32B96FD8D7D4CF5509A470B1ACE00BE85','ARCHIVED','2016-05-26 17:06:16',0),
@@ -3731,7 +3733,7 @@ INSERT INTO `updates` VALUES
('2016_07_19_08_characters.sql','FB41FD2F8A7114FEE154021A9D47488C4B12E2A9','ARCHIVED','2016-07-19 14:36:29',0), ('2016_07_19_08_characters.sql','FB41FD2F8A7114FEE154021A9D47488C4B12E2A9','ARCHIVED','2016-07-19 14:36:29',0),
('2016_08_15_00_characters.sql','BF0B5F453384210CD77C54E262A19B888AAA4095','ARCHIVED','2016-08-14 18:14:32',0), ('2016_08_15_00_characters.sql','BF0B5F453384210CD77C54E262A19B888AAA4095','ARCHIVED','2016-08-14 18:14:32',0),
('2016_08_25_00_characters.sql','4AD506C3FCE54238EF452AC07EC562BD41A9D50C','ARCHIVED','2016-08-25 22:54:11',0), ('2016_08_25_00_characters.sql','4AD506C3FCE54238EF452AC07EC562BD41A9D50C','ARCHIVED','2016-08-25 22:54:11',0),
('2016_10_17_00_characters.sql','A0EF594CD73690D46A46031137DB0E895F079235','ARCHIVED','2016-10-16 16:33:05',25), ('2016_10_17_00_characters.sql','A0EF594CD73690D46A46031137DB0E895F079235','ARCHIVED','2016-10-16 16:33:05',0),
('2016_10_25_00_characters.sql','CC894484561CE138C10B69D34F7831CEDFAF496B','ARCHIVED','2016-10-25 17:19:35',0), ('2016_10_25_00_characters.sql','CC894484561CE138C10B69D34F7831CEDFAF496B','ARCHIVED','2016-10-25 17:19:35',0),
('2016_11_06_00_characters.sql','C7EC8B65C1BE7722C53BAB79C52C1549054178C0','ARCHIVED','2016-11-06 23:05:44',0), ('2016_11_06_00_characters.sql','C7EC8B65C1BE7722C53BAB79C52C1549054178C0','ARCHIVED','2016-11-06 23:05:44',0),
('2016_12_09_00_characters.sql','2A68E4187CE7F7294CBC3804AC39F48B2727E64E','ARCHIVED','2016-12-09 18:38:46',0), ('2016_12_09_00_characters.sql','2A68E4187CE7F7294CBC3804AC39F48B2727E64E','ARCHIVED','2016-12-09 18:38:46',0),
@@ -3740,42 +3742,43 @@ INSERT INTO `updates` VALUES
('2017_01_29_00_characters.sql','E7475DCC13A0910FF23BF0EFB731629950A73A0D','ARCHIVED','2017-01-29 15:00:00',0), ('2017_01_29_00_characters.sql','E7475DCC13A0910FF23BF0EFB731629950A73A0D','ARCHIVED','2017-01-29 15:00:00',0),
('2017_02_26_00_characters_2016_09_13_00_characters.sql','2EF7AD507D097ABC74FF1E98A65BEC03B12E51C6','ARCHIVED','2017-02-26 19:57:47',0), ('2017_02_26_00_characters_2016_09_13_00_characters.sql','2EF7AD507D097ABC74FF1E98A65BEC03B12E51C6','ARCHIVED','2017-02-26 19:57:47',0),
('2017_04_15_00_characters.sql','F118BA33CD7DDF2EE5673C6749C2965EFFF53C23','ARCHIVED','2017-04-15 12:10:50',0), ('2017_04_15_00_characters.sql','F118BA33CD7DDF2EE5673C6749C2965EFFF53C23','ARCHIVED','2017-04-15 12:10:50',0),
('2017_04_19_00_characters.sql','5A36FD9015ED024BC085F995F72DC81B47CD1093','ARCHIVED','2017-04-18 23:16:18',30), ('2017_04_19_00_characters.sql','5A36FD9015ED024BC085F995F72DC81B47CD1093','ARCHIVED','2017-04-18 23:16:18',0),
('2017_05_08_00_characters.sql','86B5603EEBE1DE0EA56DBB264257967CFE583F46','ARCHIVED','2017-05-08 23:54:40',0), ('2017_05_08_00_characters.sql','86B5603EEBE1DE0EA56DBB264257967CFE583F46','ARCHIVED','2017-05-08 23:54:40',0),
('2017_05_14_00_characters.sql','3452261F366BFE76BB59C0AAA674FA1513042899','ARCHIVED','2017-05-14 17:29:04',0), ('2017_05_14_00_characters.sql','3452261F366BFE76BB59C0AAA674FA1513042899','ARCHIVED','2017-05-14 17:29:04',0),
('2017_05_24_00_characters.sql','02701BF57589CD41456A748AEF425CBB2D3E6AD7','ARCHIVED','2017-05-24 22:00:00',0), ('2017_05_24_00_characters.sql','02701BF57589CD41456A748AEF425CBB2D3E6AD7','ARCHIVED','2017-05-24 22:00:00',0),
('2017_06_04_00_characters.sql','BC80D2B7515CC6E01701070D2DA466727F36DB5E','ARCHIVED','2017-06-04 14:43:26',0), ('2017_06_04_00_characters.sql','BC80D2B7515CC6E01701070D2DA466727F36DB5E','ARCHIVED','2017-06-04 14:43:26',0),
('2017_08_20_00_characters.sql','8C5BBF6AEAA6C7DE2F40A7D3878C8187A4729F13','ARCHIVED','2017-08-20 17:00:00',0), ('2017_08_20_00_characters.sql','8C5BBF6AEAA6C7DE2F40A7D3878C8187A4729F13','ARCHIVED','2017-08-20 17:00:00',0),
('2017_08_20_01_characters.sql','2F50D5E6BF3888B8C5270D79228A1D0601FAFF1D','ARCHIVED','2017-08-20 17:52:21',0), ('2017_08_20_01_characters.sql','2F50D5E6BF3888B8C5270D79228A1D0601FAFF1D','ARCHIVED','2017-08-20 17:52:21',0),
('2017_10_29_00_characters.sql','8CFC473E7E87E58C317A72016BF69E9050D3BC83','ARCHIVED','2017-04-19 00:07:40',25), ('2017_10_29_00_characters.sql','8CFC473E7E87E58C317A72016BF69E9050D3BC83','ARCHIVED','2017-04-19 00:07:40',0),
('2018_02_03_00_characters.sql','73E9BFD848D7A22F2A7DD89CF64E30E3A8689512','ARCHIVED','2018-02-03 23:52:42',0), ('2018_02_03_00_characters.sql','73E9BFD848D7A22F2A7DD89CF64E30E3A8689512','ARCHIVED','2018-02-03 23:52:42',0),
('2018_02_08_00_characters.sql','75FA162A9B85D678B26F972371265F1EC2C75187','ARCHIVED','2018-02-08 22:23:28',0), ('2018_02_08_00_characters.sql','75FA162A9B85D678B26F972371265F1EC2C75187','ARCHIVED','2018-02-08 22:23:28',0),
('2018_02_19_00_characters.sql','75A0FFAFD0633921708DB0F72F9CC9796ACB960B','RELEASED','2018-02-19 22:33:32',117), ('2018_02_19_00_characters.sql','75A0FFAFD0633921708DB0F72F9CC9796ACB960B','ARCHIVED','2018-02-19 22:33:32',0),
('2018_03_04_00_characters.sql','2A4CD2EE2547E718490706FADC78BF36F0DED8D6','RELEASED','2018-03-04 18:15:24',0), ('2018_03_04_00_characters.sql','2A4CD2EE2547E718490706FADC78BF36F0DED8D6','ARCHIVED','2018-03-04 18:15:24',0),
('2018_04_28_00_characters.sql','CBD0FDC0F32DE3F456F7CE3D9CAD6933CD6A50F5','RELEASED','2018-04-28 12:44:09',0), ('2018_04_28_00_characters.sql','CBD0FDC0F32DE3F456F7CE3D9CAD6933CD6A50F5','ARCHIVED','2018-04-28 12:44:09',0),
('2018_07_28_00_characters.sql','31F66AE7831251A8915625EC7F10FA138AB8B654','RELEASED','2018-07-28 18:30:19',0), ('2018_07_28_00_characters.sql','31F66AE7831251A8915625EC7F10FA138AB8B654','ARCHIVED','2018-07-28 18:30:19',0),
('2018_07_31_00_characters.sql','7DA8D4A4534520B23E6F5BBD5B8EE205B799C798','RELEASED','2018-07-31 20:54:39',0), ('2018_07_31_00_characters.sql','7DA8D4A4534520B23E6F5BBD5B8EE205B799C798','ARCHIVED','2018-07-31 20:54:39',0),
('2018_12_09_00_characters.sql','7FE9641C93ED762597C08F1E9B6649C9EC2F0E47','RELEASED','2018-09-18 23:34:29',0), ('2018_12_09_00_characters.sql','7FE9641C93ED762597C08F1E9B6649C9EC2F0E47','ARCHIVED','2018-09-18 23:34:29',0),
('2018_12_09_01_characters.sql','C80B936AAD94C58A0F33382CED08CFB4E0B6AC34','RELEASED','2018-10-10 22:05:28',0), ('2018_12_09_01_characters.sql','C80B936AAD94C58A0F33382CED08CFB4E0B6AC34','ARCHIVED','2018-10-10 22:05:28',0),
('2018_12_09_02_characters.sql','DBBA0C06985CE8AC4E6E7E94BD6B2673E9ADFAE2','RELEASED','2018-12-02 17:32:31',0), ('2018_12_09_02_characters.sql','DBBA0C06985CE8AC4E6E7E94BD6B2673E9ADFAE2','ARCHIVED','2018-12-02 17:32:31',0),
('2019_06_08_00_characters.sql','6C5AF52AEF03BC019B96E7A07592C22660F9327B','RELEASED','2019-06-03 20:04:47',0), ('2019_06_08_00_characters.sql','6C5AF52AEF03BC019B96E7A07592C22660F9327B','ARCHIVED','2019-06-03 20:04:47',0),
('2019_06_08_01_characters.sql','55076AFAF4B55DB4E34029C269EE0C84315C31BA','RELEASED','2019-06-04 22:11:47',0), ('2019_06_08_01_characters.sql','55076AFAF4B55DB4E34029C269EE0C84315C31BA','ARCHIVED','2019-06-04 22:11:47',0),
('2019_06_25_00_characters.sql','B8CBF79DEE02B40B01424327D31E52C70335BEC6','RELEASED','2019-06-25 22:40:37',0), ('2019_06_25_00_characters.sql','B8CBF79DEE02B40B01424327D31E52C70335BEC6','ARCHIVED','2019-06-25 22:40:37',0),
('2019_07_15_00_characters.sql','E1C77F604FB2A2FE8B32258CD0C9EC71BEA4F0FF','RELEASED','2019-06-25 22:40:37',0), ('2019_07_15_00_characters.sql','E1C77F604FB2A2FE8B32258CD0C9EC71BEA4F0FF','ARCHIVED','2019-06-25 22:40:37',0),
('2019_10_26_00_characters.sql','F1090ACDEB876A7BB5ED8829373F6305A217949A','RELEASED','2019-10-25 23:04:42',0), ('2019_10_26_00_characters.sql','F1090ACDEB876A7BB5ED8829373F6305A217949A','ARCHIVED','2019-10-25 23:04:42',0),
('2019_10_26_01_characters.sql','59D5860930D02AB77D2AAA704C564957A9143760','RELEASED','2019-10-26 22:04:46',0), ('2019_10_26_01_characters.sql','59D5860930D02AB77D2AAA704C564957A9143760','ARCHIVED','2019-10-26 22:04:46',0),
('2019_11_03_00_characters.sql','DC789597F85B890E9A7901B4443DAD9CAEE2A02A','RELEASED','2019-11-03 14:13:27',0), ('2019_11_03_00_characters.sql','DC789597F85B890E9A7901B4443DAD9CAEE2A02A','ARCHIVED','2019-11-03 14:13:27',0),
('2019_11_12_00_characters.sql','D4C642B4D48DAE9F56329BDE51C258323A132A91','RELEASED','2019-11-12 16:31:29',0), ('2019_11_12_00_characters.sql','D4C642B4D48DAE9F56329BDE51C258323A132A91','ARCHIVED','2019-11-12 16:31:29',0),
('2019_11_22_00_characters.sql','95DFA71DBD75542C098CD86E9C0051C9690902F0','RELEASED','2019-11-20 15:10:12',0), ('2019_11_22_00_characters.sql','95DFA71DBD75542C098CD86E9C0051C9690902F0','ARCHIVED','2019-11-20 15:10:12',0),
('2019_11_30_00_characters.sql','D0678E62B651AECA60C2DD6989BF80BD999AD12B','RELEASED','2019-11-29 22:42:01',0), ('2019_11_30_00_characters.sql','D0678E62B651AECA60C2DD6989BF80BD999AD12B','ARCHIVED','2019-11-29 22:42:01',0),
('2019_12_05_00_characters.sql','EA381C9634A5646A3168F15DF4E06A708A622762','RELEASED','2019-12-05 20:56:58',0), ('2019_12_05_00_characters.sql','EA381C9634A5646A3168F15DF4E06A708A622762','ARCHIVED','2019-12-05 20:56:58',0),
('2020_02_17_00_characters.sql','E1519A81D35F19B48B3C75A83A270CB4BA0B84F2','RELEASED','2020-02-17 21:55:17',0), ('2020_02_17_00_characters.sql','E1519A81D35F19B48B3C75A83A270CB4BA0B84F2','ARCHIVED','2020-02-17 21:55:17',0),
('2020_04_20_00_characters.sql','977B5E0C894E0A7E80B2A9626F17CA636A69BD22','RELEASED','2020-04-20 19:08:18',0), ('2020_04_20_00_characters.sql','977B5E0C894E0A7E80B2A9626F17CA636A69BD22','ARCHIVED','2020-04-20 19:08:18',0),
('2020_04_24_00_characters.sql','85E2E0395A9457A53D73A9E0A7BB39B7E4C429BF','RELEASED','2020-04-24 22:04:59',0), ('2020_04_24_00_characters.sql','85E2E0395A9457A53D73A9E0A7BB39B7E4C429BF','ARCHIVED','2020-04-24 22:04:59',0),
('2020_04_25_00_characters_2017_04_03_00_characters.sql','00FA3EFADAF807AC96619A3FE47216E21C3FCB19','RELEASED','2020-04-25 00:00:00',0), ('2020_04_25_00_characters_2017_04_03_00_characters.sql','00FA3EFADAF807AC96619A3FE47216E21C3FCB19','ARCHIVED','2020-04-25 00:00:00',0),
('2020_04_26_00_characters_2017_04_12_00_characters.sql','86AA94DA9B1EA283101100886C10F648C0CE6494','RELEASED','2020-04-26 00:00:00',0), ('2020_04_26_00_characters_2017_04_12_00_characters.sql','86AA94DA9B1EA283101100886C10F648C0CE6494','ARCHIVED','2020-04-26 00:00:00',0),
('2020_04_26_01_characters_2017_04_12_01_characters.sql','5A8A1215E3A2356722F52CD7A64BBE03D21FBEA3','RELEASED','2020-04-26 00:00:00',0); ('2020_04_26_01_characters_2017_04_12_01_characters.sql','5A8A1215E3A2356722F52CD7A64BBE03D21FBEA3','ARCHIVED','2020-04-26 00:00:00',0),
('2020_06_12_00_characters.sql','DF16C99EFACA4DFADDDF35644AAC63F9B4AA2BD6','ARCHIVED','2020-06-11 16:24:56',0),
('2020_06_17_00_characters.sql','C3EE0D751E4B97CDF15F3BE27AAAE3646514A358','ARCHIVED','2020-06-17 17:04:56',0);
/*!40000 ALTER TABLE `updates` ENABLE KEYS */; /*!40000 ALTER TABLE `updates` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -3803,7 +3806,8 @@ INSERT INTO `updates_include` VALUES
('$/sql/updates/characters','RELEASED'), ('$/sql/updates/characters','RELEASED'),
('$/sql/custom/characters','RELEASED'), ('$/sql/custom/characters','RELEASED'),
('$/sql/old/6.x/characters','ARCHIVED'), ('$/sql/old/6.x/characters','ARCHIVED'),
('$/sql/old/7/characters','ARCHIVED'); ('$/sql/old/7/characters','ARCHIVED'),
('$/sql/old/8.x/characters','ARCHIVED');
/*!40000 ALTER TABLE `updates_include` ENABLE KEYS */; /*!40000 ALTER TABLE `updates_include` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -3868,4 +3872,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-02-19 22:43:09 -- Dump completed on 2020-06-17 17:04:58