esf
Read and write esf/1, the plain-text format for EVE Online ship fits. Text, canonical and binary forms. No dependencies.
Usage
use ;
save() and save_binary() take entries in any order, and check every rule
of the spec. load() returns fits in canonical form. All three return an
esf::Error when a rule is broken. It says where: line for text, or fit
and entry (counting from 1) for fits.
Fits
An EsfFit is one fit: hull, name, tactical mode and its entries.
hull is None for a fit without a ship. A document can hold more than one
fit.
Each Entry is one line of the fit. None means the default:
| field | what it is | None means |
|---|---|---|
type_id |
The type ID. | An empty slot. |
count |
How many. | One; for fighters, a full squadron. |
fit_name |
The name of another fit in the list, which this ship or container carries. | Carries no fit. |
charge |
The charge loaded. | |
charge_count |
How many charges. | A full load. |
mutaplasmid |
The mutaplasmid applied. | |
overrides |
Attribute values by attribute ID. | |
state |
State::Off, On or Heat. |
Active if the type can be, else on. |
location |
Cargo, Bay or another hold; a rack, like High or Tube, for an empty slot or with slot. |
Where the type goes by default. |
slot |
The slot in the location rack, counting from 1. load() never sets it: it returns the rack in slot order, with empty slots between. |
The next free slot. |
The Catalog
The library holds no game data. You give it a Catalog: a type that looks
up types and attributes in your copy of the SDE.
use ;
;
Each method and field says what to return and where in the SDE it comes
from. esf::sde has helpers for the parts that take more than a lookup:
use HashMap;
use ;
// One row of types.jsonl.
// effects: (effectID, effectCategoryID) in file order; attributes: (attributeID, value)
examples/sde_jsonl_catalog.rs is a complete example on the official SDE in JSONL: copy it into your project.
ESI
ESI gives each item in a ship a location_flag. esf::esi turns it into a
location and a slot:
HiSlot2 gives High and slot 3, and ShipHangar gives Maintenance.
A flag that is not inside a ship, like Hangar, gives None; the example puts
those items in the cargo hold.
Tests
The test cases live in esf-format: