32 #include "../eve-common/EVEVersion.h"
61 sLog.Blue(
" ConsoleCommand",
"Console Commands Initialized." );
62 sLog.Yellow(
" ConsoleCommand",
"Enter 'h' for current list of supported commands." );
76 select(1, &
fds,
nullptr,
nullptr, &
tv);
77 if (!FD_ISSET(0, &
fds)) {
82 if (strncmp(
buf,
"x", 1) == 0) {
83 sLog.Warning(
" EVEmu",
"EXIT called. Breaking out of Main Loop.");
87 }
else if (strncmp(
buf,
"h", 1) == 0) {
88 sLog.Green(
" EVEmu",
"Current Console Commands and Descriptions: ");
90 sLog.Warning(
" (h)elp",
" Displays this dialog.");
91 sLog.Warning(
" h(e)llo",
" Displays the 'Hello World' message.");
92 sLog.Warning(
" e(x)it",
" Exits the server, saving all loaded items and loging out all connected clients.");
93 sLog.Warning(
" (c)lients",
" Displays connected clients, showing account, character, and ip.");
94 sLog.Warning(
" (s)tatus",
" Displays Server's System Status, showing threads, memory, and cpu time.");
95 sLog.Warning(
" (v)ersion",
" Displays server version.");
96 sLog.Warning(
" (i)nformation",
" Displays server information: version, memory, uptime, clients, items, systems, bubbles.");
97 sLog.Warning(
" s(a)ve",
" Immediatly saves all loaded items. *Broken*");
98 sLog.Warning(
" (b)roadcast",
" Broadcasts a message to all clients thru the LocalChat window. *Not Implemented*");
99 sLog.Warning(
" (n)ote",
" Broadcasts a message to all clients thru a notification window.");
100 sLog.Warning(
" (m)essage",
" Broadcasts a message to all clients thru a message window.");
101 sLog.Warning(
" (p)rofile",
" Prints a profile of current server runtimes. *Incomplete*");
102 sLog.Warning(
" r(o)les",
" Prints a list of common roles and their values.");
103 sLog.Warning(
" c(o)mmands",
" Prints a list of currently loaded Commands and their required role. (long list)");
104 sLog.Warning(
" (t)est",
" Prints the current test object *varies*");
105 sLog.Warning(
" e(f)fects",
" Compiles and prints all item effects.");
106 sLog.Warning(
" threa(d)s",
" Prints a list of current threads.");
107 sLog.Warning(
" reload (l)ogs",
" Reloads log.ini to change values without restarting server.");
108 sLog.Warning(
"(q)uery stat data",
" Prints current statistic data.");
109 sLog.Warning(
" hea(r) all",
" Echo all chat msgs to console. *Not Implemented*");
110 }
else if (strncmp(
buf,
"e", 1) == 0) {
111 sLog.Green(
" EVEmu",
"Server Hello:");
112 sLog.Magenta(
" Server Says",
" Hello World!" );
113 }
else if (strncmp(
buf,
"c", 1) == 0) {
114 sLog.Green(
" EVEmu",
"Client Connection Information");
116 sLog.Warning(
" Connections",
" %u Current Clients Online", clients);
117 sLog.Warning(
" Connections",
" %u Clients Connected since startup.",
sEntityList.GetConnections() );
119 std::vector<Client*> list;
121 for (
auto cur : list) {
122 if (cur->GetChar().get() ==
nullptr) {
123 sLog.Magenta(
" Connections",
" Account %u Connected, but no character selected yet.", cur->GetUserID() );
126 sLog.Warning(
" Connections",
" [(%u)%u] %s in %s(%u). %u Minutes Online.", \
127 cur->GetUserID(), cur->GetCharacterID(), cur->GetName(), \
128 cur->GetSystemName().c_str(), cur->GetLocationID(), cur->GetChar()->OnlineTime() );
131 }
else if (strncmp(
buf,
"s", 1) == 0) {
132 std::string
state =
"";
134 uint8 aThreads = std::thread::hardware_concurrency();
135 float vm(0.0f), rss(0.0f), user(0.0f), kernel(0.0f);
136 Status(state, threads, vm, rss, user, kernel);
137 sLog.Warning(
" Server Status",
" S: %s | T: %d(%u) | RSS: %.3fMb | VM: %.3fMb | U: %.2f | K: %.2f", \
138 state.data(), threads, aThreads, rss, vm, user, kernel );
139 sLog.Warning(
" Connections",
" %u Current Clients Online.",
sEntityList.GetClientCount());
140 sLog.Warning(
" Connections",
" %u Clients Connected since startup.",
sEntityList.GetConnections() );
141 if (
sConfig.debug.UseProfiling) {
142 sLog.Green(
" Server Profiling",
"Enabled.");
144 sLog.Warning(
" Server Profiling",
"Disabled.");
146 if (
sConfig.npc.StaticSpawns) {
147 sLog.Green(
" Static Spawns",
"Enabled.");
149 sLog.Warning(
" Static Spawns",
"Disabled.");
151 if (
sConfig.npc.RoamingSpawns) {
152 sLog.Green(
" Roaming Spawns",
"Enabled.");
154 sLog.Warning(
" Roaming Spawns",
"Disabled.");
156 if (
sConfig.rates.secRate != 1.0) {
157 sLog.Green(
" SecStatus",
"Enabled at %.0f%%.", (
sConfig.rates.secRate *100) );
159 sLog.Warning(
" SecStatus",
"Normal.");
161 if (
sConfig.rates.npcBountyMultiply != 1.0) {
162 sLog.Green(
" Bountys",
"Enabled at %.0f%%.", (
sConfig.rates.npcBountyMultiply *100) );
164 sLog.Warning(
" Bountys",
"Normal.");
166 if (
sConfig.rates.damageRate != 1.0) {
167 sLog.Green(
" All Damages",
"Enabled at %.0f%%.", (
sConfig.rates.damageRate *100) );
169 sLog.Warning(
" All Damages",
"Normal.");
171 if (
sConfig.rates.missileRoF != 1.0) {
172 sLog.Green(
" Missile Dmg",
"Enabled at %.0f%%.", (
sConfig.rates.missileRoF *100) );
174 sLog.Warning(
" Missile Dmg",
"Normal.");
176 if (
sConfig.rates.turretRoF != 1.0) {
177 sLog.Green(
" Turret Dmg",
"Enabled at %.0f%%.", (
sConfig.rates.turretRoF *100) );
179 sLog.Warning(
" Turret Dmg",
"Normal.");
181 }
else if (strncmp(
buf,
"v", 1) == 0) {
182 sLog.Green(
" EVEmu",
"Server Version:");
185 }
else if (strncmp(
buf,
"i", 1) == 0) {
186 sLog.Green(
" EVEmu",
"Server Information:");
190 std::string
state =
"";
192 uint8 aThreads = std::thread::hardware_concurrency();
193 float vm(0.0f), rss(0.0f), user(0.0f), kernel(0.0f);
194 Status(state, threads, vm, rss, user, kernel);
195 sLog.Warning(
" Memory Usage",
" RSS: %.3fMb VM: %.3fMb", rss, vm );
196 sLog.Warning(
" Server Status",
" S: %s | T: %li(%u) | U: %.2f | K: %.2f", \
197 state.data(), threads, aThreads, user, kernel );
200 sLog.Warning(
" Server UpTime",
" %s", uptime.c_str() );
208 sLog.Warning(
" Active Stations",
" %u",
sEntityList.GetStationCount());
212 sLog.Warning(
" Connections",
" %u Current Clients Online.",
sEntityList.GetClientCount());
213 sLog.Warning(
" Connections",
" %u Clients Connected since startup.",
sEntityList.GetConnections() );
214 }
else if (strncmp(
buf,
"a", 1) == 0) {
215 sLog.Green(
" EVEmu",
"Server SaveAll:");
218 }
else if (strncmp(
buf,
"b", 1) == 0) {
219 sLog.Green(
" EVEmu",
"Server Broadcast:");
220 sLog.Error(
" Server Broadcast",
" Not Available Yet." );
224 }
else if (strncmp(
buf,
"n", 1) == 0) {
225 sLog.Green(
" EVEmu",
"Server Notify:");
226 const char* buff =
buf + 2;
227 std::vector<Client*> list;
229 for (
auto cur : list)
230 cur->SendNotifyMsg( buff );
231 sLog.Warning(
" Console Command",
" Notification sent to all online clients." );
232 }
else if (strncmp(
buf,
"m", 1) == 0) {
233 sLog.Green(
" EVEmu",
"Server Modal Message:");
234 const char* buff =
buf + 2;
235 std::vector<Client*> list;
237 for (
auto cur : list)
238 cur->SendInfoModalMsg( buff );
239 sLog.Warning(
" Console Command",
" Modal Message sent to all online clients." );
240 }
else if (strncmp(
buf,
"p", 1) == 0) {
241 sLog.Green(
" EVEmu",
"Server Profile:");
242 if (
sConfig.debug.UseProfiling) {
246 sLog.Warning(
" Server UpTime",
" %s", uptime.c_str() );
247 sLog.Warning(
" Connections",
" %u Current Clients Online.",
sEntityList.GetClientCount());
248 sLog.Warning(
" Connections",
" %u Clients Connected since startup.",
sEntityList.GetConnections() );
251 sLog.Error(
" Server Profile",
"Profiling is turned off.");
253 }
else if (strncmp(
buf,
"r", 1) == 0) {
255 }
else if (strncmp(
buf,
"o", 1) == 0) {
256 sLog.Green(
" EVEmu",
"Common Account Roles:");
266 sLog.Green(
" EVEmu",
"Common Corp Roles:");
273 }
else if (strncmp(
buf,
"o", 1) == 0) {
275 }
else if (strncmp(
buf,
"t", 1) == 0) {
277 }
else if (strncmp(
buf,
"f", 1) == 0) {
279 char& num(args.at(1));
281 }
else if (strncmp(
buf,
"d", 1) == 0) {
284 sLog.Blue(
" Active Threads",
"There are %u active threads running in the server.", count);
285 if (count > maxCount) {
286 sLog.Warning(
" Active Threads",
"Individual thread IDs are not displayed for more than %u active threads.", maxCount);
290 }
else if (strncmp(
buf,
"l", 1) == 0) {
296 sLog.Green(
" EVEmu",
"Log settings reloaded from %s",
sConfig.files.logSettings.c_str() );
302 sLog.Warning(
" EVEmu",
"Unable to reload settings from %s",
sConfig.files.logSettings.c_str() );
304 }
else if (strncmp(
buf,
"q", 1) == 0) {
305 sLog.Green(
" EVEmu",
"Server Statistic Data:");
308 sLog.Error(
" EVEmu",
"Command not recognized: %s",
buf);
324 std::string ignore =
"", run_state =
"";
325 int64 num_threads(0);
328 float utime(0.0f), stime(0.0f);
331 std::ifstream ifs (
"/proc/self/stat", std::ios_base::in);
332 ifs >> ignore >> ignore >> run_state >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore >> ignore
333 >> ignore >> ignore >> ignore >> utime >> stime >> ignore >> ignore >> ignore >> ignore >> num_threads
334 >> ignore >> ignore >> vsize >> rss;
337 if (
sConfig.debug.IsTestServer)
338 _log(SERVER__INFO,
"ConsoleCommand::Status() proc/self/stat returns RSS: %li, VM: %li", rss, vsize);
349 threads = num_threads;
350 user = utime / sysconf(_SC_CLK_TCK) / 100.0f;
351 kernel = stime / sysconf(_SC_CLK_TCK) / 100.0f;
352 vm_usage = ((vsize / sysconf(_SC_PAGE_SIZE)) / 1024.0f / 6);
354 resident_set = (rss * (sysconf(_SC_PAGE_SIZE) / 1024.0f) / 1024.0f);
359 sLog.Green(
" EVEmu",
"Running Server Test Code:");
374 std::string
state =
"";
376 float vm(0.0f), rss(0.0f), user(0.0f), kernel(0.0f);
377 Status(state, threads, vm, rss, user, kernel);
378 if (
sConfig.debug.IsTestServer)
379 _log(SERVER__INFO,
"Current Mem usage - RSS: %f, VM: %f", rss, vm);
387 sLog.Green(
" EVEmu",
"FxProcess(%u)", idx);
390 std::map<uint16, std::string> typeIDs;
393 sLog.Green(
" FxProcess",
"Parsing Effects for Module Items.");
398 sLog.Green(
" FxProcess",
"Parsing Effects for Charge Items.");
403 sLog.Green(
" FxProcess",
"Parsing Effects for Subsystem Items.");
408 sLog.Green(
" FxProcess",
"Parsing Effects for Skill Items.");
413 sLog.Green(
" FxProcess",
"Parsing Effects for Implant Items.");
418 sLog.Green(
" FxProcess",
"Parsing Effects for Ship Items.");
423 sLog.Green(
" FxProcess",
"Parsing Effects for All Possible Items.");
433 sLog.Green(
" FxProcess",
"Usage of Item Fx process reporting.");
434 sLog.Green(
" FxProcess",
"fx where 'x' is a number corresponding to the item category you wish to process.");
435 sLog.Green(
" FxProcess",
"1=Modules, 2=Charges, 3=Subsystems, 4=Skills, 5=Implants/Boosters, 6=Ships, 9=all");
440 for (
auto cur : typeIDs) {
441 sLog.Yellow(
"CC::FxProc",
"Processing %s (%u)", cur.second.c_str(), cur.first);
443 std::vector< TypeEffects > typeEffMap;
444 sFxDataMgr.GetTypeEffect(cur.first, typeEffMap);
445 for (
auto cur2: typeEffMap)
446 sFxProc.DecodeEffects(cur2.effectID);
#define sConfig
A macro for easier access to the singleton.
CommandDispatcher * pCommand
#define _log(type, fmt,...)
bool load_log_settings(const char *filename)
static void SaveServerStats(double threads, float rss, float vm, float user, float kernel, uint32 items, uint32 bubbles)
#define is_log_enabled(type)
#define sLog
Evaluates to a NewLog instance.
void Status(std::string &state, int64 &threads, float &vm_usage, float &resident_set, float &user, float &kernel)
void SendMessage(const char *msg)
void Initialize(CommandDispatcher *cd)
static const char *const EVEMU_REVISION
static const char *const EVEMU_BUILD_DATE
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state
static void GetItems(uint16 catID, std::map< uint16, std::string > &typeIDs)