Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds admin handler name to ticket statpanel #189

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions code/modules/admin/verbs/adminhelp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
var/datum/admin_help/AH = I
if(AH.initiator)
var/obj/effect/statclick/updated = AH.statclick.update()
L[++L.len] = list("#[AH.id]. [AH.initiator_key_name]:", "[updated.name]", REF(AH))
//L[++L.len] = list("#[AH.id]. [AH.initiator_key_name]:", "[updated.name]", REF(AH)) // ORIGINAL
L[++L.len] = list("[AH.handler ? "H-[AH.handler]" : ""]#[AH.id]. [AH.initiator_key_name]:", "[updated.name]", REF(AH)) // DOPPLER EDIT - Admin handler name
else
++num_disconnected
if(num_disconnected)
Expand Down Expand Up @@ -209,13 +210,18 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
* * msg_raw - The first message of this admin_help: used for the initial title of the ticket
* * is_bwoink - Boolean operator, TRUE if this ticket was started by an admin PM
*/
/datum/admin_help/New(msg_raw, client/C, is_bwoink, urgent = FALSE)
/datum/admin_help/New(msg_raw, client/C, is_bwoink, client/admin_C, urgent = FALSE) // DOPPLER EDIT - Add admin_C
//clean the input msg
var/msg = sanitize(copytext_char(msg_raw, 1, MAX_MESSAGE_LEN))
if(!msg || !C || !C.mob)
qdel(src)
return

// DOPPLER EDIT ADDITION BEGIN
if(admin_C && is_bwoink)
handler = "[admin_C.ckey]"
// DOPPLER EDIT END

id = ++ticket_counter
opened_at = world.time

Expand Down Expand Up @@ -481,6 +487,12 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
/datum/admin_help/proc/Close(key_name = key_name_admin(usr), silent = FALSE)
if(state != AHELP_ACTIVE)
return
// DOPPLER EDIT ADDITION BEGIN - Ticket handling
if(handler && handler != usr.ckey)
var/response = tgui_alert(usr, "This ticket is already being handled by [handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No"))
if(!response || response == "No")
return
// DOPPLER EDIT ADDITION END
RemoveActive()
state = AHELP_CLOSED
GLOB.ahelp_tickets.ListInsert(src)
Expand All @@ -496,6 +508,12 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
/datum/admin_help/proc/Resolve(key_name = key_name_admin(usr), silent = FALSE)
if(state != AHELP_ACTIVE)
return
// DOPPLER EDIT ADDITION BEGIN - Ticket handling
if(handler && handler != usr.ckey)
var/response = tgui_alert(usr, "This ticket is already being handled by [handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No"))
if(!response || response == "No")
return
// DOPPLER EDIT ADDITION END
RemoveActive()
state = AHELP_RESOLVED
GLOB.ahelp_tickets.ListInsert(src)
Expand All @@ -516,6 +534,13 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
if(state != AHELP_ACTIVE)
return

// DOPPLER EDIT ADDITION BEGIN - Ticket handling
if(handler && handler != usr.ckey)
var/response = tgui_alert(usr, "This ticket is already being handled by [handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No"))
if(!response || response == "No")
return
// DOPPLER EDIT ADDITION END

if(initiator)
initiator.giveadminhelpverb()

Expand All @@ -538,6 +563,13 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
if(state != AHELP_ACTIVE)
return

// DOPPLER EDIT ADDITION BEGIN - Ticket handling
if(handler && handler != usr.ckey)
var/response = tgui_alert(usr, "This ticket is already being handled by [handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No"))
if(!response || response == "No")
return
// DOPPLER EDIT ADDITION END

var/msg = "<font color='red' size='4'><b>- AdminHelp marked as IC issue! -</b></font><br>"
msg += "<font color='red'>Your issue has been determined by an administrator to be an in character issue and does NOT require administrator intervention at this time. For further resolution you should pursue options that are in character.</font>"

Expand Down Expand Up @@ -637,7 +669,11 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
if("reject")
Reject()
if("reply")
usr.client.cmd_ahelp_reply(initiator)
// DOPPLER EDIT START - ADMIN HANDLE
//usr.client.cmd_ahelp_reply(initiator) ORIGINAL
if(handle_issue())
usr.client.cmd_ahelp_reply(initiator)
// DOPPLER EDIT END
if("icissue")
ICIssue()
if("close")
Expand All @@ -646,6 +682,10 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
Resolve()
if("reopen")
Reopen()
// DOPPLER EDIT ADDITION START
if("handle_issue")
handle_issue()
// DOPPLER EDIT ADDITION END

