
label summon_tonks:

    $ active_girl = "tonks"
    $ last_character = "tonks"

    $ tonks_busy = True

    call update_ton_tier
    call update_tonks

    call play_music("tonks")
    call play_sound("door")

    $ renpy.checkpoint(hard=True)

    # Clothes Events
    call tonks_summon_setup

    label tonks_requests:

    # Reset
    call reset_menu_position
    ton "" (xpos="base",ypos="base")

    menu:

        # Talk
        "-Talk-" (icon="interface/icons/small/talk.webp"):
            if ton_mood > 0:
                ton "I have a headache right now, let's talk later."
                jump tonks_requests

            call tonks_chitchat
            jump tonks_talk


        # Favours
        "-Sexual favours-" (icon="interface/icons/small/condom.webp"):
            jump tonks_favor_menu

        # Fireplace Chats
        "-Let's hang-" (icon="interface/icons/small/toast.webp") if (wine_ITEM.owned > 0 and nt_he_drink.counter == 0) or (firewhisky_ITEM.owned > 0 and nt_he_drink.counter > 0):
            jump tonks_hangout

        "-Let's hang-" (icon="interface/icons/small/toast.webp", style="disabled") if (firewhisky_ITEM.owned < 1 and nt_he_drink.counter > 0):
            gen "(I don't have any firewhisky...)" ("base", xpos="far_left", ypos="head")
            jump tonks_requests

        "-Let's hang-" (icon="interface/icons/small/toast.webp", style="disabled") if (wine_ITEM.owned < 1 and nt_he_drink.counter == 0):
            gen "(I don't have any wine...)" ("base", xpos="far_left", ypos="head")
            jump tonks_requests

        # Wardrobe
        "-Wardrobe-" (icon="interface/icons/small/wardrobe.webp") if tonks_wardrobe_unlocked:
            hide tonks_main with d1
            call wardrobe

            # Hair fix
            $ tonks_haircolor = tonks.get_equipped("hair").color
            jump tonks_requests

        "-Hidden-" (style="disabled") if not tonks_wardrobe_unlocked:
            call nar(">You haven't unlocked this feature yet.")
            jump tonks_requests

        "-Give Item-" (icon="interface/icons/small/gift.webp"):
            hide tonks_main with d1
            call gift_menu
            jump tonks_requests

        # Dismiss
        "-Never mind-":
            stop music fadeout 3.0

            if game.daytime:
                ton "Alright, back to work then..."
            else:
                ton "Sweet dreams, [ton_genie_name]."

            call play_sound("door")

            jump end_tonks_event


# Tonks level up
label update_ton_tier:
    if ton_tier == 1 and nt_he.favors_E2:
        $ ton_level_up = 1

    return

label tonks_level_up(tier=None):

    call bld
    if tier == 1:
        gen "(Time to teach those students something useful!)" ("grin", xpos="far_left", ypos="head")

    $ ton_tier = tier+1
    $ ton_level_up = None

    pause.5
    call nar(">Tonks has reached level "+str(ton_tier)+"!")

    call update_ton_tier

    return


# Tonks Requests Menu
label tonks_favor_menu:
    # call update_tonks_favors

    menu:
        "-Level Up-" (icon="interface/icons/small/levelup.webp") if ton_level_up != None:
            call tonks_level_up(tier=ton_level_up)
            jump tonks_requests

        "-Personal Favours-" (icon="interface/icons/small/heart_red.webp", style="disabled"):
            call not_available
            jump tonks_favor_menu
            #
            # Uncomment once favours are ready
            #

            # label .personal:
            # python:
                # menu_choices = []
                # for i in nt_favor_list:
                    # if i in []: # Not in the game yet.
                        # menu_choices.append(gui.menu_item("-Not available-", "na", style="disabled"))
                    # elif i.start_tier > ton_tier:
                        # menu_choices.append(gui.menu_item("-Not ready-", "vague", style="disabled"))
                    # else:
                        # menu_choices.append(i.get_menu_item())

                # menu_choices.append(("-Never mind-", "nvm"))
                # result = renpy.display_menu(menu_choices)
            # if result == "nvm":
                # jump tonks_favor_menu
            # elif result == "vague":
                # call favor_not_ready
                # jump .personal
            # elif result == "na":
                # call not_available
                # jump .personal
            # else:
                # $ renpy.jump(result)

        "-Public Requests-" (icon="interface/icons/small/star_yellow.webp") if game.daytime and tonks_requests_unlocked:
            jump tonks_requests_menu

        "-Public Requests-" (icon="interface/icons/small/star_yellow.webp", style="disabled") if not game.daytime or not tonks_requests_unlocked:
            if not tonks_requests_unlocked:
                call nar(">You haven't unlocked this feature yet.")
            elif not game.daytime:
                call nar(">Public requests are available during the day only.")
            jump tonks_favor_menu

        "-Never mind-":
            jump tonks_requests

label tonks_requests_menu:
    call update_ton_requests
    python:
        menu_choices = []
        for i in nt_requests_list:
            if i in []: # Not in the game yet.
                menu_choices.append(gui.menu_item("-Not available-", "na", style="disabled"))
            elif i.start_tier > ton_tier:
                menu_choices.append(gui.menu_item("-Not ready-", "vague", style="disabled"))
            else:
                menu_choices.append(i.get_menu_item())
        menu_choices.append(("-Never mind-", "nvm"))
        result = renpy.display_menu(menu_choices)

    if result == "nvm":
        jump tonks_favor_menu
    elif result == "vague":
        call favor_not_ready
        jump tonks_requests_menu
    elif result == "na":
        call not_available
        jump tonks_requests_menu
    else:
        $ renpy.jump(result)

label update_ton_requests:
    # Set event tier to current Tonks tier if they are different
    python:
        for i in nt_requests_list:
            i.tier = ton_tier

    return
