fix(Scripts/Commands): guild commands revert back to using guild names in quotes (#17798)

* initial

* remove tabs
This commit is contained in:
Dan
2023-11-19 16:04:46 +01:00
committed by GitHub
parent c55642b3d1
commit a286bc55bd

View File

@@ -67,6 +67,13 @@ public:
return false;
}
guildName = guild_commandscript::_RemoveQuotes(guildName);
if (guildName.empty())
{
return false;
}
Player* playerTarget = target->GetConnectedPlayer();
if (playerTarget->GetGuildId())
@@ -106,6 +113,8 @@ public:
static bool HandleGuildDeleteCommand(ChatHandler*, std::string_view guildName)
{
guildName = guild_commandscript::_RemoveQuotes(guildName);
if (guildName.empty())
{
return false;
@@ -133,6 +142,13 @@ public:
return false;
}
guildName = guild_commandscript::_RemoveQuotes(guildName);
if (guildName.empty())
{
return false;
}
Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
if (!targetGuild)
return false;
@@ -188,12 +204,10 @@ public:
static bool HandleGuildRenameCommand(ChatHandler* handler, std::string_view oldGuildStr, std::string_view newGuildStr)
{
if (!oldGuildStr.empty())
{
return false;
}
oldGuildStr = guild_commandscript::_RemoveQuotes(oldGuildStr);
newGuildStr = guild_commandscript::_RemoveQuotes(newGuildStr);
if (newGuildStr.empty())
if (oldGuildStr.empty() || newGuildStr.empty())
{
return false;
}
@@ -261,6 +275,20 @@ public:
handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str()); // Extra Information
return true;
}
private:
static std::string_view _RemoveQuotes(std::string_view inputString)
{
if (inputString.starts_with('"') && inputString.ends_with('"'))
{
inputString.remove_prefix(1);
inputString.remove_suffix(1);
return inputString;
}
else
{
return "";
}
}
};
void AddSC_guild_commandscript()