Add ammo selection. TODO: add an ammo display column
This commit is contained in:
@@ -53,11 +53,21 @@ class FittingView(d.Display):
|
||||
fitID = self.activeFitID
|
||||
if fitID != None:
|
||||
cFit = service.Fit.getInstance()
|
||||
populate = cFit.appendModule(fitID, itemID)
|
||||
if populate:
|
||||
self.slotsChanged()
|
||||
if populate is not None:
|
||||
if cFit.isAmmo(itemID):
|
||||
modules = []
|
||||
sel = self.GetFirstSelected()
|
||||
while sel != -1:
|
||||
modules.append(self.mods[self.GetItemData(sel)].position)
|
||||
sel = self.GetNextSelected(sel)
|
||||
|
||||
cFit.setAmmo(fitID, itemID, modules)
|
||||
wx.PostEvent(self.mainFrame, FitChanged(fitID=fitID))
|
||||
else:
|
||||
populate = cFit.appendModule(fitID, itemID)
|
||||
if populate:
|
||||
self.slotsChanged()
|
||||
if populate is not None:
|
||||
wx.PostEvent(self.mainFrame, FitChanged(fitID=fitID))
|
||||
|
||||
def removeItem(self, event):
|
||||
row, _ = self.HitTest(event.Position)
|
||||
|
||||
@@ -230,3 +230,22 @@ class Fit(object):
|
||||
fit.character = eos.db.getCharacter(charID)
|
||||
fit.clear()
|
||||
fit.calculateModifiedAttributes()
|
||||
|
||||
def isAmmo(self, itemID):
|
||||
return eos.db.getItem(itemID).category.name == "Charge"
|
||||
|
||||
def setAmmo(self, fitID, ammoID, modules):
|
||||
if fitID is None:
|
||||
return
|
||||
|
||||
fit = eos.db.getFit(fitID)
|
||||
ammo = eos.db.getItem(ammoID)
|
||||
|
||||
for pos in modules:
|
||||
try:
|
||||
fit.modules[pos].charge = ammo
|
||||
except:
|
||||
pass
|
||||
|
||||
fit.clear()
|
||||
fit.calculateModifiedAttributes()
|
||||
Reference in New Issue
Block a user