diff --git a/eos/db/saveddata/fighter.py b/eos/db/saveddata/fighter.py index 1daa37ae7..2f4089756 100644 --- a/eos/db/saveddata/fighter.py +++ b/eos/db/saveddata/fighter.py @@ -20,7 +20,7 @@ from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean from sqlalchemy.orm import mapper from eos.db import saveddata_meta -from eos.types import Fighter +from eos.types import Fighter, Fit from sqlalchemy.orm import * from sqlalchemy.sql import and_ from eos.effectHandlerHelpers import * @@ -42,6 +42,7 @@ fighter_abilities_table = Table("fightersAbilities", saveddata_meta, mapper(Fighter, fighters_table, properties = { + "owner": relation(Fit), "_Fighter__abilities": relation( FighterAbility, backref="fighter", diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index f07e9d38a..0f366af6f 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -154,13 +154,23 @@ class ModifiedAttributeDict(collections.MutableMapping): cappingId = cappingAttrKeyCache[key] = None else: # see GH issue #620 - cappingId = cappingAttrKeyCache[key] = None if attrInfo.maxAttributeID == 797 else attrInfo.maxAttributeID + cappingId = cappingAttrKeyCache[key] = attrInfo.maxAttributeID if cappingId is None: cappingKey = None else: cappingAttrInfo = getAttributeInfo(cappingId) cappingKey = None if cappingAttrInfo is None else cappingAttrInfo.name - cappingValue = self.__calculateValue(cappingKey) if cappingKey is not None else None + + if cappingKey: + if cappingKey in self.original: + # some items come with their own caps (ie: carriers). If they do, use this + cappingValue = self.original.get(cappingKey).value + else: + # If not, get info about the default value + cappingValue = self.__calculateValue(cappingKey) + else: + cappingValue = None + # If value is forced, we don't have to calculate anything, # just return forced value instead force = self.__forced[key] if key in self.__forced else None diff --git a/eos/saveddata/ship.py b/eos/saveddata/ship.py index 0d9def9ee..3a78fd122 100644 --- a/eos/saveddata/ship.py +++ b/eos/saveddata/ship.py @@ -48,7 +48,7 @@ class Ship(ItemAttrShortcut, HandledItem): self.__item = item self.__modeItems = self.__getModeItems() - self.__itemModifiedAttributes = ModifiedAttributeDict() + self.__itemModifiedAttributes = ModifiedAttributeDict(parent=self) self.__itemModifiedAttributes.original = dict(self.item.attributes) self.__itemModifiedAttributes.original.update(self.EXTRA_ATTRIBUTES) self.__itemModifiedAttributes.overrides = self.item.overrides