mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-28 23:59:40 +01:00
Merge branch 'CHOMPStation2:master' into BaseBlep
This commit is contained in:
@@ -81,4 +81,93 @@
|
||||
|
||||
/obj/item/clothing/under/equipped(var/mob/user, var/slot)
|
||||
. = ..()
|
||||
handle_digitigrade(user)
|
||||
handle_digitigrade(user)
|
||||
|
||||
//In shoe steppies!
|
||||
/obj/item/clothing/shoes/proc/handle_inshoe_stepping(var/mob/living/carbon/human/pred, var/mob/living/carbon/human/prey)
|
||||
if(!istype(pred)) return //Sorry, inshoe steppies only for carbon/human/ for now. Based on the regular stepping mechanics
|
||||
if(!istype(prey)) return
|
||||
if(!pred.canmove || pred.buckled) return //We can't be stepping on anyone if buckled or incapable of moving
|
||||
if(pred in buckled_mobs) return
|
||||
if(pred.flying) return //If we're flying, can't really step.
|
||||
|
||||
// I kept interactions very similar to normal steppies, and removed some attack logs unless harm intent:
|
||||
// I_HELP: No painful description, messages only sent to prey. Similar to inshoe steppies from before.
|
||||
// I_DISARM: Painful yet harmless descriptions, weaken on walk. Attack logs on weaken.
|
||||
// I_GRAB: Grabby/Squishing descriptions, weaken on walk. Attack logs on weaken.
|
||||
// I_HARM: Rand .5-1.5 multiplied by .25 min or 1.75 max, multiplied by 3.5 on walk. Ranges from .125 min to 9.1875 max damage to each limb
|
||||
var/message_pred = null
|
||||
var/message_prey = null
|
||||
|
||||
switch(pred.a_intent)
|
||||
if(I_HELP)
|
||||
if(prob(40)) //Reducing spam exclusively on I_HELP. Still more frequent than old pitiful prob(1)
|
||||
if(pred.m_intent == "run")
|
||||
message_prey = pick(
|
||||
"You feel weightless for a brief moment as \the [name] move upwards.",
|
||||
"[pred]'s weight bears down on you with each of their steps.",
|
||||
"\The [name] are a ride you've got no choice but to participate in as the wearer moves.",
|
||||
"The wearer of \the [name] moves, and their feet press down on you with each step.",
|
||||
"With each step, you're sandwiched again between [pred]'s feet and the insole of their boots.",
|
||||
"As [pred] moves, their foot presses you tightly against the insole of their boots with each step.")
|
||||
else
|
||||
message_prey = pick(
|
||||
"You feel weightless for a brief moment as \the [name] move upwards.",
|
||||
"[pred]'s weight bears down on you with each of the calm steps of their walk.",
|
||||
"\The [name] are a ride you've got no choice but to participate in as the wearer walks.",
|
||||
"The wearer of \the [name] walks, and their feet press down on you heavily with each step.",
|
||||
"With each step of their unhurried walk, you're tightly sandwiched between [pred]'s feet and the insole of their boots.",
|
||||
"As [pred] walks, their foot presses you tightly against the insole of their boots with each step.")
|
||||
to_chat(prey, span_emote_subtle("<I>[message_prey]</I>"))
|
||||
|
||||
return //No message for pred if I_HELP
|
||||
|
||||
if(I_DISARM)
|
||||
if(pred.m_intent == "run")
|
||||
message_pred = "You step on [prey], squishing and pinning them within your [name]!"
|
||||
message_prey = "[pred] steps on you, squishing and pinning you within their [name]!"
|
||||
else
|
||||
message_pred = "You firmly push your foot down on [prey], painfully but harmlessly pinning them to the sole of your [name]!"
|
||||
message_prey = "[pred] firmly pushes their foot down on you, painfully but harmlessly pinning you to the sole of their [name]!"
|
||||
prey.Weaken(5) // For flavour, only noticed prey if tossed out of shoe
|
||||
add_attack_logs(pred, prey, "Pinned inshoe (walk, weaken(5))")
|
||||
|
||||
if(I_GRAB)
|
||||
if(pred.m_intent == "run")
|
||||
message_pred = "You step down onto [prey], squishing and trapping them inbetween your toes!"
|
||||
message_prey = "[pred] steps down on you, squishing and trapping you inbetween their toes!"
|
||||
else
|
||||
message_pred = "You pin [prey] down against the sole of your [name] with your foot, your toes curling up around their body, tightly trapping them inbetween them!"
|
||||
message_prey = "[pred] pins you down against the sole of their [name] with their foot, their toes curling up around your body, tighly trapping you inbetween them!"
|
||||
prey.Weaken(5) // For flavour, only noticed prey if tossed out of shoe
|
||||
add_attack_logs(pred, prey, "Grabbed inshoe (walk, weaken(5))")
|
||||
|
||||
if(I_HURT)
|
||||
var/size_damage_multiplier = pred.size_multiplier - prey.size_multiplier
|
||||
|
||||
if(size_damage_multiplier < 0) // In case of odd situations such as wearing a shoe containing someone bigger than you.
|
||||
size_damage_multiplier = 0
|
||||
|
||||
//Assuming regular micro pickup sizes outside dorms, size_damage multiplier should range from .25 to 1.75... right?
|
||||
var/damage = (rand(5, 15) * size_damage_multiplier) / 10 // This will sting, but not kill unless pred walks. Will range from .125 to 2.625 damage, randomly, to each limb
|
||||
|
||||
if(pred.m_intent == "run")
|
||||
message_pred = "You carelessly step down onto [prey], crushing them within your [name]!"
|
||||
message_prey = "[pred] steps carelessly on your body, crushing you within their [name]!"
|
||||
add_attack_logs(pred, prey, "Crushed underfoot (run, about [damage] damage per limb)")
|
||||
else
|
||||
message_pred = "You methodically place your foot down upon [prey]'s body, applying pressure, crushing them against the sole of your [name]!"
|
||||
message_prey = "[pred] methodically places their foot upon your body, applying pressure, crushing you against the sole of their [name]!"
|
||||
damage *= 3.5 //Walking damage multiplier
|
||||
add_attack_logs(pred, prey, "Crushed underfoot (walk, about [damage] damage per limb)")
|
||||
|
||||
for(var/obj/item/organ/external/I in prey.organs)
|
||||
// Running Total: 1.50 damage min, 28.875 damage max, depending on size & RNG.
|
||||
// Walking Total: 5.25 damage min, 101.0625 damage max, depending on size & RNG. Ouch.
|
||||
I.take_damage(damage, 0)
|
||||
|
||||
if(message_pred != null)
|
||||
to_chat(pred, span_warning(message_pred))
|
||||
to_chat(prey, span_warning(message_prey))
|
||||
|
||||
return
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
var/species_sounds = "None" // By default, we have nothing.
|
||||
var/death_sound_override = null
|
||||
var/virtual_reality_mob = FALSE // gross boolean for keeping VR mobs in VR
|
||||
var/datum/looping_sound/mob/on_fire/firesoundloop
|
||||
// var/datum/looping_sound/mob/stunned/stunnedloop
|
||||
/* // Not sure if needed, screams aren't a carbon thing rn.
|
||||
var/scream_sound = null
|
||||
var/female_scream_sound = null
|
||||
@@ -22,11 +24,23 @@
|
||||
. = ..()
|
||||
|
||||
deaf_loop = new(list(src), FALSE)
|
||||
firesoundloop = new(list(src), FALSE)
|
||||
// stunnedloop = new(list(src), FALSE)
|
||||
if(firesoundloop) // Partly safety, partly so we can have different probs for randomization
|
||||
if(prob(40)) // Randomize our end_sound. Can't really do this easily in looping_sound without some work
|
||||
if(prob(30))
|
||||
firesoundloop.end_sound = 'sound/effects/mob_effects/on_fire/fire_extinguish2.ogg'
|
||||
else if(prob(20))
|
||||
firesoundloop.end_sound = 'sound/effects/mob_effects/on_fire/fire_extinguish3.ogg'
|
||||
else
|
||||
firesoundloop.end_sound = 'sound/effects/mob_effects/on_fire/fire_extinguish4.ogg'
|
||||
|
||||
/mob/living/Destroy()
|
||||
. = ..()
|
||||
|
||||
QDEL_NULL(deaf_loop)
|
||||
QDEL_NULL(firesoundloop)
|
||||
// QDEL_NULL(stunnedloop)
|
||||
|
||||
/mob/living/proc/vs_animate(var/belly_to_animate)
|
||||
return
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/obj/item/weapon/circuitboard,
|
||||
/obj/item/weapon/smes_coil,
|
||||
/obj/item/weapon/fuel_assembly,
|
||||
/obj/item/weapon/ore/bluespace_crystal
|
||||
/obj/item/weapon/bluespace_crystal
|
||||
) // CHOMPEdit - Buffing the gripper to allow bluespace crystal use for telesci building.
|
||||
|
||||
var/obj/item/wrapped = null // Item currently being held.
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
vore_bump_chance = 20
|
||||
size_multiplier = 1.10
|
||||
faction = "demon"
|
||||
damage_fatigue_mult = 0
|
||||
damage_fatigue_mult = 0.5 // We don't want to give them a flat, huge boost to attack speed, but at the same time, make them fight harder the closer they are to dying.
|
||||
injury_enrages = TRUE
|
||||
|
||||
armor_soak = list(
|
||||
"melee" = 5,
|
||||
@@ -371,4 +372,4 @@
|
||||
spawn_mob_type = /mob/living/simple_mob/vore/demonAI
|
||||
|
||||
/obj/item/capture_crystal/wendigo
|
||||
spawn_mob_type = /mob/living/simple_mob/vore/demonAI/wendigo
|
||||
spawn_mob_type = /mob/living/simple_mob/vore/demonAI/wendigo
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/datum/sprite_accessory/marking/vox/vox_alt_eyes
|
||||
icon = 'modular_chomp/icons/mob/human_races/markings_vox.dmi'
|
||||
|
||||
/datum/sprite_accessory/marking/vox/vox_underbeak
|
||||
name = "Vox Underbeak"
|
||||
icon = 'modular_chomp/icons/mob/human_races/markings_vox.dmi'
|
||||
icon_state = "vox_underbeak"
|
||||
body_parts = list(BP_HEAD)
|
||||
@@ -49,7 +49,9 @@ When editing the list, please try and keep similar probabilities near each other
|
||||
prob(10); "[info] Not every hostile NPC you encounter while mining or exploring need to be defeated. Sometimes, it's better to avoid or run away from them.",
|
||||
prob(1); "[info] Stay robust, my friends.",
|
||||
prob(35); "[info] You can insert your I.D into your PDA. This frees up your belt from having to carry your PDA. Furthermore, by clicking and dragging the PDA to game screen, you can use it without holding it!",
|
||||
prob(35); "[info] Your vore-bellies have multiple add-ons! Muffling is excellent to ensure your prey does not accidentally inform everyone about their predicament, and jam suit sensors is a great courtesy to avoid medical being worried about your prey!"
|
||||
prob(35); "[info] Your vore-bellies have multiple add-ons! Muffling is excellent to ensure your prey does not accidentally inform everyone about their predicament, and jam suit sensors is a great courtesy to avoid medical being worried about your prey!",
|
||||
prob(35); "[info] Remember to check your vore panel preferences! There you can find toggles for things other than just vore(tm), such as stepping mechanics and spontaneous transformation.",
|
||||
prob(25); "[info] If you would like to toggle stepping mechanics, head to the vore panel and click on personal preferences! Disabling stepping mechanics will disable stepping descriptions and will prevent your character from taking damage if a bigger character walks over yours with harm intent. Your character will still be stunned, however."
|
||||
)
|
||||
|
||||
if("roleplay")
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/datum/tgui_feedback
|
||||
var/selected_window
|
||||
|
||||
/datum/tgui_feedback/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "TguiFeedback", "TGUI Feedback Submission")
|
||||
ui.open()
|
||||
|
||||
/datum/tgui_feedback/tgui_state(mob/user)
|
||||
return GLOB.tgui_always_state
|
||||
|
||||
/datum/tgui_feedback/tgui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["open_windows"] = list()
|
||||
for(var/datum/tgui/ui in user.tgui_open_uis)
|
||||
data["open_windows"] += ui.title
|
||||
|
||||
return data
|
||||
|
||||
/datum/tgui_feedback/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["selected_window"] = selected_window
|
||||
|
||||
return data
|
||||
|
||||
/datum/tgui_feedback/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("pick_window")
|
||||
if(!params["win"])
|
||||
return
|
||||
|
||||
selected_window = sanitize(params["win"])
|
||||
. = TRUE
|
||||
if("submit")
|
||||
message_admins("TGUI Feedback: Rating [params["rating"]] - Comment: [params["comment"]]")
|
||||
. = TRUE
|
||||
|
||||
/client/verb/tgui_feedback()
|
||||
set name = "Submit TGUI Feedback"
|
||||
set category = "OOC"
|
||||
|
||||
var/datum/tgui_feedback/feedback = new()
|
||||
feedback.tgui_interact(usr)
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* tgui state: ticket_state
|
||||
*
|
||||
* Grants the user UI_INTERACTIVE, if a ticket is open.
|
||||
**/
|
||||
|
||||
GLOBAL_DATUM_INIT(tgui_ticket_state, /datum/tgui_state/ticket_state, new)
|
||||
|
||||
/datum/tgui_state/ticket_state/can_use_topic(src_object, mob/user)
|
||||
//if (user.client.current_ticket)
|
||||
// return STATUS_INTERACTIVE
|
||||
//return STATUS_CLOSE
|
||||
return STATUS_INTERACTIVE
|
||||
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// CLIENT PROCS
|
||||
//
|
||||
|
||||
/client/verb/mentorhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Mentorhelp"
|
||||
|
||||
if(say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, "<span class='danger'>Error: Mentor-PM: You cannot send adminhelps (Muted).</span>")
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
src.verbs -= /client/verb/mentorhelp
|
||||
spawn(600)
|
||||
src.verbs += /client/verb/mentorhelp // 1 minute cool-down for mentorhelps
|
||||
|
||||
feedback_add_details("admin_verb","Mentorhelp") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
if(current_ticket)
|
||||
if(tgui_alert(usr, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No")) != "No")
|
||||
if(current_ticket)
|
||||
log_admin("Mentorhelp: [key_name(src)]: [msg]")
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
to_chat(usr, "<span class='adminnotice'><span class='mentor'>Mentor-PM to-<b>Mentors</b>: [msg]</span></span>")
|
||||
return
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Ticket not found, creating new one...</span>")
|
||||
else
|
||||
current_ticket.AddInteraction("[usr.ckey] opened a new ticket.")
|
||||
current_ticket.Resolve()
|
||||
|
||||
new /datum/ticket(msg, src, FALSE, 1)
|
||||
|
||||
//admin proc
|
||||
/client/proc/cmd_mentor_ticket_panel()
|
||||
set name = "Mentor Ticket List"
|
||||
set category = "Admin"
|
||||
|
||||
var/browse_to
|
||||
|
||||
switch(tgui_input_list(usr, "Display which ticket list?", "List Choice", list("Active Tickets", "Resolved Tickets")))
|
||||
if("Active Tickets")
|
||||
browse_to = AHELP_ACTIVE
|
||||
if("Resolved Tickets")
|
||||
browse_to = AHELP_RESOLVED
|
||||
else
|
||||
return
|
||||
|
||||
GLOB.tickets.BrowseTickets(browse_to)
|
||||
|
||||
/proc/message_mentors(var/msg)
|
||||
msg = "<span class='mentor_channel'><span class='prefix'>Mentor:</span> <span class=\"message\">[msg]</span></span>"
|
||||
|
||||
for(var/client/C in GLOB.mentors)
|
||||
to_chat(C, msg)
|
||||
for(var/client/C in GLOB.admins)
|
||||
to_chat(C, msg)
|
||||
|
||||
//
|
||||
// CLIENT PROCS
|
||||
//
|
||||
|
||||
/client/verb/adminhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Adminhelp"
|
||||
|
||||
if(say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, "<span class='danger'>Error: Admin-PM: You cannot send adminhelps (Muted).</span>")
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
src.verbs -= /client/verb/adminhelp
|
||||
spawn(1200)
|
||||
src.verbs += /client/verb/adminhelp // 2 minute cool-down for adminhelps
|
||||
|
||||
feedback_add_details("admin_verb","Adminhelp") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
if(current_ticket)
|
||||
if(tgui_alert(usr, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No")) != "No")
|
||||
if(current_ticket)
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
to_chat(usr, "<span class='adminnotice'>PM to-<b>Admins</b>: [msg]</span>")
|
||||
return
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Ticket not found, creating new one...</span>")
|
||||
else
|
||||
current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
|
||||
current_ticket.Close()
|
||||
|
||||
new /datum/ticket(msg, src, FALSE, 0)
|
||||
|
||||
//admin proc
|
||||
/client/proc/cmd_admin_ticket_panel()
|
||||
set name = "Show Ticket List"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT, TRUE))
|
||||
return
|
||||
|
||||
var/browse_to
|
||||
|
||||
switch(tgui_input_list(usr, "Display which ticket list?", "List Choice", list("Active Tickets", "Closed Tickets", "Resolved Tickets")))
|
||||
if("Active Tickets")
|
||||
browse_to = AHELP_ACTIVE
|
||||
if("Closed Tickets")
|
||||
browse_to = AHELP_CLOSED
|
||||
if("Resolved Tickets")
|
||||
browse_to = AHELP_RESOLVED
|
||||
else
|
||||
return
|
||||
|
||||
GLOB.tickets.BrowseTickets(browse_to)
|
||||
|
||||
//// VOREstation Additions Below
|
||||
|
||||
/datum/ticket/proc/send2adminchat()
|
||||
if(!config.chat_webhook_url)
|
||||
return
|
||||
|
||||
var/list/adm = get_admin_counts()
|
||||
var/list/afkmins = adm["afk"]
|
||||
var/list/allmins = adm["total"]
|
||||
|
||||
spawn(0) //Unreliable world.Exports()
|
||||
var/query_string = "type=adminhelp"
|
||||
query_string += "&key=[url_encode(config.chat_webhook_key)]"
|
||||
query_string += "&from=[url_encode(key_name(initiator))]"
|
||||
query_string += "&msg=[url_encode(html_decode(name))]"
|
||||
query_string += "&admin_number=[allmins.len]"
|
||||
query_string += "&admin_number_afk=[afkmins.len]"
|
||||
world.Export("[config.chat_webhook_url]?[query_string]")
|
||||
|
||||
/client/verb/adminspice()
|
||||
set category = "Admin"
|
||||
set name = "Request Spice"
|
||||
set desc = "Request admins to spice round up for you"
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(usr, "<span class='danger'>Error: You cannot request spice (muted from adminhelps).</span>")
|
||||
return
|
||||
|
||||
if(tgui_alert(usr, "Are you sure you want to request the admins spice things up for you? You accept the consequences if you do.","Spicy!",list("Yes","No")) != "No")
|
||||
message_admins("[ADMIN_FULLMONTY(usr)] has requested the round be spiced up a little.")
|
||||
to_chat(usr, "<span class='notice'>You have requested some more spice in your round.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>Spice request cancelled.</span>")
|
||||
return
|
||||
|
||||
//if they requested spice, then remove spice verb temporarily to prevent spamming
|
||||
usr.verbs -= /client/verb/adminspice
|
||||
spawn(10 MINUTES)
|
||||
if(usr) // In case we left in the 10 minute cooldown
|
||||
usr.verbs += /client/verb/adminspice // 10 minute cool-down for spice request
|
||||
@@ -0,0 +1,806 @@
|
||||
/*
|
||||
|
||||
CHOMPedit - This file has been excluded from the compilation.
|
||||
Reason: Replaced with "Tickets System". Main logic has been moved to: modular_chomp/modules/tickets/tickets.dm
|
||||
|
||||
*/
|
||||
|
||||
/client/var/datum/ticket/current_ticket //the current ticket the (usually) not-admin client is dealing with
|
||||
/client/var/datum/ticket/selected_ticket //the current ticket being viewed in the Tickets Panel (usually) admin/mentor client
|
||||
|
||||
// CHOMPEdit Begin
|
||||
/proc/get_ahelp_channel()
|
||||
var/datum/tgs_api/v5/api = TGS_READ_GLOBAL(tgs)
|
||||
if(istype(api) && config.ahelp_channel_tag)
|
||||
for(var/datum/tgs_chat_channel/channel in api.chat_channels)
|
||||
if(channel.custom_tag == config.ahelp_channel_tag)
|
||||
return list(channel)
|
||||
return 0
|
||||
|
||||
/proc/ahelp_discord_message(var/message)
|
||||
if(!message)
|
||||
return
|
||||
if(config.discord_ahelps_disabled)
|
||||
return
|
||||
var/datum/tgs_chat_channel/ahelp_channel = get_ahelp_channel()
|
||||
if(ahelp_channel)
|
||||
world.TgsChatBroadcast(message,ahelp_channel)
|
||||
else
|
||||
world.TgsTargetedChatBroadcast(message,TRUE)
|
||||
// CHOMPEdit End
|
||||
|
||||
//
|
||||
//TICKET MANAGER
|
||||
//
|
||||
|
||||
GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
|
||||
|
||||
/datum/tickets
|
||||
var/list/active_tickets = list()
|
||||
var/list/closed_tickets = list()
|
||||
var/list/resolved_tickets = list()
|
||||
|
||||
var/obj/effect/statclick/ticket_list/astatclick = new(null, null, AHELP_ACTIVE)
|
||||
var/obj/effect/statclick/ticket_list/cstatclick = new(null, null, AHELP_CLOSED)
|
||||
var/obj/effect/statclick/ticket_list/rstatclick = new(null, null, AHELP_RESOLVED)
|
||||
|
||||
/datum/tickets/Destroy()
|
||||
QDEL_LIST(active_tickets)
|
||||
QDEL_LIST(closed_tickets)
|
||||
QDEL_LIST(resolved_tickets)
|
||||
QDEL_NULL(astatclick)
|
||||
QDEL_NULL(cstatclick)
|
||||
QDEL_NULL(rstatclick)
|
||||
return ..()
|
||||
|
||||
//private
|
||||
/datum/tickets/proc/ListInsert(datum/ticket/new_ticket)
|
||||
var/list/ticket_list
|
||||
switch(new_ticket.state)
|
||||
if(AHELP_ACTIVE)
|
||||
ticket_list = active_tickets
|
||||
if(AHELP_CLOSED)
|
||||
ticket_list = closed_tickets
|
||||
if(AHELP_RESOLVED)
|
||||
ticket_list = resolved_tickets
|
||||
else
|
||||
CRASH("Invalid ticket state: [new_ticket.state]")
|
||||
var/num_closed = ticket_list.len
|
||||
if(num_closed)
|
||||
for(var/I in 1 to num_closed)
|
||||
var/datum/ticket/T = ticket_list[I]
|
||||
if(T.id > new_ticket.id)
|
||||
ticket_list.Insert(I, new_ticket)
|
||||
return
|
||||
ticket_list += new_ticket
|
||||
|
||||
/datum/tickets/proc/BrowseTickets(state)
|
||||
tgui_interact(usr)
|
||||
|
||||
//opens the ticket listings for one of the 3 states
|
||||
/datum/tickets/proc/BrowseTicketsLegacy(state)
|
||||
var/list/l2b
|
||||
var/title
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
l2b = active_tickets
|
||||
title = "Active Tickets"
|
||||
if(AHELP_CLOSED)
|
||||
l2b = closed_tickets
|
||||
title = "Closed Tickets"
|
||||
if(AHELP_RESOLVED)
|
||||
l2b = resolved_tickets
|
||||
title = "Resolved Tickets"
|
||||
if(!l2b)
|
||||
return
|
||||
var/list/dat = list("<html><head><title>[title]</title></head>")
|
||||
dat += "<A HREF='?_src_=holder;[HrefToken()];ahelp_tickets=[state]'>Refresh</A><br><br>"
|
||||
for(var/datum/ticket/T as anything in l2b)
|
||||
dat += "<span class='adminnotice'><span class='adminhelp'>Ticket #[T.id]</span>: <A HREF='?_src_=holder;ahelp=\ref[T];[HrefToken()];ahelp_action=ticket'>[T.initiator_key_name]: [T.name]</A></span><br>"
|
||||
|
||||
usr << browse(dat.Join(), "window=ahelp_list[state];size=600x480")
|
||||
|
||||
//Tickets statpanel
|
||||
/datum/tickets/proc/stat_entry()
|
||||
var/num_disconnected = 0
|
||||
stat("== Tickets ==")
|
||||
stat("Active Tickets:", astatclick.update("[active_tickets.len]"))
|
||||
for(var/datum/ticket/T as anything in active_tickets)
|
||||
if(T.initiator)
|
||||
var/type = "N/A"
|
||||
switch(T.level)
|
||||
if(0)
|
||||
type = "ADM"
|
||||
if(1)
|
||||
type = "MEN"
|
||||
|
||||
if(usr.client.holder || T.level > 0)
|
||||
stat("\[[type]\] #[T.id]. [T.initiator_key_name]:", T.statclick.update())
|
||||
else
|
||||
++num_disconnected
|
||||
if(num_disconnected)
|
||||
stat("Disconnected:", astatclick.update("[num_disconnected]"))
|
||||
stat("Closed Tickets:", cstatclick.update("[closed_tickets.len]"))
|
||||
stat("Resolved Tickets:", rstatclick.update("[resolved_tickets.len]"))
|
||||
|
||||
//Reassociate still open ticket if one exists
|
||||
/datum/tickets/proc/ClientLogin(client/C)
|
||||
C.current_ticket = CKey2ActiveTicket(C.ckey)
|
||||
if(C.current_ticket)
|
||||
C.current_ticket.AddInteraction("Client reconnected.")
|
||||
C.current_ticket.initiator = C
|
||||
C.current_ticket.initiator.mob.throw_alert("open ticket", /obj/screen/alert/open_ticket)
|
||||
|
||||
//Dissasociate ticket
|
||||
/datum/tickets/proc/ClientLogout(client/C)
|
||||
if(C.current_ticket)
|
||||
C.current_ticket.AddInteraction("Client disconnected.")
|
||||
C.current_ticket.initiator.mob.clear_alert("open ticket")
|
||||
C.current_ticket.initiator = null
|
||||
C.current_ticket = null
|
||||
|
||||
//Get a ticket given a ckey
|
||||
/datum/tickets/proc/CKey2ActiveTicket(ckey)
|
||||
for(var/datum/ticket/T as anything in active_tickets)
|
||||
if(T.initiator_ckey == ckey)
|
||||
return T
|
||||
|
||||
//Get a ticket by ticket id
|
||||
/datum/tickets/proc/ID2Ticket(id)
|
||||
if(!usr?.client.holder || !has_mentor_powers(usr?.client))
|
||||
message_admins("[usr] has attempted to look up a ticket with ID [id] without sufficent privileges.")
|
||||
return
|
||||
|
||||
for(var/datum/ticket/T as anything in active_tickets)
|
||||
if(T.id == id)
|
||||
return T
|
||||
|
||||
for(var/datum/ticket/T as anything in resolved_tickets)
|
||||
if(T.id == id)
|
||||
return T
|
||||
|
||||
for(var/datum/ticket/T as anything in closed_tickets)
|
||||
if(T.id == id)
|
||||
return T
|
||||
|
||||
//
|
||||
//TICKET LIST STATCLICK
|
||||
//
|
||||
|
||||
/obj/effect/statclick/ticket_list
|
||||
var/current_state
|
||||
|
||||
/obj/effect/statclick/ticket_list/New(loc, name, state)
|
||||
current_state = state
|
||||
..()
|
||||
|
||||
/obj/effect/statclick/ticket_list/Click()
|
||||
GLOB.tickets.BrowseTickets(current_state)
|
||||
|
||||
//
|
||||
//TICKET DATUM
|
||||
//
|
||||
|
||||
/datum/ticket
|
||||
var/id
|
||||
var/name
|
||||
var/level = 0 // 0 = Admin, 1 = Mentor
|
||||
var/list/tags
|
||||
var/state = AHELP_ACTIVE
|
||||
|
||||
var/opened_at
|
||||
var/closed_at
|
||||
|
||||
var/client/initiator //semi-misnomer, it's the person who ahelped/was bwoinked
|
||||
var/handler = "/Unassigned\\" // The admin handling the ticket
|
||||
var/initiator_ckey
|
||||
var/initiator_key_name
|
||||
|
||||
var/list/_interactions //use AddInteraction() or, preferably, admin_ticket_log()
|
||||
|
||||
var/obj/effect/statclick/ticket/statclick
|
||||
|
||||
var/static/ticket_counter = 0
|
||||
|
||||
/*
|
||||
//call this on its own to create a ticket, don't manually assign current_mentorhelp
|
||||
//msg is the title of the ticket: usually the ahelp text
|
||||
/datum/mentor_help/New(msg, client/C)
|
||||
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")
|
||||
initiator.current_mentorhelp.AddInteraction("Ticket erroneously left open by code")
|
||||
initiator.current_mentorhelp.Resolve()
|
||||
initiator.current_mentorhelp = src
|
||||
statclick = new(null, src)
|
||||
_interactions = list()
|
||||
log_admin("Mentorhelp: [key_name(C)]: [msg]")
|
||||
MessageNoRecipient(msg)
|
||||
//show it to the person adminhelping too
|
||||
to_chat(C, "<i><span class='mentor'>Mentor-PM to-<b>Mentors</b>: [name]</span></i>")
|
||||
GLOB.mhelp_tickets.active_tickets += src */
|
||||
|
||||
/**
|
||||
* public
|
||||
*
|
||||
* Create a new Ticket.
|
||||
* Call this on its own to create a ticket, don't manually assign current_ticket
|
||||
*
|
||||
* required msg string The title of the ticket: usually the ahelp text
|
||||
* required C client The object or datum which owns the UI.
|
||||
* required is_bwoink boolean TRUE if this ticket was started by an admin PM
|
||||
* required level integer The level of the ticket. 0 = Admin, 1 = Mentor
|
||||
*/
|
||||
/datum/ticket/New(msg, client/C, is_bwoink, ticket_level)
|
||||
//clean the input msg
|
||||
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
|
||||
if(!msg || !C || !C.mob)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
id = ++ticket_counter
|
||||
opened_at = world.time
|
||||
|
||||
name = msg
|
||||
|
||||
level = ticket_level
|
||||
|
||||
initiator = C
|
||||
initiator_ckey = initiator.ckey
|
||||
initiator_key_name = key_name(initiator, FALSE, TRUE)
|
||||
if(initiator.current_ticket) //This is a bug
|
||||
log_debug("Multiple ahelp current_tickets")
|
||||
initiator.current_ticket.AddInteraction("Ticket erroneously left open by code")
|
||||
initiator.current_ticket.Close()
|
||||
initiator.current_ticket = src
|
||||
|
||||
var/parsed_message = keywords_lookup(msg)
|
||||
|
||||
statclick = new(null, src)
|
||||
_interactions = list()
|
||||
|
||||
if(is_bwoink)
|
||||
AddInteraction("<font color='blue'>[key_name_admin(usr)] PM'd [LinkedReplyName()]</font>")
|
||||
message_admins("<font color='blue'>Ticket [TicketHref("#[id]")] created</font>")
|
||||
else
|
||||
MessageNoRecipient(parsed_message)
|
||||
send2adminchat() //VOREStation Add
|
||||
//show it to the person adminhelping too
|
||||
to_chat(C, "<span class='adminnotice'>PM to-<b>Admins</b>: [name]</span>")
|
||||
|
||||
//send it to irc if nobody is on and tell us how many were on
|
||||
var/admin_number_present = send2irc_adminless_only(initiator_ckey, name)
|
||||
log_admin("Ticket #[id]: [key_name(initiator)]: [name] - heard by [admin_number_present] non-AFK admins who have +BAN.")
|
||||
if(admin_number_present <= 0)
|
||||
to_chat(C, "<span class='notice'>No active admins are online, your adminhelp was sent to the admin discord.</span>") //VOREStation Edit
|
||||
send2adminchat() //VOREStation Add
|
||||
//YW EDIT START
|
||||
var/list/adm = get_admin_counts()
|
||||
var/list/activemins = adm["present"]
|
||||
var activeMins = activemins.len
|
||||
if(is_bwoink)
|
||||
ahelp_discord_message("ADMINHELP: FROM: [key_name_admin(usr)] TO [initiator_ckey]/[initiator_key_name] - MSG: **[msg]** - Heard by [activeMins] NON-AFK staff members.") //CHOMPEdit
|
||||
else
|
||||
ahelp_discord_message("ADMINHELP: FROM: [initiator_ckey]/[initiator_key_name] - MSG: **[msg]** - Heard by [activeMins] NON-AFK staff members.") //CHOMPEdit
|
||||
//YW EDIT END
|
||||
|
||||
// Also send it to discord since that's the hip cool thing now.
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_AHELP_SENT,
|
||||
list(
|
||||
"name" = "Ticket ([id]) (Game ID: [game_id]) ticket opened.",
|
||||
"body" = "[key_name(initiator)] has opened a ticket. \n[msg]",
|
||||
"color" = COLOR_WEBHOOK_POOR
|
||||
)
|
||||
)
|
||||
|
||||
GLOB.tickets.active_tickets += src
|
||||
|
||||
// Open a new chat with the user
|
||||
//var/datum/ticket_chat/TC = new()
|
||||
//TC.T = src
|
||||
//TC.tgui_interact(C.mob)
|
||||
C.mob.throw_alert("open ticket", /obj/screen/alert/open_ticket)
|
||||
|
||||
/datum/ticket/Destroy()
|
||||
RemoveActive()
|
||||
GLOB.tickets.closed_tickets -= src
|
||||
GLOB.tickets.resolved_tickets -= src
|
||||
return ..()
|
||||
|
||||
/datum/ticket/proc/AddInteraction(formatted_message)
|
||||
var/curinteraction = "[gameTimestamp()]: [formatted_message]"
|
||||
if(config.discord_ahelps_all) //CHOMPEdit
|
||||
ahelp_discord_message("ADMINHELP: TICKETID:[id] [strip_html_properly(curinteraction)]") //CHOMPEdit
|
||||
_interactions += curinteraction
|
||||
|
||||
/datum/ticket/proc/TicketPanel()
|
||||
tgui_interact(usr.client.mob)
|
||||
|
||||
//private
|
||||
/datum/ticket/proc/FullMonty(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
if(initiator && initiator.mob)
|
||||
. = ADMIN_FULLMONTY_NONAME(initiator.mob)
|
||||
else
|
||||
. = "Initiator disconnected."
|
||||
if(state == AHELP_ACTIVE)
|
||||
. += ClosureLinks(ref_src)
|
||||
|
||||
//private
|
||||
/datum/ticket/proc/ClosureLinks(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
|
||||
if(level == 0)
|
||||
. = " (<A HREF='?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=reject'>REJT</A>)"
|
||||
. += " (<A HREF='?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=icissue'>IC</A>)"
|
||||
. += " (<A HREF='?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=close'>CLOSE</A>)"
|
||||
. += " (<A HREF='?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=resolve'>RSLVE</A>)"
|
||||
. += " (<A HREF='?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=handleissue'>HANDLE</A>)"
|
||||
else
|
||||
. = " (<A HREF='?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=resolve'>RSLVE</A>)"
|
||||
|
||||
//private
|
||||
/datum/ticket/proc/LinkedReplyName(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
return "<A HREF='?_src_=holder;ticket=[ref_src];ticket_action=reply'>[initiator_key_name]</A>"
|
||||
|
||||
//private
|
||||
/datum/ticket/proc/TicketHref(msg, ref_src, action = "ticket")
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
return "<A HREF='?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=[action]'>[msg]</A>"
|
||||
|
||||
/*
|
||||
var/chat_msg = "<span class='notice'>(<A HREF='?_src_=mentorholder;mhelp=[ref_src];[HrefToken(TRUE)];mhelp_action=escalate'>ESCALATE</A>) Ticket [TicketHref("#[id]", ref_src)]<b>: [LinkedReplyName(ref_src)]:</b> [msg]</span>"
|
||||
*/
|
||||
|
||||
//message from the initiator without a target, all admins will see this
|
||||
//won't bug irc
|
||||
/datum/ticket/proc/MessageNoRecipient(msg)
|
||||
var/ref_src = "\ref[src]"
|
||||
var/chat_msg = "<span class='adminnotice'><span class='adminhelp'>Ticket [TicketHref("#[id]", ref_src)]</span><b>: [LinkedReplyName(ref_src)] [FullMonty(ref_src)]:</b> [msg]</span>"
|
||||
|
||||
AddInteraction("<font color='red'>[LinkedReplyName(ref_src)]: [msg]</font>")
|
||||
//send this msg to all admins
|
||||
|
||||
if(level == 1)
|
||||
for (var/client/C in GLOB.mentors)
|
||||
if (C.is_preference_enabled(/datum/client_preference/play_mentorhelp_ping))
|
||||
C << 'sound/effects/mentorhelp.mp3'
|
||||
for (var/client/C in GLOB.admins)
|
||||
if (C.is_preference_enabled(/datum/client_preference/play_mentorhelp_ping))
|
||||
C << 'sound/effects/mentorhelp.mp3'
|
||||
message_mentors(chat_msg)
|
||||
else if(level == 0)
|
||||
for(var/client/X in GLOB.admins)
|
||||
if(X.is_preference_enabled(/datum/client_preference/holder/play_adminhelp_ping))
|
||||
X << 'sound/effects/adminhelp.ogg'
|
||||
window_flash(X)
|
||||
to_chat(X, chat_msg)
|
||||
|
||||
/*
|
||||
//Reopen a closed ticket
|
||||
/datum/mentor_help/proc/Reopen()
|
||||
switch(state)
|
||||
if(AHELP_RESOLVED)
|
||||
feedback_dec("mhelp_resolve")
|
||||
AddInteraction("<font color='purple'>Reopened by [usr.ckey]</font>")
|
||||
if(initiator)
|
||||
to_chat(initiator, "<span class='filter_adminlog'><font color='purple'>Ticket [TicketHref("#[id]")] was reopened by [usr.ckey].</font></span>")
|
||||
var/msg = "<span class='adminhelp'>Ticket [TicketHref("#[id]")] reopened by [usr.ckey].</span>"
|
||||
message_mentors(msg)
|
||||
log_admin(msg)
|
||||
*/
|
||||
|
||||
//Reopen a closed ticket
|
||||
/datum/ticket/proc/Reopen()
|
||||
if(state == AHELP_ACTIVE)
|
||||
to_chat(usr, "<span class='warning'>This ticket is already open.</span>")
|
||||
return
|
||||
|
||||
if(GLOB.tickets.CKey2ActiveTicket(initiator_ckey))
|
||||
to_chat(usr, "<span class='warning'>This user already has an active ticket, cannot reopen this one.</span>")
|
||||
return
|
||||
|
||||
statclick = new(null, src)
|
||||
GLOB.tickets.active_tickets += src
|
||||
GLOB.tickets.closed_tickets -= src
|
||||
GLOB.tickets.resolved_tickets -= src
|
||||
switch(state)
|
||||
if(AHELP_CLOSED)
|
||||
feedback_dec("ticket_close")
|
||||
if(AHELP_RESOLVED)
|
||||
feedback_dec("ticket_resolve")
|
||||
state = AHELP_ACTIVE
|
||||
closed_at = null
|
||||
if(initiator)
|
||||
initiator.current_ticket = src
|
||||
|
||||
AddInteraction("<font color='purple'>Reopened by [key_name_admin(usr)]</font>")
|
||||
if(initiator)
|
||||
to_chat(initiator, "<span class='filter_adminlog'><font color='purple'>Ticket [TicketHref("#[id]")] was reopened by [key_name(usr,FALSE,FALSE)].</font></span>")
|
||||
var/msg = "<span class='adminhelp'>Ticket [TicketHref("#[id]")] reopened by [key_name_admin(usr)].</span>"
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
feedback_inc("ticket_reopen")
|
||||
//TicketPanel() //can only be done from here, so refresh it
|
||||
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_AHELP_SENT,
|
||||
list(
|
||||
"name" = "Ticket ([id]) (Game ID: [game_id]) reopened.",
|
||||
"body" = "Reopened by [key_name(usr)]."
|
||||
)
|
||||
)
|
||||
|
||||
//private
|
||||
/datum/ticket/proc/RemoveActive()
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
closed_at = world.time
|
||||
QDEL_NULL(statclick)
|
||||
GLOB.tickets.active_tickets -= src
|
||||
if(initiator && initiator.current_ticket == src)
|
||||
initiator.current_ticket = null
|
||||
|
||||
//Mark open ticket as closed/meme
|
||||
/datum/ticket/proc/Close(silent = FALSE)
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
RemoveActive()
|
||||
state = AHELP_CLOSED
|
||||
GLOB.tickets.ListInsert(src)
|
||||
AddInteraction("<span class='filter_adminlog'><font color='red'>Closed by [key_name_admin(usr)].</font></span>")
|
||||
if(initiator)
|
||||
to_chat(initiator, "<span class='filter_adminlog'><font color='red'>Ticket [TicketHref("#[id]")] was closed by [key_name(usr,FALSE,FALSE)].</font></span>")
|
||||
if(!silent)
|
||||
feedback_inc("ahelp_close")
|
||||
var/msg = "Ticket [TicketHref("#[id]")] closed by [key_name_admin(usr)]."
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_AHELP_SENT,
|
||||
list(
|
||||
"name" = "Ticket ([id]) (Game ID: [game_id]) closed.",
|
||||
"body" = "Closed by [key_name(usr)].",
|
||||
"color" = COLOR_WEBHOOK_BAD
|
||||
)
|
||||
)
|
||||
initiator?.mob?.clear_alert("open ticket")
|
||||
|
||||
//Mark open ticket as resolved/legitimate, returns ahelp verb
|
||||
/datum/ticket/proc/Resolve(silent = FALSE)
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
RemoveActive()
|
||||
state = AHELP_RESOLVED
|
||||
GLOB.tickets.ListInsert(src)
|
||||
|
||||
AddInteraction("<span class='filter_adminlog'><font color='green'>Resolved by [key_name_admin(usr)].</font></span>")
|
||||
if(initiator)
|
||||
to_chat(initiator, "<span class='filter_adminlog'><font color='green'>Ticket [TicketHref("#[id]")] was marked resolved by [key_name(usr,FALSE,FALSE)].</font></span>")
|
||||
if(!silent)
|
||||
feedback_inc("ticket_resolve")
|
||||
var/msg = "Ticket [TicketHref("#[id]")] resolved by [key_name_admin(usr)]"
|
||||
if(type == 1)
|
||||
message_mentors(msg)
|
||||
else if (type == 0)
|
||||
message_admins(msg)
|
||||
|
||||
log_admin(msg)
|
||||
if(type == 1)
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_AHELP_SENT,
|
||||
list(
|
||||
"name" = "Ticket ([id]) (Game ID: [game_id]) resolved.",
|
||||
"body" = "Marked as Resolved by [key_name(usr)].",
|
||||
"color" = COLOR_WEBHOOK_GOOD
|
||||
)
|
||||
)
|
||||
initiator?.mob?.clear_alert("open ticket")
|
||||
|
||||
//Close and return ahelp verb, use if ticket is incoherent
|
||||
/datum/ticket/proc/Reject(key_name = key_name_admin(usr))
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
|
||||
if(initiator)
|
||||
if(initiator.is_preference_enabled(/datum/client_preference/holder/play_adminhelp_ping))
|
||||
initiator << 'sound/effects/adminhelp.ogg'
|
||||
|
||||
to_chat(initiator, "<span class='filter_pm'><font color='red' size='4'><b>- AdminHelp Rejected! -</b></font><br>\
|
||||
<font color='red'><b>Your admin help was rejected.</b></font><br>\
|
||||
Please try to be calm, clear, and descriptive in admin helps, do not assume the admin has seen any related events, and clearly state the names of anybody you are reporting.</span>")
|
||||
|
||||
feedback_inc("ahelp_reject")
|
||||
var/msg = "Ticket [TicketHref("#[id]")] rejected by [key_name_admin(usr)]"
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
AddInteraction("Rejected by [key_name_admin(usr)].")
|
||||
Close(silent = TRUE)
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_AHELP_SENT,
|
||||
list(
|
||||
"name" = "Ticket ([id]) (Game ID: [game_id]) rejected.",
|
||||
"body" = "Rejected by [key_name(usr)].",
|
||||
"color" = COLOR_WEBHOOK_BAD
|
||||
)
|
||||
)
|
||||
|
||||
//Resolve ticket with IC Issue message
|
||||
/datum/ticket/proc/ICIssue(key_name = key_name_admin(usr))
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
|
||||
var/msg = "<span class='filter_pm'><font color='red' size='4'><b>- AdminHelp marked as IC issue! -</b></font><br>"
|
||||
msg += "<font color='red'><b>This is something that can be solved ICly, and does not currently require staff intervention.</b></font><br>"
|
||||
msg += "<font color='red'>Your AdminHelp may also be unanswerable due to ongoing events.</font></span>"
|
||||
|
||||
if(initiator)
|
||||
to_chat(initiator, msg)
|
||||
|
||||
feedback_inc("ahelp_icissue")
|
||||
msg = "Ticket [TicketHref("#[id]")] marked as IC by [key_name_admin(usr)]"
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
AddInteraction("Marked as IC issue by [key_name_admin(usr)]")
|
||||
Resolve(silent = TRUE)
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_AHELP_SENT,
|
||||
list(
|
||||
"name" = "Ticket ([id]) (Game ID: [game_id]) marked as IC issue.",
|
||||
"body" = "Marked as IC Issue by [key_name(usr)].",
|
||||
"color" = COLOR_WEBHOOK_BAD
|
||||
)
|
||||
)
|
||||
|
||||
//Resolve ticket with IC Issue message
|
||||
/datum/ticket/proc/HandleIssue()
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
|
||||
if(handler == key_name(usr, FALSE, TRUE))
|
||||
to_chat("<font color='red'>You are already handling this ticket.</font>")
|
||||
return
|
||||
|
||||
var/msg = "<font color='red'>Your AdminHelp is being handled by [key_name(usr,FALSE,FALSE)] please be patient.</font>"
|
||||
|
||||
if(initiator)
|
||||
to_chat(initiator, msg)
|
||||
|
||||
feedback_inc("ahelp_handling")
|
||||
msg = "Ticket [TicketHref("#[id]")] being handled by [key_name(usr,FALSE,FALSE)]"
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
AddInteraction("[key_name_admin(usr)] is now handling this ticket.")
|
||||
handler = key_name(usr, FALSE, TRUE)
|
||||
SSwebhooks.send(
|
||||
WEBHOOK_AHELP_SENT,
|
||||
list(
|
||||
"name" = "Ticket ([id]) (Game ID: [game_id]) being handled.",
|
||||
"body" = "[key_name(usr)] is now handling the ticket."
|
||||
)
|
||||
)
|
||||
|
||||
/datum/ticket/proc/Retitle()
|
||||
var/new_title = tgui_input_text(usr, "Enter a title for the ticket", "Rename Ticket", name)
|
||||
if(new_title)
|
||||
name = new_title
|
||||
//not saying the original name cause it could be a long ass message
|
||||
var/msg = "Ticket [TicketHref("#[id]")] titled [name] by [key_name_admin(usr)]"
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
//TicketPanel() //we have to be here to do this
|
||||
|
||||
//Kick ticket to next level
|
||||
/datum/ticket/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, "<span class='pm warning'>Error: client not found, unable to escalate.</span>")
|
||||
return
|
||||
|
||||
level = level - 1
|
||||
|
||||
message_mentors("[usr.ckey] escalated Ticket [TicketHref("#[id]")]")
|
||||
log_admin("[key_name(usr)] escalated ticket [src.name]")
|
||||
to_chat(src.initiator, "<span class='mentor'>[usr.ckey] escalated your ticket to admins.</span>")
|
||||
|
||||
/datum/ticket/proc/Context(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
if(state == AHELP_ACTIVE)
|
||||
. += ClosureLinks(ref_src)
|
||||
if(state != AHELP_RESOLVED)
|
||||
. += " (<A HREF='?_src_=mentorholder;mhelp=[ref_src];mhelp_action=escalate'>ESCALATE</A>)"
|
||||
|
||||
//Forwarded action from admin/Topic
|
||||
/datum/ticket/proc/Action(action)
|
||||
testing("Ahelp action: [action]")
|
||||
switch(action)
|
||||
if("ticket")
|
||||
TicketPanel()
|
||||
if("retitle")
|
||||
Retitle()
|
||||
if("reject")
|
||||
Reject()
|
||||
if("reply")
|
||||
usr.client.cmd_ahelp_reply(initiator)
|
||||
if("icissue")
|
||||
ICIssue()
|
||||
if("close")
|
||||
Close()
|
||||
if("resolve")
|
||||
Resolve()
|
||||
if("handleissue")
|
||||
HandleIssue()
|
||||
if("reopen")
|
||||
Reopen()
|
||||
if("escalate")
|
||||
Escalate()
|
||||
|
||||
//
|
||||
// TICKET STATCLICK
|
||||
//
|
||||
|
||||
/obj/effect/statclick/ticket
|
||||
var/datum/ticket/ticket_datum
|
||||
|
||||
/obj/effect/statclick/ticket/New(loc, datum/ticket/T)
|
||||
ticket_datum = T
|
||||
..(loc)
|
||||
|
||||
/obj/effect/statclick/ticket/update()
|
||||
return ..(ticket_datum.name)
|
||||
|
||||
/obj/effect/statclick/ticket/Click()
|
||||
ticket_datum.TicketPanel()
|
||||
|
||||
/obj/effect/statclick/ticket/Destroy()
|
||||
ticket_datum = null
|
||||
return ..()
|
||||
|
||||
//
|
||||
// LOGGING
|
||||
//
|
||||
|
||||
//Use this proc when an admin takes action that may be related to an open ticket on what
|
||||
//what can be a client, ckey, or mob
|
||||
/proc/admin_ticket_log(what, message)
|
||||
var/client/C
|
||||
var/mob/Mob = what
|
||||
if(istype(Mob))
|
||||
C = Mob.client
|
||||
else
|
||||
C = what
|
||||
if(istype(C) && C.current_ticket)
|
||||
C.current_ticket.AddInteraction(message)
|
||||
return C.current_ticket
|
||||
if(istext(what)) //ckey
|
||||
var/datum/ticket/T = GLOB.tickets.CKey2ActiveTicket(what)
|
||||
if(T)
|
||||
T.AddInteraction(message)
|
||||
return T
|
||||
|
||||
//
|
||||
// HELPER PROCS
|
||||
//
|
||||
|
||||
/proc/get_admin_counts(requiredflags = R_BAN)
|
||||
. = list("total" = list(), "noflags" = list(), "afk" = list(), "stealth" = list(), "present" = list())
|
||||
for(var/client/X in GLOB.admins)
|
||||
.["total"] += X
|
||||
if(requiredflags != 0 && !check_rights(rights_required = requiredflags, show_msg = FALSE, C = X))
|
||||
.["noflags"] += X
|
||||
else if(X.is_afk())
|
||||
.["afk"] += X
|
||||
else if(X.holder.fakekey)
|
||||
.["stealth"] += X
|
||||
else
|
||||
.["present"] += X
|
||||
|
||||
/proc/send2irc_adminless_only(source, msg, requiredflags = R_BAN)
|
||||
var/list/adm = get_admin_counts()
|
||||
var/list/activemins = adm["present"]
|
||||
. = activemins.len
|
||||
if(. <= 0)
|
||||
var/final = ""
|
||||
var/list/afkmins = adm["afk"]
|
||||
var/list/stealthmins = adm["stealth"]
|
||||
var/list/powerlessmins = adm["noflags"]
|
||||
var/list/allmins = adm["total"]
|
||||
if(!afkmins.len && !stealthmins.len && !powerlessmins.len)
|
||||
final = "[msg] - No admins online"
|
||||
else
|
||||
final = "[msg] - All admins stealthed\[[english_list(stealthmins)]\], AFK\[[english_list(afkmins)]\], or lacks +BAN\[[english_list(powerlessmins)]\]! Total: [allmins.len] "
|
||||
send2irc(source,final)
|
||||
|
||||
/proc/ircadminwho()
|
||||
var/list/message = list("Admins: ")
|
||||
var/list/admin_keys = list()
|
||||
for(var/client/C as anything in GLOB.admins)
|
||||
admin_keys += "[C][C.holder.fakekey ? "(Stealth)" : ""][C.is_afk() ? "(AFK)" : ""]"
|
||||
|
||||
for(var/admin in admin_keys)
|
||||
if(LAZYLEN(admin_keys) > 1)
|
||||
message += ", [admin]"
|
||||
else
|
||||
message += "[admin]"
|
||||
|
||||
return jointext(message, "")
|
||||
|
||||
/proc/keywords_lookup(msg,irc)
|
||||
|
||||
//This is a list of words which are ignored by the parser when comparing message contents for names. MUST BE IN LOWER CASE!
|
||||
var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","alien","as", "i")
|
||||
|
||||
//explode the input msg into a list
|
||||
var/list/msglist = splittext(msg, " ")
|
||||
|
||||
//generate keywords lookup
|
||||
var/list/surnames = list()
|
||||
var/list/forenames = list()
|
||||
var/list/ckeys = list()
|
||||
var/founds = ""
|
||||
for(var/mob/M in mob_list)
|
||||
var/list/indexing = list(M.real_name, M.name)
|
||||
if(M.mind)
|
||||
indexing += M.mind.name
|
||||
|
||||
for(var/string in indexing)
|
||||
var/list/L = splittext(string, " ")
|
||||
var/surname_found = 0
|
||||
//surnames
|
||||
for(var/i=L.len, i>=1, i--)
|
||||
var/word = ckey(L[i])
|
||||
if(word)
|
||||
surnames[word] = M
|
||||
surname_found = i
|
||||
break
|
||||
//forenames
|
||||
for(var/i=1, i<surname_found, i++)
|
||||
var/word = ckey(L[i])
|
||||
if(word)
|
||||
forenames[word] = M
|
||||
//ckeys
|
||||
ckeys[M.ckey] = M
|
||||
|
||||
var/ai_found = 0
|
||||
msg = ""
|
||||
var/list/mobs_found = list()
|
||||
for(var/original_word in msglist)
|
||||
var/word = ckey(original_word)
|
||||
if(word)
|
||||
if(!(word in adminhelp_ignored_words))
|
||||
if(word == "ai")
|
||||
ai_found = 1
|
||||
else
|
||||
var/mob/found = ckeys[word]
|
||||
if(!found)
|
||||
found = surnames[word]
|
||||
if(!found)
|
||||
found = forenames[word]
|
||||
if(found)
|
||||
if(!(found in mobs_found))
|
||||
mobs_found += found
|
||||
if(!ai_found && isAI(found))
|
||||
ai_found = 1
|
||||
var/is_antag = 0
|
||||
if(found.mind && found.mind.special_role)
|
||||
is_antag = 1
|
||||
founds += "Name: [found.name]([found.real_name]) Ckey: [found.ckey] [is_antag ? "(Antag)" : null] "
|
||||
msg += "[original_word]<font size='1' color='[is_antag ? "red" : "black"]'>(<A HREF='?_src_=holder;adminmoreinfo=\ref[found]'>?</A>|<A HREF='?_src_=holder;adminplayerobservefollow=\ref[found]'>F</A>)</font> "
|
||||
continue
|
||||
msg += "[original_word] "
|
||||
if(irc)
|
||||
if(founds == "")
|
||||
return "Search Failed"
|
||||
else
|
||||
return founds
|
||||
|
||||
return msg
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
//PLAYERSIDE TICKET UI
|
||||
//
|
||||
|
||||
/datum/ticket_chat
|
||||
var/datum/ticket/T
|
||||
|
||||
/datum/ticket_chat/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "TicketChat", "Ticket #[T.id] - [T.LinkedReplyName("\ref[T]")]")
|
||||
ui.open()
|
||||
user.clear_alert("open ticket")
|
||||
|
||||
/datum/ticket_chat/tgui_close(mob/user)
|
||||
. = ..()
|
||||
if(user.client.current_ticket)
|
||||
user.throw_alert("open ticket", /obj/screen/alert/open_ticket)
|
||||
|
||||
/datum/ticket_chat/tgui_state(mob/user)
|
||||
return GLOB.tgui_ticket_state
|
||||
|
||||
/datum/ticket_chat/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["id"] = T.id
|
||||
|
||||
data["level"] = T.level
|
||||
data["handler"] = T.handler
|
||||
|
||||
data["log"] = T._interactions
|
||||
|
||||
return data
|
||||
|
||||
/datum/ticket_chat/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("send_msg")
|
||||
if(!params["msg"])
|
||||
return
|
||||
|
||||
usr.client.cmd_admin_pm(usr.client, sanitize(params["msg"]), T)
|
||||
. = TRUE
|
||||
@@ -0,0 +1,340 @@
|
||||
//
|
||||
//TICKET MANAGER
|
||||
//
|
||||
|
||||
/datum/tickets/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "TicketsPanel", "Tickets")
|
||||
ui.open()
|
||||
|
||||
/datum/tickets/tgui_state(mob/user)
|
||||
return GLOB.tgui_admin_state
|
||||
|
||||
/datum/tickets/proc/get_ticket_state(state)
|
||||
var/ticket_state
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
ticket_state = "open"
|
||||
// TODO: Mentor tickets cannot be resolved
|
||||
if(AHELP_RESOLVED)
|
||||
ticket_state = "resolved"
|
||||
if(AHELP_CLOSED)
|
||||
ticket_state = "closed"
|
||||
else
|
||||
ticket_state = "unknown"
|
||||
|
||||
return ticket_state
|
||||
|
||||
/datum/tickets/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/tickets = list()
|
||||
|
||||
var/selected_ticket = null
|
||||
|
||||
if(user.client.selected_ticket)
|
||||
var/datum/ticket/T = user.client.selected_ticket
|
||||
selected_ticket = list(
|
||||
"id" = T.id,
|
||||
"name" = T.LinkedReplyName(),
|
||||
"state" = get_ticket_state(T.state),
|
||||
"level" = T.level,
|
||||
"handler" = T.handler,
|
||||
"opened_at" = (world.time - T.opened_at),
|
||||
"closed_at" = (world.time - T.closed_at),
|
||||
"opened_at_date" = gameTimestamp(wtime = T.opened_at),
|
||||
"closed_at_date" = gameTimestamp(wtime = T.closed_at),
|
||||
"actions" = T.FullMonty(),
|
||||
"log" = T._interactions,
|
||||
)
|
||||
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.active_tickets)
|
||||
if(user.client.holder || (has_mentor_powers(user.client) && T.level > 0))
|
||||
tickets.Add(list(list(
|
||||
"id" = T.id,
|
||||
"name" = T.initiator_key_name,
|
||||
"state" = get_ticket_state(T.state),
|
||||
"level" = T.level,
|
||||
"handler" = T.handler,
|
||||
"opened_at" = (world.time - T.opened_at),
|
||||
"closed_at" = (world.time - T.closed_at),
|
||||
"opened_at_date" = gameTimestamp(wtime = T.opened_at),
|
||||
"closed_at_date" = gameTimestamp(wtime = T.closed_at),
|
||||
)))
|
||||
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.closed_tickets)
|
||||
if(user.client.holder || (has_mentor_powers(user.client) && T.level > 0))
|
||||
tickets.Add(list(list(
|
||||
"id" = T.id,
|
||||
"name" = T.initiator_key_name,
|
||||
"state" = get_ticket_state(T.state),
|
||||
"level" = T.level,
|
||||
"handler" = T.handler,
|
||||
"opened_at" = (world.time - T.opened_at),
|
||||
"closed_at" = (world.time - T.closed_at),
|
||||
"opened_at_date" = gameTimestamp(wtime = T.opened_at),
|
||||
"closed_at_date" = gameTimestamp(wtime = T.closed_at),
|
||||
)))
|
||||
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.resolved_tickets)
|
||||
if(user.client.holder || (has_mentor_powers(user.client) && T.level > 0))
|
||||
tickets.Add(list(list(
|
||||
"id" = T.id,
|
||||
"name" = T.initiator_key_name,
|
||||
"state" = get_ticket_state(T.state),
|
||||
"level" = T.level,
|
||||
"handler" = T.handler,
|
||||
"opened_at" = (world.time - T.opened_at),
|
||||
"closed_at" = (world.time - T.closed_at),
|
||||
"opened_at_date" = gameTimestamp(wtime = T.opened_at),
|
||||
"closed_at_date" = gameTimestamp(wtime = T.closed_at),
|
||||
)))
|
||||
data["tickets"] = tickets
|
||||
|
||||
data["selected_ticket"] = selected_ticket
|
||||
|
||||
return data
|
||||
|
||||
/datum/tickets/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("legacy")
|
||||
var/choice = tgui_input_list(usr, "Which tickets do you want to list?", "Tickets", list("Active", "Closed", "Resolved"))
|
||||
TicketListLegacy(choice)
|
||||
. = TRUE
|
||||
if("new_ticket")
|
||||
var/list/ckeys = list()
|
||||
for(var/client/C in GLOB.clients)
|
||||
ckeys += C.key
|
||||
|
||||
var/ckey = lowertext(tgui_input_list(usr, "Please select the ckey of the user.", "Select CKEY", ckeys))
|
||||
if(!ckey)
|
||||
return
|
||||
|
||||
var/client/player
|
||||
for(var/client/C in GLOB.clients)
|
||||
if(C.ckey == ckey)
|
||||
player = C
|
||||
|
||||
if(!player)
|
||||
to_chat(usr, "<span class='warning'>Ckey ([ckey]) not online.</span>")
|
||||
return
|
||||
|
||||
var/ticket_text = tgui_input_text(usr, "What should the initial text be?", "New Ticket")
|
||||
if(!ticket_text)
|
||||
to_chat(usr, "<span class='warning'>Ticket message cannot be empty.</span>")
|
||||
return
|
||||
|
||||
var/level = tgui_alert(usr, "Is this ticket Admin-Level or Mentor-Level?", "Ticket Level", list("Admin", "Mentor"))
|
||||
if(!level)
|
||||
return
|
||||
|
||||
feedback_add_details("admin_verb","Admincreatedticket") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
if(player.current_ticket)
|
||||
if(tgui_alert(usr, "The player already has a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No")) != "No")
|
||||
if(player.current_ticket)
|
||||
player.current_ticket.MessageNoRecipient(ticket_text)
|
||||
to_chat(usr, "<span class='adminnotice'>PM to-<b>Admins</b>: [ticket_text]</span>")
|
||||
return
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Ticket not found, creating new one...</span>")
|
||||
else
|
||||
player.current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
|
||||
player.current_ticket.Close()
|
||||
|
||||
// Create a new ticket and handle it. You created it afterall!
|
||||
var/datum/ticket/T = new /datum/ticket(ticket_text, player, TRUE, level)
|
||||
if(level == "Admin")
|
||||
T.level = 0
|
||||
else
|
||||
T.level = 1
|
||||
T.HandleIssue()
|
||||
usr.client.cmd_admin_pm(player, ticket_text, T)
|
||||
. = TRUE
|
||||
if("pick_ticket")
|
||||
var/datum/ticket/T = ID2Ticket(params["ticket_id"])
|
||||
usr.client.selected_ticket = T
|
||||
. = TRUE
|
||||
if("retitle_ticket")
|
||||
usr.client.selected_ticket.Retitle()
|
||||
. = TRUE
|
||||
if("reopen_ticket")
|
||||
usr.client.selected_ticket.Reopen()
|
||||
. = TRUE
|
||||
if("undock_ticket")
|
||||
usr.client.selected_ticket.tgui_interact(usr)
|
||||
usr.client.selected_ticket = null
|
||||
. = TRUE
|
||||
if("send_msg")
|
||||
if(!params["msg"])
|
||||
return
|
||||
|
||||
usr.client.cmd_admin_pm(usr.client.selected_ticket.initiator, sanitize(params["msg"]), usr.client.selected_ticket)
|
||||
. = TRUE
|
||||
|
||||
/datum/tickets/tgui_fallback(payload)
|
||||
if(..())
|
||||
return
|
||||
|
||||
var/choice = tgui_input_list(usr, "Which tickets do you want to list?", "Tickets", list("Active", "Closed", "Resolved"))
|
||||
|
||||
TicketListLegacy(choice)
|
||||
|
||||
//
|
||||
//TICKET DATUM
|
||||
//
|
||||
|
||||
/datum/ticket/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "Ticket", "Ticket #[id] - [LinkedReplyName("\ref[src]")]")
|
||||
ui.open()
|
||||
|
||||
/datum/ticket/tgui_state(mob/user)
|
||||
return GLOB.tgui_admin_state
|
||||
|
||||
/datum/ticket/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["id"] = id
|
||||
|
||||
var/ref_src = "\ref[src]"
|
||||
data["title"] = name
|
||||
data["name"] = LinkedReplyName(ref_src)
|
||||
data["ticket_ref"] = ref_src
|
||||
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
data["state"] = "open"
|
||||
// TODO: Mentor tickets cannot be resolved
|
||||
if(AHELP_RESOLVED)
|
||||
data["state"] = "resolved"
|
||||
if(AHELP_CLOSED)
|
||||
data["state"] = "closed"
|
||||
else
|
||||
data["state"] = "unknown"
|
||||
|
||||
data["level"] = level
|
||||
data["handler"] = handler
|
||||
|
||||
data["opened_at"] = (world.time - opened_at)
|
||||
data["closed_at"] = (world.time - closed_at)
|
||||
data["opened_at_date"] = gameTimestamp(wtime = opened_at)
|
||||
data["closed_at_date"] = gameTimestamp(wtime = closed_at)
|
||||
|
||||
data["actions"] = FullMonty(ref_src)
|
||||
|
||||
data["log"] = _interactions
|
||||
|
||||
return data
|
||||
|
||||
/datum/ticket/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("retitle")
|
||||
Retitle()
|
||||
. = TRUE
|
||||
if("reopen")
|
||||
Reopen()
|
||||
. = TRUE
|
||||
if("legacy")
|
||||
TicketPanelLegacy()
|
||||
. = TRUE
|
||||
if("send_msg")
|
||||
if(!params["msg"] || !params["ticket_ref"])
|
||||
return
|
||||
|
||||
var/datum/ticket/T = locate(params["ticket_ref"])
|
||||
|
||||
usr.client.cmd_admin_pm(T.initiator, sanitize(params["msg"]), T)
|
||||
. = TRUE
|
||||
|
||||
/datum/ticket/tgui_fallback(payload)
|
||||
if(..())
|
||||
return
|
||||
|
||||
TicketPanelLegacy()
|
||||
|
||||
/*
|
||||
/datum/mentor_help/proc/TicketPanelLegacy()
|
||||
var/list/dat = list("<html><head><title>Ticket #[id]</title></head>")
|
||||
var/ref_src = "\ref[src]"
|
||||
dat += "<h4>Mentor Help Ticket #[id]: [LinkedReplyName(ref_src)]</h4>"
|
||||
dat += "<b>State: "
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
dat += "<font color='red'>OPEN</font>"
|
||||
if(AHELP_RESOLVED)
|
||||
dat += "<font color='green'>RESOLVED</font>"
|
||||
else
|
||||
dat += "UNKNOWN"
|
||||
dat += "</b>[GLOB.TAB][TicketHref("Refresh", ref_src)]"
|
||||
if(state != AHELP_ACTIVE)
|
||||
dat += "[GLOB.TAB][TicketHref("Reopen", ref_src, "reopen")]"
|
||||
dat += "<br><br>Opened at: [gameTimestamp(wtime = opened_at)] (Approx [(world.time - opened_at) / 600] minutes ago)"
|
||||
if(closed_at)
|
||||
dat += "<br>Closed at: [gameTimestamp(wtime = closed_at)] (Approx [(world.time - closed_at) / 600] minutes ago)"
|
||||
dat += "<br><br>"
|
||||
if(initiator)
|
||||
dat += "<b>Actions:</b> [Context(ref_src)]<br>"
|
||||
else
|
||||
dat += "<b>DISCONNECTED</b>[GLOB.TAB][ClosureLinks(ref_src)]<br>"
|
||||
dat += "<br><b>Log:</b><br><br>"
|
||||
for(var/I in _interactions)
|
||||
dat += "[I]<br>"
|
||||
usr << browse(dat.Join(), "window=mhelp[id];size=620x480") */
|
||||
|
||||
/datum/ticket/proc/TicketPanelLegacy()
|
||||
var/list/dat = list("<html><head><title>Ticket #[id]</title></head>")
|
||||
var/ref_src = "\ref[src]"
|
||||
dat += "<h4>Ticket #[id]: [LinkedReplyName(ref_src)]</h4>"
|
||||
dat += "<b>State: "
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
dat += "<font color='red'>OPEN</font>"
|
||||
if(AHELP_RESOLVED)
|
||||
dat += "<font color='green'>RESOLVED</font>"
|
||||
if(AHELP_CLOSED)
|
||||
dat += "CLOSED"
|
||||
else
|
||||
dat += "UNKNOWN"
|
||||
dat += "</b>[GLOB.TAB][TicketHref("Refresh", ref_src)][GLOB.TAB][TicketHref("Re-Title", ref_src, "retitle")]"
|
||||
if(state != AHELP_ACTIVE)
|
||||
dat += "[GLOB.TAB][TicketHref("Reopen", ref_src, "reopen")]"
|
||||
dat += "<br><br>Opened at: [gameTimestamp(wtime = opened_at)] (Approx [(world.time - opened_at) / 600] minutes ago)"
|
||||
if(closed_at)
|
||||
dat += "<br>Closed at: [gameTimestamp(wtime = closed_at)] (Approx [(world.time - closed_at) / 600] minutes ago)"
|
||||
dat += "<br><br>"
|
||||
if(initiator)
|
||||
dat += "<b>Actions:</b> [FullMonty(ref_src)]<br>"
|
||||
else
|
||||
dat += "<b>DISCONNECTED</b>[GLOB.TAB][ClosureLinks(ref_src)]<br>"
|
||||
dat += "<br><b>Log:</b><br><br>"
|
||||
for(var/I in _interactions)
|
||||
dat += "[I]<br>"
|
||||
|
||||
usr << browse(dat.Join(), "window=ahelp[id];size=620x480")
|
||||
|
||||
/datum/tickets/proc/TicketListLegacy(var/state)
|
||||
var/list/dat = list("<html><head><title>[state] Tickets</title></head>")
|
||||
var/tickets_found = 0
|
||||
|
||||
if(state == "Active")
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.active_tickets)
|
||||
dat += "[T.level == 0 ? "Adminhelp" : "Mentorhelp"] - [T.TicketHref("#[T.id] - [T.initiator_ckey]: [T.name]")]"
|
||||
tickets_found++
|
||||
else if(state == "Closed")
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.closed_tickets)
|
||||
dat += "[T.level == 0 ? "Adminhelp" : "Mentorhelp"] - [T.TicketHref("#[T.id] - [T.initiator_ckey]: [T.name]")]"
|
||||
tickets_found++
|
||||
else if(state == "Resolved")
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.resolved_tickets)
|
||||
dat += "[T.level == 0 ? "Adminhelp" : "Mentorhelp"] - [T.TicketHref("#[T.id] - [T.initiator_ckey]: [T.name]")]"
|
||||
tickets_found++
|
||||
|
||||
if(tickets_found == 0)
|
||||
dat += "No [state] tickets found."
|
||||
|
||||
usr << browse(dat.Join(), "window=ahelp-list;size=250x350")
|
||||
Reference in New Issue
Block a user