/** * 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 += "" html += "" html += "" html += "" html += "" html += "" html += "" html += "" html += "" 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 += "
" var/client/ownerC = src.owner ownerC.Browse(html, "window=playerStats[ckey];title=Player+Stats;size=400x330", 1) /datum/admins/proc/showPlayerIPs(ckey) if (!ckey) return alert("You must provide a valid ckey.") if(src.tempmin) logTheThing("admin", usr, ckey, "tried to access the player IPs of %target%") logTheThing("diary", usr, ckey, "tried to access the player IPs of %target%", "admin") alert("You need to be an actual admin to view player IPs.") return var/list/response try response = apiHandler.queryAPI("playerInfo/getIPs", list("ckey" = ckey), forceResponse = 1) catch () return alert("Failed to query API, try again later.") if (length(response) < 1) return alert("No data found.") var/html = "

[capitalize(ckey)] IP History

" html += "

Last seen IP: [response[1]["last_seen"]]

" html += "" html += "" html += "" html += "" html += "" for (var/list/details in response) html += "" html += "
IPTimes connected
[details["ip"]][details["times"]]
" var/client/ownerC = src.owner ownerC.Browse(html, "window=playerStatsIPs[ckey];title=IP+History;size=300x250", 1) /datum/admins/proc/showPlayerCompIDs(ckey) if (!ckey) return alert("You must provide a valid ckey.") if(src.tempmin) logTheThing("admin", usr, ckey, "tried to access the player compIDs of %target%") logTheThing("diary", usr, ckey, "tried to access the player compIDs of %target%", "admin") alert("You need to be an actual admin to view player compIDs.") return var/list/response try response = apiHandler.queryAPI("playerInfo/getCompIDs", list("ckey" = ckey), forceResponse = 1) catch () return alert("Failed to query API, try again later.") if (length(response) < 1) return alert("No data found.") var/html = "

[capitalize(ckey)] Computer ID History

" html += "

Last seen Computer ID: [response[1]["last_seen"]]

" html += "" html += "" html += "" html += "" html += "" for (var/list/details in response) html += "" html += "
Computer IDTimes connected
[details["compID"]][details["times"]]
" var/client/ownerC = src.owner ownerC.Browse(html, "window=playerStatsCompIDs[ckey];title=Computer+ID+History;size=300x250", 1)