266 lines
13 KiB
Plaintext
266 lines
13 KiB
Plaintext
init -5 python:
|
|
from collections import namedtuple
|
|
AchievementKind = namedtuple("AchievementKind", ("category", "name", "description", "icon", "progression", "progression_max"))
|
|
AchievementKind.title = AchievementKind.name
|
|
|
|
define achievements_db = {
|
|
# id : (categoryname, title, description, icon, secret)
|
|
"unlockher": AchievementKind("progression", "Granger Danger", "Unlock Hermione Granger.", "interface/icons/head/hermione.webp", None, None),
|
|
"unlockcho": AchievementKind("progression", "Chang Dynasty", "Unlocked Cho Chang.", "interface/icons/head/cho.webp", None, None),
|
|
"unlocklun": AchievementKind("progression", "Looney Tunes", "Unlocked Luna Lovegood.", "interface/icons/head/luna.webp", None, None),
|
|
"unlockast": AchievementKind("progression", "Green Peas", "Unlocked Astoria Greengrass.", "interface/icons/head/astoria.webp", None, None),
|
|
"unlockton": AchievementKind("progression", "Nymphadoreador", "Unlocked Nymphadora Tonks.", "interface/icons/head/tonks.webp", None, None),
|
|
"unlocksus": AchievementKind("progression", "Boner", "Unlocked Susan Bones.", "interface/icons/head/susan.webp", None, None),
|
|
"unlocksna": AchievementKind("progression", "Strictly colleagues", "Unlocked Severus Snape.", "interface/icons/head/snape.webp", None, None),
|
|
"overwhored": AchievementKind("progression", "Overwhored", "Fully corrupted one of the girls.", "interface/icons/head/hermione.webp", None, None),
|
|
"mirror": AchievementKind("events", "Mirror, mirror on the wall..", "Found the Room of Requirements.", "images/rooms/room_of_requirement/mirror_hover.webp", None, None),
|
|
"gold": AchievementKind("general", "Gold Digger", "Acquired 10,000 gold coins.", "interface/icons/gold.webp", "states.env.gold", 10000),
|
|
"drunkard": AchievementKind("general", "Drunken Master", "Acquired 25 bottles of wine.", "interface/icons/wine.webp", "wine_ITEM.owned", 25),
|
|
"workaholic": AchievementKind("general", "Workaholic", "Completed five full reports.", "interface/icons/generic_scroll.webp", "states.paperwork_reports_times", 5),
|
|
"fireplace": AchievementKind("general", "Feel the Heat", "Started fire 5 times.", "images/rooms/main_room/fireplace/fireplace_idle.webp", "states.fireplace_started_times", 5),
|
|
"peta": AchievementKind("general", "I think I forgot something...", "Forgot to feed the bird 50 days in a row.", "images/rooms/main_room/phoenix/phoenix_01.webp", "(states.env.day - states.bird_fed_times)", 50),
|
|
"petpal": AchievementKind("general", "Regular stroking", "Petted the bird 25 times.", "images/rooms/main_room/phoenix/phoenix_01.webp", "states.bird_petted_times", 25),
|
|
"postman": AchievementKind("general", "Poster Boy", "Bought all posters from the store.", "interface/icons/agrabah_poster.webp", None, None),
|
|
"hats": AchievementKind("general", "Mad Hatter", "Bought all hats from the store.", "interface/icons/icon_gambler_hat.webp", None, None),
|
|
"daddy": AchievementKind("events", "Who's your daddy?", "Been called a daddy.", "interface/icons/head/hermione.webp", None, None),
|
|
"pantiesfap": AchievementKind("events", "I sneezed on them...", "Rubbed one out on someone's panties.", "characters/genie/chibis/jerk_off/02.webp", None, None),
|
|
"bros": AchievementKind("events", "Bros before hoes", "Became best pals with Snape.", "interface/icons/head/snape.webp", None, None),
|
|
"knock": AchievementKind("events", "*Knock* *knock*", "Told Hermione to fuck off.", "images/rooms/main_room/door/door_idle.webp", None, None),
|
|
"decorator": AchievementKind("general", "Decorator", "Applied a decoration.", "interface/icons/stag_trophy.webp", None, None),
|
|
"flashback": AchievementKind("events", "Flashback", "Rolled back to the future at the right moment...", "interface/icons/cards.webp", None, None),
|
|
"start": AchievementKind("progression", "Welcome to Hogwarts!", "Finished the intro.", "interface/icon.webp", None, None),
|
|
"Credits": AchievementKind("general", "New game, who this?", "Watched the credits.", "interface/icons/silver_scroll.webp", None, None),
|
|
"Cardwin": AchievementKind("events", "Time to duel", "Won a card game duel.", "interface/icons/cards.webp", None, None),
|
|
"puzzle": AchievementKind("general", "Down the hatch!", "Waste a bottle of rare phoenix tears.", "interface/icons/item_potion.webp", None, None),
|
|
"ending": AchievementKind("events", "Bittersweet Farewell", "Reached the ending.", "interface/icons/silver.webp", None, None),
|
|
#1.37 HG achievements
|
|
"busted": AchievementKind("events", "BUSTED!", "Got busted for busting a nut.", "interface/icons/head/hermione.webp", None, None),
|
|
"herstrip": AchievementKind("progression", "Dance lessons", "Allowed Hermione to dance naked in front of Snape.", "interface/icons/head/hermione.webp", None, None),
|
|
"herkiss": AchievementKind("progression", "First Kiss", "You made out with Hermione, or rather your cock did.", "interface/icons/head/hermione.webp", None, None),
|
|
"hertits": AchievementKind("progression", "Boobs Lover", "Stuck a dick between the valley of plenty.", "interface/icons/head/hermione.webp", None, None),
|
|
"headlib": AchievementKind("progression", "Head Librarian", "Had oral lessons with Hermione.", "interface/icons/head/hermione.webp", None, None),
|
|
"nerdgasm": AchievementKind("progression", "Nerdgasm", "Done the deed with Hermione.", "interface/icons/head/hermione.webp", None, None)
|
|
}
|
|
|
|
init python hide:
|
|
for name in achievements_db:
|
|
achievement.register(name)
|
|
|
|
init python:
|
|
# intentionaly not a define nor a default
|
|
__popup_stack = []
|
|
|
|
config.after_default_callbacks.append(__popup_stack.clear)
|
|
config.always_shown_screens.append("achievement_main")
|
|
|
|
screen achievement_main():
|
|
layer "interface"
|
|
|
|
vbox:
|
|
for id index id in __popup_stack[:3]:
|
|
use achievement_window(msg=achievements_db[id].title, title="Achievement unlocked!", icon=achievements_db[id].icon)
|
|
timer 6 action Function(__popup_stack.remove, id)
|
|
|
|
label popup(msg="", title="", icon=None, xpos=0, ypos=60, sound=True, soundfile='sounds/achievement.ogg'):
|
|
if sound:
|
|
play sound soundfile
|
|
hide screen achievement_window
|
|
show screen achievement_window(msg=msg, title=title, icon=icon, xpos=xpos, ypos=ypos)
|
|
return
|
|
|
|
screen achievement_window(msg="", title="", icon=None, xpos=0, ypos=60):
|
|
tag popup_window
|
|
layer "interface"
|
|
|
|
frame:
|
|
style "empty"
|
|
at popup_animation(time=5.0, xx=-410)
|
|
pos (xpos, ypos)
|
|
xsize 410
|
|
ysize 96
|
|
|
|
add gui.format("interface/achievements/{}/box.webp")
|
|
if icon:
|
|
frame:
|
|
style "empty"
|
|
pos (6, 6)
|
|
xsize 84
|
|
ysize 84
|
|
$ image_zoom = crop_image_zoom(icon, 84, 84)
|
|
if 'head' in icon:
|
|
add image_zoom align (0.5, 1.0) yoffset -1
|
|
else:
|
|
add image_zoom align (0.5, 0.5)
|
|
|
|
add "interface/achievements/glass.webp"
|
|
frame:
|
|
style "empty"
|
|
xpos 96
|
|
xsize 314
|
|
vbox:
|
|
ypos 12
|
|
spacing 10
|
|
xalign 0.5
|
|
text title size 18 xalign 0.5
|
|
text msg size 14 xalign 0.5
|
|
timer 6.0 action Hide("achievement_window")
|
|
|
|
transform rotate_circular(t=7):
|
|
on show, appear, start:
|
|
subpixel True
|
|
rotate 0
|
|
linear t rotate 360
|
|
repeat
|
|
|
|
init python in achievements:
|
|
def validate():
|
|
"""Validate icons and progression flags"""
|
|
for i in renpy.store.achievements_db.values():
|
|
if not renpy.loadable(i.icon):
|
|
raise IOError(repr(i.icon))
|
|
# if i.progression and not isinstance(eval(i.progression), (int, float)):
|
|
# raise TypeError(f"Progression flag must return a float or an integer - {i.progression}")
|
|
|
|
validate()
|
|
|
|
def unlock(id, silent=False):
|
|
if renpy.store._in_replay:
|
|
return
|
|
|
|
if not renpy.store.achievement.has(id):
|
|
renpy.store.achievement.grant(id)
|
|
|
|
if not silent:
|
|
renpy.play('sounds/achievement.ogg')
|
|
renpy.store.__popup_stack.append(id)
|
|
|
|
status = renpy.store.achievement.has
|
|
lock = renpy.store.achievement.clear
|
|
|
|
def get_list(category=None):
|
|
if category:
|
|
items = filter((lambda x: category==renpy.store.achievements_db[x].category.lower()), renpy.store.achievements_db)
|
|
else:
|
|
items = renpy.store.achievements_db
|
|
items = sorted(items, key=lambda x: renpy.store.natsort_key(renpy.store.achievements_db[x].title))
|
|
return items
|
|
|
|
def get_list(category=None):
|
|
if category:
|
|
items = filter((lambda x: category==renpy.store.achievements_db[x].category), renpy.store.achievements_db)
|
|
else:
|
|
items = renpy.store.achievements_db
|
|
|
|
# Sort titles
|
|
items = sorted(items, key=lambda x: renpy.store.natsort_key(renpy.store.achievements_db[x].title))
|
|
# Sort unlocks
|
|
items = sorted(items, key=lambda x: renpy.store.achievement.has(x))
|
|
return items
|
|
|
|
def get_categories():
|
|
return set(item.category for item in renpy.store.achievements_db.values())
|
|
|
|
label achievements:
|
|
$ disable_game_menu()
|
|
call screen achievements
|
|
$ enable_game_menu()
|
|
jump main_room_menu
|
|
|
|
screen achievements():
|
|
modal True
|
|
layer "interface"
|
|
zorder 0
|
|
style_prefix "achievements"
|
|
|
|
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 = None
|
|
default menu_categories = achievements.get_categories()
|
|
default menu_items = achievements.get_list(category)
|
|
|
|
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 _("All") action [SetScreenVariable("category", None), SetScreenVariable("menu_items", achievements.get_list())] selected (category==None) at navigation_tabs
|
|
for i in menu_categories:
|
|
textbutton "[i.capitalize()]" action [SetScreenVariable("category", i), SetScreenVariable("menu_items", achievements.get_list(i))] selected (category==i) 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 ["game_menu"] at navigation_tabs
|
|
|
|
frame:
|
|
label _("Achievements")
|
|
|
|
# Add items
|
|
viewport:
|
|
ypos 32
|
|
scrollbars "vertical"
|
|
mousewheel True
|
|
vbox:
|
|
for item in menu_items:
|
|
$ item_unlocked = achievement.has(item)
|
|
$ item_data = achievements_db[item]
|
|
$ item_color = "#ffffff" if item_unlocked else "#8d8d8d"
|
|
fixed:
|
|
fit_first True
|
|
button:
|
|
hbox:
|
|
add crop_image_zoom(item_data.icon, 48, 48, not item_unlocked) xysize (48, 48)
|
|
null width 5
|
|
vbox:
|
|
text "[item_data.title]" color item_color
|
|
text "[item_data.description]" color item_color style "achievements_text_small"
|
|
action NullAction()
|
|
if item_unlocked:
|
|
add "interface/topbar/icon_check.webp" xysize (24, 24) yalign 0.5
|
|
if item_data.progression:
|
|
if item_unlocked:
|
|
bar value StaticValue(1.0)
|
|
else:
|
|
bar value StaticValue(eval(item_data.progression), item_data.progression_max) style "achievements_bar_disabled"
|
|
add "frame_spacer" xalign 0.5 xsize 500
|
|
|
|
style achievements_viewport is viewport:
|
|
xalign 0.5
|
|
ymaximum 392
|
|
style achievements_vbox is frame_vbox:
|
|
ypos 0
|
|
yspacing 0
|
|
xalign 0
|
|
style achievements_frame is frame
|
|
style achievements_label is frame_label
|
|
style achievements_label_text is frame_label_text
|
|
style achievements_text is frame_text:
|
|
xalign 0
|
|
style achievements_text_small is achievements_text:
|
|
xalign 0
|
|
size 12
|
|
style achievements_button is frame_button:
|
|
xfill True
|
|
yminimum 48
|
|
style achievements_button_text is frame_button_text
|
|
style achievements_bar is player_bar:
|
|
xmaximum 400
|
|
yalign 1.0
|
|
xpos 78
|
|
ysize 10
|
|
yoffset -2
|
|
style achievements_bar_disabled is achievements_bar:
|
|
left_bar Frame(Transform(Image("gui/creamy_pumpkin_pie/player/player_bar_full.png", oversample=4), matrixcolor=BrightnessMatrix(-0.5)), 24, 0, tile=False)
|
|
right_bar Frame(Transform(Image("gui/creamy_pumpkin_pie/player/player_bar_empty.png", oversample=4), matrixcolor=BrightnessMatrix(-0.5)), 24, 0, tile=False)
|