aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-08-28 18:30:45 +0200
committerShauren <shauren.trinity@gmail.com>2021-08-28 18:30:45 +0200
commitbc2c76a5b8b4a6e5c1d6e65d367c700e4ef1cbf2 (patch)
treef4b880d4f805a448a09875333db3610e807727ad /src
parentb9647bdecc08e63041bbf0d845d5c5b81705e180 (diff)
Core/Spells: Refactor building SMSG_SPELL_EXECUTE_LOG to not create 192 empty vectors on every spell cast
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Server/Packets/CombatLogPackets.cpp64
-rw-r--r--src/server/game/Server/Packets/CombatLogPackets.h14
-rw-r--r--src/server/game/Spells/Spell.cpp80
-rw-r--r--src/server/game/Spells/Spell.h52
-rw-r--r--src/server/game/Spells/SpellEffects.cpp92
5 files changed, 157 insertions, 145 deletions
diff --git a/src/server/game/Server/Packets/CombatLogPackets.cpp b/src/server/game/Server/Packets/CombatLogPackets.cpp
index 7aafcfdd870..ce7254c2305 100644
--- a/src/server/game/Server/Packets/CombatLogPackets.cpp
+++ b/src/server/game/Server/Packets/CombatLogPackets.cpp
@@ -63,48 +63,60 @@ WorldPacket const* WorldPackets::CombatLog::SpellExecuteLog::Write()
{
*this << Caster;
*this << int32(SpellID);
- *this << uint32(Effects.size());
+ *this << uint32(Effects->size());
- for (SpellLogEffect const& effect : Effects)
+ for (SpellLogEffect const& effect : *Effects)
{
*this << int32(effect.Effect);
- *this << uint32(effect.PowerDrainTargets.size());
- *this << uint32(effect.ExtraAttacksTargets.size());
- *this << uint32(effect.DurabilityDamageTargets.size());
- *this << uint32(effect.GenericVictimTargets.size());
- *this << uint32(effect.TradeSkillTargets.size());
- *this << uint32(effect.FeedPetTargets.size());
+ *this << uint32(effect.PowerDrainTargets ? effect.PowerDrainTargets->size() : 0);
+ *this << uint32(effect.ExtraAttacksTargets ? effect.ExtraAttacksTargets->size() : 0);
+ *this << uint32(effect.DurabilityDamageTargets ? effect.DurabilityDamageTargets->size() : 0);
+ *this << uint32(effect.GenericVictimTargets ? effect.GenericVictimTargets->size() : 0);
+ *this << uint32(effect.TradeSkillTargets ? effect.TradeSkillTargets->size() : 0);
+ *this << uint32(effect.FeedPetTargets ? effect.FeedPetTargets->size() : 0);
- for (SpellLogEffectPowerDrainParams const& powerDrainTarget : effect.PowerDrainTargets)
+ if (effect.PowerDrainTargets)
{
- *this << powerDrainTarget.Victim;
- *this << uint32(powerDrainTarget.Points);
- *this << uint32(powerDrainTarget.PowerType);
- *this << float(powerDrainTarget.Amplitude);
+ for (SpellLogEffectPowerDrainParams const& powerDrainTarget : *effect.PowerDrainTargets)
+ {
+ *this << powerDrainTarget.Victim;
+ *this << uint32(powerDrainTarget.Points);
+ *this << uint32(powerDrainTarget.PowerType);
+ *this << float(powerDrainTarget.Amplitude);
+ }
}
- for (SpellLogEffectExtraAttacksParams const& extraAttacksTarget : effect.ExtraAttacksTargets)
+ if (effect.ExtraAttacksTargets)
{
- *this << extraAttacksTarget.Victim;
- *this << uint32(extraAttacksTarget.NumAttacks);
+ for (SpellLogEffectExtraAttacksParams const& extraAttacksTarget : *effect.ExtraAttacksTargets)
+ {
+ *this << extraAttacksTarget.Victim;
+ *this << uint32(extraAttacksTarget.NumAttacks);
+ }
}
- for (SpellLogEffectDurabilityDamageParams const& durabilityDamageTarget : effect.DurabilityDamageTargets)
+ if (effect.DurabilityDamageTargets)
{
- *this << durabilityDamageTarget.Victim;
- *this << int32(durabilityDamageTarget.ItemID);
- *this << int32(durabilityDamageTarget.Amount);
+ for (SpellLogEffectDurabilityDamageParams const& durabilityDamageTarget : *effect.DurabilityDamageTargets)
+ {
+ *this << durabilityDamageTarget.Victim;
+ *this << int32(durabilityDamageTarget.ItemID);
+ *this << int32(durabilityDamageTarget.Amount);
+ }
}
- for (SpellLogEffectGenericVictimParams const& genericVictimTarget : effect.GenericVictimTargets)
- *this << genericVictimTarget.Victim;
+ if (effect.GenericVictimTargets)
+ for (SpellLogEffectGenericVictimParams const& genericVictimTarget : *effect.GenericVictimTargets)
+ *this << genericVictimTarget.Victim;
- for (SpellLogEffectTradeSkillItemParams const& tradeSkillTarget : effect.TradeSkillTargets)
- *this << int32(tradeSkillTarget.ItemID);
+ if (effect.TradeSkillTargets)
+ for (SpellLogEffectTradeSkillItemParams const& tradeSkillTarget : *effect.TradeSkillTargets)
+ *this << int32(tradeSkillTarget.ItemID);
- for (SpellLogEffectFeedPetParams const& feedPetTarget : effect.FeedPetTargets)
- *this << int32(feedPetTarget.ItemID);
+ if (effect.FeedPetTargets)
+ for (SpellLogEffectFeedPetParams const& feedPetTarget : *effect.FeedPetTargets)
+ *this << int32(feedPetTarget.ItemID);
}
WriteLogDataBit();
diff --git a/src/server/game/Server/Packets/CombatLogPackets.h b/src/server/game/Server/Packets/CombatLogPackets.h
index bef250fa4d0..1da43fef7e1 100644
--- a/src/server/game/Server/Packets/CombatLogPackets.h
+++ b/src/server/game/Server/Packets/CombatLogPackets.h
@@ -68,25 +68,13 @@ namespace WorldPackets
class SpellExecuteLog final : public CombatLogServerPacket
{
public:
- struct SpellLogEffect
- {
- int32 Effect = 0;
-
- std::vector<SpellLogEffectPowerDrainParams> PowerDrainTargets;
- std::vector<SpellLogEffectExtraAttacksParams> ExtraAttacksTargets;
- std::vector<SpellLogEffectDurabilityDamageParams> DurabilityDamageTargets;
- std::vector<SpellLogEffectGenericVictimParams> GenericVictimTargets;
- std::vector<SpellLogEffectTradeSkillItemParams> TradeSkillTargets;
- std::vector<SpellLogEffectFeedPetParams> FeedPetTargets;
- };
-
SpellExecuteLog() : CombatLogServerPacket(SMSG_SPELL_EXECUTE_LOG, 16 + 4 + 4 + 1) { }
WorldPacket const* Write() override;
ObjectGuid Caster;
int32 SpellID = 0;
- std::vector<SpellLogEffect> Effects;
+ std::vector<SpellLogEffect> const* Effects = nullptr;
};
class SpellHealLog final : public CombatLogServerPacket
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 968c0e0ca1e..8f651dac952 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4561,39 +4561,33 @@ void Spell::UpdateSpellCastDataAmmo(WorldPackets::Spells::SpellAmmo& ammo)
void Spell::SendSpellExecuteLog()
{
+ if (_executeLogEffects.empty())
+ return;
+
WorldPackets::CombatLog::SpellExecuteLog spellExecuteLog;
spellExecuteLog.Caster = m_caster->GetGUID();
spellExecuteLog.SpellID = m_spellInfo->Id;
+ spellExecuteLog.Effects = &_executeLogEffects;
+ spellExecuteLog.LogData.Initialize(this);
- for (SpellEffectInfo const* effect : m_spellInfo->GetEffects())
- {
- if (!effect)
- 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.Effects.emplace_back();
-
- WorldPackets::CombatLog::SpellExecuteLog::SpellLogEffect& spellLogEffect = spellExecuteLog.Effects.back();
- spellLogEffect.Effect = effect->Effect;
- spellLogEffect.PowerDrainTargets = std::move(_powerDrainTargets[effect->EffectIndex]);
- spellLogEffect.ExtraAttacksTargets = std::move(_extraAttacksTargets[effect->EffectIndex]);
- spellLogEffect.DurabilityDamageTargets = std::move(_durabilityDamageTargets[effect->EffectIndex]);
- spellLogEffect.GenericVictimTargets = std::move(_genericVictimTargets[effect->EffectIndex]);
- spellLogEffect.TradeSkillTargets = std::move(_tradeSkillTargets[effect->EffectIndex]);
- spellLogEffect.FeedPetTargets = std::move(_feedPetTargets[effect->EffectIndex]);
- }
+ m_caster->SendCombatLogMessage(&spellExecuteLog);
+}
- spellExecuteLog.LogData.Initialize(this);
+SpellLogEffect& Spell::GetExecuteLogEffect(SpellEffectName effect)
+{
+ auto itr = std::find_if(_executeLogEffects.begin(), _executeLogEffects.end(), [effect](SpellLogEffect& log)
+ {
+ return log.Effect == effect;
+ });
+ if (itr != _executeLogEffects.end())
+ return *itr;
- if (!spellExecuteLog.Effects.empty())
- m_caster->SendCombatLogMessage(&spellExecuteLog);
+ _executeLogEffects.emplace_back();
+ _executeLogEffects.back().Effect = effect;
+ return _executeLogEffects.back();
}
-void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 points, float amplitude)
+void Spell::ExecuteLogEffectTakeTargetPower(SpellEffectName effect, Unit* target, uint32 powerType, uint32 points, float amplitude)
{
SpellLogEffectPowerDrainParams spellLogEffectPowerDrainParams;
@@ -4602,19 +4596,19 @@ void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32
spellLogEffectPowerDrainParams.PowerType = powerType;
spellLogEffectPowerDrainParams.Amplitude = amplitude;
- _powerDrainTargets[effIndex].push_back(spellLogEffectPowerDrainParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::PowerDrainTargets).push_back(spellLogEffectPowerDrainParams);
}
-void Spell::ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 numAttacks)
+void Spell::ExecuteLogEffectExtraAttacks(SpellEffectName effect, Unit* victim, uint32 numAttacks)
{
SpellLogEffectExtraAttacksParams spellLogEffectExtraAttacksParams;
spellLogEffectExtraAttacksParams.Victim = victim->GetGUID();
spellLogEffectExtraAttacksParams.NumAttacks = numAttacks;
- _extraAttacksTargets[effIndex].push_back(spellLogEffectExtraAttacksParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::ExtraAttacksTargets).push_back(spellLogEffectExtraAttacksParams);
}
-void Spell::ExecuteLogEffectInterruptCast(uint8 /*effIndex*/, Unit* victim, uint32 spellId)
+void Spell::SendSpellInterruptLog(Unit* victim, uint32 spellId)
{
WorldPackets::CombatLog::SpellInterruptLog data;
data.Caster = m_caster->GetGUID();
@@ -4625,62 +4619,62 @@ void Spell::ExecuteLogEffectInterruptCast(uint8 /*effIndex*/, Unit* victim, uint
m_caster->SendMessageToSet(data.Write(), true);
}
-void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 amount)
+void Spell::ExecuteLogEffectDurabilityDamage(SpellEffectName effect, Unit* victim, int32 itemId, int32 amount)
{
SpellLogEffectDurabilityDamageParams spellLogEffectDurabilityDamageParams;
spellLogEffectDurabilityDamageParams.Victim = victim->GetGUID();
spellLogEffectDurabilityDamageParams.ItemID = itemId;
spellLogEffectDurabilityDamageParams.Amount = amount;
- _durabilityDamageTargets[effIndex].push_back(spellLogEffectDurabilityDamageParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::DurabilityDamageTargets).push_back(spellLogEffectDurabilityDamageParams);
}
-void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj)
+void Spell::ExecuteLogEffectOpenLock(SpellEffectName effect, Object* obj)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = obj->GetGUID();
- _genericVictimTargets[effIndex].push_back(spellLogEffectGenericVictimParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::GenericVictimTargets).push_back(spellLogEffectGenericVictimParams);
}
-void Spell::ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry)
+void Spell::ExecuteLogEffectCreateItem(SpellEffectName effect, uint32 entry)
{
SpellLogEffectTradeSkillItemParams spellLogEffectTradeSkillItemParams;
spellLogEffectTradeSkillItemParams.ItemID = entry;
- _tradeSkillTargets[effIndex].push_back(spellLogEffectTradeSkillItemParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::TradeSkillTargets).push_back(spellLogEffectTradeSkillItemParams);
}
-void Spell::ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry)
+void Spell::ExecuteLogEffectDestroyItem(SpellEffectName effect, uint32 entry)
{
SpellLogEffectFeedPetParams spellLogEffectFeedPetParams;
spellLogEffectFeedPetParams.ItemID = entry;
- _feedPetTargets[effIndex].push_back(spellLogEffectFeedPetParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::FeedPetTargets).push_back(spellLogEffectFeedPetParams);
}
-void Spell::ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj)
+void Spell::ExecuteLogEffectSummonObject(SpellEffectName effect, WorldObject* obj)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = obj->GetGUID();
- _genericVictimTargets[effIndex].push_back(spellLogEffectGenericVictimParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::GenericVictimTargets).push_back(spellLogEffectGenericVictimParams);
}
-void Spell::ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj)
+void Spell::ExecuteLogEffectUnsummonObject(SpellEffectName effect, WorldObject* obj)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = obj->GetGUID();
- _genericVictimTargets[effIndex].push_back(spellLogEffectGenericVictimParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::GenericVictimTargets).push_back(spellLogEffectGenericVictimParams);
}
-void Spell::ExecuteLogEffectResurrect(uint8 effect, Unit* target)
+void Spell::ExecuteLogEffectResurrect(SpellEffectName effect, Unit* target)
{
SpellLogEffectGenericVictimParams spellLogEffectGenericVictimParams;
spellLogEffectGenericVictimParams.Victim = target->GetGUID();
- _genericVictimTargets[effect].push_back(spellLogEffectGenericVictimParams);
+ GetExecuteLogEffectTargets(effect, &SpellLogEffect::GenericVictimTargets).push_back(spellLogEffectGenericVictimParams);
}
void Spell::SendInterrupted(uint8 result)
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index a72a83ecd06..ebf93a583c6 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -21,6 +21,7 @@
#include "ConditionMgr.h"
#include "DBCEnums.h"
#include "ObjectGuid.h"
+#include "Optional.h"
#include "Position.h"
#include "SharedDefines.h"
#include "SpellDefines.h"
@@ -204,6 +205,18 @@ struct SpellLogEffectFeedPetParams
int32 ItemID = 0;
};
+struct SpellLogEffect
+{
+ int32 Effect = 0;
+
+ Optional<std::vector<SpellLogEffectPowerDrainParams>> PowerDrainTargets;
+ Optional<std::vector<SpellLogEffectExtraAttacksParams>> ExtraAttacksTargets;
+ Optional<std::vector<SpellLogEffectDurabilityDamageParams>> DurabilityDamageTargets;
+ Optional<std::vector<SpellLogEffectGenericVictimParams>> GenericVictimTargets;
+ Optional<std::vector<SpellLogEffectTradeSkillItemParams>> TradeSkillTargets;
+ Optional<std::vector<SpellLogEffectFeedPetParams>> FeedPetTargets;
+};
+
class TC_GAME_API SpellCastTargets
{
public:
@@ -588,16 +601,26 @@ class TC_GAME_API Spell
void SendSpellGo();
void SendSpellCooldown();
void SendSpellExecuteLog();
- void ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 points, float amplitude);
- void ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 numAttacks);
- void ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId);
- void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 amount);
- void ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj);
- void ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry);
- void ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry);
- void ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj);
- void ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj);
- void ExecuteLogEffectResurrect(uint8 effIndex, Unit* target);
+ SpellLogEffect& GetExecuteLogEffect(SpellEffectName effect);
+ template<typename T>
+ std::vector<T>& GetExecuteLogEffectTargets(SpellEffectName effect, Optional<std::vector<T>> SpellLogEffect::* member)
+ {
+ Optional<std::vector<T>>& opt = GetExecuteLogEffect(effect).*member;
+ if (!opt)
+ opt.emplace();
+
+ return *opt;
+ }
+ void ExecuteLogEffectTakeTargetPower(SpellEffectName effect, Unit* target, uint32 powerType, uint32 points, float amplitude);
+ void ExecuteLogEffectExtraAttacks(SpellEffectName effect, Unit* victim, uint32 numAttacks);
+ void ExecuteLogEffectDurabilityDamage(SpellEffectName effect, Unit* victim, int32 itemId, int32 amount);
+ void ExecuteLogEffectOpenLock(SpellEffectName effect, Object* obj);
+ void ExecuteLogEffectCreateItem(SpellEffectName effect, uint32 entry);
+ void ExecuteLogEffectDestroyItem(SpellEffectName effect, uint32 entry);
+ void ExecuteLogEffectSummonObject(SpellEffectName effect, WorldObject* obj);
+ void ExecuteLogEffectUnsummonObject(SpellEffectName effect, WorldObject* obj);
+ void ExecuteLogEffectResurrect(SpellEffectName effect, Unit* target);
+ void SendSpellInterruptLog(Unit* victim, uint32 spellId);
void SendInterrupted(uint8 result);
void SendChannelUpdate(uint32 time);
void SendChannelStart(uint32 duration);
@@ -911,7 +934,7 @@ class TC_GAME_API Spell
HitTriggerSpellList m_hitTriggerSpells;
// effect helpers
- void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons, ObjectGuid privateObjectOwner);
+ void SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons, ObjectGuid privateObjectOwner);
void UpdateSpellCastDataTargets(WorldPackets::Spells::SpellCastData& data);
void UpdateSpellCastDataAmmo(WorldPackets::Spells::SpellAmmo& data);
@@ -932,12 +955,7 @@ class TC_GAME_API Spell
std::unique_ptr<PathGenerator> m_preGeneratedPath;
- std::vector<SpellLogEffectPowerDrainParams> _powerDrainTargets[MAX_SPELL_EFFECTS];
- std::vector<SpellLogEffectExtraAttacksParams> _extraAttacksTargets[MAX_SPELL_EFFECTS];
- std::vector<SpellLogEffectDurabilityDamageParams> _durabilityDamageTargets[MAX_SPELL_EFFECTS];
- std::vector<SpellLogEffectGenericVictimParams> _genericVictimTargets[MAX_SPELL_EFFECTS];
- std::vector<SpellLogEffectTradeSkillItemParams> _tradeSkillTargets[MAX_SPELL_EFFECTS];
- std::vector<SpellLogEffectFeedPetParams> _feedPetTargets[MAX_SPELL_EFFECTS];
+ std::vector<SpellLogEffect> _executeLogEffects;
Spell(Spell const& right) = delete;
Spell& operator=(Spell const& right) = delete;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index f076af9662a..db53874ebde 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -378,7 +378,7 @@ void Spell::EffectUnused(SpellEffIndex /*effIndex*/)
// NOT USED BY ANY SPELL OR USELESS OR IMPLEMENTED IN DIFFERENT WAY IN TRINITY
}
-void Spell::EffectResurrectNew(SpellEffIndex effIndex)
+void Spell::EffectResurrectNew(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -399,7 +399,7 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex)
uint32 health = damage;
uint32 mana = effectInfo->MiscValue;
- ExecuteLogEffectResurrect(effIndex, target);
+ ExecuteLogEffectResurrect(SpellEffectName(effectInfo->Effect), target);
target->SetResurrectRequestData(m_caster, health, mana, 0);
SendResurrectRequest(target);
}
@@ -1081,7 +1081,7 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex /*effIndex*/)
TC_LOG_DEBUG("spells", "Spell: %s has unlearned spell %u from %s", player->GetGUID().ToString().c_str(), spellToUnlearn, m_caster->GetGUID().ToString().c_str());
}
-void Spell::EffectPowerDrain(SpellEffIndex effIndex)
+void Spell::EffectPowerDrain(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -1112,7 +1112,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
unitCaster->EnergizeBySpell(unitCaster, m_spellInfo, gain, powerType);
}
- ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, newDamage, gainMultiplier);
+ ExecuteLogEffectTakeTargetPower(SpellEffectName(effectInfo->Effect), unitTarget, powerType, newDamage, gainMultiplier);
}
void Spell::EffectSendEvent(SpellEffIndex /*effIndex*/)
@@ -1156,7 +1156,7 @@ void Spell::EffectSendEvent(SpellEffIndex /*effIndex*/)
m_caster->GetMap()->ScriptsStart(sEventScripts, effectInfo->MiscValue, m_caster, target);
}
-void Spell::EffectPowerBurn(SpellEffIndex effIndex)
+void Spell::EffectPowerBurn(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -1174,7 +1174,7 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
float dmgMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this);
// add log data before multiplication (need power amount, not damage)
- ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, newDamage, 0.0f);
+ ExecuteLogEffectTakeTargetPower(SpellEffectName(effectInfo->Effect), unitTarget, powerType, newDamage, 0.0f);
newDamage = int32(newDamage * dmgMultiplier);
@@ -1415,7 +1415,7 @@ void Spell::EffectCreateItem(SpellEffIndex effIndex)
return;
DoCreateItem(effIndex, effectInfo->ItemType, m_spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) ? ItemContext::Trade_Skill : ItemContext::NONE);
- ExecuteLogEffectCreateItem(effIndex, effectInfo->ItemType);
+ ExecuteLogEffectCreateItem(SpellEffectName(effectInfo->Effect), effectInfo->ItemType);
}
void Spell::EffectCreateItem2(SpellEffIndex effIndex)
@@ -1756,7 +1756,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
}
}
}
- ExecuteLogEffectOpenLock(effIndex, gameObjTarget ? (Object*)gameObjTarget : (Object*)itemTarget);
+ ExecuteLogEffectOpenLock(SpellEffectName(effectInfo->Effect), gameObjTarget ? (Object*)gameObjTarget : (Object*)itemTarget);
}
void Spell::EffectSummonChangeItem(SpellEffIndex /*effIndex*/)
@@ -1895,7 +1895,7 @@ void Spell::EffectProficiency(SpellEffIndex /*effIndex*/)
}
}
-void Spell::EffectSummonType(SpellEffIndex effIndex)
+void Spell::EffectSummonType(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
@@ -1973,7 +1973,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
{
if (properties->Flags & 512)
{
- SummonGuardian(effIndex, entry, properties, numSummons, privateObjectOwner);
+ SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
break;
}
@@ -1983,7 +1983,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
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)
case SummonTitle::Vehicle:
@@ -2055,7 +2055,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
summon->SetCreatedBySpell(m_spellInfo->Id);
}
- ExecuteLogEffectSummonObject(effIndex, summon);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), summon);
}
return;
}
@@ -2063,7 +2063,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
break;
}
case SUMMON_CATEGORY_PET:
- SummonGuardian(effIndex, entry, properties, numSummons, privateObjectOwner);
+ SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
break;
case SUMMON_CATEGORY_PUPPET:
{
@@ -2114,7 +2114,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
if (summon)
{
summon->SetCreatorGUID(caster->GetGUID());
- ExecuteLogEffectSummonObject(effIndex, summon);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), summon);
}
}
@@ -2648,7 +2648,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
}
}
-void Spell::EffectSummonPet(SpellEffIndex effIndex)
+void Spell::EffectSummonPet(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
@@ -2667,7 +2667,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
{
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67);
if (properties)
- SummonGuardian(effIndex, petentry, properties, 1, ObjectGuid::Empty);
+ SummonGuardian(effectInfo, petentry, properties, 1, ObjectGuid::Empty);
return;
}
@@ -2727,7 +2727,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
if (!new_name.empty())
pet->SetName(new_name);
- ExecuteLogEffectSummonObject(effIndex, pet);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), pet);
}
void Spell::EffectLearnPetSpell(SpellEffIndex effIndex)
@@ -3049,14 +3049,14 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
Unit::ProcSkillsAndAuras(unitCaster, unitTarget, PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS, PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS,
PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_INTERRUPT, nullptr, nullptr, nullptr);
}
- ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id);
+ SendSpellInterruptLog(unitTarget, curSpellInfo->Id);
unitTarget->InterruptSpell(CurrentSpellTypes(i), false);
}
}
}
}
-void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
+void Spell::EffectSummonObjectWild(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
@@ -3085,7 +3085,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
go->SetSpellId(m_spellInfo->Id);
- ExecuteLogEffectSummonObject(effIndex, go);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), go);
// Wild object not have owner and check clickable by players
map->AddToMap(go);
@@ -3102,7 +3102,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
linkedTrap->SetSpellId(m_spellInfo->Id);
- ExecuteLogEffectSummonObject(effIndex, linkedTrap);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), linkedTrap);
}
}
@@ -3542,7 +3542,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
unitTarget->m_lastSanctuaryTime = GameTime::GetGameTimeMS();
}
-void Spell::EffectDuel(SpellEffIndex effIndex)
+void Spell::EffectDuel(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -3595,7 +3595,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
go->SetSpellId(m_spellInfo->Id);
- ExecuteLogEffectSummonObject(effIndex, go);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), go);
caster->AddGameObject(go);
map->AddToMap(go);
@@ -3838,7 +3838,7 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/)
player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
}
-void Spell::EffectFeedPet(SpellEffIndex effIndex)
+void Spell::EffectFeedPet(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -3858,7 +3858,7 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex)
if (!pet->IsAlive())
return;
- ExecuteLogEffectDestroyItem(effIndex, foodItem->GetEntry());
+ ExecuteLogEffectDestroyItem(SpellEffectName(effectInfo->Effect), foodItem->GetEntry());
int32 pct;
int32 levelDiff = int32(pet->getLevel()) - int32(foodItem->GetTemplate()->GetBaseItemLevel());
@@ -3880,7 +3880,7 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex)
m_caster->CastSpell(pet, effectInfo->TriggerSpell, args);
}
-void Spell::EffectDismissPet(SpellEffIndex effIndex)
+void Spell::EffectDismissPet(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -3890,11 +3890,11 @@ void Spell::EffectDismissPet(SpellEffIndex effIndex)
Pet* pet = unitTarget->ToPet();
- ExecuteLogEffectUnsummonObject(effIndex, pet);
+ ExecuteLogEffectUnsummonObject(SpellEffectName(effectInfo->Effect), pet);
pet->GetOwner()->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
}
-void Spell::EffectSummonObject(SpellEffIndex effIndex)
+void Spell::EffectSummonObject(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
@@ -3941,14 +3941,14 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
go->SetSpellId(m_spellInfo->Id);
unitCaster->AddGameObject(go);
- ExecuteLogEffectSummonObject(effIndex, go);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), go);
map->AddToMap(go);
unitCaster->m_ObjectSlot[slot] = go->GetGUID();
}
-void Spell::EffectResurrect(SpellEffIndex effIndex)
+void Spell::EffectResurrect(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -3967,13 +3967,13 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
uint32 health = target->CountPctFromMaxHealth(damage);
uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
- ExecuteLogEffectResurrect(effIndex, target);
+ ExecuteLogEffectResurrect(SpellEffectName(effectInfo->Effect), target);
target->SetResurrectRequestData(m_caster, health, mana, 0);
SendResurrectRequest(target);
}
-void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex)
+void Spell::EffectAddExtraAttacks(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -3986,7 +3986,7 @@ void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex)
unitTarget->m_extraAttacks = damage;
- ExecuteLogEffectExtraAttacks(effIndex, unitTarget, damage);
+ ExecuteLogEffectExtraAttacks(SpellEffectName(effectInfo->Effect), unitTarget, damage);
}
void Spell::EffectParry(SpellEffIndex /*effIndex*/)
@@ -4574,7 +4574,7 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
}
}
-void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
+void Spell::EffectDurabilityDamage(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -4588,7 +4588,7 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
if (slot < 0)
{
unitTarget->ToPlayer()->DurabilityPointsLossAll(damage, (slot < -1));
- ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, -1, -1);
+ ExecuteLogEffectDurabilityDamage(SpellEffectName(effectInfo->Effect), unitTarget, -1, -1);
return;
}
@@ -4599,7 +4599,7 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
if (Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
unitTarget->ToPlayer()->DurabilityPointsLoss(item, damage);
- ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, item->GetEntry(), slot);
+ ExecuteLogEffectDurabilityDamage(SpellEffectName(effectInfo->Effect), unitTarget, item->GetEntry(), slot);
}
}
@@ -4643,7 +4643,7 @@ void Spell::EffectModifyThreatPercent(SpellEffIndex /*effIndex*/)
unitTarget->GetThreatManager().ModifyThreatByPercent(unitCaster, damage);
}
-void Spell::EffectTransmitted(SpellEffIndex effIndex)
+void Spell::EffectTransmitted(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
@@ -4753,7 +4753,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
//go->SetLevel(unitCaster->getLevel());
go->SetSpellId(m_spellInfo->Id);
- ExecuteLogEffectSummonObject(effIndex, go);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), go);
TC_LOG_DEBUG("spells", "AddObject at SpellEfects.cpp EffectTransmitted");
//unitCaster->AddGameObject(go);
@@ -4770,7 +4770,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
linkedTrap->SetSpellId(m_spellInfo->Id);
linkedTrap->SetOwnerGUID(unitCaster->GetGUID());
- ExecuteLogEffectSummonObject(effIndex, linkedTrap);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), linkedTrap);
}
}
@@ -5144,7 +5144,7 @@ void Spell::EffectGameObjectSetDestructionState(SpellEffIndex /*effIndex*/)
gameObjTarget->SetDestructibleState(GameObjectDestructibleState(effectInfo->MiscValue), m_caster, true);
}
-void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians, ObjectGuid privateObjectOwner)
+void Spell::SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians, ObjectGuid privateObjectOwner)
{
if (!unitCaster)
return;
@@ -5203,7 +5203,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
summon->AI()->EnterEvadeMode();
- ExecuteLogEffectSummonObject(i, summon);
+ ExecuteLogEffectSummonObject(SpellEffectName(effect->Effect), summon);
}
}
@@ -5486,7 +5486,7 @@ void Spell::EffectSummonPersonalGameObject(SpellEffIndex effIndex)
go->SetSpellId(m_spellInfo->Id);
go->SetPrivateObjectOwner(m_caster->GetGUID());
- ExecuteLogEffectSummonObject(effIndex, go);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), go);
map->AddToMap(go);
@@ -5497,11 +5497,11 @@ void Spell::EffectSummonPersonalGameObject(SpellEffIndex effIndex)
linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
linkedTrap->SetSpellId(m_spellInfo->Id);
- ExecuteLogEffectSummonObject(effIndex, linkedTrap);
+ ExecuteLogEffectSummonObject(SpellEffectName(effectInfo->Effect), linkedTrap);
}
}
-void Spell::EffectResurrectWithAura(SpellEffIndex effIndex)
+void Spell::EffectResurrectWithAura(SpellEffIndex /*effIndex*/)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
@@ -5528,7 +5528,7 @@ void Spell::EffectResurrectWithAura(SpellEffIndex effIndex)
if (resurrectAura && target->HasAura(resurrectAura))
return;
- ExecuteLogEffectResurrect(effIndex, target);
+ ExecuteLogEffectResurrect(SpellEffectName(effectInfo->Effect), target);
target->SetResurrectRequestData(m_caster, health, mana, resurrectAura);
SendResurrectRequest(target);
}
@@ -5639,7 +5639,7 @@ void Spell::EffectCreateHeirloomItem(SpellEffIndex effIndex)
bonusList.push_back(collectionMgr->GetHeirloomBonus(m_misc.Raw.Data[0]));
DoCreateItem(effIndex, m_misc.Raw.Data[0], ItemContext::NONE, bonusList);
- ExecuteLogEffectCreateItem(effIndex, m_misc.Raw.Data[0]);
+ ExecuteLogEffectCreateItem(SpellEffectName(effectInfo->Effect), m_misc.Raw.Data[0]);
}
void Spell::EffectActivateGarrisonBuilding(SpellEffIndex /*effIndex*/)