Core/PacketIO: Implemented SMSG_SPELL_ABSORB_LOG
Port From (https://github.com/TrinityCore/TrinityCore/commit/854a55daabf5dc264a961ec86ca0cd8ee39140c5)
This commit is contained in:
@@ -1031,7 +1031,7 @@ namespace Game.Entities
|
|||||||
foreach (var aura in vCopyDamageCopy)
|
foreach (var aura in vCopyDamageCopy)
|
||||||
{
|
{
|
||||||
// Check if aura was removed during iteration - we don't need to work on such auras
|
// Check if aura was removed during iteration - we don't need to work on such auras
|
||||||
if (!(aura.GetBase().IsAppliedOnTarget(victim.GetGUID())))
|
if (!aura.GetBase().IsAppliedOnTarget(victim.GetGUID()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check damage school mask
|
// check damage school mask
|
||||||
@@ -1041,6 +1041,7 @@ namespace Game.Entities
|
|||||||
Unit shareDamageTarget = aura.GetCaster();
|
Unit shareDamageTarget = aura.GetCaster();
|
||||||
if (shareDamageTarget == null)
|
if (shareDamageTarget == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SpellInfo spell = aura.GetSpellInfo();
|
SpellInfo spell = aura.GetSpellInfo();
|
||||||
|
|
||||||
uint share = MathFunctions.CalculatePct(damage, aura.GetAmount());
|
uint share = MathFunctions.CalculatePct(damage, aura.GetAmount());
|
||||||
@@ -1179,6 +1180,20 @@ namespace Game.Entities
|
|||||||
killed = false;
|
killed = false;
|
||||||
|
|
||||||
skipSettingDeathState = true;
|
skipSettingDeathState = true;
|
||||||
|
|
||||||
|
if (currentAbsorb != 0)
|
||||||
|
{
|
||||||
|
SpellAbsorbLog absorbLog = new();
|
||||||
|
absorbLog.Attacker = GetGUID();
|
||||||
|
absorbLog.Victim = victim.GetGUID();
|
||||||
|
absorbLog.Caster = baseAura.GetCasterGUID();
|
||||||
|
absorbLog.AbsorbedSpellID = spellProto != null ? spellProto.Id : 0;
|
||||||
|
absorbLog.AbsorbSpellID = baseAura.GetId();
|
||||||
|
absorbLog.Absorbed = currentAbsorb;
|
||||||
|
absorbLog.OriginalDamage = damageInfo.GetOriginalDamage();
|
||||||
|
absorbLog.LogData.Initialize(victim);
|
||||||
|
SendCombatLogMessage(absorbLog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
damage = damageInfo.GetDamage();
|
damage = damageInfo.GetDamage();
|
||||||
@@ -2613,8 +2628,8 @@ namespace Game.Entities
|
|||||||
absorbAurEff.GetBase().CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb, ref defaultPrevented);
|
absorbAurEff.GetBase().CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb, ref defaultPrevented);
|
||||||
currentAbsorb = (int)tempAbsorb;
|
currentAbsorb = (int)tempAbsorb;
|
||||||
|
|
||||||
if (defaultPrevented)
|
if (!defaultPrevented)
|
||||||
continue;
|
{
|
||||||
|
|
||||||
// absorb must be smaller than the damage itself
|
// absorb must be smaller than the damage itself
|
||||||
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, damageInfo.GetDamage());
|
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, damageInfo.GetDamage());
|
||||||
@@ -2635,6 +2650,21 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentAbsorb != 0)
|
||||||
|
{
|
||||||
|
SpellAbsorbLog absorbLog = new();
|
||||||
|
absorbLog.Attacker = damageInfo.GetAttacker().GetGUID();
|
||||||
|
absorbLog.Victim = damageInfo.GetVictim().GetGUID();
|
||||||
|
absorbLog.Caster = absorbAurEff.GetBase().GetCasterGUID();
|
||||||
|
absorbLog.AbsorbedSpellID = damageInfo.GetSpellInfo() != null ? damageInfo.GetSpellInfo().Id : 0;
|
||||||
|
absorbLog.AbsorbSpellID = absorbAurEff.GetId();
|
||||||
|
absorbLog.Absorbed = currentAbsorb;
|
||||||
|
absorbLog.OriginalDamage = damageInfo.GetOriginalDamage();
|
||||||
|
absorbLog.LogData.Initialize(damageInfo.GetVictim());
|
||||||
|
SendCombatLogMessage(absorbLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// absorb by mana cost
|
// absorb by mana cost
|
||||||
var vManaShieldCopy = damageInfo.GetVictim().GetAuraEffectsByType(AuraType.ManaShield);
|
var vManaShieldCopy = damageInfo.GetVictim().GetAuraEffectsByType(AuraType.ManaShield);
|
||||||
foreach (var absorbAurEff in vManaShieldCopy)
|
foreach (var absorbAurEff in vManaShieldCopy)
|
||||||
@@ -2663,9 +2693,8 @@ namespace Game.Entities
|
|||||||
absorbAurEff.GetBase().CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb, ref defaultPrevented);
|
absorbAurEff.GetBase().CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb, ref defaultPrevented);
|
||||||
currentAbsorb = (int)tempAbsorb;
|
currentAbsorb = (int)tempAbsorb;
|
||||||
|
|
||||||
if (defaultPrevented)
|
if (!defaultPrevented)
|
||||||
continue;
|
{
|
||||||
|
|
||||||
// absorb must be smaller than the damage itself
|
// absorb must be smaller than the damage itself
|
||||||
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, damageInfo.GetDamage());
|
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, damageInfo.GetDamage());
|
||||||
|
|
||||||
@@ -2695,6 +2724,21 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentAbsorb != 0)
|
||||||
|
{
|
||||||
|
SpellAbsorbLog absorbLog = new();
|
||||||
|
absorbLog.Attacker = damageInfo.GetAttacker().GetGUID();
|
||||||
|
absorbLog.Victim = damageInfo.GetVictim().GetGUID();
|
||||||
|
absorbLog.Caster = absorbAurEff.GetBase().GetCasterGUID();
|
||||||
|
absorbLog.AbsorbedSpellID = damageInfo.GetSpellInfo() != null ? damageInfo.GetSpellInfo().Id : 0;
|
||||||
|
absorbLog.AbsorbSpellID = absorbAurEff.GetId();
|
||||||
|
absorbLog.Absorbed = currentAbsorb;
|
||||||
|
absorbLog.OriginalDamage = damageInfo.GetOriginalDamage();
|
||||||
|
absorbLog.LogData.Initialize(damageInfo.GetVictim());
|
||||||
|
SendCombatLogMessage(absorbLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
damageInfo.ModifyDamage(absorbIgnoringDamage);
|
damageInfo.ModifyDamage(absorbIgnoringDamage);
|
||||||
|
|
||||||
// split damage auras - only when not damaging self
|
// split damage auras - only when not damaging self
|
||||||
|
|||||||
@@ -608,6 +608,37 @@ namespace Game.Networking.Packets
|
|||||||
public ContentTuningParams ContentTuning = new();
|
public ContentTuningParams ContentTuning = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SpellAbsorbLog : CombatLogServerPacket
|
||||||
|
{
|
||||||
|
public SpellAbsorbLog() : base(ServerOpcodes.SpellAbsorbLog, ConnectionType.Instance) { }
|
||||||
|
|
||||||
|
public override void Write()
|
||||||
|
{
|
||||||
|
_worldPacket.WritePackedGuid(Attacker);
|
||||||
|
_worldPacket.WritePackedGuid(Victim);
|
||||||
|
_worldPacket.WriteUInt32(AbsorbedSpellID);
|
||||||
|
_worldPacket.WriteUInt32(AbsorbSpellID);
|
||||||
|
_worldPacket.WritePackedGuid(Caster);
|
||||||
|
_worldPacket.WriteInt32(Absorbed);
|
||||||
|
_worldPacket.WriteUInt32(OriginalDamage);
|
||||||
|
|
||||||
|
_worldPacket.WriteBit(Unk);
|
||||||
|
WriteLogDataBit();
|
||||||
|
FlushBits();
|
||||||
|
|
||||||
|
WriteLogData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectGuid Attacker;
|
||||||
|
public ObjectGuid Victim;
|
||||||
|
public ObjectGuid Caster;
|
||||||
|
public uint AbsorbedSpellID;
|
||||||
|
public uint AbsorbSpellID;
|
||||||
|
public int Absorbed;
|
||||||
|
public uint OriginalDamage;
|
||||||
|
public bool Unk;
|
||||||
|
}
|
||||||
|
|
||||||
//Structs
|
//Structs
|
||||||
struct SpellLogEffectPowerDrainParams
|
struct SpellLogEffectPowerDrainParams
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user