mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 00:01:28 +00:00
[Commands] Cleanup #lastname Command. (#1802)
- Cleanup message and logic.
This commit is contained in:
parent
8a27fce3a8
commit
03847fb1ac
@ -229,7 +229,7 @@ int command_init(void)
|
||||
command_add("kick", "[charname] - Disconnect charname", AccountStatus::GMLeadAdmin, command_kick) ||
|
||||
command_add("kill", "- Kill your target", AccountStatus::GMAdmin, command_kill) ||
|
||||
command_add("killallnpcs", " [npc_name] Kills all npcs by search name, leave blank for all attackable NPC's", AccountStatus::GMMgmt, command_killallnpcs) ||
|
||||
command_add("lastname", "[new lastname] - Set your or your player target's lastname", AccountStatus::Guide, command_lastname) ||
|
||||
command_add("lastname", "[Last Name] - Set you or your player target's lastname", AccountStatus::Guide, command_lastname) ||
|
||||
command_add("level", "[level] - Set your or your target's level", AccountStatus::Steward, command_level) ||
|
||||
command_add("list", "[npcs|players|corpses|doors|objects] [search] - Search entities", AccountStatus::ApprenticeGuide, command_list) ||
|
||||
command_add("listpetition", "- List petitions", AccountStatus::Guide, command_listpetition) ||
|
||||
|
||||
@ -2,18 +2,36 @@
|
||||
|
||||
void command_lastname(Client *c, const Seperator *sep)
|
||||
{
|
||||
Client *t = c;
|
||||
|
||||
Client *target = c;
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
t = c->GetTarget()->CastToClient();
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
LogInfo("#lastname request from [{}] for [{}]", c->GetName(), t->GetName());
|
||||
|
||||
if (strlen(sep->arg[1]) <= 70) {
|
||||
t->ChangeLastName(sep->arg[1]);
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Usage: #lastname <lastname> where <lastname> is less than 70 chars long");
|
||||
LogInfo("#lastname request from [{}] for [{}]", c->GetCleanName(), target->GetCleanName());
|
||||
|
||||
std::string last_name = sep->arg[1];
|
||||
if (last_name.size() > 64) {
|
||||
c->Message(Chat::White, "Usage: #lastname [Last Name] (Last Name must be 64 characters or less)");
|
||||
return;
|
||||
}
|
||||
|
||||
target->ChangeLastName(last_name.c_str());
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} now {} a last name of '{}'.",
|
||||
(
|
||||
c == target ?
|
||||
"You" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
c == target ? "have" : "has",
|
||||
last_name
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user