-
Notifications
You must be signed in to change notification settings - Fork 19
Fit model
Two core objects you will be dealing with the most often are Fits and Holders.
Initially this object was called MutableAttributeHolder, now reduced to just Holder. This class makes use of multiple Eos facilities to calculate modified item attributes, update them when necessary and expose to user. You will not be using this class directly - instead, all specific classes like Drone
or Skill
will be using it as parent. All these specific end-user objects may be referred to as "holders" throughout the doc pages and code.
Following holders are available:
Booster
Character
Charge
Drone
EffectBeacon
Implant
ModuleHigh
ModuleMed
ModuleLow
Rig
Ship
Skill
Stance
Subsystem
More info on specific holder types can be found on this page.
Fit
serves as container for all holders, exposes several high-level methods to the users (e.g. fit validation and stats). Eos' fit model is, most likely, slightly different from what you expect: almost all holders are stored directly on the fit (with the only exception of charges which are stored on modules). It means, that when you change ship on fit - only ship will be changed, everything else (including modules, rigs, subsystems) will be kept on fit. Overall fit structure looks like this:
-
.character
(direct) -
.skills
(restricted set) -
.implants
(set) -
.boosters
(set) -
.ship
(direct) -
.stance
(direct) -
.subsystems
(set) -
.modules.high
(list) -
.modules.med
(list) -
.modules.low
(list) -
.rigs
(set) -
.drones
(set) -
.effect_beacon
(direct)
Type of container is specified in parenthesis. You can find more info about them here.
The Character
object is assigned to any fit by default and you should never change it (unless you're 100% sure that you need to do it) - because all character types in EVE have the same set of attributes and effects, at least out of those which matter for ship fitting.
One important thing to remember is that holders are 'hollow' by their nature - they carry just typeIDs of items they represent, and some holder-specific info: states for modules, levels for skills, etc. Fit and holders cannot provide any actual functionality (like calculating attributes of any item or exposing ship stats) without knowing some data about actual EVE objects like base item attributes: if you attempt to access that functionality, it will either fail with NoSourceError or will return None.
>>> fit = Fit()
>>> fit.ship = Ship(32311)
>>> fit.stats.agility_factor
Traceback (most recent call last):
...
eos.fit.holder.mixin.holder.exception.NoSourceError
>>> print(fit.stats.get_nominal_dps().total)
None
To fix it, add at least one source to SourceManager
and assign source to fit. It will fill fit's holders with necessary data and enable all of available Eos features for said fit.
You can do it three ways during Fit
instantiation:
- Using source instance
>>> SourceManager.add('tiamat', data_handler, cache_handler)
>>> source = SourceManager.get('tiamat')
>>> fit = Fit(source=source)
>>> fit.ship = Ship(32311)
>>> fit.stats.agility_factor
15.645718159599085
- Using source alias
>>> SourceManager.add('tiamat', data_handler, cache_handler)
>>> fit = Fit(source='tiamat')
>>> fit.ship = Ship(32311)
>>> fit.stats.agility_factor
15.645718159599085
- Implicitly assigning default source (or passing None as source)
>>> SourceManager.add('tiamat', data_handler, cache_handler, make_default=True)
>>> fit = Fit()
>>> fit.ship = Ship(32311)
>>> fit.stats.agility_factor
15.645718159599085
You can change it later at any moment by changing fit.source
attribute - it accepts Source
instances, source aliases and None. In case of None fit won't use default source like it does during fit instantiation.
Changing sources might be useful if you want to compare fit stats between current Tranquility build and latest Singularity builds.