Bleeding edgy refresh (#303)
* not code stuff * other things * global vars, defines, helpers * onclick hud stuff, orphans, world.dm * controllers and datums * game folder * everything not client/mobs in modules * client folder * stage 1 mob stuff * simple animal things * silicons * carbon things * ayylmaos and monkeys * hyoomahn * icons n shit * sprite fixes * compile fixes * some fixes I cherrypicked. * qdel fixes * forgot brain refractors
This commit is contained in:
@@ -72,7 +72,7 @@ DBConnection/proc/Connect()
|
||||
doConnect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
||||
. = IsConnected()
|
||||
if (!. && config.sql_enabled)
|
||||
log_world("SQL error: " + ErrorMsg())
|
||||
log_sql("Connect() failed | [ErrorMsg()]")
|
||||
++failed_connections
|
||||
|
||||
DBConnection/proc/doConnect(dbi_handler=src.dbi,user_handler=src.user,password_handler=src.password,cursor_handler)
|
||||
@@ -122,9 +122,16 @@ DBQuery
|
||||
|
||||
DBQuery/proc/Connect(DBConnection/connection_handler) src.db_connection = connection_handler
|
||||
|
||||
DBQuery/proc/Execute(sql_query=src.sql,cursor_handler=default_cursor)
|
||||
DBQuery/proc/warn_execute()
|
||||
. = Execute()
|
||||
if(!.)
|
||||
to_chat(usr, "<span class='danger'>A SQL error occured during this operation, check the server logs.</span>")
|
||||
|
||||
DBQuery/proc/Execute(sql_query=src.sql,cursor_handler=default_cursor, log_error = 1)
|
||||
Close()
|
||||
return _dm_db_execute(_db_query,sql_query,db_connection._db_con,cursor_handler,null)
|
||||
. = _dm_db_execute(_db_query,sql_query,db_connection._db_con,cursor_handler,null)
|
||||
if(!. && log_error)
|
||||
log_sql("[ErrorMsg()] | Query used: [sql]")
|
||||
|
||||
DBQuery/proc/NextRow() return _dm_db_next_row(_db_query,item,conversions)
|
||||
|
||||
|
||||
@@ -26,15 +26,21 @@
|
||||
|
||||
for(var/mob/M in player_list)
|
||||
if(!isnewplayer(M) && !M.ear_deaf)
|
||||
M << announcement
|
||||
to_chat(M, announcement)
|
||||
if(M.client.prefs.toggles & SOUND_ANNOUNCEMENTS)
|
||||
M << sound(sound)
|
||||
|
||||
/proc/print_command_report(text = "", title = "Central Command Update")
|
||||
for (var/obj/machinery/computer/communications/C in machines)
|
||||
/proc/print_command_report(text = "", title = null, announce=TRUE)
|
||||
if(!title)
|
||||
title = "Classified [command_name()] Update"
|
||||
|
||||
if(announce)
|
||||
priority_announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/AI/commandreport.ogg')
|
||||
|
||||
for(var/obj/machinery/computer/communications/C in machines)
|
||||
if(!(C.stat & (BROKEN|NOPOWER)) && C.z == ZLEVEL_STATION)
|
||||
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( C.loc )
|
||||
P.name = "paper- '[title]'"
|
||||
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(C.loc)
|
||||
P.name = "paper - '[title]'"
|
||||
P.info = text
|
||||
C.messagetitle.Add("[title]")
|
||||
C.messagetext.Add(text)
|
||||
@@ -46,7 +52,7 @@
|
||||
|
||||
for(var/mob/M in player_list)
|
||||
if(!isnewplayer(M) && !M.ear_deaf)
|
||||
M << "<b><font size = 3><font color = red>[title]</font color><BR>[message]</font size></b><BR>"
|
||||
to_chat(M, "<b><font size = 3><font color = red>[title]</font color><BR>[message]</font size></b><BR>")
|
||||
if(M.client.prefs.toggles & SOUND_ANNOUNCEMENTS)
|
||||
if(alert)
|
||||
M << sound('sound/misc/notice1.ogg')
|
||||
|
||||
@@ -65,10 +65,11 @@ var/datum/feedback/blackbox = new()
|
||||
if (!dbcon.Connect()) return
|
||||
var/round_id
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
|
||||
query.Execute()
|
||||
while (query.NextRow())
|
||||
round_id = query.item[1]
|
||||
var/DBQuery/query_feedback_max_id = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
|
||||
if(!query_feedback_max_id.Execute())
|
||||
return
|
||||
while (query_feedback_max_id.NextRow())
|
||||
round_id = query_feedback_max_id.item[1]
|
||||
|
||||
if (!isnum(round_id))
|
||||
round_id = text2num(round_id)
|
||||
@@ -85,8 +86,8 @@ var/datum/feedback/blackbox = new()
|
||||
if (sqlrowlist == "")
|
||||
return
|
||||
|
||||
var/DBQuery/query_insert = dbcon.NewQuery("INSERT DELAYED IGNORE INTO [format_table_name("feedback")] VALUES " + sqlrowlist)
|
||||
query_insert.Execute()
|
||||
var/DBQuery/query_feedback_save = dbcon.NewQuery("INSERT DELAYED IGNORE INTO [format_table_name("feedback")] VALUES " + sqlrowlist)
|
||||
query_feedback_save.Execute()
|
||||
|
||||
|
||||
/proc/feedback_set(variable,value)
|
||||
@@ -205,116 +206,48 @@ var/datum/feedback/blackbox = new()
|
||||
return list(variable,value,details)
|
||||
|
||||
//sql reporting procs
|
||||
/proc/sql_poll_players()
|
||||
/proc/sql_poll_population()
|
||||
if(!config.sql_enabled)
|
||||
return
|
||||
if(!dbcon.Connect())
|
||||
return
|
||||
var/playercount = 0
|
||||
for(var/mob/M in player_list)
|
||||
if(M.client)
|
||||
playercount += 1
|
||||
if(!dbcon.Connect())
|
||||
log_game("SQL ERROR during player polling. Failed to connect.")
|
||||
else
|
||||
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, time) VALUES ([playercount], '[sqltime]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during player polling. Error : \[[err]\]\n")
|
||||
|
||||
/proc/sql_poll_admins()
|
||||
if(!config.sql_enabled)
|
||||
return
|
||||
var/admincount = admins.len
|
||||
if(!dbcon.Connect())
|
||||
log_game("SQL ERROR during admin polling. Failed to connect.")
|
||||
else
|
||||
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (admincount, time) VALUES ([admincount], '[sqltime]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during admin polling. Error : \[[err]\]\n")
|
||||
|
||||
/proc/sql_report_round_start()
|
||||
// TODO
|
||||
if(!config.sql_enabled)
|
||||
return
|
||||
|
||||
/proc/sql_report_round_end()
|
||||
// TODO
|
||||
if(!config.sql_enabled)
|
||||
return
|
||||
var/DBQuery/query_record_playercount = dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()], INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
query_record_playercount.Execute()
|
||||
|
||||
/proc/sql_report_death(mob/living/L)
|
||||
if(!config.sql_enabled)
|
||||
return
|
||||
if(!L)
|
||||
if(!dbcon.Connect())
|
||||
return
|
||||
if(!L.key || !L.mind)
|
||||
if(!L || !L.key || !L.mind)
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(L)
|
||||
var/area/placeofdeath = get_area(T.loc)
|
||||
var/podname = placeofdeath.name
|
||||
|
||||
var/sqlname = sanitizeSQL(L.real_name)
|
||||
var/sqlkey = sanitizeSQL(L.key)
|
||||
var/sqlpod = sanitizeSQL(podname)
|
||||
var/sqlspecial = sanitizeSQL(L.mind.special_role)
|
||||
var/sqlkey = sanitizeSQL(L.ckey)
|
||||
var/sqljob = sanitizeSQL(L.mind.assigned_role)
|
||||
var/sqlspecial = sanitizeSQL(L.mind.special_role)
|
||||
var/sqlpod = sanitizeSQL(placeofdeath.name)
|
||||
var/laname
|
||||
var/lakey
|
||||
if(L.lastattacker)
|
||||
laname = sanitizeSQL(L.lastattacker:real_name)
|
||||
lakey = sanitizeSQL(L.lastattacker:key)
|
||||
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
||||
var/coord = "[L.x], [L.y], [L.z]"
|
||||
var/map = MAP_NAME
|
||||
if(!dbcon.Connect())
|
||||
log_game("SQL ERROR during death reporting. Failed to connect.")
|
||||
else
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord, mapname, server_ip, server_port) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[L.gender]', [L.getBruteLoss()], [L.getFireLoss()], [L.brainloss], [L.getOxyLoss()], '[coord]', '[map]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during death reporting. Error : \[[err]\]\n")
|
||||
|
||||
//This proc is used for feedback. It is executed at round end.
|
||||
/proc/sql_commit_feedback()
|
||||
if(!blackbox)
|
||||
log_game("Round ended without a blackbox recorder. No feedback was sent to the database: This should not happen without admin intervention.")
|
||||
return
|
||||
|
||||
//content is a list of lists. Each item in the list is a list with two fields, a variable name and a value. Items MUST only have these two values.
|
||||
var/list/datum/feedback_variable/content = blackbox.get_round_feedback()
|
||||
|
||||
if(!content)
|
||||
log_game("Round ended without any feedback being generated. No feedback was sent to the database.")
|
||||
return
|
||||
|
||||
if(!dbcon.Connect())
|
||||
log_game("SQL ERROR during feedback reporting. Failed to connect.")
|
||||
else
|
||||
|
||||
var/DBQuery/max_query = dbcon.NewQuery("SELECT MAX(roundid) AS max_round_id FROM [format_table_name("feedback")]")
|
||||
max_query.Execute()
|
||||
|
||||
var/newroundid
|
||||
|
||||
while(max_query.NextRow())
|
||||
newroundid = max_query.item[1]
|
||||
|
||||
if(!(isnum(newroundid)))
|
||||
newroundid = text2num(newroundid)
|
||||
|
||||
if(isnum(newroundid))
|
||||
newroundid++
|
||||
else
|
||||
newroundid = 1
|
||||
|
||||
for(var/datum/feedback_variable/item in content)
|
||||
var/variable = item.get_variable()
|
||||
var/value = item.get_value()
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("feedback")] (id, roundid, time, variable, value) VALUES (null, [newroundid], Now(), '[variable]', '[value]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during feedback reporting. Error : \[[err]\]\n")
|
||||
if(L.lastattacker && ismob(L.lastattacker))
|
||||
var/mob/LA = L.lastattacker
|
||||
laname = sanitizeSQL(LA.real_name)
|
||||
lakey = sanitizeSQL(LA.key)
|
||||
var/sqlgender = sanitizeSQL(L.gender)
|
||||
var/sqlbrute = sanitizeSQL(L.getBruteLoss())
|
||||
var/sqlfire = sanitizeSQL(L.getFireLoss())
|
||||
var/sqlbrain = sanitizeSQL(L.getBrainLoss())
|
||||
var/sqloxy = sanitizeSQL(L.getOxyLoss())
|
||||
var/sqltox = sanitizeSQL(L.getStaminaLoss())
|
||||
var/sqlclone = sanitizeSQL(L.getStaminaLoss())
|
||||
var/sqlstamina = sanitizeSQL(L.getStaminaLoss())
|
||||
var/coord = sanitizeSQL("[L.x], [L.y], [L.z]")
|
||||
var/map = sanitizeSQL(SSmapping.config.map_name)
|
||||
var/DBQuery/query_report_death = dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, coord, mapname, server_ip, server_port) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[SQLtime()]', '[laname]', '[lakey]', '[sqlgender]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[coord]', '[map]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||
query_report_death.Execute()
|
||||
|
||||
Reference in New Issue
Block a user