/** * A bunch of procs for showing admins player data from the central API databases */ /** * Verbs */ /client/proc/cmd_admin_show_player_stats() set name = "Show Player Stats" set category = null admin_only var/ckey = input(usr, "Please enter a ckey", "Player Details", "") as text src.holder.showPlayerStats(ckey) /client/proc/cmd_admin_show_player_ips() set name = "Show Player IPs" set category = null admin_only var/ckey = input(usr, "Please enter a ckey", "Player Details", "") as text src.holder.showPlayerIPs(ckey) /client/proc/cmd_admin_show_player_compids() set name = "Show Player Computer IDs" set category = null admin_only var/ckey = input(usr, "Please enter a ckey", "Player Details", "") as text src.holder.showPlayerCompIDs(ckey) /** * Procs-that-open-popups */ /datum/admins/proc/showPlayerStats(ckey) if (!ckey) return alert("You must provide a valid ckey.") if(src.tempmin) logTheThing("admin", usr, ckey, "tried to access the player stats of %target%") logTheThing("diary", usr, ckey, "tried to access the player stats of %target%", "admin") alert("You need to be an actual admin to view player stats.") return var/list/response try response = apiHandler.queryAPI("playerInfo/get", list("ckey" = ckey), forceResponse = 1) catch () return alert("Failed to query API, try again later.") if (text2num(response["seen"]) < 1) return alert("No data found.") //Find the connected client, if present (ignore not found) var/client/C try C = getClientFromCkey(ckey) catch var/html = "
[capitalize(ckey)] Stats
" html += "| Current status | [C ? "Online" : "Offline"] |
| Rounds connected to | [response["seen"]] |
| Rounds participated in | [response["participated"]] |
| Last seen BYOND version | [response["byondMajor"]].[response["byondMinor"]] |
| Platform | [response["platform"]] |
| Browser | [response["browser"]] [response["browserVersion"]][response["browserMode"] ? " ([response["browserMode"]])" : ""] |
| IP | "
html += "Last seen: [response["last_ip"]] " html += "See All" html += " |
| Computer ID | "
html += "Last seen: [response["last_compID"]] " html += "See All" html += " |
[capitalize(ckey)] IP History
" html += "Last seen IP: [response[1]["last_seen"]]
" html += "| IP | " html += "Times connected | " html += "
|---|---|
| [details["ip"]] | [details["times"]] |
[capitalize(ckey)] Computer ID History
" html += "Last seen Computer ID: [response[1]["last_seen"]]
" html += "| Computer ID | " html += "Times connected | " html += "
|---|---|
| [details["compID"]] | [details["times"]] |