diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 49c77ca0a4a..055e52663a6 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -541,7 +541,7 @@ GLOBAL_LIST_INIT(do_after_once_tracker, list()) to_chat(user, "Name = [M.name]; Real_name = [M.real_name]; Mind_name = [M.mind?"[M.mind.name]":""]; Key = [M.key];") to_chat(user, "Location = [location_description];") to_chat(user, "[special_role_description]") - to_chat(user, "(PM) ([ADMIN_PP(M,"PP")]) ([ADMIN_VV(M,"VV")]) ([ADMIN_TP(M,"TP")]) ([ADMIN_SM(M,"SM")]) ([ADMIN_FLW(M,"FLW")])") + to_chat(user, "(PM) ([ADMIN_PP(M,"PP")]) ([ADMIN_VV(M,"VV")]) ([ADMIN_TP(M,"TP")]) ([ADMIN_SM(M,"SM")]) ([ADMIN_FLW(M,"FLW")])") // Gets the first mob contained in an atom, and warns the user if there's not exactly one /proc/get_mob_in_atom_with_warning(atom/A, mob/user = usr) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index e7c4089812c..46559eb6b5c 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -424,6 +424,18 @@ Turf and target are seperate in case you want to teleport some distance from a t if(M.ckey == key) return M +/proc/get_client_by_ckey(ckey) + if(cmptext(copytext(ckey, 1, 2),"@")) + ckey = findStealthKey(ckey) + return GLOB.directory[ckey] + + +/proc/findStealthKey(txt) + if(txt) + for(var/P in GLOB.stealthminID) + if(GLOB.stealthminID[P] == txt) + return P + // Returns the atom sitting on the turf. // For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf. /proc/get_atom_on_turf(var/atom/movable/M) diff --git a/code/controllers/subsystem/tickets/mentor_tickets.dm b/code/controllers/subsystem/tickets/mentor_tickets.dm index af4ea2e914d..97f84263a45 100644 --- a/code/controllers/subsystem/tickets/mentor_tickets.dm +++ b/code/controllers/subsystem/tickets/mentor_tickets.dm @@ -25,4 +25,4 @@ GLOBAL_REAL(SSmentor_tickets, /datum/controller/subsystem/tickets/mentor_tickets message_mentorTicket(msg) /datum/controller/subsystem/tickets/mentor_tickets/create_other_system_ticket(datum/ticket/T) - SStickets.newTicket(T.clientName, T.content, T.title) + SStickets.newTicket(get_client_by_ckey(T.client_ckey), T.content, T.title) diff --git a/code/controllers/subsystem/tickets/tickets.dm b/code/controllers/subsystem/tickets/tickets.dm index 64f91e96b6c..60f3a5fa8dd 100644 --- a/code/controllers/subsystem/tickets/tickets.dm +++ b/code/controllers/subsystem/tickets/tickets.dm @@ -93,7 +93,7 @@ SUBSYSTEM_DEF(tickets) var/datum/ticket/T = new(title, passedContent, getTicketCounterAndInc()) allTickets += T - T.clientName = C + T.client_ckey = C.ckey T.locationSent = C.mob.loc.name T.mobControlled = C.mob @@ -139,14 +139,16 @@ SUBSYSTEM_DEF(tickets) /datum/controller/subsystem/tickets/proc/convert_ticket(datum/ticket/T) T.ticketState = TICKET_CLOSED var/client/C = usr.client - to_chat_safe(T.clientName, list("[key_name_hidden(C)] has converted your ticket to a [other_ticket_name] ticket.",\ + var/client/owner = get_client_by_ckey(T.client_ckey) + to_chat_safe(owner, list("[key_name_hidden(C)] has converted your ticket to a [other_ticket_name] ticket.",\ "Be sure to use the correct type of help next time!")) message_staff("[C] has converted ticket number [T.ticketNum] to a [other_ticket_name] ticket.") log_game("[C] has converted ticket number [T.ticketNum] to a [other_ticket_name] ticket.") create_other_system_ticket(T) /datum/controller/subsystem/tickets/proc/create_other_system_ticket(datum/ticket/T) - SSmentor_tickets.newTicket(T.clientName, T.content, T.title) + var/client/C = get_client_by_ckey(T.client_ckey) + SSmentor_tickets.newTicket(C, T.content, T.title) /datum/controller/subsystem/tickets/proc/autoRespond(N) if(!check_rights(rights_needed)) @@ -177,7 +179,7 @@ SUBSYSTEM_DEF(tickets) sorted_responses += key var/message_key = input("Select an autoresponse. This will mark the ticket as resolved.", "Autoresponse") as null|anything in sortTim(sorted_responses, /proc/cmp_text_asc) //use sortTim and cmp_text_asc to sort alphabetically - + var/client/ticket_owner = get_client_by_ckey(T.client_ckey) switch(message_key) if(null) //they cancelled T.staffAssigned = initial(T.staffAssigned) //if they cancel we dont need to hold this ticket anymore @@ -189,18 +191,18 @@ SUBSYSTEM_DEF(tickets) C.man_up(returnClient(N)) T.lastStaffResponse = "Autoresponse: [message_key]" resolveTicket(N) - message_staff("[C] has auto responded to [T.clientName]\'s adminhelp with: [message_key] ") - log_game("[C] has auto responded to [T.clientName]\'s adminhelp with: [response_phrases[message_key]]") + message_staff("[C] has auto responded to [ticket_owner]\'s adminhelp with: [message_key] ") + log_game("[C] has auto responded to [ticket_owner]\'s adminhelp with: [response_phrases[message_key]]") if("Mentorhelp") convert_ticket(T) else var/msg_sound = sound('sound/effects/adminhelp.ogg') SEND_SOUND(returnClient(N), msg_sound) to_chat_safe(returnClient(N), "[key_name_hidden(C)] is autoresponding with: [response_phrases[message_key]]")//for this we want the full value of whatever key this is to tell the player so we do response_phrases[message_key] - message_staff("[C] has auto responded to [T.clientName]\'s adminhelp with: [message_key] ") //we want to use the short named keys for this instead of the full sentence which is why we just do message_key + message_staff("[C] has auto responded to [ticket_owner]\'s adminhelp with: [message_key] ") //we want to use the short named keys for this instead of the full sentence which is why we just do message_key T.lastStaffResponse = "Autoresponse: [message_key]" resolveTicket(N) - log_game("[C] has auto responded to [T.clientName]\'s adminhelp with: [response_phrases[message_key]]") + log_game("[C] has auto responded to [ticket_owner]\'s adminhelp with: [response_phrases[message_key]]") //Set ticket state with key N to closed /datum/controller/subsystem/tickets/proc/closeTicket(N) @@ -214,7 +216,7 @@ SUBSYSTEM_DEF(tickets) //Check if the user already has a ticket open and within the cooldown period. /datum/controller/subsystem/tickets/proc/checkForOpenTicket(client/C) for(var/datum/ticket/T in allTickets) - if(T.clientName == C && T.ticketState == TICKET_OPEN && (T.ticketCooldown > world.time)) + if(T.client_ckey == C.ckey && T.ticketState == TICKET_OPEN && (T.ticketCooldown > world.time)) return T return FALSE @@ -222,7 +224,7 @@ SUBSYSTEM_DEF(tickets) /datum/controller/subsystem/tickets/proc/checkForTicket(client/C) var/list/tickets = list() for(var/datum/ticket/T in allTickets) - if(T.clientName == C && (T.ticketState == TICKET_OPEN || T.ticketState == TICKET_STALE)) + if(T.client_ckey == C.ckey && (T.ticketState == TICKET_OPEN || T.ticketState == TICKET_STALE)) tickets += T if(tickets.len) return tickets @@ -231,7 +233,7 @@ SUBSYSTEM_DEF(tickets) //return the client of a ticket number /datum/controller/subsystem/tickets/proc/returnClient(N) var/datum/ticket/T = allTickets[N] - return T.clientName + return get_client_by_ckey(T.client_ckey) /datum/controller/subsystem/tickets/proc/assignStaffToTicket(client/C, N) var/datum/ticket/T = allTickets[N] @@ -244,7 +246,8 @@ SUBSYSTEM_DEF(tickets) /datum/ticket var/ticketNum // Ticket number - var/clientName // Client which opened the ticket + /// ckey of the client who opened the ticket + var/client_ckey var/timeOpened // Time the ticket was opened var/title //The initial message with links var/list/content // content of the staff help @@ -379,7 +382,7 @@ UI STUFF dat += "

