label summon_cho:
    #play music "music/fuzzball-parade-by-kevin-macleod.ogg" fadein 1 if_changed
    #play sound "sounds/door.ogg"

    $ states.active_girl = "cho"

    $ states.cho.busy = True
    #call update_states.cho.tier
    call update_cho

    $ renpy.checkpoint(hard=True)

    if states.cho.ev.panty_thief.acquired:
        if states.cho.tier == 2:
            jump cho_panties_response_T2
        elif states.cho.tier == 3:
            jump cho_panties_response_T3

    # Slytherin Quidditch Intro.
    if states.cho.tier == 2 and not states.cho.ev.quidditch.e5_complete:
        jump cho_quid_E5
    # Gryffindor Quidditch Intro.
    elif states.cho.tier == 3 and not states.cho.ev.quidditch.e10_complete:
        jump cho_quid_E10
    # Quidditch Outro (Not yet finished, need a few more days)
    # elif states.cho.tier == 4 and not states.cho.ev.quidditch.e14_complete:
    #     jump cho_quid_E14

    # Clothes Events
    call cho_summon_setup

    label cho_requests:

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

    menu:

        # Main Matches
        "-Start Hufflepuff Match-" (icon="interface/icons/small/huff.webp") if (states.cho.tier == 1 and states.cho.ev.quidditch.hufflepuff_stage == "ready"):
            if states.cho.public_level == 0:
                gen "(If I want Cho to do anything in public with those {i}Muffletuffs{/i} I better do it before the match.)" ("base", xpos="far_left", ypos="head")
                gen "(Although maybe not...)" ("base", xpos="far_left", ypos="head")
                menu:
                    "Are you ready to begin the match?"
                    "-Yes-":
                        pass
                    "-no-":
                        jump cho_requests
            jump start_hufflepuff_match

        "-Start Slytherin Match-" (icon="interface/icons/small/slyt.webp") if (states.cho.tier == 2 and states.cho.ev.quidditch.slytherin_stage == "ready" and states.cho.ev.quidditch.e7_complete):
            if states.cho.public_level <= 3:
                gen "(If I want Cho to do anything in public with those {i}Slythershits{/i} I better do it before the match.)" ("base", xpos="far_left", ypos="head")
                gen "(Although maybe not...)" ("base", xpos="far_left", ypos="head")
                menu:
                    "Are you ready to begin the match?"
                    "-Yes-":
                        pass
                    "-no-":
                        jump cho_requests
            jump start_slytherin_match

        "-Start Gryffindor Match-" (icon="interface/icons/small/gryf.webp") if (states.cho.tier == 3 and states.cho.ev.quidditch.gryffindor_stage == "ready" and states.cho.ev.quidditch.e13_complete):
            if states.cho.public_level <= 6:
                gen "(If I want Cho to do anything in public with those {i}Gryphoncucks{/i} I better do it before the match.)" ("base", xpos="far_left", ypos="head")
                gen "(Although maybe not...)" ("base", xpos="far_left", ypos="head")

            nar "Starting the match will progress Cho's story to the next stage."
            nar "Make sure to save your game in case you want to return to this stage later."
            pause.5

            menu:
                "Are you ready to begin the match?"
                "-Yes-":
                    pass
                "-No-":
                    jump cho_requests
            jump start_gryffindor_match

        # Talk
        "-Talk-" (icon="interface/icons/small/talk.webp"):
            if states.cho.mood > 0:
                cho "I have nothing to say to you, [name_genie_cho]..." ("annoyed", "base", "base", "mid")
                jump cho_requests

            call cho_chitchat
            jump cho_talk

        # Quidditch Training
        "-Training-" (icon="interface/icons/small/quidditch.webp") if states.cho.tier < 4 and not states.cho.ev.quidditch.lock_training:
            if states.cho.mood > 0:
                gen "Ready to get back to training?" ("base", xpos="far_left", ypos="head")
                if states.cho.mood >= 5:
                    cho "No.{w=0.5} And I don't want to hear of it right now, Sir." ("open", "narrow", "angry", "mid")
                else:
                    cho "I'm sorry, [name_genie_cho]. But I don't feel like training today." ("soft", "base", "worried", "down")
                nar "Cho is still upset with you."
                jump cho_requests

            jump cho_training

        "-Training-" (icon="interface/icons/small/quidditch.webp", style="disabled") if states.cho.tier < 4 and states.cho.ev.quidditch.lock_training:
            gen "(She's as ready as one can be.)" ("base", xpos="far_left", ypos="head")
            jump cho_requests

        "-Sexual favours-" (icon="interface/icons/small/condom.webp") if states.cho.favors_unlocked:
            if states.cho.mood > 0:
                cho "I'm sorry, [name_genie_cho]. But I don't feel like it today..." ("upset", "base", "worried", "mid")
                jump cho_requests
            else:
                jump cho_favor_menu

        "-Sexual favours-" (icon="interface/icons/small/condom.webp", style="disabled") if not states.cho.favors_unlocked:
            if states.cho.tier == 1:
                gen "(I need to help her with her Quidditch training, before I can ask for something like this.)" ("base", xpos="far_left", ypos="head")
            elif states.cho.tier == 4:
                gen "(I have a feeling this is as far as I can progress with her at the moment.)" ("base", xpos="far_left", ypos="head")
            else:
                gen "(I should ask her about the next Quidditch match first. See who we're up against...)" ("base", xpos="far_left", ypos="head")
            jump cho_requests

        "-Wardrobe-" (icon="interface/icons/small/wardrobe.webp") if states.cho.wardrobe_unlocked:
            hide cho_main with d1
            call wardrobe
            jump cho_requests

        "-Hidden-" (style="disabled") if not states.cho.wardrobe_unlocked:
            nar "You haven't unlocked this feature yet."
            jump cho_requests

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

        # Dismiss
        "-Dismiss Her-":
            stop music fadeout 3.0

            if states.cho.mood == 0:
                cho "Goodbye, [name_genie_cho]." ("base", "base", "base", "mid")
            else:
                cho "Goodbye, [name_genie_cho]." ("annoyed", "base", "base", "L")

            play sound "sounds/door.ogg"

            jump end_cho_event

