new version commit
This commit is contained in:
91
modules/mod-mxwow-levelup/src/mxwow_levelup.cpp
Normal file
91
modules/mod-mxwow-levelup/src/mxwow_levelup.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
//// MxWoW Official Module
|
||||
//// Level Up
|
||||
//// Dev: mikx
|
||||
//// Git: https://mxgit.ovh/MxWoW/mod_mxwow_levelup
|
||||
|
||||
#include "Configuration/Config.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Chat.h"
|
||||
#include <WorldSessionMgr.h>
|
||||
|
||||
class mxwow_levelup : public PlayerScript
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
mxwow_levelup() : PlayerScript("mxwow_levelup") { }
|
||||
|
||||
void OnPlayerLogin(Player* player) override
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnPlayerLevelChanged(Player * player, uint8 oldLevel)
|
||||
{
|
||||
if(!sConfigMgr->GetOption<bool>("MxWoW_LevelUp.Enabled", false)) { return; }
|
||||
|
||||
Map* map = player->GetMap();
|
||||
std::string mapName = map->GetMapName();
|
||||
std::ostringstream ss;
|
||||
uint32 showMultiple = sConfigMgr->GetOption<int>("MxWoW_LevelUp.Show.Multiple", false);
|
||||
uint32 newLevel = oldLevel + 1;
|
||||
ss << "|cffabeeff[MxW] [" << GetPlayerColor(player) << player->GetName() << "|cffabeeff][|cff09ff00" << mapName << "|cffabeeff] est maintenant niveau |cff09ff00" << oldLevel + 1 << "|cffabeeff.";
|
||||
if (sConfigMgr->GetOption<bool>("MxWoW_LevelUp.Enabled.Bot", false)) {
|
||||
if (newLevel % showMultiple == 0)
|
||||
{
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (newLevel % showMultiple == 0 && !IsAccountBot(player))
|
||||
{
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetPlayerColor(const Player* p)
|
||||
{
|
||||
switch (p->getClass())
|
||||
{
|
||||
case CLASS_ROGUE:
|
||||
return "|cffFFF468";
|
||||
case CLASS_DEATH_KNIGHT:
|
||||
return "|cffC41E3A";
|
||||
case CLASS_WARRIOR:
|
||||
return "|cffC69B6D";
|
||||
case CLASS_PRIEST:
|
||||
return "|cffFFFFFF";
|
||||
case CLASS_MAGE:
|
||||
return "|cff3FC7EB";
|
||||
case CLASS_PALADIN:
|
||||
return "|cffF48CBA";
|
||||
case CLASS_HUNTER:
|
||||
return "|cffAAD372";
|
||||
case CLASS_DRUID:
|
||||
return "|cffFF7C0A";
|
||||
case CLASS_SHAMAN:
|
||||
return "|cff0070DD";
|
||||
case CLASS_WARLOCK:
|
||||
return "|cff8788EE";
|
||||
default:
|
||||
return "n/d";
|
||||
}
|
||||
}
|
||||
|
||||
bool IsAccountBot(const Player* p) {
|
||||
QueryResult queryCheckAccount = LoginDatabase.Query("SELECT * FROM account WHERE id = {} AND username LIKE 'RNDBOT%'", p->GetSession()->GetAccountId());
|
||||
if (queryCheckAccount) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddMxWoWLevelUpScripts()
|
||||
{
|
||||
new mxwow_levelup();
|
||||
}
|
||||
11
modules/mod-mxwow-levelup/src/mxwow_levelup_loader.cpp
Normal file
11
modules/mod-mxwow-levelup/src/mxwow_levelup_loader.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
//// MxWoW Official Module
|
||||
//// Level Up
|
||||
//// Dev: mikx
|
||||
//// Git: https://mxgit.ovh/MxWoW/mod_mxwow_levelup
|
||||
|
||||
void AddMxWoWLevelUpScripts();
|
||||
|
||||
void Addmod_mxwow_levelupScripts()
|
||||
{
|
||||
AddMxWoWLevelUpScripts();
|
||||
}
|
||||
Reference in New Issue
Block a user