diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 9dea7788d..a7e70fcb0 100755 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -165,6 +165,20 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): else: return self.__chargeCycles + @property + def hpBeforeReload(self): + """ + If item is some kind of repairer with charges, calculate + HP it reps before going into reload. + """ + cycles = self.numShots + armorRep = self.getModifiedItemAttr("armorDamageAmount") or 0 + shieldRep = self.getModifiedItemAttr("shieldBonus") or 0 + if not cycles or (not armorRep and not shieldRep): + return None + hp = round((armorRep + shieldRep) * cycles) + return hp + def __calculateAmmoShots(self): if self.charge is not None: # Set number of cycles before reload is needed @@ -335,7 +349,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): # Check ship type restrictions fitsOnType = set() fitsOnGroup = set() - + shipType = self.getModifiedItemAttr("fitsToShipType") if shipType is not None: fitsOnType.add(shipType) @@ -355,7 +369,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): if (len(fitsOnGroup) > 0 or len(fitsOnType) > 0) and fit.ship.item.group.ID not in fitsOnGroup and fit.ship.item.ID not in fitsOnType: return False - + # If the mod is a subsystem, don't let two subs in the same slot fit if self.slot == Slot.SUBSYSTEM: subSlot = self.getModifiedItemAttr("subSystemSlot") diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index 72f471d96..9a1df251f 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -26,6 +26,7 @@ from gui.utils.numberFormatter import formatAmount import service import gui.mainFrame import gui.builtinViews.fittingView as fv +import gui.globalEvents as GE EffectiveHpToggled, EFFECTIVE_HP_TOGGLED = wx.lib.newevent.NewEvent() @@ -160,9 +161,7 @@ class ResistancesViewFull(StatsView): def ehpSwitch(self, event): self.showEffective = event.effective - sFit = service.Fit.getInstance() - self.refreshPanel(sFit.getFit(self.mainFrame.getActiveFit())) - event.Skip() + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) def refreshPanel(self, fit): #If we did anything intresting, we'd update our labels to reflect the new fit's stats here diff --git a/gui/builtinViewColumns/misc.py b/gui/builtinViewColumns/misc.py index e91b9613b..6ad4f9257 100644 --- a/gui/builtinViewColumns/misc.py +++ b/gui/builtinViewColumns/misc.py @@ -17,11 +17,14 @@ # along with pyfa. If not, see . #=============================================================================== + +import gui.mainFrame from gui import builtinViewColumns from gui.viewColumn import ViewColumn from gui import bitmapLoader from gui.utils.numberFormatter import formatAmount from gui.utils.listFormatter import formatList +from service.fit import Fit import wx @@ -42,6 +45,7 @@ class Miscellanea(ViewColumn): if params["displayName"] or self.imageId == -1: self.columnText = "Misc data" self.mask |= wx.LIST_MASK_TEXT + self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getText(self, stuff): text = self.__getData(stuff)[0] @@ -407,6 +411,28 @@ class Miscellanea(ViewColumn): text = "{0}s".format(cycleTime) tooltip = "Spoolup time" return text, tooltip + elif itemGroup in ("Fueled Armor Repairer", "Fueled Shield Booster"): + hp = stuff.hpBeforeReload + cycles = stuff.numShots + cycleTime = stuff.cycleTime + if not hp or not cycleTime or not cycles: + return "", None + fit = Fit.getInstance().getFit(self.mainFrame.getActiveFit()) + ehpTotal = fit.ehp + hpTotal = fit.hp + useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective + if useEhp: + if itemGroup == "Fueled Armor Repairer": + hpRatio = ehpTotal["armor"] / hpTotal["armor"] + else: + hpRatio = ehpTotal["shield"] / hpTotal["shield"] + else: + hpRatio = 1 + ehp = hp * hpRatio + duration = cycles * cycleTime / 1000 + text = "{0} / {1}s".format(formatAmount(ehp, 3, 0, 9), formatAmount(duration, 3, 0, 3)) + tooltip = "Hitpoints restored over duration using charges" + return text, tooltip elif stuff.charge is not None: chargeGroup = stuff.charge.group.name if chargeGroup in ("Rocket", "Advanced Rocket", "Light Missile", "Advanced Light Missile", "FoF Light Missile", diff --git a/gui/statsPane.py b/gui/statsPane.py index a3dcc795f..37331e875 100644 --- a/gui/statsPane.py +++ b/gui/statsPane.py @@ -54,6 +54,7 @@ class StatsPane(wx.Panel): self.SetSizer(mainSizer) self.views = [] + self.nameViewMap = {} maxviews = len(self.DEFAULT_VIEWS) i=0 for viewName in self.DEFAULT_VIEWS: @@ -62,6 +63,7 @@ class StatsPane(wx.Panel): contentPanel.viewName = viewName view = StatsView.getView(viewName)(self) + self.nameViewMap[viewName] = view self.views.append(view) headerPanel = tp.GetHeaderPanel()