[Commands] Cleanup #npcedit, #lastname, #title, and #titlesuffix Commands. (#2215)

* [Commands] Cleanup #lastname, #npcedit, #title, and #titlesuffix Commands.
- Cleanup messages and logic.

* Update emu_constants.h

* Update command.cpp

* Update command.cpp

* Cleanup of GetXName methods to not define map unnecessarily.

* Update emu_constants.cpp

* Update npcedit.cpp
This commit is contained in:
Kinglykrab
2022-05-28 14:35:05 -04:00
committed by GitHub
parent 7de50d0e60
commit c8f6dbb86d
7 changed files with 2577 additions and 1358 deletions
+6 -10
View File
@@ -5,16 +5,12 @@ void command_title(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
if (!arguments) {
c->Message(
Chat::White,
"Usage: #title [Remove|Title] [Save (0 = False, 1 = True)]"
);
c->Message(Chat::White, "Usage: #title [Title] (use \"-1\" to remove title)");
return;
}
bool is_remove = !strcasecmp(sep->arg[1], "remove");
std::string title = is_remove ? "" : sep->arg[1];
bool save_title = sep->IsNumber(2) ? atobool(sep->arg[2]) : false;
bool is_remove = !strcasecmp(sep->argplus[1], "-1");
std::string title = is_remove ? "" : sep->argplus[1];
auto target = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
@@ -30,9 +26,9 @@ void command_title(Client *c, const Seperator *sep)
find_replace(title, "_", " ");
}
if (!save_title || is_remove) {
if (is_remove) {
target->SetAATitle(title);
} else if (save_title) {
} else {
title_manager.CreateNewPlayerTitle(target, title);
}
@@ -43,7 +39,7 @@ void command_title(Client *c, const Seperator *sep)
fmt::format(
"Title has been {}{} for {}{}",
is_remove ? "removed" : "changed",
!is_remove && save_title ? " and saved" : "",
!is_remove ? " and saved" : "",
c->GetTargetDescription(target),
(
is_remove ?