fix build and add enabled hook lists for performance improvement

This commit is contained in:
Ludwig 2025-02-26 08:39:57 +01:00
parent 668b19995b
commit f444ef80ab

View file

@ -117,25 +117,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)
@ -148,73 +150,57 @@ public:
case 10: case 10:
{ {
if (oldLevel < 10) if (oldLevel < 10)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
case 20: case 20:
{ {
if (oldLevel < 20) if (oldLevel < 20)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
case 30: case 30:
{ {
if (oldLevel < 30) if (oldLevel < 30)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
case 40: case 40:
{ {
if (oldLevel < 40) if (oldLevel < 40)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
case 50: case 50:
{ {
if (oldLevel < 50) if (oldLevel < 50)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
case 60: case 60:
{ {
if (oldLevel < 60) if (oldLevel < 60)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
case 70: case 70:
{ {
if (oldLevel < 70) if (oldLevel < 70)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
case 80: case 80:
{ {
if (oldLevel < 80) if (oldLevel < 80)
{
money = giveAward(player); money = giveAward(player);
} }
}
break; break;
default: default:
@ -311,7 +297,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
{ {