From 344840303e645ef3a47bfcb8e4d251780834f2c7 Mon Sep 17 00:00:00 2001 From: Ben10083 Date: Thu, 29 Jun 2023 13:59:33 -0400 Subject: [PATCH] APOLLO Ticket Ids and link announcement --- code/game/machinery/ARES/ARES_procs.dm | 18 ++++++++++++++++-- code/game/machinery/ARES/ARES_records.dm | 9 ++++++++- tgui/packages/tgui/interfaces/WorkingJoe.js | 14 ++++++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/code/game/machinery/ARES/ARES_procs.dm b/code/game/machinery/ARES/ARES_procs.dm index 79c49818595c..79756812c109 100644 --- a/code/game/machinery/ARES/ARES_procs.dm +++ b/code/game/machinery/ARES/ARES_procs.dm @@ -690,6 +690,7 @@ GLOBAL_DATUM_INIT(ares_link, /datum/ares_link, new) if(!istype(maint_ticket)) continue var/list/current_maint = list() + current_maint["id"] = maint_ticket.ticket_id current_maint["time"] = maint_ticket.ticket_time current_maint["title"] = maint_ticket.ticket_name current_maint["details"] = maint_ticket.ticket_details @@ -703,6 +704,7 @@ GLOBAL_DATUM_INIT(ares_link, /datum/ares_link, new) var/list/logged_access = list() for(var/datum/ares_ticket/access_ticket/access_ticket as anything in link.tickets_access) var/list/current_ticket = list() + current_ticket["id"] = access_ticket.ticket_id current_ticket["time"] = access_ticket.ticket_time current_ticket["title"] = access_ticket.ticket_name current_ticket["details"] = access_ticket.ticket_details @@ -805,9 +807,21 @@ GLOBAL_DATUM_INIT(ares_link, /datum/ares_link, new) var/confirm = tgui_alert(usr, "Please confirm the submission of your maintenance report. \n\n [name] \n\n [details] \n\n Is this correct?", "Confirmation", list("Yes", "No")) if(confirm == "Yes") if(link) - var/datum/ares_ticket/maintenance/maint_ticket = new(last_login, name, details) + //make a unique ID for the ticket + //will be 4 digit ticket with first digit being ARES access level + //loop that stays until unique ticket made + var/unique_id = "" + var/uniqueness = FALSE + while(!uniqueness) + unique_id = "#[authentication][rand(9)][rand(9)][rand(9)]" + uniqueness = TRUE + //verify that no ticket IDs are the same, if they are, we run this loop again + for(var/datum/ares_ticket/maintenance/ticket in link.tickets_maintenance) + if(ticket.ticket_id == unique_id) + uniqueness = FALSE + var/datum/ares_ticket/maintenance/maint_ticket = new(last_login, unique_id, name, details) link.tickets_maintenance += maint_ticket - log_game("ARES: Maintenance Ticket created by [key_name(operator)] as [last_login] with Header '[name]' and Details of '[details]'.") + log_game("ARES: Maintenance Ticket [unique_id] created by [key_name(operator)] as [last_login] with Header '[name]' and Details of '[details]'.") return TRUE return FALSE diff --git a/code/game/machinery/ARES/ARES_records.dm b/code/game/machinery/ARES/ARES_records.dm index 9cb8574e58f7..cea7a90a7ba9 100644 --- a/code/game/machinery/ARES/ARES_records.dm +++ b/code/game/machinery/ARES/ARES_records.dm @@ -79,6 +79,8 @@ var/ticket_assignee /// World time in text format. var/ticket_time + /// Unique ID of ticket for easy reference + var/ticket_id /// Who submitted the ticket. Derived from last login. var/ticket_submitter /// The name of the ticket. @@ -86,11 +88,16 @@ /// The content of the ticket, usually an explanation of what it is for. var/ticket_details -/datum/ares_ticket/New(user, name, details) +/datum/ares_ticket/New(user, id, name, details) ticket_time = worldtime2text() + ticket_id = id ticket_submitter = user ticket_details = details ticket_name = name + /// broadcast ticket + var/datum/language/apollo/apollo = GLOB.all_languages[LANGUAGE_APOLLO] + for(var/mob/living/silicon/decoy/ship_ai/AI in ai_mob_list) + apollo.broadcast(AI, "[ticket_type] [ticket_id] '[ticket_name]' has been created. Consult APOLLO for further details.") /datum/ares_ticket/maintenance ticket_type = ARES_RECORD_MAINTENANCE diff --git a/tgui/packages/tgui/interfaces/WorkingJoe.js b/tgui/packages/tgui/interfaces/WorkingJoe.js index 492446a7a882..d27a86186241 100644 --- a/tgui/packages/tgui/interfaces/WorkingJoe.js +++ b/tgui/packages/tgui/interfaces/WorkingJoe.js @@ -423,12 +423,15 @@ const MaintReports = (props, context) => { align="center" fontSize="1.25rem"> + Id + + Time - + Title - + Details @@ -437,12 +440,15 @@ const MaintReports = (props, context) => { return ( + {ticket.id} + + {ticket.time} - + {ticket.title} - + {ticket.details}