Scripts/Commands: add some missing checks for .guild create command
Port From (https://github.com/TrinityCore/TrinityCore/commit/a2c0f6d32113c8ff42760c389826bad80ce77815)
This commit is contained in:
@@ -35,18 +35,30 @@ namespace Game.Chat
|
|||||||
if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
|
if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string guildname = handler.ExtractQuotedArg(args.NextString());
|
string guildName = handler.ExtractQuotedArg(args.NextString());
|
||||||
if (string.IsNullOrEmpty(guildname))
|
if (string.IsNullOrEmpty(guildName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (target.GetGuildId() != 0)
|
if (target.GetGuildId() != 0)
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.PlayerInGuild);
|
handler.SendSysMessage(CypherStrings.PlayerInGuild);
|
||||||
return true;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.GuildMgr.GetGuildByName(guildName))
|
||||||
|
{
|
||||||
|
handler.SendSysMessage(CypherStrings.GuildRenameAlreadyExists);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.ObjectMgr.IsReservedName(guildName) || !ObjectManager.IsValidCharterName(guildName))
|
||||||
|
{
|
||||||
|
handler.SendSysMessage(CypherStrings.BadValue);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Guild guild = new();
|
Guild guild = new();
|
||||||
if (!guild.Create(target, guildname))
|
if (!guild.Create(target, guildName))
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.GuildNotCreated);
|
handler.SendSysMessage(CypherStrings.GuildNotCreated);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user