WTS/game/scripts/interface/inventory.rpy

110 lines
5.7 KiB
Plaintext

default inventory_mode = 0 # 0 - Inventory, 1 - gifts
label inventory:
$ disable_game_menu()
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") 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") 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") 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") 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") 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") 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") 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:
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
for item in menu_items:
if item.owned > 0 or config.developer:
button:
xysize (48, 48)
if selected_item == item:
add "interface/achievements/glow.webp" align (0.5, 0.5) xysize (48, 48) alpha 0.7 at rotate_circular
add crop_image_zoom(item.get_image(), 48, 48, (item.owned <= 0 or (inventory_mode==1 and (not item.givable or not states.active_girl in item.usable_on)))) 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) offset (8, -8)
if item.owned > 1:
text "x[item.owned]" offset (-8, 34) size 12
if (inventory_mode==0 or (inventory_mode==1 and (item.givable and states.active_girl in item.usable_on))):
action [SetScreenVariable("selected_item", item)]
if selected_item:
vbox:
align (0.0, 1.0)
hbox:
spacing 5
add selected_item.get_image() xysize(96, 96) align (0.05, 0.95)
vbox:
yalign 1.0
xsize 400
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 selected_item.givable:
text _("Usable on: [item.usable_on]") xalign 0
if selected_item.owned > 1:
text "x[selected_item.owned]" align (0.0, 1.0)