[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
+17 -6
View File
@@ -9,20 +9,31 @@ void command_lastname(Client *c, const Seperator *sep)
LogInfo("#lastname request from [{}] for [{}]", c->GetCleanName(), target->GetCleanName());
std::string last_name = sep->arg[1];
bool is_remove = !strcasecmp(sep->argplus[1], "-1");
std::string last_name = is_remove ? "" : sep->argplus[1];
if (last_name.size() > 64) {
c->Message(Chat::White, "Usage: #lastname [Last Name] (Last Name must be 64 characters or less)");
c->Message(Chat::White, "Last name must be 64 characters or less.");
return;
}
target->ChangeLastName(last_name);
c->Message(
Chat::White,
fmt::format(
"{} now {} a last name of '{}'.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
last_name
"Last name has been {}{} for {}{}",
is_remove ? "removed" : "changed",
!is_remove ? " and saved" : "",
c->GetTargetDescription(target),
(
is_remove ?
"." :
fmt::format(
" to '{}'.",
last_name
)
)
).c_str()
);
}