From af4da91ae6b2076637ab1c69addf5ab83497ea15 Mon Sep 17 00:00:00 2001 From: Ludwig Date: Wed, 26 Feb 2025 21:31:43 +0100 Subject: [PATCH 1/2] fix build, codestyle and add enabled hook list for performance improvement --- src/PvPScript.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/PvPScript.cpp b/src/PvPScript.cpp index 2c1392d..47f1ae2 100644 --- a/src/PvPScript.cpp +++ b/src/PvPScript.cpp @@ -1,13 +1,13 @@ +#include "AccountMgr.h" +#include "Chat.h" #include "Configuration/Config.h" -#include "Player.h" #include "Creature.h" -#include "AccountMgr.h" -#include "ScriptMgr.h" #include "Define.h" #include "GossipDef.h" -#include "Pet.h" #include "LootMgr.h" -#include "Chat.h" +#include "Pet.h" +#include "Player.h" +#include "ScriptMgr.h" uint32 SummonChest, KillAnnounce; bool spawnchestIP; @@ -17,9 +17,12 @@ std::vector AreatoIgnore = { 1741 /*Gurubashi*/, 2177 }; class PvPScript : public PlayerScript { public: - PvPScript() : PlayerScript("PvPScript") {} + PvPScript() : PlayerScript("PvPScript", { + PLAYERHOOK_ON_PLAYER_KILLED_BY_CREATURE, + PLAYERHOOK_ON_PVP_KILL + }) {} - void OnPlayerKilledByCreature(Creature* killer, Player* killed/*, bool& durabilityLoss*/) + void OnPlayerKilledByCreature(Creature* killer, Player* killed/*, bool& durabilityLoss*/) override { if (!sConfigMgr->GetOption("PvPChest", true)) return; @@ -33,10 +36,8 @@ class PvPScript : public PlayerScript if (spawnchestIP) if (Pet* pet = killer->ToPet()) if (Player* owner = pet->GetOwner()) - { if (!CheckConditions(owner, killed)) return; - } if (!CheckConditions(nullptr, killed)) return; @@ -49,7 +50,7 @@ class PvPScript : public PlayerScript } } - void OnPVPKill(Player* killer, Player* killed) + void OnPlayerPVPKill(Player* killer, Player* killed) override { if (!sConfigMgr->GetOption("PvPChest", true)) return; From 9bbc83fb8991205eccb1ca0d5d8d95372e749df8 Mon Sep 17 00:00:00 2001 From: sudlud Date: Wed, 26 Feb 2025 22:05:14 +0100 Subject: [PATCH 2/2] Update PvPScript.cpp - remove override --- src/PvPScript.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PvPScript.cpp b/src/PvPScript.cpp index 47f1ae2..518225d 100644 --- a/src/PvPScript.cpp +++ b/src/PvPScript.cpp @@ -22,7 +22,7 @@ class PvPScript : public PlayerScript PLAYERHOOK_ON_PVP_KILL }) {} - void OnPlayerKilledByCreature(Creature* killer, Player* killed/*, bool& durabilityLoss*/) override + void OnPlayerKilledByCreature(Creature* killer, Player* killed/*, bool& durabilityLoss*/) { if (!sConfigMgr->GetOption("PvPChest", true)) return; @@ -50,7 +50,7 @@ class PvPScript : public PlayerScript } } - void OnPlayerPVPKill(Player* killer, Player* killed) override + void OnPlayerPVPKill(Player* killer, Player* killed) { if (!sConfigMgr->GetOption("PvPChest", true)) return;