Merge pull request #1916 from Markolie/looc

Reboot improvements, player panel fix, IsBanned fix
This commit is contained in:
Fox-McCloud
2015-09-01 16:42:09 -04:00
10 changed files with 91 additions and 107 deletions
+3 -9
View File
@@ -1,5 +1,8 @@
//Blocks an attempt to connect before even creating our client datum thing.
world/IsBanned(key,address,computer_id)
if (!key || !address || !computer_id)
log_access("Failed Login (invalid data): [key] [address]-[computer_id]")
return list("reason"="invalid login data", "desc"="Your computer provided invalid or blank information to the server on connection (byond username, IP, and Computer ID.) Provided information for reference: Username:'[key]' IP:'[address]' Computer ID:'[computer_id]' If you continue to get this error, please restart byond or contact byond support.")
if(ckey(key) in admin_datums)
return ..()
@@ -38,17 +41,12 @@ world/IsBanned(key,address,computer_id)
diary << "Ban database connection failure. Key [ckeytext] not checked"
return
var/failedcid = 1
var/failedip = 1
var/ipquery = ""
var/cidquery = ""
if(address)
failedip = 0
ipquery = " OR ip = '[address]' "
if(computer_id)
failedcid = 0
cidquery = " OR computerid = '[computer_id]' "
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM [format_table_name("ban")] WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
@@ -79,8 +77,4 @@ world/IsBanned(key,address,computer_id)
return list("reason"="[bantype]", "desc"="[desc]")
if (failedcid)
message_admins("[key] has logged in with a blank computer id in the ban check.")
if (failedip)
message_admins("[key] has logged in with a blank ip in the ban check.")
return ..() //default pager ban stuff
+36 -37
View File
@@ -66,11 +66,12 @@ var/global/nologevent = 0
body += "<A href='?src=\ref[src];jobban2=\ref[M]'>Jobban</A> | "
body += "<A href='?src=\ref[src];appearanceban=\ref[M]'>Appearance Ban</A> | "
body += "<A href='?src=\ref[src];notes=show;mob=\ref[M]'>Notes</A> | "
if(M.client.check_watchlist(M.client.ckey))
body += "<A href='?_src_=holder;watchremove=[M.ckey]'>Remove from Watchlist</A> | "
body += "<A href='?_src_=holder;watchedit=[M.ckey]'>Edit Watchlist Reason</A> "
else
body += "<A href='?_src_=holder;watchadd=\ref[M.ckey]'>Add to Watchlist</A> "
if(M.client)
if(M.client.check_watchlist(M.client.ckey))
body += "<A href='?_src_=holder;watchremove=[M.ckey]'>Remove from Watchlist</A> | "
body += "<A href='?_src_=holder;watchedit=[M.ckey]'>Edit Watchlist Reason</A> "
else
body += "<A href='?_src_=holder;watchadd=\ref[M.ckey]'>Add to Watchlist</A> "
if(M.client)
body += "| <A HREF='?src=\ref[src];sendtoprison=\ref[M]'>Prison</A> | "
@@ -596,31 +597,32 @@ var/global/nologevent = 0
/datum/admins/proc/restart()
set category = "Server"
set name = "Restart"
set desc="Restarts the world"
if (!usr.client.holder)
return
set desc = "Restarts the world."
if(!check_rights(R_ADMIN)) return
var/confirm = alert("Restart the game world?", "Restart", "Yes", "Cancel")
if(confirm == "Cancel")
return
if(confirm == "Yes")
world << "\red <b>Restarting world!</b> \blue Initiated by [usr.client.holder.fakekey ? "Admin" : usr.key]!"
log_admin("[key_name(usr)] initiated a reboot.")
feedback_set_details("end_error","admin reboot - by [usr.key] [usr.client.holder.fakekey ? "(stealth)" : ""]")
var/delay = input("What delay should the restart have (in seconds)?", "Restart Delay", 5) as num
if(!delay)
delay = 50
else
delay = delay * 10
message_admins("[key_name_admin(usr)] has initiated a server restart with a delay of [delay/10] seconds")
log_admin("[key_name(usr)] has initiated a server restart with a delay of [delay/10] seconds")
ticker.delay_end = 0
feedback_add_details("admin_verb","R") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
if(blackbox)
blackbox.save_all_data_to_sql()
sleep(50)
world.Reboot()
world.Reboot("Initiated by [usr.client.holder.fakekey ? "Admin" : usr.key].", "end_error", "admin reboot - by [usr.key] [usr.client.holder.fakekey ? "(stealth)" : ""]", delay)
/datum/admins/proc/announce()
set category = "Special Verbs"
set name = "Announce"
set desc="Announce your desires to the world"
if(!check_rights(0)) return
if(!check_rights(R_ADMIN)) return
var/message = input("Global message to send:", "Admin Announce", null, null) as message
if(message)
@@ -759,24 +761,6 @@ var/global/nologevent = 0
log_admin("[key_name(usr)] removed the delay.")
feedback_add_details("admin_verb","DELAY") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/datum/admins/proc/immreboot()
set category = "Server"
set desc="Reboots the server post haste"
set name="Immediate Reboot"
if(!usr.client.holder) return
if( alert("Reboot server?",,"Yes","No") == "No")
return
world << "\red <b>Rebooting world!</b> \blue Initiated by [usr.client.holder.fakekey ? "Admin" : usr.key]!"
log_admin("[key_name(usr)] initiated an immediate reboot.")
feedback_set_details("end_error","immediate admin reboot - by [usr.key] [usr.client.holder.fakekey ? "(stealth)" : ""]")
feedback_add_details("admin_verb","IR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
if(blackbox)
blackbox.save_all_data_to_sql()
world.Reboot()
/datum/admins/proc/unprison(var/mob/M in mob_list)
set category = "Admin"
set name = "Unprison"
@@ -997,6 +981,21 @@ proc/formatLocation(var/location)
proc/formatPlayerPanel(var/mob/U,var/text="PP")
return "<A HREF='?_src_=holder;adminplayeropts=\ref[U]'>[text]</A>"
//Kicks all the clients currently in the lobby. The second parameter (kick_only_afk) determins if an is_afk() check is ran, or if all clients are kicked
//defaults to kicking everyone (afk + non afk clients in the lobby)
//returns a list of ckeys of the kicked clients
/proc/kick_clients_in_lobby(message, kick_only_afk = 0)
var/list/kicked_client_names = list()
for(var/client/C in clients)
if(istype(C.mob, /mob/new_player))
if(kick_only_afk && !C.is_afk()) //Ignore clients who are not afk
continue
if(message)
C << message
kicked_client_names.Add("[C.ckey]")
del(C)
return kicked_client_names
//returns 1 to let the dragdrop code know we are trapping this event
//returns 0 if we don't plan to trap the event
/datum/admins/proc/cmd_ghost_drag(var/mob/dead/observer/frommob, var/mob/living/tomob)
-1
View File
@@ -120,7 +120,6 @@ var/list/admin_verbs_server = list(
/datum/admins/proc/delay,
/datum/admins/proc/toggleaban,
/client/proc/toggle_log_hrefs,
/datum/admins/proc/immreboot,
/client/proc/everyone_random,
/datum/admins/proc/toggleAI,
/client/proc/cmd_admin_delete, /*delete an instance/object/mob/etc*/
+1 -1
View File
@@ -197,7 +197,7 @@
<tr id='title_tr'>
<td align='center'>
<font size='5'><b>Player panel</b></font><br>
Hover over a line to see more information - [check_rights(R_ADMIN,0) ? "<a href='?src=\ref[src];check_antagonist=1'>Check antagonists</a> | " : "" ]
Hover over a line to see more information | [check_rights(R_ADMIN,0) ? "<a href='?src=\ref[src];check_antagonist=1'>Check antagonists</a> | Kick <a href='?_src_=holder;kick_all_from_lobby=1;afkonly=0'>everyone</a>/<a href='?_src_=holder;kick_all_from_lobby=1;afkonly=1'>AFKers</a> in lobby" : "" ]
<p>
</td>
</tr>
+17
View File
@@ -2111,6 +2111,23 @@
message_admins("[key_name_admin(usr)] created [number]ea [english_list(paths)]")
break
return
else if(href_list["kick_all_from_lobby"])
if(!check_rights(R_ADMIN))
return
if(ticker && ticker.current_state == GAME_STATE_PLAYING)
var/afkonly = text2num(href_list["afkonly"])
if(alert("Are you sure you want to kick all [afkonly ? "AFK" : ""] clients from the lobby?","Confirmation","Yes","Cancel") != "Yes")
return
var/list/listkicked = kick_clients_in_lobby("<span class='danger'>You were kicked from the lobby by an Administrator.</span>", afkonly)
var/strkicked = ""
for(var/name in listkicked)
strkicked += "[name], "
message_admins("[key_name_admin(usr)] has kicked [afkonly ? "all AFK" : "all"] clients from the lobby. [length(listkicked)] clients kicked: [strkicked ? strkicked : "--"]")
log_admin("[key_name(usr)] has kicked [afkonly ? "all AFK" : "all"] clients from the lobby. [length(listkicked)] clients kicked: [strkicked ? strkicked : "--"]")
else
usr << "You may only use this when the game is running."
else if(href_list["secretsfun"])
if(!check_rights(R_SERVER|R_EVENT)) return