Implement "Set as damage pattern" for ammo
This commit is contained in:
@@ -1 +1,2 @@
|
||||
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit"]
|
||||
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit",
|
||||
"ammoPattern"]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user