mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Commands] Cleanup #level Command (#3045)
# Notes - Cleanup messages and logic. - Defaults target to GM so that you don't have to target yourself to use the command.
This commit is contained in:
parent
b6497cdd6a
commit
8393e50aa8
@ -198,7 +198,7 @@ int command_init(void)
|
|||||||
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", "[Last Name] - Set your or your player target's last name (use \"-1\" to remove last name)", AccountStatus::Guide, command_lastname) ||
|
command_add("lastname", "[Last Name] - Set your or your player target's last name (use \"-1\" to remove last name)", AccountStatus::Guide, command_lastname) ||
|
||||||
command_add("level", "[Level] - Set 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) ||
|
||||||
command_add("lootsim", "[npc_type_id] [loottable_id] [iterations] - Runs benchmark simulations using real loot logic to report numbers and data", AccountStatus::GMImpossible, command_lootsim) ||
|
command_add("lootsim", "[npc_type_id] [loottable_id] [iterations] - Runs benchmark simulations using real loot logic to report numbers and data", AccountStatus::GMImpossible, command_lootsim) ||
|
||||||
|
|||||||
@ -2,22 +2,21 @@
|
|||||||
|
|
||||||
void command_level(Client *c, const Seperator *sep)
|
void command_level(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
int arguments = sep->argnum;
|
const auto arguments = sep->argnum;
|
||||||
if (!arguments || !sep->IsNumber(1)) {
|
if (!arguments || !sep->IsNumber(1)) {
|
||||||
c->Message(Chat::White, "Usage: #level [Level]");
|
c->Message(Chat::White, "Usage: #level [Level]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto target = c->GetTarget();
|
Mob* t = c;
|
||||||
if (!target) {
|
if (c->GetTarget()) {
|
||||||
c->Message(Chat::White, "You must have a target to use this command.");
|
t = c->GetTarget();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto level = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
auto level = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||||
auto max_level = static_cast<uint8>(RuleI(Character, MaxLevel));
|
auto max_level = static_cast<uint8>(RuleI(Character, MaxLevel));
|
||||||
|
|
||||||
if (c->Admin() < RuleI(GM, MinStatusToLevelTarget)) {
|
if (c != t && c->Admin() < RuleI(GM, MinStatusToLevelTarget)) {
|
||||||
c->Message(Chat::White, "Your status is not high enough to change another person's level.");
|
c->Message(Chat::White, "Your status is not high enough to change another person's level.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -37,12 +36,12 @@ void command_level(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
target->SetLevel(level, true);
|
t->SetLevel(level, true);
|
||||||
if (target->IsClient()) {
|
if (t->IsClient()) {
|
||||||
target->CastToClient()->SendLevelAppearance();
|
t->CastToClient()->SendLevelAppearance();
|
||||||
|
|
||||||
if (RuleB(Bots, Enabled) && RuleB(Bots, BotLevelsWithOwner)) {
|
if (RuleB(Bots, Enabled) && RuleB(Bots, BotLevelsWithOwner)) {
|
||||||
Bot::LevelBotWithClient(target->CastToClient(), level, true);
|
Bot::LevelBotWithClient(t->CastToClient(), level, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user