# Doomination [v0.5.1] [HardCorn]
# Gallery, Photos, Money, Puzzle Hints - Cheat Mod by pepplez @ F95zone
init offset = 9
define UnlockerMod_version = "1.6 Game v0.5.1"
init 9 python: 
    import os, time
    
    # measuring init time
    _t0 = time.perf_counter()

    # photos
    dp_images = [
        "images/photo/photobig/dp_photo_01_%s.png",
        "images/photo/photobig/dp_photo_02/dp_photo_02_%s.png",
        "images/photo/photobig/dp_photo_03_%s.webp",
        "images/photo/photobig/dp_photo_04_%s.webp",
        "images/photo/photobig/dp_photo_05_%s.webp",
        "images/photo/photobig/dp_photo_06_%s.webp",
        "images/photo/photobig/dp_photo_07_%s.webp",
        "images/photo/photobig/dp_photo_08_%s.webp",
        "images/photo/photobig/dp_photo_09_%s.webp",
        "images/photo/photobig/dp_photo_10_%s.webp",
        "images/photo/photobig/dp_photo_11_%s.webp",
        "images/photo/photobig/dp_photo_12_%s.webp",
        "images/photo/photobig/dp_photo_13_%s.webp",
        "images/photo/photobig/dp_photo_14_%s.webp",
        "images/photo/photobig/dp_photo_15_%s.webp",
        "images/photo/photobig/dp_photo_16_%s.webp",
        "images/photo/photobig/dp_photo_17_%s.webp",
        "images/photo/photobig/dp_photo_18_%s.webp",
        "images/photo/photobig/dp_photo_19_%s.webp",
        "images/photo/photobig/dp_photo_20_%s.webp",
        "images/photo/photobig/dp_photo_21_%s.webp",
        "images/photo/photobig/dp_photo_22_%s.webp",
        "images/photo/photobig/dp_photo_23_%s.webp",
        "images/photo/photobig/dp_photo_24_%s.webp",
        "images/photo/photobig/dp_photo_25_%s.webp",
        "images/photo/photobig/dp_photo_26_%s.webp",
        "images/photo/photobig/dp_photo_27_%s.webp",
        "images/photo/photobig/dp_photo_28_%s.webp",
        "images/photo/photobig/dp_photo_29_%s.webp",
        "images/photo/photobig/dp_photo_30_%s.webp",
        "images/photo/photobig/dp_photo_31_%s.webp",
        "images/photo/photobig/dp_photo_32_%s.webp",
        "images/photo/photobig/dp_photo_33_%s.webp",
        "images/photo/photobig/dp_photo_34_%s.webp",
        "images/photo/photobig/dp_photo_35_%s.webp",
        "images/photo/photobig/dp_photo_36_%s.webp",
        "images/photo/photobig/dp_photo_37_%s.webp",
        "images/photo/photobig/dp_photo_38_%s.webp",
        "images/photo/photobig/dp_photo_39_%s.webp",
        "images/photo/photobig/dp_photo_40_%s.webp",
        "images/photo/photobig/dp_photo_41_%s.webp",
        "images/photo/photobig/dp_photo_42_%s.webp",
        "images/photo/photobig/dp_photo_43_%s.webp",
        "images/photo/photobig/dp_photo_44_%s.webp",
        "images/photo/photobig/dp_photo_45_%s.webp",
        "images/photo/photobig/dp_photo_46_%s.webp",
        "images/photo/photobig/dp_photo_47_%s.webp",
        "images/photo/photobig/dp_photo_48_%s.webp",
        "images/photo/photobig/dp_photo_49_%s.webp",
        "images/photo/photobig/dp_photo_50_%s.webp",
        "images/photo/photobig/dp_photo_51_%s.webp",
        "images/photo/photobig/dp_photo_52_%s.webp",
    ]



    config.console = True
    def unlock_nude():

        for i in range(1, 10):
            setattr(store, f"dgg_pt{i}", True)

            store.dgg_nude = True

    for name in persistent.__dict__:
        if not name.startswith("_"):
            setattr(persistent, name, True)

    renpy.save_persistent()
    
    os.environ["RENPY_SKIP_SPLASHSCREEN"] = "1"
    renpy.config.quit_action = Quit(confirm=False)

    def get_next_photo(current_num):
        """Trova la prossima foto disponibile"""
        dp_total = len(dp_images)+1 # just count image list 
        for i in range(current_num + 1, dp_total):   
            var_name = f"dp_{i:02d}"
            
            if getattr(store, var_name, 0) > -1:
                return i
        
        return None  
    
    def get_prev_photo(current_num):
        """Trova la foto precedente disponibile"""
        for i in range(current_num - 1, 0, -1):  # Da current-1 fino a 1
            var_name = f"dp_{i:02d}"
            # Accetta qualsiasi valore > 0 (non solo 1)
            if getattr(store, var_name, 0) > -1:
                return i
        return None  # Nessuna foto precedente disponibile
    # init time result
    _t1 = time.perf_counter()
    print(f"[Unlocker] Init took {((_t1 - _t0) * 1000):.0f} ms. Mod v{UnlockerMod_version} by pepplez @ F95zone")

