diff --git a/zone/command.cpp b/zone/command.cpp index 09aa704b1..dcc28ff9b 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -204,9 +204,10 @@ int command_init(void) command_add("equipitem", "[slotid(0-21)] - Equip the item on your cursor into the specified slot", 50, command_equipitem) || command_add("face", "- Change the face of your target", 80, command_face) || command_add("faction", "[Find (criteria | all ) | Review (criteria | all) | Reset (id)] - Resets Player's Faction", 80, command_faction) || - command_add("findaliases", "[search term]- Searches for available command aliases, by alias or command", 0, command_findaliases) || + command_add("findaliases", "[search criteria]- Searches for available command aliases, by alias or command", 0, command_findaliases) || command_add("findnpctype", "[search criteria] - Search database NPC types", 100, command_findnpctype) || - command_add("findspell", "[searchstring] - Search for a spell", 50, command_findspell) || + command_add("findrace", "[search criteria] - Search for a race", 50, command_findrace) || + command_add("findspell", "[search criteria] - Search for a spell", 50, command_findspell) || command_add("findzone", "[search criteria] - Search database zones", 100, command_findzone) || command_add("fixmob", "[race|gender|texture|helm|face|hair|haircolor|beard|beardcolor|heritage|tattoo|detail] [next|prev] - Manipulate appearance of your target", 80, command_fixmob) || command_add("flag", "[status] [acctname] - Refresh your admin status, or set an account's admin status if arguments provided", 0, command_flag) || @@ -2628,6 +2629,46 @@ void command_showskills(Client *c, const Seperator *sep) c->Message(Chat::White, "Skill [%d] is at [%d] - %u", i, t->GetSkill(i), t->GetRawSkill(i)); } +void command_findrace(Client *c, const Seperator *sep) +{ + if (sep->arg[1][0] == 0) { + c->Message(Chat::White, "Usage: #findrace [race name]"); + } else if (Seperator::IsNumber(sep->argplus[1])) { + int search_id = atoi(sep->argplus[1]); + std::string race_name = GetRaceIDName(search_id); + if (race_name != std::string("")) { + c->Message(Chat::White, "Race %d: %s", search_id, race_name.c_str()); + return; + } + } else { + const char *search_criteria = sep->argplus[1]; + int found_count = 0; + char race_name[64]; + char search_string[65]; + strn0cpy(search_string, search_criteria, sizeof(search_string)); + strupr(search_string); + char *string_location; + for (int race_id = RACE_HUMAN_1; race_id <= RT_PEGASUS_3; race_id++) { + strn0cpy(race_name, GetRaceIDName(race_id), sizeof(race_name)); + strupr(race_name); + string_location = strstr(race_name, search_string); + if (string_location != nullptr) { + c->Message(Chat::White, "Race %d: %s", race_id, GetRaceIDName(race_id)); + found_count++; + } + + if (found_count == 20) { + break; + } + } + if (found_count == 20) { + c->Message(Chat::White, "20 Races found... max reached."); + } else { + c->Message(Chat::White, "%i Race(s) found.", found_count); + } + } +} + void command_findspell(Client *c, const Seperator *sep) { if (sep->arg[1][0] == 0) diff --git a/zone/command.h b/zone/command.h index 7c1af0edf..05c92eac4 100644 --- a/zone/command.h +++ b/zone/command.h @@ -101,6 +101,7 @@ void command_face(Client *c, const Seperator *sep); void command_faction(Client *c, const Seperator *sep); void command_findaliases(Client *c, const Seperator *sep); void command_findnpctype(Client *c, const Seperator *sep); +void command_findrace(Client *c, const Seperator *sep); void command_findspell(Client *c, const Seperator *sep); void command_findzone(Client *c, const Seperator *sep); void command_fixmob(Client *c, const Seperator *sep);