@eveshipfit/dogma-engine 8.1.0 → 10.0.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/README.md +79 -10
- package/esf_dogma_engine.d.ts +4 -1
- package/esf_dogma_engine_bg.js +40 -6
- package/esf_dogma_engine_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,80 @@
|
|
|
1
1
|
# EVEShip.fit's Dogma Engine
|
|
2
2
|
|
|
3
|
+
[](https://crates.io/crates/esf-dogma-engine)
|
|
4
|
+
[](https://www.npmjs.com/package/@eveshipfit/dogma-engine)
|
|
5
|
+
[](https://github.com/EVEShipFit/dogma-engine/actions/workflows/testing.yml)
|
|
6
|
+
[](https://docs.rs/esf-dogma-engine)
|
|
7
|
+
|
|
8
|
+
[](https://discord.gg/S5V5BkvNf7)
|
|
9
|
+
|
|
3
10
|
This library calculates accurately statistics of an EVE Online ship fit.
|
|
4
11
|
|
|
5
12
|
The input are several data-files provided by EVE Online, together with a ship fit.
|
|
6
|
-
The output are all the Dogma attributes
|
|
13
|
+
The output are all the Dogma attributes of the ship, its items and the character.
|
|
7
14
|
|
|
8
15
|
## Implementation
|
|
9
16
|
|
|
10
17
|
This Dogma engine implements a multi-pass approach.
|
|
11
18
|
|
|
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.
|
|
19
|
+
- [pass 1](./crates/esf-dogma-engine/src/calculate/pass_1.rs): collect all the Dogma attributes of the hull and modules.
|
|
20
|
+
- [pass 2](./crates/esf-dogma-engine/src/calculate/pass_2.rs): collect all the Dogma effects of the hull and modules.
|
|
21
|
+
- [pass 3](./crates/esf-dogma-engine/src/calculate/pass_3.rs): apply all the Dogma effects to the hull/modules, calculating the actual Dogma attribute values.
|
|
22
|
+
- [pass 4](./crates/esf-dogma-engine/src/calculate/pass_4.rs): augment the Dogma attributes with EVEShip.fit specific attributes, that are too complex for the Dogma itself to handle.
|
|
23
|
+
|
|
24
|
+
## Input and output
|
|
25
|
+
|
|
26
|
+
`calculate` takes a fit and options, and returns a calculation.
|
|
27
|
+
All identifiers are those from the SDE.
|
|
28
|
+
|
|
29
|
+
### Fit
|
|
30
|
+
|
|
31
|
+
- `name` (optional): name of the fit.
|
|
32
|
+
- `ship`: the ship being fitted.
|
|
33
|
+
- `type_id`: its type.
|
|
34
|
+
- `items`: everything fitted or carried. Each item has:
|
|
35
|
+
- `type_id`: its type.
|
|
36
|
+
- `slot`: where the item is.
|
|
37
|
+
- `type`: `high`, `medium`, `low`, `rig`, `subsystem`, `service`, `drone_bay` or `cargo`.
|
|
38
|
+
_`cargo` is carried, but not calculated._
|
|
39
|
+
- `index`: position within that slot type, starting at 0. Absent for `drone_bay` and `cargo`.
|
|
40
|
+
- `quantity` (optional, default 1): stack size for drones and cargo.
|
|
41
|
+
- `state`: requested state; `offline`, `online`, `active` or `overload`.
|
|
42
|
+
- `charge` (optional): the loaded charge, as `type_id`.
|
|
43
|
+
- `character` (optional):
|
|
44
|
+
- `skills`: level (0 to 5) per skill type ID. A missing skill gives no bonuses.
|
|
45
|
+
|
|
46
|
+
### Options
|
|
47
|
+
|
|
48
|
+
- `sources` (optional, default false): report per attribute what its value was calculated from.
|
|
49
|
+
Leave it off unless you show it; it makes the calculation several times bigger.
|
|
50
|
+
|
|
51
|
+
### Calculation
|
|
52
|
+
|
|
53
|
+
- `ship`: result for the ship.
|
|
54
|
+
- `items`: one result per item of the fit, in the same order.
|
|
55
|
+
- `character`: result for the character.
|
|
56
|
+
|
|
57
|
+
Each result has:
|
|
58
|
+
|
|
59
|
+
- `attributes`: per attribute ID, its `base` value before effects and its final `value`.
|
|
60
|
+
With the `sources` option, also `sources`: every modifier on it, in the order they were applied. Each has:
|
|
61
|
+
- `from`: where it comes from; `type` is `ship`, `character`, `item` or `charge` (with the `index` into `items`), or `skill` (with its `type_id`).
|
|
62
|
+
- `effect_id`: the effect that modifies.
|
|
63
|
+
- `source_attribute_id`: the attribute on the source that holds `value`.
|
|
64
|
+
- `operator`: `pre_assign`, `pre_mul`, `pre_div`, `mod_add`, `mod_sub`, `post_mul`, `post_div`, `post_percent` or `post_assign`.
|
|
65
|
+
- `value`: the value of the modifying attribute.
|
|
66
|
+
- `quantity`: how many times it counts. A stacking penalised stack is listed once per item instead.
|
|
67
|
+
- `penalty`: the stacking penalty factor it got, or `null` if not penalised.
|
|
68
|
+
- `applied`: false when the source's state is too low for the effect.
|
|
69
|
+
|
|
70
|
+
How much each source added is not reported: multiplications compound and stacking penalties depend on order, so there is no single answer.
|
|
71
|
+
- `state`: the state the item reached, which can be lower than requested.
|
|
72
|
+
- `max_state`: the highest state the item can reach.
|
|
73
|
+
- `charge`: result for its charge, if it has one.
|
|
74
|
+
|
|
75
|
+
### Things to know
|
|
76
|
+
|
|
77
|
+
- A stack, like five drones, has the attributes of a single item; its bonuses count once per item in the stack.
|
|
16
78
|
|
|
17
79
|
## EVEShip.fit's specific attributes
|
|
18
80
|
|
|
@@ -42,8 +104,8 @@ English names live in `sde.dat`, so an EFT-fit written in English imports withou
|
|
|
42
104
|
After that, we can run the application.
|
|
43
105
|
|
|
44
106
|
```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
|
|
107
|
+
flatc --rust --gen-onefile -o crates/esf-data/src/sde/ node_modules/@eveshipfit/sde/specs/eve.fbs node_modules/@eveshipfit/sde/specs/names.fbs
|
|
108
|
+
cargo run --release -p esf-cli
|
|
47
109
|
```
|
|
48
110
|
|
|
49
111
|
The regression suite reads the same paths; set `ESF_SDE` and `ESF_NAMES` to point it elsewhere.
|
|
@@ -75,7 +137,7 @@ This is done with [wasm-pack](https://rustwasm.github.io/wasm-pack/):
|
|
|
75
137
|
|
|
76
138
|
```bash
|
|
77
139
|
cargo install wasm-pack
|
|
78
|
-
wasm-pack build --release --
|
|
140
|
+
wasm-pack build crates/esf-wasm --release --out-dir ../../pkg
|
|
79
141
|
```
|
|
80
142
|
|
|
81
143
|
In the `pkg` folder is now a NPM module to use.
|
|
@@ -91,6 +153,13 @@ initPanicHook();
|
|
|
91
153
|
|
|
92
154
|
const sde = await fetch("/sde.dat").then((response) => response.arrayBuffer());
|
|
93
155
|
const buildNumber = load_sde(new Uint8Array(sde));
|
|
94
|
-
|
|
95
|
-
|
|
156
|
+
const fit = {
|
|
157
|
+
ship: { type_id: 587 },
|
|
158
|
+
items: [{ type_id: 2873, slot: { type: "high", index: 0 }, state: "active", charge: { type_id: 185 } }],
|
|
159
|
+
character: { skills: { 3300: 5 } },
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const calculation = calculate(fit);
|
|
163
|
+
/* Or if you want to know the source of the effects: */
|
|
164
|
+
const withSources = calculate(fit, { sources: true });
|
|
96
165
|
```
|
package/esf_dogma_engine.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
|
|
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
|
|
package/esf_dogma_engine_bg.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {any}
|
|
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(
|
|
7
|
-
const ret = wasm.calculate(
|
|
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
|
|
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
|
|
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;
|
package/esf_dogma_engine_bg.wasm
CHANGED
|
Binary file
|