diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm
index 5915a9a6f6..cff2875e7d 100644
--- a/code/modules/client/client procs.dm
+++ b/code/modules/client/client procs.dm
@@ -187,6 +187,7 @@
GLOB.directory[ckey] = src
GLOB.ahelp_tickets.ClientLogin(src)
+ GLOB.mhelp_tickets.ClientLogin(src)
//Admin Authorisation
holder = admin_datums[ckey]
@@ -279,6 +280,7 @@
mentorholder.owner = null
GLOB.mentors -= src
GLOB.ahelp_tickets.ClientLogout(src)
+ GLOB.mhelp_tickets.ClientLogout(src)
GLOB.directory -= ckey
GLOB.clients -= src
return ..()
diff --git a/code/modules/mentor/mentor.dm b/code/modules/mentor/mentor.dm
index f897e1632c..bf3259d61a 100644
--- a/code/modules/mentor/mentor.dm
+++ b/code/modules/mentor/mentor.dm
@@ -107,7 +107,7 @@ var/list/mentor_verbs_default = list(
if(href_list["mhelp"])
var/mhelp_ref = href_list["mhelp"]
var/datum/mentor_help/MH = locate(mhelp_ref)
- if (MH)
+ if (MH && istype(MH, /datum/mentor_help))
MH.Action(href_list["mhelp_action"])
else
to_chat(C, "Ticket [mhelp_ref] has been deleted!")
@@ -168,7 +168,8 @@ var/list/mentor_verbs_default = list(
to_chat(src, "Error: Mentor-PM: You are unable to use admin PM-s (muted).")
return
- if(!(has_mentor_powers(src)) && !current_mentorhelp)
+ //Not a mentor and no open ticket
+ if(!has_mentor_powers(src) && !current_mentorhelp)
to_chat(src, "You can no longer reply to this ticket, please open another one by using the Mentorhelp verb if need be.")
to_chat(src, "Message: [msg]")
return
@@ -181,16 +182,7 @@ var/list/mentor_verbs_default = list(
else if(istype(whom,/client))
recipient = whom
- if(!recipient)
- if(has_mentor_powers(src))
- to_chat(src, "Error: Mentor-PM: Client not found.")
- to_chat(src, msg)
- else
- log_admin("Mentorhelp: [key_name(src)] sent [msg]")
- current_mentorhelp.MessageNoRecipient(msg)
- return
-
- //get message text, limit it's length.and clean/escape html
+ //get message text, limit it's length.and clean/escape html
if(!msg)
msg = tgui_input_text(src,"Message:", "Mentor-PM to [whom]")
@@ -204,11 +196,18 @@ var/list/mentor_verbs_default = list(
if(!recipient)
if(has_mentor_powers(src))
to_chat(src, "Error:Mentor-PM: Client not found.")
+ to_chat(src, msg)
else
- log_admin("Mentorhelp: [key_name(src)] sent [msg]")
+ log_admin("Mentorhelp: [key_name(src)]: [msg]")
current_mentorhelp.MessageNoRecipient(msg)
return
+ //Has mentor powers but the recipient no longer has an open ticket
+ if(has_mentor_powers(src) && !recipient.current_mentorhelp)
+ to_chat(src, "You can no longer reply to this ticket.")
+ to_chat(src, "Message: [msg]")
+ return
+
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
return
@@ -233,7 +232,7 @@ var/list/mentor_verbs_default = list(
to_chat(recipient, "Mentor-PM from-[src]: [msg]")
to_chat(src, "Mentor-PM to-[recipient]: [msg]")
- log_admin("[key_name(src)] sent [msg] to [key_name(recipient)]")
+ log_admin("[key_name(src)]->[key_name(recipient)]: [msg]")
if(recipient.is_preference_enabled(/datum/client_preference/play_mentorhelp_ping))
recipient << 'sound/effects/mentorhelp.mp3'
diff --git a/code/modules/mentor/mentorhelp.dm b/code/modules/mentor/mentorhelp.dm
index 1cce0702b1..e5f7ac49d8 100644
--- a/code/modules/mentor/mentorhelp.dm
+++ b/code/modules/mentor/mentorhelp.dm
@@ -143,7 +143,7 @@ GLOBAL_DATUM_INIT(mhelp_tickets, /datum/mentor_help_tickets, new)
name = msg
initiator = C
- initiator_ckey = initiator.ckey
+ initiator_ckey = C.ckey
initiator_key_name = key_name(initiator, FALSE, TRUE)
if(initiator.current_mentorhelp) //This is a bug
log_debug("Ticket erroneously left open by code")
@@ -154,7 +154,7 @@ GLOBAL_DATUM_INIT(mhelp_tickets, /datum/mentor_help_tickets, new)
statclick = new(null, src)
_interactions = list()
- log_admin("Mentorhelp: [key_name(C)] sent [msg]")
+ log_admin("Mentorhelp: [key_name(C)]: [msg]")
MessageNoRecipient(msg)
//show it to the person adminhelping too
to_chat(C, "Mentor-PM to-Mentors: [name]")
@@ -190,7 +190,7 @@ GLOBAL_DATUM_INIT(mhelp_tickets, /datum/mentor_help_tickets, new)
//message from the initiator without a target, all people with mentor powers will see this
/datum/mentor_help/proc/MessageNoRecipient(msg)
var/ref_src = "\ref[src]"
- var/chat_msg = "Ticket [TicketHref("#[id]", ref_src)]: [LinkedReplyName(ref_src)]: [msg]"
+ var/chat_msg = "(ESCALATE) Ticket [TicketHref("#[id]", ref_src)]: [LinkedReplyName(ref_src)]: [msg]"
AddInteraction("[LinkedReplyName(ref_src)]: [msg]")
for (var/client/C in GLOB.mentors)
if (C.is_preference_enabled(/datum/client_preference/play_mentorhelp_ping))
@@ -287,11 +287,29 @@ GLOBAL_DATUM_INIT(mhelp_tickets, /datum/mentor_help_tickets, new)
usr << browse(dat.Join(), "window=mhelp[id];size=620x480")
+//Kick ticket to admins
+/datum/mentor_help/proc/Escalate()
+ if(tgui_alert(usr, "Really escalate this ticket to admins? No mentors will ever be able to interact with it again if you do.","Escalate",list("Yes","No")) != "Yes")
+ return
+ if (src.initiator == null) // You can't escalate a mentorhelp of someone who's logged out because it won't create the adminhelp properly
+ to_chat(usr, "Error: client not found, unable to escalate.")
+ return
+ var/datum/admin_help/AH = new /datum/admin_help(src.name, src.initiator, FALSE)
+ message_mentors("[usr.ckey] escalated Ticket [TicketHref("#[id]")]")
+ log_admin("[key_name(usr)] escalated mentorhelp [src.name]")
+ to_chat(src.initiator, "[usr.ckey] escalated your mentorhelp to admins.")
+ AH._interactions = src._interactions
+ GLOB.mhelp_tickets.active_tickets -= src
+ GLOB.mhelp_tickets.resolved_tickets -= src
+ qdel(src)
+
/datum/mentor_help/proc/Context(ref_src)
if(!ref_src)
ref_src = "\ref[src]"
if(state == AHELP_ACTIVE)
. += ClosureLinks(ref_src)
+ if(state != AHELP_RESOLVED)
+ . += " (ESCALATE)"
//Forwarded action from admin/Topic OR mentor/Topic depending on which rank the caller has
/datum/mentor_help/proc/Action(action)
@@ -304,6 +322,8 @@ GLOBAL_DATUM_INIT(mhelp_tickets, /datum/mentor_help_tickets, new)
Resolve()
if("reopen")
Reopen()
+ if("escalate")
+ Escalate()
//
// TICKET STATCLICK
@@ -357,9 +377,9 @@ GLOBAL_DATUM_INIT(mhelp_tickets, /datum/mentor_help_tickets, new)
if(current_mentorhelp)
if(tgui_alert(usr, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No")) != "No")
if(current_mentorhelp)
- log_admin("Mentorhelp: [key_name(src)] sent [msg]")
+ log_admin("Mentorhelp: [key_name(src)]: [msg]")
current_mentorhelp.MessageNoRecipient(msg)
- to_chat(usr, "Mentor-PM to-Mentors: [msg]")
+ to_chat(usr, "Mentor-PM to-Mentors: [msg]")
return
else
to_chat(usr, "Ticket not found, creating new one...")