mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Commands] Cleanup #camerashake Command. (#1787)
- Cleanup message and logic. - Fix ConvertSecondsToTime logic for milliseconds. - Add ConvertMillisecondsToTime inline function.
This commit is contained in:
+1
-1
@@ -133,7 +133,7 @@ int command_init(void)
|
||||
command_add("bot", "- Type \"#bot help\" or \"^help\" to the see the list of available commands for bots.", AccountStatus::Player, command_bot) ||
|
||||
#endif
|
||||
|
||||
command_add("camerashake", "Shakes the camera on everyone's screen globally.", AccountStatus::QuestTroupe, command_camerashake) ||
|
||||
command_add("camerashake", "[Duration (Milliseconds)] [Intensity (1-10)] - Shakes the camera on everyone's screen globally.", AccountStatus::QuestTroupe, command_camerashake) ||
|
||||
command_add("castspell", "[Spell ID] [Instant (0 = False, 1 = True, Default is 1 if Unused)] - Cast a spell", AccountStatus::Guide, command_castspell) ||
|
||||
command_add("chat", "[channel num] [message] - Send a channel message to all zones", AccountStatus::GMMgmt, command_chat) ||
|
||||
command_add("checklos", "- Check for line of sight to your target", AccountStatus::Guide, command_checklos) ||
|
||||
|
||||
@@ -5,20 +5,29 @@ extern WorldServer worldserver;
|
||||
|
||||
void command_camerashake(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (c) {
|
||||
if (sep->arg[1][0] && sep->arg[2][0]) {
|
||||
auto pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct));
|
||||
ServerCameraShake_Struct *scss = (ServerCameraShake_Struct *) pack->pBuffer;
|
||||
scss->duration = atoi(sep->arg[1]);
|
||||
scss->intensity = atoi(sep->arg[2]);
|
||||
worldserver.SendPacket(pack);
|
||||
c->Message(Chat::Red, "Successfully sent the packet to world! Shake it, world, shake it!");
|
||||
safe_delete(pack);
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::Red, "Usage -- #camerashake [duration], [intensity [1-10])");
|
||||
}
|
||||
int arguments = sep->argnum;
|
||||
if (!arguments || !sep->IsNumber(1) || !sep->IsNumber(2)) {
|
||||
c->Message(Chat::Red, "Usage: #camerashake [Duration (Milliseconds)] [Intensity (1-10)]");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
auto duration = std::stoi(sep->arg[1]);
|
||||
auto intensity = std::stoi(sep->arg[2]);
|
||||
|
||||
auto pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct));
|
||||
ServerCameraShake_Struct *camera_shake = (ServerCameraShake_Struct *) pack->pBuffer;
|
||||
camera_shake->duration = duration;
|
||||
camera_shake->intensity = intensity;
|
||||
worldserver.SendPacket(pack);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Sending camera shake to world with a duration of {} ({}) and an intensity of {}.",
|
||||
ConvertMillisecondsToTime(duration),
|
||||
duration,
|
||||
intensity
|
||||
).c_str()
|
||||
);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ void command_stun(Client *c, const Seperator *sep)
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
ConvertSecondsToTime(duration)
|
||||
ConvertMillisecondsToTime(duration)
|
||||
) :
|
||||
fmt::format(
|
||||
"You unstunned {}.",
|
||||
|
||||
@@ -826,7 +826,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
ServerUptime_Struct* sus = (ServerUptime_Struct*)pack->pBuffer;
|
||||
uint32 ms = Timer::GetCurrentTime();
|
||||
std::string time_string = ConvertSecondsToTime(ms);
|
||||
std::string time_string = ConvertMillisecondsToTime(ms);
|
||||
SendEmoteMessage(
|
||||
sus->adminname,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user