242 lines
8.5 KiB
Plaintext
242 lines
8.5 KiB
Plaintext
init python:
|
|
def brewing_sortfilter(item, sortby="A-z", filtering=None):
|
|
# if filtering == "Locked":
|
|
# item = filter(lambda x: x.is_unlocked(), item)
|
|
# elif filtering == "Unlocked":
|
|
# item = filter(lambda x: x.is_unlocked() is True, item)
|
|
|
|
# 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)
|
|
|
|
return item
|
|
|
|
def __actuate():
|
|
global menu_items
|
|
global current_item
|
|
|
|
menu_items = brewing_sortfilter(inventory.get_instances_of_type("potion"), current_sorting, current_filter)
|
|
|
|
if current_item not in menu_items:
|
|
current_item = next(iter(menu_items), None)
|
|
|
|
label brewing:
|
|
$ gui.in_context("brewing_menu")
|
|
return
|
|
|
|
label .make(item):
|
|
if item.has_ingredients():
|
|
play sound "sounds/bubble.ogg"
|
|
$ item.make()
|
|
else:
|
|
gen "It appears I'm missing some key ingredients..." ("base", xpos="far_left", ypos="head")
|
|
return
|
|
|
|
label brewing_menu(xx=150, yy=90):
|
|
|
|
$ renpy.dynamic(
|
|
"menu_items",
|
|
items_shown = 36,
|
|
current_filter = "Unlocked",
|
|
current_sorting = "A-z",
|
|
current_item = None,
|
|
)
|
|
$ __actuate()
|
|
|
|
call screen brewing(xx, yy)
|
|
|
|
return
|
|
|
|
screen brewing(xx, yy):
|
|
tag brewing
|
|
zorder 15
|
|
modal True
|
|
|
|
add "gui_fade"
|
|
|
|
if renpy.mobile:
|
|
use close_button_background
|
|
|
|
use close_button
|
|
|
|
fixed:
|
|
pos (xx, yy)
|
|
if settings.get("animations"):
|
|
at gui_animation
|
|
use brewing_menu
|
|
use brewing_menuitem
|
|
|
|
screen brewing_menu():
|
|
window:
|
|
style "empty"
|
|
style_prefix gui.theme('achievements')
|
|
xysize (207, 454)
|
|
|
|
use invisible_button()
|
|
|
|
add gui.format("interface/achievements/{}/panel_left.webp")
|
|
|
|
vpgrid:
|
|
rows 1
|
|
yfill True
|
|
|
|
vbox:
|
|
style_prefix gui.theme('achievements_categories')
|
|
pos (6, 6)
|
|
for i_item in menu_items:
|
|
frame:
|
|
style "empty"
|
|
xysize (195, 50)
|
|
|
|
vbox:
|
|
textbutton i_item.name:
|
|
xysize (195, 46)
|
|
text_align (0.6, 0.5)
|
|
text_xanchor 0.5
|
|
text_size 12
|
|
if current_item == i_item:
|
|
background gui.format("interface/achievements/{}/highlight_left_b.webp")
|
|
else:
|
|
hover_background gui.format("interface/achievements/{}/highlight_left_b.webp")
|
|
selected (current_item == i_item)
|
|
action SetVariable("current_item", i_item)
|
|
|
|
add gui.format("interface/achievements/{}/spacer_left.webp")
|
|
|
|
button:
|
|
style gui.theme("overlay_button")
|
|
background gui.format("interface/achievements/{}/iconbox.webp")
|
|
foreground "interface/achievements/glass_iconbox.webp"
|
|
xysize (48, 48)
|
|
add crop_image_zoom(i_item.get_image(), 42, 42) align (0.5, 0.5)
|
|
|
|
if i_item.owned > 0:
|
|
text "[i_item.owned]" size 10 align (0.02, 0.1) color "#ffffff" outlines [ (1, "#000", 0, 0) ]
|
|
vbox:
|
|
style_prefix gui.theme('achievements_filters')
|
|
pos (6, 384)
|
|
|
|
if current_filter is None:
|
|
textbutton "Show: All" action [SetVariable("current_filter", "Unlocked"), Function(__actuate)]
|
|
else:
|
|
textbutton "Show: [current_filter]" action [SetVariable("current_filter", None), Function(__actuate)]
|
|
textbutton "Sort by: [current_sorting]" action [SetVariable("current_sorting", current_sorting[::-1]), Function(__actuate),]
|
|
|
|
screen brewing_menuitem():
|
|
default turned_on = False
|
|
default drop_ingredients = False
|
|
|
|
window:
|
|
style "empty"
|
|
pos (217, -53)
|
|
xysize (560, 507)
|
|
use invisible_button()
|
|
|
|
#add "interface/achievements/star.webp"
|
|
add gui.format("interface/achievements/{}/panel.webp")
|
|
|
|
if turned_on:
|
|
add "interface/brewing/bg_on.webp" align (0.5, 1.0) xsize 548 fit "contain" yoffset -6
|
|
else:
|
|
add "interface/brewing/bg_off.webp" align (0.5, 1.0) xsize 548 fit "contain" yoffset -6
|
|
|
|
text "Brewing Station" size 22 xalign 0.5 ypos 65
|
|
|
|
if current_item:
|
|
vbox:
|
|
xsize 560
|
|
pos (24, 113)
|
|
spacing 5
|
|
|
|
text "[current_item.desc]" size 12
|
|
text "Usable on:" size 12
|
|
hbox:
|
|
for c in current_item.usable_on:
|
|
add "interface/icons/head/{}.webp".format(c) size (24, 24)
|
|
|
|
hbox:
|
|
spacing 10
|
|
pos (24, 270)
|
|
|
|
for ingredient in current_item.recipe:
|
|
frame:
|
|
style "empty"
|
|
xysize (48, 48)
|
|
add gui.format("interface/achievements/{}/iconbox.webp")
|
|
|
|
add crop_image_zoom(ingredient.get_image(), 42, 42, ingredient.owned <= 0) align (0.5, 0.5)
|
|
|
|
button:
|
|
style gui.theme("overlay_button")
|
|
background "interface/achievements/glass_iconbox.webp"
|
|
xsize 46 ysize 46
|
|
action NullAction()
|
|
tooltip ingredient.name
|
|
|
|
if ingredient.owned > 0:
|
|
if ingredient.infinite:
|
|
text "{unicode}∞{/unicode}" size 20 align (0.1, 0.1) offset(-1, -9) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
|
|
else:
|
|
text "[ingredient.owned]" size 10 align (0.1, 0.1) color "#ffffff" outlines [ (1, "#000", 0, 0) ]
|
|
else:
|
|
text "[ingredient.owned]" size 10 align (0.1, 0.1) color "#ff0000" outlines [ (1, "#000", 0, 0) ]
|
|
|
|
frame:
|
|
style "empty"
|
|
xysize (64, 64)
|
|
pos (464, 254)
|
|
|
|
add gui.format("interface/achievements/{}/iconbox.webp") size (64, 64)
|
|
|
|
add crop_image_zoom(current_item.get_image(), 52, 52, current_item.owned <= 0) align (0.5, 0.5)
|
|
|
|
button:
|
|
style gui.theme("overlay_button")
|
|
background Transform("interface/achievements/glass_iconbox.webp", size=(64, 64))
|
|
xysize (64, 64)
|
|
action NullAction()
|
|
tooltip current_item.name
|
|
|
|
if current_item.owned > 0:
|
|
text "[current_item.owned]" size 14 align (0.1, 0.1) color "#ffffff" outlines [ (1, "#000", 0, 0) ]
|
|
|
|
imagebutton:
|
|
if current_item.has_ingredients():
|
|
at transform:
|
|
subpixel True
|
|
|
|
on hover:
|
|
easeout_bounce 0.77 rotate 2 xoffset 3
|
|
easeout_bounce 0.77 rotate -2 xoffset -3
|
|
repeat
|
|
|
|
on idle:
|
|
linear 0.33 rotate 0 xoffset 0
|
|
|
|
idle "cauldron_off"
|
|
focus_mask None
|
|
pos (381, 311)
|
|
anchor (0.5, 0.5)
|
|
action Call("brewing.make", current_item, from_current=True)
|
|
if current_item.has_ingredients():
|
|
hover image_hover("cauldron_on")
|
|
hovered [Play("background", "sounds/brewing_idle.ogg"), SetLocalVariable("turned_on", True)]
|
|
unhovered [Stop("background"), SetLocalVariable("turned_on", False)]
|
|
else:
|
|
hover image_hover("cauldron_off")
|
|
|
|
if turned_on:
|
|
add "interface/brewing/glow.webp":
|
|
at transform:
|
|
align (0.5, 1.0)
|
|
xsize 548
|
|
fit "contain"
|
|
yoffset -6
|
|
|
|
alpha 0.1
|
|
linear 2.0 alpha 1.0
|
|
linear 1.5 alpha 0.1
|
|
repeat
|