deepwoken 0.1.5 → 0.1.7

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/index.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  export { ATTUNEMENT_STATS, CORE_STATS, WEAPON_STATS } from './types.js';
2
2
  export type { Aspect, Mantra, Outfit, Stat, Talent, Weapon } from './types.js';
3
3
 
4
- import type { Aspect, Mantra, Outfit, Talent, Weapon } from './types.js';
4
+ import type { Aspect, Mantra, Outfit, Stat, Talent, Weapon } from './types.js';
5
5
 
6
6
  // dynamically import wasm bc the server will try to load wasm regardless man
7
- let WasmDeepData: typeof import('./pkg/deepwoken.js').DeepData;
7
+ let WasmDeepData: any;
8
+ let WasmStatMap: any;
8
9
 
9
10
  if (typeof window !== 'undefined') {
10
11
  const wasm = await import('./pkg/deepwoken.js');
11
12
  await wasm.default();
12
13
  WasmDeepData = wasm.DeepData;
14
+ WasmStatMap = wasm.StatMap;
13
15
  }
14
16
 
15
17
  export class DeepData {
@@ -43,3 +45,17 @@ export class DeepData {
43
45
  outfits(): Outfit[] { return this._wasm.outfits(); }
44
46
  aspects(): Aspect[] { return this._wasm.aspects(); }
45
47
  }
48
+
49
+ export class StatMap {
50
+ private _wasm: any;
51
+
52
+ constructor(map: Partial<Record<Stat, number>> = {}) {
53
+ this._wasm = new WasmStatMap(map);
54
+ }
55
+
56
+ /* The total build cost, accounting for multi-attunement shenanigans */
57
+ cost(): number { return this._wasm.cost(); }
58
+ get(stat: Stat): number { return this._wasm.get(stat); }
59
+ set(stat: Stat, value: number) { this._wasm.set(stat, value); }
60
+ toJSON(): Partial<Record<Stat, number>> { return this._wasm.toJSON(); }
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepwoken",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -29,11 +29,22 @@ export class DeepData {
29
29
  weapons(): any;
30
30
  }
31
31
 
32
+ export class StatMap {
33
+ free(): void;
34
+ [Symbol.dispose](): void;
35
+ cost(): number;
36
+ get(stat: string): number;
37
+ constructor(map: any);
38
+ set(stat: string, value: number): void;
39
+ toJSON(): any;
40
+ }
41
+
32
42
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
33
43
 
34
44
  export interface InitOutput {
35
45
  readonly memory: WebAssembly.Memory;
36
46
  readonly __wbg_deepdata_free: (a: number, b: number) => void;
47
+ readonly __wbg_statmap_free: (a: number, b: number) => void;
37
48
  readonly deepdata_aspects: (a: number) => [number, number, number];
38
49
  readonly deepdata_fetchLatest: () => any;
39
50
  readonly deepdata_fetchLatestFrom: (a: number, b: number, c: number, d: number) => any;
@@ -47,6 +58,11 @@ export interface InitOutput {
47
58
  readonly deepdata_outfits: (a: number) => [number, number, number];
48
59
  readonly deepdata_talents: (a: number) => [number, number, number];
49
60
  readonly deepdata_weapons: (a: number) => [number, number, number];
61
+ readonly statmap_cost: (a: number) => number;
62
+ readonly statmap_get: (a: number, b: number, c: number) => [number, number, number];
63
+ readonly statmap_new: (a: any) => [number, number, number];
64
+ readonly statmap_set: (a: number, b: number, c: number, d: number) => [number, number];
65
+ readonly statmap_toJSON: (a: number) => [number, number, number];
50
66
  readonly wasm_bindgen__closure__destroy__hf10da1d08ed9fc18: (a: number, b: number) => void;
51
67
  readonly wasm_bindgen__closure__destroy__he46194fcf4899997: (a: number, b: number) => void;
52
68
  readonly wasm_bindgen__convert__closures_____invoke__h71bc5879fd2abe15: (a: number, b: number, c: any) => [number, number];
package/pkg/deepwoken.js CHANGED
@@ -172,6 +172,74 @@ export class DeepData {
172
172
  }
173
173
  if (Symbol.dispose) DeepData.prototype[Symbol.dispose] = DeepData.prototype.free;
174
174
 
175
+ export class StatMap {
176
+ __destroy_into_raw() {
177
+ const ptr = this.__wbg_ptr;
178
+ this.__wbg_ptr = 0;
179
+ StatMapFinalization.unregister(this);
180
+ return ptr;
181
+ }
182
+ free() {
183
+ const ptr = this.__destroy_into_raw();
184
+ wasm.__wbg_statmap_free(ptr, 0);
185
+ }
186
+ /**
187
+ * @returns {number}
188
+ */
189
+ cost() {
190
+ const ret = wasm.statmap_cost(this.__wbg_ptr);
191
+ return ret;
192
+ }
193
+ /**
194
+ * @param {string} stat
195
+ * @returns {number}
196
+ */
197
+ get(stat) {
198
+ const ptr0 = passStringToWasm0(stat, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
199
+ const len0 = WASM_VECTOR_LEN;
200
+ const ret = wasm.statmap_get(this.__wbg_ptr, ptr0, len0);
201
+ if (ret[2]) {
202
+ throw takeFromExternrefTable0(ret[1]);
203
+ }
204
+ return ret[0];
205
+ }
206
+ /**
207
+ * @param {any} map
208
+ */
209
+ constructor(map) {
210
+ const ret = wasm.statmap_new(map);
211
+ if (ret[2]) {
212
+ throw takeFromExternrefTable0(ret[1]);
213
+ }
214
+ this.__wbg_ptr = ret[0] >>> 0;
215
+ StatMapFinalization.register(this, this.__wbg_ptr, this);
216
+ return this;
217
+ }
218
+ /**
219
+ * @param {string} stat
220
+ * @param {number} value
221
+ */
222
+ set(stat, value) {
223
+ const ptr0 = passStringToWasm0(stat, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
224
+ const len0 = WASM_VECTOR_LEN;
225
+ const ret = wasm.statmap_set(this.__wbg_ptr, ptr0, len0, value);
226
+ if (ret[1]) {
227
+ throw takeFromExternrefTable0(ret[0]);
228
+ }
229
+ }
230
+ /**
231
+ * @returns {any}
232
+ */
233
+ toJSON() {
234
+ const ret = wasm.statmap_toJSON(this.__wbg_ptr);
235
+ if (ret[2]) {
236
+ throw takeFromExternrefTable0(ret[1]);
237
+ }
238
+ return takeFromExternrefTable0(ret[0]);
239
+ }
240
+ }
241
+ if (Symbol.dispose) StatMap.prototype[Symbol.dispose] = StatMap.prototype.free;
242
+
175
243
  function __wbg_get_imports() {
176
244
  const import0 = {
177
245
  __proto__: null,
@@ -179,6 +247,10 @@ function __wbg_get_imports() {
179
247
  const ret = Error(getStringFromWasm0(arg0, arg1));
180
248
  return ret;
181
249
  },
250
+ __wbg_Number_7da99b0afe51b89a: function(arg0) {
251
+ const ret = Number(arg0);
252
+ return ret;
253
+ },
182
254
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
183
255
  const ret = String(arg1);
184
256
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -186,6 +258,17 @@ function __wbg_get_imports() {
186
258
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
187
259
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
188
260
  },
261
+ __wbg___wbindgen_bigint_get_as_i64_a4925bc53b16f3d6: function(arg0, arg1) {
262
+ const v = arg1;
263
+ const ret = typeof(v) === 'bigint' ? v : undefined;
264
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
265
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
266
+ },
267
+ __wbg___wbindgen_boolean_get_4a348b369b009243: function(arg0) {
268
+ const v = arg0;
269
+ const ret = typeof(v) === 'boolean' ? v : undefined;
270
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
271
+ },
189
272
  __wbg___wbindgen_debug_string_43c7ccb034739216: function(arg0, arg1) {
190
273
  const ret = debugString(arg1);
191
274
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -193,6 +276,10 @@ function __wbg_get_imports() {
193
276
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
194
277
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
195
278
  },
279
+ __wbg___wbindgen_is_bigint_15e2d080220c7748: function(arg0) {
280
+ const ret = typeof(arg0) === 'bigint';
281
+ return ret;
282
+ },
196
283
  __wbg___wbindgen_is_function_18bea6e84080c016: function(arg0) {
197
284
  const ret = typeof(arg0) === 'function';
198
285
  return ret;
@@ -210,6 +297,20 @@ function __wbg_get_imports() {
210
297
  const ret = arg0 === undefined;
211
298
  return ret;
212
299
  },
300
+ __wbg___wbindgen_jsval_eq_65f99081d9ee8f4d: function(arg0, arg1) {
301
+ const ret = arg0 === arg1;
302
+ return ret;
303
+ },
304
+ __wbg___wbindgen_jsval_loose_eq_1a2067dfb025b5ec: function(arg0, arg1) {
305
+ const ret = arg0 == arg1;
306
+ return ret;
307
+ },
308
+ __wbg___wbindgen_number_get_eed4462ef92e1bed: function(arg0, arg1) {
309
+ const obj = arg1;
310
+ const ret = typeof(obj) === 'number' ? obj : undefined;
311
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
312
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
313
+ },
213
314
  __wbg___wbindgen_string_get_d09f733449cbf7a2: function(arg0, arg1) {
214
315
  const obj = arg1;
215
316
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -257,6 +358,10 @@ function __wbg_get_imports() {
257
358
  const ret = arg0.done;
258
359
  return ret;
259
360
  },
361
+ __wbg_entries_d58050057c0390ac: function(arg0) {
362
+ const ret = Object.entries(arg0);
363
+ return ret;
364
+ },
260
365
  __wbg_fetch_8508e14acc7090e7: function(arg0, arg1) {
261
366
  const ret = arg0.fetch(arg1);
262
367
  return ret;
@@ -269,6 +374,14 @@ function __wbg_get_imports() {
269
374
  const ret = Reflect.get(arg0, arg1);
270
375
  return ret;
271
376
  }, arguments); },
377
+ __wbg_get_c40e2c3262995a8e: function(arg0, arg1) {
378
+ const ret = arg0[arg1 >>> 0];
379
+ return ret;
380
+ },
381
+ __wbg_get_unchecked_3de5bfaaea65f86b: function(arg0, arg1) {
382
+ const ret = arg0[arg1 >>> 0];
383
+ return ret;
384
+ },
272
385
  __wbg_has_393943c179c58bfe: function() { return handleError(function (arg0, arg1) {
273
386
  const ret = Reflect.has(arg0, arg1);
274
387
  return ret;
@@ -277,6 +390,16 @@ function __wbg_get_imports() {
277
390
  const ret = arg0.headers;
278
391
  return ret;
279
392
  },
393
+ __wbg_instanceof_ArrayBuffer_d8e4e51f1cf7287a: function(arg0) {
394
+ let result;
395
+ try {
396
+ result = arg0 instanceof ArrayBuffer;
397
+ } catch (_) {
398
+ result = false;
399
+ }
400
+ const ret = result;
401
+ return ret;
402
+ },
280
403
  __wbg_instanceof_Response_4d70bea95d48a514: function(arg0) {
281
404
  let result;
282
405
  try {
@@ -287,10 +410,28 @@ function __wbg_get_imports() {
287
410
  const ret = result;
288
411
  return ret;
289
412
  },
413
+ __wbg_instanceof_Uint8Array_6e48d83da6091cc8: function(arg0) {
414
+ let result;
415
+ try {
416
+ result = arg0 instanceof Uint8Array;
417
+ } catch (_) {
418
+ result = false;
419
+ }
420
+ const ret = result;
421
+ return ret;
422
+ },
423
+ __wbg_isSafeInteger_6709fb28be12d738: function(arg0) {
424
+ const ret = Number.isSafeInteger(arg0);
425
+ return ret;
426
+ },
290
427
  __wbg_iterator_e77d2b7575cca5a7: function() {
291
428
  const ret = Symbol.iterator;
292
429
  return ret;
293
430
  },
431
+ __wbg_length_00dd7227fd4626ad: function(arg0) {
432
+ const ret = arg0.length;
433
+ return ret;
434
+ },
294
435
  __wbg_length_5e07cf181b2745fb: function(arg0) {
295
436
  const ret = arg0.length;
296
437
  return ret;
@@ -454,12 +595,12 @@ function __wbg_get_imports() {
454
595
  return ret;
455
596
  },
456
597
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
457
- // Cast intrinsic for `Closure(Closure { dtor_idx: 140, function: Function { arguments: [], shim_idx: 141, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
598
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 145, function: Function { arguments: [], shim_idx: 146, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
458
599
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf10da1d08ed9fc18, wasm_bindgen__convert__closures_____invoke__h8e5a743d58fae3f8);
459
600
  return ret;
460
601
  },
461
602
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
462
- // Cast intrinsic for `Closure(Closure { dtor_idx: 165, function: Function { arguments: [Externref], shim_idx: 166, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
603
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 169, function: Function { arguments: [Externref], shim_idx: 170, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
463
604
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he46194fcf4899997, wasm_bindgen__convert__closures_____invoke__h71bc5879fd2abe15);
464
605
  return ret;
465
606
  },
@@ -520,6 +661,9 @@ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate
520
661
  const DeepDataFinalization = (typeof FinalizationRegistry === 'undefined')
521
662
  ? { register: () => {}, unregister: () => {} }
522
663
  : new FinalizationRegistry(ptr => wasm.__wbg_deepdata_free(ptr >>> 0, 1));
664
+ const StatMapFinalization = (typeof FinalizationRegistry === 'undefined')
665
+ ? { register: () => {}, unregister: () => {} }
666
+ : new FinalizationRegistry(ptr => wasm.__wbg_statmap_free(ptr >>> 0, 1));
523
667
 
524
668
  function addToExternrefTable0(obj) {
525
669
  const idx = wasm.__externref_table_alloc();
Binary file