146 lines
8.7 KiB
Plaintext
146 lines
8.7 KiB
Plaintext
default inventory_mode = 0 # 0 - Inventory, 1 - gifts
|
|
|
|
label inventory(inter_pause=True):
|
|
$ disable_game_menu()
|
|
if inter_pause:
|
|
# Ensures all irrelevant screens are hidden before capturing the surface tree
|
|
with Pause(0.2)
|
|
call screen inventory
|
|
$ enable_game_menu()
|
|
jump main_room_menu
|
|
|
|
screen inventory():
|
|
modal True
|
|
layer "interface"
|
|
zorder 0
|
|
style_prefix "frame"
|
|
|
|
default navigation_atl = navigation_show
|
|
default last_frame = (screenshot.capture() or screenshot.image)
|
|
default navigation_last_frame_atl = navigation_last_frame_show
|
|
default navigation_exit = False
|
|
|
|
default category = "gift"
|
|
default menu_items = inventory.get_instances_of_type(category)
|
|
default selected_item = None
|
|
|
|
add last_frame at navigation_last_frame_atl
|
|
|
|
if navigation_exit:
|
|
timer 0.4 action Return()
|
|
|
|
frame:
|
|
style "empty"
|
|
align (0.5, 0.5)
|
|
at navigation_atl
|
|
|
|
vbox:
|
|
style_prefix "navigation_subtabs"
|
|
pos (286, 170)
|
|
|
|
at navigation_subtabs_show
|
|
|
|
textbutton _("Gifts") action [SetScreenVariable("category", "gift"), SetScreenVariable("menu_items", inventory.get_instances_of_type("gift")), SetScreenVariable("selected_item", None)] selected (category=="gift") sensitive (inventory_mode==0 or inventory.is_givable_type("gift")) at navigation_tabs
|
|
textbutton _("Books") action [SetScreenVariable("category", "book"), SetScreenVariable("menu_items", inventory.get_instances_of_type("book")), SetScreenVariable("selected_item", None)] selected (category=="book") sensitive (inventory_mode==0 or inventory.is_givable_type("book")) at navigation_tabs
|
|
textbutton _("Scrolls") action [SetScreenVariable("category", "scroll"), SetScreenVariable("menu_items", inventory.get_instances_of_type("scroll")), SetScreenVariable("selected_item", None)] selected (category=="scroll") sensitive (inventory_mode==0 or inventory.is_givable_type("scroll")) at navigation_tabs
|
|
textbutton _("Ingredients") action [SetScreenVariable("category", "ingredient"), SetScreenVariable("menu_items", inventory.get_instances_of_type("ingredient")), SetScreenVariable("selected_item", None)] selected (category=="ingredient") sensitive (inventory_mode==0 or inventory.is_givable_type("ingredient")) at navigation_tabs
|
|
textbutton _("Potions") action [SetScreenVariable("category", "potion"), SetScreenVariable("menu_items", inventory.get_instances_of_type("potion")), SetScreenVariable("selected_item", None)] selected (category=="potion") sensitive (inventory_mode==0 or inventory.is_givable_type("potion")) at navigation_tabs
|
|
textbutton _("Decorations") action [SetScreenVariable("category", "decoration"), SetScreenVariable("menu_items", inventory.get_instances_of_type("decoration")), SetScreenVariable("selected_item", None)] selected (category=="decoration") sensitive (inventory_mode==0 or inventory.is_givable_type("decoration")) at navigation_tabs
|
|
textbutton _("Consumables") action [SetScreenVariable("category", "quest"), SetScreenVariable("menu_items", inventory.get_instances_of_type("quest")), SetScreenVariable("selected_item", None)] selected (category=="quest") sensitive (inventory_mode==0 or inventory.is_givable_type("quest")) at navigation_tabs
|
|
null height 35
|
|
textbutton _("Return") action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym ["inventory", "game_menu"] at navigation_tabs
|
|
|
|
if selected_item and ((inventory_mode==0 and selected_item.usable) or inventory_mode==1 and selected_item.givable):
|
|
vbox:
|
|
style_prefix "navigation_tabs"
|
|
pos (798, 170)
|
|
|
|
at navigation_tabs_show
|
|
|
|
textbutton selected_item.caption:
|
|
if inventory_mode==0:
|
|
sensitive selected_item.owned
|
|
action [selected_item.use, renpy.restart_interaction]
|
|
elif inventory_mode==1:
|
|
action Return(selected_item)
|
|
style "navigation_tabs_button_special"
|
|
at navigation_tabs
|
|
|
|
frame:
|
|
label _("Inventory")
|
|
|
|
# Add items
|
|
grid 10 8:
|
|
ypos 32
|
|
xalign 0.5
|
|
spacing 2
|
|
for item in menu_items:
|
|
if item.owned > 0 or config.developer:
|
|
$ givable = (item.givable and states.active_girl in item.usable_on)
|
|
button:
|
|
xysize (48, 48)
|
|
style "inventory_item_button"
|
|
selected (selected_item == item)
|
|
add crop_image_zoom(item.get_image(), 48, 48, item.owned <= 0 or (inventory_mode==1 and not givable)) align (0.5, 0.5)
|
|
|
|
if item.used or (item.type=="decoration" and item.in_use):
|
|
add "interface/topbar/icon_check.webp" xysize (16, 16) align (1.0, 1.0)
|
|
if item.owned > 1:
|
|
text "{size=-4}x{/size}[item.owned]" size 12 align (0.0, 1.0) yoffset 3
|
|
|
|
if not (inventory_mode==1 and not givable):
|
|
action [SetScreenVariable("selected_item", item)]
|
|
|
|
if selected_item:
|
|
vbox:
|
|
align (0.0, 1.0)
|
|
|
|
add "frame_spacer" xalign 0.5 xsize 500
|
|
null height 10
|
|
|
|
hbox:
|
|
spacing 5
|
|
|
|
fixed:
|
|
align (0.05, 0.95)
|
|
xysize (96, 96)
|
|
add Transform("wheelmenu_button", xysize=(96, 96))
|
|
add selected_item.get_image() xysize(96, 96)
|
|
vbox:
|
|
spacing 5
|
|
yalign 1.0
|
|
xsize 400
|
|
yminimum 80
|
|
|
|
hbox:
|
|
label selected_item.name
|
|
if selected_item.used or (selected_item.type=="decoration" and selected_item.in_use):
|
|
add "interface/topbar/icon_check.webp" xysize (24, 24) yoffset -12
|
|
text selected_item.desc xalign 0
|
|
if inventory_mode==0 and selected_item.use_progression:
|
|
vbox:
|
|
align (0, 0)
|
|
for k, v in selected_item.use_progression.items():
|
|
$ progress = "{unicode}✔{/unicode}" if eval(v) else "{unicode}✘{/unicode}"
|
|
text "{size=-3}[k] [progress]{/size}" xalign 0 text_align 0 color ("#ffffff" if eval(v) else "#8d8d8d")
|
|
if selected_item.givable:
|
|
hbox:
|
|
yoffset -5
|
|
text _("Giftable:") yalign 0.5
|
|
for i in item.usable_on:
|
|
add "wheelmenu_[i]" xysize (24, 24) yalign 0.5
|
|
if selected_item.owned > 1:
|
|
text "{size=-4}x{/size}[selected_item.owned]" align (0.0, 1.0)
|
|
|
|
style inventory_item_button is empty:
|
|
background Transform("wheelmenu_button", xysize=(48,48))
|
|
hover_background At(Transform("wheelmenu_button_opaque", xysize=(48,48)), wheelmenu_hover_anim)
|
|
selected_background Fixed(Transform("wheelmenu_button", xysize=(48,48)), At(Transform("interface/achievements/glow.webp", align=(0.5, 0.5), size=(48, 48), alpha=0.5), rotate_circular))
|
|
selected_hover_background Fixed(At(Transform("wheelmenu_button_opaque", xysize=(48,48)), wheelmenu_hover_anim), At(Transform("interface/achievements/glow.webp", align=(0.5, 0.5), size=(48, 48), alpha=0.5), rotate_circular))
|
|
|
|
style inventory_item_big_button is empty:
|
|
background Transform("wheelmenu_button", xysize=(48,48))
|
|
hover_background At(Transform("wheelmenu_button_opaque", xysize=(48,48)), wheelmenu_hover_anim)
|
|
selected_background Fixed(Transform("wheelmenu_button", xysize=(48,48)), At(Transform("interface/achievements/glow.webp", align=(0.5, 0.5), size=(48, 48), alpha=0.5), rotate_circular))
|
|
selected_hover_background Fixed(At(Transform("wheelmenu_button_opaque", xysize=(48,48)), wheelmenu_hover_anim), At(Transform("interface/achievements/glow.webp", align=(0.5, 0.5), size=(48, 48), alpha=0.5), rotate_circular))
|