deepwoken 0.1.5 → 0.1.6

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,16 @@ 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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepwoken",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -29,11 +29,21 @@ 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
+ }
40
+
32
41
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
33
42
 
34
43
  export interface InitOutput {
35
44
  readonly memory: WebAssembly.Memory;
36
45
  readonly __wbg_deepdata_free: (a: number, b: number) => void;
46
+ readonly __wbg_statmap_free: (a: number, b: number) => void;
37
47
  readonly deepdata_aspects: (a: number) => [number, number, number];
38
48
  readonly deepdata_fetchLatest: () => any;
39
49
  readonly deepdata_fetchLatestFrom: (a: number, b: number, c: number, d: number) => any;
@@ -47,6 +57,10 @@ export interface InitOutput {
47
57
  readonly deepdata_outfits: (a: number) => [number, number, number];
48
58
  readonly deepdata_talents: (a: number) => [number, number, number];
49
59
  readonly deepdata_weapons: (a: number) => [number, number, number];
60
+ readonly statmap_cost: (a: number) => number;
61
+ readonly statmap_get: (a: number, b: number, c: number) => [number, number, number];
62
+ readonly statmap_new: (a: any) => [number, number, number];
63
+ readonly statmap_set: (a: number, b: number, c: number, d: number) => [number, number];
50
64
  readonly wasm_bindgen__closure__destroy__hf10da1d08ed9fc18: (a: number, b: number) => void;
51
65
  readonly wasm_bindgen__closure__destroy__he46194fcf4899997: (a: number, b: number) => void;
52
66
  readonly wasm_bindgen__convert__closures_____invoke__h71bc5879fd2abe15: (a: number, b: number, c: any) => [number, number];
package/pkg/deepwoken.js CHANGED
@@ -172,6 +172,64 @@ 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
+ if (Symbol.dispose) StatMap.prototype[Symbol.dispose] = StatMap.prototype.free;
232
+
175
233
  function __wbg_get_imports() {
176
234
  const import0 = {
177
235
  __proto__: null,
@@ -179,6 +237,10 @@ function __wbg_get_imports() {
179
237
  const ret = Error(getStringFromWasm0(arg0, arg1));
180
238
  return ret;
181
239
  },
240
+ __wbg_Number_7da99b0afe51b89a: function(arg0) {
241
+ const ret = Number(arg0);
242
+ return ret;
243
+ },
182
244
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
183
245
  const ret = String(arg1);
184
246
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -186,6 +248,17 @@ function __wbg_get_imports() {
186
248
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
187
249
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
188
250
  },
251
+ __wbg___wbindgen_bigint_get_as_i64_a4925bc53b16f3d6: function(arg0, arg1) {
252
+ const v = arg1;
253
+ const ret = typeof(v) === 'bigint' ? v : undefined;
254
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
255
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
256
+ },
257
+ __wbg___wbindgen_boolean_get_4a348b369b009243: function(arg0) {
258
+ const v = arg0;
259
+ const ret = typeof(v) === 'boolean' ? v : undefined;
260
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
261
+ },
189
262
  __wbg___wbindgen_debug_string_43c7ccb034739216: function(arg0, arg1) {
190
263
  const ret = debugString(arg1);
191
264
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -193,6 +266,10 @@ function __wbg_get_imports() {
193
266
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
194
267
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
195
268
  },
269
+ __wbg___wbindgen_is_bigint_15e2d080220c7748: function(arg0) {
270
+ const ret = typeof(arg0) === 'bigint';
271
+ return ret;
272
+ },
196
273
  __wbg___wbindgen_is_function_18bea6e84080c016: function(arg0) {
197
274
  const ret = typeof(arg0) === 'function';
198
275
  return ret;
@@ -210,6 +287,20 @@ function __wbg_get_imports() {
210
287
  const ret = arg0 === undefined;
211
288
  return ret;
212
289
  },
290
+ __wbg___wbindgen_jsval_eq_65f99081d9ee8f4d: function(arg0, arg1) {
291
+ const ret = arg0 === arg1;
292
+ return ret;
293
+ },
294
+ __wbg___wbindgen_jsval_loose_eq_1a2067dfb025b5ec: function(arg0, arg1) {
295
+ const ret = arg0 == arg1;
296
+ return ret;
297
+ },
298
+ __wbg___wbindgen_number_get_eed4462ef92e1bed: function(arg0, arg1) {
299
+ const obj = arg1;
300
+ const ret = typeof(obj) === 'number' ? obj : undefined;
301
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
302
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
303
+ },
213
304
  __wbg___wbindgen_string_get_d09f733449cbf7a2: function(arg0, arg1) {
214
305
  const obj = arg1;
215
306
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -257,6 +348,10 @@ function __wbg_get_imports() {
257
348
  const ret = arg0.done;
258
349
  return ret;
259
350
  },
351
+ __wbg_entries_d58050057c0390ac: function(arg0) {
352
+ const ret = Object.entries(arg0);
353
+ return ret;
354
+ },
260
355
  __wbg_fetch_8508e14acc7090e7: function(arg0, arg1) {
261
356
  const ret = arg0.fetch(arg1);
262
357
  return ret;
@@ -269,6 +364,14 @@ function __wbg_get_imports() {
269
364
  const ret = Reflect.get(arg0, arg1);
270
365
  return ret;
271
366
  }, arguments); },
367
+ __wbg_get_c40e2c3262995a8e: function(arg0, arg1) {
368
+ const ret = arg0[arg1 >>> 0];
369
+ return ret;
370
+ },
371
+ __wbg_get_unchecked_3de5bfaaea65f86b: function(arg0, arg1) {
372
+ const ret = arg0[arg1 >>> 0];
373
+ return ret;
374
+ },
272
375
  __wbg_has_393943c179c58bfe: function() { return handleError(function (arg0, arg1) {
273
376
  const ret = Reflect.has(arg0, arg1);
274
377
  return ret;
@@ -277,6 +380,16 @@ function __wbg_get_imports() {
277
380
  const ret = arg0.headers;
278
381
  return ret;
279
382
  },
383
+ __wbg_instanceof_ArrayBuffer_d8e4e51f1cf7287a: function(arg0) {
384
+ let result;
385
+ try {
386
+ result = arg0 instanceof ArrayBuffer;
387
+ } catch (_) {
388
+ result = false;
389
+ }
390
+ const ret = result;
391
+ return ret;
392
+ },
280
393
  __wbg_instanceof_Response_4d70bea95d48a514: function(arg0) {
281
394
  let result;
282
395
  try {
@@ -287,10 +400,28 @@ function __wbg_get_imports() {
287
400
  const ret = result;
288
401
  return ret;
289
402
  },
403
+ __wbg_instanceof_Uint8Array_6e48d83da6091cc8: function(arg0) {
404
+ let result;
405
+ try {
406
+ result = arg0 instanceof Uint8Array;
407
+ } catch (_) {
408
+ result = false;
409
+ }
410
+ const ret = result;
411
+ return ret;
412
+ },
413
+ __wbg_isSafeInteger_6709fb28be12d738: function(arg0) {
414
+ const ret = Number.isSafeInteger(arg0);
415
+ return ret;
416
+ },
290
417
  __wbg_iterator_e77d2b7575cca5a7: function() {
291
418
  const ret = Symbol.iterator;
292
419
  return ret;
293
420
  },
421
+ __wbg_length_00dd7227fd4626ad: function(arg0) {
422
+ const ret = arg0.length;
423
+ return ret;
424
+ },
294
425
  __wbg_length_5e07cf181b2745fb: function(arg0) {
295
426
  const ret = arg0.length;
296
427
  return ret;
@@ -454,12 +585,12 @@ function __wbg_get_imports() {
454
585
  return ret;
455
586
  },
456
587
  __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`.
588
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 145, function: Function { arguments: [], shim_idx: 146, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
458
589
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf10da1d08ed9fc18, wasm_bindgen__convert__closures_____invoke__h8e5a743d58fae3f8);
459
590
  return ret;
460
591
  },
461
592
  __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`.
593
+ // 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
594
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he46194fcf4899997, wasm_bindgen__convert__closures_____invoke__h71bc5879fd2abe15);
464
595
  return ret;
465
596
  },
@@ -520,6 +651,9 @@ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate
520
651
  const DeepDataFinalization = (typeof FinalizationRegistry === 'undefined')
521
652
  ? { register: () => {}, unregister: () => {} }
522
653
  : new FinalizationRegistry(ptr => wasm.__wbg_deepdata_free(ptr >>> 0, 1));
654
+ const StatMapFinalization = (typeof FinalizationRegistry === 'undefined')
655
+ ? { register: () => {}, unregister: () => {} }
656
+ : new FinalizationRegistry(ptr => wasm.__wbg_statmap_free(ptr >>> 0, 1));
523
657
 
524
658
  function addToExternrefTable0(obj) {
525
659
  const idx = wasm.__externref_table_alloc();
Binary file