[Cleanup] Remove hard-coded Status Checks (#3727)

* [Cleanup] Remove hard-coded Status Checks

# Notes
- Removed the hard-coded GM status checks since if you have access to the command we can now limit access to subcommands if necessary.

* Update client_packet.cpp
This commit is contained in:
Alex King
2023-12-03 11:44:30 -05:00
committed by GitHub
parent 22994e3264
commit e719aa43cf
13 changed files with 649 additions and 862 deletions
+2 -60
View File
@@ -81,11 +81,6 @@ void command_guild(Client *c, const Seperator *sep)
).c_str()
);
} else {
if (c->Admin() < minStatusToEditOtherGuilds) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
auto guild_name = sep->argplus[3];
auto guild_id = guild_mgr.CreateGuild(sep->argplus[3], leader_id);
@@ -144,16 +139,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds) {
if (c->GuildID() != guild_id) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
} else if (!guild_mgr.CheckGMStatus(guild_id, c->Admin())) {
c->Message(Chat::White, "You cannot edit your current guild, your status is not high enough.");
return;
}
}
LogGuilds(
"[{}]: Deleting guild [{}] ([{}]) with GM command",
c->GetName(),
@@ -175,16 +160,10 @@ void command_guild(Client *c, const Seperator *sep)
SendGuildSubCommands(c);
} else if (is_info) {
if (arguments != 2 && c->IsInAGuild()) {
if (c->Admin() >= minStatusToEditOtherGuilds) {
c->Message(Chat::White, "#guild info [Guild ID]");
} else {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
}
c->Message(Chat::White, "#guild info [Guild ID]");
} else {
auto guild_id = GUILD_NONE;
if (arguments != 2 || !sep->IsNumber(2)) {
guild_id = c->GuildID();
} else if (c->Admin() >= minStatusToEditOtherGuilds) {
if (sep->IsNumber(2)) {
guild_id = Strings::ToUnsignedInt(sep->arg[2]);
}
@@ -193,11 +172,6 @@ void command_guild(Client *c, const Seperator *sep)
}
}
} else if (is_list) {
if (c->Admin() < minStatusToEditOtherGuilds) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
guild_mgr.ListGuilds(c, std::string());
} else if (is_rename) {
if (!sep->IsNumber(2)) {
@@ -215,16 +189,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds) {
if (c->GuildID() != guild_id) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
} else if (!guild_mgr.CheckGMStatus(guild_id, c->Admin())) {
c->Message(Chat::White, "You cannot edit your current guild, your status is not high enough.");
return;
}
}
auto new_guild_name = sep->argplus[3];
LogGuilds(
"[{}]: Renaming guild [{}] ([{}]) to [{}] with GM command",
@@ -293,11 +257,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds && guild_id != c->GuildID()) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
if (!guild_id || guild_id == GUILD_NONE) {
LogGuilds(
"[{}]: Removing [{}] ([{}]) from guild with GM command",
@@ -390,16 +349,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds) {
if (c->GuildID() != guild_id) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
} else if (!guild_mgr.CheckGMStatus(guild_id, c->Admin())) {
c->Message(Chat::White, "You cannot edit your current guild, your status is not high enough.");
return;
}
}
LogGuilds(
"[{}]: Setting leader of guild [{}] ([{}]) to [{}] with GM command",
c->GetName(),
@@ -461,11 +410,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds && character_id != c->CharacterID()) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
LogGuilds(
"[{}]: Setting [{}] ([{}])'s guild rank to [{}] with GM command",
c->GetName(),
@@ -498,8 +442,6 @@ void command_guild(Client *c, const Seperator *sep)
);
if (!client) {
c->Message(Chat::White, "You must target someone or specify a character name.");
} else if (c->Admin() < minStatusToEditOtherGuilds && client->GuildID() != c->GuildID()) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
} else {
if (!client->IsInAGuild()) {
c->Message(