mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-18 06:32:25 +00:00
[Commands] Cleanup #setskillall Command. (#1992)
- Cleanup messages and logic.
This commit is contained in:
parent
3f0987ba55
commit
6303f129af
@ -339,7 +339,7 @@ int command_init(void)
|
||||
command_add("setpass", "[accountname] [password] - Set local password for accountname", AccountStatus::GMLeadAdmin, command_setpass) ||
|
||||
command_add("setpvppoints", "[Amount] - Set your or your player target's PVP points", AccountStatus::GMAdmin, command_setpvppoints) ||
|
||||
command_add("setskill", "[skillnum] [value] - Set your target's skill skillnum to value", AccountStatus::Guide, command_setskill) ||
|
||||
command_add("setskillall", "[value] - Set all of your target's skills to value", AccountStatus::Guide, command_setskillall) ||
|
||||
command_add("setskillall", "[Skill Level] - Set all of your or your target's skills to the specified skill level", AccountStatus::Guide, command_setskillall) ||
|
||||
command_add("setstartzone", "[Zone ID|Zone Short Name] - Sets your or your target's starting zone (Use '0' or 'Reset' to allow the player use of /setstartcity)", AccountStatus::QuestTroupe, command_setstartzone) ||
|
||||
command_add("setstat", "- Sets the stats to a specific value.", AccountStatus::Max, command_setstat) ||
|
||||
command_add("setxp", "[value] - Set your or your player target's experience", AccountStatus::GMAdmin, command_setxp) ||
|
||||
|
||||
@ -2,28 +2,50 @@
|
||||
|
||||
void command_setskillall(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (c->GetTarget() == 0) {
|
||||
c->Message(Chat::White, "Error: #setallskill: No target.");
|
||||
auto target = c;
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
else if (!c->GetTarget()->IsClient()) {
|
||||
c->Message(Chat::White, "Error: #setskill: Target must be a client.");
|
||||
}
|
||||
else if (!sep->IsNumber(1) || atoi(sep->arg[1]) < 0 || atoi(sep->arg[1]) > HIGHEST_CAN_SET_SKILL) {
|
||||
c->Message(Chat::White, "Usage: #setskillall value ");
|
||||
c->Message(Chat::White, " value = 0 to %d", HIGHEST_CAN_SET_SKILL);
|
||||
}
|
||||
else {
|
||||
if (c->Admin() >= commandSetSkillsOther || c->GetTarget() == c || c->GetTarget() == 0) {
|
||||
LogInfo("Set ALL skill request from [{}], target:[{}]", c->GetName(), c->GetTarget()->GetName());
|
||||
uint16 level = atoi(sep->arg[1]);
|
||||
for (EQ::skills::SkillType skill_num = EQ::skills::Skill1HBlunt;
|
||||
skill_num <= EQ::skills::HIGHEST_SKILL;
|
||||
skill_num = (EQ::skills::SkillType) (skill_num + 1)) {
|
||||
c->GetTarget()->CastToClient()->SetSkill(skill_num, level);
|
||||
|
||||
if (!sep->IsNumber(1)) {
|
||||
c->Message(Chat::White, "Usage: #setskillall [Skill Level] - Set all of your or your target's skills to the specified skill level");
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Note: Skill Level ranges from 0 to {}",
|
||||
HIGHEST_CAN_SET_SKILL
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
if (c->Admin() >= commandSetSkillsOther || c->GetTarget() == c) {
|
||||
LogInfo(
|
||||
"Set ALL skill request from [{}], target:[{}]",
|
||||
c->GetCleanName(),
|
||||
target->GetCleanName()
|
||||
);
|
||||
|
||||
auto skill_level = static_cast<uint16>(std::stoul(sep->arg[1]));
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Setting all skills to {} for {}.",
|
||||
skill_level,
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
for (EQ::skills::SkillType skill_num = EQ::skills::Skill1HBlunt; skill_num <= EQ::skills::HIGHEST_SKILL; skill_num = (EQ::skills::SkillType) (skill_num + 1)) {
|
||||
target->SetSkill(skill_num, skill_level);
|
||||
}
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Error: Your status is not high enough to set anothers skills");
|
||||
} else {
|
||||
c->Message(Chat::White, "Your status is not high enough to set another player's skills.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user