Porting attack logs to use SQL

This commit is contained in:
Cadyn
2021-01-27 16:59:27 -08:00
parent 46c8e161a2
commit be51ec1b85
3 changed files with 35 additions and 13 deletions

View File

@@ -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]")