mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
* [Strings] Add more number formatters # Notes - Adds `Strings::ToUnsignedInt` for `uint32` support. - Adds `Strings::ToBigInt` for `int64` support. - Adds `Strings::ToUnsignedBigInt` for `uint64` support. - Adds `Strings::ToFloat` for `float` support. - Replaces all `std::stoi` references with `Strings::ToInt`. - Replaces all `atoi` references with `Strings::ToInt`. - Replaces all `std::stoul` references with `Strings::ToUnsignedInt`. - Replaces all `atoul` references with `Strings::ToUnsignedInt`. - Replaces all `std::stoll` references with `Strings::ToBigInt`. - Replaces all `atoll` references with `Strings::ToBigInt`. - Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `atoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `std::stof` references with `Strings::ToFloat`. * [Strings] Add more number formatters - Adds `Strings::ToUnsignedInt` for `uint32` support. - Adds `Strings::ToBigInt` for `int64` support. - Adds `Strings::ToUnsignedBigInt` for `uint64` support. - Adds `Strings::ToFloat` for `float` support. - Replaces all `std::stoi` references with `Strings::ToInt`. - Replaces all `atoi` references with `Strings::ToInt`. - Replaces all `std::stoul` references with `Strings::ToUnsignedInt`. - Replaces all `atoul` references with `Strings::ToUnsignedInt`. - Replaces all `std::stoll` references with `Strings::ToBigInt`. - Replaces all `atoll` references with `Strings::ToBigInt`. - Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `atoull` references with `Strings::ToUnsignedBigInt`. - Replaces all `std::stof` references with `Strings::ToFloat`. * Rebase cleanup * Changes/benchmarks/tests --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
47 lines
1.3 KiB
C++
Executable File
47 lines
1.3 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>(Strings::ToUnsignedInt(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.");
|
|
}
|
|
}
|
|
}
|
|
|