@eveshipfit/dogma-engine 13.2.0 → 13.4.0

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
@@ -32,6 +32,8 @@ import wasmInit, {
32
32
  save_eft,
33
33
  load_esi_fitting,
34
34
  save_esi_fitting,
35
+ load_dna,
36
+ post_load,
35
37
  load_killmail,
36
38
  load_link,
37
39
  calculate,
@@ -60,6 +62,10 @@ const eft = save_eft(fit);
60
62
  /* Or if you have a fitting a character saved in game, as ESI returns it (and the other way around): */
61
63
  const fromEsi = load_esi_fitting(fitting);
62
64
  const toEsi = save_esi_fitting(fit);
65
+ /* Or if you have DNA, the fits EVE links to in chat, with or without its `fitting:` prefix: */
66
+ const fromDna = load_dna(dna);
67
+ /* EFT, ESI and DNA have no states; with the skills set, this sets the ones EVE gives an imported fit: */
68
+ const settled = post_load({ ...fromEsi, character: { skills } });
63
69
  /* Or if you have a killmail, as ESI returns it, for the fit of the ship that died: */
64
70
  const fromKillmail = load_killmail(killmail);
65
71
  /* Or if you have an EVEShip.fit link, `<version>:<payload>`, with the payload gunzipped and unbase64'd: */
@@ -540,6 +540,11 @@ export function beacon(type_id: number): Projection;
540
540
  */
541
541
  export function calculate(fit: Fit, options?: Options | null): Calculation;
542
542
 
543
+ /**
544
+ * Load a fit from DNA, the fits EVE links to in chat.
545
+ */
546
+ export function load_dna(dna: string): Fit;
547
+
543
548
  /**
544
549
  * Load a fit from EFT, the text format EVE copies a fit to the clipboard in.
545
550
  */
@@ -584,6 +589,12 @@ export function load_names(bytes: Uint8Array): number;
584
589
  */
585
590
  export function load_sde(bytes: Uint8Array): number;
586
591
 
592
+ /**
593
+ * Set a fit loaded from EFT, an ESI fitting or DNA to the states EVE gives
594
+ * it on import. Set the skills of the character first.
595
+ */
596
+ export function post_load(fit: Fit): Fit;
597
+
587
598
  /**
588
599
  * Write a fit as EFT, the text format EVE copies a fit to the clipboard in.
589
600
  */
@@ -612,6 +623,7 @@ export interface InitOutput {
612
623
  readonly memory: WebAssembly.Memory;
613
624
  readonly beacon: (a: number) => [number, number, number];
614
625
  readonly calculate: (a: any, b: number) => [number, number, number];
626
+ readonly load_dna: (a: number, b: number) => [number, number, number];
615
627
  readonly load_eft: (a: number, b: number) => [number, number, number];
616
628
  readonly load_esf: (a: number, b: number) => [number, number, number];
617
629
  readonly load_esf_link: (a: number, b: number) => [number, number, number];
@@ -620,6 +632,7 @@ export interface InitOutput {
620
632
  readonly load_link: (a: number, b: number, c: number, d: number) => [number, number, number];
621
633
  readonly load_names: (a: number, b: number) => [number, number, number];
622
634
  readonly load_sde: (a: number, b: number) => [number, number, number];
635
+ readonly post_load: (a: any) => [number, number, number];
623
636
  readonly save_eft: (a: any) => [number, number, number, number];
624
637
  readonly save_esf: (a: any) => [number, number, number, number];
625
638
  readonly save_esf_link: (a: any) => [number, number, number, number];
@@ -28,6 +28,21 @@ export function calculate(fit, options) {
28
28
  return takeFromExternrefTable0(ret[0]);
29
29
  }
30
30
 
31
+ /**
32
+ * Load a fit from DNA, the fits EVE links to in chat.
33
+ * @param {string} dna
34
+ * @returns {Fit}
35
+ */
36
+ export function load_dna(dna) {
37
+ const ptr0 = passStringToWasm0(dna, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
38
+ const len0 = WASM_VECTOR_LEN;
39
+ const ret = wasm.load_dna(ptr0, len0);
40
+ if (ret[2]) {
41
+ throw takeFromExternrefTable0(ret[1]);
42
+ }
43
+ return takeFromExternrefTable0(ret[0]);
44
+ }
45
+
31
46
  /**
32
47
  * Load a fit from EFT, the text format EVE copies a fit to the clipboard in.
33
48
  * @param {string} eft
@@ -151,6 +166,20 @@ export function load_sde(bytes) {
151
166
  return ret[0];
152
167
  }
153
168
 
169
+ /**
170
+ * Set a fit loaded from EFT, an ESI fitting or DNA to the states EVE gives
171
+ * it on import. Set the skills of the character first.
172
+ * @param {Fit} fit
173
+ * @returns {Fit}
174
+ */
175
+ export function post_load(fit) {
176
+ const ret = wasm.post_load(fit);
177
+ if (ret[2]) {
178
+ throw takeFromExternrefTable0(ret[1]);
179
+ }
180
+ return takeFromExternrefTable0(ret[0]);
181
+ }
182
+
154
183
  /**
155
184
  * Write a fit as EFT, the text format EVE copies a fit to the clipboard in.
156
185
  * @param {Fit} fit
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "EVEShipFit Team <info@eveship.fit>"
6
6
  ],
7
7
  "description": "Library to calculate statistics for EVE Online ship fits",
8
- "version": "13.2.0",
8
+ "version": "13.4.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",