Avoid extraneous bool call

This commit is contained in:
Gouvernathor 2023-11-14 23:35:10 +01:00
parent 0d4a309898
commit 95b3db770e

View File

@ -31,9 +31,9 @@ label shop_item_menu(xx=150, yy=90):
current_sorting = "Price (Asc)" current_sorting = "Price (Asc)"
if current_category in {"Gifts", "Ingredients"}: if current_category in {"Gifts", "Ingredients"}:
category_items = [x for x in inventory_dict[current_category] if bool(x.price > 0 and x.unlocked)] category_items = [x for x in inventory_dict[current_category] if (x.price > 0 and x.unlocked)]
elif current_category in {"Books", "Scrolls", "Decorations", "Quest Items"}: elif current_category in {"Books", "Scrolls", "Decorations", "Quest Items"}:
category_items = [x for x in inventory_dict[current_category] if bool(x.price > 0 and x.owned < x.limit and x.unlocked)] category_items = [x for x in inventory_dict[current_category] if (x.price > 0 and x.owned < x.limit and x.unlocked)]
menu_items = shop_item_sortfilter(category_items, current_sorting) menu_items = shop_item_sortfilter(category_items, current_sorting)
menu_items_length = len(menu_items) menu_items_length = len(menu_items)
@ -50,9 +50,9 @@ label shop_item_menu(xx=150, yy=90):
elif __choice[0] == "category": elif __choice[0] == "category":
$ current_category = __choice[1] $ current_category = __choice[1]
if current_category in {"Gifts", "Ingredients"}: if current_category in {"Gifts", "Ingredients"}:
$ category_items = [x for x in inventory_dict[current_category] if bool(x.price > 0 and x.unlocked)] $ category_items = [x for x in inventory_dict[current_category] if (x.price > 0 and x.unlocked)]
elif current_category in {"Books", "Scrolls", "Decorations", "Quest Items"}: elif current_category in {"Books", "Scrolls", "Decorations", "Quest Items"}:
$ category_items = [x for x in inventory_dict[current_category] if bool(x.price > 0 and x.owned < x.limit and x.unlocked)] $ category_items = [x for x in inventory_dict[current_category] if (x.price > 0 and x.owned < x.limit and x.unlocked)]
$ menu_items = shop_item_sortfilter(category_items, current_sorting) $ menu_items = shop_item_sortfilter(category_items, current_sorting)
$ menu_items_length = len(menu_items) $ menu_items_length = len(menu_items)
$ current_page = 0 $ current_page = 0
@ -73,9 +73,9 @@ label shop_item_menu(xx=150, yy=90):
$ renpy.call("purchase_item", current_item) $ renpy.call("purchase_item", current_item)
if current_category in {"Gifts", "Ingredients"}: if current_category in {"Gifts", "Ingredients"}:
$ category_items = [x for x in inventory_dict[current_category] if bool(x.price > 0 and x.unlocked)] $ category_items = [x for x in inventory_dict[current_category] if (x.price > 0 and x.unlocked)]
elif current_category in {"Books", "Scrolls", "Decorations", "Quest Items"}: elif current_category in {"Books", "Scrolls", "Decorations", "Quest Items"}:
$ category_items = [x for x in inventory_dict[current_category] if bool(x.price > 0 and x.owned < x.limit and x.unlocked)] $ category_items = [x for x in inventory_dict[current_category] if (x.price > 0 and x.owned < x.limit and x.unlocked)]
$ menu_items = shop_item_sortfilter(category_items, current_sorting) $ menu_items = shop_item_sortfilter(category_items, current_sorting)
$ menu_items_length = len(menu_items) $ menu_items_length = len(menu_items)