├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── package.json └── src ├── config ├── config.json5 └── keybinds.json5 ├── css ├── custom.css ├── main.css ├── map.css ├── status.css └── waiting.css ├── detectcfg.js ├── gamestate_integration_boltobserv.cfg ├── gsi.js ├── html ├── map.html ├── status.html └── waiting.html ├── http.js ├── img ├── adv-defuse.webp ├── adv-plant.webp ├── adv-solesurvivor.webp ├── bomb-defused.webp ├── bomb-dropped.webp ├── bomb-planted.webp ├── empty.webp ├── favicon.ico ├── icon-64x64.png ├── icon.svg ├── projectile-hc-firebomb-CT.webp ├── projectile-hc-firebomb-T.webp ├── projectile-hc-flashbang-CT.webp ├── projectile-hc-flashbang-T.webp ├── projectile-hc-frag-CT.webp ├── projectile-hc-frag-T.webp ├── projectile-hc-smoke-CT.webp ├── projectile-hc-smoke-T.webp ├── projectile-img-firebomb-CT.webp ├── projectile-img-firebomb-T.webp ├── projectile-img-flashbang-CT.webp ├── projectile-img-flashbang-T.webp ├── projectile-img-frag-CT.webp ├── projectile-img-frag-T.webp ├── projectile-img-smoke-CT.webp └── projectile-img-smoke-T.webp ├── index.js ├── keybinds.js ├── loadconfig.js ├── maps ├── de_ancient │ ├── LICENSE │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_anubis │ ├── LICENSE │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_cache │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_dust2 │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_inferno │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_mirage │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_nuke │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_overpass │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── de_train │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png └── de_vertigo │ ├── meta.json5 │ ├── overlay_buyzones.png │ ├── overlay_logos.png │ └── radar.png ├── package-lock.json ├── package.json ├── renderers ├── _global.js ├── _init.js ├── _map.js ├── _socket.js ├── advisory.js ├── bomb.js ├── loopFast.js ├── loopSlow.js ├── playerPosition.js ├── projectiles.js └── smokes.js ├── socket.js └── window.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | ko_fi: boltgolt 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | config.override.json5 4 | keybinds.override.json5 5 | 6 | libraryfolders.vdf 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | Boltobserv logo

3 | Giving CS observers a powerful new radar.
4 | Easy to read, infinitely resizeable, and with tons of features the default Counter-Strike radar does not have.

