Merge pull request #15504 from SandPoot/job-exp-exemption

Re-adds the admin button to let them exempt players from job exp requirements.
This commit is contained in:
silicons
2022-02-15 20:58:43 -08:00
committed by GitHub
2 changed files with 38 additions and 9 deletions
-9
View File
@@ -53,15 +53,6 @@
return
cmd_show_exp_panel(M.client)
else if(href_list["toggleexempt"])
if(!check_rights(R_ADMIN))
return
var/client/C = locate(href_list["toggleexempt"]) in GLOB.clients
if(!C)
to_chat(usr, "<span class='danger'>ERROR: Client not found.</span>")
return
toggle_exempt_status(C)
else if(href_list["makeAntag"])
if(!check_rights(R_ADMIN))
return
+38
View File
@@ -17,6 +17,13 @@
ui = new(user, src, "TrackedPlaytime")
ui.open()
/datum/job_report_menu/ui_data(mob/user)
var/list/data = list()
data["exemptStatus"] = (owner.prefs?.db_flags & DB_FLAG_EXEMPT)
return data
/datum/job_report_menu/ui_static_data()
if (!CONFIG_GET(flag/use_exp_tracking))
return list("failReason" = JOB_REPORT_MENU_FAIL_REASON_TRACKING_DISABLED)
@@ -42,8 +49,39 @@
data["livingTime"] = play_records[EXP_TYPE_LIVING]
data["ghostTime"] = play_records[EXP_TYPE_GHOST]
data["adminTime"] = play_records[EXP_TYPE_ADMIN] ? play_records[EXP_TYPE_ADMIN] : 0
data["isAdmin"] = check_rights(R_ADMIN, show_msg = FALSE)
return data
/datum/job_report_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("toggle_exempt")
if(!check_rights(R_ADMIN))
message_admins("[ADMIN_LOOKUPFLW(usr)] attempted to toggle job playtime exempt status without admin rights.")
log_admin("[ADMIN_LOOKUPFLW(usr)] attempted to toggle job playtime exempt status without admin rights.")
to_chat(usr, span_danger("ERROR: Insufficient admin rights."), confidential = TRUE)
return TRUE
var/datum/admins/viewer_admin_datum = GLOB.admin_datums[usr.ckey]
if(!viewer_admin_datum)
message_admins("[ADMIN_LOOKUPFLW(usr)] attempted to toggle job playtime exempt status without admin datum for their ckey.")
log_admin("[ADMIN_LOOKUPFLW(usr)] attempted to toggle job playtime exempt status without admin datum for their ckey.")
to_chat(usr, span_danger("ERROR: Insufficient admin rights."), confidential = TRUE)
return TRUE
if(QDELETED(owner))
to_chat(usr, span_danger("ERROR: Client not found."), confidential = TRUE)
return TRUE
viewer_admin_datum.toggle_exempt_status(owner)
return TRUE
#undef JOB_REPORT_MENU_FAIL_REASON_TRACKING_DISABLED
#undef JOB_REPORT_MENU_FAIL_REASON_NO_RECORDS