From 6662fb5d02c027820038effc5c2e9758826b35a7 Mon Sep 17 00:00:00 2001 From: SoundScopes Date: Sat, 20 Jun 2015 15:49:40 +0100 Subject: [PATCH 1/4] Admin Updates --- code/modules/admin/admin.dm | 113 --------------------------- code/modules/admin/player_notes.dm | 117 +++++++++++++++++++++++++++- code/modules/admin/verbs/deadsay.dm | 18 +++-- icons/misc/buildmode.dmi | Bin 911 -> 939 bytes 4 files changed, 127 insertions(+), 121 deletions(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 8a405d72..e9d829b6 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -229,119 +229,6 @@ var/global/floorIsLava = 0 feedback_add_details("admin_verb","SPP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/datum/player_info/var/author // admin who authored the information -/datum/player_info/var/rank //rank of admin who made the notes -/datum/player_info/var/content // text content of the information -/datum/player_info/var/timestamp // Because this is bloody annoying - -#define PLAYER_NOTES_ENTRIES_PER_PAGE 50 -/datum/admins/proc/PlayerNotes() - set category = "Admin" - set name = "Player Notes" - if (!istype(src,/datum/admins)) - src = usr.client.holder -/* if (!istype(src,/datum/admins)) - usr << "Error: you are not an admin!" - return -*/ - if(!check_rights(R_ADMIN|R_MOD)) - return - - if(config.ban_legacy_system) - PlayerNotesPage(1) - else - show_notes_sql() - -/datum/admins/proc/PlayerNotesPage(page) - var/dat = "Player notes
" - var/savefile/S=new("data/player_notes.sav") - var/list/note_keys - S >> note_keys - if(!note_keys) - dat += "No notes found." - else - dat += "" - note_keys = sortList(note_keys) - - // Display the notes on the current page - var/number_pages = note_keys.len / PLAYER_NOTES_ENTRIES_PER_PAGE - // Emulate ceil(why does BYOND not have ceil) - if(number_pages != round(number_pages)) - number_pages = round(number_pages) + 1 - var/page_index = page - 1 - if(page_index < 0 || page_index >= number_pages) - return - - var/lower_bound = page_index * PLAYER_NOTES_ENTRIES_PER_PAGE + 1 - var/upper_bound = (page_index + 1) * PLAYER_NOTES_ENTRIES_PER_PAGE - upper_bound = min(upper_bound, note_keys.len) - for(var/index = lower_bound, index <= upper_bound, index++) - var/t = note_keys[index] - dat += "" - - dat += "
[t]

" - - // Display a footer to select different pages - for(var/index = 1, index <= number_pages, index++) - if(index == page) - dat += "" - dat += "[index] " - if(index == page) - dat += "" - - usr << browse(dat, "window=player_notes;size=400x400") - - -/datum/admins/proc/player_has_info(var/key as text) - var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav") - var/list/infos - info >> infos - if(!infos || !infos.len) return 0 - else return 1 - -/datum/admins/proc/show_player_info(var/key as text) - set category = "Admin" - set name = "Show Player Info" - if (!istype(src,/datum/admins)) - src = usr.client.holder - if (!istype(src,/datum/admins)) - usr << "Error: you are not an admin!" - return - - if(config.ban_legacy_system) - var/dat = "Info on [key]" - dat += "" - - var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav") - var/list/infos - info >> infos - if(!infos) - dat += "No information found on the given key.
" - else - var/update_file = 0 - var/i = 0 - for(var/datum/player_info/I in infos) - i += 1 - if(!I.timestamp) - I.timestamp = "Pre-4/3/2012" - update_file = 1 - if(!I.rank) - I.rank = "N/A" - update_file = 1 - dat += "[I.content] by [I.author] ([I.rank]) on [I.timestamp] " - if(I.author == usr.key || I.author == "Adminbot") - dat += "Remove" - dat += "

" - if(update_file) info << infos - - dat += "
" - dat += "Add Comment
" - - dat += "" - usr << browse(dat, "window=adminplayerinfo;size=480x480") - else - show_notes_sql(key) - /datum/admins/proc/access_news_network() //MARKER set category = "Fun" set name = "Access Newscaster Network" diff --git a/code/modules/admin/player_notes.dm b/code/modules/admin/player_notes.dm index 56c6aa65..d2ac8d48 100644 --- a/code/modules/admin/player_notes.dm +++ b/code/modules/admin/player_notes.dm @@ -85,6 +85,121 @@ datum/admins/proc/notes_gethtml(var/ckey) //Hijacking this file for BS12 playernotes functions. I like this ^ one systemm alright, but converting sounds too bothersome~ Chinsky. + +//Moved stuff here because well, this is the notes file >_< +/datum/player_info/var/author // admin who authored the information +/datum/player_info/var/rank //rank of admin who made the notes +/datum/player_info/var/content // text content of the information +/datum/player_info/var/timestamp // Because this is bloody annoying + +#define PLAYER_NOTES_ENTRIES_PER_PAGE 50 +/datum/admins/proc/PlayerNotes() + set category = "Admin" + set name = "Player Notes" + if (!istype(src,/datum/admins)) + src = usr.client.holder +/* if (!istype(src,/datum/admins)) + usr << "Error: you are not an admin!" + return +*/ + if(!check_rights(R_ADMIN|R_MOD)) + return + + if(config.ban_legacy_system) + PlayerNotesPage(1) + else + show_notes_sql() + +/datum/admins/proc/PlayerNotesPage(page) + var/dat = "Player notes
" + var/savefile/S=new("data/player_notes.sav") + var/list/note_keys + S >> note_keys + if(!note_keys) + dat += "No notes found." + else + dat += "" + note_keys = sortList(note_keys) + + // Display the notes on the current page + var/number_pages = note_keys.len / PLAYER_NOTES_ENTRIES_PER_PAGE + // Emulate ceil(why does BYOND not have ceil) + if(number_pages != round(number_pages)) + number_pages = round(number_pages) + 1 + var/page_index = page - 1 + if(page_index < 0 || page_index >= number_pages) + return + + var/lower_bound = page_index * PLAYER_NOTES_ENTRIES_PER_PAGE + 1 + var/upper_bound = (page_index + 1) * PLAYER_NOTES_ENTRIES_PER_PAGE + upper_bound = min(upper_bound, note_keys.len) + for(var/index = lower_bound, index <= upper_bound, index++) + var/t = note_keys[index] + dat += "" + + dat += "
[t]

" + + // Display a footer to select different pages + for(var/index = 1, index <= number_pages, index++) + if(index == page) + dat += "" + dat += "[index] " + if(index == page) + dat += "" + + usr << browse(dat, "window=player_notes;size=400x400") + + +/datum/admins/proc/player_has_info(var/key as text) + var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav") + var/list/infos + info >> infos + if(!infos || !infos.len) return 0 + else return 1 + +/datum/admins/proc/show_player_info(var/key as text) + set category = "Admin" + set name = "Show Player Info" + if (!istype(src,/datum/admins)) + src = usr.client.holder + if (!istype(src,/datum/admins)) + usr << "Error: you are not an admin!" + return + + if(config.ban_legacy_system) + var/dat = "Info on [key]" + dat += "" + + var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav") + var/list/infos + info >> infos + if(!infos) + dat += "No information found on the given key.
" + else + var/update_file = 0 + var/i = 0 + for(var/datum/player_info/I in infos) + i += 1 + if(!I.timestamp) + I.timestamp = "Pre-4/3/2012" + update_file = 1 + if(!I.rank) + I.rank = "N/A" + update_file = 1 + dat += "[I.content] by [I.author] ([I.rank]) on [I.timestamp] " + if(I.author == usr.key || I.author == "Adminbot") + dat += "Remove" + dat += "

