@eveshipfit/dogma-engine 13.3.0 → 13.5.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,7 @@ import wasmInit, {
32
32
  save_eft,
33
33
  load_esi_fitting,
34
34
  save_esi_fitting,
35
+ load_dna,
35
36
  post_load,
36
37
  load_killmail,
37
38
  load_link,
@@ -61,7 +62,9 @@ const eft = save_eft(fit);
61
62
  /* Or if you have a fitting a character saved in game, as ESI returns it (and the other way around): */
62
63
  const fromEsi = load_esi_fitting(fitting);
63
64
  const toEsi = save_esi_fitting(fit);
64
- /* Neither EFT nor ESI has states; with the skills set, this sets the ones EVE gives an imported 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: */
65
68
  const settled = post_load({ ...fromEsi, character: { skills } });
66
69
  /* Or if you have a killmail, as ESI returns it, for the fit of the ship that died: */
67
70
  const fromKillmail = load_killmail(killmail);
@@ -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
  */
@@ -585,8 +590,8 @@ export function load_names(bytes: Uint8Array): number;
585
590
  export function load_sde(bytes: Uint8Array): number;
586
591
 
587
592
  /**
588
- * Set a fit loaded from EFT or an ESI fitting to the states EVE gives it on
589
- * import. Set the skills of the character first.
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.
590
595
  */
591
596
  export function post_load(fit: Fit): Fit;
592
597
 
@@ -618,6 +623,7 @@ export interface InitOutput {
618
623
  readonly memory: WebAssembly.Memory;
619
624
  readonly beacon: (a: number) => [number, number, number];
620
625
  readonly calculate: (a: any, b: number) => [number, number, number];
626
+ readonly load_dna: (a: number, b: number) => [number, number, number];
621
627
  readonly load_eft: (a: number, b: number) => [number, number, number];
622
628
  readonly load_esf: (a: number, b: number) => [number, number, number];
623
629
  readonly load_esf_link: (a: number, b: 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
@@ -152,8 +167,8 @@ export function load_sde(bytes) {
152
167
  }
153
168
 
154
169
  /**
155
- * Set a fit loaded from EFT or an ESI fitting to the states EVE gives it on
156
- * import. Set the skills of the character first.
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.
157
172
  * @param {Fit} fit
158
173
  * @returns {Fit}
159
174
  */
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.3.0",
8
+ "version": "13.5.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",