mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 07:59:01 +01:00
Conflict Resolution
# Conflicts: # interface/skin.dmf
This commit is contained in:
@@ -0,0 +1,732 @@
|
||||
//handles saving to SQL Format
|
||||
//MAKE SURE YOU KEEP THIS UP TO DATE!
|
||||
//if the db can't be updated, return 0
|
||||
//if the db was updated, return 1
|
||||
|
||||
/datum/preferences/proc/SQLsave_character(var/cslot)
|
||||
char_slot = cslot
|
||||
if(!cslot)
|
||||
log_debug("invalid slot")
|
||||
return 0
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
log_debug("Ckey is [ckey]")
|
||||
establish_db_connection(dbcon)
|
||||
if(!dbcon.IsConnected())
|
||||
return 0
|
||||
else
|
||||
log_debug("db connected, real name is [real_name]")
|
||||
if(!getCharId(ckey))
|
||||
log_debug("New Character")
|
||||
query = dbcon.NewQuery("INSERT INTO ss13_characters (ckey, slot) VALUES ('[ckey]', '[cslot]')")
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
getCharId(ckey)
|
||||
InsertCharData()
|
||||
InsertJobsData()
|
||||
InsertFlavourData()
|
||||
InsertRobotFlavourData()
|
||||
InsertMiscData()
|
||||
InsertSkillsData()
|
||||
InsertGearData()
|
||||
InsertOrgansData()
|
||||
else
|
||||
log_debug("ID = [char_id]")
|
||||
log_debug("Update entry")
|
||||
UpdateCharData()
|
||||
UpdateJobsData()
|
||||
UpdateFlavourData()
|
||||
UpdateRobotFlavourData()
|
||||
UpdateMiscData()
|
||||
UpdateSkillsData()
|
||||
UpdateGearData()
|
||||
UpdateOrgansData()
|
||||
TextQuery = "UPDATE SS13_characters SET Character_Name = (SELECT name FROM characters_data WHERE char_id = '[char_id]') WHERE id = '[char_id]'"
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
log_debug("Save query executed")
|
||||
return 1
|
||||
log_debug("No ckey in datums")
|
||||
return 0
|
||||
|
||||
/datum/preferences/proc/SQLload_character(var/slot, var/pckey)
|
||||
establish_db_connection(dbcon)
|
||||
if(!dbcon.IsConnected())
|
||||
return 0
|
||||
char_slot = slot
|
||||
if(!getCharId(pckey))
|
||||
return 0
|
||||
log_debug("Loading character ID [char_id] from slot [char_slot]")
|
||||
if(LoadCharData())
|
||||
if(LoadJobsData())
|
||||
if(LoadFlavourData())
|
||||
if(LoadRobotFlavourData())
|
||||
if(LoadMiscData())
|
||||
if(LoadSkillsData())
|
||||
if(LoadGearData())
|
||||
if(LoadOrgansData())
|
||||
SanitizeCharacter()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/preferences/proc/getCharId(var/ckey)
|
||||
TextQuery = "SELECT id FROM ss13_characters WHERE ckey='[ckey]' AND slot = '[char_slot]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
log_debug("Query ready")
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
var/rowDebug = query.RowCount()
|
||||
log_debug("Query executed, [rowDebug] rows")
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
query.NextRow()
|
||||
char_id = query.item[1]
|
||||
log_debug("GetCharId : [char_id]")
|
||||
return char_id
|
||||
|
||||
/datum/preferences/proc/InsertCharData()
|
||||
log_debug("Insert Char Data")
|
||||
TextQuery = "INSERT INTO characters_data (age, backbag, b_type, char_id, eyes_B, eyes_G, eyes_R, facial_B, facial_G, facial_R, facial_style, "
|
||||
TextQuery += "gender, hair_B, hair_G, hair_R, hair_style, isRandom, language, name, OOC,skin_B, skin_G, skin_R, skin_tone, spawnpoint, species, undershirt, underwear) VALUES "
|
||||
TextQuery += "('[age]', '[backbag]', '[b_type]', '[char_id]', '[b_eyes]', '[g_eyes]', '[r_eyes]', '[b_facial]', '[g_facial]', '[r_facial]', '[f_style]', "
|
||||
TextQuery += "'[gender]', '[b_hair]', '[g_hair]', '[r_hair]', '[h_style]', '[be_random_name]', '[language]', '[real_name]', "
|
||||
TextQuery += "'[metadata]', '[b_skin]', '[g_skin]', '[r_skin]', '[s_tone]', '[spawnpoint]', '[species]', '[undershirt]', '[underwear]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateCharData()
|
||||
log_debug("Update Char Data")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_data WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertCharData()
|
||||
TextQuery = "UPDATE characters_data SET age = '[age]', backbag='[backbag]', b_type='[b_type]', eyes_B = '[b_eyes]', eyes_G='[g_eyes]', eyes_R='[r_eyes]',"
|
||||
TextQuery += "facial_B='[b_facial]', facial_G='[g_facial]', facial_R='[r_facial]', facial_style='[f_style]', gender = '[gender]', hair_B='[b_hair]', hair_G='[g_hair]',"
|
||||
TextQuery += "hair_R='[r_hair]', hair_style='[h_style]', isRandom='[be_random_name]', language='[language]', name='[real_name]', OOC='[metadata]',skin_B='[b_skin]', skin_G='[g_skin]',"
|
||||
TextQuery += "skin_R='[r_skin]', skin_tone='[s_tone]', spawnpoint='[spawnpoint]', species='[species]', undershirt='[undershirt]', underwear='[underwear]'"
|
||||
TextQuery += "WHERE char_id = '[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
|
||||
/datum/preferences/proc/LoadCharData()
|
||||
log_debug("Load char data")
|
||||
TextQuery = "SELECT age, backbag, b_type, eyes_B, eyes_G, eyes_R, facial_B, facial_G, facial_R, facial_style, gender, "
|
||||
TextQuery += "hair_B, hair_G, hair_R, hair_style, isRandom, language, name, OOC, skin_B, skin_G, skin_R, skin_tone, spawnpoint, species, undershirt, underwear "
|
||||
TextQuery += "FROM characters_data WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
age = text2num(query.item[1])
|
||||
backbag = text2num(query.item[2])
|
||||
b_type = text2num(query.item[3])
|
||||
b_eyes = text2num(query.item[4])
|
||||
g_eyes = text2num(query.item[5])
|
||||
r_eyes = text2num(query.item[6])
|
||||
b_facial = text2num(query.item[7])
|
||||
g_facial = text2num(query.item[8])
|
||||
r_facial = text2num(query.item[9])
|
||||
f_style = query.item[10]
|
||||
gender = query.item[11]
|
||||
b_hair = text2num(query.item[12])
|
||||
g_hair = text2num(query.item[13])
|
||||
r_hair = text2num(query.item[14])
|
||||
h_style = query.item[15]
|
||||
be_random_name = text2num(query.item[16])
|
||||
language = query.item[17]
|
||||
real_name = query.item[18]
|
||||
metadata = query.item[19]
|
||||
b_skin = text2num(query.item[20])
|
||||
g_skin = text2num(query.item[21])
|
||||
r_skin = text2num(query.item[22])
|
||||
s_tone = text2num(query.item[23])
|
||||
spawnpoint = query.item[24]
|
||||
species = query.item[25]
|
||||
undershirt = query.item[26]
|
||||
underwear = query.item[27]
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertJobsData()
|
||||
log_debug("Insert jobs")
|
||||
var/alt_titles_list = list2params(player_alt_titles)
|
||||
TextQuery = "INSERT INTO characters_jobs (char_id, Alternate, civ_high, civ_med, civ_low, medsci_high, medsci_med, medsci_low, engsec_high, engsec_med, engsec_low, alt_titles) "
|
||||
TextQuery += " VALUES ('[char_id]','[alternate_option]', '[job_civilian_high]', '[job_civilian_med]', '[job_civilian_low]', '[job_medsci_high]', '[job_medsci_med]', '[job_medsci_low]', "
|
||||
TextQuery += "'[job_engsec_high]', '[job_engsec_med]', '[job_engsec_low]', '[alt_titles_list]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateJobsData()
|
||||
log_debug("update jobs")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_jobs WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertJobsData()
|
||||
var/alt_titles_list = list2params(player_alt_titles)
|
||||
TextQuery = "UPDATE characters_jobs SET Alternate='[alternate_option]', civ_high='[job_civilian_high]', civ_med='[job_civilian_med]', civ_low='[job_civilian_low]', "
|
||||
TextQuery += "medsci_high='[job_medsci_high]', medsci_med='[job_medsci_med]', medsci_low='[job_medsci_low]', "
|
||||
TextQuery += "engsec_high='[job_engsec_high]', engsec_med='[job_engsec_med]', engsec_low='[job_engsec_low]', alt_titles = '[alt_titles_list]' WHERE char_id = [char_id] "
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadJobsData()
|
||||
log_debug("load_jobs")
|
||||
TextQuery = "SELECT * FROM characters_jobs WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
alternate_option = text2num(query.item[3])
|
||||
job_civilian_high = text2num(query.item[4])
|
||||
job_civilian_med = text2num(query.item[5])
|
||||
job_civilian_low = text2num(query.item[6])
|
||||
job_medsci_high = text2num(query.item[7])
|
||||
job_medsci_med = text2num(query.item[8])
|
||||
job_medsci_low = text2num(query.item[9])
|
||||
job_engsec_high = text2num(query.item[10])
|
||||
job_engsec_med = text2num(query.item[11])
|
||||
job_engsec_low = text2num(query.item[12])
|
||||
player_alt_titles = params2list(query.item[13])
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertFlavourData()
|
||||
log_debug("insert flavour")
|
||||
TextQuery = "INSERT INTO characters_flavour (char_id, generals, head, face, eyes, torso, arms, hands, legs, feet) "
|
||||
TextQuery += " VALUES ('[char_id]','[flavor_texts["general"]]', '[flavor_texts["head"]]', '[flavor_texts["face"]]', '[flavor_texts["eyes"]]', '[flavor_texts["torso"]]', "
|
||||
TextQuery += "'[flavor_texts["arms"]]', '[flavor_texts["hands"]]', '[flavor_texts["legs"]]', '[flavor_texts["feet"]]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateFlavourData()
|
||||
log_debug("update flavour")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_data WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertFlavourData()
|
||||
TextQuery = "UPDATE characters_flavour SET generals='[flavor_texts["general"]]', head='[flavor_texts["head"]]', face='[flavor_texts["face"]]', eyes='[flavor_texts["eyes"]]', "
|
||||
TextQuery += "torso='[flavor_texts["torso"]]', arms='[flavor_texts["arms"]]', hands='[flavor_texts["hands"]]', legs='[flavor_texts["legs"]]', feet='[flavor_texts["feet"]]' "
|
||||
TextQuery += "WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadFlavourData()
|
||||
log_debug("load flavour")
|
||||
TextQuery = "SELECT * FROM characters_flavour WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
flavor_texts["general"] = query.item[3]
|
||||
flavor_texts["head"] = query.item[4]
|
||||
flavor_texts["face"] = query.item[5]
|
||||
flavor_texts["eyes"] = query.item[6]
|
||||
flavor_texts["torso"] = query.item[7]
|
||||
flavor_texts["arms"] = query.item[8]
|
||||
flavor_texts["hands"]= query.item[9]
|
||||
flavor_texts["legs"] = query.item[10]
|
||||
flavor_texts["feet"] = query.item[11]
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertRobotFlavourData()
|
||||
log_debug("insert robot")
|
||||
TextQuery = "INSERT INTO characters_robot_flavour (char_id, Default_Robot, Standard, Engineering, Construction, Surgeon, Crisis, Miner, Janitor, Service, Clerical, Security, Research) "
|
||||
TextQuery += " VALUES ('[char_id]','[flavour_texts_robot["Default"]]', '[flavour_texts_robot["Standard"]]', '[flavour_texts_robot["Engineering"]]', '[flavour_texts_robot["Construction"]]', "
|
||||
TextQuery += "'[flavour_texts_robot["Surgeon"]]', '[flavour_texts_robot["Crisis"]]', '[flavour_texts_robot["Miner"]]', '[flavour_texts_robot["Janitor"]]', '[flavour_texts_robot["Service"]]', "
|
||||
TextQuery += "'[flavour_texts_robot["Clerical"]]', '[flavour_texts_robot["Security"]]','[flavour_texts_robot["Research"]]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateRobotFlavourData()
|
||||
log_debug("update robot")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_robot_flavour WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertRobotFlavourData()
|
||||
TextQuery = "UPDATE characters_robot_flavour SET Default_Robot='[flavour_texts_robot["Default"]]', Standard='[flavour_texts_robot["Standard"]]', Engineering='[flavour_texts_robot["Engineering"]]', "
|
||||
TextQuery += "Construction='[flavour_texts_robot["Construction"]]', Surgeon='[flavour_texts_robot["Surgeon"]]', Crisis='[flavour_texts_robot["Crisis"]]', Miner='[flavour_texts_robot["Miner"]]', "
|
||||
TextQuery += "Janitor='[flavour_texts_robot["Janitor"]]', Service='[flavour_texts_robot["Service"]]', Clerical='[flavour_texts_robot["Clerical"]]', "
|
||||
TextQuery += "Security='[flavour_texts_robot["Security"]]', Research='[flavour_texts_robot["Research"]]' WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadRobotFlavourData()
|
||||
log_debug("load robot")
|
||||
TextQuery = "SELECT * FROM characters_robot_flavour WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
flavour_texts_robot["Default"] = query.item[3]
|
||||
flavour_texts_robot["Standard"] = query.item[4]
|
||||
flavour_texts_robot["Engineering"] = query.item[5]
|
||||
flavour_texts_robot["Construction"] = query.item[6]
|
||||
flavour_texts_robot["Surgeon"] = query.item[7]
|
||||
flavour_texts_robot["Crisis"] = query.item[8]
|
||||
flavour_texts_robot["Miner"] = query.item[9]
|
||||
flavour_texts_robot["Janitor"] = query.item[10]
|
||||
flavour_texts_robot["Service"] = query.item[11]
|
||||
flavour_texts_robot["Clerical"] = query.item[12]
|
||||
flavour_texts_robot["Security"] = query.item[13]
|
||||
flavour_texts_robot["Research"] = query.item[14]
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertMiscData()
|
||||
log_debug("insert misc")
|
||||
sanitizePrefs()
|
||||
TextQuery = "INSERT INTO characters_misc (char_id, med_rec, sec_rec, gen_rec, disab, used_skill, skills_spec, "
|
||||
TextQuery += "home_sys, citizen, faction, religion, NT_relation, uplink_loc, exploit_rec) VALUES ("
|
||||
TextQuery += "'[char_id]', '[med_record]', '[sec_record]', '[gen_record]', '[disabilities]', '[used_skillpoints]', "
|
||||
TextQuery += "'[skill_specialization]', '[home_system]', '[citizenship]', '[faction]', '[religion]', '[nanotrasen_relation]', "
|
||||
TextQuery += "'[uplinklocation]', '[exploit_record]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateMiscData()
|
||||
log_debug("update misc")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_misc WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertMiscData()
|
||||
TextQuery = "UPDATE characters_misc SET med_rec='[med_record]', sec_rec='[sec_record]', gen_rec='[gen_record]', disab='[disabilities]', "
|
||||
TextQuery += "used_skill='[used_skillpoints]', skills_spec='[skill_specialization]', "
|
||||
TextQuery += "home_sys='[home_system]', citizen='[citizenship]', faction='[faction]', religion='[religion]', NT_relation='[nanotrasen_relation]', uplink_loc='[uplinklocation]', "
|
||||
TextQuery += "exploit_rec='[exploit_record]' WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadMiscData()
|
||||
log_debug("load_misc")
|
||||
TextQuery = "SELECT * FROM characters_misc WHERE char_id = [char_id]"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
med_record = query.item[3]
|
||||
sec_record = query.item[4]
|
||||
gen_record = query.item[5]
|
||||
disabilities = text2num(query.item[6])
|
||||
used_skillpoints = text2num(query.item[7])
|
||||
skill_specialization = query.item[8]
|
||||
home_system = query.item[9]
|
||||
citizenship = query.item[10]
|
||||
faction = query.item[11]
|
||||
religion = query.item[12]
|
||||
nanotrasen_relation = query.item[13]
|
||||
uplinklocation = query.item[14]
|
||||
exploit_record = query.item[15]
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertSkillsData()
|
||||
log_debug("insert skills")
|
||||
TextQuery = "INSERT INTO characters_skills (char_id, Command, Botany, Cooking, Close_Combat, Weapons_Expertise, Forensics, NanoTrasen_Law, EVA, "
|
||||
TextQuery += "Construction, Electrical, Atmos, Engines, Heavy_Mach, Complex_Devices, Information_Tech, Genetics, Chemistry, Science, Medicine, Anatomy, Virology) VALUES "
|
||||
TextQuery += "('[char_id]', '[skills["management"]]', '[skills["botany"]]', '[skills["cooking"]]', '[skills["combat"]]', '[skills["weapons"]]', '[skills["forensics"]]', '[skills["law"]]', '[skills["EVA"]]',"
|
||||
TextQuery += " '[skills["construction"]]', '[skills["electrical"]]', '[skills["atmos"]]', '[skills["engines"]]', '[skills["pilot"]]', '[skills["devices"]]', '[skills["computer"]]', '[skills["genetics"]]',"
|
||||
TextQuery += " '[skills["chemistry"]]', '[skills["science"]]', '[skills["medical"]]', '[skills["anatomy"]]', '[skills["virology"]]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateSkillsData()
|
||||
log_debug("update skills")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_skills WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertSkillsData()
|
||||
TextQuery = "UPDATE characters_skills SET Command='[skills["management"]]', Botany='[skills["botany"]]', Cooking='[skills["cooking"]]', Close_Combat='[skills["combat"]]', "
|
||||
TextQuery += "Weapons_Expertise='[skills["weapons"]]', Forensics='[skills["forensics"]]', NanoTrasen_Law='[skills["law"]]', EVA='[skills["EVA"]]', "
|
||||
TextQuery += "Construction='[skills["construction"]]', Electrical='[skills["electrical"]]', Atmos='[skills["atmos"]]', Engines='[skills["engines"]]', Heavy_Mach='[skills["pilot"]]', Complex_Devices='[skills["devices"]]', "
|
||||
TextQuery += "Information_Tech='[skills["computer"]]', Genetics='[skills["genetics"]]', Chemistry='[skills["chemistry"]]', Science='[skills["science"]]', Medicine='[skills["medical"]]', "
|
||||
TextQuery += "Anatomy='[skills["anatomy"]]', Virology='[skills["virology"]]' WHERE char_id = '[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
|
||||
/datum/preferences/proc/LoadSkillsData()
|
||||
log_debug("load skills")
|
||||
TextQuery = "SELECT * FROM characters_skills WHERE char_id = '[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
skills["management"] = text2num(query.item[3])
|
||||
skills["botany"] = text2num(query.item[4])
|
||||
skills["cooking"] = text2num(query.item[5])
|
||||
skills["combat"] = text2num(query.item[6])
|
||||
skills["weapons"] = text2num(query.item[7])
|
||||
skills["forensics"] = text2num(query.item[8])
|
||||
skills["law"] = text2num(query.item[9])
|
||||
skills["EVA"] = text2num(query.item[10])
|
||||
skills["construction"] = text2num(query.item[11])
|
||||
skills["electrical"] = text2num(query.item[12])
|
||||
skills["atmos"] = text2num(query.item[13])
|
||||
skills["engines"] = text2num(query.item[14])
|
||||
skills["pilot"] = text2num(query.item[15])
|
||||
skills["devices"] = text2num(query.item[16])
|
||||
skills["computer"] = text2num(query.item[17])
|
||||
skills["genetics"] = text2num(query.item[18])
|
||||
skills["chemistry"] = text2num(query.item[19])
|
||||
skills["science"] = text2num(query.item[20])
|
||||
skills["medical"] = text2num(query.item[21])
|
||||
skills["anatomy"] = text2num(query.item[22])
|
||||
skills["virology"] = text2num(query.item[23])
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertGearData()
|
||||
log_debug("insert gear")
|
||||
//var/loop_id = 0
|
||||
var/gear_list = list2params(gear)
|
||||
//test
|
||||
TextQuery = "INSERT INTO characters_gear (char_id, gear) VALUES ('[char_id]', '[gear_list]')"
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateGearData()
|
||||
log_debug("update gear")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_gear WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertGearData()
|
||||
//var/loop_id = 0
|
||||
var/gear_list = list2params(gear)
|
||||
TextQuery = "UPDATE characters_gear SET gear='[gear_list]' WHERE char_id = '[char_id]'"
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadGearData()
|
||||
log_debug("load gear")
|
||||
TextQuery = "SELECT * FROM characters_gear WHERE char_id = '[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
gear = params2list(query.item[3])
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertOrgansData()
|
||||
log_debug("insert organs")
|
||||
TextQuery = "INSERT INTO characters_organs (char_id, l_leg, r_leg, l_arm, r_arm, l_foot, r_foot, l_hand, r_hand, heart, eyes) VALUES ("
|
||||
TextQuery += "'[char_id]', '[organ_data["l_leg"]]', '[organ_data["r_leg"]]', '[organ_data["l_arm"]]', '[organ_data["r_arm"]]', '[organ_data["l_foot"]]', '[organ_data["r_foot"]]', "
|
||||
TextQuery += "'[organ_data["l_hand"]]', '[organ_data["r_hand"]]', '[organ_data["heart"]]', '[organ_data["eyes"]]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
InsertRorgansData()
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateOrgansData()
|
||||
log_debug("update organs")
|
||||
query = dbcon.NewQuery("SELECT id FROM characters_organs WHERE char_id = '[char_id]'")
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
InsertOrgansData()
|
||||
TextQuery = "UPDATE characters_organs SET char_id='[char_id]', l_leg='[organ_data["l_leg"]]', r_leg='[organ_data["r_leg"]]', l_arm='[organ_data["l_arm"]]', r_arm='[organ_data["r_arm"]]', "
|
||||
TextQuery += "l_foot='[organ_data["l_foot"]]', r_foot='[organ_data["r_foot"]]', l_hand='[organ_data["l_hand"]]', r_hand='[organ_data["r_hand"]]', heart='[organ_data["heart"]]', eyes='[organ_data["eyes"]]'"
|
||||
TextQuery += " WHERE char_id='[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
UpdateRorgansData()
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadOrgansData()
|
||||
log_debug("load organs")
|
||||
TextQuery = "SELECT * FROM characters_organs WHERE char_id = '[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
organ_data["l_leg"] = query.item[3]
|
||||
organ_data["r_leg"] = query.item[4]
|
||||
organ_data["l_arm"] = query.item[5]
|
||||
organ_data["r_arm"] = query.item[6]
|
||||
organ_data["l_foot"] = query.item[7]
|
||||
organ_data["r_foot"] = query.item[8]
|
||||
organ_data["l_hand"] = query.item[9]
|
||||
organ_data["r_hand"] = query.item[10]
|
||||
organ_data["heart"] = query.item[11]
|
||||
organ_data["eyes"] = query.item[12]
|
||||
LoadRorgansData()
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/InsertRorgansData()
|
||||
log_debug("insert robotics organs")
|
||||
TextQuery = "INSERT INTO characters_rlimb (char_id, l_leg, r_leg, l_arm, r_arm, l_foot, r_foot, l_hand, r_hand) VALUES ("
|
||||
TextQuery += "'[char_id]', '[rlimb_data["l_leg"]]', '[rlimb_data["r_leg"]]', '[rlimb_data["l_arm"]]', '[rlimb_data["r_arm"]]', '[rlimb_data["l_foot"]]', '[rlimb_data["r_foot"]]', "
|
||||
TextQuery += "'[rlimb_data["l_hand"]]', '[rlimb_data["r_hand"]]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/UpdateRorgansData()
|
||||
log_debug("update robotics organs")
|
||||
TextQuery = "UPDATE characters_rlimb SET char_id='[char_id]', l_leg='[rlimb_data["l_leg"]]', r_leg='[rlimb_data["r_leg"]]', l_arm='[rlimb_data["l_arm"]]', r_arm='[rlimb_data["r_arm"]]', "
|
||||
TextQuery += "l_foot='[rlimb_data["l_foot"]]', r_foot='[rlimb_data["r_foot"]]', l_hand='[rlimb_data["l_hand"]]', r_hand='[rlimb_data["r_hand"]]'"
|
||||
TextQuery += " WHERE char_id = '[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadRorgansData()
|
||||
log_debug("load robotics organs")
|
||||
TextQuery = "SELECT * FROM characters_rlimb WHERE char_id = '[char_id]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
rlimb_data["l_leg"] = query.item[3]
|
||||
rlimb_data["r_leg"] = query.item[4]
|
||||
rlimb_data["l_arm"] = query.item[5]
|
||||
rlimb_data["r_arm"] = query.item[6]
|
||||
rlimb_data["l_foot"] = query.item[7]
|
||||
rlimb_data["r_foot"] = query.item[8]
|
||||
rlimb_data["l_hand"] = query.item[9]
|
||||
rlimb_data["r_hand"] = query.item[10]
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/SavePrefData(var/ckey)
|
||||
log_debug("Save pref data")
|
||||
TextQuery = "SELECT * FROM player_preferences WHERE ckey = '[ckey]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
sanitizePrefs()
|
||||
TextQuery = "INSERT INTO player_preferences (ckey, ooccolor, lastchangelog, UI_style, default_slot, toggles, UI_style_color, UI_style_alpha, be_special) "
|
||||
TextQuery += "VALUES ('[ckey]', '[ooccolor]','[lastchangelog]', '[UI_style]', '[default_slot]', '[toggles]', '[UI_style_color]', '[UI_style_alpha]','[be_special]')"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
else
|
||||
return UpdatePrefData(ckey)
|
||||
|
||||
/datum/preferences/proc/UpdatePrefData(var/ckey)
|
||||
log_debug("Update pref data")
|
||||
sanitizePrefs()
|
||||
TextQuery = "UPDATE player_preferences SET ooccolor='[ooccolor]', lastchangelog='[lastchangelog]', UI_style='[UI_style]', default_slot='[default_slot]', toggles='[toggles]', "
|
||||
TextQuery += "UI_style_color='[UI_style_color]', UI_style_alpha='[UI_style_alpha]', be_special='[be_special]' WHERE ckey = '[ckey]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/LoadPrefData(var/ckey)
|
||||
log_debug("load pref data")
|
||||
establish_db_connection(dbcon)
|
||||
if(!dbcon.IsConnected())
|
||||
return 0
|
||||
TextQuery = "SELECT * FROM player_preferences WHERE ckey = '[ckey]'"
|
||||
log_debug(TextQuery)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(dbcon.ErrorMsg())
|
||||
log_debug(dbcon.ErrorMsg())
|
||||
if(!query.RowCount())
|
||||
return 0
|
||||
log_debug("Load query executed successfully")
|
||||
query.NextRow()
|
||||
ooccolor = query.item[3]
|
||||
lastchangelog = text2num(query.item[4])
|
||||
UI_style = query.item[5]
|
||||
default_slot = text2num(query.item[6])
|
||||
toggles = text2num(query.item[7])
|
||||
UI_style_color = query.item[8]
|
||||
UI_style_alpha = text2num(query.item[9])
|
||||
be_special = text2num(query.item[10])
|
||||
sanitizePrefs()
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/sanitizePrefs()
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
|
||||
UI_style = sanitize_inlist(UI_style, list("White", "Midnight","Orange","old"), initial(UI_style))
|
||||
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
|
||||
default_slot = sanitize_integer(default_slot, 1, config.character_slots, initial(default_slot))
|
||||
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
|
||||
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
|
||||
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/SanitizeCharacter()
|
||||
|
||||
metadata = sanitize_text(metadata, initial(metadata))
|
||||
real_name = sanitizeName(real_name)
|
||||
|
||||
if(isnull(species) || !(species in playable_species))
|
||||
species = "Human"
|
||||
|
||||
if(isnum(underwear))
|
||||
var/list/undies = gender == MALE ? underwear_m : underwear_f
|
||||
underwear = undies[undies[underwear]]
|
||||
|
||||
if(isnum(undershirt))
|
||||
undershirt = undershirt_t[undershirt_t[undershirt]]
|
||||
|
||||
if(isnull(language)) language = "None"
|
||||
if(isnull(spawnpoint)) spawnpoint = "Arrivals Shuttle"
|
||||
if(isnull(nanotrasen_relation)) nanotrasen_relation = initial(nanotrasen_relation)
|
||||
if(!real_name) real_name = random_name(gender)
|
||||
be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name))
|
||||
gender = sanitize_gender(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_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))
|
||||
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))
|
||||
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))
|
||||
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))
|
||||
backbag = sanitize_integer(backbag, 1, backbaglist.len, initial(backbag))
|
||||
b_type = sanitize_text(b_type, initial(b_type))
|
||||
|
||||
alternate_option = sanitize_integer(alternate_option, 0, 2, initial(alternate_option))
|
||||
job_civilian_high = sanitize_integer(job_civilian_high, 0, 65535, initial(job_civilian_high))
|
||||
job_civilian_med = sanitize_integer(job_civilian_med, 0, 65535, initial(job_civilian_med))
|
||||
job_civilian_low = sanitize_integer(job_civilian_low, 0, 65535, initial(job_civilian_low))
|
||||
job_medsci_high = sanitize_integer(job_medsci_high, 0, 65535, initial(job_medsci_high))
|
||||
job_medsci_med = sanitize_integer(job_medsci_med, 0, 65535, initial(job_medsci_med))
|
||||
job_medsci_low = sanitize_integer(job_medsci_low, 0, 65535, initial(job_medsci_low))
|
||||
job_engsec_high = sanitize_integer(job_engsec_high, 0, 65535, initial(job_engsec_high))
|
||||
job_engsec_med = sanitize_integer(job_engsec_med, 0, 65535, initial(job_engsec_med))
|
||||
job_engsec_low = sanitize_integer(job_engsec_low, 0, 65535, initial(job_engsec_low))
|
||||
|
||||
if(!skills) skills = list()
|
||||
if(!used_skillpoints) used_skillpoints= 0
|
||||
if(isnull(disabilities)) disabilities = 0
|
||||
if(!player_alt_titles) player_alt_titles = new()
|
||||
if(!organ_data) src.organ_data = list()
|
||||
if(!rlimb_data) src.rlimb_data = list()
|
||||
if(!gear) src.gear = list()
|
||||
|
||||
if(!home_system) home_system = "Unset"
|
||||
if(!citizenship) citizenship = "None"
|
||||
if(!faction) faction = "None"
|
||||
if(!religion) religion = "None"
|
||||
return 1
|
||||
@@ -32,6 +32,7 @@ datum/preferences
|
||||
//doohickeys for savefiles
|
||||
var/path
|
||||
var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used
|
||||
var/current_slot = 1
|
||||
var/savefile_version = 0
|
||||
|
||||
//non-preference stuff
|
||||
@@ -134,17 +135,35 @@ datum/preferences
|
||||
var/metadata = ""
|
||||
var/slot_name = ""
|
||||
|
||||
//SQL Save system vars
|
||||
var/chardata[]
|
||||
var/jobsdata[]
|
||||
var/flavourdata[]
|
||||
var/miscdata[]
|
||||
var/DBQuery/query
|
||||
var/TextQuery
|
||||
var/char_id
|
||||
var/char_slot
|
||||
|
||||
/datum/preferences/New(client/C)
|
||||
b_type = pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+")
|
||||
if(istype(C))
|
||||
if(!IsGuestKey(C.key))
|
||||
load_path(C.ckey)
|
||||
if(load_preferences())
|
||||
if(load_character())
|
||||
log_debug("loading data for [C.ckey]")
|
||||
if(LoadPrefData(C.ckey))
|
||||
log_debug("Default slot loaded : [default_slot]")
|
||||
if(SQLload_character(default_slot, C.ckey))
|
||||
current_slot = default_slot
|
||||
log_debug("Character [real_name] loaded, slot is [current_slot]")
|
||||
return
|
||||
if(load_preferences())
|
||||
if(load_character(default_slot))
|
||||
current_slot = getCharSlot_File()
|
||||
return
|
||||
//this ensure that if db fail the file system is used to load an initial character
|
||||
gender = pick(MALE, FEMALE)
|
||||
real_name = random_name(gender,species)
|
||||
|
||||
gear = list()
|
||||
|
||||
/datum/preferences/proc/ZeroSkills(var/forced = 0)
|
||||
@@ -1363,7 +1382,7 @@ datum/preferences
|
||||
s_tone = 35 - max(min( round(new_s_tone), 220),1)
|
||||
|
||||
if("skin")
|
||||
if(species == "Unathi" || species == "Tajara" || species == "Skrell" || species == "Machine")
|
||||
if(species == "Unathi" || species == "Tajara" || species == "Skrell" || species == "Machine" || species == "Vaurca")
|
||||
var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", rgb(r_skin, g_skin, b_skin)) as color|null
|
||||
if(new_skin)
|
||||
r_skin = hex2num(copytext(new_skin, 2, 4))
|
||||
@@ -1597,22 +1616,48 @@ datum/preferences
|
||||
toggles ^= CHAT_GHOSTRADIO
|
||||
|
||||
if("save")
|
||||
save_preferences()
|
||||
save_character()
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
//switch comment to switch to file save system
|
||||
default_slot = current_slot
|
||||
SavePrefData(ckey)
|
||||
SQLsave_character(current_slot, ckey)
|
||||
//save_preferences()
|
||||
//save_character()
|
||||
|
||||
if("reload")
|
||||
load_preferences()
|
||||
load_character()
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
//switch comment to switch to file save system
|
||||
LoadPrefData(ckey)
|
||||
SQLload_character(current_slot, ckey)
|
||||
//load_preferences()
|
||||
//load_character()
|
||||
|
||||
if("open_load_dialog")
|
||||
if(!IsGuestKey(user.key))
|
||||
//file system preferences
|
||||
//open_load_dialog_file(user)
|
||||
open_load_dialog(user)
|
||||
|
||||
if("close_load_dialog")
|
||||
close_load_dialog(user)
|
||||
|
||||
if("changeslot")
|
||||
load_character(text2num(href_list["num"]))
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
current_slot = text2num(href_list["num"])
|
||||
if(!SQLload_character(current_slot, ckey))
|
||||
gender = pick(MALE, FEMALE)
|
||||
real_name = random_name(gender,species)
|
||||
gear.Cut()
|
||||
ZeroSkills(1)
|
||||
ResetJobs()
|
||||
//file system load
|
||||
//load_character()
|
||||
close_load_dialog(user)
|
||||
|
||||
ShowChoices(user)
|
||||
@@ -1730,6 +1775,44 @@ datum/preferences
|
||||
var/dat = "<body>"
|
||||
dat += "<tt><center>"
|
||||
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
var/TextQuery = "SELECT Character_Name FROM SS13_characters WHERE ckey = '[ckey]' ORDER BY slot"
|
||||
var/DBQuery/query
|
||||
establish_db_connection(dbcon)
|
||||
if(!dbcon.IsConnected())
|
||||
open_load_dialog_file(user)
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
var/rows
|
||||
if(!query.RowCount())
|
||||
rows = 0
|
||||
else
|
||||
rows = query.RowCount()
|
||||
dat += "<b>Select a character slot to load (SQL Edition !)</b><hr>"
|
||||
var/name
|
||||
for(var/i=1, i<= config.character_slots, i++)
|
||||
log_debug("[rows] rows queried, i = [i]")
|
||||
if(i<=rows)
|
||||
query.NextRow()
|
||||
name = query.item[1]
|
||||
log_debug("adding [query.item[1]] to list")
|
||||
else name = "Character[i]"
|
||||
if(i==default_slot)
|
||||
name = "<b>[name]</b>"
|
||||
dat += "<a href='?_src_=prefs;preference=changeslot;num=[i];'>[name]</a><br>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<a href='byond://?src=\ref[user];preference=close_load_dialog'>Close</a><br>"
|
||||
dat += "</center></tt>"
|
||||
user << browse(dat, "window=saves;size=300x390")
|
||||
|
||||
|
||||
/datum/preferences/proc/open_load_dialog_file(mob/user)
|
||||
var/dat = "<body>"
|
||||
dat += "<tt><center>"
|
||||
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(S)
|
||||
dat += "<b>Select a character slot to load</b><hr>"
|
||||
@@ -1741,11 +1824,39 @@ datum/preferences
|
||||
if(i==default_slot)
|
||||
name = "<b>[name]</b>"
|
||||
dat += "<a href='?_src_=prefs;preference=changeslot;num=[i];'>[name]</a><br>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<a href='byond://?src=\ref[user];preference=close_load_dialog'>Close</a><br>"
|
||||
dat += "</center></tt>"
|
||||
user << browse(dat, "window=saves;size=300x390")
|
||||
|
||||
/datum/preferences/proc/getCharSlot()
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
var/TextQuery = "SELECT slot FROM SS13_characters WHERE ckey = '[ckey]' AND Character_Name = '[real_name]'"
|
||||
var/DBQuery/query
|
||||
establish_db_connection(dbcon)
|
||||
if(!dbcon.IsConnected())
|
||||
getCharSlot_File()
|
||||
query = dbcon.NewQuery(TextQuery)
|
||||
query.Execute()
|
||||
if(!query.RowCount())
|
||||
return 1
|
||||
query.NextRow()
|
||||
return text2num(query.item[1])
|
||||
return 1
|
||||
|
||||
|
||||
/datum/preferences/proc/getCharSlot_File() //get character slot from savefile
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(S)
|
||||
var/name
|
||||
for(var/i=1, i<= config.character_slots, i++)
|
||||
S.cd = "/character[i]"
|
||||
S["real_name"] >> name
|
||||
if(name == real_name)
|
||||
return i
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/close_load_dialog(mob/user)
|
||||
user << browse(null, "window=saves")
|
||||
|
||||
@@ -205,7 +205,7 @@ BLIND // can't see anything
|
||||
body_parts_covered = HANDS
|
||||
slot_flags = SLOT_GLOVES
|
||||
attack_verb = list("challenged")
|
||||
species_restricted = list("exclude","Unathi","Tajara")
|
||||
species_restricted = list("exclude","Unathi","Tajara","Vaurca")
|
||||
sprite_sheets = list("Vox" = 'icons/mob/species/vox/gloves.dmi')
|
||||
|
||||
/obj/item/clothing/gloves/update_clothing_icon()
|
||||
@@ -243,6 +243,7 @@ BLIND // can't see anything
|
||||
if("exclude" in species_restricted)
|
||||
species_restricted -= "Unathi"
|
||||
species_restricted -= "Tajara"
|
||||
species_restricted -= "Vaurca"
|
||||
return
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@@ -335,7 +336,7 @@ BLIND // can't see anything
|
||||
slowdown = SHOES_SLOWDOWN
|
||||
force = 2
|
||||
var/overshoes = 0
|
||||
species_restricted = list("exclude","Unathi","Tajara")
|
||||
species_restricted = list("exclude","Unathi","Tajara","Vaurca")
|
||||
sprite_sheets = list("Vox" = 'icons/mob/species/vox/shoes.dmi')
|
||||
var/silent = 0
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
if("exclude" in species_restricted)
|
||||
species_restricted -= "Unathi"
|
||||
species_restricted -= "Tajara"
|
||||
species_restricted -= "Vaurca"
|
||||
return
|
||||
else
|
||||
user << "<span class='notice'>The [src] have already been clipped!</span>"
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
M.lastattacker = user
|
||||
user.attack_log += "\[[time_stamp()]\]<font color='red'> Attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])</font>"
|
||||
M.attack_log += "\[[time_stamp()]\]<font color='orange'> Attacked by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])</font>"
|
||||
msg_admin_attack("[key_name(user)] attacked [key_name(M)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)" )
|
||||
msg_admin_attack("[key_name(user)] attacked [key_name(M)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)" )
|
||||
|
||||
if(istype(M, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = M
|
||||
|
||||
@@ -322,6 +322,30 @@
|
||||
set_trait(TRAIT_PLANT_COLOUR,"#D9C94E")
|
||||
set_trait(TRAIT_PLANT_ICON,"mushroom")
|
||||
|
||||
/datum/seed/koisspore
|
||||
name = "koisspore"
|
||||
seed_name = "kois"
|
||||
seed_noun = "spires"
|
||||
display_name = "k'ois spores"
|
||||
mutants = null
|
||||
chems = list("koispaste" = list(25))
|
||||
splat_type = /obj/effect/plant
|
||||
kitchen_tag = "koisspore"
|
||||
|
||||
/datum/seed/koisspore/New()
|
||||
..()
|
||||
set_trait(TRAIT_MATURATION,5)
|
||||
set_trait(TRAIT_PRODUCTION,1)
|
||||
set_trait(TRAIT_YIELD,8)
|
||||
set_trait(TRAIT_POTENCY,60)
|
||||
set_trait(TRAIT_BIOLUM,1)
|
||||
set_trait(TRAIT_CARNIVOROUS,1)
|
||||
set_trait(TRAIT_BIOLUM_COLOUR,"#94b21c")
|
||||
set_trait(TRAIT_PRODUCT_ICON,"mushroom11")
|
||||
set_trait(TRAIT_PRODUCT_COLOUR,"#94b21c")
|
||||
set_trait(TRAIT_PLANT_COLOUR,"#94b21c")
|
||||
set_trait(TRAIT_PLANT_ICON,"mushroom6")
|
||||
|
||||
/datum/seed/mushroom/mold
|
||||
name = "mold"
|
||||
seed_name = "brown mold"
|
||||
|
||||
@@ -280,3 +280,6 @@ var/global/list/plant_seed_sprites = list()
|
||||
|
||||
/obj/item/seeds/thaadra
|
||||
seed_type = "thaadra"
|
||||
|
||||
/obj/item/seeds/koisspore
|
||||
seed_type = "koisspore"
|
||||
|
||||
@@ -292,5 +292,5 @@
|
||||
var/mob/living/M = G.affecting
|
||||
if(!istype(M)) return //wut
|
||||
M.apply_damage(30,BRUTE)
|
||||
if(M.stat == 2)
|
||||
M.gib()
|
||||
// if(M.stat == 2)
|
||||
// M.gib()
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
|
||||
proc/handle_mutations_and_radiation()
|
||||
|
||||
if(species.flags & IS_SYNTHETIC || species.name == "Vaurca") //Robots/bugs don't suffer from mutations or radloss.
|
||||
if(species.flags & IS_SYNTHETIC || species.name == "Vaurca") //Robots & bugs don't suffer from mutations or radloss.
|
||||
return
|
||||
|
||||
if(getFireLoss())
|
||||
@@ -439,6 +439,13 @@
|
||||
var/failed_inhale = 0
|
||||
var/failed_exhale = 0
|
||||
|
||||
if(species.has_organ["breathing apparatus"])
|
||||
var/obj/item/organ/vaurca/breathingapparatus/L = internal_organs_by_name["breathing apparatus"]
|
||||
if(isnull(L))
|
||||
poison_type = null
|
||||
else if(L.is_broken())
|
||||
poison_type = "oxygen" //if Vaurca breathing apparatus breaks, oxygen becomes poisonous.
|
||||
|
||||
if(species.breath_type)
|
||||
breath_type = species.breath_type
|
||||
else
|
||||
@@ -1636,7 +1643,7 @@
|
||||
else if(foundVirus)
|
||||
holder.icon_state = "hudill"
|
||||
/* else if(has_brain_worms())
|
||||
var/mob/living/simple_animal/borer/B = has_brain_worms() //Cotrical borer disable
|
||||
var/mob/living/simple_animal/borer/B = has_brain_worms()
|
||||
if(B.controlling)
|
||||
holder.icon_state = "hudbrainworm"
|
||||
else
|
||||
|
||||
@@ -269,20 +269,29 @@
|
||||
|
||||
/datum/species/bug
|
||||
name = "Vaurca"
|
||||
name_plural = "varucae"
|
||||
name_plural = "Vaurcae"
|
||||
|
||||
icobase = 'icons/mob/human_races/r_vaurca.dmi'
|
||||
deform = 'icons/mob/human_races/r_vaurca.dmi'
|
||||
language = "Vaurcese"
|
||||
unarmed_types = list(/datum/unarmed_attack/stomp, /datum/unarmed_attack/kick, /datum/unarmed_attack/claws, /datum/unarmed_attack/bite/sharp)
|
||||
rarity_value = 2
|
||||
slowdown = 1
|
||||
darksight = 5 //USELESS
|
||||
eyes = "blank_eyes"
|
||||
slowdown = 0 //may become a bonus if vaurca gain more legs.
|
||||
darksight = 8 //USELESS
|
||||
eyes = "vaurca_eyes" //makes it so that eye colour is not changed when skin colour is.
|
||||
brute_mod = 0.5 //note to self: remove is_synthetic checks for brmod and burnmod
|
||||
burn_mod = 2
|
||||
burn_mod = 1.5 //2x was a bit too much. we'll see how this goes.
|
||||
warning_low_pressure = 50
|
||||
hazard_low_pressure = 0
|
||||
siemens_coefficient = 0 //attempting to mimic the old insulation feature.
|
||||
breath_type = "oxygen"
|
||||
poison_type = "null" //a species that breathes plasma shouldn't be poisoned by it.
|
||||
blurb = "Vaurca are a bipedal insectoid species from the first moon of Sedantis I. \
|
||||
They have a complex caste system consisting of the lower slave caste called The Bound and the higher, free-thinking caste of the Unbound. \
|
||||
The majority of Vaurca present in human-space belong to the former caste of Bound, and almost all Vaurca working on NanoTrasen Stations are similarly Bound. \
|
||||
Although tolerated on Nanotrasen stations and in Tau Ceti, they are often discriminated against and are unwelcome in most human-owned \
|
||||
sectors in the Sol Alliance. All Vaurca present in human space are colonists at the end of a 2,000 year journey, and all contact with \
|
||||
their homeworld has been lost. All Vaurca legally present in Tau Ceti belong either to the Zo'ra hive, or the K'lax hive."
|
||||
|
||||
cold_level_1 = 50
|
||||
cold_level_2 = -1
|
||||
@@ -291,9 +300,10 @@
|
||||
heat_level_1 = 330 //Default 360
|
||||
heat_level_2 = 380 //Default 400
|
||||
heat_level_3 = 600 //Default 1000
|
||||
flags = CAN_JOIN | IS_WHITELISTED | NO_SLIP | NO_SCAN
|
||||
flags = CAN_JOIN | NO_SLIP | NO_SCAN | HAS_SKIN_COLOR | IS_WHITELISTED
|
||||
blood_color = "#E6E600" // dark yellow
|
||||
flesh_color = "#575757"
|
||||
flesh_color = "#E6E600"
|
||||
base_color = "#575757"
|
||||
|
||||
inherent_verbs = list(
|
||||
/mob/living/carbon/human/proc/bugbite //weaker version of gut.
|
||||
@@ -310,3 +320,7 @@
|
||||
"brain" = /obj/item/organ/brain,
|
||||
"eyes" = /obj/item/organ/eyes,
|
||||
)
|
||||
|
||||
/datum/species/unathi/equip_survival_gear(var/mob/living/carbon/human/H)
|
||||
..()
|
||||
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(H),slot_shoes)
|
||||
@@ -127,14 +127,14 @@ var/const/MAX_ACTIVE_TIME = 400
|
||||
|
||||
L.visible_message("\red \b [src] leaps at [L]'s face!")
|
||||
|
||||
/* Tentatively removed since huggers can't be thrown anymore
|
||||
|
||||
if(ishuman(L))
|
||||
var/mob/living/carbon/human/H = L
|
||||
if(H.head && H.head.flags & HEADCOVERSMOUTH)
|
||||
H.visible_message("\red \b [src] smashes against [H]'s [H.head]!")
|
||||
Die()
|
||||
return
|
||||
*/
|
||||
|
||||
|
||||
if(iscarbon(M))
|
||||
var/mob/living/carbon/target = L
|
||||
|
||||
@@ -54,11 +54,6 @@ datum/skill/construction
|
||||
desc = "Your ability to construct various buildings, such as walls, floors, tables and so on. Note that constructing devices such as APCs additionally requires the Electronics skill. A low level of this skill is typical for janitors, a high level of this skill is typical for engineers."
|
||||
field = "Engineering"
|
||||
|
||||
datum/skill/management
|
||||
ID = "management"
|
||||
name = "Command"
|
||||
desc = "Your ability to manage and commandeer other crew members."
|
||||
|
||||
datum/skill/knowledge/law
|
||||
ID = "law"
|
||||
name = "NanoTrasen Law"
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
/* Food */
|
||||
/datum/reagent/kois
|
||||
name = "K'ois"
|
||||
id = "koispaste"
|
||||
description = "A thick goopy substance, rich in K'ois nutrients."
|
||||
metabolism = REM * 4
|
||||
var/nutriment_factor = 40
|
||||
var/injectable = 0
|
||||
color = "#dcd9cd"
|
||||
|
||||
/datum/reagent/kois/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
if(M.get_species() == "Vaurca")
|
||||
M.heal_organ_damage(0.8 * removed, 0)
|
||||
M.nutrition += nutriment_factor * removed // For hunger and fatness
|
||||
M.add_chemical_effect(CE_BLOODRESTORE, 6 * removed)
|
||||
else
|
||||
M.adjustToxLoss(1.5 * removed)
|
||||
return
|
||||
..()
|
||||
|
||||
/datum/reagent/nutriment
|
||||
name = "Nutriment"
|
||||
@@ -17,10 +35,14 @@
|
||||
affect_ingest(M, alien, removed)
|
||||
|
||||
/datum/reagent/nutriment/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
M.heal_organ_damage(0.5 * removed, 0)
|
||||
M.nutrition += nutriment_factor * removed // For hunger and fatness
|
||||
M.add_chemical_effect(CE_BLOODRESTORE, 4 * removed)
|
||||
|
||||
if(M.get_species() == "Vaurca")
|
||||
M.adjustToxLoss(1.5 * removed)
|
||||
else
|
||||
M.heal_organ_damage(0.8 * removed, 0)
|
||||
M.nutrition += nutriment_factor * removed // For hunger and fatness
|
||||
M.add_chemical_effect(CE_BLOODRESTORE, 6 * removed)
|
||||
return
|
||||
..()
|
||||
/datum/reagent/nutriment/protein // Bad for Skrell!
|
||||
name = "animal protein"
|
||||
id = "protein"
|
||||
@@ -299,7 +321,7 @@
|
||||
M.eye_blind = max(M.eye_blind, 10)
|
||||
|
||||
if(mouth_covered)
|
||||
if(!message)
|
||||
if(!message)
|
||||
message = "<span class='warning'>Your [face_protection] protects you from the pepperspray!</span>"
|
||||
else if(!no_pain)
|
||||
message = "<span class='danger'>Your face and throat burn!</span>"
|
||||
|
||||
@@ -245,6 +245,17 @@
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/koisbar
|
||||
name = "K'ois Bar"
|
||||
desc = "Bland NanoTrasen produced K'ois bars, rich in syrup."
|
||||
icon_state = "koisbar"
|
||||
trash = /obj/item/trash/koisbar
|
||||
filling_color = "#dcd9cd"
|
||||
|
||||
New()
|
||||
..()
|
||||
reagents.add_reagent("kois", 20)
|
||||
bitesize = 5
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/aesirsalad
|
||||
name = "Aesir salad"
|
||||
|
||||
Reference in New Issue
Block a user