Core/Spells: Refactor building SMSG_SPELL_EXECUTE_LOG to not create 192 empty vectors on every spell cast

Port From (https://github.com/TrinityCore/TrinityCore/commit/bc2c76a5b8b4a6e5c1d6e65d367c700e4ef1cbf2)
This commit is contained in:
hondacrx
2021-08-30 15:46:45 -04:00
parent 85f7edc339
commit 6e9451082d
3 changed files with 116 additions and 139 deletions
@@ -18,6 +18,7 @@
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using Game.Spells;
using System;
using System.Collections.Generic;
@@ -190,18 +191,6 @@ namespace Game.Networking.Packets
public ObjectGuid Caster;
public uint SpellID;
public List<SpellLogEffect> Effects = new();
public class SpellLogEffect
{
public int Effect;
public List<SpellLogEffectPowerDrainParams> PowerDrainTargets = new();
public List<SpellLogEffectExtraAttacksParams> ExtraAttacksTargets = new();
public List<SpellLogEffectDurabilityDamageParams> DurabilityDamageTargets = new();
public List<SpellLogEffectGenericVictimParams> GenericVictimTargets = new();
public List<SpellLogEffectTradeSkillItemParams> TradeSkillTargets = new();
public List<SpellLogEffectFeedPetParams> FeedPetTargets = new();
}
}
class SpellHealLog : CombatLogServerPacket
@@ -639,9 +628,9 @@ namespace Game.Networking.Packets
public uint OriginalDamage;
public bool Unk;
}
//Structs
struct SpellLogEffectPowerDrainParams
public struct SpellLogEffectPowerDrainParams
{
public ObjectGuid Victim;
public uint Points;
@@ -649,30 +638,30 @@ namespace Game.Networking.Packets
public float Amplitude;
}
struct SpellLogEffectExtraAttacksParams
public struct SpellLogEffectExtraAttacksParams
{
public ObjectGuid Victim;
public uint NumAttacks;
}
struct SpellLogEffectDurabilityDamageParams
public struct SpellLogEffectDurabilityDamageParams
{
public ObjectGuid Victim;
public int ItemID;
public int Amount;
}
struct SpellLogEffectGenericVictimParams
public struct SpellLogEffectGenericVictimParams
{
public ObjectGuid Victim;
}
struct SpellLogEffectTradeSkillItemParams
public struct SpellLogEffectTradeSkillItemParams
{
public int ItemID;
}
struct SpellLogEffectFeedPetParams
public struct SpellLogEffectFeedPetParams
{
public int ItemID;
}
@@ -745,4 +734,4 @@ namespace Game.Networking.Packets
public float State11;
public uint State12;
}
}
}