/datum/admin_help/proc/player_ticket_panel()
var/list/dat = list("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Player Ticket</title></head>")
Expand Down Expand Up @@ -784,7 +824,7 @@ GLOBAL_DATUM_INIT(admin_help_ui_handler, /datum/admin_help_ui_handler, new)
user_client.current_ticket.MessageNoRecipient(message, urgent)
return

new /datum/admin_help(message, user_client, FALSE, urgent)
new /datum/admin_help(message, user_client, FALSE, null, urgent) // DOPPLER EDIT - add null

/client/verb/no_tgui_adminhelp(message as message)
set name = "NoTguiAdminhelp"
Expand Down
8 changes: 7 additions & 1 deletion code/modules/admin/verbs/adminpm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ ADMIN_VERB(cmd_admin_pm_panel, R_NONE, "Admin PM", "Show a list of clients to PM
var/already_logged = FALSE
// Full boinks will always be done to players, so we are not guarenteed that they won't have a ticket
if(!recipient_ticket)
new /datum/admin_help(send_message, recipient, TRUE)
new /datum/admin_help(send_message, recipient, TRUE, src) // DOPPLER EDIT - Add src
already_logged = TRUE
// This action mutates our existing cached ticket information, so we recache
ticket = current_ticket
Expand Down Expand Up @@ -418,6 +418,12 @@ ADMIN_VERB(cmd_admin_pm_panel, R_NONE, "Admin PM", "Show a list of clients to PM
SEND_SOUND(recipient, sound('sound/effects/adminhelp.ogg'))
return TRUE

// DOPPLER EDIT ADDITION BEGIN - Ticket handling
// Basically, if we realized that we shouldn't've been handling the ticket, let's bail. Otherwise, we just change who's handling it.
if(ticket && our_holder && !ticket.handle_issue())
return
// DOPPLER EDIT END

// Ok if we're here, either this message is for an admin, or someone somehow figured out how to send a new message as a player
// First case well, first
if(!our_holder && !recipient_holder) //neither are admins
Expand Down
45 changes: 45 additions & 0 deletions modular_doppler/ticket_handler/admin.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/datum/admin_help
/// Who is handling this admin help?
var/handler

/datum/admin_help/ClosureLinks(ref_src)
. = ..()
. += " (<A HREF='?_src_=holder;[HrefToken(forceGlobal = TRUE)];ahelp=[ref_src];ahelp_action=handle_issue'>HANDLE</A>)"

// Let the initiator know their ahelp is being handled
/datum/admin_help/proc/handle_issue(key_name = key_name_admin(usr))
if(state != AHELP_ACTIVE)
return FALSE

if(handler && handler == usr.ckey) // No need to handle it twice as the same person ;)
return TRUE

if(handler && handler != usr.ckey)
var/response = tgui_alert(usr, "This ticket is already being handled by [handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No"))
if(!response || response == "No")
return FALSE

var/msg = span_adminhelp("Your ticket is now being handled by [key_name]! Please wait while they type their response and/or gather relevant information.")

if(initiator)
to_chat(initiator, msg)

SSblackbox.record_feedback("tally", "ahelp_stats", 1, "handling")
msg = "Ticket [TicketHref("#[id]")] is being handled by [key_name]"
message_admins(msg)
log_admin_private(msg)
AddInteraction("Being handled by [key_name]", "Being handled by [key_name_admin(usr, FALSE)]")

handler = "[usr.ckey]"
return TRUE

/*
/// Confirm that the admin trying to take over the handling of a ticket really wants to do that
/datum/admin_help/proc/confirm_takeover()
if(!handler || handler != usr.ckey)
return FALSE
var/response = tgui_alert(usr, "This ticket is already being handled by [handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No"))
if(response == "Yes")
return TRUE
return FALSE
*/
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -7032,6 +7032,7 @@
#include "modular_doppler\stone\code\ore_veins.dm"
#include "modular_doppler\stone\code\stone.dm"
#include "modular_doppler\tableflip\tableflip.dm"
#include "modular_doppler\ticket_handler\admin.dm"
#include "modular_doppler\time_clock\code\console.dm"
#include "modular_doppler\time_clock\code\console_tgui.dm"
#include "modular_doppler\time_clock\code\mind.dm"
Expand Down
Loading