mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Porting attack logs to use SQL
This commit is contained in:
@@ -120,10 +120,16 @@ Proc for attack log creation, because really why not
|
||||
var/user_str = key_name(user)
|
||||
var/target_str = key_name(target)
|
||||
|
||||
if(ismob(user))
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Attacked [target_str]: [what_done]</font>")
|
||||
if(ismob(user)) //CHOMPEdit Begin
|
||||
//user.attack_log += text("\[[time_stamp()]\] <font color='red'>Attacked [target_str]: [what_done]</font>")
|
||||
var/DBQuery/query_insert = SSdbcore.NewQuery("INSERT INTO erro_attacklog (id, time, ckey, mob, message) VALUES (null, NOW(), :t_ckey, :t_mob, :t_content)", list("t_ckey" = user.ckey, "t_mob" = user.real_name, "t_content" = "<font color='red'>Attacked [target_str]: [what_done]</font>"))
|
||||
query_insert.Execute()
|
||||
qdel(query_insert)
|
||||
if(ismob(target))
|
||||
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Attacked by [user_str]: [what_done]</font>")
|
||||
//target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Attacked by [user_str]: [what_done]</font>")
|
||||
var/DBQuery/query_insert = SSdbcore.NewQuery("INSERT INTO erro_attacklog (id, time, ckey, mob, message) VALUES (null, NOW(), :t_ckey, :t_mob, :t_content)", list("t_ckey" = target.ckey, "t_mob" = target.real_name, "t_content" = "<font color='orange'>Attacked by [user_str]: [what_done]</font>"))
|
||||
query_insert.Execute()
|
||||
qdel(query_insert)
|
||||
log_attack(user_str,target_str,what_done)
|
||||
if(admin_notify)
|
||||
msg_admin_attack("[key_name_admin(user)] vs [target_str]: [what_done]")
|
||||
|
||||
@@ -574,6 +574,14 @@ var/failed_old_db_connections = 0
|
||||
if(num_tries==5)
|
||||
log_admin("ERROR TRYING TO CLEAR erro_dialog")
|
||||
qdel(query_truncate)
|
||||
var/DBQuery/query_truncate2 = SSdbcore.NewQuery("TRUNCATE erro_attacklog")
|
||||
num_tries = 0
|
||||
while(!query_truncate2.Execute() && num_tries<5)
|
||||
num_tries++
|
||||
|
||||
if(num_tries==5)
|
||||
log_admin("ERROR TRYING TO CLEAR erro_attacklog")
|
||||
qdel(query_truncate)
|
||||
else
|
||||
to_world_log("Feedback database connection failed.")
|
||||
//CHOMPEdit End
|
||||
|
||||
@@ -9,17 +9,25 @@
|
||||
if(M.mind)
|
||||
dat += "<b>Current Antag?:</b> [(M.mind.special_role)?"Yes":"No"]<br>"
|
||||
dat += "<br><b>Note:</b> This is arranged from earliest to latest. <br><br>"
|
||||
|
||||
|
||||
if(!isemptylist(M.attack_log))
|
||||
dat += "<fieldset style='border: 2px solid white; display: inline'>"
|
||||
for(var/l in M.attack_log)
|
||||
dat += "[l]<br>"
|
||||
|
||||
dat += "</fieldset>"
|
||||
|
||||
//CHOMPEdit Begin
|
||||
/*for(var/d in M.dialogue_log)
|
||||
dat += "[d]<br>"*/
|
||||
var/DBQuery/query = SSdbcore.NewQuery("SELECT id,time,ckey,mob,message from erro_attacklog WHERE ckey = :t_ckey", list("t_ckey" = M.ckey))
|
||||
if(!query.Execute())
|
||||
dat += "<i>Database query error</i>"
|
||||
else
|
||||
dat += "<i>No attack logs found for [M].</i>"
|
||||
var/messages = ""
|
||||
while(query.NextRow())
|
||||
messages += "([query.item[2]]) (ckey:[query.item[3]] real_name:[query.item[4]]) [query.item[5]]<br>"
|
||||
|
||||
if(messages=="")
|
||||
dat+="<i>Query returned nothing.</i>"
|
||||
else
|
||||
dat += "<fieldset style='border: 2px solid white; display: inline'>"
|
||||
dat += messages
|
||||
dat += "</fieldset>"
|
||||
qdel(query)
|
||||
//CHOMPEdit End
|
||||
|
||||
var/datum/browser/popup = new(usr, "admin_attack_log", "[src]", 650, 650, src)
|
||||
popup.set_content(jointext(dat,null))
|
||||
|
||||
Reference in New Issue
Block a user