motely-wasm 17.7.0 → 18.1.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
@@ -2,6 +2,8 @@
2
2
 
3
3
  WebAssembly package for [Motely](https://github.com/OptimusPi/MotelyJAML) — the Balatro seed search engine, with filters written in JAML.
4
4
 
5
+ The package ships `jaml.schema.json` (JSON Schema for the JAML filter format) at the package root, so editors can wire it up for autocomplete / validation without an extra fetch.
6
+
5
7
  ## Install
6
8
 
7
9
  ```sh
@@ -124,6 +126,60 @@ const result = Motely.analyzeJamlSeeds(jaml, ["ABCD1234", "XYZ99"]);
124
126
  console.log(Motely.version());
125
127
  ```
126
128
 
129
+ ## JAML schema
130
+
131
+ `motely-wasm` ships `jaml.schema.json` at the package root — point your editor at it for
132
+ autocomplete and inline validation while writing filters:
133
+
134
+ ```json
135
+ {
136
+ "$schema": "node_modules/motely-wasm/jaml.schema.json"
137
+ }
138
+ ```
139
+
140
+ Or with a `# yaml-language-server` comment at the top of any `.jaml` / `.yml` filter file:
141
+
142
+ ```yaml
143
+ # yaml-language-server: $schema=node_modules/motely-wasm/jaml.schema.json
144
+ name: WeeMonday
145
+ deck: Erratic
146
+ stake: Black
147
+ must:
148
+ - joker: WeeJoker
149
+ antes: [1]
150
+ ```
151
+
152
+ JAML is a YAML dialect (JSON-compatible). A filter is a flat document:
153
+
154
+ | Key | Purpose | Example |
155
+ |---|---|---|
156
+ | `name` | Human label | `WeeMonday` |
157
+ | `deck` | Starting deck | `Erratic`, `Red`, `Ghost`, … |
158
+ | `stake` | Difficulty floor | `White`, `Black`, `Gold`, … |
159
+ | `must` | All clauses must match | list of clause objects |
160
+ | `mustNot` | All clauses must NOT match | list of clause objects |
161
+ | `should` | Scored clauses (use with `score:`) | list of clause objects |
162
+
163
+ Each clause object names a target type (`joker`, `tarot`, `planet`, `voucher`, `tag`, `boss`) plus
164
+ optional filters (`antes`, `sources`, `min`, `score`):
165
+
166
+ ```yaml
167
+ must:
168
+ - joker: WeeJoker # specific item name, or "Any"
169
+ antes: [1, 2] # which antes to check (omit = all)
170
+ sources:
171
+ shopItems: [0, 1] # shop slot indices
172
+ boosterPacks: [0] # pack slot indices
173
+ - tag: NegativeTag
174
+ antes: [1]
175
+ - voucher: Telescope
176
+ antes: [1, 2]
177
+ min: 2 # appear at least N times across all listed antes
178
+ ```
179
+
180
+ Use `Motely.validateJaml(jaml)` to check a filter string at runtime; `Motely.explainJaml(jaml)`
181
+ returns a human-readable plan; `Motely.createPlan(jaml)` returns the scoring structure.
182
+
127
183
  ## Running a search
128
184
 
129
185
  `Motely.createSearch(jaml)` returns a settings builder. Chain a search-mode method,
@@ -155,6 +211,69 @@ console.log(search.isCompleted, search.totalSeedsSearched, search.matchingSeeds)
155
211
  search.cancel(); // stop early
156
212
  ```
157
213
 
214
+ ## Stream pagers
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:
219
+
220
+ ```js
221
+ import { Motely, MotelyDeck, MotelyStake } from "motely-wasm";
222
+
223
+ const pager = Motely.createShopPager("AAAAAAAA", MotelyDeck.Red, MotelyStake.White, 1);
224
+ const items = pager.getNextChunk(6); // 6 packed ints, one crossing
225
+ ```
226
+
227
+ Each factory targets a distinct PRNG stream — these are not the same stream filtered, so there
228
+ is one factory per stream type:
229
+
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 |
241
+
242
+ ## Packed-int decoders
243
+
244
+ All pager streams return packed integers. Bit fields are extracted with the decode helpers
245
+ exported from the entry point:
246
+
247
+ ```js
248
+ import {
249
+ Motely,
250
+ MotelyItemType, MotelyItemTypeCategory, MotelyJokerRarity,
251
+ MotelyItemEdition, MotelyItemSeal, MotelyItemEnhancement,
252
+ } from "motely-wasm";
253
+
254
+ const pager = Motely.createJokerPager("AAAAAAAA", 0, 0, 1);
255
+ const v = pager.getNext();
256
+
257
+ const type = Motely.decodeItemType(v); // → MotelyItemType value
258
+ const category = Motely.decodeItemCategory(v); // → MotelyItemTypeCategory value
259
+ const rarity = Motely.decodeJokerRarity(v); // → MotelyJokerRarity (Common/Uncommon/Rare/Legendary)
260
+ const edition = Motely.decodeItemEdition(v); // → MotelyItemEdition (None/Foil/Holo/Poly/Negative)
261
+ const seal = Motely.decodeItemSeal(v); // → MotelyItemSeal
262
+ const enh = Motely.decodeItemEnhancement(v); // → MotelyItemEnhancement
263
+
264
+ const perishable = Motely.isPerishable(v); // → boolean
265
+ const eternal = Motely.isEternal(v); // → boolean
266
+ const rental = Motely.isRental(v); // → boolean
267
+
268
+ console.log(MotelyItemType[type]); // e.g. "WeeJoker"
269
+ console.log(MotelyJokerRarity[rarity]); // e.g. "Common"
270
+ ```
271
+
272
+ All enum tables (`MotelyItemType`, `MotelyItemTypeCategory`, `MotelyJokerRarity`,
273
+ `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.
276
+
158
277
  ## Events
159
278
 
160
279
  | Event | Payload |
Binary file