├── .gitignore ├── README.md ├── config └── gamestate_integration_CSGOTimer.cfg └── src ├── com └── tomhazell │ └── csgo │ └── ingametimer │ ├── GameStateChangeLisener.java │ ├── IGameState.java │ └── Overlay.java └── resources └── Stratum2-Black.ttf /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | *.pydevproject 15 | .metadata 16 | .gradle 17 | bin/ 18 | tmp/ 19 | *.tmp 20 | *.bak 21 | *.swp 22 | *~.nib 23 | local.properties 24 | .settings/ 25 | .loadpath 26 | 27 | #from https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore 28 | 29 | # Eclipse Core 30 | .project 31 | 32 | # External tool builders 33 | .externalToolBuilders/ 34 | 35 | # Locally stored "Eclipse launch configurations" 36 | *.launch 37 | 38 | # CDT-specific 39 | .cproject 40 | 41 | # JDT-specific (Eclipse Java Development Tools) 42 | .classpath 43 | 44 | # Java annotation processor (APT) 45 | .factorypath 46 | 47 | # PDT-specific 48 | .buildpath 49 | 50 | # sbteclipse plugin 51 | .target 52 | 53 | # TeXlipse plugin 54 | .texlipse 55 | 56 | # STS (Spring Tool Suite) 57 | .springBeans 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSGo-In-game-Bomb-Timer 2 | This is a java made overlay for CSGO that displays the bomb timer. 3 | 4 | To download either build in eclipse or download for releases(when ready). 5 | 6 | Screen shot from in game: http://imgur.com/o7vxbly 7 | 8 | I am taking ANY recomendations for the visual look as i know its not ideal ATM 9 | 10 | How to install: 11 | 12 | 0.5. make sure java is installed 13 | 14 | 1. place the config (config/gamestate_intergration_CSGOTimer.cfg) in your csgo config directory(typicly %path to steam%\steamapps\common\Counter-Strike Global Offensive\csgo\cfg. 15 | 16 | 2. Run the JAR this should only show a java icon in the task bar at the min. 17 | 18 | 3. Put CSGO in windowed mode (note that this will lightly not work if you use CSGO at non native res (back bars might be fine)) 19 | 20 | 3. get in game and plant the bomb :) 21 | 22 | It genarates a Jframe thats the size of a 1080p monitor and cant be clicked and is trasparent. A JLable sits on top of it with the bomb timer(after the bomb is planted) 23 | Thanks to https://github.com/LangdalP/GoTimer for the insperation. 24 | 25 | FAQ: 26 | Q:its not working A: open console in csgo dose it say "Loading Game State Integration: gamestate_integration_CSGOTimer.cfg" if not make sure you have placed the config in the corect place. otherwise check for a pop up you might have not seen. 27 | 28 | Q: Is this not basicly a coustom hud? can this be used to make one. A: YES!!!1! yeah basicly this could be used by disableing ingame hud and using this method. However currently you cant get the state of other players without being a spectator. So a specator HUD is very posible. Not so much a regular one. 29 | 30 | Q: Anything else contact me through github or on reddit /u/Nutty007 -------------------------------------------------------------------------------- /config/gamestate_integration_CSGOTimer.cfg: -------------------------------------------------------------------------------- 1 | "Nutty CSGO Timer v0.1" 2 | { 3 | "uri" "http://127.0.0.1:3000" 4 | "timeout" "5.0" 5 | "buffer" "0" 6 | "throttle" "0.1" 7 | "heartbeat" "30.0" 8 | "data" 9 | { 10 | "provider" "1" 11 | "map" "1" 12 | "round" "1" 13 | } 14 | } -------------------------------------------------------------------------------- /src/com/tomhazell/csgo/ingametimer/GameStateChangeLisener.java: -------------------------------------------------------------------------------- 1 | package com.tomhazell.csgo.ingametimer; 2 | import java.io.IOException; 3 | import java.io.InputStream; 4 | import java.io.OutputStream; 5 | import java.net.InetSocketAddress; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | import java.util.Set; 9 | import java.util.concurrent.Executors; 10 | 11 | import com.sun.net.httpserver.Headers; 12 | import com.sun.net.httpserver.HttpExchange; 13 | import com.sun.net.httpserver.HttpHandler; 14 | import com.sun.net.httpserver.HttpServer; 15 | import org.apache.commons.io.*; 16 | 17 | public class GameStateChangeLisener { 18 | 19 | IGameState Callback; 20 | 21 | public void Start() throws IOException { 22 | InetSocketAddress addr = new InetSocketAddress(3000); 23 | HttpServer server = HttpServer.create(addr, 0); 24 | 25 | server.createContext("/", new GameStateHandler()); 26 | server.setExecutor(Executors.newCachedThreadPool()); 27 | server.start(); 28 | } 29 | 30 | public GameStateChangeLisener(IGameState callback){ 31 | Callback = callback; 32 | 33 | } 34 | 35 | class GameStateHandler implements HttpHandler { 36 | public void handle(HttpExchange exchange) throws IOException { 37 | String requestMethod = exchange.getRequestMethod(); 38 | 39 | InputStream sin = exchange.getRequestBody(); 40 | 41 | String theString = IOUtils.toString(sin, "utf-8"); 42 | Callback.OnGameStateRecived(theString); 43 | 44 | Headers responseHeaders = exchange.getResponseHeaders(); 45 | responseHeaders.set("Content-Type", "text/plain"); 46 | OutputStream responseBody = exchange.getResponseBody(); 47 | responseBody.write(0); 48 | responseBody.flush(); 49 | exchange.sendResponseHeaders(200, 0); 50 | 51 | responseBody.close(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/com/tomhazell/csgo/ingametimer/IGameState.java: -------------------------------------------------------------------------------- 1 | package com.tomhazell.csgo.ingametimer; 2 | 3 | public interface IGameState { 4 | 5 | void OnGameStateRecived(String GameState); 6 | 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/com/tomhazell/csgo/ingametimer/Overlay.java: -------------------------------------------------------------------------------- 1 | package com.tomhazell.csgo.ingametimer; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Dimension; 6 | import java.awt.Font; 7 | import java.awt.FontFormatException; 8 | import java.awt.Toolkit; 9 | import java.io.IOException; 10 | 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JOptionPane; 14 | import javax.swing.WindowConstants; 15 | import javax.swing.border.EmptyBorder; 16 | 17 | import org.json.JSONObject; 18 | 19 | public class Overlay implements IGameState, Runnable { 20 | 21 | JLabel timer; 22 | int BombTimer = -1; 23 | 24 | public static void main(String[] args){ 25 | new Overlay(); 26 | 27 | } 28 | 29 | @Override 30 | public void OnGameStateRecived(String GameState) { 31 | JSONObject Game = new JSONObject(GameState); 32 | JSONObject round = (JSONObject) Game.get("round"); 33 | String BombState = round.getString("bomb"); 34 | 35 | 36 | if (BombState.equals("exploded")) { 37 | BombTimer = -1; 38 | } 39 | 40 | if (BombState.equals("planted") && !BombState.equals("exploded") && BombTimer == -1) { 41 | BombTimer = 40; 42 | this.run(); 43 | } 44 | 45 | if (BombState.equals("defused")) { 46 | BombTimer = -1; 47 | } 48 | 49 | } 50 | 51 | Overlay() { 52 | 53 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 54 | Double width = screenSize.getWidth(); 55 | Double height = screenSize.getHeight(); 56 | 57 | JFrame frame = new JFrame("Transparent Window"); 58 | frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 59 | frame.setUndecorated(true); 60 | frame.setBackground(new Color(0, 0, 0, 0)); 61 | frame.setSize(width.intValue(), height.intValue()); 62 | frame.setPreferredSize(new Dimension(width.intValue(), height.intValue())); 63 | frame.setAlwaysOnTop(true); 64 | 65 | frame.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", false); 66 | 67 | frame.setLayout(new BorderLayout()); 68 | 69 | timer = new JLabel(""); 70 | timer.setHorizontalAlignment(JLabel.CENTER); 71 | timer.setVerticalAlignment(JLabel.TOP); 72 | 73 | try { 74 | timer.setFont(Font.createFont(Font.TRUETYPE_FONT, this.getClass().getResourceAsStream("/resources/Stratum2-Black.ttf")).deriveFont(30.0f)); 75 | } catch (IOException e1) { 76 | errorBox("Have you modifyed the font? it cant be found. Full error: " + e1.toString()); 77 | System.exit(0); 78 | } catch (FontFormatException e) { 79 | errorBox("Have you modifyed the font? Its the wrong format. Full error: " + e.toString()); 80 | System.exit(0); 81 | } 82 | 83 | timer.setForeground(Color.RED); 84 | timer.setBorder(new EmptyBorder(2, 4, 0, 0)); 85 | frame.add(timer, BorderLayout.CENTER); 86 | 87 | frame.setVisible(true); 88 | frame.pack(); 89 | 90 | GameStateChangeLisener state = new GameStateChangeLisener(this); 91 | try { 92 | state.Start(); 93 | } catch (IOException e) { 94 | errorBox("IO Exeption, have you ran this twice? full error: " + e.toString()); 95 | System.exit(0); 96 | } 97 | 98 | } 99 | 100 | 101 | 102 | @Override 103 | public void run() { 104 | while (BombTimer > -1) { 105 | if(BombTimer < 10){ 106 | timer.setText("0:0" + Integer.toString(BombTimer)); 107 | }else{ 108 | timer.setText("0:" + Integer.toString(BombTimer)); 109 | } 110 | 111 | 112 | try { 113 | Thread.sleep(1000); 114 | } catch (InterruptedException e) { 115 | System.err.println(e.toString()); 116 | } 117 | BombTimer = BombTimer - 1; 118 | } 119 | timer.setText(""); 120 | } 121 | 122 | public static void errorBox(String Message) 123 | { 124 | JOptionPane.showMessageDialog(null, Message, "ERROR", JOptionPane.INFORMATION_MESSAGE); 125 | } 126 | } -------------------------------------------------------------------------------- /src/resources/Stratum2-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/The-Nutty/CSGo-In-game-Bomb-Timer/e3b1a19a94a70155852fbe6645fb554a70ada863/src/resources/Stratum2-Black.ttf --------------------------------------------------------------------------------