mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[Commands] Cleanup #serverinfo Command. (#2138)
* [Commands] Cleanup #serverinfo Command. - Cleanup message and logic. - Use popup instead of messages. * Update serverinfo.cpp
This commit is contained in:
parent
128e8ce08d
commit
a0ed0d57c5
@ -315,7 +315,7 @@ int command_init(void)
|
|||||||
command_add("scribespells", "[max level] [min level] - Scribe all spells for you or your player target that are usable by them, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_scribespells) ||
|
command_add("scribespells", "[max level] [min level] - Scribe all spells for you or your player target that are usable by them, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_scribespells) ||
|
||||||
command_add("sendzonespawns", "- Refresh spawn list for all clients in zone", AccountStatus::GMLeadAdmin, command_sendzonespawns) ||
|
command_add("sendzonespawns", "- Refresh spawn list for all clients in zone", AccountStatus::GMLeadAdmin, command_sendzonespawns) ||
|
||||||
command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", AccountStatus::Player, command_sensetrap) ||
|
command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", AccountStatus::Player, command_sensetrap) ||
|
||||||
command_add("serverinfo", "- Get OS info about server host", AccountStatus::GMMgmt, command_serverinfo) ||
|
command_add("serverinfo", "- Get CPU, Operating System, and Process Information about the server", AccountStatus::GMMgmt, command_serverinfo) ||
|
||||||
command_add("serverrules", "- Read this server's rules", AccountStatus::Player, command_serverrules) ||
|
command_add("serverrules", "- Read this server's rules", AccountStatus::Player, command_serverrules) ||
|
||||||
command_add("setaapts", "[AA|Group|Raid] [AA Amount] - Set your or your player target's Available AA Points by Type", AccountStatus::GMAdmin, command_setaapts) ||
|
command_add("setaapts", "[AA|Group|Raid] [AA Amount] - Set your or your player target's Available AA Points by Type", AccountStatus::GMAdmin, command_setaapts) ||
|
||||||
command_add("setaaxp", "[AA|Group|Raid] [AA Experience] - Set your or your player target's AA Experience by Type", AccountStatus::GMAdmin, command_setaaxp) ||
|
command_add("setaaxp", "[AA|Group|Raid] [AA Experience] - Set your or your player target's AA Experience by Type", AccountStatus::GMAdmin, command_setaaxp) ||
|
||||||
|
|||||||
@ -3,31 +3,96 @@
|
|||||||
|
|
||||||
void command_serverinfo(Client *c, const Seperator *sep)
|
void command_serverinfo(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
auto os = EQ::GetOS();
|
auto os = EQ::GetOS();
|
||||||
auto cpus = EQ::GetCPUs();
|
auto cpus = EQ::GetCPUs();
|
||||||
auto pid = EQ::GetPID();
|
auto process_id = EQ::GetPID();
|
||||||
auto rss = EQ::GetRSS();
|
auto rss = EQ::GetRSS() / 1048576.0;
|
||||||
auto uptime = EQ::GetUptime();
|
auto uptime = static_cast<uint32>(EQ::GetUptime());
|
||||||
|
|
||||||
c->Message(Chat::White, "Operating System Information");
|
std::string popup_text;
|
||||||
c->Message(Chat::White, "==================================================");
|
|
||||||
c->Message(Chat::White, "System: %s", os.sysname.c_str());
|
popup_text.append("<c \"#00FF00\">Operating System Information</c>");
|
||||||
c->Message(Chat::White, "Release: %s", os.release.c_str());
|
|
||||||
c->Message(Chat::White, "Version: %s", os.version.c_str());
|
popup_text.append("<table>");
|
||||||
c->Message(Chat::White, "Machine: %s", os.machine.c_str());
|
|
||||||
c->Message(Chat::White, "Uptime: %.2f seconds", uptime);
|
popup_text.append(
|
||||||
c->Message(Chat::White, "==================================================");
|
fmt::format(
|
||||||
c->Message(Chat::White, "CPU Information");
|
"<tr><td>System</td><td>{}</td></tr>",
|
||||||
c->Message(Chat::White, "==================================================");
|
os.sysname
|
||||||
for (size_t i = 0; i < cpus.size(); ++i) {
|
).c_str()
|
||||||
auto &cp = cpus[i];
|
);
|
||||||
c->Message(Chat::White, "CPU #%i: %s, Speed: %.2fGhz", i, cp.model.c_str(), cp.speed);
|
|
||||||
|
popup_text.append(
|
||||||
|
fmt::format(
|
||||||
|
"<tr><td>Release</td><td>{}</td></tr>",
|
||||||
|
os.release
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
popup_text.append(
|
||||||
|
fmt::format(
|
||||||
|
"<tr><td>Version</td><td>{}</td></tr>",
|
||||||
|
os.version
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
popup_text.append(
|
||||||
|
fmt::format(
|
||||||
|
"<tr><td>Machine</td><td>{}</td></tr>",
|
||||||
|
os.machine
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
popup_text.append(
|
||||||
|
fmt::format(
|
||||||
|
"<tr><td>Uptime</td><td>{}</td></tr>",
|
||||||
|
ConvertSecondsToTime(uptime)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
popup_text.append("</table>");
|
||||||
|
|
||||||
|
popup_text.append("<c \"#00FF00\">CPU Information</c>");
|
||||||
|
|
||||||
|
popup_text.append("<table>");
|
||||||
|
|
||||||
|
for (size_t cpu = 0; cpu < cpus.size(); ++cpu) {
|
||||||
|
auto ¤t_cpu = cpus[cpu];
|
||||||
|
popup_text.append(
|
||||||
|
fmt::format(
|
||||||
|
"<tr><td>CPU {}</td><td>{} ({:.2f}GHz)</td></tr>",
|
||||||
|
cpu,
|
||||||
|
current_cpu.model,
|
||||||
|
current_cpu.speed
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
c->Message(Chat::White, "==================================================");
|
|
||||||
c->Message(Chat::White, "Process Information");
|
popup_text.append("</table>");
|
||||||
c->Message(Chat::White, "==================================================");
|
|
||||||
c->Message(Chat::White, "PID: %u", pid);
|
popup_text.append("<c \"#00FF00\">Process Information</c>");
|
||||||
c->Message(Chat::White, "RSS: %.2f MB", rss / 1048576.0);
|
|
||||||
c->Message(Chat::White, "==================================================");
|
popup_text.append("<table>");
|
||||||
|
|
||||||
|
popup_text.append(
|
||||||
|
fmt::format(
|
||||||
|
"<tr><td>Process ID</td><td>{}</td></tr>",
|
||||||
|
process_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
popup_text.append(
|
||||||
|
fmt::format(
|
||||||
|
"<tr><td>RSS</td><td>{:.2f} MB</td></tr>",
|
||||||
|
rss
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
popup_text.append("</table>");
|
||||||
|
|
||||||
|
c->SendPopupToClient(
|
||||||
|
"Server Information",
|
||||||
|
popup_text.c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user