mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-04 05:51:54 +00:00
[MIRROR] Players now see any notes they may have gotten whilst disconnected when they join the server for the next time [MDB IGNORE] (#9028)
* Players now see any notes they may have gotten whilst disconnected when they join the server for the next time * Fixing conflicts Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
@@ -38,8 +38,6 @@
|
||||
text = input(usr,"Write your [type]","Create [type]") as null|message
|
||||
if(!text)
|
||||
return
|
||||
if(!timestamp)
|
||||
timestamp = SQLtime()
|
||||
if(!server)
|
||||
var/ssqlname = CONFIG_GET(string/serversqlname)
|
||||
if (ssqlname)
|
||||
@@ -76,15 +74,11 @@
|
||||
note_severity = input("Set the severity of the note.", "Severity", null, null) as null|anything in list("High", "Medium", "Minor", "None")
|
||||
if(!note_severity)
|
||||
return
|
||||
var/datum/db_query/query_create_message = SSdbcore.NewQuery(/* SKYRAT EDIT CHANGE - MULTISERVER */{"
|
||||
INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server_name, server, server_ip, server_port, round_id, secret, expire_timestamp, severity, playtime)
|
||||
VALUES (:type, :target_ckey, :admin_ckey, :text, :timestamp, :server_name, :server, INET_ATON(:internet_address), :port, :round_id, :secret, :expiry, :note_severity, (SELECT `minutes` FROM [format_table_name("role_time")] WHERE `ckey` = :target_ckey AND `job` = 'Living'))
|
||||
"}, list(
|
||||
var/list/parameters = list(
|
||||
"type" = type,
|
||||
"target_ckey" = target_ckey,
|
||||
"admin_ckey" = admin_ckey,
|
||||
"text" = text,
|
||||
"timestamp" = timestamp,
|
||||
"server_name" = CONFIG_GET(string/serversqlname), // SKYRAT EDIT ADDITION - MULTISERVER
|
||||
"server" = server,
|
||||
"internet_address" = world.internet_address || "0",
|
||||
@@ -93,7 +87,13 @@
|
||||
"secret" = secret,
|
||||
"expiry" = expiry || null,
|
||||
"note_severity" = note_severity,
|
||||
))
|
||||
)
|
||||
if(timestamp)
|
||||
parameters["timestamp"] = timestamp
|
||||
var/datum/db_query/query_create_message = SSdbcore.NewQuery({"
|
||||
INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, server_ip, server_port, round_id, secret, expire_timestamp, severity, playtime)
|
||||
VALUES (:type, :target_ckey, :admin_ckey, :text, [timestamp? ":timestamp" : "Now()"], :server, INET_ATON(:internet_address), :port, :round_id, :secret, :expiry, :note_severity, (SELECT `minutes` FROM [format_table_name("role_time")] WHERE `ckey` = :target_ckey AND `job` = 'Living'))
|
||||
"}, parameters)
|
||||
var/pm = "[key_name(usr)] has created a [type][(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_key]" : ""]: [text]"
|
||||
var/header = "[key_name_admin(usr)] has created a [type][(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_key]" : ""]"
|
||||
if(!query_create_message.warn_execute())
|
||||
@@ -630,13 +630,19 @@
|
||||
browser.set_content(jointext(output, ""))
|
||||
browser.open()
|
||||
|
||||
/proc/get_message_output(type, target_ckey)
|
||||
/proc/get_message_output(type, target_ckey, show_secret = TRUE, after_timestamp)
|
||||
if(!SSdbcore.Connect())
|
||||
to_chat(usr, span_danger("Failed to establish database connection."), confidential = TRUE)
|
||||
return
|
||||
if(!type)
|
||||
return
|
||||
var/output
|
||||
var/list/parameters = list(
|
||||
"targetckey" = target_ckey,
|
||||
"type" = type,
|
||||
)
|
||||
if(after_timestamp)
|
||||
parameters["after_timestamp"] = after_timestamp
|
||||
var/datum/db_query/query_get_message_output = SSdbcore.NewQuery({"
|
||||
SELECT
|
||||
id,
|
||||
@@ -649,7 +655,9 @@
|
||||
AND deleted = 0
|
||||
AND (expire_timestamp > NOW() OR expire_timestamp IS NULL)
|
||||
AND ((type != 'message' AND type != 'watchlist entry') OR targetckey = :targetckey)
|
||||
"}, list("targetckey" = target_ckey, "type" = type))
|
||||
[after_timestamp? "AND timestamp > :after_timestamp": ""]
|
||||
[!show_secret? "AND secret = 0": ""]
|
||||
"}, parameters)
|
||||
if(!query_get_message_output.warn_execute())
|
||||
qdel(query_get_message_output)
|
||||
return
|
||||
@@ -672,6 +680,9 @@
|
||||
qdel(query_message_read)
|
||||
return
|
||||
qdel(query_message_read)
|
||||
if("note")
|
||||
output += "<font color='red' size='3'><b>Note left by [span_prefix("[admin_key]")] on [timestamp]</b></font>"
|
||||
output += "<br><font color='red'>[text]</font><br>"
|
||||
if("watchlist entry")
|
||||
message_admins("<font color='red'><B>Notice: </B></font><font color='blue'>[key_name_admin(target_ckey)] has been on the watchlist since [timestamp] and has just connected - Reason: [text]</font>")
|
||||
send2tgs_adminless_only("Watchlist", "[key_name(target_ckey)] is on the watchlist and has just connected - Reason: [text]")
|
||||
|
||||
Reference in New Issue
Block a user