Create isCharge property

This commit is contained in:
blitzmann
2018-07-26 01:16:29 -04:00
parent 0d32b60f7e
commit 7f8ad3885d
3 changed files with 8 additions and 1 deletions

View File

@@ -476,6 +476,10 @@ class Item(EqBase):
def getAbyssalYypes(cls):
cls.ABYSSAL_TYPES = eos.db.getAbyssalTypes()
@property
def isCharge(self):
return self.category.name == "Charge"
def __repr__(self):
return "Item(ID={}, name={}) at {}".format(
self.ID, self.name, hex(id(self))

View File

@@ -22,6 +22,8 @@ class GuiModuleAddCommand(wx.Command):
def Do(self):
success = False
# if we have a position set, try to apply the module to that position
# todo: check to see if item is a charge. if it is, dont try to add module, but instead set amm
if self.new_position:
success = self.internal_history.Submit(FitReplaceModuleCommand(self.fitID, self.new_position, self.itemID))
if not success:

View File

@@ -1077,7 +1077,8 @@ class Fit(object):
@staticmethod
def isAmmo(itemID):
return eos.db.getItem(itemID).category.name == "Charge"
# todo: get rid of this form the service, use directly from item
return eos.db.getItem(itemID).isCharge
@deprecated
def setAmmo(self, fitID, ammoID, modules, recalc=True):