From 8785c0d5a5bf1967ee1469fdaf0d024dd22f0f0d Mon Sep 17 00:00:00 2001 From: Gildor Date: Tue, 18 Feb 2025 12:36:04 +0100 Subject: [PATCH 01/14] Core/Groups: align the player's dungeon/raid difficulty with the group's difficulty upon joining, regardless of the player's level. (#30699) --- src/server/game/Groups/Group.cpp | 19 ++++++++----------- src/server/game/Maps/Map.h | 5 ----- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 7c17d794c0..dd49abd092 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -467,18 +467,15 @@ bool Group::AddMember(Player* player) player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false); player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true); - if (player->GetLevel() >= LEVELREQUIREMENT_HEROIC) + if (player->GetDungeonDifficulty() != GetDungeonDifficulty()) { - if (player->GetDungeonDifficulty() != GetDungeonDifficulty()) - { - player->SetDungeonDifficulty(GetDungeonDifficulty()); - player->SendDungeonDifficulty(true); - } - if (player->GetRaidDifficulty() != GetRaidDifficulty()) - { - player->SetRaidDifficulty(GetRaidDifficulty()); - player->SendRaidDifficulty(true); - } + player->SetDungeonDifficulty(GetDungeonDifficulty()); + player->SendDungeonDifficulty(true); + } + if (player->GetRaidDifficulty() != GetRaidDifficulty()) + { + player->SetRaidDifficulty(GetRaidDifficulty()); + player->SendRaidDifficulty(true); } } player->SetGroupUpdateFlag(GROUP_UPDATE_FULL); diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 1f8ff20264..f82420e49e 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -216,11 +216,6 @@ class TC_GAME_API GridMap #pragma pack(push, 1) -enum LevelRequirementVsMode -{ - LEVELREQUIREMENT_HEROIC = 70 -}; - struct ZoneDynamicInfo { ZoneDynamicInfo(); From 1942647c0d0229aca96602f3617365bd477e94de Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 9 Dec 2024 21:13:18 +0100 Subject: [PATCH 02/14] Dep: Replace basic_deadline_timer with std::chrono based basic_waitable_timer (cherry picked from commit c81183a6600722f3a9bb4996c0849b530fbdd1b0) --- src/common/Asio/DeadlineTimer.h | 19 ++++++----- src/common/Metric/Metric.cpp | 4 +-- src/server/authserver/Main.cpp | 12 +++---- src/server/shared/Networking/NetworkThread.h | 4 +-- src/server/shared/Realm/RealmList.cpp | 2 +- src/server/worldserver/Main.cpp | 34 ++++++++++---------- 6 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/common/Asio/DeadlineTimer.h b/src/common/Asio/DeadlineTimer.h index 94531a2851..c1b2306b25 100644 --- a/src/common/Asio/DeadlineTimer.h +++ b/src/common/Asio/DeadlineTimer.h @@ -18,18 +18,17 @@ #ifndef DeadlineTimer_h__ #define DeadlineTimer_h__ -#include +#include "Duration.h" +#include +#include -namespace Trinity +namespace Trinity::Asio { - namespace Asio - { - class DeadlineTimer : public boost::asio::basic_deadline_timer, boost::asio::io_context::executor_type> - { - public: - using basic_deadline_timer::basic_deadline_timer; - }; - } +class DeadlineTimer : public boost::asio::basic_waitable_timer, boost::asio::io_context::executor_type> +{ +public: + using basic_waitable_timer::basic_waitable_timer; +}; } #endif // DeadlineTimer_h__ diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp index 06c084a3c2..08dff35eb9 100644 --- a/src/common/Metric/Metric.cpp +++ b/src/common/Metric/Metric.cpp @@ -220,7 +220,7 @@ void Metric::ScheduleSend() { if (_enabled) { - _batchTimer->expires_from_now(boost::posix_time::seconds(_updateInterval)); + _batchTimer->expires_after(std::chrono::seconds(_updateInterval)); _batchTimer->async_wait(std::bind(&Metric::SendBatch, this)); } else @@ -250,7 +250,7 @@ void Metric::ScheduleOverallStatusLog() { if (_enabled) { - _overallStatusTimer->expires_from_now(boost::posix_time::seconds(_overallStatusTimerInterval)); + _overallStatusTimer->expires_after(std::chrono::seconds(_overallStatusTimerInterval)); _overallStatusTimer->async_wait([this](const boost::system::error_code&) { _overallStatusTimerTriggered = true; diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index d58c7a0c0c..b82727c933 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -229,12 +229,12 @@ int main(int argc, char** argv) // Enabled a timed callback for handling the database keep alive ping int32 dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30); std::shared_ptr dbPingTimer = std::make_shared(*ioContext); - dbPingTimer->expires_from_now(boost::posix_time::minutes(dbPingInterval)); + dbPingTimer->expires_after(std::chrono::minutes(dbPingInterval)); dbPingTimer->async_wait(std::bind(&KeepDatabaseAliveHandler, std::weak_ptr(dbPingTimer), dbPingInterval, std::placeholders::_1)); int32 banExpiryCheckInterval = sConfigMgr->GetIntDefault("BanExpiryCheckInterval", 60); std::shared_ptr banExpiryCheckTimer = std::make_shared(*ioContext); - banExpiryCheckTimer->expires_from_now(boost::posix_time::seconds(banExpiryCheckInterval)); + banExpiryCheckTimer->expires_after(std::chrono::seconds(banExpiryCheckInterval)); banExpiryCheckTimer->async_wait(std::bind(&BanExpiryHandler, std::weak_ptr(banExpiryCheckTimer), banExpiryCheckInterval, std::placeholders::_1)); #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS @@ -242,7 +242,7 @@ int main(int argc, char** argv) if (m_ServiceStatus != -1) { serviceStatusWatchTimer = std::make_shared(*ioContext); - serviceStatusWatchTimer->expires_from_now(boost::posix_time::seconds(1)); + serviceStatusWatchTimer->expires_after(1s); serviceStatusWatchTimer->async_wait(std::bind(&ServiceStatusWatcher, std::weak_ptr(serviceStatusWatchTimer), std::weak_ptr(ioContext), @@ -306,7 +306,7 @@ void KeepDatabaseAliveHandler(std::weak_ptr dbPing TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); LoginDatabase.KeepAlive(); - dbPingTimer->expires_from_now(boost::posix_time::minutes(dbPingInterval)); + dbPingTimer->expires_after(std::chrono::minutes(dbPingInterval)); dbPingTimer->async_wait(std::bind(&KeepDatabaseAliveHandler, dbPingTimerRef, dbPingInterval, std::placeholders::_1)); } } @@ -321,7 +321,7 @@ void BanExpiryHandler(std::weak_ptr banExpiryCheck LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS)); LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS)); - banExpiryCheckTimer->expires_from_now(boost::posix_time::seconds(banExpiryCheckInterval)); + banExpiryCheckTimer->expires_after(std::chrono::seconds(banExpiryCheckInterval)); banExpiryCheckTimer->async_wait(std::bind(&BanExpiryHandler, banExpiryCheckTimerRef, banExpiryCheckInterval, std::placeholders::_1)); } } @@ -338,7 +338,7 @@ void ServiceStatusWatcher(std::weak_ptr serviceSta ioContext->stop(); else if (std::shared_ptr serviceStatusWatchTimer = serviceStatusWatchTimerRef.lock()) { - serviceStatusWatchTimer->expires_from_now(boost::posix_time::seconds(1)); + serviceStatusWatchTimer->expires_after(1s); serviceStatusWatchTimer->async_wait(std::bind(&ServiceStatusWatcher, serviceStatusWatchTimerRef, ioContextRef, std::placeholders::_1)); } } diff --git a/src/server/shared/Networking/NetworkThread.h b/src/server/shared/Networking/NetworkThread.h index 5f9071af65..e149867c96 100644 --- a/src/server/shared/Networking/NetworkThread.h +++ b/src/server/shared/Networking/NetworkThread.h @@ -122,7 +122,7 @@ class NetworkThread { TC_LOG_DEBUG("misc", "Network Thread Starting"); - _updateTimer.expires_from_now(boost::posix_time::milliseconds(1)); + _updateTimer.expires_after(1ms); _updateTimer.async_wait([this](boost::system::error_code const&) { Update(); }); _ioContext.run(); @@ -136,7 +136,7 @@ class NetworkThread if (_stopped) return; - _updateTimer.expires_from_now(boost::posix_time::milliseconds(1)); + _updateTimer.expires_after(1ms); _updateTimer.async_wait([this](boost::system::error_code const&) { Update(); }); AddNewSockets(); diff --git a/src/server/shared/Realm/RealmList.cpp b/src/server/shared/Realm/RealmList.cpp index f68623c5a5..b525707cf4 100644 --- a/src/server/shared/Realm/RealmList.cpp +++ b/src/server/shared/Realm/RealmList.cpp @@ -167,7 +167,7 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) if (_updateInterval) { - _updateTimer->expires_from_now(boost::posix_time::seconds(_updateInterval)); + _updateTimer->expires_after(std::chrono::seconds(_updateInterval)); _updateTimer->async_wait(std::bind(&RealmList::UpdateRealms, this, std::placeholders::_1)); } } diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 7042669840..6314538074 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -93,26 +93,26 @@ int m_ServiceStatus = -1; class FreezeDetector { - public: +public: FreezeDetector(Trinity::Asio::IoContext& ioContext, uint32 maxCoreStuckTime) : _timer(ioContext), _worldLoopCounter(0), _lastChangeMsTime(getMSTime()), _maxCoreStuckTimeInMs(maxCoreStuckTime) { } - static void Start(std::shared_ptr const& freezeDetector) + static void Start(std::shared_ptr const& freezeDetector) + { + freezeDetector->_timer.expires_after(5s); + freezeDetector->_timer.async_wait([freezeDetectorRef = std::weak_ptr(freezeDetector)](boost::system::error_code const& error) mutable { - freezeDetector->_timer.expires_from_now(boost::posix_time::seconds(5)); - freezeDetector->_timer.async_wait([freezeDetectorRef = std::weak_ptr(freezeDetector)](boost::system::error_code const& error) - { - return Handler(freezeDetectorRef, error); - }); - } + Handler(std::move(freezeDetectorRef), error); + }); + } - static void Handler(std::weak_ptr freezeDetectorRef, boost::system::error_code const& error); + static void Handler(std::weak_ptr freezeDetectorRef, boost::system::error_code const& error); - private: - Trinity::Asio::DeadlineTimer _timer; - uint32 _worldLoopCounter; - uint32 _lastChangeMsTime; - uint32 _maxCoreStuckTimeInMs; +private: + Trinity::Asio::DeadlineTimer _timer; + uint32 _worldLoopCounter; + uint32 _lastChangeMsTime; + uint32 _maxCoreStuckTimeInMs; }; void SignalHandler(boost::system::error_code const& error, int signalNumber); @@ -574,10 +574,10 @@ void FreezeDetector::Handler(std::weak_ptr freezeDetectorRef, bo } } - freezeDetector->_timer.expires_from_now(boost::posix_time::seconds(1)); - freezeDetector->_timer.async_wait([freezeDetectorRef](boost::system::error_code const& timerError) + freezeDetector->_timer.expires_after(1s); + freezeDetector->_timer.async_wait([freezeDetectorRef = std::move(freezeDetectorRef)](boost::system::error_code const& error) mutable { - return Handler(freezeDetectorRef, timerError); + Handler(std::move(freezeDetectorRef), error); }); } } From 81ab02d6f89605c4a059a76de2ba90b0e2e5b214 Mon Sep 17 00:00:00 2001 From: Mykhailo Redko Date: Tue, 18 Feb 2025 17:35:32 +0200 Subject: [PATCH 03/14] Core/Spells: Remove ProcEventInfo::GetProcTarget to avoid confusion. (#30435) --- src/server/game/Entities/Unit/Unit.cpp | 8 +- src/server/game/Entities/Unit/Unit.h | 4 +- .../game/Spells/Auras/SpellAuraEffects.cpp | 6 +- .../boss_deathbringer_saurfang.cpp | 2 +- .../VaultOfArchavon/boss_koralon.cpp | 4 +- .../Outland/BlackTemple/boss_illidan.cpp | 4 +- .../TheSlavePens/boss_ahune.cpp | 2 +- src/server/scripts/Pet/pet_generic.cpp | 2 +- src/server/scripts/Pet/pet_hunter.cpp | 2 +- src/server/scripts/Spells/spell_dk.cpp | 58 ++++--- src/server/scripts/Spells/spell_druid.cpp | 46 +++--- src/server/scripts/Spells/spell_generic.cpp | 4 +- src/server/scripts/Spells/spell_hunter.cpp | 10 +- src/server/scripts/Spells/spell_item.cpp | 47 +++--- src/server/scripts/Spells/spell_mage.cpp | 13 +- src/server/scripts/Spells/spell_paladin.cpp | 148 ++++++++++-------- src/server/scripts/Spells/spell_priest.cpp | 112 +++++++------ src/server/scripts/Spells/spell_rogue.cpp | 6 +- src/server/scripts/Spells/spell_shaman.cpp | 47 +++--- src/server/scripts/Spells/spell_warlock.cpp | 12 +- src/server/scripts/Spells/spell_warrior.cpp | 12 +- 21 files changed, 294 insertions(+), 255 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 123c3403ec..af4fcb052d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -253,12 +253,12 @@ uint32 HealInfo::GetHitMask() const return _hitMask; } -ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, +ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo) : - _actor(actor), _actionTarget(actionTarget), _procTarget(procTarget), + _actor(actor), _actionTarget(actionTarget), _typeMask(typeMask), _spellTypeMask(spellTypeMask), _spellPhaseMask(spellPhaseMask), _hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo) @@ -10179,7 +10179,7 @@ void Unit::GetProcAurasTriggeredOnEvent(AuraApplicationProcContainer& aurasTrigg void Unit::TriggerAurasProcOnEvent(Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo) { // prepare data for self trigger - ProcEventInfo myProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); + ProcEventInfo myProcEventInfo(this, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); if (typeMaskActor) { AuraApplicationProcContainer myAurasTriggeringProc; @@ -10203,7 +10203,7 @@ void Unit::TriggerAurasProcOnEvent(Unit* actionTarget, uint32 typeMaskActor, uin } // prepare data for target trigger - ProcEventInfo targetProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); + ProcEventInfo targetProcEventInfo(this, actionTarget, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); if (typeMaskActionTarget && actionTarget) { AuraApplicationProcContainer targetAurasTriggeringProc; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index a0b232460d..8bd1618ada 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -501,13 +501,12 @@ class TC_GAME_API HealInfo class TC_GAME_API ProcEventInfo { public: - ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask, + ProcEventInfo(Unit* actor, Unit* actionTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo); Unit* GetActor() { return _actor; } Unit* GetActionTarget() const { return _actionTarget; } - Unit* GetProcTarget() const { return _procTarget; } uint32 GetTypeMask() const { return _typeMask; } uint32 GetSpellTypeMask() const { return _spellTypeMask; } @@ -525,7 +524,6 @@ class TC_GAME_API ProcEventInfo private: Unit* const _actor; Unit* const _actionTarget; - Unit* const _procTarget; uint32 _typeMask; uint32 _spellTypeMask; uint32 _spellPhaseMask; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1346f8682a..bc6d367709 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5615,7 +5615,7 @@ void AuraEffect::HandleBreakableCCAuraProc(AuraApplication* aurApp, ProcEventInf void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) { Unit* triggerCaster = aurApp->GetTarget(); - Unit* triggerTarget = eventInfo.GetProcTarget(); + Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor(); uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell; if (triggerSpellId == 0) @@ -5636,7 +5636,7 @@ void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEve void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) { Unit* triggerCaster = aurApp->GetTarget(); - Unit* triggerTarget = eventInfo.GetProcTarget(); + Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor(); uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell; if (triggerSpellId == 0) @@ -5662,7 +5662,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv return; Unit* target = aurApp->GetTarget(); - Unit* triggerTarget = eventInfo.GetProcTarget(); + Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor(); if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamage(GetSpellInfo())) { SendTickImmune(triggerTarget, target); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 209dd71150..04ddea79fe 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1101,7 +1101,7 @@ class spell_deathbringer_blood_beast_blood_link : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetProcTarget()->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(aurEff).AddSpellBP0(3)); + eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(aurEff).AddSpellBP0(3)); } void Register() override diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp index daba4bfc3d..258736a4aa 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp @@ -112,7 +112,7 @@ class spell_koralon_meteor_fists : public AuraScript void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_METEOR_FISTS_DAMAGE, aurEff); } void Register() override @@ -168,7 +168,7 @@ class spell_flame_warder_meteor_fists : public AuraScript void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, aurEff); } void Register() override diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 952fa800a0..6081254590 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -1952,8 +1952,8 @@ class spell_illidan_parasitic_shadowfiend_proc : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - Unit* target = eventInfo.GetProcTarget(); - return target && !target->HasAura(SPELL_PARASITIC_SHADOWFIEND) && !target->HasAura(SPELL_PARASITIC_SHADOWFIEND_2); + Unit* target = eventInfo.GetActionTarget(); + return !target->HasAura(SPELL_PARASITIC_SHADOWFIEND) && !target->HasAura(SPELL_PARASITIC_SHADOWFIEND_2); } void Register() override diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp index 3cd67e7970..3cfdb5853a 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp @@ -839,7 +839,7 @@ class spell_ahune_spanky_hands : public AuraScript void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_COLD_SLAP, true); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_COLD_SLAP, true); } void Register() override diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index b8bb69fe22..e0d66e3629 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -202,7 +202,7 @@ class spell_pet_gen_lich_pet_aura : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return (eventInfo.GetProcTarget()->GetTypeId() == TYPEID_PLAYER); + return eventInfo.GetActionTarget()->IsPlayer(); } void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp index 9894e94825..51a9a14f3b 100644 --- a/src/server/scripts/Pet/pet_hunter.cpp +++ b/src/server/scripts/Pet/pet_hunter.cpp @@ -205,7 +205,7 @@ class spell_pet_guard_dog : public AuraScript Unit* caster = eventInfo.GetActor(); caster->CastSpell(nullptr, SPELL_PET_GUARD_DOG_HAPPINESS, aurEff); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); if (!target->CanHaveThreatList()) return; float addThreat = CalculatePct(ASSERT_NOTNULL(eventInfo.GetSpellInfo())->GetEffect(EFFECT_0).CalcValue(caster), aurEff->GetAmount()); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 71eb6b58fe..a3f06959d5 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -981,7 +981,7 @@ class spell_dk_glyph_of_scourge_strike : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT, aurEff); } void Register() override @@ -1344,7 +1344,7 @@ class spell_dk_mark_of_blood : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_MARK_OF_BLOOD_HEAL, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DK_MARK_OF_BLOOD_HEAL, aurEff); } void Register() override @@ -1363,21 +1363,24 @@ class spell_dk_necrosis : public AuraScript return ValidateSpellInfo({ SPELL_DK_NECROSIS_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(damageInfo->GetDamage(), aurEff->GetAmount())); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_NECROSIS_DAMAGE, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DK_NECROSIS_DAMAGE, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dk_necrosis::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dk_necrosis::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1889,7 +1892,7 @@ class spell_dk_sudden_doom : public AuraScript if (!spellId) return; - caster->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + caster->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -1956,7 +1959,7 @@ class spell_dk_threat_of_thassarian : public AuraScript return; spellId = sSpellMgr->GetSpellWithRank(spellId, spellInfo->GetRank()); - caster->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + caster->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -1979,19 +1982,21 @@ class spell_dk_unholy_blight : public AuraScript }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DK_UNHOLY_BLIGHT_DAMAGE); - int32 amount = CalculatePct(static_cast(damageInfo->GetDamage()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); if (AuraEffect const* glyph = caster->GetAuraEffect(SPELL_DK_GLYPH_OF_UNHOLY_BLIGHT, EFFECT_0, caster->GetGUID())) AddPct(amount, glyph->GetAmount()); @@ -2005,6 +2010,7 @@ class spell_dk_unholy_blight : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dk_unholy_blight::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dk_unholy_blight::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -2060,19 +2066,22 @@ class spell_dk_wandering_plague : public AuraScript return ValidateSpellInfo({ SPELL_DK_WANDERING_PLAGUE_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + if (!roll_chance_f(eventInfo.GetActor()->GetUnitCriticalChanceAgainst(BASE_ATTACK, eventInfo.GetActionTarget()))) + return false; + + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); - if (!roll_chance_f(caster->GetUnitCriticalChanceAgainst(BASE_ATTACK, target))) - return; - - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; + Unit* target = eventInfo.GetActionTarget(); - int32 amount = CalculatePct(static_cast(damageInfo->GetDamage()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); caster->CastSpell(target, SPELL_DK_WANDERING_PLAGUE_DAMAGE, args); @@ -2080,6 +2089,7 @@ class spell_dk_wandering_plague : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dk_wandering_plague::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dk_wandering_plague::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 9efa58725a..f10de91b48 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -536,13 +536,13 @@ class spell_dru_glyph_of_rake : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget()->GetTypeId() == TYPEID_UNIT; + return eventInfo.GetActionTarget()->IsCreature(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_GLYPH_OF_RAKE_TRIGGERED, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_GLYPH_OF_RAKE_TRIGGERED, aurEff); } void Register() override @@ -564,19 +564,20 @@ class spell_dru_glyph_of_rejuvenation : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget()->HealthBelowPct(50); + if (!eventInfo.GetActionTarget()->HealthBelowPct(50)) + return false; + + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount())); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_GLYPH_OF_REJUVENATION_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_GLYPH_OF_REJUVENATION_HEAL, args); } void Register() override @@ -606,7 +607,7 @@ class spell_dru_glyph_of_shred : public AuraScript Unit* caster = eventInfo.GetActor(); // try to find spell Rip on the target - if (AuraEffect const* rip = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, caster->GetGUID())) + if (AuraEffect const* rip = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, caster->GetGUID())) { // Rip's max duration, note: spells which modifies Rip's duration also counted like Glyph of Rip uint32 countMin = rip->GetBase()->GetMaxDuration(); @@ -689,7 +690,7 @@ class spell_dru_glyph_of_starfire_dummy : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_GLYPH_OF_STARFIRE_SCRIPT, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_GLYPH_OF_STARFIRE_SCRIPT, aurEff); } void Register() override @@ -886,21 +887,24 @@ class spell_dru_living_seed : public AuraScript return ValidateSpellInfo({ SPELL_DRUID_LIVING_SEED_PROC }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount())); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_LIVING_SEED_PROC, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount())); + GetTarget()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_LIVING_SEED_PROC, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dru_living_seed::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dru_living_seed::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1157,7 +1161,7 @@ class spell_dru_revitalize : public AuraScript if (!roll_chance_i(aurEff->GetAmount())) return; - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); uint32 spellId; switch (target->GetPowerType()) @@ -1483,7 +1487,7 @@ class spell_dru_t3_2p_bonus : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); uint32 spellId; switch (target->GetPowerType()) @@ -1524,7 +1528,7 @@ class spell_dru_t3_6p_bonus : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_BLESSING_OF_THE_CLAW, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_BLESSING_OF_THE_CLAW, aurEff); } void Register() override @@ -1721,7 +1725,7 @@ class spell_dru_t10_balance_4p_bonus : public AuraScript return; Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DRUID_LANGUISH); int32 amount = CalculatePct(static_cast(damageInfo->GetDamage()), aurEff->GetAmount()); @@ -1807,7 +1811,7 @@ class spell_dru_t10_restoration_4p_bonus_dummy : public AuraScript if (!caster) return false; - return caster->GetGroup() || caster != eventInfo.GetProcTarget(); + return caster->GetGroup() || caster != eventInfo.GetActionTarget(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index f9a30113a3..8edb09cc60 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1509,7 +1509,7 @@ class spell_ethereal_pet_aura : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - uint32 levelDiff = std::abs(GetTarget()->GetLevel() - eventInfo.GetProcTarget()->GetLevel()); + uint32 levelDiff = std::abs(eventInfo.GetActor()->GetLevel() - eventInfo.GetActionTarget()->GetLevel()); return levelDiff <= 9; } @@ -1524,7 +1524,7 @@ class spell_ethereal_pet_aura : public AuraScript if (minion->IsAIEnabled()) { minion->AI()->Talk(SAY_STEAL_ESSENCE); - minion->CastSpell(eventInfo.GetProcTarget(), SPELL_STEAL_ESSENCE_VISUAL); + minion->CastSpell(eventInfo.GetActionTarget(), SPELL_STEAL_ESSENCE_VISUAL); } } } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 09b314d7ff..623822f112 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -357,7 +357,7 @@ class spell_hun_glyph_of_arcane_shot : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - if (Unit* procTarget = eventInfo.GetProcTarget()) + if (Unit* procTarget = eventInfo.GetActionTarget()) { Unit::AuraApplicationMap const& auras = procTarget->GetAppliedAuras(); for (Unit::AuraApplicationMap::const_iterator i = auras.begin(); i != auras.end(); ++i) @@ -381,13 +381,13 @@ class spell_hun_glyph_of_arcane_shot : public AuraScript if (!procSpell) return; - int32 mana = procSpell->CalcPowerCost(GetTarget(), procSpell->GetSchoolMask()); + int32 mana = procSpell->CalcPowerCost(eventInfo.GetActor(), procSpell->GetSchoolMask()); ApplyPct(mana, aurEff->GetAmount()); // castspell refactor note: this is not triggered - is this intended? CastSpellExtraArgs args; args.AddSpellBP0(mana); - GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT, args); } void Register() override @@ -410,7 +410,7 @@ class spell_hun_glyph_of_mend_pet : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetProcTarget()->CastSpell(nullptr, SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS, aurEff); + eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS, aurEff); } void Register() override @@ -1240,7 +1240,7 @@ class spell_hun_thrill_of_the_hunt : public AuraScript // Explosive Shot if (spellInfo->SpellFamilyFlags[2] & 0x200) { - if (AuraEffect const* explosiveShot = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x00000000, 0x80000000, 0x00000000, caster->GetGUID())) + if (AuraEffect const* explosiveShot = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x00000000, 0x80000000, 0x00000000, caster->GetGUID())) { // due to Lock and Load SpellInfo::CalcPowerCost might return 0, so just calculate it manually amount = CalculatePct(static_cast(CalculatePct(caster->GetCreateMana(), explosiveShot->GetSpellInfo()->ManaCostPercentage)), aurEff->GetAmount()); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 1bdeed4655..b57a3f4b26 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -249,7 +249,7 @@ class spell_item_anger_capacitor : public SpellScriptLoader { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); caster->CastSpell(nullptr, SPELL_MOTE_OF_ANGER, true); Aura const* motes = caster->GetAura(SPELL_MOTE_OF_ANGER); @@ -450,19 +450,16 @@ class spell_item_blessing_of_ancient_kings : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget() != nullptr; + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - - int32 absorb = int32(CalculatePct(healInfo->GetHeal(), 15.0f)); - if (AuraEffect* protEff = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, 0, eventInfo.GetActor()->GetGUID())) + int32 absorb = int32(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15.0f)); + if (AuraEffect* protEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, 0, eventInfo.GetActor()->GetGUID())) { // The shield can grow to a maximum size of 20,000 damage absorbtion protEff->SetAmount(std::min(protEff->GetAmount() + absorb, 20000)); @@ -474,7 +471,7 @@ class spell_item_blessing_of_ancient_kings : public AuraScript { CastSpellExtraArgs args(aurEff); args.AddSpellBP0(absorb); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PROTECTION_OF_ANCIENT_KINGS, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PROTECTION_OF_ANCIENT_KINGS, args); } } @@ -1596,19 +1593,20 @@ class spell_item_necrotic_touch : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + if (!eventInfo.GetActionTarget()->IsAlive()) + return false; + + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(damageInfo->GetDamage(), aurEff->GetAmount())); - GetTarget()->CastSpell(nullptr, SPELL_ITEM_NECROTIC_TOUCH_PROC, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_ITEM_NECROTIC_TOUCH_PROC, args); } void Register() override @@ -1751,7 +1749,7 @@ class spell_item_persistent_shield : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); int32 bp0 = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15); // Scarab Brooch does not replace stronger shields @@ -2235,22 +2233,21 @@ class spell_item_shadowmourne : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - if (GetTarget()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) // cant collect shards while under effect of Chaos Bane buff - return false; - return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + // cant collect shards while under effect of Chaos Bane buff + return !eventInfo.GetActor()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF) && eventInfo.GetActionTarget()->IsAlive(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, aurEff); // this can't be handled in AuraScript of SoulFragments because we need to know victim if (Aura* soulFragments = GetTarget()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) { if (soulFragments->GetStackAmount() >= 10) { - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, aurEff); soulFragments->Remove(); } } @@ -3439,7 +3436,7 @@ class spell_item_shard_of_the_scale : public SpellScriptLoader { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) caster->CastSpell(target, HealProc, aurEff); @@ -3563,16 +3560,14 @@ class spell_item_sunwell_neck : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - if (eventInfo.GetActor()->GetTypeId() != TYPEID_PLAYER) - return false; - return true; + return eventInfo.GetActor()->GetTypeId() == TYPEID_PLAYER; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Player* player = eventInfo.GetActor()->ToPlayer(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); // Aggression checks are in the spell system... just cast and forget if (player->GetReputationRank(FACTION_ALDOR) == REP_EXALTED) diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 545dc8d08d..3e75600ac9 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -393,7 +393,7 @@ class spell_mage_imp_blizzard : public AuraScript { PreventDefaultAction(); uint32 triggerSpellId = sSpellMgr->GetSpellWithRank(SPELL_MAGE_CHILLED, GetSpellInfo()->GetRank()); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), triggerSpellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), triggerSpellId, aurEff); } void Register() override @@ -627,7 +627,7 @@ class spell_mage_gen_extra_effects : public AuraScript { Unit* caster = eventInfo.GetActor(); // Prevent double proc for Arcane missiles - if (caster == eventInfo.GetProcTarget()) + if (caster == eventInfo.GetActionTarget()) return false; // Proc chance is unknown, we'll just use dummy aura amount @@ -661,7 +661,7 @@ class spell_mage_glyph_of_polymorph : public AuraScript void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed. target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH); @@ -841,7 +841,8 @@ class spell_mage_ignite : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetDamageInfo() && eventInfo.GetProcTarget(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -856,7 +857,7 @@ class spell_mage_ignite : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_MAGE_IGNITE, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_MAGE_IGNITE, args); } void Register() override @@ -1061,7 +1062,7 @@ class spell_mage_missile_barrage_proc : public AuraScript { Unit* caster = eventInfo.GetActor(); // Prevent double proc for Arcane missiles - if (caster == eventInfo.GetProcTarget()) + if (caster == eventInfo.GetActionTarget()) return false; // Proc chance is unknown, we'll just use dummy aura amount diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 5f7f1303ca..d4ca85d086 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -431,17 +431,20 @@ class spell_pal_divine_purpose : public AuraScript { PrepareAuraScript(spell_pal_divine_purpose); - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { - PreventDefaultAction(); - if (!roll_chance_i(aurEff->GetAmount())) - return; + return roll_chance_i(aurEff->GetAmount()); + } - eventInfo.GetProcTarget()->RemoveAurasWithMechanic(1 << MECHANIC_STUN, AURA_REMOVE_BY_ENEMY_SPELL); + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + eventInfo.GetActionTarget()->RemoveAurasWithMechanic(1 << MECHANIC_STUN, AURA_REMOVE_BY_ENEMY_SPELL); } void Register() override { + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pal_divine_purpose::CheckProc, EFFECT_2, SPELL_AURA_DUMMY); OnEffectProc += AuraEffectProcFn(spell_pal_divine_purpose::HandleProc, EFFECT_2, SPELL_AURA_DUMMY); } }; @@ -599,22 +602,26 @@ class spell_pal_eye_for_an_eye : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; // return damage % to attacker but < 50% own total health - int32 damage = std::min(CalculatePct(static_cast(damageInfo->GetDamage()), aurEff->GetAmount()), static_cast(GetTarget()->GetMaxHealth()) / 2); + int32 damage = std::min(CalculatePct(static_cast(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()), static_cast(eventInfo.GetActionTarget()->GetMaxHealth()) / 2); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(damage); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE, args); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_eye_for_an_eye::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_eye_for_an_eye::OnProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -637,7 +644,7 @@ class spell_pal_glyph_of_divinity : public AuraScript return; Unit* caster = eventInfo.GetActor(); - if (caster == eventInfo.GetProcTarget()) + if (caster == eventInfo.GetActionTarget()) return; CastSpellExtraArgs args(aurEff); @@ -684,12 +691,17 @@ class spell_pal_glyph_of_holy_light_dummy : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); + HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; uint32 basePoints = healInfo->GetSpellInfo()->GetEffect(EFFECT_0).BasePoints + healInfo->GetSpellInfo()->GetEffect(EFFECT_0).DieSides; uint32 healAmount; @@ -700,11 +712,12 @@ class spell_pal_glyph_of_holy_light_dummy : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(CalculatePct(healAmount, aurEff->GetAmount())); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_glyph_of_holy_light_dummy::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_glyph_of_holy_light_dummy::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -803,7 +816,7 @@ class spell_pal_heart_of_the_crusader : public AuraScript PreventDefaultAction(); uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1, GetSpellInfo()->GetRank()); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -1140,39 +1153,47 @@ class spell_pal_item_t6_trinket : public AuraScript }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); if (!spellInfo) - return; - - uint32 spellId; - int32 chance; + return false; // Holy Light & Flash of Light if (spellInfo->SpellFamilyFlags[0] & 0xC0000000) { - spellId = SPELL_PALADIN_ENDURING_LIGHT; - chance = 15; + if (!roll_chance_i(15)) + return false; + + _triggeredSpellId = SPELL_PALADIN_ENDURING_LIGHT; + return true; } // Judgements else if (spellInfo->SpellFamilyFlags[0] & 0x00800000) { - spellId = SPELL_PALADIN_ENDURING_JUDGEMENT; - chance = 50; + if (!roll_chance_i(50)) + return false; + + _triggeredSpellId = SPELL_PALADIN_ENDURING_JUDGEMENT; + return true; } - else - return; - if (roll_chance_i(chance)) - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + return false; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), _triggeredSpellId, aurEff); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_item_t6_trinket::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_item_t6_trinket::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } + + uint32 _triggeredSpellId = 0; }; // 53407 - Judgement of Justice @@ -1256,7 +1277,7 @@ class spell_pal_judgement_of_light_heal : public AuraScript { PreventDefaultAction(); - Unit* caster = eventInfo.GetProcTarget(); + Unit* caster = eventInfo.GetActor(); CastSpellExtraArgs args(aurEff); args.OriginalCaster = GetCasterGUID(); @@ -1282,7 +1303,7 @@ class spell_pal_judgement_of_wisdom_mana : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget()->GetPowerType() == POWER_MANA; + return eventInfo.GetActor()->GetPowerType() == POWER_MANA; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -1291,7 +1312,7 @@ class spell_pal_judgement_of_wisdom_mana : public AuraScript SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA); - Unit* caster = eventInfo.GetProcTarget(); + Unit* caster = eventInfo.GetActor(); int32 const amount = CalculatePct(static_cast(caster->GetCreateMana()), spellInfo->GetEffect(EFFECT_0).CalcValue()); CastSpellExtraArgs args(aurEff); args.OriginalCaster = GetCasterGUID(); @@ -1517,19 +1538,21 @@ class spell_pal_righteous_vengeance : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE); - int32 amount = CalculatePct(static_cast(damageInfo->GetDamage()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); @@ -1541,6 +1564,7 @@ class spell_pal_righteous_vengeance : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_righteous_vengeance::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_righteous_vengeance::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1637,16 +1661,11 @@ class spell_pal_seal_of_righteousness : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS }); } - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetProcTarget() != nullptr; - } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* victim = eventInfo.GetProcTarget(); + Unit* victim = eventInfo.GetActionTarget(); float ap = GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK); ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS); @@ -1660,12 +1679,11 @@ class spell_pal_seal_of_righteousness : public AuraScript int32 bp = std::lroundf(mws * (0.022f * ap + 0.044f * sph)); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp); - GetTarget()->CastSpell(victim, SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args); + eventInfo.GetActor()->CastSpell(victim, SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args); } void Register() override { - DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_righteousness::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_righteousness::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1722,7 +1740,7 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader } // don't cast triggered, spell already has SPELL_ATTR4_CAN_CAST_WHILE_CASTING attr - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), DoTSpell, CastSpellExtraArgs(TRIGGERED_DONT_RESET_PERIODIC_TIMER).SetTriggeringAura(aurEff)); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), DoTSpell, CastSpellExtraArgs(TRIGGERED_DONT_RESET_PERIODIC_TIMER).SetTriggeringAura(aurEff)); } void HandleSeal(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -1730,7 +1748,7 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); // get current aura on target, if any AuraEffect const* sealDot = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PALADIN, 0x00000000, 0x00000800, 0x00000000, caster->GetGUID()); @@ -1804,7 +1822,7 @@ class spell_pal_spiritual_attunement : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { // "when healed by other friendly targets' spells" - if (eventInfo.GetProcTarget() == eventInfo.GetActionTarget()) + if (eventInfo.GetActor() == eventInfo.GetActionTarget()) return false; return eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetEffectiveHeal(); @@ -1838,19 +1856,21 @@ class spell_pal_sheath_of_light : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetEffectiveHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetEffectiveHeal()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL); - int32 amount = CalculatePct(static_cast(healInfo->GetEffectiveHeal()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast(eventInfo.GetHealInfo()->GetEffectiveHeal()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); @@ -1862,6 +1882,7 @@ class spell_pal_sheath_of_light : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_sheath_of_light::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_sheath_of_light::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); } }; @@ -1888,7 +1909,7 @@ class spell_pal_t3_6p_bonus : public AuraScript uint32 spellId; Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); switch (target->GetClass()) { @@ -1932,19 +1953,21 @@ class spell_pal_t8_2p_bonus : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_HOLY_MENDING }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_MENDING); - int32 amount = CalculatePct(static_cast(healInfo->GetHeal()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); @@ -1956,6 +1979,7 @@ class spell_pal_t8_2p_bonus : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_t8_2p_bonus::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_t8_2p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index ba55c1cbc7..781bbe1cda 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -154,24 +154,27 @@ class spell_pri_aq_3p_bonus : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_ORACULAR_HEAL }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - if (caster == eventInfo.GetProcTarget()) - return; + if (eventInfo.GetActor() == eventInfo.GetActionTarget()) + return false; HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + return healInfo && healInfo->GetHeal(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), 10)); - caster->CastSpell(caster, SPELL_PRIEST_ORACULAR_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 10)); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_PRIEST_ORACULAR_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_aq_3p_bonus::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_aq_3p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -227,37 +230,35 @@ class spell_pri_body_and_soul : public AuraScript }); } - void HandleProcTriggerSpell(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + bool CheckProcTriggerSpell(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { // Proc only on Power Word: Shield SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo || !(spellInfo->SpellFamilyFlags[0] & 0x00000001)) - { - PreventDefaultAction(); - return; - } + return spellInfo && (spellInfo->SpellFamilyFlags[0] & 0x00000001) != 0; } - void HandleProcDummy(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProcDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { - PreventDefaultAction(); - // Proc only on self casted abolish disease + if (eventInfo.GetActor() != eventInfo.GetActionTarget()) + return false; + SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo) - return; + return spellInfo && spellInfo->Id == SPELL_PRIEST_ABOLISH_DISEASE; + } - Unit* caster = eventInfo.GetActor(); - if (spellInfo->Id != SPELL_PRIEST_ABOLISH_DISEASE || caster != eventInfo.GetProcTarget()) - return; + void HandleProcDummy(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); if (roll_chance_i(aurEff->GetAmount())) - caster->CastSpell(caster, SPELL_PRIEST_BODY_AND_SOUL_POISON_TRIGGER, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_PRIEST_BODY_AND_SOUL_POISON_TRIGGER, aurEff); } void Register() override { - OnEffectProc += AuraEffectProcFn(spell_pri_body_and_soul::HandleProcTriggerSpell, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pri_body_and_soul::CheckProcTriggerSpell, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pri_body_and_soul::CheckProcDummy, EFFECT_1, SPELL_AURA_DUMMY); OnEffectProc += AuraEffectProcFn(spell_pri_body_and_soul::HandleProcDummy, EFFECT_1, SPELL_AURA_DUMMY); } }; @@ -303,28 +304,25 @@ class spell_pri_divine_aegis : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget() != nullptr; + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - - int32 absorb = CalculatePct(healInfo->GetHeal(), aurEff->GetAmount()); + int32 absorb = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount()); // Multiple effects stack, so let's try to find this aura. - if (AuraEffect const* aegis = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PRIEST_DIVINE_AEGIS, EFFECT_0)) + if (AuraEffect const* aegis = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_PRIEST_DIVINE_AEGIS, EFFECT_0)) absorb += aegis->GetAmount(); - absorb = std::min(absorb, eventInfo.GetProcTarget()->GetLevel() * 125); + absorb = std::min(absorb, eventInfo.GetActionTarget()->GetLevel() * 125); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(absorb); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_DIVINE_AEGIS, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PRIEST_DIVINE_AEGIS, args); } void Register() override @@ -368,15 +366,18 @@ class spell_pri_glyph_of_dispel_magic : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC_HEAL }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); // Dispel Magic shares spellfamilyflag with abolish disease SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo || spellInfo->SpellIconID != 74) - return; + return spellInfo && spellInfo->SpellIconID == 74; + } - Unit* target = eventInfo.GetProcTarget(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(target->CountPctFromMaxHealth(aurEff->GetAmount())); @@ -385,6 +386,7 @@ class spell_pri_glyph_of_dispel_magic : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_glyph_of_dispel_magic::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_glyph_of_dispel_magic::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -399,24 +401,27 @@ class spell_pri_glyph_of_prayer_of_healing : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - SpellInfo const* triggeredSpellInfo = sSpellMgr->AssertSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL); ASSERT(triggeredSpellInfo->GetMaxTicks() > 0); CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks()); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks()); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_glyph_of_prayer_of_healing::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_glyph_of_prayer_of_healing::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1193,7 +1198,7 @@ class spell_pri_t3_4p_bonus : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_ARMOR_OF_FAITH, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PRIEST_ARMOR_OF_FAITH, aurEff); } void Register() override @@ -1246,22 +1251,24 @@ class spell_pri_t10_heal_2p_bonus : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_BLESSED_HEALING }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PRIEST_BLESSED_HEALING); - int32 amount = CalculatePct(static_cast(healInfo->GetHeal()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1270,6 +1277,7 @@ class spell_pri_t10_heal_2p_bonus : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_t10_heal_2p_bonus::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_t10_heal_2p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 9a60d1816f..b0b6f4681f 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -71,7 +71,7 @@ class spell_rog_blade_flurry : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetProcTarget()); + _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetActionTarget()); return _procTarget != nullptr; } @@ -186,7 +186,7 @@ class spell_rog_deadly_brew : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_ROGUE_CRIPPLING_POISON, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_ROGUE_CRIPPLING_POISON, aurEff); } void Register() override @@ -637,7 +637,7 @@ class spell_rog_glyph_of_backstab : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_ROGUE_GLYPH_OF_BACKSTAB_TRIGGER, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_ROGUE_GLYPH_OF_BACKSTAB_TRIGGER, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 74bed44d1d..16af2ab74b 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -483,7 +483,7 @@ class spell_sha_earthliving_weapon : public AuraScript int32 chance = 20; Unit* caster = eventInfo.GetActor(); if (AuraEffect const* aurEff = caster->GetAuraEffectOfRankedSpell(SPELL_SHAMAN_BLESSING_OF_THE_ETERNALS_R1, EFFECT_1, caster->GetGUID())) - if (eventInfo.GetProcTarget()->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) + if (eventInfo.GetActionTarget()->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) chance += aurEff->GetAmount(); return roll_chance_i(chance); @@ -614,7 +614,7 @@ class spell_sha_flametongue_weapon : public AuraScript PreventDefaultAction(); Player* player = eventInfo.GetActor()->ToPlayer(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); WeaponAttackType attType = BASE_ATTACK; if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_OFFHAND_ATTACK) attType = OFF_ATTACK; @@ -678,7 +678,7 @@ class spell_sha_frozen_power : public AuraScript SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_FREEZE); float minDistance(spellInfo->GetEffect(EFFECT_0).CalcValue(caster)); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); if (caster->GetDistance(target) < minDistance) return; @@ -704,7 +704,7 @@ class spell_sha_glyph_of_earth_shield : public AuraScript if (!earthShield) return; - AuraEffect* earthShieldEffect = eventInfo.GetProcTarget()->GetAuraEffect(earthShield->Id, EFFECT_0, eventInfo.GetActor()->GetGUID()); + AuraEffect* earthShieldEffect = eventInfo.GetActionTarget()->GetAuraEffect(earthShield->Id, EFFECT_0, eventInfo.GetActor()->GetGUID()); if (!earthShieldEffect) return; @@ -729,24 +729,27 @@ class spell_sha_glyph_of_healing_wave : public AuraScript return ValidateSpellInfo({ SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - if (caster == eventInfo.GetProcTarget()) - return; + if (eventInfo.GetActor() == eventInfo.GetActionTarget()) + return false; HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + return healInfo && healInfo->GetHeal(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount())); - caster->CastSpell(nullptr, SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(nullptr, SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_sha_glyph_of_healing_wave::CheckProc); OnEffectProc += AuraEffectProcFn(spell_sha_glyph_of_healing_wave::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -963,7 +966,7 @@ class spell_sha_lightning_overload : public AuraScript spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1, spellInfo->GetRank()); } - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -985,7 +988,7 @@ class spell_sha_item_lightning_shield : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD, aurEff); } void Register() override @@ -1516,7 +1519,7 @@ class spell_sha_static_shock : public AuraScript return; uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1, lightningShield->GetSpellInfo()->GetRank()); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); lightningShield->GetBase()->DropCharge(); } @@ -1615,7 +1618,7 @@ class spell_sha_t3_6p_bonus : public AuraScript uint32 spellId; Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); switch (target->GetClass()) { @@ -1694,7 +1697,7 @@ class spell_sha_t8_elemental_4p_bonus : public AuraScript amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1732,7 +1735,7 @@ class spell_sha_t9_elemental_4p_bonus : public AuraScript amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1755,7 +1758,7 @@ class spell_sha_t10_elemental_4p_bonus : public AuraScript PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); // try to find spell Flame Shock on the target AuraEffect* flameShock = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x00000000, 0x00000000, caster->GetGUID()); @@ -1804,7 +1807,7 @@ class spell_sha_t10_restoration_4p_bonus : public AuraScript amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1895,7 +1898,7 @@ class spell_sha_windfury_weapon : public AuraScript args.AddSpellBP0(amount); // Attack twice for (uint8 i = 0; i < 2; ++i) - player->CastSpell(eventInfo.GetProcTarget(), spellId, args); + player->CastSpell(eventInfo.GetActionTarget(), spellId, args); } void Register() override diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index e1de6fd68d..bac0337f9c 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -449,13 +449,9 @@ class spell_warl_drain_soul : public AuraScript // Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling. // Make sure that dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive. - Unit* caster = GetCaster(); - Unit* victim = eventInfo.GetProcTarget(); - - if (caster && victim) - return victim->GetAuraApplicationOfRankedSpell(SPELL_WARLOCK_DRAIN_SOUL_R1, caster->GetGUID()) != 0; - - return false; + Unit* caster = eventInfo.GetActor(); + Unit* victim = eventInfo.GetActionTarget(); + return victim->GetAuraApplicationOfRankedSpell(SPELL_WARLOCK_DRAIN_SOUL_R1, caster->GetGUID()) != 0; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -621,7 +617,7 @@ class spell_warl_glyph_of_shadowflame : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 1ea3ca5206..d9b4014a7a 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -196,10 +196,10 @@ class spell_warr_damage_shield : public AuraScript PreventDefaultAction(); // % of amount blocked - int32 damage = CalculatePct(int32(GetTarget()->GetShieldBlockValue()), aurEff->GetAmount()); + int32 damage = CalculatePct(int32(eventInfo.GetActionTarget()->GetShieldBlockValue()), aurEff->GetAmount()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(damage); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE, args); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE, args); } void Register() override @@ -282,7 +282,7 @@ class spell_warr_deep_wounds_aura : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(damage); - actor->CastSpell(eventInfo.GetProcTarget(), GetEffectInfo(EFFECT_0).TriggerSpell, args); + actor->CastSpell(eventInfo.GetActionTarget(), GetEffectInfo(EFFECT_0).TriggerSpell, args); } void Register() override @@ -622,13 +622,13 @@ class spell_warr_retaliation : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { // check attack comes not from behind and warrior is not stunned - return GetTarget()->isInFront(eventInfo.GetActor(), float(M_PI)) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED); + return eventInfo.GetActionTarget()->isInFront(eventInfo.GetActor(), float(M_PI)) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED); } void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_RETALIATION_DAMAGE, aurEff); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_WARRIOR_RETALIATION_DAMAGE, aurEff); } void Register() override @@ -735,7 +735,7 @@ class spell_warr_sweeping_strikes : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetProcTarget()); + _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetActionTarget()); return _procTarget != nullptr; } From b32ff0c8b6042873628f2a217def90f8422f41a2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 18 Feb 2025 16:51:32 +0100 Subject: [PATCH 04/14] Scripts/Spells: Fix wrong proc target for spell 23552 Closes #30697 --- src/server/scripts/Spells/spell_shaman.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 16af2ab74b..e7ec0cd9c5 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -1007,10 +1007,10 @@ class spell_sha_item_lightning_shield_trigger : public AuraScript return ValidateSpellInfo({ SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE, aurEff); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE, aurEff); } void Register() override From b4168ee83355f36c46a9b592710b685695999121 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 19 Feb 2025 19:32:55 +0100 Subject: [PATCH 05/14] Core/Spells: Reduce differences between branches (port refactors from c0602889b57b3a6ab07a7d8ba9b4b91a560f086e) --- src/server/game/Entities/Creature/Trainer.cpp | 4 +- src/server/game/Entities/Player/Player.cpp | 4 +- src/server/game/Entities/Unit/Unit.cpp | 19 +-- src/server/game/Entities/Unit/Unit.h | 4 +- src/server/game/Guilds/Guild.h | 1 + .../game/Server/Packets/SpellPackets.cpp | 114 ++++++++++------- src/server/game/Server/Packets/SpellPackets.h | 117 ++++++++++-------- src/server/game/Spells/Spell.cpp | 11 +- .../Outland/BlackTemple/boss_illidan.cpp | 2 +- 9 files changed, 156 insertions(+), 120 deletions(-) diff --git a/src/server/game/Entities/Creature/Trainer.cpp b/src/server/game/Entities/Creature/Trainer.cpp index 2967999317..e28b86efce 100644 --- a/src/server/game/Entities/Creature/Trainer.cpp +++ b/src/server/game/Entities/Creature/Trainer.cpp @@ -105,8 +105,8 @@ namespace Trainer player->ModifyMoney(-moneyCost); - npc->SendPlaySpellVisual(179); - npc->SendPlaySpellImpact(player->GetGUID(), 362); + npc->SendPlaySpellVisualKit(179, 0); // 53 SpellCastDirected + player->SendPlaySpellVisualKit(362, 1); // 113 EmoteSalute // learn explicitly or cast explicitly if (trainerSpell->IsCastable()) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 497c803a8b..9c928b5fb7 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2016,12 +2016,12 @@ void Player::RegenerateAll() // Food emote comes above drinking emote if we have to decide (mage regen food for example) if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) { - SendPlaySpellVisual(SPELL_VISUAL_KIT_FOOD); + SendPlaySpellVisualKit(SPELL_VISUAL_KIT_FOOD, 0); break; } else if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_POWER_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) { - SendPlaySpellVisual(SPELL_VISUAL_KIT_DRINK); + SendPlaySpellVisualKit(SPELL_VISUAL_KIT_DRINK, 0); break; } } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index af4fcb052d..f5abdb65ce 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -70,6 +70,7 @@ #include "SpellInfo.h" #include "SpellHistory.h" #include "SpellMgr.h" +#include "SpellPackets.h" #include "StringConvert.h" #include "TemporarySummon.h" #include "Transport.h" @@ -12048,20 +12049,12 @@ void Unit::SetAuraStack(uint32 spellId, Unit* target, uint32 stack) aura->SetStackAmount(stack); } -void Unit::SendPlaySpellVisual(uint32 id) const +void Unit::SendPlaySpellVisualKit(uint32 id, uint32 type) const { - WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); - data << uint64(GetGUID()); - data << uint32(id); // SpellVisualKit.dbc index - SendMessageToSet(&data, true); -} - -void Unit::SendPlaySpellImpact(ObjectGuid guid, uint32 id) const -{ - WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); - data << uint64(guid); // target - data << uint32(id); // SpellVisualKit.dbc index - SendMessageToSet(&data, false); + WorldPackets::Spells::PlaySpellVisualKit playSpellVisualKit(type); + playSpellVisualKit.Unit = GetGUID(); + playSpellVisualKit.KitRecID = id; + SendMessageToSet(playSpellVisualKit.Write(), true); } bool Unit::CanApplyResilience() const diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 8bd1618ada..8f5ce6448a 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1182,8 +1182,8 @@ class TC_GAME_API Unit : public WorldObject Aura* AddAura(uint32 spellId, Unit* target); Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target); void SetAuraStack(uint32 spellId, Unit* target, uint32 stack); - void SendPlaySpellVisual(uint32 id) const; - void SendPlaySpellImpact(ObjectGuid guid, uint32 id) const; + + void SendPlaySpellVisualKit(uint32 id, uint32 type) const; void DeMorph(); diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index e42d62bab8..26ca49d3b4 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -717,6 +717,7 @@ class TC_GAME_API Guild bool DeleteMember(CharacterDatabaseTransaction trans, ObjectGuid guid, bool isDisbanding = false, bool isKicked = false); bool ChangeMemberRank(CharacterDatabaseTransaction trans, ObjectGuid guid, uint8 newRank); bool IsMember(ObjectGuid guid) const; + uint32 GetMembersCount() const { return uint32(m_members.size()); } uint64 GetMemberAvailableMoneyForRepairItems(ObjectGuid guid) const; // Bank diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp index fa74294b13..37d38d1da6 100644 --- a/src/server/game/Server/Packets/SpellPackets.cpp +++ b/src/server/game/Server/Packets/SpellPackets.cpp @@ -19,46 +19,34 @@ #include "SharedDefines.h" #include "Spell.h" #include "SpellInfo.h" +#include -void WorldPackets::Spells::CancelCast::Read() +namespace WorldPackets::Spells { - _worldPacket >> CastID; - _worldPacket >> SpellID; -} - -void WorldPackets::Spells::CancelAura::Read() -{ - _worldPacket >> SpellID; -} - -void WorldPackets::Spells::PetCancelAura::Read() +void CancelAura::Read() { - _worldPacket >> PetGUID; _worldPacket >> SpellID; } -void WorldPackets::Spells::CancelChannelling::Read() +void CancelChannelling::Read() { _worldPacket >> ChannelSpell; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellMissStatus const& spellMissStatus) +void PetCancelAura::Read() { - data << uint64(spellMissStatus.TargetGUID); - data << uint8(spellMissStatus.Reason); - if (spellMissStatus.Reason == SPELL_MISS_REFLECT) - data << uint8(spellMissStatus.ReflectStatus); - return data; + _worldPacket >> PetGUID; + _worldPacket >> SpellID; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::TargetLocation const& targetLocation) +ByteBuffer& operator<<(ByteBuffer& data, TargetLocation const& targetLocation) { data << targetLocation.Transport.WriteAsPacked(); // relative position guid here - transport for example data << targetLocation.Location.PositionXYZStream(); return data; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData const& spellTargetData) +ByteBuffer& operator<<(ByteBuffer& data, SpellTargetData const& spellTargetData) { data << uint32(spellTargetData.Flags); @@ -76,40 +64,52 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellTargetData c if (spellTargetData.Name) data << *spellTargetData.Name; + + return data; +} + +ByteBuffer& operator<<(ByteBuffer& data, SpellMissStatus const& spellMissStatus) +{ + data << uint64(spellMissStatus.TargetGUID); + data << uint8(spellMissStatus.Reason); + if (spellMissStatus.Reason == SPELL_MISS_REFLECT) + data << uint8(spellMissStatus.ReflectStatus); + return data; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::RuneData const& runeData) +ByteBuffer& operator<<(ByteBuffer& data, RuneData const& runeData) { data << uint8(runeData.Start); data << uint8(runeData.Count); for (uint8 cooldown : runeData.Cooldowns) data << uint8(cooldown); + return data; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::MissileTrajectoryResult const& traj) +ByteBuffer& operator<<(ByteBuffer& data, MissileTrajectoryResult const& traj) { data << float(traj.Pitch); data << uint32(traj.TravelTime); return data; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellAmmo const& spellAmmo) +ByteBuffer& operator<<(ByteBuffer& data, SpellAmmo const& spellAmmo) { data << uint32(spellAmmo.DisplayID); data << uint32(spellAmmo.InventoryType); return data; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::CreatureImmunities const& immunities) +ByteBuffer& operator<<(ByteBuffer& data, CreatureImmunities const& immunities) { data << uint32(immunities.School); data << uint32(immunities.Value); return data; } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData const& spellCastData) +ByteBuffer& operator<<(ByteBuffer& data, SpellCastData const& spellCastData) { data << spellCastData.CasterGUID.WriteAsPacked(); data << spellCastData.CasterUnit.WriteAsPacked(); @@ -125,19 +125,16 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con // Spells like 40647 (with a huge radius) can easily reach this limit (spell might need // target conditions but we still need to limit the number of targets sent and keeping // correct count for both hit and miss). - static std::size_t const PACKET_TARGET_LIMIT = std::numeric_limits::max(); - if (spellCastData.HitTargets->size() > PACKET_TARGET_LIMIT) - spellCastData.HitTargets->resize(PACKET_TARGET_LIMIT); - - data << uint8(spellCastData.HitTargets->size()); - for (ObjectGuid const& target : *spellCastData.HitTargets) - data << uint64(target); + static constexpr std::size_t PACKET_TARGET_LIMIT = std::numeric_limits::max(); - if (spellCastData.MissStatus->size() > PACKET_TARGET_LIMIT) - spellCastData.MissStatus->resize(PACKET_TARGET_LIMIT); + std::span hitTargets(spellCastData.HitTargets->data(), std::min(spellCastData.HitTargets->size(), PACKET_TARGET_LIMIT)); + data << uint8(hitTargets.size()); + for (ObjectGuid const& target : hitTargets) + data << target; - data << uint8(spellCastData.MissStatus->size()); - for (WorldPackets::Spells::SpellMissStatus const& status : *spellCastData.MissStatus) + std::span missTargets(spellCastData.MissStatus->data(), std::min(spellCastData.MissStatus->size(), PACKET_TARGET_LIMIT)); + data << uint8(missTargets.size()); + for (SpellMissStatus const& status : missTargets) data << status; } @@ -164,37 +161,66 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con data << uint32(0); } - if (spellCastData.Target.Flags & TARGET_FLAG_DEST_LOCATION) - data << uint8(0); + if (spellCastData.DestLocSpellCastIndex) + data << uint8(*spellCastData.DestLocSpellCastIndex); + + if (spellCastData.TargetPoints) + { + data << int32(spellCastData.TargetPoints->size()); + for (TargetLocation const& targetPoint : *spellCastData.TargetPoints) + { + data << targetPoint.Location.PositionXYZStream(); + data << targetPoint.Transport; + } + } + return data; } -WorldPacket const* WorldPackets::Spells::SpellGo::Write() +WorldPacket const* SpellStart::Write() { _worldPacket << Cast; + return &_worldPacket; } -WorldPacket const* WorldPackets::Spells::SpellStart::Write() +WorldPacket const* SpellGo::Write() { _worldPacket << Cast; + return &_worldPacket; } -WorldPacket const* WorldPackets::Spells::ResyncRunes::Write() +WorldPacket const* PlaySpellVisualKit::Write() +{ + _worldPacket << Unit; + _worldPacket << int32(KitRecID); + + return &_worldPacket; +} + +void CancelCast::Read() +{ + _worldPacket >> CastID; + _worldPacket >> SpellID; +} + +WorldPacket const* ResyncRunes::Write() { _worldPacket << Count; - for (WorldPackets::Spells::ResyncRune const& rune : Runes) + for (ResyncRune const& rune : Runes) { _worldPacket << rune.RuneType; _worldPacket << rune.Cooldown; } + return &_worldPacket; } -WorldPacket const* WorldPackets::Spells::MountResult::Write() +WorldPacket const* MountResult::Write() { _worldPacket << int32(Result); return &_worldPacket; } +} diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h index 764187a4b1..f714d12f98 100644 --- a/src/server/game/Server/Packets/SpellPackets.h +++ b/src/server/game/Server/Packets/SpellPackets.h @@ -28,36 +28,32 @@ namespace WorldPackets { namespace Spells { - class CancelCast final : public ClientPacket + class CancelAura final : public ClientPacket { public: - CancelCast(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_CAST, std::move(packet)) { } + CancelAura(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_AURA, std::move(packet)) { } void Read() override; - uint8 CastID = 0; uint32 SpellID = 0; }; - class CancelAura final : public ClientPacket + class CancelAutoRepeatSpell final : public ClientPacket { public: - CancelAura(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_AURA, std::move(packet)) { } - - void Read() override; + CancelAutoRepeatSpell(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_AUTO_REPEAT_SPELL, std::move(packet)) { } - uint32 SpellID = 0; + void Read() override { } }; - class PetCancelAura final : public ClientPacket + class CancelChannelling final : public ClientPacket { public: - PetCancelAura(WorldPacket&& packet) : ClientPacket(CMSG_PET_CANCEL_AURA, std::move(packet)) { } + CancelChannelling(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_CHANNELLING, std::move(packet)) { } void Read() override; - ObjectGuid PetGUID; - uint32 SpellID = 0; + uint32 ChannelSpell = 0; }; class CancelGrowthAura final : public ClientPacket @@ -76,22 +72,31 @@ namespace WorldPackets void Read() override { } }; - class CancelAutoRepeatSpell final : public ClientPacket + class PetCancelAura final : public ClientPacket { public: - CancelAutoRepeatSpell(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_AUTO_REPEAT_SPELL, std::move(packet)) { } + PetCancelAura(WorldPacket&& packet) : ClientPacket(CMSG_PET_CANCEL_AURA, std::move(packet)) { } - void Read() override { } + void Read() override; + + ObjectGuid PetGUID; + uint32 SpellID = 0; }; - class CancelChannelling final : public ClientPacket + struct TargetLocation { - public: - CancelChannelling(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_CHANNELLING, std::move(packet)) { } - - void Read() override; + ObjectGuid Transport; + Position Location; + }; - uint32 ChannelSpell = 0; + struct SpellTargetData + { + uint32 Flags = 0; + Optional Unit; + Optional Item; + Optional SrcLocation; + Optional DstLocation; + Optional Name; }; struct SpellMissStatus @@ -126,22 +131,6 @@ namespace WorldPackets uint32 Value = 0; }; - struct TargetLocation - { - ObjectGuid Transport; - Position Location; - }; - - struct SpellTargetData - { - uint32 Flags = 0; - Optional Unit; - Optional Item; - Optional SrcLocation; - Optional DstLocation; - Optional Name; - }; - struct SpellCastData { ObjectGuid CasterGUID; @@ -150,38 +139,62 @@ namespace WorldPackets uint32 SpellID = 0; uint32 CastFlags = 0; uint32 CastTime = 0; - mutable Optional> HitTargets; - mutable Optional> MissStatus; + Optional> HitTargets; + Optional> MissStatus; SpellTargetData Target; Optional RemainingPower; Optional RemainingRunes; Optional MissileTrajectory; Optional Ammo; + Optional DestLocSpellCastIndex; + Optional> TargetPoints; Optional Immunities; }; + class SpellStart final : public ServerPacket + { + public: + SpellStart() : ServerPacket(SMSG_SPELL_START) { } + + WorldPacket const* Write() override; + + SpellCastData Cast; + }; + class SpellGo final : public ServerPacket { - public: - SpellGo() : ServerPacket(SMSG_SPELL_GO) - { - Cast.HitTargets.emplace(); - Cast.MissStatus.emplace(); - } + public: + SpellGo() : ServerPacket(SMSG_SPELL_GO) + { + Cast.HitTargets.emplace(); + Cast.MissStatus.emplace(); + } - WorldPacket const* Write() override; + WorldPacket const* Write() override; - SpellCastData Cast; + SpellCastData Cast; }; - class SpellStart final : public ServerPacket + class PlaySpellVisualKit final : public ServerPacket { - public: - SpellStart() : ServerPacket(SMSG_SPELL_START) { } + public: + PlaySpellVisualKit(int32 kitType) : ServerPacket(kitType ? SMSG_PLAY_SPELL_IMPACT : SMSG_PLAY_SPELL_VISUAL, 8 + 4) { } - WorldPacket const* Write() override; + WorldPacket const* Write() override; - SpellCastData Cast; + ObjectGuid Unit; + int32 KitRecID = 0; + }; + + class CancelCast final : public ClientPacket + { + public: + CancelCast(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_CAST, std::move(packet)) { } + + void Read() override; + + uint8 CastID = 0; + uint32 SpellID = 0; }; struct ResyncRune diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f1a9064611..60fb89a4bf 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4372,10 +4372,13 @@ void Spell::SendSpellGo() } if (castFlags & CAST_FLAG_AMMO) - { - castData.Ammo.emplace(); - UpdateSpellCastDataAmmo(*castData.Ammo); - } + UpdateSpellCastDataAmmo(castData.Ammo.emplace()); + + if (m_targets.GetTargetMask() & TARGET_FLAG_DEST_LOCATION) + castData.DestLocSpellCastIndex.emplace(); + + if (m_targets.GetTargetMask() & TARGET_FLAG_UNUSED20) + castData.TargetPoints.emplace(); // should be sent to self only if (castFlags & CAST_FLAG_POWER_LEFT_SELF && m_caster->IsPlayer()) diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 6081254590..1255bfc4db 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -2062,7 +2062,7 @@ class spell_illidan_return_glaives : public SpellScript void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - GetHitUnit()->SendPlaySpellVisual(SPELL_GLAIVE_VISUAL_KIT); + GetHitUnit()->SendPlaySpellVisualKit(SPELL_GLAIVE_VISUAL_KIT, 0); if (Creature* caster = GetCaster()->ToCreature()) caster->DespawnOrUnsummon(); } From 310e001d3f12fd3b50c23400e4d43319b2e3183f Mon Sep 17 00:00:00 2001 From: Aokromes Date: Thu, 20 Feb 2025 11:43:23 +0100 Subject: [PATCH 06/14] DB/Creature: Update Knot Thimblejack spawn coordinates closes #30700 by CraftedRO --- sql/updates/world/3.3.5/2025_02_20_00_world.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/3.3.5/2025_02_20_00_world.sql diff --git a/sql/updates/world/3.3.5/2025_02_20_00_world.sql b/sql/updates/world/3.3.5/2025_02_20_00_world.sql new file mode 100644 index 0000000000..bd05a2f637 --- /dev/null +++ b/sql/updates/world/3.3.5/2025_02_20_00_world.sql @@ -0,0 +1,2 @@ +-- Update Knot Thimblejack spawn coordinates +UPDATE `creature` SET `position_x`=581.0821533203125, `position_y`=523.2933349609375, `position_z`=-25.31939697265625, `orientation`=2.722713708877563476, `VerifiedBuild`=59207 WHERE `guid`=56804 AND `id`=14338; From 375b43ee9e4bcfa6174939972884fbfca42e9b37 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Thu, 20 Feb 2025 11:45:14 +0100 Subject: [PATCH 07/14] DB/Misc: Remove spawn of Isalien closes #30698 by Jildor --- sql/updates/world/3.3.5/2025_02_20_01_world.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/3.3.5/2025_02_20_01_world.sql diff --git a/sql/updates/world/3.3.5/2025_02_20_01_world.sql b/sql/updates/world/3.3.5/2025_02_20_01_world.sql new file mode 100644 index 0000000000..9670853d97 --- /dev/null +++ b/sql/updates/world/3.3.5/2025_02_20_01_world.sql @@ -0,0 +1,2 @@ +-- +DELETE FROM `creature` WHERE `id`=16097; From 48baec04dfd3b654c945df9b4fc2e8feadad760a Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 20 Feb 2025 13:51:31 +0100 Subject: [PATCH 08/14] Core/Players: Fixed wrong spell id of Seal of Righteousness being given to players who don't know Judgement of Light Closes #30642 --- .../world/3.3.5/2025_02_20_02_world.sql | 8 +++++ src/server/game/Entities/Player/Player.cpp | 27 ++--------------- src/server/game/Spells/SpellInfo.cpp | 30 +++++++++---------- src/server/game/Spells/SpellMgr.cpp | 4 +++ 4 files changed, 30 insertions(+), 39 deletions(-) create mode 100644 sql/updates/world/3.3.5/2025_02_20_02_world.sql diff --git a/sql/updates/world/3.3.5/2025_02_20_02_world.sql b/sql/updates/world/3.3.5/2025_02_20_02_world.sql new file mode 100644 index 0000000000..a11521bfab --- /dev/null +++ b/sql/updates/world/3.3.5/2025_02_20_02_world.sql @@ -0,0 +1,8 @@ +UPDATE `playercreateinfo_action` SET `action`=20154 WHERE `action`=21084; + +DELETE FROM `spell_ranks` WHERE `first_spell_id`=20154; +INSERT INTO `spell_ranks` (`first_spell_id`, `spell_id`, `rank`) VALUES +(20154,20154,1), +(20154,21084,2); + +UPDATE `trainer_spell` SET `SpellId`=10321 WHERE `SpellId`=20271; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 9c928b5fb7..13c52109fc 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23072,31 +23072,10 @@ void Player::LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue) if (skillValue < ability->MinSkillLineRank && ability->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE) RemoveSpell(ability->Spell); // need learn + else if (!IsInWorld()) + AddSpell(ability->Spell, true, true, true, false, false, ability->SkillLine); else - { - // used to avoid double Seal of Righteousness on paladins, it's the only player spell which has both spell and forward spell in auto learn - if (ability->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && ability->SupercededBySpell) - { - bool skipCurrent = false; - auto bounds = sSpellMgr->GetSkillLineAbilityMapBounds(ability->SupercededBySpell); - for (auto itr = bounds.first; itr != bounds.second; ++itr) - { - if (itr->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && skillValue >= itr->second->MinSkillLineRank) - { - skipCurrent = true; - break; - } - } - - if (skipCurrent) - continue; - } - - if (!IsInWorld()) - AddSpell(ability->Spell, true, true, true, false, false, ability->SkillLine); - else - LearnSpell(ability->Spell, true, ability->SkillLine); - } + LearnSpell(ability->Spell, true, ability->SkillLine); } } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 48ae954b08..80f7aa8e87 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1136,23 +1136,23 @@ bool SpellInfo::IsStackableWithRanks() const return false; // All stance spells. if any better way, change it. - for (SpellEffectInfo const& effect : GetEffects()) + switch (SpellFamilyName) { - switch (SpellFamilyName) - { - case SPELLFAMILY_PALADIN: - // Paladin aura Spell - if (effect.Effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID) - return false; - break; - case SPELLFAMILY_DRUID: - // Druid form Spell - if (effect.Effect == SPELL_EFFECT_APPLY_AURA && - effect.ApplyAuraName == SPELL_AURA_MOD_SHAPESHIFT) - return false; - break; - } + case SPELLFAMILY_PALADIN: + // Paladin aura Spell + if (HasEffect(SPELL_EFFECT_APPLY_AREA_AURA_RAID)) + return false; + // Seal of Righteousness + if (SpellFamilyFlags[1] & 0x20000000) + return false; + break; + case SPELLFAMILY_DRUID: + // Druid form Spell + if (HasAura(SPELL_AURA_MOD_SHAPESHIFT)) + return false; + break; } + return true; } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3dfd8dc16e..a31d6fcbaa 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1973,6 +1973,10 @@ void SpellMgr::LoadSkillLineAbilityMap() ++count; } + // Don't autolearn secondary variant of Seal of Righteousness - it is learned together with Judgement of Light + if (SkillLineAbilityEntry* sealOfRighteousnessR2 = const_cast(sSkillLineAbilityStore.LookupEntry(11957))) + sealOfRighteousnessR2->AcquireMethod = 0; + TC_LOG_INFO("server.loading", ">> Loaded {} SkillLineAbility MultiMap Data in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); } From caa058d496a2671bd96dbbe5e41ceab775f5639e Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 20 Feb 2025 14:01:11 +0100 Subject: [PATCH 09/14] Core/PacketIO: Implemented CMSG_CORPSE_MAP_POSITION_QUERY/SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE --- src/server/game/Handlers/QueryHandler.cpp | 51 ++++++++++--------- .../game/Server/Packets/QueryPackets.cpp | 28 ++++++++++ src/server/game/Server/Packets/QueryPackets.h | 43 ++++++++++++++++ src/server/game/Server/Protocol/Opcodes.cpp | 6 +-- src/server/game/Server/WorldSession.h | 6 ++- 5 files changed, 105 insertions(+), 29 deletions(-) diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index d1febe6baa..6e9db0a3c7 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -18,6 +18,7 @@ #include "WorldSession.h" #include "CharacterCache.h" #include "Common.h" +#include "Corpse.h" #include "DatabaseEnv.h" #include "DBCStores.h" #include "GameTime.h" @@ -28,6 +29,7 @@ #include "ObjectMgr.h" #include "Player.h" #include "QueryPackets.h" +#include "Transport.h" #include "UpdateMask.h" #include "World.h" @@ -141,13 +143,13 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObj } } -void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/) +void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLocationFromClient& /*queryCorpseLocation*/) { if (!_player->HasCorpse()) { - WorldPacket data(MSG_CORPSE_QUERY, 1); - data << uint8(0); // corpse not found - SendPacket(&data); + WorldPackets::Query::CorpseLocation packet; + packet.Valid = false; // corpse not found + SendPacket(packet.Write()); return; } @@ -178,15 +180,13 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/) } } - WorldPacket data(MSG_CORPSE_QUERY, 1+(6*4)); - data << uint8(1); // corpse found - data << int32(mapID); - data << float(x); - data << float(y); - data << float(z); - data << int32(corpseMapID); - data << uint32(0); // unknown - SendPacket(&data); + WorldPackets::Query::CorpseLocation packet; + packet.Valid = true; + packet.MapID = corpseMapID; + packet.ActualMapID = mapID; + packet.Position = Position(x, y, z); + packet.Transport = 0; // TODO: If corpse is on transport, send transport offsets and transport guid + SendPacket(packet.Write()); } void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData) @@ -314,19 +314,22 @@ void WorldSession::HandleQueryPageText(WorldPacket& recvData) } } -void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData) +void WorldSession::HandleQueryCorpseTransport(WorldPackets::Query::QueryCorpseTransport& queryCorpseTransport) { - TC_LOG_DEBUG("network", "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY"); - - uint32 unk; - recvData >> unk; + WorldPackets::Query::CorpseTransportQuery response; + if (Corpse const* corpse = _player->GetCorpse()) + { + if (Transport const* transport = corpse->GetTransport()) + { + if (transport->GetGUID().GetCounter() == queryCorpseTransport.Transport) + { + response.Position = transport->GetPosition(); + response.Facing = transport->GetOrientation(); + } + } + } - WorldPacket data(SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4+4+4+4); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - SendPacket(&data); + SendPacket(response.Write()); } void WorldSession::HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& query) diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp index c09a0da8e5..83ccc9399c 100644 --- a/src/server/game/Server/Packets/QueryPackets.cpp +++ b/src/server/game/Server/Packets/QueryPackets.cpp @@ -76,6 +76,34 @@ WorldPacket const* WorldPackets::Query::QueryGameObjectResponse::Write() return &_worldPacket; } +WorldPacket const* WorldPackets::Query::CorpseLocation::Write() +{ + _worldPacket << uint8(Valid); + + if (Valid) + { + _worldPacket << int32(MapID); + _worldPacket << Position; + _worldPacket << int32(ActualMapID); + _worldPacket << uint32(Transport); + } + + return &_worldPacket; +} + +void WorldPackets::Query::QueryCorpseTransport::Read() +{ + _worldPacket >> Transport; +} + +WorldPacket const* WorldPackets::Query::CorpseTransportQuery::Write() +{ + _worldPacket << Position; + _worldPacket << float(Facing); + + return &_worldPacket; +} + void WorldPackets::Query::QueryItemSingle::Read() { _worldPacket >> ItemID; diff --git a/src/server/game/Server/Packets/QueryPackets.h b/src/server/game/Server/Packets/QueryPackets.h index 333e2eb785..8c36c07afc 100644 --- a/src/server/game/Server/Packets/QueryPackets.h +++ b/src/server/game/Server/Packets/QueryPackets.h @@ -108,6 +108,49 @@ namespace WorldPackets GameObjectStats Stats; }; + class QueryCorpseLocationFromClient final : public ClientPacket + { + public: + QueryCorpseLocationFromClient(WorldPacket&& packet) : ClientPacket(MSG_CORPSE_QUERY, std::move(packet)) { } + + void Read() override { } + }; + + class CorpseLocation final : public ServerPacket + { + public: + CorpseLocation() : ServerPacket(MSG_CORPSE_QUERY, 1 + 4 + 4 + 4 + 4 + 4 + 4) { } + + WorldPacket const* Write() override; + + uint32 Transport = 0; + TaggedPosition<::Position::XYZ> Position; + int32 ActualMapID = 0; + int32 MapID = 0; + bool Valid = false; + }; + + class QueryCorpseTransport final : public ClientPacket + { + public: + QueryCorpseTransport(WorldPacket&& packet) : ClientPacket(CMSG_CORPSE_MAP_POSITION_QUERY, std::move(packet)) { } + + void Read() override; + + uint32 Transport = 0; + }; + + class CorpseTransportQuery final : public ServerPacket + { + public: + CorpseTransportQuery() : ServerPacket(SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4 + 4 + 4 + 4) { } + + WorldPacket const* Write() override; + + TaggedPosition<::Position::XYZ> Position; + float Facing = 0.0f; + }; + class QueryItemSingle final : public ClientPacket { public: diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 4b10b53f56..1364387911 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -662,7 +662,7 @@ void OpcodeTable::Initialize() /*0x213*/ DEFINE_HANDLER(CMSG_UNLEARN_TALENTS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x214*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT, STATUS_NEVER); /*0x215*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_GAMEOBJECT_DESPAWN_ANIM, STATUS_NEVER); - /*0x216*/ DEFINE_HANDLER(MSG_CORPSE_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCorpseQueryOpcode ); + /*0x216*/ DEFINE_HANDLER(MSG_CORPSE_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQueryCorpseLocation ); /*0x217*/ DEFINE_HANDLER(CMSG_GMTICKET_DELETETICKET, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGMTicketDeleteOpcode ); /*0x218*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_GMTICKET_DELETETICKET, STATUS_NEVER); /*0x219*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHAT_WRONG_FACTION, STATUS_NEVER); @@ -1334,7 +1334,7 @@ void OpcodeTable::Initialize() /*0x4B3*/ DEFINE_HANDLER(CMSG_ITEM_REFUND_INFO, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleItemRefundInfoRequest ); /*0x4B4*/ DEFINE_HANDLER(CMSG_ITEM_REFUND, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleItemRefund ); /*0x4B5*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_ITEM_REFUND_RESULT, STATUS_NEVER); - /*0x4B6*/ DEFINE_HANDLER(CMSG_CORPSE_MAP_POSITION_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCorpseMapPositionQuery ); + /*0x4B6*/ DEFINE_HANDLER(CMSG_CORPSE_MAP_POSITION_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQueryCorpseTransport ); /*0x4B7*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, STATUS_NEVER); /*0x4B8*/ DEFINE_HANDLER(CMSG_UNUSED5, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL ); /*0x4B9*/ DEFINE_HANDLER(CMSG_UNUSED6, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); @@ -1359,7 +1359,7 @@ void OpcodeTable::Initialize() /*0x4CC*/ DEFINE_HANDLER(CMSG_END_BATTLEFIELD_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); /*0x4CD*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MULTIPLE_PACKETS, STATUS_NEVER); /*0x4CE*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_GRAVITY_DISABLE, STATUS_NEVER); - /*0x4CF*/ DEFINE_HANDLER(CMSG_MOVE_GRAVITY_DISABLE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveGravityDisableAck ); + /*0x4CF*/ DEFINE_HANDLER(CMSG_MOVE_GRAVITY_DISABLE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveGravityDisableAck ); /*0x4D0*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_GRAVITY_ENABLE, STATUS_NEVER); /*0x4D1*/ DEFINE_HANDLER(CMSG_MOVE_GRAVITY_ENABLE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveGravityEnableAck); /*0x4D2*/ DEFINE_SERVER_OPCODE_HANDLER(MSG_MOVE_GRAVITY_CHNG, STATUS_NEVER); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index a8c5a892f8..00abbdd7dd 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -241,6 +241,8 @@ namespace WorldPackets { class QueryCreature; class QueryGameObject; + class QueryCorpseLocationFromClient; + class QueryCorpseTransport; class QueryItemSingle; class QuestPOIQuery; } @@ -980,8 +982,8 @@ class TC_GAME_API WorldSession void HandleChatIgnoredOpcode(WorldPacket& recvPacket); void HandleReclaimCorpse(WorldPackets::Misc::ReclaimCorpse& packet); - void HandleCorpseQueryOpcode(WorldPacket& recvPacket); - void HandleCorpseMapPositionQuery(WorldPacket& recvPacket); + void HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLocationFromClient& packet); + void HandleQueryCorpseTransport(WorldPackets::Query::QueryCorpseTransport& packet); void HandleResurrectResponse(WorldPackets::Misc::ResurrectResponse& packet); void HandleSummonResponseOpcode(WorldPacket& recvData); From 6522446c1d1ea032cec77d8d42978187e5d74881 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 20 Feb 2025 23:41:35 +0100 Subject: [PATCH 10/14] Core/Players: Name some unknown player flags --- src/server/game/Entities/Player/Player.h | 64 ++++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index cc4df35f6a..5891ecc685 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -319,38 +319,38 @@ enum DrunkenState enum PlayerFlags { - PLAYER_FLAGS_GROUP_LEADER = 0x00000001, - PLAYER_FLAGS_AFK = 0x00000002, - PLAYER_FLAGS_DND = 0x00000004, - PLAYER_FLAGS_GM = 0x00000008, - PLAYER_FLAGS_GHOST = 0x00000010, - PLAYER_FLAGS_RESTING = 0x00000020, - PLAYER_FLAGS_UNK6 = 0x00000040, - PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state - PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards - PLAYER_FLAGS_IN_PVP = 0x00000200, - PLAYER_FLAGS_HIDE_HELM = 0x00000400, - PLAYER_FLAGS_HIDE_CLOAK = 0x00000800, - PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time - PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time - PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000, - PLAYER_FLAGS_DEVELOPER = 0x00008000, // prefix for something? - PLAYER_FLAGS_UNK16 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary - PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1) - PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually) - PLAYER_FLAGS_UBER = 0x00080000, - PLAYER_FLAGS_UNK20 = 0x00100000, - PLAYER_FLAGS_UNK21 = 0x00200000, - PLAYER_FLAGS_COMMENTATOR2 = 0x00400000, - PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree, allowed only spells with SPELL_ATTR0_REQ_AMMO, SPELL_EFFECT_ATTACK, checked only for active player - PLAYER_FLAGS_UNK24 = 0x01000000, // disabled all melee ability on tab include autoattack - PLAYER_FLAGS_NO_XP_GAIN = 0x02000000, - PLAYER_FLAGS_UNK26 = 0x04000000, - PLAYER_FLAGS_UNK27 = 0x08000000, - PLAYER_FLAGS_UNK28 = 0x10000000, - PLAYER_FLAGS_UNK29 = 0x20000000, - PLAYER_FLAGS_UNK30 = 0x40000000, - PLAYER_FLAGS_UNK31 = 0x80000000 + PLAYER_FLAGS_GROUP_LEADER = 0x00000001, + PLAYER_FLAGS_AFK = 0x00000002, + PLAYER_FLAGS_DND = 0x00000004, + PLAYER_FLAGS_GM = 0x00000008, + PLAYER_FLAGS_GHOST = 0x00000010, + PLAYER_FLAGS_RESTING = 0x00000020, + PLAYER_FLAGS_VOICE_CHAT = 0x00000040, + PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state + PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards + PLAYER_FLAGS_IN_PVP = 0x00000200, + PLAYER_FLAGS_HIDE_HELM = 0x00000400, + PLAYER_FLAGS_HIDE_CLOAK = 0x00000800, + PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time + PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time + PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000, + PLAYER_FLAGS_DEVELOPER = 0x00008000, // prefix for something? + PLAYER_FLAGS_LOW_LEVEL_RAID_ENABLED = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary + PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1) + PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually) + PLAYER_FLAGS_UBER = 0x00080000, + PLAYER_FLAGS_UNK20 = 0x00100000, + PLAYER_FLAGS_UNK21 = 0x00200000, + PLAYER_FLAGS_COMMENTATOR2 = 0x00400000, + PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree, allowed only spells with SPELL_ATTR0_REQ_AMMO, SPELL_EFFECT_ATTACK, checked only for active player + PLAYER_FLAGS_UNK24 = 0x01000000, // disabled all melee ability on tab include autoattack + PLAYER_FLAGS_NO_XP_GAIN = 0x02000000, + PLAYER_FLAGS_UNK26 = 0x04000000, + PLAYER_FLAGS_UNK27 = 0x08000000, + PLAYER_FLAGS_UNK28 = 0x10000000, + PLAYER_FLAGS_UNK29 = 0x20000000, + PLAYER_FLAGS_UNK30 = 0x40000000, + PLAYER_FLAGS_UNK31 = 0x80000000 }; enum PlayerBytesOffsets From 88a9a1a25d2776afae41df42b67cf77cf8b14e6f Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 20 Feb 2025 23:42:00 +0100 Subject: [PATCH 11/14] Core/Misc: Reduce differences between branches --- src/server/game/Entities/Player/Player.cpp | 49 ++++++------------- src/server/game/Entities/Player/Player.h | 3 ++ .../game/Movement/Spline/MoveSplineInit.cpp | 2 +- 3 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 13c52109fc..3ccf62abd4 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -497,9 +497,8 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo SetPvpFlag(UNIT_BYTE2_FLAG_PVP); SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); } + SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER); - SetModCastingSpeed(1.0f); // fix cast time showed in spell tooltip on client - SetHoverHeight(1.0f); // default for players in 3.0.3 SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); // -1 is default value @@ -510,37 +509,9 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo SetFacialStyle(createInfo->FacialHair); SetRestState((GetSession()->IsARecruiter() || GetSession()->GetRecruiterId() != 0) ? REST_STATE_RAF_LINKED : REST_STATE_NOT_RAF_LINKED); SetNativeGender(Gender(createInfo->Gender)); - SetArenaFaction(0); - - SetUInt32Value(PLAYER_GUILDID, 0); - SetGuildRank(0); - SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0); - - for (int i = 0; i < KNOWN_TITLES_SIZE; ++i) - SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES + i, 0); // 0=disabled - SetUInt32Value(PLAYER_CHOSEN_TITLE, 0); - - SetUInt32Value(PLAYER_FIELD_KILLS, 0); - SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0); - SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0); - SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); // set starting level - uint32 start_level = GetClass() != CLASS_DEATH_KNIGHT - ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL) - : sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL); - - if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL)) - { - uint32 gm_level = GetClass() != CLASS_DEATH_KNIGHT - ? sWorld->getIntConfig(CONFIG_START_GM_LEVEL) - : std::max(sWorld->getIntConfig(CONFIG_START_GM_LEVEL), sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL)); - - if (gm_level > start_level) - start_level = gm_level; - } - - SetLevel(start_level, false); + SetLevel(GetStartLevel(createInfo->Class), false); InitRunes(); @@ -2677,7 +2648,7 @@ void Player::InitStatsForLevel(bool reapplyMods) { SetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, 0); SetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, 0); - SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, 1.00f); + SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, 1.0f); } //reset attack power, damage and attack speed fields @@ -11296,7 +11267,6 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool // Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750) if (type == INVTYPE_WEAPON && pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM) return EQUIP_ERR_WRONG_SLOT; - else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND) { if (!CanDualWield()) @@ -22221,6 +22191,19 @@ void Player::ReportedAfkBy(Player* reporter) reporter->SendDirectMessage(reportAfkResult.Write()); } +uint8 Player::GetStartLevel(uint8 playerClass) const +{ + uint8 startLevel = sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL); + + if (playerClass == CLASS_DEATH_KNIGHT) + startLevel = std::max(sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL), startLevel); + + if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL)) + startLevel = std::max(sWorld->getIntConfig(CONFIG_START_GM_LEVEL), startLevel); + + return startLevel; +} + WorldLocation Player::GetStartPosition() const { PlayerInfo const* info = sObjectMgr->GetPlayerInfo(GetRace(), GetClass()); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 5891ecc685..ba7bb3a16b 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1673,6 +1673,8 @@ class TC_GAME_API Player : public Unit, public GridObject float OCTRegenMPPerSpirit() const; float GetRatingMultiplier(CombatRating cr) const; float GetRatingBonusValue(CombatRating cr) const; + + /// Returns base spellpower bonus from spellpower stat on items uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; } int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; } @@ -2065,6 +2067,7 @@ class TC_GAME_API Player : public Unit, public GridObject float m_homebindY; float m_homebindZ; + uint8 GetStartLevel(uint8 playerClass) const; WorldLocation GetStartPosition() const; // currently visible objects at player client diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index d09ce2c2e4..0b9c767123 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -61,7 +61,7 @@ namespace Movement MoveSpline& move_spline = *unit->movespline; // Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes (movementInfo.transport.guid is 0 in that case) - bool transport = unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit->GetTransGUID(); + bool transport = unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !unit->GetTransGUID().IsEmpty(); Location real_position; // there is a big chance that current position is unknown if current state is not finalized, need compute it // this also allows CalculatePath spline position and update map position in much greater intervals From 114b84d8212dd346fad28f6a7ef81c453f0be1e8 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 20 Feb 2025 23:42:23 +0100 Subject: [PATCH 12/14] Core/Transports: Fixed wrong transport guid generator initialization --- src/server/game/Globals/ObjectMgr.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 41aa94a6d2..97d585c5db 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7451,21 +7451,22 @@ void ObjectMgr::SetHighestGuids() { QueryResult result = CharacterDatabase.Query("SELECT MAX(guid) FROM characters"); if (result) - GetGuidSequenceGenerator(HighGuid::Player).Set((*result)[0].GetUInt32() + 1); + GetGenerator().Set((*result)[0].GetUInt32() + 1); result = CharacterDatabase.Query("SELECT MAX(guid) FROM item_instance"); if (result) - GetGuidSequenceGenerator(HighGuid::Item).Set((*result)[0].GetUInt32() + 1); + GetGenerator().Set((*result)[0].GetUInt32() + 1); // Cleanup other tables from nonexistent guids ( >= _hiItemGuid) - CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '{}'", GetGuidSequenceGenerator(HighGuid::Item).GetNextAfterMaxUsed()); // One-time query - CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '{}'", GetGuidSequenceGenerator(HighGuid::Item).GetNextAfterMaxUsed()); // One-time query - CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '{}'", GetGuidSequenceGenerator(HighGuid::Item).GetNextAfterMaxUsed()); // One-time query - CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '{}'", GetGuidSequenceGenerator(HighGuid::Item).GetNextAfterMaxUsed()); // One-time query + CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '{}'", GetGenerator().GetNextAfterMaxUsed()); // One-time query + CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '{}'", GetGenerator().GetNextAfterMaxUsed()); // One-time query + CharacterDatabase.PExecute("DELETE a, ab FROM auctionhouse a LEFT JOIN auctionbidders ab ON ab.id = a.id WHERE itemguid >= '{}'", + GetGenerator().GetNextAfterMaxUsed()); // One-time query + CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '{}'", GetGenerator().GetNextAfterMaxUsed()); // One-time query result = WorldDatabase.Query("SELECT MAX(guid) FROM transports"); if (result) - GetGuidSequenceGenerator(HighGuid::Transport).Set((*result)[0].GetUInt32() + 1); + GetGenerator().Set((*result)[0].GetUInt32() + 1); result = CharacterDatabase.Query("SELECT MAX(id) FROM auctionhouse"); if (result) From fab59abb05488eecccf83b8d964e07b4185200e7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 20 Feb 2025 23:45:45 +0100 Subject: [PATCH 13/14] DB: Fix db startup errors related to 48baec04dfd3b654c945df9b4fc2e8feadad760a Closes #30704 --- sql/updates/world/3.3.5/2025_02_20_03_world.sql | 5 +++++ src/server/scripts/Spells/spell_paladin.cpp | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 sql/updates/world/3.3.5/2025_02_20_03_world.sql diff --git a/sql/updates/world/3.3.5/2025_02_20_03_world.sql b/sql/updates/world/3.3.5/2025_02_20_03_world.sql new file mode 100644 index 0000000000..73a45d08d8 --- /dev/null +++ b/sql/updates/world/3.3.5/2025_02_20_03_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_pal_seal_of_righteousness'; +DELETE FROM `spell_script_names` WHERE `spell_id`=21084 AND `ScriptName`='spell_pal_seals'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(-20154,'spell_pal_seal_of_righteousness'), +(-20154,'spell_pal_seals'); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index d4ca85d086..c91810158f 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -1785,6 +1785,7 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader }; // 20375 - Seal of Command +// 20154 - Seal of Righteousness // 21084 - Seal of Righteousness // 31801 - Seal of Vengeance // 31892 - Seal of Blood @@ -1805,6 +1806,9 @@ class spell_pal_seals : public AuraScript void Register() override { + if (m_scriptSpellId == 20154) + return; // another console log prevention hack - first "rank" of Seal of Righteousness doesn't have the judgement effect + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pal_seals::CheckDummyProc, EFFECT_2, SPELL_AURA_DUMMY); } }; From c9ba09a6441e31e79b892983c0e7388e0a6037b5 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 22 Feb 2025 07:52:27 +0100 Subject: [PATCH 14/14] Core/Scripts: updated more documentation comments for spell script hooks to match with the rest (cherry picked from commit 71ec8c93acef3dce14eaf52e756ef68a3159050a) # Conflicts: # src/server/game/Spells/SpellScript.h --- src/server/game/Spells/SpellScript.h | 42 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 5f623e2221..6b399c3a59 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -789,116 +789,116 @@ class TC_GAME_API AuraScript : public _SpellScript // executed when aura effect is applied with specified mode to target // should be used when when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe // example: OnEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); - // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode); + // where function is: void function(AuraEffect const* aurEff, AuraEffectHandleModes mode); HookList OnEffectApply; // executed after aura effect is applied with specified mode to target // example: AfterEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); - // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode); + // where function is: void function(AuraEffect const* aurEff, AuraEffectHandleModes mode); HookList AfterEffectApply; #define AuraEffectApplyFn(F, I, N, M) EffectApplyHandlerFunction(&F, I, N, M) // executed after aura effect is removed with specified mode from target // should be used when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe // example: OnEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); - // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode); + // where function is: void function(AuraEffect const* aurEff, AuraEffectHandleModes mode); HookList OnEffectRemove; // executed when aura effect is removed with specified mode from target // example: AfterEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes); - // where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode); + // where function is: void function(AuraEffect const* aurEff, AuraEffectHandleModes mode); HookList AfterEffectRemove; #define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandlerFunction(&F, I, N, M) // executed when periodic aura effect ticks on target // example: OnEffectPeriodic += AuraEffectPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is: void function (AuraEffect const* aurEff); + // where function is: void function(AuraEffect const* aurEff); HookList OnEffectPeriodic; #define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandlerFunction(&F, I, N) // executed when periodic aura effect is updated // example: OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is: void function (AuraEffect* aurEff); + // where function is: void function(AuraEffect* aurEff); HookList OnEffectUpdatePeriodic; #define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandlerFunction(&F, I, N) // executed when aura effect calculates amount // example: DoEffectCalcAmount += AuraEffectCalcAmounFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is: void function (AuraEffect* aurEff, int32& amount, bool& canBeRecalculated); + // where function is: void function(AuraEffect* aurEff, int32& amount, bool& canBeRecalculated); HookList DoEffectCalcAmount; #define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandlerFunction(&F, I, N) // executed when aura effect calculates periodic data // example: DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is: void function (AuraEffect const* aurEff, bool& isPeriodic, int32& amplitude); + // where function is: void function(AuraEffect const* aurEff, bool& isPeriodic, int32& amplitude); HookList DoEffectCalcPeriodic; #define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandlerFunction(&F, I, N) // executed when aura effect calculates spellmod // example: DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is: void function (AuraEffect const* aurEff, SpellModifier*& spellMod); + // where function is: void function(AuraEffect const* aurEff, SpellModifier*& spellMod); HookList DoEffectCalcSpellMod; #define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandlerFunction(&F, I, N) // executed when absorb aura effect is going to reduce damage // example: OnEffectAbsorb += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier); - // where function is: void function (AuraEffect const* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); + // where function is: void function(AuraEffect const* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); HookList OnEffectAbsorb; #define AuraEffectAbsorbFn(F, I) EffectAbsorbFunction(&F, I) // executed after absorb aura effect reduced damage to target - absorbAmount is real amount absorbed by aura // example: AfterEffectAbsorb += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier); - // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); + // where function is: void function(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); HookList AfterEffectAbsorb; // executed when mana shield aura effect is going to reduce damage // example: OnEffectManaShield += AuraEffectManaShieldFn(class::function, EffectIndexSpecifier); - // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); + // where function is: void function(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); HookList OnEffectManaShield; #define AuraEffectManaShieldFn(F, I) EffectManaShieldFunction(&F, I) // executed after mana shield aura effect reduced damage to target - absorbAmount is real amount absorbed by aura // example: AfterEffectManaShield += AuraEffectManaShieldFn(class::function, EffectIndexSpecifier); - // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); + // where function is: void function(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount); HookList AfterEffectManaShield; // executed when the caster of some spell with split dmg aura gets damaged through it // example: OnEffectSplit += AuraEffectSplitFn(class::function, EffectIndexSpecifier); - // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount); + // where function is: void function(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount); HookList OnEffectSplit; #define AuraEffectSplitFn(F, I) EffectSplitFunction(&F, I) // executed when aura checks if it can proc // example: DoCheckProc += AuraCheckProcFn(class::function); - // where function is: bool function (ProcEventInfo& eventInfo); + // where function is: bool function(ProcEventInfo& eventInfo); HookList DoCheckProc; #define AuraCheckProcFn(F) CheckProcHandlerFunction(&F) // executed when aura effect checks if it can proc the aura // example: DoCheckEffectProc += AuraCheckEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is bool function (AuraEffect const* aurEff, ProcEventInfo& eventInfo); + // where function is bool function(AuraEffect const* aurEff, ProcEventInfo& eventInfo); HookList DoCheckEffectProc; #define AuraCheckEffectProcFn(F, I, N) CheckEffectProcHandlerFunction(&F, I, N) // executed before aura procs (possibility to prevent charge drop/cooldown) // example: DoPrepareProc += AuraProcFn(class::function); - // where function is: void function (ProcEventInfo& eventInfo); + // where function is: void function(ProcEventInfo& eventInfo); HookList DoPrepareProc; // executed when aura procs // example: OnProc += AuraProcFn(class::function); - // where function is: void function (ProcEventInfo& eventInfo); + // where function is: void function(ProcEventInfo& eventInfo); HookList OnProc; // executed after aura proced // example: AfterProc += AuraProcFn(class::function); - // where function is: void function (ProcEventInfo& eventInfo); + // where function is: void function(ProcEventInfo& eventInfo); HookList AfterProc; #define AuraProcFn(F) AuraProcHandlerFunction(&F) // executed when aura effect procs // example: OnEffectProc += AuraEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is: void function (AuraEffect const* aurEff, ProcEventInfo& procInfo); + // where function is: void function(AuraEffect const* aurEff, ProcEventInfo& procInfo); HookList OnEffectProc; // executed after aura effect proced // example: AfterEffectProc += AuraEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier); - // where function is: void function (AuraEffect const* aurEff, ProcEventInfo& procInfo); + // where function is: void function(AuraEffect const* aurEff, ProcEventInfo& procInfo); HookList AfterEffectProc; #define AuraEffectProcFn(F, I, N) EffectProcHandlerFunction(&F, I, N)