?selling now also gives the shop location and can show 25 entries.
parent
67bc539706
commit
930d9bbd8c
|
@ -98,9 +98,10 @@ class DatabaseInterface:
|
||||||
expr = Tunnel.owner.has(Player.name.ilike('%{}%'.format(owner_name)))
|
expr = Tunnel.owner.has(Player.name.ilike('%{}%'.format(owner_name)))
|
||||||
return self.database.query_by_filter(session, Tunnel, expr)
|
return self.database.query_by_filter(session, Tunnel, expr)
|
||||||
|
|
||||||
def find_item(self, session, item_name):
|
def find_item(self, session, item_name, limit=25):
|
||||||
expr = ItemListing.name.ilike('%{}%'.format(item_name))
|
expr = ItemListing.name.ilike('%{}%'.format(item_name))
|
||||||
return self.database.query_by_filter(session, ItemListing, expr, sort=ItemListing.normalized_price)
|
return self.database.query_by_filter(session, ItemListing, expr, limit=limit,
|
||||||
|
sort=ItemListing.normalized_price)
|
||||||
|
|
||||||
def find_shop_selling_item(self, session, item_name):
|
def find_shop_selling_item(self, session, item_name):
|
||||||
return self.find_item(session, item_name)
|
return self.find_item(session, item_name)
|
||||||
|
|
|
@ -215,7 +215,7 @@ class Location(SQL_Base):
|
||||||
format(bot_config.dynmap_url, bot_config.world_name, self.x, self.z)
|
format(bot_config.dynmap_url, bot_config.world_name, self.x, self.z)
|
||||||
|
|
||||||
def pos_to_str(self):
|
def pos_to_str(self):
|
||||||
pos_str = '**(x= {}, z= {})** {}'.format(self.x, self.z, self.dimension.value.title())
|
pos_str = '**(x= {}, z= {})**'.format(self.x, self.z)
|
||||||
if self.tunnel is not None:
|
if self.tunnel is not None:
|
||||||
return pos_str + ', Tunnel: **{}**'.format(self.tunnel)
|
return pos_str + ', Tunnel: **{}**'.format(self.tunnel)
|
||||||
else:
|
else:
|
||||||
|
@ -303,4 +303,4 @@ class ItemListing(SQL_Base):
|
||||||
return '**{}** **{}** for **{}D**'.format(self.amount, self.name, self.price)
|
return '**{}** **{}** for **{}D**'.format(self.amount, self.name, self.price)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '**{}**, selling {}'.format(self.shop.name, self.listing_str())
|
return '**{}** @ {}, selling {}'.format(self.shop.name, self.shop.pos_to_str(), self.listing_str())
|
||||||
|
|
Loading…
Reference in New Issue