You have been autobanned due to a warning by [ckey].
This is a temporary ban, it will be removed in [AUTOBANTIME] minutes."
- qdel(C)
- else
- message_admins("[key_name_admin(src)] has warned [warned_ckey] resulting in a [AUTOBANTIME] minute ban.")
- AddBan(warned_ckey, D.last_id, "Autobanning due to too many formal warnings", ckey, 1, AUTOBANTIME)
- feedback_inc("ban_warn",1)
- else
- if(C)
- C << "You have been formally warned by an administrator.
Further warnings will result in an autoban."
- message_admins("[key_name_admin(src)] has warned [key_name_admin(C)]. They have [MAX_WARNS-D.warns] strikes remaining.")
- else
- message_admins("[key_name_admin(src)] has warned [warned_ckey] (DC). They have [MAX_WARNS-D.warns] strikes remaining.")
-
- feedback_add_details("admin_verb","WARN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
-
-#undef MAX_WARNS
-#undef AUTOBANTIME
-
/client/proc/drop_bomb() // Some admin dickery that can probably be done better -- TLE
set category = "Special Verbs"
set name = "Drop Bomb"
diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm
index 7819c9a5822..ae04799354c 100644
--- a/code/modules/admin/banjob.dm
+++ b/code/modules/admin/banjob.dm
@@ -73,7 +73,7 @@ DEBUG
return
//Job permabans
- var/DBQuery/query = dbcon.NewQuery("SELECT ckey, job FROM erro_ban WHERE bantype = 'JOB_PERMABAN' AND isnull(unbanned)")
+ var/DBQuery/query = dbcon.NewQuery("SELECT ckey, job FROM ss13_ban WHERE bantype = 'JOB_PERMABAN' AND isnull(unbanned)")
query.Execute()
while(query.NextRow())
@@ -83,7 +83,7 @@ DEBUG
jobban_keylist.Add("[ckey] - [job]")
//Job tempbans
- var/DBQuery/query1 = dbcon.NewQuery("SELECT ckey, job FROM erro_ban WHERE bantype = 'JOB_TEMPBAN' AND isnull(unbanned) AND expiration_time > Now()")
+ var/DBQuery/query1 = dbcon.NewQuery("SELECT ckey, job FROM ss13_ban WHERE bantype = 'JOB_TEMPBAN' AND isnull(unbanned) AND expiration_time > Now()")
query1.Execute()
while(query1.NextRow())
diff --git a/code/modules/admin/permissionverbs/permissionedit.dm b/code/modules/admin/permissionverbs/permissionedit.dm
index 3bd563aaf58..e1cbb5da1a0 100644
--- a/code/modules/admin/permissionverbs/permissionedit.dm
+++ b/code/modules/admin/permissionverbs/permissionedit.dm
@@ -71,7 +71,7 @@
if(!istext(adm_ckey) || !istext(new_rank))
return
- var/DBQuery/select_query = dbcon.NewQuery("SELECT id FROM erro_admin WHERE ckey = '[adm_ckey]'")
+ var/DBQuery/select_query = dbcon.NewQuery("SELECT id FROM ss13_admin WHERE ckey = '[adm_ckey]'")
select_query.Execute()
var/new_admin = 1
@@ -81,16 +81,16 @@
admin_id = text2num(select_query.item[1])
if(new_admin)
- var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO `erro_admin` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
+ var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO `ss13_admin` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
insert_query.Execute()
- var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new admin [adm_ckey] to rank [new_rank]');")
+ var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new admin [adm_ckey] to rank [new_rank]');")
log_query.Execute()
usr << "\blue New admin added."
else
if(!isnull(admin_id) && isnum(admin_id))
- var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET rank = '[new_rank]' WHERE id = [admin_id]")
+ var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `ss13_admin` SET rank = '[new_rank]' WHERE id = [admin_id]")
insert_query.Execute()
- var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edited the rank of [adm_ckey] to [new_rank]');")
+ var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edited the rank of [adm_ckey] to [new_rank]');")
log_query.Execute()
usr << "\blue Admin rank changed."
@@ -123,7 +123,7 @@
if(!istext(adm_ckey) || !isnum(new_permission))
return
- var/DBQuery/select_query = dbcon.NewQuery("SELECT id, flags FROM erro_admin WHERE ckey = '[adm_ckey]'")
+ var/DBQuery/select_query = dbcon.NewQuery("SELECT id, flags FROM ss13_admin WHERE ckey = '[adm_ckey]'")
select_query.Execute()
var/admin_id
@@ -136,14 +136,14 @@
return
if(admin_rights & new_permission) //This admin already has this permission, so we are removing it.
- var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET flags = [admin_rights & ~new_permission] WHERE id = [admin_id]")
+ var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `ss13_admin` SET flags = [admin_rights & ~new_permission] WHERE id = [admin_id]")
insert_query.Execute()
- var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
+ var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
log_query.Execute()
usr << "\blue Permission removed."
else //This admin doesn't have this permission, so we are adding it.
- var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET flags = '[admin_rights | new_permission]' WHERE id = [admin_id]")
+ var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `ss13_admin` SET flags = '[admin_rights | new_permission]' WHERE id = [admin_id]")
insert_query.Execute()
- var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]')")
+ var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]')")
log_query.Execute()
usr << "\blue Permission added."
\ No newline at end of file
diff --git a/code/modules/admin/player_notes_sql.dm b/code/modules/admin/player_notes_sql.dm
new file mode 100644
index 00000000000..0a1abe7b84e
--- /dev/null
+++ b/code/modules/admin/player_notes_sql.dm
@@ -0,0 +1,262 @@
+//System will now support SQL pulls for fetching player notes.
+//Yay!
+
+/proc/notes_add_sql(var/player_ckey, var/note, var/mob/user, var/player_address, var/player_computerid)
+ if(!player_ckey || !note)
+ return
+
+ var/list/query_details = list(":ckey" = player_ckey, ":address" = player_address ? player_address : null, ":computer_id" = player_computerid ? player_computerid : null, ":a_ckey" = null, ":note" = note)
+
+ if (!user)
+ query_details[":a_ckey"] = "Adminbot"
+ else
+ query_details[":a_ckey"] = user.ckey
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ alert("SQL connection failed while trying to add a note!")
+ return
+
+ if (!player_address || !player_computerid)
+ var/DBQuery/init_query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = :ckey")
+ init_query.Execute(list(":ckey" = player_ckey))
+ if (init_query.NextRow())
+ if (!query_details[":address"])
+ query_details[":address"] = init_query.item[1]
+ if (!query_details[":computer_id"])
+ query_details[":computer_id"] = init_query.item[2]
+
+ var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_notes (id, adddate, ckey, ip, computerid, a_ckey, content) VALUES (null, Now(), :ckey, :address, :computer_id, :a_ckey, :note)")
+ insert_query.Execute(query_details)
+
+ message_admins("\blue [key_name_admin(user)] has edited [player_ckey]'s notes.")
+ log_admin("[key_name(user)] has edited [player_ckey]'s notes.")
+
+/proc/notes_edit_sql(var/note_id, var/note_edit)
+ if (!note_id || !note_edit)
+ return
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ error("SQL connection failed while attempting to delete a note!")
+ return
+
+ var/count = 0 //failsafe from unban procs
+ var/ckey
+ var/note
+
+ var/DBQuery/init_query = dbcon.NewQuery("SELECT ckey, content FROM ss13_notes WHERE id = :note_id")
+ init_query.Execute(list(":note_id" = note_id))
+ while (init_query.NextRow())
+ ckey = init_query.item[1]
+ note = init_query.item[2]
+ count++
+
+ if (count == 0)
+ usr << "\red Database update failed due to a note id not being present in the database."
+ error("Database update failed due to a note id not being present in the database.")
+ return
+
+ if (count > 1)
+ usr << "\red Database update failed due to multiple notes having the same ID. Contact the database admin."
+ error("Database update failed due to multiple notes having the same ID. Contact the database admin.")
+ return
+
+ switch (note_edit)
+ if ("delete")
+ if(alert("Delete this note?", "Delete?", "Yes", "No") == "Yes")
+ var/DBQuery/deletequery = dbcon.NewQuery("UPDATE ss13_notes SET visible = 0 WHERE id = :note_id")
+ deletequery.Execute(list(":note_id" = note_id))
+
+ message_admins("\blue [key_name_admin(usr)] deleted one of [ckey]'s notes.")
+ log_admin("[key_name(usr)] deleted one of [ckey]'s notes.")
+ else
+ usr << "Cancelled"
+ return
+ if ("content")
+ var/new_content = input("Edit this note's contents.", "New Contents", note, null) as null|text
+ if (!new_content)
+ usr << "Cancelled"
+ return
+ var/DBQuery/editquery = dbcon.NewQuery("UPDATE ss13_notes SET content = :new_content, lasteditor = :a_ckey, lasteditdate = Now(), edited = 1 WHERE id = :note_id")
+ editquery.Execute(list(":new_conent" = new_content, ":a_ckey" = usr.client.ckey, ":note_id" = note_id))
+
+/datum/admins/proc/show_notes_sql(var/player_ckey = null, var/admin_ckey = null)
+ if (!check_rights(R_ADMIN|R_MOD))
+ return
+
+ if (admin_ckey == "Adminbot")
+ usr << "Adminbot is not an actual admin. You were lied to."
+ //The fucking size of this request would be astronomical. Please do not!
+ return
+
+ player_ckey = ckey(player_ckey)
+ admin_ckey = ckey(admin_ckey)
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ error("SQL connection failed while attempting to view a player's notes!")
+ return
+
+ var/dat = "Notes Look-up Panel
"
+
+ //Totally not stealing code from the DB_ban_panel
+
+ dat += ""
+
+ dat += ""
+ dat += ""
+ dat += "| ISSUED TO | "
+ dat += "ISSUED BY | "
+ dat += "TIME ISSUED | "
+ dat += "CONTENT | "
+ dat += "
"
+
+ if (player_ckey)
+ var/list/query_details = list(":player_ckey" = player_ckey)
+
+ dat += "| Add Note |
"
+
+ var/DBQuery/init_query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = :player_ckey")
+ init_query.Execute(query_details)
+ if (init_query.NextRow())
+ query_details += ":player_address"
+ query_details += ":player_computerid"
+ query_details[":player_address"] = init_query.item[1]
+ query_details[":player_computerid"] = init_query.item[2]
+
+ var/query_content = "SELECT id, adddate, ckey, a_ckey, content, edited, lasteditor, lasteditdate FROM ss13_notes WHERE ckey = :player_ckey AND visible = '1'"
+
+ if (query_details[":player_address"])
+ query_content += " OR ip = :player_address AND visible = '1'"
+ if (query_details[":player_computerid"])
+ query_content += " OR computerid = :player_computerid AND visible = '1'"
+
+ query_content += " ORDER BY adddate ASC"
+ var/DBQuery/query = dbcon.NewQuery(query_content)
+ query.Execute(query_details, 1)
+
+ while (query.NextRow())
+ var/id = text2num(query.item[1])
+ var/date = query.item[2]
+ var/p_ckey = query.item[3]
+ var/a_ckey = query.item[4]
+ var/content = query.item[5]
+ var/edited = text2num(query.item[6])
+
+ if (admin_ckey && ckey(a_ckey) != ckey(admin_ckey))
+ continue
+ else
+ dat += "| [p_ckey] | [a_ckey] | [date] | [content] |
"
+ if (edited)
+ var/lasteditor = query.item[7]
+ var/editdate = query.item[8]
+ dat += "| Note last edited: [editdate], by: [lasteditor]. |
"
+ dat += "| (Delete) (Edit) |
"
+ dat += "|   |
"
+
+ else if (admin_ckey && !player_ckey)
+ var/aquery_content = "SELECT id, adddate, ckey, content, edited, lasteditor, lasteditdate FROM ss13_notes WHERE a_ckey = :a_ckey AND visible = '1' ORDER BY adddate ASC"
+ var/DBQuery/admin_query = dbcon.NewQuery(aquery_content)
+ admin_query.Execute(list(":a_ckey" = admin_ckey))
+
+ while (admin_query.NextRow())
+ var/id = text2num(admin_query.item[1])
+ var/date = admin_query.item[2]
+ var/p_ckey = admin_query.item[3]
+ var/content = admin_query.item[4]
+ var/edited = text2num(admin_query.item[5])
+
+ dat += "| [p_ckey] | [admin_ckey] | [date] | [content] |
"
+ if (edited)
+ var/lasteditor = admin_query.item[6]
+ var/editdate = admin_query.item[7]
+ dat += "| Note last edited: [editdate], by: [lasteditor]. |
"
+ dat += "| (Delete) (Edit) |
"
+ dat += "|   |
"
+
+ dat += "
"
+ usr << browse(dat,"window=lookupnotes;size=900x500")
+
+/*/proc/notes_transfer()
+ msg_scopes("Locating master list.")
+ var/savefile/note_list = new("data/player_notes.sav")
+ var/list/note_keys
+ note_list >> note_keys
+
+ msg_scopes("Establishing DB connection!")
+ establish_db_connection()
+ if(!dbcon.IsConnected())
+ msg_scopes("No DB connection!")
+ return
+
+ for(var/t in note_keys)
+ var/IP = null
+ var/CID = null
+ var/DBQuery/query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = '[t]'")
+ query.Execute()
+ if(query.NextRow())
+ IP = query.item[1]
+ CID = query.item[2]
+
+ var/savefile/info = new("data/player_saves/[copytext(t, 1, 2)]/[t]/info.sav")
+ var/list/infos
+ info >> infos
+
+ for(var/datum/player_info/I in infos)
+ var/a_ckey = sanitizeSQL(I.author)
+ var/timeY = copytext(I.timestamp, findtext(I.timestamp, "of") + 3)
+ var/timeM
+ var/timeD = copytext(I.timestamp, findtext(I.timestamp, " ", 6) + 1, findtext(I.timestamp, " ", 6) + 3)
+ if(findtext(timeD, "s") || findtext(timeD, "n") || findtext(timeD, "r") || findtext(timeD, "t"))
+ timeD = "0[copytext(timeD, 1, 2)]"
+
+// msg_scopes("Timestamp: [I.timestamp].")
+ var/temp = copytext(I.timestamp, 6, findtext(I.timestamp, " ", 6))
+// msg_scopes("The day? [timeD].")
+// msg_scopes("The month? [temp].")
+// msg_scopes("The year? [timeY].")
+ switch(temp)
+ if("January")
+ timeM = "01"
+ if("February")
+ timeM = "02"
+ if("March")
+ timeM = "03"
+ if("April")
+ timeM = "04"
+ if("May")
+ timeM = "05"
+ if("June")
+ timeM = "06"
+ if("July")
+ timeM = "07"
+ if("August")
+ timeM = "08"
+ if("September")
+ timeM = "09"
+ if("October")
+ timeM = "10"
+ if("November")
+ timeM = "11"
+ if("December")
+ timeM = "12"
+
+ var/DTG = "[timeY]-[timeM]-[timeD] 00:00:00"
+// msg_scopes("Full DTG: [DTG]")
+ var/insertionstuff
+ if(IP && CID)
+ insertionstuff = "INSERT INTO ss13_notes (id, adddate, ckey, ip, computerid, a_ckey, content) VALUES (null, '[DTG]', '[t]', '[IP]', '[CID]', '[a_ckey]', '[I.content]')"
+ else
+ insertionstuff = "INSERT INTO ss13_notes (id, adddate, ckey, ip, computerid, a_ckey, content) VALUES (null, '[DTG]', '[t]', null, null, '[a_ckey]', '[I.content]')"
+ var/DBQuery/insertquery = dbcon.NewQuery(insertionstuff)
+ insertquery.Execute()
+ if(insertquery.ErrorMsg())
+ msg_scopes(insertquery.ErrorMsg())
+ else
+ msg_scopes("Transfer successful.")*/
diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm
index 9a9a2b44b7f..51eea2ebbb7 100644
--- a/code/modules/admin/player_panel.dm
+++ b/code/modules/admin/player_panel.dm
@@ -82,6 +82,7 @@
body += "PM - "
body += "SM - "
body += "JMP
"
+ body += "WIND
"
if(antagonist > 0)
body += "Antagonist";
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index de178bc2980..653caf3c839 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -2641,6 +2641,49 @@
PlayerNotesPage(text2num(href_list["index"]))
return
+ else if(href_list["warnsearchckey"] || href_list["warnsearchadmin"])
+ var/adminckey = href_list["warnsearchadmin"]
+ var/playerckey = href_list["warnsearchckey"]
+
+ warning_panel(adminckey, playerckey)
+ return
+
+ else if(href_list["dbwarningedit"])
+ var/warningEdit = href_list["dbwarningedit"]
+ var/warningId = text2num(href_list["dbwarningid"])
+ if(!warningEdit || !warningId)
+ return
+
+ warningsEdit(warningId, warningEdit)
+ return
+
+ else if(href_list["dbnoteedit"])
+ var/noteedit = href_list["dbnoteedit"]
+ var/noteid = text2num(href_list["dbnoteid"])
+ if(!noteedit || !noteid)
+ return
+
+ notes_edit_sql(noteid, noteedit)
+ return
+
+ else if(href_list["notessearchckey"] || href_list["notessearchadmin"])
+ var/adminckey = href_list["notessearchadmin"]
+ var/playerckey = href_list["notessearchckey"]
+
+ show_notes_sql(playerckey, adminckey)
+ return
+
+ else if(href_list["admin_wind_player"])
+
+ var/mob/M = locate(href_list["admin_wind_player"])
+ if(!ismob(M))
+ usr << "This can only be used on instances of type /mob"
+ return
+
+ paralyze_mob(M)
+
+ return
+
mob/living/proc/can_centcom_reply()
return 0
diff --git a/code/modules/admin/verbs/check_customitem_activity.dm b/code/modules/admin/verbs/check_customitem_activity.dm
index 1bda56c6e58..8d701e26734 100644
--- a/code/modules/admin/verbs/check_customitem_activity.dm
+++ b/code/modules/admin/verbs/check_customitem_activity.dm
@@ -55,7 +55,7 @@ var/inactive_keys = "None
"
//run a query to get all ckeys inactive for over 2 months
var/list/inactive_ckeys = list()
if(ckeys_with_customitems.len)
- var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey, lastseen FROM erro_player WHERE datediff(Now(), lastseen) > 60")
+ var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey, lastseen FROM ss13_player WHERE datediff(Now(), lastseen) > 60")
query_inactive.Execute()
while(query_inactive.NextRow())
var/cur_ckey = query_inactive.item[1]
@@ -67,7 +67,7 @@ var/inactive_keys = "None
"
//if there are ckeys left over, check whether they have a database entry at all
if(ckeys_with_customitems.len)
for(var/cur_ckey in ckeys_with_customitems)
- var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE ckey = '[cur_ckey]'")
+ var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey FROM ss13_player WHERE ckey = '[cur_ckey]'")
query_inactive.Execute()
if(!query_inactive.RowCount())
inactive_ckeys += cur_ckey
diff --git a/code/modules/admin/verbs/warning.dm b/code/modules/admin/verbs/warning.dm
new file mode 100644
index 00000000000..34d5c4b3c29
--- /dev/null
+++ b/code/modules/admin/verbs/warning.dm
@@ -0,0 +1,412 @@
+/*
+ * DB based warning proc
+ */
+
+/client/proc/warn(warned_ckey)
+ if (!check_rights(R_ADMIN|R_MOD))
+ return
+
+ if (!warned_ckey || !istext(warned_ckey))
+ return
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ usr << "Error: warn(): Database Connection failed, reverting to legacy systems."
+ usr.client.warn_legacy(warned_ckey)
+ return
+
+ var/warning_reason = input("Add Warning Reason. This is visible to the player.") as null|text
+
+ if (!warning_reason)
+ return
+
+ var/warning_notes = input("Add additional informatoin. This is visible only to staff.") as null|text
+
+ var/warning_severity
+ switch (alert("Set warning severity", null, "Standard", "Severe"))
+ if ("standard")
+ warning_severity = 0
+ if ("Severe")
+ warning_severity = 1
+
+ var/warned_computerid = null
+ var/warned_ip = null
+ var/client/C = directory[warned_ckey]
+ if (C)
+ warned_computerid = C.computer_id
+ warned_ip = C.address
+ else
+ var/DBQuery/lookup_query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = :ckey")
+ lookup_query.Execute(list(":ckey" = warned_ckey))
+
+ if (lookup_query.NextRow())
+ warned_ip = lookup_query.item[1]
+ warned_computerid = lookup_query.item[2]
+
+ var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_warnings (id, time, severity, reason, notes, ckey, computerid, ip, a_ckey, a_ip, a_computerid) VALUES (null, Now(), :warning_severity, :warning_reason, :warning_notes, :warned_ckey, :warned_computerid, :warned_ip, :a_ckey, :a_ip, :a_computerid)")
+ insert_query.Execute(list(":warning_severity" = warning_severity, ":warning_reason" = warning_reason, ":warning_notes" = warning_notes, ":warned_ckey" = warned_ckey, ":warned_computerid" = warned_computerid, ":warned_ip" = warned_ip, ":a_ckey" = ckey, ":a_ip" = address, ":a_computerid" = computer_id))
+
+ notes_add_sql(warned_ckey, "Warning added by [ckey], for: [warning_reason]. || Notes regarding the warning: [warning_notes].", src, warned_ip, warned_computerid)
+
+ feedback_add_details("admin_verb", "WARN-DB")
+ if (C)
+ C << "You have been warned by an administrator.
Click here to review and acknowledge them!"
+
+ message_admins("[key_name_admin(src)] has warned [warned_ckey] for: [warning_reason].")
+
+/*
+ * Legacy warning proc
+ */
+
+#define MAX_WARNS 3
+#define AUTOBANTIME 10
+
+/client/proc/warn_legacy(warned_ckey)
+ if (!warned_ckey)
+ usr << "Error: warn_legacy(): No ckey passed!"
+ return
+
+ var/datum/preferences/D
+ var/client/C = directory[warned_ckey]
+ if(C) D = C.prefs
+ else D = preferences_datums[warned_ckey]
+
+ if(!D)
+ src << "Error: warn_legacy(): No such ckey found."
+ return
+
+ if(++D.warns >= MAX_WARNS) //uh ohhhh...you'reee iiiiin trouuuubble O:)
+ ban_unban_log_save("[ckey] warned [warned_ckey], resulting in a [AUTOBANTIME] minute autoban.")
+ if(C)
+ message_admins("[key_name_admin(src)] has warned [key_name_admin(C)] resulting in a [AUTOBANTIME] minute ban.")
+ C << "You have been autobanned due to a warning by [ckey].
This is a temporary ban, it will be removed in [AUTOBANTIME] minutes."
+ qdel(C)
+ else
+ message_admins("[key_name_admin(src)] has warned [warned_ckey] resulting in a [AUTOBANTIME] minute ban.")
+ AddBan(warned_ckey, D.last_id, "Autobanning due to too many formal warnings", ckey, 1, AUTOBANTIME)
+ feedback_inc("ban_warn",1)
+ else
+ if(C)
+ C << "You have been warned by an administrator.
Further warnings will result in an autoban."
+ message_admins("[key_name_admin(src)] has warned [key_name_admin(C)]. They have [MAX_WARNS-D.warns] strikes remaining.")
+ else
+ message_admins("[key_name_admin(src)] has warned [warned_ckey] (DC). They have [MAX_WARNS-D.warns] strikes remaining.")
+
+ feedback_add_details("admin_verb","WARN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+
+#undef MAX_WARNS
+#undef AUTOBANTIME
+
+/*
+ * A proc for a player to check their own warnings
+ */
+
+/client/verb/warnings_check()
+ set name = "My warnings"
+ set category = "OOC"
+ set desc = "Display warnings issued to you."
+
+ var/lcolor = "#ffeeee" //light colour, severity = 0
+ var/dcolor = "#ffaaaa" //dark colour, severity = 1
+ var/ecolor = "#e3e3e3" //gray colour, expired = 1
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ alert("Connection to the SQL database lost. Aborting. Please alert an Administrator or a member of staff.")
+ return
+
+ var/dat = "Warnings received
"
+
+ dat += ""
+ dat += ""
+ dat += "| ADMIN | "
+ dat += "TIME ISSUED | "
+ dat += "REASON | "
+ dat += "
"
+
+ var/DBQuery/search_query = dbcon.NewQuery("SELECT id, time, severity, reason, a_ckey, acknowledged, expired FROM ss13_warnings WHERE visible = 1 AND (ckey = :ckey OR computerid = :computer_id OR ip = :address) ORDER BY time DESC;")
+ search_query.Execute(list(":ckey" = ckey, ":computer_id" = computer_id, ":address" = address))
+
+ while (search_query.NextRow())
+ var/id = text2num(search_query.item[1])
+ var/time = search_query.item[2]
+ var/severity = text2num(search_query.item[3])
+ var/reason = search_query.item[4]
+ var/a_ckey = search_query.item[5]
+ var/ackn = text2num(search_query.item[6])
+ var/expired = text2num(search_query.item[7])
+
+ var/bgcolor = lcolor
+
+ if (severity)
+ bgcolor = dcolor
+
+ if (expired)
+ bgcolor = ecolor
+
+ dat += ""
+ dat += "| [a_ckey] | "
+ dat += "[time] | "
+ dat += "[reason] | "
+ dat += "
"
+
+ if (!ackn)
+ dat += "| (Acknowledge Warning) |
"
+ else if (expired)
+ dat += "| Warning expired and no longer active! |
"
+ else
+ dat += "| Warning acknowledged! |
"
+
+ dat += ""
+ dat += "|   | "
+ dat += "
"
+
+ dat += "
"
+ usr << browse(dat, "window=mywarnings;size=900x500")
+
+/*
+ * A proc for acknowledging a warning
+ */
+
+/client/proc/warnings_acknowledge(warning_id)
+ if (!warning_id)
+ return
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ alert("Connection to SQL database failed while attempting to update your warning's status!")
+ return
+
+ var/DBQuery/query = dbcon.NewQuery("UPDATE ss13_warnings SET acknowledged = 1 WHERE id = :warning_id;")
+ query.Execute(list(":warning_id" = warning_id))
+
+ warnings_check()
+
+/*
+ * A proc to alert you if you have unacknowledged warnings.
+ * Called in /client/New (client procs.dm)
+ */
+
+/client/proc/warnings_alert()
+ var/count = 0
+ var/count_expire = 0
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ return
+
+ var/list/client_details = list(":ckey" = ckey, ":computer_id" = computer_id, ":address" = address)
+
+ var/DBQuery/expire_query = dbcon.NewQuery("SELECT id FROM ss13_warnings WHERE (acknowledged = 1 AND expired = 0 AND DATE_SUB(CURDATE(),INTERVAL 3 MONTH) > time) AND (ckey = :ckey OR computerid = :computer_id OR ip = :address)")
+ expire_query.Execute(client_details)
+ while (expire_query.NextRow())
+ var/warning_id = text2num(expire_query.item[1])
+ var/DBQuery/update_query = dbcon.NewQuery("UPDATE ss13_warnings SET expired = 1 WHERE id = :warning_id")
+ update_query.Execute(list(":warning_id" = warning_id))
+ count_expire++
+
+ var/DBQuery/query = dbcon.NewQuery("SELECT id FROM ss13_warnings WHERE (visible = 1 AND acknowledged = 0 AND expired = 0) AND (ckey = :ckey OR computerid = :computer_id OR ip = :address)")
+ query.Execute(client_details)
+ while (query.NextRow())
+ count++
+
+ if (count)
+ src << "
"
+ src << "You have [count] unread [count > 1 ? "warnings" : "warning"]! Click here to review and acknowledge them!"
+ if (count_expire)
+ src << "
"
+ src << "[count_expire] of your warnings expired."
+
+/*
+ * A proc for an admin/moderator to look up a member's warnings.
+ */
+
+/client/proc/warning_panel()
+ set category = "Admin"
+ set name = "Warnings Panel"
+ set desc = "Look-up warnings assigned to players."
+
+ if(!holder)
+ return
+
+ holder.warning_panel()
+
+/datum/admins/proc/warning_panel(var/adminckey = null, var/playerckey = null)
+ if (!check_rights(R_ADMIN|R_MOD))
+ return
+
+ var/lcolor = "#ffeeee" //light colour, severity = 0
+ var/dcolor = "#ffdddd" //dark colour, severity = 1
+ var/ecolor = "#e3e3e3" //gray colour, expired = 1
+
+ establish_db_connection()
+ if (!dbcon.IsConnected())
+ alert("Connection to the SQL database lost. Aborting. Please alert the database admin!")
+ return
+
+ var/dat = "Warning Look-up Panel
"
+
+ //Totally not stealing code from the DB_ban_panel
+
+ dat += ""
+
+ if (adminckey || playerckey)
+
+ dat += ""
+ dat += ""
+ dat += "| ISSUED TO | "
+ dat += "ISSUED BY | "
+ dat += "TIME ISSUED | "
+ dat += "REASON | "
+ dat += "
"
+
+ var/list/query_details = list("a_ckey", "ckey")
+ var/paramone = ""
+ var/paramtwo = ""
+ if(adminckey)
+ paramone = "AND a_ckey = :a_ckey "
+ query_details["a_ckey"] = adminckey
+ if(playerckey)
+ paramtwo = "AND ckey = :ckey "
+ query_details["ckey"] = playerckey
+
+ var/DBQuery/search_query = dbcon.NewQuery("SELECT id, time, severity, reason, notes, ckey, a_ckey, acknowledged, expired, edited, lasteditor, lasteditdate FROM ss13_warnings WHERE visible = 1 [paramone] [paramtwo] ORDER BY time DESC;")
+ search_query.Execute(query_details, 1)
+
+ while (search_query.NextRow())
+ var/id = text2num(search_query.item[1])
+ var/time = search_query.item[2]
+ var/severity = text2num(search_query.item[3])
+ var/reason = search_query.item[4]
+ var/notes = search_query.item[5]
+ var/ckey = search_query.item[6]
+ var/a_ckey = search_query.item[7]
+ var/ackn = text2num(search_query.item[8])
+ var/expired = text2num(search_query.item[9])
+ var/edited = text2num(search_query.item[10])
+
+ var/bgcolor = lcolor
+
+ if(severity)
+ bgcolor = dcolor
+ if(expired)
+ bgcolor = ecolor
+
+ dat += ""
+ dat += "| [ckey] | "
+ dat += "[a_ckey] | "
+ dat += "[time] | "
+ dat += "[reason] | "
+ dat += "
"
+ dat += ""
+ dat += "| Staff Notes: \"[notes]\" | "
+ dat += "
"
+ if(!ackn)
+ dat += "| Warning has not been acknolwedged by recipient. |
"
+ if(expired)
+ dat += "| The warning has expired. |
"
+ if(edited)
+ var/lastEditor = search_query.item[11]
+ var/lastEditDate = search_query.item[12]
+ dat += "| Warning last edited: [lastEditDate], by: [lastEditor]. |
"
+ dat += ""
+ dat += "| Options: "
+ if(check_rights(R_ADMIN) || a_ckey == sanitizeSQL(ckey))
+ dat += "Edit Reason "
+ dat += "Edit Note "
+ dat += "Delete Warning"
+ else
+ dat += "You can only edit or delete notes that you have issued."
+ dat += " | "
+ dat += "
"
+
+ dat += ""
+ dat += "|   | "
+ dat += "
"
+
+ dat +="
"
+
+ usr << browse(dat, "window=lookupwarns;size=900x500")
+ feedback_add_details("admin_verb","WARN-LKUP")
+
+/*
+ * A proc for editing and deleting warnings issued
+ */
+
+/proc/warningsEdit(var/warning_id, var/warning_edit)
+ if(!warning_id || !warning_edit)
+ return
+
+ establish_db_connection()
+ if(!dbcon.IsConnected())
+ alert("Connection to the SQL database lost. Aborting. Please alert the database admin!")
+ return
+
+ var/count = 0 //failsafe
+ var/ckey
+ var/reason
+ var/notes
+ var/list/query_details = list(":warning_id" = warning_id, ":a_ckey" = usr.ckey)
+
+ var/DBQuery/initial_query = dbcon.NewQuery("SELECT ckey, reason, notes FROM ss13_warnings WHERE id = :warning_id")
+ initial_query.Execute(query_details, 1)
+ while (initial_query.NextRow())
+ ckey = initial_query.item[1]
+ reason = initial_query.item[2]
+ notes = initial_query.item[3]
+ count++
+
+ if (count == 0)
+ usr << "\red Database update failed due to a warning id not being present in the database."
+ error("Database update failed due to a warning id not being present in the database.")
+ return
+
+ if (count > 1)
+ usr << "\red Database update failed due to multiple warnings having the same ID. Contact the database admin."
+ error("Database update failed due to multiple warnings having the same ID. Contact the database admin.")
+ return
+
+ switch (warning_edit)
+ if ("delete")
+ if(alert("Delete this warning?", "Delete?", "Yes", "No") == "Yes")
+ var/DBQuery/deleteQuery = dbcon.NewQuery("UPDATE ss13_warnings SET visible = 0 WHERE id = :warning_id")
+ deleteQuery.Execute(query_details)
+
+ message_admins("\blue [key_name_admin(usr)] deleted one of [ckey]'s warnings.")
+ log_admin("[key_name(usr)] deleted one of [ckey]'s warnings.")
+ else
+ usr << "Cancelled"
+ return
+
+ if ("editReason")
+ query_details += ":new_reason"
+ query_details[":new_reason"] = input("Edit this warning's reason.", "New Reason", reason, null) as null|text
+
+ if(!query_details[":new_reason"] || query_details[":new_reason"] == reason)
+ usr << "Cancelled"
+ return
+
+ var/DBQuery/reason_query = dbcon.NewQuery("UPDATE ss13_warnings SET reason = :new_reason, edited = 1, lasteditor = :a_ckey, lasteditdate = NOW() WHERE id = :warning_id")
+ reason_query.Execute(query_details, 1)
+
+ message_admins("\blue [key_name_admin(usr)] edited one of [ckey]'s warning reasons.")
+ log_admin("[key_name(usr)] edited one of [ckey]'s warning reasons.")
+
+ if("editNotes")
+ query_details += ":new_notes"
+ query_details[":new_notes"] = input("Edit this warning's notes.", "New Notes", notes, null) as null|text
+
+ if(!query_details[":new_notes"] || query_details[":new_notes"] == notes)
+ usr << "Cancelled"
+ return
+
+ var/DBQuery/notes_query = dbcon.NewQuery("UPDATE ss13_warnings SET notes = :new_notes, edited = 1, lasteditor = :a_ckey, lasteditdate = NOW() WHERE id = :warning_id")
+ notes_query.Execute(query_details, 1)
+
+ message_admins("\blue [key_name_admin(usr)] edited one of [ckey]'s warning notes.")
+ log_admin("[key_name(usr)] edited one of [ckey]'s warning notes.")
diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm
index 1155882b82e..bbb2359f13e 100644
--- a/code/modules/client/client defines.dm
+++ b/code/modules/client/client defines.dm
@@ -45,5 +45,6 @@
var/player_age = "Requires database" //So admins know why it isn't working - Used to determine how old the account is - in days.
var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
+ var/whitelist_status = 0 //Used to determine what whitelists the player has access to. Uses bitflag values!
preload_rsc = 0 // This is 0 so we can set it to an URL once the player logs in and have them download the resources from a different server.
diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm
index 3ee7ebcdebe..d47c438443c 100644
--- a/code/modules/client/client procs.dm
+++ b/code/modules/client/client procs.dm
@@ -164,6 +164,8 @@
sleep(2) // wait a bit more, possibly fixes hardware mode not re-activating right
winset(src, null, "command=\".configure graphics-hwmode on\"")
+ warnings_alert()
+
log_client_to_db()
send_resources()
@@ -200,7 +202,7 @@
var/sql_ckey = sql_sanitize_text(ckey(key))
- var/DBQuery/query = dbcon.NewQuery("SELECT datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
+ var/DBQuery/query = dbcon.NewQuery("SELECT datediff(Now(),firstseen) as age FROM ss13_player WHERE ckey = '[sql_ckey]'")
query.Execute()
if(query.NextRow())
@@ -220,23 +222,24 @@
var/sql_ckey = sql_sanitize_text(src.ckey)
- var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
+ var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age, whitelist_status FROM ss13_player WHERE ckey = '[sql_ckey]'")
query.Execute()
var/sql_id = 0
player_age = 0 // New players won't have an entry so knowing we have a connection we set this to zero to be updated if their is a record.
while(query.NextRow())
sql_id = query.item[1]
player_age = text2num(query.item[2])
+ whitelist_status = text2num(query.item[3])
break
- var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE ip = '[address]'")
+ var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM ss13_player WHERE ip = '[address]'")
query_ip.Execute()
related_accounts_ip = ""
while(query_ip.NextRow())
related_accounts_ip += "[query_ip.item[1]], "
break
- var/DBQuery/query_cid = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE computerid = '[computer_id]'")
+ var/DBQuery/query_cid = dbcon.NewQuery("SELECT ckey FROM ss13_player WHERE computerid = '[computer_id]'")
query_cid.Execute()
related_accounts_cid = ""
while(query_cid.NextRow())
@@ -261,16 +264,16 @@
if(sql_id)
//Player already identified previously, we need to just update the 'lastseen', 'ip' and 'computer_id' variables
- var/DBQuery/query_update = dbcon.NewQuery("UPDATE erro_player SET lastseen = Now(), ip = '[sql_ip]', computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]' WHERE id = [sql_id]")
+ var/DBQuery/query_update = dbcon.NewQuery("UPDATE ss13_player SET lastseen = Now(), ip = '[sql_ip]', computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]' WHERE id = [sql_id]")
query_update.Execute()
else
//New player!! Need to insert all the stuff
- var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO erro_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')")
+ var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO ss13_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')")
query_insert.Execute()
//Logging player access
var/serverip = "[world.internet_address]:[world.port]"
- var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `erro_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');")
+ var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `ss13_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');")
query_accesslog.Execute()
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 7e69a279bea..eedd4b9136a 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -19,7 +19,8 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
"raider" = IS_MODE_COMPILED("heist"), // 11
"diona" = 1, // 12
"loyalist" = IS_MODE_COMPILED("revolution"), // 13
- "pAI candidate" = 1, // -- TLE // 14
+ "vampire" = IS_MODE_COMPILED("vampire"), // 14
+ "pAI candidate" = 1, // -- TLE // 15
)
//used for alternate_option
@@ -45,6 +46,7 @@ datum/preferences
var/be_special = 0 //Special role selection
var/UI_style = "Midnight"
var/toggles = TOGGLES_DEFAULT
+ var/asfx_togs = ASFX_DEFAULT
var/UI_style_color = "#ffffff"
var/UI_style_alpha = 255
@@ -647,7 +649,7 @@ datum/preferences
if(config.usealienwhitelist) //If we're using the whitelist, make sure to check it!
if(!(current_species.flags & CAN_JOIN))
restricted = 2
- else if((current_species.flags & IS_WHITELISTED) && !is_alien_whitelisted(user,current_species))
+ else if((current_species.flags & IS_WHITELISTED) && !is_alien_whitelisted(user,current_species.name))
restricted = 1
if(restricted)
@@ -655,7 +657,7 @@ datum/preferences
dat += "You cannot play as this species.If you wish to be whitelisted, you can make an application post on the forums."
else if(restricted == 2)
dat += "You cannot play as this species.This species is not available for play as a station race.."
- if(!restricted || check_rights(R_ADMIN, 0))
+ if(!restricted)
dat += "\[select\]"
dat += "