diff --git a/baystation12.dme b/baystation12.dme index 8e69350ebe..9100395f76 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -454,6 +454,7 @@ #include "code\game\gamemodes\sandbox\h_sandbox.dm" #include "code\game\gamemodes\sandbox\sandbox.dm" #include "code\game\gamemodes\traitor\traitor.dm" +#include "code\game\gamemodes\traitor\traitor_info.dm" #include "code\game\gamemodes\wizard\rightandwrong.dm" #include "code\game\gamemodes\wizard\soulstone.dm" #include "code\game\gamemodes\wizard\spellbook.dm" @@ -1178,8 +1179,8 @@ #include "code\WorkInProgress\Mloc\Shortcuts.dm" #include "code\WorkInProgress\organs\implants.dm" #include "code\WorkInProgress\organs\organs.dm" -#include "code\WorkInProgress\Ported\head.dm" #include "code\WorkInProgress\Ported\policetape.dm" +#include "code\WorkInProgress\Ported\sql.dm" #include "code\WorkInProgress\Ported\Abi79\uplink_kits.dm" #include "code\WorkInProgress\Ported\Abi79\uplinks.dm" #include "code\WorkInProgress\Ported\Bureaucracy\copier.dm" diff --git a/code/WorkInProgress/Ported/Abi79/uplinks.dm b/code/WorkInProgress/Ported/Abi79/uplinks.dm index 203cbb77bb..ae261a85ac 100644 --- a/code/WorkInProgress/Ported/Abi79/uplinks.dm +++ b/code/WorkInProgress/Ported/Abi79/uplinks.dm @@ -175,9 +175,9 @@ A list of items and costs is stored under the datum of every game mode, alongsid if(text2num(href_list["cost"]) > uses) // Not enough crystals for the item return 0 - //if(usr:mind && ticker.mode.traitors[usr:mind]) - //var/datum/traitorinfo/info = ticker.mode.traitors[usr:mind] - //info.spawnlist += href_list["buy_item"] + if(usr:mind && ticker.mode.traitors[usr:mind]) + var/datum/traitorinfo/info = ticker.mode.traitors[usr:mind] + info.spawnlist += href_list["buy_item"] uses -= text2num(href_list["cost"]) @@ -268,7 +268,7 @@ A list of items and costs is stored under the datum of every game mode, alongsid else item:loc = get_turf(A) usr.update_clothing() - // usr.client.onBought("[item:name]") When we have the stats again, uncomment. + usr.client.onBought("[item:name]") /* if(istype(item, /obj/spawner)) // Spawners need to have del called on them to avoid leaving a marker behind del item*/ //HEADFINDBACK @@ -371,7 +371,7 @@ A list of items and costs is stored under the datum of every game mode, alongsid item:loc = get_turf(A) /* if(istype(item, /obj/spawner)) // Spawners need to have del called on them to avoid leaving a marker behind del item*/ - // usr.client.onBought("[item:name]") When we have the stats again, uncomment. + usr.client.onBought("[item:name]") src.attack_self(usr) return diff --git a/code/WorkInProgress/Ported/head.dm b/code/WorkInProgress/Ported/sql.dm similarity index 55% rename from code/WorkInProgress/Ported/head.dm rename to code/WorkInProgress/Ported/sql.dm index d1cac9bc30..9e0cad90ad 100644 --- a/code/WorkInProgress/Ported/head.dm +++ b/code/WorkInProgress/Ported/sql.dm @@ -1,48 +1,65 @@ -//This looks to be the traitor win tracker code. Gonna comment it out as we lack it currently. -/* +//This looks to be the traitor win tracker code. client/proc/add_roundsjoined() if(!makejson) return + var/DBConnection/dbcon = new() + + dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") + if(!dbcon.IsConnected()) return + var/DBQuery/cquery = dbcon.NewQuery("INSERT INTO `roundsjoined` (`ckey`) VALUES ('[ckey(src.key)]')") if(!cquery.Execute()) message_admins(cquery.ErrorMsg()) + client/proc/add_roundssurvived() if(!makejson) return + var/DBConnection/dbcon = new() + + dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") + if(!dbcon.IsConnected()) return + var/DBQuery/cquery = dbcon.NewQuery("INSERT INTO `roundsurvived` (`ckey`) VALUES ('[ckey(src.key)]')") if(!cquery.Execute()) message_admins(cquery.ErrorMsg()) -client/proc/onDeath(var/mob/A = src.mob) + +client/proc/onDeath() if(!makejson) return roundinfo.deaths++ - if(!ismob(A)) + if(!ismob(mob)) return - var/ckey = src.ckey - var/area + var/area = get_area(mob) var/attacker var/tod = time2text(world.realtime) var/health var/last - if(isturf(A.loc)) - area = A.loc:loc:name - else - area = A.loc:name - if(ishuman(A.lastattacker)) - attacker = A.lastattacker:name + if(ishuman(mob.lastattacker)) + attacker = mob.lastattacker:name else attacker = "None" - health = "Oxy:[A.oxyloss]Brute:[A.bruteloss]Burn:[A.fireloss]Toxins:[A.toxloss]" - if(A.logs.len >= 1) - last = A.logs[A.logs.len] + health = "Oxy:[mob.oxyloss]Brute:[mob.bruteloss]Burn:[mob.fireloss]Toxins:[mob.toxloss]Brain:[mob.brainloss]" + if(mob.attack_log.len >= 1) + last = mob.attack_log[mob.attack_log.len] else last = "None" + + var/DBConnection/dbcon = new() + + dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") + if(!dbcon.IsConnected()) return + var/DBQuery/cquery = dbcon.NewQuery("INSERT INTO `deathlog` (`ckey`,`location`,`lastattacker`,`ToD`,`health`,`lasthit`) VALUES ('[ckey]',[dbcon.Quote(area)],[dbcon.Quote(attacker)],'[tod]','[health]',[dbcon.Quote(last)])") if(!cquery.Execute()) message_admins(cquery.ErrorMsg()) + client/proc/onBought(names) if(!makejson) return if(!names) return + var/DBConnection/dbcon = new() + + dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") + if(!dbcon.IsConnected()) return + var/DBQuery/cquery = dbcon.NewQuery("INSERT INTO `traitorbuy` (`type`) VALUES ([dbcon.Quote(names)])") if(!cquery.Execute()) message_admins(cquery.ErrorMsg()) -*/ datum/roundinfo var/core = 0 diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 42837d308c..6cff317a6c 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -22,6 +22,7 @@ list/datum/mind/modePlayer = new list/restricted_jobs = list() // Jobs it doesn't make sense to be. I.E chaplain or AI cultist list/protected_jobs = list() // Jobs that can't be tratiors because + list/logtraitors = list() required_players = 1 required_enemies = 0 recommended_enemies = 0 diff --git a/code/game/gamemodes/meme/meme.dm b/code/game/gamemodes/meme/meme.dm index 6b91dc6e4e..2782617d8d 100644 --- a/code/game/gamemodes/meme/meme.dm +++ b/code/game/gamemodes/meme/meme.dm @@ -92,7 +92,7 @@ // if picking hosts works with this method, remove the method above if(!first_host) first_host = pick(first_hosts) - first_hosts.remove(first_host) + first_hosts.Remove(first_host) M.enter_host(first_host.current) forge_meme_objectives(meme, first_host) diff --git a/code/game/gamemodes/revolution/rp-revolution.dm b/code/game/gamemodes/revolution/rp-revolution.dm index c66dfef4cd..1c8d2367ee 100644 --- a/code/game/gamemodes/revolution/rp-revolution.dm +++ b/code/game/gamemodes/revolution/rp-revolution.dm @@ -25,15 +25,13 @@ /datum/game_mode/rp_revolution/announce() world << "The current game mode is - Revolution RP!" -// world << "Some crewmembers are attempting to start a revolution!
\nRevolutionaries - Kill the Captain, HoP, and HoS. Convert other crewmembers (excluding the Captain, HoP, HoS, and security officers) to your cause. Protect your leaders.
\nPersonnel - Protect the Captain, HoP, and HoR. Kill the leaders of the revolution, and brainwash the other revolutionaries (by beating them in the head).
" /datum/game_mode/rp_revolution/send_intercept() var/intercepttext = "Cent. Com. Update Requested staus information:
" intercepttext += " Cent. Com has recently been contacted by the following syndicate affiliated organisations in your area, please investigate any information you may have:" var/list/possible_modes = list() - possible_modes.Add("revolution", "wizard", "nuke", "traitor", "malf") - possible_modes -= "nuke" + possible_modes.Add("revolution", "wizard", "traitor", "malf") var/number = pick(2, 3) var/i = 0 for(i = 0, i < number, i++) diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index c3d311e7ad..c80099fb9c 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -78,6 +78,10 @@ /datum/game_mode/proc/forge_traitor_objectives(var/datum/mind/traitor) + var/datum/traitorinfo/info = new + info.ckey = traitor.key + info.starting_player_count = num_players() + info.starting_name = traitor.current.name if(istype(traitor.current, /mob/living/silicon)) var/datum/objective/assassinate/kill_objective = new kill_objective.owner = traitor @@ -92,11 +96,16 @@ var/datum/objective/block/block_objective = new block_objective.owner = traitor traitor.objectives += block_objective + info.starting_occupation = "AI" else + info.starting_occupation = (traitor.current:wear_id && traitor.current:wear_id:assignment ? traitor.current:wear_id:assignment : traitor.assigned_role) for(var/datum/objective/o in SelectObjectives((istype(traitor.current:wear_id, /obj/item/weapon/card/id) ? traitor.current:wear_id:assignment : traitor.assigned_role), traitor)) o.owner = traitor traitor.objectives += o + for(var/datum/objective/objective in traitor.objectives) + info.starting_objective += "[objective.explanation_text] " + logtraitors[traitor] = info return @@ -184,6 +193,15 @@ else world << "The [special_role_text] has failed!" //feedback_add_details("traitor_success","FAIL") + + var/datum/traitorinfo/info = logtraitors[traitor] + if (info) + var/DBConnection/dbcon = new() + dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") + if(dbcon.IsConnected()) + var/DBQuery/query = dbcon.NewQuery("INSERT INTO `bay12`.`traitorlogs` (`CKey`, `Objective`, `Succeeded`, `Spawned`, `Occupation`, `PlayerCount`) VALUES ('[info.ckey]', [dbcon.Quote(info.starting_objective)], '[traitorwin]', '[dd_list2text(info.spawnlist, ";")]', '[info.starting_occupation]', '[info.starting_player_count]')") + query.Execute() + return 1 diff --git a/code/game/gamemodes/traitor/traitor_info.dm b/code/game/gamemodes/traitor/traitor_info.dm new file mode 100644 index 0000000000..d3d4b1a47d --- /dev/null +++ b/code/game/gamemodes/traitor/traitor_info.dm @@ -0,0 +1,7 @@ +/datum/traitorinfo + var/starting_objective = "" + var/starting_player_count = 0 + var/starting_occupation = "" + var/starting_name = "" + var/ckey = "" + var/list/spawnlist = list() \ No newline at end of file diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 4bdc2b9890..c7f2139042 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -277,6 +277,7 @@ var/global/datum/controller/occupations/job_master if(!equipped) var/obj/item/clothing/glasses/G = H.glasses G.prescription = 1 + H.client.add_roundsjoined() H.update_clothing() return 1 diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm index 3970dab6f0..ba3034ad53 100644 --- a/code/modules/mob/death.dm +++ b/code/modules/mob/death.dm @@ -47,6 +47,7 @@ /mob/proc/death(gibbed) timeofdeath = world.time + client.onDeath() var/cancel = 0 for(var/mob/M in world) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index e80a0c2164..f72051a457 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -74,7 +74,7 @@ var/computer_id = null var/lastattacker = null var/lastattacked = null - var/attack_log = list( ) + var/list/attack_log = list( ) var/already_placed = 0.0 var/obj/machinery/machine = null var/other_mobs = null