?selling now also gives the shop location and can show 25 entries.

doc_update
Joey Hines 2018-09-22 09:48:33 -05:00
parent 67bc539706
commit 930d9bbd8c
2 changed files with 5 additions and 4 deletions

View File

@ -98,9 +98,10 @@ class DatabaseInterface:
expr = Tunnel.owner.has(Player.name.ilike('%{}%'.format(owner_name)))
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))
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):
return self.find_item(session, item_name)

View File

@ -215,7 +215,7 @@ class Location(SQL_Base):
format(bot_config.dynmap_url, bot_config.world_name, self.x, self.z)
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:
return pos_str + ', Tunnel: **{}**'.format(self.tunnel)
else:
@ -303,4 +303,4 @@ class ItemListing(SQL_Base):
return '**{}** **{}** for **{}D**'.format(self.amount, self.name, self.price)
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())