mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Welcome Screen (#535)
The idea is to consolidate all of the spam that you see on the lower right panel into one concrete, semi-persistent pop-up window. Utilizing bootstrap, it'll show you a neat welcome screen, the message of the day, staff memos (if accessible), and a personalized set of notifications. The system is set up for easy future expansion, as well.
This commit is contained in:
@@ -113,8 +113,6 @@
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ban_mirror_id, player_ckey, ban_mirror_ip, ban_mirror_computerid, date(ban_mirror_datetime) as datetime FROM ss13_ban_mirrors WHERE ban_id = :ban_id")
|
||||
query.Execute(list(":ban_id" = ban_id))
|
||||
|
||||
testing("Ban ID: [ban_id]")
|
||||
|
||||
var/mirrors[] = list()
|
||||
while (query.NextRow())
|
||||
var/items[] = list()
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
#define MEMOFILE "data/memo.sav" //where the memos are saved
|
||||
#define ENABLE_MEMOS 1 //using a define because screw making a config variable for it. This is more efficient and purty.
|
||||
|
||||
//switch verb so we don't spam up the verb lists with like, 3 verbs for this feature.
|
||||
/client/proc/admin_memo(task in list("write","show","delete"))
|
||||
set name = "Memo"
|
||||
set category = "Server"
|
||||
if(!ENABLE_MEMOS) return
|
||||
if(!check_rights(0)) return
|
||||
switch(task)
|
||||
if("write") admin_memo_write()
|
||||
if("show") admin_memo_show()
|
||||
if("delete") admin_memo_delete()
|
||||
|
||||
//write a message
|
||||
/client/proc/admin_memo_write()
|
||||
var/savefile/F = new(MEMOFILE)
|
||||
if(F)
|
||||
var/memo = sanitize(input(src,"Type your memo\n(Leaving it blank will delete your current memo):","Write Memo",null) as null|message, extra = 0)
|
||||
switch(memo)
|
||||
if(null)
|
||||
return
|
||||
if("")
|
||||
F.dir.Remove(ckey)
|
||||
src << "<b>Memo removed</b>"
|
||||
return
|
||||
if( findtext(memo,"<script",1,0) )
|
||||
return
|
||||
F[ckey] << "[key] on [time2text(world.realtime,"(DDD) DD MMM hh:mm")]<br>[memo]"
|
||||
message_admins("[key] set an admin memo:<br>[memo]")
|
||||
|
||||
//show all memos
|
||||
/client/proc/admin_memo_show()
|
||||
if(ENABLE_MEMOS)
|
||||
var/savefile/F = new(MEMOFILE)
|
||||
if(F)
|
||||
for(var/ckey in F.dir)
|
||||
src << "<center><span class='motd'><b>Admin Memo</b><i> by [F[ckey]]</i></span></center>"
|
||||
|
||||
//delete your own or somebody else's memo
|
||||
/client/proc/admin_memo_delete()
|
||||
var/savefile/F = new(MEMOFILE)
|
||||
if(F)
|
||||
var/ckey
|
||||
if(check_rights(R_SERVER,0)) //high ranking admins can delete other admin's memos
|
||||
ckey = input(src,"Whose memo shall we remove?","Remove Memo",null) as null|anything in F.dir
|
||||
else
|
||||
ckey = src.ckey
|
||||
if(ckey)
|
||||
F.dir.Remove(ckey)
|
||||
src << "<b>Removed Memo created by [ckey].</b>"
|
||||
|
||||
#undef MEMOFILE
|
||||
#undef ENABLE_MEMOS
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* A file containing the admin commands for interfacing with the server_greeting datum.
|
||||
*/
|
||||
/client/proc/admin_edit_motd()
|
||||
set name = "Edit MotD"
|
||||
set category = "Server"
|
||||
|
||||
if (!check_rights(R_SERVER))
|
||||
return
|
||||
|
||||
var/new_message = input(usr, "Please edit the Message of the Day as necessary.", "Message of the Day", server_greeting.motd) as message
|
||||
|
||||
if (!new_message)
|
||||
new_message = "<center>This is a palceholder. Pester your staff to change it!</center>"
|
||||
|
||||
server_greeting.update_value("motd", new_message)
|
||||
message_admins("[ckey] has edited the message of the day:<br>[html_encode(new_message)]")
|
||||
|
||||
/client/proc/admin_memo_control(task in list("write", "delete"))
|
||||
set name = "Edit Memos"
|
||||
set category = "Server"
|
||||
|
||||
if (!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
switch (task)
|
||||
if ("write")
|
||||
admin_memo_write()
|
||||
if ("delete")
|
||||
admin_memo_delete()
|
||||
|
||||
/client/proc/admin_memo_write()
|
||||
var/current_memo = ""
|
||||
if (server_greeting.memo_list.len && server_greeting.memo_list[ckey])
|
||||
current_memo = server_greeting.memo_list[ckey]
|
||||
|
||||
var/new_memo = input(usr, "Please write your memo.", "Memo", current_memo) as message
|
||||
|
||||
if (server_greeting.update_value("memo_write", list(ckey, new_memo)))
|
||||
src << "<span class='notice'>Operation carried out successfully.</span>"
|
||||
message_admins("[ckey] wrote a new memo:<br>[html_encode(new_memo)]")
|
||||
else
|
||||
src << "<span class='danger'>Error carrying out desired operation.</span>"
|
||||
|
||||
return
|
||||
|
||||
/client/proc/admin_memo_delete()
|
||||
if (!server_greeting.memo_list.len)
|
||||
src << "<span class='notice'>No memos are currently saved.</span>"
|
||||
return
|
||||
|
||||
if (!check_rights(R_SERVER))
|
||||
if (!server_greeting.memo_list[ckey])
|
||||
src << "<span class='warning'>You do not have a memo saved. Cancelling.</span>"
|
||||
|
||||
else if (alert("Do you wish to delete your own memo, written on [server_greeting.memo_list[ckey]["date"]]?", "Choices", "Yes", "No") == "Yes")
|
||||
if (server_greeting.update_value("memo_delete", ckey))
|
||||
src << "<span class='notice'>Operation carried out successfully.</span>"
|
||||
message_admins("[ckey] has deleted their own memo.")
|
||||
else
|
||||
src << "<span class='danger'>Error carrying out desired operation.</span>"
|
||||
|
||||
else
|
||||
src << "<span class='notice'>Cancelled.</span>"
|
||||
|
||||
return
|
||||
else
|
||||
var/input = input(usr, "Whose memo shall we delete?", "Remove Memo", null) as null|anything in server_greeting.memo_list
|
||||
|
||||
if (!input)
|
||||
src << "<span class='notice'>Cancelled.</span>"
|
||||
return
|
||||
|
||||
if (server_greeting.update_value("memo_delete", input))
|
||||
src << "<span class='notice'>Operation carried out successfully.</span>"
|
||||
message_admins("[ckey] has deleted the memo of [input].")
|
||||
else
|
||||
src << "<span class='danger'>Error carrying out desired operation.</span>"
|
||||
|
||||
return
|
||||
@@ -50,7 +50,7 @@ var/list/admin_verbs_admin = list(
|
||||
/client/proc/rename_silicon, /*properly renames silicons*/
|
||||
/client/proc/manage_silicon_laws, /* Allows viewing and editing silicon laws. */
|
||||
/client/proc/check_antagonists,
|
||||
/client/proc/admin_memo, /*admin memo system. show/delete/write. +SERVER needed to delete admin memos of others*/
|
||||
/client/proc/admin_memo_control, /*admin memo system. show/delete/write. +SERVER needed to delete admin memos of others*/
|
||||
/client/proc/dsay, /*talk in deadchat using our ckey/fakekey*/
|
||||
/client/proc/toggleprayers, /*toggles prayers on/off*/
|
||||
// /client/proc/toggle_hear_deadcast, /*toggles whether we hear deadchat*/
|
||||
@@ -155,7 +155,8 @@ var/list/admin_verbs_server = list(
|
||||
/datum/admins/proc/toggle_space_ninja,
|
||||
/client/proc/toggle_random_events,
|
||||
/client/proc/check_customitem_activity,
|
||||
/client/proc/nanomapgen_DumpImage
|
||||
/client/proc/nanomapgen_DumpImage,
|
||||
/client/proc/admin_edit_motd
|
||||
)
|
||||
var/list/admin_verbs_debug = list(
|
||||
/client/proc/getruntimelog, /*allows us to access runtime logs to somebody*/
|
||||
|
||||
@@ -183,11 +183,10 @@
|
||||
warnings_check()
|
||||
|
||||
/*
|
||||
* A proc to alert you if you have unacknowledged warnings.
|
||||
* Called in /client/New (client procs.dm)
|
||||
* A proc to gather notifications regarding your warnings.
|
||||
* Called by /datum/preferences/proc/gather_notifications() in preferences.dm
|
||||
*/
|
||||
|
||||
/client/proc/warnings_alert()
|
||||
/client/proc/warnings_gather()
|
||||
var/count = 0
|
||||
var/count_expire = 0
|
||||
|
||||
@@ -210,12 +209,13 @@
|
||||
while (query.NextRow())
|
||||
count++
|
||||
|
||||
var/list/data = list("unread" = "", "expired" = "")
|
||||
if (count)
|
||||
src << "<br>"
|
||||
src << "<font color=red><b>You have [count] unread [count > 1 ? "warnings" : "warning"]! Click <a href='byond://?src=\ref[src];warnview=1'>here</a> to review and acknowledge them!</b></font>"
|
||||
data["unread"] = "You have <b>[count] unread [count > 1 ? "warnings" : "warning"]!</b> Click <a href='?JSlink=warnings;notification=:src_ref'>here</a> to review and acknowledge them!"
|
||||
if (count_expire)
|
||||
src << "<br>"
|
||||
src << "<font color=blue><b>[count_expire] of your warnings expired.</b></font>"
|
||||
data["expired"] = "[count_expire] of your warnings have expired."
|
||||
|
||||
return data
|
||||
|
||||
/*
|
||||
* A proc for an admin/moderator to look up a member's warnings.
|
||||
|
||||
@@ -135,6 +135,36 @@
|
||||
|
||||
return
|
||||
|
||||
// JSlink switch.
|
||||
if (href_list["JSlink"])
|
||||
switch (href_list["JSlink"])
|
||||
if ("warnings")
|
||||
src.warnings_check()
|
||||
|
||||
if ("linking")
|
||||
src.check_linking_requests()
|
||||
|
||||
if ("dismiss")
|
||||
if (href_list["notification"])
|
||||
var/datum/client_notification/a = locate(href_list["notification"])
|
||||
if (a && isnull(a.gcDestroyed))
|
||||
a.dismiss()
|
||||
|
||||
if ("github")
|
||||
if (!config.githuburl)
|
||||
src << "<span class='danger'>Github URL not set in the config. Unable to open the site.</span>"
|
||||
else if (alert("This will open the issue tracker in your browser. Are you sure?",, "Yes", "No") == "Yes")
|
||||
src << link(config.githuburl)
|
||||
|
||||
if ("forums")
|
||||
src.forum()
|
||||
|
||||
if ("wiki")
|
||||
src.wiki()
|
||||
|
||||
if ("webint")
|
||||
src.open_webint()
|
||||
|
||||
..() //redirect to hsrc.()
|
||||
|
||||
/client/proc/handle_spam_prevention(var/message, var/mute_type)
|
||||
@@ -207,6 +237,8 @@
|
||||
if(!prefs)
|
||||
prefs = new /datum/preferences(src)
|
||||
preferences_datums[ckey] = prefs
|
||||
|
||||
prefs.gather_notifications(src)
|
||||
prefs.last_ip = address //these are gonna be used for banning
|
||||
prefs.last_id = computer_id //these are gonna be used for banning
|
||||
|
||||
@@ -223,18 +255,6 @@
|
||||
else
|
||||
del(src)
|
||||
return 0
|
||||
else if (byond_version < config.client_warn_version)
|
||||
src << "<span class='danger'><b>Your version of BYOND may be out of date!</b></span>"
|
||||
src << config.client_warn_message
|
||||
src << "Your version: [byond_version]."
|
||||
src << "Required version to remove this message: [config.client_warn_version] or later."
|
||||
src << "Visit http://www.byond.com/download/ to get the latest version of BYOND."
|
||||
|
||||
if(custom_event_msg && custom_event_msg != "")
|
||||
src << "<h1 class='alert'>Custom Event</h1>"
|
||||
src << "<h2 class='alert'>A custom event is taking place. OOC Info:</h2>"
|
||||
src << "<span class='alert'>[custom_event_msg]</span>"
|
||||
src << "<br>"
|
||||
|
||||
if( (world.address == address || !address) && !host )
|
||||
host = key
|
||||
@@ -242,7 +262,6 @@
|
||||
|
||||
if(holder)
|
||||
add_admin_verbs()
|
||||
admin_memo_show()
|
||||
|
||||
// Forcibly enable hardware-accelerated graphics, as we need them for the lighting overlays.
|
||||
// (but turn them off first, since sometimes BYOND doesn't turn them on properly otherwise)
|
||||
@@ -252,20 +271,13 @@
|
||||
sleep(2) // wait a bit more, possibly fixes hardware mode not re-activating right
|
||||
winset(src, null, "command=\".configure graphics-hwmode on\"")
|
||||
|
||||
warnings_alert()
|
||||
|
||||
check_linking_requests()
|
||||
|
||||
send_resources()
|
||||
nanomanager.send_resources(src)
|
||||
|
||||
if(prefs.lastchangelog != changelog_hash) //bolds the changelog button on the interface so we know there are updates.
|
||||
src << "<span class='info'>You have unread updates in the changelog.</span>"
|
||||
winset(src, "rpane.changelog", "background-color=#eaeaea;font-style=bold")
|
||||
if(config.aggressive_changelog)
|
||||
src.changes()
|
||||
|
||||
var/outdated_greeting_info = server_greeting.find_outdated_info(src)
|
||||
|
||||
if (outdated_greeting_info)
|
||||
server_greeting.display_to_client(src, outdated_greeting_info)
|
||||
|
||||
//////////////
|
||||
//DISCONNECT//
|
||||
@@ -384,6 +396,11 @@
|
||||
'html/images/loading.gif',
|
||||
'html/images/ntlogo.png',
|
||||
'html/images/talisman.png',
|
||||
'html/bootstrap/css/bootstrap.min.css',
|
||||
'html/bootstrap/js/bootstrap.min.js',
|
||||
'html/bootstrap/js/html5shiv.min.js',
|
||||
'html/bootstrap/js/respond.min.js',
|
||||
'html/jquery/jquery-2.0.0.min.js',
|
||||
'icons/pda_icons/pda_atmos.png',
|
||||
'icons/pda_icons/pda_back.png',
|
||||
'icons/pda_icons/pda_bell.png',
|
||||
@@ -424,7 +441,6 @@
|
||||
'icons/spideros_icons/sos_14.png'
|
||||
)
|
||||
|
||||
|
||||
/mob/proc/MayRespawn()
|
||||
return 0
|
||||
|
||||
@@ -481,6 +497,23 @@
|
||||
src << browse(dat, "window=LinkingRequests")
|
||||
return
|
||||
|
||||
/client/proc/gather_linking_requests()
|
||||
if (!config.webint_url || !config.sql_enabled)
|
||||
return
|
||||
|
||||
establish_db_connection(dbcon)
|
||||
if (!dbcon.IsConnected())
|
||||
return
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT COUNT(*) AS request_count FROM ss13_player_linking WHERE status = 'new' AND player_ckey = :ckey AND deleted_at IS NULL")
|
||||
select_query.Execute(list(":ckey" = ckey))
|
||||
|
||||
if (select_query.NextRow())
|
||||
if (text2num(select_query.item[1]) > 0)
|
||||
return "You have [select_query.item[1]] account linking requests pending review. Click <a href='?JSlink=linking;notification=:src_ref'>here</a> to see them!"
|
||||
|
||||
return null
|
||||
|
||||
/client/proc/process_webint_link(var/route, var/attributes)
|
||||
if (!route)
|
||||
return
|
||||
@@ -523,3 +556,9 @@
|
||||
|
||||
src << link(linkURL)
|
||||
return
|
||||
|
||||
/client/verb/show_greeting()
|
||||
set name = "Open Greeting"
|
||||
set category = "OOC"
|
||||
|
||||
server_greeting.display_to_client(src, server_greeting.find_outdated_info(src))
|
||||
|
||||
@@ -40,6 +40,7 @@ datum/preferences
|
||||
var/muted = 0
|
||||
var/last_ip
|
||||
var/last_id
|
||||
var/list/notifications = list() //A list of datums, for the dynamic server greeting window.
|
||||
|
||||
//game-preferences
|
||||
var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
|
||||
@@ -50,6 +51,8 @@ datum/preferences
|
||||
var/asfx_togs = ASFX_DEFAULT
|
||||
var/UI_style_color = "#ffffff"
|
||||
var/UI_style_alpha = 255
|
||||
var/motd_hash = "" //Hashes for the new server greeting window.
|
||||
var/memo_hash = ""
|
||||
|
||||
//character preferences
|
||||
var/real_name //our character's name
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* A simple datum for storing notifications for dispaly.
|
||||
*/
|
||||
/datum/client_notification
|
||||
var/datum/preferences/owner = null
|
||||
|
||||
var/list/note_wrapper = list()
|
||||
var/note_text = ""
|
||||
|
||||
var/proc_src = null
|
||||
var/proc_name = ""
|
||||
var/proc_args = null
|
||||
|
||||
var/persistent = 0
|
||||
|
||||
/datum/client_notification/New(var/datum/preferences/prefs, var/list/new_wrapper, var/new_text, var/new_persistence)
|
||||
if (!prefs)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if (!new_wrapper || new_wrapper.len != 2)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if (!new_text)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
owner = prefs
|
||||
|
||||
note_wrapper = new_wrapper
|
||||
note_text = new_text
|
||||
|
||||
note_text = replacetextEx(note_text, ":src_ref", "\ref[src]")
|
||||
note_wrapper[1] = replacetextEx(note_wrapper[1], ":src_ref", "\ref[src]")
|
||||
|
||||
if (new_persistence)
|
||||
persistent = new_persistence
|
||||
|
||||
/datum/client_notification/Destroy()
|
||||
if (owner)
|
||||
owner.notifications -= src
|
||||
owner = null
|
||||
|
||||
..()
|
||||
|
||||
/*
|
||||
* Associates a callback to be executed whenever a notification is dismissed.
|
||||
*/
|
||||
/datum/client_notification/proc/tie_callback(var/dismiss_proc_src, var/dismiss_proc, var/dismiss_proc_args)
|
||||
if (!dismiss_proc_src || !dismiss_proc)
|
||||
return
|
||||
|
||||
proc_src = dismiss_proc_src
|
||||
proc_name = dismiss_proc
|
||||
|
||||
if (dismiss_proc_args)
|
||||
proc_args = dismiss_proc_args
|
||||
|
||||
/*
|
||||
* Returns the HTML required to display this alert.
|
||||
*/
|
||||
/datum/client_notification/proc/get_html()
|
||||
var/html = "<div class=\"row\">[note_wrapper[1]]\n"
|
||||
|
||||
if (!persistent)
|
||||
html += "<a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">×</a>\n"
|
||||
|
||||
html += note_text
|
||||
html += "\n[note_wrapper[2]]</div>"
|
||||
|
||||
return html
|
||||
|
||||
/*
|
||||
* Dismisses the notification, executing the proc that was set up as necessary.
|
||||
*/
|
||||
/datum/client_notification/proc/dismiss()
|
||||
if (proc_src && proc_name)
|
||||
call(proc_src, proc_name)(proc_args)
|
||||
|
||||
if (!persistent)
|
||||
qdel(src)
|
||||
|
||||
/*
|
||||
* Adds a new notification datum for later processing.
|
||||
*/
|
||||
/datum/preferences/proc/new_notification(var/type, var/text, var/persistent, var/callback_src, var/callback_proc, var/callback_args)
|
||||
if (!text)
|
||||
return
|
||||
|
||||
var/list/wrapper
|
||||
switch (type)
|
||||
if ("success")
|
||||
wrapper = list("<div class=\"alert alert-success\" notification=\":src_ref\">", "</div>")
|
||||
if ("info")
|
||||
wrapper = list("<div class=\"alert alert-info\" notification=\":src_ref\">", "</div>")
|
||||
if ("warning")
|
||||
wrapper = list("<div class=\"alert alert-warning\" notification=\":src_ref\">", "</div>")
|
||||
if ("danger")
|
||||
wrapper = list("<div class=\"alert alert-danger\" notification=\":src_ref\">", "</div>")
|
||||
else
|
||||
wrapper = list("<div class=\"alert alert-info\" notification=\":src_ref\">", "</div>")
|
||||
|
||||
var/datum/client_notification/note = new(src, wrapper, text, persistent)
|
||||
|
||||
if (callback_src && callback_proc)
|
||||
note.tie_callback(callback_src, callback_proc, callback_args)
|
||||
|
||||
notifications += note
|
||||
|
||||
/*
|
||||
* Gathers all notifications relevant to the client.
|
||||
*/
|
||||
/datum/preferences/proc/gather_notifications(var/client/user)
|
||||
if (!user)
|
||||
return
|
||||
|
||||
if (user.byond_version < config.client_warn_version)
|
||||
var/version_warn = ""
|
||||
version_warn += "<b>Your version of BYOND may be out of date!</b><br>"
|
||||
version_warn += config.client_warn_message
|
||||
version_warn += "Your version: [user.byond_version].<br>"
|
||||
version_warn += "Required version to remove this message: [config.client_warn_version] or later.<br>"
|
||||
version_warn += "Visit http://www.byond.com/download/ to get the latest version of BYOND."
|
||||
|
||||
new_notification("danger", version_warn)
|
||||
|
||||
if (custom_event_msg && custom_event_msg != "")
|
||||
var/custom_event_warn = "<b><center>A custom event is taking place!</center></b><br>"
|
||||
custom_event_warn += "<b>OOC Info:</b><br>[custom_event_msg]"
|
||||
|
||||
new_notification("danger", custom_event_warn)
|
||||
|
||||
if (lastchangelog != changelog_hash)
|
||||
winset(user, "rpane.changelog", "background-color=#eaeaea;font-style=bold")
|
||||
if (config.aggressive_changelog)
|
||||
new_notification("info", "You have unread updates in the changelog.", callback_src = user, callback_proc = "changes")
|
||||
else
|
||||
new_notification("info", "You have unread updates in the changelog.")
|
||||
|
||||
if (config.sql_enabled)
|
||||
|
||||
var/list/warnings = user.warnings_gather()
|
||||
if (warnings["unread"])
|
||||
new_notification("danger", warnings["unread"], 1)
|
||||
if (warnings["expired"])
|
||||
new_notification("info", warnings["expired"])
|
||||
|
||||
var/linking = user.gather_linking_requests()
|
||||
if (linking)
|
||||
new_notification("info", linking, callback_src = user, callback_proc = "check_linking_requests")
|
||||
|
||||
var/cciaa_actions = count_ccia_actions(user)
|
||||
if (cciaa_actions)
|
||||
new_notification("info", cciaa_actions)
|
||||
|
||||
/*
|
||||
* Helper proc for getting a count of active CCIA actions against the player's character.
|
||||
*/
|
||||
/datum/preferences/proc/count_ccia_actions(var/client/user)
|
||||
if (!user)
|
||||
return null
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
error("Error initiatlizing database connection while counting CCIA actions.")
|
||||
return null
|
||||
|
||||
var/DBQuery/prep_query = dbcon.NewQuery("SELECT id FROM ss13_characters WHERE ckey = :ckey")
|
||||
prep_query.Execute(list(":ckey" = user.ckey))
|
||||
var/list/chars = list()
|
||||
|
||||
while (prep_query.NextRow())
|
||||
chars += text2num(prep_query.item[1])
|
||||
|
||||
if (!chars.len)
|
||||
return null
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery({"SELECT
|
||||
COUNT(act_chr.action_id) AS action_count
|
||||
FROM ss13_ccia_action_char act_chr
|
||||
JOIN ss13_characters chr ON act_chr.char_id = chr.id
|
||||
JOIN ss13_ccia_actions act ON act_chr.action_id = act.id
|
||||
WHERE
|
||||
act_chr.char_id IN :char_id AND
|
||||
(act.expires_at IS NULL OR act.expires_at >= CURRENT_DATE()) AND
|
||||
act.deleted_at IS NULL;"})
|
||||
query.Execute(list(":char_id" = chars))
|
||||
|
||||
if (query.NextRow())
|
||||
var/action_count = text2num(query.item[1])
|
||||
|
||||
if (action_count == 0)
|
||||
return null
|
||||
|
||||
var/string = "There are [action_count] active CCIA actions currently active against your character(s)."
|
||||
return string
|
||||
|
||||
return null
|
||||
@@ -57,10 +57,14 @@
|
||||
S["UI_style_color"] >> UI_style_color
|
||||
S["UI_style_alpha"] >> UI_style_alpha
|
||||
S["asfx_togs"] >> asfx_togs
|
||||
S["motd_hash"] >> motd_hash
|
||||
S["memo_hash"] >> memo_hash
|
||||
|
||||
//Sanitize
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
|
||||
motd_hash = sanitize_text(motd_hash, initial(motd_hash))
|
||||
memo_hash = sanitize_text(memo_hash, initial(memo_hash))
|
||||
UI_style = sanitize_inlist(UI_style, list("White", "Midnight","Orange","old"), initial(UI_style))
|
||||
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
|
||||
default_slot = sanitize_integer(default_slot, 1, config.character_slots, initial(default_slot))
|
||||
@@ -87,6 +91,8 @@
|
||||
S["default_slot"] << default_slot
|
||||
S["toggles"] << toggles
|
||||
S["asfx_togs"] << asfx_togs
|
||||
S["motd_hash"] << motd_hash
|
||||
S["memo_hash"] << memo_hash
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
UI_style_color,
|
||||
UI_style_alpha,
|
||||
be_special,
|
||||
asfx_togs
|
||||
asfx_togs,
|
||||
motd_hash,
|
||||
memo_hash
|
||||
FROM ss13_player_preferences
|
||||
WHERE ckey = :ckey"})
|
||||
query.Execute(list(":ckey" = C.ckey))
|
||||
@@ -28,10 +30,14 @@
|
||||
UI_style_alpha = text2num(query.item[7])
|
||||
be_special = text2num(query.item[8])
|
||||
asfx_togs = text2num(query.item[9])
|
||||
motd_hash = query.item[10]
|
||||
memo_hash = query.item[11]
|
||||
|
||||
//Sanitize
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
|
||||
motd_hash = sanitize_text(motd_hash, initial(motd_hash))
|
||||
memo_hash = sanitize_text(memo_hash, initial(memo_hash))
|
||||
UI_style = sanitize_inlist(UI_style, list("White", "Midnight","Orange","old"), initial(UI_style))
|
||||
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
|
||||
default_slot = sanitize_integer(default_slot, 1, config.character_slots, initial(default_slot))
|
||||
@@ -61,7 +67,9 @@
|
||||
UI_style_color = :ui_color,
|
||||
UI_style_alpha = :ui_alpha,
|
||||
be_special = :be_special,
|
||||
asfx_togs = :asfx_togs
|
||||
asfx_togs = :asfx_togs,
|
||||
motd_hash = :motd_hash,
|
||||
memo_hash = :memo_hash
|
||||
WHERE ckey = :ckey"})
|
||||
update_query.Execute(get_prefs_update_insert_params(C))
|
||||
|
||||
@@ -71,8 +79,8 @@
|
||||
if (!C)
|
||||
return 0
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery({"INSERT INTO ss13_player_preferences (ckey, ooccolor, lastchangelog, UI_style, current_character, toggles, UI_style_color, UI_style_alpha, be_special, asfx_togs)
|
||||
VALUES (:ckey, :ooccolor, :lastchangelog, :ui_style, :current_character, :toggles, :ui_color, :ui_alpha, :be_special, :asfx_togs);"})
|
||||
var/DBQuery/query = dbcon.NewQuery({"INSERT INTO ss13_player_preferences (ckey, ooccolor, lastchangelog, UI_style, current_character, toggles, UI_style_color, UI_style_alpha, be_special, asfx_togs, motd_hash, memo_hash)
|
||||
VALUES (:ckey, :ooccolor, :lastchangelog, :ui_style, :current_character, :toggles, :ui_color, :ui_alpha, :be_special, :asfx_togs, :motd_hash, :memo_hash);"})
|
||||
query.Execute(get_prefs_update_insert_params(C))
|
||||
|
||||
return 1
|
||||
@@ -92,6 +100,8 @@
|
||||
params[":ui_alpha"] = UI_style_alpha
|
||||
params[":be_special"] = be_special
|
||||
params[":asfx_togs"] = asfx_togs
|
||||
params[":motd_hash"] = motd_hash
|
||||
params[":memo_hash"] = memo_hash
|
||||
|
||||
return params
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/mob/new_player/Login()
|
||||
update_Login_details() //handles setting lastKnownIP and computer_id for use by the ban systems as well as checking for multikeying
|
||||
if(join_motd)
|
||||
src << "<div class=\"motd\">[join_motd]</div>"
|
||||
|
||||
if(!mind)
|
||||
mind = new /datum/mind(key)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/*
|
||||
* /proc/webint_start_singlesignon()
|
||||
* Used to insert a token into the web_sso database and to enable a user to navigate to a page on the website and be automatically logged in. Hashes the user's save file for a unique token. Additional security managed on the website's end.
|
||||
* Used to insert a token into the web_sso database and to enable a user to navigate to a page on the website and be automatically logged in. Generates a hash algorithmically. Additional security managed on the website's end.
|
||||
*
|
||||
* Arguments:
|
||||
* - var/user - Must be a mob or a client. The player object that's going to be using the request.
|
||||
|
||||
Reference in New Issue
Block a user