fixing config stuff

This commit is contained in:
WebLuke
2025-09-09 14:04:52 -06:00
parent 59c6d9b979
commit 7c06da82dd
2 changed files with 18 additions and 27 deletions

View File

@@ -1,7 +1,3 @@
#
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
[worldserver] [worldserver]
######################################## ########################################

View File

@@ -4,7 +4,7 @@
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "Player.h" #include "Player.h"
#include "Config.h" #include "Configuration/Config.h"
#include "Chat.h" #include "Chat.h"
@@ -12,6 +12,7 @@
class GrowUp : public PlayerScript class GrowUp : public PlayerScript
{ {
public: public:
GrowUp() : PlayerScript("GrowUp", { GrowUp() : PlayerScript("GrowUp", {
PLAYERHOOK_ON_LOGIN, PLAYERHOOK_ON_LOGIN,
PLAYERHOOK_ON_FIRST_LOGIN, PLAYERHOOK_ON_FIRST_LOGIN,
@@ -22,7 +23,7 @@ public:
{ {
if (sConfigMgr->GetOption<bool>("GrownUp.Announce", true)) if (sConfigMgr->GetOption<bool>("GrownUp.Announce", true))
ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00Grown Up |rmodule."); ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00Grown Up |rmodule.");
if (sConfigMgr->GetOption<bool>("GrownUp.Enable", true) && sConfigMgr->GetOption<bool>("GrownUp.LoginCheck", true)) if (sConfigMgr->GetOption<bool>("GrownUp.LoginCheck", true))
{ {
uint8 level = player->GetLevel(); uint8 level = player->GetLevel();
float newScale = 1.0f; float newScale = 1.0f;
@@ -42,33 +43,27 @@ public:
void OnPlayerFirstLogin(Player* player) override void OnPlayerFirstLogin(Player* player) override
{ {
if (sConfigMgr->GetOption<bool>("GrownUp.Enable", true)) player->SetObjectScale(0.5f);
{ ChatHandler(player->GetSession()).SendSysMessage("Your adventure begins young one!");
player->SetObjectScale(0.5f);
ChatHandler(player->GetSession()).SendSysMessage("Your adventure begins young one!");
}
} }
void OnPlayerLevelChanged(Player* player, uint8 /*oldLevel*/) override void OnPlayerLevelChanged(Player* player, uint8 /*oldLevel*/) override
{ {
if (sConfigMgr->GetOption<bool>("GrownUp.Enable", true)) uint8 newLevel = player->GetLevel();
{ float newScale = 1.0f; // default full size
uint8 newLevel = player->GetLevel();
float newScale = 1.0f; // default full size
if (newLevel < 5) if (newLevel < 5)
newScale = 0.5f; newScale = 0.5f;
else if (newLevel < 10) else if (newLevel < 10)
newScale = 0.65f; newScale = 0.65f;
else if (newLevel < 15) else if (newLevel < 15)
newScale = 0.85f; newScale = 0.85f;
else else
newScale = 1.0f; newScale = 1.0f;
player->SetObjectScale(newScale); player->SetObjectScale(newScale);
ChatHandler(player->GetSession()) ChatHandler(player->GetSession())
.PSendSysMessage("Your adventure has grown!"); // Message when leveling up may try and add the % back later. .PSendSysMessage("Your adventure has grown!"); // Message when leveling up may try and add the % back later.
}
} }
}; };