Core/PacketIO: Updated packet structures to 9.0.2

Port From (https://github.com/TrinityCore/TrinityCore/commit/96d340f70ccef57fad177a24ca099055d7dce04d)
This commit is contained in:
hondacrx
2020-12-12 23:45:36 -05:00
parent f0037ab99f
commit 4c2106781a
14 changed files with 97 additions and 104 deletions
+4 -1
View File
@@ -53,7 +53,10 @@ namespace Game.Spells
Duration = 0x04,
Scalable = 0x08,
Negative = 0x10,
Unk20 = 0x20
Unk20 = 0x20,
Unk40 = 0x40,
Unk80 = 0x80,
MawPower = 0x100
}
public class AuraApplication
-31
View File
@@ -3947,23 +3947,6 @@ namespace Game.Spells
target.ToPlayer().ApplyRatingMod((CombatRating)rating, GetAmount(), apply);
}
[AuraEffectHandler(AuraType.ModRatingFromStat)]
void HandleModRatingFromStat(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag((AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat)))
return;
Unit target = aurApp.GetTarget();
if (!target.IsTypeId(TypeId.Player))
return;
// Just recalculate ratings
for (int rating = 0; rating < (int)CombatRating.Max; ++rating)
if (Convert.ToBoolean(GetMiscValue() & (1 << rating)))
target.ToPlayer().UpdateRating((CombatRating)rating);
}
[AuraEffectHandler(AuraType.ModRatingPct)]
void HandleModRatingPct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
@@ -4155,20 +4138,6 @@ namespace Game.Spells
/********************************/
/*** POWER COST ***/
/********************************/
[AuraEffectHandler(AuraType.ModPowerCostSchoolPct)]
void HandleModPowerCostPCT(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask))
return;
Unit target = aurApp.GetTarget();
float amount = MathFunctions.CalculatePct(1.0f, GetAmount());
for (int i = 0; i < (int)SpellSchools.Max; ++i)
if (Convert.ToBoolean(GetMiscValue() & (1 << i)))
target.ApplyModPowerCostMultiplier((SpellSchools)i, amount, apply);
}
[AuraEffectHandler(AuraType.ModPowerCostSchool)]
void HandleModPowerCost(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
+23 -7
View File
@@ -2753,6 +2753,7 @@ namespace Game.Spells
if (power.PowerType != PowerType.Health)
{
// Flat mod from caster auras by spell school and power type
int flatMod = 0;
var auras = caster.GetAuraEffectsByType(AuraType.ModPowerCostSchool);
foreach (var eff in auras)
{
@@ -2762,8 +2763,13 @@ namespace Game.Spells
if (!Convert.ToBoolean(eff.GetMiscValueB() & (1 << (int)power.PowerType)))
continue;
powerCost += eff.GetAmount();
flatMod += eff.GetAmount();
}
if (power.PowerType == PowerType.Mana)
flatMod *= (int)(1.0f + caster.m_unitData.ManaCostModifierModifier);
powerCost += flatMod;
}
// Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
@@ -2776,7 +2782,7 @@ namespace Game.Spells
else
{
WeaponAttackType slot = WeaponAttackType.BaseAttack;
if (HasAttribute(SpellAttr3.ReqOffhand))
if (!HasAttribute(SpellAttr3.MainHand) && HasAttribute(SpellAttr3.ReqOffhand))
slot = WeaponAttackType.OffAttack;
speed = caster.GetBaseAttackTime(slot);
@@ -2789,13 +2795,23 @@ namespace Game.Spells
Player modOwner = caster.GetSpellModOwner();
if (modOwner)
{
if (power.OrderIndex == 0)
modOwner.ApplySpellMod(Id, SpellModOp.Cost, ref powerCost, spell);
else if (power.OrderIndex == 1)
modOwner.ApplySpellMod(Id, SpellModOp.SpellCost2, ref powerCost, spell);
switch (power.OrderIndex)
{
case 0:
modOwner.ApplySpellMod(Id, SpellModOp.Cost, ref powerCost, spell);
break;
case 1:
modOwner.ApplySpellMod(Id, SpellModOp.SpellCost2, ref powerCost, spell);
break;
case 2:
modOwner.ApplySpellMod(Id, SpellModOp.SpellCost3, ref powerCost, spell);
break;
default:
break;
}
}
if (!caster.IsControlledByPlayer() && MathFunctions.fuzzyEq(power.PowerCostPct, 0.0f) && SpellLevel != 0)
if (!caster.IsControlledByPlayer() && MathFunctions.fuzzyEq(power.PowerCostPct, 0.0f) && SpellLevel != 0 && power.PowerType == PowerType.Mana)
{
if (HasAttribute(SpellAttr0.LevelDamageCalculation))
{