5 | 6 |
7 | 8 | ## Features 9 | 10 | ### Advanced player dots 11 | 12 | Player dots show more than just the location of the player. With 6 different dot states an observer can see exactly what a player is doing. The player slot number is shown as clear as possible on top of each dot. 13 | 14 | | Dots | Type | Description | 15 | |----------------------------------------|-------------------|-------------------------------------------------------------------------------------------------------------------------| 16 | | ![](https://i.imgur.com/rS7z3Hh.png) | Default | Player dots as seen on the normal CS radar, normally with a slot number on them. | 17 | | ![](https://i.imgur.com/qCqMGfY.png) | Flashed | Flashed players have a semi-white glow. This only shows when players are fully flashed (white screen). | 18 | | ![](https://i.imgur.com/QNhkhlV.png) | Active | A ring is shown around players that the observer selects to show the POV from. | 19 | | ![](https://i.imgur.com/lemRnpz.png) | Shooting | Muzzle flashes when a player fires a shot with any weapon. Shows for 1 frame for each shot. | 20 | | ![](https://i.imgur.com/HgQuHIY.png) | Being damaged | When any amount of health is lost the player dot shows a red line on the back of a player dot. | 21 | | ![](https://i.imgur.com/ahtStgB.png) | Bomb carrier | For Ts only. Shows the player that has the C4 with them. Easily spottable on the radar because of the color difference. | 22 | | ![](https://i.imgur.com/dFSweaR.png) | Dead | Killed players are still faintly visible on the radar as a small cross. | 23 | 24 | ### Clean radar backgrounds 25 | 26 | The radar images used are made in close cooperation with [simpleradar](https://readtldr.gg/simpleradar) and [readtldr.gg](https://readtldr.gg/), and are much higher quality and with more exact positioning of wall than the in-game radar. Every radar image is custom made for Boltobserv, allowing features like buyzones that are only shown during buytime. The style used by simpleradar is also much easier on the eyes. 27 | 28 | ![](https://i.imgur.com/Pvfi8vx.png) 29 | 30 | ### Follow the action 31 | 32 | 33 | 34 | When only a few players are alive most of the radar is just empty and only a very small part contains all the action. Boltobserv has an autozoom feature that fixes this. The radar image can automatically pan and zoom according to where the players are located, and smoothly follows the action. 35 | 36 | Autozoom tries to keep the action in the middle, with a safe padding around any players so they can never accidentally run off the radar image. it also has a minimal zoom level, so that the radar only zooms in when the action is concentrated in a small part of the map. 37 | 38 | ### Advisories 39 | 40 | Advisories are automatically detected events that the observer might want to switch to. 41 | To make switching to this event easier, the observer slot number is displayed next to an icon noting the type of advisory. 42 | The observer should still make his own judgment of the situation. 43 | 44 | All possible advisories are (with increasing priority): 45 | 46 | | Advisory | Type | Description | 47 | |----------------------------------------|---------------|----------------------------------------------------------------------------------------------------------------------| 48 | | ![](https://i.imgur.com/xR9eknI.png) | Default | This is displayed when no other notable events are happening. | 49 | | ![](https://i.imgur.com/DD2El5N.png) | Bomb plant | A terrorist is planting the bomb on a bombsite. | 50 | | ![](https://i.imgur.com/Xy1oLON.png) | Defusing | A CT is defusing the bomb. | 51 | | ![](https://i.imgur.com/FCZ8oB0.png) | Sole survivor | Only one member of a team is left standing. It's a good idea to observe this player, as all action will involve him. | 52 | 53 | ### Infinitely scalable 54 | 55 | Because Boltobserv runs as an external application, it can be resized to be whatever size you want, and be moved to any display you want. 56 | Running without window borders enables it to dedicate as much space as possible to the radar. 57 | 58 | It can even [run in a browser](https://github.com/boltgolt/boltobserv/wiki/Opening-radar-in-browser), allowing you to view the radar over the network. This also means that the radar can be added as a browser source in applications like OBS with a transparent background. 59 | 60 | ### And much more 61 | 62 | - Smokes, molotovs and flashbangs shown on the map 63 | - Split maps for upper and lower on Nuke and Vertigo 64 | - Any radar background color, including full transparency 65 | - Always-on-top and fixed on-screen positioning 66 | - Player dot z-height indicators, either by color dot or scale 67 | - [Custom configurable OS-level keybinds](https://github.com/boltgolt/boltobserv/wiki/How-to-use-keybinds) 68 | - Automatic .cfg file installation 69 | - Show radar as an application window, in [the browser](https://github.com/boltgolt/boltobserv/wiki/Opening-radar-in-browser) or [capture it directly in OBS](https://github.com/boltgolt/boltobserv/wiki/How-to-capture-Boltobserv-in-OBS) 70 | 71 | 72 | ## Installation 73 | 74 | 1. Download the latest .zip form the [releases](https://github.com/boltgolt/boltobserv/releases) page and unzip it. 75 | 2. Launch `Boltobserv.exe`, it should ask you to automatically install the .cfg file. If it doesn't, copy the `gamestate_integration_boltobserv.cfg` file from the .zip to your CS config folder (the same folder you'd put an `autoexec.cfg`). 76 | 3. You're done! (Re)start CS2 and Boltobserv should automatically connect. 77 | 78 | Please report any bugs or feature requests here on Github. 79 | 80 | ## Configuration 81 | 82 | Most functions of Boltobserv are configurable. To make your own config, go to `/resources/app/config` and either edit the `config.json5` file directly or duplicate it and rename the copy to `config.override.json5`. Using a override file will allow you to move your settings to a different machine or version without breaking the base config file. 83 | 84 | ## Special thanks 85 | 86 | Thanks to [PGL](https://www.pglesports.com/) and [Inygon](https://inygon.com/) for supporting open source development on Boltobserv 87 | 88 | [![PGL](https://i.imgur.com/0LaJULP.png)](https://www.pglesports.com/) 89 | [![Inygon](https://i.imgur.com/bQjz86D.png)](https://inygon.com/) 90 | 91 | If you want to support development on specific functionality, don't hesitate to contact me. Supporting me by [sending a small donation](https://ko-fi.com/boltgolt) is also very appreciated. 92 | 93 | ## License 94 | 95 | This project is licensed under GPL-3. In short, this means that all changes you make to this project need to be made open source (among other things). Commercial use is encouraged, as is distribution. 96 | 97 | The paragraph above is not legal advice and is not legally binding. See the LICENSE file for the full license. 98 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "boltobserv", 3 | "version": "1.5.2", 4 | "_whatisthis": "Older versions of Boltobserv used this file to check for updates, so it can't be deleted. The real package.json is in /src" 5 | } 6 | -------------------------------------------------------------------------------- /src/config/config.json5: -------------------------------------------------------------------------------- 1 | // ============================= MAIN CONFIG FILE ============================= 2 | // It's possible to change values directly in this file, but by creating a file 3 | // called "config.override.json5" in the same directory you can override values 4 | // without making changes here. This makes your config a lot more portable. 5 | 6 | { 7 | "_version": "1.5.2", 8 | 9 | // Settings related to the Boltobserv window 10 | "window": { 11 | // Don't show radar in a window, only a small status window will open 12 | "disable": false, 13 | 14 | // Always show the window as the top application 15 | "alwaysOnTop": false, 16 | 17 | // Make the background of the window transparent 18 | "transparent": false, 19 | 20 | // Change the background color of the window with optional transparency 21 | // The color should be in hexadecimal color code 22 | // like #FFF or #FFFFFF to normal color and #80FFFFFF to color with transparency 23 | "backgroundColor": "#000000", 24 | 25 | // Start window as a full screen application 26 | // Use ALT + F4 to quit 27 | "fullscreen": false, 28 | 29 | // Will disable GPU rendering, helps capture the window in programs like OBS 30 | "disableGpu": false, 31 | 32 | // Do not capture mouse events, allowing interaction with the window underneath 33 | // Dragging or resizing the window will be disabled if this option is true 34 | "mousePassthrough": false, 35 | 36 | // The default shape and position of the window 37 | "defaultSize": { 38 | // The height and width in pixels 39 | "height": 600, 40 | "width": 600, 41 | 42 | // The default distance from the top left of the screen 43 | // Set to -1 to let the OS pick the best place 44 | "top": -1, 45 | "left": -1 46 | } 47 | }, 48 | 49 | // Settings related to remote browser access to the radar 50 | "browser": { 51 | // Prevents a background from being set in the browser, for OBS capture 52 | "transparent": false, 53 | 54 | "ports": { 55 | // Serves static files, such as HTML. Use this one in your browser 56 | "static": 36364, 57 | // Dynamic websocket port, used for live data transport 58 | "socket": 36365 59 | } 60 | }, 61 | 62 | // Settings that will change the way the radar is displayed 63 | "radar": { 64 | // Hide advisories on the radar 65 | "hideAdvisories": false, 66 | // When true, players higher on the map will show over lower ones 67 | // If false, the player slot number determines the stacking order 68 | // The spectated player is always visible on top of everything 69 | "highestPlayerOnTop": true, 70 | // Show the buyzones on the map, or only when players can buy 71 | // Only works on SimpleRadar maps, can either be "never", "buytime" or "always" 72 | "showBuyzones": "buytime", 73 | // Show Boltobserv, Simple Radar and Lexogrine logos 74 | "showLogos": true, 75 | 76 | // Show the player name on the dot, options are: 77 | // "never" only show the spec number (observer slot) 78 | // "both" show the name of the player under the dot 79 | // "always" replace the spec number by the player name 80 | "showName": "never", 81 | // Truncate the name of the player after this many characters 82 | "maxNameLength": 8, 83 | 84 | // Show muzzle flashes for players shooting 85 | "shooting": true, 86 | // Show red indicators on player dots when their health gets lower 87 | "damage": true, 88 | // Show flashed players in a lighter color 89 | "flashes": true, 90 | // Show flying projectiles on the map 91 | "projectiles": true, 92 | 93 | // Give active smokes the color of the team that threw it 94 | "smokeColors": true, 95 | // Show projectiles as very plain and clear letter combinations 96 | "plainProjectiles": false, 97 | 98 | // Frames to smooth out player movement 99 | "playerSmoothing": 13, 100 | // Frames to smooth out flying projectile movement 101 | "projectileSmoothing": 5, 102 | // Opacity between 0 and 1 of the dead player crosses, set to 0 to fully hide 103 | "tombstoneOpacity": 0.4, 104 | 105 | // Amount of scaling to apply to player dots on the radar 106 | // Values above 1 might be blurry 107 | "playerDotScale": 0.7, 108 | // Same as the above, but for the bomb 109 | "bombDotScale": 0.7 110 | }, 111 | 112 | // Show a vertical indicator on every player dot, indicating how high the player is on the map 113 | "vertIndicator": { 114 | // Indicator type, can either be "none", "color" or "scale" 115 | "type": "scale", 116 | 117 | // RGB values for the color indicator, from lowest to highest 118 | "colorRange": [[13, 255, 0], [255, 255, 255], [255, 0, 199]], 119 | // Controls by how much dots should scale depending on height, works in combination with playerDotScale 120 | // 0.5 halves the amount of scaling, 1 keeps it the default, 1.5 makes player dots scale more 121 | "scaleDelta": 1 122 | }, 123 | 124 | // Settings for automatically zooming in on alive players on the map 125 | "autozoom": { 126 | // Enable or disable autozoom 127 | "enable": true, 128 | 129 | // Frames to smooth out zoom movement 130 | "smoothing": 32, 131 | 132 | // Percentage of radar space to try to keep as padding between the outermost players and the edge of the radar 133 | "padding": 0.3, 134 | 135 | // Only apply autozoom if calculated zoom level would be at least this much 136 | // In decimals, where 1.2 would mean 20% more zoomed in than the default radar 137 | "minZoom": 1.3 138 | }, 139 | 140 | // Settings related to the CSGO game 141 | "game": { 142 | // Seconds of inactivity before considering a connection to the game client as lost 143 | // Set to -1 to never timeout 144 | "connectionTimout": 90, 145 | 146 | // The port GSI will try to connect to 147 | "networkPort": 36363, 148 | 149 | // Tries to detect the CSGO game on the machine and prompts to install the CFG file if it hasn't already 150 | "installCfg": true, 151 | 152 | // The hostname for the GSI server to listen on 153 | "host": "0.0.0.0" 154 | }, 155 | 156 | // Settings that should not be used in normal operation, but help to find issues 157 | "debug": { 158 | // Print the loaded config into the console 159 | "printConfig": false, 160 | 161 | // Don't open any electron window, just start the server 162 | // Do NOT execute Boltobserv outside a terminal with this enabled, could become a zombie process 163 | "terminalOnly": false 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /src/config/keybinds.json5: -------------------------------------------------------------------------------- 1 | { 2 | "Control+Alt+R": "functions.reload()" 3 | } 4 | -------------------------------------------------------------------------------- /src/css/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Use this file to apply custom styles to the radar image 3 | */ 4 | 5 | /* Any player dot */ 6 | div.dot {} 7 | 8 | /* Players that are CT or T */ 9 | div.dot.CT {} 10 | div.dot.T {} 11 | 12 | /* The player with the bomb */ 13 | div.dot.bomb{} 14 | 15 | /* The player currently being observed */ 16 | div.dot.active {} 17 | 18 | /* A dead player */ 19 | div.dot.dead {} 20 | 21 | /* The number on a player dot */ 22 | div.label {} 23 | 24 | /* The number on the dot being spectated */ 25 | div.label.active {} 26 | 27 | /* Damage indecator behind the player dot */ 28 | div.dot::before {} 29 | 30 | /* Muzzle flash in fromt of the the player dot */ 31 | div.dot::after {} 32 | 33 | /* The dropped or planted bomb on the map */ 34 | #bomb {} 35 | 36 | /* Smoke circles on the map */ 37 | #smokes > div {} 38 | 39 | /* Inferno circles on the map */ 40 | .inferno > div {} 41 | 42 | /* The advisory on screen */ 43 | #advisory {} 44 | -------------------------------------------------------------------------------- /src/css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | display: flex; 4 | align-items: center; 5 | justify-content: center; 6 | font-family: Arial, Helvetica, sans-serif; 7 | -moz-user-select: none; 8 | user-select: none; 9 | cursor: not-allowed; 10 | } 11 | 12 | body > div { 13 | color: white; 14 | height: 100vh; 15 | width: 100vh; 16 | max-width: 100vh; 17 | max-height: 100vw; 18 | position: relative; 19 | overflow: hidden; 20 | } 21 | 22 | #dragarea { 23 | -webkit-app-region: drag; 24 | height: calc(96vh - 20px); 25 | width: calc(96vw - 20px); 26 | top: 20px; 27 | left: 20px; 28 | position: fixed; 29 | z-index: 1000; 30 | } 31 | -------------------------------------------------------------------------------- /src/css/map.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --config-tombstone-opacity: .4; 3 | --config-bomb-dot-scale: .7; 4 | } 5 | 6 | body { 7 | overflow: hidden; 8 | } 9 | 10 | #container { 11 | -webkit-backface-visibility: hidden; 12 | transition: transform .025; 13 | } 14 | 15 | #radar { 16 | position: absolute; 17 | height: 100%; 18 | width: 100%; 19 | bottom: 0; 20 | left: 0; 21 | z-index: 1; 22 | transform: scale(1) translate(0%, 0%); 23 | 24 | will-change: transform; 25 | outline: .1vmin solid transparent; 26 | -webkit-backface-visibility: hidden; 27 | } 28 | 29 | #radar img { 30 | position: absolute; 31 | top: 0; 32 | left: 0; 33 | height: 100%; 34 | width: 100%; 35 | opacity: 1; 36 | transition: opacity .4s; 37 | } 38 | 39 | #smokes, #entities, #flashbangs, #projectiles, #trails { 40 | position: absolute; 41 | height: 100%; 42 | width: 100%; 43 | bottom: 0; 44 | left: 0; 45 | z-index: 2; 46 | } 47 | 48 | div.dot, div.label { 49 | position: absolute; 50 | height: 5.6vmin; 51 | width: 5.6vmin; 52 | left: -100vw; 53 | bottom: -100vh; 54 | display: block; 55 | background: #f00; 56 | transform: translate(-50%, 50%); 57 | transform-origin: 0% 100%; 58 | border-radius: 100% .2vmin 100% 100%; 59 | box-shadow: 0 0 1.6vmin .8vmin rgba(0, 0, 0, .2); 60 | opacity: 1; 61 | z-index: 15; 62 | 63 | will-change: bottom, left, transform; 64 | outline: .1vmin solid transparent; 65 | -webkit-backface-visibility: hidden; 66 | backface-visibility: initial; 67 | } 68 | 69 | div.dot::before, div.dot::after { 70 | content: ''; 71 | position: absolute; 72 | z-index: 14; 73 | opacity: 0; 74 | transition: opacity .02s; 75 | } 76 | 77 | div.dot::before { 78 | height: 4vmin; 79 | width: 4vmin; 80 | background: radial-gradient(circle at right top, #0000 0 45%, #BE2C2C 0 70%, #0000 0); 81 | left: -1.3vmin; 82 | bottom: -1.3vmin; 83 | } 84 | 85 | div.dot::after { 86 | height: 6.6vmin; 87 | width: 6.6vmin; 88 | background: linear-gradient(180deg, #888 1vmin, #0000 0), linear-gradient(270deg, #888 1vmin, #0000 0), linear-gradient(180deg, #bbb 2vmin, #0000 0), linear-gradient(270deg, #bbb 2vmin, #0000 0), linear-gradient(180deg, #fff 3vmin, #0000 0), linear-gradient(270deg, #fff 3vmin, #0000 0); 89 | left: 2vmin; 90 | bottom: 2vmin; 91 | } 92 | 93 | div.dot.CT { 94 | background: #5ab8f4; 95 | } 96 | 97 | div.dot.T { 98 | background: #f0c941; 99 | } 100 | 101 | div.dot.bomb { 102 | border-radius: 2vmin .4vmin 2vmin 2.4vmin; 103 | background: #FF8200; 104 | } 105 | 106 | div.dot.active { 107 | z-index: 7000 !important; 108 | box-shadow: 0 0 0 .2vmin rgba(0, 0, 0, .9), 0 0 0 1vmin rgba(255, 255, 255, .9), 0 0 2.4vmin 1.2vmin rgba(255, 255, 255, .2); 109 | } 110 | 111 | div.dot.hurting::before { 112 | opacity: .8; 113 | } 114 | 115 | div.dot.shooting::after { 116 | opacity: .75; 117 | } 118 | 119 | div.dot.flashed { 120 | box-shadow: 0 0 1.6vmin .8vmin rgba(0, 0, 0, .2), inset 0 0 2vmin 1vmin rgba(255, 255, 255, .8); 121 | } 122 | 123 | div.dot.flashed.active { 124 | box-shadow: 0 0 0 .2vmin rgba(0, 0, 0, .9), 0 0 0 1vmin rgba(255, 255, 255, .9), 0 0 2.4vmin 1.2vmin rgba(255, 255, 255, .2), inset 0 0 2vmin 1vmin rgba(255, 255, 255, .8); 125 | } 126 | 127 | div.dot.dead { 128 | color: transparent; 129 | text-shadow: none; 130 | border-radius: 0; 131 | clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%); 132 | opacity: var(--config-tombstone-opacity); 133 | z-index: 13 !important; 134 | filter: none; 135 | } 136 | 137 | div.dot > div { 138 | position: absolute; 139 | bottom: 1.3vmin; 140 | left: 1.3vmin; 141 | width: 3vmin; 142 | height: 3vmin; 143 | background: #0000; 144 | box-shadow: inset 0 0 0 1.5vmin rgba(255,255,255,0); 145 | box-sizing: border-box; 146 | border-radius: 60vmin; 147 | } 148 | 149 | div.dot.dead > div { 150 | display: none; 151 | } 152 | 153 | div.label { 154 | background: none; 155 | display: flex; 156 | justify-content: center; 157 | color: black; 158 | font-weight: bold; 159 | text-shadow: 0 0 1.2vmin rgba(255, 255, 255, .2); 160 | box-shadow: none; 161 | line-height: 5.6vmin; 162 | font-size: 4.8vmin; 163 | } 164 | 165 | div.label.active { 166 | z-index: 7000 !important; 167 | font-size: 5vmin; 168 | } 169 | 170 | div.label.dead { 171 | display: none; 172 | } 173 | 174 | div.label span { 175 | display: block; 176 | position: absolute; 177 | left: 50%; 178 | top: 100%; 179 | transform: translateX(-50%); 180 | font-size: .7em; 181 | color: #FFF; 182 | text-shadow: 0 0 .3em #000; 183 | opacity: .85; 184 | } 185 | 186 | #bomb { 187 | position: absolute; 188 | background-image: url("../img/bomb-dropped.webp"); 189 | background-size: contain; 190 | height: 2.2vmin; 191 | width: 2.2vmin; 192 | bottom: -30%; 193 | left: -30%; 194 | transform: scale(var(--config-bomb-dot-scale)) translate(-50%, 50%); 195 | transform-origin: bottom left; 196 | } 197 | 198 | #bomb.defused { 199 | background-image: url("../img/bomb-defused.webp"); 200 | filter: drop-shadow(0 0 .4vmin rgba(0, 255, 0, .3)); 201 | } 202 | 203 | #bomb.planted { 204 | background-image: url("../img/bomb-planted.webp"); 205 | animation: beep 1s infinite; 206 | } 207 | 208 | @keyframes beep { 209 | 0% { 210 | filter: drop-shadow(0 0 0 rgba(255, 0, 0, 1)); 211 | background-color: rgba(255, 0, 0, 0); 212 | } 213 | 10% { 214 | filter: drop-shadow(0 0 1vmin rgba(255, 0, 0, 1)); 215 | background-color: rgba(255, 0, 0, 0.2); 216 | } 217 | 20% { 218 | filter: drop-shadow(0 0 1.8vmin rgba(255, 0, 0, 0)); 219 | background-color: rgba(255, 0, 0, 0); 220 | } 221 | } 222 | 223 | #smokes > div { 224 | position: absolute; 225 | border-radius: 100%; 226 | opacity: .8; 227 | transform-origin: center; 228 | background: #9F9D9D; 229 | overflow: hidden; 230 | border-color: #D7D7D7; 231 | transform: translate(-50%, 50%); 232 | transition: opacity .3s; 233 | } 234 | 235 | #smokes > div::before { 236 | content: ''; 237 | display: block; 238 | height: 100%; 239 | width: 100%; 240 | border: transparent solid .6vmin; 241 | border-color: inherit; 242 | border-radius: 100%; 243 | box-sizing: border-box; 244 | } 245 | 246 | #smokes > div.CT { 247 | background: #678FAA; 248 | border-color: #77C5F6; 249 | } 250 | 251 | #smokes > div.T { 252 | background: #CCBA7D; 253 | border-color: #F1D369; 254 | } 255 | 256 | #smokes > div.hide { 257 | opacity: 0; 258 | } 259 | 260 | #smokes > div.fading { 261 | transition: opacity 1.8s; 262 | } 263 | 264 | #smokes > div > div { 265 | height: 100%; 266 | width: 100%; 267 | border: transparent solid .6vmin; 268 | border-color: inherit; 269 | border-radius: 100%; 270 | background-color: #364254; 271 | transform: translate(-0.6vmin, 0.6vmin); 272 | position: absolute; 273 | opacity: 1; 274 | transition: background-color .15s, opacity .8s; 275 | } 276 | 277 | #smokes > div > div.flash { 278 | background-color: #fff; 279 | } 280 | 281 | #smokes > div > div.fade { 282 | opacity: 0; 283 | } 284 | 285 | #infernos { 286 | position: absolute; 287 | height: 100%; 288 | width: 100%; 289 | bottom: 0; 290 | left: 0; 291 | z-index: 2; 292 | } 293 | 294 | .inferno { 295 | position: absolute; 296 | height: 100%; 297 | width: 100%; 298 | bottom: 0; 299 | left: 0; 300 | z-index: 2; 301 | transition: opacity .3s; 302 | } 303 | 304 | .inferno > div { 305 | position: absolute; 306 | border-radius: 100%; 307 | opacity: .75; 308 | background: #ff4848; 309 | box-sizing: border-box; 310 | border: #ce3f00 solid .2vmin; 311 | transform: translate(-50%, 50%); 312 | transition: opacity .3s; 313 | } 314 | 315 | #flashbangs > div { 316 | position: absolute; 317 | opacity: .8; 318 | background: #FFF; 319 | box-sizing: border-box; 320 | transform-origin: center; 321 | border-radius: 100%; 322 | transform: translate(-50%, 50%); 323 | clip-path: polygon(15% 8%, 40% 25%, 50% 0%, 60% 25%, 85% 8%, 74% 35%, 100% 36%, 78% 50%, 100% 70%, 72.5% 67%, 77.5% 92.5%, 60% 75%, 50% 100%, 40% 75%, 22.5% 92.5%, 27.5% 67%, 0% 70%, 22% 50%, 0% 36%, 26% 35%); 324 | box-shadow: inset 0 0 0vmin 1.7vmin #FC9F2D, inset 0 0 5vmin 0 #FEA130; 325 | transition: opacity .3s; 326 | } 327 | 328 | #flashbangs > div.full { 329 | opacity: .8; 330 | } 331 | 332 | #flashbangs > div.hide { 333 | opacity: 0; 334 | } 335 | 336 | #trails path { 337 | stroke-linejoin: round; 338 | fill: none; 339 | } 340 | 341 | #projectiles > div { 342 | position: absolute; 343 | box-sizing: border-box; 344 | transform-origin: center; 345 | transform: translate(-50%, 50%); 346 | background-repeat: no-repeat; 347 | background-size: contain; 348 | background-position: center; 349 | height: 4vmin; 350 | width: 4vmin; 351 | } 352 | 353 | #advisory { 354 | position: absolute; 355 | width: 14%; 356 | height: 7%; 357 | background: #f00; 358 | border-radius: 3vmin 8vmin 8vmin 3vmin; 359 | background: linear-gradient(to right, #222, #292929); 360 | color: #000; 361 | box-shadow: 0 0 .4vmin .3vmin rgba(255, 255, 255, .05); 362 | display: none; 363 | } 364 | 365 | #advisory::before { 366 | content: ""; 367 | position: absolute; 368 | top: 10%; 369 | left: 7%; 370 | height: 80%; 371 | width: 40%; 372 | background-position: center; 373 | background-repeat: no-repeat; 374 | background-size: contain; 375 | } 376 | 377 | #advisory span { 378 | position: absolute; 379 | top: 10%; 380 | right: 5%; 381 | height: 80%; 382 | width: 40%; 383 | border-radius: 100%; 384 | box-sizing: border-box; 385 | box-shadow: 0 0 .4vmin .3v rgba(255, 255, 255, .2) inset; 386 | background: #000; 387 | text-align: center; 388 | color: #000; 389 | line-height: 5.9vmin; 390 | font-size: 5vmin; 391 | font-weight: bold; 392 | } 393 | 394 | #advisory.planting::before { 395 | background-image: url("../img/adv-plant.webp"); 396 | } 397 | 398 | #advisory.planting { 399 | background: linear-gradient(to right, #AD9A3C, #ECCD37); 400 | box-shadow: 0 0 .4vmin .3vmin rgba(255,252,0,.2); 401 | } 402 | 403 | #advisory.defuse::before { 404 | background-image: url("../img/adv-defuse.webp"); 405 | } 406 | 407 | #advisory.defuse { 408 | background: linear-gradient(to right, #39536d, #3a7eb1); 409 | box-shadow: 0 0 .4vmin .3vmin rgba(0,41,255,.2); 410 | } 411 | 412 | #advisory.solesurvivor::before { 413 | background-image: url("../img/adv-solesurvivor.webp"); 414 | } 415 | 416 | #advisory.solesurvivor { 417 | background: linear-gradient(to right, #436C39, #40B13A); 418 | box-shadow: 0 0 .4vmin .3vmin rgba(13,255,0,.2); 419 | } 420 | 421 | #advisory.planting span, #advisory.defuse span, #advisory.solesurvivor span { 422 | color: #fff; 423 | } 424 | 425 | #unknownMap { 426 | position: absolute; 427 | bottom: 0; 428 | left: 0; 429 | height: 100%; 430 | width: 100%; 431 | background: #000; 432 | display: none; 433 | justify-content: center; 434 | align-items: center; 435 | } 436 | -------------------------------------------------------------------------------- /src/css/status.css: -------------------------------------------------------------------------------- 1 | body { 2 | overflow: hidden; 3 | cursor: inherit; 4 | } 5 | 6 | #game { 7 | width: 100vw; 8 | max-width: 100vw; 9 | } 10 | 11 | img { 12 | height: 30px; 13 | margin-right: 10px; 14 | animation: none; 15 | } 16 | 17 | #text { 18 | position: absolute; 19 | top: 72px; 20 | width: 100vw; 21 | display: flex; 22 | justify-content: center; 23 | align-items: center; 24 | } 25 | 26 | #text > div { 27 | display: inline; 28 | opacity: .8; 29 | } 30 | 31 | #text span { 32 | text-decoration: underline; 33 | cursor: pointer; 34 | position: relative; 35 | z-index: 2000; 36 | -webkit-app-region: no-drag; 37 | } 38 | 39 | #text span:hover { 40 | cursor: pointer; 41 | -webkit-app-region: no-drag; 42 | } 43 | 44 | #dragarea { 45 | -webkit-app-region: drag; 46 | height: 100vh; 47 | width: 100vw; 48 | top: 0; 49 | left: 0; 50 | } 51 | 52 | #version { 53 | bottom: 14px; 54 | } 55 | -------------------------------------------------------------------------------- /src/css/waiting.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: rgba(0, 0, 0, .24); 3 | } 4 | 5 | #container { 6 | display: flex; 7 | flex-direction: column; 8 | align-items: center; 9 | justify-content: space-between; 10 | width: 100vw; 11 | max-width: 100vw; 12 | height: 100vh; 13 | max-height: 100vh; 14 | overflow: visible; 15 | } 16 | 17 | #container > div:first-child { 18 | background: #222; 19 | width: 100%; 20 | padding: .8rem 1rem; 21 | font-size: .9rem; 22 | color: #fff; 23 | box-sizing: border-box; 24 | display: flex; 25 | justify-content: space-between; 26 | } 27 | 28 | #container > div:first-child img { 29 | height: 1.6rem; 30 | margin-right: .7rem; 31 | vertical-align: middle; 32 | animation: beat 3s infinite ease-in-out; 33 | } 34 | 35 | @keyframes beat { 36 | 40% { 37 | transform: scale(1) rotate(0deg); 38 | } 39 | 40 | 60% { 41 | transform: scale(1.1) rotate(190deg); 42 | } 43 | 44 | 70% { 45 | transform: scale(1) rotate(180deg); 46 | } 47 | 48 | 100% { 49 | transform: scale(1) rotate(180deg); 50 | } 51 | } 52 | 53 | #container > div:first-child a { 54 | color: #a647c7; 55 | margin-left: .7rem; 56 | text-decoration: underline; 57 | cursor: pointer; 58 | position: relative; 59 | z-index: 2000; 60 | -webkit-app-region: no-drag; 61 | } 62 | 63 | #container > div:first-child button { 64 | color: #000; 65 | background: #a647c7; 66 | } 67 | 68 | #container > div:first-child section { 69 | position: absolute; 70 | width: 90%; 71 | left: 5%; 72 | top: 4.4rem; 73 | text-align: center; 74 | font-size: .8rem; 75 | cursor: pointer; 76 | z-index: 2000; 77 | -webkit-app-region: no-drag; 78 | color: #555; 79 | } 80 | 81 | #container > div:first-child section a { 82 | display: block; 83 | color: inherit; 84 | } 85 | 86 | #openconfig { 87 | display: none; 88 | } 89 | 90 | #container > div:nth-child(2) { 91 | display: flex; 92 | align-items: center; 93 | } 94 | 95 | .statusbox { 96 | background: #333; 97 | color: #AAA; 98 | border-radius: .8vmin; 99 | text-align: center; 100 | font-size: 2.4vmin; 101 | width: 20vmin; 102 | overflow: hidden; 103 | } 104 | 105 | .statusbox strong { 106 | display: block; 107 | padding: 2vmin 0 .2vmin; 108 | } 109 | 110 | .statusbox > span { 111 | display: block; 112 | font-size: 1.8vmin; 113 | text-transform: uppercase; 114 | padding-bottom: 2vmin; 115 | } 116 | 117 | .statusbox div { 118 | font-size: 2vmin; 119 | padding: 2vmin; 120 | background: #222; 121 | } 122 | 123 | .statusbox div span { 124 | display: block; 125 | max-width: 100%; 126 | text-overflow: ellipsis; 127 | overflow: hidden; 128 | } 129 | 130 | .statusbox.connected { 131 | color: #fff; 132 | background: #a647c7; 133 | } 134 | 135 | .statusbox.connected div { 136 | color: #fff; 137 | background: #7E3498; 138 | } 139 | 140 | .statusline { 141 | color: #333; 142 | width: 6vmin; 143 | padding-bottom: .4vmin; 144 | text-align: center; 145 | font-size: 6vmin; 146 | font-weight: bold; 147 | } 148 | 149 | .statusline.connected { 150 | color: #a647c7; 151 | } 152 | 153 | #cfgs { 154 | width: 100vw; 155 | box-sizing: border-box; 156 | padding: 1rem; 157 | cursor: default; 158 | font-size: .8rem; 159 | } 160 | 161 | #cfgs > div { 162 | display: flex; 163 | flex-direction: row; 164 | background: #a647c7; 165 | padding: .6rem .8rem; 166 | margin-bottom: .2rem; 167 | line-height: 1.2rem; 168 | width: 100%; 169 | box-sizing: border-box; 170 | max-width: 65rem; 171 | margin: auto; 172 | border-radius: .1rem; 173 | } 174 | 175 | #cfgs span { 176 | font-weight: bold; 177 | } 178 | 179 | #cfgs small { 180 | font-size: inherit; 181 | flex: 1; 182 | overflow: hidden; 183 | white-space: nowrap; 184 | text-overflow: ellipsis; 185 | min-width: 0; 186 | padding: 0 .4rem 0 .3rem; 187 | } 188 | 189 | button { 190 | background: #FFF; 191 | border: 0; 192 | color: #a647c7; 193 | padding: .2rem 1rem; 194 | font-weight: bold; 195 | cursor: pointer; 196 | position: relative; 197 | z-index: 2000; 198 | -webkit-app-region: no-drag; 199 | text-align: center; 200 | text-transform: uppercase; 201 | border-radius: .1rem; 202 | transform: scale(1); 203 | transition: transform .15s; 204 | } 205 | 206 | button:hover { 207 | transform: scale(1.05); 208 | } 209 | 210 | button:active { 211 | transform: scale(0.98); 212 | } 213 | 214 | button:focus { 215 | outline: none; 216 | } 217 | 218 | #noconnection { 219 | font-size: 4vmin; 220 | text-align: center; 221 | box-sizing: border-box; 222 | padding: 5vmin 10vmin 5vmin 10vmin; 223 | } 224 | 225 | #dragarea { 226 | max-width: initial; 227 | max-height: initial; 228 | } 229 | 230 | @media (max-width: 500px) { 231 | #container > div:first-child a, 232 | #container > div:first-child button, 233 | #container > div:first-child section { 234 | display: none !important; 235 | } 236 | 237 | #cfgs { 238 | visibility: hidden; 239 | } 240 | } 241 | 242 | @media (max-height: 350px) { 243 | #container > div:first-child section { 244 | display: none; 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /src/detectcfg.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const path = require("path") 3 | const steamPath = require("steam-game-path") 4 | 5 | module.exports = { 6 | found: [], 7 | search: () => { 8 | let result = steamPath.getGamePath(730) 9 | if (result && result.game && fs.existsSync(result.game.path)) { 10 | console.info("Found installation in", result.game.path) 11 | 12 | let configPath = path.join(result.game.path, "game", "core", "cfg", "gamestate_integration_boltobserv.cfg") 13 | 14 | if (fs.existsSync(configPath)) { 15 | let foundHeader = fs.readFileSync(configPath, "utf8").split("\n")[0] 16 | let ownHeader = fs.readFileSync(path.join(__dirname, "gamestate_integration_boltobserv.cfg"), "utf8").split("\n")[0] 17 | 18 | if (foundHeader != ownHeader) { 19 | module.exports.found.push({ 20 | type: "update", 21 | path: result.game.path 22 | }) 23 | } 24 | } 25 | else { 26 | module.exports.found.push({ 27 | type: "install", 28 | path: result.game.path 29 | }) 30 | } 31 | } 32 | }, 33 | 34 | install: (target) => { 35 | let template = path.join(__dirname, "gamestate_integration_boltobserv.cfg") 36 | let dest = path.join(target, "game", "core", "cfg", "gamestate_integration_boltobserv.cfg") 37 | fs.copyFileSync(template, dest) 38 | 39 | console.info("Installed config file as", dest) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/gamestate_integration_boltobserv.cfg: -------------------------------------------------------------------------------- 1 | "Boltobserv integration v3 | https://github.com/boltgolt/boltobserv" 2 | { 3 | "uri" "http://localhost:36363" 4 | "timeout" "0.1" 5 | "buffer" "0.0" 6 | "throttle" "0.0" 7 | "heartbeat" "2.0" 8 | "data" 9 | { 10 | "provider" "1" 11 | "map" "1" 12 | "bomb" "1" 13 | "round" "1" 14 | "player_id" "1" 15 | "allplayers_id" "1" 16 | "allplayers_state" "1" 17 | "allplayers_weapons" "1" 18 | "allplayers_position" "1" 19 | "phase_countdowns" "1" 20 | "allgrenades" "1" 21 | } 22 | "output" 23 | { 24 | "precision_time" "3" 25 | "precision_position" "3" 26 | "precision_vector" "3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/gsi.js: -------------------------------------------------------------------------------- 1 | const http = require("http") 2 | const config = require("./loadconfig") 3 | 4 | let server = http.createServer(handleRequest) 5 | 6 | server.on("error", err => { 7 | console.error("GSI server error:", err) 8 | }) 9 | 10 | server.listen(config.game.networkPort, config.game.host, () => { 11 | console.info(`GSI input expected at http://${config.game.host}:${config.game.networkPort}`) 12 | }) 13 | 14 | function handleRequest(req, res) { 15 | if (req.method != "POST") { 16 | res.writeHead(405) 17 | return res.end("Boltobserv running\nPlease POST GSI data here") 18 | } 19 | 20 | // Start with an enpty body 21 | let body = "" 22 | // Append incomming data to body 23 | req.on("data", data => body += data) 24 | 25 | 26 | // On end if packet data 27 | req.on("end", () => { 28 | // Send back empty response immediatly 29 | res.end("") 30 | 31 | // Patch incomming JSON to convert large integers to strings 32 | body = body.replace(/"owner": ([0-9]{10,})/g, '"owner": "$1"') 33 | // Parse JSON packet 34 | let game = JSON.parse(body) 35 | 36 | if (game.provider) { 37 | let connObject = { 38 | status: "up" 39 | } 40 | 41 | if (game.player) { 42 | if (game.player.activity != "playing") { 43 | connObject.player = game.player.name 44 | } 45 | } 46 | 47 | process.send({ 48 | type: "connection", 49 | data: connObject 50 | }) 51 | } 52 | 53 | if (game.map) { 54 | process.send({ 55 | type: "map", 56 | data: game.map.name 57 | }) 58 | } 59 | 60 | if (game.allplayers) { 61 | let playerArr = [] 62 | 63 | for (let id in game.allplayers) { 64 | if (!Number.isInteger(game.allplayers[id].observer_slot)) continue 65 | 66 | let player = game.allplayers[id] 67 | let pos = player.position.split(", ") 68 | let angle = 0 69 | let hasBomb = false 70 | let bombActive = false 71 | let isActive = false 72 | let rawAngle = player.forward.split(", ") 73 | let ammo = {} 74 | 75 | if (parseFloat(rawAngle[0]) > 0) { 76 | angle = 90 + parseFloat(rawAngle[1]) * -1 * 90 77 | } 78 | else { 79 | angle = 270 + parseFloat(rawAngle[1]) * 90 80 | } 81 | 82 | if (game.player) { 83 | if (game.player.observer_slot == player.observer_slot) { 84 | isActive = true 85 | } 86 | } 87 | 88 | for (let id in player.weapons) { 89 | // The player has the bomb in their inventory 90 | if (player.weapons[id].name == "weapon_c4") { 91 | hasBomb = true 92 | // The player has the bomb in their hands 93 | bombActive = player.weapons[id].state == "active" 94 | } 95 | 96 | // Save the amma in each gun to know when the player is shooting 97 | else if (player.weapons[id].ammo_clip) { 98 | ammo[player.weapons[id].name] = player.weapons[id].ammo_clip 99 | } 100 | } 101 | 102 | playerArr.push({ 103 | id: id, 104 | num: player.observer_slot, 105 | name: player.name, 106 | team: player.team, 107 | health: player.state.health, 108 | active: isActive, 109 | flashed: player.state.flashed, 110 | bomb: hasBomb, 111 | bombActive: bombActive, 112 | angle: angle, 113 | ammo: ammo, 114 | position: { 115 | x: parseFloat(pos[0]), 116 | y: parseFloat(pos[1]), 117 | z: parseFloat(pos[2]) 118 | } 119 | }) 120 | } 121 | 122 | process.send({ 123 | type: "players", 124 | data: { 125 | players: playerArr 126 | } 127 | }) 128 | } 129 | 130 | if (game.grenades) { 131 | let grenades = { 132 | smokes: [], 133 | infernos: [], 134 | flashbangs: [], 135 | projectiles: [] 136 | } 137 | 138 | for (let nadeID in game.grenades) { 139 | let nade = game.grenades[nadeID] 140 | 141 | if (nade.type == "smoke" && nade.effecttime != '0.000') { 142 | let pos = nade.position.split(", ") 143 | let owner = game.allplayers[nade.owner] 144 | 145 | if (!owner) continue 146 | let team = owner.team ? owner.team : "" 147 | 148 | grenades.smokes.push({ 149 | id: nadeID, 150 | time: parseFloat(nade.effecttime), 151 | team: team, 152 | position: { 153 | x: parseFloat(pos[0]), 154 | y: parseFloat(pos[1]), 155 | z: parseFloat(pos[2]) 156 | } 157 | }) 158 | } 159 | 160 | if (nade.type == "flashbang" && parseFloat(nade.lifetime) >= 1.4) { 161 | let pos = nade.position.split(", ") 162 | grenades.flashbangs.push({ 163 | id: nadeID, 164 | position: { 165 | x: parseFloat(pos[0]), 166 | y: parseFloat(pos[1]), 167 | z: parseFloat(pos[2]) 168 | } 169 | }) 170 | } 171 | 172 | else if (nade.type == "inferno") { 173 | if (nade.flames) { 174 | let flamesPos = [] 175 | let flamesNum = Object.values(nade.flames).length 176 | 177 | for (var i = 0; i < flamesNum; i++) { 178 | let pos = Object.values(nade.flames)[i].split(", ") 179 | flamesPos.push({ 180 | x: parseFloat(pos[0]), 181 | y: parseFloat(pos[1]), 182 | z: parseFloat(pos[2]) 183 | }) 184 | } 185 | 186 | grenades.infernos.push({ 187 | id: nadeID, 188 | flamesNum: flamesNum, 189 | flamesPosition: flamesPos 190 | }) 191 | } 192 | } 193 | 194 | else if (nade.type != "decoy" && nade.velocity != "0.000, 0.000, 0.000" && (nade.type != "smoke" || nade.effecttime == '0.000')) { 195 | let pos = nade.position.split(", ") 196 | let owner = game.allplayers[nade.owner] 197 | 198 | if (!owner) continue 199 | let team = owner.team ? owner.team : "" 200 | 201 | grenades.projectiles.push({ 202 | id: nade.type + nadeID, 203 | type: nade.type, 204 | team: team, 205 | position: { 206 | x: parseFloat(pos[0]), 207 | y: parseFloat(pos[1]), 208 | z: parseFloat(pos[2]) 209 | } 210 | }) 211 | } 212 | } 213 | 214 | // Emit an event for every type of grenade 215 | for (let type in grenades) { 216 | process.send({ 217 | type: type, 218 | data: grenades[type] 219 | }) 220 | } 221 | } 222 | 223 | if (game.round) { 224 | process.send({ 225 | type: "round", 226 | data: game.round.phase 227 | }) 228 | } 229 | 230 | if (game.phase_countdowns) { 231 | process.send({ 232 | type: "canbuy", 233 | data: !((['live', 'bomb', 'defuse', 'over'].includes(game.phase_countdowns.phase)) && parseFloat(game.phase_countdowns.phase_ends_in) < 95) 234 | }) 235 | } 236 | 237 | if (game.bomb) { 238 | let pos = game.bomb.position.split(", ") 239 | 240 | process.send({ 241 | type: "bomb", 242 | data: { 243 | state: game.bomb.state, 244 | player: game.bomb.player, 245 | position: { 246 | x: parseFloat(pos[0]), 247 | y: parseFloat(pos[1]), 248 | z: parseFloat(pos[2]) 249 | } 250 | } 251 | }) 252 | } 253 | }) 254 | } 255 | -------------------------------------------------------------------------------- /src/html/map.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Boltobserv 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 | 17 | 18 |
19 | 20 | 21 |
22 |
23 |
24 | 25 | 26 | 27 |
28 | 29 | 30 |
31 |
32 | 33 |
34 |
2
35 |
36 |
3
37 |
38 |
4
39 |
40 |
5
41 |
42 |
6
43 |
44 |
7
45 |
46 |
8
47 |
48 |
9
49 |
50 |
0
51 |
52 |
1
53 | 54 | 55 |
56 | ? 57 |
58 |
59 | 60 |
61 | 62 | Unsupported map 63 | 64 |
65 |
66 | 67 |
68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/html/status.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Boltobserv 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 |
23 | 24 |
25 |
26 |
27 | 28 | 29 | 30 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/html/waiting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Boltobserv - Waiting for CS 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 |
18 | 19 |
20 | 21 | 22 | Boltobserv 23 | 24 | 25 | 26 | 27 | 32 |
33 | 34 |
35 |
36 | Boltobserv 37 | Disconnected 38 |
Connecting to socket
39 |
40 | 41 |
42 | 43 |
44 | CS2 45 | Disconnected 46 |
Still waiting for Boltobserv
47 |
48 | 49 |
50 | 51 |
52 | Match server 53 | Disconnected 54 |
Waiting for CS to connect first
55 |
56 |
57 | 58 |
59 |
60 | 61 | 62 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /src/http.js: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const path = require("path") 3 | const fs = require("fs") 4 | 5 | const version = require("./package.json").version 6 | const config = require("./loadconfig") 7 | 8 | const host = "localhost" 9 | 10 | let app = express() 11 | 12 | app.use((req, res, next) => { 13 | res.header("Cache-Control", "no-cache") 14 | res.setHeader("X-Powered-By", `Boltobserv ${version} `) 15 | next() 16 | }) 17 | 18 | app.get("/favicon.ico", (req, res) => {res.sendFile(path.join(__dirname, "img", "favicon.ico"))}) 19 | 20 | for (let dir of ["css", "renderers", "img", "maps"]) { 21 | app.use(`/${dir}`, express.static(path.join(__dirname, dir))) 22 | } 23 | 24 | let activePage = "waiting" 25 | process.on("message", data => { 26 | activePage = data 27 | }) 28 | 29 | app.get("/", (req, res) => { 30 | res.sendFile(path.join(__dirname, "html", activePage + ".html")) 31 | }) 32 | 33 | function handleCheck(req, res) { 34 | res.header("Access-Control-Allow-Origin", "*") 35 | res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") 36 | 37 | res.json({ 38 | "type": "boltgolt/boltobserv", 39 | "version": version, 40 | "socket": config.browser.ports.socket, 41 | "activePage": activePage, 42 | "configPath": path.join(__dirname, "config") 43 | }) 44 | } 45 | 46 | app.options("/doorknock", handleCheck) 47 | app.get("/doorknock", handleCheck) 48 | 49 | app.listen(config.browser.ports.static) 50 | console.info(`Browser view enabled at http://${host}:${config.browser.ports.static}`) 51 | -------------------------------------------------------------------------------- /src/img/adv-defuse.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/adv-defuse.webp -------------------------------------------------------------------------------- /src/img/adv-plant.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/adv-plant.webp -------------------------------------------------------------------------------- /src/img/adv-solesurvivor.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/adv-solesurvivor.webp -------------------------------------------------------------------------------- /src/img/bomb-defused.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/bomb-defused.webp -------------------------------------------------------------------------------- /src/img/bomb-dropped.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/bomb-dropped.webp -------------------------------------------------------------------------------- /src/img/bomb-planted.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/bomb-planted.webp -------------------------------------------------------------------------------- /src/img/empty.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/empty.webp -------------------------------------------------------------------------------- /src/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/favicon.ico -------------------------------------------------------------------------------- /src/img/icon-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/icon-64x64.png -------------------------------------------------------------------------------- /src/img/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/img/projectile-hc-firebomb-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-firebomb-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-hc-firebomb-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-firebomb-T.webp -------------------------------------------------------------------------------- /src/img/projectile-hc-flashbang-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-flashbang-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-hc-flashbang-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-flashbang-T.webp -------------------------------------------------------------------------------- /src/img/projectile-hc-frag-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-frag-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-hc-frag-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-frag-T.webp -------------------------------------------------------------------------------- /src/img/projectile-hc-smoke-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-smoke-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-hc-smoke-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-hc-smoke-T.webp -------------------------------------------------------------------------------- /src/img/projectile-img-firebomb-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-firebomb-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-img-firebomb-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-firebomb-T.webp -------------------------------------------------------------------------------- /src/img/projectile-img-flashbang-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-flashbang-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-img-flashbang-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-flashbang-T.webp -------------------------------------------------------------------------------- /src/img/projectile-img-frag-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-frag-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-img-frag-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-frag-T.webp -------------------------------------------------------------------------------- /src/img/projectile-img-smoke-CT.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-smoke-CT.webp -------------------------------------------------------------------------------- /src/img/projectile-img-smoke-T.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/img/projectile-img-smoke-T.webp -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | // ================================================================================ 2 | // 3 | // PLEASE READ: 4 | // This project is under a GPL-3 license, you are REQUIRED to publicly publish any 5 | // changes or upgrades you make to the codebase, it strengthens the community. 6 | // Contact the maintainer if you have any questions regarding the license. 7 | // 8 | // ================================================================================ 9 | 10 | const path = require("path") 11 | const child_process = require("child_process") 12 | 13 | const config = require("./loadconfig") 14 | const window = require("./window") 15 | 16 | let hasMap = false 17 | let connTimeout = false 18 | var win = false 19 | 20 | let gsi = child_process.fork(`${__dirname}/gsi.js`) 21 | let http = child_process.fork(`${__dirname}/http.js`) 22 | let socket = child_process.fork(`${__dirname}/socket.js`) 23 | 24 | function setActivePage(page, win) { 25 | if (window.win !== false && !config.window.disable) { 26 | window.win.loadFile(`html/${page}.html`) 27 | } 28 | 29 | http.send(page) 30 | 31 | socket.send({ 32 | type: "pageUpdate" 33 | }) 34 | 35 | // Make sure no race condition occured 36 | setTimeout(() => { 37 | socket.send({ 38 | type: "pageUpdate" 39 | }) 40 | }, 200) 41 | } 42 | 43 | gsi.on("message", (message) => { 44 | socket.send(message) 45 | 46 | if (message.type == "connection") { 47 | if (message.data.status == "up" && connTimeout === false && config.game.connectionTimout >= 0) { 48 | console.info("CSGO has pinged server, connection established") 49 | } 50 | } 51 | else if (!hasMap) { 52 | if (message.type == "map") { 53 | setActivePage("map", win) 54 | hasMap = true 55 | 56 | console.info(`Map ${message.data} selected`) 57 | } 58 | } 59 | 60 | if (config.game.connectionTimout >= 0) { 61 | clearTimeout(connTimeout) 62 | connTimeout = setTimeout(() => { 63 | hasMap = false 64 | setActivePage("waiting", win) 65 | }, config.game.connectionTimout * 1000) 66 | } 67 | }) 68 | 69 | if (!config.debug.terminalOnly) { 70 | window.gsi = gsi 71 | window.http = http 72 | window.socket = socket 73 | window.build() 74 | } 75 | else { 76 | console.info("Not opening window, terminal only mode is enabled") 77 | } 78 | 79 | function cleanup() { 80 | gsi.kill() 81 | http.kill() 82 | socket.kill() 83 | window.app.quit() 84 | } 85 | 86 | for (let signal of ["exit", "SIGINT", "SIGUSR1", "SIGUSR2"]) { 87 | process.on(signal, cleanup) 88 | } 89 | -------------------------------------------------------------------------------- /src/keybinds.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const JSON5 = require("json5") 3 | const path = require("path") 4 | const electron = require("electron") 5 | 6 | let win = false 7 | let socket = false 8 | let effects = {} 9 | 10 | function executeAction(subject, command) { 11 | switch (command) { 12 | case "toggle": 13 | if (typeof effects[subject] == "undefined") effects[subject] = false 14 | effects[subject] = !effects[subject] 15 | break 16 | 17 | case "on": 18 | case "true": 19 | effects[subject] = true 20 | break 21 | 22 | case "off": 23 | case "false": 24 | effects[subject] = false 25 | break 26 | 27 | default: 28 | console.warn(`WARNING: Unkown keybind command in keybind "${subject}:${command}"`) 29 | return 30 | } 31 | 32 | socket.send({ 33 | type: "effect", 34 | data: { 35 | key: subject, 36 | value: effects[subject] 37 | } 38 | }) 39 | 40 | switch (subject) { 41 | case "window.fullscreen": 42 | win.setFullScreen(effects[subject]) 43 | break 44 | case "window.mousePassthrough": 45 | win.setIgnoreMouseEvents(effects[subject]) 46 | break 47 | } 48 | } 49 | 50 | 51 | function parseBind(binds) { 52 | function nextBind(binds) { 53 | if (binds.length > 0) parseBind(binds) 54 | } 55 | 56 | let bind = binds 57 | 58 | if (typeof binds == "object") { 59 | bind = binds[0] 60 | binds.shift() 61 | } 62 | 63 | let actionRegex = /([\w\.]*?)\s?->\s?(\w*)/ 64 | let functionRegex = /([\w\.]*?)\((.*?)\)/ 65 | 66 | if (bind.match(actionRegex)) { 67 | let parsed = actionRegex.exec(bind) 68 | executeAction(parsed[1], parsed[2]) 69 | 70 | if (binds.length > 0) parseBind(binds) 71 | } 72 | else if (bind.match(functionRegex)) { 73 | let parsed = functionRegex.exec(bind) 74 | let argument = parsed[2] 75 | 76 | switch (parsed[1]) { 77 | case "functions.sleep": 78 | setTimeout(() => { 79 | if (binds.length > 0) parseBind(binds) 80 | }, argument * 1000) 81 | break 82 | 83 | case "functions.reload": 84 | // Reload both electron window and browsers 85 | win.reload() 86 | socket.send({ 87 | type: "pageUpdate" 88 | }) 89 | 90 | // Wait a second for everything to load before executing the next action 91 | setTimeout(() => { 92 | if (binds.length > 0) parseBind(binds) 93 | }, 100) 94 | break 95 | 96 | case "window.width": 97 | win.setSize(Math.min(0, argument), win.getSize()[1]) 98 | return nextBind(binds) 99 | case "window.height": 100 | win.setSize(win.getSize()[0], Math.min(0, argument)) 101 | return nextBind(binds) 102 | 103 | case "window.left": 104 | win.setBounds({x: parseInt(argument)}) 105 | return nextBind(binds) 106 | case "window.top": 107 | win.setBounds({y: parseInt(argument)}) 108 | return nextBind(binds) 109 | 110 | default: 111 | console.warn(`WARNING: Unkown keybind function in keybind "${bind}"`) 112 | return 113 | } 114 | } 115 | } 116 | 117 | module.exports = (_socket, _win) => { 118 | win = _win 119 | socket = _socket 120 | 121 | let rawArr = JSON5.parse(fs.readFileSync(path.join(__dirname, "config", "keybinds.json5"), "utf8")) 122 | 123 | if (fs.existsSync(path.join(__dirname, "config", "keybinds.override.json5"))) { 124 | let override = JSON5.parse(fs.readFileSync(path.join(__dirname, "config", "keybinds.override.json5"), "utf8")) 125 | Object.assign(rawArr, override) 126 | } 127 | 128 | for (let rawBind in rawArr) { 129 | if (electron.globalShortcut.isRegistered(rawBind)) { 130 | console.warn(`WARNING: Keybind "${rawBind}" is already used, registering anyway`) 131 | } 132 | 133 | try { 134 | let registered = electron.globalShortcut.register(rawBind, () => { 135 | parseBind(rawArr[rawBind]) 136 | }) 137 | 138 | if (!registered) { 139 | console.warn(`WARNING: Keybind "${rawBind}" could not be registered`) 140 | } 141 | } catch (e) { 142 | console.warn(`WARNING: Error while registering Keybind "${rawBind}"`) 143 | } 144 | } 145 | 146 | let count = Object.keys(rawArr).length 147 | if (count > 0) console.info(`Registered ${count} ${count == 1 ? "keybind" : "keybinds"} with the OS`) 148 | } 149 | -------------------------------------------------------------------------------- /src/loadconfig.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const JSON5 = require("json5") 3 | const path = require("path") 4 | const util = require("util") 5 | const pack = require("./package.json") 6 | 7 | /** 8 | * Copy deep object values into target object 9 | * @param {Object} core Target object 10 | * @param {Object} override Source object 11 | */ 12 | function deepCopyObject(core, override) { 13 | // For each core property 14 | for (let prop in core) { 15 | // Check if the prop is an deeper object, run this function recursively on it if it is 16 | if (typeof core[prop] == "object") { 17 | deepCopyObject(core[prop], override[prop]) 18 | continue 19 | } 20 | 21 | // Otherwise, if the prop is set in both the core and overwrite, set it to the overwrite value 22 | if (typeof override[prop] != 'undefined') { 23 | core[prop] = override[prop] 24 | } 25 | } 26 | } 27 | 28 | // Load the default config 29 | let loadedConfig = JSON5.parse(fs.readFileSync(path.join(__dirname, "config", "config.json5"), "utf8")) 30 | 31 | if (pack.version != loadedConfig._version) { 32 | console.warn(`WARNING config.json version missmatch (radar v${pack.version}, config v${loadedConfig._version})`) 33 | } 34 | 35 | // If there is an overwrite config file 36 | if (fs.existsSync(path.join(__dirname, "config", "config.override.json5"))) { 37 | // Read the overwrite file 38 | let override = JSON5.parse(fs.readFileSync(path.join(__dirname, "config", "config.override.json5"), "utf8")) 39 | // Set any settings in the core config to the override ones 40 | deepCopyObject(loadedConfig, override) 41 | } 42 | 43 | // Show config in console if enabled 44 | if (loadedConfig.debug.printConfig) { 45 | console.info("Loaded config:", util.inspect(loadedConfig, { 46 | showHidden: true, 47 | depth: Infinity, 48 | colors: true, 49 | compact: false 50 | })) 51 | } 52 | 53 | // Return the merged configs 54 | module.exports = loadedConfig 55 | -------------------------------------------------------------------------------- /src/maps/de_ancient/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Lexogrine 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/maps/de_ancient/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 2, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 4.26, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 2590, 15 | "y": 2520 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 7, 24 | "y": 12 25 | }, 26 | 27 | // The minimum and maximum height a player can be on the map 28 | "zRange": { 29 | "min": -95, 30 | "max": 220 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/maps/de_ancient/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_ancient/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_ancient/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_ancient/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_ancient/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_ancient/radar.png -------------------------------------------------------------------------------- /src/maps/de_anubis/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Lexogrine 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/maps/de_anubis/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 1, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 5.25, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 2830, 15 | "y": 2030 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 76, 24 | "y": 12 25 | }, 26 | 27 | // The minimum and maximum height a player can be on the map 28 | "zRange": { 29 | "min": -85, 30 | "max": 180 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/maps/de_anubis/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_anubis/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_anubis/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_anubis/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_anubis/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_anubis/radar.png -------------------------------------------------------------------------------- /src/maps/de_cache/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 2, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 5.54, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 2020, 15 | "y": 2390 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 72, 24 | "y": 69 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/maps/de_cache/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_cache/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_cache/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_cache/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_cache/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_cache/radar.png -------------------------------------------------------------------------------- /src/maps/de_dust2/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 3, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 4.40, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 2470, 15 | "y": 1255 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 76.6, 24 | "y": 17 25 | }, 26 | 27 | // The minimum and maximum height a player can be on the map 28 | "zRange": { 29 | "min": -50, 30 | "max": 185 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/maps/de_dust2/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_dust2/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_dust2/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_dust2/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_dust2/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_dust2/radar.png -------------------------------------------------------------------------------- /src/maps/de_inferno/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 3, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 4.91, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 2090, 15 | "y": 1150 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 16, 24 | "y": 56 25 | }, 26 | 27 | "zRange": { 28 | "min": 73, 29 | "max": 310 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/maps/de_inferno/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_inferno/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_inferno/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_inferno/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_inferno/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_inferno/radar.png -------------------------------------------------------------------------------- /src/maps/de_mirage/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 3, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 5.02, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 3240, 15 | "y": 3410 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 10, 24 | "y": 39.5 25 | }, 26 | 27 | // The minimum and maximum height a player can be on the map 28 | "zRange": { 29 | "min": -300, 30 | "max": 20 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/maps/de_mirage/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_mirage/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_mirage/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_mirage/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_mirage/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_mirage/radar.png -------------------------------------------------------------------------------- /src/maps/de_nuke/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 2, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 6.98, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 3290, 15 | "y": 5990 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [ 20 | { 21 | // The top and bottom y height for this split 22 | "bounds": { 23 | "top": -482, 24 | "bottom": -2500 25 | }, 26 | // The radar offset in percentages to apply when player is in the split 27 | "offset": { 28 | "x": 0, 29 | "y": -46 30 | }, 31 | 32 | // The minimum and maximum height a player can be within this split 33 | "zRange": { 34 | "min": -770, 35 | "max": -480 36 | } 37 | } 38 | ], 39 | 40 | // Position in which advisories should be placed, in percentages from the bottom left 41 | "advisoryPosition": { 42 | "x": 20, 43 | "y": 30 44 | }, 45 | 46 | // The minimum and maximum height a player can be on the map 47 | "zRange": { 48 | "min": -480, 49 | "max": -20 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/maps/de_nuke/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_nuke/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_nuke/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_nuke/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_nuke/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_nuke/radar.png -------------------------------------------------------------------------------- /src/maps/de_overpass/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 3, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 5.18, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 4830, 15 | "y": 3540 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 72, 24 | "y": 84 25 | }, 26 | 27 | // The minimum and maximum height a player can be on the map 28 | "zRange": { 29 | "min": 10, 30 | "max": 500 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/maps/de_overpass/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_overpass/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_overpass/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_overpass/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_overpass/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_overpass/radar.png -------------------------------------------------------------------------------- /src/maps/de_train/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 3, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 4.74, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 2730, 15 | "y": 2360 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [], 20 | 21 | // Position in which advisories should be placed, in percentages from the bottom left 22 | "advisoryPosition": { 23 | "x": 10, 24 | "y": 56 25 | }, 26 | 27 | // The minimum and maximum height a player can be on the map 28 | "zRange": { 29 | "min": -320, 30 | "max": 15 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/maps/de_train/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_train/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_train/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_train/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_train/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_train/radar.png -------------------------------------------------------------------------------- /src/maps/de_vertigo/meta.json5: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | // The version of this meta file 4 | "radar": 3, 5 | // The object format version this file is using 6 | "format": 3 7 | }, 8 | 9 | // The amount of in-game units per pixel of the 1024px radar image 10 | "resolution": 4.96, 11 | 12 | // How many in-game units is the origin (0,0) of the map from the bottom left point of the radar 13 | "offset": { 14 | "x": 3890, 15 | "y": 3800 16 | }, 17 | 18 | // Contains any special map splits 19 | "splits": [ 20 | { 21 | // The top and bottom y height for this split 22 | "bounds": { 23 | "top": 11680, 24 | "bottom": 0 25 | }, 26 | // The radar offset in percentages to apply when player is in the split 27 | "offset": { 28 | "x": 0.2, 29 | "y": -42.6 30 | }, 31 | 32 | // The minimum and maximum height a player can be within this split 33 | "zRange": { 34 | "min": 11550, 35 | "max": 11680 36 | } 37 | } 38 | ], 39 | 40 | // Position in which advisories should be placed, in percentages from the bottom left 41 | "advisoryPosition": { 42 | "x": 68, 43 | "y": 84 44 | }, 45 | 46 | // The minimum and maximum height a player can be on the map 47 | "zRange": { 48 | "min": 11680, 49 | "max": 11920 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/maps/de_vertigo/overlay_buyzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_vertigo/overlay_buyzones.png -------------------------------------------------------------------------------- /src/maps/de_vertigo/overlay_logos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_vertigo/overlay_logos.png -------------------------------------------------------------------------------- /src/maps/de_vertigo/radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boltgolt/boltobserv/a6c31f56d2bf66951c0135d761b2c514978c3f02/src/maps/de_vertigo/radar.png -------------------------------------------------------------------------------- /src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "boltobserv", 3 | "version": "1.5.2", 4 | "description": "External radar for CSGO observers", 5 | "main": "index.js", 6 | "homepage": "https://github.com/boltgolt/boltobserv/", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/boltgolt/boltobserv.git" 10 | }, 11 | "scripts": { 12 | "start": "electron ." 13 | }, 14 | "author": "Boltgolt (https://boltgolt.nl)", 15 | "license": "GPL-3.0", 16 | "devDependencies": { 17 | "electron": "^22.3.25", 18 | "electron-packager": "^15.5.2" 19 | }, 20 | "dependencies": { 21 | "express": "^4.18.2", 22 | "json5": "^2.2.3", 23 | "steam-game-path": "^2.2.0", 24 | "ws": "^7.5.10" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/renderers/_global.js: -------------------------------------------------------------------------------- 1 | // Shared render object 2 | // 3 | // Provides shared variables and functions for all renderers. 4 | 5 | global = { 6 | // Config loaded from disk 7 | config: {}, 8 | // Effects triggered by key-binds 9 | effects: {}, 10 | mapData: {}, 11 | currentMap: "none", 12 | // The last known game phase 13 | gamePhase: "freezetime", 14 | 15 | playerPos: [], 16 | playerBuffers: [], 17 | playerSplits: [], 18 | playerDots: [], 19 | playerLabels: [], 20 | playerAmmos: [], 21 | playerHealths: [], 22 | 23 | projectilePos: {}, 24 | projectileBuffer: {}, 25 | 26 | /** 27 | * Convert in-game position units to radar percentages 28 | * @param {Array} positionObj In-game position object with X and Y, and an optional Z 29 | * @param {String} axis The axis to calculate position for 30 | * @param {Number} playerNum An optional player number to wipe location buffer on split switch 31 | * @return {Number} Relative radar percentage 32 | */ 33 | positionToPerc: (positionObj, axis, playerNum) => { 34 | // The position of the player in game, with the bottom left corner of the radar as origin (0,0) 35 | let gamePosition = positionObj[axis] + global.mapData.offset[axis] 36 | // The position of the player relative to an 1024x1024 pixel grid 37 | let pixelPosition = gamePosition / global.mapData.resolution 38 | // The position of the player as an percentage for any size 39 | let precPosition = pixelPosition / 1024 * 100 40 | 41 | // Set the split to the default map 42 | let currentSplit = -1 43 | // Check if there are splits on the map and if we have a Z position 44 | if (global.mapData.splits.length > 0 && typeof positionObj.z == "number") { 45 | // Go through each split 46 | for (let i in global.mapData.splits) { 47 | let split = global.mapData.splits[i] 48 | 49 | // If the position is within the split 50 | if (positionObj.z > split.bounds.bottom && positionObj.z < split.bounds.top) { 51 | // Apply the split offset and save this split 52 | precPosition += split.offset[axis] 53 | currentSplit = parseInt(i) 54 | 55 | // Stop checking other splits as there can only be one active split 56 | break 57 | } 58 | } 59 | } 60 | 61 | // If we're calculating a player position 62 | if (typeof playerNum == "number") { 63 | // Wipe the location buffer if we've changed split 64 | // Prevents the player from flying across the radar on split switch 65 | if (global.playerSplits[playerNum] != currentSplit) { 66 | global.playerBuffers[playerNum] = [] 67 | } 68 | 69 | // Save this split as the last split id seen 70 | global.playerSplits[playerNum] = currentSplit 71 | global.playerPos[playerNum].split = currentSplit 72 | } 73 | 74 | // Return the position relative to the radar image 75 | return precPosition 76 | } 77 | } 78 | 79 | // Fill position and buffer arrays 80 | for (var i = 0; i < 10; i++) { 81 | global.playerPos.push({ 82 | x: null, 83 | y: null, 84 | alive: false 85 | }) 86 | 87 | global.playerSplits.push(-1) 88 | global.playerBuffers.push([]) 89 | global.playerDots.push(document.getElementById("dot" + i)) 90 | global.playerLabels.push(document.getElementById("label" + i)) 91 | global.playerAmmos.push({}) 92 | global.playerHealths.push(0) 93 | } 94 | -------------------------------------------------------------------------------- /src/renderers/_init.js: -------------------------------------------------------------------------------- 1 | // Render initializer 2 | // 3 | // Starts all other renderers. 4 | 5 | // If a welcome packet has been received 6 | let hasConfig = false 7 | // If the map is ready, called by _map.js 8 | let hasMap = false 9 | // If importScripts has been run 10 | let hasInited = false 11 | 12 | /** 13 | * Add script elements for scripts to import, can also be called from _map.js 14 | */ 15 | function importScripts() { 16 | // Only do this once, and only if we already have both the map and the config 17 | if (!hasConfig || !hasMap || hasInited) return 18 | hasInited = true 19 | 20 | // Go through all scripts and append them to the body 21 | for (let script of hasConfig) { 22 | let tag = document.createElement("script") 23 | tag.setAttribute("src", "/renderers/" + script) 24 | document.body.appendChild(tag) 25 | } 26 | } 27 | 28 | socket.element.addEventListener("welcome", event => { 29 | if (hasConfig) return 30 | hasConfig = event.data.scripts 31 | global.config = event.data.config 32 | 33 | importScripts() 34 | 35 | // Loop through each player dot to apply the scaling config option 36 | for (let playerElem of document.getElementsByClassName("player")) { 37 | playerElem.style.transform = `scale(${event.data.config.radar.playerDotScale}) translate(-50%, 50%)` 38 | } 39 | 40 | for (let labelElement of document.getElementsByClassName("label")) { 41 | labelElement.style.transform = `scale(${global.config.radar.playerDotScale}) translate(-50%, 50%)` 42 | } 43 | 44 | if (navigator.userAgent.toLowerCase().indexOf(" electron/") <= -1) { 45 | // Remove the elements meant to drag the window in electron 46 | document.getElementById("dragarea").style.display = "none" 47 | // Set cursor to default, as we don't have a drag area 48 | document.body.style.cursor = "default" 49 | 50 | if (!global.config.browser.transparent) { 51 | document.body.style.background = "#000" 52 | } 53 | } 54 | 55 | // Insert stylesheet into head to apply some CSS setings from config 56 | document.documentElement.style.setProperty("--config-tombstone-opacity", event.data.config.radar.tombstoneOpacity) 57 | document.documentElement.style.setProperty("--config-bomb-dot-scale", event.data.config.radar.bombDotScale) 58 | }) 59 | 60 | if (socket.native && socket.native.readyNumber === 1) { 61 | socket.native.send("requestWelcome") 62 | } 63 | 64 | window.addEventListener("DOMContentLoaded", () => { 65 | // If not electron (browser) 66 | if (navigator.userAgent.toLowerCase().indexOf(" electron/") <= -1) { 67 | // Reload the site when a new HTML page has been rendered 68 | socket.element.addEventListener("pageUpdate", event => { 69 | location.reload() 70 | }) 71 | } 72 | }) 73 | -------------------------------------------------------------------------------- /src/renderers/_map.js: -------------------------------------------------------------------------------- 1 | // Initial map rendering 2 | // 3 | // Responsible for changing radar background on map change, loading map 4 | // metadata and applying some general config values. 5 | 6 | // Catch map data send by the game 7 | socket.element.addEventListener("map", event => { 8 | /** 9 | * Show a map error and quit 10 | * @param {String} text What error message to show 11 | */ 12 | function throwMapError(text) { 13 | document.getElementById("unknownMap").style.display = "flex" 14 | document.getElementById("unknownMap").children[0].innerHTML = text 15 | } 16 | 17 | // If map is unchanged we do not need to do anything 18 | if (global.currentMap == event.data) return 19 | 20 | let mapName = event.data 21 | if (mapName.indexOf("/") != -1) { 22 | mapName = mapName.split("/")[mapName.split("/").length - 1] 23 | } 24 | 25 | fetch(window.location.origin + `/maps/${mapName}/meta.json5`) 26 | .then(resp => resp.text()) 27 | .then(data => { 28 | data = data.replace(/^\s*?\/\/.*?$/gm, "") 29 | global.mapData = JSON.parse(data) 30 | 31 | // Check if the map uses the expected meta format 32 | if (global.mapData.version.format != 3) { 33 | return throwMapError(`Outdated map file for ${mapName}`) 34 | } 35 | 36 | // Make sure that the "unknown map" message is turned off for valid maps 37 | document.getElementById("unknownMap").style.display = "none" 38 | 39 | // Show the radar backdrop 40 | document.getElementById("radarBackground").src = `/maps/${mapName}/radar.png` 41 | 42 | if (global.config.radar.showLogos) { 43 | document.getElementById("radarLogos").src = `/maps/${mapName}/overlay_logos.png` 44 | } 45 | if (global.config.radar.showBuyzones != "never") { 46 | document.getElementById("radarBuyZones").src = `/maps/${mapName}/overlay_buyzones.png` 47 | } 48 | 49 | // Set the map as the current map and in the window title 50 | global.currentMap = mapName 51 | document.title = "Boltobserv - " + mapName 52 | 53 | // Hide advisories if you've been disabled in the config 54 | if (global.config.radar.hideAdvisories) { 55 | document.getElementById("advisory").style.display = "none" 56 | } 57 | else { 58 | // Otherwise, read the advisory position from config and apply it 59 | document.getElementById("advisory").style.left = global.mapData.advisoryPosition.x + "%" 60 | document.getElementById("advisory").style.bottom = global.mapData.advisoryPosition.y + "%" 61 | document.getElementById("advisory").style.display = "block" 62 | } 63 | 64 | // Allow init to load other scripts 65 | hasMap = true 66 | importScripts() 67 | }) 68 | .catch(() => { 69 | return throwMapError(`Error reading the ${mapName} map file :(`) 70 | }) 71 | }) 72 | 73 | if (global.config.radar.showBuyzones == "buytime") { 74 | socket.element.addEventListener("canbuy", event => { 75 | document.getElementById("radarBuyZones").style.opacity = event.data ? 1 : 0 76 | }) 77 | } 78 | -------------------------------------------------------------------------------- /src/renderers/_socket.js: -------------------------------------------------------------------------------- 1 | // Websocket implementation 2 | // 3 | // Starts a connection to the server and emits events for other scripts to 4 | // listen for. 5 | 6 | let socket = { 7 | native: null, 8 | connected: false, 9 | connect: () => { 10 | // Check if we're in electron 11 | if (navigator.userAgent.toLowerCase().indexOf(" electron/") > -1) { 12 | // If we are, we can just import the config directly 13 | global.config = require("../loadconfig") 14 | 15 | // Start the websocket and attach the event listeners 16 | let websocket = new WebSocket(`ws://127.0.0.1:${global.config.browser.ports.socket}`) 17 | attachEvents(websocket) 18 | } 19 | else { 20 | // We need to fetch the doorknock to get the socket port if we're in a browser 21 | fetch(window.location.origin + "/doorknock") 22 | .then(resp => resp.json()) 23 | .then(data => { 24 | // Start a socket to the port we got from the doorknock 25 | let websocket = new WebSocket(`ws://${window.location.hostname}:${data.socket}`) 26 | attachEvents(websocket) 27 | 28 | // If we're on the waiting screen with a version element, insert the version we got 29 | if (document.getElementById("version") && document.getElementById("version").innerHTML == "") { 30 | document.getElementById("version").innerHTML = data.version 31 | } 32 | 33 | // Add a nice line in the console <3 34 | console.info(`%cBoltobserv %cv${data.version}%c, at your service ❤ `, "font-weight: bold", "font-weight: bold; color:red", "font-weight: bold", "https://github.com/boltgolt/boltobserv/") 35 | }) 36 | .catch((err) => { 37 | console.error(err) 38 | 39 | // If something went wrong in the doorknock, try it again in 25ms 40 | socket.connected = false 41 | setTimeout(() => { 42 | socket.connect() 43 | }, 25) 44 | }) 45 | } 46 | 47 | window.addEventListener("DOMContentLoaded", () => { 48 | let connectbox = document.getElementById("connectbolt") 49 | if (connectbox) { 50 | connectbox.classList.add("connected") 51 | connectbox.querySelector("span").innerHTML = "Connected" 52 | connectbox.querySelector("div").innerHTML = "Listening and ready" 53 | document.getElementById("connectgame").querySelector("div").innerHTML = "Not sending GSI packets" 54 | } 55 | }) 56 | 57 | function attachEvents(websocket) { 58 | // Called when the socket is started 59 | socket.native = websocket; 60 | websocket.onopen = () => { 61 | socket.connected = true 62 | websocket.send("requestWelcome") 63 | } 64 | 65 | // Called when the server has pushed a message to us 66 | websocket.onmessage = event => { 67 | // Decode the message 68 | let incom = JSON.parse(event.data) 69 | // Create a new event with the given event type 70 | let outev = new Event(incom.type) 71 | // Add the data we got to the new event 72 | outev.data = incom.data 73 | // Send the event to other scripts 74 | socket.element.dispatchEvent(outev) 75 | } 76 | 77 | // Called when the socket is closed, try opening the socket again in 25ms 78 | websocket.onclose = event => { 79 | socket.connected = false 80 | setTimeout(() => { 81 | socket.connect() 82 | }, 25) 83 | } 84 | 85 | // Called when a handler errors out, close the socket and start clean 86 | websocket.onerror = err => { 87 | console.error(err) 88 | socket.close() 89 | } 90 | } 91 | }, 92 | 93 | // Dummy element, events are fired from here 94 | element: document.createElement("div") 95 | } 96 | 97 | // Start the socket 98 | socket.connect() 99 | 100 | // On a round indicator packet 101 | socket.element.addEventListener("round", event => { 102 | let phase = event.data 103 | 104 | // Abort if there's no change in phase 105 | if (global.gamePhase == phase) return 106 | 107 | // If the round has ended 108 | if ((phase == "freezetime" && global.gamePhase == "over") || (phase == "live" && global.gamePhase == "over")) { 109 | // Emit a custom event 110 | let roundend = new Event("roundend") 111 | socket.element.dispatchEvent(roundend) 112 | } 113 | 114 | // Set the new phase 115 | global.gamePhase = phase 116 | }) 117 | 118 | socket.element.addEventListener("effect", event => { 119 | global.effects[event.data.key] = event.data.value 120 | }) 121 | -------------------------------------------------------------------------------- /src/renderers/advisory.js: -------------------------------------------------------------------------------- 1 | // Advisories 2 | // 3 | // Determines if an advisory can be shown and prioritizes the most important one. 4 | 5 | let idToNum = {} 6 | let advisories = { 7 | planting: -1, 8 | defuse: -1, 9 | solesurvivor: -1 10 | } 11 | 12 | function trim(str) { 13 | let string = str + "" 14 | return string.substring(0, string.length - 2) 15 | } 16 | 17 | function updateAdvisory() { 18 | for (let name in advisories) { 19 | if (advisories[name] != -1) { 20 | document.getElementById("advisory").className = name 21 | document.getElementById("advisory").children[0].innerHTML = idToNum[advisories[name]] + 1 22 | if (document.getElementById("advisory").children[0].innerHTML == 10) { 23 | document.getElementById("advisory").children[0].innerHTML = 0 24 | } 25 | return 26 | } 27 | } 28 | 29 | document.getElementById("advisory").className = "" 30 | } 31 | 32 | socket.element.addEventListener("players", event => { 33 | let data = event.data 34 | let ctsAlive = [] 35 | let tsAlive = [] 36 | 37 | for (let player of data.players) { 38 | if (player.health > 0) { 39 | if (player.team == "CT") { 40 | ctsAlive.push(player.id) 41 | } 42 | else { 43 | tsAlive.push(player.id) 44 | } 45 | } 46 | 47 | if (idToNum[trim(player.id)] != player.num) { 48 | idToNum[trim(player.id)] = player.num 49 | } 50 | } 51 | 52 | if (ctsAlive.length == 1) { 53 | advisories.solesurvivor = trim(ctsAlive[0]) 54 | } 55 | else if (tsAlive.length == 1) { 56 | advisories.solesurvivor = trim(tsAlive[0]) 57 | } 58 | else { 59 | advisories.solesurvivor = -1 60 | } 61 | 62 | updateAdvisory() 63 | }) 64 | 65 | socket.element.addEventListener("bomb", event => { 66 | let data = event.data 67 | 68 | if (idToNum[trim(data.player)]) { 69 | if (data.state == "planting") { 70 | advisories.planting = trim(data.player) 71 | } 72 | else { 73 | advisories.planting = -1 74 | } 75 | 76 | if (data.state == "defusing") { 77 | advisories.defuse = trim(data.player) 78 | } 79 | else { 80 | advisories.defuse = -1 81 | } 82 | } 83 | else { 84 | advisories.planting = -1 85 | advisories.defuse = -1 86 | } 87 | 88 | updateAdvisory() 89 | }) 90 | -------------------------------------------------------------------------------- /src/renderers/bomb.js: -------------------------------------------------------------------------------- 1 | // Bomb rendering 2 | // 3 | // Shows dropped and planted bomb. 4 | 5 | let bombElement = document.getElementById("bomb") 6 | let bombStyle = bombElement.style 7 | 8 | socket.element.addEventListener("bomb", event => { 9 | let bomb = event.data 10 | 11 | if (bomb.state == "carried" || bomb.state == "exploded") { 12 | bombStyle.display = "none" 13 | } 14 | else { 15 | bombStyle.display = "block" 16 | bombStyle.left = global.positionToPerc(bomb.position, "x") + "%" 17 | bombStyle.bottom = global.positionToPerc(bomb.position, "y") + "%" 18 | } 19 | 20 | if (bomb.state == "planted" || bomb.state == "defusing") { 21 | bombElement.className = "planted" 22 | } 23 | else if (bomb.state == "defused") { 24 | bombElement.className = "defused" 25 | } 26 | else { 27 | bombElement.className = "" 28 | } 29 | }) 30 | -------------------------------------------------------------------------------- /src/renderers/loopFast.js: -------------------------------------------------------------------------------- 1 | // Main loop 2 | // 3 | // Sets player position on screen at +/- 60fps 4 | 5 | // Function to be executed before every frame paint 6 | function step() { 7 | // Go though every player location buffer 8 | for (let num in global.playerBuffers) { 9 | // Scale that can be changed by the vertical indicator 10 | let scale = global.config.radar.playerDotScale 11 | 12 | // If a new player position is available 13 | if (global.playerPos[num].x != null) { 14 | // We want to check if the angle value has looped around, so we need a previous value 15 | if (global.playerBuffers[num][0]) { 16 | // If the angle used to be small, but is large now 17 | if (global.playerPos[num].a > 270 && global.playerBuffers[num][0].a < 90) { 18 | // Move the old value to the other side of the 360 degree circle 19 | global.playerBuffers[num].forEach(buffer => {buffer.a += 360}) 20 | } 21 | 22 | // If the angle used to be large, but is low now 23 | if (global.playerPos[num].a < 90 && global.playerBuffers[num][0].a > 270) { 24 | // Move the old value to the other side of the 360 degree circle 25 | global.playerBuffers[num].forEach(buffer => {buffer.a -= 360}) 26 | } 27 | } 28 | 29 | // Add it to the start of the buffer 30 | global.playerBuffers[num].unshift({ 31 | x: global.playerPos[num].x, 32 | y: global.playerPos[num].y, 33 | a: global.playerPos[num].a 34 | }) 35 | 36 | // Limit the size of the buffer to the count specified in the config 37 | global.playerBuffers[num] = global.playerBuffers[num].slice(0, global.config.radar.playerSmoothing) 38 | 39 | // If the map and config support vertical indicator 40 | if (global.mapData.zRange && global.config.vertIndicator && global.config.vertIndicator.type != "none") { 41 | // Get the z range from the config 42 | let zRange = global.mapData.zRange 43 | 44 | // If the player is in a split, get that z range 45 | if (typeof global.playerPos[num].split == "number") { 46 | if (global.playerPos[num].split >= 0) { 47 | zRange = global.mapData.splits[global.playerPos[num].split].zRange 48 | } 49 | } 50 | 51 | // Calculate player z-height in the given range on a scale of 0 to 1 52 | let perc = Math.abs(global.playerPos[num].z - zRange.min) / Math.abs(zRange.max - zRange.min) 53 | if (global.playerPos[num].z < zRange.min) perc = 0 54 | perc = Math.min(1, Math.max(0, perc)) 55 | 56 | // If the color indicator is enabled 57 | if (global.config.vertIndicator.type == "color") { 58 | // Get all colors and make them RGB values 59 | let bottomColor = global.config.vertIndicator.colorRange[0].join(",") 60 | let mediumColor = global.config.vertIndicator.colorRange[1].join(",") 61 | let topColor = global.config.vertIndicator.colorRange[2].join(",") 62 | 63 | // By default we show the bottom color 64 | let color = bottomColor 65 | 66 | // If we're over half of the range we show the top color 67 | if (perc > 0.5) { 68 | color = topColor 69 | perc = (perc - 0.5) 70 | } 71 | else { 72 | perc = 0.5 - perc 73 | } 74 | 75 | // Show the chosen color as a background color 76 | document.getElementById("height" + num).style.background = `rgb(${mediumColor})` 77 | // Overlay the middle color with a transparency to blend the colors 78 | document.getElementById("height" + num).style.boxShadow = `inset 0 0 0 1.5vmin rgba(${color},${perc * 2})` 79 | } 80 | 81 | // If the scale indicator is enabled 82 | else if (global.config.vertIndicator.type == "scale") { 83 | // Scale the dot by height multiplied by the configured delta 84 | scale *= ((perc - 0.5) / 2 + 1) * global.config.vertIndicator.scaleDelta 85 | global.playerLabels[num].style.transform = `scale(${scale}) translate(-50%, 50%)` 86 | } 87 | 88 | if (global.config.radar.highestPlayerOnTop) { 89 | global.playerDots[num].style.zIndex = Math.round(global.playerPos[num].z + 2500) 90 | global.playerLabels[num].style.zIndex = Math.round(global.playerPos[num].z + 2500) 91 | } 92 | } 93 | } 94 | 95 | // Take the average of the X, Y and rotation buffers 96 | let bufferPercX = (global.playerBuffers[num].reduce((prev, curr) => prev + curr.x, 0) / (global.playerBuffers[num].length)) 97 | let bufferPercY = (global.playerBuffers[num].reduce((prev, curr) => prev + curr.y, 0) / (global.playerBuffers[num].length)) 98 | let bufferAngle = (global.playerBuffers[num].reduce((prev, curr) => prev + curr.a, 0) / (global.playerBuffers[num].length)) 99 | 100 | // Apply the calculated X and Y to the player dot 101 | global.playerDots[num].style.left = bufferPercX + "%" 102 | global.playerDots[num].style.bottom = bufferPercY + "%" 103 | global.playerLabels[num].style.left = bufferPercX + "%" 104 | global.playerLabels[num].style.bottom = bufferPercY + "%" 105 | 106 | // Apply the transformations to the dots 107 | if (global.playerPos[num].alive) { 108 | global.playerDots[num].style.transform = `rotate(${bufferAngle - 45}deg) scale(${scale}) translate(-50%, 50%)` 109 | } 110 | else { 111 | global.playerDots[num].style.transform = `rotate(0deg) scale(${global.config.radar.playerDotScale}) translate(-50%, 50%)` 112 | } 113 | } 114 | 115 | // Go through each active projectile 116 | for (let id in global.projectilePos) { 117 | // Add the newest location to the start of the buffer 118 | global.projectileBuffer[id].unshift(global.projectilePos[id]) 119 | 120 | // Limit the size of the buffer to the count specified in the config 121 | global.projectileBuffer[id] = global.projectileBuffer[id].slice(0, global.config.radar.projectileSmoothing) 122 | 123 | // Calculate the avarage position over the active buffer 124 | let bufferPercX = (global.projectileBuffer[id].reduce((prev, curr) => prev + curr.x, 0) / (global.projectileBuffer[id].length)) 125 | let bufferPercY = (global.projectileBuffer[id].reduce((prev, curr) => prev + curr.y, 0) / (global.projectileBuffer[id].length)) 126 | 127 | // Set the location of the projectile 128 | global.projectilePos[id].elem.style.left = bufferPercX + "%" 129 | global.projectilePos[id].elem.style.bottom = bufferPercY + "%" 130 | } 131 | 132 | // Wait for next repaint 133 | window.requestAnimationFrame(step) 134 | } 135 | 136 | // Request an update before the next repaint 137 | // Maximizes FPS with the least CPU possible 138 | window.requestAnimationFrame(step) 139 | -------------------------------------------------------------------------------- /src/renderers/loopSlow.js: -------------------------------------------------------------------------------- 1 | // Secondary loop 2 | // 3 | // Handles radar autozoom every 25ms (40fps) 4 | 5 | // Get the styling for the entire container 6 | let radarStyle = document.getElementById("container").style 7 | // Prepare position queues 8 | let radarQueues = { 9 | scale: [1, 1, 1, 1, 1, 1], 10 | x: [0, 0, 0, 0, 0, 0], 11 | y: [0, 0, 0, 0, 0, 0] 12 | } 13 | 14 | // Run the loop every 25ms 15 | setInterval(() => { 16 | // Abort if autozoom isn't enabled 17 | if (!global.config.autozoom.enable && typeof global.effects["radar.autozoom"] == "undefined") return 18 | 19 | 20 | // Bounding rect around all living players 21 | // Starts as impossibly small or large bounds so players will always overwrite it 22 | let bounds = { 23 | x: { 24 | min: 100, 25 | max: 0 26 | }, 27 | y: { 28 | min: 100, 29 | max: 0 30 | } 31 | } 32 | 33 | // Go through each player 34 | for (let player of global.playerPos) { 35 | // Ignore dead player markers for autozoom 36 | if (!player.alive) continue 37 | 38 | // Overwrite the previous min/max if the value for this player is smaller/larger 39 | if (bounds.x.min > player.x) bounds.x.min = player.x 40 | if (bounds.x.max < player.x) bounds.x.max = player.x 41 | if (bounds.y.min > player.y) bounds.y.min = player.y 42 | if (bounds.y.max < player.y) bounds.y.max = player.y 43 | } 44 | 45 | // Calculate the zoom-level where all players alive are visible 46 | let radarScale = 1 + (1 - Math.max(bounds.x.max - bounds.x.min, bounds.y.max - bounds.y.min) / 100) 47 | 48 | // Do not zoom if the scale seems to have been calculated with just the default data 49 | if (radarScale === 3) return 50 | 51 | // Limit the radar scale to base size, and keep a customizable padding around the players 52 | radarScale = Math.max(1, radarScale - global.config.autozoom.padding) 53 | 54 | // Calculate the center of the bound 55 | let radarX = (((bounds.x.max + bounds.x.min) / 2) - 50) * -1 56 | let radarY = ((bounds.y.max + bounds.y.min) / 2) - 50 57 | 58 | // Reset all calculated values to default if min zoom level has not been reached 59 | if (radarScale < global.config.autozoom.minZoom || global.effects["radar.autozoom"] === false) { 60 | radarScale = 1 61 | radarX = radarY = 0 62 | } 63 | 64 | // Add all calculated values to their queues, and limit the queue length 65 | radarQueues.scale.unshift(radarScale) 66 | radarQueues.scale = radarQueues.scale.slice(0, global.config.autozoom.smoothing) 67 | radarQueues.x.unshift(radarX) 68 | radarQueues.x = radarQueues.x.slice(0, global.config.autozoom.smoothing) 69 | radarQueues.y.unshift(radarY) 70 | radarQueues.y = radarQueues.y.slice(0, global.config.autozoom.smoothing) 71 | 72 | // Calculate the average for all 3 values 73 | let avgScale = radarQueues.scale.reduce((sum, el) => sum + el, 0) / radarQueues.scale.length 74 | let avgX = radarQueues.x.reduce((sum, el) => sum + el, 0) / radarQueues.x.length 75 | let avgY = radarQueues.y.reduce((sum, el) => sum + el, 0) / radarQueues.y.length 76 | 77 | // Apply the style to the container 78 | radarStyle.transform = `scale(${avgScale}) translate(${avgX}%, ${avgY}%)` 79 | }, 25) 80 | -------------------------------------------------------------------------------- /src/renderers/playerPosition.js: -------------------------------------------------------------------------------- 1 | // Player position calculations 2 | // 3 | // Sets player dot style and pushed to player location buffer, but does not set 4 | // the location. 5 | 6 | socket.element.addEventListener("players", event => { 7 | let data = event.data 8 | 9 | // Abort if no map has been selected yet 10 | if (global.currentMap == "none") return 11 | 12 | // Loop though each player 13 | for (let player of data.players) { 14 | // Get their player element and start building the class 15 | let playerDot = global.playerDots[player.num] 16 | let playerLabel = global.playerLabels[player.num] 17 | let classes = [player.team] 18 | 19 | // Mark dead players with a cross 20 | if (player.health <= 0) { 21 | classes.push("dead") 22 | } 23 | else { 24 | // Make the bomb carrier orange and and a line around the spectated player 25 | if (player.bomb) classes.push("bomb") 26 | if (player.active) classes.push("active") 27 | if (player.flashed > 31) classes.push("flashed") 28 | 29 | // If drawing muzzle flashes is enabled 30 | if (global.config.radar.shooting) { 31 | // Go through each weapon the player has 32 | for (let weapon in player.ammo) { 33 | if (global.playerAmmos[player.num][weapon]) { 34 | // They are shooting if there's less ammo in the clip than the packet before 35 | if (global.playerAmmos[player.num][weapon] > player.ammo[weapon]) { 36 | classes.push("shooting") 37 | } 38 | } 39 | } 40 | 41 | // Save the last ammo stats for the next packet 42 | global.playerAmmos[player.num] = player.ammo 43 | } 44 | 45 | // If damage indicators are enabled 46 | if (global.config.radar.damage) { 47 | // If we have less health than last packet we are hurtin' 48 | if (player.health < global.playerHealths[player.num]) { 49 | classes.push("hurting") 50 | } 51 | 52 | // Save the health value for next time 53 | global.playerHealths[player.num] = player.health 54 | } 55 | 56 | // Save the position so the main loop can interpolate it 57 | global.playerPos[player.num].x = global.positionToPerc(player.position, "x", player.num) 58 | global.playerPos[player.num].y = global.positionToPerc(player.position, "y", player.num) 59 | global.playerPos[player.num].a = player.angle 60 | global.playerPos[player.num].z = player.position.z 61 | } 62 | 63 | // Add all classes as a class string 64 | let newClasses = classes.join(" ") 65 | 66 | // Check if the new classname is different than the one already applied 67 | // This prevents unnecessary className updates and CSS recalculations 68 | if (playerDot.className != "dot " + newClasses) playerDot.className = "dot " + newClasses 69 | if (playerLabel.className != "label " + newClasses) playerLabel.className = "label " + newClasses 70 | 71 | // Set the player alive attribute (used in autozoom) 72 | global.playerPos[player.num].alive = player.health > 0 73 | 74 | if (global.config.radar.showName == "both") { 75 | playerLabel.children[0].textContent = player.name.substring(0, global.config.radar.maxNameLength) 76 | } 77 | if (global.config.radar.showName == "always") { 78 | playerLabel.textContent = player.name.substring(0, global.config.radar.maxNameLength) 79 | } 80 | } 81 | }) 82 | 83 | // On round reset 84 | socket.element.addEventListener("roundend", event => { 85 | let phase = event.data 86 | 87 | // Go through each player 88 | for (let num in global.playerBuffers) { 89 | // Empty the location buffer 90 | global.playerBuffers[num] = [] 91 | // Reset the player position 92 | global.playerPos[num] = { 93 | x: null, 94 | y: null, 95 | z: null, 96 | a: null, 97 | alive: false 98 | } 99 | 100 | // Force a re-render on the dot and label, can sometimes bug out in electron 101 | global.playerDots[num].style.display = "none" 102 | global.playerDots[num].style.display = "block" 103 | global.playerLabels[num].style.display = "none" 104 | global.playerLabels[num].style.display = "" 105 | } 106 | }) 107 | -------------------------------------------------------------------------------- /src/renderers/projectiles.js: -------------------------------------------------------------------------------- 1 | // Projectile rendering 2 | // 3 | // Shows any flying projectioes on the map. 4 | 5 | // Fired with an array of projectiles that are currently in the air 6 | socket.element.addEventListener("projectiles", event => { 7 | if (!global.config.radar.projectiles) return 8 | 9 | let projectiles = event.data 10 | let activeProjectiles = [] 11 | let type = global.config.radar.plainProjectiles ? 'hc' : 'img' 12 | 13 | // For each projectile in the packet 14 | for (let projectile of projectiles) { 15 | // Create unique id, because the GSI id can have duplicate IDs now 16 | let projectileID = "projectile" + projectile.id 17 | 18 | // Calculate positions relative to the radar 19 | let posX = global.positionToPerc(projectile.position, "x") 20 | let posY = global.positionToPerc(projectile.position, "y") 21 | 22 | // Get the projectile element 23 | let projectileElement = document.getElementById(projectileID) 24 | let trailElement = document.getElementById("trail" + projectileID) 25 | 26 | // If the element does not exist yet, add it 27 | if (!projectileElement) { 28 | // Create a new element 29 | projectileElement = document.createElement("div") 30 | projectileElement.id = projectileID 31 | projectileElement.className = projectile.team 32 | 33 | projectileElement.style.backgroundImage = `url('/img/projectile-${type}-${projectile.type}-${projectile.team}.webp')` 34 | if (projectile.type == 'frag') projectileElement.dataset.isfrag = 'true' 35 | 36 | // Add it to the DOM 37 | document.getElementById("projectiles").appendChild(projectileElement) 38 | 39 | // Create a trail path element 40 | trailElement = document.createElementNS("http://www.w3.org/2000/svg", "path"); 41 | trailElement.id = "trail" + projectileID 42 | 43 | // Set the width relative to the scale of the radar 44 | trailElement.setAttributeNS(null, "stroke-width", global.mapData.resolution * 0.2) 45 | // Color it with the team colors 46 | trailElement.setAttributeNS(null, "stroke", projectile.team == "T" ? "#ffa70166" : "#1584C466") 47 | // Move the start of the path to the current position 48 | trailElement.setAttributeNS(null, "d", "M " + posX + " " + (100 - posY)) 49 | 50 | // Add it to the DOM 51 | document.getElementById("trails").appendChild(trailElement) 52 | 53 | // Initialize the smooth position buffer 54 | global.projectileBuffer[projectileID] = [] 55 | } 56 | 57 | // CS2 bug: frag grenades stay active after exploding about half the time 58 | if (projectile.type == 'frag') { 59 | // Get the previous coords from the 60 | let trailParts = trailElement.getAttributeNS(null, "d").split(" ") 61 | // True if more than three packets are known and nade stationary 62 | let isStationary = trailParts.length > 9 63 | 64 | // Go through each nade position from last to newest, max last 5 65 | for (let i = trailParts.length - 1; i > 2 && trailParts.length - i < 5 * 3; i -= 3) { 66 | // If the nade moved in this frame, it is not stationary 67 | if (trailParts[i] != trailParts[i - 3] || trailParts[i - 1] != trailParts[i - 4]) { 68 | isStationary = false 69 | break 70 | } 71 | } 72 | 73 | // Hide nade an tail if nade is stationary 74 | if (isStationary) { 75 | triggerSmokeGap(projectileElement) 76 | projectileElement.style.opacity = 0 77 | trailElement.style.opacity = 0 78 | } 79 | } 80 | 81 | // Mark the projectile id as active 82 | activeProjectiles.push(projectileID) 83 | 84 | // Save the current position so the fast loop can pick it up 85 | global.projectilePos[projectileID] = { 86 | x: posX, 87 | y: posY, 88 | elem: projectileElement 89 | } 90 | 91 | // Extend path to current position 92 | trailElement.setAttributeNS(null, "d", trailElement.getAttributeNS(null, "d") + " L " + posX + " " + (100 - posY)) 93 | } 94 | 95 | // For each projectile element on the map 96 | for (let projectileElement of document.getElementById("projectiles").children) { 97 | // If the element exists but the projectile is no longer in the game 98 | if (!activeProjectiles.includes(projectileElement.id)) { 99 | // Remove the element 100 | projectileElement.remove() 101 | 102 | // Remove the trail if it exits 103 | let trailElement = document.getElementById("trail" + projectileElement.id) 104 | if (trailElement) document.getElementById("trails").removeChild(trailElement) 105 | 106 | // If a frag is no longer on the map it has exploded 107 | if (projectileElement.dataset.isfrag == 'true') { 108 | triggerSmokeGap(projectileElement) 109 | } 110 | 111 | // Clear the old position and buffers 112 | delete global.projectilePos[projectileElement.id] 113 | delete global.projectileBuffer[projectileElement.id] 114 | } 115 | } 116 | }) 117 | 118 | // Create event to show gap in smoke after frag nade 119 | function triggerSmokeGap(projectileElement) { 120 | let exploEvent = new Event("explosion") 121 | exploEvent.data = { 122 | id: projectileElement.id, 123 | position: { 124 | x: parseFloat(projectileElement.style.left.slice(0, -1)), 125 | y: parseFloat(projectileElement.style.bottom.slice(0, -1)) 126 | } 127 | } 128 | 129 | socket.element.dispatchEvent(exploEvent) 130 | } 131 | 132 | // Clear all projectiles on round reset 133 | socket.element.addEventListener("roundend", event => { 134 | document.getElementById("projectiles").innerHTML = "" 135 | document.getElementById("trails").innerHTML = "" 136 | }) 137 | -------------------------------------------------------------------------------- /src/renderers/smokes.js: -------------------------------------------------------------------------------- 1 | // Smoke rendering 2 | // 3 | // Shows smokes/infernos/flashbangs on map and calculates duration. 4 | 5 | // The live position of all smokes 6 | socket.element.addEventListener("smokes", event => { 7 | let smokes = event.data 8 | 9 | // Called to show the fade in animation with a delay 10 | function fadeIn(smokeElement, team) { 11 | setTimeout(() => { 12 | smokeElement.className = "smokeEntity show " + team 13 | }, 25) 14 | } 15 | 16 | // Called to remove the smoke element after the fadeout 17 | function remove(smokeElement) { 18 | setTimeout(() => { 19 | smokeElement.remove() 20 | }, 2000) 21 | } 22 | 23 | // Go through each smoke 24 | for (let smoke of smokes) { 25 | // Create unique id, because the GSI id can have duplicate IDs now 26 | let smokeID = "smoke" + smoke.id + (smoke.position.x + smoke.position.y + smoke.position.z) 27 | // Get the smoke element 28 | let smokeElement = document.getElementById(smokeID) 29 | 30 | // Color the smokes if that option is enabled 31 | let team = "U" 32 | if (global.config.radar.smokeColors) team = smoke.team 33 | 34 | // If the element does not exist yet, add it 35 | if (!smokeElement) { 36 | // Do not add a new smoke element if it has already started fading out 37 | if (smoke.time > 20.1) continue 38 | 39 | // Create a new element 40 | smokeElement = document.createElement("div") 41 | smokeElement.id = smokeID 42 | smokeElement.className = "smokeEntity hide " + team 43 | 44 | // Calculate the height and width based on the map resolution 45 | smokeElement.style.height = smokeElement.style.width = 300 / global.mapData.resolution / 1024 * 100 + "%" 46 | 47 | // Add it to the DOM 48 | document.getElementById("smokes").appendChild(smokeElement) 49 | 50 | // Play the fade in animation 51 | fadeIn(smokeElement, team) 52 | 53 | // Safety timeout: never show for longer than 23 sec 54 | setTimeout(() => { 55 | remove(smokeElement) 56 | }, 23000) 57 | } 58 | 59 | // Set the location of the smoke 60 | smokeElement.style.left = global.positionToPerc(smoke.position, "x") + "%" 61 | smokeElement.style.bottom = global.positionToPerc(smoke.position, "y") + "%" 62 | 63 | // If the smoke has been here for over 15 seconds, ready the smoke element for the fade away 64 | // Setting the fading class will set the opacity transition to another value 65 | if (smoke.time > 15 && smoke.time <= 16.4 && smokeElement.className != "smokeEntity fading " + team) { 66 | smokeElement.className = "smokeEntity fading " + team 67 | } 68 | 69 | // Trigger the fade away 70 | if (smoke.time > 20.1 && smokeElement.className != "smokeEntity fading hide " + team) { 71 | smokeElement.className = "smokeEntity fading hide " + team 72 | remove(smokeElement) 73 | } 74 | } 75 | }) 76 | 77 | // When a grenade explodes, show gap in smoke 78 | socket.element.addEventListener("explosion", event => { 79 | let pos = event.data.position 80 | 81 | 82 | for (let smokeElement of document.getElementById("smokes").childNodes) { 83 | // Don't add more than one for the same explosion 84 | if (smokeElement.querySelector("#gap" + event.data.id)) continue 85 | 86 | // Get smoke position from html attr 87 | let smokeX = parseFloat(smokeElement.style.left.slice(0, -1)) 88 | let smokeY = parseFloat(smokeElement.style.bottom.slice(0, -1)) 89 | let smokeSize = parseFloat(smokeElement.style.width.slice(0, -1)) 90 | 91 | // Calculate the relative distance between the center point of the smoke and the grenade 92 | let dist = (Math.abs(smokeX - pos.x) + Math.abs(smokeY - pos.y)) * global.mapData.resolution 93 | 94 | if (dist < global.mapData.resolution * 4) { 95 | // Create a new element 96 | let gapElement = document.createElement("div") 97 | gapElement.className = "flash" 98 | gapElement.id = "gap" + event.data.id 99 | 100 | // Calculate gap position within smoke 101 | gapElement.style.left = (pos.x - smokeX) / smokeSize * 100 + "%" 102 | gapElement.style.bottom = (pos.y - smokeY) / smokeSize * 100 + "%" 103 | 104 | // Insert gap into smoke 105 | smokeElement.appendChild(gapElement) 106 | 107 | // Fade out the flash animation 108 | setTimeout(() => { 109 | gapElement.className = "" 110 | }, 100) 111 | 112 | // Remove the gap 113 | setTimeout(() => { 114 | gapElement.className = "fade" 115 | }, 550) 116 | } 117 | } 118 | }) 119 | 120 | // The position of all infernos 121 | socket.element.addEventListener("infernos", event => { 122 | let infernos = event.data 123 | // List of all infernos that are currently still in the game 124 | let activeInfernos = [] 125 | 126 | // Go through each inferno 127 | for (let inferno of infernos) { 128 | // Get the inferno element 129 | let infernoElement = document.getElementById("inferno" + inferno.id) 130 | let flameElementsStr = "" 131 | let flameElement = [] 132 | 133 | // Mark inferno as currently active in the game 134 | activeInfernos.push("inferno" + inferno.id) 135 | 136 | // If the element does not exist yet, add it 137 | if (!infernoElement) { 138 | infernoElement = document.createElement("div") 139 | 140 | infernoElement.id = "inferno" + inferno.id 141 | infernoElement.className = "inferno" 142 | infernoElement.style.opacity = 1 143 | 144 | // Add it to the inferno container 145 | document.getElementById("infernos").appendChild(infernoElement) 146 | } 147 | 148 | // For each flame in the inferno 149 | for (var i = 0; i < inferno.flamesNum; i++) { 150 | // Create a new flame 151 | flameElement[i] = document.createElement("div") 152 | 153 | // Style the flame 154 | flameElement[i].style.height = flameElement[i].style.width = 100 / global.mapData.resolution / 1024 * 100 + "%" 155 | flameElement[i].style.left = global.positionToPerc(inferno.flamesPosition[i], "x") + "%" 156 | flameElement[i].style.bottom = global.positionToPerc(inferno.flamesPosition[i], "y") + "%" 157 | 158 | // Add it to the parent inferno 159 | flameElementsStr += flameElement[i].outerHTML 160 | } 161 | 162 | // SHow the new inferno elements 163 | infernoElement.innerHTML = flameElementsStr 164 | } 165 | 166 | // Go through inferno elements on the radar 167 | for (let infernoElem of document.getElementsByClassName('inferno')) { 168 | // If the inferno is on the radar but no longer in the game, fade it out 169 | if (!activeInfernos.includes(infernoElem.id)) { 170 | infernoElem.style.opacity = 0 171 | 172 | setTimeout(() => { 173 | infernoElem.remove() 174 | }, 400) 175 | } 176 | } 177 | }) 178 | 179 | // The live position of all flashbangs 180 | socket.element.addEventListener("flashbangs", event => { 181 | let flashbangs = event.data 182 | 183 | // Go through each flashbang 184 | for (let flashbang of flashbangs) { 185 | // Get the flashbang element 186 | let flashbangElement = document.getElementById("flashbang" + flashbang.id) 187 | 188 | // If the element does not exist yet, add it 189 | if (!flashbangElement) { 190 | // Create a new element 191 | flashbangElement = document.createElement("div") 192 | flashbangElement.id = "flashbang" + flashbang.id 193 | flashbangElement.className = "flashbangEntity" 194 | 195 | // Calculate the height and width based on the map resolution 196 | flashbangElement.style.height = flashbangElement.style.width = 290 / global.mapData.resolution / 1024 * 100 + "%" 197 | 198 | // Add it to the DOM 199 | document.getElementById("flashbangs").appendChild(flashbangElement) 200 | 201 | // Set the location of the flashbang 202 | flashbangElement.style.left = global.positionToPerc(flashbang.position, "x") + "%" 203 | flashbangElement.style.bottom = global.positionToPerc(flashbang.position, "y") + "%" 204 | 205 | // Play a "pop" animation after adding 206 | setTimeout(() => { 207 | flashbangElement.className = "flashbangEntity full" 208 | }, 100) 209 | 210 | // Fade out slowly 211 | setTimeout(() => { 212 | flashbangElement.className = "flashbangEntity full hide" 213 | }, 1200) 214 | 215 | // Remove element when invisible 216 | setTimeout(() => { 217 | flashbangElement.remove() 218 | }, 2200) 219 | } 220 | } 221 | }) 222 | 223 | // Clear all smokes and infernos on round reset 224 | socket.element.addEventListener("roundend", event => { 225 | document.getElementById("smokes").innerHTML = "" 226 | document.getElementById("trails").innerHTML = "" 227 | document.getElementById("infernos").innerHTML = "" 228 | document.getElementById("flashbangs").innerHTML = "" 229 | }) 230 | -------------------------------------------------------------------------------- /src/socket.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs") 2 | const path = require("path") 3 | const WebSocket = require("ws") 4 | 5 | const config = require("./loadconfig") 6 | const wss = new WebSocket.Server({ 7 | port: config.browser.ports.socket 8 | }) 9 | 10 | // Will contain the filenames of all rendered scripts 11 | let scripts = [] 12 | // Get a list of available renderers 13 | let renderers = fs.readdirSync(path.join(__dirname, "renderers")) 14 | 15 | for (let renderer of renderers) { 16 | // Skip renderers that start with a "_", as they are only helpers 17 | if (renderer.slice(0, 1) == "_") continue 18 | // Load in the render module 19 | scripts.push(renderer) 20 | } 21 | 22 | // When a new connection is established 23 | wss.on("connection", ws => { 24 | // Send a packet so the client has a config and knows what scripts to load 25 | ws.on("message", message => { 26 | if (message === "requestWelcome") { 27 | ws.send(JSON.stringify({ 28 | type: "welcome", 29 | data: { 30 | scripts: scripts, 31 | config: { 32 | browser: config.browser, 33 | radar: config.radar, 34 | autozoom: config.autozoom, 35 | vertIndicator: config.vertIndicator, 36 | } 37 | } 38 | })) 39 | } 40 | }) 41 | }) 42 | 43 | // When a packet needs to be sent 44 | process.on("message", data => { 45 | // Format the package as a string 46 | let string = JSON.stringify(data) 47 | 48 | // Send it to all open connections 49 | wss.clients.forEach(client => { 50 | if (client.readyState === WebSocket.OPEN) { 51 | client.send(string) 52 | } 53 | }) 54 | }) 55 | -------------------------------------------------------------------------------- /src/window.js: -------------------------------------------------------------------------------- 1 | const path = require("path") 2 | const config = require("./loadconfig") 3 | 4 | const detectcfg = require("./detectcfg") 5 | if (config.game.installCfg && !config.debug.terminalOnly) detectcfg.search() 6 | 7 | module.exports = { 8 | electron: false, 9 | app: false, 10 | gsi: false, 11 | http: false, 12 | socket: false, 13 | win: false, 14 | 15 | build: () => { 16 | module.exports.electron = require("electron") 17 | module.exports.app = module.exports.electron.app 18 | 19 | if (config.window.disableGpu) { 20 | console.info("GPU disabled by config option") 21 | 22 | module.exports.app.disableHardwareAcceleration() 23 | module.exports.app.commandLine.appendSwitch("disable-gpu") 24 | } 25 | 26 | module.exports.app.on("ready", module.exports.create) 27 | }, 28 | 29 | create: () => { 30 | let winConfig = { 31 | width: config.window.defaultSize.width, 32 | height: config.window.defaultSize.height, 33 | fullscreen: config.window.fullscreen, 34 | minHeight: 200, 35 | minWidth: 200, 36 | frame: false, 37 | resizable: true, 38 | hasShadow: false, 39 | enableLargerThanScreen: true, 40 | darkTheme: true, 41 | title: "Boltobserv", 42 | icon: path.join(__dirname, "img/icon-64x64.png"), 43 | webPreferences: { 44 | nodeIntegration: true, 45 | webaudio: false, 46 | webgl: false, 47 | contextIsolation: false, 48 | backgroundThrottling: false, 49 | allowEval: false 50 | } 51 | } 52 | 53 | if (config.window.defaultSize.top >= 0 || config.window.defaultSize.left >= 0) { 54 | winConfig.x = Math.max(0, config.window.defaultSize.left) 55 | winConfig.y = Math.max(0, config.window.defaultSize.top) 56 | } 57 | 58 | if (config.window.transparent) { 59 | winConfig.transparent = true 60 | } 61 | else { 62 | winConfig.backgroundColor = config.window.backgroundColor 63 | } 64 | 65 | if (config.window.backgroundColor && !config.window.transparent) { 66 | winConfig.backgroundColor = config.window.backgroundColor 67 | } 68 | 69 | if (config.window.disable) { 70 | winConfig.width = 450 71 | winConfig.height = 200 72 | winConfig.fullscreen = false 73 | winConfig.resizable = false 74 | } 75 | 76 | win = new module.exports.electron.BrowserWindow(winConfig) 77 | module.exports.win = win 78 | 79 | if (config.window.alwaysOnTop) { 80 | win.setAlwaysOnTop(true, "screen") 81 | } 82 | 83 | if (config.window.mousePassthrough) { 84 | win.setIgnoreMouseEvents(true) 85 | } 86 | 87 | if (config.window.fullscreen) { 88 | win.setFullScreen(true) 89 | } 90 | 91 | win.on("closed", () => { 92 | module.exports.gsi.kill() 93 | module.exports.http.kill() 94 | module.exports.socket.kill() 95 | module.exports.app.quit() 96 | process.exit() 97 | }) 98 | 99 | if (config.window.disable) { 100 | win.loadFile("html/status.html") 101 | } 102 | else { 103 | win.loadFile("html/waiting.html") 104 | } 105 | 106 | module.exports.electron.ipcMain.on("reqInstall", (event) => { 107 | event.sender.send("cfgInstall", detectcfg.found) 108 | }) 109 | 110 | module.exports.electron.ipcMain.on("install", (event, path) => { 111 | detectcfg.install(path) 112 | }) 113 | 114 | // Capture file requests and redirect them to on-disk paths 115 | module.exports.electron.protocol.interceptFileProtocol("file", (request, callback) => { 116 | let loc = request.url.substr(5) 117 | 118 | // Remove drive letter on windows 119 | loc = loc.replace(/\w:\//, "") 120 | 121 | if (request.url.match(/^.*?\/html\/\w*?.html/)) { 122 | loc = request.url.replace(/^.*?\/html\/(\w*?).html/, "html/$1.html") 123 | } 124 | 125 | callback({ 126 | path: path.normalize(path.join(__dirname, loc)) 127 | }) 128 | }) 129 | 130 | // Load key-binds and start listening 131 | require("./keybinds")(module.exports.socket, module.exports.win) 132 | } 133 | } 134 | --------------------------------------------------------------------------------