diff --git a/nullptr/models/base.py b/nullptr/models/base.py index c7c8a26..dad656a 100644 --- a/nullptr/models/base.py +++ b/nullptr/models/base.py @@ -7,6 +7,7 @@ class Base: store: object def __init__(self, symbol, store): + self.disable_dirty = False self.store = store self.symbol = symbol self.define() @@ -36,7 +37,7 @@ class Base: setattr(self, attr, lst) def __setattr__(self, name, value): - if name not in ['symbol','store','__dict__']: + if name not in ['symbol','store','disable_dirty'] and not self.disable_dirty: self.store.dirty(self) super().__setattr__(name, value) @@ -47,7 +48,9 @@ class Base: return False def load(self, d): - self.__dict__ = d + self.disable_dirty = True + self.__dict__.update(d) + self.disable_dirty = False def dict(self): r = {} diff --git a/nullptr/models/marketplace.py b/nullptr/models/marketplace.py index fc59251..6ae0e98 100644 --- a/nullptr/models/marketplace.py +++ b/nullptr/models/marketplace.py @@ -27,7 +27,10 @@ class Marketplace(SystemMember): price['sell'] = mg(g, 'sellPrice') prices[symbol] = price self.prices = prices - + + def sellable_items(self, resources): + return [r for r in resources if r in self.prices] + @classmethod def ext(self): return 'mkt'