From d2e7d294d5ee34e62b0237650e7615a0dbb39e5b Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Wed, 7 Aug 2024 18:37:07 +0100 Subject: [PATCH] Reimplement Inventory for new GUI, bug fixes --- game/gui/creamy_pumpkin_pie/top_bar.png | 3 + game/scripts/gui/navigation.rpy | 12 + game/scripts/interface/gifts.rpy | 96 +++- game/scripts/interface/inventory.rpy | 685 ++++++++++-------------- game/scripts/inventory/books.rpy | 15 +- game/scripts/inventory/classes.rpy | 2 +- game/scripts/utility/image_crop.rpy | 2 +- game/scripts/wardrobe/wardrobe.rpy | 4 +- 8 files changed, 415 insertions(+), 404 deletions(-) create mode 100644 game/gui/creamy_pumpkin_pie/top_bar.png diff --git a/game/gui/creamy_pumpkin_pie/top_bar.png b/game/gui/creamy_pumpkin_pie/top_bar.png new file mode 100644 index 00000000..ec70d5b0 --- /dev/null +++ b/game/gui/creamy_pumpkin_pie/top_bar.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f6c41ace695b2cf9748e9ca99a4d24767cb28207949a02942c0f553ea1f3ce9 +size 82574 diff --git a/game/scripts/gui/navigation.rpy b/game/scripts/gui/navigation.rpy index 1184c7c9..224d047e 100644 --- a/game/scripts/gui/navigation.rpy +++ b/game/scripts/gui/navigation.rpy @@ -399,6 +399,18 @@ style navigation_tabs_button_text is who: yalign 0.5 selected_xoffset 15 +style navigation_tabs_button_special is navigation_tabs_button: + ysize 35 + left_padding 15 + right_padding 30 + selected_right_padding 50 + background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), matrixcolor=HueMatrix(90.0)), 0, 0, 80, 0, tile=False) + selected_background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), matrixcolor=HueMatrix(180.0)), 0, 0, 80, 0, tile=False) + insensitive_background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), matrixcolor=SaturationMatrix(0.0)), 0, 0, 80, 0, tile=False) + activate_sound "sounds/pageflip.ogg" + +style navigation_tabs_button_special_text is navigation_tabs_button_text + style navigation_subtabs_vbox: xfill True xanchor 1.0 diff --git a/game/scripts/interface/gifts.rpy b/game/scripts/interface/gifts.rpy index 65b30373..16192034 100644 --- a/game/scripts/interface/gifts.rpy +++ b/game/scripts/interface/gifts.rpy @@ -1,7 +1,100 @@ label gift_menu: + $ disable_game_menu() $ inventory_mode = 1 - $ gui.in_context("inventory_menu") + call screen inventory + + if _return.type == "gift": + if get_character_gifted(states.active_girl): + show screen blktone + with d3 + gen "I already gave her a gift today. Don't want to spoil her too much..." ("base", xpos="far_left", ypos="head") + hide screen blktone + with d3 + else: + hide screen inventory + $ renpy.call(get_character_gift_label(states.active_girl), _return) + # call screen inventory(xx, yy) + elif _return.type == "potion": + if not states.active_girl in _return.usable_on: + show screen blktone + with d3 + gen "(Something tells me this potion won't work on [states.active_girl].)" ("base", xpos="far_left", ypos="head") + nar "Perhaps in the future..." + hide screen blktone + with d3 + elif not states.env.daytime: + show screen blktone + with d3 + gen "(Some grander force tells me I should give it to her during daytime only.)" ("base", xpos="far_left", ypos="head") + hide screen blktone + with d3 + elif get_character_mood(states.active_girl) > 0: + show screen blktone + with d3 + gen "(I don't think it's a good idea to give it to her when she's still upset with me...)" ("base", xpos="far_left", ypos="head") + gen "(I should wait for her to calm down first.)" ("base", xpos="far_left", ypos="head") + hide screen blktone + with d3 + elif states.active_girl == "hermione" and not states.her.favors_convinced_stage == 2 and is_in_lead(states.env.gryffindor): + show screen blktone + with d3 + + gen "[name_hermione_genie], what would you say--" ("base", xpos="far_left", ypos="head") + her "I'm sorry professor but I don't need your help at the moment." + her "My house is already in the lead points wise." + gen "Figures..." ("base", xpos="far_left", ypos="head") + + call tutorial("points") + + hide screen blktone + with d3 + else: + python: + enable_game_menu() + inventory_mode = 0 + _return.give(states.active_girl) + elif _return.type == "quest": + if not states.active_girl in _return.usable_on: + show screen blktone + with d3 + gen "(Something tells me I cannot give this item to [states.active_girl].)" ("base", xpos="far_left", ypos="head") + nar "Perhaps in the future..." + hide screen blktone + with d3 + #TODO Add daytime check for buttplug give item event + #show screen blktone + #with d3 + #gen "(Some grander force tells me I should give it to her during daytime only.)" ("base", xpos="far_left", ypos="head") + #hide screen blktone + #with d3 + elif get_character_mood(states.active_girl) > 0: + show screen blktone + with d3 + gen "(I don't think it's a good idea to give it to her when she's still upset with me...)" ("base", xpos="far_left", ypos="head") + gen "(I should wait for her to calm down first.)" ("base", xpos="far_left", ypos="head") + hide screen blktone + with d3 + elif states.active_girl == "hermione" and not states.her.favors_convinced_stage == 2 and is_in_lead(states.env.gryffindor): + show screen blktone + with d3 + + gen "[name_hermione_genie], I have something for you--" ("base", xpos="far_left", ypos="head") + her "I'm sorry professor but I don't need your help at the moment." + her "My house is already in the lead points wise." + gen "Figures..." ("base", xpos="far_left", ypos="head") + + call tutorial("points") + + hide screen blktone + with d3 + else: + python: + enable_game_menu() + inventory_mode = 0 + _return.give(states.active_girl) + $ inventory_mode = 0 + $ enable_game_menu() return label give_gift(text, gift): @@ -14,6 +107,7 @@ label give_gift(text, gift): return screen gift(gift): + layer "interface" zorder 30 if isinstance(gift, Item): diff --git a/game/scripts/interface/inventory.rpy b/game/scripts/interface/inventory.rpy index e73df048..61697e4d 100644 --- a/game/scripts/interface/inventory.rpy +++ b/game/scripts/interface/inventory.rpy @@ -1,19 +1,19 @@ -init python: - def inventory_sortfilter(item, sortby="A-z", filtering=None): - if filtering == "Owned": - item = (x for x in item if x.owned > 0) +# init python: +# def inventory_sortfilter(item, sortby="A-z", filtering=None): +# if filtering == "Owned": +# item = (x for x in item if x.owned > 0) - # Always sort alphabetically first. - item = sorted(item, key=lambda x: natsort_key(x.name)) +# # Always sort alphabetically first. +# item = sorted(item, key=lambda x: natsort_key(x.name)) - if sortby == "z-A": - item.sort(key=lambda x: natsort_key(x.name), reverse=True) - elif current_sorting == "Available": - item.sort(key=lambda x: x.owned is True, reverse=True) - elif current_sorting == "Unavailable": - item.sort(key=lambda x: x.owned is False) +# if sortby == "z-A": +# item.sort(key=lambda x: natsort_key(x.name), reverse=True) +# elif current_sorting == "Available": +# item.sort(key=lambda x: x.owned is True, reverse=True) +# elif current_sorting == "Unavailable": +# item.sort(key=lambda x: x.owned is False) - return item +# return item default inventory_mode = 0 # 0 - Inventory, 1 - gifts @@ -22,410 +22,307 @@ default inventory_mode = 0 # 0 - Inventory, 1 - gifts #################################### label inventory: - $ gui.in_context("inventory_menu") + call screen inventory + # $ enable_game_menu() jump main_room_menu -label inventory_menu(xx=150, yy=90): - # Inventory dictionary +# label inventory_menu: +# call screen inventory +# return - python: - - if inventory_mode == 0: - inventory_dict = { - "Gifts": inventory.get_instances_of_type("gift"), - "Books": inventory.get_instances_of_type("book"), - "Scrolls": inventory.get_instances_of_type("scroll"), - "Ingredients": inventory.get_instances_of_type("ingredient"), - "Potions": inventory.get_instances_of_type("potion"), - "Decorations": inventory.get_instances_of_type("decoration"), - "Quest Items": inventory.get_instances_of_type("quest"), - } - elif inventory_mode == 1: - inventory_dict = { - "Gifts": inventory.get_instances_of_type("gift"), - "Potions": inventory.get_instances_of_type("potion"), - "Quest Items": inventory.get_instances_of_type("quest"), - } - - items_shown = 36 - current_page = 0 - current_category = next(iter(inventory_dict.keys())) - current_filter = "Owned" - current_sorting = "Available" - - category_items = inventory_dict[current_category] - menu_items = inventory_sortfilter(category_items, current_sorting, current_filter) - menu_items_length = len(menu_items) - current_item = next(iter(menu_items), None) - - show screen inventory(xx, yy) - - label .after_init: - - $ renpy.dynamic(__choice = ui.interact()) - - if __choice[0] == "select": - $ current_item = __choice[1] - elif __choice[0] == "category": - python: - current_category = __choice[1] - category_items = inventory_dict[current_category] - menu_items = inventory_sortfilter(category_items, current_sorting, current_filter) - menu_items_length = len(menu_items) - - if current_category == "Decorations": - menu_items = sorted(menu_items, key=lambda x: x.placement.id) - - current_page = 0 - current_item = next(iter(menu_items), None) - - elif __choice == "inc": - $ current_page += 1 - elif __choice == "dec": - $ current_page += -1 - elif __choice == "sort": - python: - if current_sorting == "A-z": - current_sorting = "z-A" - elif current_sorting == "z-A": - current_sorting = "Available" - elif current_sorting == "Available": - current_sorting = "Unavailable" - else: - current_sorting = "A-z" - menu_items = inventory_sortfilter(category_items, current_sorting, current_filter) - menu_items_length = len(menu_items) - - if current_category == "Decorations": - menu_items = sorted(menu_items, key=lambda x: x.placement.id) - - current_page = 0 - - if not current_item or not menu_items_length: - current_item = next(iter(menu_items), None) - - elif __choice == "filter": - python: - if current_filter is None: - current_filter = "Owned" - else: - current_filter = None - menu_items = inventory_sortfilter(category_items, current_sorting, current_filter) - menu_items_length = len(menu_items) - - if current_category == "Decorations": - menu_items = sorted(menu_items, key=lambda x: x.placement.id) - - current_page = 0 - - if not current_item or not menu_items_length: - current_item = next(iter(menu_items), None) - - elif __choice == "use": - python: - enable_game_menu() - current_item.use() - elif __choice == "give": - - if current_item.type == "gift": - if get_character_gifted(states.active_girl): - show screen blktone - with d3 - gen "I already gave her a gift today. Don't want to spoil her too much..." ("base", xpos="far_left", ypos="head") - hide screen blktone - with d3 - else: - hide screen inventory - $ renpy.call(get_character_gift_label(states.active_girl), current_item) - show screen inventory(xx, yy) - elif current_item.type == "potion": - if not states.active_girl in current_item.usable_on: - show screen blktone - with d3 - gen "(Something tells me this potion won't work on [states.active_girl].)" ("base", xpos="far_left", ypos="head") - nar "Perhaps in the future..." - hide screen blktone - with d3 - elif not states.env.daytime: - show screen blktone - with d3 - gen "(Some grander force tells me I should give it to her during daytime only.)" ("base", xpos="far_left", ypos="head") - hide screen blktone - with d3 - elif get_character_mood(states.active_girl) > 0: - show screen blktone - with d3 - gen "(I don't think it's a good idea to give it to her when she's still upset with me...)" ("base", xpos="far_left", ypos="head") - gen "(I should wait for her to calm down first.)" ("base", xpos="far_left", ypos="head") - hide screen blktone - with d3 - elif states.active_girl == "hermione" and not states.her.favors_convinced_stage == 2 and is_in_lead(states.env.gryffindor): - show screen blktone - with d3 - - gen "[name_hermione_genie], what would you say--" ("base", xpos="far_left", ypos="head") - her "I'm sorry professor but I don't need your help at the moment." - her "My house is already in the lead points wise." - gen "Figures..." ("base", xpos="far_left", ypos="head") - - call tutorial("points") - - hide screen blktone - with d3 - else: - python: - enable_game_menu() - inventory_mode = 0 - current_item.give(states.active_girl) - elif current_item.type == "quest": - if not states.active_girl in current_item.usable_on: - show screen blktone - with d3 - gen "(Something tells me I cannot give this item to [states.active_girl].)" ("base", xpos="far_left", ypos="head") - nar "Perhaps in the future..." - hide screen blktone - with d3 - #TODO Add daytime check for buttplug give item event - #show screen blktone - #with d3 - #gen "(Some grander force tells me I should give it to her during daytime only.)" ("base", xpos="far_left", ypos="head") - #hide screen blktone - #with d3 - elif get_character_mood(states.active_girl) > 0: - show screen blktone - with d3 - gen "(I don't think it's a good idea to give it to her when she's still upset with me...)" ("base", xpos="far_left", ypos="head") - gen "(I should wait for her to calm down first.)" ("base", xpos="far_left", ypos="head") - hide screen blktone - with d3 - elif states.active_girl == "hermione" and not states.her.favors_convinced_stage == 2 and is_in_lead(states.env.gryffindor): - show screen blktone - with d3 - - gen "[name_hermione_genie], I have something for you--" ("base", xpos="far_left", ypos="head") - her "I'm sorry professor but I don't need your help at the moment." - her "My house is already in the lead points wise." - gen "Figures..." ("base", xpos="far_left", ypos="head") - - call tutorial("points") - - hide screen blktone - with d3 - else: - python: - enable_game_menu() - inventory_mode = 0 - current_item.give(states.active_girl) - - else: - hide screen inventory - return - - jump .after_init - -screen inventory(xx, yy): - tag inventory - zorder 15 +screen inventory(): modal True + layer "interface" + zorder 0 + style_prefix "frame" - add "gui_fade" + 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 - if renpy.mobile: - use close_button_background - use close_button(key=["inventory", "game_menu"]) + default category = "gift" + # default subcategory = None + default menu_items = inventory.get_instances_of_type(category) + default selected_item = None - fixed: - if settings.get("animations"): - at gui_animation - use inventory_menu(xx, yy) - use inventory_menuitem(xx, yy) + add last_frame at navigation_last_frame_atl -screen inventory_menu(xx, yy): - window: + if navigation_exit: + timer 0.4 action Return("close") + + frame: style "empty" - style_prefix gui.theme('achievements') - pos (xx, yy) - xysize (207, 454) - - use invisible_button() - - add gui.format("interface/achievements/{}/panel_left.webp") + align (0.5, 0.5) + at navigation_atl vbox: - pos (6, 41) - for category in iter(inventory_dict.keys()): - vbox: - textbutton category: - style "empty" - xsize 195 ysize 16 - text_xalign 0.5 - if current_category == category: - background gui.format("interface/achievements/{}/highlight_left.webp") - else: - hover_background gui.format("interface/achievements/{}/highlight_left.webp") - action Return(["category", category]) - add gui.format("interface/achievements/{}/spacer_left.webp") + style_prefix "navigation_subtabs" + pos (286, 170) - # Gold & Tokens - null height 16 - text "{color=#daa520}Gold{/color} {outlinecolor=#ffffff00}[states.env.gold]{/outlinecolor}" size 12 outlines [ (2, "#000", 0, 0) ] xpos 0.1 xanchor 0 - add gui.format("interface/achievements/{}/spacer_left.webp") - text "{color=#2055da}Tokens{/color} {outlinecolor=#ffffff00}[states.env.tokens]{/outlinecolor}" size 12 outlines [ (2, "#000", 0, 0) ] xpos 0.1 xanchor 0 - add gui.format("interface/achievements/{}/spacer_left.webp") + at navigation_subtabs_show - vbox: - style_prefix gui.theme('achievements_filters') - pos (6, 384) - if current_filter is None: - textbutton "Show: All" action Return("filter") - else: - textbutton "Show: [current_filter]" action Return("filter") - textbutton "Sort by: [current_sorting]" action Return("sort") + 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 -screen inventory_menuitem(xx, yy): - window: - style "empty" - style_prefix gui.theme() - pos (xx+217, yy-53) - xysize (560, 507) - - use invisible_button() - - add "interface/achievements/inventory.webp" - add gui.format("interface/achievements/{}/panel.webp") - - #Western Egg - button xsize 90 ysize 60 action Play("sound", "sounds/plushie.ogg") xalign 0.5 style "empty" - - text "Inventory" size 22 xalign 0.5 ypos 65 - - #text "Unlocked: "+str(len([x for x in menu_items if x[1][3] is True]))+"/[menu_items_length]" size 12 pos (24, 70) - - # Page counter - if menu_items_length > items_shown: - hbox: - xanchor 1.0 - pos (540, 24) - spacing 5 - add "interface/page.webp" yanchor 0.5 ypos 53 - text str(current_page+1)+"/"+str(int(math.ceil(menu_items_length/items_shown))) ypos 44 size 16 + if selected_item and ((inventory_mode==0 and selected_item.usable) or inventory_mode==1 and selected_item.givable): vbox: - pos (570, 186) - spacing 10 + style_prefix "navigation_tabs" + pos (798, 170) - imagebutton: - idle gui.format("interface/frames/{}/arrow_up.webp") - if not current_page <= 0: - hover image_hover(gui.format("interface/frames/{}/arrow_up.webp")) - action Return("dec") + at navigation_tabs_show - imagebutton: - idle Transform(gui.format("interface/frames/{}/arrow_up.webp"), yzoom=-1) - if current_page < math.ceil((menu_items_length-1)/items_shown)-1: - hover Transform(image_hover(gui.format("interface/frames/{}/arrow_up.webp")), yzoom=-1) - action Return("inc") + 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 - # Add items - grid 9 4: - style "empty" - pos (24, 113) - spacing 10 + frame: + # maximum (None, 450) - for it_item in menu_items[current_page*items_shown:(current_page+1)*items_shown]: - frame: - style "empty" - xsize 48 - ysize 48 - add gui.format("interface/achievements/{}/iconbox.webp") + label _("Inventory") - if current_item is not None and current_item.id == it_item.id: - add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular - - add crop_image_zoom(it_item.get_image(), 42, 42, it_item.owned <= 0) align (0.5, 0.5) - - button: - style gui.theme("overlay_button") - background "interface/achievements/glass_iconbox.webp" - xsize 46 ysize 46 - action Return(["select", it_item]) - tooltip it_item.name - - if it_item.limit > 1 and it_item.owned > 0: - if it_item.infinite: - text "{unicode}∞{/unicode}" size 20 align (0.1, 0.1) offset(-1, -9) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] - else: - text str(it_item.owned) size 10 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] - elif current_category == "Decorations": - if it_item.in_use: - add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-3, -3) zoom 0.5 - elif current_category in ("Books", "Quest Items"): - if it_item.used: - add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-3, -3) zoom 0.5 - - if inventory_mode == 1 and (not it_item.givable or not states.active_girl in it_item.usable_on): - add "#b2000040" - - if menu_items_length <= 0: - text "Nothing here yet" align (0.5, 0.5) size 24 - - if current_item: - frame: - style "empty" - xsize 96 - ysize 96 - pos (24, 375) - add gui.format("interface/achievements/{}/icon_selected.webp") - add crop_image_zoom(current_item.get_image(), 84, 84, current_item.owned <= 0) align (0.5, 0.5) - add "interface/achievements/glass_selected.webp" pos (6, 6) - - if current_category in {"Gifts", "Ingredients", "Potions"}: - if current_item.owned > 0: - if current_item.infinite: - text "{unicode}∞{/unicode}" size 30 align (0.1, 0.1) offset(-2, -10) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] - else: - text "[current_item.owned]" size 14 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] - elif current_category == "Decorations": - if current_item.in_use: - add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-6, -6) - elif current_category in ("Books", "Quest Items"): - if current_item.used: - add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-6, -6) - - if inventory_mode == 1 and (not current_item.givable or not states.active_girl in current_item.usable_on): - add "#b2000040" - - add gui.format("interface/achievements/{}/highlight.webp") pos (112, 375) - add gui.format("interface/achievements/{}/spacer.webp") pos (120, 398) - hbox: - spacing 5 + # Add items + grid 10 8: + ypos 32 xalign 0.5 - text current_item.name ypos 380 size 16 xoffset 45 + for item in menu_items: + 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) - $ frame = Frame(gui.format("interface/frames/{}/iconframe.webp"), 6, 6) + 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 and current_item.usable) or (inventory_mode == 1 and current_item.givable): - textbutton "[current_item.caption]": - style "inventory_button" - background frame - xalign 0.89 - xoffset 45 - ypos 374 - sensitive (current_item.owned > 0) - if inventory_mode == 0: - action Return("use") - elif inventory_mode == 1: - action Return("give") + if (inventory_mode==0 or (inventory_mode==1 and (item.givable and states.active_girl in item.usable_on))): + action [SetScreenVariable("selected_item", item)] - hbox: - pos (132, 407) - xsize 410 - text current_item.desc size 12 + if selected_item: + vbox: + align (0.0, 1.0) -style inventory_button: - xysize (90, 26) - hover_foreground "#ffffff1F" + hbox: + spacing 5 -style inventory_button_text: - outlines [] - align (0.5, 0.5) - size 16 + 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) + + +# screen inventory_menu(xx, yy): +# style_prefix "frame" + +# window: +# style "empty" +# style_prefix gui.theme('achievements') +# pos (xx, yy) +# xysize (207, 454) + +# use invisible_button() + +# add gui.format("interface/achievements/{}/panel_left.webp") + +# vbox: +# pos (6, 41) +# for category in iter(inventory_dict.keys()): +# vbox: +# textbutton category: +# style "empty" +# xsize 195 ysize 16 +# text_xalign 0.5 +# if current_category == category: +# background gui.format("interface/achievements/{}/highlight_left.webp") +# else: +# hover_background gui.format("interface/achievements/{}/highlight_left.webp") +# action Return(["category", category]) +# add gui.format("interface/achievements/{}/spacer_left.webp") + +# # Gold & Tokens +# null height 16 +# text "{color=#daa520}Gold{/color} {outlinecolor=#ffffff00}[states.env.gold]{/outlinecolor}" size 12 outlines [ (2, "#000", 0, 0) ] xpos 0.1 xanchor 0 +# add gui.format("interface/achievements/{}/spacer_left.webp") +# text "{color=#2055da}Tokens{/color} {outlinecolor=#ffffff00}[states.env.tokens]{/outlinecolor}" size 12 outlines [ (2, "#000", 0, 0) ] xpos 0.1 xanchor 0 +# add gui.format("interface/achievements/{}/spacer_left.webp") + +# vbox: +# style_prefix gui.theme('achievements_filters') +# pos (6, 384) +# if current_filter is None: +# textbutton "Show: All" action Return("filter") +# else: +# textbutton "Show: [current_filter]" action Return("filter") +# textbutton "Sort by: [current_sorting]" action Return("sort") + +# screen inventory_menuitem(xx, yy): +# window: +# style "empty" +# style_prefix gui.theme() +# pos (xx+217, yy-53) +# xysize (560, 507) + +# use invisible_button() + +# add "interface/achievements/inventory.webp" +# add gui.format("interface/achievements/{}/panel.webp") + +# #Western Egg +# button xsize 90 ysize 60 action Play("sound", "sounds/plushie.ogg") xalign 0.5 style "empty" + +# text "Inventory" size 22 xalign 0.5 ypos 65 + +# #text "Unlocked: "+str(len([x for x in menu_items if x[1][3] is True]))+"/[menu_items_length]" size 12 pos (24, 70) + +# # Page counter +# if menu_items_length > items_shown: +# hbox: +# xanchor 1.0 +# pos (540, 24) +# spacing 5 +# add "interface/page.webp" yanchor 0.5 ypos 53 +# text str(current_page+1)+"/"+str(int(math.ceil(menu_items_length/items_shown))) ypos 44 size 16 +# vbox: +# pos (570, 186) +# spacing 10 + +# imagebutton: +# idle gui.format("interface/frames/{}/arrow_up.webp") +# if not current_page <= 0: +# hover image_hover(gui.format("interface/frames/{}/arrow_up.webp")) +# action Return("dec") + +# imagebutton: +# idle Transform(gui.format("interface/frames/{}/arrow_up.webp"), yzoom=-1) +# if current_page < math.ceil((menu_items_length-1)/items_shown)-1: +# hover Transform(image_hover(gui.format("interface/frames/{}/arrow_up.webp")), yzoom=-1) +# action Return("inc") + +# # Add items +# grid 9 4: +# style "empty" +# pos (24, 113) +# spacing 10 + +# for it_item in menu_items[current_page*items_shown:(current_page+1)*items_shown]: +# frame: +# style "empty" +# xsize 48 +# ysize 48 +# add gui.format("interface/achievements/{}/iconbox.webp") + +# if current_item is not None and current_item.id == it_item.id: +# add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular + +# add crop_image_zoom(it_item.get_image(), 42, 42, it_item.owned <= 0) align (0.5, 0.5) + +# button: +# style gui.theme("overlay_button") +# background "interface/achievements/glass_iconbox.webp" +# xsize 46 ysize 46 +# action Return(["select", it_item]) +# tooltip it_item.name + +# if it_item.limit > 1 and it_item.owned > 0: +# if it_item.infinite: +# text "{unicode}∞{/unicode}" size 20 align (0.1, 0.1) offset(-1, -9) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] +# else: +# text str(it_item.owned) size 10 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] +# elif current_category == "Decorations": +# if it_item.in_use: +# add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-3, -3) zoom 0.5 +# elif current_category in ("Books", "Quest Items"): +# if it_item.used: +# add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-3, -3) zoom 0.5 + +# if inventory_mode == 1 and (not it_item.givable or not states.active_girl in it_item.usable_on): +# add "#b2000040" + +# if menu_items_length <= 0: +# text "Nothing here yet" align (0.5, 0.5) size 24 + +# if current_item: +# frame: +# style "empty" +# xsize 96 +# ysize 96 +# pos (24, 375) +# add gui.format("interface/achievements/{}/icon_selected.webp") +# add crop_image_zoom(current_item.get_image(), 84, 84, current_item.owned <= 0) align (0.5, 0.5) +# add "interface/achievements/glass_selected.webp" pos (6, 6) + +# if current_category in {"Gifts", "Ingredients", "Potions"}: +# if current_item.owned > 0: +# if current_item.infinite: +# text "{unicode}∞{/unicode}" size 30 align (0.1, 0.1) offset(-2, -10) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] +# else: +# text "[current_item.owned]" size 14 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ] +# elif current_category == "Decorations": +# if current_item.in_use: +# add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-6, -6) +# elif current_category in ("Books", "Quest Items"): +# if current_item.used: +# add "interface/topbar/icon_check.webp" align (1.0, 1.0) offset (-6, -6) + +# if inventory_mode == 1 and (not current_item.givable or not states.active_girl in current_item.usable_on): +# add "#b2000040" + +# add gui.format("interface/achievements/{}/highlight.webp") pos (112, 375) +# add gui.format("interface/achievements/{}/spacer.webp") pos (120, 398) +# hbox: +# spacing 5 +# xalign 0.5 +# text current_item.name ypos 380 size 16 xoffset 45 + +# $ frame = Frame(gui.format("interface/frames/{}/iconframe.webp"), 6, 6) + +# if (inventory_mode == 0 and current_item.usable) or (inventory_mode == 1 and current_item.givable): +# textbutton "[current_item.caption]": +# style "inventory_button" +# background frame +# xalign 0.89 +# xoffset 45 +# ypos 374 +# sensitive (current_item.owned > 0) +# if inventory_mode == 0: +# action Return("use") +# elif inventory_mode == 1: +# action Return("give") + +# hbox: +# pos (132, 407) +# xsize 410 +# text current_item.desc size 12 + +# style inventory_button: +# xysize (90, 26) +# hover_foreground "#ffffff1F" + +# style inventory_button_text: +# outlines [] +# align (0.5, 0.5) +# size 16 diff --git a/game/scripts/inventory/books.rpy b/game/scripts/inventory/books.rpy index 0b16ff58..355db520 100644 --- a/game/scripts/inventory/books.rpy +++ b/game/scripts/inventory/books.rpy @@ -515,14 +515,19 @@ label quidditch_guide_book: nar "Quidditch - One of the most popular sports in the wizarding world is a team based sport played on broomsticks..." nar "Two opposing teams with seven people making up each team go up against each other..." - nar "The game is played using four balls... One quaffle, two bludgers and one snitch.\nThe beginning of the match is signalled by the quaffle being thrown into the air by the referee..." + nar "The game is played using four balls... One quaffle, two bludgers and one snitch." + nar "The beginning of the match is signalled by the quaffle being thrown into the air by the referee..." nar "Quidditch, unlike many other sports is played on an oval shaped pitch with a scoring area on each end..." nar "Much like other sports, you're not allowed to go outside the boundary lines with the quaffle or you'd have to hand it over to the opposing team..." - nar "When the game is set in motion each player takes their assigned positions.\nThere's three chasers, two beaters, one keeper and one seeker..." - nar "The chasers purpose is to score the Quaffle. Beaters on the other hand is to hit them with the bludgers as to knock the ball out of their grasp... The keeper blocks the goal and the seeker needs to catch the snitch." - nar "As most injuries are easily remedied through magical means there's nothing to stop a player from knocking into one another as to get a hold of the Quaffle. Distraction tactics are also common even during official matches..." + nar "When the game is set in motion each player takes their assigned positions." + nar "There's three chasers, two beaters, one keeper and one seeker..." + nar "The chasers purpose is to score the Quaffle. Beaters on the other hand is to hit them with the bludgers as to knock the ball out of their grasp..." + nar "The keeper blocks the goal and the seeker needs to catch the snitch." + nar "As most injuries are easily remedied through magical means there's nothing to stop a player from knocking into one another as to get a hold of the Quaffle." + nar "Distraction tactics are also common even during official matches..." nar "The way scoring is done is when the chaser has a hold of the quaffle they need to get to the opponent's side of the pitch and score it by getting it through a hoop..." - nar "The winning team is decided once the snitch is caught which is worth 150 points to the team of which seeker caught it. Therefore a match could technically go on forever... The longest Quidditch match went on for about 3 months..." + nar "The winning team is decided once the snitch is caught which is worth 150 points to the team of which seeker caught it. Therefore a match could technically go on forever..." + nar "The longest Quidditch match went on for about 3 months..." call book_end diff --git a/game/scripts/inventory/classes.rpy b/game/scripts/inventory/classes.rpy index 7f25cd6d..87d4c0fb 100644 --- a/game/scripts/inventory/classes.rpy +++ b/game/scripts/inventory/classes.rpy @@ -13,7 +13,7 @@ init python: return self.items def get_instances_of_type(self, type): - return [x for x in self.get_instances() if x.type == type] + return sorted([x for x in self.get_instances() if x.type == type], key=lambda y: natsort_key(y.name)) class Item(object): def __init__(self, id, type, name, price=0, desc="", unlocked=True, func=None, label=None, limit=100, image="default", givable=False, currency="gold", caption="use", owned=0, infinite=False, give_label=None, usable_on=[]): diff --git a/game/scripts/utility/image_crop.rpy b/game/scripts/utility/image_crop.rpy index 76ff7f6a..7a6f4e48 100644 --- a/game/scripts/utility/image_crop.rpy +++ b/game/scripts/utility/image_crop.rpy @@ -33,7 +33,7 @@ init python: def crop_image_zoom(path, xsize, ysize, grayscale=False): x, y, w, h = crop_whitespace(path) - matrix = SaturationMatrix(0) if grayscale else None + matrix = SaturationMatrix(0)*BrightnessMatrix(-0.25)*OpacityMatrix(0.5) if grayscale else None sprite = Image(path) return Transform(sprite, crop=(x, y, w, h), xsize=xsize, ysize=ysize, fit="contain", matrixcolor=matrix, subpixel=True) diff --git a/game/scripts/wardrobe/wardrobe.rpy b/game/scripts/wardrobe/wardrobe.rpy index 28de8d0d..846789d0 100644 --- a/game/scripts/wardrobe/wardrobe.rpy +++ b/game/scripts/wardrobe/wardrobe.rpy @@ -134,7 +134,7 @@ style loading_trivia_text: size 24 layeredimage loading: - always "gui_fade" + # always "gui_fade" always Text("Loading", style="loading_text"): align (0.5, 0.35) always "loading_spinner" @@ -221,7 +221,7 @@ label _wardrobe: screen wardrobe(xx, yy): tag wardrobe zorder 24 - add "gui_fade" + # add "gui_fade" if renpy.mobile: use close_button_background