From 3622a2fd2abddf2f91b584db8f8210a01833ea61 Mon Sep 17 00:00:00 2001 From: GeneriedJenelle Date: Sat, 28 Sep 2019 08:36:58 +0100 Subject: [PATCH] Ports World Server Dialogue/Attack Log Viewer --- code/_global_vars/mobs.dm | 1 + code/_helpers/logging.dm | 35 ++++++++++- code/modules/admin/admin_attack_log.dm | 1 + code/modules/admin/admin_tools.dm | 62 +++++++++++++++++++ code/modules/admin/admin_verbs.dm | 4 ++ .../admin/secrets/admin_secrets/admin_logs.dm | 33 +++++++++- vorestation.dme | 1 + 7 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 code/modules/admin/admin_tools.dm diff --git a/code/_global_vars/mobs.dm b/code/_global_vars/mobs.dm index 10d829904a..7e60dc71ea 100644 --- a/code/_global_vars/mobs.dm +++ b/code/_global_vars/mobs.dm @@ -5,3 +5,4 @@ GLOBAL_LIST_EMPTY(stealthminID) GLOBAL_LIST_EMPTY(directory) //all ckeys with associated client GLOBAL_LIST_EMPTY(clients) GLOBAL_LIST_EMPTY(players_by_zlevel) +GLOBAL_LIST_EMPTY(round_text_log) diff --git a/code/_helpers/logging.dm b/code/_helpers/logging.dm index c771de02ef..f64623af8b 100644 --- a/code/_helpers/logging.dm +++ b/code/_helpers/logging.dm @@ -61,8 +61,13 @@ /proc/log_access_in(client/new_client) if (config.log_access) +<<<<<<< HEAD var/message = "[key_name(new_client)] - IP:[new_client.address] - CID:[new_client.computer_id] - BYOND v[new_client.byond_version]" WRITE_LOG(diary, "ACCESS IN: [message]") +======= + var/message = "[key_name(new_client)] - IP:[new_client.address] - CID:[new_client.computer_id] - BYOND v[new_client.byond_version]" + diary << "\[[time_stamp()]]ACCESS IN: [message][log_end]" +>>>>>>> e7ea3a2... Ports World Server Dialogue/Attack Log Viewer (#6460) /proc/log_access_out(mob/last_mob) if (config.log_access) @@ -73,26 +78,46 @@ if (config.log_say) WRITE_LOG(diary, "SAY: [speaker.simple_info_line()]: [html_decode(text)]") + //Log the message to in-game dialogue logs, as well. + if(speaker.client) + speaker.dialogue_log += "([time_stamp()]) ([speaker]/[speaker.client]) SAY: - [text]" + GLOB.round_text_log += "([time_stamp()]) ([speaker]/[speaker.client]) SAY: - [text]" + /proc/log_ooc(text, client/user) if (config.log_ooc) WRITE_LOG(diary, "OOC: [user.simple_info_line()]: [html_decode(text)]") + GLOB.round_text_log += "([time_stamp()]) ([user]) OOC: - [text]" + /proc/log_aooc(text, client/user) if (config.log_ooc) WRITE_LOG(diary, "AOOC: [user.simple_info_line()]: [html_decode(text)]") + GLOB.round_text_log += "([time_stamp()]) ([user]) AOOC: - [text]" + /proc/log_looc(text, client/user) if (config.log_ooc) WRITE_LOG(diary, "LOOC: [user.simple_info_line()]: [html_decode(text)]") + GLOB.round_text_log += "([time_stamp()]) ([user]) LOOC: - [text]" + /proc/log_whisper(text, mob/speaker) if (config.log_whisper) WRITE_LOG(diary, "WHISPER: [speaker.simple_info_line()]: [html_decode(text)]") + if(speaker.client) + speaker.dialogue_log += "([time_stamp()]) ([speaker]/[speaker.client]) SAY: - [text]" + GLOB.round_text_log += "([time_stamp()]) ([speaker]/[speaker.client]) SAY: - [text]" + + /proc/log_emote(text, mob/speaker) if (config.log_emote) WRITE_LOG(diary, "EMOTE: [speaker.simple_info_line()]: [html_decode(text)]") + if(speaker.client) + speaker.dialogue_log += "([time_stamp()]) ([speaker]/[speaker.client]) EMOTE: - [text]" + GLOB.round_text_log += "([time_stamp()]) ([speaker]/[speaker.client]) EMOTE: - [text]" + /proc/log_attack(attacker, defender, message) if (config.log_attack) WRITE_LOG(diary, "ATTACK: [attacker] against [defender]: [message]") @@ -113,6 +138,10 @@ if (config.log_say) WRITE_LOG(diary, "DEADCHAT: [speaker.simple_info_line()]: [html_decode(text)]") + speaker.dialogue_log += "([time_stamp()]) ([speaker]/[speaker.client]) DEADSAY: - [text]" + GLOB.round_text_log += "([time_stamp()]) ([src]/[speaker.client]) DEADSAY: - [text]" + + /proc/log_ghostemote(text, mob/speaker) if (config.log_emote) WRITE_LOG(diary, "DEADEMOTE: [speaker.simple_info_line()]: [html_decode(text)]") @@ -125,6 +154,10 @@ if (config.log_pda) WRITE_LOG(diary, "PDA: [speaker.simple_info_line()]: [html_decode(text)]") + speaker.dialogue_log += "([time_stamp()]) ([speaker]/[speaker.client]) MSG: - [text]" + GLOB.round_text_log += "([time_stamp()]) ([speaker]/[speaker.client]) MSG: - [text]" + + /proc/log_to_dd(text) world.log << text //this comes before the config check because it can't possibly runtime if(config.log_world_output) @@ -222,7 +255,7 @@ if(include_link && is_special_character(M) && highlight_special_characters) name = "[name]" //Orange - + . += "/([name])" return . diff --git a/code/modules/admin/admin_attack_log.dm b/code/modules/admin/admin_attack_log.dm index f04bdf3b61..c1f5c67464 100644 --- a/code/modules/admin/admin_attack_log.dm +++ b/code/modules/admin/admin_attack_log.dm @@ -1,6 +1,7 @@ /mob/var/lastattacker = null /mob/var/lastattacked = null /mob/var/attack_log = list( ) +/mob/var/dialogue_log = list( ) proc/log_and_message_admins(var/message as text, var/mob/user = usr) log_admin(user ? "[key_name(user)] [message]" : "EVENT [message]") diff --git a/code/modules/admin/admin_tools.dm b/code/modules/admin/admin_tools.dm new file mode 100644 index 0000000000..376aa2da44 --- /dev/null +++ b/code/modules/admin/admin_tools.dm @@ -0,0 +1,62 @@ +/client/proc/cmd_admin_check_player_logs(mob/living/M as mob in mob_list) + set category = "Admin" + set name = "Check Player Attack Logs" + set desc = "Check a player's attack logs." + +//Views specific attack logs belonging to one player. + var/dat = "[M]'s Attack Log:
" + dat += "Viewing attack logs of [M] - (Played by ([key_name(M)]).
" + if(M.mind) + dat += "Current Antag?: [(M.mind.special_role)?"Yes":"No"]
" + dat += "
Note: This is arranged from earliest to latest.

" + + + if(!isemptylist(M.attack_log)) + dat += "
" + for(var/l in M.attack_log) + dat += "[l]
" + + dat += "
" + + else + dat += "No attack logs found for [M]." + + var/datum/browser/popup = new(usr, "admin_attack_log", "[src]", 650, 650, src) + popup.set_content(jointext(dat,null)) + popup.open() + + onclose(usr, "admin_attack_log") + + feedback_add_details("admin_verb","PL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + +/client/proc/cmd_admin_check_dialogue_logs(mob/living/M as mob in mob_list) + set category = "Admin" + set name = "Check Player Dialogue Logs" + set desc = "Check a player's dialogue logs." + +//Views specific dialogue logs belonging to one player. + var/dat = "[M]'s Dialogue Log:
" + dat += "Viewing say and emote logs of [M] - (Played by ([key_name(M)]).
" + if(M.mind) + dat += "Current Antag?: [(M.mind.special_role)?"Yes":"No"]
" + dat += "
Note: This is arranged from earliest to latest.

" + + if(!isemptylist(M.dialogue_log)) + dat += "
" + + for(var/d in M.dialogue_log) + dat += "[d]
" + + dat += "
" + else + dat += "No dialogue logs found for [M]." + var/datum/browser/popup = new(usr, "admin_dialogue_log", "[src]", 650, 650, src) + popup.set_content(jointext(dat,null)) + popup.open() + + onclose(usr, "admin_dialogue_log") + + + feedback_add_details("admin_verb","PDL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + + diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 67cc4d496c..9f8e6271f3 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -38,6 +38,8 @@ var/list/admin_verbs_admin = list( /client/proc/cmd_admin_subtle_message, //send an message to somebody as a 'voice in their head', /client/proc/cmd_admin_delete, //delete an instance/object/mob/etc, /client/proc/cmd_admin_check_contents, //displays the contents of an instance, + /client/proc/cmd_admin_check_player_logs, //checks a player's attack logs, + /client/proc/cmd_admin_check_dialogue_logs, //checks a player's dialogue logs, /datum/admins/proc/access_news_network, //allows access of newscasters, /client/proc/giveruntimelog, //allows us to give access to runtime logs to somebody, /client/proc/getserverlog, //allows us to fetch server logs (diary) for other days, @@ -267,6 +269,8 @@ var/list/admin_verbs_hideable = list( /datum/admins/proc/view_atk_log, /client/proc/cmd_admin_subtle_message, /client/proc/cmd_admin_check_contents, + /client/proc/cmd_admin_check_player_logs, + /client/proc/cmd_admin_check_dialogue_logs, /datum/admins/proc/access_news_network, /client/proc/admin_call_shuttle, /client/proc/admin_cancel_shuttle, diff --git a/code/modules/admin/secrets/admin_secrets/admin_logs.dm b/code/modules/admin/secrets/admin_secrets/admin_logs.dm index d2664f1e2b..b578eb046f 100644 --- a/code/modules/admin/secrets/admin_secrets/admin_logs.dm +++ b/code/modules/admin/secrets/admin_secrets/admin_logs.dm @@ -10,4 +10,35 @@ dat += "
  • [l]
  • " if(!admin_log.len) dat += "No-one has done anything this round!" - user << browse(dat, "window=admin_log") + + var/datum/browser/popup = new(user, "adminlogs", "[src]", 550, 650, src) + popup.set_content(jointext(dat,null)) + popup.open() + + onclose(user, "adminlogs") + + +/datum/admin_secret_item/admin_secret/round_logs + name = "Round Dialogue Logs" + +/datum/admin_secret_item/admin_secret/round_logs/execute(var/mob/user) + . = ..() + if(!.) + return + var/dat = "Dialogue Log
    " + + dat += "
    " + + for(var/l in GLOB.round_text_log) + dat += "
  • [l]
  • " + + dat += "
    " + + if(!GLOB.round_text_log) + dat += "No-one has said anything this round! (How odd?)" + + var/datum/browser/popup = new(user, "dialoguelogs", "[src]", 550, 650, src) + popup.set_content(jointext(dat,null)) + popup.open() + + onclose(user, "dialoguelogs") diff --git a/vorestation.dme b/vorestation.dme index 37b332f6ff..1d48fc0012 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -1382,6 +1382,7 @@ #include "code\modules\admin\admin_memo.dm" #include "code\modules\admin\admin_ranks.dm" #include "code\modules\admin\admin_secrets.dm" +#include "code\modules\admin\admin_tools.dm" #include "code\modules\admin\admin_verbs.dm" #include "code\modules\admin\banjob.dm" #include "code\modules\admin\ckey_vr.dm"