Merge remote-tracking branch 'origin/master' into fix-reward-messages-1

This commit is contained in:
Ludwig 2025-02-26 11:18:50 +01:00
commit b78a72d5ce

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)
@ -193,7 +196,7 @@ public:
default: default:
break; break;
} }
sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str()); sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
} }
// Always send message on reward level up // Always send message on reward level up
@ -222,7 +225,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;
@ -257,7 +260,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
{ {