c64-ready 2.5.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +52 -1
  2. package/bin/admin.mjs +7 -1
  3. package/bin/agent.mjs +18 -0
  4. package/bin/headless.mjs +1 -1
  5. package/dist/assets/BeachHead-CuSwFD4k.js +1 -0
  6. package/dist/assets/ChuckieEgg-CPqBnAOF.js +1 -0
  7. package/dist/assets/ForbiddenForest-DsQ9jsc8.js +1 -0
  8. package/dist/assets/Galaga-Cutc3p9s.js +1 -0
  9. package/dist/assets/Gribbly-DdZ_hHFt.js +1 -0
  10. package/dist/assets/Hercules-vZYKm7GG.js +1 -0
  11. package/dist/assets/LegendOfWilf-CxSMOjsj.js +1 -0
  12. package/dist/assets/MariosCementFactory-z0IZ0q30.js +1 -0
  13. package/dist/assets/MoleAttack-buC6ChYy.js +1 -0
  14. package/dist/assets/MunchyWorm-D2Zv7i0Q.js +1 -0
  15. package/dist/assets/ParkPatrol-CVj7hyoB.js +1 -0
  16. package/dist/assets/PottyPigeon-0SYpIUBa.js +1 -0
  17. package/dist/assets/RainbowIslands-BjfmJB8z.js +1 -0
  18. package/dist/assets/Stix-BU-qUCeC.js +1 -0
  19. package/dist/assets/Tilt-C5KtKisF.js +1 -0
  20. package/dist/assets/UpNDown-CATRO7Mz.js +1 -0
  21. package/dist/assets/Uridium-DanS2KoH.js +1 -0
  22. package/dist/assets/VegetablesDeluxe-C41ViimS.js +1 -0
  23. package/dist/assets/index-B8DSjPqI.js +243 -0
  24. package/dist/assets/src-DX0rJQsE.js +1 -0
  25. package/dist/assets/src-_trgwTvp.js +2 -0
  26. package/dist/assets/string-utils-CMVABfx0.js +1 -0
  27. package/dist/index.html +1 -1
  28. package/dist-ts/emulator/c64-emulator.d.ts +2 -2
  29. package/dist-ts/emulator/c64-emulator.js +2 -2
  30. package/dist-ts/emulator/c64-keys.d.ts +69 -0
  31. package/dist-ts/emulator/c64-keys.d.ts.map +1 -0
  32. package/dist-ts/emulator/c64-keys.js +69 -0
  33. package/dist-ts/emulator/c64-keys.js.map +1 -0
  34. package/dist-ts/emulator/c64-wasm.d.ts +1 -1
  35. package/dist-ts/emulator/gamepad-mapping.d.ts +64 -0
  36. package/dist-ts/emulator/gamepad-mapping.d.ts.map +1 -0
  37. package/dist-ts/emulator/gamepad-mapping.js +154 -0
  38. package/dist-ts/emulator/gamepad-mapping.js.map +1 -0
  39. package/dist-ts/emulator/input.d.ts +27 -78
  40. package/dist-ts/emulator/input.d.ts.map +1 -1
  41. package/dist-ts/emulator/input.js +94 -215
  42. package/dist-ts/emulator/input.js.map +1 -1
  43. package/dist-ts/headless/audio-capture.d.ts +1 -1
  44. package/dist-ts/headless/c64-headless.d.ts +2 -2
  45. package/dist-ts/headless/c64-headless.js +4 -4
  46. package/dist-ts/headless/frame-capture.d.ts +1 -1
  47. package/dist-ts/headless/input-bridge.d.ts +1 -1
  48. package/dist-ts/player/c64-player.d.ts +21 -5
  49. package/dist-ts/player/c64-player.d.ts.map +1 -1
  50. package/dist-ts/player/c64-player.js +32 -5
  51. package/dist-ts/player/c64-player.js.map +1 -1
  52. package/dist-ts/player/canvas-renderer.d.ts +2 -2
  53. package/dist-ts/player/cheevos-dev.d.ts +65 -0
  54. package/dist-ts/player/cheevos-dev.d.ts.map +1 -0
  55. package/dist-ts/player/cheevos-dev.js +237 -0
  56. package/dist-ts/player/cheevos-dev.js.map +1 -0
  57. package/dist-ts/player/cheevos-tracker-panel.d.ts +21 -0
  58. package/dist-ts/player/cheevos-tracker-panel.d.ts.map +1 -0
  59. package/dist-ts/player/cheevos-tracker-panel.js +242 -0
  60. package/dist-ts/player/cheevos-tracker-panel.js.map +1 -0
  61. package/dist-ts/player/index.d.ts +10 -7
  62. package/dist-ts/player/index.d.ts.map +1 -1
  63. package/dist-ts/player/index.js +6 -4
  64. package/dist-ts/player/index.js.map +1 -1
  65. package/dist-ts/player/input-handler.d.ts +7 -3
  66. package/dist-ts/player/input-handler.d.ts.map +1 -1
  67. package/dist-ts/player/input-handler.js +24 -1
  68. package/dist-ts/player/input-handler.js.map +1 -1
  69. package/dist-ts/player/load-formats.d.ts +1 -1
  70. package/dist-ts/player/local-rom-store.d.ts +23 -0
  71. package/dist-ts/player/local-rom-store.d.ts.map +1 -0
  72. package/dist-ts/player/local-rom-store.js +87 -0
  73. package/dist-ts/player/local-rom-store.js.map +1 -0
  74. package/dist-ts/player/startup-params.d.ts +7 -0
  75. package/dist-ts/player/startup-params.d.ts.map +1 -0
  76. package/dist-ts/player/startup-params.js +47 -0
  77. package/dist-ts/player/startup-params.js.map +1 -0
  78. package/dist-ts/player/ui-controller.d.ts +23 -1
  79. package/dist-ts/player/ui-controller.d.ts.map +1 -1
  80. package/dist-ts/player/ui-controller.js +665 -1
  81. package/dist-ts/player/ui-controller.js.map +1 -1
  82. package/package.json +11 -4
  83. package/src/emulator/c64-keys.ts +68 -0
  84. package/src/emulator/gamepad-mapping.ts +212 -0
  85. package/src/emulator/input.ts +106 -209
  86. package/src/headless/agent-cli.mjs +825 -0
  87. package/src/headless/headless-cli.mjs +10 -4
  88. package/src/headless/input-server.mjs +92 -17
  89. package/src/headless/png.mjs +72 -0
  90. package/src/headless/webrtc-server.mjs +458 -34
  91. package/src/main.ts +197 -12
  92. package/src/player/c64-player.ts +58 -1
  93. package/src/player/cheevos-dev.ts +340 -0
  94. package/src/player/cheevos-tracker-panel.ts +309 -0
  95. package/src/player/index.ts +19 -0
  96. package/src/player/input-handler.ts +32 -0
  97. package/src/player/local-rom-store.ts +126 -0
  98. package/src/player/startup-params.ts +40 -0
  99. package/src/player/ui-controller.ts +751 -0
  100. package/src/player/ultimate-bridge.ts +161 -0
  101. package/src/player/ultimate-panel.ts +315 -0
  102. package/src/types/c64-cheevos.d.ts +6 -0
  103. package/dist/assets/index-BAsZcXuS.js +0 -178
  104. /package/dist/assets/{marked.esm--kBm026b.js → marked.esm-fTuuvbcB.js} +0 -0
  105. /package/dist/assets/{purify.es-BcoGFDcJ.js → purify.es-CRM-GE0Y.js} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # c64-ready
4
4
 
5
- `c64-ready` is a TypeScript/Vite frontend prototype for running and rendering a Commodore 64 emulator in the browser.
5
+ `c64-ready` is a TypeScript/Vite frontend and headless emulator for running and debugging C64 files in emulation.
6
6
 
