Adds cfg option to let players see their own notes

This lets players see the admin notes that have been added to their
ckey, by using a verb in the OOC tab.
This is a config option and is off by default.
This commit is contained in:
tkdrg
2014-12-19 22:39:28 -03:00
parent 579f297076
commit 9d7567f46d
5 changed files with 47 additions and 3 deletions
+23 -1
View File
@@ -4,13 +4,35 @@
#define NOTESFILE "data/player_notes.sav" //where the player notes are saved
/proc/see_own_notes()
if(!config.see_own_notes)
return
var/ckey = usr.client.ckey
if(!ckey)
usr << "<span class='warning'>Error: No ckey found.</span>"
return
var/savefile/notesfile = new(NOTESFILE)
if(!notesfile)
usr << "<span class='warning'>Error: Cannot access [NOTESFILE]</span>"
return
notesfile.cd = "/[ckey]"
var/dat = "<b>Notes for [ckey]:</b><br>"
while(!notesfile.eof)
var/note
notesfile >> note
dat += note
var/datum/browser/popup = new(usr, "player_notes", "Player Notes", 700, 400)
popup.set_content(dat)
popup.open()
datum/admins/proc/notes_show(var/ckey)
usr << browse("<head><title>Player Notes</title></head><body>[notes_gethtml(ckey)]</body>","window=player_notes;size=700x400")
datum/admins/proc/notes_gethtml(var/ckey)
var/savefile/notesfile = new(NOTESFILE)
if(!notesfile) return "<font color='red'>Error: Cannot access [NOTESFILE]</font>"
if(!notesfile) return "<span class='warning'>Error: Cannot access [NOTESFILE]</span>"
if(ckey)
. = "<b>Notes for <a href='?_src_=holder;notes=show'>[ckey]</a>:</b> <a href='?_src_=holder;notes=add;ckey=[ckey]'>\[+\]</a><br>"
notesfile.cd = "/[ckey]"
+6 -1
View File
@@ -133,6 +133,7 @@ var/next_external_rsc = 0
if((global.comms_key == "default_pwd" || length(global.comms_key) <= 6) && global.comms_allowed) //It's the default value or less than 6 characters long, but it somehow didn't disable comms.
src << "<span class='danger'>The server's API key is either too short or is the default value! Consider changing it immediately!</span>"
add_verbs_from_config()
set_client_age_from_db()
if (!ticker || ticker.current_state == GAME_STATE_PREGAME)
@@ -218,6 +219,10 @@ var/next_external_rsc = 0
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');")
query_accesslog.Execute()
/client/proc/add_verbs_from_config()
if(config.see_own_notes)
verbs += /client/proc/self_notes
#undef TOPIC_SPAM_DELAY
#undef UPLOAD_LIMIT
@@ -306,4 +311,4 @@ var/next_external_rsc = 0
'icons/stamp_icons/large_stamp-cap.png',
'icons/stamp_icons/large_stamp-qm.png',
'icons/stamp_icons/large_stamp-law.png'
)
)