Remote restarts and discord msg fix (#6783)

This commit is contained in:
Erki
2019-08-16 20:54:10 +03:00
committed by Werner
parent 5702752dad
commit ab4ea852c9
8 changed files with 120 additions and 53 deletions

View File

@@ -17,7 +17,7 @@
s["roundduration"] = get_round_duration_formatted()
s["gameid"] = game_id
s["game_state"] = SSticker ? 0 : SSticker.current_state
s["transferring"] = emergency_shuttle ? !emergency_shuttle.online() : FALSE
s["transferring"] = !!(emergency_shuttle?.online())
s["players"] = clients.len
s["admins"] = 0
@@ -27,7 +27,7 @@
var/client/C = S
if(C.holder.fakekey)
continue
if(C.holder.rights & R_BAN) // we are doing R_BAN to not count retired admins, since they get R_MOD and R_ADMIN but not R_BAN.
if(C.holder.rights & (R_MOD|R_ADMIN))
s["admins"]++
statuscode = 200
@@ -70,52 +70,78 @@
data = chars
return TRUE
//Admin Count
/datum/topic_command/get_count_admin
name = "get_count_admin"
description = "Gets the number of admins connected"
/datum/topic_command/get_staff_by_flag
name = "get_staff_by_flag"
description = "Gets the list of staff, selected by flag values."
params = list(
"flags" = list("name"="flags","desc"="The flags to query based on.","req"=1,"type"="int"),
"strict" = list("name"="strict","desc"="Set to 1 if you want all flags to be present on the holder.","req"=0,"type"="int"),
"show_fakekeys" = list("name"="strict","desc"="Set to 1 if you want to show fake key holders as well.","req"=0,"type"="int")
)
/datum/topic_command/get_staff_by_flag/run_command(queryparams)
var/flags = text2num(queryparams["flags"])
flags &= R_ALL
var/strict = !!(queryparams["strict"] && (text2num(queryparams["strict"]) == 1))
var/show_fakes = !!(queryparams["show_fakekeys"] && (text2num(queryparams["show_fakekeys"]) == 1))
var/list/ckeys_found = list()
/datum/topic_command/get_count_admin/run_command(queryparams)
var/n = 0
for (var/client/client in clients)
if (client.holder && client.holder.rights & (R_ADMIN))
n++
if (!client.holder)
continue
if (!show_fakes && client.holder.fakekey)
continue
if (strict)
if (client.holder.rights == flags)
ckeys_found += client.ckey
else
if (client.holder.rights & flags)
ckeys_found += client.ckey
statuscode = 200
response = "Admin count fetched"
data = n
response = "Staff count and list fetched."
data = list(
"ckeys" = ckeys_found
)
return TRUE
//CCIA Count
/datum/topic_command/get_count_cciaa
name = "get_count_cciaa"
description = "Gets the number of ccia connected"
/datum/topic_command/get_staff_by_rank
name = "get_staff_by_rank"
description = "Gets the list of staff, selected by their rank."
params = list(
"rank" = list("name"="flags","desc"="The rank name to query based on.","req"=1,"type"="str"),
"show_fakekeys" = list("name"="strict","desc"="Set to 1 if you want to show fake key holders as well.","req"=0,"type"="int")
)
/datum/topic_command/get_staff_by_flag/run_command(queryparams)
var/rank = queryparams["rank"]
var/show_fakes = !!(queryparams["show_fakekeys"] && (text2num(queryparams["show_fakekeys"]) == 1))
var/list/ckeys_found = list()
/datum/topic_command/get_count_ccia/run_command(queryparams)
var/n = 0
for (var/client/client in clients)
if (client.holder && (client.holder.rights & R_CCIAA) && !(client.holder.rights & R_ADMIN))
n++
if (!client.holder)
continue
if (!show_fakes && client.holder.fakekey)
continue
if (client.holder.rank == rank)
ckeys_found += client.ckey
statuscode = 200
response = "CCIA count fetched"
data = n
return TRUE
response = "Staff count and list fetched."
data = list(
"ckeys" = ckeys_found
)
//Mod Count
/datum/topic_command/get_count_mod
name = "get_count_mod"
description = "Gets the number of mods connected"
/datum/topic_command/get_count_mod/run_command(queryparams)
var/n = 0
for (var/client/client in clients)
if (client.holder && (client.holder.rights & R_MOD) && !(client.holder.rights & R_ADMIN))
n++
statuscode = 200
response = "Mod count fetched"
data = n
return TRUE
//Player Count
@@ -204,7 +230,7 @@
var/list/players = list()
for (var/client/C in clients)
if (show_hidden_admins && C.holder && C.holder.fakekey)
if (!show_hidden_admins && C.holder?.fakekey)
players += ckey(C.holder.fakekey)
else
players += C.ckey