diff --git a/config.py b/config.py index 6ac9ae32c..6b10b521b 100644 --- a/config.py +++ b/config.py @@ -18,10 +18,10 @@ debug = False saveInRoot = False # Version data -version = "1.20.0" -tag = "Stable" +version = "1.20.2" +tag = "git" expansionName = "March 2016" -expansionVersion = "1.0" +expansionVersion = "1.3" evemonMinVersion = "4081" pyfaPath = None diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 332faea21..13f3069b0 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -832,7 +832,8 @@ class Fit(object): return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity def addDrain(self, cycleTime, capNeed, clipSize=0): - resistance = self.ship.getModifiedItemAttr("energyWarfareResistance") or 1 + """ Used for both cap drains and cap fills (fills have negative capNeed) """ + resistance = self.ship.getModifiedItemAttr("energyWarfareResistance") or 1 if capNeed > 0 else 1 self.__extraDrains.append((cycleTime, capNeed * resistance, clipSize)) def removeDrain(self, i): diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 1f5e84ec1..6ea98bfec 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -416,10 +416,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): # Check this only if we're told to do so if hardpointLimit: if self.hardpoint == Hardpoint.TURRET: - if fit.ship.getModifiedItemAttr('turretSlotsLeft') - fit.getHardpointsUsed(Hardpoint.TURRET) < 1: + if (fit.ship.getModifiedItemAttr('turretSlotsLeft') or 0) - fit.getHardpointsUsed(Hardpoint.TURRET) < 1: return False elif self.hardpoint == Hardpoint.MISSILE: - if fit.ship.getModifiedItemAttr('launcherSlotsLeft') - fit.getHardpointsUsed(Hardpoint.MISSILE) < 1: + if (fit.ship.getModifiedItemAttr('launcherSlotsLeft')or 0) - fit.getHardpointsUsed(Hardpoint.MISSILE) < 1: return False return True diff --git a/eve.db b/eve.db index 68da081ce..0bb9841e8 100644 Binary files a/eve.db and b/eve.db differ diff --git a/service/fit.py b/service/fit.py index 085748e85..590651abe 100644 --- a/service/fit.py +++ b/service/fit.py @@ -261,6 +261,9 @@ class Fit(object): self.recalc(fit, withBoosters=True) fit.fill() + # Check that the states of all modules are valid + self.checkStates(fit, None) + eos.db.commit() fit.inited = True return fit diff --git a/service/port.py b/service/port.py index 9f98b8383..8f922ac8d 100644 --- a/service/port.py +++ b/service/port.py @@ -123,7 +123,10 @@ class Port(object): # If XML-style start of tag encountered, detect as XML if re.match("<", firstLine): - return "XML", cls.importXml(string, callback, encoding) + if encoding: + return "XML", cls.importXml(string, callback, encoding) + else: + return "XML", cls.importXml(string, callback) # If JSON-style start, parse os CREST/JSON if firstLine[0] == '{': @@ -176,10 +179,13 @@ class Port(object): # When item can't be added to any slot (unknown item or just charge), ignore it except ValueError: continue - if m.isValidState(State.ACTIVE): - m.state = State.ACTIVE + if m.fits(f): + m.owner = f + if m.isValidState(State.ACTIVE): + m.state = State.ACTIVE + + f.modules.append(m) - f.modules.append(m) except: continue @@ -219,9 +225,11 @@ class Port(object): for i in xrange(int(amount)): try: m = Module(item) - f.modules.append(m) + if m.fits(f): + f.modules.append(m) except: pass + m.owner = f if m.isValidState(State.ACTIVE): m.state = State.ACTIVE @@ -315,12 +323,15 @@ class Port(object): except: pass - if setOffline is True and m.isValidState(State.OFFLINE): - m.state = State.OFFLINE - elif m.isValidState(State.ACTIVE): - m.state = State.ACTIVE + if m.fits(fit): + m.owner = fit + if setOffline is True and m.isValidState(State.OFFLINE): + m.state = State.OFFLINE + elif m.isValidState(State.ACTIVE): + m.state = State.ACTIVE + + fit.modules.append(m) - fit.modules.append(m) for droneName in droneMap: d = Drone(sMkt.getItem(droneName)) @@ -467,6 +478,7 @@ class Port(object): # Create module and activate it if it's activable m = Module(modItem) + m.owner = f if m.isValidState(State.ACTIVE): m.state = State.ACTIVE # Add charge to mod if applicable, on any errors just don't add anything @@ -478,7 +490,9 @@ class Port(object): except: pass # Append module to fit - f.modules.append(m) + if m.fits(f): + f.modules.append(m) + # Append fit to list of fits fits.append(f) @@ -534,12 +548,16 @@ class Port(object): # When item can't be added to any slot (unknown item or just charge), ignore it except ValueError: continue - if m.isValidState(State.ACTIVE): - m.state = State.ACTIVE + if m.fits(f): + m.owner = f + if m.isValidState(State.ACTIVE): + m.state = State.ACTIVE + + f.modules.append(m) - f.modules.append(m) except KeyboardInterrupt: continue + fits.append(f) if callback: wx.CallAfter(callback, None)