From 00187ad971922aba7ee880e8a3974a9e9b0148b4 Mon Sep 17 00:00:00 2001 From: Kyep Date: Fri, 1 Feb 2019 23:46:29 -0800 Subject: [PATCH] Updates show player playtime report --- code/__DEFINES/preferences.dm | 4 ++- code/__HELPERS/game.dm | 2 +- code/game/jobs/job_exp.dm | 65 +++++++++++++++++++---------------- code/modules/admin/admin.dm | 2 +- 4 files changed, 40 insertions(+), 33 deletions(-) diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index c2cd40c1a58..5fa1c2e587a 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -51,4 +51,6 @@ #define EXP_TYPE_SECURITY "Security" #define EXP_TYPE_SILICON "Silicon" #define EXP_TYPE_SERVICE "Service" -#define EXP_TYPE_WHITELIST "Whitelist" \ No newline at end of file +#define EXP_TYPE_WHITELIST "Whitelist" + +#define EXP_DEPT_TYPE_LIST list(EXP_TYPE_SERVICE, EXP_TYPE_MEDICAL, EXP_TYPE_ENGINEERING, EXP_TYPE_SCIENCE, EXP_TYPE_SECURITY, EXP_TYPE_COMMAND, EXP_TYPE_SILICON, EXP_TYPE_SPECIAL) \ No newline at end of file diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index eb6fb8a4802..79b7da3c10c 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -449,7 +449,7 @@ proc/pollCandidates(Question, be_special_type, antag_age_check = 0, poll_time = if(jobban_isbanned(G, roletext) || jobban_isbanned(G, "Syndicate")) continue if(config.use_exp_restrictions && min_hours) - if(G.client.get_exp_living_num() < min_hours * 60) + if(G.client.get_exp_type_num(EXP_TYPE_LIVING) < min_hours * 60) continue if(check_antaghud && cannotPossess(G)) continue diff --git a/code/game/jobs/job_exp.dm b/code/game/jobs/job_exp.dm index 82c170a1997..fa13fbdb4b7 100644 --- a/code/game/jobs/job_exp.dm +++ b/code/game/jobs/job_exp.dm @@ -47,7 +47,7 @@ var/global/list/role_playtime_requirements = list( to_chat(src, "Playtime tracking is not enabled.") return - to_chat(src, "Your playtime is [get_exp_living()].") + to_chat(src, "Your [EXP_TYPE_CREW] playtime is [get_exp_type(EXP_TYPE_CREW)].") // Admin Verbs @@ -57,36 +57,31 @@ var/global/list/role_playtime_requirements = list( if(!check_rights(R_ADMIN|R_MOD|R_MENTOR)) return var/msg = "Playtime Report" - var/list/players_new = list() - var/list/players_old = list() - var/pline var/datum/job/theirjob var/jtext + msg += "" + for(var/thisdept in EXP_DEPT_TYPE_LIST) + msg += "" + msg += "" for(var/client/C in GLOB.clients) - jtext = "No Job" + msg += "" + if(check_rights(R_ADMIN, 0)) + msg += "" + else + msg += "" + + jtext = "-" if(C.mob.mind && C.mob.mind.assigned_role) theirjob = job_master.GetJob(C.mob.mind.assigned_role) if(theirjob) jtext = theirjob.title - if(config.use_exp_restrictions && theirjob.exp_requirements && theirjob.exp_type) - jtext += "*" - if(check_rights(R_ADMIN, 0)) - pline = "
  • [key_name_admin(C.mob)]: [jtext]: " + C.get_exp_living() + "
  • " - else - pline = "
  • [key_name_mentor(C.mob)]: [jtext]: " + C.get_exp_living() + "
  • " - if(C.get_exp_living_num() > 1200) - players_old += pline - else - players_new += pline - if(players_new.len) - msg += "
    Players under 20h:
    " - if(players_old.len) - msg += "
    Players over 20h:
    " - msg += "" + msg += "" + + msg += "" + msg += "[C.get_exp_dept_string()]" + msg += "" + + msg += "
    PlayerJobCrew[thisdept]
    [key_name_admin(C.mob)][key_name_mentor(C.mob)][jtext]" + C.get_exp_type(EXP_TYPE_CREW) + "
    " src << browse(msg, "window=Player_playtime_check") @@ -200,14 +195,24 @@ var/global/list/role_playtime_requirements = list( return_text += "" return return_text +/client/proc/get_exp_type(var/etype) + return get_exp_format(get_exp_type_num(etype)) -/client/proc/get_exp_living() - return get_exp_format(get_exp_living_num()) - -/client/proc/get_exp_living_num() +/client/proc/get_exp_type_num(var/etype) var/list/play_records = params2list(prefs.exp) - var/exp_living = text2num(play_records[EXP_TYPE_LIVING]) - return exp_living + return text2num(play_records[etype]) + +/client/proc/get_exp_dept_string() + var/list/play_records = params2list(prefs.exp) + var/list/result_text = list() + for(var/thistype in EXP_DEPT_TYPE_LIST) + var/thisvalue = text2num(play_records[thistype]) + if(thisvalue) + result_text.Add("[get_exp_format(thisvalue)]") + else + result_text.Add("-") + return result_text.Join("") + /proc/get_exp_format(var/expnum) if(expnum > 60) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index c4e07ca577f..465cb648169 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -62,7 +62,7 @@ var/global/nologevent = 0 if(M.client) body += " played by [M.client] " body += "\[[M.client.holder ? M.client.holder.rank : "Player"]\] " - body += "\[" + M.client.get_exp_living() + "\]" + body += "\[" + M.client.get_exp_type(EXP_TYPE_CREW) + " as [EXP_TYPE_CREW]\]" if(istype(M, /mob/new_player)) body += " Hasn't Entered Game "