Implement "Set as damage pattern" for ammo

This commit is contained in:
cncfanatics
2010-10-28 16:16:59 +02:00
parent 3d544e0477
commit c90dab16ba
4 changed files with 22 additions and 3 deletions

View File

@@ -1 +1,2 @@
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit"]
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit",
"ammoPattern"]

View File

@@ -9,7 +9,6 @@ class DamagePattern(ContextMenu):
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def display(self, context, selection):
return context in ("resistancesViewFull",) and self.mainFrame.getActiveFit() is not None

View File

@@ -311,7 +311,7 @@ class ItemView(d.Display):
if sel == -1:
return
menu = ContextMenu.getMenu(self.active[sel], "item" if self.searching is False else "itemSearch")
menu = ContextMenu.getMenu((self.active[sel],), "item" if self.searching is False else "itemSearch")
self.PopupMenu(menu)
def itemSort(self, item):

View File

@@ -338,6 +338,25 @@ class Fit(object):
fit.clear()
fit.calculateModifiedAttributes()
def setAsPattern(self, fitID, ammo):
if fitID is None:
return
try:
sDP = DamagePattern.getInstance()
dp = sDP.getDamagePattern("Ammo")
except:
dp = eos.types.DamagePattern()
dp.name = "Ammo"
fit = eos.db.getFit(fitID)
for attr in ("em", "thermal", "kinetic", "explosive"):
setattr(dp, "%sAmount" % attr, ammo.getAttribute("%sDamage" % attr))
fit.damagePattern = dp
fit.clear()
fit.calculateModifiedAttributes()
def exportFit(self, fitID):
fit = eos.db.getFit(fitID)
return fit.exportEft()