Core/PacketIO: Implemented SMSG_SPELL_HEAL_ABSORB_LOG
Port From (https://github.com/TrinityCore/TrinityCore/commit/53b7c4d47c35f7823f5f50578beb0140f4279e03)
This commit is contained in:
@@ -2610,7 +2610,6 @@ namespace Game.Entities
|
|||||||
if (currentAbsorb < 0)
|
if (currentAbsorb < 0)
|
||||||
currentAbsorb = 0;
|
currentAbsorb = 0;
|
||||||
|
|
||||||
|
|
||||||
uint tempAbsorb = (uint)currentAbsorb;
|
uint tempAbsorb = (uint)currentAbsorb;
|
||||||
|
|
||||||
// This aura type is used both by Spirit of Redemption (death not really prevented, must grant all credit immediately) and Cheat Death (death prevented)
|
// This aura type is used both by Spirit of Redemption (death not really prevented, must grant all credit immediately) and Cheat Death (death prevented)
|
||||||
@@ -3382,17 +3381,15 @@ namespace Game.Entities
|
|||||||
vSchoolAbsorbCopy.Sort(new AbsorbAuraOrderPred());
|
vSchoolAbsorbCopy.Sort(new AbsorbAuraOrderPred());
|
||||||
|
|
||||||
// absorb without mana cost
|
// absorb without mana cost
|
||||||
for (var i = 0; i < vSchoolAbsorbCopy.Count; ++i)
|
for (var i = 0; i < vSchoolAbsorbCopy.Count && (damageInfo.GetDamage() > 0); ++i)
|
||||||
{
|
{
|
||||||
var absorbAurEff = vSchoolAbsorbCopy[i];
|
var absorbAurEff = vSchoolAbsorbCopy[i];
|
||||||
if (damageInfo.GetDamage() == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// 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
|
||||||
AuraApplication aurApp = absorbAurEff.GetBase().GetApplicationOfTarget(damageInfo.GetVictim().GetGUID());
|
AuraApplication aurApp = absorbAurEff.GetBase().GetApplicationOfTarget(damageInfo.GetVictim().GetGUID());
|
||||||
if (aurApp == null)
|
if (aurApp == null)
|
||||||
continue;
|
continue;
|
||||||
if (!Convert.ToBoolean(absorbAurEff.GetMiscValue() & (int)damageInfo.GetSchoolMask()))
|
if ((absorbAurEff.GetMiscValue() & (int)damageInfo.GetSchoolMask()) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// get amount which can be still absorbed by the aura
|
// get amount which can be still absorbed by the aura
|
||||||
@@ -3606,7 +3603,7 @@ namespace Game.Entities
|
|||||||
if (aurApp == null)
|
if (aurApp == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((absorbAurEff.GetMiscValue() & (int)healInfo.GetSpellInfo().GetSchoolMask()) == 0)
|
if ((absorbAurEff.GetMiscValue() & (int)healInfo.GetSchoolMask()) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// get amount which can be still absorbed by the aura
|
// get amount which can be still absorbed by the aura
|
||||||
@@ -3622,26 +3619,38 @@ namespace Game.Entities
|
|||||||
absorbAurEff.GetBase().CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, healInfo, ref tempAbsorb, ref defaultPrevented);
|
absorbAurEff.GetBase().CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, healInfo, ref tempAbsorb, ref defaultPrevented);
|
||||||
currentAbsorb = (int)tempAbsorb;
|
currentAbsorb = (int)tempAbsorb;
|
||||||
|
|
||||||
if (defaultPrevented)
|
if (!defaultPrevented)
|
||||||
continue;
|
|
||||||
|
|
||||||
// currentAbsorb - damage can be absorbed by shield
|
|
||||||
// If need absorb less damage
|
|
||||||
currentAbsorb = (int)Math.Min(healInfo.GetHeal(), currentAbsorb);
|
|
||||||
|
|
||||||
healInfo.AbsorbHeal((uint)currentAbsorb);
|
|
||||||
|
|
||||||
tempAbsorb = (uint)currentAbsorb;
|
|
||||||
absorbAurEff.GetBase().CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, healInfo, ref tempAbsorb);
|
|
||||||
|
|
||||||
// Check if our aura is using amount to count heal
|
|
||||||
if (absorbAurEff.GetAmount() >= 0)
|
|
||||||
{
|
{
|
||||||
// Reduce shield amount
|
// absorb must be smaller than the heal itself
|
||||||
absorbAurEff.ChangeAmount(absorbAurEff.GetAmount() - currentAbsorb);
|
currentAbsorb = MathFunctions.RoundToInterval(ref currentAbsorb, 0, healInfo.GetHeal());
|
||||||
// Aura cannot absorb anything more - remove it
|
|
||||||
if (absorbAurEff.GetAmount() <= 0)
|
healInfo.AbsorbHeal((uint)currentAbsorb);
|
||||||
existExpired = true;
|
|
||||||
|
tempAbsorb = (uint)currentAbsorb;
|
||||||
|
absorbAurEff.GetBase().CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, healInfo, ref tempAbsorb);
|
||||||
|
|
||||||
|
// Check if our aura is using amount to count heal
|
||||||
|
if (absorbAurEff.GetAmount() >= 0)
|
||||||
|
{
|
||||||
|
// Reduce shield amount
|
||||||
|
absorbAurEff.ChangeAmount(absorbAurEff.GetAmount() - currentAbsorb);
|
||||||
|
// Aura cannot absorb anything more - remove it
|
||||||
|
if (absorbAurEff.GetAmount() <= 0)
|
||||||
|
absorbAurEff.GetBase().Remove(AuraRemoveMode.EnemySpell);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentAbsorb != 0)
|
||||||
|
{
|
||||||
|
SpellHealAbsorbLog absorbLog = new();
|
||||||
|
absorbLog.Healer = healInfo.GetHealer() ? healInfo.GetHealer().GetGUID() : ObjectGuid.Empty;
|
||||||
|
absorbLog.Target = healInfo.GetTarget().GetGUID();
|
||||||
|
absorbLog.AbsorbCaster = absorbAurEff.GetBase().GetCasterGUID();
|
||||||
|
absorbLog.AbsorbedSpellID = (int)(healInfo.GetSpellInfo() != null ? healInfo.GetSpellInfo().Id : 0);
|
||||||
|
absorbLog.AbsorbSpellID = (int)absorbAurEff.GetId();
|
||||||
|
absorbLog.Absorbed = currentAbsorb;
|
||||||
|
absorbLog.OriginalHeal = (int)healInfo.GetOriginalHeal();
|
||||||
|
healInfo.GetTarget().SendMessageToSet(absorbLog, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -626,6 +626,36 @@ namespace Game.Networking.Packets
|
|||||||
public bool Unk;
|
public bool Unk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SpellHealAbsorbLog : ServerPacket
|
||||||
|
{
|
||||||
|
public SpellHealAbsorbLog() : base(ServerOpcodes.SpellHealAbsorbLog, ConnectionType.Instance) { }
|
||||||
|
|
||||||
|
public override void Write()
|
||||||
|
{
|
||||||
|
_worldPacket.WritePackedGuid(Target);
|
||||||
|
_worldPacket.WritePackedGuid(AbsorbCaster);
|
||||||
|
_worldPacket.WritePackedGuid(Healer);
|
||||||
|
_worldPacket.WriteInt32(AbsorbSpellID);
|
||||||
|
_worldPacket.WriteInt32(AbsorbedSpellID);
|
||||||
|
_worldPacket.WriteInt32(Absorbed);
|
||||||
|
_worldPacket.WriteInt32(OriginalHeal);
|
||||||
|
_worldPacket.WriteBit(ContentTuning != null);
|
||||||
|
_worldPacket.FlushBits();
|
||||||
|
|
||||||
|
if (ContentTuning != null)
|
||||||
|
ContentTuning.Write(_worldPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectGuid Healer;
|
||||||
|
public ObjectGuid Target;
|
||||||
|
public ObjectGuid AbsorbCaster;
|
||||||
|
public int AbsorbSpellID;
|
||||||
|
public int AbsorbedSpellID;
|
||||||
|
public int Absorbed;
|
||||||
|
public int OriginalHeal;
|
||||||
|
public ContentTuningParams ContentTuning;
|
||||||
|
}
|
||||||
|
|
||||||
//Structs
|
//Structs
|
||||||
public struct SpellLogEffectPowerDrainParams
|
public struct SpellLogEffectPowerDrainParams
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user