motely-wasm 18.1.1 → 18.2.1

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.
package/README.md CHANGED
@@ -211,48 +211,52 @@ console.log(search.isCompleted, search.totalSeedsSearched, search.matchingSeeds)
211
211
  search.cancel(); // stop early
212
212
  ```
213
213
 
214
- ## Stream pagers
214
+ ## Stream cursor
215
215
 
216
- Pagers expose Balatro's raw PRNG streams one packed int per item, no JAML filter needed.
217
- **Always prefer `getNextChunk(n)` over repeated `getNext()` calls** each call is a WASM
218
- interop crossing, so batching is the right default:
216
+ `Motely.createStreamCursor(seed, deck, stake, ante, kind)` returns a stateful cursor over
217
+ one of Balatro's per-ante PRNG streamsone packed int per item, no JAML filter needed.
218
+ The `kind` argument selects which stream; one factory + one enum arg covers every stream
219
+ type:
219
220
 
220
221
  ```js
221
- import { Motely, MotelyDeck, MotelyStake } from "motely-wasm";
222
+ import { Motely } from "motely-wasm";
223
+ import { MotelyStreamKind } from "motely-wasm/motely";
224
+ import { MotelyDeck, MotelyStake } from "motely-wasm/motely/enums";
222
225
 
223
- const pager = Motely.createShopPager("AAAAAAAA", MotelyDeck.Red, MotelyStake.White, 1);
224
- const items = pager.getNextChunk(6); // 6 packed ints, one crossing
226
+ const cursor = Motely.createStreamCursor("AAAAAAAA", MotelyDeck.Red, MotelyStake.White, 1, MotelyStreamKind.Shop);
227
+ const items = cursor.getNextChunk(6); // 6 packed ints, one WASM crossing
225
228
  ```
226
229
 
227
- Each factory targets a distinct PRNG streamthese are not the same stream filtered, so there
228
- is one factory per stream type:
230
+ **Always prefer `getNextChunk(n)` over repeated `getNext()` calls**each call is a WASM
231
+ interop crossing, so batching is the right default.
229
232
 
230
- | Factory | Stream |
231
- |---|---|
232
- | `createShopPager(seed, deck, stake, ante)` | Mixed shop (jokers, tarots, planets, spectrals on Ghost, standard cards with MagicTrick) |
233
- | `createJokerPager(seed, deck, stake, ante)` | Shop jokers — includes edition + sticker bits |
234
- | `createTarotPager(seed, deck, stake, ante)` | Shop tarots |
235
- | `createPlanetPager(seed, deck, stake, ante)` | Shop planets |
236
- | `createSpectralPager(seed, deck, stake, ante)` | Shop spectrals (non-Ghost returns `SpectralExcludedByStream`) |
237
- | `createLegendaryJokerPager(seed, deck, stake, ante)` | Legendary fixed-rarity joker stream |
238
- | `createRareTagJokerPager(seed, deck, stake, ante)` | Rare Tag hand-out joker stream |
239
- | `createTagPager(seed, deck, stake, ante)` | Tags — value is `MotelyTag` cast to int |
240
- | `createVoucherPager(seed, deck, stake, ante)` | Vouchers — value is `MotelyVoucher` cast to int |
233
+ | `MotelyStreamKind` value | Stream | Returned int |
234
+ |---|---|---|
235
+ | `Shop` | Mixed shop (jokers, tarots, planets, spectrals on Ghost, standard cards with MagicTrick) | Packed item (`decodeItemType`, `decodeItemCategory`, …) |
236
+ | `Joker` | Shop jokers — includes edition + sticker bits | Packed item |
237
+ | `Tarot` | Shop tarots | Packed item |
238
+ | `Planet` | Shop planets | Packed item |
239
+ | `Spectral` | Shop spectrals (non-Ghost returns `SpectralExcludedByStream`) | Packed item |
240
+ | `LegendaryJoker` | Legendary fixed-rarity joker stream | Packed item |
241
+ | `RareTagJoker` | Rare Tag hand-out joker stream | Packed item |
242
+ | `Tag` | Tags — raw `MotelyTag` enum cast to int. Decoders do not apply; use `MotelyTag[value]`. | `(int)MotelyTag` |
243
+ | `Voucher` | Vouchers — raw `MotelyVoucher` enum cast to int. Uses an empty run state, so odd-indexed (prerequisite-required) vouchers are skipped by the engine. Use `MotelyVoucher[value]`. | `(int)MotelyVoucher` |
241
244
 
242
245
  ## Packed-int decoders
243
246
 
244
- All pager streams return packed integers. Bit fields are extracted with the decode helpers
245
- exported from the entry point:
247
+ Stream cursors return packed integers. Bit fields are extracted with the decode helpers
248
+ on `Motely`:
246
249
 
247
250
  ```js
