WTS/game/scripts/wardrobe/wardrobe.rpy

224 lines
7.6 KiB
Plaintext
Raw Normal View History

2024-10-13 08:38:11 +00:00
# Defines
define wardrobe.outfit_schedule = ("day", "night", "cloudy", "rainy", "snowy")
define wardrobe.subcategories = {
2022-05-16 23:48:22 +00:00
"hair": 5, "shirts": 5, "skirts": 5, "pantyhose": 5, "slot1": 5, "panties": 5, "save": 5,
"earrings": 4, "sweaters": 4, "trousers": 4, "stockings": 4, "bikini panties": 4, "load": 4,
"neckwear": 3, "dresses": 3, "shorts": 3, "socks": 3, "schedule": 3,
"one-piece suits": 2, "import": 2,
"robes": 1, "export": 1,
"gloves": 0, "pubes": 0, "delete": 0,
"other": -1,
}
2024-10-13 08:38:11 +00:00
# Settings
default wardrobe.music = False
default wardrobe.chitchats = True
default wardrobe.autosave = False
default wardrobe.suppress_warnings = False
default wardrobe.randomize_color = False
default wardrobe.global_color = False
2024-10-13 08:38:11 +00:00
# Functions
init python in wardrobe:
from collections import OrderedDict
2024-10-13 08:38:11 +00:00
def get_subcategories(d):
return OrderedDict(
sorted(
[
(subcat, [item for item in items if item.unlocked])
2024-10-13 08:38:11 +00:00
for subcat, items in subcategories.get(d, {}).items()
],
2024-10-13 08:38:11 +00:00
key=lambda x: subcategories.get(x[0], 0),
reverse=True
)
)
2024-10-13 08:38:11 +00:00
def get_icon(category):
fp = f"gui/creamy_pumpkin_pie/icons/{category}.png"
if renpy.loadable(fp):
return renpy.store.Image(fp, oversample=4)
return renpy.store.Image("gui/creamy_pumpkin_pie/icons/noicon.png", oversample=4)
def equip(item):
scope = renpy.get_screen("wardrobe").scope
character = scope["character"]
if item.type == "hair" and character.is_equipped_item(item):
renpy.play("sounds/fail.ogg")
renpy.notify("Hair cannot be removed.")
else:
if character.is_equipped_item(item):
if wardrobe_check_unequip(item):
wardrobe_react("unequip", item)
character.unequip(item)
else:
wardrobe_react("unequip_fail", item)
else:
if wardrobe_check_equip(item):
wardrobe_react("equip", item)
if not wardrobe_check_blacklist(item):
wardrobe_react("blacklist", item)
item.mark_as_seen()
character.equip(item)
if wardrobe_fallback_required(item):
# Has to be called regardless of player preference.
renpy.call(get_character_response(states.active_girl, "fallback"), item)
else:
wardrobe_react("equip_fail", item)
renpy.restart_interaction()
def strip():
scope = renpy.get_screen("wardrobe").scope
state = scope.get("__character_strip", 0)
character = scope["character"]
if state == 0: # Strip to underwear
character.strip("clothes")
character.wear("bra", "panties")
scope["__character_strip"] = 1
elif state == 1: # Strip naked
character.strip("bra", "panties")
scope["__character_strip"] = 2
elif state == 2: # Wear everything
character.wear("all")
scope["__character_strip"] = 0
renpy.restart_interaction()
def exit():
scope = renpy.get_screen("wardrobe").scope
character = scope["character"]
# Handle exit animation
scope["navigation_last_frame_atl"] = renpy.store.navigation_last_frame_hide
scope["navigation_atl"] = renpy.store.navigation_hide
scope["navigation_exit"] = True
# Save the outfit
outfit = renpy.store.get_character_outfit(renpy.store.states.active_girl, typ="last")
outfit.save()
# Reset states
character.wear("all")
renpy.restart_interaction()
2024-10-13 08:38:11 +00:00
label wardrobe(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 wardrobe
$ enable_game_menu()
jump main_room_menu
screen wardrobe():
layer "interface"
zorder 0
2022-05-16 23:48:22 +00:00
style_prefix "wardrobe"
2024-10-13 08:38:11 +00:00
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
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
default character = get_character_object(states.active_girl)
default selected_category = None
default selected_subcategory = None
# default menu_items = inventory.get_instances_of_type(category)
# default selected_item = None
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
add last_frame at navigation_last_frame_atl
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
add "gui_fade_both" at gui_fade
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
if navigation_exit:
timer 0.4 action Return()
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
frame:
at navigation_atl
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
vbox:
2022-05-16 23:48:22 +00:00
hbox:
spacing 0
2024-10-13 08:38:11 +00:00
for category in character.wardrobe:
if category == "hidden":
continue
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
button:
add wardrobe.get_icon(category) xysize (64, 64)
tooltip category
2024-10-13 08:38:11 +00:00
action [SetScreenVariable("selected_category", category), SetScreenVariable("selected_subcategory", None)]
null height 5
add "frame_spacer" xsize 500 xalign 0.5
null height 5
if selected_category:
viewport:
ysize 32
edgescroll (60, 50)
mousewheel "horizontal"
hbox:
for subcategory in character.wardrobe[selected_category]:
button:
label subcategory
action SetScreenVariable("selected_subcategory", subcategory)
2024-10-13 08:38:11 +00:00
null height 5
add "frame_spacer" xsize 500 xalign 0.5
null height 5
if selected_subcategory:
vpgrid:
cols 5
ysize 399
xspacing 5
yspacing 5
mousewheel True
scrollbars "vertical"
for item in character.wardrobe[selected_category][selected_subcategory]:
add item.button
add character.image align (1.0, 1.0) zoom 0.6
vbox:
align (0.5, 1.0)
textbutton "Return" action wardrobe.exit keysym "game_menu"
textbutton "Strip" action wardrobe.strip
2024-10-13 08:38:11 +00:00
style wardrobe_item_button is empty:
background Transform("wheelmenu_button", xysize=(96,96))
hover_background At(Transform("wheelmenu_button_opaque", xysize=(96,96)), wheelmenu_hover_anim)
selected_foreground Transform("#ffffff", alpha=0.5)
hover_sound "sounds/qubodup-hover1.ogg"
2024-10-13 08:38:11 +00:00
activate_sound "sounds/qubodup-click2.ogg"
# anchor (0.5, 0.5)
2022-05-16 23:48:22 +00:00
2024-10-13 08:38:11 +00:00
style wardrobe_item_button_inadequate is empty:
background Transform("wheelmenu_button", xysize=(96,96))
hover_background At(Transform("wheelmenu_button_opaque", xysize=(96,96), matrixcolor=TintMatrix("#ff0000")), wheelmenu_hover_anim)
2024-10-13 08:38:11 +00:00
hover_sound "sounds/qubodup-hover1.ogg"
activate_sound "sounds/qubodup-click2.ogg"
# anchor (0.5, 0.5)
style wardrobe_frame is empty:
xsize 540
yfill True
padding (10, 10)
background Frame(Image("gui/creamy_pumpkin_pie/side_frame.png", oversample=4), 0, 100, 9, 75, tile=False)
style wardrobe_button is frame_button:
xpadding 0
style wardrobe_button_text is frame_button_text:
size 18
style wardrobe_label:
xpadding 5
ypadding 5
style wardrobe_label_text is wardrobe_button_text
style wardrobe_viewport:
fit_first True
xsize 500