Scripts/Commands: add some missing checks for .guild create command (#23201)

* Core/Conditions: implement CONDITION_GAMEMASTER

* Scripts/Commands: add some missing checks for .guild create command
This commit is contained in:
ForesterDev
2019-04-24 18:58:56 +04:00
committed by Giacomo Pozzoni
parent f163c2f96a
commit ae8750716f

View File

@@ -29,6 +29,7 @@ EndScriptData */
#include "GuildMgr.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "RBAC.h"
@@ -87,7 +88,22 @@ public:
if (target->GetGuildId())
{
handler->SendSysMessage(LANG_PLAYER_IN_GUILD);
return true;
handler->SetSentErrorMessage(true);
return false;
}
if (sGuildMgr->GetGuildByName(guildName))
{
handler->SendSysMessage(LANG_GUILD_RENAME_ALREADY_EXISTS);
handler->SetSentErrorMessage(true);
return false;
}
if (sObjectMgr->IsReservedName(guildName) || !sObjectMgr->IsValidCharterName(guildName))
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
Guild* guild = new Guild;