mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-21 06:07:16 +01:00
89fb9871e0
* next set of admin verbs * invoke * . * a few more * few more * . * few more * some more * move thos * next * some debug verbs * axe the old mod loading * del * is local for some verbs * few more * . * . * . * Add local narrate. * Fixes this Needed to be user.mob, since user is the client and usr was the old user.mob * fixes * . * . * . * . --------- Co-authored-by: Cameron Lennox <killer65311@gmail.com>
86 lines
3.4 KiB
Plaintext
86 lines
3.4 KiB
Plaintext
GLOBAL_VAR_INIT(checked_for_inactives, FALSE)
|
|
GLOBAL_VAR_INIT(inactive_keys, "None<br>")
|
|
|
|
ADMIN_VERB(check_customitem_activity, R_ADMIN|R_MOD|R_SERVER, "Check activity of players with custom items", "Allows you to investigate custom item activity.", ADMIN_CATEGORY_INVESTIGATE)
|
|
var/dat = span_bold("Inactive players with custom items") + "<br>"
|
|
dat += "<br>"
|
|
dat += "The list below contains players with custom items that have not logged\
|
|
in for the past two months, or have not logged in since this system was implemented.\
|
|
This system requires the feedback SQL database to be properly setup and linked.<br>"
|
|
dat += "<br>"
|
|
dat += "Populating this list is done automatically, but must be manually triggered on a per\
|
|
round basis. Populating the list may cause a lag spike, so use it sparingly.<br>"
|
|
dat += "<hr>"
|
|
if(GLOB.checked_for_inactives)
|
|
dat += GLOB.inactive_keys
|
|
dat += "<hr>"
|
|
dat += "This system was implemented on March 1 2013, and the database a few days before that. Root server access is required to add or disable access to specific custom items.<br>"
|
|
else
|
|
dat += "<a href='byond://?src=\ref[user];_src_=holder;[HrefToken()];populate_inactive_customitems=1'>Populate list (requires an active database connection)</a><br>"
|
|
|
|
var/datum/browser/popup = new(user, "inactive_customitems", "Inactive Custom Items", 600, 480)
|
|
popup.set_content(dat)
|
|
popup.open()
|
|
|
|
/proc/populate_inactive_customitems_list(var/client/C)
|
|
set background = 1
|
|
|
|
if(GLOB.checked_for_inactives)
|
|
return
|
|
|
|
if(!SSdbcore.IsConnected())
|
|
return
|
|
|
|
//grab all ckeys associated with custom items
|
|
var/list/ckeys_with_customitems = list()
|
|
|
|
var/file = file2text("config/custom_items.txt")
|
|
var/lines = splittext(file, "\n")
|
|
|
|
for(var/line in lines)
|
|
// split & clean up
|
|
var/list/Entry = splittext(line, ":")
|
|
for(var/i = 1 to Entry.len)
|
|
Entry[i] = trim(Entry[i])
|
|
|
|
if(Entry.len < 1)
|
|
continue
|
|
|
|
var/cur_key = Entry[1]
|
|
if(!ckeys_with_customitems.Find(cur_key))
|
|
ckeys_with_customitems.Add(cur_key)
|
|
|
|
//run a query to get all ckeys inactive for over 2 months
|
|
var/list/inactive_ckeys = list()
|
|
if(ckeys_with_customitems.len)
|
|
var/datum/db_query/query_inactive = SSdbcore.NewQuery("SELECT ckey, lastseen FROM erro_player WHERE datediff(Now(), lastseen) > 60")
|
|
query_inactive.Execute()
|
|
while(query_inactive.NextRow())
|
|
var/cur_ckey = query_inactive.item[1]
|
|
//if the ckey has a custom item attached, output it
|
|
if(ckeys_with_customitems.Find(cur_ckey))
|
|
ckeys_with_customitems.Remove(cur_ckey)
|
|
inactive_ckeys[cur_ckey] = "last seen on [query_inactive.item[2]]"
|
|
qdel(query_inactive)
|
|
|
|
//if there are ckeys left over, check whether they have a database entry at all
|
|
if(ckeys_with_customitems.len)
|
|
for(var/cur_ckey in ckeys_with_customitems)
|
|
var/datum/db_query/query_inactive = SSdbcore.NewQuery("SELECT ckey FROM erro_player WHERE ckey = '[cur_ckey]'")
|
|
query_inactive.Execute()
|
|
if(!length(query_inactive.rows))
|
|
inactive_ckeys += cur_ckey
|
|
qdel(query_inactive)
|
|
|
|
if(inactive_ckeys.len)
|
|
GLOB.inactive_keys = ""
|
|
for(var/cur_key in inactive_ckeys)
|
|
if(inactive_ckeys[cur_key])
|
|
GLOB.inactive_keys += span_bold("[cur_key]") + " - [inactive_ckeys[cur_key]]<br>"
|
|
else
|
|
GLOB.inactive_keys += "[cur_key] - no database entry<br>"
|
|
|
|
GLOB.checked_for_inactives = TRUE
|
|
if(C)
|
|
SSadmin_verbs.dynamic_invoke_verb(C, /datum/admin_verb/check_customitem_activity) //Recursively calling ourselves until cancelled or a unique name is given.
|