@eveshipfit/dogma-engine 8.0.0 → 9.0.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.
@@ -1,7 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
- export function calculate(js_esf_fit: any, js_skills: any): any;
4
+ /**
5
+ * `js_options` may be left out; it then uses the defaults.
6
+ */
7
+ export function calculate(js_fit: any, js_options: any): any;
5
8
 
6
9
  export function init(): void;
7
10
 
@@ -1,10 +1,11 @@
1
1
  /**
2
- * @param {any} js_esf_fit
3
- * @param {any} js_skills
2
+ * `js_options` may be left out; it then uses the defaults.
3
+ * @param {any} js_fit
4
+ * @param {any} js_options
4
5
  * @returns {any}
5
6
  */
6
- export function calculate(js_esf_fit, js_skills) {
7
- const ret = wasm.calculate(js_esf_fit, js_skills);
7
+ export function calculate(js_fit, js_options) {
8
+ const ret = wasm.calculate(js_fit, js_options);
8
9
  if (ret[2]) {
9
10
  throw takeFromExternrefTable0(ret[1]);
10
11
  }
@@ -45,6 +46,12 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
45
46
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
46
47
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
47
48
  }
49
+ export function __wbg___wbindgen_bigint_get_as_i64_b482365c149396c8(arg0, arg1) {
50
+ const v = arg1;
51
+ const ret = typeof(v) === 'bigint' ? v : undefined;
52
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
53
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
54
+ }
48
55
  export function __wbg___wbindgen_boolean_get_7a12af2b3f899c5a(arg0) {
49
56
  const v = arg0;
50
57
  const ret = typeof(v) === 'boolean' ? v : undefined;
@@ -61,10 +68,18 @@ export function __wbg___wbindgen_in_50072d4d6e45c193(arg0, arg1) {
61
68
  const ret = arg0 in arg1;
62
69
  return ret;
63
70
  }
71
+ export function __wbg___wbindgen_is_bigint_60fc0336cb14f5d7(arg0) {
72
+ const ret = typeof(arg0) === 'bigint';
73
+ return ret;
74
+ }
64
75
  export function __wbg___wbindgen_is_function_fcda5e3902d732fe(arg0) {
65
76
  const ret = typeof(arg0) === 'function';
66
77
  return ret;
67
78
  }
79
+ export function __wbg___wbindgen_is_null_5160b3e381865372(arg0) {
80
+ const ret = arg0 === null;
81
+ return ret;
82
+ }
68
83
  export function __wbg___wbindgen_is_object_edb6b15aa3afe12e(arg0) {
69
84
  const val = arg0;
70
85
  const ret = typeof(val) === 'object' && val !== null;
@@ -78,6 +93,10 @@ export function __wbg___wbindgen_is_undefined_8c687d0b90d5b524(arg0) {
78
93
  const ret = arg0 === undefined;
79
94
  return ret;
80
95
  }
96
+ export function __wbg___wbindgen_jsval_eq_9fdcd3c0a860dd3b(arg0, arg1) {
97
+ const ret = arg0 === arg1;
98
+ return ret;
99
+ }
81
100
  export function __wbg___wbindgen_jsval_loose_eq_3c30021c243b64cd(arg0, arg1) {
82
101
  const ret = arg0 == arg1;
83
102
  return ret;
@@ -148,6 +167,16 @@ export function __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae(arg0) {
148
167
  const ret = result;
149
168
  return ret;
150
169
  }
170
+ export function __wbg_instanceof_Map_1ff6a2b54c899f0d(arg0) {
171
+ let result;
172
+ try {
173
+ result = arg0 instanceof Map;
174
+ } catch (_) {
175
+ result = false;
176
+ }
177
+ const ret = result;
178
+ return ret;
179
+ }
151
180
  export function __wbg_instanceof_Uint8Array_598adc0fef426aa8(arg0) {
152
181
  let result;
153
182
  try {
@@ -235,12 +264,17 @@ export function __wbindgen_generic_0000000000000001(arg0) {
235
264
  const ret = arg0;
236
265
  return ret;
237
266
  }
238
- export function __wbindgen_generic_0000000000000002(arg0, arg1) {
267
+ export function __wbindgen_generic_0000000000000002(arg0) {
268
+ // Cast intrinsic for `I64 -> Externref`.
269
+ const ret = arg0;
270
+ return ret;
271
+ }
272
+ export function __wbindgen_generic_0000000000000003(arg0, arg1) {
239
273
  // Cast intrinsic for `Ref(String) -> Externref`.
240
274
  const ret = getStringFromWasm0(arg0, arg1);
241
275
  return ret;
242
276
  }
243
- export function __wbindgen_generic_0000000000000003(arg0) {
277
+ export function __wbindgen_generic_0000000000000004(arg0) {
244
278
  // Cast intrinsic for `U64 -> Externref`.
245
279
  const ret = BigInt.asUintN(64, arg0);
246
280
  return ret;
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": "8.0.0",
8
+ "version": "9.0.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/README.md DELETED
@@ -1,96 +0,0 @@
1
- # EVEShip.fit's Dogma Engine
2
-
3
- This library calculates accurately statistics of an EVE Online ship fit.
4
-
5
- The input are several data-files provided by EVE Online, together with a ship fit.
6
- The output are all the Dogma attributes, containing all the details of the ship.
7
-
8
- ## Implementation
9
-
10
- This Dogma engine implements a multi-pass approach.
11
-
12
- - [pass 1](./src/calculate/pass_1.rs): collect all the Dogma attributes of the hull and modules.
13
- - [pass 2](./src/calculate/pass_2.rs): collect all the Dogma effects of the hull and modules.
14
- - [pass 3](./src/calculate/pass_3.rs): apply all the Dogma effects to the hull/modules, calculating the actual Dogma attribute values.
15
- - [pass 4](./src/calculate/pass_4.rs): augment the Dogma attributes with EVEShip.fit specific attributes, that are too complex for the Dogma itself to handle.
16
-
17
- ## EVEShip.fit's specific attributes
18
-
19
- `Pass 4` create Dogma attributes that do not exist in-game, but are rather complicated to calculate.
20
- To make rendering a fit easier, these are calculated by this library, and presented as new Dogma attributes.
21
-
22
- Their identifier is always a negative value, to visually separate them.
23
- What additional attributes exist are defined in [EVEShipFit/sde-patched](https://github.com/EVEShipFit/sde-patched) repository.
24
-
25
- ## Development
26
-
27
- Make sure you have [Rust installed](https://www.rust-lang.org/tools/install).
28
-
29
- Next, we need the data-files.
30
- They are Flatbuffers, built by [sde-patched](https://github.com/EVEShipFit/sde-patched) and published on npm as [`@eveshipfit/sde`](https://www.npmjs.com/package/@eveshipfit/sde):
31
-
32
- ```bash
33
- npm ci
34
- ```
35
-
36
- - `sde.dat` holds everything needed to calculate a fit.
37
- - `names.dat` holds the type names in the other seven languages EVE supports.
38
- It is optional.
39
-
40
- English names live in `sde.dat`, so an EFT-fit written in English imports without it; `names.dat` is only consulted when a name does not match.
41
-
42
- After that, we can run the application.
43
-
44
- ```bash
45
- flatc --rust --gen-onefile -o src/sde/ node_modules/@eveshipfit/sde/specs/eve.fbs node_modules/@eveshipfit/sde/specs/names.fbs
46
- cargo run --release --no-default-features --features rust
47
- ```
48
-
49
- The regression suite reads the same paths; set `ESF_SDE` and `ESF_NAMES` to point it elsewhere.
50
-
51
- ## Regression
52
-
53
- The engine is locked down by snapshot tests.
54
- A case calculates one fit with one set of skills, and compares the result against a stored snapshot in [tests/snapshots](./tests/snapshots).
55
-
56
- ```bash
57
- cargo test
58
- ```
59
-
60
- If failures are expected differences, use `insta` to resolve them:
61
-
62
- ```bash
63
- cargo install cargo-insta
64
- cargo insta review
65
- ```
66
-
67
- ## Integration
68
-
69
- ### Javascript (WebAssembly)
70
-
71
- The primary goal of this library is to build a WebAssembly variant that can easily be used in the browser.
72
- This means that there is no need for a server-component, and everything can be calculated in the browser.
73
-
74
- This is done with [wasm-pack](https://rustwasm.github.io/wasm-pack/):
75
-
76
- ```bash
77
- cargo install wasm-pack
78
- wasm-pack build --release -- --no-default-features --features wasm
79
- ```
80
-
81
- In the `pkg` folder is now a NPM module to use.
82
-
83
- Javascript hands over `sde.dat` once, and every lookup after that happens inside WebAssembly.
84
- The file is a Flatbuffer, so nothing is parsed: the bytes are used where they land.
85
-
86
- ```js
87
- import init, { init as initPanicHook, load_sde, calculate } from "@eveshipfit/dogma-engine";
88
-
89
- await init();
90
- initPanicHook();
91
-
92
- const sde = await fetch("/sde.dat").then((response) => response.arrayBuffer());
93
- const buildNumber = load_sde(new Uint8Array(sde));
94
-
95
- const statistics = calculate(fit, skills);
96
- ```