Ticket #[T.ticketNum]

" - dat += "

[T.clientName] / [T.mobControlled] opened this [ticket_name] at [T.timeOpened] at location [T.locationSent]

" + dat += "

[T.client_ckey] / [T.mobControlled] opened this [ticket_name] at [T.timeOpened] at location [T.locationSent]

" dat += "

Ticket Status: [status]" dat += "" dat += "" diff --git a/code/defines/procs/admin.dm b/code/defines/procs/admin.dm index 23b485ad252..fa5556b4e40 100644 --- a/code/defines/procs/admin.dm +++ b/code/defines/procs/admin.dm @@ -42,11 +42,11 @@ if(key) if(C && C.holder && C.holder.fakekey && !include_name) if(include_link) - . += "" + . += "" . += "Administrator" else if(include_link && C) - . += "" + . += "" . += key if(include_link) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 07dd4975ddb..45971e6993e 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -85,7 +85,7 @@ GLOBAL_VAR_INIT(nologevent, 0) body += "VV - " body += "[ADMIN_TP(M,"TP")] - " if(M.client) - body += "PM - " + body += "PM - " body += "[ADMIN_SM(M,"SM")] - " if(ishuman(M) && M.mind) body += "HM -" diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index b3957a86b44..0802e6e8b1a 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -420,13 +420,8 @@ GLOBAL_LIST_INIT(admin_verbs_ticket, list( feedback_add_details("admin_verb","S") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return -/client/proc/findStealthKey(txt) - if(txt) - for(var/P in GLOB.stealthminID) - if(GLOB.stealthminID[P] == txt) - return P - txt = GLOB.stealthminID[ckey] - return txt +/client/proc/getStealthKey() + return GLOB.stealthminID[ckey] /client/proc/createStealthKey() var/num = (rand(0,1000)) diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index c2248261baa..220b1086172 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -305,7 +305,7 @@ - [close ? "" : ""]"} + [close ? "" : ""]"} /datum/admins/proc/check_antagonists() if(!check_rights(R_ADMIN)) @@ -418,7 +418,7 @@ var/mob/M = blob.current if(M) dat += "" - dat += "" + dat += "" else dat += "" dat += "
[T.title]
[M_name] - [M_rname] - [M_key] ([M_job]) @@ -342,7 +342,7 @@ dname = M return {"
[dname][caption][logout_status][istype(A, /area/security/permabrig) ? " (PERMA) " : ""][M.stat == 2 ? " (DEAD)" : ""]PM [ADMIN_FLW(M, "FLW")]
PM [ADMIN_FLW(M, "FLW")]
[ADMIN_PP(M,"[M.real_name]")][M.client ? "" : " (ghost)"][M.stat == 2 ? " (DEAD)" : ""]PMPM
Blob not found!
" diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index ce5f06053eb..48c407e6866 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -64,9 +64,7 @@ var/client/C if(istext(whom)) - if(cmptext(copytext(whom,1,2),"@")) - whom = findStealthKey(whom) - C = GLOB.directory[whom] + C = get_client_by_ckey(whom) else if(istype(whom,/client)) C = whom diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index ea099ea53b3..b5f5c51ba59 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -108,13 +108,9 @@ //Admin PM if(href_list["priv_msg"]) - var/client/C = locate(href_list["priv_msg"]) + var/ckey_txt = href_list["priv_msg"] - if(!C) // Might be a stealthmin ID, so pass it in straight - C = href_list["priv_msg"] - else if(C.UID() != href_list["priv_msg"]) - C = null // 404 client not found. Let cmd_admin_pm handle the error - cmd_admin_pm(C, null, href_list["type"]) + cmd_admin_pm(ckey_txt, null, href_list["type"]) return if(href_list["irc_msg"]) diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index c222f76eadb..639f3da7aaf 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -20,10 +20,10 @@ spawn() alert("You have logged in already with another key this round, please log out of this one NOW or risk being banned!") if(matches) if(M.client) - message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)].", 1) + message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)].", 1) log_adminwarn("Notice: [key_name(src)] has the same [matches] as [key_name(M)].") else - message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)] (no longer logged in). ", 1) + message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)] (no longer logged in). ", 1) log_adminwarn("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).") /mob/Login()