Add extra info for misc column for fueled boosters

This commit is contained in:
Ebag333
2017-01-28 21:47:58 -08:00
parent a952f80ea4
commit 88125634d2
2 changed files with 52 additions and 7 deletions

View File

@@ -243,9 +243,13 @@ class Item(EqBase):
return self.__attributes
def getAttribute(self, key):
def getAttribute(self, key, default=None):
if key in self.attributes:
return self.attributes[key].value
elif default:
return default
else:
return None
def isType(self, type):
for effect in self.effects.itervalues():

View File

@@ -450,30 +450,71 @@ class Miscellanea(ViewColumn):
return text, item.name
else:
return "", None
elif itemGroup in ("Ancillary Armor Repairer", "Ancillary Shield Booster"):
elif itemGroup in (
"Ancillary Armor Repairer",
"Ancillary Shield Booster",
"Capacitor Booster",
"Ancillary Remote Armor Repairer",
"Ancillary Remote Shield Booster",
):
if "Armor" in itemGroup or "Shield" in itemGroup:
boosted_attribute = "HP"
elif "Capacitor" in itemGroup:
boosted_attribute = "Cap"
else:
boosted_attribute = None
hp = stuff.hpBeforeReload
cycles = stuff.numShots
cycleTime = stuff.rawCycleTime
if boosted_attribute == "Cap":
if hp is None:
local_booster = stuff.charge.getAttribute("capacitorBonus",0)
hp = max(local_booster, 0) * cycles
reload_time = 10
elif boosted_attribute == "HP":
if hp is None:
armor_repairer = item.getAttribute("armorDamageAmount", None)
shield_booster = item.getAttribute("shieldBonus", None)
hp = max(armor_repairer, shield_booster, 0)
reload_time = item.getAttribute("reloadTime", 0) / 1000
else:
reload_time = 0
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
tooltip = "HP restored over duration using charges"
if useEhp:
if itemGroup == "Ancillary Armor Repairer":
tooltip = "{0} restored over duration using charges (plus reload)".format(boosted_attribute)
if useEhp and boosted_attribute == "HP" and "Remote" not in itemGroup:
if "Ancillary Armor Repairer" in itemGroup:
hpRatio = ehpTotal["armor"] / hpTotal["armor"]
else:
hpRatio = ehpTotal["shield"] / hpTotal["shield"]
tooltip = "E{0}".format(tooltip)
else:
hpRatio = 1
if itemGroup == "Ancillary Armor Repairer":
if ("Ancillary" and "Armor") in itemGroup:
hpRatio *= 3
ehp = hp * hpRatio
duration = cycles * cycleTime / 1000
text = "{0} / {1}s".format(formatAmount(ehp, 3, 0, 9), formatAmount(duration, 3, 0, 3))
for number_of_cycles in {5, 10, 25}:
tooltip = "{0}\n{1} charges lasts {2} seconds ({3} cycles)".format(
tooltip,
formatAmount(number_of_cycles*cycles, 3, 0, 3),
formatAmount((duration+reload_time)*number_of_cycles, 3, 0, 3),
formatAmount(number_of_cycles, 3, 0, 3)
)
text = "{0} / {1}s (+{2}s)".format(formatAmount(ehp, 3, 0, 9), formatAmount(duration, 3, 0, 3), formatAmount(reload_time, 3, 0, 3))
return text, tooltip
elif itemGroup == "Armor Resistance Shift Hardener":