Skip to content

About

OpenFrontIO AutoClicker is a browser-based script that does macro/automation for OpenFront.io that helps players perform repetitive in-game actions faster.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

OpenFrontIO AutoClicker

OpenFrontIO AutoClicker is a browser-based JavaScript that does macro/automation for OpenFront.io that helps players perform repetitive in-game actions faster.

It provides integrated function for rapidly launching nukes and building or upgrading structures such as Ports, SAM Launchers, and Missile Silos, making it especially useful in high - gold multiplier custom games where large numbers of actions need to be performed quickly.

Following Newer development, this is not just a AutoClicker for mass launching/building no more, it also have:

  • overlay layers to display SAM range/Level count
  • Auto Launching Nuke to intercept enemy transport ship(Scans the map every 5 second when enabled and auto calculate nuke lead and launch a single nuke at it)

How to Use

Copy the code below and save it as a book mark on your browser(The script is too long that chrome would display the remaining part of the script as ..., it's normal behavior and will not cut it off), then click it while in a game

javascript:(()%3D%3E%7Bconst%20COUNT%3D50%2CTYPE%3D%22Atom%20Bomb%22%2CKEY%3D%22__openfrontNukeBatch_v2%22%3Bif(window%5BKEY%5D)%7Bwindow%5BKEY%5D.abort()%3Bdelete%20window%5BKEY%5D%3Balert(%22OpenFront%20nuke%20macro%20OFF%22)%3Breturn%3B%7Dconst%20menu%3Ddocument.querySelector(%22build-menu%22)%3Bif(!menu%3F.game%7C%7C!menu.eventBus%7C%7C!menu.transformHandler%7C%7Ctypeof%20menu.sendBuildOrUpgrade!%3D%3D%22function%22)%7Balert(%22Join%20a%20running%20game%20before%20activating%20this%20bookmark.%22)%3Breturn%3B%7Dlet%20template%3Btry%7Bmenu.sendBuildOrUpgrade.call(%7BeventBus%3A%7Bemit(event)%7Btemplate%3Devent%3B%7D%7D%2CuiState%3A%7BrocketDirectionUp%3Atrue%7D%2ChideMenu()%7B%7D%7D%2C%7Btype%3ATYPE%2CcanBuild%3Atrue%2CcanUpgrade%3Afalse%7D%2C0)%3B%7Dcatch(error)%7Bconsole.error(%22%5BOpenFront%5D%20Setup%20error%3A%22%2Cerror)%3B%7Dif(!template%7C%7Ctemplate.unit!%3D%3DTYPE)%7Balert(%22Could%20not%20locate%20the%20build%20event.%20The%20game%20interface%20may%20have%20changed.%22)%3Breturn%3B%7Dconst%20BuildEvent%3Dtemplate.constructor%2Ccontroller%3Dnew%20AbortController()%2Coptions%3D%7Bcapture%3Atrue%2Csignal%3Acontroller.signal%7D%3Blet%20held%3Dfalse%2Cpressed%3Dfalse%3Bconst%20editing%3Devent%3D%3Eevent.composedPath().some(node%3D%3Enode%3F.isContentEditable%7C%7C%5B%22INPUT%22%2C%22TEXTAREA%22%2C%22SELECT%22%5D.includes(node%3F.tagName))%3Bconst%20onMap%3Devent%3D%3Eevent.composedPath().some(node%3D%3Enode%3F.id%3D%3D%3D%22game-input-overlay%22%7C%7Cnode%3F.tagName%3D%3D%3D%22CANVAS%22)%3Bconst%20swallow%3Devent%3D%3E%7Bevent.preventDefault()%3Bevent.stopImmediatePropagation()%3B%7D%3Bwindow.addEventListener(%22keydown%22%2Cevent%3D%3E%7Bif(event.code%3D%3D%3D%22KeyX%22%26%26!event.ctrlKey%26%26!event.altKey%26%26!event.metaKey%26%26!editing(event))%7Bheld%3Dtrue%3Bswallow(event)%3B%7D%7D%2Coptions)%3Bwindow.addEventListener(%22keyup%22%2Cevent%3D%3E%7Bif(event.code%3D%3D%3D%22KeyX%22)%7Bheld%3Dfalse%3Bif(!editing(event))swallow(event)%3B%7D%7D%2Coptions)%3Bwindow.addEventListener(%22blur%22%2C()%3D%3E%7Bheld%3Dfalse%3Bpressed%3Dfalse%3B%7D%2C%7Bsignal%3Acontroller.signal%7D)%3Bdocument.addEventListener(%22visibilitychange%22%2C()%3D%3E%7Bif(document.hidden)%7Bheld%3Dfalse%3Bpressed%3Dfalse%3B%7D%7D%2C%7Bsignal%3Acontroller.signal%7D)%3Bwindow.addEventListener(%22pointerdown%22%2Cevent%3D%3E%7Bif(event.button!%3D%3D0%7C%7C!held%7C%7Cediting(event)%7C%7C!onMap(event))return%3Bpressed%3Dtrue%3Bswallow(event)%3Btry%7Bif(document.querySelector(%22build-menu%22)!%3D%3Dmenu)throw%20new%20Error(%22Game%20changed.%20Toggle%20the%20bookmark%20off%20and%20on%20again.%22)%3Bconst%20world%3Dmenu.transformHandler.screenToWorldCoordinates(event.clientX%2Cevent.clientY)%3Bif(!world%7C%7C!menu.game.isValidCoord(world.x%2Cworld.y))throw%20new%20Error(%22Cursor%20is%20outside%20the%20map.%22)%3Bconst%20tile%3Dmenu.game.ref(world.x%2Cworld.y)%3Bconst%20request%3Dnew%20BuildEvent(TYPE%2Ctile)%3Brequest.unit%3DTYPE%3Brequest.tile%3Dtile%3Brequest.rocketDirectionUp%3Dtypeof%20menu.uiState%3F.rocketDirectionUp%3D%3D%3D%22boolean%22%3Fmenu.uiState.rocketDirectionUp%3Atrue%3Brequest.amount%3DCOUNT%3Bconsole.info(%22%5BOpenFront%5D%20Sending%20nuke%20batch%3A%22%2C%7Bunit%3Arequest.unit%2Ctile%3Arequest.tile%2CrocketDirectionUp%3Arequest.rocketDirectionUp%2Camount%3Arequest.amount%7D)%3Bmenu.eventBus.emit(request)%3B%7Dcatch(error)%7Bconsole.error(%22%5BOpenFront%5D%20Nuke%20macro%20error%3A%22%2Cerror)%3Balert(%22Nuke%20macro%20error%3A%20%22%2Berror.message)%3B%7D%7D%2Coptions)%3Bfor(const%20type%20of%5B%22mousedown%22%2C%22mouseup%22%2C%22pointerup%22%2C%22click%22%2C%22pointercancel%22%5D)%7Bwindow.addEventListener(type%2Cevent%3D%3E%7Bif(!pressed%7C%7Cevent.button%3E0)return%3Bswallow(event)%3Bif(type%3D%3D%3D%22click%22%7C%7Ctype%3D%3D%3D%22pointercancel%22)pressed%3Dfalse%3B%7D%2Coptions)%3B%7Dwindow%5BKEY%5D%3Dcontroller%3Balert(%22Hold%20a%20key%20%2B%20left-click%20the%20map%5Cn%5CnX%20-%20Nuke%5CnZ%20-%20Port%5CnV%20-%20SAM%5CnB%20-%20Missile%20silo%20(build%20%2F%20up%20to%2050%20upgrades)%5CnN%20-%20City%20(build%20%2F%20up%20to%20100%20upgrades)%5Cn%5CnPress%20O%20once%20-%20Toggle%20SAM%20ranges%20%2B%20total%20enemy%20SAM%20levels%20by%20cursor%5CnPress%20I%20once%20-%20Toggle%20auto-nuking%20enemy%20troop%20transports%20(every%205%20seconds)%22)%3B%7D)()%3B(()%3D%3E%7Bconst%20KEY%3D%22__of_port_macro__%22%2Cold%3Dwindow%5BKEY%5D%3Bif(old)%7Bold.stop()%3Bdelete%20window%5BKEY%5D%3Bconsole.log(%22%5BOpenFront%5D%20Port%20macro%20OFF%22)%3Breturn%3B%7Dconst%20menu%3Ddocument.querySelector(%22build-menu%22)%2Cbus%3Dmenu%3F.eventBus%2Cgame%3Dmenu%3F.game%2Ctransform%3Dmenu%3F.transformHandler%3Bif(!menu%7C%7C!bus%7C%7C!game%7C%7C!transform)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20find%20the%20active%20game's%20BuildMenu%2FEventBus.%20Run%20this%20inside%20a%20match.%22)%3Breturn%3B%7Dlet%20upgradeCtor%3Dnull%2CbuildCtor%3Dnull%2Cbusy%3Dfalse%2CzHeld%3Dfalse%2CmacroPointer%3Dfalse%3Bconst%20captureEvent%3D(bu%2Ctile)%3D%3E%7Blet%20captured%3Dnull%3Bconst%20originalEmit%3Dbus.emit%3Bconst%20originalHide%3Dmenu.hideMenu%3Btry%7Bbus.emit%3Dfunction(ev)%7Bcaptured%3Dev%3B%7D%3Bmenu.hideMenu%3Dfunction()%7B%7D%3Bmenu.sendBuildOrUpgrade(bu%2Ctile)%3B%7Dcatch(e)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20discover%20event%20type%3A%22%2Ce)%3B%7Dfinally%7Bbus.emit%3DoriginalEmit%3Bmenu.hideMenu%3DoriginalHide%3B%7Dreturn%20captured%3F.constructor%7C%7Cnull%3B%7D%3Bconst%20typing%3De%3D%3E%7Bconst%20t%3De.target%3Breturn!!(t%26%26(t.closest%3F.(%22input%2Ctextarea%2Cselect%2C%5Bcontenteditable%3D'true'%5D%22)%7C%7Ct.isContentEditable))%3B%7D%3Bconst%20keydown%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyZ%22%7C%7Ctyping(e))return%3BzHeld%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20keyup%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyZ%22)return%3BzHeld%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20blur%3D()%3D%3E%7BzHeld%3Dfalse%3BmacroPointer%3Dfalse%3Bbusy%3Dfalse%3B%7D%3Bconst%20pointerdown%3Dasync%20e%3D%3E%7Bif(e.button!%3D%3D0%7C%7C!zHeld%7C%7Ctyping(e))return%3Bif(!document.body.classList.contains(%22in-game%22))return%3Bif(!e.target%3F.closest%3F.(%22%23game-input-overlay%22))return%3BmacroPointer%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3Bif(busy)return%3Bbusy%3Dtrue%3Btry%7Bif(game.inSpawnPhase%3F.())return%3Bconst%20cell%3Dtransform.screenToWorldCoordinates(e.clientX%2Ce.clientY)%3Bif(!game.isValidCoord(cell.x%2Ccell.y))return%3Bconst%20tile%3Dgame.ref(cell.x%2Ccell.y)%3Bconst%20player%3Dgame.myPlayer%3F.()%3Bif(!player)return%3Bconst%20list%3Dawait%20player.buildables(tile%2C%5B%22Port%22%5D)%3Bconst%20bu%3Dlist.find(x%3D%3Ex.type%3D%3D%3D%22Port%22)%3Bif(!bu)return%3Bif(bu.canUpgrade!%3D%3Dfalse)%7BupgradeCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!upgradeCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20UpgradeStructureIntentEvent%22)%3Breturn%3B%7Dconst%20id%3Dbu.canUpgrade%3Bbus.emit(new%20upgradeCtor(id%2Cbu.type%2C50))%3Bbus.emit(new%20upgradeCtor(id%2Cbu.type%2C50))%3Bconsole.log(%22%5BOpenFront%5D%20Port%20upgrade%3A%20up%20to%20100%20levels%22)%3B%7Delse%20if(bu.canBuild!%3D%3Dfalse)%7BbuildCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!buildCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20BuildUnitIntentEvent%22)%3Breturn%3B%7Dbus.emit(new%20buildCtor(bu.type%2Ctile))%3Bconsole.log(%22%5BOpenFront%5D%20Built%20Port%22)%3B%7Delse%7Bconsole.log(%22%5BOpenFront%5D%20No%20valid%20Port%20build%2Fupgrade%20here%22)%3B%7D%7Dcatch(err)%7Bconsole.error(%22%5BOpenFront%5D%20Port%20macro%20error%3A%22%2Cerr)%3B%7Dfinally%7Bbusy%3Dfalse%3B%7D%7D%3Bconst%20pointerup%3De%3D%3E%7Bif(!macroPointer)return%3BmacroPointer%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bwindow.addEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.addEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.addEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.addEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.addEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.addEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3Bwindow%5BKEY%5D%3D%7Bstop()%7Bwindow.removeEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.removeEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.removeEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.removeEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.removeEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.removeEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3B%7D%7D%3Bconsole.log(%22%5BOpenFront%5D%20Port%20macro%20ON%20%E2%80%94%20hold%20Z%20%2B%20left%20click%22)%3B%7D)()%3B(()%3D%3E%7Bconst%20KEY%3D%22__of_sam_macro__%22%2Cold%3Dwindow%5BKEY%5D%3Bif(old)%7Bold.stop()%3Bdelete%20window%5BKEY%5D%3Bconsole.log(%22%5BOpenFront%5D%20SAM%20macro%20OFF%22)%3Breturn%3B%7Dconst%20menu%3Ddocument.querySelector(%22build-menu%22)%2Cbus%3Dmenu%3F.eventBus%2Cgame%3Dmenu%3F.game%2Ctransform%3Dmenu%3F.transformHandler%3Bif(!menu%7C%7C!bus%7C%7C!game%7C%7C!transform)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20find%20the%20active%20game's%20BuildMenu%2FEventBus.%20Run%20this%20inside%20a%20match.%22)%3Breturn%3B%7Dlet%20upgradeCtor%3Dnull%2CbuildCtor%3Dnull%2Cbusy%3Dfalse%2CvHeld%3Dfalse%2CmacroPointer%3Dfalse%3Bconst%20captureEvent%3D(bu%2Ctile)%3D%3E%7Blet%20captured%3Dnull%3Bconst%20originalEmit%3Dbus.emit%3Bconst%20originalHide%3Dmenu.hideMenu%3Btry%7Bbus.emit%3Dfunction(ev)%7Bcaptured%3Dev%3B%7D%3Bmenu.hideMenu%3Dfunction()%7B%7D%3Bmenu.sendBuildOrUpgrade(bu%2Ctile)%3B%7Dcatch(e)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20discover%20event%20type%3A%22%2Ce)%3B%7Dfinally%7Bbus.emit%3DoriginalEmit%3Bmenu.hideMenu%3DoriginalHide%3B%7Dreturn%20captured%3F.constructor%7C%7Cnull%3B%7D%3Bconst%20typing%3De%3D%3E%7Bconst%20t%3De.target%3Breturn!!(t%26%26(t.closest%3F.(%22input%2Ctextarea%2Cselect%2C%5Bcontenteditable%3D'true'%5D%22)%7C%7Ct.isContentEditable))%3B%7D%3Bconst%20keydown%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyV%22%7C%7Ctyping(e))return%3BvHeld%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20keyup%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyV%22)return%3BvHeld%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20blur%3D()%3D%3E%7BvHeld%3Dfalse%3BmacroPointer%3Dfalse%3Bbusy%3Dfalse%3B%7D%3Bconst%20pointerdown%3Dasync%20e%3D%3E%7Bif(e.button!%3D%3D0%7C%7C!vHeld%7C%7Ctyping(e))return%3Bif(!document.body.classList.contains(%22in-game%22))return%3Bif(!e.target%3F.closest%3F.(%22%23game-input-overlay%22))return%3BmacroPointer%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3Bif(busy)return%3Bbusy%3Dtrue%3Btry%7Bif(game.inSpawnPhase%3F.())return%3Bconst%20cell%3Dtransform.screenToWorldCoordinates(e.clientX%2Ce.clientY)%3Bif(!game.isValidCoord(cell.x%2Ccell.y))return%3Bconst%20tile%3Dgame.ref(cell.x%2Ccell.y)%3Bconst%20player%3Dgame.myPlayer%3F.()%3Bif(!player)return%3Bconst%20list%3Dawait%20player.buildables(tile%2C%5B%22SAM%20Launcher%22%5D)%3Bconst%20bu%3Dlist.find(x%3D%3Ex.type%3D%3D%3D%22SAM%20Launcher%22)%3Bif(!bu)return%3Bif(bu.canUpgrade!%3D%3Dfalse)%7BupgradeCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!upgradeCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20UpgradeStructureIntentEvent%22)%3Breturn%3B%7Dconst%20id%3Dbu.canUpgrade%3Bbus.emit(new%20upgradeCtor(id%2Cbu.type%2C50))%3Bbus.emit(new%20upgradeCtor(id%2Cbu.type%2C50))%3Bconsole.log(%22%5BOpenFront%5D%20SAM%20upgrade%3A%20up%20to%20100%20levels%22)%3B%7Delse%20if(bu.canBuild!%3D%3Dfalse)%7BbuildCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!buildCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20BuildUnitIntentEvent%22)%3Breturn%3B%7Dbus.emit(new%20buildCtor(bu.type%2Ctile))%3Bconsole.log(%22%5BOpenFront%5D%20Built%20SAM%20Launcher%22)%3B%7Delse%7Bconsole.log(%22%5BOpenFront%5D%20No%20valid%20SAM%20build%2Fupgrade%20here%22)%3B%7D%7Dcatch(err)%7Bconsole.error(%22%5BOpenFront%5D%20SAM%20macro%20error%3A%22%2Cerr)%3B%7Dfinally%7Bbusy%3Dfalse%3B%7D%7D%3Bconst%20pointerup%3De%3D%3E%7Bif(!macroPointer)return%3BmacroPointer%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bwindow.addEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.addEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.addEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.addEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.addEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.addEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3Bwindow%5BKEY%5D%3D%7Bstop()%7Bwindow.removeEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.removeEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.removeEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.removeEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.removeEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.removeEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3B%7D%7D%3Bconsole.log(%22%5BOpenFront%5D%20SAM%20macro%20ON%20%E2%80%94%20hold%20V%20%2B%20left%20click%22)%3B%7D)()%3B(()%3D%3E%7Bconst%20KEY%3D%22__of_missile_silo_macro__%22%2Cold%3Dwindow%5BKEY%5D%3Bif(old)%7Bold.stop()%3Bdelete%20window%5BKEY%5D%3Bconsole.log(%22%5BOpenFront%5D%20Missile%20Silo%20macro%20OFF%22)%3Breturn%3B%7Dconst%20menu%3Ddocument.querySelector(%22build-menu%22)%2Cbus%3Dmenu%3F.eventBus%2Cgame%3Dmenu%3F.game%2Ctransform%3Dmenu%3F.transformHandler%3Bif(!menu%7C%7C!bus%7C%7C!game%7C%7C!transform)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20find%20the%20active%20game's%20BuildMenu%2FEventBus.%20Run%20this%20inside%20a%20match.%22)%3Breturn%3B%7Dlet%20upgradeCtor%3Dnull%2CbuildCtor%3Dnull%2Cbusy%3Dfalse%2CbHeld%3Dfalse%2CmacroPointer%3Dfalse%3Bconst%20captureEvent%3D(bu%2Ctile)%3D%3E%7Blet%20captured%3Dnull%3Bconst%20originalEmit%3Dbus.emit%3Bconst%20originalHide%3Dmenu.hideMenu%3Btry%7Bbus.emit%3Dfunction(ev)%7Bcaptured%3Dev%3B%7D%3Bmenu.hideMenu%3Dfunction()%7B%7D%3Bmenu.sendBuildOrUpgrade(bu%2Ctile)%3B%7Dcatch(e)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20discover%20event%20type%3A%22%2Ce)%3B%7Dfinally%7Bbus.emit%3DoriginalEmit%3Bmenu.hideMenu%3DoriginalHide%3B%7Dreturn%20captured%3F.constructor%7C%7Cnull%3B%7D%3Bconst%20typing%3De%3D%3E%7Bconst%20t%3De.target%3Breturn!!(t%26%26(t.closest%3F.(%22input%2Ctextarea%2Cselect%2C%5Bcontenteditable%3D'true'%5D%22)%7C%7Ct.isContentEditable))%3B%7D%3Bconst%20keydown%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyB%22%7C%7Ctyping(e))return%3BbHeld%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20keyup%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyB%22)return%3BbHeld%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20blur%3D()%3D%3E%7BbHeld%3Dfalse%3BmacroPointer%3Dfalse%3Bbusy%3Dfalse%3B%7D%3Bconst%20pointerdown%3Dasync%20e%3D%3E%7Bif(e.button!%3D%3D0%7C%7C!bHeld%7C%7Ctyping(e))return%3Bif(!document.body.classList.contains(%22in-game%22))return%3Bif(!e.target%3F.closest%3F.(%22%23game-input-overlay%22))return%3BmacroPointer%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3Bif(busy)return%3Bbusy%3Dtrue%3Btry%7Bif(game.inSpawnPhase%3F.())return%3Bconst%20cell%3Dtransform.screenToWorldCoordinates(e.clientX%2Ce.clientY)%3Bif(!game.isValidCoord(cell.x%2Ccell.y))return%3Bconst%20tile%3Dgame.ref(cell.x%2Ccell.y)%3Bconst%20player%3Dgame.myPlayer%3F.()%3Bif(!player)return%3Bconst%20list%3Dawait%20player.buildables(tile)%3Bconst%20bu%3Dlist.find(x%3D%3Ex.type%3D%3D%3D%22Missile%20Silo%22)%3Bif(!bu)%7Bconsole.log(%22%5BOpenFront%5D%20Missile%20Silo%20is%20not%20available%20at%20this%20tile%22)%3Breturn%3B%7Dif(bu.canUpgrade!%3D%3Dfalse)%7BupgradeCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!upgradeCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20UpgradeStructureIntentEvent%22)%3Breturn%3B%7Dconst%20id%3Dbu.canUpgrade%3Bbus.emit(new%20upgradeCtor(id%2Cbu.type%2C50))%3Bconsole.log(%22%5BOpenFront%5D%20Missile%20Silo%20upgrade%3A%20up%20to%2050%20levels%22)%3B%7Delse%20if(bu.canBuild!%3D%3Dfalse)%7BbuildCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!buildCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20BuildUnitIntentEvent%22)%3Breturn%3B%7Dbus.emit(new%20buildCtor(bu.type%2Ctile))%3Bconsole.log(%22%5BOpenFront%5D%20Built%20Missile%20Silo%22)%3B%7Delse%7Bconsole.log(%22%5BOpenFront%5D%20Cannot%20build%20or%20upgrade%20Missile%20Silo%20here%22)%3B%7D%7Dcatch(err)%7Bconsole.error(%22%5BOpenFront%5D%20Missile%20Silo%20macro%20error%3A%22%2Cerr)%3B%7Dfinally%7Bbusy%3Dfalse%3B%7D%7D%3Bconst%20pointerup%3De%3D%3E%7Bif(!macroPointer)return%3BmacroPointer%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bwindow.addEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.addEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.addEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.addEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.addEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.addEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3Bwindow%5BKEY%5D%3D%7Bstop()%7Bwindow.removeEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.removeEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.removeEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.removeEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.removeEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.removeEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3B%7D%7D%3Bconsole.log(%22%5BOpenFront%5D%20Missile%20Silo%20macro%20ON%20%E2%80%94%20hold%20B%20%2B%20left%20click%22)%3B%7D)()%3B(()%3D%3E%7Bconst%20KEY%3D%22__of_city_macro__%22%2Cold%3Dwindow%5BKEY%5D%3Bif(old)%7Bold.stop()%3Bdelete%20window%5BKEY%5D%3Bconsole.log(%22%5BOpenFront%5D%20City%20macro%20OFF%22)%3Breturn%3B%7Dconst%20menu%3Ddocument.querySelector(%22build-menu%22)%2Cbus%3Dmenu%3F.eventBus%2Cgame%3Dmenu%3F.game%2Ctransform%3Dmenu%3F.transformHandler%3Bif(!menu%7C%7C!bus%7C%7C!game%7C%7C!transform)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20find%20the%20active%20game's%20BuildMenu%2FEventBus.%20Run%20this%20inside%20a%20match.%22)%3Breturn%3B%7Dlet%20upgradeCtor%3Dnull%2CbuildCtor%3Dnull%2Cbusy%3Dfalse%2CnHeld%3Dfalse%2CmacroPointer%3Dfalse%3Bconst%20captureEvent%3D(bu%2Ctile)%3D%3E%7Blet%20captured%3Dnull%3Bconst%20originalEmit%3Dbus.emit%3Bconst%20originalHide%3Dmenu.hideMenu%3Btry%7Bbus.emit%3Dfunction(ev)%7Bcaptured%3Dev%3B%7D%3Bmenu.hideMenu%3Dfunction()%7B%7D%3Bmenu.sendBuildOrUpgrade(bu%2Ctile)%3B%7Dcatch(e)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20discover%20event%20type%3A%22%2Ce)%3B%7Dfinally%7Bbus.emit%3DoriginalEmit%3Bmenu.hideMenu%3DoriginalHide%3B%7Dreturn%20captured%3F.constructor%7C%7Cnull%3B%7D%3Bconst%20typing%3De%3D%3E%7Bconst%20t%3De.target%3Breturn!!(t%26%26(t.closest%3F.(%22input%2Ctextarea%2Cselect%2C%5Bcontenteditable%3D'true'%5D%22)%7C%7Ct.isContentEditable))%3B%7D%3Bconst%20keydown%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyN%22%7C%7Ctyping(e))return%3BnHeld%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20keyup%3De%3D%3E%7Bif(e.code!%3D%3D%22KeyN%22)return%3BnHeld%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bconst%20blur%3D()%3D%3E%7BnHeld%3Dfalse%3BmacroPointer%3Dfalse%3Bbusy%3Dfalse%3B%7D%3Bconst%20pointerdown%3Dasync%20e%3D%3E%7Bif(e.button!%3D%3D0%7C%7C!nHeld%7C%7Ctyping(e))return%3Bif(!document.body.classList.contains(%22in-game%22))return%3Bif(!e.target%3F.closest%3F.(%22%23game-input-overlay%22))return%3BmacroPointer%3Dtrue%3Be.preventDefault()%3Be.stopImmediatePropagation()%3Bif(busy)return%3Bbusy%3Dtrue%3Btry%7Bif(game.inSpawnPhase%3F.())return%3Bconst%20cell%3Dtransform.screenToWorldCoordinates(e.clientX%2Ce.clientY)%3Bif(!game.isValidCoord(cell.x%2Ccell.y))return%3Bconst%20tile%3Dgame.ref(cell.x%2Ccell.y)%3Bconst%20player%3Dgame.myPlayer%3F.()%3Bif(!player)return%3Bconst%20list%3Dawait%20player.buildables(tile%2C%5B%22City%22%5D)%3Bconst%20bu%3Dlist.find(x%3D%3Ex.type%3D%3D%3D%22City%22)%3Bif(!bu)return%3Bif(bu.canUpgrade!%3D%3Dfalse)%7BupgradeCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!upgradeCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20UpgradeStructureIntentEvent%22)%3Breturn%3B%7Dconst%20id%3Dbu.canUpgrade%3Bbus.emit(new%20upgradeCtor(id%2Cbu.type%2C50))%3Bbus.emit(new%20upgradeCtor(id%2Cbu.type%2C50))%3Bconsole.log(%22%5BOpenFront%5D%20City%20upgrade%3A%20up%20to%20100%20levels%22)%3B%7Delse%20if(bu.canBuild!%3D%3Dfalse)%7BbuildCtor%3F%3F%3DcaptureEvent(bu%2Ctile)%3Bif(!buildCtor)%7Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20locate%20BuildUnitIntentEvent%22)%3Breturn%3B%7Dbus.emit(new%20buildCtor(bu.type%2Ctile))%3Bconsole.log(%22%5BOpenFront%5D%20Built%20City%22)%3B%7Delse%7Bconsole.log(%22%5BOpenFront%5D%20No%20valid%20City%20build%2Fupgrade%20here%22)%3B%7D%7Dcatch(err)%7Bconsole.error(%22%5BOpenFront%5D%20City%20macro%20error%3A%22%2Cerr)%3B%7Dfinally%7Bbusy%3Dfalse%3B%7D%7D%3Bconst%20pointerup%3De%3D%3E%7Bif(!macroPointer)return%3BmacroPointer%3Dfalse%3Be.preventDefault()%3Be.stopImmediatePropagation()%3B%7D%3Bwindow.addEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.addEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.addEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.addEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.addEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.addEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3Bwindow%5BKEY%5D%3D%7Bstop()%7Bwindow.removeEventListener(%22keydown%22%2Ckeydown%2Ctrue)%3Bwindow.removeEventListener(%22keyup%22%2Ckeyup%2Ctrue)%3Bwindow.removeEventListener(%22blur%22%2Cblur%2Ctrue)%3Bwindow.removeEventListener(%22pointerdown%22%2Cpointerdown%2Ctrue)%3Bwindow.removeEventListener(%22pointerup%22%2Cpointerup%2Ctrue)%3Bwindow.removeEventListener(%22pointercancel%22%2Cpointerup%2Ctrue)%3B%7D%7D%3Bconsole.log(%22%5BOpenFront%5D%20City%20macro%20ON%20%E2%80%94%20hold%20N%20%2B%20left%20click%22)%3B%7D)()%3B(()%3D%3E%7Bconst%20KEY%3D%22__of_sam_range_overlay__%22%3Bconst%20old%3Dwindow%5BKEY%5D%3Bif(old)%7Bold.stop()%3Breturn%3B%7Dif(!window.__openfrontNukeBatch_v2)return%3Bconst%20menu%3Ddocument.querySelector(%22build-menu%22)%3Bconst%20game%3Dmenu%3F.game%3Bconst%20transform%3Dmenu%3F.transformHandler%3Bconst%20config%3Dgame%3F.config%3F.()%3Bif(!game%7C%7Ctypeof%20game.units!%3D%3D%22function%22%7C%7Ctypeof%20game.ticks!%3D%3D%22function%22%7C%7Ctypeof%20game.isValidCoord!%3D%3D%22function%22%7C%7Ctypeof%20config%3F.samRange!%3D%3D%22function%22%7C%7Ctypeof%20transform%3F.worldToScreenCoordinates!%3D%3D%22function%22%7C%7Ctypeof%20transform%3F.screenToWorldCoordinates!%3D%3D%22function%22%7C%7Ctypeof%20transform%3F.boundingRect!%3D%3D%22function%22)%7Bconsole.error(%22%5BOpenFront%5D%20SAM%20overlay%20could%20not%20find%20the%20game's%20range%20or%20camera%20API.%22)%3Breturn%3B%7Dconst%20controller%3Dnew%20AbortController()%3Bconst%20options%3D%7Bcapture%3Atrue%2Csignal%3Acontroller.signal%7D%3Blet%20enabled%3Dfalse%3Blet%20stopped%3Dfalse%3Blet%20oPressed%3Dfalse%3Blet%20frame%3D0%3Blet%20canvas%3Dnull%3Blet%20context%3Dnull%3Blet%20cursorBadge%3Dnull%3Blet%20cursor%3Dnull%3Blet%20hasPlayer%3Dfalse%3Blet%20lastCountKey%3D%22%22%3Blet%20enemyLevels%3D0%3Blet%20sams%3D%5B%5D%3Blet%20lastTick%3Dnull%3Blet%20lastView%3D%22%22%3Bconst%20editing%3Devent%3D%3Eevent.composedPath().some(node%3D%3Enode%3F.isContentEditable%7C%7C%5B%22INPUT%22%2C%22TEXTAREA%22%2C%22SELECT%22%5D.includes(node%3F.tagName))%3Bconst%20inThisGame%3D()%3D%3Edocument.body.classList.contains(%22in-game%22)%26%26document.querySelector(%22build-menu%22)%3D%3D%3Dmenu%26%26menu.game%3D%3D%3Dgame%26%26menu.transformHandler%3D%3D%3Dtransform%3Bconst%20swallow%3Devent%3D%3E%7Bevent.preventDefault()%3Bevent.stopImmediatePropagation()%3B%7D%3Bfunction%20hide()%7Benabled%3Dfalse%3BcancelAnimationFrame(frame)%3Bframe%3D0%3Bcanvas%3F.remove()%3BcursorBadge%3F.remove()%3Bcanvas%3Dnull%3Bcontext%3Dnull%3BcursorBadge%3Dnull%3BlastCountKey%3D%22%22%3Bsams%3D%5B%5D%3BlastTick%3Dnull%3BlastView%3D%22%22%3B%7Dfunction%20stop()%7Bif(stopped)return%3Bstopped%3Dtrue%3Bhide()%3Bcontroller.abort()%3Bif(window%5BKEY%5D%3D%3D%3Dapi)delete%20window%5BKEY%5D%3Bconsole.info(%22%5BOpenFront%5D%20SAM%20range%20overlay%20removed%22)%3B%7Dfunction%20colorFor(sam%2Cme)%7Bconst%20owner%3Dsam.owner()%3Bif(!me)return%20owner.borderColor%3F.()%3F.toHex%3F.()%7C%7C%22%2367e8f9%22%3Bif(owner.id()%3D%3D%3Dme.id())return%22%234ade80%22%3Bif(me.isFriendly%3F.(owner)%7C%7Cme.isAlliedWith%3F.(owner)%7C%7Cme.isOnSameTeam%3F.(owner))return%22%23fde047%22%3Breturn%22%23fb7185%22%3B%7Dfunction%20isEnemy(sam%2Cme)%7Bif(!me)return%20false%3Bconst%20owner%3Dsam.owner()%3Breturn%20owner.id()!%3D%3Dme.id()%26%26!(me.isFriendly%3F.(owner)%7C%7Cme.isAlliedWith%3F.(owner)%7C%7Cme.isOnSameTeam%3F.(owner))%3B%7Dfunction%20clearCursor()%7Bcursor%3Dnull%3Bif(cursorBadge)cursorBadge.hidden%3Dtrue%3B%7Dfunction%20updateCursorLevels(rect%2Ctick)%7Bif(!cursorBadge)return%3Bif(!cursor%7C%7C!hasPlayer%7C%7Ccursor.x%3Crect.left%7C%7Ccursor.y%3Crect.top%7C%7Ccursor.x%3E%3Drect.left%2Brect.width%7C%7Ccursor.y%3E%3Drect.top%2Brect.height)%7BcursorBadge.hidden%3Dtrue%3Breturn%3B%7Dconst%20hit%3Ddocument.elementFromPoint(cursor.x%2Ccursor.y)%3Bif(!hit%3F.closest%3F.(%22%23game-input-overlay%22)%26%26hit%3F.tagName!%3D%3D%22CANVAS%22)%7BcursorBadge.hidden%3Dtrue%3Breturn%3B%7Dconst%20tile%3Dtransform.screenToWorldCoordinates(cursor.x%2Ccursor.y)%3Bif(!game.isValidCoord(tile.x%2Ctile.y))%7BcursorBadge.hidden%3Dtrue%3Breturn%3B%7Dconst%20key%3D%5Btick%2Ctile.x%2Ctile.y%5D.join(%22%2C%22)%3Bif(key!%3D%3DlastCountKey)%7BlastCountKey%3Dkey%3BenemyLevels%3D0%3Bfor(const%20sam%20of%20sams)%7Bif(!sam.enemy%7C%7C!sam.completed%7C%7C!(sam.current%3E0))continue%3Bconst%20dx%3Dtile.x-sam.x%3Bconst%20dy%3Dtile.y-sam.y%3Bif(dx*dx%2Bdy*dy%3C%3Dsam.current*sam.current)enemyLevels%2B%3Dsam.level%3B%7DcursorBadge.textContent%3DString(enemyLevels)%3B%7Dconst%20width%3DMath.max(22%2C10%2BString(enemyLevels).length*8)%3Blet%20left%3Dcursor.x%2B14%3Blet%20top%3Dcursor.y%2B18%3Bif(left%2Bwidth%3Ewindow.innerWidth-6)left%3Dcursor.x-width-14%3Bif(top%2B20%3Ewindow.innerHeight-6)top%3Dcursor.y-32%3BcursorBadge.style.left%3DMath.max(6%2Cleft)%2B%22px%22%3BcursorBadge.style.top%3DMath.max(6%2Ctop)%2B%22px%22%3BcursorBadge.hidden%3Dfalse%3B%7Dfunction%20rangesFor(sam%2Ctick)%7Bconst%20level%3Dsam.level()%3Bconst%20upgrade%3Dsam.samLauncherState%3F.()%3Bconst%20state%3Dsam.state%3Bconst%20startTick%3Dupgrade%3F.upgradeStartTick%3F%3Fstate%3F.samUpgradeStartTick%3Bconst%20duration%3Dupgrade%3F.duration%3F%3Fstate%3F.samUpgradeDuration%3F%3Fconfig.samUpgradeDuration%3F.()%3Bconst%20startRange%3Dupgrade%3F.startRange%3F%3Fstate%3F.samUpgradeStartRange%3Bconst%20targetLevel%3Dupgrade%3F.targetLevel%3F%3Fstate%3F.samUpgradeTargetLevel%3F%3Flevel%3Bconst%20target%3Dconfig.samRange(targetLevel)%3Bif(Number.isFinite(startTick)%26%26Number.isFinite(duration)%26%26duration%3E0%26%26Number.isFinite(startRange))%7Bconst%20progress%3DMath.max(0%2CMath.min(1%2C(tick-startTick)%2Fduration))%3Bconst%20current%3DstartRange%2B(target-startRange)*progress%3Breturn%7Bcurrent%2Cpreview%3Aprogress%3C1%26%26target%3Ecurrent%3Ftarget%3A0%7D%3B%7Dif(sam.isUnderConstruction%3F.())return%7Bcurrent%3A0%2Cpreview%3Atarget%7D%3Breturn%7Bcurrent%3Aconfig.samRange(level)%2Cpreview%3A0%7D%3B%7Dfunction%20circle(x%2Cy%2Cradius%2Ccolor%2Cpreview%2Cwidth%2Cheight)%7Bif(!Number.isFinite(radius)%7C%7Cradius%3C%3D0%7C%7Cx%2Bradius%3C0%7C%7Cy%2Bradius%3C0%7C%7Cx-radius%3Ewidth%7C%7Cy-radius%3Eheight)return%3Bcontext.beginPath()%3Bcontext.arc(x%2Cy%2Cradius%2C0%2CMath.PI*2)%3Bcontext.setLineDash(preview%3F%5B6%2C4%5D%3A%5B%5D)%3Bcontext.globalAlpha%3Dpreview%3F0.55%3A0.9%3Bcontext.lineWidth%3D3.5%3Bcontext.strokeStyle%3D%22rgba(0%2C0%2C0%2C0.65)%22%3Bcontext.stroke()%3Bcontext.lineWidth%3D1.5%3Bcontext.strokeStyle%3Dcolor%3Bcontext.stroke()%3B%7Dfunction%20paint()%7Bconst%20rect%3Dtransform.boundingRect()%3Bconst%20scale%3Dtransform.scale%3Bconst%20dpr%3Dwindow.devicePixelRatio%7C%7C1%3Bif(rect.width%3C%3D0%7C%7Crect.height%3C%3D0%7C%7C!(scale%3E0))%7Bcontext.clearRect(0%2C0%2Ccanvas.width%2Ccanvas.height)%3Bif(cursorBadge)cursorBadge.hidden%3Dtrue%3BlastView%3D%22%22%3Breturn%3B%7Dconst%20tick%3Dgame.ticks()%3Bif(tick!%3D%3DlastTick)%7Bconst%20me%3Dgame.myPlayer%3F.()%3BhasPlayer%3D!!me%3Bsams%3Dgame.units(%22SAM%20Launcher%22).filter(sam%3D%3Esam.isActive()).map(sam%3D%3E%7Bconst%20tile%3Dsam.tile()%3Breturn%7Bx%3Agame.x(tile)%2Cy%3Agame.y(tile)%2Ccolor%3AcolorFor(sam%2Cme)%2Clevel%3Asam.level()%2Cenemy%3AisEnemy(sam%2Cme)%2Ccompleted%3A!sam.isUnderConstruction%3F.()%2C...rangesFor(sam%2Ctick)%7D%3B%7D)%3BlastTick%3Dtick%3BlastCountKey%3D%22%22%3B%7DupdateCursorLevels(rect%2Ctick)%3Bconst%20origin%3Dtransform.worldToScreenCoordinates(%7Bx%3A0%2Cy%3A0%7D)%3Bconst%20view%3D%5Btick%2Corigin.x%2Corigin.y%2Cscale%2Crect.left%2Crect.top%2Crect.width%2Crect.height%2Cdpr%5D.join(%22%2C%22)%3Bif(view%3D%3D%3DlastView)return%3BlastView%3Dview%3Bconst%20pixelWidth%3DMath.max(1%2CMath.round(rect.width*dpr))%3Bconst%20pixelHeight%3DMath.max(1%2CMath.round(rect.height*dpr))%3Bif(canvas.width!%3D%3DpixelWidth)canvas.width%3DpixelWidth%3Bif(canvas.height!%3D%3DpixelHeight)canvas.height%3DpixelHeight%3BObject.assign(canvas.style%2C%7Bleft%3Arect.left%2B%22px%22%2Ctop%3Arect.top%2B%22px%22%2Cwidth%3Arect.width%2B%22px%22%2Cheight%3Arect.height%2B%22px%22%7D)%3Bcontext.setTransform(dpr%2C0%2C0%2Cdpr%2C0%2C0)%3Bcontext.clearRect(0%2C0%2Crect.width%2Crect.height)%3Bfor(const%20sam%20of%20sams)%7Bconst%20x%3Dorigin.x-rect.left%2Bsam.x*scale%3Bconst%20y%3Dorigin.y-rect.top%2Bsam.y*scale%3Bcircle(x%2Cy%2Csam.current*scale%2Csam.color%2Cfalse%2Crect.width%2Crect.height)%3Bcircle(x%2Cy%2Csam.preview*scale%2Csam.color%2Ctrue%2Crect.width%2Crect.height)%3B%7D%7Dfunction%20draw()%7Bframe%3D0%3Bif(!enabled%7C%7Cstopped)return%3Bif(!inThisGame())%7Bstop()%3Breturn%3B%7Dif(document.hidden)return%3Btry%7Bpaint()%3B%7Dcatch(error)%7Bhide()%3Bconsole.error(%22%5BOpenFront%5D%20SAM%20overlay%20stopped%3A%22%2Cerror)%3Breturn%3B%7Dframe%3DrequestAnimationFrame(draw)%3B%7Dfunction%20toggle()%7Bif(stopped)return%3Bif(enabled)%7Bhide()%3Bconsole.info(%22%5BOpenFront%5D%20Individual%20SAM%20ranges%20OFF%22)%3Breturn%3B%7Dif(!inThisGame())%7Bstop()%3Breturn%3B%7Dcanvas%3Ddocument.createElement(%22canvas%22)%3Bcanvas.id%3D%22of-individual-sam-ranges%22%3Bcanvas.setAttribute(%22aria-hidden%22%2C%22true%22)%3BObject.assign(canvas.style%2C%7Bposition%3A%22fixed%22%2CpointerEvents%3A%22none%22%2CzIndex%3A%221%22%7D)%3Bcontext%3Dcanvas.getContext(%222d%22)%3Bif(!context)%7Bhide()%3Bconsole.error(%22%5BOpenFront%5D%20Could%20not%20create%20the%20SAM%20overlay%20canvas.%22)%3Breturn%3B%7Dconst%20input%3Ddocument.getElementById(%22game-input-overlay%22)%3Bif(input%3F.parentElement%3D%3D%3Ddocument.body)input.before(canvas)%3Belse%20document.body.appendChild(canvas)%3BcursorBadge%3Ddocument.createElement(%22span%22)%3BcursorBadge.id%3D%22of-enemy-sam-count%22%3BcursorBadge.setAttribute(%22aria-hidden%22%2C%22true%22)%3BcursorBadge.textContent%3D%220%22%3BcursorBadge.hidden%3Dtrue%3BObject.assign(cursorBadge.style%2C%7Bposition%3A%22fixed%22%2CpointerEvents%3A%22none%22%2CuserSelect%3A%22none%22%2CzIndex%3A%2210000%22%2Ccolor%3A%22%23fff%22%2Cbackground%3A%22rgba(15%2C23%2C42%2C0.9)%22%2Cfont%3A%22600%2012px%2F16px%20ui-monospace%2C%20SFMono-Regular%2C%20Consolas%2C%20monospace%22%2Cpadding%3A%221px%204px%22%2Cborder%3A%221px%20solid%20rgba(255%2C255%2C255%2C0.35)%22%2CborderRadius%3A%223px%22%2CboxSizing%3A%22border-box%22%2CwhiteSpace%3A%22nowrap%22%7D)%3Bdocument.body.appendChild(cursorBadge)%3Benabled%3Dtrue%3BlastTick%3Dnull%3BlastView%3D%22%22%3Bdraw()%3Bif(enabled)console.info(%22%5BOpenFront%5D%20Individual%20SAM%20ranges%20ON%22)%3B%7Dconst%20api%3D%7Bstop%2Ctoggle%2Cget%20enabled()%7Breturn%20enabled%3B%7D%7D%3Bwindow%5BKEY%5D%3Dapi%3Bwindow.addEventListener(%22pointermove%22%2Cevent%3D%3E%7Bif(event.pointerType%3D%3D%3D%22touch%22)%7BclearCursor()%3Breturn%3B%7Dcursor%3D%7Bx%3Aevent.clientX%2Cy%3Aevent.clientY%7D%3B%7D%2C%7B...options%2Cpassive%3Atrue%7D)%3Bwindow.addEventListener(%22pointerout%22%2Cevent%3D%3E%7Bif(!event.relatedTarget)clearCursor()%3B%7D%2Coptions)%3Bwindow.addEventListener(%22keydown%22%2Cevent%3D%3E%7Bif(event.code!%3D%3D%22KeyO%22%7C%7Cevent.ctrlKey%7C%7Cevent.altKey%7C%7Cevent.metaKey%7C%7Cevent.isComposing%7C%7Cediting(event))return%3Bswallow(event)%3Bif(event.repeat%7C%7CoPressed)return%3BoPressed%3Dtrue%3Btoggle()%3B%7D%2Coptions)%3Bwindow.addEventListener(%22keyup%22%2Cevent%3D%3E%7Bif(event.code!%3D%3D%22KeyO%22%7C%7C!oPressed)return%3BoPressed%3Dfalse%3Bswallow(event)%3B%7D%2Coptions)%3Bwindow.addEventListener(%22blur%22%2C()%3D%3E%7BoPressed%3Dfalse%3BclearCursor()%3B%7D%2Coptions)%3Bdocument.addEventListener(%22visibilitychange%22%2C()%3D%3E%7BoPressed%3Dfalse%3BclearCursor()%3Bif(!enabled)return%3BcancelAnimationFrame(frame)%3Bframe%3D0%3Bif(!document.hidden)%7BlastTick%3Dnull%3BlastView%3D%22%22%3Bdraw()%3B%7D%7D%2C%7Bsignal%3Acontroller.signal%7D)%3Bconsole.info(%22%5BOpenFront%5D%20Press%20O%20for%20SAM%20ranges%20and%20total%20enemy%20SAM%20levels%20by%20the%20cursor%22)%3B%7D)()%3B(()%3D%3E%7Bconst%20KEY%3D%22__of_convoy_interceptor__%22%3Bconst%20old%3Dwindow%5BKEY%5D%3Bif(old)%7Bold.stop()%3Breturn%3B%7Dconst%20master%3Dwindow.__openfrontNukeBatch_v2%3Bif(!master%7C%7Cmaster.signal.aborted)return%3Bconst%20SCAN_MS%3D5000%2CTOAST_MS%3D3000%2CCOMMAND_DELAY_TICKS%3D2%3Bconst%20TYPE%3D%22Atom%20Bomb%22%2CSHIP%3D%22Transport%22%2CSILO%3D%22Missile%20Silo%22%3Bconst%20menu%3Ddocument.querySelector(%22build-menu%22)%3Bconst%20game%3Dmenu%3F.game%2Cbus%3Dmenu%3F.eventBus%2Cconfig%3Dgame%3F.config%3F.()%3Bif(!game%7C%7C!bus%7C%7Ctypeof%20menu.sendBuildOrUpgrade!%3D%3D%22function%22%7C%7C!%5B%22units%22%2C%22ticks%22%2C%22x%22%2C%22y%22%2C%22ref%22%2C%22isValidCoord%22%2C%22height%22%2C%22width%22%5D.every(name%3D%3Etypeof%20game%5Bname%5D%3D%3D%3D%22function%22))%7Bconsole.error(%22%5BOpenFront%5D%20Convoy%20interceptor%3A%20game%20API%20unavailable.%22)%3Breturn%3B%7Dlet%20captured%3Btry%7Bmenu.sendBuildOrUpgrade.call(%7BeventBus%3A%7Bemit(event)%7Bcaptured%3Devent%3B%7D%7D%2CuiState%3A%7BrocketDirectionUp%3Atrue%7D%2ChideMenu()%7B%7D%7D%2C%7Btype%3ATYPE%2CcanBuild%3Atrue%2CcanUpgrade%3Afalse%7D%2C0)%3B%7Dcatch(error)%7Bconsole.error(%22%5BOpenFront%5D%20Convoy%20interceptor%20setup%3A%22%2Cerror)%3Breturn%3B%7Dif(captured%3F.unit!%3D%3DTYPE)return%3Bconst%20BuildEvent%3Dcaptured.constructor%3Bconst%20controller%3Dnew%20AbortController()%3Bconst%20options%3D%7Bcapture%3Atrue%2Csignal%3Acontroller.signal%7D%3Bconst%20samples%3Dnew%20Map()%2Cchecks%3Dnew%20Map()%3Blet%20enabled%3Dfalse%2Cstopped%3Dfalse%2CiPressed%3Dfalse%2Cgeneration%3D0%3Blet%20interval%3Dnull%2CtoastTimer%3Dnull%2Ctoast%3Dnull%2CactiveScan%3Dnull%3Blet%20lastScanTick%3Dnull%3Bconst%20editing%3Devent%3D%3Eevent.composedPath().some(node%3D%3Enode%3F.isContentEditable%7C%7C%5B%22INPUT%22%2C%22TEXTAREA%22%2C%22SELECT%22%5D.includes(node%3F.tagName))%3Bconst%20swallow%3Devent%3D%3E%7Bevent.preventDefault()%3Bevent.stopImmediatePropagation()%3B%7D%3Bconst%20inThisGame%3D()%3D%3Edocument.body.classList.contains(%22in-game%22)%26%26document.querySelector(%22build-menu%22)%3D%3D%3Dmenu%26%26menu.game%3D%3D%3Dgame%3Bconst%20usable%3D()%3D%3EinThisGame()%26%26!game.inSpawnPhase%3F.()%26%26!game.isPaused%3F.()%26%26!game.isCatchingUp%3F.()%3Bconst%20validRun%3Drun%3D%3E!stopped%26%26enabled%26%26generation%3D%3D%3Drun%26%26usable()%3Bconst%20xy%3Dtile%3D%3E(%7Bx%3Agame.x(tile)%2Cy%3Agame.y(tile)%7D)%3Bconst%20distance%3D(a%2Cb)%3D%3EMath.hypot(a.x-b.x%2Ca.y-b.y)%3Bconst%20clamp%3D(n%2Clo%2Chi)%3D%3EMath.max(lo%2CMath.min(hi%2Cn))%3Bfunction%20isEnemy(ship%2Cme)%7Bconst%20owner%3Dship.owner()%3Breturn%20owner%26%26owner.id()!%3D%3Dme.id()%26%26!(me.isFriendly%3F.(owner)%7C%7Cme.isAlliedWith%3F.(owner)%7C%7Cme.isOnSameTeam%3F.(owner))%3B%7Dfunction%20notify(message)%7BclearTimeout(toastTimer)%3Btoast%3F.remove()%3Btoast%3Ddocument.createElement(%22div%22)%3Btoast.id%3D%22of-convoy-interceptor-toast%22%3Btoast.setAttribute(%22role%22%2C%22status%22)%3Btoast.setAttribute(%22aria-live%22%2C%22polite%22)%3Btoast.textContent%3Dmessage%3BObject.assign(toast.style%2C%7Bposition%3A%22fixed%22%2Ctop%3A%2270px%22%2Cleft%3A%2250%25%22%2Ctransform%3A%22translateX(-50%25)%22%2CpointerEvents%3A%22none%22%2CuserSelect%3A%22none%22%2CzIndex%3A%222147483647%22%2Cpadding%3A%2210px%2016px%22%2CborderRadius%3A%228px%22%2Ccolor%3A%22%23fff%22%2Cbackground%3A%22rgba(15%2C23%2C42%2C0.94)%22%2Cborder%3A%221px%20solid%20rgba(255%2C255%2C255%2C0.3)%22%2CboxShadow%3A%220%203px%2015px%20rgba(0%2C0%2C0%2C0.35)%22%2Cfont%3A%22600%2014px%2F1.4%20system-ui%2C%20sans-serif%22%2CtextAlign%3A%22center%22%2CmaxWidth%3A%22calc(100vw%20-%2040px)%22%7D)%3Bdocument.body.appendChild(toast)%3BtoastTimer%3DsetTimeout(()%3D%3E%7Btoast%3F.remove()%3Btoast%3Dnull%3BtoastTimer%3Dnull%3B%7D%2CTOAST_MS)%3B%7Dfunction%20checkBuildable(me%2Ctile)%7Breturn%20new%20Promise(resolve%3D%3E%7Bconst%20timer%3DsetTimeout(()%3D%3Efinish(null)%2C2000)%3Bconst%20finish%3Dvalue%3D%3E%7Bif(!checks.has(timer))return%3Bchecks.delete(timer)%3BclearTimeout(timer)%3Bresolve(value)%3B%7D%3Bchecks.set(timer%2Cfinish)%3BPromise.resolve().then(()%3D%3Eme.buildables(tile%2C%5BTYPE%5D)).then(list%3D%3Efinish(list%3F.find(item%3D%3Eitem.type%3D%3D%3DTYPE)%3F%3Fnull)%2Cerror%3D%3E%7Bconsole.warn(%22%5BOpenFront%5D%20Convoy%20build%20check%3A%22%2Cerror)%3Bfinish(null)%3B%7D)%3B%7D)%3B%7Dfunction%20disable()%7Benabled%3Dfalse%3Bgeneration%2B%2B%3BclearInterval(interval)%3Binterval%3Dnull%3BactiveScan%3Dnull%3Bfor(const%20finish%20of%5B...checks.values()%5D)finish(null)%3Bsamples.clear()%3BlastScanTick%3Dnull%3B%7Dfunction%20stop()%7Bif(stopped)return%3Bstopped%3Dtrue%3Bdisable()%3BclearTimeout(toastTimer)%3BtoastTimer%3Dnull%3Btoast%3F.remove()%3Btoast%3Dnull%3Bcontroller.abort()%3Bif(window%5BKEY%5D%3D%3D%3Dapi)delete%20window%5BKEY%5D%3B%7Dfunction%20flightTicks(from%2Cto%2CdirectionUp)%7Bconst%20speed%3Dtypeof%20config%3F.nukeSpeed%3D%3D%3D%22function%22%3Fconfig.nukeSpeed(TYPE)%3A10%3Bif(!(speed%3E0)%7C%7C!Number.isFinite(speed))throw%20new%20Error(%22Invalid%20nuke%20speed%22)%3Bconst%20dx%3Dto.x-from.x%2Cdy%3Dto.y-from.y%3Bconst%20height%3DMath.max(Math.hypot(dx%2Cdy)%2F3%2C50)*(directionUp%3F-1%3A1)%3Bconst%20fixed%3Dn%3D%3EMath.round(n)*256%3Bconst%20p%3D%5Bfixed(from.x)%2Cfixed(from.y)%2Cfixed(from.x%2Bdx%2F4)%2Cfixed(clamp(from.y%2Bdy%2F4%2Bheight%2C0%2Cgame.height()-1))%2Cfixed(from.x%2B3*dx%2F4)%2Cfixed(clamp(from.y%2B3*dy%2F4%2Bheight%2C0%2Cgame.height()-1))%2Cfixed(to.x)%2Cfixed(to.y)%5D%3Bconst%20spacing%3DMath.max(256%2CMath.round(speed*256))%3Blet%20lastX%3Dp%5B0%5D%2ClastY%3Dp%5B1%5D%2Caccumulated%3D0%2Cpoints%3D1%3Blet%20endX%3Dfrom.x%2CendY%3Dfrom.y%3Bfunction%20subdivide(ax%2Cay%2Cbx%2Cby%2Ccx%2Ccy%2Cdx%2Cdy%2Cdepth)%7Bconst%20length%3DMath.abs(bx-ax)%2BMath.abs(by-ay)%2BMath.abs(cx-bx)%2BMath.abs(cy-by)%2BMath.abs(dx-cx)%2BMath.abs(dy-cy)%3Bif(length%3C%3D256%7C%7Cdepth%3E%3D10)%7Bconst%20ex%3Dax-lastX%2Cey%3Day-lastY%3Baccumulated%2B%3DMath.floor(Math.sqrt(ex*ex%2Bey*ey))%3BlastX%3Dax%3BlastY%3Day%3Bconst%20steps%3DMath.floor(accumulated%2Fspacing)%3Bif(steps%3E0)%7Bpoints%2B%3Dsteps%3Baccumulated-%3Dsteps*spacing%3BendX%3D(ax%2B128)%3E%3E8%3BendY%3D(ay%2B128)%3E%3E8%3B%7Dreturn%3B%7Dconst%20abx%3D(ax%2Bbx)%3E%3E1%2Caby%3D(ay%2Bby)%3E%3E1%3Bconst%20bcx%3D(bx%2Bcx)%3E%3E1%2Cbcy%3D(by%2Bcy)%3E%3E1%3Bconst%20cdx%3D(cx%2Bdx)%3E%3E1%2Ccdy%3D(cy%2Bdy)%3E%3E1%3Bconst%20abcx%3D(abx%2Bbcx)%3E%3E1%2Cabcy%3D(aby%2Bbcy)%3E%3E1%3Bconst%20bcdx%3D(bcx%2Bcdx)%3E%3E1%2Cbcdy%3D(bcy%2Bcdy)%3E%3E1%3Bconst%20mx%3D(abcx%2Bbcdx)%3E%3E1%2Cmy%3D(abcy%2Bbcdy)%3E%3E1%3Bsubdivide(ax%2Cay%2Cabx%2Caby%2Cabcx%2Cabcy%2Cmx%2Cmy%2Cdepth%2B1)%3Bsubdivide(mx%2Cmy%2Cbcdx%2Cbcdy%2Ccdx%2Ccdy%2Cdx%2Cdy%2Cdepth%2B1)%3B%7Dsubdivide(...p%2C0)%3Bif(endX!%3D%3Dto.x%7C%7CendY!%3D%3Dto.y)points%2B%2B%3Breturn%20Math.max(1%2CMath.ceil((points-1)*spacing%2FMath.max(1%2CMath.round(speed*256))))%3B%7Dfunction%20motionFor(ship%2Cpast%2Ctick)%7Bconst%20plan%3Dgame.motionPlans%3F.()%3F.get(ship.id())%3Bif(plan%3F.path%3F.length%3E1%26%26Number.isFinite(plan.startTick)%26%26plan.ticksPerStep%3E%3D1)%7Bconst%20end%3Dplan.startTick%2B(plan.path.length-1)*plan.ticksPerStep%3Breturn%7Bmethod%3A%22route%22%2Cend%2Cat(time)%7Bif(time%3E%3Dend)return%20null%3Bconst%20i%3Dclamp(Math.floor((time-plan.startTick)%2Fplan.ticksPerStep)%2C0%2Cplan.path.length-1)%3Breturn%20xy(plan.path%5Bi%5D)%3B%7D%7D%3B%7Dconst%20pos%3Dxy(ship.tile())%3Blet%20vx%2Cvy%3Bconst%20previousTile%3Dship.state%3F.lastPos%3Bif(Number.isInteger(previousTile)%26%26previousTile%3E%3D0%26%26previousTile%3Cgame.width()*game.height())%7Bconst%20prev%3Dxy(previousTile)%3Bvx%3Dpos.x-prev.x%3Bvy%3Dpos.y-prev.y%3B%7Delse%20if(past%26%26tick%3Epast.tick)%7Bvx%3D(pos.x-past.x)%2F(tick-past.tick)%3Bvy%3D(pos.y-past.y)%2F(tick-past.tick)%3B%7Delse%7Breturn%20null%3B%7Dif(!Number.isFinite(vx)%7C%7C!Number.isFinite(vy)%7C%7CMath.hypot(vx%2Cvy)%3E4)return%20null%3Blet%20end%3DInfinity%3Bconst%20destination%3Dship.targetTile%3F.()%3Bconst%20speed2%3Dvx*vx%2Bvy*vy%3Bif(Number.isInteger(destination)%26%26speed2%3E0)%7Bconst%20dest%3Dxy(destination)%2Cdx%3Ddest.x-pos.x%2Cdy%3Ddest.y-pos.y%3Bconst%20along%3D(dx*vx%2Bdy*vy)%2Fspeed2%3Bconst%20sideways%3DMath.abs(dx*vy-dy*vx)%2FMath.sqrt(speed2)%3Bif(along%3E%3D0%26%26sideways%3C%3D2)end%3Dtick%2Balong%3B%7Dreturn%7Bmethod%3A%22velocity%22%2Cend%2Cat(time)%7Bif(time%3E%3Dend)return%20null%3Breturn%7Bx%3Apos.x%2Bvx*(time-tick)%2Cy%3Apos.y%2Bvy*(time-tick)%7D%3B%7D%7D%3B%7Dfunction%20siloSnapshot(me)%7Breturn%20me.units(SILO).filter(unit%3D%3Eunit.isActive()%26%26!unit.isUnderConstruction()).map(unit%3D%3E(%7Bunit%2Ctile%3Aunit.tile()%2C...xy(unit.tile())%2Clevel%3Aunit.level()%2Cqueue%3A%5B...unit.missileTimerQueue()%5D%7D))%3B%7Dfunction%20nearestSilo(silos%2Cpoint)%7Blet%20best%3Dnull%2CbestDistance%3DInfinity%3Bfor(const%20silo%20of%20silos)%7Bif(silo.queue.length%3E%3Dsilo.level%7C%7C!silo.unit.isActive()%7C%7Csilo.unit.isUnderConstruction())continue%3Bconst%20d%3DMath.abs(silo.x-point.x)%2BMath.abs(silo.y-point.y)%3Bif(d%3CbestDistance)%7Bbest%3Dsilo%3BbestDistance%3Dd%3B%7D%7Dreturn%20best%3B%7Dfunction%20departureTick(queue%2CrequestTick)%7Blet%20last%3D0%3Bfor(const%20launchTick%20of%20queue)last%3DMath.max(launchTick%2B1%2Clast%2B1)%3Breturn%20Math.max(requestTick%2Clast)%3B%7Dfunction%20intercept(ship%2Cpast%2Csilos%2CdirectionUp)%7Bconst%20tick%3Dgame.ticks()%2CrequestTick%3Dtick%2BCOMMAND_DELAY_TICKS%3Bconst%20motion%3DmotionFor(ship%2Cpast%2Ctick)%3Bif(!motion%7C%7Cmotion.end%3C%3DrequestTick%2B1)return%20null%3Blet%20time%3DrequestTick%2B1%2Cbest%3Dnull%3Bfor(let%20i%3D0%3Bi%3C18%3Bi%2B%2B)%7Bconst%20point%3Dmotion.at(Math.min(time%2Cmotion.end-1))%3Bif(!point)break%3Bconst%20target%3D%7Bx%3AMath.round(point.x)%2Cy%3AMath.round(point.y)%7D%3Bif(!game.isValidCoord(target.x%2Ctarget.y))break%3Bconst%20tile%3Dgame.ref(target.x%2Ctarget.y)%3Bif(game.isImpassable%3F.(tile)%7C%7C(typeof%20game.isWater%3D%3D%3D%22function%22%26%26!game.isWater(tile)))break%3Bconst%20silo%3DnearestSilo(silos%2Ctarget)%3Bif(!silo)return%20null%3Bconst%20arrival%3DdepartureTick(silo.queue%2CrequestTick)%2BflightTicks(silo%2Ctarget%2CdirectionUp)%3Bconst%20future%3Dmotion.at(arrival)%3Bif(future)%7Bconst%20miss%3Ddistance(target%2Cfuture)%3Bif(!best%7C%7Cmiss%3Cbest.miss)best%3D%7Btile%2Ctarget%2Csilo%2CrequestTick%2Carrival%2Cmiss%2CdirectionUp%2Cmethod%3Amotion.method%7D%3Bif(miss%3C%3D1)return%20best%3B%7Dif(time%3D%3D%3Darrival)break%3Btime%3Darrival%3B%7Dreturn%20best%26%26best.miss%3C%3D2%3Fbest%3Anull%3B%7Dasync%20function%20scan()%7Bif(stopped%7C%7C!enabled%7C%7CactiveScan)return%3Bif(!inThisGame())%7Bstop()%3Breturn%3B%7Dif(!usable())return%3Bconst%20me%3Dgame.myPlayer%3F.()%3Bif(!me%7C%7Cme.isAlive%3F.()%3D%3D%3Dfalse%7C%7Ctypeof%20me.buildables!%3D%3D%22function%22)return%3Bconst%20tick%3Dgame.ticks()%3Bif(tick%3D%3D%3DlastScanTick)return%3BlastScanTick%3Dtick%3Bconst%20run%3Dgeneration%2CscanId%3D%7B%7D%3BactiveScan%3DscanId%3Btry%7Bconst%20attempted%3Dnew%20Set()%3Bconst%20ships%3Dgame.units(SHIP).filter(ship%3D%3Eship.isActive())%3Bconst%20live%3Dnew%20Set(ships.map(ship%3D%3Eship.id()))%3Bfor(const%20id%20of%20samples.keys())if(!live.has(id))samples.delete(id)%3Bconst%20previous%3Dnew%20Map(samples)%3Bfor(const%20ship%20of%20ships)samples.set(ship.id()%2C%7B...xy(ship.tile())%2Ctick%7D)%3Bconst%20silos%3DsiloSnapshot(me)%3Blet%20budget%3DBigInt(me.gold())%3Bfor(const%20ship%20of%20ships)%7Bif(!validRun(run)%7C%7Cgame.myPlayer%3F.()%3F.id()!%3D%3Dme.id())break%3Bif(attempted.has(ship.id())%7C%7C!ship.isActive()%7C%7C!isEnemy(ship%2Cme))continue%3Bfor(let%20retry%3D0%3Bretry%3C3%3Bretry%2B%2B)%7Bconst%20directionUp%3Dmenu.uiState%3F.rocketDirectionUp!%3D%3Dfalse%3Bconst%20aim%3Dintercept(ship%2Cprevious.get(ship.id())%2Csilos%2CdirectionUp)%3Bif(!aim)break%3Bconst%20buildable%3Dawait%20checkBuildable(me%2Caim.tile)%3Bif(!validRun(run)%7C%7Cgame.myPlayer%3F.()%3F.id()!%3D%3Dme.id())return%3Bif(!ship.isActive()%7C%7C!isEnemy(ship%2Cme)%7C%7Cme.isAlive%3F.()%3D%3D%3Dfalse)break%3Bif(!buildable%7C%7Cbuildable.canBuild%3D%3D%3Dfalse%7C%7C!Number.isInteger(buildable.canBuild))break%3Bif((menu.uiState%3F.rocketDirectionUp!%3D%3Dfalse)!%3D%3DdirectionUp)continue%3Bconst%20fresh%3Dintercept(ship%2Cprevious.get(ship.id())%2Csilos%2CdirectionUp)%3Bif(!fresh)break%3Bif(fresh.tile!%3D%3Daim.tile%7C%7Cfresh.silo.tile!%3D%3Daim.silo.tile)continue%3Bif(buildable.canBuild!%3D%3Dfresh.silo.tile)break%3Bconst%20cost%3DBigInt(buildable.cost)%3Bif(cost%3Ebudget)break%3Bconst%20request%3Dnew%20BuildEvent(TYPE%2Cfresh.tile%2Cfresh.directionUp%2C1)%3Brequest.amount%3D1%3Bbus.emit(request)%3Battempted.add(ship.id())%3Bbudget-%3Dcost%3Bfresh.silo.queue.push(fresh.requestTick)%3Bconsole.info(%22%5BOpenFront%5D%20Convoy%20nuke%20request%22%2C%7Bconvoy%3Aship.id()%2Ctile%3Afresh.tile%2Csilo%3Afresh.silo.unit.id()%2CpredictedImpactTick%3Afresh.arrival%2Cprediction%3Afresh.method%2CrocketDirectionUp%3Afresh.directionUp%2Camount%3A1%7D)%3Bbreak%3B%7D%7D%7Dcatch(error)%7Bif(generation%3D%3D%3Drun%26%26enabled%26%26!stopped)%7Bdisable()%3Bnotify(%22Convoy%20auto-nuke%20OFF%20%E2%80%94%20game%20data%20unavailable%22)%3Bconsole.error(%22%5BOpenFront%5D%20Convoy%20interceptor%20stopped%3A%22%2Cerror)%3B%7D%7Dfinally%7Bif(activeScan%3D%3D%3DscanId)activeScan%3Dnull%3B%7D%7Dfunction%20toggle()%7Bif(stopped)return%3Bif(!inThisGame())%7Bstop()%3Breturn%3B%7Dif(enabled)%7Bdisable()%3Bnotify(%22Convoy%20auto-nuke%20OFF%22)%3Breturn%3B%7Denabled%3Dtrue%3Bgeneration%2B%2B%3Bnotify(%22Convoy%20auto-nuke%20ON%20%E2%80%94%20scanning%20every%205%20seconds%22)%3Binterval%3DsetInterval(scan%2CSCAN_MS)%3Bvoid%20scan()%3B%7Dconst%20api%3D%7Bstop%2Ctoggle%2Cget%20enabled()%7Breturn%20enabled%3B%7D%7D%3Bwindow%5BKEY%5D%3Dapi%3Bmaster.signal.addEventListener(%22abort%22%2Cstop%2C%7Bonce%3Atrue%2Csignal%3Acontroller.signal%7D)%3Bwindow.addEventListener(%22keydown%22%2Cevent%3D%3E%7Bif(event.code!%3D%3D%22KeyI%22%7C%7Cevent.ctrlKey%7C%7Cevent.altKey%7C%7Cevent.metaKey%7C%7Cevent.isComposing%7C%7Cediting(event))return%3Bswallow(event)%3Bif(event.repeat%7C%7CiPressed)return%3BiPressed%3Dtrue%3Btoggle()%3B%7D%2Coptions)%3Bwindow.addEventListener(%22keyup%22%2Cevent%3D%3E%7Bif(event.code!%3D%3D%22KeyI%22%7C%7C!iPressed)return%3BiPressed%3Dfalse%3Bswallow(event)%3B%7D%2Coptions)%3Bwindow.addEventListener(%22blur%22%2C()%3D%3E%7BiPressed%3Dfalse%3B%7D%2Coptions)%3Bwindow.addEventListener(%22pagehide%22%2Cstop%2Coptions)%3Bdocument.addEventListener(%22visibilitychange%22%2C()%3D%3E%7BiPressed%3Dfalse%3B%7D%2Coptions)%3Bconsole.info(%22%5BOpenFront%5D%20Press%20I%20for%20automatic%20enemy%20troop-transport%20interception%20(starts%20OFF)%22)%3B%7D)()%3B

Hold the corresponding key and click where you want the building/nuke to be built, and it will be build at there for the corresponding amount assuming you have enough gold. Holding the key and rapidly clicking allows you to build a large amount within a short period of time.

Key (Hold) Action
x Launch 50 Nuke
z Build/Upgrade 100 Port
v Build/Upgrade 100 Sam
b Build/Upgrade 50 Silo
n Build/Upgrade 100 City
Key (Toggle) Action
o Enable SAM Overlay
i Enable Auto Ship Intercept

SAM Overlay is a new feature where the range of every SAM is been displayed as a circle; It always tells you the amount of Enemy SAM that is covering the pixel that your cursor is currently pointed at.

New feature is still been added to this repo, the JS above will be updated for new features

Context

I like to play custom games with large gold multiplier, in which case it would be exhausting to upgrade hundreds of levels of building and launch thousands batches of nuke, so this script is wrote to upgrade and launch at a faster rate by applying a multiplier

For example in a 50x Gold "Nuke War" custom game, players often struggle to launch nuke fast enough to penetrate enemy air defense(SAM) despite sufficient gold

This script is made by backward engineering the source code published on https://github.com/openfrontio/openfrontio

Play the game on https://openfront.io

This is NOT a cheating script, this script does not let you gain more resource than what you already have, all it does is improving experience and help you carry out instruction faster

About

OpenFrontIO AutoClicker is a browser-based script that does macro/automation for OpenFront.io that helps players perform repetitive in-game actions faster.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages