mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-17 18:41:29 +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("kick", "[charname] - Disconnect charname", AccountStatus::GMLeadAdmin, command_kick) ||
|
||||||
command_add("kill", "- Kill your target", AccountStatus::GMAdmin, command_kill) ||
|
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("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("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("list", "[npcs|players|corpses|doors|objects] [search] - Search entities", AccountStatus::ApprenticeGuide, command_list) ||
|
||||||
command_add("listpetition", "- List petitions", AccountStatus::Guide, command_listpetition) ||
|
command_add("listpetition", "- List petitions", AccountStatus::Guide, command_listpetition) ||
|
||||||
|
|||||||
@ -2,18 +2,36 @@
|
|||||||
|
|
||||||
void command_lastname(Client *c, const Seperator *sep)
|
void command_lastname(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
Client *t = c;
|
Client *target = c;
|
||||||
|
|
||||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||||
t = c->GetTarget()->CastToClient();
|
target = c->GetTarget()->CastToClient();
|
||||||
}
|
}
|
||||||
LogInfo("#lastname request from [{}] for [{}]", c->GetName(), t->GetName());
|
|
||||||
|
LogInfo("#lastname request from [{}] for [{}]", c->GetCleanName(), target->GetCleanName());
|
||||||
if (strlen(sep->arg[1]) <= 70) {
|
|
||||||
t->ChangeLastName(sep->arg[1]);
|
std::string last_name = sep->arg[1];
|
||||||
}
|
if (last_name.size() > 64) {
|
||||||
else {
|
c->Message(Chat::White, "Usage: #lastname [Last Name] (Last Name must be 64 characters or less)");
|
||||||
c->Message(Chat::White, "Usage: #lastname <lastname> where <lastname> is less than 70 chars long");
|
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