" + if(update_file) info << infos + + dat += "
" + dat += "Add Comment
" + + dat += "" + usr << browse(dat, "window=adminplayerinfo;size=480x480") + else + show_notes_sql(key) + /proc/notes_add(var/key, var/note, var/mob/usr) if (!key || !note) return @@ -169,4 +284,4 @@ datum/admins/proc/notes_gethtml(var/ckey) for(var/datum/player_info/I in infos) dat += "[I.content]%0D%0Aby [I.author] ([I.rank]) on [I.timestamp]%0D%0A%0D%0A" - return dat + return dat \ No newline at end of file diff --git a/code/modules/admin/verbs/deadsay.dm b/code/modules/admin/verbs/deadsay.dm index 02519121..33e78ef4 100644 --- a/code/modules/admin/verbs/deadsay.dm +++ b/code/modules/admin/verbs/deadsay.dm @@ -30,10 +30,12 @@ stafftype = "EVENT" msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN) + + if (!msg) //We don't want to log empty messages + return + log_admin("DSAY: [key_name(src)] : [msg]") - if (!msg) - return var/rendered = "DEAD: [stafftype]([src.holder.fakekey ? pick("BADMIN", "hornigranny", "TLF", "scaredforshadows", "KSI", "Silnazi", "HerpEs", "BJ69", "SpoofedEdd", "Uhangay", "Wario90900", "Regarity", "MissPhareon", "LastFish", "unMportant", "Deurpyn", "Fatbeaver") : src.key]) says, \"[msg]\"" @@ -44,12 +46,14 @@ if(!M.client) continue - if(M.client && M.client.holder && (M.client.prefs.toggles & CHAT_DEAD)) // show the message to admins who have deadchat toggled on - if((M.client.holder.rights & R_DUTYOFF) && !(M.client.holder.rights & (R_ADMIN|R_MOD|R_DEV|R_FUN))) - continue - M.show_message(rendered, 2) + if(!(M.client.prefs.toggles & CHAT_DEAD)) + continue - else if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_DEAD)) // show the message to regular ghosts who have deadchat toggled on + if(M.client.holder && (M.client.holder.rights & (R_ADMIN|R_MOD|R_DEV|R_FUN))) // show the message to admins who have deadchat toggled on + M.show_message(rendered, 2) + continue + + if(M.stat == DEAD) // show the message to regular ghosts who have deadchat toggled on M.show_message(rendered, 2) feedback_add_details("admin_verb","D") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/icons/misc/buildmode.dmi b/icons/misc/buildmode.dmi index a885e76d549d102dcd6434e04434e6bb64adde35..40252b5ca94de680cf619c6cd58f39bcd8195791 100644 GIT binary patch delta 730 zcmV<00ww*A2df8=I10ePzyJW5P$ckmkwU3|t4TybRA_f5#CoA9k(6}1x!aFbv+MiM-&OnduGI z0f;@5t_-jOfRe5Zr~umzJ5AjFJ??+x6Mi&cJ0$ZEnt(GWY5=Fxr~#ZVBo*LzDI0>P z9ZZJsZ37Gm=5_D{?4nVxb3(x! zPV){$uLXc9oMCyupcw#?k#K&%q6NTzl@FH(44MHbU%>o;MGHU*?(%>^e;a_;iSB81 zFC_O;_6L(Yoc#&qKLzzu5Y?Hqbo0QW6-s%!zjjguAt^&V*%f*ueE zm-61>#Irk9CE)l@wFfYUw2G!U8G68K2-Cn07)OHzwG$IS=0OiwO=IjuDS#LcT??rI z^cJj_a&n>(unwjKh)y)j!X}*U>tK^myeZ9=x%SbX4l8}&!l~vtom>~4@vtzjT&&S z^Z!S^1|aGK01~1nL3!Rp|Rsf2IR)FisT2{CL;Cgz0 zofu#R0C}AlkO1-y3r*a9PRB3#gnI+>A(@9z1Z+*B2C%t|8o;I_sQ~M)YzUrmFd4$P z3@{{+m2lRluoZwliLNCSbsAp-s0+yw&|BKNi|YflN8KNo{on;yM5A7h2?fV+3Of|N z76AHihUo=^W&lV=!tjDc3xF#hPA?dLGy_n+fbfDv3qT6)^nyV@4WM@tyO*)sk-A;E zKbX41xj&)&bHHnV@SOXD`H5tys{kB0(7=a%Nf!Z-Y;{`zknYx{17rZ$1o+c>%!t0k8&es~|(b3LunolFwzJ!UABM4FKZH0B58- z((3`qFS_tW>4XLg768A683E$T18xFlbKn8qfFzhK0G%0!9;H3fGG~YJiwP*bLyl>7D8bxT*n=?vV!HlOH``Ae@zVJ0LsO*#X&|>RkXg z?+YD6;8pCIL>r*6j5a{#NYN2nUD*uCgXt1S(HPE`;0BEe#R^zWX=)28rleX*>k7cE k!yf>u#k1CGrEBl@3tiZMF<9sSKL7v#07*qoM6N<$f>!@K+W-In From 9d87a18a3dbe2e09375b47cba7f702aae9cc721c Mon Sep 17 00:00:00 2001 From: SoundScopes Date: Tue, 23 Jun 2015 19:20:35 +0100 Subject: [PATCH 2/4] Dead Emote stuff --- code/modules/mob/emote.dm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index 281933fb..a4cd80dd 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -100,8 +100,13 @@ if(istype(M, /mob/new_player)) continue - if(M.client && M.client.holder && (M.client.holder.rights & R_ADMIN|R_MOD) && (M.client.prefs.toggles & CHAT_DEAD)) // Show the emote to admins/mods - M << message + if(!M.client) + continue - else if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_DEAD)) // Show the emote to regular ghosts with deadchat toggled on - M.show_message(message, 2) + if(M.client.prefs.toggles & CHAT_DEAD) + + if(M.client.holder && M.client.holder.rights & (R_ADMIN|R_MOD)) // Show the emote to admins/mods + M << message + + if(M.stat == DEAD) // Show the emote to regular ghosts + M.show_message(message, 2) From c34ca539b3a62a92bc6928e22eda9a689a330741 Mon Sep 17 00:00:00 2001 From: SoundScopes Date: Tue, 23 Jun 2015 19:21:13 +0100 Subject: [PATCH 3/4] Remember to save --- code/modules/mob/emote.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index a4cd80dd..99543859 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -107,6 +107,7 @@ if(M.client.holder && M.client.holder.rights & (R_ADMIN|R_MOD)) // Show the emote to admins/mods M << message - + continue +7 if(M.stat == DEAD) // Show the emote to regular ghosts M.show_message(message, 2) From 76ed7f648db2eacc56676b017035730124bbcb0a Mon Sep 17 00:00:00 2001 From: SoundScopes Date: Wed, 24 Jun 2015 02:45:42 +0100 Subject: [PATCH 4/4] Update emote.dm --- code/modules/mob/emote.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index 99543859..1840efa4 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -108,6 +108,6 @@ if(M.client.holder && M.client.holder.rights & (R_ADMIN|R_MOD)) // Show the emote to admins/mods M << message continue -7 + if(M.stat == DEAD) // Show the emote to regular ghosts M.show_message(message, 2)