init 9 screen my_keys:
    on "show" action [ Function(unlock_nude), SetVariable("inventory.money", 99999999)]
    key "h" action NullAction()

init 9 screen puzzle(g):
    modal True
    add "images/domgame/domgame_bg.png"
    on "show" action Function(g.init)
    default pep_show_hints = True
    # text str(pep_show_hints)
    if g.framesize:
        frame:
            align .24,.5 xysize g.framesize
            background "#222"
    draggroup:
        for i in g.map:
            drag:
                draggable False
                drag_name i.name
                align .3,.5 offset i.x, i.y
                frame:
                    xysize g.size,g.size background None padding 2,2
                    frame:
                        background "#333"
                        if pep_show_hints:
                            text i.name

        for i in g.pieces:
            drag:
                align .8,.5 offset i.x, i.y
                droppable False
                clicked Function(i.rotate)
                dragged i.dropped
                fixed:
                    fit_first True
                    add i.cut at rotate(i.rotation*90) anchor (.5,.5) offset g.size/2,g.size/2
                    
                    if pep_show_hints:
                        vbox:
                            align .5,.5
                            # text i.name
                            text i.iname
                            # text str(i.rotation)

    if g.calc():
        timer 0.1 action Hide("puzzle"), Return()

    vbox:
        spacing 10 offset 10,-10
        align 0.0,0.5

        textbutton "Toggle hints" action ToggleScreenVariable("pep_show_hints", False, True)
        
        imagebutton:
            idle "images/domgame/button_skip_idle.png"
            hover "images/domgame/button_skip_hover.png"
            padding 20,20
            action Hide("puzzle"), Return()

        imagebutton:
            idle "images/domgame/button_reset_idle.png"
            hover "images/domgame/button_reset_hover.png"
            padding 20,20
            action Function(g.init)
            
            
init 9 screen dp_photo_window():
    zorder 100
    modal True
    tag deadpool_photo
    $ dp_total = len(dp_images) # count photos
    key "mouseup_2" action NullAction()
    key "h" action NullAction()
    add "doom_dev"
    add "images/photo/photo_box.png"
    text "{=stats_text}[dp_total]/[dp_total]{/=stats_text}" outlines [(4, "#1c1c1c")] xpos 990 ypos 760

    vpgrid:
        cols 4
        #rows 20
        xpos 590 ypos 360 spacing 38
        draggable True
        mousewheel False
        ysize 390
        yinitial 0
        scrollbars "vertical"
        side_spacing 33

        # photo loop
        for i, img in enumerate(dp_images, start=1):

            $ varname = "dp_%02d" % i
            $ screenname = "dp%02d" % i
            $ unlocked = globals()[varname]


            if unlocked > -1:

                imagebutton:
                    auto img
                    focus_mask True
                    hover_sound "images/assets/Click_Electronic_13.mp3"
                    action [
                        Hide("dp_photo_window", transition=Dissolve(0.1)),
                        Show(screenname)
                    ]

            else:

                frame:
                    style "photo_slot"


        for i in range(34):
            frame:
                style "photo_slot"

    imagebutton auto ("images/task/new_goback_%s.webp") focus_mask True hover_sound "images/assets/Click_Electronic_13.mp3" action [Hide ("dp_photo_window", transition=Dissolve(0.1)), Show("doom_device")]
    imagebutton auto ("images/device/doomdevice_shutdown_%s.png") focus_mask True hover_sound "images/assets/Click_Electronic_13.mp3" action [Hide ("dp_photo_window", transition=Dissolve(0.1)), Show("up_header")]        
