Update base.py and marketplace.py
This commit is contained in:
parent
f849f871d2
commit
3a3e3b9da2
@ -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 = {}
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user