251
+ import { Motely } from "motely-wasm";
252
+ import { MotelyStreamKind } from "motely-wasm/motely";
248
253
  import {
249
- Motely,
250
254
  MotelyItemType, MotelyItemTypeCategory, MotelyJokerRarity,
251
255
  MotelyItemEdition, MotelyItemSeal, MotelyItemEnhancement,
252
- } from "motely-wasm";
256
+ } from "motely-wasm/motely/enums";
253
257
 
254
- const pager = Motely.createJokerPager("AAAAAAAA", 0, 0, 1);
255
- const v = pager.getNext();
258
+ const cursor = Motely.createStreamCursor("AAAAAAAA", 0, 0, 1, MotelyStreamKind.Joker);
259
+ const v = cursor.getNext();
256
260
 
257
261
  const type = Motely.decodeItemType(v); // → MotelyItemType value
258
262
  const category = Motely.decodeItemCategory(v); // → MotelyItemTypeCategory value
@@ -271,8 +275,9 @@ console.log(MotelyJokerRarity[rarity]); // e.g. "Common"
271
275
 
272
276
  All enum tables (`MotelyItemType`, `MotelyItemTypeCategory`, `MotelyJokerRarity`,
273
277
  `MotelyItemEdition`, `MotelyItemSeal`, `MotelyItemEnhancement`, `MotelyTag`,
274
- `MotelyVoucher`, `MotelyBoosterPack`, `MotelyDeck`, `MotelyStake`) are exported from
275
- `motely-wasm` and can be used for reverse-lookup by numeric value or forward-lookup by name.
278
+ `MotelyVoucher`, `MotelyBoosterPack`, `MotelyDeck`, `MotelyStake`) live at
279
+ `motely-wasm/motely/enums` and can be used for reverse-lookup by numeric value or
280
+ forward-lookup by name. `MotelyStreamKind` lives at `motely-wasm/motely`.
276
281
 
277
282
  ## Events
278
283
 
@@ -296,7 +301,8 @@ Motely.onScoredResult.unsubscribe(handler);
296
301
  | Import path | Contents |
297
302
  |---|---|
298
303
  | `motely-wasm` | Default export: `boot`, `getStatus`, `BootStatus`. Named export: `Motely` (main API) |
299
- | `motely-wasm/motely` | Types: `IMotelySearch`, `IMotelySearchSettingsInterop`, `MotelyProgress`, `MotelyScoredSeedResult`, `MotelyDeck`, `MotelyStake`, enums |
304
+ | `motely-wasm/motely` | `IMotelySearch`, `IMotelySearchSettingsInterop`, `IMotelyStreamCursor`, `MotelyProgress`, `MotelyScoredSeedResult`, `MotelyStreamKind` |
305
+ | `motely-wasm/motely/enums` | All Balatro enums — `MotelyItemType`, `MotelyItemTypeCategory`, `MotelyJokerRarity`, `MotelyItemEdition`, `MotelyItemSeal`, `MotelyItemEnhancement`, `MotelyTag`, `MotelyVoucher`, `MotelyBoosterPack`, `MotelyDeck`, `MotelyStake`, `MotelyBossBlind`, etc. |
300
306
  | `motely-wasm/motely/filters` | `JamlAesthetic`, `JamlSearchPlan` |
301
307
  | `motely-wasm/motely/analysis` | `MotelyJamlyzerResult`, `MotelySeedAnalysis` |
302
308
  | `motely-wasm/bootsharp/file-system` | File-system interop (browser OPFS) — `PermissionMode`, `IFileMounter` |
Binary file