# Cho Favor Menu
label cho_favor_menu:
    call update_cho_favors

    menu:
        "-Personal Favours-" (icon="interface/icons/small/heart_red.webp"):
            label .personal:
            python:
                menu_choices = []
                for i in cc_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 > states.cho.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 cho_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", style="disabled") if not game.daytime or not states.cho.requests_unlocked:
            if not states.cho.requests_unlocked:
                nar "Progress further to unlock public requests."
            elif not game.daytime:
                nar "Public requests are available during the day only."
            jump cho_favor_menu

        "-Public Requests-" (icon="interface/icons/small/star_yellow.webp") if game.daytime and states.cho.requests_unlocked:
            jump cho_requests_menu

        "-Never mind-":
            jump cho_requests

label update_cho_favors:
    python:
        for i in cc_favor_list:
            i.tier = states.cho.tier
    return

# Cho Requests Menu
label cho_requests_menu:
    call update_cho_requests
    python:
        menu_choices = []
        for i in cc_requests_list:
            if i in []: # Not in the game yet.
                menu_choices.append(gui.menu_item("-Not available-", "na", style="disabled"))
                menu_choices.append(gui.menu_item())
            elif i.start_tier > states.cho.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 cho_favor_menu
    elif result == "vague":
        call favor_not_ready
        jump cho_requests
    elif result == "na":
        call not_available
        jump cho_requests
    else:
        $ renpy.jump(result)

label update_cho_requests:
    # Set event tier to current Cho tier if they are different
    python:
        for i in cc_requests_list:
            i.tier = states.cho.tier
    return

label favor_not_ready:
    nar "You can't do this favour just yet."
    return

label not_available:
    $ TBA_message("This feature is currently not available as of version %s." % config.version)
    return