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;
}
}
}
+74 -85
View File
@@ -1993,10 +1993,10 @@ namespace Game.Spells
if (Aura.BuildEffectMaskForOwner(m_spellInfo, SpellConst.MaxEffectMask, unit) != 0)
{
foreach (SpellEffectInfo auraSpellEffect in m_spellInfo.GetEffects())
if (auraSpellEffect != null)
hitInfo.AuraBasePoints[auraSpellEffect.EffectIndex] = (m_spellValue.CustomBasePointsMask & (1 << (int)auraSpellEffect.EffectIndex)) != 0 ?
m_spellValue.EffectBasePoints[auraSpellEffect.EffectIndex] :
auraSpellEffect.CalcBaseValue(m_originalCaster, unit, m_castItemEntry, m_castItemLevel);
if (auraSpellEffect != null)
hitInfo.AuraBasePoints[auraSpellEffect.EffectIndex] = (m_spellValue.CustomBasePointsMask & (1 << (int)auraSpellEffect.EffectIndex)) != 0 ?
m_spellValue.EffectBasePoints[auraSpellEffect.EffectIndex] :
auraSpellEffect.CalcBaseValue(m_originalCaster, unit, m_castItemEntry, m_castItemLevel);
// Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add
hitInfo.DRGroup = m_spellInfo.GetDiminishingReturnsGroupForSpell();
@@ -2664,7 +2664,7 @@ namespace Game.Spells
SetExecutedCurrently(false);
return;
}
Unit unitCaster = m_caster.ToUnit();
if (unitCaster != null)
{
@@ -3185,7 +3185,7 @@ namespace Game.Spells
&& charm.m_unitData.CreatedBySpell == m_spellInfo.Id)
((Puppet)charm).UnSummon();
}
Creature creatureCaster = unitCaster.ToCreature();
if (creatureCaster != null)
creatureCaster.ReleaseFocus(this);
@@ -3805,51 +3805,32 @@ namespace Game.Spells
void SendSpellExecuteLog()
{
if (_executeLogEffects.Empty())
return;
SpellExecuteLog spellExecuteLog = new();
spellExecuteLog.Caster = m_caster.GetGUID();
spellExecuteLog.SpellID = m_spellInfo.Id;
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
{
if (effect == null)
continue;
if (_powerDrainTargets[effect.EffectIndex].Empty() && _extraAttacksTargets[effect.EffectIndex].Empty() &&
_durabilityDamageTargets[effect.EffectIndex].Empty() && _genericVictimTargets[effect.EffectIndex].Empty() &&
_tradeSkillTargets[effect.EffectIndex].Empty() && _feedPetTargets[effect.EffectIndex].Empty())
continue;
SpellExecuteLog.SpellLogEffect spellLogEffect = new();
spellLogEffect.Effect = (int)effect.Effect;
spellLogEffect.PowerDrainTargets = _powerDrainTargets[effect.EffectIndex];
spellLogEffect.ExtraAttacksTargets = _extraAttacksTargets[effect.EffectIndex];
spellLogEffect.DurabilityDamageTargets = _durabilityDamageTargets[effect.EffectIndex];
spellLogEffect.GenericVictimTargets = _genericVictimTargets[effect.EffectIndex];
spellLogEffect.TradeSkillTargets = _tradeSkillTargets[effect.EffectIndex];
spellLogEffect.FeedPetTargets = _feedPetTargets[effect.EffectIndex];
spellExecuteLog.Effects.Add(spellLogEffect);
}
spellExecuteLog.Effects = _executeLogEffects.Values.ToList();
spellExecuteLog.LogData.Initialize(this);
if (!spellExecuteLog.Effects.Empty())
m_caster.SendCombatLogMessage(spellExecuteLog);
CleanupExecuteLogList();
m_caster.SendCombatLogMessage(spellExecuteLog);
}
void CleanupExecuteLogList()
SpellLogEffect GetExecuteLogEffect(SpellEffectName effect)
{
_powerDrainTargets.Clear();
_extraAttacksTargets.Clear();
_durabilityDamageTargets.Clear();
_genericVictimTargets.Clear();
_tradeSkillTargets.Clear();
_feedPetTargets.Clear();
var spellLogEffect = _executeLogEffects.LookupByKey(effect);
if (spellLogEffect != null)
return spellLogEffect;
SpellLogEffect executeLogEffect = new();
executeLogEffect.Effect = (int)effect;
_executeLogEffects.Add(effect, executeLogEffect);
return executeLogEffect;
}
void ExecuteLogEffectTakeTargetPower(uint effIndex, Unit target, PowerType powerType, uint points, float amplitude)
void ExecuteLogEffectTakeTargetPower(SpellEffectName effect, Unit target, PowerType powerType, uint points, float amplitude)
{
SpellLogEffectPowerDrainParams spellLogEffectPowerDrainParams;
@@ -3858,19 +3839,19 @@ namespace Game.Spells
spellLogEffectPowerDrainParams.PowerType = (uint)powerType;
spellLogEffectPowerDrainParams.Amplitude = amplitude;
_powerDrainTargets.Add(effIndex, spellLogEffectPowerDrainParams);
GetExecuteLogEffect(effect).PowerDrainTargets.Add(spellLogEffectPowerDrainParams);
}
void ExecuteLogEffectExtraAttacks(uint effIndex, Unit victim, uint numAttacks)
void ExecuteLogEffectExtraAttacks(SpellEffectName effect, Unit victim, uint numAttacks)
{
SpellLogEffectExtraAttacksParams spellLogEffectExtraAttacksParams;
spellLogEffectExtraAttacksParams.Victim = victim.GetGUID();
spellLogEffectExtraAttacksParams.NumAttacks = numAttacks;
_extraAttacksTargets.Add(effIndex, spellLogEffectExtraAttacksParams);
GetExecuteLogEffect(effect).ExtraAttacksTargets.Add(spellLogEffectExtraAttacksParams);
}
void ExecuteLogEffectInterruptCast(uint effIndex, Unit victim, uint spellId)
void SendSpellInterruptLog(Unit victim, uint spellId)
{
SpellInterruptLog data = new();
data.Caster = m_caster.GetGUID();
@@ -3881,62 +3862,62 @@ namespace Game.Spells
m_caster.SendMessageToSet(data, true);
}
void ExecuteLogEffectDurabilityDamage(uint effIndex, Unit victim, int itemId, int amount)
void ExecuteLogEffectDurabilityDamage(SpellEffectName effect, Unit victim, int itemId, int amount)
{
SpellLogEffectDurabilityDamageParams spellLogEffectDurabilityDamageParams;
spellLogEffectDurabilityDamageParams.Victim = victim.GetGUID();
spellLogEffectDurabilityDamageParams.ItemID = itemId;
spellLogEffectDurabilityDamageParams.Amount = amount;
_durabilityDamageTargets.Add(effIndex, spellLogEffectDurabilityDamageParams);
GetExecuteLogEffect(effect).DurabilityDamageTargets.Add(spellLogEffectDurabilityDamageParams);
}
void ExecuteLogEffectOpenLock(uint effIndex, WorldObject obj)
void ExecuteLogEffectOpenLock(SpellEffectName effect, WorldObject obj)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = obj.GetGUID();
_genericVictimTargets.Add(effIndex, spellLogEffectGenericVictimParams);
GetExecuteLogEffect(effect).GenericVictimTargets.Add(spellLogEffectGenericVictimParams);
}
void ExecuteLogEffectCreateItem(uint effIndex, uint entry)
void ExecuteLogEffectCreateItem(SpellEffectName effect, uint entry)
{
SpellLogEffectTradeSkillItemParams spellLogEffectTradeSkillItemParams;
spellLogEffectTradeSkillItemParams.ItemID = (int)entry;
_tradeSkillTargets.Add(effIndex, spellLogEffectTradeSkillItemParams);
GetExecuteLogEffect(effect).TradeSkillTargets.Add(spellLogEffectTradeSkillItemParams);
}
void ExecuteLogEffectDestroyItem(uint effIndex, uint entry)
void ExecuteLogEffectDestroyItem(SpellEffectName effect, uint entry)
{
SpellLogEffectFeedPetParams spellLogEffectFeedPetParams;
spellLogEffectFeedPetParams.ItemID = (int)entry;
_feedPetTargets.Add(effIndex, spellLogEffectFeedPetParams);
GetExecuteLogEffect(effect).FeedPetTargets.Add(spellLogEffectFeedPetParams);
}
void ExecuteLogEffectSummonObject(uint effIndex, WorldObject obj)
void ExecuteLogEffectSummonObject(SpellEffectName effect, WorldObject obj)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = obj.GetGUID();
_genericVictimTargets.Add(effIndex, spellLogEffectGenericVictimParams);
GetExecuteLogEffect(effect).GenericVictimTargets.Add(spellLogEffectGenericVictimParams);
}
void ExecuteLogEffectUnsummonObject(uint effIndex, WorldObject obj)
void ExecuteLogEffectUnsummonObject(SpellEffectName effect, WorldObject obj)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = obj.GetGUID();
_genericVictimTargets.Add(effIndex, spellLogEffectGenericVictimParams);
GetExecuteLogEffect(effect).GenericVictimTargets.Add(spellLogEffectGenericVictimParams);
}
void ExecuteLogEffectResurrect(uint effIndex, Unit target)
void ExecuteLogEffectResurrect(SpellEffectName effect, Unit target)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = target.GetGUID();
_genericVictimTargets.Add(effIndex, spellLogEffectGenericVictimParams);
GetExecuteLogEffect(effect).GenericVictimTargets.Add(spellLogEffectGenericVictimParams);
}
void SendInterrupted(byte result)
@@ -4591,8 +4572,8 @@ namespace Game.Spells
// also, such casts shouldn't be sent to client
if (!(m_spellInfo.IsPassive() && (m_targets.GetUnitTarget() == null || m_targets.GetUnitTarget() == m_caster)))
{
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
WorldObject caster = m_caster;
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
WorldObject caster = m_caster;
if (m_originalCaster != null)
caster = m_originalCaster;
@@ -4608,21 +4589,21 @@ namespace Game.Spells
if (castResult != SpellCastResult.SpellCastOk)
return castResult;
// If it's not a melee spell, check if vision is obscured by SPELL_AURA_INTERFERE_TARGETTING
if (m_spellInfo.DmgClass != SpellDmgClass.Melee)
// If it's not a melee spell, check if vision is obscured by SPELL_AURA_INTERFERE_TARGETTING
if (m_spellInfo.DmgClass != SpellDmgClass.Melee)
{
Unit unitCaster1 = m_caster.ToUnit();
if (unitCaster1 != null)
{
Unit unitCaster1 = m_caster.ToUnit();
if (unitCaster1 != null)
{
foreach (var auraEffect in unitCaster1.GetAuraEffectsByType(AuraType.InterfereTargetting))
if (!unitCaster1.IsFriendlyTo(auraEffect.GetCaster()) && !unitTarget.HasAura(auraEffect.GetId(), auraEffect.GetCasterGUID()))
return SpellCastResult.VisionObscured;
foreach (var auraEffect in unitCaster1.GetAuraEffectsByType(AuraType.InterfereTargetting))
if (!unitCaster1.IsFriendlyTo(auraEffect.GetCaster()) && !unitTarget.HasAura(auraEffect.GetId(), auraEffect.GetCasterGUID()))
return SpellCastResult.VisionObscured;
foreach (var auraEffect in unitTarget.GetAuraEffectsByType(AuraType.InterfereTargetting))
if (!unitCaster1.IsFriendlyTo(auraEffect.GetCaster()) && (!unitTarget.HasAura(auraEffect.GetId(), auraEffect.GetCasterGUID()) || !unitCaster1.HasAura(auraEffect.GetId(), auraEffect.GetCasterGUID())))
return SpellCastResult.VisionObscured;
}
foreach (var auraEffect in unitTarget.GetAuraEffectsByType(AuraType.InterfereTargetting))
if (!unitCaster1.IsFriendlyTo(auraEffect.GetCaster()) && (!unitTarget.HasAura(auraEffect.GetId(), auraEffect.GetCasterGUID()) || !unitCaster1.HasAura(auraEffect.GetId(), auraEffect.GetCasterGUID())))
return SpellCastResult.VisionObscured;
}
}
if (unitTarget != m_caster)
{
@@ -4634,9 +4615,9 @@ namespace Game.Spells
if (m_spellInfo.HasAttribute(SpellCustomAttributes.ReqTargetFacingCaster) && !unitTarget.HasInArc(MathFunctions.PI, m_caster))
return SpellCastResult.NotInfront;
// Ignore LOS for gameobjects casts
if (!m_caster.IsGameObject())
{
// Ignore LOS for gameobjects casts
if (!m_caster.IsGameObject())
{
WorldObject losTarget = m_caster;
if (IsTriggered() && m_triggeredByAuraSpell != null)
{
@@ -6859,7 +6840,7 @@ namespace Game.Spells
targetInfo.Damage += m_damage;
targetInfo.Healing += m_healing;
float critChance = m_spellValue.CriticalChance;
if (m_originalCaster != null)
{
@@ -7481,12 +7462,7 @@ namespace Game.Spells
}
#region Fields
MultiMap<uint, SpellLogEffectPowerDrainParams> _powerDrainTargets = new();
MultiMap<uint, SpellLogEffectExtraAttacksParams> _extraAttacksTargets = new();
MultiMap<uint, SpellLogEffectDurabilityDamageParams> _durabilityDamageTargets = new();
MultiMap<uint, SpellLogEffectGenericVictimParams> _genericVictimTargets = new();
MultiMap<uint, SpellLogEffectTradeSkillItemParams> _tradeSkillTargets = new();
MultiMap<uint, SpellLogEffectFeedPetParams> _feedPetTargets = new();
Dictionary<SpellEffectName, SpellLogEffect> _executeLogEffects = new();
PathGenerator m_preGeneratedPath;
public SpellInfo m_spellInfo;
@@ -8377,7 +8353,7 @@ namespace Game.Spells
}
public class WorldObjectSpellConeTargetCheck : WorldObjectSpellAreaTargetCheck
{
{
float _coneAngle;
float _lineWidth;
@@ -8463,7 +8439,7 @@ namespace Game.Spells
return base.Invoke(target);
}
}
public class SpellEvent : BasicEvent
{
public SpellEvent(Spell spell)
@@ -8669,4 +8645,17 @@ namespace Game.Spells
return this;
}
}
}
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();
}
}
+33 -34
View File
@@ -32,7 +32,6 @@ using Game.Movement;
using Game.Networking.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Game.Spells
{
@@ -83,7 +82,7 @@ namespace Game.Spells
int health = damage;
int mana = effectInfo.MiscValue;
ExecuteLogEffectResurrect(effIndex, target);
ExecuteLogEffectResurrect(effectInfo.Effect, target);
target.SetResurrectRequestData(m_caster, (uint)health, (uint)mana, 0);
SendResurrectRequest(target);
}
@@ -821,7 +820,7 @@ namespace Game.Spells
unitCaster.EnergizeBySpell(unitCaster, m_spellInfo, gain, powerType);
}
ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, (uint)newDamage, gainMultiplier);
ExecuteLogEffectTakeTargetPower(effectInfo.Effect, unitTarget, powerType, (uint)newDamage, gainMultiplier);
}
[SpellEffectHandler(SpellEffectName.SendEvent)]
@@ -888,7 +887,7 @@ namespace Game.Spells
float dmgMultiplier = effectInfo.CalcValueMultiplier(unitCaster, this);
// add log data before multiplication (need power amount, not damage)
ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, (uint)newDamage, 0.0f);
ExecuteLogEffectTakeTargetPower(effectInfo.Effect, unitTarget, powerType, (uint)newDamage, 0.0f);
newDamage = (int)(newDamage * dmgMultiplier);
@@ -1131,7 +1130,7 @@ namespace Game.Spells
return;
DoCreateItem(effIndex, effectInfo.ItemType, m_spellInfo.HasAttribute(SpellAttr0.Tradespell) ? ItemContext.TradeSkill : ItemContext.None);
ExecuteLogEffectCreateItem(effIndex, effectInfo.ItemType);
ExecuteLogEffectCreateItem(effectInfo.Effect, effectInfo.ItemType);
}
[SpellEffectHandler(SpellEffectName.CreateLoot)]
@@ -1485,7 +1484,7 @@ namespace Game.Spells
}
}
}
ExecuteLogEffectOpenLock(effIndex, gameObjTarget != null ? gameObjTarget : (WorldObject)itemTarget);
ExecuteLogEffectOpenLock(effectInfo.Effect, gameObjTarget != null ? gameObjTarget : (WorldObject)itemTarget);
}
[SpellEffectHandler(SpellEffectName.SummonChangeItem)]
@@ -1699,7 +1698,7 @@ namespace Game.Spells
case SummonCategory.Unk:
if (Convert.ToBoolean(properties.Flags & SummonPropFlags.Unk10))
{
SummonGuardian(effIndex, entry, properties, numSummons, privateObjectOwner);
SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
break;
}
switch (properties.Title)
@@ -1708,9 +1707,9 @@ namespace Game.Spells
case SummonTitle.Guardian:
case SummonTitle.Runeblade:
case SummonTitle.Minion:
SummonGuardian(effIndex, entry, properties, numSummons, privateObjectOwner);
SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
break;
// Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
// Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
case SummonTitle.Vehicle:
case SummonTitle.Mount:
{
@@ -1781,14 +1780,14 @@ namespace Game.Spells
summon.SetCreatedBySpell(m_spellInfo.Id);
}
ExecuteLogEffectSummonObject(effIndex, summon);
ExecuteLogEffectSummonObject(effectInfo.Effect, summon);
}
return;
}
}//switch
break;
case SummonCategory.Pet:
SummonGuardian(effIndex, entry, properties, numSummons, privateObjectOwner);
SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
break;
case SummonCategory.Puppet:
{
@@ -1839,7 +1838,7 @@ namespace Game.Spells
if (summon != null)
{
summon.SetCreatorGUID(caster.GetGUID());
ExecuteLogEffectSummonObject(effIndex, summon);
ExecuteLogEffectSummonObject(effectInfo.Effect, summon);
}
}
@@ -2394,7 +2393,7 @@ namespace Game.Spells
{
SummonPropertiesRecord properties = CliDB.SummonPropertiesStorage.LookupByKey(67);
if (properties != null)
SummonGuardian(effIndex, petentry, properties, 1, ObjectGuid.Empty);
SummonGuardian(effectInfo, petentry, properties, 1, ObjectGuid.Empty);
return;
}
@@ -2449,7 +2448,7 @@ namespace Game.Spells
if (!string.IsNullOrEmpty(new_name))
pet.SetName(new_name);
ExecuteLogEffectSummonObject(effIndex, pet);
ExecuteLogEffectSummonObject(effectInfo.Effect, pet);
}
[SpellEffectHandler(SpellEffectName.LearnPetSpell)]
@@ -2796,7 +2795,7 @@ namespace Game.Spells
else if (m_spellInfo.DmgClass == SpellDmgClass.Melee)
Unit.ProcSkillsAndAuras(unitCaster, unitTarget, ProcFlags.DoneSpellMeleeDmgClass, ProcFlags.TakenSpellMeleeDmgClass, ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Hit, ProcFlagsHit.Interrupt, null, null, null);
}
ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo.Id);
SendSpellInterruptLog(unitTarget, curSpellInfo.Id);
unitTarget.InterruptSpell(i, false);
}
}
@@ -2834,7 +2833,7 @@ namespace Game.Spells
go.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
go.SetSpellId(m_spellInfo.Id);
ExecuteLogEffectSummonObject(effIndex, go);
ExecuteLogEffectSummonObject(effectInfo.Effect, go);
// Wild object not have owner and check clickable by players
map.AddToMap(go);
@@ -2857,7 +2856,7 @@ namespace Game.Spells
linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
linkedTrap.SetSpellId(m_spellInfo.Id);
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
ExecuteLogEffectSummonObject(effectInfo.Effect, linkedTrap);
}
}
@@ -3395,7 +3394,7 @@ namespace Game.Spells
go.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
go.SetSpellId(m_spellInfo.Id);
ExecuteLogEffectSummonObject(effIndex, go);
ExecuteLogEffectSummonObject(effectInfo.Effect, go);
caster.AddGameObject(go);
map.AddToMap(go);
@@ -3666,7 +3665,7 @@ namespace Game.Spells
if (!pet.IsAlive())
return;
ExecuteLogEffectDestroyItem(effIndex, foodItem.GetEntry());
ExecuteLogEffectDestroyItem(effectInfo.Effect, foodItem.GetEntry());
int pct;
int levelDiff = (int)pet.GetLevel() - (int)foodItem.GetTemplate().GetBaseItemLevel();
@@ -3699,7 +3698,7 @@ namespace Game.Spells
Pet pet = unitTarget.ToPet();
ExecuteLogEffectUnsummonObject(effIndex, pet);
ExecuteLogEffectUnsummonObject(effectInfo.Effect, pet);
pet.GetOwner().RemovePet(pet, PetSaveMode.NotInSlot);
}
@@ -3751,7 +3750,7 @@ namespace Game.Spells
go.SetSpellId(m_spellInfo.Id);
unitCaster.AddGameObject(go);
ExecuteLogEffectSummonObject(effIndex, go);
ExecuteLogEffectSummonObject(effectInfo.Effect, go);
map.AddToMap(go);
@@ -3778,7 +3777,7 @@ namespace Game.Spells
uint health = (uint)target.CountPctFromMaxHealth(damage);
uint mana = (uint)MathFunctions.CalculatePct(target.GetMaxPower(PowerType.Mana), damage);
ExecuteLogEffectResurrect(effIndex, target);
ExecuteLogEffectResurrect(effectInfo.Effect, target);
target.SetResurrectRequestData(m_caster, health, mana, 0);
SendResurrectRequest(target);
@@ -3798,7 +3797,7 @@ namespace Game.Spells
unitTarget.ExtraAttacks = (uint)damage;
ExecuteLogEffectExtraAttacks(effIndex, unitTarget, (uint)damage);
ExecuteLogEffectExtraAttacks(effectInfo.Effect, unitTarget, (uint)damage);
}
[SpellEffectHandler(SpellEffectName.Parry)]
@@ -4403,7 +4402,7 @@ namespace Game.Spells
if (slot < 0)
{
unitTarget.ToPlayer().DurabilityPointsLossAll(damage, (slot < -1));
ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, -1, -1);
ExecuteLogEffectDurabilityDamage(effectInfo.Effect, unitTarget, -1, -1);
return;
}
@@ -4415,7 +4414,7 @@ namespace Game.Spells
if (item != null)
{
unitTarget.ToPlayer().DurabilityPointsLoss(item, damage);
ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, (int)item.GetEntry(), slot);
ExecuteLogEffectDurabilityDamage(effectInfo.Effect, unitTarget, (int)item.GetEntry(), slot);
}
}
@@ -4572,7 +4571,7 @@ namespace Game.Spells
go.SetOwnerGUID(unitCaster.GetGUID());
go.SetSpellId(m_spellInfo.Id);
ExecuteLogEffectSummonObject(effIndex, go);
ExecuteLogEffectSummonObject(effectInfo.Effect, go);
Log.outDebug(LogFilter.Spells, "AddObject at SpellEfects.cpp EffectTransmitted");
@@ -4585,7 +4584,7 @@ namespace Game.Spells
linkedTrap.SetSpellId(m_spellInfo.Id);
linkedTrap.SetOwnerGUID(unitCaster.GetGUID());
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
ExecuteLogEffectSummonObject(effectInfo.Effect, linkedTrap);
}
}
@@ -4960,7 +4959,7 @@ namespace Game.Spells
gameObjTarget.SetDestructibleState((GameObjectDestructibleState)effectInfo.MiscValue, m_caster, true);
}
void SummonGuardian(uint i, uint entry, SummonPropertiesRecord properties, uint numGuardians, ObjectGuid privateObjectOwner)
void SummonGuardian(SpellEffectInfo effect, uint entry, SummonPropertiesRecord properties, uint numGuardians, ObjectGuid privateObjectOwner)
{
if (unitCaster == null)
return;
@@ -5025,7 +5024,7 @@ namespace Game.Spells
summon.GetAI().EnterEvadeMode();
ExecuteLogEffectSummonObject(i, summon);
ExecuteLogEffectSummonObject(effect.Effect, summon);
}
}
@@ -5330,7 +5329,7 @@ namespace Game.Spells
go.SetSpellId(m_spellInfo.Id);
go.SetPrivateObjectOwner(m_caster.GetGUID());
ExecuteLogEffectSummonObject(effIndex, go);
ExecuteLogEffectSummonObject(effectInfo.Effect, go);
map.AddToMap(go);
@@ -5342,7 +5341,7 @@ namespace Game.Spells
linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
linkedTrap.SetSpellId(m_spellInfo.Id);
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
ExecuteLogEffectSummonObject(effectInfo.Effect, linkedTrap);
}
}
@@ -5374,7 +5373,7 @@ namespace Game.Spells
if (resurrectAura != 0 && target.HasAura(resurrectAura))
return;
ExecuteLogEffectResurrect(effIndex, target);
ExecuteLogEffectResurrect(effectInfo.Effect, target);
target.SetResurrectRequestData(m_caster, health, mana, resurrectAura);
SendResurrectRequest(target);
}
@@ -5495,7 +5494,7 @@ namespace Game.Spells
bonusList.Add(collectionMgr.GetHeirloomBonus(m_misc.Data0));
DoCreateItem(effIndex, m_misc.Data0, ItemContext.None, bonusList);
ExecuteLogEffectCreateItem(effIndex, m_misc.Data0);
ExecuteLogEffectCreateItem(effectInfo.Effect, m_misc.Data0);
}
[SpellEffectHandler(SpellEffectName.ActivateGarrisonBuilding)]
@@ -5871,4 +5870,4 @@ namespace Game.Spells
int _chance;
byte _charges;
}
}
}