mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Ported BS12 player info system.
This commit is contained in:
@@ -116,7 +116,6 @@ var/savefile/Banlist
|
|||||||
Banlist["temp"] << temp
|
Banlist["temp"] << temp
|
||||||
if (temp)
|
if (temp)
|
||||||
Banlist["minutes"] << bantimestamp
|
Banlist["minutes"] << bantimestamp
|
||||||
notes_add(ckey, "Banned - [reason]")
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/proc/RemoveBan(foldername)
|
/proc/RemoveBan(foldername)
|
||||||
|
|||||||
@@ -168,6 +168,83 @@ 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!
|
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
|
||||||
|
|
||||||
|
/datum/admins/proc/PlayerNotes()
|
||||||
|
set category = "Admin"
|
||||||
|
set name = "Player Notes"
|
||||||
|
var/dat = "<B>Player notes</B><HR><table>"
|
||||||
|
if (!istype(src,/datum/admins))
|
||||||
|
src = usr.client.holder
|
||||||
|
if (!istype(src,/datum/admins))
|
||||||
|
usr << "Error: you are not an admin!"
|
||||||
|
return
|
||||||
|
|
||||||
|
var/savefile/S=new("data/player_notes.sav")
|
||||||
|
var/list/note_keys
|
||||||
|
S >> note_keys
|
||||||
|
if(!note_keys)
|
||||||
|
dat += "No notes found."
|
||||||
|
else
|
||||||
|
sortList(note_keys)
|
||||||
|
for(var/t in note_keys)
|
||||||
|
dat += "<tr><td><a href='?src=\ref[src];notes=show;ckey=[t]'>[t]</a></td></tr>"
|
||||||
|
dat += "</table>"
|
||||||
|
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
|
||||||
|
var/dat = "<html><head><title>Info on [key]</title></head>"
|
||||||
|
dat += "<body>"
|
||||||
|
|
||||||
|
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.<br>"
|
||||||
|
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 += "<font color=#008800>[I.content]</font> <i>by [I.author] ([I.rank])</i> on <i><font color=blue>[I.timestamp]</i></font> "
|
||||||
|
if(I.author == usr.key)
|
||||||
|
dat += "<A href='?src=\ref[src];remove_player_info=[key];remove_index=[i]'>Remove</A>"
|
||||||
|
dat += "<br><br>"
|
||||||
|
if(update_file) info << infos
|
||||||
|
|
||||||
|
dat += "<br>"
|
||||||
|
dat += "<A href='?src=\ref[src];add_player_info=[key]'>Add Comment</A><br>"
|
||||||
|
|
||||||
|
dat += "</body></html>"
|
||||||
|
usr << browse(dat, "window=adminplayerinfo;size=480x480")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/datum/admins/proc/access_news_network() //MARKER
|
/datum/admins/proc/access_news_network() //MARKER
|
||||||
set category = "Fun"
|
set category = "Fun"
|
||||||
set name = "Access Newscaster Network"
|
set name = "Access Newscaster Network"
|
||||||
@@ -979,21 +1056,6 @@ var/global/floorIsLava = 0
|
|||||||
if(istype(H))
|
if(istype(H))
|
||||||
H.regenerate_icons()
|
H.regenerate_icons()
|
||||||
|
|
||||||
/datum/admins/proc/PlayerNotes()
|
|
||||||
var/dat = "<B>Player notes</B><HR><table>"
|
|
||||||
|
|
||||||
var/savefile/S=new("data/player_notes.sav")
|
|
||||||
var/list/note_keys
|
|
||||||
S >> note_keys
|
|
||||||
if(!note_keys)
|
|
||||||
dat += "No notes found."
|
|
||||||
else
|
|
||||||
sortList(note_keys)
|
|
||||||
for(var/t in note_keys)
|
|
||||||
dat += text("<tr><td><A href='?src=\ref[src];view_player_info=[t]'>[t]</A></td></tr>")
|
|
||||||
dat += "</table>"
|
|
||||||
usr << browse(dat, "window=player_notes;size=400x400")
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//ALL DONE
|
//ALL DONE
|
||||||
|
|||||||
@@ -44,5 +44,3 @@
|
|||||||
else
|
else
|
||||||
src << "<font color='red'>Error: admin_investigate: Href Logging is not on.</font>"
|
src << "<font color='red'>Error: admin_investigate: Href Logging is not on.</font>"
|
||||||
return
|
return
|
||||||
if("notes")
|
|
||||||
holder.notes_show()
|
|
||||||
|
|||||||
@@ -130,6 +130,8 @@
|
|||||||
verbs += /client/proc/display_admin_reports
|
verbs += /client/proc/display_admin_reports
|
||||||
verbs += /datum/admins/proc/show_skills
|
verbs += /datum/admins/proc/show_skills
|
||||||
verbs += /client/proc/admin_ghost
|
verbs += /client/proc/admin_ghost
|
||||||
|
verbs += /datum/admins/proc/show_player_info
|
||||||
|
verbs += /datum/admins/proc/PlayerNotes
|
||||||
else return
|
else return
|
||||||
|
|
||||||
//Extra moderator commands
|
//Extra moderator commands
|
||||||
|
|||||||
@@ -594,7 +594,6 @@ var/list/admin_datums = list()
|
|||||||
jobban_fullban(M, job, "[reason]; By [usr.ckey] on [time2text(world.realtime)]")
|
jobban_fullban(M, job, "[reason]; By [usr.ckey] on [time2text(world.realtime)]")
|
||||||
if(!msg) msg = job
|
if(!msg) msg = job
|
||||||
else msg += ", [job]"
|
else msg += ", [job]"
|
||||||
notes_add(M.ckey, "Banned from [msg] - [reason]")
|
|
||||||
message_admins("\blue [key_name_admin(usr)] banned [key_name_admin(M)] from [msg]", 1)
|
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<BIG><B>You have been jobbanned by [usr.client.ckey] from: [msg].</B></BIG>"
|
||||||
M << "\red <B>The reason is: [reason]</B>"
|
M << "\red <B>The reason is: [reason]</B>"
|
||||||
@@ -641,25 +640,6 @@ var/list/admin_datums = list()
|
|||||||
//M.client = null
|
//M.client = null
|
||||||
del(M.client)
|
del(M.client)
|
||||||
|
|
||||||
//Player Notes
|
|
||||||
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)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
if (href_list["removejobban"])
|
if (href_list["removejobban"])
|
||||||
if ((src.rank in list("Game Admin", "Game Master" )))
|
if ((src.rank in list("Game Admin", "Game Master" )))
|
||||||
@@ -2590,3 +2570,85 @@ var/list/admin_datums = list()
|
|||||||
vsc.ChangeSettingsDialog(usr,vsc.plc.settings)
|
vsc.ChangeSettingsDialog(usr,vsc.plc.settings)
|
||||||
if(href_list["vsc"] == "default")
|
if(href_list["vsc"] == "default")
|
||||||
vsc.SetDefault(usr)
|
vsc.SetDefault(usr)
|
||||||
|
|
||||||
|
// player info stuff
|
||||||
|
|
||||||
|
if(href_list["add_player_info"])
|
||||||
|
var/key = href_list["add_player_info"]
|
||||||
|
var/add = input("Add Player Info") as null|text
|
||||||
|
if(!add) return
|
||||||
|
|
||||||
|
var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav")
|
||||||
|
var/list/infos
|
||||||
|
info >> infos
|
||||||
|
if(!infos) infos = list()
|
||||||
|
|
||||||
|
var/datum/player_info/P = new
|
||||||
|
P.author = usr.key
|
||||||
|
P.rank = usr.client.holder.rank
|
||||||
|
P.content = add
|
||||||
|
var/modifyer = "th"
|
||||||
|
switch(time2text(world.timeofday, "DD"))
|
||||||
|
if("01","21","31")
|
||||||
|
modifyer = "st"
|
||||||
|
if("02","22",)
|
||||||
|
modifyer = "nd"
|
||||||
|
if("03","23")
|
||||||
|
modifyer = "rd"
|
||||||
|
var/day_string = "[time2text(world.timeofday, "DD")][modifyer]"
|
||||||
|
if(copytext(day_string,1,2) == "0")
|
||||||
|
day_string = copytext(day_string,2)
|
||||||
|
var/full_date = time2text(world.timeofday, "DDD, Month DD of YYYY")
|
||||||
|
var/day_loc = findtext(full_date, time2text(world.timeofday, "DD"))
|
||||||
|
P.timestamp = "[copytext(full_date,1,day_loc)][day_string][copytext(full_date,day_loc+2)]"
|
||||||
|
|
||||||
|
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.")
|
||||||
|
|
||||||
|
del info
|
||||||
|
|
||||||
|
var/savefile/note_list = new("data/player_notes.sav")
|
||||||
|
var/list/note_keys
|
||||||
|
note_list >> note_keys
|
||||||
|
if(!note_keys) note_keys = list()
|
||||||
|
if(!note_keys.Find(key)) note_keys += key
|
||||||
|
note_list << note_keys
|
||||||
|
del note_list
|
||||||
|
|
||||||
|
show_player_info(key)
|
||||||
|
|
||||||
|
if(href_list["remove_player_info"])
|
||||||
|
var/key = href_list["remove_player_info"]
|
||||||
|
var/index = text2num(href_list["remove_index"])
|
||||||
|
|
||||||
|
var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav")
|
||||||
|
var/list/infos
|
||||||
|
info >> infos
|
||||||
|
if(!infos || infos.len < index) return
|
||||||
|
|
||||||
|
var/datum/player_info/item = infos[index]
|
||||||
|
infos.Remove(item)
|
||||||
|
info << infos
|
||||||
|
|
||||||
|
message_admins("\blue [key_name_admin(usr)] deleted one of [key]'s notes.")
|
||||||
|
log_admin("[key_name(usr)] deleted one of [key]'s notes.")
|
||||||
|
|
||||||
|
del info
|
||||||
|
|
||||||
|
show_player_info(key)
|
||||||
|
|
||||||
|
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")
|
||||||
|
show_player_info(ckey)
|
||||||
|
return
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
//This stuff was originally intended to be integrated into the ban-system I was working on
|
|
||||||
//but it's safe to say that'll never be finished. So I've merged it into the current player panel.
|
|
||||||
//enjoy ~Carn
|
|
||||||
|
|
||||||
#define NOTESFILE "data/player_notes.sav" //where the player notes are saved
|
|
||||||
|
|
||||||
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(ckey)
|
|
||||||
. = "<b>Notes for <a href='?src=\ref[src];notes=show'>[ckey]</a>:</b> <a href='?src=\ref[src];notes=add;ckey=[ckey]'>\[+\]</a> <a href='?src=\ref[src];notes=remove;ckey=[ckey]'>\[-\]</a><br>"
|
|
||||||
notesfile.cd = "/[ckey]"
|
|
||||||
var/index = 1
|
|
||||||
while( !notesfile.eof )
|
|
||||||
var/note
|
|
||||||
notesfile >> note
|
|
||||||
. += "[note] <a href='?src=\ref[src];notes=remove;ckey=[ckey];from=[index]'>\[-\]</a><br>"
|
|
||||||
index++
|
|
||||||
else
|
|
||||||
. = "<b>All Notes:</b> <a href='?src=\ref[src];notes=add'>\[+\]</a> <a href='?src=\ref[src];notes=remove'>\[-\]</a><br>"
|
|
||||||
notesfile.cd = "/"
|
|
||||||
for(var/dir in notesfile.dir)
|
|
||||||
. += "<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)
|
|
||||||
if(!notesfile) return
|
|
||||||
|
|
||||||
if(!ckey)
|
|
||||||
notesfile.cd = "/"
|
|
||||||
ckey = ckey(input(usr,"Who would you like to remove notes for?","Enter a ckey",null) as null|anything in notesfile.dir)
|
|
||||||
if(!ckey) return
|
|
||||||
|
|
||||||
if(start_index)
|
|
||||||
notesfile.cd = "/[ckey]"
|
|
||||||
var/list/noteslist = list()
|
|
||||||
if(!end_index) end_index = start_index
|
|
||||||
var/index = 0
|
|
||||||
while( !notesfile.eof )
|
|
||||||
index++
|
|
||||||
var/temp
|
|
||||||
notesfile >> temp
|
|
||||||
if( (start_index <= index) && (index <= end_index) )
|
|
||||||
continue
|
|
||||||
noteslist += temp
|
|
||||||
|
|
||||||
notesfile.eof = -2 //Move to the start of the buffer and then erase.
|
|
||||||
|
|
||||||
for( var/note in noteslist )
|
|
||||||
notesfile << note
|
|
||||||
else
|
|
||||||
notesfile.cd = "/"
|
|
||||||
if(alert(usr,"Are you sure you want to remove all their notes?","Confirmation","No","Yes - Remove all notes") == "Yes - Remove all notes")
|
|
||||||
notesfile.dir.Remove(ckey)
|
|
||||||
return
|
|
||||||
|
|
||||||
#undef NOTESFILE
|
|
||||||
Reference in New Issue
Block a user