Implement spoolup parameters fetcher and rely on it for misc column stats
This commit is contained in:
@@ -75,7 +75,7 @@ class FitDpsGraph(Graph):
|
||||
pyfalog.critical(e)
|
||||
|
||||
for mod in fit.modules:
|
||||
dps = mod.getDps(targetResists=fit.targetResists)[0].total
|
||||
dps = mod.getDps(targetResists=fit.targetResists).total
|
||||
if mod.hardpoint == Hardpoint.TURRET:
|
||||
if mod.state >= State.ACTIVE:
|
||||
total += dps * self.calculateTurretMultiplier(mod, data)
|
||||
|
||||
@@ -1223,7 +1223,7 @@ class Fit(object):
|
||||
remoteReps = {}
|
||||
|
||||
for module in self.modules:
|
||||
rrType, rrAmount, spoolTime = module.getRemoteReps(spoolOptions=spoolOptions)
|
||||
rrType, rrAmount = module.getRemoteReps(spoolOptions=spoolOptions)
|
||||
if rrType:
|
||||
if rrType not in remoteReps:
|
||||
remoteReps[rrType] = 0
|
||||
@@ -1448,8 +1448,8 @@ class Fit(object):
|
||||
weaponDps = DmgTypes(0, 0, 0, 0)
|
||||
|
||||
for mod in self.modules:
|
||||
weaponVolley += mod.getVolley(spoolOptions=spoolOptions, targetResists=self.targetResists)[0]
|
||||
weaponDps += mod.getDps(spoolOptions=spoolOptions, targetResists=self.targetResists)[0]
|
||||
weaponVolley += mod.getVolley(spoolOptions=spoolOptions, targetResists=self.targetResists)
|
||||
weaponDps += mod.getDps(spoolOptions=spoolOptions, targetResists=self.targetResists)
|
||||
|
||||
self.__weaponVolleyMap[spoolOptions] = weaponVolley
|
||||
self.__weaponDpsMap[spoolOptions] = weaponDps
|
||||
|
||||
@@ -434,7 +434,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
|
||||
def getVolley(self, spoolOptions=None, targetResists=None, ignoreState=False):
|
||||
if self.isEmpty or (self.state < State.ACTIVE and not ignoreState):
|
||||
return DmgTypes(0, 0, 0, 0), 0
|
||||
return DmgTypes(0, 0, 0, 0)
|
||||
if self.__baseVolley is None:
|
||||
dmgGetter = self.getModifiedChargeAttr if self.charge else self.getModifiedItemAttr
|
||||
dmgMult = self.getModifiedItemAttr("damageMultiplier", 1)
|
||||
@@ -444,22 +444,22 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
kinetic=(dmgGetter("kineticDamage", 0)) * dmgMult,
|
||||
explosive=(dmgGetter("explosiveDamage", 0)) * dmgMult)
|
||||
spoolType, spoolAmount = resolveSpoolOptions(spoolOptions, self)
|
||||
spoolBoost, spoolTime = calculateSpoolup(
|
||||
spoolBoost = calculateSpoolup(
|
||||
self.getModifiedItemAttr("damageMultiplierBonusMax", 0),
|
||||
self.getModifiedItemAttr("damageMultiplierBonusPerCycle", 0),
|
||||
self.rawCycleTime / 1000, spoolType, spoolAmount)
|
||||
self.rawCycleTime / 1000, spoolType, spoolAmount)[0]
|
||||
spoolMultiplier = 1 + spoolBoost
|
||||
volley = DmgTypes(
|
||||
em=self.__baseVolley.em * spoolMultiplier * (1 - getattr(targetResists, "emAmount", 0)),
|
||||
thermal=self.__baseVolley.thermal * spoolMultiplier * (1 - getattr(targetResists, "thermalAmount", 0)),
|
||||
kinetic=self.__baseVolley.kinetic * spoolMultiplier * (1 - getattr(targetResists, "kineticAmount", 0)),
|
||||
explosive=self.__baseVolley.explosive * spoolMultiplier * (1 - getattr(targetResists, "explosiveAmount", 0)))
|
||||
return volley, spoolTime
|
||||
return volley
|
||||
|
||||
def getDps(self, spoolOptions=None, targetResists=None, ignoreState=False):
|
||||
volley, spoolTime = self.getVolley(spoolOptions=spoolOptions, targetResists=targetResists, ignoreState=ignoreState)
|
||||
volley = self.getVolley(spoolOptions=spoolOptions, targetResists=targetResists, ignoreState=ignoreState)
|
||||
if not volley:
|
||||
return DmgTypes(0, 0, 0, 0), 0
|
||||
return DmgTypes(0, 0, 0, 0)
|
||||
# Some weapons repeat multiple times in one cycle (bosonic doomsdays). Get the number of times it fires off
|
||||
volleysPerCycle = max(self.getModifiedItemAttr("doomsdayDamageDuration", 1) / self.getModifiedItemAttr("doomsdayDamageCycleTime", 1), 1)
|
||||
dpsFactor = volleysPerCycle / (self.cycleTime / 1000)
|
||||
@@ -468,11 +468,11 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
thermal=volley.thermal * dpsFactor,
|
||||
kinetic=volley.kinetic * dpsFactor,
|
||||
explosive=volley.explosive * dpsFactor)
|
||||
return dps, spoolTime
|
||||
return dps
|
||||
|
||||
def getRemoteReps(self, spoolOptions=None, ignoreState=False):
|
||||
if self.isEmpty or (self.state < State.ACTIVE and not ignoreState):
|
||||
return (None, 0, 0)
|
||||
return None, 0
|
||||
|
||||
def getBaseRemoteReps(module):
|
||||
remoteModuleGroups = {
|
||||
@@ -507,17 +507,35 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.__baseRemoteReps = getBaseRemoteReps(self)
|
||||
|
||||
rrType, rrAmount = self.__baseRemoteReps
|
||||
spoolTime = 0
|
||||
|
||||
if rrType and rrAmount and self.item.group.name == "Mutadaptive Remote Armor Repairer":
|
||||
spoolType, spoolAmount = resolveSpoolOptions(spoolOptions, self)
|
||||
spoolBoost, spoolTime = calculateSpoolup(
|
||||
spoolBoost = calculateSpoolup(
|
||||
self.getModifiedItemAttr("repairMultiplierBonusMax", 0),
|
||||
self.getModifiedItemAttr("repairMultiplierBonusPerCycle", 0),
|
||||
self.rawCycleTime / 1000, spoolType, spoolAmount)
|
||||
self.rawCycleTime / 1000, spoolType, spoolAmount)[0]
|
||||
rrAmount *= (1 + spoolBoost)
|
||||
|
||||
return rrType, rrAmount, spoolTime
|
||||
return rrType, rrAmount
|
||||
|
||||
def getSpoolData(self, spoolOptions=None):
|
||||
weaponMultMax = self.getModifiedItemAttr("damageMultiplierBonusMax", 0)
|
||||
weaponMultPerCycle = self.getModifiedItemAttr("damageMultiplierBonusPerCycle", 0)
|
||||
if weaponMultMax and weaponMultPerCycle:
|
||||
spoolType, spoolAmount = resolveSpoolOptions(spoolOptions, self)
|
||||
_, spoolCycles, spoolTime = calculateSpoolup(
|
||||
weaponMultMax, weaponMultPerCycle,
|
||||
self.rawCycleTime / 1000, spoolType, spoolAmount)
|
||||
return spoolCycles, spoolTime
|
||||
rrMultMax = self.getModifiedItemAttr("repairMultiplierBonusMax", 0)
|
||||
rrMultPerCycle = self.getModifiedItemAttr("repairMultiplierBonusPerCycle", 0)
|
||||
if rrMultMax and rrMultPerCycle:
|
||||
spoolType, spoolAmount = resolveSpoolOptions(spoolOptions, self)
|
||||
_, spoolCycles, spoolTime = calculateSpoolup(
|
||||
rrMultMax, rrMultPerCycle,
|
||||
self.rawCycleTime / 1000, spoolType, spoolAmount)
|
||||
return spoolCycles, spoolTime
|
||||
return 0, 0
|
||||
|
||||
@property
|
||||
def reloadTime(self):
|
||||
|
||||
@@ -38,20 +38,22 @@ def calculateSpoolup(modMaxValue, modStepValue, modCycleTime, spoolType, spoolAm
|
||||
"""
|
||||
Calculate damage multiplier increment based on passed parameters. Module cycle time
|
||||
is specified in seconds.
|
||||
|
||||
Returns spoolup value, amount of cycles to reach it and time to reach it.
|
||||
"""
|
||||
if not modMaxValue or not modStepValue:
|
||||
return 0, 0
|
||||
return 0, 0, 0
|
||||
if spoolType == SpoolType.SCALE:
|
||||
cycles = int(floatUnerr(spoolAmount * modMaxValue / modStepValue))
|
||||
return cycles * modStepValue, cycles * modCycleTime
|
||||
return cycles * modStepValue, cycles, cycles * modCycleTime
|
||||
elif spoolType == SpoolType.TIME:
|
||||
cycles = min(int(floatUnerr(spoolAmount / modCycleTime)), int(floatUnerr(modMaxValue / modStepValue)))
|
||||
return cycles * modStepValue, cycles * modCycleTime
|
||||
return cycles * modStepValue, cycles, cycles * modCycleTime
|
||||
elif spoolType == SpoolType.CYCLES:
|
||||
cycles = min(int(spoolAmount), int(floatUnerr(modMaxValue / modStepValue)))
|
||||
return cycles * modStepValue, cycles * modCycleTime
|
||||
return cycles * modStepValue, cycles, cycles * modCycleTime
|
||||
else:
|
||||
return 0, 0
|
||||
return 0, 0, 0
|
||||
|
||||
|
||||
def resolveSpoolOptions(spoolOptions, module):
|
||||
|
||||
@@ -28,25 +28,25 @@ from eos.utils.spoolSupport import SpoolType, SpoolOptions
|
||||
stats = [
|
||||
(
|
||||
"labelRemoteCapacitor", "Capacitor:", "{}{} GJ/s", "capacitorInfo", "Capacitor restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Capacitor"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Capacitor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Capacitor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Capacitor", 0),
|
||||
3, 0, 0),
|
||||
(
|
||||
"labelRemoteShield", "Shield:", "{}{} HP/s", "shieldActive", "Shield restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Shield"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Shield", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Shield", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Shield", 0),
|
||||
3, 0, 0),
|
||||
(
|
||||
"labelRemoteArmor", "Armor:", "{}{} HP/s", "armorActive", "Armor restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Armor"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Armor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Armor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Armor", 0),
|
||||
3, 0, 0),
|
||||
(
|
||||
"labelRemoteHull", "Hull:", "{}{} HP/s", "hullActive", "Hull restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Hull"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Hull", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Hull", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Hull", 0),
|
||||
3, 0, 0)]
|
||||
|
||||
@@ -27,25 +27,25 @@ from eos.utils.spoolSupport import SpoolType, SpoolOptions
|
||||
stats = [
|
||||
(
|
||||
"labelRemoteCapacitor", "Capacitor:", "{}{} GJ/s", "capacitorInfo", "Capacitor restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Capacitor"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Capacitor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Capacitor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Capacitor", 0),
|
||||
3, 0, 0),
|
||||
(
|
||||
"labelRemoteShield", "Shield:", "{}{} HP/s", "shieldActive", "Shield restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Shield"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Shield", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Shield", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Shield", 0),
|
||||
3, 0, 0),
|
||||
(
|
||||
"labelRemoteArmor", "Armor:", "{}{} HP/s", "armorActive", "Armor restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Armor"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Armor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Armor", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Armor", 0),
|
||||
3, 0, 0),
|
||||
(
|
||||
"labelRemoteHull", "Hull:", "{}{} HP/s", "hullActive", "Hull restored",
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Hull"),
|
||||
lambda fit, spool: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, spool, False)).get("Hull", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True)).get("Hull", 0),
|
||||
lambda fit: fit.getRemoteReps(spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True)).get("Hull", 0),
|
||||
3, 0, 0)]
|
||||
|
||||
@@ -117,9 +117,7 @@ class Miscellanea(ViewColumn):
|
||||
info.append((text, tooltip))
|
||||
# TODO: fetch spoolup option
|
||||
defaultSpoolValue = 1
|
||||
spoolTime = stuff.getVolley(
|
||||
spoolOptions=SpoolOptions(SpoolType.SCALE, defaultSpoolValue, False),
|
||||
ignoreState=True)[1]
|
||||
spoolTime = stuff.getSpoolData(spoolOptions=SpoolOptions(SpoolType.SCALE, defaultSpoolValue, False))[1]
|
||||
if spoolTime:
|
||||
text = "{0}s".format(formatAmount(spoolTime, 3, 0, 3))
|
||||
tooltip = "spool up time"
|
||||
@@ -341,31 +339,32 @@ class Miscellanea(ViewColumn):
|
||||
elif itemGroup == "Mutadaptive Remote Armor Repairer":
|
||||
# TODO: fetch spoolup option
|
||||
defaultSpoolValue = 1
|
||||
rrType, rps, spoolTime = stuff.getRemoteReps(
|
||||
spoolOptions=SpoolOptions(SpoolType.SCALE, defaultSpoolValue, False),
|
||||
ignoreState=True)
|
||||
rrTypePre, rpsPre, spoolTimePre = stuff.getRemoteReps(
|
||||
spoolOptions=SpoolOptions(SpoolType.SCALE, 0, True),
|
||||
ignoreState=True)
|
||||
rrTypeFull, rpsFull, spoolTimeFull = stuff.getRemoteReps(
|
||||
spoolOptions=SpoolOptions(SpoolType.SCALE, 1, True),
|
||||
ignoreState=True)
|
||||
spoolOptDefault = SpoolOptions(SpoolType.SCALE, defaultSpoolValue, False)
|
||||
spoolOptPre = SpoolOptions(SpoolType.SCALE, 0, True)
|
||||
spoolOptFull = SpoolOptions(SpoolType.SCALE, 1, True)
|
||||
rrType, rps = stuff.getRemoteReps(spoolOptions=spoolOptDefault, ignoreState=True)
|
||||
rrTypePre, rpsPre = stuff.getRemoteReps(spoolOptions=spoolOptPre, ignoreState=True)
|
||||
rrTypeFull, rpsFull = stuff.getRemoteReps(spoolOptions=spoolOptFull, ignoreState=True)
|
||||
if not rps:
|
||||
return "", None
|
||||
text = []
|
||||
tooltip = []
|
||||
text.append("{}/s".format(formatAmount(rps, 3, 0, 3, forceSign=True)))
|
||||
tooltip.append("Armor repaired per second")
|
||||
spoolTime = stuff.getSpoolData(spoolOptDefault)[1]
|
||||
if spoolTime:
|
||||
text.append("{}s".format(formatAmount(spoolTime, 3, 0, 3)))
|
||||
tooltip.append("spool up time")
|
||||
text = " | ".join(text)
|
||||
tooltip = " and ".join(tooltip)
|
||||
tooltip = "{}\nSpool up: {}-{} over {}s".format(
|
||||
tooltip,
|
||||
formatAmount(rpsPre, 3, 0, 3),
|
||||
formatAmount(rpsFull, 3, 0, 3),
|
||||
formatAmount(spoolTimeFull - spoolTimePre, 3, 0, 3))
|
||||
spoolTimePre = stuff.getSpoolData(spoolOptPre)[1]
|
||||
spoolTimeFull = stuff.getSpoolData(spoolOptFull)[1]
|
||||
if spoolTimePre != spoolTimeFull:
|
||||
tooltip = "{}\nSpool up: {}-{} over {}s".format(
|
||||
tooltip,
|
||||
formatAmount(rpsPre, 3, 0, 3),
|
||||
formatAmount(rpsFull, 3, 0, 3),
|
||||
formatAmount(spoolTimeFull - spoolTimePre, 3, 0, 3))
|
||||
return text, tooltip
|
||||
elif itemGroup == "Remote Shield Booster":
|
||||
rps = stuff.getRemoteReps(ignoreState=True)[1]
|
||||
|
||||
@@ -303,8 +303,11 @@ class EfsPort():
|
||||
def getWeaponSystemData(fit):
|
||||
weaponSystems = []
|
||||
groups = {}
|
||||
# TODO: fetch spoolup option
|
||||
defaultSpoolValue = 1
|
||||
spoolOptions = SpoolOptions(SpoolType.SCALE, defaultSpoolValue, False)
|
||||
for mod in fit.modules:
|
||||
if mod.getDps()[0].total > 0:
|
||||
if mod.getDps(spoolOptions=spoolOptions).total > 0:
|
||||
# Group weapon + ammo combinations that occur more than once
|
||||
keystr = str(mod.itemID) + "-" + str(mod.chargeID)
|
||||
if keystr in groups:
|
||||
@@ -346,14 +349,11 @@ class EfsPort():
|
||||
maxRange = 300000
|
||||
else:
|
||||
maxRange = stats.maxRange
|
||||
# TODO: fetch spoolup option
|
||||
defaultSpoolValue = 1
|
||||
spoolOptions = SpoolOptions(SpoolType.SCALE, defaultSpoolValue, False)
|
||||
statDict = {
|
||||
"dps": stats.getDps(spoolOptions=spoolOptions)[0].total * n, "capUse": stats.capUse * n, "falloff": stats.falloff,
|
||||
"dps": stats.getDps(spoolOptions=spoolOptions).total * n, "capUse": stats.capUse * n, "falloff": stats.falloff,
|
||||
"type": typeing, "name": name, "optimal": maxRange,
|
||||
"numCharges": stats.numCharges, "numShots": stats.numShots, "reloadTime": stats.reloadTime,
|
||||
"cycleTime": stats.cycleTime, "volley": stats.getVolley(spoolOptions=spoolOptions)[0].total * n, "tracking": tracking,
|
||||
"cycleTime": stats.cycleTime, "volley": stats.getVolley(spoolOptions=spoolOptions).total * n, "tracking": tracking,
|
||||
"maxVelocity": maxVelocity, "explosionDelay": explosionDelay, "damageReductionFactor": damageReductionFactor,
|
||||
"explosionRadius": explosionRadius, "explosionVelocity": explosionVelocity, "aoeFieldRange": aoeFieldRange,
|
||||
"damageMultiplierBonusMax": stats.getModifiedItemAttr("damageMultiplierBonusMax"),
|
||||
|
||||
Reference in New Issue
Block a user