Upload files

This commit is contained in:
SandPoot
2022-02-15 22:16:07 -03:00
parent 289a3902b1
commit c42aa2c30a
5 changed files with 193 additions and 6 deletions

View File

@@ -0,0 +1,68 @@
/datum/player_playtime/New(mob/viewer)
ui_interact(viewer)
/datum/player_playtime/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "PlayerPlaytimes", "Player Playtimes")
ui.open()
/datum/player_playtime/ui_state(mob/user)
return GLOB.admin_state
/datum/player_playtime/ui_data(mob/user)
var/list/data = list()
var/list/clients = list()
for(var/client/C in GLOB.clients)
var/list/client = list()
client["ckey"] = C.ckey
client["playtime"] = C.get_exp_living(TRUE)
client["playtime_hours"] = C.get_exp_living()
var/mob/M = C.mob
client["observer"] = isobserver(M)
client["ingame"] = !isnewplayer(M)
client["name"] = M.real_name
var/nnpa = CONFIG_GET(number/notify_new_player_age)
if(nnpa >= 0)
if(C.account_age >= 0 && (C.account_age < CONFIG_GET(number/notify_new_player_age)))
client["new_account"] = "New BYOND account [C.account_age] day[(C.account_age==1?"":"s")] old, created on [C.account_join_date]"
clients += list(client)
clients = sortList(clients, /proc/cmp_playtime)
data["clients"] = clients
return data
/datum/player_playtime/ui_act(action, params)
if(..())
return
switch(action)
if("view_playtime")
var/mob/target = get_mob_by_ckey(params["ckey"])
usr.client.holder.cmd_show_exp_panel(target.client)
if("admin_pm")
usr.client.cmd_admin_pm(params["ckey"])
if("player_panel")
var/mob/target = get_mob_by_ckey(params["ckey"])
usr.client.holder.show_player_panel(target)
if("view_variables")
var/mob/target = get_mob_by_ckey(params["ckey"])
usr.client.debug_variables(target)
if("observe")
if(!isobserver(usr) && !check_rights(R_ADMIN))
return
var/mob/target = get_mob_by_key(params["ckey"])
if(!target)
to_chat(usr, "<span class='notice'>Player not found.</span>")
return
var/client/C = usr.client
if(!isobserver(usr) && !C.admin_ghost())
return
var/mob/dead/observer/A = C.mob
A.ManualFollow(target)

View File

@@ -1557,6 +1557,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
/client/proc/cmd_admin_check_player_exp() //Allows admins to determine who the newer players are.
set category = "Admin"
set name = "Player Playtime"
if(!check_rights(R_ADMIN))
return
@@ -1564,12 +1565,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
to_chat(usr, "<span class='warning'>Tracking is disabled in the server configuration file.</span>")
return
var/list/msg = list()
msg += "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Playtime Report</title></head><body>Playtime:<BR><UL>"
for(var/client/C in GLOB.clients)
msg += "<LI> - [key_name_admin(C)]: <A href='?_src_=holder;[HrefToken()];getplaytimewindow=[REF(C.mob)]'>" + C.get_exp_living() + "</a></LI>"
msg += "</UL></BODY></HTML>"
src << browse(msg.Join(), "window=Player_playtime_check")
new /datum/player_playtime(usr)
/obj/effect/temp_visual/fireball
icon = 'icons/obj/wizard.dmi'