7
7
  It is based on `c64.js (from lvllvl.com by James)` from the original project source: https://github.com/jaammees/lvllvl
8
8
 
@@ -58,6 +58,30 @@ Run tests in watch mode:
58
58
  npm run test:watch
59
59
  ```
60
60
 
61
+ ## Agent CLI — screenshots, memory and breakpoints for AI-assisted development
62
+
63
+ `c64-agent` runs a program for a fixed number of emulated frames, feeds it scripted
64
+ keyboard and joystick input, and reports back: CPU registers, the text screen, memory
65
+ dumps, PNG screenshots and optional video. Runs are deterministic, which makes it the
66
+ tool to hand to an LLM coding agent or a CI job.
67
+
68
+ ```zsh
69
+ # Run a KickAssembler build for 5 seconds, then screenshot it and print the screen
70
+ npx -p c64-ready c64-agent game.prg --frames 250 --screenshot shot.png --screen
71
+
72
+ # Press fire at frame 100 and stop when the code reaches a label
73
+ npx -p c64-ready c64-agent game.prg --symbols game.sym --at 100:joy2=fire --break on_fire
74
+ ```
75
+
76
+ See [Agent CLI](docs/AGENT_CLI.md) for every option. For ready-made Claude Code /
77
+ Agent Skills, see [c64-skills](https://github.com/hayesmaker/c64-skills).
78
+
79
+ ## Cheevos development
80
+
81
+ c64-ready can load local `c64-cheevos` game detectors while running games in the browser. This is useful for developing score tracking and achievements with live emulator memory reads.
82
+
83
+ See [Cheevos Development](docs/CHEEVOS_DEVELOPMENT.md) for detector IDs, JSON set format, tracker panel fields, and local testing workflow.
84
+
61
85
  ## Headless streaming (Docker)
62
86
 
63
87
  The headless player streams the C64 output over **WebRTC** — a single container serves
@@ -520,6 +544,32 @@ shared TypeScript types for custom integrations. Serve `c64.wasm` and
520
544
  load the emulator core and audio worklet at runtime. If those assets are not served from
521
545
  the web root, pass `audio.assetBaseUrl` or `audio.workletUrl` to `C64Player`.
522
546
 
547
+ #### Gamepad mapping
548
+
549
+ By default a gamepad drives the joystick in all 8 directions; A fires, B is up, X is Space
550
+ and RT / Start are RUN/STOP. `setGamepadMapping()` changes that per game: the stick mode,
551
+ and a joystick input (`{ joystick: 'up' | 'down' | 'left' | 'right' | 'fire' }`), a C64
552
+ key (`{ key: C64_KEY.* }`) or nothing (`null`) for each direction and for A, B, X, Y, LB,
553
+ RB, LT and RT. Unlisted controls keep their defaults, and Start stays RUN/STOP.
554
+
555
+ ```ts
556
+ import { C64_KEY } from 'c64-ready';
557
+
558
+ // Thrust is keyboard only: rotate with A / S, thrust with Shift, fire with Return, shield with Space
559
+ player.setGamepadMapping({
560
+ stick: '2way', // '8way' (default) | '4way' | '2way'
561
+ directions: { left: { key: C64_KEY.A }, right: { key: C64_KEY.S } },
562
+ buttons: {
563
+ a: { key: C64_KEY.RETURN },
564
+ b: { key: C64_KEY.SHIFT_LEFT },
565
+ x: { key: C64_KEY.SPACE },
566
+ },
567
+ });
568
+ ```
569
+
570
+ On-screen controls can share the same mapping as a virtual gamepad: pass the controls
571
+ held on them to `player.setVirtualGamepadState({ left: true, a: true })`.
572
+
523
573
  ### Building before publish
524
574
 
525
575
  To regenerate both the Vite browser bundle and the TypeScript API outputs in one step:
@@ -586,6 +636,7 @@ Extended documentation lives in the [`docs/`](docs/) folder:
586
636
 
587
637
  | File | Description |
588
638
  | ----------------------------------------------------- | ------------------------------------------------------------------ |
639
+ | [`AGENT_CLI.md`](docs/AGENT_CLI.md) | `c64-agent`: deterministic run, screenshot, dump and breakpoint CLI |
589
640
  | [`AUDIO_ENGINE.md`](docs/AUDIO_ENGINE.md) | SID audio pipeline, worklet pull-model, timing rules |
590
641
  | [`HEADLESS_INPUT.md`](docs/HEADLESS_INPUT.md) | Headless WebSocket input API reference |
591
642
  | [`HEADLESS_RUNNING.md`](docs/HEADLESS_RUNNING.md) | Headless CLI usage, frame/timing rules, ffmpeg integration |
package/bin/admin.mjs CHANGED
@@ -133,7 +133,7 @@ function callAdmin(wsUrl, payload, timeoutMs = 7000) {
133
133
  }
134
134
  if (!msg || typeof msg !== 'object') return;
135
135
  if (msg.type === 'hello') return;
136
- if (msg.type === 'admin-status-ok' || msg.type === 'admin-kick-player-ok' || msg.type === 'admin-kick-all-ok') {
136
+ if (msg.type === 'admin-status-ok' || msg.type === 'admin-kick-player-ok' || msg.type === 'admin-kick-all-ok' || msg.type === 'admin-attract-mode-ok') {
137
137
  finish(resolve, msg);
138
138
  return;
139
139
  }
@@ -187,6 +187,12 @@ async function main() {
187
187
  const kicked = res.kicked ?? {};
188
188
  console.log(`Kick-all complete: host=${kicked.host ?? '-'} p2=${kicked.p2 ?? '-'} spectators=${kicked.spectators ?? 0} webrtcPeers=${kicked.webrtcPeers ?? 0}`);
189
189
  console.log(renderStatus(res.status));
190
+ return;
191
+ }
192
+
193
+ if (res.type === 'admin-attract-mode-ok') {
194
+ const attractMode = res.attractMode ?? {};
195
+ console.log(`Attract Mode ${res.action ?? 'command'} ok: active=${attractMode.active ? 'yes' : 'no'}`);
190
196
  }
191
197
  }
192
198
 
package/bin/agent.mjs ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) 2026 hayesmaker
4
+ // See LICENSE in the project root for full license information.
5
+ /**
6
+ * c64-agent — deterministic load → run → inspect runner for LLM agents and test scripts.
7
+ * Run `c64-agent --help` for usage, or see docs/AGENT_CLI.md.
8
+ */
9
+ import { runAgent } from '../src/headless/agent-cli.mjs';
10
+
11
+ try {
12
+ const { exitCode, output } = await runAgent();
13
+ if (output) process.stdout.write(output.endsWith('\n') ? output : `${output}\n`);
14
+ process.exitCode = exitCode;
15
+ } catch (e) {
16
+ process.stderr.write(`c64-agent: error: ${e && e.message ? e.message : e}\n`);
17
+ process.exitCode = 1;
18
+ }
package/bin/headless.mjs CHANGED
@@ -62,7 +62,7 @@ Options:
62
62
  --webrtc-min-bitrate-kbps <n> VP8 SDP x-google-min-bitrate hint (default: 200)
63
63
  --webrtc-max-bitrate-kbps <n> VP8 SDP x-google-max-bitrate hint (default: 600)
64
64
  --webrtc-output-fps <n> Max WebRTC video send FPS cap (default: 40)
65
- --admin-token <token> Shared admin token for c64-admin commands
65
+ --admin-token <token> Shared token for c64-admin and browser host controls
66
66
  --input Start WebSocket input server for remote control
67
67
  --ws-port <n> WebSocket server port (default: 9001)
68
68
  --verbose Print per-frame diagnostics to stderr
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:38400,length:17,label:`Game state and score`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){console.log(`Beach Head initialized`,i,t),this._popCheevo=o,this._postScore=s,this.user=r,this.gameId=t,this.watcher=e(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map((e,t)=>{let r=a.some(t=>t.achievement._id===e._id),i=()=>{};switch(n(e.title)){}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}}),this.resetGameVars()}resetGameVars(){this.score=0,this.ships=100,this.tanks=100,this.bunkerHp=0,this.isGameOver=!0,this.isBeachHead=!1}getSkillLevel=()=>parseInt(this.cpuReadNS(38400).toString(16))-1;getScore=()=>{let e=t(38407,this),n=t(38406,this),r=``+e+n;return parseInt(r)*100};getShips=()=>parseInt(this.cpuReadNS(38414).toString(16),16);getTanks=()=>parseInt(this.cpuReadNS(38415).toString(16),16);getBunkerHp=()=>parseInt(this.cpuReadNS(38416).toString(16),16);gameOverCheck=()=>!this.isGameOver&&this.isBeachHead&&this.tanks===0?!0:!this.isGameOver&&this.ships===0;execute=()=>{let e=this.getScore();e!==this.score&&(this.score=e);let t=this.getShips();t===10&&t!==this.ships&&(this.score=0,this.isGameOver=!1,this.watcher.dispatch(`newGame`,{gameMode:this.getSkillLevel()}),console.log(`New Game`,this.ships,this.tanks,this.score)),t!==this.ships&&(this.ships=t,console.log(`this.ships=`,this.ships,this.score));let n=this.getTanks();n!==this.tanks&&(this.tanks=n,this.tanks>0&&(this.isBeachHead=!0),console.log(`this.tanks=`,this.tanks,this.score)),this.gameOverCheck()&&(console.log(`GameOver`,this.score),this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore());let r=this.getBunkerHp();r!==this.bunkerHp&&(this.bunkerHp=r,!this.isGameOver&&this.bunkerHp===0&&(this.isGameOver=!0,this.postScore())),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};postScore(){console.log(`Post Score:`,this.score),this._postScore(this.gameId,this.score,this.user.id,this.user.username,this.getSkillLevel()).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Beach-Head Leaderboard!`}),this.resetGameVars()})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{r as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{t}from"./string-utils-CMVABfx0.js";var n=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:100,length:11,label:`Score, lives, and level`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:n,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){console.log(`Chuckie Egg initialized`,i,n),this._popCheevo=o,this._postScore=s,this.user=r,this.gameId=n,this.watcher=e(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map((e,n)=>{let r=a.some(t=>t.achievement._id===e._id),i=()=>{};switch(t(e.title)){}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}}),this.resetGameVars()}resetGameVars(){this.score=0,this.lives=0,this.isGameOver=!0}newGameVars(){this.score=0,this.isGameOver=!1}getScore=()=>{let e=this.cpuReadNS(100).toString(16),t=this.cpuReadNS(101).toString(16),n=this.cpuReadNS(102).toString(16),r=this.cpuReadNS(103).toString(16),i=this.cpuReadNS(104).toString(16),a=``+e+t+n+r+i+`0`;return parseInt(a)};getLives=()=>parseInt(this.cpuReadNS(106).toString(16),16);gameOverCheck=()=>!this.isGameOver&&this.lives===0;newGameCheck=()=>this.isGameOver&&this.lives===5;execute=()=>{this.newGameCheck()&&(console.log(`New Game`),this.isGameOver=!1,this.newGameVars(),this.watcher.dispatch(`newGame`,{}));let e=this.getScore();e!==this.score&&(this.score=e),this.gameOverCheck()&&(console.log(`GameOver`),this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore());let t=this.getLives();t!==this.lives&&(this.lives=t,console.log(`this.lives=`,this.lives,this.score)),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};postScore(){console.log(`Post Score:`,this.score),this._postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Chuckie-Egg Leaderboard!`}),this.resetGameVars()})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{n as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{t}from"./string-utils-CMVABfx0.js";var n=42,r=43,i=44,a=45,o=85,s=95,c=105,l=78,u=94,d=65,f=39,p=34,m=53262,h={4:0,8:1,12:2,16:3},g={INNOCENT:4,TROOPER:8,DAREDEVIL:12,CRAZY:16},_={SPIDERS:1,BEES:2,FROGS:4,DRAGONS:8,PHANTOM:16,SNAKE:32,DEMOGORGON:64,GAME_END:128},v={SPIDERS:[4,8,12,16],BEES:[1,2,3,4],FROGS:[6,12,16,20],DRAGONS:[1,1,2,3],PHANTOM:[1,1,1,2],SNAKE:[1,1,2,3],DEMOGORGON:[1,1,1,1]},y=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:34,length:12,label:`Score and arrows`},{address:65,length:31,label:`Wave state`},{address:105,length:1,label:`Difficulty`},{address:53262,length:1,label:`Night state`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:n,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){this.name=`Forbidden Forest(test0)`,console.log(`${this.name}::Constructor`,n),this._popCheevo=o,this.postScore=s,this.user=r,this.gameId=n,this.watcher=e(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map((e,n)=>{let r=a.some(t=>t.achievement._id===e._id),i;switch(console.log(`cheevo %s`,n,t(e.title)),t(e.title)){case`arachnophobia`:i=()=>{if(this.currentGameMode>=1)return this.currentEnemyType===_.BEES&&this.previousEnemyType===_.SPIDERS&&this.getLives()>0};break;case`beeUrself`:i=()=>{if(this.currentGameMode>=1)return this.currentEnemyType===_.FROGS&&this.previousEnemyType===_.BEES&&this.getLives()>0};break;case`froggerNotLikeThis`:i=()=>{if(this.currentGameMode>=1)return this.currentEnemyType===_.DRAGONS&&this.previousEnemyType===_.FROGS&&this.getLives()>0};break;case`dragonbreed`:i=()=>{if(this.currentGameMode>=1)return this.currentEnemyType===_.PHANTOM&&this.previousEnemyType===_.DRAGONS&&this.getLives()>0};break;case`fantmas`:i=()=>{if(this.currentGameMode>=1)return this.currentEnemyType===_.SNAKE&&this.previousEnemyType===_.PHANTOM&&this.getLives()>0};break;case`whyDidItHaveToBeSnakes`:i=()=>{if(this.currentGameMode>=1)return this.currentEnemyType===_.DEMOGORGON&&this.previousEnemyType===_.SNAKE&&this.getLives()>0};break;case`demogorgonParty`:i=()=>this.currentGameMode>=1&&this.previousEnemyType===_.DEMOGORGON&&this.currentEnemyType===_.GAME_END&&this.getLives()>0;break;case`ultimateMaster`:i=()=>this.startingGameMode===h[g.INNOCENT]&&this.getGameMode()===h[g.CRAZY]&&this.previousEnemyType===_.DEMOGORGON&&this.currentEnemyType===_.GAME_END&&this.getLives()>0;break;case`perfectSpiders`:i=()=>this.currentGameMode>=h[g.TROOPER]&&this.currentEnemyType===_.BEES&&this.previousEnemyType===_.SPIDERS&&this.getLives()>=3&&this.getArrows()===this.arrowsAtRoundStart-v.SPIDERS[this.currentGameMode];break;case`perfectBees`:i=()=>(this.currentEnemyType===_.FROGS&&this.previousEnemyType===_.BEES&&console.log(`[Bees Beaten] arrowsNow=%s, arrowsAtStart=%s`,this.getArrows(),this.arrowsAtRoundStart,v.BEES[this.currentGameMode]),this.currentGameMode>=h[g.TROOPER]&&this.currentEnemyType===_.FROGS&&this.previousEnemyType===_.BEES&&this.getLives()>=3&&this.getArrows()===this.arrowsAtRoundStart-v.BEES[this.currentGameMode]+1);break;case`perfectFrogs`:i=()=>(this.currentEnemyType===_.DRAGONS&&this.previousEnemyType===_.FROGS&&console.log(`[Frogs Beaten] lives %s arrowsNow=%s, arrowsAtStart=%s`,this.getLives(),this.getArrows(),this.arrowsAtRoundStart,v.FROGS[this.currentGameMode]),this.currentGameMode>=h[g.TROOPER]&&this.currentEnemyType===_.DRAGONS&&this.previousEnemyType===_.FROGS&&this.getLives()>=3&&(this.getArrows()===this.arrowsAtRoundStart-v.FROGS[this.currentGameMode]+1||this.getArrows()===this.arrowsAtRoundStart-v.FROGS[this.currentGameMode]));break;case`perfectDragons`:i=()=>(this.currentEnemyType===_.PHANTOM&&this.previousEnemyType===_.DRAGONS&&console.log(`[Dragons Beaten] lives=%s arrowsNow=%s, arrowsAtStart=%s`,this.getLives(),this.getArrows(),this.arrowsAtRoundStart,v.DRAGONS[this.currentGameMode]),this.currentGameMode>=h[g.TROOPER]&&this.currentEnemyType===_.PHANTOM&&this.previousEnemyType===_.DRAGONS&&this.getLives()>=3&&(this.getArrows()===this.arrowsAtRoundStart-v.DRAGONS[this.currentGameMode]-1||this.getArrows()===this.arrowsAtRoundStart-v.DRAGONS[this.currentGameMode]));break;case`oneShotPhantom`:i=()=>(this.currentEnemyType===_.SNAKE&&this.previousEnemyType===_.PHANTOM&&console.log(`[Phantom Beaten] lives=%s arrowsNow=%s, arrowsAtStart=%s`,this.getLives(),this.getArrows(),this.arrowsAtRoundStart,v.PHANTOM[this.currentGameMode]),this.currentGameMode>=h[g.TROOPER]&&this.currentEnemyType===_.SNAKE&&this.previousEnemyType===_.PHANTOM&&this.getLives()>=3&&this.getArrows()===this.arrowsAtRoundStart-v.PHANTOM[this.currentGameMode]);break;case`oneShotSnake`:i=()=>(this.currentEnemyType===_.DEMOGORGON&&this.previousEnemyType===_.SNAKE&&console.log(`[Snake Beaten] lives=%s arrowsNow=%s, arrowsAtStart=%s`,this.getLives(),this.getArrows(),this.arrowsAtRoundStart,v.SNAKE[this.currentGameMode]),this.currentGameMode>=h[g.TROOPER]&&this.currentEnemyType===_.DEMOGORGON&&this.previousEnemyType===_.SNAKE&&this.getLives()>=3&&this.getArrows()===this.arrowsAtRoundStart-v.SNAKE[this.currentGameMode]);break;case`oneShotDemogorgon`:i=()=>(this.currentEnemyType===_.GAME_END&&this.previousEnemyType===_.DEMOGORGON&&console.log(`[Demogorgon Beaten] lives=%s arrowsNow=%s, arrowsAtStart=%s`,this.getLives(),this.getArrows(),this.arrowsAtRoundStart,v.DEMOGORGON[this.currentGameMode]),this.currentGameMode>=h[g.TROOPER]&&this.previousEnemyType===_.DEMOGORGON&&this.currentEnemyType===_.GAME_END&&this.getLives()>=3&&this.getArrows()===this.arrowsAtRoundStart-1);break;case`undeadSlayer`:i=()=>this.currentGameMode>=h[g.TROOPER]&&this.currentEnemyType===_.PHANTOM&&this.getArrows()===this.arrowsAtRoundStart-5&&this.getLives()>=3&&this.getScore()===this.scoreAtStart+5*1e3;break;case`quickKill`:i=()=>this.currentGameMode===h[g.INNOCENT]&&this.currentEnemyType===_.DEMOGORGON&&this.previousEnemyType===_.SNAKE&&this.cpuReadNS(m)<240;break;default:i=()=>!1;break}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}}),this.resetGameVars()}resetGameVars(){this.score=0,this.lives=0,this.gameMode=0,this.isGameOver=!0,this.previousEnemyType=null,this.currentEnemyType=null,this.previousProgress=null,this.currentProgress=null,this.previousWaveBaseline=null,this.currentWaveBaseline=null,this.previousGameMode=null,this.currentGameMode=null,this.arrowsRemaining=null,this.arrowsAtRoundStart=null,this.scoreAtStart=null,this.isRoundInterstitial=!1,this.scoreSubmitted=!1}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.scoreAtStart=this.score,this.lives=this.getLives(),this.gameMode=this.currentGameMode,this.startingGameMode=this.currentGameMode,this.previousEnemyType=this.currentEnemyType,this.previousProgress=this.currentProgress,this.previousWaveBaseline=this.currentWaveBaseline,this.previousGameMode=this.currentGameMode,this.arrowsRemaining=this.getArrows(),this.arrowsAtRoundStart=this.arrowsRemaining,this.isRoundInterstitial=!1,this.scoreSubmitted=!1,this.watcher.dispatch(`newGame`,{gameMode:this.gameMode}),console.log(`[Started] New Game - score=%s, lives=%s, gameMode=%s, arrows=%s, nightState=%s`,this.score,this.lives,this.gameMode,this.arrowsAtRoundStart,this.cpuReadNS(m))}updateProgressState(){this.previousEnemyType!==this.currentEnemyType&&(console.log(`[New Round]: PrevEnemy %s | New Enemy %s | Kills %s | Arrows %s | NightState=%s]`,this.previousEnemyType,this.currentEnemyType,this.getCurrentKills(),this.getArrows(),this.cpuReadNS(m)),this.isRoundInterstitial=!0),this.isRoundInterstitial&&this.cpuReadNS(p)===44&&(this.isRoundInterstitial=!1,this.arrowsAtRoundStart=this.cpuReadNS(f),this.scoreAtStart=this.getScore(),console.log(`Start Enemy Attack wave [Arrows=%s] [nightState%s]`,this.arrowsAtRoundStart,this.cpuReadNS(m))),this.previousEnemyType=this.currentEnemyType,this.previousProgress=this.currentProgress,this.previousWaveBaseline=this.currentWaveBaseline,this.previousGameMode=this.currentGameMode,this.currentEnemyType=this.cpuReadNS(l),this.currentProgress=this.cpuReadNS(d),this.currentWaveBaseline=this.cpuReadNS(u),this.currentGameMode=this.getGameMode()}getArrows(){return this.cpuReadNS(f)}getCurrentKills(){return console.log(`getCurrentKills `,this.cpuReadNS(d)-this.cpuReadNS(u)),this.cpuReadNS(d)-this.cpuReadNS(u)}getScore(){let e=this.cpuReadNS(n),t=this.cpuReadNS(r),o=this.cpuReadNS(i),s=this.cpuReadNS(a),c=[s>>4,s&15,o>>4,o&15,t>>4,t&15,e>>4,e&15];return Number(c.join(``))}getLives(){return this.cpuReadNS(s)}getGameMode(){return h[this.cpuReadNS(c)]??0}endGameCheck(){return!this.isGameOver&&this.getLives()===0}newGameCheck(){return this.isGameOver&&this.getLives()>0&&this.cpuReadNS(o)===1}execute(){this.updateProgressState();let e=this.getScore();e!==this.score&&!this.isGameOver&&(e!==0||this.score===0)&&(this.score=e),this.newGameCheck()&&this.newGameVars();let t=this.getLives();if(t!==this.lives&&(this.lives=t,console.log(`lives=`,this.lives)),this.endGameCheck()){if(console.log(`Game Over! Final Score:`,this.score),this.isGameOver=!0,this.scoreSubmitted)return;this.scoreSubmitted=!0,this.watcher.dispatch(`gameOver`,{score:this.score,gameMode:this.gameMode}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${this.name} Leaderboard!`})})}this.isGameOver||this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{y as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t}from"./string-utils-CMVABfx0.js";var n=35380,r=33115,i=33114,a=33113,o=33112,s=216,c=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:s,length:1,label:`Game state`},{address:o,length:4,label:`Score`},{address:n,length:1,label:`Lives`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){this.name=`Galaga`,console.log(`${this.name}::Constructor`,t),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map((e,t)=>{let n=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:n,check:()=>{},cheevoId:e._id}}),this.resetGameVars()}resetGameVars(){this.score=0,this.lives=0,this.isGameOver=!0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.lives=this.getLives(),console.log(`Started New Game`,this.score,this.lives)}getScore(){let e=t(r,this),n=t(i,this),s=t(a,this),c=t(o,this);return parseInt(e+n+s+c,10)}getLives(){return parseInt(this.cpuReadNS(n).toString(16),10)}endGameCheck(){if(!this.isGameOver&&this.cpuReadNS(s)===19)return console.log(`Game Over flag=19`,this.score,this.lives),!0}newGameCheck(){return this.isGameOver&&this.cpuReadNS(s)===16}execute(){let e=this.getScore();e!==this.score&&(this.score=e),this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{}));let t=this.getLives();t!==this.lives&&(this.lives=t),this.endGameCheck()&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score of %s posted successfully`,this.score,e.data),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${this.name} Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{c as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t}from"./string-utils-CMVABfx0.js";var n=33,r=34,i=35,a=36,o=87,s=89,c=157,l=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:n,length:4,label:`Score`},{address:o,length:6,label:`Player state`},{address:c,length:1,label:`Game state`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){console.log(`Gribbley::constructor`,t,r),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map((e,t)=>{let n=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:n,check:()=>{},cheevoId:e._id}}),this.isGameOver=!0,this.score=0,this.lives=0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),console.log(`Start New Game`,this.score)}getScore(){let e=t(n,this),o=t(r,this),s=t(i,this),c=t(a,this);return parseInt(e+o+s+c,10)}getIsDead(){return parseInt(this.cpuReadNS(s),10)===0&&parseInt(this.cpuReadNS(o),10)===0&&parseInt(this.cpuReadNS(c),10)===1}newGameCheck(){return parseInt(this.cpuReadNS(s),10)===80&&parseInt(this.cpuReadNS(o),10)===40&&parseInt(this.cpuReadNS(c),10)===2}execute(){let e=this.getScore();e!==this.score&&(this.score=e,console.log(`Gribbly.score=`,this.score)),this.isGameOver&&this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),this.getIsDead()&&!this.isGameOver&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Gribbly Grobbly Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{l as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{t}from"./string-utils-CMVABfx0.js";var n=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:30,length:1,label:`Lives`},{address:69,length:6,label:`Score`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:n,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){this._popCheevo=o,this.postScore=s,this.user=r,this.gameId=n,this.watcher=e(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map((e,n)=>{let r=a.some(t=>t.achievement._id===e._id),i=()=>{};switch(t(e.title)){}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}}),this.score=0,this.lives=0,this.isGameOver=!0,this.isRollOverScore=!1}getScore=()=>{let e=parseInt(this.cpuReadNS(69).toString(16))-30,t=parseInt(this.cpuReadNS(70).toString(16))-30,n=parseInt(this.cpuReadNS(71).toString(16))-30,r=parseInt(this.cpuReadNS(72).toString(16))-30,i=parseInt(this.cpuReadNS(73).toString(16))-30,a=parseInt(this.cpuReadNS(74).toString(16))-30,o=``+e+t+n+r+i+a,s=parseInt(o);return s>=9e5&&(this.isRollOverScore=!0),this.isRollOverScore&&s<this.score?parseInt(`1`+o):parseInt(o)};getLives=()=>parseInt(this.cpuReadNS(30).toString(16));execute=()=>{let e=this.getScore();e!==this.score&&(this.score=e);let t=this.getLives();t===3&&t!==this.lives&&(console.log(`New Game`),this.isGameOver=!1,this.watcher.dispatch(`newGame`,{})),t===0&&this.lives===1&&!this.isGameOver&&(this.isGameOver=!0,this.isRollOverScore=!1,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Hercules Leaderboard!`})})),t!==this.lives&&(this.lives=t),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{n as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";var t=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:33356,length:1,label:`Lives lost`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor(){console.log(`LegendOfWilf initialized`),this.livesLost=0,this.hasLostLife=!1,this.watcher=e(),this.cheevos=[]}getLives=()=>0;execute=()=>{let e=this.getLives();this.livesLost===0&&e===0&&!this.hasStartedGame&&(this.hasStartedGame=!0,this.watcher.dispatch(`newGame`,{})),e>this.livesLost&&(this.livesLost=e,this.hasLostLife=!0),this.cheevos.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(e.title,e.message),this.watcher.dispatch(`cheevo`,{title:e.title,message:e.message}))})}};export{t as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{t}from"./string-utils-CMVABfx0.js";var n=8393,r=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:8393,length:1,label:`Game mode`},{address:33057,length:2,label:`Score`},{address:33356,length:1,label:`Lives lost`},{address:36256,length:2,label:`Player position`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:n,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){this.gameModes=[`gameA`,`gameB`],this._popCheevo=o,this.postScore=s,this.user=r,this.gameId=n,this.watcher=e(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map((e,n)=>{let r=a.some(t=>t.achievement._id===e._id),i;switch(t(e.title)){case`welcomeToYourNewJob`:i=()=>this.score>=100;break;case`hopeYouHadAWonderfulFirstDay`:i=()=>this.score>=200;break;case`bonusMilestone`:i=()=>this.score>=300;break;case`promotion`:i=()=>this.score>=400;break;case`suckedInToOvertime`:i=()=>this.score>=500;break;case`franticFreddie`:i=()=>this.score>=600;break;case`tryingToImpressTheBoss`:i=()=>this.score>=700;break;case`theresEasierWaysToDoThis`:i=()=>this.score>=800;break;case`startingToSmellLikeCement`:i=()=>this.score>=900;break;case`cementKing`:i=()=>this.score>=1e3;break;case`verbalWarning`:i=()=>this.livesLost===1&&!this.isGameOver;break;case`finalWarning`:i=()=>this.livesLost===2&&!this.isGameOver;break;case`grossMisconduct`:i=()=>this.livesLost===3;break;case`doubleScoreFactory`:i=()=>this.score>=300&&this.livesLost===0;break;case`escapeArtist`:i=()=>this.hasReachedEscapeFloor?this.location.row===2&&this.location.col===1||this.location.row===2&&this.location.col===4||this.location.row===3&&this.location.col===1?!0:this.location.row===3&&this.location.col===4:!1;break;case`ultimateMaster`:i=()=>this.score>=1e3&&this.livesLost===0;break}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}}),this.score=0,this.livesLost=255,this.location={row:0,col:0},this.hasReachedEscapeFloor=!1,this.scoreSubmitted=!1,this.isGameOver=!0}getGameMode=()=>parseInt(this.cpuReadNS(n).toString(16),16);getLocation=()=>{let e=parseInt(this.cpuReadNS(36256).toString(16));return{row:parseInt(this.cpuReadNS(36257).toString(16)),col:e}};getScore=()=>{let e=parseInt(this.cpuReadNS(33057).toString(16));return parseInt(this.cpuReadNS(33058).toString(16))*100+e};getLives=()=>parseInt(this.cpuReadNS(33356).toString(16));execute=()=>{let e=this.getLocation();(e.row!==this.location.row||e.col!==this.location.col)&&(this.location=e,this.location.row===4&&this.location.col===1&&(this.hasReachedEscapeFloor=!0));let t=this.getScore();t!==this.score&&(this.score=t);let n=this.getLives();if(n===0&&n!==this.livesLost&&this.isGameOver&&(console.log(`New Game`),this.livesLost=n,this.scoreSubmitted=!1,this.watcher.dispatch(`newGame`,{gameMode:this.getGameMode()}),this.isGameOver=!1),n===3&&this.livesLost===2&&!this.scoreSubmitted){this.scoreSubmitted=!0;let e=this.getGameMode();this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score,gameMode:e}),this.postScore(this.gameId,this.score,this.user.id,this.user.username,e).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the MCF Leaderboard!`})})}n>this.livesLost&&(this.hasReachedEscapeFloor=!1,this.livesLost=n),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{r as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t}from"./string-utils-CMVABfx0.js";var n=10,r=11,i=80,a=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:n,length:2,label:`Score`},{address:i,length:1,label:`Game state`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){console.log(`MoleAttack::constructor`,t,r),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map((e,t)=>{let n=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:n,check:()=>{},cheevoId:e._id}}),this.isGameOver=!0,this.score=0,this.lives=0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),console.log(`Start New Game`,this.score)}getScore(){let e=t(r,this),i=t(n,this);return parseInt(e+i,10)}getIsDead(){return parseInt(this.cpuReadNS(i),10)===0}newGameCheck(){return parseInt(this.cpuReadNS(i),10)===1}execute(){let e=this.getScore();e!==this.score&&(this.score=e,console.log(`MoleAttack.score=`,this.score)),this.isGameOver&&this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),this.getIsDead()&&!this.isGameOver&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the MOLE ATTACK Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{a as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t}from"./string-utils-CMVABfx0.js";var n=10311,r=10316,i=10315,a=10314,o=10313,s=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:n,length:6,label:`Game state and score`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){console.log(`MunchyWorm-v2::constructor`,t),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map((e,t)=>{let n=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:n,check:()=>{},cheevoId:e._id}}),this.resetGameVars()}resetGameVars(){this.score=0,this.isGameOver=!0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),console.log(`Start New Game`,this.score)}getScore(){let e=t(r,this),n=t(i,this),s=t(a,this),c=t(o,this);return parseInt(e+n+s+c,10)}getIsDead(){console.log(`getIsDead GAME_STATE_FLAG`,this.cpuReadNS(n));let e=this.cpuReadNS(n);return e===226||e>=36&&e<=49}newGameCheck(){return this.cpuReadNS(n)===32}execute(){let e=this.getScore();e!==this.score&&(this.score=e,console.log(`MunchyWorm.score=`,this.score)),this.isGameOver&&this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),!this.isGameOver&&this.getIsDead()&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Munchy Worm Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{s as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t}from"./string-utils-CMVABfx0.js";var n=15638,r=15639,i=15640,a=15631,o=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:a,length:10,label:`Lives and score`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){console.log(`ParkPatrol::constructor`,t,r),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map((e,t)=>{let n=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:n,check:()=>{},cheevoId:e._id}}),this.isGameOver=!0,this.score=0,this.lives=0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),console.log(`Start New Game`,this.score)}getScore(){let e=t(n,this),a=t(r,this),o=t(i,this);return parseInt(e+a+o,10)}getLives(){return parseInt(this.cpuReadNS(a).toString(16),10)}getIsDead(){}newGameCheck(){return this.isGameOver&&this.getLives()>0}execute(){let e=this.getScore();e!==this.score&&(this.score=e,console.log(`ParkPatrol.score=`,this.score));let t=this.getLives();t!==this.lives&&(this.lives=t,console.log(`ParkPatrol.lives=`,this.lives)),this.isGameOver&&this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),this.getIsDead()&&!this.isGameOver&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Park Patrol Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{o as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{a as t,i as n,t as r}from"./string-utils-CMVABfx0.js";var i=1031,a=1032,o=1033,s=1034,c=1035,l=1036,u=1045,d=1159,f=1160,p=1161,m=1162,h=1164,g=1165,_=1166,v=1167,y=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:i,length:15,label:`Score and lives`},{address:d,length:9,label:`Game over text`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){console.log(`PottyPigeon::constructor`,t,i),this._popCheevo=o,this.postScore=s,this.watcher=e(),this.cheevos=[],this.user=n,this.gameId=t,this.score=0,this.lives=0,this.gameOverString=``,this.isGameOver=!0,this.cheevosSet=i,this.cheevosMap=i.cheevos.map(e=>{let t=a.some(t=>t.achievement._id===e._id),n;switch(r(e.title)){case`welcomeToYourNewJob`:n=()=>this.score>=100;break}return{title:e.title,message:e.description,isPopped:t,check:n,cheevoId:e._id}})}getGameOver(){let e=t(d,this,0),n=t(f,this,0),r=t(p,this,0),i=t(m,this,0),a=t(h,this,0),o=t(g,this,0),s=t(_,this,0),c=t(v,this,0);return e+n+r+i+a+o+s+c}getScore(){let e=n(i,this),t=n(a,this),r=n(o,this),u=n(s,this),d=n(c,this),f=n(l,this);return parseInt(e+t+r+u+d+f)}getLives(){let e=n(u,this);return parseInt(e,10)}debug(e,t){console.log(`Tilt::Debug`,t,this.cpuReadNS(e).toString(16))}execute=()=>{this.isGameOver&&this.lives===2&&(console.log(`PottyPigeon::NewGame!`,this.lives,this.score),this.isGameOver=!1,this.gameOverString=``,this.watcher.dispatch(`newGame`,{}));let e=this.getScore();e!==this.score&&(console.log(`PottyPigeon::ScoreChange! score=`,e,this.score),this.score=e);let t=this.getLives();t!==this.lives&&(console.log(`PottyPigeon::LivesChange! lives=`,t,this.lives),this.lives=t);let n=this.getGameOver();n!==this.gameOverString&&(console.log(`PottyPigeon::GameOverStringChange! gameOverString=`,n),this.gameOverString=n,!this.isGameOver&&this.gameOverString===`gameover`&&(this.isGameOver=!0,console.log(`PottyPigeon::GameOver! score=`,e,this.score),this.isGameOver=!0,this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Potty Pigeon Leaderboard!`}),this.watcher.dispatch(`gameOver`,{score:this.score})}))),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{y as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=4443,i=4444,a=4445,o=4446,s=4448,c=4454,l=4453,u=255,d=173,f=174,p=6323,m=78,h=79,g=64,_=128,v=1,y=4,b=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:r,length:4,label:`Score`},{address:s,length:1,label:`Lives`},{address:c,length:1,label:`Round`},{address:l,length:1,label:`Island`},{address:d,length:2,label:`DiamondOrder`},{address:p,length:1,label:`Credits`},{address:m,length:2,label:`Powerups`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){this.name=`Rainbow Islands (Twitch Live4)`,console.log(`${this.name} - LIVE`,t),this._popCheevo=o,this.postScore=s,this.user=r,this.gameId=t,this.watcher=e(),this.resetGameVars(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map(e=>{let t=a.some(t=>t.achievement._id===e._id),r;switch(n(e.title)){case`potOfGold`:r=()=>this.score>=25e4;break;case`bigFood`:r=()=>this.score>=5e5;break;case`bigWhoop`:r=()=>this.score>=1e6;break;case`bugSpray`:r=()=>this.islandNumber===1;break;case`helikopterHelikopter`:r=()=>this.islandNumber===2;break;case`doTheMash`:r=()=>this.islandNumber===3;break;case`toyStory`:r=()=>this.islandNumber===4;break;case`revengeOnDoh`:r=()=>this.islandNumber===5;break;case`theDroidsYourLookingFor`:r=()=>this.islandNumber===6;break;case`endOfTheRainbow`:r=()=>this.islandNumber===7;break;case`perfectCollection`:r=()=>this.cpuReadNS(f)===0&&this.cpuReadNS(d)===0&&this.islandNumber===0;break;case`the1cc`:r=()=>this.islandNumber===7&&this.cpuReadNS(p)===0;break;case`needForSpeed`:r=()=>(this.cpuReadNS(h)&g)>=g;break;case`redPotionMastery`:r=()=>(this.cpuReadNS(h)&v)>=v;break;case`yellowPotionMastery`:r=()=>(this.cpuReadNS(h)&y)===y;break;case`bookOfWings`:r=()=>(this.cpuReadNS(h)&_)===_;break;default:break}return{title:e.title,message:e.description,isPopped:t,check:r||(()=>!1),cheevoId:e._id}}),console.log(`CheevosMap::`,this.cheevosMap)}resetGameVars(){this.score=0,this.lives=u,this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted=!1,this.roundNumber=0,this.islandNumber=0}newGameVars(){this.isGameOver=!1,this.isGameInProgress=!0,this.score=this.getScore(),this.lives=this.getLives(),this.scoreSubmitted=!1,this.roundNumber=0,this.islandNumber=0,console.log(`Started New Game`,this.score,this.lives)}getScore(){let e=t(r,this),n=t(i,this),s=t(a,this),c=t(o,this);return parseInt(e+n+s+c,10)}getIsland(){return this.cpuReadNS(l)}getRound(){return this.cpuReadNS(c)}getLives(){return this.cpuReadNS(s)}newGameCheck(){let e=this.getLives();return this.isGameOver&&e===2&&this.cpuReadNS(d)===6}endGameCheck(){return this.isGameInProgress&&this.getLives()===u}execute(){this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{}));let e=this.getScore();e!==this.score&&!this.isGameOver&&(this.score=e);let t=this.getLives();t!==this.lives&&(this.lives=t,console.log(`${this.name}.lives=`,this.lives));let n=this.getRound();n!==this.roundNumber&&(this.roundNumber=n);let r=this.getIsland();if(r!==this.islandNumber&&(console.log(`New Island .islandNumber=${this.islandNumber}`,this.roundNumber),this.islandNumber=r),this.endGameCheck()){if(this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted)return;this.scoreSubmitted=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${this.name} Leaderboard!`})})}this.isGameOver||this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{b as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t}from"./string-utils-CMVABfx0.js";var n=19245,r=19246,i=19247,a=19248,o=19274,s=19235,c=19211,l=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:c,length:1,label:`Reset state`},{address:s,length:1,label:`Game over state`},{address:n,length:4,label:`Lives and score`},{address:o,length:1,label:`Player hit`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){console.log(`Stix::constructor`,t,r),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map((e,t)=>{let n=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:n,check:()=>{},cheevoId:e._id}}),this.isGameOver=!0,this.score=0,this.lives=0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.lives=this.getLives(),console.log(`Start New Game`,this.score,this.lives)}getScore(){let e=t(a,this),n=t(i,this),o=t(r,this);return parseInt(e+n+o,10)}getIsDead(){return parseInt(this.cpuReadNS(s),10)===0}getLives(){return parseInt(this.cpuReadNS(n).toString(16),10)}newGameCheck(){return parseInt(this.cpuReadNS(c).toString(16),10),parseInt(this.cpuReadNS(c).toString(16),10)===1?!this.getIsDead()&&this.getLives()===3:this.isGameOver&&!this.getIsDead()&&this.getLives()===3}execute(){let e=this.getScore();e!==this.score&&(this.score=e,console.log(`Stix.score=`,this.score)),this.isGameOver&&this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{}));let t=this.getLives();t!==this.lives&&(this.lives=t,console.log(`Stix.lives=`,this.lives)),t===0&&this.getIsDead()&&!this.isGameOver&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the STIX Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{l as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=36162,i=53063,a=53064,o=53065,s=53051,c=53037,l=53114,u=53170,d=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:r,length:1,label:`Game state`},{address:c,length:15,label:`Level state`},{address:i,length:3,label:`Score`},{address:l,length:1,label:`Ball state`},{address:u,length:4,label:`Power state`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){console.log(`Tilt::constructor`,t,i),this._popCheevo=o,this.postScore=s,this.watcher=e(),this.cheevos=[],this.user=r,this.gameId=t,this.score=0,this.power=0,this.isGameOver=!0,this.cheevosSet=i,this.cheevosMap=i.cheevos.map(e=>{let t=a.some(t=>t.achievement._id===e._id),r;switch(n(e.title)){case`welcomeToYourNewJob`:r=()=>this.score>=100;break}return{title:e.title,message:e.description,isPopped:t,check:r,cheevoId:e._id}})}getScore(){let e=t(o,this),n=t(a,this),r=t(i,this);return parseInt(e+n+r,10)}getPower(){return this.cpuReadNS(53170).toString(16)}newGameCheck(){return this.cpuReadNS(l).toString(16)===`0`&&this.cpuReadNS(u).toString(16)===`30`&&this.cpuReadNS(s).toString(16)===`0`}gameOverCheck(){return this.cpuReadNS(r).toString(16)===`0`}debug(e,t){console.log(`Tilt::Debug`,t,this.cpuReadNS(e).toString(16))}execute=()=>{this.isGameOver&&this.newGameCheck()&&(console.log(`Tilt::NewGame!`,this.score),this.isGameOver=!1,this.watcher.dispatch(`newGame`,{}));let e=this.getScore();e!==this.score&&(this.score=e),!this.isGameOver&&this.gameOverCheck()&&(console.log(`Tilt::GameOver! score=`,e,this.score),this.isGameOver=!0,this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the Tilt Leaderboard!`}),this.watcher.dispatch(`gameOver`,{score:this.score})}));let t=this.getPower();t!==this.power&&(this.power=t),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{d as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t}from"./string-utils-CMVABfx0.js";var n=526,r=512,i=513,a=514,o=515,s=572,c=`Up 'n' Down`,l=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:r,length:15,label:`Score and lives`},{address:s,length:1,label:`Attract mode`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){console.log(`%s :: constructor`,c,t,r),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map((e,t)=>{let n=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:n,check:()=>{},cheevoId:e._id}}),this.isGameOver=!0,this.score=0,this.lives=0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.lives=this.getLives(),console.log(`Start New Game of %s`,c,this.score,this.lives)}getScore(){let e=t(r,this),n=t(i,this),s=t(a,this),c=t(o,this);return parseInt(e+n+s+c)}getIsAttractMode(){return(this.cpuReadNS(s)&128)!=0}getLives(){return this.cpuReadNS(n)}execute(){if(this.isGameOver&&!this.getIsAttractMode()&&this.getLives()===4&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),this.getIsAttractMode())return;let e=this.getScore();e!==this.score&&!this.isGameOver&&(this.score=e,console.log(`%s.score=`,c,this.score));let t=this.getLives();t!==this.lives&&!this.getIsAttractMode()&&(this.lives=t,console.log(`%s.lives=`,c,this.lives)),t===255&&!this.getIsAttractMode()&&!this.isGameOver&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${c} Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{l as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{t}from"./string-utils-CMVABfx0.js";var n=38,r=135,i=169,a=150,o=37,s=151,c=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:37,length:2,label:`Lives and level`},{address:135,length:1,label:`Formations`},{address:150,length:2,label:`Level state`},{address:169,length:1,label:`Destruct sequence`},{address:18515,length:6,label:`Score`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:o,user:s,cheevosSet:c={cheevos:[]},poppedCheevos:l=[],popCheevo:u=async()=>{},postScore:d=async()=>({})}){console.log(`Uridium initialized`,c,o),this._popCheevo=u,this.gameId=o,this.user=s,this.lives=0,this.level=0,this.fightersDestroyed=0,this.watcher=e(),this.cheevosSet=c,this.cheevosMap=c.cheevos.map((e,o)=>{let s=l.some(t=>t.achievement._id===e._id),c=()=>{};switch(t(e.title)){case`zinc`:c=()=>parseInt(this.cpuReadNS(n))===1&&parseInt(this.cpuReadNS(a))===23;break;case`lead`:c=()=>parseInt(this.cpuReadNS(n))===2&&parseInt(this.cpuReadNS(a))===23;break;case`copper`:c=()=>parseInt(this.cpuReadNS(n))===3&&parseInt(this.cpuReadNS(a))===23;break;case`silver`:c=()=>parseInt(this.cpuReadNS(n))===4&&parseInt(this.cpuReadNS(a))===23;break;case`iron`:c=()=>parseInt(this.cpuReadNS(n))===5&&parseInt(this.cpuReadNS(a))===23;break;case`gold`:c=()=>parseInt(this.cpuReadNS(n))===6&&parseInt(this.cpuReadNS(a))===23;break;case`platinum`:c=()=>parseInt(this.cpuReadNS(n))===7&&parseInt(this.cpuReadNS(a))===23;break;case`tungsten`:c=()=>parseInt(this.cpuReadNS(n))===8&&parseInt(this.cpuReadNS(a))===23;break;case`iridon`:c=()=>parseInt(this.cpuReadNS(n))===9&&parseInt(this.cpuReadNS(a))===23;break;case`kallisto`:c=()=>parseInt(this.cpuReadNS(n))===10&&parseInt(this.cpuReadNS(a))===23;break;case`triAlloy`:c=()=>parseInt(this.cpuReadNS(n))===11&&parseInt(this.cpuReadNS(a))===23;break;case`quadminium`:c=()=>parseInt(this.cpuReadNS(n))===12&&parseInt(this.cpuReadNS(a))===23;break;case`ergonite`:c=()=>parseInt(this.cpuReadNS(n))===13&&parseInt(this.cpuReadNS(a))===23;break;case`galactium`:c=()=>parseInt(this.cpuReadNS(n))===14&&parseInt(this.cpuReadNS(a))===23;break;case`greatShotTurkey`:c=()=>parseInt(this.cpuReadNS(n))===15&&parseInt(this.cpuReadNS(a))===23;break;case`novicePilot`:c=()=>this.score>=1e4;break;case`experiencedPilot`:c=()=>this.score>=25e3;break;case`veteranPilot`:c=()=>this.score>=5e4;break;case`elitePilot`:c=()=>this.score>=1e5;break;case`uridiumAce`:c=()=>this.score>=15e4;break;case`meltdown`:c=()=>parseInt(this.cpuReadNS(i))===0&&parseInt(this.cpuReadNS(a))===23;break;case`clearedHot`:c=()=>parseInt(this.cpuReadNS(r))===6;break;case`dogFighter`:c=()=>{};break}return{title:e.title,message:e.description,isPopped:s,check:c,cheevoId:e._id}}),this.score=0,this.highScore=0,this.postScore=d,this.scoreSubmitted=!1}getScore=()=>{let e=this.cpuReadNS(18515).toString(16)===`30`?`0`:this.cpuReadNS(18515).toString(16),t=this.cpuReadNS(18516).toString(16)===`30`?`0`:this.cpuReadNS(18516).toString(16),n=this.cpuReadNS(18517).toString(16)===`30`?`0`:this.cpuReadNS(18517).toString(16),r=this.cpuReadNS(18518).toString(16)===`30`?`0`:this.cpuReadNS(18518).toString(16),i=this.cpuReadNS(18519).toString(16)===`30`?`0`:this.cpuReadNS(18519).toString(16),a=this.cpuReadNS(18520).toString(16)===`30`?`0`:this.cpuReadNS(18520).toString(16);return parseInt(e+t+n+r+i+a)};getLevel=()=>parseInt(this.cpuReadNS(n));getLives=()=>parseInt(this.cpuReadNS(o).toString(16));getFighterDestroyed=()=>parseInt(this.cpuReadNS(s))===38;execute=()=>{let e=this.getScore();e!==this.score&&(this.score=e),this.getFighterDestroyed()&&(this.fightersDestroyed+=1);let t=this.getLevel();t!==this.level&&(this.level=t);let n=this.getLives();n!==this.lives&&(n>0&&this.lives===0&&(this.scoreSubmitted=!1,this.watcher.dispatch(`newGame`,{gameMode:0})),n<this.lives&&console.log(`Uridium::life lost`,n),n===0&&this.lives===1&&!this.scoreSubmitted&&(this.scoreSubmitted=!0,this.fightersDestroyed=0,this.watcher.dispatch(`gameOver`,{score:this.score,gameMode:0,highScore:this.score>this.highScore?this.score:0}),console.log(`User submit`,this.user,e,this.score),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the URIDIUM Leaderboard!`})})),this.lives=n,this.watcher.dispatch(`livesChange`,{lives:this.lives})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{c as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=20932,i=20933,a=20934,o=2249,s=20939,c=788,l=class{static ultimate={pollIntervalMs:250,memoryRanges:[{address:c,length:1,label:`Game state`},{address:o,length:1,label:`Game mode`},{address:r,length:8,label:`Score and shuffles`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){console.log(`Vegetables Deluxe initialized`,i,t),this.gameModes=[`casual`,`shopping`,`classic`,`countdown`],this._popCheevo=o,this._postScore=s,this.user=r,this.gameId=t,this.watcher=e(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map((e,t)=>{let r=a.some(t=>t.achievement._id===e._id),i=()=>{};switch(n(e.title)){}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}}),this.resetGameVars()}resetGameVars(){this.score=0,this.shuffles=0,this.gameMode=-1,this.isGameOver=!0}newGameVars(){this.score=0,this.isGameOver=!1,this.gameMode=this.getGameMode()}getGameMode=()=>parseInt(this.cpuReadNS(o).toString(16),10)-1;getScore=()=>{let e=t(a,this),n=t(i,this),o=t(r,this);return parseInt(e+n+o,10)*100};getShuffles=()=>parseInt(this.cpuReadNS(s).toString(16),16);gameOverCheck=()=>!this.isGameOver&&this.shuffles===255;newGameCheck=()=>!this.isGameOver||this.cpuReadNS(c)===140?!1:this.isGameOver&&(this.cpuReadNS(c)===171||this.cpuReadNS(c)===149)?(console.log(`Starting new game score=`,this.getScore()),!0):!1;inMenuCheck=()=>!this.isGameOver&&this.cpuReadNS(c)===140;execute=()=>{let e=this.getScore(),t=this.getShuffles();t!==this.shuffles&&(this.shuffles=t,this.gameOverCheck()&&(console.log(`GameOver gameMode=%s | score=%s`,this.gameMode,e),this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:e}),this.postScore(e)),console.log(`this.currentShuffles=`,this.shuffles,this.score)),this.inMenuCheck()&&(console.log(`game reset`),this.isGameOver=!0),this.newGameCheck()&&(this.isGameOver=!1,this.newGameVars(),this.watcher.dispatch(`newGame`,{gameMode:this.gameMode}),console.log(`New Game::mode=%s (%s)`,this.gameMode,this.gameModeStr())),!this.isGameOver&&e!==this.score&&(this.score=e),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})};gameModeStr(){switch(this.gameMode){case-1:return`Casual`;case 0:return`Shopping`;case 1:return`Classic`;case 2:return`Countdown`}}postScore(e){if(console.log(`Post Score:`,e,`gameMode:`,this.gameMode,`{%s}`,this.gameModeStr()),this.gameMode===-1){this.watcher.dispatch(`cheevo`,{title:`Casual game`,message:`Casual Mode has no leaderboard, Your score was: ${e}`});return}this._postScore(this.gameId,e,this.user.id,this.user.username,this.gameMode).then(t=>{console.log(`Score posted successfully`,t),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${e} has been submitted to the Vegetables ${this.gameModeStr()} Leaderboard!`}),this.resetGameVars()})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{l as default};