Converts Mob Colours to Hexadecimal

No front-end changes. This just means that mob colours now take up less columns in the database, incur less processing (reduced rgb() calls) and reduces the amount of code dedicated to them.
This commit is contained in:
KasparoVy
2017-04-14 04:32:37 -04:00
parent b31f38796a
commit a6bb591b46
24 changed files with 346 additions and 621 deletions
+52 -111
View File
@@ -112,9 +112,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
var/socks = "Nude" //socks type
var/backbag = GBACKPACK //backpack type
var/ha_style = "None" //Head accessory style
var/r_headacc = 0 //Head accessory colour
var/g_headacc = 0 //Head accessory colour
var/b_headacc = 0 //Head accessory colour
var/hacc_colour = "#000000" //Head accessory colour
var/list/m_styles = list(
"head" = "None",
"body" = "None",
@@ -126,26 +124,14 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
"tail" = "#000000"
) //Marking colours.
var/h_style = "Bald" //Hair type
var/r_hair = 0 //Hair color
var/g_hair = 0 //Hair color
var/b_hair = 0 //Hair color
var/r_hair_sec = 0 //Secondary hair color
var/g_hair_sec = 0 //Secondary hair color
var/b_hair_sec = 0 //Secondary hair color
var/h_colour = "#000000" //Hair color
var/h_sec_colour = "#000000" //Secondary hair color
var/f_style = "Shaved" //Facial hair type
var/r_facial = 0 //Facial hair color
var/g_facial = 0 //Facial hair color
var/b_facial = 0 //Facial hair color
var/r_facial_sec = 0 //Secondary facial hair color
var/g_facial_sec = 0 //Secondary facial hair color
var/b_facial_sec = 0 //Secondary facial hair color
var/f_colour = "#000000" //Facial hair color
var/f_sec_colour = "#000000" //Secondary facial hair color
var/s_tone = 0 //Skin tone
var/r_skin = 0 //Skin color
var/g_skin = 0 //Skin color
var/b_skin = 0 //Skin color
var/r_eyes = 0 //Eye color
var/g_eyes = 0 //Eye color
var/b_eyes = 0 //Eye color
var/s_colour = "#000000" //Skin color
var/e_colour = "#000000" //Eye color
var/alt_head = "None" //Alt head style.
var/species = "Human"
var/language = "None" //Secondary language
@@ -241,8 +227,8 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
save_preferences(C)
save_character(C) //let's save this new random character so it doesn't keep generating new ones.
/datum/preferences/proc/color_square(r, g, b)
return "<span style='font-face: fixedsys; background-color: #[num2hex(r, 2)][num2hex(g, 2)][num2hex(b, 2)]; color: #[num2hex(r, 2)][num2hex(g, 2)][num2hex(b, 2)]'>___</span>"
/datum/preferences/proc/color_square(colour)
return "<span style='font-face: fixedsys; background-color: [colour]; color: [colour]'>___</span>"
// Hello I am a proc full of snowflake species checks how are you
/datum/preferences/proc/ShowChoices(mob/user)
@@ -319,45 +305,45 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
headaccessoryname = "Horns: "
dat += "<b>[headaccessoryname]</b>"
dat += "<a href='?_src_=prefs;preference=ha_style;task=input'>[ha_style]</a> "
dat += "<a href='?_src_=prefs;preference=headaccessory;task=input'>Color</a> [color_square(r_headacc, g_headacc, b_headacc)]<br>"
dat += "<a href='?_src_=prefs;preference=headaccessory;task=input'>Color</a> [color_square(hacc_colour)]<br>"
if(S.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings.
dat += "<b>Head Markings:</b> "
dat += "<a href='?_src_=prefs;preference=m_style_head;task=input'>[m_styles["head"]]</a>"
dat += "<a href='?_src_=prefs;preference=m_head_colour;task=input'>Color</a> [color_square(color2R(m_colours["head"]), color2G(m_colours["head"]), color2B(m_colours["head"]))]<br>"
dat += "<a href='?_src_=prefs;preference=m_head_colour;task=input'>Color</a> [color_square(m_colours["head"])]<br>"
if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings/tattoos.
dat += "<b>Body Markings:</b> "
dat += "<a href='?_src_=prefs;preference=m_style_body;task=input'>[m_styles["body"]]</a>"
dat += "<a href='?_src_=prefs;preference=m_body_colour;task=input'>Color</a> [color_square(color2R(m_colours["body"]), color2G(m_colours["body"]), color2B(m_colours["body"]))]<br>"
dat += "<a href='?_src_=prefs;preference=m_body_colour;task=input'>Color</a> [color_square(m_colours["body"])]<br>"
if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings.
dat += "<b>Tail Markings:</b> "
dat += "<a href='?_src_=prefs;preference=m_style_tail;task=input'>[m_styles["tail"]]</a>"
dat += "<a href='?_src_=prefs;preference=m_tail_colour;task=input'>Color</a> [color_square(color2R(m_colours["tail"]), color2G(m_colours["tail"]), color2B(m_colours["tail"]))]<br>"
dat += "<a href='?_src_=prefs;preference=m_tail_colour;task=input'>Color</a> [color_square(m_colours["tail"])]<br>"
dat += "<b>Hair:</b> "
dat += "<a href='?_src_=prefs;preference=h_style;task=input'>[h_style]</a>"
dat += "<a href='?_src_=prefs;preference=hair;task=input'>Color</a> [color_square(r_hair, g_hair, b_hair)]"
dat += "<a href='?_src_=prefs;preference=hair;task=input'>Color</a> [color_square(h_colour)]"
var/datum/sprite_accessory/temp_hair_style = hair_styles_list[h_style]
if(temp_hair_style && temp_hair_style.secondary_theme && !temp_hair_style.no_sec_colour)
dat += " <a href='?_src_=prefs;preference=secondary_hair;task=input'>Color #2</a> [color_square(r_hair_sec, g_hair_sec, b_hair_sec)]"
dat += " <a href='?_src_=prefs;preference=secondary_hair;task=input'>Color #2</a> [color_square(h_sec_colour)]"
dat += "<br>"
dat += "<b>Facial Hair:</b> "
dat += "<a href='?_src_=prefs;preference=f_style;task=input'>[f_style ? "[f_style]" : "Shaved"]</a>"
dat += "<a href='?_src_=prefs;preference=facial;task=input'>Color</a> [color_square(r_facial, g_facial, b_facial)]"
dat += "<a href='?_src_=prefs;preference=facial;task=input'>Color</a> [color_square(f_colour)]"
var/datum/sprite_accessory/temp_facial_hair_style = facial_hair_styles_list[f_style]
if(temp_facial_hair_style && temp_facial_hair_style.secondary_theme && !temp_facial_hair_style.no_sec_colour)
dat += " <a href='?_src_=prefs;preference=secondary_facial;task=input'>Color #2</a> [color_square(r_facial_sec, g_facial_sec, b_facial_sec)]"
dat += " <a href='?_src_=prefs;preference=secondary_facial;task=input'>Color #2</a> [color_square(f_sec_colour)]"
dat += "<br>"
if(!(S.bodyflags & ALL_RPARTS))
dat += "<b>Eyes:</b> "
dat += "<a href='?_src_=prefs;preference=eyes;task=input'>Color</a> [color_square(r_eyes, g_eyes, b_eyes)]<br>"
dat += "<a href='?_src_=prefs;preference=eyes;task=input'>Color</a> [color_square(e_colour)]<br>"
if((S.bodyflags & HAS_SKIN_COLOR) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user)) //admins can always fuck with this, because they are admins
dat += "<b>Body Color:</b> "
dat += "<a href='?_src_=prefs;preference=skin;task=input'>Color</a> [color_square(r_skin, g_skin, b_skin)]<br>"
dat += "<a href='?_src_=prefs;preference=skin;task=input'>Color</a> [color_square(s_colour)]<br>"
if(body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user))
dat += "<b>Body Accessory:</b> "
@@ -1188,33 +1174,23 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
age = rand(AGE_MIN, AGE_MAX)
if("hair")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox"))
r_hair = rand(0,255)
g_hair = rand(0,255)
b_hair = rand(0,255)
h_colour = rand_hex_color()
if("secondary_hair")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox"))
r_hair_sec = rand(0,255)
g_hair_sec = rand(0,255)
b_hair_sec = rand(0,255)
h_sec_colour = rand_hex_color()
if("h_style")
h_style = random_hair_style(gender, species, robohead)
if("facial")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox"))
r_facial = rand(0,255)
g_facial = rand(0,255)
b_facial = rand(0,255)
f_colour = rand_hex_color()
if("secondary_facial")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox"))
r_facial_sec = rand(0,255)
g_facial_sec = rand(0,255)
b_facial_sec = rand(0,255)
f_sec_colour = rand_hex_color()
if("f_style")
f_style = random_facial_hair_style(gender, species, robohead)
if("headaccessory")
if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species that have head accessories.
r_headacc = rand(0,255)
g_headacc = rand(0,255)
b_headacc = rand(0,255)
hacc_colour = rand_hex_color()
if("ha_style")
if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species that have head accessories.
ha_style = random_head_accessory(species)
@@ -1223,19 +1199,19 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
m_styles["head"] = random_marking_style("head", species, robohead, null, alt_head)
if("m_head_colour")
if(S.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings.
m_colours["head"] = rgb(rand(0,255), rand(0,255), rand(0,255))
m_colours["head"] = rand_hex_color()
if("m_style_body")
if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings.
m_styles["body"] = random_marking_style("body", species)
if("m_body_colour")
if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings.
m_colours["body"] = rgb(rand(0,255), rand(0,255), rand(0,255))
m_colours["body"] = rand_hex_color()
if("m_style_tail")
if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings.
m_styles["tail"] = random_marking_style("tail", species, null, body_accessory)
if("m_tail_colour")
if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings.
m_colours["tail"] = rgb(rand(0,255), rand(0,255), rand(0,255))
m_colours["tail"] = rand_hex_color()
if("underwear")
underwear = random_underwear(gender, species)
ShowChoices(user)
@@ -1246,17 +1222,13 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
socks = random_socks(gender, species)
ShowChoices(user)
if("eyes")
r_eyes = rand(0,255)
g_eyes = rand(0,255)
b_eyes = rand(0,255)
e_colour = rand_hex_color()
if("s_tone")
if(S.bodyflags & (HAS_SKIN_TONE|HAS_ICON_SKIN_TONE))
s_tone = random_skin_tone()
if("s_color")
if(S.bodyflags & HAS_SKIN_COLOR)
r_skin = rand(0,255)
g_skin = rand(0,255)
b_skin = rand(0,255)
s_colour = rand_hex_color()
if("bag")
backbag = pick(backbaglist)
/*if("skin_style")
@@ -1319,9 +1291,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
ha_style = random_head_accessory(species)
else
ha_style = "None" // No Vulp ears on Unathi
r_headacc = 0
g_headacc = 0
b_headacc = 0
hacc_colour = rand_hex_color()
if(NS.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings.
m_styles["head"] = random_marking_style("head", species, robohead, null, alt_head)
@@ -1361,9 +1331,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
s_tone = 0
if(!(NS.bodyflags & HAS_SKIN_COLOR))
r_skin = 0
g_skin = 0
b_skin = 0
s_colour = "#000000"
alt_head = "None" //No alt heads on species that don't have them.
speciesprefs = 0 //My Vox tank shouldn't change how my future Grey talks.
@@ -1419,21 +1387,17 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("hair")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox")) //Species that have hair. (No HAS_HAIR flag)
var/input = "Choose your character's hair colour:"
var/new_hair = input(user, input, "Character Preference", rgb(r_hair, g_hair, b_hair)) as color|null
var/new_hair = input(user, input, "Character Preference", h_colour) as color|null
if(new_hair)
r_hair = color2R(new_hair)
g_hair = color2G(new_hair)
b_hair = color2B(new_hair)
h_colour = new_hair
if("secondary_hair")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox"))
var/datum/sprite_accessory/hair_style = hair_styles_list[h_style]
if(hair_style.secondary_theme && !hair_style.no_sec_colour)
var/new_hair = input(user, "Choose your character's secondary hair colour:", "Character Preference", rgb(r_hair_sec, g_hair_sec, b_hair_sec)) as color|null
var/new_hair = input(user, "Choose your character's secondary hair colour:", "Character Preference", h_sec_colour) as color|null
if(new_hair)
r_hair_sec = color2R(new_hair)
g_hair_sec = color2G(new_hair)
b_hair_sec = color2B(new_hair)
h_sec_colour = new_hair
if("h_style")
var/list/valid_hairstyles = list()
@@ -1467,11 +1431,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("headaccessory")
if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species with head accessories.
var/input = "Choose the colour of your your character's head accessory:"
var/new_head_accessory = input(user, input, "Character Preference", rgb(r_headacc, g_headacc, b_headacc)) as color|null
var/new_head_accessory = input(user, input, "Character Preference", hacc_colour) as color|null
if(new_head_accessory)
r_headacc = color2R(new_head_accessory)
g_headacc = color2G(new_head_accessory)
b_headacc = color2B(new_head_accessory)
hacc_colour = new_head_accessory
if("ha_style")
if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species with head accessories.
@@ -1626,21 +1588,17 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("facial")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox")) //Species that have facial hair. (No HAS_HAIR_FACIAL flag)
var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference", rgb(r_facial, g_facial, b_facial)) as color|null
var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference", f_colour) as color|null
if(new_facial)
r_facial = color2R(new_facial)
g_facial = color2G(new_facial)
b_facial = color2B(new_facial)
f_colour = new_facial
if("secondary_facial")
if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox"))
var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[f_style]
if(facial_hair_style.secondary_theme && !facial_hair_style.no_sec_colour)
var/new_facial = input(user, "Choose your character's secondary facial-hair colour:", "Character Preference", rgb(r_facial_sec, g_facial_sec, b_facial_sec)) as color|null
var/new_facial = input(user, "Choose your character's secondary facial-hair colour:", "Character Preference", f_sec_colour) as color|null
if(new_facial)
r_facial_sec = color2R(new_facial)
g_facial_sec = color2G(new_facial)
b_facial_sec = color2B(new_facial)
f_sec_colour = new_facial
if("f_style")
var/list/valid_facial_hairstyles = list()
@@ -1723,11 +1681,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
socks = new_socks
if("eyes")
var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference", rgb(r_eyes, g_eyes, b_eyes)) as color|null
var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference", e_colour) as color|null
if(new_eyes)
r_eyes = color2R(new_eyes)
g_eyes = color2G(new_eyes)
b_eyes = color2B(new_eyes)
e_colour = new_eyes
if("s_tone")
if(S.bodyflags & HAS_SKIN_TONE)
@@ -1750,12 +1706,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("skin")
if((S.bodyflags & HAS_SKIN_COLOR) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user))
var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", rgb(r_skin, g_skin, b_skin)) as color|null
var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", s_colour) as color|null
if(new_skin)
r_skin = color2R(new_skin)
g_skin = color2G(new_skin)
b_skin = color2B(new_skin)
s_colour = new_skin
if("ooccolor")
var/new_ooccolor = input(user, "Choose your OOC colour:", "Game Preference", ooccolor) as color|null
@@ -2124,21 +2077,13 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
//Head-specific
var/obj/item/organ/external/head/H = character.get_organ("head")
H.r_hair = r_hair
H.g_hair = g_hair
H.b_hair = b_hair
H.hair_colour = h_colour
H.r_hair_sec = r_hair_sec
H.g_hair_sec = g_hair_sec
H.b_hair_sec = b_hair_sec
H.sec_hair_colour = h_sec_colour
H.r_facial = r_facial
H.g_facial = g_facial
H.b_facial = b_facial
H.facial_colour = f_colour
H.r_facial_sec = r_facial_sec
H.g_facial_sec = g_facial_sec
H.b_facial_sec = b_facial_sec
H.sec_facial_colour = f_sec_colour
H.h_style = h_style
H.f_style = f_style
@@ -2146,9 +2091,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
H.alt_head = alt_head
//End of head-specific.
character.r_skin = r_skin
character.g_skin = g_skin
character.b_skin = b_skin
character.skin_colour = s_colour
character.s_tone = s_tone
@@ -2192,9 +2135,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
character.socks = socks
if(character.species.bodyflags & HAS_HEAD_ACCESSORY)
H.r_headacc = r_headacc
H.g_headacc = g_headacc
H.b_headacc = b_headacc
H.headacc_colour = hacc_colour
H.ha_style = ha_style
if(character.species.bodyflags & HAS_MARKINGS)
character.m_colours = m_colours
@@ -2211,7 +2152,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
message_admins("[key_name_admin(character)] has spawned with their gender as plural or neuter. Please notify coders.")
character.change_gender(MALE)
character.change_eye_color(r_eyes, g_eyes, b_eyes)
character.change_eye_color(e_colour)
if(disabilities & DISABILITY_FLAG_FAT && (CAN_BE_FAT in character.species.species_traits))
character.dna.SetSEState(FATBLOCK,1,1)
@@ -118,34 +118,20 @@
age,
species,
language,
hair_red,
hair_green,
hair_blue,
secondary_hair_red,
secondary_hair_green,
secondary_hair_blue,
facial_red,
facial_green,
facial_blue,
secondary_facial_red,
secondary_facial_green,
secondary_facial_blue,
hair_colour,
secondary_hair_colour,
facial_hair_colour,
secondary_facial_hair_colour,
skin_tone,
skin_red,
skin_green,
skin_blue,
skin_colour,
marking_colours,
head_accessory_red,
head_accessory_green,
head_accessory_blue,
head_accessory_colour,
hair_style_name,
facial_style_name,
marking_styles,
head_accessory_style_name,
alt_head_name,
eyes_red,
eyes_green,
eyes_blue,
eye_colour,
underwear,
undershirt,
backbag,
@@ -194,61 +180,46 @@
species = query.item[6]
language = query.item[7]
//colors to be consolidated into hex strings (requires some work with dna code)
r_hair = text2num(query.item[8])
g_hair = text2num(query.item[9])
b_hair = text2num(query.item[10])
r_hair_sec = text2num(query.item[11])
g_hair_sec = text2num(query.item[12])
b_hair_sec = text2num(query.item[13])
r_facial = text2num(query.item[14])
g_facial = text2num(query.item[15])
b_facial = text2num(query.item[16])
r_facial_sec = text2num(query.item[17])
g_facial_sec = text2num(query.item[18])
b_facial_sec = text2num(query.item[19])
s_tone = text2num(query.item[20])
r_skin = text2num(query.item[21])
g_skin = text2num(query.item[22])
b_skin = text2num(query.item[23])
m_colours = params2list(query.item[24])
r_headacc = text2num(query.item[25])
g_headacc = text2num(query.item[26])
b_headacc = text2num(query.item[27])
h_style = query.item[28]
f_style = query.item[29]
m_styles = params2list(query.item[30])
ha_style = query.item[31]
alt_head = query.item[32]
r_eyes = text2num(query.item[33])
g_eyes = text2num(query.item[34])
b_eyes = text2num(query.item[35])
underwear = query.item[36]
undershirt = query.item[37]
backbag = query.item[38]
b_type = query.item[39]
h_colour = query.item[8]
h_sec_colour = query.item[9]
f_colour = query.item[10]
f_sec_colour = query.item[11]
s_tone = text2num(query.item[12])
s_colour = query.item[13]
m_colours = params2list(query.item[14])
hacc_colour = query.item[15]
h_style = query.item[16]
f_style = query.item[17]
m_styles = params2list(query.item[18])
ha_style = query.item[19]
alt_head = query.item[20]
e_colour = query.item[21]
underwear = query.item[22]
undershirt = query.item[23]
backbag = query.item[24]
b_type = query.item[25]
//Jobs
alternate_option = text2num(query.item[40])
job_support_high = text2num(query.item[41])
job_support_med = text2num(query.item[42])
job_support_low = text2num(query.item[43])
job_medsci_high = text2num(query.item[44])
job_medsci_med = text2num(query.item[45])
job_medsci_low = text2num(query.item[46])
job_engsec_high = text2num(query.item[47])
job_engsec_med = text2num(query.item[48])
job_engsec_low = text2num(query.item[49])
job_karma_high = text2num(query.item[50])
job_karma_med = text2num(query.item[51])
job_karma_low = text2num(query.item[52])
alternate_option = text2num(query.item[26])
job_support_high = text2num(query.item[27])
job_support_med = text2num(query.item[28])
job_support_low = text2num(query.item[29])
job_medsci_high = text2num(query.item[30])
job_medsci_med = text2num(query.item[31])
job_medsci_low = text2num(query.item[32])
job_engsec_high = text2num(query.item[33])
job_engsec_med = text2num(query.item[34])
job_engsec_low = text2num(query.item[35])
job_karma_high = text2num(query.item[36])
job_karma_med = text2num(query.item[37])
job_karma_low = text2num(query.item[38])
//Miscellaneous
flavor_text = query.item[53]
med_record = query.item[54]
sec_record = query.item[55]
gen_record = query.item[56]
flavor_text = query.item[39]
med_record = query.item[40]
sec_record = query.item[41]
gen_record = query.item[42]
// 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)
@@ -258,18 +229,18 @@
sec_record = html_encode(sec_record)
if(findtext(gen_record, "<"))
gen_record = html_encode(gen_record)
disabilities = text2num(query.item[57])
player_alt_titles = params2list(query.item[58])
organ_data = params2list(query.item[59])
rlimb_data = params2list(query.item[60])
nanotrasen_relation = query.item[61]
speciesprefs = text2num(query.item[62])
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])
//socks
socks = query.item[63]
body_accessory = query.item[64]
gear = params2list(query.item[65])
autohiss_mode = text2num(query.item[66])
socks = query.item[49]
body_accessory = query.item[50]
gear = params2list(query.item[51])
autohiss_mode = text2num(query.item[52])
//Sanitize
var/datum/species/SP = all_species[species]
@@ -283,36 +254,22 @@
be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name))
gender = sanitize_gender(gender, FALSE, !SP.has_gender)
age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age))
r_hair = sanitize_integer(r_hair, 0, 255, initial(r_hair))
g_hair = sanitize_integer(g_hair, 0, 255, initial(g_hair))
b_hair = sanitize_integer(b_hair, 0, 255, initial(b_hair))
r_hair_sec = sanitize_integer(r_hair_sec, 0, 255, initial(r_hair_sec))
g_hair_sec = sanitize_integer(g_hair_sec, 0, 255, initial(g_hair_sec))
b_hair_sec = sanitize_integer(b_hair_sec, 0, 255, initial(b_hair_sec))
r_facial = sanitize_integer(r_facial, 0, 255, initial(r_facial))
g_facial = sanitize_integer(g_facial, 0, 255, initial(g_facial))
b_facial = sanitize_integer(b_facial, 0, 255, initial(b_facial))
r_facial_sec = sanitize_integer(r_facial_sec, 0, 255, initial(r_facial_sec))
g_facial_sec = sanitize_integer(g_facial_sec, 0, 255, initial(g_facial_sec))
b_facial_sec = sanitize_integer(b_facial_sec, 0, 255, initial(b_facial_sec))
h_colour = sanitize_hexcolor(h_colour)
h_sec_colour = sanitize_hexcolor(h_sec_colour)
f_colour = sanitize_hexcolor(f_colour)
f_sec_colour = sanitize_hexcolor(f_sec_colour)
s_tone = sanitize_integer(s_tone, -185, 34, initial(s_tone))
r_skin = sanitize_integer(r_skin, 0, 255, initial(r_skin))
g_skin = sanitize_integer(g_skin, 0, 255, initial(g_skin))
b_skin = sanitize_integer(b_skin, 0, 255, initial(b_skin))
s_colour = sanitize_hexcolor(s_colour)
for(var/marking_location in m_colours)
m_colours[marking_location] = sanitize_hexcolor(m_colours[marking_location], DEFAULT_MARKING_COLOURS[marking_location])
r_headacc = sanitize_integer(r_headacc, 0, 255, initial(r_headacc))
g_headacc = sanitize_integer(g_headacc, 0, 255, initial(g_headacc))
b_headacc = sanitize_integer(b_headacc, 0, 255, initial(b_headacc))
hacc_colour = sanitize_hexcolor(hacc_colour)
h_style = sanitize_inlist(h_style, hair_styles_list, initial(h_style))
f_style = sanitize_inlist(f_style, facial_hair_styles_list, initial(f_style))
for(var/marking_location in m_styles)
m_styles[marking_location] = sanitize_inlist(m_styles[marking_location], marking_styles_list, DEFAULT_MARKING_STYLES[marking_location])
ha_style = sanitize_inlist(ha_style, head_accessory_styles_list, initial(ha_style))
alt_head = sanitize_inlist(alt_head, alt_heads_list, initial(alt_head))
r_eyes = sanitize_integer(r_eyes, 0, 255, initial(r_eyes))
g_eyes = sanitize_integer(g_eyes, 0, 255, initial(g_eyes))
b_eyes = sanitize_integer(b_eyes, 0, 255, initial(b_eyes))
e_colour = sanitize_hexcolor(e_colour)
underwear = sanitize_text(underwear, initial(underwear))
undershirt = sanitize_text(undershirt, initial(undershirt))
backbag = sanitize_text(backbag, initial(backbag))
@@ -373,34 +330,20 @@
age='[age]',
species='[sanitizeSQL(species)]',
language='[sanitizeSQL(language)]',
hair_red='[r_hair]',
hair_green='[g_hair]',
hair_blue='[b_hair]',
secondary_hair_red='[r_hair_sec]',
secondary_hair_green='[g_hair_sec]',
secondary_hair_blue='[b_hair_sec]',
facial_red='[r_facial]',
facial_green='[g_facial]',
facial_blue='[b_facial]',
secondary_facial_red='[r_facial_sec]',
secondary_facial_green='[g_facial_sec]',
secondary_facial_blue='[b_facial_sec]',
hair_colour='[h_colour]',
secondary_hair_colour='[h_sec_colour]',
facial_hair_colour='[f_colour]',
secondary_facial_hair_colour='[f_sec_colour]',
skin_tone='[s_tone]',
skin_red='[r_skin]',
skin_green='[g_skin]',
skin_blue='[b_skin]',
skin_colour='[s_colour]',
marking_colours='[sanitizeSQL(markingcolourslist)]',
head_accessory_red='[r_headacc]',
head_accessory_green='[g_headacc]',
head_accessory_blue='[b_headacc]',
head_accessory_colour='[hacc_colour]',
hair_style_name='[sanitizeSQL(h_style)]',
facial_style_name='[sanitizeSQL(f_style)]',
marking_styles='[sanitizeSQL(markingstyleslist)]',
head_accessory_style_name='[sanitizeSQL(ha_style)]',
alt_head_name='[sanitizeSQL(alt_head)]',
eyes_red='[r_eyes]',
eyes_green='[g_eyes]',
eyes_blue='[b_eyes]',
eye_colour='[e_colour]',
underwear='[underwear]',
undershirt='[undershirt]',
backbag='[backbag]',
@@ -446,19 +389,17 @@
var/DBQuery/query = dbcon.NewQuery({"
INSERT INTO [format_table_name("characters")] (ckey, slot, OOC_Notes, real_name, name_is_always_random, gender,
age, species, language,
hair_red, hair_green, hair_blue,
secondary_hair_red, secondary_hair_green, secondary_hair_blue,
facial_red, facial_green, facial_blue,
secondary_facial_red, secondary_facial_green, secondary_facial_blue,
skin_tone, skin_red, skin_green, skin_blue,
hair_colour, secondary_hair_colour,
facial_hair_colour, secondary_facial_hair_colour,
skin_tone, skin_colour,
marking_colours,
head_accessory_red, head_accessory_green, head_accessory_blue,
head_accessory_colour,
hair_style_name,
facial_style_name,
marking_styles,
head_accessory_style_name,
alt_head_name,
eyes_red, eyes_green, eyes_blue,
eye_colour,
underwear, undershirt,
backbag, b_type, alternate_option,
job_support_high, job_support_med, job_support_low,
@@ -476,19 +417,17 @@
VALUES
('[C.ckey]', '[default_slot]', '[sanitizeSQL(metadata)]', '[sanitizeSQL(real_name)]', '[be_random_name]','[gender]',
'[age]', '[sanitizeSQL(species)]', '[sanitizeSQL(language)]',
'[r_hair]', '[g_hair]', '[b_hair]',
'[r_hair_sec]', '[g_hair_sec]', '[b_hair_sec]',
'[r_facial]', '[g_facial]', '[b_facial]',
'[r_facial_sec]', '[g_facial_sec]', '[b_facial_sec]',
'[s_tone]', '[r_skin]', '[g_skin]', '[b_skin]',
'[h_colour]', '[h_sec_colour]',
'[f_colour]', '[f_sec_colour]',
'[s_tone]', '[s_colour]',
'[sanitizeSQL(markingcolourslist)]',
'[r_headacc]', '[g_headacc]', '[b_headacc]',
'[hacc_colour]',
'[sanitizeSQL(h_style)]',
'[sanitizeSQL(f_style)]',
'[sanitizeSQL(markingstyleslist)]',
'[sanitizeSQL(ha_style)]',
'[sanitizeSQL(alt_head)]',
'[r_eyes]', '[g_eyes]', '[b_eyes]',
'[e_colour]',
'[underwear]', '[undershirt]',
'[backbag]', '[b_type]', '[alternate_option]',
'[job_support_high]', '[job_support_med]', '[job_support_low]',