mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-11 13:02: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("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("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("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("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("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) ||
|
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)
|
void command_setskillall(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
if (c->GetTarget() == 0) {
|
auto target = c;
|
||||||
c->Message(Chat::White, "Error: #setallskill: No target.");
|
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.");
|
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");
|
||||||
else if (!sep->IsNumber(1) || atoi(sep->arg[1]) < 0 || atoi(sep->arg[1]) > HIGHEST_CAN_SET_SKILL) {
|
c->Message(
|
||||||
c->Message(Chat::White, "Usage: #setskillall value ");
|
Chat::White,
|
||||||
c->Message(Chat::White, " value = 0 to %d", HIGHEST_CAN_SET_SKILL);
|
fmt::format(
|
||||||
}
|
"Note: Skill Level ranges from 0 to {}",
|
||||||
else {
|
HIGHEST_CAN_SET_SKILL
|
||||||
if (c->Admin() >= commandSetSkillsOther || c->GetTarget() == c || c->GetTarget() == 0) {
|
).c_str()
|
||||||
LogInfo("Set ALL skill request from [{}], target:[{}]", c->GetName(), c->GetTarget()->GetName());
|
);
|
||||||
uint16 level = atoi(sep->arg[1]);
|
} else {
|
||||||
for (EQ::skills::SkillType skill_num = EQ::skills::Skill1HBlunt;
|
if (c->Admin() >= commandSetSkillsOther || c->GetTarget() == c) {
|
||||||
skill_num <= EQ::skills::HIGHEST_SKILL;
|
LogInfo(
|
||||||
skill_num = (EQ::skills::SkillType) (skill_num + 1)) {
|
"Set ALL skill request from [{}], target:[{}]",
|
||||||
c->GetTarget()->CastToClient()->SetSkill(skill_num, level);
|
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 {
|
||||||
else {
|
c->Message(Chat::White, "Your status is not high enough to set another player's skills.");
|
||||||
c->Message(Chat::White, "Error: Your status is not high enough to set anothers skills");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user