eqemu-server/zone/gm_commands/setskillall.cpp
Kinglykrab 7df9b2974b
[Commands] Cleanup #reloadzps Command. (#2129)
* [Commands] Cleanup #reloadzps Command.
- Cleanup messages and logic.
- Make reloading of zone points global instead of zone specific.

* Further cleanup.
- Add zone->GetZoneDescription().
- Add mob->GetTargetDescription(mob).

* Final cleanup.

* Typo.
2022-05-07 03:23:15 -04:00

47 lines
1.2 KiB
C++
Executable File

#include "../client.h"
void command_setskillall(Client *c, const Seperator *sep)
{
auto target = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
}
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(),
c->GetTargetDescription(target)
);
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->GetTargetDescription(target)
).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, "Your status is not high enough to set another player's skills.");
}
}
}