deepwoken 0.1.9 → 0.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/index.ts CHANGED
@@ -6,12 +6,14 @@ import type { Aspect, Mantra, Outfit, Stat, Talent, Weapon } from './types.js';
6
6
  // dynamically import wasm bc the server will try to load wasm regardless man
7
7
  let WasmDeepData: any;
8
8
  let WasmStatMap: any;
9
+ let wasmNameToIdentifier: (name: string) => string;
9
10
 
10
11
  if (typeof window !== 'undefined') {
11
12
  const wasm = await import('./pkg/deepwoken.js');
12
13
  await wasm.default();
13
14
  WasmDeepData = wasm.DeepData;
14
15
  WasmStatMap = wasm.StatMap;
16
+ wasmNameToIdentifier = wasm.nameToIdentifier;
15
17
  }
16
18
 
17
19
  export class DeepData {
@@ -46,6 +48,11 @@ export class DeepData {
46
48
  aspects(): Aspect[] { return this._wasm.aspects(); }
47
49
  }
48
50
 
51
+ /** Transforms the name of things ingame into a parsable identifier/key used in the database */
52
+ export function nameToIdentifier(name: string): string {
53
+ return wasmNameToIdentifier(name);
54
+ }
55
+
49
56
  export class StatMap {
50
57
  private _wasm: any;
51
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepwoken",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -42,6 +42,11 @@ export class StatMap {
42
42
  toJSON(): any;
43
43
  }
44
44
 
45
+ /**
46
+ * Transforms the name of things ingame into an identifier/key used in the database
47
+ */
48
+ export function nameToIdentifier(name: string): string;
49
+
45
50
  export function shrineOrderDwb(pre: StatMap, racial: StatMap): StatMap;
46
51
 
47
52
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -63,6 +68,7 @@ export interface InitOutput {
63
68
  readonly deepdata_outfits: (a: number) => [number, number, number];
64
69
  readonly deepdata_talents: (a: number) => [number, number, number];
65
70
  readonly deepdata_weapons: (a: number) => [number, number, number];
71
+ readonly nameToIdentifier: (a: number, b: number) => [number, number];
66
72
  readonly shrineOrderDwb: (a: number, b: number) => number;
67
73
  readonly statmap_cost: (a: number) => number;
68
74
  readonly statmap_get: (a: number, b: number, c: number) => [number, number, number];
@@ -83,6 +89,7 @@ export interface InitOutput {
83
89
  readonly __externref_table_alloc: () => number;
84
90
  readonly __wbindgen_externrefs: WebAssembly.Table;
85
91
  readonly __externref_table_dealloc: (a: number) => void;
92
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
86
93
  readonly __wbindgen_start: () => void;
87
94
  }
88
95
 
package/pkg/deepwoken.js CHANGED
@@ -270,6 +270,26 @@ export class StatMap {
270
270
  }
271
271
  if (Symbol.dispose) StatMap.prototype[Symbol.dispose] = StatMap.prototype.free;
272
272
 
273
+ /**
274
+ * Transforms the name of things ingame into an identifier/key used in the database
275
+ * @param {string} name
276
+ * @returns {string}
277
+ */
278
+ export function nameToIdentifier(name) {
279
+ let deferred2_0;
280
+ let deferred2_1;
281
+ try {
282
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
283
+ const len0 = WASM_VECTOR_LEN;
284
+ const ret = wasm.nameToIdentifier(ptr0, len0);
285
+ deferred2_0 = ret[0];
286
+ deferred2_1 = ret[1];
287
+ return getStringFromWasm0(ret[0], ret[1]);
288
+ } finally {
289
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
290
+ }
291
+ }
292
+
273
293
  /**
274
294
  * @param {StatMap} pre
275
295
  * @param {StatMap} racial
@@ -637,12 +657,12 @@ function __wbg_get_imports() {
637
657
  return ret;
638
658
  },
639
659
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
640
- // Cast intrinsic for `Closure(Closure { dtor_idx: 147, function: Function { arguments: [], shim_idx: 148, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
660
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 151, function: Function { arguments: [], shim_idx: 152, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
641
661
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hfbac65673247baa3, wasm_bindgen__convert__closures_____invoke__hcf18b6c4eb572639);
642
662
  return ret;
643
663
  },
644
664
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
645
- // Cast intrinsic for `Closure(Closure { dtor_idx: 167, function: Function { arguments: [Externref], shim_idx: 168, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
665
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 171, function: Function { arguments: [Externref], shim_idx: 172, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
646
666
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h22f2fd8de233cef9, wasm_bindgen__convert__closures_____invoke__h462ab53fb1f380e1);
647
667
  return ret;
648
668
  },
Binary file