deepwoken 0.2.1 → 0.2.3
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 +22 -1
- package/package.json +2 -1
- package/pkg/deepwoken.d.ts +22 -0
- package/pkg/deepwoken.js +106 -2
- package/pkg/deepwoken_bg.wasm +0 -0
- package/requirement.ts +15 -0
- package/types.ts +7 -0
package/index.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
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
|
+
export type { Atom, Clause, ClauseType, Reducability } from './requirement.js';
|
|
3
4
|
|
|
4
5
|
import type { Aspect, Mantra, Outfit, Stat, Talent, Weapon } from './types.js';
|
|
6
|
+
import type { Clause } from './requirement.js';
|
|
5
7
|
|
|
6
8
|
// dynamically import wasm bc the server will try to load wasm regardless man
|
|
7
9
|
let WasmDeepData: any;
|
|
8
10
|
let WasmStatMap: any;
|
|
11
|
+
let WasmRequirement: any;
|
|
9
12
|
let wasmNameToIdentifier: (name: string) => string;
|
|
10
13
|
|
|
11
14
|
if (typeof window !== 'undefined') {
|
|
@@ -13,6 +16,7 @@ if (typeof window !== 'undefined') {
|
|
|
13
16
|
await wasm.default();
|
|
14
17
|
WasmDeepData = wasm.DeepData;
|
|
15
18
|
WasmStatMap = wasm.StatMap;
|
|
19
|
+
WasmRequirement = wasm.Requirement;
|
|
16
20
|
wasmNameToIdentifier = wasm.nameToIdentifier;
|
|
17
21
|
}
|
|
18
22
|
|
|
@@ -54,7 +58,8 @@ export function nameToIdentifier(name: string): string {
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
export class StatMap {
|
|
57
|
-
|
|
61
|
+
/** @internal */
|
|
62
|
+
_wasm: any;
|
|
58
63
|
|
|
59
64
|
constructor(map: Partial<Record<Stat, number>> = {}) {
|
|
60
65
|
this._wasm = new WasmStatMap(map);
|
|
@@ -71,3 +76,19 @@ export class StatMap {
|
|
|
71
76
|
set(stat: Stat, value: number) { this._wasm.set(stat, value); }
|
|
72
77
|
toJSON(): Partial<Record<Stat, number>> { return this._wasm.toJSON(); }
|
|
73
78
|
}
|
|
79
|
+
|
|
80
|
+
export class Requirement {
|
|
81
|
+
private _wasm: any;
|
|
82
|
+
|
|
83
|
+
constructor(input: string) {
|
|
84
|
+
this._wasm = new WasmRequirement(input);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
satisfiedBy(stats: StatMap): boolean { return this._wasm.satisfiedBy(stats._wasm); }
|
|
88
|
+
isEmpty(): boolean { return this._wasm.isEmpty(); }
|
|
89
|
+
usedStats(): Stat[] { return this._wasm.usedStats(); }
|
|
90
|
+
name(): string | null { return this._wasm.name(); }
|
|
91
|
+
prereqs(): string[] { return this._wasm.prereqs(); }
|
|
92
|
+
clauses(): Clause[] { return this._wasm.clauses(); }
|
|
93
|
+
toString(): string { return this._wasm.toString(); }
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepwoken",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"index.ts",
|
|
9
9
|
"types.ts",
|
|
10
|
+
"requirement.ts",
|
|
10
11
|
"generated.ts",
|
|
11
12
|
"pkg/deepwoken_bg.wasm",
|
|
12
13
|
"pkg/deepwoken.js",
|
package/pkg/deepwoken.d.ts
CHANGED
|
@@ -29,6 +29,19 @@ export class DeepData {
|
|
|
29
29
|
weapons(): any;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export class Requirement {
|
|
33
|
+
free(): void;
|
|
34
|
+
[Symbol.dispose](): void;
|
|
35
|
+
clauses(): any;
|
|
36
|
+
isEmpty(): boolean;
|
|
37
|
+
name(): string | undefined;
|
|
38
|
+
constructor(input: string);
|
|
39
|
+
prereqs(): any;
|
|
40
|
+
satisfiedBy(stats: StatMap): boolean;
|
|
41
|
+
toString(): string;
|
|
42
|
+
usedStats(): any;
|
|
43
|
+
}
|
|
44
|
+
|
|
32
45
|
export class StatMap {
|
|
33
46
|
free(): void;
|
|
34
47
|
[Symbol.dispose](): void;
|
|
@@ -54,6 +67,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
54
67
|
export interface InitOutput {
|
|
55
68
|
readonly memory: WebAssembly.Memory;
|
|
56
69
|
readonly __wbg_deepdata_free: (a: number, b: number) => void;
|
|
70
|
+
readonly __wbg_requirement_free: (a: number, b: number) => void;
|
|
57
71
|
readonly __wbg_statmap_free: (a: number, b: number) => void;
|
|
58
72
|
readonly deepdata_aspects: (a: number) => [number, number, number];
|
|
59
73
|
readonly deepdata_fetchLatest: () => any;
|
|
@@ -69,6 +83,14 @@ export interface InitOutput {
|
|
|
69
83
|
readonly deepdata_talents: (a: number) => [number, number, number];
|
|
70
84
|
readonly deepdata_weapons: (a: number) => [number, number, number];
|
|
71
85
|
readonly nameToIdentifier: (a: number, b: number) => [number, number];
|
|
86
|
+
readonly requirement_clauses: (a: number) => [number, number, number];
|
|
87
|
+
readonly requirement_isEmpty: (a: number) => number;
|
|
88
|
+
readonly requirement_name: (a: number) => [number, number];
|
|
89
|
+
readonly requirement_new: (a: number, b: number) => [number, number, number];
|
|
90
|
+
readonly requirement_prereqs: (a: number) => [number, number, number];
|
|
91
|
+
readonly requirement_satisfiedBy: (a: number, b: number) => number;
|
|
92
|
+
readonly requirement_toString: (a: number) => [number, number];
|
|
93
|
+
readonly requirement_usedStats: (a: number) => [number, number, number];
|
|
72
94
|
readonly shrineOrderDwb: (a: number, b: number) => number;
|
|
73
95
|
readonly statmap_cost: (a: number) => number;
|
|
74
96
|
readonly statmap_get: (a: number, b: number, c: number) => [number, number, number];
|
package/pkg/deepwoken.js
CHANGED
|
@@ -172,6 +172,107 @@ export class DeepData {
|
|
|
172
172
|
}
|
|
173
173
|
if (Symbol.dispose) DeepData.prototype[Symbol.dispose] = DeepData.prototype.free;
|
|
174
174
|
|
|
175
|
+
export class Requirement {
|
|
176
|
+
__destroy_into_raw() {
|
|
177
|
+
const ptr = this.__wbg_ptr;
|
|
178
|
+
this.__wbg_ptr = 0;
|
|
179
|
+
RequirementFinalization.unregister(this);
|
|
180
|
+
return ptr;
|
|
181
|
+
}
|
|
182
|
+
free() {
|
|
183
|
+
const ptr = this.__destroy_into_raw();
|
|
184
|
+
wasm.__wbg_requirement_free(ptr, 0);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @returns {any}
|
|
188
|
+
*/
|
|
189
|
+
clauses() {
|
|
190
|
+
const ret = wasm.requirement_clauses(this.__wbg_ptr);
|
|
191
|
+
if (ret[2]) {
|
|
192
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
193
|
+
}
|
|
194
|
+
return takeFromExternrefTable0(ret[0]);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @returns {boolean}
|
|
198
|
+
*/
|
|
199
|
+
isEmpty() {
|
|
200
|
+
const ret = wasm.requirement_isEmpty(this.__wbg_ptr);
|
|
201
|
+
return ret !== 0;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @returns {string | undefined}
|
|
205
|
+
*/
|
|
206
|
+
name() {
|
|
207
|
+
const ret = wasm.requirement_name(this.__wbg_ptr);
|
|
208
|
+
let v1;
|
|
209
|
+
if (ret[0] !== 0) {
|
|
210
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
211
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
212
|
+
}
|
|
213
|
+
return v1;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* @param {string} input
|
|
217
|
+
*/
|
|
218
|
+
constructor(input) {
|
|
219
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
220
|
+
const len0 = WASM_VECTOR_LEN;
|
|
221
|
+
const ret = wasm.requirement_new(ptr0, len0);
|
|
222
|
+
if (ret[2]) {
|
|
223
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
224
|
+
}
|
|
225
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
226
|
+
RequirementFinalization.register(this, this.__wbg_ptr, this);
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* @returns {any}
|
|
231
|
+
*/
|
|
232
|
+
prereqs() {
|
|
233
|
+
const ret = wasm.requirement_prereqs(this.__wbg_ptr);
|
|
234
|
+
if (ret[2]) {
|
|
235
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
236
|
+
}
|
|
237
|
+
return takeFromExternrefTable0(ret[0]);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* @param {StatMap} stats
|
|
241
|
+
* @returns {boolean}
|
|
242
|
+
*/
|
|
243
|
+
satisfiedBy(stats) {
|
|
244
|
+
_assertClass(stats, StatMap);
|
|
245
|
+
const ret = wasm.requirement_satisfiedBy(this.__wbg_ptr, stats.__wbg_ptr);
|
|
246
|
+
return ret !== 0;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @returns {string}
|
|
250
|
+
*/
|
|
251
|
+
toString() {
|
|
252
|
+
let deferred1_0;
|
|
253
|
+
let deferred1_1;
|
|
254
|
+
try {
|
|
255
|
+
const ret = wasm.requirement_toString(this.__wbg_ptr);
|
|
256
|
+
deferred1_0 = ret[0];
|
|
257
|
+
deferred1_1 = ret[1];
|
|
258
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
259
|
+
} finally {
|
|
260
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* @returns {any}
|
|
265
|
+
*/
|
|
266
|
+
usedStats() {
|
|
267
|
+
const ret = wasm.requirement_usedStats(this.__wbg_ptr);
|
|
268
|
+
if (ret[2]) {
|
|
269
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
270
|
+
}
|
|
271
|
+
return takeFromExternrefTable0(ret[0]);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (Symbol.dispose) Requirement.prototype[Symbol.dispose] = Requirement.prototype.free;
|
|
275
|
+
|
|
175
276
|
export class StatMap {
|
|
176
277
|
static __wrap(ptr) {
|
|
177
278
|
ptr = ptr >>> 0;
|
|
@@ -657,12 +758,12 @@ function __wbg_get_imports() {
|
|
|
657
758
|
return ret;
|
|
658
759
|
},
|
|
659
760
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
660
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
761
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 147, function: Function { arguments: [], shim_idx: 148, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
661
762
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hfbac65673247baa3, wasm_bindgen__convert__closures_____invoke__hcf18b6c4eb572639);
|
|
662
763
|
return ret;
|
|
663
764
|
},
|
|
664
765
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
665
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
766
|
+
// 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`.
|
|
666
767
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h22f2fd8de233cef9, wasm_bindgen__convert__closures_____invoke__h462ab53fb1f380e1);
|
|
667
768
|
return ret;
|
|
668
769
|
},
|
|
@@ -723,6 +824,9 @@ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate
|
|
|
723
824
|
const DeepDataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
724
825
|
? { register: () => {}, unregister: () => {} }
|
|
725
826
|
: new FinalizationRegistry(ptr => wasm.__wbg_deepdata_free(ptr >>> 0, 1));
|
|
827
|
+
const RequirementFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
828
|
+
? { register: () => {}, unregister: () => {} }
|
|
829
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_requirement_free(ptr >>> 0, 1));
|
|
726
830
|
const StatMapFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
727
831
|
? { register: () => {}, unregister: () => {} }
|
|
728
832
|
: new FinalizationRegistry(ptr => wasm.__wbg_statmap_free(ptr >>> 0, 1));
|
package/pkg/deepwoken_bg.wasm
CHANGED
|
Binary file
|
package/requirement.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Stat } from './generated.js';
|
|
2
|
+
|
|
3
|
+
export type Reducability = "reducible" | "strict";
|
|
4
|
+
export type ClauseType = "and" | "or";
|
|
5
|
+
|
|
6
|
+
export interface Atom {
|
|
7
|
+
reducability: Reducability;
|
|
8
|
+
value: number;
|
|
9
|
+
stats: Stat[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Clause {
|
|
13
|
+
clause_type: ClauseType;
|
|
14
|
+
atoms: Atom[];
|
|
15
|
+
}
|
package/types.ts
CHANGED
|
@@ -53,8 +53,15 @@ export interface Outfit {
|
|
|
53
53
|
notes: number;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export interface AspectVariantInfo {
|
|
57
|
+
unlock: string | null;
|
|
58
|
+
colors: Record<string, string>;
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
export interface Aspect {
|
|
57
62
|
name: string;
|
|
63
|
+
desc: string;
|
|
58
64
|
innate: Partial<Record<Stat, number>>;
|
|
59
65
|
is_pathfinder: boolean;
|
|
66
|
+
variants: Record<string, AspectVariantInfo>;
|
|
60
67
|
}
|