Merge pull request #38 from azerothcore/sudlud-pach-42-3

fix build and add enabled hook lists for performance improvement
This commit is contained in:
sudlud 2025-02-26 11:18:33 +01:00 committed by GitHub
commit eb72cb9a29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,9 +64,10 @@ config file for quick modifications.
*/ */
#include "Configuration/Config.h" #include "Configuration/Config.h"
#include "ScriptMgr.h"
#include "Player.h"
#include "Chat.h" #include "Chat.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldSessionMgr.h"
struct COL struct COL
{ {
@ -117,25 +118,27 @@ class CongratsAnnounce : public PlayerScript
public: public:
CongratsAnnounce() : PlayerScript("CongratsAnnounce") {} CongratsAnnounce() : PlayerScript("CongratsAnnounce", {
PLAYERHOOK_ON_LOGIN
}) {}
void OnLogin(Player* player) void OnPlayerLogin(Player* player)
{ {
// Announce Module // Announce Module
if (col.congratsAnnounce) if (col.congratsAnnounce)
{
ChatHandler(player->GetSession()).SendSysMessage(col.acoreMessageId); ChatHandler(player->GetSession()).SendSysMessage(col.acoreMessageId);
}
} }
}; };
class CongratsOnLevel : public PlayerScript class CongratsOnLevel : public PlayerScript
{ {
public: public:
CongratsOnLevel() : PlayerScript("CongratsOnLevel") { } CongratsOnLevel() : PlayerScript("CongratsOnLevel", {
PLAYERHOOK_ON_LEVEL_CHANGED
}) { }
// Level Up Rewards // Level Up Rewards
void OnLevelChanged(Player* player, uint8 oldLevel) override void OnPlayerLevelChanged(Player* player, uint8 oldLevel) override
{ {
// If enabled... // If enabled...
if (col.congratsEnable) if (col.congratsEnable)
@ -247,7 +250,7 @@ public:
default: default:
break; break;
} }
sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str()); sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
} }
// If level is defined, they hit a reward level. // If level is defined, they hit a reward level.
@ -276,7 +279,7 @@ public:
default: default:
break; break;
} }
sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str()); sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
// Issue a raid warning to the player // Issue a raid warning to the player
std::ostringstream ss2; std::ostringstream ss2;
@ -311,7 +314,9 @@ public:
class ModCongratsLevelWorldScript : public WorldScript class ModCongratsLevelWorldScript : public WorldScript
{ {
public: public:
ModCongratsLevelWorldScript() : WorldScript("ModCongratsLevelWorldScript") { } ModCongratsLevelWorldScript() : WorldScript("ModCongratsLevelWorldScript", {
WORLDHOOK_ON_BEFORE_CONFIG_LOAD
}) { }
void OnBeforeConfigLoad(bool reload) override void OnBeforeConfigLoad(bool reload) override
{ {