2019-01-04 16:54:38 +00:00
|
|
|
|
|
|
|
def formatted_item_listing(item):
|
2019-01-14 20:20:16 +00:00
|
|
|
return "{} {} for {}D".format(item["amount"], item["item_name"], item["price"])
|
|
|
|
|
|
|
|
|
|
|
|
def formatted_location(location):
|
|
|
|
if location["tunnel"] is not None:
|
|
|
|
tunnel = "**{}** ".format(location["tunnel"])
|
|
|
|
else:
|
|
|
|
tunnel = ""
|
|
|
|
|
2019-01-31 19:56:50 +00:00
|
|
|
return '**{}** @ **{}** {}Owner(s): **{}**'.format(location["name"], formatted_position(location), tunnel,
|
|
|
|
formatted_owners(location))
|
2019-01-14 20:20:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
def formatted_tunnel(tunnel):
|
|
|
|
return '**{} {}**: {}'.format(tunnel["tunnel_direction"], tunnel["tunnel_number"], tunnel["location_name"])
|
|
|
|
|
|
|
|
|
|
|
|
def formatted_position(location):
|
|
|
|
return '(x={}, z={})'.format(location["x_coord"], location["z_coord"])
|
|
|
|
|
|
|
|
|
|
|
|
def formatted_shop(shop):
|
|
|
|
inventory = ""
|
|
|
|
for item in shop["items"]:
|
|
|
|
inventory = inventory + "\n" + (formatted_item_listing(item))
|
|
|
|
|
|
|
|
return formatted_location(shop) + inventory
|
2019-01-31 19:56:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def formatted_owners(location):
|
|
|
|
owner_list = ''
|
|
|
|
if "owner" in location:
|
|
|
|
|
|
|
|
if len(location["owner"]) == 0:
|
|
|
|
owner_list = location["owner"][0]["name"]
|
|
|
|
else:
|
|
|
|
owner_list = location["owner"][0]["name"]
|
|
|
|
for owner in location["owner"][1:]:
|
|
|
|
owner_list += ", " + owner["name"]
|
|
|
|
|
|
|
|
return owner_list
|