Documentation
¶
Overview ¶
Package fitting turns a killmail's item list into a stable fit identity.
Three things come out of one killmail:
- fit_hash sha256 over the ship and its fitted modules
- family_hash the same, with each module replaced by its T1 root, so meta and faction variants of one doctrine cluster together
- items the render payload — modules with their loaded charge, plus drone rows carrying a bay total
The hash format is a compatibility contract, not an implementation detail. Roughly 400,000 fits are stored under hashes produced by the TypeScript, and a hash that differs by so much as a separator orphans all of them. So the serialisation below is reproduced exactly — including the decisions that look arbitrary.
The one worth calling out: charges and drones are deliberately NOT part of the hash. Two Rifters with identical modules and different ammo are the same fit. That was chosen so the enrichment columns could be added later without invalidating what was already on disk, and it stays that way.
Index ¶
Constants ¶
const ( SlotHigh = 1 SlotMed = 2 SlotLow = 3 SlotRig = 4 SlotSubsystem = 5 SlotDrone = 6 )
Slot groups, numbered to match the in-game and EFT layout — high, med, low, rig, subsystem, drone — so the frontend renders a fit without remapping.
const DroneBayFlag = 87
DroneBayFlag is where drones sit on a killmail.
Variables ¶
This section is empty.
Functions ¶
func IsShipType ¶
IsShipType reports whether a hull is a ship.
Resolved through group to category because CCP's SDE does not populate a category on types, only on groups. Callers use it to skip pods, structures and deployables, where a fit means nothing.
func SlotGroupForFlag ¶
SlotGroupForFlag maps an SDE inventory flag to a slot group.
The ranges are verified against inv_flags: 11-18 low, 19-26 med, 27-34 high, 92-99 rig (eight exist even though most hulls use three), 125-132 subsystem.
Fighter tubes and bays are deliberately absent. They are not covered by the partial index on killmail_items, so including them would turn every carrier and supercarrier fit lookup into a full scan — rare enough to wait for a dedicated index.
Types ¶
type ExtractedItem ¶
type ExtractedItem struct {
SlotGroup int32
Ordinal int32
TypeID int32
ChargeTypeID int32
Quantity int32
}
ExtractedItem is one row of the render payload.
type Fitting ¶
type Fitting struct {
FitHash string
FamilyHash string
Items []ExtractedItem
}
Fitting is the extracted identity and payload.
type Item ¶
type Item struct {
TypeID int32
FlagID int32
// ParentIndex is >= 0 for an item inside a container. Only top-level items
// are fitted hardware; anything nested is cargo.
ParentIndex int32
// Quantity is dropped plus destroyed. Only drones use it — a bay holds
// several of one type and the count has to round-trip.
Quantity int32
}
Item is one killmail item, reduced to what the extractor needs.