Skip to content
This repository has been archived by the owner on Oct 15, 2023. It is now read-only.

feat: Exploitable Records #162

Merged
merged 8 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SQL/paradise_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ CREATE TABLE `characters` (
`med_record` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`sec_record` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`gen_record` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exploit_record` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`disabilities` mediumint(8) NOT NULL,
`player_alt_titles` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`organ_data` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
Expand Down
4 changes: 4 additions & 0 deletions SQL/updates/31-32.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Updating SQL from 31 to 32 -Larentoun
# Add exploit records
ALTER TABLE `characters`
ADD COLUMN `exploit_record` longtext COLLATE utf8mb4_unicode_ci NOT NULL AFTER `gen_record`;
2 changes: 1 addition & 1 deletion code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@
#define EXPLOSION_BLOCK_PROC -1

// The SQL version required by this version of the code
#define SQL_VERSION 31
#define SQL_VERSION 32

// Vending machine stuff
#define CAT_NORMAL 1
Expand Down
2 changes: 2 additions & 0 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ GLOBAL_VAR_INIT(record_id_num, 1001)
G.fields["photo-west"] = "data:image/png;base64,[icon2base64(icon(G.fields["photo"], dir = WEST))]"
if(H.gen_record && !jobban_isbanned(H, "Records"))
G.fields["notes"] = H.gen_record
G.fields["exploit_record"] = H.exploit_record
else
G.fields["notes"] = "No notes found."
G.fields["exploit_record"] = "No notes found."
general += G

//Medical Record
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/devices/uplinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ GLOBAL_LIST_EMPTY(world_uplinks)
"age" = html_encode(L.fields["age"]),
"species" = html_encode(L.fields["species"]),
"rank" = html_encode(L.fields["rank"]),
"fingerprint" = html_encode(L.fields["fingerprint"])
"fingerprint" = html_encode(L.fields["fingerprint"]),
"exploit_record" = html_encode(L.fields["exploit_record"]),
))

data["exploitable"] = exploitable
Expand Down
25 changes: 22 additions & 3 deletions code/modules/client/preference/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
var/med_record = ""
var/sec_record = ""
var/gen_record = ""
var/exploit_record = ""
var/disabilities = 0

var/nanotrasen_relation = "Neutral"
Expand Down Expand Up @@ -1091,11 +1092,18 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
HTML += "<br><a href=\"byond://?_src_=prefs;preference=records;task=sec_record\">Security Records</a><br>"

if(length(sec_record) <= 40)
HTML += "[sec_record]<br>"
HTML += "[sec_record]"
else
HTML += "[copytext_char(sec_record, 1, 37)]...<br>"
HTML += "[copytext_char(sec_record, 1, 37)]..."

HTML += "<a href=\"byond://?_src_=prefs;preference=records;records=-1\">\[Done\]</a>"
HTML += "<br><a href=\"byond://?_src_=prefs;preference=records;task=exploit_record\">Exploitable Records</a><br>"

if(length(exploit_record) <= 40)
HTML += "[exploit_record]"
else
HTML += "[copytext_char(exploit_record, 1, 37)]..."

HTML += "<br><br><a href=\"byond://?_src_=prefs;preference=records;records=-1\">\[Done\]</a>"
HTML += "</center></tt>"

var/datum/browser/popup = new(user, "records", "<div align='center'>Character Records</div>", 350, 300)
Expand Down Expand Up @@ -1353,6 +1361,16 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
gen_record = genmsg
SetRecords(user)

if(href_list["task"] == "exploit_record")
var/expmsg = input(usr,"Set your exploitable notes here. This info is available to traitors only.","Exploitable Records",html_decode(exploit_record)) as message

if(expmsg != null)
expmsg = copytext(expmsg, 1, MAX_PAPER_MESSAGE_LEN)
expmsg = html_encode(expmsg)

exploit_record = expmsg
SetRecords(user)

if(href_list["preference"] == "gear")
if(href_list["toggle_gear"])
var/datum/gear/TG = GLOB.gear_datums[href_list["toggle_gear"]]
Expand Down Expand Up @@ -2559,6 +2577,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
character.med_record = med_record
character.sec_record = sec_record
character.gen_record = gen_record
character.exploit_record = exploit_record

character.change_gender(gender)
character.age = age
Expand Down
43 changes: 26 additions & 17 deletions code/modules/client/preference/preferences_mysql.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
med_record,
sec_record,
gen_record,
exploit_record,
disabilities,
player_alt_titles,
organ_data,
Expand Down Expand Up @@ -285,6 +286,7 @@
med_record = query.item[40]
sec_record = query.item[41]
gen_record = query.item[42]
exploit_record = query.item[43]
// Apparently, the preceding vars weren't always encoded properly...
if(findtext(flavor_text, "<")) // ... so let's clumsily check for tags!
flavor_text = html_encode(flavor_text)
Expand All @@ -294,31 +296,33 @@
sec_record = html_encode(sec_record)
if(findtext(gen_record, "<"))
gen_record = html_encode(gen_record)
disabilities = text2num(query.item[43])
player_alt_titles = params2list(query.item[44])
organ_data = params2list(query.item[45])
rlimb_data = params2list(query.item[46])
nanotrasen_relation = query.item[47]
speciesprefs = text2num(query.item[48])
if(findtext(exploit_record, "<"))
exploit_record = html_encode(exploit_record)
disabilities = text2num(query.item[44])
player_alt_titles = params2list(query.item[45])
organ_data = params2list(query.item[46])
rlimb_data = params2list(query.item[47])
nanotrasen_relation = query.item[48]
speciesprefs = text2num(query.item[49])

//socks
socks = query.item[49]
body_accessory = query.item[50]
loadout_gear = params2list(query.item[51])
autohiss_mode = text2num(query.item[52])
uplink_pref = query.item[53]
socks = query.item[50]
body_accessory = query.item[51]
loadout_gear = params2list(query.item[52])
autohiss_mode = text2num(query.item[53])
uplink_pref = query.item[54]

// TTS
tts_seed = query.item[54]
tts_seed = query.item[55]

//Emotes
custom_emotes_tmp = query.item[55]
custom_emotes_tmp = query.item[56]

// Gradient
h_grad_style = query.item[56]
h_grad_offset_x = query.item[57] // parsed down below
h_grad_colour = query.item[58]
h_grad_alpha = query.item[59]
h_grad_style = query.item[57]
h_grad_offset_x = query.item[58] // parsed down below
h_grad_colour = query.item[59]
h_grad_alpha = query.item[60]

saved = TRUE

Expand Down Expand Up @@ -467,6 +471,7 @@
med_record=:med_record,
sec_record=:sec_record,
gen_record=:gen_record,
exploit_record=:exploit_record,
player_alt_titles=:playertitlelist,
disabilities=:disabilities,
organ_data=:organlist,
Expand Down Expand Up @@ -529,6 +534,7 @@
"med_record" = med_record,
"sec_record" = sec_record,
"gen_record" = gen_record,
"exploit_record" = exploit_record,
"playertitlelist" = (playertitlelist ? playertitlelist : ""), // This it intentnional. It wont work without it!
"disabilities" = disabilities,
"organlist" = (organlist ? organlist : ""),
Expand Down Expand Up @@ -585,6 +591,7 @@
med_record,
sec_record,
gen_record,
exploit_record,
player_alt_titles,
disabilities, organ_data, rlimb_data, nanotrasen_relation, speciesprefs,
socks, body_accessory, gear, autohiss, hair_gradient, hair_gradient_offset, hair_gradient_colour, hair_gradient_alpha, uplink_pref, tts_seed, custom_emotes)
Expand Down Expand Up @@ -613,6 +620,7 @@
:med_record,
:sec_record,
:gen_record,
:exploit_record,
:playertitlelist,
:disabilities, :organlist, :rlimblist, :nanotrasen_relation, :speciesprefs,
:socks, :body_accessory, :gearlist, :autohiss_mode, :h_grad_style, :h_grad_offset, :h_grad_colour, :h_grad_alpha, :uplink_pref, :tts_seed, :custom_emotes)
Expand Down Expand Up @@ -663,6 +671,7 @@
"med_record" = med_record,
"sec_record" = sec_record,
"gen_record" = gen_record,
"exploit_record" = exploit_record,
"playertitlelist" = (playertitlelist ? playertitlelist : ""), // This it intentnional. It wont work without it!
"disabilities" = disabilities,
"organlist" = (organlist ? organlist : ""),
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
var/med_record = ""
var/sec_record = ""
var/gen_record = ""
var/exploit_record = ""
var/lying = 0
var/lying_prev = 0
var/lastpuke = 0
Expand Down
2 changes: 1 addition & 1 deletion config/example/dbconfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## This value must be set to the version of the paradise schema in use.
## If this value does not match, the SQL database will not be loaded and an error will be generated.
## Roundstart will be delayed.
DB_VERSION 31
DB_VERSION 32

## Server the MySQL database can be found at.
# Examples: localhost, 200.135.5.43, www.mysqldb.com, etc.
Expand Down
3 changes: 3 additions & 0 deletions tgui/packages/tgui/interfaces/Uplink.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ const ExploitableInfoPage = (_properties, context) => {
<Box>Sex: {selectedRecord.sex}</Box>
<Box>Species: {selectedRecord.species}</Box>
</Section>
<Section title={"Exploitable Records"}>
<Box prewrap>{selectedRecord.exploit_record}</Box>
</Section>
</Flex.Item>
</Flex>
</Section>
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/public/tgui.bundle.js

Large diffs are not rendered by default.