From d2a52e26b2563f3bfe4469f2c4eb3144a688494a Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 14 Nov 2016 05:27:16 -0800 Subject: [PATCH 1/3] Switch Shield/Cap to using new formula The old formula was surpsingly close in most scenarios. It is, however, hardcoded to 25% which isn't always peak cap/shield regen. --- eos/saveddata/fit.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index a3000267f..a360f638e 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -32,7 +32,7 @@ import time import copy from utils.timer import Timer from eos.enum import Enum - +from gnosis.formulas.formulas import Formulas import logging @@ -50,8 +50,6 @@ class ImplantLocation(Enum): class Fit(object): """Represents a fitting, with modules, ship, implants, etc.""" - PEAK_RECHARGE = 0.25 - def __init__(self, ship=None, name=""): """Initialize a fit from the program""" # use @mode.setter's to set __attr and IDs. This will set mode as well @@ -880,15 +878,29 @@ class Fit(object): return self.__sustainableTank - def calculateCapRecharge(self, percent = PEAK_RECHARGE): - capacity = self.ship.getModifiedItemAttr("capacitorCapacity") - rechargeRate = self.ship.getModifiedItemAttr("rechargeRate") / 1000.0 - return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity + def calculateCapRecharge(self): + return_matrix = Formulas.capacitor_shield_regen_matrix(self.ship.getModifiedItemAttr("capacitorCapacity"), + self.ship.getModifiedItemAttr("rechargeRate")) + high_water_percent = 0 + high_water_delta = 0 + for item in return_matrix: + if high_water_delta < item['DeltaAmount']: + high_water_percent = item['Percent'] + high_water_delta = item['DeltaAmount'] - def calculateShieldRecharge(self, percent = PEAK_RECHARGE): - capacity = self.ship.getModifiedItemAttr("shieldCapacity") - rechargeRate = self.ship.getModifiedItemAttr("shieldRechargeRate") / 1000.0 - return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity + return high_water_delta + + def calculateShieldRecharge(self): + return_matrix = Formulas.capacitor_shield_regen_matrix(self.ship.getModifiedItemAttr("shieldCapacity"), + self.ship.getModifiedItemAttr("shieldRechargeRate")) + high_water_percent = 0 + high_water_delta = 0 + for item in return_matrix: + if high_water_delta < item['DeltaAmount']: + high_water_percent = item['Percent'] + high_water_delta = item['DeltaAmount'] + + return high_water_delta def addDrain(self, src, cycleTime, capNeed, clipSize=0): """ Used for both cap drains and cap fills (fills have negative capNeed) """ From 5bca2d723e252ce7d62724e2f5721adc4d8ed284 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Tue, 15 Nov 2016 10:10:19 -0800 Subject: [PATCH 2/3] Change from multi to en-us only Allows this to run in 32 bit Python. --- scripts/jsonToSql.py | 2 +- scripts/prep_data.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/jsonToSql.py b/scripts/jsonToSql.py index ce4bdf5fa..42bc02e50 100755 --- a/scripts/jsonToSql.py +++ b/scripts/jsonToSql.py @@ -126,7 +126,7 @@ def main(db, json_path): for row in data: typeLines = [] typeId = row["typeID"] - traitData = row["traits_en-us"] + traitData = row["traits"] for skillData in sorted(traitData.get("skills", ()), key=lambda i: i["header"]): typeLines.append(convertSection(skillData)) if "role" in traitData: diff --git a/scripts/prep_data.py b/scripts/prep_data.py index b4508d208..a014b5c3e 100644 --- a/scripts/prep_data.py +++ b/scripts/prep_data.py @@ -82,7 +82,7 @@ if not args.nojson: "invtypes,mapbulk_marketGroups,phbmetadata,phbtraits,fsdTypeOverrides,"\ "evegroups,evetypes,evecategories,marketProxy()_GetMarketGroups()" - FlowManager(miners, writers).run(list, "multi") + FlowManager(miners, writers).run(list, "en-us") ### SQL Convert import jsonToSql From 3217980ada0e07e24c051db2256e564a9c86b951 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 16 Nov 2016 12:11:27 -0800 Subject: [PATCH 3/3] Revert "Switch Shield/Cap to using new formula" This reverts commit d2a52e26b2563f3bfe4469f2c4eb3144a688494a. --- eos/saveddata/fit.py | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index a360f638e..a3000267f 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -32,7 +32,7 @@ import time import copy from utils.timer import Timer from eos.enum import Enum -from gnosis.formulas.formulas import Formulas + import logging @@ -50,6 +50,8 @@ class ImplantLocation(Enum): class Fit(object): """Represents a fitting, with modules, ship, implants, etc.""" + PEAK_RECHARGE = 0.25 + def __init__(self, ship=None, name=""): """Initialize a fit from the program""" # use @mode.setter's to set __attr and IDs. This will set mode as well @@ -878,29 +880,15 @@ class Fit(object): return self.__sustainableTank - def calculateCapRecharge(self): - return_matrix = Formulas.capacitor_shield_regen_matrix(self.ship.getModifiedItemAttr("capacitorCapacity"), - self.ship.getModifiedItemAttr("rechargeRate")) - high_water_percent = 0 - high_water_delta = 0 - for item in return_matrix: - if high_water_delta < item['DeltaAmount']: - high_water_percent = item['Percent'] - high_water_delta = item['DeltaAmount'] + def calculateCapRecharge(self, percent = PEAK_RECHARGE): + capacity = self.ship.getModifiedItemAttr("capacitorCapacity") + rechargeRate = self.ship.getModifiedItemAttr("rechargeRate") / 1000.0 + return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity - return high_water_delta - - def calculateShieldRecharge(self): - return_matrix = Formulas.capacitor_shield_regen_matrix(self.ship.getModifiedItemAttr("shieldCapacity"), - self.ship.getModifiedItemAttr("shieldRechargeRate")) - high_water_percent = 0 - high_water_delta = 0 - for item in return_matrix: - if high_water_delta < item['DeltaAmount']: - high_water_percent = item['Percent'] - high_water_delta = item['DeltaAmount'] - - return high_water_delta + def calculateShieldRecharge(self, percent = PEAK_RECHARGE): + capacity = self.ship.getModifiedItemAttr("shieldCapacity") + rechargeRate = self.ship.getModifiedItemAttr("shieldRechargeRate") / 1000.0 + return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity def addDrain(self, src, cycleTime, capNeed, clipSize=0): """ Used for both cap drains and cap fills (fills have negative capNeed) """