mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 21:12:24 +01:00
Porting Apollo Infractions Computer (#1033)
Ports Apollo's infraction's system, creating a permanent criminal record for every character. Every minor or medium infraction accrued over the course of a round is added to the character's permanent security record which is available at vanilla records councils. Antagonists are automatically exempt from this process, and players can exercise control over what charges they consider canon or not. Brigging a person is now dependent on the criminal sentencing computer, which reads a person's ID and applies a brig timer automatically for the charges selected. Personnel without ID's will have to be brigged manually.
This commit is contained in:
@@ -25,7 +25,8 @@
|
||||
/datum/category_item/player_setup_item/general/background/gather_load_query()
|
||||
return list("ss13_characters_flavour" = list("vars" = list("records_employment" = "gen_record",
|
||||
"records_medical" = "med_record",
|
||||
"records_security" = "sec_record"),
|
||||
"records_security" = "sec_record",
|
||||
"records_ccia" = "ccia_record"),
|
||||
"args" = list("char_id")),
|
||||
"ss13_characters" = list("vars" = list("home_system", "citizenship", "faction", "religion"), "args" = list("id")))
|
||||
|
||||
|
||||
@@ -19,20 +19,20 @@
|
||||
S["memo_hash"] << pref.memo_hash
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/settings/gather_load_query()
|
||||
return list("ss13_player_preferences" = list("vars" = list("lastchangelog", "current_character", "toggles", "asfx_toggles" = "asfx_togs", "motd_hash", "memo_hash"), "args" = list("ckey")))
|
||||
return list("ss13_player_preferences" = list("vars" = list("lastchangelog", "current_character", "toggles", "asfx_togs" = "asfx_toggles", "motd_hash", "memo_hash"), "args" = list("ckey")))
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/settings/gather_load_parameters()
|
||||
return list(":ckey" = pref.client.ckey)
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/settings/gather_save_query()
|
||||
return list("ss13_player_preferences" = list("lastchangelog", "current_character", "toggles", "asfx_toggles", "motd_hash", "memo_hash", "ckey" = 1))
|
||||
return list("ss13_player_preferences" = list("lastchangelog", "current_character", "toggles", "asfx_togs", "motd_hash", "memo_hash", "ckey" = 1))
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/settings/gather_save_parameters()
|
||||
return list(":ckey" = pref.client.ckey,
|
||||
":lastchangelog" = pref.lastchangelog,
|
||||
":current_character" = pref.current_character,
|
||||
":toggles" = pref.toggles,
|
||||
":asfx_toggles" = pref.asfx_togs,
|
||||
":asfx_togs" = pref.asfx_togs,
|
||||
":motd_hash" = pref.motd_hash,
|
||||
":memo_hash" = pref.memo_hash)
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/datum/category_item/player_setup_item/other/incidents
|
||||
name = "Incidents"
|
||||
sort_order = 7
|
||||
|
||||
/datum/category_item/player_setup_item/other/incidents/load_special(var/savefile/S)
|
||||
pref.incidents = list()
|
||||
|
||||
//Special Aurora Snowflake to load in the ccia actions and persistant incidents
|
||||
if (config.sql_saves) // Doesnt work without db
|
||||
//Load in the CCIA Actions
|
||||
var/DBQuery/ccia_action_query = dbcon.NewQuery({"SELECT
|
||||
act.title,
|
||||
act.type,
|
||||
act.issuedby,
|
||||
act.details,
|
||||
act.url,
|
||||
act.expires_at
|
||||
FROM ss13_ccia_action_char act_chr
|
||||
JOIN ss13_characters chr ON act_chr.char_id = chr.id
|
||||
JOIN ss13_ccia_actions act ON act_chr.action_id = act.id
|
||||
WHERE
|
||||
act_chr.char_id = ':char_id' AND
|
||||
(act.expires_at IS NULL OR act.expires_at >= CURRENT_DATE()) AND
|
||||
act.deleted_at IS NULL;
|
||||
"})
|
||||
if (!ccia_action_query.Execute(list(":char_id" = pref.current_character)))
|
||||
error("Error CCIA Actions for character #[pref.current_character]. SQL error message: '[ccia_action_query.ErrorMsg()]'.")
|
||||
|
||||
while(ccia_action_query.NextRow())
|
||||
var/list/action = list(
|
||||
ccia_action_query.item[1],
|
||||
ccia_action_query.item[2],
|
||||
ccia_action_query.item[3],
|
||||
ccia_action_query.item[4],
|
||||
ccia_action_query.item[5],
|
||||
ccia_action_query.item[6]
|
||||
)
|
||||
pref.ccia_actions.Add(list(action))
|
||||
|
||||
//Load in the infractions
|
||||
var/DBQuery/char_infraction_query = dbcon.NewQuery({"SELECT
|
||||
id, char_id, UID, datetime, notes, charges, evidence, arbiters, brig_sentence, fine, felony
|
||||
FROM ss13_character_incidents
|
||||
WHERE
|
||||
char_id = ':char_id' AND deleted_at IS NULL
|
||||
"})
|
||||
char_infraction_query.Execute(list(":char_id" = pref.current_character))
|
||||
|
||||
while(char_infraction_query.NextRow())
|
||||
var/datum/char_infraction/infraction = new()
|
||||
infraction.db_id = text2num(char_infraction_query.item[1])
|
||||
infraction.char_id = text2num(char_infraction_query.item[2])
|
||||
infraction.UID = char_infraction_query.item[3]
|
||||
infraction.datetime = char_infraction_query.item[4]
|
||||
infraction.notes = char_infraction_query.item[5]
|
||||
infraction.charges = json_decode(char_infraction_query.item[6])
|
||||
infraction.evidence = json_decode(char_infraction_query.item[7])
|
||||
infraction.arbiters = json_decode(char_infraction_query.item[8])
|
||||
infraction.brig_sentence = text2num(char_infraction_query.item[9])
|
||||
infraction.fine = text2num(char_infraction_query.item[10])
|
||||
infraction.felony = text2num(char_infraction_query.item[11])
|
||||
pref.incidents.Add(infraction)
|
||||
log_debug("Added infraction with [infraction.UID]")
|
||||
|
||||
|
||||
/datum/category_item/player_setup_item/other/incidents/content(var/mob/user)
|
||||
. += "<b>Incident Information</b><br>"
|
||||
. += "The following incidents are on file for your character<br>"
|
||||
for (var/datum/char_infraction/I in pref.incidents)
|
||||
. += "<hr>"
|
||||
. += "UID: [I.UID]<br>"
|
||||
. += "Date/Time: [I.datetime]<br>"
|
||||
. += "Charges: "
|
||||
for (var/L in I.charges)
|
||||
. += "[L], "
|
||||
if (I.fine == 0)
|
||||
. += "<br>Brig Sentence: [I.getBrigSentence()] <br>"
|
||||
else
|
||||
. += "Fine: [I.fine] Credits<br>"
|
||||
. += "Notes: <br>"
|
||||
if (I.notes != "")
|
||||
. += nl2br(I.notes)
|
||||
else
|
||||
. += "- No Summary Entered -"
|
||||
. += "<br><a href='?src=\ref[src];details_sec_incident=[I.db_id]'>Show Details</a><br><a href='?src=\ref[src];del_sec_incident=[I.db_id]'>Delete Incident</a>"
|
||||
|
||||
/datum/category_item/player_setup_item/other/incidents/OnTopic(var/href,var/list/href_list, var/mob/user)
|
||||
if(href_list["del_sec_incident"])
|
||||
var/search_incident = text2num(href_list["del_sec_incident"])
|
||||
var/confirm = alert(user,"Do you want to delete that incident ?","Delete Incident","Yes","No")
|
||||
|
||||
if(!search_incident || !CanUseTopic(user) || confirm == "No")
|
||||
return TOPIC_NOACTION
|
||||
|
||||
for(var/datum/char_infraction/I in pref.incidents)
|
||||
if(I.db_id == search_incident && I.char_id == pref.current_character)
|
||||
I.deleteFromDB("user")
|
||||
qdel(I)
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["details_sec_incident"])
|
||||
if(!CanUseTopic(user))
|
||||
return TOPIC_NOACTION
|
||||
|
||||
var/list/params = list("location" = "security_incident", "incident" = href_list["details_sec_incident"])
|
||||
usr.client.process_webint_link("interface/login/sso_server", list2params(params))
|
||||
|
||||
return ..()
|
||||
@@ -32,6 +32,11 @@
|
||||
category_item_type = /datum/category_item/player_setup_item/player_global
|
||||
sql_role = SQL_PREFERENCES
|
||||
|
||||
/datum/category_group/player_setup_category/other_preferences
|
||||
name = "Other"
|
||||
sort_order = 6
|
||||
category_item_type = /datum/category_item/player_setup_item/other
|
||||
|
||||
/****************************
|
||||
* Category Collection Setup *
|
||||
****************************/
|
||||
@@ -131,6 +136,7 @@
|
||||
handle_sql_loading(SQL_CHARACTER)
|
||||
|
||||
for(var/datum/category_item/player_setup_item/PI in items)
|
||||
PI.load_special(S)
|
||||
PI.sanitize_character(config.sql_saves)
|
||||
|
||||
/datum/category_group/player_setup_category/proc/save_character(var/savefile/S)
|
||||
@@ -205,11 +211,17 @@
|
||||
return sort_order
|
||||
|
||||
/*
|
||||
* Called when the item is asked to load per character settings
|
||||
* Called when the item is asked to load per character settings - Only called when sql saves are disabled or unavailable
|
||||
*/
|
||||
/datum/category_item/player_setup_item/proc/load_character(var/savefile/S)
|
||||
return
|
||||
|
||||
/*
|
||||
* Called no matter if sql safes are enabled or disabled
|
||||
*/
|
||||
/datum/category_item/player_setup_item/proc/load_special(var/savefile/S)
|
||||
return
|
||||
|
||||
/*
|
||||
* Called when the item is asked to save per character settings
|
||||
*/
|
||||
|
||||
@@ -162,6 +162,8 @@
|
||||
for (var/variable in var_names)
|
||||
if (isnull(var_names[variable]))
|
||||
query += " [variable] = [arg_names[i]]"
|
||||
if (i < var_names.len)
|
||||
query += ", "
|
||||
|
||||
i++
|
||||
|
||||
|
||||
Reference in New Issue
Block a user