mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Eluna remove crash possibility of using ReloadEluna global function on returning hooks, restrict the use of the reload command
This commit is contained in:
33
HookMgr.cpp
33
HookMgr.cpp
@@ -304,6 +304,12 @@ void Eluna::OnShutdownCancel()
|
||||
|
||||
void Eluna::OnWorldUpdate(uint32 diff)
|
||||
{
|
||||
if (reload)
|
||||
{
|
||||
ReloadEluna();
|
||||
return;
|
||||
}
|
||||
|
||||
m_EventMgr->Update(diff);
|
||||
EVENT_BEGIN(ServerEventBindings, WORLD_EVENT_ON_UPDATE, return);
|
||||
Push(L, diff);
|
||||
@@ -458,24 +464,27 @@ bool Eluna::OnRemove(Player* pPlayer, Item* item)
|
||||
bool Eluna::OnCommand(Player* player, const char* text)
|
||||
{
|
||||
std::string fullcmd(text);
|
||||
char* creload = strtok((char*)text, " ");
|
||||
char* celuna = strtok(NULL, "");
|
||||
if (creload && celuna)
|
||||
if (player->GetSession()->GetSecurity() >= SEC_ADMINISTRATOR)
|
||||
{
|
||||
std::string reload(creload);
|
||||
std::string eluna(celuna);
|
||||
std::transform(reload.begin(), reload.end(), reload.begin(), ::tolower);
|
||||
if (reload == "reload")
|
||||
char* creload = strtok((char*)text, " ");
|
||||
char* celuna = strtok(NULL, "");
|
||||
if (creload && celuna)
|
||||
{
|
||||
std::transform(eluna.begin(), eluna.end(), eluna.begin(), ::tolower);
|
||||
if (std::string("eluna").find(eluna) == 0)
|
||||
std::string reload(creload);
|
||||
std::string eluna(celuna);
|
||||
std::transform(reload.begin(), reload.end(), reload.begin(), ::tolower);
|
||||
if (reload == "reload")
|
||||
{
|
||||
eWorld->SendServerMessage(SERVER_MSG_STRING, "Reloading Eluna...");
|
||||
ReloadEluna();
|
||||
return false;
|
||||
std::transform(eluna.begin(), eluna.end(), eluna.begin(), ::tolower);
|
||||
if (std::string("eluna").find(eluna) == 0)
|
||||
{
|
||||
Eluna::reload = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool result = true;
|
||||
EVENT_BEGIN(PlayerEventBindings, PLAYER_EVENT_ON_COMMAND, return result);
|
||||
Push(L, player);
|
||||
|
||||
Reference in New Issue
Block a user