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
+9 -9
View File
@@ -1760,7 +1760,7 @@ namespace Game.Entities
return false;
bool immunedToAllEffects = true;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{
if (effect == null || !effect.IsEffect())
continue;
@@ -1780,7 +1780,7 @@ namespace Game.Entities
public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster)
{
SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index);
SpellEffectInfo effect = spellInfo.GetEffect(index);
if (effect == null)
return true;
@@ -1816,7 +1816,7 @@ namespace Game.Entities
{
if (m_spells[i] == 0)
continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i]);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i], GetMap().GetDifficultyID());
if (spellInfo == null)
{
Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]);
@@ -1824,7 +1824,7 @@ namespace Game.Entities
}
bool bcontinue = true;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{
if (effect != null && ((effect.Effect == SpellEffectName.SchoolDamage) || (effect.Effect == SpellEffectName.Instakill)
|| (effect.Effect == SpellEffectName.EnvironmentalDamage) || (effect.Effect == SpellEffectName.HealthLeech)))
@@ -1865,7 +1865,7 @@ namespace Game.Entities
{
if (m_spells[i] == 0)
continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i]);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(m_spells[i], GetMap().GetDifficultyID());
if (spellInfo == null)
{
Log.outError(LogFilter.Unit, "WORLD: unknown spell id {0}", m_spells[i]);
@@ -1873,7 +1873,7 @@ namespace Game.Entities
}
bool bcontinue = true;
foreach (SpellEffectInfo effect in spellInfo.GetEffectsForDifficulty(GetMap().GetDifficultyID()))
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
{
if (effect != null && effect.Effect == SpellEffectName.Heal)
{
@@ -2209,7 +2209,7 @@ namespace Game.Entities
{
foreach (var id in cainfo.auras)
{
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id);
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id, GetMap().GetDifficultyID());
if (AdditionalSpellInfo == null)
{
Log.outError(LogFilter.Sql, "Creature ({0}) has wrong spell {1} defined in `auras` field.", GetGUID().ToString(), id);
@@ -2593,7 +2593,7 @@ namespace Game.Entities
if (spellID == 0)
continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID, GetMap().GetDifficultyID());
if (spellInfo != null)
{
if (spellInfo.GetRecoveryTime() == 0 // No cooldown
@@ -2771,7 +2771,7 @@ namespace Game.Entities
SpellInfo spellInfo = focusSpell.GetSpellInfo();
// don't use spell focus for vehicle spells
if (spellInfo.HasAura(Difficulty.None, AuraType.ControlVehicle))
if (spellInfo.HasAura(AuraType.ControlVehicle))
return;
if ((!target || target == this) && focusSpell.GetCastTime() == 0) // instant cast, untargeted (or self-targeted) spell doesn't need any facing updates
+5 -11
View File
@@ -442,18 +442,12 @@ namespace Game.Misc
packet.SuggestedPartyMembers = quest.SuggestedPlayers;
// RewardSpell can teach multiple spells in trigger spell effects. But not all effects must be SPELL_EFFECT_LEARN_SPELL. See example spell 33950
if (quest.RewardSpell != 0)
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell, Difficulty.None);
if (spellInfo != null)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell);
if (spellInfo.HasEffect(SpellEffectName.LearnSpell))
{
var effects = spellInfo.GetEffectsForDifficulty(Difficulty.None);
foreach (var spellEffectInfo in effects)
{
if (spellEffectInfo.IsEffect(SpellEffectName.LearnSpell))
packet.LearnSpells.Add(spellEffectInfo.TriggerSpell);
}
}
foreach (SpellEffectInfo effect in spellInfo.GetEffects())
if (effect.IsEffect(SpellEffectName.LearnSpell))
packet.LearnSpells.Add(effect.TriggerSpell);
}
quest.BuildQuestRewards(packet.Rewards, _session.GetPlayer());
+3 -3
View File
@@ -15,7 +15,7 @@ namespace Game.Entities
public Array<uint> ReqAbility = new Array<uint>(3);
public byte ReqLevel;
public bool IsCastable() { return Global.SpellMgr.GetSpellInfo(SpellId).HasEffect(SpellEffectName.LearnSpell); }
public bool IsCastable() { return Global.SpellMgr.GetSpellInfo(SpellId, Difficulty.None).HasEffect(SpellEffectName.LearnSpell); }
}
public class Trainer
@@ -98,7 +98,7 @@ namespace Game.Entities
if (state != TrainerSpellState.Available)
return false;
SpellInfo trainerSpellInfo = Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId);
SpellInfo trainerSpellInfo = Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None);
if (trainerSpellInfo.IsPrimaryProfessionFirstRank() && player.GetFreePrimaryProfessionPoints() == 0)
return false;
@@ -129,7 +129,7 @@ namespace Game.Entities
// check ranks
bool hasLearnSpellEffect = false;
bool knowsAllLearnedSpells = true;
foreach (SpellEffectInfo spellEffect in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId).GetEffectsForDifficulty(Difficulty.None))
foreach (SpellEffectInfo spellEffect in Global.SpellMgr.GetSpellInfo(trainerSpell.SpellId, Difficulty.None).GetEffects())
{
if (spellEffect == null || !spellEffect.IsEffect(SpellEffectName.LearnSpell))
continue;