mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +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>
58 lines
1.4 KiB
C++
Executable File
58 lines
1.4 KiB
C++
Executable File
#include "../client.h"
|
|
|
|
void command_texture(Client *c, const Seperator *sep)
|
|
{
|
|
int arguments = sep->argnum;
|
|
if (!arguments || !sep->IsNumber(1)) {
|
|
c->Message(Chat::White, "Usage: #texture [Texture] [Helmet Texture]");
|
|
return;
|
|
}
|
|
|
|
auto texture = static_cast<uint16>(std::min(Strings::ToUnsignedInt(sep->arg[1]), (uint32) 65535));
|
|
auto helmet_texture = static_cast<uint8>(
|
|
sep->IsNumber(2) ?
|
|
std::min(Strings::ToUnsignedInt(sep->arg[2]), (uint32) 255) :
|
|
0
|
|
);
|
|
|
|
Mob* target = c;
|
|
if (c->GetTarget() && c->Admin() >= commandTextureOthers) {
|
|
target = c->GetTarget();
|
|
}
|
|
|
|
if (Mob::IsPlayerRace(target->GetModel())) { // Player Races Wear Armor, so Wearchange is sent instead
|
|
for (
|
|
int texture_slot = EQ::textures::textureBegin;
|
|
texture_slot <= EQ::textures::LastTintableTexture;
|
|
texture_slot++
|
|
) {
|
|
target->SendTextureWC(texture_slot, texture);
|
|
}
|
|
} else { // Non-Player Races only need Illusion Packets to be sent for texture
|
|
target->SendIllusionPacket(
|
|
target->GetModel(),
|
|
target->GetGender(),
|
|
texture,
|
|
helmet_texture
|
|
);
|
|
}
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Texture Changed for {} | Texture: {}{}",
|
|
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
|
|
texture,
|
|
(
|
|
Mob::IsPlayerRace(target->GetModel()) ?
|
|
"" :
|
|
fmt::format(
|
|
" Helmet Texture: {}",
|
|
helmet_texture
|
|
)
|
|
)
|
|
).c_str()
|
|
);
|
|
}
|
|
|