mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
* [Commands] Cleanup #appearance Command # Notes - Cleanup messages and logic. - Cleanup appearance type constants to use a namespace with constexpr instead. - Cleanup animation constants to use a namespace with constexpr instead. * Update emu_constants.cpp * Cleanup
70 lines
1.4 KiB
C++
Executable File
70 lines
1.4 KiB
C++
Executable File
#include "../../client.h"
|
|
#include "../../../common/data_verification.h"
|
|
|
|
void SetFlymode(Client *c, const Seperator *sep)
|
|
{
|
|
const auto arguments = sep->argnum;
|
|
if (arguments < 2 || !sep->IsNumber(2)) {
|
|
c->Message(Chat::White, "Usage: #set flymode [Flymode ID]");
|
|
|
|
for (const auto& e : EQ::constants::GetFlyModeMap()) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Flymode {} | {}",
|
|
e.first,
|
|
e.second
|
|
).c_str()
|
|
);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
Mob* t = c;
|
|
if (c->GetTarget()) {
|
|
t = c->GetTarget();
|
|
}
|
|
|
|
const int8 flymode_id = Strings::ToInt(sep->arg[2]);
|
|
if (
|
|
!EQ::ValueWithin(
|
|
flymode_id,
|
|
EQ::constants::GravityBehavior::Ground,
|
|
EQ::constants::GravityBehavior::LevitateWhileRunning
|
|
)
|
|
) {
|
|
c->Message(Chat::White, "Usage: #set flymode [Flymode ID]");
|
|
|
|
for (const auto& e : EQ::constants::GetFlyModeMap()) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Flymode {} | {}",
|
|
e.first,
|
|
e.second
|
|
).c_str()
|
|
);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
t->SetFlyMode(static_cast<GravityBehavior>(flymode_id));
|
|
t->SendAppearancePacket(AppearanceType::FlyMode, flymode_id);
|
|
|
|
const uint32 account = c->AccountID();
|
|
|
|
database.SetGMFlymode(account, flymode_id);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Fly Mode for {} is now {} ({}).",
|
|
c->GetTargetDescription(t),
|
|
EQ::constants::GetFlyModeName(flymode_id),
|
|
flymode_id
|
|
).c_str()
|
|
);
|
|
}
|