else if (actual_command.substr(0, 6) == "/info ") {
pInfo(peer)->last_wrenched = cmd.substr(6, cmd.length() - 6).c_str();
string recently_visited = "", info, bans, logs, email, rank, mac, nick, ip, rid, device;
int dl = 0, wl = 0, bgl = 0;
long long int locks = 0;
//int locks = bgl * 10000 + dl * 100 + wl;
for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) {
if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL) continue;
if (to_lower(pInfo(currentPeer)->tankIDName) == to_lower(pInfo(peer)->last_wrenched)) {
for (string a : pInfo(currentPeer)->bans) bans += a + ", ";
if (bans == "") bans = "This player doesn't have any ban!";
for (string a : pInfo(currentPeer)->logs) logs += a + ", ";
if (logs == "") logs = "This player has clear logs.";
for (auto it = pInfo(currentPeer)->last_visited_worlds.rbegin(); it != pInfo(currentPeer)->last_visited_worlds.rend(); ++it) {
string a_ = *it + (next(it) != pInfo(currentPeer)->last_visited_worlds.rend() ? "``, " : "``");
recently_visited += a_;
}
nick = pInfo(currentPeer)->tankIDName;
mac = pInfo(currentPeer)->mac;
email = pInfo(currentPeer)->email;
ip = pInfo(currentPeer)->ip;
rid = pInfo(currentPeer)->rid;
modify_inventory(currentPeer, 242, wl);
modify_inventory(currentPeer, 1796, dl);
modify_inventory(currentPeer, 7188, bgl);
locks = bgl * 10000 + dl * 100 + wl * 1;
if (pInfo(currentPeer)->platformid == "4") device = "Android";
else if (pInfo(currentPeer)->platformid == "0,1,1" || pInfo(currentPeer)->platformid == "0") device = "PC";
else if (pInfo(currentPeer)->platformid == "1") device = "IOS";
if (pInfo(currentPeer)->adminLevel == -1) rank = "VIP";
else if (pInfo(currentPeer)->adminLevel == 1) rank = "Moderator";
else if (pInfo(currentPeer)->adminLevel == 2) rank = "Super Moderator";
else if (pInfo(currentPeer)->adminLevel == 3) rank = "Ultra Moderator";
else if (pInfo(currentPeer)->adminLevel == 4) rank = "Super Admin";
else if (pInfo(currentPeer)->adminLevel == 5) rank = "Developer";
else rank = "Player";
time_t s__;
s__ = time(NULL);
int days_ = int(s__) / (60 * 60 * 24);
double hours_ = (double)((s__ - pInfo(peer)->playtime) + pInfo(peer)->seconds) / 3600;
string num_text = to_string(hours_);
string rounded = num_text.substr(0, num_text.find(".") + 3);
if (pInfo(peer)->adminLevel >= 1) {
info += "\nadd_textbox|`4Warnings: `o " + logs + "|";
info += "\nadd_textbox|`bBans: `o" + bans + "|";
info += "\nadd_textbox|`6IP: `o" + ip + "|";
info += "\nadd_textbox|`6MAC: `o" + mac + "|";
info += "\nadd_textbox|`6RID: `o" + rid + "|";
info += "\nadd_textbox|`rMail: `o" + email + "|";
info += "\nadd_textbox|`rDevice: `o" + device + "|";
info += "\nadd_textbox|`#Recent Visited: `o" + recently_visited + "|";
info += "\nadd_spacer|small|";
info += "\nadd_label_with_icon|small|`9Total Locks: `w" + to_string(locks) + "``|left|242|";
info += "\nadd_label_with_icon|small|`9Total Gems: `w" + to_string(pInfo(currentPeer)->gems) + "``|left|112|";
info += "\nadd_label_with_icon|small|`9Total Play: `w" + rounded + "``|left|1482|";
info += "\nadd_label_with_icon|small|`9Account Age: `w" + to_string(days_ - pInfo(peer)->account_created) + "``|left|9474|";
info += "\nadd_label_with_icon|small|`9Level: `w" + to_string(pInfo(currentPeer)->level) + "``|left|1488|";
info += "\nadd_label_with_icon|small|`9Rank: `w" + rank + "``|left|278|";
}
else {
info += "\nadd_label_with_icon|small|`9Total Locks: `w" + to_string(locks) + "``|left|242|";
info += "\nadd_label_with_icon|small|`9Total Gems: `w" + to_string(pInfo(currentPeer)->gems) + "``|left|112|";
info += "\nadd_label_with_icon|small|`9Total Play: `w" + rounded + "``|left|1482|";
info += "\nadd_label_with_icon|small|`9Account Age: `w" + to_string(days_ - pInfo(peer)->account_created) + "``|left|9474|";
info += "\nadd_label_with_icon|small|`9Level: `w" + to_string(pInfo(currentPeer)->level) + "``|left|1488|";
info += "\nadd_label_with_icon|small|`9Rank: `w" + rank + "``|left|278|";
}
gamepacket_t p;
p.Insert("OnDialogRequest");
p.Insert("set_default_color|`o\nadd_label_with_icon|big|`2Info: `w" + nick + "``|left|32|\nadd_spacer|small|" + info + "\nadd_spacer|small|\nadd_button|sks|Close|\nadd_quick_exit|\n");
p.CreatePacket(peer);
}
else {
gamepacket_t p;
p.Insert("OnConsoleMessage");
p.Insert("`4Error! `oPlayer not found.");
p.CreatePacket(peer);
}
}
}