Compare commits

..

15 commits

Author SHA1 Message Date
sudlud
fed4752e0c
Merge pull request #42 from azerothcore/sudlud-pach-42-4
fix order of language entries
2025-02-28 14:15:30 +01:00
Ludwig
66f9e0a4f5 fix order of language entries 2025-02-28 13:59:52 +01:00
sudlud
0c9c0c9bc8
Merge pull request #41 from jamssismy/patch-2
Update mod_congratsonlevel.cpp
2025-02-28 13:58:09 +01:00
jamssismy
ae5e5d3b28
Update mod_congratsonlevel.cpp
I aligned the code, and actually, our communication is done through AI translation. I initially thought your mention of alignment referred to the unification of the level display function calls. Thank you for the reminder. I'm not a professional programmer and haven't received formal training, so I don't have good code alignment habits. Thanks again for your reminder!~
2025-02-28 11:29:09 +08:00
jamssismy
4fe199845e
Update mod_congratsonlevel.cpp
The calling method for levels has been standardized
<< static_cast<int>(player->GetLevel()) <<
2025-02-27 16:41:14 +08:00
jamssismy
0d233e2c33
Update mod_congratsonlevel.cpp
The software or game now supports user interface prompts in both Simplified Chinese and Traditional Chinese, making it more accessible to a wider range of Chinese-speaking users.
A correction has been made to the on-screen display of currency amounts. Specifically, where small amounts of currency were being shown, the unit was incorrectly displayed as "Gold." This has been corrected so that it now accurately displays "Copper," which is the appropriate unit for smaller denominations in games like World of Warcraft.
2025-02-27 10:02:34 +08:00
sudlud
d756b42db3
Merge pull request #40 from azerothcore/fix-level-messages-1
fix messages not showing level correctly
2025-02-26 20:34:26 +01:00
Ludwig
239bae9d5b fix messages not showing level correctly 2025-02-26 20:25:04 +01:00
sudlud
6f7a3dbbeb
Merge pull request #39 from azerothcore/fix-reward-messages-1
fix reward level up message and CongratsPerLevel.Enable functionality
2025-02-26 12:23:36 +01:00
Ludwig
b78a72d5ce Merge remote-tracking branch 'origin/master' into fix-reward-messages-1 2025-02-26 11:18:50 +01:00
sudlud
eb72cb9a29
Merge pull request #38 from azerothcore/sudlud-pach-42-3
fix build and add enabled hook lists for performance improvement
2025-02-26 11:18:33 +01:00
Ludwig
d133684206 fix for WorldSessionMgr 2025-02-26 10:12:16 +01:00
Ludwig
0f8ee189b1 fix unintended changes 2025-02-26 08:50:31 +01:00
Ludwig
793fc6ade3 restore braces 2025-02-26 08:49:55 +01:00
Ludwig
f444ef80ab fix build and add enabled hook lists for performance improvement 2025-02-26 08:39:57 +01:00

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)
@ -178,22 +181,30 @@ public:
case LOCALE_koKR: case LOCALE_koKR:
case LOCALE_frFR: case LOCALE_frFR:
case LOCALE_deDE: case LOCALE_deDE:
case LOCALE_zhCN:
case LOCALE_zhTW:
case LOCALE_ruRU: case LOCALE_ruRU:
{ {
ss << "|cffFFFFFF[ |cffFF0000C|cffFFA500O|cffFFFF00N|cff00FF00G|cff00FFFFR|cff6A5ACDA|cffFF00FFT|cff98FB98S|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFhas reached |cff4CFF00Level " << std::to_string(player->GetLevel()) << "|cffFFFFFF!"; ss << "|cffFFFFFF[ |cffFF0000C|cffFFA500O|cffFFFF00N|cff00FF00G|cff00FFFFR|cff6A5ACDA|cffFF00FFT|cff98FB98S|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFhas reached |cff4CFF00Level " << static_cast<int>(player->GetLevel()) << "|cffFFFFFF!";
break;
}
case LOCALE_zhCN:
{
ss << "|cffFFFFFF[ |cffFF0000恭|cffFFA500喜|cffFFFF00你|cff00FF00升|cff00FFFF级|cff6A5ACD啦|cffFF00FF! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFF已达到 |cff4CFF00" << static_cast<int>(player->GetLevel()) << " 级|cffFFFFFF!";
break;
}
case LOCALE_zhTW:
{
ss << "|cffFFFFFF[ |cffFF0000恭|cffFFA500喜|cffFFFF00你|cff00FF00升|cff00FFFF級|cff6A5ACD啦|cffFF00FF! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFF已達到 |cff4CFF00" << static_cast<int>(player->GetLevel()) << " 級|cffFFFFFF!";
break; break;
} }
case LOCALE_esES: case LOCALE_esES:
case LOCALE_esMX: case LOCALE_esMX:
{ {
ss << "|cffFFFFFF[ |cffFF0000F|cffFFA500E|cffFFFF00L|cff00FF00I|cff00FFFFC|cff6A5ACDI|cffFF00FFT|cff98FB98A|cff00FF00C|cff00FFFFI|cffFF0000O|cff00FF00N|cff00FFFFE|cffFF00FFS|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFha alcanzado |cff4CFF00el nivel " << std::to_string(player->GetLevel()) << "|cffFFFFFF!"; ss << "|cffFFFFFF[ |cffFF0000F|cffFFA500E|cffFFFF00L|cff00FF00I|cff00FFFFC|cff6A5ACDI|cffFF00FFT|cff98FB98A|cff00FF00C|cff00FFFFI|cffFF0000O|cff00FF00N|cff00FFFFE|cffFF00FFS|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFha alcanzado |cff4CFF00el nivel " << static_cast<int>(player->GetLevel()) << "|cffFFFFFF!";
} }
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
@ -207,22 +218,30 @@ public:
case LOCALE_koKR: case LOCALE_koKR:
case LOCALE_frFR: case LOCALE_frFR:
case LOCALE_deDE: case LOCALE_deDE:
case LOCALE_zhCN:
case LOCALE_zhTW:
case LOCALE_ruRU: case LOCALE_ruRU:
{ {
ss << "|cffFFFFFF[ |cffFF0000C|cffFFA500O|cffFFFF00N|cff00FF00G|cff00FFFFR|cff6A5ACDA|cffFF00FFT|cff98FB98S|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFhas reached |cff4CFF00Level " << level << "|cffFFFFFF!"; ss << "|cffFFFFFF[ |cffFF0000C|cffFFA500O|cffFFFF00N|cff00FF00G|cff00FFFFR|cff6A5ACDA|cffFF00FFT|cff98FB98S|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFhas reached |cff4CFF00Level " << static_cast<int>(player->GetLevel()) << "|cffFFFFFF!";
break;
}
case LOCALE_zhCN: // 简体中文
{
ss << "|cffFFFFFF[ |cffFF0000恭|cffFFA500喜|cffFFFF00你|cff00FF00升|cff00FFFF级|cff6A5ACD啦|cffFF00FF! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFF已达到 |cff4CFF00" << static_cast<int>(player->GetLevel()) << " 级|cffFFFFFF!";
break;
}
case LOCALE_zhTW: // 繁体中文
{
ss << "|cffFFFFFF[ |cffFF0000恭|cffFFA500喜|cffFFFF00你|cff00FF00升|cff00FFFF級|cff6A5ACD啦|cffFF00FF! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFF已達到 |cff4CFF00" << static_cast<int>(player->GetLevel()) << " 級|cffFFFFFF!";
break; break;
} }
case LOCALE_esES: case LOCALE_esES:
case LOCALE_esMX: case LOCALE_esMX:
{ {
ss << "|cffFFFFFF[ |cffFF0000F|cffFFA500E|cffFFFF00L|cff00FF00I|cff00FFFFC|cff6A5ACDI|cffFF00FFT|cff98FB98A|cff00FF00C|cff00FFFFI|cffFF0000O|cff00FF00N|cff00FFFFE|cffFF00FFS|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFha alcanzado |cff4CFF00el nivel " << level << "|cffFFFFFF!"; ss << "|cffFFFFFF[ |cffFF0000F|cffFFA500E|cffFFFF00L|cff00FF00I|cff00FFFFC|cff6A5ACDI|cffFF00FFT|cff98FB98A|cff00FF00C|cff00FFFFI|cffFF0000O|cff00FF00N|cff00FFFFE|cffFF00FFS|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFha alcanzado |cff4CFF00el nivel " << static_cast<int>(player->GetLevel()) << "|cffFFFFFF!";
} }
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;
@ -232,17 +251,25 @@ public:
case LOCALE_koKR: case LOCALE_koKR:
case LOCALE_frFR: case LOCALE_frFR:
case LOCALE_deDE: case LOCALE_deDE:
case LOCALE_zhCN:
case LOCALE_zhTW:
case LOCALE_ruRU: case LOCALE_ruRU:
{ {
ss2 << "Congrats on Level " << level << " " << player->GetName() << "! You've been awarded " << money << " gold and a few treasures!"; ss2 << "Congrats on Level " << static_cast<int>(player->GetLevel()) << " " << player->GetName() << "! You've been awarded " << money << " Copper and a few treasures!";
break;
}
case LOCALE_zhCN: // 简体中文
{
ss2 << "恭喜达到等级 " << static_cast<int>(player->GetLevel()) << "" << player->GetName() << "!您获得了 " << money << " 钱币和一些宝藏!";
break;
}
case LOCALE_zhTW: // 繁体中文
{
ss2 << "恭喜達到等級 " << static_cast<int>(player->GetLevel()) << "" << player->GetName() << "!您獲得了 " << money << " 錢幣和一些寶藏!";
break; break;
} }
case LOCALE_esES: case LOCALE_esES:
case LOCALE_esMX: case LOCALE_esMX:
{ {
ss2 << "¡Felicidades por el nivel " << level << " " << player->GetName() << " Se le ha concedido " << money << " oro y unos cuantos tesoros!"; ss2 << "¡Felicidades por el nivel " << static_cast<int>(player->GetLevel()) << " " << player->GetName() << " Se le ha concedido " << money << " cobre y unos cuantos tesoros!";
} }
default: default:
break; break;
@ -257,7 +284,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
{ {