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;