- Protobuf Compiler: >= 29.3 (optional)
- Python environment: >= 3.12 (dev: 3.12.4)
- UV: >= 0.5.24
- Rust: >= 1.83.0
-
Compile protobuf for python (optional) (The repo offers a pre-compiled python file.)
protoc efos.proto --python_out . # Output file: efos_pb2.py
-
Download FSD files.
You have to manually download FSD datasets and unzip it to a separate folder (in this guide,./fsd
). URL: fsd.zip. -
Convert FSD files to protobuf.
-
Initialize UV env
uv sync
-
Run converter
uv run -m data.convert <path/to/fsd> <path/to/patches> <path/to/output>
Example:
uv run -m data.convert data/fsd data/patches data/out
-
Wait until the command exits.
-
-
Build the library
cargo build
use eve_fit_os::fit::{ItemFit, ItemModule, ItemSlot, ItemSlotType, ItemState, ItemCharge, ItemDrone},
let fit = ItemFit {
ship_type_id: 628, // Arbitrator, 主宰级
// ship modules, including rigs and subsystems.
modules: (0..3)
.map(|index| ItemModule {
// Rapid Light Missile Launcher II
// 轻型快速导弹发射器 II
type_id: 1877,
slot: ItemSlot {
slot_type: ItemSlotType::High,
index,
},
state: ItemState::Active,
charge: Some(ItemCharge {
// Mjolnir Fury Light Missile
// 雷神愤怒轻型导弹
type_id: 2613,
})
})
.collect(),
drones: vec![ItemDrone {
type_id: 2456, // Hobgoblin II, 地精灵 II
state: ItemState::Active,
}],
implants: vec![ItemImplant {
// Zainou 'Snapshot' Light Missiles LM-905
// 载诺 快照 轻型导弹 LM-905
type_id: 27252
}]
};
let skills: BTreeMap<i32, u8> =
[
// ...
]
.into_iter()
.collect();
Any type implements InfoProvider
can be a data provider.
The lib itself offers a container initialized from the protobuf data mentioned above.
use eve_fit_os::protobuf::Database;
let info = Database::init("data/out/pb2").unwrap();
use eve_fit_os::fit::FitContainer;
use eve_fit_os::calculate::calculate;
let container = FitContainer::new(fit, skills);
let out = calculate(&container, &info);
let dmg = out
.modules
.iter()
.find(|t| t.type_id == 1877)
.and_then(|t| t.charge.as_ref())
.and_then(|t| t.attributes.get(&114)) // emDamage
.and_then(|t| t.value)
.unwrap_or_default();
assert!(dmg <= 161 && dmg >= 159); // around 160.4
To easily calculate some special attributes.
All patches' id are negative, starting from -1
.
The sequence and exact id of a patch item is not guaranteed,
you have to check the patch file and the output json to figure out
what a patch item and its id is.
This project's data files are not subjected to change unless the project itself changes.
That means we could assume that no fields will be added/removed,
so we can force some of the fields to be required
, which is not allowed in proto3.