/proc/keywords_lookup(msg) //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() 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, iSpeech is currently admin-disabled." return //handle muting and automuting if(prefs.muted & MUTE_ADMINHELP) src << "Error: Admin-PM: You cannot send adminhelps (Muted)." return if(src.handle_spam_prevention(msg,MUTE_ADMINHELP)) return var/ref_mob = "\ref[mob]" for(var/datum/adminticket/T in admintickets) if(T.permckey == src.ckey && T.resolved == "No") if(alert(usr,"You already have an adminhelp open, would you like to bump it?", "Bump Adminhelp", "Yes", "No") == "Yes") T.logs += "[src.ckey] has bumped this adminhelp!" if(T.admin == "N/A") usr << "Due to the fact your Adminhelp had no assigned admin, admins have been pinged." message_admins("[src.ckey] has bumped their adminhelp #[T.ID], still no assigned admin!") msg = "ADMINHELP: [key_name(src)] (?) (PP) (VV) (SM) (TP) (FLW) (R) (REJT): [T.msg]" for(var/client/X in admins) if(X.prefs.toggles & SOUND_ADMINHELP) X << 'sound/effects/adminhelp.ogg' X << msg else usr << "Admins have been notified." message_admins("[src.ckey] has bumped their adminhelp #[T.ID].") src.verbs -= /client/verb/adminhelp adminhelptimerid = addtimer(CALLBACK(src, .proc/giveadminhelpverb), 1200, TIMER_STOPPABLE) //2 minute cooldown of admin helps return usr << "Thank you for your patience." return src.verbs -= /client/verb/adminhelp adminhelptimerid = addtimer(CALLBACK(src, .proc/giveadminhelpverb), 1200, TIMER_STOPPABLE) //clean the input msg if(!msg) return msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) if(!msg) return var/original_msg = msg msg = keywords_lookup(msg) if(!mob) return //this doesn't happen createticket(src, msg, src.ckey, mob) var/datum/adminticket/ticket for(var/datum/adminticket/T in admintickets) if(T.permckey == src.ckey) ticket = T msg = "ADMINHELP: [key_name(src)] (?) (PP) (VV) (SM) (TP) (FLW) (R): [msg]" //send this msg to all admins for(var/client/X in admins) if(X.prefs.toggles & SOUND_ADMINHELP) X << 'sound/effects/adminhelp.ogg' window_flash(X) X << msg //show it to the person adminhelping too src << "PM to-Admins: [original_msg]" //send it to irc if nobody is on and tell us how many were on var/admin_number_present = send2irc_admin_notice_handler("adminhelp", ckey, original_msg) log_admin("ADMINHELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins who have +BAN.") feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return /proc/calculate_admins(type, requiredflags = R_BAN) var/admin_number_total = 0 //Total number of admins var/admin_number_afk = 0 //Holds the number of admins who are afk var/admin_number_ignored = 0 //Holds the number of admins without +BAN (so admins who are not really admins) var/admin_number_decrease = 0 //Holds the number of admins with are afk, ignored or both for(var/client/X in admins) admin_number_total++; var/invalid = 0 if(requiredflags != 0 && !check_rights_for(X, requiredflags)) admin_number_ignored++ invalid = 1 if(X.is_afk()) admin_number_afk++ invalid = 1 if(X.holder.fakekey) admin_number_ignored++ invalid = 1 if(invalid) admin_number_decrease++ switch(type) if("ignored") return admin_number_ignored if("total") return admin_number_total if("away") return admin_number_afk if("present") return admin_number_total - admin_number_decrease return 0 /proc/send2irc_admin_notice_handler(type, source, msg) var/afk_admins = calculate_admins("away") var/total_admins = calculate_admins("total") var/ignored_admins = calculate_admins("ignored") var/admin_number_present = calculate_admins("present") //Number of admins who are neither afk nor invalid var/irc_message_afk = "[msg] - All admins AFK ([afk_admins]/[total_admins]) or skipped ([ignored_admins]/[total_admins])" var/irc_message_normal = "[msg] - heard by [admin_number_present] non-AFK admins who have +BAN." var/irc_message_adminless = "[msg] - No admins online" switch(type) if("adminhelp") if(config.announce_adminhelps) send2irc(source, irc_message_normal) else if(admin_number_present <= 0) if(!afk_admins && !ignored_admins) send2admindiscord(source, irc_message_adminless) else if(afk_admins >= 1) send2admindiscord(source, irc_message_afk) else send2admindiscord(source, irc_message_normal) if("watchlist") if(config.announce_watchlist) send2irc(source, irc_message_normal) else if(admin_number_present <= 0) if(!afk_admins && !ignored_admins) send2admindiscord(source, irc_message_adminless) else if(afk_admins >= 1) send2admindiscord(source, irc_message_afk) else send2admindiscord(source, irc_message_normal) if("new_player") if(config.irc_first_connection_alert) send2irc(source, irc_message_normal) else if(admin_number_present <= 0) if(!afk_admins && !ignored_admins) send2admindiscord(source, irc_message_adminless) else if(afk_admins >= 1) send2admindiscord(source, irc_message_afk) else send2admindiscord(source, irc_message_normal) return admin_number_present /proc/send2irc(msg,msg2) if(config.useircbot) shell("python nudge.py [msg] \"[msg2]\"") return