make slot a property for item and use that for the item list bg

This commit is contained in:
Tony Cook
2019-03-01 19:24:39 +11:00
parent 2ea3394845
commit af17a4f1c9
2 changed files with 22 additions and 6 deletions

View File

@@ -240,6 +240,7 @@ class Item(EqBase):
self.__assistive = None
self.__overrides = None
self.__priceObj = None
self.__slot = None
@property
def attributes(self):
@@ -479,6 +480,21 @@ class Item(EqBase):
def isCharge(self):
return self.category.name == "Charge"
effectSlots = { 'loPower' : 1,
'medPower' : 2,
'hiPower' : 3,
'rigSlot' : 4,
'subSystem': 5 }
@property
def slot(self):
if self.__slot is None:
self.__slot = 0
for effectName in self.effectSlots:
if effectName in self.effects:
self.__slot = self.effectSlots[effectName]
break
return self.__slot;
def __repr__(self):
return "Item(ID={}, name={}) at {}".format(
self.ID, self.name, hex(id(self))