Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra info for misc column for fueled boosters (cap, shield, and armor) #960

Merged
11 changes: 8 additions & 3 deletions eos/gamedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,14 @@ def attributes(self):

return self.__attributes

def getAttribute(self, key):
if key in self.attributes:
return self.attributes[key].value
def getAttribute(self, key, default=None):
try:
if key in self.attributes:
return self.attributes[key].value
else:
return default
except AttributeError:
return default

def isType(self, type):
for effect in self.effects.itervalues():
Expand Down
26 changes: 16 additions & 10 deletions eos/modifiedAttributeDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,25 @@


class ItemAttrShortcut(object):
def getModifiedItemAttr(self, key):
if key in self.itemModifiedAttributes:
return self.itemModifiedAttributes[key]
else:
return None
def getModifiedItemAttr(self, key, default=None):
try:
if key in self.itemModifiedAttributes:
return self.itemModifiedAttributes[key]
else:
return default
except AttributeError:
return default


class ChargeAttrShortcut(object):
def getModifiedChargeAttr(self, key):
if key in self.chargeModifiedAttributes:
return self.chargeModifiedAttributes[key]
else:
return None
def getModifiedChargeAttr(self, key, default=None):
try:
if key in self.chargeModifiedAttributes:
return self.chargeModifiedAttributes[key]
else:
return default
except AttributeError:
return default


class ModifiedAttributeDict(collections.MutableMapping):
Expand Down
59 changes: 49 additions & 10 deletions gui/builtinViewColumns/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,30 +450,69 @@ def __getData(self, stuff):
return text, item.name
else:
return "", None
elif itemGroup in ("Ancillary Armor Repairer", "Ancillary Shield Booster"):
hp = stuff.hpBeforeReload
cycles = stuff.numShots
cycleTime = stuff.rawCycleTime
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"
reload_time = item.getAttribute("reloadTime", 0) / 1000
elif "Capacitor" in itemGroup:
boosted_attribute = "Cap"
reload_time = 10
else:
boosted_attribute = ""
reload_time = 0

cycles = max(stuff.numShots, 0)
cycleTime = max(stuff.rawCycleTime, 0)

# Get HP or boosted amount
stuff_hp = max(stuff.hpBeforeReload, 0)
armor_hp = stuff.getModifiedItemAttr("armorDamageAmount", 0)
capacitor_hp = stuff.getModifiedChargeAttr("capacitorBonus", 0)
shield_hp = stuff.getModifiedItemAttr("shieldBonus", 0)
hp = max(stuff_hp, armor_hp * cycles, capacitor_hp * cycles, shield_hp * cycles, 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":
hpRatio *= 3

if "Ancillary" in itemGroup and "Armor" in itemGroup:
hpRatio *= stuff.getModifiedItemAttr("chargedArmorDamageMultiplier", 1)

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":
Expand Down