Core/RBAC: Add .reload rbac command and prevent possible crash if rbac_permissions has wrong data

This commit is contained in:
Spp
2013-02-27 03:29:11 +01:00
parent 4ea31ce886
commit 480c6cf4dd
13 changed files with 255 additions and 29 deletions

View File

@@ -22,6 +22,7 @@ Comment: All reload related commands
Category: commandscripts
EndScriptData */
#include "AccountMgr.h"
#include "AchievementMgr.h"
#include "AuctionHouseMgr.h"
#include "Chat.h"
@@ -128,6 +129,7 @@ public:
{ "prospecting_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesProspectingCommand, "", NULL },
{ "quest_poi", SEC_ADMINISTRATOR, true, &HandleReloadQuestPOICommand, "", NULL },
{ "quest_template", SEC_ADMINISTRATOR, true, &HandleReloadQuestTemplateCommand, "", NULL },
{ "rbac", SEC_ADMINISTRATOR, true, &HandleReloadRBACCommand, "", NULL },
{ "reference_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesReferenceCommand, "", NULL },
{ "reserved_name", SEC_ADMINISTRATOR, true, &HandleReloadReservedNameCommand, "", NULL },
{ "reputation_reward_rate", SEC_ADMINISTRATOR, true, &HandleReloadReputationRewardRateCommand, "", NULL },
@@ -1242,6 +1244,15 @@ public:
handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded.");
return true;
}
static bool HandleReloadRBACCommand(ChatHandler* handler, const char* /*args*/)
{
sLog->outInfo(LOG_FILTER_GENERAL, "Reloading RBAC tables...");
sAccountMgr->LoadRBAC();
sWorld->ReloadRBAC();
handler->SendGlobalGMSysMessage("RBAC data reloaded.");
return true;
}
};
void AddSC_reload_commandscript()