WTS/game/scripts/interface/door.rpy

196 lines
6.5 KiB
Plaintext
Raw Permalink Normal View History

2022-05-16 23:48:22 +00:00
####################################
############# Menu #################
####################################
default summon_show_busy = True
default door_randomobj = renpy.random.Random()
init python:
def __choice(seq):
seed = door_randomobj.getstate()
rv = door_randomobj.choice(seq)
door_randomobj.setstate(seed)
return rv
define map_transcript_loc = dict(
library = "Library",
room_g = "Gryffindor Dormitory",
room_s = "Slytherin Dormitory",
room_r = "Ravenclaw Dormitory",
room_h = "Hufflepuff Dormitory",
great_hall = "Great Hall",
courtyard = "Courtyard",
forest = "Forest",
greenhouse = "Greenhouse",
defense = "D.A.D.A Classroom",
training_grounds = "Training Grounds",
Lake = "Lake",
randomstudent = functools.partial(__choice, (
"Classroom",
"Bathroom",
"Hagrid's Hut",
"Weasley's Store",
"Mafkin's Store",
"Broom Cupboard",
"Attic")),
randomsnape = functools.partial(__choice, (
"Classroom",
"Boathouse",
"Bathroom",
"Snape's Office",
"Hall",
"Slytherin Dormitory",
"Library",
"Attic",
"Forest",
"Lake",
"Dungeons",
"Quidditch Cave",
"Staircase",
"Behind your door",
"Room of Doom")),
randomtonks = functools.partial(__choice, (
"Classroom",
"Bathroom",
"Hall",
"Gryffindor Dormitory",
"Slytherin Dormitory",
"Hufflepuff Dormitory",
"Ravenclaw Dormitory",
"Training Grounds",
"Tonks's Room",
"Quidditch Pitch",
"Infirmary",
"Sex Dungeon",
"Hospital Wing",
"Forest",
"Lake",
"Greenhouse",
"Mafkin's Store")),
)
2022-05-16 23:48:22 +00:00
label summon:
$ gui.in_context("summon_menu")
jump main_room_menu
label summon_menu(xx=723, yy=90):
$ renpy.dynamic(
# Door dictionary
summon_dict = {
# the order will be the one in the menu
"Snape": {"ico": "snape", "flag": states.sna.unlocked, "busy": states.sna.busy, "loc": "randomsnape"},
"Tonks": {"ico": "tonks", "flag": states.ton.unlocked, "busy": states.ton.busy, "loc": "randomtonks"},
"Hermione": {"ico": "hermione", "flag": states.her.unlocked, "busy": states.her.busy, "loc": states.her.map_location },
"Cho": {"ico": "cho", "flag": states.cho.unlocked, "busy": states.cho.busy, "loc": states.cho.map_location},
"Luna": {"ico": "luna", "flag": states.lun.unlocked, "busy": states.lun.busy, "loc": states.lun.map_location},
"Astoria": {"ico": "astoria", "flag": states.ast.unlocked, "busy": states.ast.busy, "loc": states.ast.map_location },
"Susan": {"ico": "susan", "flag": states.sus.unlocked, "busy": states.sus.busy, "loc": states.sus.map_location}
#"Ginny", "Daphne", "Padma", "Patil", "Myrtle", "Mafkin"
},
)
2022-05-16 23:48:22 +00:00
call screen summon(xx, yy)
2022-05-16 23:48:22 +00:00
return
2022-05-16 23:48:22 +00:00
label .summon(char):
$ enable_game_menu()
$ renpy.jump_out_of_context("summon_"+char.lower())
return
label .summon_busy(char):
if game.daytime or char in ["Tonks", "Snape"]:
nar "[char] is currently busy. Try again later."
2022-05-16 23:48:22 +00:00
else:
nar "[char] is currently asleep. Try again tomorrow."
2022-05-16 23:48:22 +00:00
return
2022-05-16 23:48:22 +00:00
screen summon(xx, yy):
tag summon
zorder 15
modal True
add "gui_fade"
if renpy.mobile:
use close_button_background
use close_button(key=["summon", "game_menu"])
fixed:
pos (xx, yy)
2022-05-16 23:48:22 +00:00
if settings.get("animations"):
at gui_animation
use summon_menu
2022-05-16 23:48:22 +00:00
screen summon_menu():
2022-05-16 23:48:22 +00:00
tag summon_menu
modal True
zorder 15
window:
style "empty"
xysize (207, 454)
use invisible_button()
add gui.format("interface/achievements/{}/panel_left.webp")
vbox:
pos (6, 384)
spacing 32
null
frame:
style "empty"
textbutton "Show Busy:":
style gui.theme("overlay_button")
xsize 195 ysize 32
text_align (0.4, 0.5)
text_size 12
action ToggleVariable("summon_show_busy", True, False)
add gui.theme("check_{}").format(str(summon_show_busy).lower()) xalign 0.7 ypos 4
vbox:
pos (6, 6)
$ allbusy = True
for char, char_dict in summon_dict.items():
if char_dict["flag"]:
if summon_show_busy or not char_dict["busy"]:
$ allbusy = False
2022-05-16 23:48:22 +00:00
frame:
style "empty"
xsize 195
ysize 50
vbox:
textbutton char:
style "empty"
xsize 195 ysize 46
hover_background gui.format("interface/achievements/{}/highlight_left_b.webp")
text_xalign 0.6 text_yalign 0.5
text_xanchor 0.5
text_size 20
if not char_dict["busy"]:
action Call("summon_menu.summon", char, from_current=True)
2022-05-16 23:48:22 +00:00
else:
text_color "#8C8C70"
action Call("summon_menu.summon_busy", char, from_current=True)
2022-05-16 23:48:22 +00:00
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("interface/icons/head/"+char_dict["ico"]+".webp", 42, 42, char_dict["busy"]) align (0.5, 0.5)
2022-05-16 23:48:22 +00:00
$ loc = map_transcript_loc[char_dict["loc"]]
text (loc() if callable(loc) else loc) size 10 xcenter 0.6 yalign 0.9
2022-05-16 23:48:22 +00:00
if not states.sna.unlocked:
2022-05-16 23:48:22 +00:00
text "You don't know anyone" size 12 at truecenter
elif allbusy:
text "All characters are busy" size 12 at truecenter