From fc47488d29fbca7707696eb520a9e184f5f3e7fc Mon Sep 17 00:00:00 2001 From: monster860 Date: Mon, 23 May 2016 16:47:20 -0400 Subject: [PATCH] Fix gameboard href exploit and spacing issues --- code/game/machinery/gameboard.dm | 103 +++++++++++++++++-------------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/code/game/machinery/gameboard.dm b/code/game/machinery/gameboard.dm index b331930b325..99d9a192385 100644 --- a/code/game/machinery/gameboard.dm +++ b/code/game/machinery/gameboard.dm @@ -2,59 +2,60 @@ name = "Virtual Gameboard" icon = 'icons/obj/stationobjs.dmi' icon_state = "gboard_on" - desc = "A holographic table allowing the crew to have fun™ on boring shifts! One player per board." + desc = "A holographic table allowing the crew to have fun� on boring shifts! One player per board." density = 1 anchored = 1 use_power = 1 + var/cooling_down = 0 /obj/machinery/gameboard/New() - ..() - component_parts = list() - component_parts += new /obj/item/weapon/circuitboard/gameboard(null) - component_parts += new /obj/item/weapon/stock_parts/micro_laser(null) - component_parts += new /obj/item/stack/cable_coil(null, 3) - component_parts += new /obj/item/stack/sheet/glass(null, 1) - RefreshParts() + ..() + component_parts = list() + component_parts += new /obj/item/weapon/circuitboard/gameboard(null) + component_parts += new /obj/item/weapon/stock_parts/micro_laser(null) + component_parts += new /obj/item/stack/cable_coil(null, 3) + component_parts += new /obj/item/stack/sheet/glass(null, 1) + RefreshParts() /obj/machinery/gameboard/power_change() - . = ..() - update_icon() + . = ..() + update_icon() /obj/machinery/gameboard/update_icon() - if(stat & NOPOWER) - icon_state = "gboard_off" - else - icon_state = "gboard_on" + if(stat & NOPOWER) + icon_state = "gboard_off" + else + icon_state = "gboard_on" /obj/machinery/gameboard/attack_hand(mob/user) - . = ..() - if(.) - return - if(src.in_use) - to_chat(user, "This gameboard is already in use!") - return - interact(user) + . = ..() + if(.) + return + if(src.in_use) + to_chat(user, "This gameboard is already in use!") + return + interact(user) /obj/machinery/gameboard/interact(mob/user) - . = ..() - if(.) - return + . = ..() + if(.) + return - var/dat - dat = replacetext(file2text('html/chess.html'), "\[hsrc]", "\ref[src]") - var/datum/asset/simple/chess/assets = get_asset_datum(/datum/asset/simple/chess) - assets.send(user) + var/dat + dat = replacetext(file2text('html/chess.html'), "\[hsrc]", "\ref[src]") + var/datum/asset/simple/chess/assets = get_asset_datum(/datum/asset/simple/chess) + assets.send(user) - var/datum/browser/popup = new(user, "SpessChess", name, 500, 800, src) - popup.set_content(dat) - popup.add_stylesheet("chess.css", 'html/browser/chess.css') - popup.add_script("garbochess.js", 'html/browser/garbochess.js') - //popup.add_script("boardui.js", 'html/browser/boardui.js') - popup.add_script("jquery-1.8.2.min.js", 'html/browser/jquery-1.8.2.min.js') - popup.add_script("jquery-ui-1.8.24.custom.min.js", 'html/browser/jquery-ui-1.8.24.custom.min.js') - popup.set_window_options("titlebar=0") - popup.open() - user.set_machine(src) + var/datum/browser/popup = new(user, "SpessChess", name, 500, 800, src) + popup.set_content(dat) + popup.add_stylesheet("chess.css", 'html/browser/chess.css') + popup.add_script("garbochess.js", 'html/browser/garbochess.js') + //popup.add_script("boardui.js", 'html/browser/boardui.js') + popup.add_script("jquery-1.8.2.min.js", 'html/browser/jquery-1.8.2.min.js') + popup.add_script("jquery-ui-1.8.24.custom.min.js", 'html/browser/jquery-ui-1.8.24.custom.min.js') + popup.set_window_options("titlebar=0") + popup.open() + user.set_machine(src) /obj/machinery/gameboard/proc/close_game() //yes, shamelessly copied over from arcade_base in_use = 0 @@ -65,15 +66,21 @@ return /obj/machinery/gameboard/Topic(var/href, var/list/href_list) - . = ..() - var/prize = /obj/item/stack/tickets - if (.) - return + . = ..() + var/prize = /obj/item/stack/tickets + if (.) + return - if (href_list["checkmate"]) - visible_message("[src.name] beeps, \"WINNER!\"") - new prize(get_turf(src), 80) - close_game() + if (href_list["checkmate"]) + if(cooling_down) + message_admins("Too many checkmates on chessboard, possible HREF exploits: [key_name_admin(usr)] on [src] (JMP)") + return + visible_message("[src.name] beeps, \"WINNER!\"") + new prize(get_turf(src), 80) + close_game() + cooling_down = 1 + spawn(600) + cooling_down = 0 - if (href_list["close"]) - close_game() \ No newline at end of file + if (href_list["close"]) + close_game() \ No newline at end of file