mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
[MIRROR] Ports ticket system overhaul from downstream (#11122)
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
6c46750f0e
commit
8197dee77b
@@ -41,10 +41,12 @@
|
||||
#define R_MOD (1<<13)
|
||||
#define R_EVENT (1<<14)
|
||||
#define R_HOST (1<<15) //higher than this will overflow
|
||||
#define R_MENTOR (1<<16)
|
||||
|
||||
#define R_DEFAULT R_NONE
|
||||
|
||||
#define R_EVERYTHING (1<<16)-1 //the sum of all other rank permissions, used for +EVERYTHING
|
||||
#define R_EVERYTHING (1<<17)-1 //the sum of all other rank permissions, used for +EVERYTHING
|
||||
#define R_HOLDER ((R_EVERYTHING) & (~R_MENTOR))
|
||||
|
||||
#define SMITE_BREAKLEGS "Break Legs"
|
||||
#define SMITE_BLUESPACEARTILLERY "Bluespace Artillery"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//check if all bitflags specified are present
|
||||
#define CHECK_MULTIPLE_BITFIELDS(flagvar, flags) ((flagvar & (flags)) == flags)
|
||||
|
||||
GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768))
|
||||
GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304))
|
||||
|
||||
/* Directions */
|
||||
///All the cardinal direction bitflags.
|
||||
|
||||
@@ -204,8 +204,8 @@
|
||||
|
||||
// Mentor pm filter
|
||||
#define span_mentor(str) ("<span class='mentor'>" + str + "</span>")
|
||||
#define span_mentor_pm_notice(str) ("<span class='mentor notice'>" + str + "</span>")
|
||||
#define span_mentor_pm_warning(str) ("<span class='mentor warning'>" + str + "</span>")
|
||||
#define span_mentor_notice(str) ("<span class='mentor notice'>" + str + "</span>")
|
||||
#define span_mentor_warning(str) ("<span class='mentor warning'>" + str + "</span>")
|
||||
|
||||
/* Adminchat */
|
||||
// All of those have their own filter
|
||||
|
||||
@@ -42,6 +42,7 @@ DEFINE_BITFIELD(admin_flags, list(
|
||||
"SPAWN" = R_SPAWN,
|
||||
"STEALTH" = R_STEALTH,
|
||||
"VAREDIT" = R_VAREDIT,
|
||||
"MENTOR" = R_MENTOR,
|
||||
))
|
||||
|
||||
DEFINE_BITFIELD(datum_flags, list(
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
GLOBAL_LIST_EMPTY(admins) //all clients whom are admins
|
||||
GLOBAL_PROTECT(admins)
|
||||
GLOBAL_LIST_EMPTY(mentors)
|
||||
GLOBAL_PROTECT(mentors)
|
||||
GLOBAL_LIST_EMPTY(deadmins) //all ckeys who have used the de-admin verb.
|
||||
GLOBAL_LIST_EMPTY(stealthminID)
|
||||
GLOBAL_LIST_EMPTY(directory) //all ckeys with associated client
|
||||
|
||||
@@ -213,6 +213,7 @@
|
||||
if (rights & R_SPAWN) . += "[seperator]+SPAWN"
|
||||
if (rights & R_MOD) . += "[seperator]+MODERATOR"
|
||||
if (rights & R_EVENT) . += "[seperator]+EVENT"
|
||||
if (rights & R_MENTOR) . += "[seperator]+MENTOR"
|
||||
return .
|
||||
|
||||
// Converts a hexadecimal color (e.g. #FF0050) to a list of numbers for red, green, and blue (e.g. list(255,0,80) ).
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
//PUBLIC - call these wherever you want
|
||||
|
||||
|
||||
/mob/proc/throw_alert(category, type, severity, obj/new_master)
|
||||
|
||||
/** Proc to create or update an alert. Returns the alert if the alert is new or updated, 0 if it was thrown already
|
||||
* category is a text string. Each mob may only have one alert per category; the previous one will be replaced
|
||||
* path is a type path of the actual alert type to throw
|
||||
@@ -13,7 +10,7 @@
|
||||
* new_master is optional and sets the alert's icon state to "template" in the ui_style icons with the master as an overlay.
|
||||
* Clicks are forwarded to master
|
||||
*/
|
||||
|
||||
/mob/proc/throw_alert(category, type, severity, obj/new_master)
|
||||
if(!category)
|
||||
return
|
||||
|
||||
@@ -428,6 +425,23 @@ so as to remain in compliance with the most up-to-date laws."
|
||||
if(isliving(usr))
|
||||
var/mob/living/L = usr
|
||||
return L.resist()
|
||||
|
||||
// TICKETS
|
||||
/obj/screen/alert/open_ticket
|
||||
icon = 'icons/logo.dmi'
|
||||
name = "Admin Chat Request"
|
||||
desc = "A Administrator would like to chat with you. \
|
||||
Click here to begin."
|
||||
icon_state = "32x32"
|
||||
|
||||
/obj/screen/alert/open_ticket/Click()
|
||||
if(!usr || !usr.client) return
|
||||
|
||||
// Open a new chat with the user
|
||||
var/datum/ticket_chat/TC = new()
|
||||
TC.T = usr.client.current_ticket
|
||||
TC.tgui_interact(usr.client.mob)
|
||||
|
||||
// PRIVATE = only edit, use, or override these if you're editing the system as a whole
|
||||
|
||||
// Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there
|
||||
|
||||
@@ -735,3 +735,14 @@
|
||||
|
||||
/datum/config_entry/flag/pixel_size_limit
|
||||
default = FALSE
|
||||
|
||||
/// These are for tgs4 channels, for discord chatbots used in TGS.
|
||||
/datum/config_entry/string/ahelp_channel_tag
|
||||
|
||||
/// Turn this off if you don't want the TGS bot sending you messages whenever an ahelp ticket is created.
|
||||
/datum/config_entry/flag/discord_ahelps_disabled
|
||||
default = FALSE
|
||||
|
||||
/// Turn this on if you want all admin-PMs to go to be sent to discord, and not only the first message of a ticket.
|
||||
/datum/config_entry/flag/discord_ahelps_all
|
||||
default = FALSE
|
||||
|
||||
@@ -63,7 +63,9 @@ SUBSYSTEM_DEF(statpanels)
|
||||
//target.stat_panel.send_message("update_split_admin_tabs", !!(target.prefs.toggles & SPLIT_ADMIN_TABS))
|
||||
target.stat_panel.send_message("update_split_admin_tabs", FALSE)
|
||||
|
||||
if(!("MC" in target.panel_tabs) || !("Tickets" in target.panel_tabs))
|
||||
if(check_rights_for(target, R_MENTOR))
|
||||
target.stat_panel.send_message("add_tickets_tabs", target.holder.href_token)
|
||||
else if(!("MC" in target.panel_tabs) || !("Tickets" in target.panel_tabs))
|
||||
target.stat_panel.send_message("add_admin_tabs", target.holder.href_token)
|
||||
|
||||
//if(target.stat_tab == "MC" && ((num_fires % mc_wait == 0) || target?.prefs.read_preference(/datum/preference/toggle/fast_mc_refresh)))
|
||||
@@ -177,13 +179,9 @@ SUBSYSTEM_DEF(statpanels)
|
||||
target.stat_panel.send_message("update_examine", list("EX" = examine_update, "UPD" = update_panel))
|
||||
|
||||
/datum/controller/subsystem/statpanels/proc/set_tickets_tab(client/target)
|
||||
/* CHOMPRemove Start, our tickets are handled differently
|
||||
var/list/tickets = list()
|
||||
if(check_rights_for(target, R_ADMIN|R_SERVER|R_MOD)) //Prevents non-staff from opening the list of ahelp tickets
|
||||
tickets += GLOB.ahelp_tickets.stat_entry(target)
|
||||
tickets += GLOB.mhelp_tickets.stat_entry(target)
|
||||
*/// CHOMPRemove End
|
||||
var/list/tickets = GLOB.tickets.stat_entry(target) // CHOMPEdit
|
||||
if(check_rights_for(target, R_ADMIN|R_SERVER|R_MOD|R_MENTOR)) //Prevents non-staff from opening the list of ahelp tickets
|
||||
tickets = GLOB.tickets.stat_entry(target)
|
||||
target.stat_panel.send_message("update_tickets", tickets)
|
||||
|
||||
/datum/controller/subsystem/statpanels/proc/set_SDQL2_tab(client/target)
|
||||
|
||||
@@ -520,7 +520,6 @@ var/world_topic_spam_protect_time = world.timeofday
|
||||
|
||||
/hook/startup/proc/loadMods()
|
||||
world.load_mods()
|
||||
world.load_mentors() // no need to write another hook.
|
||||
return 1
|
||||
|
||||
/world/proc/load_mods()
|
||||
@@ -544,40 +543,6 @@ var/world_topic_spam_protect_time = world.timeofday
|
||||
var/datum/admins/D = new /datum/admins(title, rights, ckey)
|
||||
D.associate(GLOB.directory[ckey])
|
||||
|
||||
/world/proc/load_mentors()
|
||||
if(CONFIG_GET(flag/admin_legacy_system))
|
||||
var/text = file2text("config/mentors.txt")
|
||||
if (!text)
|
||||
error("Failed to load config/mentors.txt")
|
||||
else
|
||||
var/list/lines = splittext(text, "\n")
|
||||
for(var/line in lines)
|
||||
if (!line)
|
||||
continue
|
||||
if (copytext(line, 1, 2) == ";")
|
||||
continue
|
||||
|
||||
var/ckey = copytext(line, 1, length(line)+1)
|
||||
var/datum/mentor/M = new /datum/mentor(ckey)
|
||||
M.associate(GLOB.directory[ckey])
|
||||
else
|
||||
establish_db_connection()
|
||||
if(!SSdbcore.IsConnected())
|
||||
error("Failed to connect to database in load_mentors().")
|
||||
log_misc("Failed to connect to database in load_mentors().")
|
||||
return
|
||||
|
||||
var/datum/db_query/query = SSdbcore.NewQuery("SELECT ckey, mentor FROM erro_mentor")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
var/ckey = query.item[1]
|
||||
var/mentor = query.item[2]
|
||||
|
||||
if(mentor)
|
||||
var/datum/mentor/M = new /datum/mentor(ckey)
|
||||
M.associate(GLOB.directory[ckey])
|
||||
qdel(query)
|
||||
|
||||
/world/proc/update_status()
|
||||
var/s = ""
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ GLOBAL_PROTECT(protected_ranks)
|
||||
flag = R_MOD
|
||||
if("EVENT")
|
||||
flag = R_EVENT
|
||||
if("MENTOR")
|
||||
flag = R_MENTOR
|
||||
if("@")
|
||||
if(previous_rank)
|
||||
switch(group_count)
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
// Reports are a way to notify admins of wrongdoings that happened
|
||||
// while no admin was present. They work a bit similar to news, but
|
||||
// they can only be read by admins and moderators.
|
||||
|
||||
// a single admin report
|
||||
/datum//admin_report/var
|
||||
ID // the ID of the report
|
||||
body // the content of the report
|
||||
author // key of the author
|
||||
date // date on which this was created
|
||||
done // whether this was handled
|
||||
|
||||
offender_key // store the key of the offender
|
||||
offender_cid // store the cid of the offender
|
||||
|
||||
/datum//report_topic_handler
|
||||
Topic(href,href_list)
|
||||
..()
|
||||
var/client/C = locate(href_list["client"])
|
||||
if(href_list["action"] == "show_reports")
|
||||
C.display_admin_reports()
|
||||
else if(href_list["action"] == "remove")
|
||||
C.mark_report_done(text2num(href_list["ID"]))
|
||||
else if(href_list["action"] == "edit")
|
||||
C.edit_report(text2num(href_list["ID"]))
|
||||
|
||||
var/datum/report_topic_handler/report_topic_handler
|
||||
|
||||
world/New()
|
||||
..()
|
||||
report_topic_handler = new
|
||||
|
||||
// add a new news datums
|
||||
/proc/make_report(body, author, okey, cid)
|
||||
var/savefile/Reports = new("data/reports.sav")
|
||||
var/list/reports
|
||||
var/lastID
|
||||
|
||||
Reports["reports"] >> reports
|
||||
Reports["lastID"] >> lastID
|
||||
|
||||
if(!reports) reports = list()
|
||||
if(!lastID) lastID = 0
|
||||
|
||||
var/datum/admin_report/created = new()
|
||||
created.ID = ++lastID
|
||||
created.body = body
|
||||
created.author = author
|
||||
created.date = world.realtime
|
||||
created.done = 0
|
||||
created.offender_key = okey
|
||||
created.offender_cid = cid
|
||||
|
||||
reports.Insert(1, created)
|
||||
|
||||
Reports["reports"] << reports
|
||||
Reports["lastID"] << lastID
|
||||
|
||||
// load the reports from disk
|
||||
/proc/load_reports()
|
||||
var/savefile/Reports = new("data/reports.sav")
|
||||
var/list/reports
|
||||
|
||||
Reports["reports"] >> reports
|
||||
|
||||
if(!reports) reports = list()
|
||||
|
||||
return reports
|
||||
|
||||
// check if there are any unhandled reports
|
||||
/client/proc/unhandled_reports()
|
||||
if(!src.holder) return 0
|
||||
var/list/reports = load_reports()
|
||||
|
||||
for(var/datum/admin_report/N in reports)
|
||||
if(N.done)
|
||||
continue
|
||||
else return 1
|
||||
|
||||
return 0
|
||||
|
||||
// checks if the player has an unhandled report against him
|
||||
/client/proc/is_reported()
|
||||
var/list/reports = load_reports()
|
||||
|
||||
for(var/datum/admin_report/N in reports) if(!N.done)
|
||||
if(N.offender_key == src.key)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
// display only the reports that haven't been handled
|
||||
/client/proc/display_admin_reports()
|
||||
set category = "Admin.Moderation"
|
||||
set name = "Display Admin Reports"
|
||||
if(!src.holder) return
|
||||
|
||||
var/list/reports = load_reports()
|
||||
|
||||
var/output = ""
|
||||
if(unhandled_reports())
|
||||
// load the list of unhandled reports
|
||||
for(var/datum/admin_report/N in reports)
|
||||
if(N.done)
|
||||
continue
|
||||
output += span_bold("Reported player:") + " [N.offender_key](CID: [N.offender_cid])<br>"
|
||||
output += span_bold("Offense:") + "[N.body]<br>"
|
||||
output += "<small>Occurred at [time2text(N.date,"MM/DD hh:mm:ss")]</small><br>"
|
||||
output += "<small>authored by <i>[N.author]</i></small><br>"
|
||||
output += " <a href='byond://?src=\ref[report_topic_handler];client=\ref[src];[HrefToken()];action=remove;ID=[N.ID]'>Flag as Handled</a>"
|
||||
if(src.key == N.author)
|
||||
output += " <a href='byond://?src=\ref[report_topic_handler];client=\ref[src];[HrefToken()];action=edit;ID=[N.ID]'>Edit</a>"
|
||||
output += "<br>"
|
||||
output += "<br>"
|
||||
else
|
||||
output += "Whoops, no reports!"
|
||||
|
||||
var/datum/browser/popup = new(src, "news", "News", 600, 400)
|
||||
popup.set_content(output)
|
||||
popup.open()
|
||||
|
||||
/client/proc/Report(mob/M as mob in world)
|
||||
set category = "Admin.Moderation"
|
||||
if(!src.holder)
|
||||
return
|
||||
|
||||
var/CID = "Unknown"
|
||||
if(M.client)
|
||||
CID = M.client.computer_id
|
||||
|
||||
var/body = tgui_input_text(src.mob, "Describe in detail what you're reporting [M] for", "Report")
|
||||
if(!body) return
|
||||
|
||||
|
||||
make_report(body, key, M.key, CID)
|
||||
|
||||
spawn(1)
|
||||
display_admin_reports()
|
||||
|
||||
/client/proc/mark_report_done(ID as num)
|
||||
if(!src.holder || src.holder.level < 0)
|
||||
return
|
||||
|
||||
var/savefile/Reports = new("data/reports.sav")
|
||||
var/list/reports
|
||||
|
||||
Reports["reports"] >> reports
|
||||
|
||||
var/datum/admin_report/found
|
||||
for(var/datum/admin_report/N in reports)
|
||||
if(N.ID == ID)
|
||||
found = N
|
||||
if(!found)
|
||||
to_chat(src, span_boldwarning("* An error occurred, sorry."))
|
||||
|
||||
found.done = 1
|
||||
|
||||
Reports["reports"] << reports
|
||||
|
||||
|
||||
/client/proc/edit_report(ID as num)
|
||||
if(!src.holder || src.holder.level < 0)
|
||||
to_chat(src, span_boldwarning("You tried to modify the news, but you're not an admin!"))
|
||||
return
|
||||
|
||||
var/savefile/Reports = new("data/reports.sav")
|
||||
var/list/reports
|
||||
|
||||
Reports["reports"] >> reports
|
||||
|
||||
var/datum/admin_report/found
|
||||
for(var/datum/admin_report/N in reports)
|
||||
if(N.ID == ID)
|
||||
found = N
|
||||
if(!found)
|
||||
to_chat(src, span_boldwarning("* An error occurred, sorry."))
|
||||
|
||||
var/body = tgui_input_text(src.mob, "Enter a body for the news", "Body", multiline = TRUE, prevent_enter = TRUE)
|
||||
if(!body) return
|
||||
|
||||
found.body = body
|
||||
|
||||
Reports["reports"] << reports
|
||||
@@ -1,25 +1,4 @@
|
||||
//admin verb groups - They can overlap if you so wish. Only one of each verb will exist in the verbs list regardless
|
||||
var/list/admin_verbs_default = list(
|
||||
// /datum/admins/proc/show_player_panel, //shows an interface for individual players, with various links (links require additional flags, //VOREStation Remove,
|
||||
// /client/proc/player_panel_new, //shows an interface for all players, with links to various panels, //VOREStation Remove,
|
||||
// /client/proc/player_panel, //VOREStation Remove,
|
||||
/client/proc/cmd_admin_say, //VOREStation Add,
|
||||
/client/proc/cmd_mod_say, //VOREStation Add,
|
||||
/client/proc/cmd_event_say, //VOREStation Add,
|
||||
/client/proc/cmd_mentor_ticket_panel,
|
||||
/client/proc/cmd_mentor_say,
|
||||
// /client/proc/hide_verbs, //hides all our adminverbs, //VOREStation Remove,
|
||||
// /client/proc/hide_most_verbs, //hides all our hideable adminverbs, //VOREStation Remove,
|
||||
// /client/proc/debug_variables, //allows us to -see- the variables of any instance in the game. +VAREDIT needed to modify, //VOREStation Remove,
|
||||
// /client/proc/mark_datum_mapview, //VOREStation Remove,
|
||||
// /client/proc/cmd_check_new_players, //allows us to see every new player, //VOREStation Remove,
|
||||
// /client/proc/check_antagonists, //shows all antags,
|
||||
// /client/proc/cmd_mod_say,
|
||||
// /client/proc/deadchat //toggles deadchat on/off,
|
||||
// /client/proc/toggle_ahelp_sound,
|
||||
/client/proc/debugstatpanel,
|
||||
)
|
||||
|
||||
var/list/admin_verbs_admin = list(
|
||||
/client/proc/toggle_vantag_hud,
|
||||
/datum/admins/proc/set_tcrystals,
|
||||
@@ -83,9 +62,6 @@ var/list/admin_verbs_admin = list(
|
||||
/datum/admins/proc/toggleoocdead, //toggles ooc on/off for everyone who is dead,
|
||||
/datum/admins/proc/togglehubvisibility, //toggles visibility on the BYOND Hub.,
|
||||
/datum/admins/proc/toggledsay, //toggles dsay on/off for everyone,
|
||||
/client/proc/cmd_admin_say, //admin-only ooc chat,
|
||||
/client/proc/cmd_mod_say,
|
||||
/client/proc/cmd_event_say,
|
||||
/datum/admins/proc/PlayerNotes,
|
||||
/datum/admins/proc/show_player_info,
|
||||
/client/proc/free_slot, //frees slot for chosen job,
|
||||
@@ -118,8 +94,6 @@ var/list/admin_verbs_admin = list(
|
||||
/datum/admins/proc/sendFax,
|
||||
/client/proc/despawn_player,
|
||||
/datum/admins/proc/view_feedback,
|
||||
/client/proc/make_mentor,
|
||||
/client/proc/unmake_mentor,
|
||||
/client/proc/delbook,
|
||||
/client/proc/toggle_spawning_with_recolour,
|
||||
/client/proc/start_vote,
|
||||
@@ -203,7 +177,6 @@ var/list/admin_verbs_server = list(
|
||||
/datum/admins/proc/delay,
|
||||
/datum/admins/proc/toggleaban,
|
||||
/datum/admins/proc/togglepersistence,
|
||||
/client/proc/cmd_mod_say,
|
||||
/client/proc/toggle_log_hrefs,
|
||||
/datum/admins/proc/immreboot,
|
||||
/client/proc/everyone_random,
|
||||
@@ -299,9 +272,6 @@ var/list/admin_verbs_possess = list(
|
||||
/proc/possess,
|
||||
/proc/release
|
||||
)
|
||||
var/list/admin_verbs_permissions = list(
|
||||
/client/proc/edit_admin_permissions
|
||||
)
|
||||
var/list/admin_verbs_rejuv = list(
|
||||
/client/proc/respawn_character
|
||||
)
|
||||
@@ -396,8 +366,6 @@ var/list/admin_verbs_mod = list(
|
||||
/client/proc/debug_variables, //allows us to -see- the variables of any instance in the game. +VAREDIT needed to modify, //VOREStation Add,
|
||||
/client/proc/mark_datum_mapview, //VOREStation Add,
|
||||
/client/proc/cmd_check_new_players, //allows us to see every new player, //VOREStation Add,
|
||||
/client/proc/cmd_mod_say,
|
||||
/client/proc/cmd_event_say,
|
||||
/datum/admins/proc/show_player_info,
|
||||
/datum/admins/proc/show_traitor_panel,
|
||||
/client/proc/player_panel_new,
|
||||
@@ -421,7 +389,6 @@ var/list/admin_verbs_mod = list(
|
||||
|
||||
var/list/admin_verbs_event_manager = list(
|
||||
/client/proc/toggle_vantag_hud,
|
||||
/client/proc/cmd_event_say,
|
||||
/client/proc/cmd_admin_pm_context,
|
||||
/client/proc/cmd_admin_pm_panel,
|
||||
/client/proc/admin_ghost,
|
||||
@@ -527,8 +494,6 @@ var/list/admin_verbs_event_manager = list(
|
||||
/client/proc/admin_memo, //admin memo system. show/delete/write. +SERVER needed to delete admin memos of others,
|
||||
/client/proc/dsay, //talk in deadchat using our ckey/fakekey,
|
||||
/client/proc/secrets,
|
||||
/client/proc/cmd_mod_say,
|
||||
/client/proc/cmd_event_say,
|
||||
/datum/admins/proc/show_player_info,
|
||||
/client/proc/free_slot, //frees slot for chosen job,
|
||||
/client/proc/cmd_admin_change_custom_event,
|
||||
@@ -555,7 +520,6 @@ var/list/admin_verbs_event_manager = list(
|
||||
/datum/admins/proc/startnow,
|
||||
/datum/admins/proc/restart,
|
||||
/datum/admins/proc/delay,
|
||||
/client/proc/cmd_mod_say,
|
||||
/datum/admins/proc/immreboot,
|
||||
/client/proc/everyone_random,
|
||||
/client/proc/cmd_admin_delete, //delete an instance/object/mob/etc,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/client/proc/add_admin_verbs()
|
||||
// OLD ADMIN VERB SYSTEM
|
||||
if(holder)
|
||||
var/rights = holder.rank_flags()
|
||||
add_verb(src, admin_verbs_default)
|
||||
if(rights & R_HOLDER)
|
||||
if(rights & R_BUILDMODE) add_verb(src, /client/proc/togglebuildmodeself)
|
||||
if(rights & R_ADMIN) add_verb(src, admin_verbs_admin)
|
||||
if(rights & R_FUN) add_verb(src, admin_verbs_fun)
|
||||
@@ -12,7 +11,6 @@
|
||||
if(CONFIG_GET(flag/debugparanoid) && !(rights & R_ADMIN))
|
||||
remove_verb(src, admin_verbs_paranoid_debug) //Right now it's just callproc but we can easily add others later on.
|
||||
if(rights & R_POSSESS) add_verb(src, admin_verbs_possess)
|
||||
if(rights & R_PERMISSIONS) add_verb(src, admin_verbs_permissions)
|
||||
if(rights & R_STEALTH) add_verb(src, /client/proc/stealth)
|
||||
if(rights & R_REJUVINATE) add_verb(src, admin_verbs_rejuv)
|
||||
if(rights & R_SOUNDS) add_verb(src, admin_verbs_sounds)
|
||||
@@ -26,14 +24,12 @@
|
||||
/client/proc/remove_admin_verbs()
|
||||
// OLD ADMIN VERB SYSTEM
|
||||
remove_verb(src, list(
|
||||
admin_verbs_default,
|
||||
/client/proc/togglebuildmodeself,
|
||||
admin_verbs_admin,
|
||||
admin_verbs_fun,
|
||||
admin_verbs_server,
|
||||
admin_verbs_debug,
|
||||
admin_verbs_possess,
|
||||
admin_verbs_permissions,
|
||||
/client/proc/stealth,
|
||||
admin_verbs_rejuv,
|
||||
admin_verbs_sounds,
|
||||
@@ -132,7 +128,7 @@
|
||||
set category = "Admin.Game"
|
||||
set desc = "Toggles ghost-like invisibility (Don't abuse this)"
|
||||
|
||||
if(holder && mob)
|
||||
if(check_rights(R_HOLDER) && mob)
|
||||
if(mob.invisibility > INVISIBILITY_OBSERVER)
|
||||
to_chat(mob, span_warning("You can't use this, your current invisibility level ([mob.invisibility]) is above the observer level ([INVISIBILITY_OBSERVER])."))
|
||||
return
|
||||
@@ -151,7 +147,7 @@
|
||||
/client/proc/player_panel()
|
||||
set name = "Player Panel"
|
||||
set category = "Admin.Game"
|
||||
if(holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
holder.player_panel_old()
|
||||
feedback_add_details("admin_verb","PP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
return
|
||||
@@ -159,7 +155,7 @@
|
||||
/client/proc/player_panel_new()
|
||||
set name = "Player Panel New"
|
||||
set category = "Admin.Game"
|
||||
if(holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
holder.player_panel_new()
|
||||
feedback_add_details("admin_verb","PPN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
return
|
||||
@@ -167,7 +163,7 @@
|
||||
/client/proc/check_antagonists()
|
||||
set name = "Check Antagonists"
|
||||
set category = "Admin.Investigate"
|
||||
if(holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
holder.check_antagonists()
|
||||
log_admin("[key_name(usr)] checked antagonists.") //for tsar~
|
||||
feedback_add_details("admin_verb","CHA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
@@ -194,7 +190,7 @@ ADMIN_VERB(game_panel, R_ADMIN|R_SERVER|R_FUN, "Game Panel", "Look at the state
|
||||
/client/proc/secrets()
|
||||
set name = "Secrets"
|
||||
set category = "Admin.Secrets"
|
||||
if (holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
holder.Secrets()
|
||||
feedback_add_details("admin_verb","S") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
return
|
||||
@@ -221,7 +217,7 @@ ADMIN_VERB(game_panel, R_ADMIN|R_SERVER|R_FUN, "Game Panel", "Look at the state
|
||||
/client/proc/stealth()
|
||||
set category = "Admin.Game"
|
||||
set name = "Stealth Mode"
|
||||
if(holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
if(holder.fakekey)
|
||||
holder.fakekey = null
|
||||
if(isnewplayer(src.mob))
|
||||
@@ -398,7 +394,7 @@ ADMIN_VERB(deadmin, R_NONE, "DeAdmin", "Shed your admin powers.", ADMIN_CATEGORY
|
||||
/client/proc/check_ai_laws()
|
||||
set name = "Check AI Laws"
|
||||
set category = "Admin.Silicon"
|
||||
if(holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
src.holder.output_ai_laws()
|
||||
|
||||
/client/proc/rename_silicon()
|
||||
@@ -460,7 +456,7 @@ ADMIN_VERB(deadmin, R_NONE, "DeAdmin", "Shed your admin powers.", ADMIN_CATEGORY
|
||||
/client/proc/mod_panel()
|
||||
set name = "Moderator Panel"
|
||||
set category = "Admin.Moderation"
|
||||
/* if(holder)
|
||||
/* if(check_rights(R_HOLDER))
|
||||
holder.mod_panel()*/
|
||||
// feedback_add_details("admin_verb","MP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
return
|
||||
@@ -468,14 +464,14 @@ ADMIN_VERB(deadmin, R_NONE, "DeAdmin", "Shed your admin powers.", ADMIN_CATEGORY
|
||||
/client/proc/playernotes()
|
||||
set name = "Show Player Info"
|
||||
set category = "Admin.Moderation"
|
||||
if(holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
holder.PlayerNotes()
|
||||
return
|
||||
|
||||
/client/proc/free_slot()
|
||||
set name = "Free Job Slot"
|
||||
set category = "Admin.Game"
|
||||
if(holder)
|
||||
if(check_rights(R_HOLDER))
|
||||
var/list/jobs = list()
|
||||
for (var/datum/job/J in job_master.occupations)
|
||||
if (J.current_positions >= J.total_positions && J.total_positions != -1)
|
||||
@@ -544,11 +540,8 @@ ADMIN_VERB(deadmin, R_NONE, "DeAdmin", "Shed your admin powers.", ADMIN_CATEGORY
|
||||
log_admin("[key_name(usr)] gave [key_name(T)] the spell [S].")
|
||||
message_admins(span_blue("[key_name_admin(usr)] gave [key_name(T)] the spell [S]."), 1)
|
||||
|
||||
/client/proc/debugstatpanel()
|
||||
set name = "Debug Stat Panel"
|
||||
set category = "Debug.Misc"
|
||||
|
||||
src.stat_panel.send_message("create_debug")
|
||||
ADMIN_VERB(debugstatpanel, R_DEBUG, "Debug Stat Panel", "Allows to debug the statpanel", "Debug.Misc")
|
||||
user.stat_panel.send_message("create_debug")
|
||||
|
||||
/client/proc/spawn_reagent()
|
||||
set name = "Spawn Reagent"
|
||||
@@ -620,7 +613,7 @@ ADMIN_VERB(deadmin, R_NONE, "DeAdmin", "Shed your admin powers.", ADMIN_CATEGORY
|
||||
var/atom/movable/orbiter
|
||||
var/input
|
||||
|
||||
if(holder.marked_datum)
|
||||
if(check_rights(R_HOLDER) && holder.marked_datum)
|
||||
input = tgui_alert(usr, "You have \n[holder.marked_datum] marked, should this be the center of the orbit, or the orbiter?", "Orbit", list("Center", "Orbiter", "Neither"))
|
||||
switch(input)
|
||||
if("Center")
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
/client/proc/edit_admin_permissions()
|
||||
set category = "Admin.Secrets"
|
||||
set name = "Permissions Panel"
|
||||
set desc = "Edit admin permissions"
|
||||
|
||||
if(!check_rights(R_PERMISSIONS))
|
||||
return
|
||||
|
||||
usr.client.holder.edit_admin_permissions()
|
||||
ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit admin permissions.", "Admin.Secrets")
|
||||
user.holder.edit_admin_permissions()
|
||||
|
||||
/datum/admins/proc/edit_admin_permissions(action, target, operation, page)
|
||||
if(!check_rights(R_PERMISSIONS))
|
||||
|
||||
@@ -29,9 +29,8 @@
|
||||
check_antagonists()
|
||||
return
|
||||
|
||||
// CHOMPedit Start - Tickets System
|
||||
if(href_list["ticket"])
|
||||
if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT))
|
||||
if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT|R_MENTOR))
|
||||
return
|
||||
|
||||
var/ticket_ref = href_list["ticket"]
|
||||
@@ -44,9 +43,7 @@
|
||||
else if(href_list["tickets"])
|
||||
GLOB.tickets.BrowseTickets(text2num(href_list["tickets"]))
|
||||
|
||||
// CHOMPedit End
|
||||
|
||||
// mentor_commands(href, href_list, src) // CHOMPedit - Skip this because client is already admin & contents already handled of code above
|
||||
// mentor_commands(href, href_list, src) - Skip because client is already admin & contents handled above
|
||||
|
||||
if(href_list["dbsearchckey"] || href_list["dbsearchadmin"])
|
||||
|
||||
@@ -868,7 +865,6 @@
|
||||
to_chat(M, span_filter_system(span_warning("No ban appeals URL has been set.")))
|
||||
log_admin("[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis will be removed in [mins] minutes.")
|
||||
message_admins(span_blue("[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis will be removed in [mins] minutes."))
|
||||
// CHOMPedit Start - Tickets System
|
||||
var/datum/ticket/T = M.client ? M.client.current_ticket : null
|
||||
if(T)
|
||||
T.Resolve()
|
||||
@@ -898,11 +894,9 @@
|
||||
message_admins(span_blue("[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis is a permanent ban."))
|
||||
feedback_inc("ban_perma",1)
|
||||
DB_ban_record(BANTYPE_PERMA, M, -1, reason)
|
||||
// CHOMPedit Start - Tickets System
|
||||
var/datum/ticket/T = M.client ? M.client.current_ticket : null
|
||||
if(T)
|
||||
T.Resolve()
|
||||
// CHOMPedit End
|
||||
qdel(M.client)
|
||||
//qdel(M)
|
||||
if("Cancel")
|
||||
|
||||
@@ -1,835 +0,0 @@
|
||||
/*
|
||||
|
||||
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/admin_help/current_ticket //the current ticket the (usually) not-admin client is dealing with
|
||||
|
||||
//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(ahelp_tickets, /datum/admin_help_tickets, new)
|
||||
|
||||
/datum/admin_help_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/admin_help_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/admin_help_tickets/proc/ListInsert(datum/admin_help/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/admin_help/AH = ticket_list[I]
|
||||
if(AH.id > new_ticket.id)
|
||||
ticket_list.Insert(I, new_ticket)
|
||||
return
|
||||
ticket_list += new_ticket
|
||||
|
||||
//opens the ticket listings for one of the 3 states
|
||||
/datum/admin_help_tickets/proc/BrowseTickets(state)
|
||||
if(!check_rights(R_ADMIN|R_SERVER)) //Prevents non-staff from opening the list of ahelp tickets
|
||||
return
|
||||
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='byond://?_src_=holder;[HrefToken()];ahelp_tickets=[state]'>Refresh</A><br><br>"
|
||||
for(var/datum/admin_help/AH as anything in l2b)
|
||||
dat += span_adminnotice(span_adminhelp("Ticket #[AH.id]") + ": <A href='byond://?_src_=holder;ahelp=\ref[AH];[HrefToken()];ahelp_action=ticket'>[AH.initiator_key_name]: [AH.name]</A>") + "<br>"
|
||||
dat += "</html>"
|
||||
usr << browse(dat.Join(), "window=ahelp_list[state];size=600x480")
|
||||
|
||||
//Tickets statpanel
|
||||
/datum/admin_help_tickets/proc/stat_entry()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
var/list/L = list()
|
||||
var/num_disconnected = 0
|
||||
L[++L.len] = list("== Admin Tickets ==", "", null, null)
|
||||
L[++L.len] = list("Active Tickets:", "[astatclick.update("[active_tickets.len]")]", null, REF(astatclick))
|
||||
astatclick.update("[active_tickets.len]")
|
||||
for(var/datum/admin_help/AH as anything in active_tickets)
|
||||
if(AH.initiator)
|
||||
L[++L.len] = list("#[AH.id]. [AH.initiator_key_name]:", "[AH.statclick.update()]", REF(AH))
|
||||
else
|
||||
++num_disconnected
|
||||
if(num_disconnected)
|
||||
L[++L.len] = list("Disconnected:", "[astatclick.update("[num_disconnected]")]", null, REF(astatclick))
|
||||
L[++L.len] = list("Closed Tickets:", "[cstatclick.update("[closed_tickets.len]")]", null, REF(cstatclick))
|
||||
L[++L.len] = list("Resolved Tickets:", "[rstatclick.update("[resolved_tickets.len]")]", null, REF(rstatclick))
|
||||
return L
|
||||
|
||||
//Reassociate still open ticket if one exists
|
||||
/datum/admin_help_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
|
||||
|
||||
//Dissasociate ticket
|
||||
/datum/admin_help_tickets/proc/ClientLogout(client/C)
|
||||
if(C.current_ticket)
|
||||
C.current_ticket.AddInteraction("Client disconnected.")
|
||||
C.current_ticket.initiator = null
|
||||
C.current_ticket = null
|
||||
|
||||
//Get a ticket given a ckey
|
||||
/datum/admin_help_tickets/proc/CKey2ActiveTicket(ckey)
|
||||
for(var/datum/admin_help/AH as anything in active_tickets)
|
||||
if(AH.initiator_ckey == ckey)
|
||||
return AH
|
||||
|
||||
//
|
||||
//TICKET LIST STATCLICK
|
||||
//
|
||||
|
||||
/obj/effect/statclick/ticket_list
|
||||
var/current_state
|
||||
|
||||
/obj/effect/statclick/ticket_list/Initialize(mapload, text, target)
|
||||
. = ..()
|
||||
current_state = target
|
||||
|
||||
/obj/effect/statclick/ticket_list/Click()
|
||||
GLOB.ahelp_tickets.BrowseTickets(current_state)
|
||||
|
||||
//called by admin topic
|
||||
/obj/effect/statclick/ticket_list/proc/Action()
|
||||
Click()
|
||||
//
|
||||
//TICKET DATUM
|
||||
//
|
||||
|
||||
/datum/admin_help
|
||||
var/id
|
||||
var/name
|
||||
var/state = AHELP_ACTIVE
|
||||
|
||||
var/opened_at
|
||||
var/closed_at
|
||||
|
||||
var/client/initiator //semi-misnomer, it's the person who ahelped/was bwoinked
|
||||
var/initiator_ckey
|
||||
var/initiator_key_name
|
||||
|
||||
var/list/_interactions //use AddInteraction() or, preferably, admin_ticket_log()
|
||||
|
||||
var/obj/effect/statclick/ahelp/statclick
|
||||
|
||||
var/static/ticket_counter = 0
|
||||
|
||||
//call this on its own to create a ticket, don't manually assign current_ticket
|
||||
//msg is the title of the ticket: usually the ahelp text
|
||||
//is_bwoink is TRUE if this ticket was started by an admin PM
|
||||
/datum/admin_help/New(msg, client/C, is_bwoink)
|
||||
//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
|
||||
|
||||
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(span_blue("[key_name_admin(usr)] PM'd [LinkedReplyName()]"))
|
||||
message_admins(span_blue("Ticket [TicketHref("#[id]")] created"))
|
||||
else
|
||||
MessageNoRecipient(parsed_message)
|
||||
send2adminchat() //VOREStation Add
|
||||
//show it to the person adminhelping too
|
||||
to_chat(C, span_admin_pm_notice("PM to-" + span_bold("Admins") + ": [name]"))
|
||||
|
||||
//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_admin_pm_notice("No active admins are online, your adminhelp was sent to the admin discord.")) //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.ahelp_tickets.active_tickets += src
|
||||
|
||||
/datum/admin_help/Destroy()
|
||||
RemoveActive()
|
||||
GLOB.ahelp_tickets.closed_tickets -= src
|
||||
GLOB.ahelp_tickets.resolved_tickets -= src
|
||||
return ..()
|
||||
|
||||
/datum/admin_help/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
|
||||
|
||||
//private
|
||||
/datum/admin_help/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/admin_help/proc/ClosureLinks(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
. = " (<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken(TRUE)];ahelp_action=reject'>REJT</A>)"
|
||||
. += " (<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken(TRUE)];ahelp_action=icissue'>IC</A>)"
|
||||
. += " (<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken(TRUE)];ahelp_action=close'>CLOSE</A>)"
|
||||
. += " (<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken(TRUE)];ahelp_action=resolve'>RSLVE</A>)"
|
||||
. += " (<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken(TRUE)];ahelp_action=handleissue'>HANDLE</A>)"
|
||||
|
||||
//private
|
||||
/datum/admin_help/proc/LinkedReplyName(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
return "<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken()];ahelp_action=reply'>[initiator_key_name]</A>"
|
||||
|
||||
//private
|
||||
/datum/admin_help/proc/TicketHref(msg, ref_src, action = "ticket")
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
return "<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken()];ahelp_action=[action]'>[msg]</A>"
|
||||
|
||||
//message from the initiator without a target, all admins will see this
|
||||
//won't bug irc
|
||||
/datum/admin_help/proc/MessageNoRecipient(msg)
|
||||
var/ref_src = "\ref[src]"
|
||||
var/chat_msg = span_admin_pm_notice(span_adminhelp("Ticket [TicketHref("#[id]", ref_src)]") + span_bold(": [LinkedReplyName(ref_src)] [FullMonty(ref_src)]:") + msg)
|
||||
|
||||
AddInteraction(span_red("[LinkedReplyName(ref_src)]: [msg]"))
|
||||
//send this msg to all admins
|
||||
|
||||
for(var/client/X in GLOB.admins)
|
||||
// if(!check_rights_for(X, R_ADMIN)) //CHOMP Remove let everyone hear the ahelp
|
||||
// continue //CHOMP Remove let everyone hear the ahelp
|
||||
if(X.prefs?.read_preference(/datum/preference/toggle/holder/play_adminhelp_ping))
|
||||
X << 'sound/effects/adminhelp.ogg'
|
||||
window_flash(X)
|
||||
to_chat(X, chat_msg)
|
||||
|
||||
//Reopen a closed ticket
|
||||
/datum/admin_help/proc/Reopen()
|
||||
if(state == AHELP_ACTIVE)
|
||||
to_chat(usr, span_warning("This ticket is already open."))
|
||||
return
|
||||
|
||||
if(GLOB.ahelp_tickets.CKey2ActiveTicket(initiator_ckey))
|
||||
to_chat(usr, span_warning("This user already has an active ticket, cannot reopen this one."))
|
||||
return
|
||||
|
||||
statclick = new(null, src)
|
||||
GLOB.ahelp_tickets.active_tickets += src
|
||||
GLOB.ahelp_tickets.closed_tickets -= src
|
||||
GLOB.ahelp_tickets.resolved_tickets -= src
|
||||
switch(state)
|
||||
if(AHELP_CLOSED)
|
||||
feedback_dec("ahelp_close")
|
||||
if(AHELP_RESOLVED)
|
||||
feedback_dec("ahelp_resolve")
|
||||
state = AHELP_ACTIVE
|
||||
closed_at = null
|
||||
if(initiator)
|
||||
initiator.current_ticket = src
|
||||
|
||||
AddInteraction(span_purple("Reopened by [key_name_admin(usr)]"))
|
||||
if(initiator)
|
||||
to_chat(initiator, span_filter_adminlog("[span_purple("Ticket [TicketHref("#[id]")] was reopened by [key_name(usr,FALSE,FALSE)].")]"))
|
||||
var/msg = span_adminhelp("Ticket [TicketHref("#[id]")] reopened by [key_name_admin(usr)].")
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
feedback_inc("ahelp_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/admin_help/proc/RemoveActive()
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
closed_at = world.time
|
||||
QDEL_NULL(statclick)
|
||||
GLOB.ahelp_tickets.active_tickets -= src
|
||||
if(initiator && initiator.current_ticket == src)
|
||||
initiator.current_ticket = null
|
||||
|
||||
//Mark open ticket as closed/meme
|
||||
/datum/admin_help/proc/Close(silent = FALSE)
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
RemoveActive()
|
||||
state = AHELP_CLOSED
|
||||
GLOB.ahelp_tickets.ListInsert(src)
|
||||
AddInteraction(span_filter_adminlog(span_red("Closed by [key_name_admin(usr)].")))
|
||||
if(initiator)
|
||||
to_chat(initiator, span_filter_adminlog("[span_red("Ticket [TicketHref("#[id]")] was closed by [key_name(usr,FALSE,FALSE)].")]"))
|
||||
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
|
||||
)
|
||||
)
|
||||
|
||||
//Mark open ticket as resolved/legitimate, returns ahelp verb
|
||||
/datum/admin_help/proc/Resolve(silent = FALSE)
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
RemoveActive()
|
||||
state = AHELP_RESOLVED
|
||||
GLOB.ahelp_tickets.ListInsert(src)
|
||||
|
||||
AddInteraction(span_filter_adminlog(span_green("Resolved by [key_name_admin(usr)].")))
|
||||
if(initiator)
|
||||
to_chat(initiator, span_filter_adminlog("[span_green("Ticket [TicketHref("#[id]")] was marked resolved by [key_name(usr,FALSE,FALSE)].")]"))
|
||||
if(!silent)
|
||||
feedback_inc("ahelp_resolve")
|
||||
var/msg = "Ticket [TicketHref("#[id]")] resolved by [key_name_admin(usr)]"
|
||||
message_admins(msg)
|
||||
log_admin(msg)
|
||||
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
|
||||
)
|
||||
)
|
||||
|
||||
//Close and return ahelp verb, use if ticket is incoherent
|
||||
/datum/admin_help/proc/Reject(key_name = key_name_admin(usr))
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
|
||||
if(initiator)
|
||||
if(initiator.prefs?.read_preference(/datum/preference/toggle/holder/play_adminhelp_ping))
|
||||
initiator << 'sound/effects/adminhelp.ogg'
|
||||
|
||||
to_chat(initiator, span_filter_pm("[span_red(span_huge(span_bold("- AdminHelp Rejected! -")))]<br>\
|
||||
[span_red(span_bold("Your admin help was rejected."))]<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."))
|
||||
|
||||
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/admin_help/proc/ICIssue(key_name = key_name_admin(usr))
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
|
||||
var/msg = "[span_red(span_huge(span_bold("- AdminHelp marked as IC issue! -")))]<br>"
|
||||
msg += "[span_red(span_bold("This is something that can be solved ICly, and does not currently require staff intervention."))]<br>"
|
||||
msg += "[span_red("Your AdminHelp may also be unanswerable due to ongoing events.")]"
|
||||
|
||||
if(initiator)
|
||||
to_chat(initiator,span_filter_pm(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/admin_help/proc/HandleIssue()
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
|
||||
var/msg = span_red("Your AdminHelp is being handled by [key_name(usr,FALSE,FALSE)] please be patient.")
|
||||
|
||||
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.")
|
||||
var/query_string = "type=admintake"
|
||||
query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]"
|
||||
query_string += "&admin=[url_encode(key_name(usr))]"
|
||||
query_string += "&user=[url_encode(key_name(initiator))]"
|
||||
world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]")
|
||||
|
||||
|
||||
|
||||
|
||||
//Show the ticket panel
|
||||
/datum/admin_help/proc/TicketPanel()
|
||||
tgui_interact(usr.client.mob)
|
||||
|
||||
/datum/admin_help/proc/TicketPanelLegacy()
|
||||
var/list/dat = list("<html><head><title>Ticket #[id]</title></head>")
|
||||
var/ref_src = "\ref[src]"
|
||||
dat += "<h4>Admin Help Ticket #[id]: [LinkedReplyName(ref_src)]</h4>"
|
||||
dat += span_bold("State: ")
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
dat += span_red(span_bold("OPEN"))
|
||||
if(AHELP_RESOLVED)
|
||||
dat += span_green(span_bold("RESOLVED"))
|
||||
if(AHELP_CLOSED)
|
||||
dat += span_bold("CLOSED")
|
||||
else
|
||||
dat += span_bold("UNKNOWN")
|
||||
dat += "[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 += span_bold("Actions:") + " [FullMonty(ref_src)]<br>"
|
||||
else
|
||||
dat += span_bold("DISCONNECTED") + "[GLOB.TAB][ClosureLinks(ref_src)]<br>"
|
||||
dat += "<br>" + span_bold("Log:") + "<br><br>"
|
||||
for(var/I in _interactions)
|
||||
dat += "[I]<br>"
|
||||
dat += "</html>"
|
||||
usr << browse(dat.Join(), "window=ahelp[id];size=620x480")
|
||||
|
||||
/datum/admin_help/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
|
||||
|
||||
/datum/admin_help/tgui_fallback(payload)
|
||||
if(..())
|
||||
return
|
||||
|
||||
TicketPanelLegacy()
|
||||
|
||||
/datum/admin_help/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AdminTicketPanel", "Ticket #[id] - [LinkedReplyName("\ref[src]")]")
|
||||
ui.open()
|
||||
|
||||
/datum/admin_help/tgui_state(mob/user)
|
||||
return GLOB.tgui_admin_state
|
||||
|
||||
/datum/admin_help/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["id"] = id
|
||||
|
||||
var/ref_src = "\ref[src]"
|
||||
data["title"] = name
|
||||
data["name"] = LinkedReplyName(ref_src)
|
||||
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
data["state"] = "open"
|
||||
if(AHELP_RESOLVED)
|
||||
data["state"] = "resolved"
|
||||
if(AHELP_CLOSED)
|
||||
data["state"] = "closed"
|
||||
else
|
||||
data["state"] = "unknown"
|
||||
|
||||
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/admin_help/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("retitle")
|
||||
Retitle()
|
||||
. = TRUE
|
||||
if("reopen")
|
||||
Reopen()
|
||||
. = TRUE
|
||||
if("legacy")
|
||||
TicketPanelLegacy()
|
||||
. = TRUE
|
||||
|
||||
//Forwarded action from admin/Topic
|
||||
/datum/admin_help/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()
|
||||
|
||||
//
|
||||
// TICKET STATCLICK
|
||||
//
|
||||
|
||||
/obj/effect/statclick/ahelp
|
||||
var/datum/admin_help/ahelp_datum
|
||||
|
||||
/obj/effect/statclick/ahelp/Initialize(mapload, text, target)
|
||||
. = ..()
|
||||
ahelp_datum = target
|
||||
|
||||
/obj/effect/statclick/ahelp/update()
|
||||
return ..(ahelp_datum.name)
|
||||
|
||||
/obj/effect/statclick/ahelp/Click()
|
||||
ahelp_datum.TicketPanel()
|
||||
|
||||
/obj/effect/statclick/ahelp/Destroy()
|
||||
ahelp_datum = null
|
||||
return ..()
|
||||
|
||||
//
|
||||
// CLIENT PROCS
|
||||
//
|
||||
|
||||
/client/verb/adminhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Adminhelp"
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_danger("Error: Admin-PM: You cannot send adminhelps (Muted)."))
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
remove_verb(src, /client/verb/adminhelp)
|
||||
spawn(1200)
|
||||
add_verb(src, /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)
|
||||
var/input = tgui_alert(usr, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
if(!input)
|
||||
return
|
||||
if(input == "Yes")
|
||||
if(current_ticket)
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
to_chat(usr, span_admin_pm_notice("PM to-" + span_bold("Admins") + ": [msg]"))
|
||||
return
|
||||
else
|
||||
to_chat(usr, span_warning("Ticket not found, creating new one..."))
|
||||
else
|
||||
current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
|
||||
current_ticket.Close()
|
||||
|
||||
new /datum/admin_help(msg, src, FALSE)
|
||||
|
||||
//admin proc
|
||||
/client/proc/cmd_admin_ticket_panel()
|
||||
set name = "Show Ticket List"
|
||||
set category = "Admin.Misc"
|
||||
|
||||
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.ahelp_tickets.BrowseTickets(browse_to)
|
||||
|
||||
//
|
||||
// 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/admin_help/AH = GLOB.ahelp_tickets.CKey2ActiveTicket(what)
|
||||
if(AH)
|
||||
AH.AddInteraction(message)
|
||||
return AH
|
||||
|
||||
//
|
||||
// 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_for(X, requiredflags))
|
||||
.["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] "
|
||||
var/textentry = "(<A href='byond://?_src_=holder;[HrefToken()];adminmoreinfo=\ref[found]'>?</A>|<A href='byond://?_src_=holder;[HrefToken()];adminplayerobservefollow=\ref[found]'>F</A> "
|
||||
msg += "[original_word]" + span_small((is_antag ? span_red(textentry) : span_black(textentry)))
|
||||
continue
|
||||
msg += "[original_word] "
|
||||
if(irc)
|
||||
if(founds == "")
|
||||
return "Search Failed"
|
||||
else
|
||||
return founds
|
||||
|
||||
return msg
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
|
||||
CHOMPedit - This file has been excluded from the compilation.
|
||||
Reason: Replaced with "Tickets System"
|
||||
|
||||
*/
|
||||
|
||||
/datum/admin_help/proc/send2adminchat()
|
||||
if(!CONFIG_GET(string/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_GET(string/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_GET(string/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_danger("Error: You cannot request spice (muted from adminhelps)."))
|
||||
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")) == "Yes")
|
||||
message_admins("[ADMIN_FULLMONTY(usr)] has requested the round be spiced up a little.")
|
||||
to_chat(usr, span_notice("You have requested some more spice in your round."))
|
||||
else
|
||||
to_chat(usr, span_notice("Spice request cancelled."))
|
||||
return
|
||||
|
||||
//if they requested spice, then remove spice verb temporarily to prevent spamming
|
||||
remove_verb(usr, /client/verb/adminspice)
|
||||
spawn(10 MINUTES)
|
||||
if(usr) // In case we left in the 10 minute cooldown
|
||||
add_verb(usr, /client/verb/adminspice) // 10 minute cool-down for spice request
|
||||
@@ -52,19 +52,19 @@
|
||||
to_chat(src, span_admin_pm_warning("Error: Admin-PM: Client not found."))
|
||||
return
|
||||
|
||||
var/datum/ticket/T = C.current_ticket // CHOMPedit - Ticket System
|
||||
var/datum/ticket/T = C.current_ticket
|
||||
|
||||
if(T) // CHOMPedit - Ticket System
|
||||
if(T)
|
||||
message_admins(span_pm("[key_name_admin(src)] has started replying to [key_name(C, 0, 0)]'s admin help."))
|
||||
var/msg = tgui_input_text(src,"Message:", "Private message to [key_name(C, 0, 0)]", multiline = TRUE)
|
||||
if (!msg)
|
||||
message_admins(span_pm("[key_name_admin(src)] has cancelled their reply to [key_name(C, 0, 0)]'s admin help."))
|
||||
return
|
||||
cmd_admin_pm(whom, msg, T) // CHOMPedit - Ticket System
|
||||
cmd_admin_pm(whom, msg, T)
|
||||
|
||||
//takes input from cmd_admin_pm_context, cmd_admin_pm_panel or /client/Topic and sends them a PM.
|
||||
//Fetching a message if needed. src is the sender and C is the target client
|
||||
/client/proc/cmd_admin_pm(whom, msg, datum/ticket/T) // CHOMPedit - Ticket System
|
||||
/client/proc/cmd_admin_pm(whom, msg, datum/ticket/T)
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_admin_pm_warning("Error: Admin-PM: You are unable to use admin PM-s (muted)."))
|
||||
return
|
||||
@@ -170,7 +170,7 @@
|
||||
else
|
||||
if(holder) //sender is an admin but recipient is not. Do BIG RED TEXT
|
||||
if(!recipient.current_ticket)
|
||||
new /datum/ticket(msg, recipient, TRUE, 0) // CHOMPedit - Ticket System
|
||||
new /datum/ticket(msg, recipient, TRUE, 1)
|
||||
|
||||
to_chat(recipient, span_admin_pm_warning(span_huge(span_bold("-- Administrator private message --"))))
|
||||
to_chat(recipient, span_admin_pm_warning("Admin PM from-<b>[key_name(src, recipient, 0)]</b>: [msg]"))
|
||||
@@ -217,7 +217,7 @@
|
||||
/proc/IrcPm(target,msg,sender)
|
||||
var/client/C = GLOB.directory[target]
|
||||
|
||||
var/datum/ticket/ticket = C ? C.current_ticket : GLOB.tickets.CKey2ActiveTicket(target) // CHOMPedit - Ticket System
|
||||
var/datum/ticket/ticket = C ? C.current_ticket : GLOB.tickets.CKey2ActiveTicket(target)
|
||||
var/compliant_msg = trim(lowertext(msg))
|
||||
var/irc_tagged = "[sender](IRC)"
|
||||
var/list/splits = splittext(compliant_msg, " ")
|
||||
|
||||
@@ -1,63 +1,53 @@
|
||||
/client/proc/cmd_admin_say(msg as text)
|
||||
set category = "Admin.Chat"
|
||||
set name = "Asay" //Gave this shit a shorter name so you only have to time out "asay" rather than "admin say" to use it --NeoFite
|
||||
set hidden = 1
|
||||
if(!check_rights(R_ADMIN)) //VOREStation Edit
|
||||
return
|
||||
|
||||
msg = sanitize(msg)
|
||||
ADMIN_VERB(cmd_admin_say, R_ADMIN, "ASay", "Send a message to other admins", "Admin.Chat", message as text)
|
||||
var/msg = sanitize(message)
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
log_adminsay(msg,src)
|
||||
log_adminsay(msg, user)
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(check_rights_for(C, R_ADMIN))
|
||||
to_chat(C, span_admin_channel(create_text_tag("admin", "ADMIN:", C) + " " + span_name("[key_name(usr, 1)]") + "([admin_jump_link(mob, src)]): " + span_name("[msg]") ))
|
||||
to_chat(C, span_admin_channel(create_text_tag("admin", "ADMIN:", C) + " " + span_name("[key_name(user, 1)]") + "([admin_jump_link(user.mob, C.holder)]): " + span_name("[msg]") ))
|
||||
|
||||
feedback_add_details("admin_verb","M") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_mod_say(msg as text)
|
||||
set category = "Admin.Chat"
|
||||
set name = "Msay"
|
||||
set hidden = 1
|
||||
|
||||
if(!check_rights(R_ADMIN|R_MOD|R_EVENT)) //VOREStation Edit //CHOMP Removal: Removed R_SERVER because it wasn't necessary.
|
||||
return
|
||||
|
||||
msg = sanitize(msg)
|
||||
log_modsay(msg,src)
|
||||
ADMIN_VERB(cmd_mod_say, (R_ADMIN|R_MOD|R_SERVER), "Msay", "Send a message to other mod", "Admin.Chat", message as text)
|
||||
var/msg = sanitize(message)
|
||||
log_modsay(msg, user)
|
||||
|
||||
if (!msg)
|
||||
return
|
||||
|
||||
var/sender_name = key_name(usr, 1)
|
||||
var/sender_name = key_name(user, 1)
|
||||
if(check_rights(R_ADMIN, 0))
|
||||
sender_name = span_admin("[sender_name]")
|
||||
for(var/client/C in GLOB.admins)
|
||||
if(check_rights(R_ADMIN|R_MOD|R_SERVER)) //VOREStation Edit
|
||||
to_chat(C, span_mod_channel(create_text_tag("mod", "MOD:", C) + " " + span_name("[sender_name]") + "([admin_jump_link(mob, C.holder)]): " + span_name("[msg]") ))
|
||||
to_chat(C, span_mod_channel(create_text_tag("mod", "MOD:", C) + " " + span_name("[sender_name]") + "([admin_jump_link(user.mob, C.holder)]): " + span_name("[msg]") ))
|
||||
|
||||
feedback_add_details("admin_verb","MS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/cmd_event_say(msg as text)
|
||||
set category = "Admin.Chat"
|
||||
set name = "Esay"
|
||||
set hidden = 1
|
||||
|
||||
if(!check_rights(R_ADMIN|R_MOD|R_EVENT|R_EVENT)) //CHOMP Removal: Removed R_SERVER because it wasn't necessary.
|
||||
return
|
||||
|
||||
msg = sanitize(msg)
|
||||
log_eventsay(msg,src)
|
||||
ADMIN_VERB(cmd_event_say, (R_ADMIN|R_MOD|R_EVENT|R_SERVER), "Esay", "Send a message to other event manager", "Admin.Chat", message as text)
|
||||
var/msg = sanitize(message)
|
||||
log_eventsay(msg, user)
|
||||
|
||||
if (!msg)
|
||||
return
|
||||
|
||||
var/sender_name = key_name(usr, 1)
|
||||
var/sender_name = key_name(user, 1)
|
||||
if(check_rights(R_ADMIN, 0))
|
||||
sender_name = span_admin("[sender_name]")
|
||||
for(var/client/C in GLOB.admins)
|
||||
to_chat(C, span_event_channel(create_text_tag("event", "EVENT:", C) + " " + span_name("[sender_name]") + "([admin_jump_link(mob, C.holder)]): " + span_name("[msg]") ))
|
||||
to_chat(C, span_event_channel(create_text_tag("event", "EVENT:", C) + " " + span_name("[sender_name]") + "([admin_jump_link(user.mob, C.holder)]): " + span_name("[msg]") ))
|
||||
|
||||
feedback_add_details("admin_verb","GS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
ADMIN_VERB(cmd_mentor_say, (R_ADMIN|R_MOD|R_EVENT|R_SERVER|R_MENTOR), "Mentorsay", "Send a message to other mentors", "Admin.Chat", message as text)
|
||||
var/msg = sanitize(message)
|
||||
if (!msg)
|
||||
return
|
||||
|
||||
log_admin("Mentorsay: [key_name(user)]: [msg]")
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
to_chat(C, create_text_tag("mentor", "MENTOR:", C) + " " + span_mentor_channel(span_name("[user]") + ": " + span_message("[msg]")))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//DO NOT ADD MORE TO THIS FILE.
|
||||
//Use vv_do_topic()!
|
||||
/client/proc/view_var_Topic(href, href_list, hsrc)
|
||||
if((usr.client != src) || !src.holder)
|
||||
if((usr.client != src) || !check_rights(R_HOLDER))
|
||||
return
|
||||
var/datum/target = locate(href_list["target"])
|
||||
if(istype(target))
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
var/mob/M = locate(href_list["rename"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
var/new_name = sanitize(tgui_input_text(usr,"What would you like to name this mob?","Input a name",M.real_name,MAX_NAME_LEN), MAX_NAME_LEN)
|
||||
var/new_name = sanitize(tgui_input_text(src,"What would you like to name this mob?","Input a name",M.real_name,MAX_NAME_LEN), MAX_NAME_LEN)
|
||||
if( !new_name || !M ) return
|
||||
|
||||
message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].")
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
var/D = locate(href_list["datumedit"])
|
||||
if(!istype(D,/datum) && !istype(D,/client))
|
||||
to_chat(usr, "This can only be used on instances of types /client or /datum")
|
||||
to_chat(src, "This can only be used on instances of types /client or /datum")
|
||||
return
|
||||
|
||||
modify_variables(D, href_list["varnameedit"], 1)
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
var/D = locate(href_list["datumchange"])
|
||||
if(!istype(D,/datum) && !istype(D,/client))
|
||||
to_chat(usr, "This can only be used on instances of types /client or /datum")
|
||||
to_chat(src, "This can only be used on instances of types /client or /datum")
|
||||
return
|
||||
|
||||
modify_variables(D, href_list["varnamechange"], 0)
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
var/atom/A = locate(href_list["datummass"])
|
||||
if(!istype(A))
|
||||
to_chat(usr, "This can only be used on instances of type /atom")
|
||||
to_chat(src, "This can only be used on instances of type /atom")
|
||||
return
|
||||
|
||||
cmd_mass_modify_object_variables(A, href_list["varnamemass"])
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["mob_player_panel"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
src.holder.show_player_panel(M)
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["give_spell"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
src.give_spell(M)
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
var/mob/living/M = locate(href_list["give_modifier"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob/living")
|
||||
to_chat(src, "This can only be used on instances of type /mob/living")
|
||||
return
|
||||
|
||||
src.admin_give_modifier(M)
|
||||
@@ -98,22 +98,22 @@
|
||||
|
||||
var/mob/living/carbon/human/H = locate(href_list["give_wound_internal"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, span_notice("This can only be used on instances of type /mob/living/carbon/human"))
|
||||
to_chat(src, span_notice("This can only be used on instances of type /mob/living/carbon/human"))
|
||||
return
|
||||
|
||||
var/severity = tgui_input_number(usr, "How much damage should the bleeding internal wound cause? \
|
||||
var/severity = tgui_input_number(src, "How much damage should the bleeding internal wound cause? \
|
||||
Bleed timer directly correlates with this. 0 cancels. Input is rounded to nearest integer.",
|
||||
"Wound Severity", 0)
|
||||
if(!severity) return
|
||||
|
||||
var/obj/item/organ/external/chosen_organ = tgui_input_list(usr, "Choose an external organ to inflict IB on!", "Organ Choice", H.organs)
|
||||
var/obj/item/organ/external/chosen_organ = tgui_input_list(src, "Choose an external organ to inflict IB on!", "Organ Choice", H.organs)
|
||||
if(!chosen_organ || !istype(chosen_organ))
|
||||
to_chat(usr, span_notice("The chosen organ is of inappropriate type or no longer exists."))
|
||||
return
|
||||
|
||||
var/datum/wound/internal_bleeding/I = new /datum/wound/internal_bleeding(severity)
|
||||
if(!I || !istype(I))
|
||||
to_chat(usr, span_notice("Could not initialize internal wound"))
|
||||
to_chat(src, span_notice("Could not initialize internal wound"))
|
||||
log_debug("[usr] attempted to create an internal bleeding wound on [H]'s [chosen_organ] of [severity] damage \
|
||||
and wound initialization failed")
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["godmode"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
src.cmd_admin_godmode(M)
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["gib"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
src.cmd_admin_gib(M)
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["build_mode"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
togglebuildmode(M)
|
||||
@@ -166,7 +166,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["drop_everything"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
if(usr.client)
|
||||
@@ -177,7 +177,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["direct_control"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be used on instances of type /mob")
|
||||
to_chat(src, "This can only be used on instances of type /mob")
|
||||
return
|
||||
|
||||
if(usr.client)
|
||||
@@ -188,22 +188,22 @@
|
||||
|
||||
var/mob/M = locate(href_list["give_ai"])
|
||||
if(!isliving(M))
|
||||
to_chat(usr, span_notice("This can only be used on instances of type /mob/living"))
|
||||
to_chat(src, span_notice("This can only be used on instances of type /mob/living"))
|
||||
return
|
||||
var/mob/living/L = M
|
||||
if(L.client || L.teleop)
|
||||
to_chat(usr, span_warning("This cannot be used on player mobs!"))
|
||||
to_chat(src, span_warning("This cannot be used on player mobs!"))
|
||||
return
|
||||
|
||||
if(L.ai_holder) //Cleaning up the original ai
|
||||
var/ai_holder_old = L.ai_holder
|
||||
L.ai_holder = null
|
||||
qdel(ai_holder_old) //Only way I could make #TESTING - Unable to be GC'd to stop. del() logs show it works.
|
||||
L.ai_holder_type = tgui_input_list(usr, "Choose AI holder", "AI Type", typesof(/datum/ai_holder/))
|
||||
L.ai_holder_type = tgui_input_list(src, "Choose AI holder", "AI Type", typesof(/datum/ai_holder/))
|
||||
L.initialize_ai_holder()
|
||||
L.faction = sanitize(tgui_input_text(usr, "Please input AI faction", "AI faction", "neutral"))
|
||||
L.a_intent = tgui_input_list(usr, "Please choose AI intent", "AI intent", list(I_HURT, I_HELP))
|
||||
if(tgui_alert(usr, "Make mob wake up? This is needed for carbon mobs.", "Wake mob?", list("Yes", "No")) == "Yes")
|
||||
L.faction = sanitize(tgui_input_text(src, "Please input AI faction", "AI faction", "neutral"))
|
||||
L.a_intent = tgui_input_list(src, "Please choose AI intent", "AI intent", list(I_HURT, I_HELP))
|
||||
if(tgui_alert(src, "Make mob wake up? This is needed for carbon mobs.", "Wake mob?", list("Yes", "No")) == "Yes")
|
||||
L.AdjustSleeping(-100)
|
||||
|
||||
else if(href_list["make_skeleton"])
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
var/mob/living/carbon/human/H = locate(href_list["make_skeleton"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be used on instances of type /mob/living/carbon/human")
|
||||
to_chat(src, "This can only be used on instances of type /mob/living/carbon/human")
|
||||
return
|
||||
|
||||
H.ChangeToSkeleton()
|
||||
@@ -223,17 +223,17 @@
|
||||
|
||||
var/obj/O = locate(href_list["delall"])
|
||||
if(!isobj(O))
|
||||
to_chat(usr, "This can only be used on instances of type /obj")
|
||||
to_chat(src, "This can only be used on instances of type /obj")
|
||||
return
|
||||
|
||||
var/action_type = tgui_alert(usr, "Strict type ([O.type]) or type and all subtypes?","Type Selection",list("Strict type","Type and subtypes","Cancel"))
|
||||
var/action_type = tgui_alert(src, "Strict type ([O.type]) or type and all subtypes?","Type Selection",list("Strict type","Type and subtypes","Cancel"))
|
||||
if(action_type == "Cancel" || !action_type)
|
||||
return
|
||||
|
||||
if(tgui_alert(usr, "Are you really sure you want to delete all objects of type [O.type]?","Delete All?",list("Yes","No")) != "Yes")
|
||||
if(tgui_alert(src, "Are you really sure you want to delete all objects of type [O.type]?","Delete All?",list("Yes","No")) != "Yes")
|
||||
return
|
||||
|
||||
if(tgui_alert(usr, "Second confirmation required. Delete?","REALLY?",list("Yes","No")) != "Yes")
|
||||
if(tgui_alert(src, "Second confirmation required. Delete?","REALLY?",list("Yes","No")) != "Yes")
|
||||
return
|
||||
|
||||
var/O_type = O.type
|
||||
@@ -246,7 +246,7 @@
|
||||
qdel(Obj)
|
||||
CHECK_TICK
|
||||
if(!i)
|
||||
to_chat(usr, "No objects of this type exist")
|
||||
to_chat(src, "No objects of this type exist")
|
||||
return
|
||||
log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ")
|
||||
message_admins(span_notice("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) "))
|
||||
@@ -258,7 +258,7 @@
|
||||
qdel(Obj)
|
||||
CHECK_TICK
|
||||
if(!i)
|
||||
to_chat(usr, "No objects of this type exist")
|
||||
to_chat(src, "No objects of this type exist")
|
||||
return
|
||||
log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ")
|
||||
message_admins(span_notice("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) "))
|
||||
@@ -267,7 +267,7 @@
|
||||
|
||||
var/obj/item/pda/P = locate(href_list["fakepdapropconvo"])
|
||||
if(!istype(P))
|
||||
to_chat(usr, span_warning("This can only be done to instances of type /pda"))
|
||||
to_chat(src, span_warning("This can only be done to instances of type /pda"))
|
||||
return
|
||||
|
||||
P.createPropFakeConversation_admin(usr)
|
||||
@@ -277,7 +277,7 @@
|
||||
|
||||
var/atom/A = locate(href_list["rotatedatum"])
|
||||
if(!istype(A))
|
||||
to_chat(usr, "This can only be done to instances of type /atom")
|
||||
to_chat(src, "This can only be done to instances of type /atom")
|
||||
return
|
||||
|
||||
switch(href_list["rotatedir"])
|
||||
@@ -290,12 +290,12 @@
|
||||
|
||||
var/mob/living/carbon/human/H = locate(href_list["makemonkey"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
to_chat(src, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
return
|
||||
|
||||
if(tgui_alert(usr, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(tgui_alert(src, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
holder.Topic(href, list("monkeyone"=href_list["makemonkey"]))
|
||||
|
||||
@@ -304,12 +304,12 @@
|
||||
|
||||
var/mob/living/carbon/human/H = locate(href_list["makerobot"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
to_chat(src, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
return
|
||||
|
||||
if(tgui_alert(usr, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(tgui_alert(src, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
holder.Topic(href, list("makerobot"=href_list["makerobot"]))
|
||||
|
||||
@@ -318,12 +318,12 @@
|
||||
|
||||
var/mob/living/carbon/human/H = locate(href_list["makealien"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
to_chat(src, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
return
|
||||
|
||||
if(tgui_alert(usr, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(tgui_alert(src, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
holder.Topic(href, list("makealien"=href_list["makealien"]))
|
||||
|
||||
@@ -332,12 +332,12 @@
|
||||
|
||||
var/mob/living/carbon/human/H = locate(href_list["makeai"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
to_chat(src, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
return
|
||||
|
||||
if(tgui_alert(usr, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(tgui_alert(src, "Confirm mob type change?","Confirm",list("Transform","Cancel")) != "Transform") return
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
holder.Topic(href, list("makeai"=href_list["makeai"]))
|
||||
|
||||
@@ -346,67 +346,67 @@
|
||||
|
||||
var/mob/living/carbon/human/H = locate(href_list["setspecies"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
to_chat(src, "This can only be done to instances of type /mob/living/carbon/human")
|
||||
return
|
||||
|
||||
var/new_species = tgui_input_list(usr, "Please choose a new species.","Species", GLOB.all_species)
|
||||
var/new_species = tgui_input_list(src, "Please choose a new species.","Species", GLOB.all_species)
|
||||
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
|
||||
if(H.set_species(new_species))
|
||||
to_chat(usr, "Set species of [H] to [H.species].")
|
||||
to_chat(src, "Set species of [H] to [H.species].")
|
||||
else
|
||||
to_chat(usr, "Failed! Something went wrong.")
|
||||
to_chat(src, "Failed! Something went wrong.")
|
||||
|
||||
else if(href_list["addlanguage"])
|
||||
if(!check_rights(R_SPAWN)) return
|
||||
|
||||
var/mob/H = locate(href_list["addlanguage"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob")
|
||||
to_chat(src, "This can only be done to instances of type /mob")
|
||||
return
|
||||
|
||||
var/new_language = tgui_input_list(usr, "Please choose a language to add.","Language", GLOB.all_languages)
|
||||
var/new_language = tgui_input_list(src, "Please choose a language to add.","Language", GLOB.all_languages)
|
||||
|
||||
if(!new_language)
|
||||
return
|
||||
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
|
||||
if(H.add_language(new_language))
|
||||
to_chat(usr, "Added [new_language] to [H].")
|
||||
to_chat(src, "Added [new_language] to [H].")
|
||||
else
|
||||
to_chat(usr, "Mob already knows that language.")
|
||||
to_chat(src, "Mob already knows that language.")
|
||||
|
||||
else if(href_list["remlanguage"])
|
||||
if(!check_rights(R_SPAWN)) return
|
||||
|
||||
var/mob/H = locate(href_list["remlanguage"])
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob")
|
||||
to_chat(src, "This can only be done to instances of type /mob")
|
||||
return
|
||||
|
||||
if(!H.languages.len)
|
||||
to_chat(usr, "This mob knows no languages.")
|
||||
to_chat(src, "This mob knows no languages.")
|
||||
return
|
||||
|
||||
var/datum/language/rem_language = tgui_input_list(usr, "Please choose a language to remove.","Language", H.languages)
|
||||
var/datum/language/rem_language = tgui_input_list(src, "Please choose a language to remove.","Language", H.languages)
|
||||
|
||||
if(!rem_language)
|
||||
return
|
||||
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
|
||||
if(H.remove_language(rem_language.name))
|
||||
to_chat(usr, "Removed [rem_language] from [H].")
|
||||
to_chat(src, "Removed [rem_language] from [H].")
|
||||
else
|
||||
to_chat(usr, "Mob doesn't know that language.")
|
||||
to_chat(src, "Mob doesn't know that language.")
|
||||
|
||||
else if(href_list["addverb"])
|
||||
if(!check_rights(R_DEBUG)) return
|
||||
@@ -414,7 +414,7 @@
|
||||
var/mob/H = locate(href_list["addverb"])
|
||||
|
||||
if(!ismob(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob")
|
||||
to_chat(src, "This can only be done to instances of type /mob")
|
||||
return
|
||||
var/list/possibleverbs = list()
|
||||
possibleverbs += "Cancel" // One for the top...
|
||||
@@ -434,9 +434,9 @@
|
||||
possibleverbs -= H.verbs
|
||||
possibleverbs += "Cancel" // ...And one for the bottom
|
||||
|
||||
var/verb = tgui_input_list(usr, "Select a verb!", "Verbs", possibleverbs)
|
||||
var/verb = tgui_input_list(src, "Select a verb!", "Verbs", possibleverbs)
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
if(!verb || verb == "Cancel")
|
||||
return
|
||||
@@ -449,11 +449,11 @@
|
||||
var/mob/H = locate(href_list["remverb"])
|
||||
|
||||
if(!istype(H))
|
||||
to_chat(usr, "This can only be done to instances of type /mob")
|
||||
to_chat(src, "This can only be done to instances of type /mob")
|
||||
return
|
||||
var/verb = tgui_input_list(usr, "Please choose a verb to remove.","Verbs", H.verbs)
|
||||
var/verb = tgui_input_list(src, "Please choose a verb to remove.","Verbs", H.verbs)
|
||||
if(!H)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
if(!verb)
|
||||
return
|
||||
@@ -465,18 +465,18 @@
|
||||
|
||||
var/mob/living/carbon/M = locate(href_list["addorgan"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon")
|
||||
to_chat(src, "This can only be done to instances of type /mob/living/carbon")
|
||||
return
|
||||
|
||||
var/new_organ = tgui_input_list(usr, "Please choose an organ to add.","Organ", subtypesof(/obj/item/organ))
|
||||
var/new_organ = tgui_input_list(src, "Please choose an organ to add.","Organ", subtypesof(/obj/item/organ))
|
||||
if(!new_organ) return
|
||||
|
||||
if(!M)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
|
||||
if(locate(new_organ) in M.internal_organs)
|
||||
to_chat(usr, "Mob already has that organ.")
|
||||
to_chat(src, "Mob already has that organ.")
|
||||
return
|
||||
|
||||
new new_organ(M)
|
||||
@@ -487,20 +487,20 @@
|
||||
|
||||
var/mob/living/carbon/M = locate(href_list["remorgan"])
|
||||
if(!istype(M))
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon")
|
||||
to_chat(src, "This can only be done to instances of type /mob/living/carbon")
|
||||
return
|
||||
|
||||
var/obj/item/organ/rem_organ = tgui_input_list(usr, "Please choose an organ to remove.","Organ", M.internal_organs)
|
||||
var/obj/item/organ/rem_organ = tgui_input_list(src, "Please choose an organ to remove.","Organ", M.internal_organs)
|
||||
|
||||
if(!M)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
|
||||
if(!(locate(rem_organ) in M.internal_organs))
|
||||
to_chat(usr, "Mob does not have that organ.")
|
||||
to_chat(src, "Mob does not have that organ.")
|
||||
return
|
||||
|
||||
to_chat(usr, "Removed [rem_organ] from [M].")
|
||||
to_chat(src, "Removed [rem_organ] from [M].")
|
||||
rem_organ.removed()
|
||||
qdel(rem_organ)
|
||||
|
||||
@@ -510,12 +510,12 @@
|
||||
var/mob/H = locate(href_list["fix_nano"])
|
||||
|
||||
if(!istype(H) || !H.client)
|
||||
to_chat(usr, "This can only be done on mobs with clients")
|
||||
to_chat(src, "This can only be done on mobs with clients")
|
||||
return
|
||||
|
||||
H.client.send_resources()
|
||||
|
||||
to_chat(usr, "Resource files sent")
|
||||
to_chat(src, "Resource files sent")
|
||||
to_chat(H, "Your NanoUI Resource files have been refreshed")
|
||||
|
||||
log_admin("[key_name(usr)] resent the NanoUI resource files to [key_name(H)] ")
|
||||
@@ -525,7 +525,7 @@
|
||||
|
||||
var/mob/M = locate(href_list["regenerateicons"])
|
||||
if(!ismob(M))
|
||||
to_chat(usr, "This can only be done to instances of type /mob")
|
||||
to_chat(src, "This can only be done to instances of type /mob")
|
||||
return
|
||||
M.regenerate_icons()
|
||||
|
||||
@@ -537,10 +537,10 @@
|
||||
|
||||
var/Text = href_list["adjustDamage"]
|
||||
|
||||
var/amount = tgui_input_number(usr, "Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0, min_value=-INFINITY, round_value=FALSE)
|
||||
var/amount = tgui_input_number(src, "Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0, min_value=-INFINITY, round_value=FALSE)
|
||||
|
||||
if(!L)
|
||||
to_chat(usr, "Mob doesn't exist anymore")
|
||||
to_chat(src, "Mob doesn't exist anymore")
|
||||
return
|
||||
|
||||
switch(Text)
|
||||
@@ -551,7 +551,7 @@
|
||||
if("brain") L.adjustBrainLoss(amount)
|
||||
if("clone") L.adjustCloneLoss(amount)
|
||||
else
|
||||
to_chat(usr, "You caused an error. DEBUG: Text:[Text] Mob:[L]")
|
||||
to_chat(src, "You caused an error. DEBUG: Text:[Text] Mob:[L]")
|
||||
return
|
||||
|
||||
if(amount != 0)
|
||||
@@ -570,11 +570,11 @@
|
||||
var/client/C = value["value"]
|
||||
if (!C)
|
||||
return
|
||||
var/prompt = tgui_alert(usr, "Do you want to grant [C] access to view this VV window? (they will not be able to edit or change anysrc nor open nested vv windows unless they themselves are an admin)", "Confirm", list("Yes", "No"))
|
||||
var/prompt = tgui_alert(src, "Do you want to grant [C] access to view this VV window? (they will not be able to edit or change anysrc nor open nested vv windows unless they themselves are an admin)", "Confirm", list("Yes", "No"))
|
||||
if (prompt != "Yes")
|
||||
return
|
||||
if(!thing)
|
||||
to_chat(usr, span_warning("The object you tried to expose to [C] no longer exists (GC'd)"))
|
||||
to_chat(src, span_warning("The object you tried to expose to [C] no longer exists (GC'd)"))
|
||||
return
|
||||
message_admins("[key_name_admin(usr)] Showed [key_name_admin(C)] a <a href='byond://?_src_=vars;[HrefToken(TRUE)];datumrefresh=\ref[thing]'>VV window</a>")
|
||||
log_admin("Admin [key_name(usr)] Showed [key_name(C)] a VV window of a [src]")
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#define ICON_STATE_CHECKED 1 /// this dmi is checked. We don't check this one anymore.
|
||||
#define ICON_STATE_NULL 2 /// this dmi has null-named icon_state, allowing it to show a sprite on vv editor.
|
||||
|
||||
ADMIN_VERB_AND_CONTEXT_MENU(debug_variables, (R_DEBUG|R_SERVER|R_ADMIN|R_SPAWN|R_FUN|R_EVENT), "View Variables", "View the variables of a datum.", "Debug.Investigate", datum/thing in world)
|
||||
user.debug_variables(thing)
|
||||
// This is kept as a separate proc because admins are able to show VV to non-admins
|
||||
|
||||
/client/proc/debug_variables(datum/D in world)
|
||||
set category = "Debug.Investigate"
|
||||
set name = "View Variables"
|
||||
|
||||
@@ -182,7 +182,6 @@
|
||||
|
||||
switch(href_list["_src_"])
|
||||
if("holder") hsrc = holder
|
||||
if("mentorholder") hsrc = (check_rights(R_ADMIN, 0) ? holder : mentorholder)
|
||||
if("usr") hsrc = mob
|
||||
if("prefs") return prefs.process_link(usr,href_list)
|
||||
if("vars") return view_var_Topic(href,href_list,hsrc)
|
||||
@@ -260,7 +259,7 @@
|
||||
initialize_commandbar_spy()
|
||||
tgui_panel = new(src, "browseroutput")
|
||||
|
||||
GLOB.tickets.ClientLogin(src) // CHOMPedit - Tickets System
|
||||
GLOB.tickets.ClientLogin(src)
|
||||
|
||||
//Admin Authorisation
|
||||
holder = GLOB.admin_datums[ckey]
|
||||
@@ -268,10 +267,6 @@
|
||||
GLOB.admins += src
|
||||
holder.owner = src
|
||||
|
||||
mentorholder = mentor_datums[ckey]
|
||||
if (mentorholder)
|
||||
mentorholder.associate(GLOB.directory[ckey])
|
||||
|
||||
//preferences datum - also holds some persistant data for the client (because we may as well keep these datums to a minimum)
|
||||
prefs = preferences_datums[ckey]
|
||||
if(prefs)
|
||||
@@ -376,7 +371,9 @@
|
||||
gc_destroyed = world.time
|
||||
if (!QDELING(src))
|
||||
stack_trace("Client does not purport to be QDELING, this is going to cause bugs in other places!")
|
||||
GLOB.tickets.ClientLogout(src) // CHOMPedit - Tickets System
|
||||
|
||||
GLOB.tickets.ClientLogout(src)
|
||||
|
||||
// Yes this is the same as what's found in qdel(). Yes it does need to be here
|
||||
// Get off my back
|
||||
SEND_SIGNAL(src, COMSIG_PARENT_QDELETING, TRUE)
|
||||
@@ -387,9 +384,6 @@
|
||||
if(holder)
|
||||
holder.owner = null
|
||||
GLOB.admins -= src
|
||||
if (mentorholder)
|
||||
mentorholder.owner = null
|
||||
GLOB.mentors -= src
|
||||
GLOB.directory -= ckey
|
||||
GLOB.clients -= src
|
||||
|
||||
|
||||
@@ -62,10 +62,12 @@
|
||||
var/modmsg = ""
|
||||
var/devmsg = ""
|
||||
var/eventMmsg = ""
|
||||
var/mentormsg = ""
|
||||
var/num_mods_online = 0
|
||||
var/num_admins_online = 0
|
||||
var/num_devs_online = 0
|
||||
var/num_event_managers_online = 0
|
||||
var/num_mentors_online = 0
|
||||
for(var/client/C in GLOB.admins) // VOREStation Edit - GLOB
|
||||
var/temp = ""
|
||||
var/category = R_ADMIN
|
||||
@@ -84,6 +86,9 @@
|
||||
else if(check_rights_for(C, R_STEALTH)) // event managers //VOREStation Edit: Retired Staff
|
||||
category = R_EVENT
|
||||
num_event_managers_online++
|
||||
else if(check_rights_for(C, R_MENTOR))
|
||||
category = R_MENTOR
|
||||
num_mentors_online++
|
||||
|
||||
temp += "\t[C] is a [C.holder.rank_names()]"
|
||||
if(holder)
|
||||
@@ -110,6 +115,8 @@
|
||||
devmsg += temp
|
||||
if(R_EVENT)
|
||||
eventMmsg += temp
|
||||
if(R_MENTOR)
|
||||
mentormsg += temp
|
||||
|
||||
msg = span_bold("Current Admins ([num_admins_online]):") + "\n" + msg
|
||||
|
||||
@@ -122,27 +129,8 @@
|
||||
if(CONFIG_GET(flag/show_event_managers))
|
||||
msg += "\n" + span_bold(" Current Miscellaneous ([num_event_managers_online]):") + "\n" + eventMmsg
|
||||
|
||||
var/num_mentors_online = 0
|
||||
var/mmsg = ""
|
||||
|
||||
for(var/client/C in GLOB.mentors)
|
||||
num_mentors_online++
|
||||
mmsg += "\t[C] is a Mentor"
|
||||
if(holder)
|
||||
if(isobserver(C.mob))
|
||||
mmsg += " - Observing"
|
||||
else if(isnewplayer(C.mob))
|
||||
mmsg += " - Lobby"
|
||||
else
|
||||
mmsg += " - Playing"
|
||||
|
||||
if(C.is_afk())
|
||||
var/seconds = C.last_activity_seconds()
|
||||
mmsg += " (AFK - [round(seconds / 60)] minutes, [seconds % 60] seconds)"
|
||||
mmsg += "\n"
|
||||
|
||||
if(CONFIG_GET(flag/show_mentors))
|
||||
msg += "\n" + span_bold(" Current Mentors ([num_mentors_online]):") + "\n" + mmsg
|
||||
msg += "\n" + span_bold(" Current Mentors ([num_mentors_online]):") + "\n" + mentormsg
|
||||
|
||||
msg += "\n" + span_info("Adminhelps are also sent to Discord. If no admins are available in game try anyway and an admin on Discord may see it and respond.")
|
||||
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
/client
|
||||
var/datum/mentor/mentorholder = null
|
||||
|
||||
var/list/mentor_datums = list()
|
||||
|
||||
var/list/mentor_verbs_default = list(
|
||||
/client/proc/cmd_mentor_ticket_panel,
|
||||
/client/proc/cmd_mentor_say,
|
||||
/client/proc/cmd_dementor
|
||||
)
|
||||
|
||||
/datum/mentor
|
||||
var/client/owner = null
|
||||
|
||||
/datum/mentor/New(ckey)
|
||||
if(!ckey)
|
||||
error("Mentor datum created without a ckey argument. Datum has been deleted")
|
||||
qdel(src)
|
||||
return
|
||||
mentor_datums[ckey] = src
|
||||
|
||||
/datum/mentor/proc/associate(client/C)
|
||||
if(istype(C))
|
||||
owner = C
|
||||
owner.mentorholder = src
|
||||
owner.add_mentor_verbs()
|
||||
GLOB.mentors |= C
|
||||
|
||||
/datum/mentor/proc/disassociate()
|
||||
if(owner)
|
||||
GLOB.mentors -= owner
|
||||
owner.remove_mentor_verbs()
|
||||
owner.mentorholder = null
|
||||
mentor_datums[owner.ckey] = null
|
||||
qdel(src)
|
||||
|
||||
/client/proc/add_mentor_verbs()
|
||||
if(mentorholder)
|
||||
add_verb(src, mentor_verbs_default)
|
||||
|
||||
/client/proc/remove_mentor_verbs()
|
||||
if(mentorholder)
|
||||
remove_verb(src, mentor_verbs_default)
|
||||
|
||||
/client/proc/make_mentor()
|
||||
set category = "Admin.Secrets"
|
||||
set name = "Make Mentor"
|
||||
if(!holder)
|
||||
to_chat(src, span_admin_pm_warning("Error: Only administrators may use this command."))
|
||||
return
|
||||
var/list/client/targets[0]
|
||||
for(var/client/T in GLOB.clients)
|
||||
targets["[T.key]"] = T
|
||||
var/target = tgui_input_list(src,"Who do you want to make a mentor?","Make Mentor", sortList(targets))
|
||||
if(!target)
|
||||
return
|
||||
var/client/C = targets[target]
|
||||
if(has_mentor_powers(C) || GLOB.deadmins[C.ckey]) // If an admin is deadminned you could mentor them and that will cause fuckery if they readmin
|
||||
to_chat(src, span_admin_pm_warning("Error: They already have mentor powers."))
|
||||
return
|
||||
var/datum/mentor/M = new /datum/mentor(C.ckey)
|
||||
M.associate(C)
|
||||
to_chat(C, span_admin_pm_notice("You have been granted mentorship."))
|
||||
to_chat(src, span_admin_pm_notice("You have made [C] a mentor."))
|
||||
log_admin("[key_name(src)] made [key_name(C)] a mentor.")
|
||||
feedback_add_details("admin_verb","Make Mentor") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
// CHOMPedit Start - Adding to DB Logic
|
||||
var/result = tgui_alert(src, "Do you want to add this person into the mentor database? This will allow them to be a mentor in future rounds too.", "Add to Database", list("Yes", "No"))
|
||||
if(result == "Yes")
|
||||
var/datum/db_query/query = SSdbcore.NewQuery("INSERT INTO erro_mentor (ckey, mentor) VALUES (:ckey, :mentor)", list("ckey" = C.ckey, "mentor" = 1))
|
||||
query.Execute()
|
||||
qdel(query)
|
||||
// CHOMPedit End
|
||||
|
||||
/client/proc/unmake_mentor()
|
||||
set category = "Admin.Secrets"
|
||||
set name = "Unmake Mentor"
|
||||
if(!holder)
|
||||
to_chat(src, span_admin_pm_warning("Error: Only administrators may use this command."))
|
||||
return
|
||||
var/list/client/targets[0]
|
||||
for(var/client/T in GLOB.mentors)
|
||||
targets["[T.key]"] = T
|
||||
var/target = tgui_input_list(src,"Which mentor do you want to unmake?","Unmake Mentor", sortList(targets))
|
||||
if(!target)
|
||||
return
|
||||
var/client/C = targets[target]
|
||||
C.mentorholder.disassociate()
|
||||
to_chat(C, span_admin_pm_warning("Your mentorship has been revoked."))
|
||||
to_chat(src, span_admin_pm_notice("You have revoked [C]'s mentorship."))
|
||||
log_admin("[key_name(src)] revoked [key_name(C)]'s mentorship.")
|
||||
feedback_add_details("admin_verb","Unmake Mentor") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
// CHOMPedit Start - Removing from DB Logic
|
||||
var/datum/db_query/query = SSdbcore.NewQuery("DELETE FROM erro_mentor WHERE ckey = :ckey", list("ckey" = C.ckey))
|
||||
query.Execute()
|
||||
qdel(query)
|
||||
// CHOMPedit End
|
||||
|
||||
/client/proc/cmd_mentor_say(msg as text)
|
||||
set category = "Admin.Chat"
|
||||
set name ="Mentorsay"
|
||||
|
||||
//check rights
|
||||
if (!has_mentor_powers(src))
|
||||
return
|
||||
|
||||
msg = sanitize(msg)
|
||||
if (!msg)
|
||||
return
|
||||
|
||||
log_admin("Mentorsay: [key_name(src)]: [msg]")
|
||||
|
||||
for(var/client/C in GLOB.mentors)
|
||||
to_chat(C, create_text_tag("mentor", "MENTOR:", C) + " " + span_mentor_channel(span_name("[src]") + ": " + span_message("[msg]")))
|
||||
for(var/client/C in GLOB.admins)
|
||||
to_chat(C, create_text_tag("mentor", "MENTOR:", C) + " " + span_mentor_channel(span_name("[src]") + ": " + span_message("[msg]")))
|
||||
|
||||
/proc/mentor_commands(href, href_list, client/C)
|
||||
// CHOMPedit Start - Tickets System
|
||||
if(href_list["ticket"])
|
||||
var/ticket_ref = href_list["ticket"]
|
||||
var/datum/ticket/T = locate(ticket_ref)
|
||||
if (T && istype(T, /datum/ticket))
|
||||
T.Action(href_list["ticket_action"])
|
||||
else
|
||||
to_chat(C, "Ticket [ticket_ref] has been deleted!")
|
||||
|
||||
if (href_list["tickets"])
|
||||
GLOB.tickets.BrowseTickets(text2num(href_list["tickets"]))
|
||||
// CHOMPedit End
|
||||
|
||||
/datum/mentor/Topic(href, href_list)
|
||||
..()
|
||||
if (usr.client != src.owner || (!usr.client.mentorholder))
|
||||
log_admin("[key_name(usr)] tried to illegally use mentor functions.")
|
||||
message_admins("[usr.key] tried to illegally use mentor functions.")
|
||||
return
|
||||
|
||||
mentor_commands(href, href_list, usr)
|
||||
|
||||
/client/proc/cmd_dementor()
|
||||
set category = "Admin.Misc"
|
||||
set name = "De-mentor"
|
||||
|
||||
if(tgui_alert(usr, "Confirm self-dementor for the round? You can't re-mentor yourself without someone promoting you.","Dementor",list("Yes","No")) == "Yes")
|
||||
src.mentorholder.disassociate()
|
||||
|
||||
/client/proc/cmd_mhelp_reply(whom)
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_admin_pm_warning("Error: Mentor-PM: You are unable to use admin PM-s (muted)."))
|
||||
return
|
||||
var/client/C
|
||||
if(istext(whom))
|
||||
C = GLOB.directory[whom]
|
||||
else if(istype(whom,/client))
|
||||
C = whom
|
||||
if(!C)
|
||||
if(has_mentor_powers(src))
|
||||
to_chat(src, span_admin_pm_warning("Error: Mentor-PM: Client not found."))
|
||||
return
|
||||
|
||||
var/datum/ticket/T = C.current_ticket // CHOMPedit - Ticket System
|
||||
|
||||
if(T) // CHOMPedit - Ticket System
|
||||
message_mentors(span_mentor_channel("[src] has started replying to [C]'s mentor help."))
|
||||
var/msg = tgui_input_text(src,"Message:", "Private message to [C]", multiline = TRUE)
|
||||
if (!msg)
|
||||
message_mentors(span_mentor_channel("[src] has cancelled their reply to [C]'s mentor help."))
|
||||
return
|
||||
cmd_mentor_pm(whom, msg, T) // CHOMPedit - Ticket System
|
||||
|
||||
/proc/has_mentor_powers(client/C)
|
||||
return C.holder || C.mentorholder
|
||||
|
||||
// This not really a great place to put it, but this verb replaces adminhelp in hotkeys so that people requesting help can select the type they need
|
||||
// You can still directly adminhelp if necessary, this ONLY replaces the inbuilt hotkeys
|
||||
|
||||
/client/verb/requesthelp()
|
||||
set category = "Admin"
|
||||
set name = "Request help"
|
||||
set hidden = 1
|
||||
|
||||
var/mhelp = tgui_alert(usr, "Select the help you need.","Request for Help",list("Adminhelp","Mentorhelp"))
|
||||
if(!mhelp)
|
||||
return
|
||||
|
||||
var/msg = tgui_input_text(usr, "Input your request for help.", "Request for Help ([mhelp])", multiline = TRUE)
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
if (mhelp == "Mentorhelp")
|
||||
mentorhelp(msg)
|
||||
return
|
||||
|
||||
adminhelp(msg)
|
||||
|
||||
|
||||
/client/proc/cmd_mentor_pm(whom, msg, datum/ticket/T) // CHOMPedit - Ticket System
|
||||
set category = "Admin"
|
||||
set name = "Mentor-PM"
|
||||
set hidden = 1
|
||||
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_mentor_pm_warning("Error: Mentor-PM: You are unable to use mentor PM-s (muted)."))
|
||||
return
|
||||
|
||||
//Not a mentor and no open ticket
|
||||
if(!has_mentor_powers(src) && !current_ticket) // CHOMPedit - Ticket System
|
||||
to_chat(src, span_mentor_pm_warning("You can no longer reply to this ticket, please open another one by using the Mentorhelp verb if need be."))
|
||||
to_chat(src, span_mentor_pm_notice("Message: [msg]"))
|
||||
var/client/recipient
|
||||
|
||||
if(istext(whom))
|
||||
recipient = GLOB.directory[whom]
|
||||
|
||||
else if(istype(whom,/client))
|
||||
recipient = whom
|
||||
|
||||
//get message text, limit it's length.and clean/escape html
|
||||
if(!msg)
|
||||
msg = tgui_input_text(src,"Message:", "Mentor-PM to [whom]", multiline = TRUE)
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_mentor_pm_warning("Error: Mentor-PM: You are unable to use mentor PM-s (muted)."))
|
||||
return
|
||||
|
||||
if(!recipient)
|
||||
if(has_mentor_powers(src))
|
||||
to_chat(src, span_mentor_pm_warning("Error:Mentor-PM: Client not found."))
|
||||
to_chat(src, msg)
|
||||
else
|
||||
log_admin("Mentorhelp: [key_name(src)]: [msg]")
|
||||
current_ticket.MessageNoRecipient(msg) // CHOMPedit - Ticket System
|
||||
return
|
||||
|
||||
//Has mentor powers but the recipient no longer has an open ticket
|
||||
if(has_mentor_powers(src) && !recipient.current_ticket) // CHOMPedit - Ticket System
|
||||
to_chat(src, span_mentor_pm_warning("You can no longer reply to this ticket."))
|
||||
to_chat(src, span_mentor_pm_notice("Message: [msg]"))
|
||||
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
msg = trim(sanitize(copytext(msg,1,MAX_MESSAGE_LEN)))
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
var/interaction_message = span_mentor_pm_notice("Mentor-PM from-<b>[src]</b> to-<b>[recipient]</b>: [msg]")
|
||||
|
||||
// CHOMPedit Start - Ticket System
|
||||
if (recipient.current_ticket && !has_mentor_powers(recipient))
|
||||
recipient.current_ticket.AddInteraction(interaction_message)
|
||||
if (src.current_ticket && !has_mentor_powers(src))
|
||||
src.current_ticket.AddInteraction(interaction_message)
|
||||
|
||||
// It's a little fucky if they're both mentors, but while admins may need to adminhelp I don't really see any reason a mentor would have to mentorhelp since you can literally just ask any other mentors online
|
||||
if (has_mentor_powers(recipient) && has_mentor_powers(src))
|
||||
if (recipient.current_ticket)
|
||||
recipient.current_ticket.AddInteraction(interaction_message)
|
||||
if (src.current_ticket)
|
||||
src.current_ticket.AddInteraction(interaction_message)
|
||||
// CHOMPedit End
|
||||
|
||||
to_chat(recipient, span_mentor(span_italics("Mentor-PM from-<b><a href='byond://?mentorhelp_msg=\ref[src]'>[src]</a></b>: [msg]")))
|
||||
to_chat(src, span_mentor(span_italics("Mentor-PM to-<b>[recipient]</b>: [msg]")))
|
||||
|
||||
log_admin("[key_name(src)]->[key_name(recipient)]: [msg]")
|
||||
|
||||
if(recipient.prefs?.read_preference(/datum/preference/toggle/play_mentorhelp_ping))
|
||||
recipient << 'sound/effects/mentorhelp.mp3'
|
||||
|
||||
for(var/client/C in GLOB.mentors)
|
||||
if (C != recipient && C != src)
|
||||
to_chat(C, interaction_message)
|
||||
for(var/client/C in GLOB.admins)
|
||||
if (C != recipient && C != src)
|
||||
to_chat(C, interaction_message)
|
||||
@@ -1,507 +0,0 @@
|
||||
/client/var/datum/mentor_help/current_mentorhelp
|
||||
|
||||
//
|
||||
//TICKET MANAGER
|
||||
//
|
||||
|
||||
GLOBAL_DATUM_INIT(mhelp_tickets, /datum/mentor_help_tickets, new)
|
||||
|
||||
/datum/mentor_help_tickets
|
||||
var/list/active_tickets = list()
|
||||
var/list/resolved_tickets = list()
|
||||
|
||||
var/obj/effect/statclick/mticket_list/astatclick = new(null, null, AHELP_ACTIVE)
|
||||
var/obj/effect/statclick/mticket_list/rstatclick = new(null, null, AHELP_RESOLVED)
|
||||
|
||||
/datum/mentor_help_tickets/Destroy()
|
||||
QDEL_LIST(active_tickets)
|
||||
QDEL_LIST(resolved_tickets)
|
||||
QDEL_NULL(astatclick)
|
||||
QDEL_NULL(rstatclick)
|
||||
return ..()
|
||||
|
||||
//private
|
||||
/datum/mentor_help_tickets/proc/ListInsert(datum/mentor_help/new_ticket)
|
||||
var/list/mticket_list
|
||||
switch(new_ticket.state)
|
||||
if(AHELP_ACTIVE)
|
||||
mticket_list = active_tickets
|
||||
if(AHELP_RESOLVED)
|
||||
mticket_list = resolved_tickets
|
||||
else
|
||||
CRASH("Invalid ticket state: [new_ticket.state]")
|
||||
var/num_closed = mticket_list.len
|
||||
if(num_closed)
|
||||
for(var/I in 1 to num_closed)
|
||||
var/datum/mentor_help/MH = mticket_list[I]
|
||||
if(MH.id > new_ticket.id)
|
||||
mticket_list.Insert(I, new_ticket)
|
||||
return
|
||||
mticket_list += new_ticket
|
||||
|
||||
//opens the ticket listings, only two states here
|
||||
/datum/mentor_help_tickets/proc/BrowseTickets(state)
|
||||
var/list/l2b
|
||||
var/title
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
l2b = active_tickets
|
||||
title = "Active Tickets"
|
||||
if(AHELP_RESOLVED)
|
||||
l2b = resolved_tickets
|
||||
title = "Resolved Tickets"
|
||||
if(!l2b)
|
||||
return
|
||||
var/list/dat = list()
|
||||
dat += "<A href='byond://?_src_=mentorholder;[HrefToken()];mhelp_tickets=[state]'>Refresh</A><br><br>"
|
||||
for(var/datum/mentor_help/MH as anything in l2b)
|
||||
dat += span_adminnotice(span_adminhelp("Ticket #[MH.id]") + " <A href='byond://?_src_=mentorholder;mhelp=\ref[MH];[HrefToken()];mhelp_action=ticket'>[MH.initiator_ckey]: [MH.name]</A>") + "<br>"
|
||||
|
||||
var/datum/browser/popup = new(usr, "mhelp_list[state]", "Mentor Help List", 600, 480)
|
||||
popup.add_head_content("<title>[title]</title>")
|
||||
popup.set_content(dat.Join())
|
||||
popup.open()
|
||||
|
||||
//Tickets statpanel
|
||||
/datum/mentor_help_tickets/proc/stat_entry()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
var/list/L = list()
|
||||
var/num_disconnected = 0
|
||||
L[++L.len] = list("== Mentor Tickets ==", "", null, null)
|
||||
L[++L.len] = list("Active Tickets:", "[astatclick.update("[active_tickets.len]")]", null, REF(astatclick))
|
||||
astatclick.update("[active_tickets.len]")
|
||||
for(var/datum/mentor_help/MH as anything in active_tickets)
|
||||
if(MH.initiator)
|
||||
L[++L.len] = list("#[MH.id]. [MH.initiator_ckey]:", "[MH.statclick.update()]", REF(MH))
|
||||
else
|
||||
++num_disconnected
|
||||
if(num_disconnected)
|
||||
L[++L.len] = list("Disconnected:", "[astatclick.update("[num_disconnected]")]", null, REF(astatclick))
|
||||
L[++L.len] = list("Resolved Tickets:", "[rstatclick.update("[resolved_tickets.len]")]", null, REF(rstatclick))
|
||||
return L
|
||||
|
||||
//Reassociate still open ticket if one exists
|
||||
/datum/mentor_help_tickets/proc/ClientLogin(client/C)
|
||||
C.current_mentorhelp = CKey2ActiveTicket(C.ckey)
|
||||
if(C.current_mentorhelp)
|
||||
C.current_mentorhelp.AddInteraction("Client reconnected.")
|
||||
C.current_mentorhelp.initiator = C
|
||||
|
||||
//Dissasociate ticket
|
||||
/datum/mentor_help_tickets/proc/ClientLogout(client/C)
|
||||
if(C.current_mentorhelp)
|
||||
C.current_mentorhelp.AddInteraction("Client disconnected.")
|
||||
C.current_mentorhelp.initiator = null
|
||||
C.current_mentorhelp = null
|
||||
|
||||
//Get a ticket given a ckey
|
||||
/datum/mentor_help_tickets/proc/CKey2ActiveTicket(ckey)
|
||||
for(var/datum/admin_help/MH as anything in active_tickets)
|
||||
if(MH.initiator_ckey == ckey)
|
||||
return MH
|
||||
|
||||
//
|
||||
//TICKET LIST STATCLICK
|
||||
//
|
||||
|
||||
/obj/effect/statclick/mticket_list
|
||||
var/current_state
|
||||
|
||||
INITIALIZE_IMMEDIATE(/obj/effect/statclick/mticket_list)
|
||||
/obj/effect/statclick/mticket_list/Initialize(mapload, name, state)
|
||||
. = ..()
|
||||
current_state = state
|
||||
|
||||
/obj/effect/statclick/mticket_list/Click()
|
||||
GLOB.mhelp_tickets.BrowseTickets(current_state)
|
||||
|
||||
//
|
||||
//TICKET DATUM
|
||||
//
|
||||
|
||||
/datum/mentor_help
|
||||
var/id
|
||||
var/name
|
||||
var/state = AHELP_ACTIVE
|
||||
|
||||
var/opened_at
|
||||
var/closed_at
|
||||
|
||||
var/client/initiator //semi-misnomer, it's the person who ahelped/was bwoinked
|
||||
var/initiator_ckey
|
||||
var/initiator_key_name
|
||||
|
||||
var/list/_interactions //use AddInteraction() or, preferably, admin_ticket_log()
|
||||
|
||||
var/obj/effect/statclick/ahelp/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)
|
||||
//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
|
||||
|
||||
initiator = 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, span_mentor(span_italics("Mentor-PM to-" + span_bold("Mentors") + ": [name]")))
|
||||
|
||||
GLOB.mhelp_tickets.active_tickets += src
|
||||
|
||||
/datum/mentor_help/Destroy()
|
||||
RemoveActive()
|
||||
GLOB.mhelp_tickets.resolved_tickets -= src
|
||||
return ..()
|
||||
|
||||
/datum/mentor_help/proc/AddInteraction(formatted_message)
|
||||
_interactions += "[gameTimestamp()]: [formatted_message]"
|
||||
|
||||
//private
|
||||
/datum/mentor_help/proc/ClosureLinks(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
. = " (<A href='byond://?_src_=mentorholder;mhelp=[ref_src];[HrefToken()];mhelp_action=resolve'>RSLVE</A>)"
|
||||
|
||||
//private
|
||||
/datum/mentor_help/proc/LinkedReplyName(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
return "<A href='byond://?_src_=mentorholder;mhelp=[ref_src];[HrefToken()];mhelp_action=reply'>[initiator_ckey]</A>"
|
||||
|
||||
//private
|
||||
/datum/mentor_help/proc/TicketHref(msg, ref_src, action = "ticket")
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
return "<A href='byond://?_src_=mentorholder;mhelp=[ref_src];[HrefToken()];mhelp_action=[action]'>[msg]</A>"
|
||||
|
||||
//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 = span_notice("(<A href='byond://?_src_=mentorholder;mhelp=[ref_src];[HrefToken()];mhelp_action=escalate'>ESCALATE</A>) Ticket [TicketHref("#[id]", ref_src)]" + span_bold(": [LinkedReplyName(ref_src)]:") + " [msg]")
|
||||
AddInteraction(span_red("[LinkedReplyName(ref_src)]: [msg]"))
|
||||
for (var/client/C in GLOB.mentors)
|
||||
if (C.prefs?.read_preference(/datum/preference/toggle/play_mentorhelp_ping))
|
||||
C << 'sound/effects/mentorhelp.mp3'
|
||||
for (var/client/C in GLOB.admins)
|
||||
if (C.prefs?.read_preference(/datum/preference/toggle/play_mentorhelp_ping))
|
||||
C << 'sound/effects/mentorhelp.mp3'
|
||||
message_mentors(chat_msg)
|
||||
|
||||
//Reopen a closed ticket
|
||||
/datum/mentor_help/proc/Reopen()
|
||||
if(state == AHELP_ACTIVE)
|
||||
to_chat(usr, span_warning("This ticket is already open."))
|
||||
return
|
||||
|
||||
if(GLOB.mhelp_tickets.CKey2ActiveTicket(initiator_ckey))
|
||||
to_chat(usr, span_warning("This user already has an active ticket, cannot reopen this one."))
|
||||
return
|
||||
|
||||
statclick = new(null, src)
|
||||
GLOB.mhelp_tickets.active_tickets += src
|
||||
GLOB.mhelp_tickets.resolved_tickets -= src
|
||||
switch(state)
|
||||
if(AHELP_RESOLVED)
|
||||
feedback_dec("mhelp_resolve")
|
||||
state = AHELP_ACTIVE
|
||||
closed_at = null
|
||||
if(initiator)
|
||||
initiator.current_mentorhelp = src
|
||||
|
||||
AddInteraction(span_purple("Reopened by [usr.ckey]"))
|
||||
if(initiator)
|
||||
to_chat(initiator, span_filter_adminlog("[span_purple("Ticket [TicketHref("#[id]")] was reopened by [usr.ckey].")]"))
|
||||
var/msg = span_adminhelp("Ticket [TicketHref("#[id]")] reopened by [usr.ckey].")
|
||||
message_mentors(msg)
|
||||
log_admin(msg)
|
||||
feedback_inc("mhelp_reopen")
|
||||
TicketPanel() //can only be done from here, so refresh it
|
||||
|
||||
//private
|
||||
/datum/mentor_help/proc/RemoveActive()
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
closed_at = world.time
|
||||
QDEL_NULL(statclick)
|
||||
GLOB.mhelp_tickets.active_tickets -= src
|
||||
if(initiator && initiator.current_mentorhelp == src)
|
||||
initiator.current_mentorhelp = null
|
||||
|
||||
//Mark open ticket as resolved/legitimate, returns mentorhelp verb
|
||||
/datum/mentor_help/proc/Resolve(silent = FALSE)
|
||||
if(state != AHELP_ACTIVE)
|
||||
return
|
||||
RemoveActive()
|
||||
state = AHELP_RESOLVED
|
||||
GLOB.mhelp_tickets.ListInsert(src)
|
||||
|
||||
AddInteraction(span_filter_adminlog("[span_green("Resolved by [usr.ckey].")]"))
|
||||
if(initiator)
|
||||
to_chat(initiator, span_filter_adminlog("[span_green("Ticket [TicketHref("#[id]")] was marked resolved by [usr.ckey].")]"))
|
||||
if(!silent)
|
||||
feedback_inc("mhelp_resolve")
|
||||
var/msg = "Ticket [TicketHref("#[id]")] resolved by [usr.ckey]"
|
||||
message_mentors(msg)
|
||||
log_admin(msg)
|
||||
|
||||
//Show the ticket panel
|
||||
/datum/mentor_help/proc/TicketPanel()
|
||||
tgui_interact(usr.client.mob)
|
||||
|
||||
/datum/mentor_help/proc/TicketPanelLegacy()
|
||||
var/list/dat = list()
|
||||
var/ref_src = "\ref[src]"
|
||||
dat += "<h4>Mentor Help Ticket #[id]: [LinkedReplyName(ref_src)]</h4>"
|
||||
dat += span_bold("State: ")
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
dat += span_bold(span_red("OPEN"))
|
||||
if(AHELP_RESOLVED)
|
||||
dat += span_bold(span_green("RESOLVED"))
|
||||
else
|
||||
dat += "UNKNOWN"
|
||||
dat += "[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 += span_bold("Actions:") + " [Context(ref_src)]<br>"
|
||||
else
|
||||
dat += span_bold("DISCONNECTED") + "[GLOB.TAB][ClosureLinks(ref_src)]<br>"
|
||||
dat += "<br>" + span_bold("Log:") + "<br><br>"
|
||||
for(var/I in _interactions)
|
||||
dat += "[I]<br>"
|
||||
|
||||
var/datum/browser/popup = new(usr, "mhelp[id]", "Mento Help [id]", 620, 480)
|
||||
popup.add_head_content("<title>Ticket #[id]</title>")
|
||||
popup.set_content(dat.Join())
|
||||
popup.open()
|
||||
|
||||
/datum/mentor_help/tgui_fallback(payload)
|
||||
if(..())
|
||||
return
|
||||
|
||||
TicketPanelLegacy()
|
||||
|
||||
/datum/mentor_help/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "MentorTicketPanel", "Ticket #[id] - [LinkedReplyName("\ref[src]")]")
|
||||
ui.open()
|
||||
|
||||
/datum/mentor_help/tgui_state(mob/user)
|
||||
return GLOB.tgui_mentor_state
|
||||
|
||||
/datum/mentor_help/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["id"] = id
|
||||
|
||||
var/ref_src = "\ref[src]"
|
||||
data["title"] = name
|
||||
data["name"] = LinkedReplyName(ref_src)
|
||||
|
||||
switch(state)
|
||||
if(AHELP_ACTIVE)
|
||||
data["state"] = "open"
|
||||
if(AHELP_RESOLVED)
|
||||
data["state"] = "resolved"
|
||||
else
|
||||
data["state"] = "unknown"
|
||||
|
||||
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"] = Context(ref_src)
|
||||
|
||||
data["log"] = _interactions
|
||||
|
||||
return data
|
||||
|
||||
/datum/mentor_help/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("escalate")
|
||||
Escalate()
|
||||
. = TRUE
|
||||
if("reopen")
|
||||
Reopen()
|
||||
. = TRUE
|
||||
if("legacy")
|
||||
TicketPanelLegacy()
|
||||
. = TRUE
|
||||
|
||||
//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, span_mentor_pm_warning("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, span_mentor("[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)
|
||||
. += " (<A href='byond://?_src_=mentorholder;[HrefToken()];mhelp=[ref_src];mhelp_action=escalate'>ESCALATE</A>)"
|
||||
|
||||
//Forwarded action from admin/Topic OR mentor/Topic depending on which rank the caller has
|
||||
/datum/mentor_help/proc/Action(action)
|
||||
switch(action)
|
||||
if("ticket")
|
||||
TicketPanel()
|
||||
if("reply")
|
||||
usr.client.cmd_mhelp_reply(initiator)
|
||||
if("resolve")
|
||||
Resolve()
|
||||
if("reopen")
|
||||
Reopen()
|
||||
if("escalate")
|
||||
Escalate()
|
||||
|
||||
//
|
||||
// TICKET STATCLICK
|
||||
//
|
||||
|
||||
/obj/effect/statclick/mhelp
|
||||
var/datum/mentor_help/mhelp_datum
|
||||
|
||||
INITIALIZE_IMMEDIATE(/obj/effect/statclick/mhelp)
|
||||
/obj/effect/statclick/mhelp/Initialize(mapload, datum/mentor_help/MH)
|
||||
mhelp_datum = MH
|
||||
. = ..()
|
||||
|
||||
/obj/effect/statclick/mhelp/update()
|
||||
return ..(mhelp_datum.name)
|
||||
|
||||
/obj/effect/statclick/mhelp/Click()
|
||||
mhelp_datum.TicketPanel()
|
||||
|
||||
/obj/effect/statclick/mhelp/Destroy()
|
||||
mhelp_datum = null
|
||||
return ..()
|
||||
|
||||
//
|
||||
// CLIENT PROCS
|
||||
//
|
||||
|
||||
/client/verb/mentorhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Mentorhelp"
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_danger("Error: Mentor-PM: You cannot send adminhelps (Muted)."))
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
// Making sure there's actually a mentor or admin who can respond.
|
||||
var/list/admins = get_admin_counts()
|
||||
var/list/activeAdmins = admins["present"]
|
||||
var/list/mentors = GLOB.mentors
|
||||
if(!mentors.len && !activeAdmins.len)
|
||||
var/choice = tgui_alert(usr, "There are no active admins or mentors online. Would you like to make an ahelp instead, so that staff is notified of your issue? \
|
||||
Alternatively, you may go to the discord yourself and repeat your question in #ss13-tutoring. Please note, if choosing the later, do not include current-round information.",
|
||||
"Send to discord?", list("Admin-help!", "Still mentorhelp!", "Cancel"))
|
||||
if(choice == "Admin-help!")
|
||||
usr.client.adminhelp(msg)
|
||||
remove_verb(src, /client/verb/mentorhelp)
|
||||
spawn(1200)
|
||||
add_verb(src, /client/verb/mentorhelp) // 2 minute cd to prevent abusing this to spam admins.
|
||||
return
|
||||
else if(!choice || choice == "Cancel")
|
||||
return
|
||||
|
||||
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
remove_verb(src, /client/verb/mentorhelp)
|
||||
spawn(600)
|
||||
add_verb(src, /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_mentorhelp)
|
||||
var/input = tgui_alert(usr, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
if(!input)
|
||||
return
|
||||
if(input == "Yes")
|
||||
if(current_mentorhelp)
|
||||
log_admin("Mentorhelp: [key_name(src)]: [msg]")
|
||||
current_mentorhelp.MessageNoRecipient(msg)
|
||||
to_chat(usr, span_mentor_pm_notice("Mentor-PM to-" + span_bold("Mentors") + ": [msg]"))
|
||||
return
|
||||
else
|
||||
to_chat(usr, span_warning("Ticket not found, creating new one..."))
|
||||
else
|
||||
current_mentorhelp.AddInteraction("[usr.ckey] opened a new ticket.")
|
||||
current_mentorhelp.Resolve()
|
||||
|
||||
new /datum/mentor_help(msg, src, FALSE)
|
||||
|
||||
//admin proc
|
||||
/client/proc/cmd_mentor_ticket_panel()
|
||||
set name = "Mentor Ticket List"
|
||||
set category = "Admin.Misc"
|
||||
|
||||
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.mhelp_tickets.BrowseTickets(browse_to)
|
||||
|
||||
/proc/message_mentors(var/msg)
|
||||
msg = span_mentor_channel(span_prefix("Mentor: " + span_message(msg)))
|
||||
|
||||
for(var/client/C in GLOB.mentors)
|
||||
to_chat(C, msg)
|
||||
for(var/client/C in GLOB.admins)
|
||||
to_chat(C, msg)
|
||||
@@ -102,7 +102,7 @@
|
||||
*
|
||||
* required payload list A list of the payload supposed to be set on the regular UI.
|
||||
*/
|
||||
/datum/proc/tgui_fallback(list/payload)
|
||||
/datum/proc/tgui_fallback(list/payload, mob/user)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SEND_SIGNAL(src, COMSIG_UI_FALLBACK, usr)
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
GLOBAL_DATUM_INIT(tgui_mentor_state, /datum/tgui_state/mentor_state, new)
|
||||
|
||||
/datum/tgui_state/mentor_state/can_use_topic(src_object, mob/user)
|
||||
if(has_mentor_powers(user.client))
|
||||
if(check_rights_for(user.client, R_ADMIN|R_EVENT|R_DEBUG|R_MENTOR))
|
||||
return STATUS_INTERACTIVE
|
||||
return STATUS_CLOSE
|
||||
|
||||
@@ -430,7 +430,7 @@
|
||||
#ifdef TGUI_DEBUGGING
|
||||
log_tgui(user, "Fallback Triggered: [href_list["payload"]], Window: [window.id], Source: [src_object]")
|
||||
#endif
|
||||
src_object.tgui_fallback(payload)
|
||||
src_object.tgui_fallback(payload, user)
|
||||
if(TGUI_MANAGED_BYONDUI_TYPE_RENDER)
|
||||
var/byond_ui_id = payload[TGUI_MANAGED_BYONDUI_PAYLOAD_ID]
|
||||
if(!byond_ui_id || LAZYLEN(open_byondui_elements) > TGUI_MANAGED_BYONDUI_LIMIT)
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
return TRUE
|
||||
if(ADMIN_CHANNEL)
|
||||
if(check_rights(R_ADMIN, show_msg = FALSE))
|
||||
client.cmd_admin_say(entry)
|
||||
SSadmin_verbs.dynamic_invoke_verb(client, /datum/admin_verb/cmd_admin_say, entry)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
295
code/modules/tickets/procs.dm
Normal file
295
code/modules/tickets/procs.dm
Normal file
@@ -0,0 +1,295 @@
|
||||
//
|
||||
// CLIENT PROCS
|
||||
//
|
||||
|
||||
/client/verb/mentorhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Mentorhelp"
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_danger("Error: Mentor-PM: You cannot send adminhelps (Muted)."))
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
remove_verb(src,/client/verb/mentorhelp)
|
||||
spawn(600)
|
||||
add_verb(src,/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)
|
||||
var/input = tgui_alert(src, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
if(!input)
|
||||
return
|
||||
if(input == "Yes")
|
||||
if(current_ticket)
|
||||
log_admin("Mentorhelp: [key_name(src)]: [msg]")
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
to_chat(src, span_adminnotice(span_mentor("Mentor-PM to-" + span_bold("Mentors") + ": [msg]")))
|
||||
return
|
||||
else
|
||||
to_chat(src, span_warning("Ticket not found, creating new one..."))
|
||||
else
|
||||
current_ticket.AddInteraction("[usr.ckey] opened a new ticket.")
|
||||
current_ticket.Resolve()
|
||||
|
||||
new /datum/ticket(msg, src, FALSE, 0)
|
||||
|
||||
//admin proc
|
||||
ADMIN_VERB(cmd_mentor_ticket_panel, (R_ADMIN|R_SERVER|R_MOD|R_MENTOR), "Mentor Ticket List", "Opens the list of mentor tickets", "Admin.Misc")
|
||||
var/browse_to
|
||||
|
||||
switch(tgui_input_list(user, "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_mentor_channel(span_prefix("Mentor:") + span_message("[msg]"))
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
to_chat(C, msg)
|
||||
|
||||
//
|
||||
// CLIENT PROCS
|
||||
//
|
||||
|
||||
/client/verb/requesthelp()
|
||||
set category = "Admin"
|
||||
set name = "Request help"
|
||||
set hidden = 1
|
||||
|
||||
var/mhelp = tgui_alert(usr, "Select the help you need.","Request for Help",list("Adminhelp","Mentorhelp"))
|
||||
if(!mhelp)
|
||||
return
|
||||
|
||||
var/msg = tgui_input_text(usr, "Input your request for help.", "Request for Help ([mhelp])", multiline = TRUE)
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
if (mhelp == "Mentorhelp")
|
||||
mentorhelp(msg)
|
||||
return
|
||||
|
||||
adminhelp(msg)
|
||||
|
||||
/client/verb/adminhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Adminhelp"
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_danger("Error: Admin-PM: You cannot send adminhelps (Muted)."))
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
remove_verb(src,/client/verb/adminhelp)
|
||||
spawn(1200)
|
||||
add_verb(src,/client/verb/adminhelp ) // 2 minute cool-down for adminhelp
|
||||
|
||||
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)
|
||||
var/input = tgui_alert(src, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
if(!input)
|
||||
return
|
||||
if(input == "Yes")
|
||||
if(current_ticket)
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
to_chat(src, span_adminnotice("PM to-" + span_bold("Admins") + ": [msg]"))
|
||||
return
|
||||
else
|
||||
to_chat(src, span_warning("Ticket not found, creating new one..."))
|
||||
else if(current_ticket)
|
||||
current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
|
||||
current_ticket.Close()
|
||||
|
||||
new /datum/ticket(msg, src, FALSE, 1)
|
||||
|
||||
//admin proc
|
||||
/client/proc/cmd_admin_ticket_panel()
|
||||
set name = "Show Ticket List"
|
||||
set category = "Admin.Misc"
|
||||
|
||||
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_GET(string/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_GET(string/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_GET(string/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_danger("Error: You cannot request spice (muted from adminhelps)."))
|
||||
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")) == "Yes")
|
||||
message_admins("[ADMIN_FULLMONTY(usr)] has requested the round be spiced up a little.")
|
||||
to_chat(usr, span_notice("You have requested some more spice in your round."))
|
||||
else
|
||||
to_chat(usr, span_notice("Spice request cancelled."))
|
||||
return
|
||||
|
||||
//if they requested spice, then remove spice verb temporarily to prevent spamming
|
||||
remove_verb(usr,/client/verb/adminspice)
|
||||
spawn(10 MINUTES)
|
||||
if(usr) // In case we left in the 10 minute cooldown
|
||||
add_verb(usr,/client/verb/adminspice ) // 10 minute cool-down for spice request
|
||||
|
||||
//
|
||||
// MENTOR PROCS
|
||||
//
|
||||
|
||||
/client/proc/cmd_mhelp_reply(whom)
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_admin_pm_warning("Error: Mentor-PM: You are unable to use admin PM-s (muted)."))
|
||||
return
|
||||
var/client/C
|
||||
if(istext(whom))
|
||||
C = GLOB.directory[whom]
|
||||
else if(istype(whom,/client))
|
||||
C = whom
|
||||
if(!C)
|
||||
if(src.holder)
|
||||
to_chat(src, span_admin_pm_warning("Error: Mentor-PM: Client not found."))
|
||||
return
|
||||
|
||||
var/datum/ticket/T = C.current_ticket
|
||||
|
||||
if(T)
|
||||
message_mentors(span_mentor_channel("[src] has started replying to [C]'s mentor help."))
|
||||
var/msg = tgui_input_text(src,"Message:", "Private message to [C]", multiline = TRUE)
|
||||
if (!msg)
|
||||
message_mentors(span_mentor_channel("[src] has cancelled their reply to [C]'s mentor help."))
|
||||
return
|
||||
cmd_mentor_pm(whom, msg, T)
|
||||
|
||||
/client/proc/cmd_mentor_pm(whom, msg, datum/ticket/T)
|
||||
set category = "Admin"
|
||||
set name = "Mentor-PM"
|
||||
set hidden = 1
|
||||
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_mentor_warning("Error: Mentor-PM: You are unable to use mentor PM-s (muted)."))
|
||||
return
|
||||
|
||||
//Not a mentor and no open ticket
|
||||
if(!src.holder && !current_ticket)
|
||||
to_chat(src, span_mentor_warning("You can no longer reply to this ticket, please open another one by using the Mentorhelp verb if need be."))
|
||||
to_chat(src, span_mentor_notice("Message: [msg]"))
|
||||
return
|
||||
|
||||
var/client/recipient
|
||||
|
||||
if(istext(whom))
|
||||
recipient = GLOB.directory[whom]
|
||||
|
||||
else if(istype(whom,/client))
|
||||
recipient = whom
|
||||
|
||||
//get message text, limit it's length.and clean/escape html
|
||||
if(!msg)
|
||||
msg = tgui_input_text(src,"Message:", "Mentor-PM to [whom]", multiline = TRUE)
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_mentor_warning("Error: Mentor-PM: You are unable to use mentor PM-s (muted)."))
|
||||
return
|
||||
|
||||
if(!recipient)
|
||||
if(src.holder)
|
||||
to_chat(src, span_mentor_warning("Error:Mentor-PM: Client not found."))
|
||||
to_chat(src, msg)
|
||||
else
|
||||
log_admin("Mentorhelp: [key_name(src)]: [msg]")
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
return
|
||||
|
||||
//Has mentor powers but the recipient no longer has an open ticket
|
||||
if(src.holder && !recipient.current_ticket)
|
||||
to_chat(src, span_mentor_warning("You can no longer reply to this ticket."))
|
||||
to_chat(src, span_mentor_notice("Message: [msg]"))
|
||||
return
|
||||
|
||||
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
msg = trim(sanitize(copytext(msg,1,MAX_MESSAGE_LEN)))
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
var/interaction_message = span_mentor_notice("Mentor-PM from-<b>[src]</b> to-<b>[recipient]</b>: [msg]")
|
||||
|
||||
if (recipient.current_ticket && !recipient.holder && recipient.current_ticket.level == 0)
|
||||
recipient.current_ticket.AddInteraction(interaction_message)
|
||||
if (src.current_ticket && !src.holder && src.current_ticket.level == 0)
|
||||
src.current_ticket.AddInteraction(interaction_message)
|
||||
|
||||
// It's a little fucky if they're both mentors, but while admins may need to adminhelp I don't really see any reason a mentor would have to mentorhelp since you can literally just ask any other mentors online
|
||||
if (recipient.holder && src.holder)
|
||||
if (recipient.current_ticket && recipient != src && recipient.current_ticket.level == 0)
|
||||
recipient.current_ticket.AddInteraction(interaction_message)
|
||||
if (src.current_ticket && src.current_ticket.level == 0)
|
||||
src.current_ticket.AddInteraction(interaction_message)
|
||||
|
||||
to_chat(recipient, span_mentor(span_italics("Mentor-PM from-<b><a href='byond://?mentorhelp_msg=\ref[src]'>[src]</a></b>: [msg]")))
|
||||
to_chat(src, span_mentor(span_italics("Mentor-PM to-<b>[recipient]</b>: [msg]")))
|
||||
|
||||
log_admin("[key_name(src)]->[key_name(recipient)]: [msg]")
|
||||
|
||||
if(recipient.prefs?.read_preference(/datum/preference/toggle/play_mentorhelp_ping))
|
||||
recipient << 'sound/effects/mentorhelp.mp3'
|
||||
|
||||
for(var/client/C in GLOB.admins)
|
||||
if (C != recipient && C != src)
|
||||
to_chat(C, interaction_message)
|
||||
@@ -1,14 +1,6 @@
|
||||
/*
|
||||
|
||||
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_GET(string/ahelp_channel_tag))
|
||||
@@ -27,9 +19,7 @@ Reason: Replaced with "Tickets System". Main logic has been moved to: modular_ch
|
||||
world.TgsChatBroadcast(message,ahelp_channel)
|
||||
else
|
||||
world.TgsTargetedChatBroadcast(message,TRUE)
|
||||
// CHOMPEdit End
|
||||
|
||||
//
|
||||
//TICKET MANAGER
|
||||
//
|
||||
|
||||
@@ -105,26 +95,64 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
var/list/L = list()
|
||||
var/num_disconnected = 0
|
||||
L[++L.len] = list("== Admin Tickets ==", "", null, null)
|
||||
L[++L.len] = list("Active Tickets:", "[astatclick.update("[active_tickets.len]")]", null, REF(astatclick))
|
||||
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"
|
||||
var/num_adm_tickets_disconnected = 0
|
||||
var/num_men_tickets_disconnected = 0
|
||||
|
||||
if((target && target.holder) || T.level > 0)
|
||||
L[++L.len] = list("\[[type]\] #[T.id]. [T.initiator_key_name]:", T.name, null, REF(T.statclick))
|
||||
var/list/admin_tickets = list()
|
||||
var/list/mentor_tickets = list()
|
||||
|
||||
for(var/datum/ticket/T as anything in active_tickets)
|
||||
switch (T.level)
|
||||
if(1)
|
||||
admin_tickets += T
|
||||
if(0)
|
||||
mentor_tickets += T
|
||||
|
||||
var/closed_admin_tickets = 0
|
||||
var/closed_mentor_tickets = 0
|
||||
|
||||
for(var/datum/ticket/T as anything in closed_tickets)
|
||||
switch (T.level)
|
||||
if(1)
|
||||
closed_admin_tickets++
|
||||
if(0)
|
||||
closed_mentor_tickets++
|
||||
|
||||
var/resolved_admin_tickets = 0
|
||||
var/resolved_mentor_tickets = 0
|
||||
|
||||
for(var/datum/ticket/T as anything in resolved_tickets)
|
||||
switch (T.level)
|
||||
if(1)
|
||||
resolved_admin_tickets++
|
||||
if(0)
|
||||
resolved_mentor_tickets++
|
||||
|
||||
if(check_rights_for(target, R_ADMIN|R_SERVER|R_MOD))
|
||||
L[++L.len] = list("== Admin Tickets ==", "", null, null)
|
||||
L[++L.len] = list("Active Tickets:", "[astatclick.update("[admin_tickets.len]")]", null, REF(astatclick))
|
||||
for(var/datum/ticket/T as anything in admin_tickets)
|
||||
if(T.initiator)
|
||||
L[++L.len] = list("ADM #[T.id]. [T.initiator_key_name]:", T.name, null, REF(T.statclick))
|
||||
else
|
||||
++num_disconnected
|
||||
if(num_disconnected)
|
||||
L[++L.len] = list("Disconnected:", "[astatclick.update("[num_disconnected]")]", null, REF(astatclick))
|
||||
L[++L.len] = list("Closed Tickets:", "[cstatclick.update("[closed_tickets.len]")]", null, REF(cstatclick))
|
||||
L[++L.len] = list("Resolved Tickets:", "[rstatclick.update("[resolved_tickets.len]")]", null, REF(rstatclick))
|
||||
num_adm_tickets_disconnected++
|
||||
if(num_adm_tickets_disconnected)
|
||||
L[++L.len] = list("Disconnected:", "[astatclick.update("[num_adm_tickets_disconnected]")]", null, REF(astatclick))
|
||||
L[++L.len] = list("Closed Tickets:", "[cstatclick.update("[closed_admin_tickets]")]", null, REF(cstatclick))
|
||||
L[++L.len] = list("Resolved Tickets:", "[rstatclick.update("[resolved_admin_tickets]")]", null, REF(rstatclick))
|
||||
|
||||
L[++L.len] = list("== Mentor Tickets ==", "", null, null)
|
||||
L[++L.len] = list("Active Tickets:", "[astatclick.update("[mentor_tickets.len]")]", null, REF(astatclick))
|
||||
for(var/datum/ticket/T as anything in mentor_tickets)
|
||||
if(T.initiator)
|
||||
L[++L.len] = list("MEN #[T.id]. [T.initiator_key_name]:", T.name, null, REF(T.statclick))
|
||||
else
|
||||
num_men_tickets_disconnected++
|
||||
if(num_men_tickets_disconnected)
|
||||
L[++L.len] = list("Disconnected:", "[astatclick.update("[num_men_tickets_disconnected]")]", null, REF(astatclick))
|
||||
L[++L.len] = list("Closed Tickets:", "[cstatclick.update("[closed_mentor_tickets]")]", null, REF(cstatclick))
|
||||
L[++L.len] = list("Resolved Tickets:", "[rstatclick.update("[resolved_mentor_tickets]")]", null, REF(rstatclick))
|
||||
|
||||
return L
|
||||
|
||||
//Reassociate still open ticket if one exists
|
||||
@@ -152,7 +180,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
|
||||
|
||||
//Get a ticket by ticket id
|
||||
/datum/tickets/proc/ID2Ticket(id)
|
||||
if(!usr?.client.holder || !has_mentor_powers(usr?.client))
|
||||
if(!check_rights((R_ADMIN|R_SERVER|R_MOD|R_MENTOR), TRUE))
|
||||
message_admins("[usr] has attempted to look up a ticket with ID [id] without sufficent privileges.")
|
||||
return
|
||||
|
||||
@@ -190,7 +218,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
/datum/ticket
|
||||
var/id
|
||||
var/name
|
||||
var/level = 0 // 0 = Admin, 1 = Mentor
|
||||
var/level = 0 // 0 = Mentor, 1 = Admin
|
||||
var/list/tags
|
||||
var/state = AHELP_ACTIVE
|
||||
|
||||
@@ -225,7 +253,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
MessageNoRecipient(msg)
|
||||
//show it to the person adminhelping too
|
||||
to_chat(C, span_mentor(span_italics("Mentor-PM to-" + span_bold("Mentors") + ": [name]"))
|
||||
GLOB.mhelp_tickets.active_tickets += src */
|
||||
GLOB.ahelp_tickets.active_tickets += src */
|
||||
|
||||
/**
|
||||
* public
|
||||
@@ -271,25 +299,28 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
message_admins(span_blue("Ticket [TicketHref("#[id]")] created"))
|
||||
else
|
||||
MessageNoRecipient(parsed_message)
|
||||
send2adminchat() //VOREStation Add
|
||||
//show it to the person adminhelping too
|
||||
switch(level)
|
||||
if(0)
|
||||
to_chat(C, span_mentor_notice("PM to-" + span_bold("Mentors") + ": [name]"))
|
||||
|
||||
if(1)
|
||||
to_chat(C, span_adminnotice("PM to-" + span_bold("Admins") + ": [name]"))
|
||||
|
||||
//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_notice("No active admins are online, your adminhelp was sent to the admin discord.")) //VOREStation Edit
|
||||
send2adminchat() //VOREStation Add
|
||||
//YW EDIT START
|
||||
to_chat(C, span_notice("No active admins are online, your adminhelp was sent to the admin discord."))
|
||||
send2adminchat()
|
||||
|
||||
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
|
||||
ahelp_discord_message("ADMINHELP: FROM: [key_name_admin(usr)] TO [initiator_ckey]/[initiator_key_name] - MSG: **[msg]** - Heard by [activeMins] NON-AFK staff members.")
|
||||
else
|
||||
ahelp_discord_message("ADMINHELP: FROM: [initiator_ckey]/[initiator_key_name] - MSG: **[msg]** - Heard by [activeMins] NON-AFK staff members.") //CHOMPEdit
|
||||
//YW EDIT END
|
||||
ahelp_discord_message("ADMINHELP: FROM: [initiator_ckey]/[initiator_key_name] - MSG: **[msg]** - Heard by [activeMins] NON-AFK staff members.")
|
||||
|
||||
// Also send it to discord since that's the hip cool thing now.
|
||||
SSwebhooks.send(
|
||||
@@ -318,18 +349,19 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
|
||||
/datum/ticket/proc/AddInteraction(formatted_message)
|
||||
var/curinteraction = "[gameTimestamp()]: [formatted_message]"
|
||||
if(CONFIG_GET(flag/discord_ahelps_all)) //CHOMPEdit
|
||||
ahelp_discord_message("ADMINHELP: TICKETID:[id] [strip_html_properly(curinteraction)]") //CHOMPEdit
|
||||
if(CONFIG_GET(flag/discord_ahelps_all))
|
||||
ahelp_discord_message("ADMINHELP: TICKETID:[id] [strip_html_properly(curinteraction)]")
|
||||
_interactions += curinteraction
|
||||
|
||||
/datum/ticket/proc/TicketPanel()
|
||||
tgui_interact(usr.client.mob)
|
||||
|
||||
//private
|
||||
/datum/ticket/proc/FullMonty(ref_src)
|
||||
/datum/ticket/proc/FullMonty(ref_src, admin = FALSE)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
if(initiator && initiator.mob)
|
||||
if(admin)
|
||||
. = ADMIN_FULLMONTY_NONAME(initiator.mob)
|
||||
else
|
||||
. = "Initiator disconnected."
|
||||
@@ -341,7 +373,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
|
||||
if(level == 0)
|
||||
if(level == 1)
|
||||
. = " (<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=reject'>REJT</A>)"
|
||||
. += " (<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=icissue'>IC</A>)"
|
||||
. += " (<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=close'>CLOSE</A>)"
|
||||
@@ -349,21 +381,22 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
. += " (<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=handleissue'>HANDLE</A>)"
|
||||
else
|
||||
. = " (<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=resolve'>RSLVE</A>)"
|
||||
. += " (<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=escalate'>ESCALATE</A>)"
|
||||
|
||||
//private
|
||||
/datum/ticket/proc/LinkedReplyName(ref_src)
|
||||
if(!ref_src)
|
||||
ref_src = "\ref[src]"
|
||||
return "<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken()];ticket_action=reply'>[initiator_key_name]</A>"
|
||||
return "<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];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='byond://?_src_=holder;ticket=[ref_src];[HrefToken()];ticket_action=[action]'>[msg]</A>"
|
||||
return "<A href='byond://?_src_=holder;ticket=[ref_src];[HrefToken(TRUE)];ticket_action=[action]'>[msg]</A>"
|
||||
|
||||
/*
|
||||
var/chat_msg = span_notice("(<A href='byond://?_src_=mentorholder;mhelp=[ref_src];[HrefToken()];mhelp_action=escalate'>ESCALATE</A>) Ticket [TicketHref("#[id]", ref_src)]" + span_bold(": [LinkedReplyName(ref_src)]:") + " [msg]")
|
||||
var/chat_msg = span_notice("(<A href='byond://?_src_=holder;ahelp=[ref_src];[HrefToken()];ahelp_action=escalate'>ESCALATE</A>) Ticket [TicketHref("#[id]", ref_src)]" + span_bold(": [LinkedReplyName(ref_src)]:") + " [msg]")
|
||||
*/
|
||||
|
||||
//message from the initiator without a target, all admins will see this
|
||||
@@ -375,15 +408,12 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
AddInteraction(span_red("[LinkedReplyName(ref_src)]: [msg]"))
|
||||
//send this msg to all admins
|
||||
|
||||
if(level == 1)
|
||||
for (var/client/C in GLOB.mentors)
|
||||
if (C.prefs?.read_preference(/datum/preference/toggle/play_mentorhelp_ping))
|
||||
C << 'sound/effects/mentorhelp.mp3'
|
||||
if(level == 0)
|
||||
for (var/client/C in GLOB.admins)
|
||||
if (C.prefs?.read_preference(/datum/preference/toggle/play_mentorhelp_ping))
|
||||
C << 'sound/effects/mentorhelp.mp3'
|
||||
message_mentors(chat_msg)
|
||||
else if(level == 0)
|
||||
else if(level == 1)
|
||||
for(var/client/X in GLOB.admins)
|
||||
if(X.prefs?.read_preference(/datum/preference/toggle/holder/play_adminhelp_ping))
|
||||
X << 'sound/effects/adminhelp.ogg'
|
||||
@@ -395,7 +425,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
/datum/mentor_help/proc/Reopen()
|
||||
switch(state)
|
||||
if(AHELP_RESOLVED)
|
||||
feedback_dec("mhelp_resolve")
|
||||
feedback_dec("ahelp_resolve")
|
||||
AddInteraction(span_purple("Reopened by [usr.ckey]"))
|
||||
if(initiator)
|
||||
to_chat(initiator, span_filter_adminlog(span_purple("Ticket [TicketHref("#[id]")] was reopened by [usr.ckey].")))
|
||||
@@ -575,7 +605,12 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
to_chat(usr, span_red("You are already handling this ticket."))
|
||||
return
|
||||
|
||||
var/msg = span_red("Your AdminHelp is being handled by [key_name(usr,FALSE,FALSE)] please be patient.")
|
||||
var/msg
|
||||
switch(level)
|
||||
if(0)
|
||||
msg = span_green("Your MentorHelp is being handled by [key_name(usr,FALSE,FALSE)] please be patient.")
|
||||
if(1)
|
||||
msg = span_red("Your AdminHelp is being handled by [key_name(usr,FALSE,FALSE)] please be patient.")
|
||||
|
||||
if(initiator)
|
||||
to_chat(initiator, msg)
|
||||
@@ -609,26 +644,31 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
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_mentor_pm_warning("Error: client not found, unable to escalate."))
|
||||
to_chat(usr, span_mentor_warning("Error: client not found, unable to escalate."))
|
||||
return
|
||||
|
||||
level = level - 1
|
||||
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_mentor("[usr.ckey] escalated your ticket to admins."))
|
||||
|
||||
/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='byond://?_src_=mentorholder;mhelp=[ref_src];mhelp_action=escalate'>ESCALATE</A>)"
|
||||
|
||||
//Forwarded action from admin/Topic
|
||||
/datum/ticket/proc/Action(action)
|
||||
testing("Ahelp action: [action]")
|
||||
//testing("Ticket action: [action]")
|
||||
|
||||
// Actions everyone can do
|
||||
switch(level)
|
||||
if(0)
|
||||
if(!check_rights_for(usr.client, (R_ADMIN|R_SERVER|R_MOD|R_MENTOR)))
|
||||
return
|
||||
if(1)
|
||||
if(!check_rights_for(usr.client, (R_ADMIN|R_SERVER|R_MOD)))
|
||||
return
|
||||
|
||||
perform_action(action)
|
||||
|
||||
/datum/ticket/proc/perform_action(action)
|
||||
switch(action)
|
||||
if("ticket")
|
||||
TicketPanel()
|
||||
@@ -637,6 +677,10 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list)
|
||||
if("reject")
|
||||
Reject()
|
||||
if("reply")
|
||||
switch(level)
|
||||
if(0)
|
||||
usr.client.cmd_mhelp_reply(initiator)
|
||||
if(1)
|
||||
usr.client.cmd_ahelp_reply(initiator)
|
||||
if("icissue")
|
||||
ICIssue()
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
return data
|
||||
|
||||
/datum/ticket_chat/tgui_act(action, params)
|
||||
/datum/ticket_chat/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
@@ -43,5 +43,10 @@
|
||||
if(!params["msg"])
|
||||
return
|
||||
|
||||
usr.client.cmd_admin_pm(usr.client, sanitize(params["msg"]), T)
|
||||
switch(T.level)
|
||||
if (0)
|
||||
ui.user.client.cmd_mentor_pm(ui.user.client, sanitize(params["msg"]), T)
|
||||
if (1)
|
||||
ui.user.client.cmd_admin_pm(ui.user.client, sanitize(params["msg"]), T)
|
||||
|
||||
. = TRUE
|
||||
@@ -9,7 +9,7 @@
|
||||
ui.open()
|
||||
|
||||
/datum/tickets/tgui_state(mob/user)
|
||||
return GLOB.tgui_admin_state
|
||||
return GLOB.tgui_mentor_state
|
||||
|
||||
/datum/tickets/proc/get_ticket_state(state)
|
||||
var/ticket_state
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
if(user.client.selected_ticket)
|
||||
var/datum/ticket/T = user.client.selected_ticket
|
||||
if(check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) || (check_rights_for(user.client, R_MENTOR) && T.level < 1))
|
||||
selected_ticket = list(
|
||||
"id" = T.id,
|
||||
"name" = T.LinkedReplyName(),
|
||||
@@ -44,12 +45,12 @@
|
||||
"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(),
|
||||
"actions" = check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) ? T.FullMonty(,TRUE) : 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))
|
||||
if(check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) || (check_rights_for(user.client, R_MENTOR) && T.level < 1))
|
||||
tickets.Add(list(list(
|
||||
"id" = T.id,
|
||||
"name" = T.initiator_key_name,
|
||||
@@ -63,7 +64,7 @@
|
||||
)))
|
||||
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.closed_tickets)
|
||||
if(user.client.holder || (has_mentor_powers(user.client) && T.level > 0))
|
||||
if(check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) || (check_rights_for(user.client, R_MENTOR) && T.level < 1))
|
||||
tickets.Add(list(list(
|
||||
"id" = T.id,
|
||||
"name" = T.initiator_key_name,
|
||||
@@ -77,7 +78,7 @@
|
||||
)))
|
||||
|
||||
for(var/datum/ticket/T as anything in GLOB.tickets.resolved_tickets)
|
||||
if(user.client.holder || (has_mentor_powers(user.client) && T.level > 0))
|
||||
if(check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) || (check_rights_for(user.client, R_MENTOR) && T.level < 1))
|
||||
tickets.Add(list(list(
|
||||
"id" = T.id,
|
||||
"name" = T.initiator_key_name,
|
||||
@@ -90,7 +91,7 @@
|
||||
"closed_at_date" = gameTimestamp(wtime = T.closed_at),
|
||||
)))
|
||||
data["tickets"] = tickets
|
||||
|
||||
data["is_admin"] = check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD))
|
||||
data["selected_ticket"] = selected_ticket
|
||||
|
||||
return data
|
||||
@@ -100,15 +101,15 @@
|
||||
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)
|
||||
var/choice = tgui_input_list(ui.user, "Which tickets do you want to list?", "Tickets", list("Active", "Closed", "Resolved"))
|
||||
TicketListLegacy(ui.user, 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))
|
||||
var/ckey = lowertext(tgui_input_list(ui.user, "Please select the ckey of the user.", "Select CKEY", ckeys))
|
||||
if(!ckey)
|
||||
return
|
||||
|
||||
@@ -118,71 +119,79 @@
|
||||
player = C
|
||||
|
||||
if(!player)
|
||||
to_chat(usr, span_warning("Ckey ([ckey]) not online."))
|
||||
to_chat(ui.user, span_warning("Ckey ([ckey]) not online."))
|
||||
return
|
||||
|
||||
var/ticket_text = tgui_input_text(usr, "What should the initial text be?", "New Ticket")
|
||||
var/ticket_text = tgui_input_text(ui.user, "What should the initial text be?", "New Ticket")
|
||||
if(!ticket_text)
|
||||
to_chat(usr, span_warning("Ticket message cannot be empty."))
|
||||
to_chat(ui.user, span_warning("Ticket message cannot be empty."))
|
||||
return
|
||||
|
||||
var/level = tgui_alert(usr, "Is this ticket Admin-Level or Mentor-Level?", "Ticket Level", list("Admin", "Mentor"))
|
||||
var/level = tgui_alert(ui.user, "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)
|
||||
var/input = tgui_alert(usr, "The player already has a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
var/input = tgui_alert(ui.user, "The player already has a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
if(!input)
|
||||
return
|
||||
if(input == "Yes")
|
||||
if(player.current_ticket)
|
||||
player.current_ticket.MessageNoRecipient(ticket_text)
|
||||
to_chat(usr, span_adminnotice("PM to-" + span_bold("Admins") + ": [ticket_text]"))
|
||||
to_chat(ui.user, span_adminnotice("PM to-" + span_bold("Admins") + ": [ticket_text]"))
|
||||
return
|
||||
else
|
||||
to_chat(usr, span_warning("Ticket not found, creating new one..."))
|
||||
to_chat(ui.user, span_warning("Ticket not found, creating new one..."))
|
||||
else
|
||||
player.current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
|
||||
player.current_ticket.AddInteraction("[key_name_admin(ui.user)] 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
|
||||
else
|
||||
T.level = 0
|
||||
T.HandleIssue()
|
||||
usr.client.cmd_admin_pm(player, ticket_text, T)
|
||||
switch(T.level)
|
||||
if (0)
|
||||
ui.user.client.cmd_mentor_pm(player, ticket_text, T)
|
||||
if (1)
|
||||
ui.user.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
|
||||
ui.user.client.selected_ticket = T
|
||||
. = TRUE
|
||||
if("retitle_ticket")
|
||||
usr.client.selected_ticket.Retitle()
|
||||
ui.user.client.selected_ticket.Retitle()
|
||||
. = TRUE
|
||||
if("reopen_ticket")
|
||||
usr.client.selected_ticket.Reopen()
|
||||
ui.user.client.selected_ticket.Reopen()
|
||||
. = TRUE
|
||||
if("undock_ticket")
|
||||
usr.client.selected_ticket.tgui_interact(usr)
|
||||
usr.client.selected_ticket = null
|
||||
ui.user.client.selected_ticket.tgui_interact(ui.user)
|
||||
ui.user.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)
|
||||
switch(ui.user.client.selected_ticket.level)
|
||||
if (0)
|
||||
ui.user.client.cmd_mentor_pm(ui.user.client.selected_ticket.initiator, sanitize(params["msg"]), ui.user.client.selected_ticket)
|
||||
if (1)
|
||||
ui.user.client.cmd_admin_pm(ui.user.client.selected_ticket.initiator, sanitize(params["msg"]), ui.user.client.selected_ticket)
|
||||
. = TRUE
|
||||
|
||||
/datum/tickets/tgui_fallback(payload)
|
||||
/datum/tickets/tgui_fallback(payload, user)
|
||||
if(..())
|
||||
return
|
||||
|
||||
var/choice = tgui_input_list(usr, "Which tickets do you want to list?", "Tickets", list("Active", "Closed", "Resolved"))
|
||||
var/choice = tgui_input_list(user, "Which tickets do you want to list?", "Tickets", list("Active", "Closed", "Resolved"))
|
||||
|
||||
TicketListLegacy(choice)
|
||||
TicketListLegacy(user, choice)
|
||||
|
||||
//
|
||||
//TICKET DATUM
|
||||
@@ -195,7 +204,7 @@
|
||||
ui.open()
|
||||
|
||||
/datum/ticket/tgui_state(mob/user)
|
||||
return GLOB.tgui_admin_state
|
||||
return GLOB.tgui_mentor_state
|
||||
|
||||
/datum/ticket/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
@@ -226,13 +235,13 @@
|
||||
data["opened_at_date"] = gameTimestamp(wtime = opened_at)
|
||||
data["closed_at_date"] = gameTimestamp(wtime = closed_at)
|
||||
|
||||
data["actions"] = FullMonty(ref_src)
|
||||
data["actions"] = check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) ? FullMonty(ref_src, TRUE) : FullMonty(ref_src)
|
||||
|
||||
data["log"] = _interactions
|
||||
|
||||
return data
|
||||
|
||||
/datum/ticket/tgui_act(action, params)
|
||||
/datum/ticket/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
@@ -243,7 +252,7 @@
|
||||
Reopen()
|
||||
. = TRUE
|
||||
if("legacy")
|
||||
TicketPanelLegacy()
|
||||
TicketPanelLegacy(ui.user)
|
||||
. = TRUE
|
||||
if("send_msg")
|
||||
if(!params["msg"] || !params["ticket_ref"])
|
||||
@@ -251,45 +260,21 @@
|
||||
|
||||
var/datum/ticket/T = locate(params["ticket_ref"])
|
||||
|
||||
usr.client.cmd_admin_pm(T.initiator, sanitize(params["msg"]), T)
|
||||
switch(level)
|
||||
if (0)
|
||||
ui.user.client.cmd_mentor_pm(T.initiator, sanitize(params["msg"]), T)
|
||||
if (1)
|
||||
ui.user.client.cmd_admin_pm(T.initiator, sanitize(params["msg"]), T)
|
||||
|
||||
. = TRUE
|
||||
|
||||
/datum/ticket/tgui_fallback(payload)
|
||||
/datum/ticket/tgui_fallback(payload, user)
|
||||
if(..())
|
||||
return
|
||||
|
||||
TicketPanelLegacy()
|
||||
TicketPanelLegacy(user)
|
||||
|
||||
/*
|
||||
/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 += span_red("OPEN")
|
||||
if(AHELP_RESOLVED)
|
||||
dat += span_green("RESOLVED")
|
||||
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 += span_bold("Actions:") + " [Context(ref_src)]<br>"
|
||||
else
|
||||
dat += span_bold("DISCONNECTED") + "[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()
|
||||
/datum/ticket/proc/TicketPanelLegacy(mob/user)
|
||||
var/list/dat = list("<html><head><title>Ticket #[id]</title></head>")
|
||||
var/ref_src = "\ref[src]"
|
||||
dat += "<h4>Ticket #[id]: [LinkedReplyName(ref_src)]</h4>"
|
||||
@@ -311,33 +296,39 @@
|
||||
dat += "<br>Closed at: [gameTimestamp(wtime = closed_at)] (Approx [(world.time - closed_at) / 600] minutes ago)"
|
||||
dat += "<br><br>"
|
||||
if(initiator)
|
||||
dat += span_bold("Actions:") + " [FullMonty(ref_src)]<br>"
|
||||
dat += span_bold("Actions:") + " [check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) ? FullMonty(ref_src, TRUE) : FullMonty(ref_src)]<br>"
|
||||
else
|
||||
dat += span_bold("DISCONNECTED") + "[GLOB.TAB][ClosureLinks(ref_src)]<br>"
|
||||
dat += "<br><b>Log:</b><br><br>"
|
||||
for(var/I in _interactions)
|
||||
dat += "[I]<br>"
|
||||
dat += "</html>"
|
||||
usr << browse(dat.Join(), "window=ahelp[id];size=620x480")
|
||||
user << browse(dat.Join(), "window=ahelp[id];size=620x480")
|
||||
|
||||
/datum/tickets/proc/TicketListLegacy(var/state)
|
||||
/datum/tickets/proc/TicketListLegacy(mob/user, 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]")]"
|
||||
if(!check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) && T.level > 0)
|
||||
continue
|
||||
dat += "[T.level == 0 ? "Mentorhelp" : "Adminhelp"] - [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]")]"
|
||||
if(!check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) && T.level > 0)
|
||||
continue
|
||||
dat += "[T.level == 0 ? "Mentorhelp" : "Adminhelp"] - [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]")]"
|
||||
if(!check_rights_for(user.client, (R_ADMIN|R_SERVER|R_MOD)) && T.level > 0)
|
||||
continue
|
||||
dat += "[T.level == 0 ? "Mentorhelp" : "Adminhelp"] - [T.TicketHref("#[T.id] - [T.initiator_ckey]: [T.name]")]"
|
||||
tickets_found++
|
||||
|
||||
if(tickets_found == 0)
|
||||
dat += "No [state] tickets found."
|
||||
dat += "</html>"
|
||||
usr << browse(dat.Join(), "window=ahelp-list;size=250x350")
|
||||
user << browse(dat.Join(), "window=ahelp-list;size=250x350")
|
||||
@@ -614,3 +614,12 @@ JUKEBOX_TRACK_FILES config/jukebox.json
|
||||
|
||||
## Uncomment to limit resize caps depending on sprite icon height
|
||||
#PIXEL_SIZE_LIMIT
|
||||
|
||||
# This is the tgs4 channel tag, for discord chatbots used in TGS
|
||||
#AHELP_CHANNEL_TAG admin
|
||||
|
||||
# Turn this off if you don't want the TGS bot sending you messages whenever an ahelp ticket is created.
|
||||
#DISCORD_AHELPS_DISABLED
|
||||
|
||||
#Turn this on if you want all admin-PMs to go to be sent to discord, and not only the first message of a ticket.
|
||||
#DISCORD_AHELPS_ALL
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
; just add the ckey (lowercase) of every mentor on a separate line
|
||||
; lines starting with ; are comments and will be ignored
|
||||
|
||||
; not_a_user
|
||||
@@ -1066,6 +1066,11 @@ Byond.subscribeTo('add_admin_tabs', function (ht) {
|
||||
addPermanentTab("Tickets");
|
||||
});
|
||||
|
||||
Byond.subscribeTo('add_tickets_tabs', function (ht) {
|
||||
href_token = ht;
|
||||
addPermanentTab("Tickets");
|
||||
});
|
||||
|
||||
Byond.subscribeTo('update_examine', function (payload) {
|
||||
examine = payload.EX;
|
||||
if (examine.length > 0 && !verb_tabs.includes("Examine")) {
|
||||
|
||||
BIN
icons/logo.dmi
Normal file
BIN
icons/logo.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
icons/virgoicon_32.png
Normal file
BIN
icons/virgoicon_32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -1,171 +0,0 @@
|
||||
//
|
||||
// CLIENT PROCS
|
||||
//
|
||||
|
||||
/client/verb/mentorhelp(msg as text)
|
||||
set category = "Admin"
|
||||
set name = "Mentorhelp"
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_danger("Error: Mentor-PM: You cannot send adminhelps (Muted)."))
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
remove_verb(src,/client/verb/mentorhelp) //CHOMPEdit
|
||||
spawn(600)
|
||||
add_verb(src,/client/verb/mentorhelp ) // 1 minute cool-down for mentorhelps //CHOMPEdit
|
||||
|
||||
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)
|
||||
var/input = tgui_alert(usr, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
if(!input)
|
||||
return
|
||||
if(input == "Yes")
|
||||
if(current_ticket)
|
||||
log_admin("Mentorhelp: [key_name(src)]: [msg]")
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
to_chat(usr, span_adminnotice(span_mentor("Mentor-PM to-" + span_bold("Mentors") + ": [msg]")))
|
||||
return
|
||||
else
|
||||
to_chat(usr, span_warning("Ticket not found, creating new one..."))
|
||||
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.Misc"
|
||||
|
||||
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_mentor_channel(span_prefix("Mentor:") + span_message("[msg]"))
|
||||
|
||||
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"
|
||||
|
||||
//handle muting and automuting
|
||||
if(prefs.muted & MUTE_ADMINHELP)
|
||||
to_chat(src, span_danger("Error: Admin-PM: You cannot send adminhelps (Muted)."))
|
||||
return
|
||||
if(handle_spam_prevention(msg,MUTE_ADMINHELP))
|
||||
return
|
||||
|
||||
if(!msg)
|
||||
return
|
||||
|
||||
//remove out adminhelp verb temporarily to prevent spamming of admins.
|
||||
remove_verb(src,/client/verb/adminhelp) //CHOMPEdit
|
||||
spawn(1200)
|
||||
add_verb(src,/client/verb/adminhelp ) // 2 minute cool-down for adminhelps //CHOMPEdit
|
||||
|
||||
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)
|
||||
var/input = tgui_alert(usr, "You already have a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No"))
|
||||
if(!input)
|
||||
return
|
||||
if(input == "Yes")
|
||||
if(current_ticket)
|
||||
current_ticket.MessageNoRecipient(msg)
|
||||
to_chat(usr, span_adminnotice("PM to-" + span_bold("Admins") + ": [msg]"))
|
||||
return
|
||||
else
|
||||
to_chat(usr, span_warning("Ticket not found, creating new one..."))
|
||||
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.Misc"
|
||||
|
||||
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_GET(string/chat_webhook_url)) // CHOMPEdit
|
||||
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_GET(string/chat_webhook_key))]" // CHOMPEdit
|
||||
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_GET(string/chat_webhook_url)]?[query_string]") // CHOMPEdit
|
||||
|
||||
/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_danger("Error: You cannot request spice (muted from adminhelps)."))
|
||||
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")) == "Yes")
|
||||
message_admins("[ADMIN_FULLMONTY(usr)] has requested the round be spiced up a little.")
|
||||
to_chat(usr, span_notice("You have requested some more spice in your round."))
|
||||
else
|
||||
to_chat(usr, span_notice("Spice request cancelled."))
|
||||
return
|
||||
|
||||
//if they requested spice, then remove spice verb temporarily to prevent spamming
|
||||
remove_verb(usr,/client/verb/adminspice) //CHOMPEdit
|
||||
spawn(10 MINUTES)
|
||||
if(usr) // In case we left in the 10 minute cooldown
|
||||
add_verb(usr,/client/verb/adminspice ) // 10 minute cool-down for spice request //CHOMPEdit
|
||||
@@ -1,93 +0,0 @@
|
||||
/* eslint react/no-danger: "off" */
|
||||
import { useBackend } from 'tgui/backend';
|
||||
import { Window } from 'tgui/layouts';
|
||||
import { Button, LabeledList, Section, Stack } from 'tgui-core/components';
|
||||
import { round, toFixed } from 'tgui-core/math';
|
||||
|
||||
const State = {
|
||||
open: 'Open',
|
||||
resolved: 'Resolved',
|
||||
closed: 'Closed',
|
||||
unknown: 'Unknown',
|
||||
};
|
||||
|
||||
type Data = {
|
||||
id: number;
|
||||
title: string;
|
||||
name: string;
|
||||
state: string;
|
||||
opened_at: number;
|
||||
closed_at: number;
|
||||
opened_at_date: string;
|
||||
closed_at_date: string;
|
||||
actions: string;
|
||||
log: string[];
|
||||
};
|
||||
|
||||
export const AdminTicketPanel = (props) => {
|
||||
const { act, data } = useBackend<Data>();
|
||||
const {
|
||||
id,
|
||||
title,
|
||||
name,
|
||||
state,
|
||||
opened_at,
|
||||
closed_at,
|
||||
opened_at_date,
|
||||
closed_at_date,
|
||||
actions,
|
||||
log,
|
||||
} = data;
|
||||
return (
|
||||
<Window width={900} height={600}>
|
||||
<Window.Content scrollable>
|
||||
<Section
|
||||
title={'Ticket #' + id}
|
||||
buttons={
|
||||
<Stack>
|
||||
<Stack.Item>
|
||||
<Button icon="pen" onClick={() => act('retitle')}>
|
||||
Rename Ticket
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button onClick={() => act('legacy')}>Legacy UI</Button>
|
||||
</Stack.Item>
|
||||
</Stack>
|
||||
}
|
||||
>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Admin Help Ticket">
|
||||
#{id}: <div dangerouslySetInnerHTML={{ __html: name }} />
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="State">{State[state]}</LabeledList.Item>
|
||||
{State[state] === State.open ? (
|
||||
<LabeledList.Item label="Opened At">
|
||||
{opened_at_date +
|
||||
' (' +
|
||||
toFixed(round((opened_at / 600) * 10, 0) / 10, 1) +
|
||||
' minutes ago.)'}
|
||||
</LabeledList.Item>
|
||||
) : (
|
||||
<LabeledList.Item label="Closed At">
|
||||
{closed_at_date +
|
||||
' (' +
|
||||
toFixed(round((closed_at / 600) * 10, 0) / 10, 1) +
|
||||
' minutes ago.)'}
|
||||
<Button onClick={() => act('reopen')}>Reopen</Button>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Actions">
|
||||
<div dangerouslySetInnerHTML={{ __html: actions }} />
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Log">
|
||||
{Object.keys(log).map((L, i) => (
|
||||
<div key={i} dangerouslySetInnerHTML={{ __html: log[L] }} />
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
@@ -1,91 +0,0 @@
|
||||
/* eslint react/no-danger: "off" */
|
||||
import { useBackend } from 'tgui/backend';
|
||||
import { Window } from 'tgui/layouts';
|
||||
import { Button, LabeledList, Section, Stack } from 'tgui-core/components';
|
||||
import { round, toFixed } from 'tgui-core/math';
|
||||
|
||||
const State = {
|
||||
open: 'Open',
|
||||
resolved: 'Resolved',
|
||||
unknown: 'Unknown',
|
||||
};
|
||||
|
||||
type Data = {
|
||||
id: number;
|
||||
title: string;
|
||||
name: string;
|
||||
state: string;
|
||||
opened_at: number;
|
||||
closed_at: number;
|
||||
opened_at_date: string;
|
||||
closed_at_date: string;
|
||||
actions: string;
|
||||
log: string[];
|
||||
};
|
||||
|
||||
export const MentorTicketPanel = (props) => {
|
||||
const { act, data } = useBackend<Data>();
|
||||
const {
|
||||
id,
|
||||
name,
|
||||
state,
|
||||
opened_at,
|
||||
closed_at,
|
||||
opened_at_date,
|
||||
closed_at_date,
|
||||
actions,
|
||||
log,
|
||||
} = data;
|
||||
return (
|
||||
<Window width={900} height={600}>
|
||||
<Window.Content scrollable>
|
||||
<Section
|
||||
title={'Ticket #' + id}
|
||||
buttons={
|
||||
<Stack>
|
||||
<Stack.Item>
|
||||
<Button icon="arrow-up" onClick={() => act('escalate')}>
|
||||
Escalate
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button onClick={() => act('legacy')}>Legacy UI</Button>
|
||||
</Stack.Item>
|
||||
</Stack>
|
||||
}
|
||||
>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Mentor Help Ticket">
|
||||
#{id}: <div dangerouslySetInnerHTML={{ __html: name }} />
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="State">{State[state]}</LabeledList.Item>
|
||||
{State[state] === State.open ? (
|
||||
<LabeledList.Item label="Opened At">
|
||||
{opened_at_date +
|
||||
' (' +
|
||||
toFixed(round((opened_at / 600) * 10, 0) / 10, 1) +
|
||||
' minutes ago.)'}
|
||||
</LabeledList.Item>
|
||||
) : (
|
||||
<LabeledList.Item label="Closed At">
|
||||
{closed_at_date +
|
||||
' (' +
|
||||
toFixed(round((closed_at / 600) * 10, 0) / 10, 1) +
|
||||
' minutes ago.)'}
|
||||
<Button onClick={() => act('reopen')}>Reopen</Button>
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
<LabeledList.Item label="Actions">
|
||||
<div dangerouslySetInnerHTML={{ __html: actions }} />
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Log">
|
||||
{Object.keys(log).map((L, i) => (
|
||||
<div key={i} dangerouslySetInnerHTML={{ __html: log[L] }} />
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
@@ -3,6 +3,7 @@ import { type RefObject, useEffect, useRef, useState } from 'react';
|
||||
import { useBackend } from 'tgui/backend';
|
||||
import { Window } from 'tgui/layouts';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
Input,
|
||||
@@ -14,14 +15,14 @@ import { KEY } from 'tgui-core/keys';
|
||||
import { round, toFixed } from 'tgui-core/math';
|
||||
|
||||
const Level = {
|
||||
0: 'Adminhelp',
|
||||
1: 'Mentorhelp',
|
||||
0: 'Mentorhelp',
|
||||
1: 'Adminhelp',
|
||||
2: 'GM Request',
|
||||
};
|
||||
|
||||
const LevelColor = {
|
||||
0: 'red',
|
||||
1: 'green',
|
||||
0: 'green',
|
||||
1: 'red',
|
||||
2: 'pink',
|
||||
};
|
||||
|
||||
@@ -103,19 +104,13 @@ export const Ticket = (props) => {
|
||||
<Section
|
||||
title={'Ticket #' + id}
|
||||
buttons={
|
||||
<Stack>
|
||||
<Stack.Item>
|
||||
<Box nowrap>
|
||||
<Button icon="pen" onClick={() => act('retitle')}>
|
||||
Rename Ticket
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button onClick={() => act('legacy')}>Legacy UI</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button color={LevelColor[level]}>{Level[level]}</Button>
|
||||
</Stack.Item>
|
||||
</Stack>
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
<LabeledList>
|
||||
@@ -13,14 +13,14 @@ import {
|
||||
import { KEY } from 'tgui-core/keys';
|
||||
|
||||
const Level = {
|
||||
0: 'Adminhelp',
|
||||
1: 'Mentorhelp',
|
||||
0: 'Mentorhelp',
|
||||
1: 'Adminhelp',
|
||||
2: 'GM Request',
|
||||
};
|
||||
|
||||
const LevelColor = {
|
||||
0: 'red',
|
||||
1: 'green',
|
||||
0: 'green',
|
||||
1: 'red',
|
||||
2: 'pink',
|
||||
};
|
||||
|
||||
@@ -16,17 +16,21 @@ import {
|
||||
} from 'tgui-core/components';
|
||||
import { KEY } from 'tgui-core/keys';
|
||||
import { round, toFixed } from 'tgui-core/math';
|
||||
import { type BooleanLike } from 'tgui-core/react';
|
||||
import type { BooleanLike } from 'tgui-core/react';
|
||||
|
||||
const Level = {
|
||||
0: 'Admin',
|
||||
1: 'Mentor',
|
||||
const AdminLevel = {
|
||||
0: 'Mentor',
|
||||
1: 'Admin',
|
||||
2: 'All Levels',
|
||||
};
|
||||
|
||||
const MentorLevel = {
|
||||
0: 'Mentor',
|
||||
};
|
||||
|
||||
const LevelColor = {
|
||||
0: 'red',
|
||||
1: 'green',
|
||||
0: 'green',
|
||||
1: 'red',
|
||||
2: 'pink',
|
||||
};
|
||||
|
||||
@@ -53,6 +57,7 @@ type Data = {
|
||||
tickets: Ticket[];
|
||||
|
||||
selected_ticket: Ticket;
|
||||
is_admin: BooleanLike;
|
||||
};
|
||||
|
||||
type Ticket = {
|
||||
@@ -94,7 +99,7 @@ const getFilteredTickets = (
|
||||
|
||||
export const TicketsPanel = (props) => {
|
||||
const { act, data } = useBackend<Data>();
|
||||
const { tickets, selected_ticket } = data;
|
||||
const { tickets, selected_ticket, is_admin } = data;
|
||||
|
||||
const [stateFilter, setStateFilter] = useState('open');
|
||||
const [levelFilter, setLevelFilter] = useState(2);
|
||||
@@ -122,6 +127,8 @@ export const TicketsPanel = (props) => {
|
||||
}
|
||||
});
|
||||
|
||||
const availableLevel = is_admin ? AdminLevel : MentorLevel;
|
||||
|
||||
const filtered_tickets = getFilteredTickets(
|
||||
tickets,
|
||||
stateFilter,
|
||||
@@ -148,10 +155,10 @@ export const TicketsPanel = (props) => {
|
||||
<Dropdown
|
||||
width="100%"
|
||||
maxHeight="160px"
|
||||
options={Object.values(Level)}
|
||||
selected={Level[levelFilter]}
|
||||
options={Object.values(availableLevel)}
|
||||
selected={availableLevel[levelFilter]}
|
||||
onSelected={(val) =>
|
||||
setLevelFilter(Object.values(Level).indexOf(val))
|
||||
setLevelFilter(Object.values(availableLevel).indexOf(val))
|
||||
}
|
||||
/>
|
||||
</Section>
|
||||
@@ -177,7 +184,7 @@ export const TicketsPanel = (props) => {
|
||||
<Box inline>
|
||||
<Box>
|
||||
<Button color={LevelColor[ticket.level]}>
|
||||
{Level[ticket.level]}
|
||||
{availableLevel[ticket.level]}
|
||||
</Button>
|
||||
{ticket.name}
|
||||
</Box>
|
||||
@@ -198,34 +205,24 @@ export const TicketsPanel = (props) => {
|
||||
<Section
|
||||
title={'Ticket #' + selected_ticket.id}
|
||||
buttons={
|
||||
<Stack>
|
||||
<Stack.Item>
|
||||
<Box nowrap>
|
||||
<Button
|
||||
icon="arrow-up"
|
||||
onClick={() => act('undock_ticket')}
|
||||
>
|
||||
Undock
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button
|
||||
icon="pen"
|
||||
onClick={() => act('retitle_ticket')}
|
||||
>
|
||||
Rename Ticket
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button onClick={() => act('legacy')}>
|
||||
Legacy UI
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button onClick={() => act('legacy')}>Legacy UI</Button>
|
||||
<Button color={LevelColor[selected_ticket.level]}>
|
||||
{Level[selected_ticket.level]}
|
||||
{availableLevel[selected_ticket.level]}
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
</Stack>
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
<LabeledList>
|
||||
@@ -238,7 +235,7 @@ export const TicketsPanel = (props) => {
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Type">
|
||||
{Level[selected_ticket.level]}
|
||||
{availableLevel[selected_ticket.level]}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="State">
|
||||
{State[selected_ticket.state]}
|
||||
@@ -339,8 +336,7 @@ export const TicketsPanel = (props) => {
|
||||
<Section
|
||||
title="No ticket selected"
|
||||
buttons={
|
||||
<Stack>
|
||||
<Stack.Item>
|
||||
<Box nowrap>
|
||||
<Button
|
||||
disabled
|
||||
icon="arrow-up"
|
||||
@@ -348,8 +344,6 @@ export const TicketsPanel = (props) => {
|
||||
>
|
||||
Undock
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button
|
||||
disabled
|
||||
icon="pen"
|
||||
@@ -357,11 +351,8 @@ export const TicketsPanel = (props) => {
|
||||
>
|
||||
Rename Ticket
|
||||
</Button>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Button onClick={() => act('legacy')}>Legacy UI</Button>
|
||||
</Stack.Item>
|
||||
</Stack>
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
Please select a ticket on the left to view its details.
|
||||
@@ -18,8 +18,9 @@ bitflags = {
|
||||
"R_MOD": 1<<13,
|
||||
"R_EVENT": 1<<14,
|
||||
"R_HOST": 1<<15,
|
||||
"R_MENTOR": 1<<16,
|
||||
"-------------": 0,
|
||||
"EVERYTHING": (1<<16)-1
|
||||
"EVERYTHING": (1<<17)-1
|
||||
}
|
||||
|
||||
class BitflagCalculator:
|
||||
|
||||
@@ -3134,7 +3134,6 @@
|
||||
#include "code\modules\media\media_tracks.dm"
|
||||
#include "code\modules\media\mediamanager.dm"
|
||||
#include "code\modules\media\walkpod.dm"
|
||||
#include "code\modules\mentor\mentor.dm"
|
||||
#include "code\modules\metric\activity.dm"
|
||||
#include "code\modules\metric\count.dm"
|
||||
#include "code\modules\metric\department.dm"
|
||||
@@ -4616,6 +4615,7 @@
|
||||
#include "code\modules\tgui\states\observer.dm"
|
||||
#include "code\modules\tgui\states\physical.dm"
|
||||
#include "code\modules\tgui\states\self.dm"
|
||||
#include "code\modules\tgui\states\ticket.dm"
|
||||
#include "code\modules\tgui\states\vorepanel_vr.dm"
|
||||
#include "code\modules\tgui\states\zlevel.dm"
|
||||
#include "code\modules\tgui_input\alert.dm"
|
||||
@@ -4631,6 +4631,10 @@
|
||||
#include "code\modules\tgui_panel\external.dm"
|
||||
#include "code\modules\tgui_panel\telemetry.dm"
|
||||
#include "code\modules\tgui_panel\tgui_panel.dm"
|
||||
#include "code\modules\tickets\procs.dm"
|
||||
#include "code\modules\tickets\tickets.dm"
|
||||
#include "code\modules\tickets\tickets_player_ui.dm"
|
||||
#include "code\modules\tickets\tickets_ui.dm"
|
||||
#include "code\modules\tooltip\tooltip.dm"
|
||||
#include "code\modules\turbolift\_turbolift.dm"
|
||||
#include "code\modules\turbolift\turbolift.dm"
|
||||
@@ -5218,11 +5222,6 @@
|
||||
#include "modular_chomp\code\modules\spells\spells.dm"
|
||||
#include "modular_chomp\code\modules\telesci\bscrystal.dm"
|
||||
#include "modular_chomp\code\modules\tgui\feedback.dm"
|
||||
#include "modular_chomp\code\modules\tgui\states\ticket.dm"
|
||||
#include "modular_chomp\code\modules\tickets\procs.dm"
|
||||
#include "modular_chomp\code\modules\tickets\tickets.dm"
|
||||
#include "modular_chomp\code\modules\tickets\tickets_player_ui.dm"
|
||||
#include "modular_chomp\code\modules\tickets\tickets_ui.dm"
|
||||
#include "modular_chomp\code\modules\vore\resizing\resize.dm"
|
||||
#include "modular_chomp\code\modules\weapons\melee.dm"
|
||||
#include "modular_chomp\code\modules\weapons\staves.dm"
|
||||
|
||||
Reference in New Issue
Block a user