Automatic player note fixes.

Player notes should now properly include the relevant admin's ckey.
Automatically adds temporary and permanent bans to the player's notes.
This commit is contained in:
PsiOmega
2015-06-10 17:56:31 +02:00
parent 84ae0dd3d1
commit 2bd0d7a2f4
2 changed files with 11 additions and 46 deletions

View File

@@ -27,26 +27,6 @@ datum/admins/proc/notes_gethtml(var/ckey)
. += "<a href='?src=\ref[src];notes=show;ckey=[dir]'>[dir]</a><br>"
return
//handles adding notes to the end of a ckey's buffer
//originally had seperate entries such as var/by to record who left the note and when
//but the current bansystem is a heap of dung.
/proc/notes_add(var/ckey, var/note)
if(!ckey)
ckey = ckey(input(usr,"Who would you like to add notes for?","Enter a ckey",null) as text|null)
if(!ckey) return
if(!note)
note = html_encode(input(usr,"Enter your note:","Enter some text",null) as message|null)
if(!note) return
var/savefile/notesfile = new(NOTESFILE)
if(!notesfile) return
notesfile.cd = "/[ckey]"
notesfile.eof = 1 //move to the end of the buffer
notesfile << "[time2text(world.realtime,"DD-MMM-YYYY")] | [note][(usr && usr.ckey)?" ~[usr.ckey]":""]"
return
//handles removing entries from the buffer, or removing the entire directory if no start_index is given
/proc/notes_remove(var/ckey, var/start_index, var/end_index)
var/savefile/notesfile = new(NOTESFILE)
@@ -85,7 +65,7 @@ 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.
/proc/notes_add(var/key, var/note, var/mob/usr)
/proc/notes_add(var/key, var/note, var/mob/user)
if (!key || !note)
return
@@ -111,9 +91,9 @@ datum/admins/proc/notes_gethtml(var/ckey)
var/day_loc = findtext(full_date, time2text(world.timeofday, "DD"))
var/datum/player_info/P = new
if (usr)
P.author = usr.key
P.rank = usr.client.holder.rank
if (user)
P.author = user.key
P.rank = user.client.holder.rank
else
P.author = "Adminbot"
P.rank = "Friendly Robot"
@@ -123,8 +103,8 @@ datum/admins/proc/notes_gethtml(var/ckey)
infos += P
info << infos
message_admins("\blue [key_name_admin(usr)] has edited [key]'s notes.")
log_admin("[key_name(usr)] has edited [key]'s notes.")
message_admins("\blue [key_name_admin(user)] has edited [key]'s notes.")
log_admin("[key_name(user)] has edited [key]'s notes.")
del info

View File

@@ -110,6 +110,7 @@
banreason = "(MANUAL BAN) "+banreason
DB_ban_record(bantype, playermob, banduration, banreason, banjob, null, banckey)
notes_add(playermob.ckey,banreason,usr)
else if(href_list["editrights"])
if(!check_rights(R_PERMISSIONS))
@@ -757,7 +758,7 @@
msg = job
else
msg += ", [job]"
notes_add(M.ckey, "Banned from [msg] - [reason]")
notes_add(M.ckey, "Banned from [msg] - [reason]", usr)
message_admins("\blue [key_name_admin(usr)] banned [key_name_admin(M)] from [msg] for [mins] minutes", 1)
M << "\red<BIG><B>You have been jobbanned by [usr.client.ckey] from: [msg].</B></BIG>"
M << "\red <B>The reason is: [reason]</B>"
@@ -778,7 +779,7 @@
jobban_fullban(M, job, "[reason]; By [usr.ckey] on [time2text(world.realtime)]")
if(!msg) msg = job
else msg += ", [job]"
notes_add(M.ckey, "Banned from [msg] - [reason]")
notes_add(M.ckey, "Banned from [msg] - [reason]", usr)
message_admins("\blue [key_name_admin(usr)] banned [key_name_admin(M)] from [msg]", 1)
M << "\red<BIG><B>You have been jobbanned by [usr.client.ckey] from: [msg].</B></BIG>"
M << "\red <B>The reason is: [reason]</B>"
@@ -832,25 +833,7 @@
message_admins("\blue [key_name_admin(usr)] booted [key_name_admin(M)].", 1)
//M.client = null
del(M.client)
/*
//Player Notes
else if(href_list["notes"])
var/ckey = href_list["ckey"]
if(!ckey)
var/mob/M = locate(href_list["mob"])
if(ismob(M))
ckey = M.ckey
switch(href_list["notes"])
if("show")
notes_show(ckey)
if("add")
notes_add(ckey,href_list["text"])
notes_show(ckey)
if("remove")
notes_remove(ckey,text2num(href_list["from"]),text2num(href_list["to"]))
notes_show(ckey)
*/
else if(href_list["removejobban"])
if(!check_rights(R_BAN)) return
@@ -885,6 +868,7 @@
return
AddBan(M.ckey, M.computer_id, reason, usr.ckey, 1, mins)
ban_unban_log_save("[usr.client.ckey] has banned [M.ckey]. - Reason: [reason] - This will be removed in [mins] minutes.")
notes_add(M.ckey,"[usr.client.ckey] has banned [M.ckey]. - Reason: [reason] - This will be removed in [mins] minutes.",usr)
M << "\red<BIG><B>You have been banned by [usr.client.ckey].\nReason: [reason].</B></BIG>"
M << "\red This is a temporary ban, it will be removed in [mins] minutes."
feedback_inc("ban_tmp",1)
@@ -917,6 +901,7 @@
else
M << "\red No ban appeals URL has been set."
ban_unban_log_save("[usr.client.ckey] has permabanned [M.ckey]. - Reason: [reason] - This is a permanent ban.")
notes_add(M.ckey,"[usr.client.ckey] has permabanned [M.ckey]. - Reason: [reason] - This is a permanent ban.",usr)
log_admin("[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis is a permanent ban.")
message_admins("\blue[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis is a permanent ban.")
feedback_inc("ban_perma",1)