Core/Spells: Fixed value of aura effects for stat mod auras applied by items

Port From (https://github.com/TrinityCore/TrinityCore/commit/123858331211db6fe6745f0886c1499f8e598443)
This commit is contained in:
hondacrx
2019-12-02 14:01:46 -05:00
parent 40ed357043
commit cdb225a4b6
13 changed files with 120 additions and 75 deletions
@@ -83,7 +83,7 @@ namespace Framework.Database
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_AURAS, "SELECT casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges, castItemLevel FROM character_aura 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_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_QUESTSTATUS, "SELECT quest, status, timer FROM character_queststatus WHERE guid = ? AND status <> 0");
@@ -322,8 +322,8 @@ namespace Framework.Database
PrepareStatement(CharStatements.DEL_TRANSMOG_OUTFIT, "DELETE FROM character_transmog_outfits WHERE setguid=?");
// Auras
PrepareStatement(CharStatements.INS_AURA, "INSERT INTO character_aura (guid, casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges, castItemLevel) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.INS_AURA, "INSERT INTO character_aura (guid, casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, maxDuration, remainTime, remainCharges, castItemId, castItemLevel) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.INS_AURA_EFFECT, "INSERT INTO character_aura_effect (guid, casterGuid, itemGuid, spell, effectMask, effectIndex, amount, baseAmount) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
+27 -2
View File
@@ -359,7 +359,7 @@ namespace Game.DataStorage
BarberShopCostBaseGameTable = GameTableReader.Read<GtBarberShopCostBaseRecord>("BarberShopCostBase.txt");
BaseMPGameTable = GameTableReader.Read<GtBaseMPRecord>("BaseMp.txt");
CombatRatingsGameTable = GameTableReader.Read<GtCombatRatingsRecord>("CombatRatings.txt");
CombatRatingsMultByILvlGameTable = GameTableReader.Read<GtCombatRatingsMultByILvlRecord>("CombatRatingsMultByILvl.txt");
CombatRatingsMultByILvlGameTable = GameTableReader.Read<GtGenericMultByILvlRecord>("CombatRatingsMultByILvl.txt");
ItemSocketCostPerLevelGameTable = GameTableReader.Read<GtItemSocketCostPerLevelRecord>("ItemSocketCostPerLevel.txt");
HpPerStaGameTable = GameTableReader.Read<GtHpPerStaRecord>("HpPerSta.txt");
NpcDamageByClassGameTable[0] = GameTableReader.Read<GtNpcDamageByClassRecord>("NpcDamageByClass.txt");
@@ -380,6 +380,7 @@ namespace Game.DataStorage
NpcTotalHpGameTable[6] = GameTableReader.Read<GtNpcTotalHpRecord>("NpcTotalHpExp6.txt");
NpcTotalHpGameTable[7] = GameTableReader.Read<GtNpcTotalHpRecord>("NpcTotalHpExp7.txt");
SpellScalingGameTable = GameTableReader.Read<GtSpellScalingRecord>("SpellScaling.txt");
StaminaMultByILvlGameTable = GameTableReader.Read<GtGenericMultByILvlRecord>("StaminaMultByILvl.txt");
XpGameTable = GameTableReader.Read<GtXpRecord>("xp.txt");
Log.outInfo(LogFilter.ServerLoading, "Initialized {0} DBC GameTables data stores in {1} ms", LoadedFileCount, Time.GetMSTimeDiffToNow(oldMSTime));
@@ -641,13 +642,14 @@ namespace Game.DataStorage
public static GameTable<GtBarberShopCostBaseRecord> BarberShopCostBaseGameTable;
public static GameTable<GtBaseMPRecord> BaseMPGameTable;
public static GameTable<GtCombatRatingsRecord> CombatRatingsGameTable;
public static GameTable<GtCombatRatingsMultByILvlRecord> CombatRatingsMultByILvlGameTable;
public static GameTable<GtGenericMultByILvlRecord> CombatRatingsMultByILvlGameTable;
public static GameTable<GtHpPerStaRecord> HpPerStaGameTable;
public static GameTable<GtItemSocketCostPerLevelRecord> ItemSocketCostPerLevelGameTable;
public static GameTable<GtNpcDamageByClassRecord>[] NpcDamageByClassGameTable = new GameTable<GtNpcDamageByClassRecord>[(int)Expansion.Max];
public static GameTable<GtNpcManaCostScalerRecord> NpcManaCostScalerGameTable;
public static GameTable<GtNpcTotalHpRecord>[] NpcTotalHpGameTable = new GameTable<GtNpcTotalHpRecord>[(int)Expansion.Max];
public static GameTable<GtSpellScalingRecord> SpellScalingGameTable;
public static GameTable<GtGenericMultByILvlRecord> StaminaMultByILvlGameTable;
public static GameTable<GtXpRecord> XpGameTable;
#endregion
@@ -747,6 +749,29 @@ namespace Game.DataStorage
return 0.0f;
}
public static float GetIlvlStatMultiplier(GtGenericMultByILvlRecord row, InventoryType invType)
{
switch (invType)
{
case InventoryType.Neck:
case InventoryType.Finger:
return row.JewelryMultiplier;
case InventoryType.Trinket:
return row.TrinketMultiplier;
case InventoryType.Weapon:
case InventoryType.Shield:
case InventoryType.Ranged:
case InventoryType.Weapon2Hand:
case InventoryType.WeaponMainhand:
case InventoryType.WeaponOffhand:
case InventoryType.Holdable:
case InventoryType.RangedRight:
return row.WeaponMultiplier;
default:
return row.ArmorMultiplier;
}
}
#endregion
}
}
@@ -90,7 +90,7 @@ namespace Game.DataStorage
public float Unused12;
}
public sealed class GtCombatRatingsMultByILvlRecord
public sealed class GtGenericMultByILvlRecord
{
public float ArmorMultiplier;
public float WeaponMultiplier;
+4 -2
View File
@@ -487,7 +487,8 @@ namespace Game.Entities
int maxDuration = auraResult.Read<int>(6);
int remainTime = auraResult.Read<int>(7);
byte remainCharges = auraResult.Read<byte>(8);
int castItemLevel = auraResult.Read<int>(9);
uint castItemId = auraResult.Read<uint>(9);
int castItemLevel = auraResult.Read<int>(10);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(key.SpellId);
if (spellInfo == null)
@@ -518,7 +519,7 @@ namespace Game.Entities
AuraLoadEffectInfo info = effectInfo[key];
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, castItemLevel);
Aura aura = Aura.TryCreate(spellInfo, castId, key.EffectMask, this, null, info.BaseAmounts, null, casterGuid, itemGuid, castItemId, castItemLevel);
if (aura != null)
{
if (!aura.CanBeSaved())
@@ -1694,6 +1695,7 @@ namespace Game.Entities
stmt.AddValue(index++, aura.GetMaxDuration());
stmt.AddValue(index++, aura.GetDuration());
stmt.AddValue(index++, aura.GetCharges());
stmt.AddValue(index++, aura.GetCastItemId());
stmt.AddValue(index, aura.GetCastItemLevel());
trans.Append(stmt);
+6 -26
View File
@@ -4002,33 +4002,9 @@ namespace Game.Entities
uint itemLevel = item.GetItemLevel(this);
float combatRatingMultiplier = 1.0f;
GtCombatRatingsMultByILvlRecord ratingMult = CliDB.CombatRatingsMultByILvlGameTable.GetRow(itemLevel);
GtGenericMultByILvlRecord ratingMult = CliDB.CombatRatingsMultByILvlGameTable.GetRow(itemLevel);
if (ratingMult != null)
{
switch (proto.GetInventoryType())
{
case InventoryType.Weapon:
case InventoryType.Shield:
case InventoryType.Ranged:
case InventoryType.Weapon2Hand:
case InventoryType.WeaponMainhand:
case InventoryType.WeaponOffhand:
case InventoryType.Holdable:
case InventoryType.RangedRight:
combatRatingMultiplier = ratingMult.WeaponMultiplier;
break;
case InventoryType.Trinket:
combatRatingMultiplier = ratingMult.TrinketMultiplier;
break;
case InventoryType.Neck:
case InventoryType.Finger:
combatRatingMultiplier = ratingMult.JewelryMultiplier;
break;
default:
combatRatingMultiplier = ratingMult.ArmorMultiplier;
break;
}
}
combatRatingMultiplier = CliDB.GetIlvlStatMultiplier(ratingMult, proto.GetInventoryType());
// req. check at equip, but allow use for extended range if range limit max level, set proper level
for (byte i = 0; i < ItemConst.MaxStats; ++i)
@@ -4066,6 +4042,10 @@ namespace Game.Entities
//ApplyStatBuffMod(Stats.Spirit, MathFunctions.CalculatePct(val, GetModifierValue(UnitMods.StatSpirit, UnitModifierType.BasePCTExcludeCreate)), apply);
//break;
case ItemModType.Stamina: //modify stamina
GtGenericMultByILvlRecord staminaMult = CliDB.StaminaMultByILvlGameTable.GetRow(itemLevel);
if (staminaMult != null)
val = (int)(val * CliDB.GetIlvlStatMultiplier(staminaMult, proto.GetInventoryType()));
HandleStatModifier(UnitMods.StatStamina, UnitModifierType.BaseValue, (float)val, apply);
ApplyStatBuffMod(Stats.Stamina, MathFunctions.CalculatePct(val, GetModifierValue(UnitMods.StatStamina, UnitModifierType.BasePCTExcludeCreate)), apply);
break;
+7 -5
View File
@@ -33,16 +33,16 @@ namespace Game.Entities
// function uses real base points (typically value - 1)
public int CalculateSpellDamage(Unit target, SpellInfo spellProto, uint effect_index, int? basePoints = null, 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);
return effect != null ? effect.CalcValue(this, basePoints, target) : 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, 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);
variance = 0.0f;
return effect != null ? effect.CalcValue(out variance, this, basePoints, target, itemLevel) : 0;
return effect != null ? effect.CalcValue(out variance, this, basePoints, target, castItemId, itemLevel) : 0;
}
public int SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
@@ -4142,7 +4142,7 @@ namespace Game.Entities
}
}
}
public Aura _TryStackingOrRefreshingExistingAura(SpellInfo newAura, uint effMask, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1)
public Aura _TryStackingOrRefreshingExistingAura(SpellInfo newAura, uint effMask, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, uint castItemId = 0, int castItemLevel = -1)
{
Cypher.Assert(!casterGUID.IsEmpty() || caster);
@@ -4157,6 +4157,7 @@ namespace Game.Entities
if (castItem != null)
{
castItemGuid = castItem.GetGUID();
castItemId = castItem.GetEntry();
Player owner = castItem.GetOwner();
if (owner)
castItemLevel = (int)castItem.GetItemLevel(owner);
@@ -4197,6 +4198,7 @@ namespace Game.Entities
if (castItemGuid != foundAura.GetCastItemGUID())
{
foundAura.SetCastItemGUID(castItemGuid);
foundAura.SetCastItemId(castItemId);
foundAura.SetCastItemLevel(castItemLevel);
}
+23 -15
View File
@@ -284,12 +284,13 @@ namespace Game.Spells
{
const int UPDATE_TARGET_MAP_INTERVAL = 500;
public Aura(SpellInfo spellproto, ObjectGuid castId, WorldObject owner, Unit caster, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, int castItemLevel)
public Aura(SpellInfo spellproto, ObjectGuid castId, WorldObject owner, Unit caster, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
{
m_spellInfo = spellproto;
m_castGuid = castId;
m_casterGuid = !casterGUID.IsEmpty() ? casterGUID : caster.GetGUID();
m_castItemGuid = castItem != null ? castItem.GetGUID() : castItemGuid;
m_castItemId = castItem != null ? castItem.GetEntry() : castItemId;
m_castItemLevel = castItemLevel;
m_spellXSpellVisualId = caster ? caster.GetCastSpellXSpellVisualId(spellproto) : spellproto.GetSpellXSpellVisualId();
m_applyTime = Time.UnixTime;
@@ -2242,6 +2243,7 @@ namespace Game.Spells
public ObjectGuid GetCastGUID() { return m_castGuid; }
public ObjectGuid GetCasterGUID() { return m_casterGuid; }
public ObjectGuid GetCastItemGUID() { return m_castItemGuid; }
public uint GetCastItemId() { return m_castItemId; }
public int GetCastItemLevel() { return m_castItemLevel; }
public uint GetSpellXSpellVisualId() { return m_spellXSpellVisualId; }
public WorldObject GetOwner() { return m_owner; }
@@ -2261,6 +2263,11 @@ namespace Game.Spells
m_castItemGuid = guid;
}
public void SetCastItemId(uint id)
{
m_castItemId = id;
}
public void SetCastItemLevel(int level)
{
m_castItemLevel = level;
@@ -2390,12 +2397,12 @@ namespace Game.Spells
}
return (effMask & availableEffectMask);
}
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1)
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)
{
bool throwway;
return TryRefreshStackOrCreate(spellproto, castId, tryEffMask, owner, caster, out throwway, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, 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, int castItemLevel = -1)
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)
{
Cypher.Assert(spellproto != null);
Cypher.Assert(owner != null);
@@ -2406,7 +2413,7 @@ namespace Game.Spells
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
if (effMask == 0)
return null;
Aura foundAura = owner.ToUnit()._TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, castItemLevel);
Aura foundAura = owner.ToUnit()._TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, castItemId, castItemLevel);
if (foundAura != null)
{
// we've here aura, which script triggered removal after modding stack amount
@@ -2418,9 +2425,9 @@ namespace Game.Spells
return foundAura;
}
else
return Create(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel);
return Create(spellproto, castId, effMask, owner, caster, 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, int castItemLevel = -1)
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)
{
Cypher.Assert(spellproto != null);
Cypher.Assert(owner != null);
@@ -2429,9 +2436,9 @@ namespace Game.Spells
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
if (effMask == 0)
return null;
return Create(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel);
return Create(spellproto, castId, effMask, owner, caster, 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, int 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)
{
Cypher.Assert(effMask != 0);
Cypher.Assert(spellproto != null);
@@ -2461,10 +2468,10 @@ namespace Game.Spells
{
case TypeId.Unit:
case TypeId.Player:
aura = new UnitAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel);
aura = new UnitAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
break;
case TypeId.DynamicObject:
aura = new DynObjAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel);
aura = new DynObjAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemId, castItemLevel);
break;
default:
Cypher.Assert(false);
@@ -2482,6 +2489,7 @@ namespace Game.Spells
ObjectGuid m_castGuid;
ObjectGuid m_casterGuid;
ObjectGuid m_castItemGuid;
uint m_castItemId;
int m_castItemLevel;
uint m_spellXSpellVisualId;
long m_applyTime;
@@ -2518,8 +2526,8 @@ namespace Game.Spells
public class UnitAura : Aura
{
public UnitAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, int castItemLevel)
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemLevel)
public UnitAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
{
m_AuraDRGroup = DiminishingGroup.None;
LoadScripts();
@@ -2629,8 +2637,8 @@ namespace Game.Spells
public class DynObjAura : Aura
{
public DynObjAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, int castItemLevel)
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemLevel)
public DynObjAura(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, uint castItemId, int castItemLevel)
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemId, castItemLevel)
{
LoadScripts();
Cypher.Assert(GetDynobjOwner() != null);
+6 -6
View File
@@ -32,12 +32,12 @@ namespace Game.Spells
{
public class AuraEffect
{
public AuraEffect(Aura abase, uint effindex, int? baseAmount, Unit caster)
public AuraEffect(Aura baseAura, uint effindex, int? baseAmount, Unit caster)
{
auraBase = abase;
m_spellInfo = abase.GetSpellInfo();
_effectInfo = abase.GetSpellEffectInfo(effindex);
m_baseAmount = baseAmount.HasValue ? baseAmount.Value : _effectInfo.CalcBaseValue(caster, abase.GetAuraType() == AuraObjectType.Unit ? abase.GetOwner().ToUnit() : null, abase.GetCastItemLevel());
auraBase = baseAura;
m_spellInfo = baseAura.GetSpellInfo();
_effectInfo = baseAura.GetSpellEffectInfo(effindex);
m_baseAmount = baseAmount.HasValue ? baseAmount.Value : _effectInfo.CalcBaseValue(caster, baseAura.GetAuraType() == AuraObjectType.Unit ? baseAura.GetOwner().ToUnit() : null, baseAura.GetCastItemId(), baseAura.GetCastItemLevel());
m_donePct = 1.0f;
m_effIndex = (byte)effindex;
m_canBeRecalculated = true;
@@ -76,7 +76,7 @@ namespace Game.Spells
int amount = 0;
if (!m_spellInfo.HasAttribute(SpellAttr8.MasterySpecialization) || MathFunctions.fuzzyEq(GetSpellEffectInfo().BonusCoefficient, 0.0f))
amount = GetSpellEffectInfo().CalcValue(caster, m_baseAmount, GetBase().GetOwner().ToUnit(), GetBase().GetCastItemLevel());
amount = GetSpellEffectInfo().CalcValue(caster, m_baseAmount, GetBase().GetOwner().ToUnit(), GetBase().GetCastItemId(), GetBase().GetCastItemLevel());
else if (caster != null && caster.IsTypeId(TypeId.Player))
amount = (int)(caster.ToPlayer().m_activePlayerData.Mastery * GetSpellEffectInfo().BonusCoefficient);
+5 -5
View File
@@ -2073,12 +2073,12 @@ namespace Game.Spells
foreach (SpellEffectInfo auraSpellEffect in GetEffects())
if (auraSpellEffect != null)
basePoints[auraSpellEffect.EffectIndex] = (m_spellValue.CustomBasePointsMask & (1 << (int)auraSpellEffect.EffectIndex)) != 0 ?
m_spellValue.EffectBasePoints[auraSpellEffect.EffectIndex] : auraSpellEffect.CalcBaseValue(m_originalCaster, unit, m_castItemLevel);
m_spellValue.EffectBasePoints[auraSpellEffect.EffectIndex] : auraSpellEffect.CalcBaseValue(m_originalCaster, unit, m_castItemEntry, m_castItemLevel);
bool refresh = false;
bool resetPeriodicTimer = !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontResetPeriodicTimer);
m_spellAura = Aura.TryRefreshStackOrCreate(m_spellInfo, m_castId, (byte)effectMask, unit,
m_originalCaster, out refresh, basePoints, m_CastItem, ObjectGuid.Empty, resetPeriodicTimer, ObjectGuid.Empty, m_castItemLevel);
m_originalCaster, out refresh, basePoints, m_CastItem, ObjectGuid.Empty, resetPeriodicTimer, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
if (m_spellAura != null)
{
// Set aura stack amount to desired value
@@ -7121,7 +7121,7 @@ namespace Game.Spells
if ((m_spellValue.CustomBasePointsMask & (1 << (int)i)) != 0)
basePoint = m_spellValue.EffectBasePoints[i];
return m_caster.CalculateSpellDamage(target, m_spellInfo, i, basePoint, m_castItemLevel);
return m_caster.CalculateSpellDamage(target, m_spellInfo, i, basePoint, m_castItemEntry, m_castItemLevel);
}
int CalculateDamage(uint i, Unit target, out float variance)
{
@@ -7129,7 +7129,7 @@ namespace Game.Spells
if ((m_spellValue.CustomBasePointsMask & (1 << (int)i)) != 0)
basePoint = m_spellValue.EffectBasePoints[i];
return m_caster.CalculateSpellDamage(target, m_spellInfo, i, out variance, basePoint, m_castItemLevel);
return m_caster.CalculateSpellDamage(target, m_spellInfo, i, out variance, basePoint, m_castItemEntry, m_castItemLevel);
}
public SpellState GetState()
{
@@ -7566,7 +7566,7 @@ namespace Game.Spells
Cypher.Assert(effects.Length <= SpellConst.MaxEffects);
foreach (SpellEffectInfo effect in effects)
if (effect != null)
EffectBasePoints[effect.EffectIndex] = effect.CalcBaseValue(caster, null, -1);
EffectBasePoints[effect.EffectIndex] = effect.CalcBaseValue(caster, null, 0, -1);
CustomBasePointsMask = 0;
MaxAffectedTargets = proto.MaxAffectedTargets;
+1 -1
View File
@@ -1223,7 +1223,7 @@ namespace Game.Spells
if (!dynObj.CreateDynamicObject(caster.GetMap().GenerateLowGuid(HighGuid.DynamicObject), caster, m_spellInfo, destTarget, radius, DynamicObjectType.AreaSpell, m_SpellVisual))
return;
Aura aura = Aura.TryCreate(m_spellInfo, m_castId, SpellConst.MaxEffectMask, dynObj, caster, m_spellValue.EffectBasePoints, null, ObjectGuid.Empty, ObjectGuid.Empty, m_castItemLevel);
Aura aura = Aura.TryCreate(m_spellInfo, m_castId, SpellConst.MaxEffectMask, dynObj, caster, m_spellValue.EffectBasePoints, null, ObjectGuid.Empty, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
if (aura != null)
{
m_spellAura = aura;
+33 -8
View File
@@ -3905,18 +3905,18 @@ namespace Game.Spells
return IsAreaAuraEffect() || Effect == SpellEffectName.ApplyAura;
}
public int CalcValue(Unit caster = null, int? bp = null, Unit target = null, int itemLevel = -1)
public int CalcValue(Unit caster = null, int? bp = null, Unit target = null, uint castItemId = 0, int itemLevel = -1)
{
float throwAway;
return CalcValue(out throwAway, caster, bp, target, itemLevel);
return CalcValue(out throwAway, caster, bp, target, castItemId, itemLevel);
}
public int CalcValue(out float variance, Unit caster = null, int? bp = null, Unit target = null, int itemLevel = -1)
public int CalcValue(out float variance, Unit caster = null, int? bp = null, Unit target = null, uint castItemId = 0, int itemLevel = -1)
{
variance = 0.0f;
float basePointsPerLevel = RealPointsPerLevel;
// TODO: this needs to be a float, not rounded
int basePoints = CalcBaseValue(caster, target, itemLevel);
int basePoints = CalcBaseValue(caster, target, castItemId, itemLevel);
float value = bp.HasValue ? bp.Value : BasePoints;
float comboDamage = PointsPerResource;
@@ -3964,7 +3964,7 @@ namespace Game.Spells
return (int)Math.Round(value);
}
public int CalcBaseValue(Unit caster, Unit target, int itemLevel)
public int CalcBaseValue(Unit caster, Unit target, uint itemId, int itemLevel)
{
if (Scaling.Coefficient != 0.0f)
{
@@ -4011,10 +4011,34 @@ namespace Game.Spells
if (_spellInfo.Scaling._Class == -7)
{
// todo: get inventorytype here
GtCombatRatingsMultByILvlRecord ratingMult = CliDB.CombatRatingsMultByILvlGameTable.GetRow(effectiveItemLevel);
GtGenericMultByILvlRecord ratingMult = CliDB.CombatRatingsMultByILvlGameTable.GetRow(effectiveItemLevel);
if (ratingMult != null)
tempValue *= ratingMult.ArmorMultiplier;
{
ItemSparseRecord itemSparse = CliDB.ItemSparseStorage.LookupByKey(itemId);
if (itemSparse != null)
tempValue *= CliDB.GetIlvlStatMultiplier(ratingMult, itemSparse.inventoryType);
}
}
if (IsAura(AuraType.ModRating))
{
GtGenericMultByILvlRecord ratingMult = CliDB.CombatRatingsMultByILvlGameTable.GetRow(effectiveItemLevel);
if (ratingMult != null)
{
ItemSparseRecord itemSparse = CliDB.ItemSparseStorage.LookupByKey(itemId);
if (itemSparse != null)
tempValue *= CliDB.GetIlvlStatMultiplier(ratingMult, itemSparse.inventoryType);
}
else if (IsAura(AuraType.ModStat) && MiscValue == (int)Stats.Stamina)
{
GtGenericMultByILvlRecord staminaMult = CliDB.StaminaMultByILvlGameTable.GetRow(effectiveItemLevel);
if (staminaMult != null)
{
ItemSparseRecord itemSparse = CliDB.ItemSparseStorage.LookupByKey(itemId);
if (itemSparse != null)
tempValue *= CliDB.GetIlvlStatMultiplier(staminaMult, itemSparse.inventoryType);
}
}
}
}
@@ -4172,6 +4196,7 @@ namespace Game.Spells
case SpellEffectName.ApplyAreaAuraOwner:
case SpellEffectName.ApllyAuraOnPet:
case SpellEffectName.Unk202:
case SpellEffectName.ApplyAreaAuraPartyNonrandom:
switch (ApplyAuraName)
{
case AuraType.PeriodicDamage: