mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
[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:
@@ -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 ?
|
||||
|
||||
Reference in New Issue
Block a user