@eveshipfit/dogma-engine 12.0.0 → 13.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 +17 -330
- package/esf_dogma_engine.d.ts +8 -7
- package/esf_dogma_engine.js +0 -14
- package/esf_dogma_engine_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
# EVEShip.fit's Dogma Engine
|
|
1
|
+
# EVEShip.fit's Dogma Engine for Javascript
|
|
2
2
|
|
|
3
|
-
[](https://crates.io/crates/esf-dogma-engine)
|
|
4
3
|
[](https://www.npmjs.com/package/@eveshipfit/dogma-engine)
|
|
5
|
-
[](https://pypi.org/project/eveshipfit-dogma-engine/)
|
|
6
|
-
[](https://github.com/EVEShipFit/dogma-engine/actions/workflows/testing.yml)
|
|
7
|
-
[](https://docs.rs/esf-dogma-engine)
|
|
8
|
-
|
|
9
4
|
[](https://discord.gg/S5V5BkvNf7)
|
|
10
5
|
|
|
11
6
|
This library calculates accurately statistics of an EVE Online ship fit.
|
|
@@ -13,199 +8,22 @@ This library calculates accurately statistics of an EVE Online ship fit.
|
|
|
13
8
|
The input are several data-files provided by EVE Online, together with a ship fit.
|
|
14
9
|
The output are all the Dogma attributes of the ship, its items and the character.
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
This Dogma engine implements a multi-pass approach.
|
|
19
|
-
|
|
20
|
-
- [pass 1](./crates/esf-dogma-engine/src/calculate/pass_1.rs): collect all the Dogma attributes of the hull and modules.
|
|
21
|
-
- [pass 2](./crates/esf-dogma-engine/src/calculate/pass_2.rs): collect all the Dogma effects of the hull and modules.
|
|
22
|
-
- [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.
|
|
23
|
-
- [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.
|
|
24
|
-
|
|
25
|
-
## Input and output
|
|
26
|
-
|
|
27
|
-
`calculate` takes a fit and options, and returns a calculation.
|
|
28
|
-
All identifiers are those from the SDE.
|
|
29
|
-
|
|
30
|
-
### Fit
|
|
31
|
-
|
|
32
|
-
- `name` (optional): name of the fit.
|
|
33
|
-
- `ship`: the ship being fitted.
|
|
34
|
-
- `type_id`: its type.
|
|
35
|
-
- `mode` (optional): type ID of the active mode, for ships that have modes.
|
|
36
|
-
_Whether the mode belongs to the ship is not checked._
|
|
37
|
-
- `items`: everything fitted or carried. Each item has:
|
|
38
|
-
- `type_id`: its type.
|
|
39
|
-
- `slot`: where the item is.
|
|
40
|
-
- `type`: `high`, `medium`, `low`, `rig`, `subsystem`, `service`, `fighter_tube`, `fighter_bay`, `implant`, `booster`, `drone_bay` or `cargo`.
|
|
41
|
-
- `index`: position within that slot type, starting at 0 (`implant` and `booster` starting at 1).
|
|
42
|
-
Absent for `fighter_bay`, `drone_bay` and `cargo`.
|
|
43
|
-
- `quantity` (optional, default 1): stack size for drones, fighters and cargo. For fighters in a tube, the squadron size.
|
|
44
|
-
- `state`: requested state; `offline`, `online`, `active` or `overload`.
|
|
45
|
-
- `charge` (optional): the loaded charge, as `type_id`.
|
|
46
|
-
- `mutation` (optional): for mutated items (Abyssal modules, mutated drones, ...).
|
|
47
|
-
- `base`: type ID of the item before it was mutated.
|
|
48
|
-
- `attributes`: the rolled value per attribute ID.
|
|
49
|
-
- `fighter_abilities` (optional): the abilities a fighter uses, as effect IDs. Absent means the fighter's default abilities.
|
|
50
|
-
- `booster_side_effects` (optional): the side effects a booster rolled, as effect IDs. Absent means none.
|
|
51
|
-
- `spool` (optional): for modules whose bonus grows every cycle, how far it has spooled.
|
|
52
|
-
Only per-second stats use it; volley is always unspooled. Absent means fully spooled.
|
|
53
|
-
- `multiplier_bonus`: the bonus reached so far; 0.0 is unspooled, 2.125 is +212.5%.
|
|
54
|
-
- `character` (optional):
|
|
55
|
-
- `skills`: level (0 to 5) per skill type ID. A missing skill gives no bonuses.
|
|
56
|
-
- `security_status` (optional, default 0.0): the pilot's security status, -10.0 to 5.0.
|
|
57
|
-
- `environment` (optional): where the fit is.
|
|
58
|
-
- `damage_profile` (optional, default 0.25 each): incoming damage for effective hitpoints, as `em`, `explosive`, `kinetic` and `thermal` (relative to each other).
|
|
59
|
-
- `security` (optional, default `high_sec`): `high_sec`, `low_sec`, `null_sec` or `wormhole`.
|
|
60
|
-
- `reactive_armor` (optional, default `do_not_adapt`): what a Reactive Armor Hardener shifts its resistances towards.
|
|
61
|
-
`do_not_adapt` leaves them where EVE shows them, `damage_profile` shifts towards `damage_profile`, and
|
|
62
|
-
`{"profile": {..}}` shifts towards a profile of its own, written the same way as `damage_profile`.
|
|
63
|
-
- `incoming` (optional): what effects and buffs to apply that come from outside the ship.
|
|
64
|
-
A calculation reports the same shape as `outgoing`: feed one fit's result into another's `incoming` links them up.
|
|
65
|
-
- `buffs` (optional, default none): buffs to apply, like the ones a command burst hands out.
|
|
66
|
-
- `id`: which buff, as `dbuffCollections` in the SDE numbers them.
|
|
67
|
-
- `value`: how strong it is, in whatever the buff's operation reads.
|
|
68
|
-
- `effects` (optional, default none): effects aimed at the fit, like a stasis webifier.
|
|
69
|
-
- `type_id`: the type the effect belongs to; its category decides the stacking penalty.
|
|
70
|
-
- `effect_id`: which effect, as `dogmaEffects` in the SDE numbers them.
|
|
71
|
-
- `attributes`: the value per attribute ID the effect reads, worked out by the fit that aimed it.
|
|
72
|
-
|
|
73
|
-
### Options
|
|
74
|
-
|
|
75
|
-
- `sources` (optional, default false): report per attribute what its value was calculated from.
|
|
76
|
-
Leave it off unless you show it; it makes the calculation several times bigger.
|
|
77
|
-
|
|
78
|
-
### Calculation
|
|
79
|
-
|
|
80
|
-
- `ship`: result for the ship.
|
|
81
|
-
- `mode`: result for the mode; absent when the fit has no mode.
|
|
82
|
-
- `items`: one result per item of the fit, in the same order.
|
|
83
|
-
- `character`: result for the character.
|
|
84
|
-
- `buffs`: the buffs that landed, ordered by id. Those of `incoming`, plus the ones the fit's own bursts hand out: a fleet boost reaches the ship running it. What is missing lost to another source of the same buff, or the SDE has no such buff.
|
|
85
|
-
- `id`: which buff, as `dbuffCollections` in the SDE numbers them.
|
|
86
|
-
- `value`: how strong it is, in whatever the buff's operation reads.
|
|
87
|
-
- `outgoing`: what the fit hands to other fits, in the shape `incoming` takes.
|
|
88
|
-
|
|
89
|
-
Each result has:
|
|
90
|
-
|
|
91
|
-
- `attributes`: per attribute ID, its `base` value before effects and its final `value`.
|
|
92
|
-
With the `sources` option, also `sources`: every modifier on it, in the order they were applied. Each has:
|
|
93
|
-
- `from`: where it comes from; `type` is `ship`, `mode`, `character`, `item` or `charge` (with the `index` into `items`), `projected` (with the `index` into `incoming.effects`), `skill` (with its `type_id`) or `buff` (with its `id`).
|
|
94
|
-
- `effect_id`: the effect that holds the modifier; `null` for a buff, which has none.
|
|
95
|
-
- `source_attribute_id`: the attribute on the source that holds `value`; `null` for a buff, which carries its own strength.
|
|
96
|
-
- `operator`: `pre_assign`, `pre_mul`, `pre_div`, `mod_add`, `mod_sub`, `post_mul`, `post_div`, `post_percent` or `post_assign`.
|
|
97
|
-
- `value`: the value of the modifying attribute, or the strength of the buff.
|
|
98
|
-
- `quantity`: how many times it counts. A stacking penalised stack is listed once per item instead.
|
|
99
|
-
- `penalty`: the stacking penalty factor it got, or `null` if not penalised.
|
|
100
|
-
- `applied`: false when the source's state is too low for the effect.
|
|
101
|
-
|
|
102
|
-
How much each source added is not reported: multiplications compound and stacking penalties depend on order, so there is no single answer.
|
|
103
|
-
- `state`: the state the item reached, which can be lower than requested.
|
|
104
|
-
- `max_state`: the highest state the item can reach.
|
|
105
|
-
- `charge`: result for its charge, if it has one.
|
|
106
|
-
|
|
107
|
-
## EVEShip.fit's specific attributes
|
|
108
|
-
|
|
109
|
-
`Pass 4` create Dogma attributes that do not exist in-game, but are rather complicated to calculate.
|
|
110
|
-
To make rendering a fit easier, these are calculated by this library, and presented as new Dogma attributes.
|
|
111
|
-
|
|
112
|
-
Their identifier is always a negative value, to visually separate them.
|
|
113
|
-
What additional attributes exist are defined in [EVEShipFit/sde-patched](https://github.com/EVEShipFit/sde-patched) repository.
|
|
114
|
-
|
|
115
|
-
## Validation
|
|
116
|
-
|
|
117
|
-
`validate()` checks if the fit violates any rules that would prevent you from flying it in-game.
|
|
118
|
-
It returns the violations, grouped by the kind of rule and, within a kind, in the order of `items`.
|
|
119
|
-
An empty list means the fit breaks no rules.
|
|
120
|
-
|
|
121
|
-
Each violation has:
|
|
122
|
-
|
|
123
|
-
- `target`: what the rule is about.
|
|
124
|
-
- `ship`, for what the ship carries as a whole.
|
|
125
|
-
- `item`, with the `index` into `items`.
|
|
126
|
-
- `charge`, with the `index` into `items` of the item holding it.
|
|
127
|
-
- `rule`: the rule, and the values that failed it. `type` says which:
|
|
128
|
-
- `resource`: `resource` ran out, `used` of `available`.
|
|
129
|
-
One of `cpu`, `powergrid`, `calibration`, `drone_bay`, `drone_bandwidth`, `launched_drones`, `fighter_bay`, `fighter_tubes`, `light_fighter_tubes`, `support_fighter_tubes`, `heavy_fighter_tubes`, `cargo_bay` or `charge_capacity`.
|
|
130
|
-
- `slots`: more items in the `slot` rack than the ship has, `used` of `available`.
|
|
131
|
-
One of `high`, `medium`, `low`, `rig`, `subsystem`, `service`, `turret` or `launcher`; the last two are hardpoints a weapon takes on top of its slot.
|
|
132
|
-
- `wrong_slot`: the item belongs in the `expected` rack.
|
|
133
|
-
- `slot_taken`: another item of the fit is in this slot too.
|
|
134
|
-
- `wrong_slot_index`: an implant or booster outside the slot it occupies, which is `expected`.
|
|
135
|
-
- `subsystem_taken`: another subsystem covers the same part of the ship.
|
|
136
|
-
- `skill`: the character is missing `type_id`, or has it at `level` where the item asks for `required`.
|
|
137
|
-
- `rig_size`: a rig of size `item` where the `ship` takes another.
|
|
138
|
-
- `ship_restricted`: the item cannot go on this ship at all.
|
|
139
|
-
- `capital_item`: a capital item on a ship that is not a capital.
|
|
140
|
-
- `max_group`: `used` of `group_id` are `limit` (`fitted`, `online` or `active`), where `allowed` may be.
|
|
141
|
-
This is what keeps a second propulsion module from running: an afterburner and a microwarpdrive share a group.
|
|
142
|
-
- `max_type`: `used` of `type_id` are fitted, where `allowed` may be.
|
|
143
|
-
- `charge_group`: a charge of a group the module does not take.
|
|
144
|
-
- `charge_size`: a charge of size `charge` where the `module` takes another.
|
|
145
|
-
|
|
146
|
-
## Usage
|
|
147
|
-
|
|
148
|
-
The engine is published for Rust, Javascript and Python; all three calculate the same way.
|
|
149
|
-
Each hands over `sde.dat` once, and every lookup after that happens inside Rust.
|
|
150
|
-
An EFT import matches the English names in `sde.dat`; hand over `names.dat` too to also match the other languages EVE supports.
|
|
151
|
-
|
|
152
|
-
How each package is built is explained under [Integration](#integration).
|
|
11
|
+
The engine is written in Rust and runs as WebAssembly, so everything is calculated in the browser; no server needed.
|
|
153
12
|
|
|
154
|
-
|
|
13
|
+
## Install
|
|
155
14
|
|
|
156
|
-
|
|
157
|
-
`esf-data` reads `sde.dat`.
|
|
15
|
+
[`@eveshipfit/sde`](https://www.npmjs.com/package/@eveshipfit/sde) ships `sde.dat` in its `dist` folder; serve or bundle that file.
|
|
158
16
|
|
|
159
17
|
```bash
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
```rust
|
|
164
|
-
use esf_data::{InfoSde, Sde};
|
|
165
|
-
use esf_dogma_engine::{Fit, Options, beacon, calculate, validate};
|
|
166
|
-
|
|
167
|
-
let bytes = std::fs::read("sde.dat")?;
|
|
168
|
-
let sde = Sde::new(&bytes)?;
|
|
169
|
-
let info = InfoSde::new(&sde);
|
|
170
|
-
|
|
171
|
-
let fit: Fit = serde_json::from_str(
|
|
172
|
-
r#"{
|
|
173
|
-
"ship": {"type_id": 587},
|
|
174
|
-
"items": [
|
|
175
|
-
{
|
|
176
|
-
"type_id": 2873,
|
|
177
|
-
"slot": {"type": "high", "index": 0},
|
|
178
|
-
"state": "active",
|
|
179
|
-
"charge": {"type_id": 185}
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
"character": {"skills": {"3300": 5}}
|
|
183
|
-
}"#,
|
|
184
|
-
)?;
|
|
185
|
-
|
|
186
|
-
let calculation = calculate(&info, &fit, &Options::default());
|
|
187
|
-
// Or if you want to know the source of the effects:
|
|
188
|
-
let with_sources = calculate(&info, &fit, &Options { sources: true, ..Default::default() });
|
|
189
|
-
// Or if you have a beacon in space (like wormhole effects):
|
|
190
|
-
let with_beacon = calculate(&info, &Fit { incoming: beacon(&info, beacon_type_id), ..fit }, &Options::default());
|
|
191
|
-
|
|
192
|
-
// What EVE would not let you fly:
|
|
193
|
-
let violations = validate(&info, &fit, &calculation);
|
|
18
|
+
npm install @eveshipfit/dogma-engine @eveshipfit/sde
|
|
194
19
|
```
|
|
195
20
|
|
|
196
|
-
### Javascript (WebAssembly)
|
|
197
|
-
|
|
198
|
-
The WebAssembly variant is published on npm as
|
|
199
|
-
[`@eveshipfit/dogma-engine`](https://www.npmjs.com/package/@eveshipfit/dogma-engine).
|
|
200
|
-
[`@eveshipfit/sde`](https://www.npmjs.com/package/@eveshipfit/sde) ships `sde.dat` in its `dist` folder; serve or bundle that file.
|
|
201
|
-
|
|
202
21
|
The package is an ES module with TypeScript types included, and it runs anywhere: under a bundler
|
|
203
22
|
(Vite, webpack, ...), from a CDN, or in a plain `<script type="module">`.
|
|
204
|
-
Its default export loads the WebAssembly and has to be awaited once before any other function is called.
|
|
205
23
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
The default export loads the WebAssembly and has to be awaited once before any other function is called.
|
|
209
27
|
|
|
210
28
|
```js
|
|
211
29
|
import wasmInit, {
|
|
@@ -213,7 +31,6 @@ import wasmInit, {
|
|
|
213
31
|
load_eft,
|
|
214
32
|
save_eft,
|
|
215
33
|
calculate,
|
|
216
|
-
validate,
|
|
217
34
|
beacon,
|
|
218
35
|
} from "@eveshipfit/dogma-engine";
|
|
219
36
|
|
|
@@ -237,148 +54,18 @@ const imported = calculate(load_eft("[Rifter, My Rifter]\n200mm AutoCannon I"));
|
|
|
237
54
|
/* And to write a fit back out as EFT: */
|
|
238
55
|
const eft = save_eft(fit);
|
|
239
56
|
|
|
240
|
-
/* What EVE would not let you fly
|
|
241
|
-
const
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Python
|
|
245
|
-
|
|
246
|
-
The Python variant is published on PyPI as
|
|
247
|
-
[`eveshipfit-dogma-engine`](https://pypi.org/project/eveshipfit-dogma-engine/).
|
|
248
|
-
The `sde` extra brings in [`eveshipfit-sde`](https://pypi.org/project/eveshipfit-sde/), which ships `sde.dat`.
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
pip install eveshipfit-dogma-engine[sde]
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
```python
|
|
255
|
-
import esf_dogma_engine as dogma
|
|
256
|
-
from eveshipfit_sde import sde_path
|
|
257
|
-
|
|
258
|
-
build_number = dogma.load_sde_from_file(sde_path())
|
|
259
|
-
|
|
260
|
-
fit = {
|
|
261
|
-
"ship": {"type_id": 587},
|
|
262
|
-
"items": [
|
|
263
|
-
{
|
|
264
|
-
"type_id": 2873,
|
|
265
|
-
"slot": {"type": "high", "index": 0},
|
|
266
|
-
"state": "active",
|
|
267
|
-
"charge": {"type_id": 185},
|
|
268
|
-
}
|
|
269
|
-
],
|
|
270
|
-
"character": {"skills": {3300: 5}},
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
calculation = dogma.calculate(fit)
|
|
274
|
-
# Or if you want to know the source of the effects:
|
|
275
|
-
with_sources = dogma.calculate(fit, {"sources": True})
|
|
276
|
-
# Or if you have a beacon in space (like wormhole effects):
|
|
277
|
-
with_beacon = dogma.calculate({**fit, "incoming": dogma.beacon(beacon_type_id)})
|
|
278
|
-
# Or if you have an EFT, the text format EVE copies a fit to the clipboard in:
|
|
279
|
-
imported = dogma.calculate(dogma.load_eft("[Rifter, My Rifter]\n200mm AutoCannon I"))
|
|
280
|
-
# And to write a fit back out as EFT:
|
|
281
|
-
eft = dogma.save_eft(fit)
|
|
282
|
-
|
|
283
|
-
# What EVE would not let you fly; it calculates the fit itself:
|
|
284
|
-
violations = dogma.validate(fit)
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
Fits and calculations are plain dicts, typed with `TypedDict` in `esf_dogma_engine.types`.
|
|
288
|
-
|
|
289
|
-
`load_eft`, `calculate` and `beacon` release the GIL while they work, so a thread pool calculates fits in parallel.
|
|
290
|
-
|
|
291
|
-
## Development
|
|
292
|
-
|
|
293
|
-
Make sure you have [Rust installed](https://www.rust-lang.org/tools/install).
|
|
294
|
-
|
|
295
|
-
Next, we need the data-files.
|
|
296
|
-
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):
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
npm ci
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
- `sde.dat` holds everything needed to calculate a fit.
|
|
303
|
-
- `names.dat` holds the type names in the other seven languages EVE supports.
|
|
304
|
-
It is optional.
|
|
305
|
-
|
|
306
|
-
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.
|
|
307
|
-
|
|
308
|
-
After that, we can run the application.
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
flatc --rust --gen-onefile -o crates/esf-data/src/sde/ node_modules/@eveshipfit/sde/specs/eve.fbs node_modules/@eveshipfit/sde/specs/names.fbs
|
|
312
|
-
cargo run --release -p esf-cli
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
For example, some attributes of a fit with every skill at L0 except two:
|
|
316
|
-
|
|
317
|
-
```bash
|
|
318
|
-
printf '[Nergal, Spool]\nLight Entropic Disintegrator II, Occult S\n' \
|
|
319
|
-
| cargo run --release -p esf-cli -- -l 0 --skill "Gunnery=4" --skill "Rapid Firing=2" -a damage -a speed
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
It prints a table on a terminal and JSON otherwise; see `--help` for the rest.
|
|
323
|
-
|
|
324
|
-
Or to write the fit back out as EFT, instead of calculating it:
|
|
325
|
-
|
|
326
|
-
```bash
|
|
327
|
-
printf '[Nergal, Spool]\nLight Entropic Disintegrator II, Occult S\n' \
|
|
328
|
-
| cargo run --release -p esf-cli -- --eft
|
|
57
|
+
/* What EVE would not let you fly, in `violations` of the calculation: */
|
|
58
|
+
const validated = calculate(fit, { validate: true });
|
|
329
59
|
```
|
|
330
60
|
|
|
331
|
-
|
|
61
|
+
`load_sde` may only be called once.
|
|
332
62
|
|
|
333
|
-
|
|
63
|
+
An EFT import matches the English names in `sde.dat`.
|
|
64
|
+
To also match the other languages EVE supports, hand `names.dat` (also in `@eveshipfit/sde`) to `load_names` the same way, after `load_sde`.
|
|
334
65
|
|
|
335
|
-
|
|
336
|
-
|
|
66
|
+
Fits and calculations are plain objects, described by the included TypeScript types.
|
|
67
|
+
What every field means is explained under [Input and output](https://github.com/EVEShipFit/dogma-engine#input-and-output).
|
|
337
68
|
|
|
338
|
-
|
|
339
|
-
cargo test
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
If failures are expected differences, use `insta` to resolve them:
|
|
343
|
-
|
|
344
|
-
```bash
|
|
345
|
-
cargo install cargo-insta
|
|
346
|
-
cargo insta review
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
## Integration
|
|
350
|
-
|
|
351
|
-
Every variant is built from the same Rust crates; the `flatc` step from [Development](#development) comes first.
|
|
352
|
-
|
|
353
|
-
### Rust
|
|
354
|
-
|
|
355
|
-
The engine itself is a plain crate; [`esf-cli`](./crates/esf-cli) is an example of using it.
|
|
356
|
-
|
|
357
|
-
```bash
|
|
358
|
-
cargo build --release -p esf-dogma-engine
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### Javascript (WebAssembly)
|
|
362
|
-
|
|
363
|
-
The primary goal of this library is to build a WebAssembly variant that can easily be used in the browser.
|
|
364
|
-
This means that there is no need for a server-component, and everything can be calculated in the browser.
|
|
365
|
-
|
|
366
|
-
This is done with [wasm-pack](https://rustwasm.github.io/wasm-pack/):
|
|
367
|
-
|
|
368
|
-
```bash
|
|
369
|
-
cargo install wasm-pack
|
|
370
|
-
wasm-pack build crates/esf-wasm --release --target web --out-dir ../../pkg
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
In the `pkg` folder is now a NPM module to use.
|
|
374
|
-
|
|
375
|
-
### Python
|
|
376
|
-
|
|
377
|
-
This is done with [maturin](https://www.maturin.rs/):
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
cargo install maturin
|
|
381
|
-
maturin build --release
|
|
382
|
-
```
|
|
69
|
+
## More
|
|
383
70
|
|
|
384
|
-
|
|
71
|
+
How the engine works, the attributes EVEShip.fit adds and the fitting rules it validates are all in the [main repository](https://github.com/EVEShipFit/dogma-engine).
|
package/esf_dogma_engine.d.ts
CHANGED
|
@@ -340,6 +340,10 @@ export interface Calculation {
|
|
|
340
340
|
* All outgoing projections (effects and buffs).
|
|
341
341
|
*/
|
|
342
342
|
outgoing?: Projection;
|
|
343
|
+
/**
|
|
344
|
+
* The fitting rules the fit breaks; only with `Options::validate`.
|
|
345
|
+
*/
|
|
346
|
+
violations?: Violation[];
|
|
343
347
|
}
|
|
344
348
|
|
|
345
349
|
/**
|
|
@@ -374,6 +378,10 @@ export interface Options {
|
|
|
374
378
|
* Report per attribute the modifiers its value was calculated from.
|
|
375
379
|
*/
|
|
376
380
|
sources?: boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Report the fitting rules the fit breaks.
|
|
383
|
+
*/
|
|
384
|
+
validate?: boolean;
|
|
377
385
|
}
|
|
378
386
|
|
|
379
387
|
/**
|
|
@@ -462,12 +470,6 @@ export function save_eft(fit: Fit): string;
|
|
|
462
470
|
|
|
463
471
|
export function set_panic_hook(): void;
|
|
464
472
|
|
|
465
|
-
/**
|
|
466
|
-
* Report the fitting rules the fit breaks. Calculates the fit itself, as
|
|
467
|
-
* every rule reads the values after skills and modules changed them.
|
|
468
|
-
*/
|
|
469
|
-
export function validate(fit: Fit): Violation[];
|
|
470
|
-
|
|
471
473
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
472
474
|
|
|
473
475
|
export interface InitOutput {
|
|
@@ -479,7 +481,6 @@ export interface InitOutput {
|
|
|
479
481
|
readonly load_sde: (a: number, b: number) => [number, number, number];
|
|
480
482
|
readonly save_eft: (a: any) => [number, number, number, number];
|
|
481
483
|
readonly set_panic_hook: () => void;
|
|
482
|
-
readonly validate: (a: any) => [number, number, number];
|
|
483
484
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
484
485
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
485
486
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/esf_dogma_engine.js
CHANGED
|
@@ -103,20 +103,6 @@ export function save_eft(fit) {
|
|
|
103
103
|
export function set_panic_hook() {
|
|
104
104
|
wasm.set_panic_hook();
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Report the fitting rules the fit breaks. Calculates the fit itself, as
|
|
109
|
-
* every rule reads the values after skills and modules changed them.
|
|
110
|
-
* @param {Fit} fit
|
|
111
|
-
* @returns {Violation[]}
|
|
112
|
-
*/
|
|
113
|
-
export function validate(fit) {
|
|
114
|
-
const ret = wasm.validate(fit);
|
|
115
|
-
if (ret[2]) {
|
|
116
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
117
|
-
}
|
|
118
|
-
return takeFromExternrefTable0(ret[0]);
|
|
119
|
-
}
|
|
120
106
|
function __wbg_get_imports() {
|
|
121
107
|
const import0 = {
|
|
122
108
|
__proto__: null,
|
package/esf_dogma_engine_bg.wasm
CHANGED
|
Binary file
|