[Commands] Nested Command Aliases (#2636)

This commit is contained in:
Chris Miles
2022-12-14 22:26:05 -06:00
committed by GitHub
parent 6ddd5db480
commit dce5f03e74
5 changed files with 137 additions and 90 deletions
+4 -10
View File
@@ -143,6 +143,7 @@ int command_init(void)
command_add("faction", "[Find (criteria | all ) | Review (criteria | all) | Reset (id)] - Resets Player's Faction", AccountStatus::QuestTroupe, command_faction) ||
command_add("factionassociation", "[factionid] [amount] - triggers a faction hits via association", AccountStatus::GMLeadAdmin, command_faction_association) ||
command_add("feature", "Change your or your target's feature's temporarily", AccountStatus::QuestTroupe, command_feature) ||
command_add("size", "Change your targets size (alias of #feature size)", AccountStatus::QuestTroupe, command_feature) ||
command_add("findaa", "[Search Criteria] - Search for an AA", AccountStatus::Guide, command_findaa) ||
command_add("findaliases", "[Search Criteria]- Searches for available command aliases, by alias or command", AccountStatus::Player, command_findaliases) ||
command_add("findclass", "[Search Criteria] - Search for a class", AccountStatus::Guide, command_findclass) ||
@@ -261,6 +262,8 @@ int command_init(void)
command_add("randomfeatures", "Temporarily randomizes the Facial Features of your target", AccountStatus::QuestTroupe, command_randomfeatures) ||
command_add("refreshgroup", "Refreshes Group for you or your player target.", AccountStatus::Player, command_refreshgroup) ||
command_add("reload", "Reloads different types of server data globally, use no argument for help menu.", AccountStatus::GMMgmt, command_reload) ||
command_add("rq", "Reloads quests (alias of #reload quests).", AccountStatus::GMMgmt, command_reload) ||
command_add("rl", "Reloads logs (alias of #reload logs).", AccountStatus::GMMgmt, command_reload) ||
command_add("removeitem", "[Item ID] [Amount] - Removes the specified Item ID by Amount from you or your player target's inventory (Amount defaults to 1 if not used)", AccountStatus::GMAdmin, command_removeitem) ||
command_add("repop", "[Force] - Repop the zone with optional force repop", AccountStatus::GMAdmin, command_repop) ||
command_add("resetaa", "Resets a Player's AA in their profile and refunds spent AA's to unspent, may disconnect player.", AccountStatus::GMMgmt, command_resetaa) ||
@@ -517,15 +520,6 @@ int command_add(std::string command_name, std::string description, uint8 admin,
return -1;
}
for (const auto& c : commandlist) {
if (c.second->function != function) {
continue;
}
LogError("command_add() - Command [{}] equates to an alias of [{}] - check command.cpp", command_name, c.first);
return -1;
}
auto c = new CommandRecord;
c->admin = admin;
c->description = description;
@@ -617,7 +611,7 @@ void command_help(Client *c, const Seperator *sep)
for (const auto& cur : commandlist) {
if (!search_criteria.empty()) {
if (cur.first.find(search_criteria) == std::string::npos) {
if (!Strings::Contains(cur.first, search_criteria) && !Strings::Contains(cur.second->description, search_criteria)) {
continue;
}
}