From 60a786a6a24c0311bed2d6357d24063267d19fc0 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 10 May 2014 22:46:25 -0400 Subject: [PATCH 1/4] Fix boosting as it related to projected fits (was boosting target fit rather than current fit) --- eos/saveddata/fit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 9a78c9c121..72913a0962 100755 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -919,13 +919,13 @@ def calculateModifiedAttributes(self, targetFit=None, withBoosters=False, dirtyS (effect.isType("active") and thing.state >= State.ACTIVE): # Run effect, and get proper bonuses applied try: - effect.handler(targetFit, thing, context) + effect.handler(self, thing, context) except: pass else: # Run effect, and get proper bonuses applied try: - effect.handler(targetFit, thing, context) + effect.handler(self, thing, context) except: pass for fit in self.projectedFits: From af325caeccc2acd20f4a5da7c37f00708217dceb Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 10 May 2014 22:47:42 -0400 Subject: [PATCH 2/4] Fix order of operations (boosting not applied to modules of projected fits) --- eos/saveddata/fit.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 72913a0962..cd1a379b96 100755 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -894,17 +894,8 @@ def calculateModifiedAttributes(self, targetFit=None, withBoosters=False, dirtyS else: c = chain((self.character, self.ship), self.drones, self.boosters, self.appliedImplants, self.modules, self.projectedDrones, self.projectedModules) - - for item in c: - # Registering the item about to affect the fit allows us to track "Affected By" relations correctly - if item is not None: - self.register(item) - item.calculateModifiedAttributes(self, runTime, False) - if forceProjected is True: - targetFit.register(item) - item.calculateModifiedAttributes(targetFit, runTime, True) + if self.gangBoosts is not None: - #print self.gangBoosts contextMap = {Skill: "skill", Ship: "ship", Module: "module", @@ -928,6 +919,16 @@ def calculateModifiedAttributes(self, targetFit=None, withBoosters=False, dirtyS effect.handler(self, thing, context) except: pass + + for item in c: + # Registering the item about to affect the fit allows us to track "Affected By" relations correctly + if item is not None: + self.register(item) + item.calculateModifiedAttributes(self, runTime, False) + if forceProjected is True: + targetFit.register(item) + item.calculateModifiedAttributes(targetFit, runTime, True) + for fit in self.projectedFits: fit.calculateModifiedAttributes(self, dirtyStorage=dirtyStorage) From a0c1686ac5d711df7721fd82b3cc21cafb8aef9e Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 10 May 2014 22:48:43 -0400 Subject: [PATCH 3/4] Pass `withBoosters` to projected fits (to flag booster calculation) --- eos/saveddata/fit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index cd1a379b96..a2a503fa75 100755 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -930,7 +930,7 @@ def calculateModifiedAttributes(self, targetFit=None, withBoosters=False, dirtyS item.calculateModifiedAttributes(targetFit, runTime, True) for fit in self.projectedFits: - fit.calculateModifiedAttributes(self, dirtyStorage=dirtyStorage) + fit.calculateModifiedAttributes(self, withBoosters=withBoosters, dirtyStorage=dirtyStorage) def fill(self): """ From b783f0641c277bb537e25e526306aac176f15b1c Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 10 May 2014 22:49:12 -0400 Subject: [PATCH 4/4] Load fleet data of projected fits --- service/fit.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/service/fit.py b/service/fit.py index bc7e7bf563..2bc071bbc7 100644 --- a/service/fit.py +++ b/service/fit.py @@ -214,7 +214,11 @@ def switchFit(self, fitID): eos.db.commit() self.recalc(fit, withBoosters=True) - def getFit(self, fitID): + def getFit(self, fitID, projected = False): + ''' Gets fit from database, and populates fleet data. + + Projected is a recursion flag that is set to reduce recursions into projected fits + ''' if fitID is None: return None fit = eos.db.getFit(fitID) @@ -227,8 +231,13 @@ def getFit(self, fitID): fit.fleet = None else: fit.fleet = f - self.recalc(fit, withBoosters=True) - fit.fill() + + if not projected: + for fitP in fit.projectedFits: + self.getFit(fitP.ID, projected = True) + self.recalc(fit, withBoosters=True) + fit.fill() + eos.db.commit() fit.inited = True return fit