diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 0ba144caa1cb9..7ebb87447273b 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -210,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 @@ -482,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) @@ -497,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) @@ -517,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() @@ -539,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 = "- AdminHelp marked as IC issue! -
" msg += "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." @@ -638,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") @@ -647,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("Player Ticket") @@ -785,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" diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 834e4741cdecf..ade08707f729a 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -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 @@ -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 diff --git a/modular_doppler/ticket_handler/admin.dm b/modular_doppler/ticket_handler/admin.dm new file mode 100644 index 0000000000000..571e7885c3268 --- /dev/null +++ b/modular_doppler/ticket_handler/admin.dm @@ -0,0 +1,45 @@ +/datum/admin_help + /// Who is handling this admin help? + var/handler + +/datum/admin_help/ClosureLinks(ref_src) + . = ..() + . += " (HANDLE)" + +// 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 +*/ diff --git a/tgstation.dme b/tgstation.dme index be2a2635135e8..d933f1c76ca39 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -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"