From 8322307ae03676c44b53d4eb0f18a6bdc9d24750 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Tue, 7 Mar 2017 09:45:34 -0800 Subject: [PATCH 01/11] Add tooltip for neut resist. Add handling missing attributes in getting modified value (return default, not exception). Tox fixes to clean up a little. --- eos/config.py | 1 - eos/effects/tractorbeamcan.py | 3 ++- eos/modifiedAttributeDict.py | 18 ++++++++++++------ gui/builtinStatsViews/capacitorViewFull.py | 11 +++++++++++ service/port.py | 2 +- service/settings.py | 1 + 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/eos/config.py b/eos/config.py index cf5b2e937..38371e299 100644 --- a/eos/config.py +++ b/eos/config.py @@ -16,4 +16,3 @@ settings = { # Autodetect path, only change if the autodetection bugs out. path = dirname(unicode(__file__, sys.getfilesystemencoding())) - diff --git a/eos/effects/tractorbeamcan.py b/eos/effects/tractorbeamcan.py index c865b1c22..2c7f8eae3 100644 --- a/eos/effects/tractorbeamcan.py +++ b/eos/effects/tractorbeamcan.py @@ -2,8 +2,9 @@ # # Used by: # Modules from group: Tractor Beam (4 of 4) -type = "active" from eos.config import settings +type = "active" + def handler(fit, module, context): print settings['setting1'] diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 757d8a3d1..bc8dfd9a1 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -26,17 +26,23 @@ cappingAttrKeyCache = {} class ItemAttrShortcut(object): def getModifiedItemAttr(self, key, default=None): - if key in self.itemModifiedAttributes: - return self.itemModifiedAttributes[key] - else: + try: + if key in self.itemModifiedAttributes: + return self.itemModifiedAttributes[key] + else: + return default + except AttributeError: return default class ChargeAttrShortcut(object): def getModifiedChargeAttr(self, key, default=None): - if key in self.chargeModifiedAttributes: - return self.chargeModifiedAttributes[key] - else: + try: + if key in self.chargeModifiedAttributes: + return self.chargeModifiedAttributes[key] + else: + return default + except AttributeError: return default diff --git a/gui/builtinStatsViews/capacitorViewFull.py b/gui/builtinStatsViews/capacitorViewFull.py index f85b35e4c..b30265741 100644 --- a/gui/builtinStatsViews/capacitorViewFull.py +++ b/gui/builtinStatsViews/capacitorViewFull.py @@ -114,6 +114,11 @@ class CapacitorViewFull(StatsView): ("label%sCapacitorRecharge", lambda: fit.capRecharge, 3, 0, 0), ("label%sCapacitorDischarge", lambda: fit.capUsed, 3, 0, 0), ) + if fit is None: + # Set default if fit is empty + neut_resist = 0 + else: + neut_resist = fit.ship.getModifiedItemAttr("energyWarfareResistance", 0) panel = "Full" for labelName, value, prec, lowest, highest in stats: @@ -127,6 +132,12 @@ class CapacitorViewFull(StatsView): label.SetLabel(formatAmount(value, prec, lowest, highest)) label.SetToolTip(wx.ToolTip("%.1f" % value)) + if labelName == "label%sCapacitorDischarge": + if neut_resist: + neut_resist = 100 - (neut_resist * 100) + label_tooltip = "Neut Resistance: {0:.0f}%".format(neut_resist) + label.SetToolTip(wx.ToolTip(label_tooltip)) + capState = fit.capState if fit is not None else 0 capStable = fit.capStable if fit is not None else False lblNameTime = "label%sCapacitorTime" diff --git a/service/port.py b/service/port.py index 3c0930810..3e923ed0f 100644 --- a/service/port.py +++ b/service/port.py @@ -816,7 +816,7 @@ class Port(object): if callback: wx.CallAfter(callback, None) # Skip fit silently if we get an exception - except Exception as e: + except Exception as e: pyfalog.error("Caught exception on fit.") pyfalog.error(e) pass diff --git a/service/settings.py b/service/settings.py index 0159bc516..5d44d4e88 100644 --- a/service/settings.py +++ b/service/settings.py @@ -437,6 +437,7 @@ class ContextMenuSettings(object): def set(self, type, value): self.ContextMenuDefaultSettings[type] = value + class EOSSettings(object): _instance = None From 99f939026fcd5c38238217ce25105db132a010de Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Mar 2017 12:14:23 -0800 Subject: [PATCH 02/11] Refactor some logic in modifiedAttributeDict --- eos/modifiedAttributeDict.py | 92 +++++++++++++++------- gui/builtinStatsViews/capacitorViewFull.py | 7 +- service/fit.py | 4 + 3 files changed, 71 insertions(+), 32 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index bc8dfd9a1..6e303f602 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -19,6 +19,7 @@ import collections from math import exp +from types import NoneType defaultValuesCache = {} cappingAttrKeyCache = {} @@ -26,24 +27,22 @@ cappingAttrKeyCache = {} class ItemAttrShortcut(object): def getModifiedItemAttr(self, key, default=None): - try: - if key in self.itemModifiedAttributes: - return self.itemModifiedAttributes[key] - else: - return default - except AttributeError: - return default + return_value = self.itemModifiedAttributes.get(key) + + if isinstance(return_value, NoneType) and not isinstance(default, NoneType): + return_value = default + + return return_value class ChargeAttrShortcut(object): def getModifiedChargeAttr(self, key, default=None): - try: - if key in self.chargeModifiedAttributes: - return self.chargeModifiedAttributes[key] - else: - return default - except AttributeError: - return default + return_value = self.chargeModifiedAttributes.get(key) + + if isinstance(return_value, NoneType) and not isinstance(default, NoneType): + return_value = default + + return return_value class ModifiedAttributeDict(collections.MutableMapping): @@ -102,18 +101,48 @@ class ModifiedAttributeDict(collections.MutableMapping): def overrides(self, val): self.__overrides = val + @property + def modified(self): + return self.__modified + + @modified.setter + def modified(self, val): + self.__modified = val + def __getitem__(self, key): + ''' # Check if we have final calculated value - if key in self.__modified: - if self.__modified[key] == self.CalculationPlaceholder: - self.__modified[key] = self.__calculateValue(key) - return self.__modified[key] + if key in self.modified: + if self.modified[key] == self.CalculationPlaceholder: + self.modified[key] = self.__calculateValue(key) + return self.modified[key] # Then in values which are not yet calculated elif key in self.__intermediary: return self.__intermediary[key] # Original value is the least priority else: return self.getOriginal(key) + ''' + + # Check if we have final calculated value + key_value = self.modified.get(key) + if key_value is self.CalculationPlaceholder: + key_value = self.modified[key] = self.__calculateValue(key) + + if not isinstance(key_value, NoneType): + return key_value + + # Then in values which are not yet calculated + if self.__intermediary: + val = self.__intermediary.get(key) + else: + val = None + + if not isinstance(val, NoneType): + return val + else: + # Original value is the least priority + return self.getOriginal(key) def __delitem__(self, key): if key in self.__modified: @@ -122,11 +151,18 @@ class ModifiedAttributeDict(collections.MutableMapping): del self.__intermediary[key] def getOriginal(self, key): - if self.OVERRIDES and key in self.__overrides: - return self.__overrides.get(key).value - val = self.__original.get(key) - if val is None: - return None + val = None + + if self.__overrides: + val = self.__overrides.get(key, None) + elif self.overrides: + val = self.overrides.get(key, None) + + if isinstance(val, NoneType): + if self.__original: + val = self.__original.get(key, None) + elif self.original: + val = self.original.get(key, None) return val.value if hasattr(val, "value") else val @@ -134,12 +170,12 @@ class ModifiedAttributeDict(collections.MutableMapping): self.__intermediary[key] = val def __iter__(self): - all = dict(self.__original, **self.__modified) - return (key for key in all) + all_dict = dict(self.__original, **self.__modified) + return (key for key in all_dict) def __contains__(self, key): return (self.__original is not None and key in self.__original) or \ - key in self.__modified or key in self.__intermediary + key in self.__modified or key in self.__intermediary def __placehold(self, key): """Create calculation placeholder in item's modified attribute dict""" @@ -366,6 +402,6 @@ class ModifiedAttributeDict(collections.MutableMapping): class Affliction(object): - def __init__(self, type, amount): - self.type = type + def __init__(self, affliction_type, amount): + self.type = affliction_type self.amount = amount diff --git a/gui/builtinStatsViews/capacitorViewFull.py b/gui/builtinStatsViews/capacitorViewFull.py index b30265741..49bb9d59b 100644 --- a/gui/builtinStatsViews/capacitorViewFull.py +++ b/gui/builtinStatsViews/capacitorViewFull.py @@ -114,11 +114,10 @@ class CapacitorViewFull(StatsView): ("label%sCapacitorRecharge", lambda: fit.capRecharge, 3, 0, 0), ("label%sCapacitorDischarge", lambda: fit.capUsed, 3, 0, 0), ) - if fit is None: - # Set default if fit is empty - neut_resist = 0 - else: + if fit: neut_resist = fit.ship.getModifiedItemAttr("energyWarfareResistance", 0) + else: + neut_resist = 0 panel = "Full" for labelName, value, prec, lowest, highest in stats: diff --git a/service/fit.py b/service/fit.py index 70a471042..96ce5c056 100644 --- a/service/fit.py +++ b/service/fit.py @@ -19,6 +19,7 @@ import copy from logbook import Logger +from time import time import eos.db from eos.saveddata.booster import Booster as es_Booster @@ -1028,9 +1029,12 @@ class Fit(object): self.recalc(fit) def recalc(self, fit, withBoosters=True): + start_time = time() pyfalog.info("=" * 10 + "recalc" + "=" * 10) if fit.factorReload is not self.serviceFittingOptions["useGlobalForceReload"]: fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"] fit.clear() fit.calculateModifiedAttributes(withBoosters=False) + + pyfalog.info("=" * 10 + "recalc time: " + str(time() - start_time) + "=" * 10) From 84de4200020ef37f9f4da2f12a6763e6a68488e9 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Mar 2017 12:27:45 -0800 Subject: [PATCH 03/11] Remove comment --- eos/modifiedAttributeDict.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 6e303f602..942311a46 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -110,20 +110,6 @@ class ModifiedAttributeDict(collections.MutableMapping): self.__modified = val def __getitem__(self, key): - ''' - # Check if we have final calculated value - if key in self.modified: - if self.modified[key] == self.CalculationPlaceholder: - self.modified[key] = self.__calculateValue(key) - return self.modified[key] - # Then in values which are not yet calculated - elif key in self.__intermediary: - return self.__intermediary[key] - # Original value is the least priority - else: - return self.getOriginal(key) - ''' - # Check if we have final calculated value key_value = self.modified.get(key) if key_value is self.CalculationPlaceholder: From b5626c13b121a8b9a1061aad9d46899078df60fd Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Mar 2017 15:16:52 -0800 Subject: [PATCH 04/11] Refactor __calculateValue --- eos/modifiedAttributeDict.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 942311a46..c19a6f0e3 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -23,6 +23,7 @@ from types import NoneType defaultValuesCache = {} cappingAttrKeyCache = {} +calculate_value_time = 0 class ItemAttrShortcut(object): @@ -194,12 +195,8 @@ class ModifiedAttributeDict(collections.MutableMapping): cappingKey = None if cappingAttrInfo is None else cappingAttrInfo.name if cappingKey: - if cappingKey in self.original: - # some items come with their own caps (ie: carriers). If they do, use this - cappingValue = self.original.get(cappingKey).value - else: - # If not, get info about the default value - cappingValue = self.__calculateValue(cappingKey) + cappingValue = self.original.get(cappingKey, self.__calculateValue(cappingKey)) + cappingValue = cappingValue.value if hasattr(cappingValue, "value") else cappingValue else: cappingValue = None @@ -211,10 +208,10 @@ class ModifiedAttributeDict(collections.MutableMapping): force = min(force, cappingValue) return force # Grab our values if they're there, otherwise we'll take default values - preIncrease = self.__preIncreases[key] if key in self.__preIncreases else 0 - multiplier = self.__multipliers[key] if key in self.__multipliers else 1 - penalizedMultiplierGroups = self.__penalizedMultipliers[key] if key in self.__penalizedMultipliers else {} - postIncrease = self.__postIncreases[key] if key in self.__postIncreases else 0 + preIncrease = self.__preIncreases.get(key, 0) + multiplier = self.__multipliers.get(key, 1) + penalizedMultiplierGroups = self.__penalizedMultipliers.get(key, {}) + postIncrease = self.__postIncreases.get(key, 0) # Grab initial value, priorities are: # Results of ongoing calculation > preAssign > original > 0 @@ -228,8 +225,12 @@ class ModifiedAttributeDict(collections.MutableMapping): else: dv = attrInfo.defaultValue default = defaultValuesCache[key] = dv if dv is not None else 0.0 - val = self.__intermediary[key] if key in self.__intermediary else self.__preAssigns[ - key] if key in self.__preAssigns else self.getOriginal(key) if key in self.__original else default + + val = self.__intermediary.get(key, + self.__preAssigns.get(key, + self.getOriginal(key) if key in self.__original else default + ) + ) # We'll do stuff in the following order: # preIncrease > multiplier > stacking penalized multipliers > postIncrease From 46626e9a632dc8ca6a3e1cb76c7e98640127580d Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Mar 2017 15:31:19 -0800 Subject: [PATCH 05/11] Kill another double lookup --- eos/modifiedAttributeDict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index c19a6f0e3..beb43c2df 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -283,7 +283,7 @@ class ModifiedAttributeDict(collections.MutableMapping): return skill.level def getAfflictions(self, key): - return self.__affectedBy[key] if key in self.__affectedBy else {} + return self.__affectedBy.get(key, {}) def iterAfflictions(self): return self.__affectedBy.__iter__() From f70d2509952bc20946212a1dfd4949e96524f816 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 13 Mar 2017 10:11:15 -0700 Subject: [PATCH 06/11] Cleanup code. Use slightly faster comparison (is instead of isinstance). Rename OVERRIDES variable to eliminate confusion. --- eos/modifiedAttributeDict.py | 44 +++++++++++++----------------------- gui/mainFrame.py | 4 ++-- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index beb43c2df..ab2ab21bc 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -19,7 +19,6 @@ import collections from math import exp -from types import NoneType defaultValuesCache = {} cappingAttrKeyCache = {} @@ -30,7 +29,7 @@ class ItemAttrShortcut(object): def getModifiedItemAttr(self, key, default=None): return_value = self.itemModifiedAttributes.get(key) - if isinstance(return_value, NoneType) and not isinstance(default, NoneType): + if return_value is None and default is not None: return_value = default return return_value @@ -40,14 +39,14 @@ class ChargeAttrShortcut(object): def getModifiedChargeAttr(self, key, default=None): return_value = self.chargeModifiedAttributes.get(key) - if isinstance(return_value, NoneType) and not isinstance(default, NoneType): + if return_value is None and default is not None: return_value = default return return_value class ModifiedAttributeDict(collections.MutableMapping): - OVERRIDES = False + overrides_enabled = False class CalculationPlaceholder(object): def __init__(self): @@ -102,21 +101,13 @@ class ModifiedAttributeDict(collections.MutableMapping): def overrides(self, val): self.__overrides = val - @property - def modified(self): - return self.__modified - - @modified.setter - def modified(self, val): - self.__modified = val - def __getitem__(self, key): # Check if we have final calculated value - key_value = self.modified.get(key) + key_value = self.__modified.get(key) if key_value is self.CalculationPlaceholder: - key_value = self.modified[key] = self.__calculateValue(key) + key_value = self.__modified[key] = self.__calculateValue(key) - if not isinstance(key_value, NoneType): + if key_value is not None: return key_value # Then in values which are not yet calculated @@ -125,7 +116,7 @@ class ModifiedAttributeDict(collections.MutableMapping): else: val = None - if not isinstance(val, NoneType): + if val is not None: return val else: # Original value is the least priority @@ -138,17 +129,14 @@ class ModifiedAttributeDict(collections.MutableMapping): del self.__intermediary[key] def getOriginal(self, key): - val = None - if self.__overrides: - val = self.__overrides.get(key, None) - elif self.overrides: + if self.overrides: val = self.overrides.get(key, None) + else: + val = None - if isinstance(val, NoneType): - if self.__original: - val = self.__original.get(key, None) - elif self.original: + if val is None: + if self.original: val = self.original.get(key, None) return val.value if hasattr(val, "value") else val @@ -157,11 +145,11 @@ class ModifiedAttributeDict(collections.MutableMapping): self.__intermediary[key] = val def __iter__(self): - all_dict = dict(self.__original, **self.__modified) + all_dict = dict(self.original, **self.__modified) return (key for key in all_dict) def __contains__(self, key): - return (self.__original is not None and key in self.__original) or \ + return (self.original is not None and key in self.original) or \ key in self.__modified or key in self.__intermediary def __placehold(self, key): @@ -170,7 +158,7 @@ class ModifiedAttributeDict(collections.MutableMapping): def __len__(self): keys = set() - keys.update(self.__original.iterkeys()) + keys.update(self.original.iterkeys()) keys.update(self.__modified.iterkeys()) keys.update(self.__intermediary.iterkeys()) return len(keys) @@ -228,7 +216,7 @@ class ModifiedAttributeDict(collections.MutableMapping): val = self.__intermediary.get(key, self.__preAssigns.get(key, - self.getOriginal(key) if key in self.__original else default + self.getOriginal(key) if key in self.original else default ) ) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 7af37d875..8a66e78d2 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -651,11 +651,11 @@ class MainFrame(wx.Frame): dlg.Show() def toggleOverrides(self, event): - ModifiedAttributeDict.OVERRIDES = not ModifiedAttributeDict.OVERRIDES + ModifiedAttributeDict.overrides_enabled = not ModifiedAttributeDict.overrides_enabled wx.PostEvent(self, GE.FitChanged(fitID=self.getActiveFit())) menu = self.GetMenuBar() menu.SetLabel(menu.toggleOverridesId, - "Turn Overrides Off" if ModifiedAttributeDict.OVERRIDES else "Turn Overrides On") + "Turn Overrides Off" if ModifiedAttributeDict.overrides_enabled else "Turn Overrides On") def saveChar(self, event): sChr = Character.getInstance() From b72304203c1a5dce1eeab64966368852a5941a44 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 13 Mar 2017 10:56:33 -0700 Subject: [PATCH 07/11] Add default option to getOriginal. This eliminates some double lookups and simplifies the code. --- eos/modifiedAttributeDict.py | 7 +++++-- gui/itemStats.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index ab2ab21bc..a9b284fb2 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -128,7 +128,7 @@ class ModifiedAttributeDict(collections.MutableMapping): if key in self.__intermediary: del self.__intermediary[key] - def getOriginal(self, key): + def getOriginal(self, key, default=None): if self.overrides: val = self.overrides.get(key, None) @@ -139,6 +139,9 @@ class ModifiedAttributeDict(collections.MutableMapping): if self.original: val = self.original.get(key, None) + if val is None and val != default: + val = default + return val.value if hasattr(val, "value") else val def __setitem__(self, key, val): @@ -216,7 +219,7 @@ class ModifiedAttributeDict(collections.MutableMapping): val = self.__intermediary.get(key, self.__preAssigns.get(key, - self.getOriginal(key) if key in self.original else default + self.getOriginal(key, default) ) ) diff --git a/gui/itemStats.py b/gui/itemStats.py index 325793e86..3ac94ce0c 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -1043,7 +1043,7 @@ class ItemAffectedBy(wx.Panel): container = {} for attrName in attributes.iterAfflictions(): # if value is 0 or there has been no change from original to modified, return - if attributes[attrName] == (attributes.getOriginal(attrName) or 0): + if attributes[attrName] == (attributes.getOriginal(attrName, 0)): continue for fit, afflictors in attributes.getAfflictions(attrName).iteritems(): @@ -1170,7 +1170,7 @@ class ItemAffectedBy(wx.Panel): container = {} for attrName in attributes.iterAfflictions(): # if value is 0 or there has been no change from original to modified, return - if attributes[attrName] == (attributes.getOriginal(attrName) or 0): + if attributes[attrName] == (attributes.getOriginal(attrName, 0)): continue for fit, afflictors in attributes.getAfflictions(attrName).iteritems(): From af5a9b31bc091e292c47b9ec0ba43f6c0dfa5f9c Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 13 Mar 2017 11:09:12 -0700 Subject: [PATCH 08/11] Fix another hidden import (move to top) --- eos/modifiedAttributeDict.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index a9b284fb2..421c2418d 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -19,6 +19,7 @@ import collections from math import exp +from eos.db.gamedata.queries import getAttributeInfo defaultValuesCache = {} cappingAttrKeyCache = {} @@ -172,7 +173,6 @@ class ModifiedAttributeDict(collections.MutableMapping): try: cappingKey = cappingAttrKeyCache[key] except KeyError: - from eos.db.gamedata.queries import getAttributeInfo attrInfo = getAttributeInfo(key) if attrInfo is None: cappingId = cappingAttrKeyCache[key] = None @@ -209,7 +209,6 @@ class ModifiedAttributeDict(collections.MutableMapping): try: default = defaultValuesCache[key] except KeyError: - from eos.db.gamedata.queries import getAttributeInfo attrInfo = getAttributeInfo(key) if attrInfo is None: default = defaultValuesCache[key] = 0.0 From 649ba71c0fde3358c43ca50a93a53b365caaae1c Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 13 Mar 2017 11:15:14 -0700 Subject: [PATCH 09/11] Make sure overrides are enabled before we return override values --- eos/modifiedAttributeDict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 421c2418d..2174252f0 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -131,7 +131,7 @@ class ModifiedAttributeDict(collections.MutableMapping): def getOriginal(self, key, default=None): - if self.overrides: + if self.overrides_enabled and self.overrides: val = self.overrides.get(key, None) else: val = None From 4f12caa05fa2fbf00a507e7685029350df3c1289 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 13 Mar 2017 11:30:07 -0700 Subject: [PATCH 10/11] Remove test variable --- eos/modifiedAttributeDict.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 2174252f0..1b0b28fc6 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -23,7 +23,6 @@ from eos.db.gamedata.queries import getAttributeInfo defaultValuesCache = {} cappingAttrKeyCache = {} -calculate_value_time = 0 class ItemAttrShortcut(object): @@ -130,7 +129,6 @@ class ModifiedAttributeDict(collections.MutableMapping): del self.__intermediary[key] def getOriginal(self, key, default=None): - if self.overrides_enabled and self.overrides: val = self.overrides.get(key, None) else: From 9d34c2a2e66c0314b50d2438721516b97920e0de Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 13 Mar 2017 11:52:18 -0700 Subject: [PATCH 11/11] Add TODO --- eos/modifiedAttributeDict.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index 1b0b28fc6..9658d6855 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -19,6 +19,8 @@ import collections from math import exp +# TODO: This needs to be moved out, we shouldn't have *ANY* dependencies back to other modules/methods inside eos. +# This also breaks writing any tests. :( from eos.db.gamedata.queries import getAttributeInfo defaultValuesCache = {}