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
+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);
}