mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
[Semi-modular] View Latest Ticket ahelp command for players (#2958)
* it compiles \o/ * fixes everything lol * Removes caveman debugging * closed_at -> opened_at Co-authored-by: Ranged <nickvanderkroon@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/datum/admin_help
|
||||
var/handler
|
||||
var/list/_interactions_player
|
||||
|
||||
//Let the initiator know their ahelp is being handled
|
||||
/datum/admin_help/proc/HandleIssue(key_name = key_name_admin(usr))
|
||||
@@ -23,5 +24,31 @@
|
||||
message_admins(msg)
|
||||
log_admin_private(msg)
|
||||
AddInteraction("Being handled by [key_name]")
|
||||
AddInteractionPlayer("Being handled by [key_name_admin(usr, FALSE)]")
|
||||
|
||||
handler = "[usr.ckey]"
|
||||
|
||||
/datum/admin_help/proc/PlayerTicketPanel()
|
||||
var/list/dat = list("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Player Ticket</title></head>")
|
||||
dat += "<b>State: "
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
dat += "<font color='red'>OPEN</font></b>"
|
||||
if(AHELP_RESOLVED)
|
||||
dat += "<font color='green'>RESOLVED</font></b>"
|
||||
if(AHELP_CLOSED)
|
||||
dat += "CLOSED</b>"
|
||||
else
|
||||
dat += "UNKNOWN</b>"
|
||||
dat += "<br><br>Opened at: [gameTimestamp("hh:mm:ss", opened_at)] (Approx [DisplayTimeText(world.time - opened_at)] ago)"
|
||||
if(closed_at)
|
||||
dat += "<br>Closed at: [gameTimestamp("hh:mm:ss", closed_at)] (Approx [DisplayTimeText(world.time - closed_at)] ago)"
|
||||
dat += "<br><br>"
|
||||
dat += "<br><b>Log:</b><br><br>"
|
||||
for(var/I in _interactions_player)
|
||||
dat += "[I]<br>"
|
||||
|
||||
usr << browse(dat.Join(), "window=ahelp[id];size=620x480")
|
||||
|
||||
/datum/admin_help/proc/AddInteractionPlayer(formatted_message)
|
||||
_interactions_player += "[time_stamp()]: [formatted_message]"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// File for more general procs, admin_help.dm is focused on the datum/admin_help/
|
||||
/client/verb/viewlatestticket()
|
||||
set category = "Admin"
|
||||
set name = "View Latest Ticket"
|
||||
|
||||
if(!current_ticket)
|
||||
// Check if the client had previous tickets, and show the latest one
|
||||
var/list/prev_tickets = list()
|
||||
var/datum/admin_help/last_AH
|
||||
// Check all resolved tickets for this player
|
||||
for(var/datum/admin_help/AH in GLOB.ahelp_tickets.resolved_tickets)
|
||||
if(AH.initiator_ckey == ckey) // Initiator is a misnomer, it's always the non-admin player even if an admin bwoinks first
|
||||
prev_tickets += AH
|
||||
// Check all closed tickets for this player
|
||||
for(var/datum/admin_help/AH in GLOB.ahelp_tickets.closed_tickets)
|
||||
if(AH.initiator_ckey == ckey)
|
||||
prev_tickets += AH
|
||||
// Take the most recent entry of prev_tickets and open the panel on it
|
||||
if(LAZYLEN(prev_tickets))
|
||||
last_AH = pop(prev_tickets)
|
||||
last_AH.PlayerTicketPanel()
|
||||
return
|
||||
|
||||
// client had no tickets this round
|
||||
to_chat(src, "<span class='warning'>You have not had an ahelp ticket this round.</span>")
|
||||
return
|
||||
|
||||
current_ticket.PlayerTicketPanel()
|
||||
Reference in New Issue
Block a user