# -*- coding: utf-8 -*-
def t302011000_1():
    """State 0"""
    while True:
        """State 2"""
        # actionbutton:6000:"Talk"
        call = t302011000_x6(flag1=3263, flag2=3261, flag3=3262, val1=5, val2=10, val3=12, val4=10, val5=12,
                             actionbutton1=6000, flag4=6000, flag5=6001, flag6=10009364, flag7=10009365,
                             flag8=6000, z1=1, z2=1000000, z3=1000000, z4=1000000, mode1=1, mode2=1)
        assert not GetEventFlag(10009510)
        """State 3"""
        assert t302011000_x1()
        """State 1"""
        assert GetEventFlag(10009510) == 1

def t302011000_1000():
    """State 0,2,3"""
    assert t302011000_x39()
    """State 1"""
    c1_120(1000)
    Quit()

def t302011000_1001():
    """State 0,2,3"""
    assert t302011000_x40()
    """State 1"""
    c1_120(1001)
    Quit()

def t302011000_1101():
    """State 0,2,3"""
    assert t302011000_x41()
    """State 1"""
    c1_120(1101)
    Quit()

def t302011000_1102():
    """State 0,2,3"""
    t302011000_x42()
    Quit()
    """Unused"""
    """State 1"""
    c1_120(1102)
    Quit()

def t302011000_1103():
    """State 0,2,3"""
    assert t302011000_x43()
    """State 1"""
    c1_120(1103)
    Quit()

def t302011000_x0(actionbutton1=6000, flag5=6001, flag9=6000, flag10=6000, flag11=6000, flag12=6000,
                  flag4=6000):
    """State 0"""
    while True:
        """State 1"""
        assert not GetOneLineHelpStatus() and not IsClientPlayer() and not IsPlayerDead() and not IsCharacterDisabled()
        """State 3"""
        assert (GetEventFlag(flag5) == 1 or GetEventFlag(flag9) == 1 or GetEventFlag(flag10) == 1 or
                GetEventFlag(flag11) == 1 or GetEventFlag(flag12) == 1)
        """State 4"""
        assert not GetEventFlag(flag4)
        """State 2"""
        if GetEventFlag(flag4) == 1:
            pass
        elif (not (not GetOneLineHelpStatus() and not IsClientPlayer() and not IsPlayerDead() and not
              IsCharacterDisabled())):
            pass
        elif (not GetEventFlag(flag5) and not GetEventFlag(flag9) and not GetEventFlag(flag10) and not
              GetEventFlag(flag11) and not GetEventFlag(flag12)):
            pass
        # actionbutton:6000:"Talk"
        elif CheckActionButtonArea(actionbutton1):
            break
    """State 5"""
    return 0

def t302011000_x1():
    """State 0,1"""
    if not CheckSpecificPersonTalkHasEnded(0):
        """State 7"""
        ClearTalkProgressData()
        StopEventAnimWithoutForcingConversationEnd(0)
        """State 6"""
        ReportConversationEndToHavokBehavior()
    else:
        pass
    """State 2"""
    if CheckSpecificPersonGenericDialogIsOpen(0) == 1:
        """State 3"""
        ForceCloseGenericDialog()
    else:
        pass
    """State 4"""
    if CheckSpecificPersonMenuIsOpen(-1, 0) == 1 and not CheckSpecificPersonGenericDialogIsOpen(0):
        """State 5"""
        ForceCloseMenu()
    else:
        pass
    """State 8"""
    return 0

def t302011000_x2():
    """State 0,1"""
    ClearTalkProgressData()
    StopEventAnimWithoutForcingConversationEnd(0)
    ForceCloseGenericDialog()
    ForceCloseMenu()
    ReportConversationEndToHavokBehavior()
    """State 2"""
    return 0

def t302011000_x3(lot1=100500):
    """State 0,1"""
    # lot:100500:Grace Mimic
    AwardItemLot(lot1)
    assert not IsMenuOpen(63) and GetCurrentStateElapsedFrames() > 1
    """State 2"""
    return 0

def t302011000_x4(val2=10, val3=12):
    """State 0,1"""
    assert GetDistanceToPlayer() < val2 and GetCurrentStateElapsedFrames() > 1
    """State 2"""
    if not f228() and not f229():
        """State 3,6"""
        call = t302011000_x20()
        if call.Done():
            pass
        elif GetDistanceToPlayer() > val3 or GetTalkInterruptReason() == 6:
            """State 5"""
            assert t302011000_x1()
    else:
        """State 4,7"""
        call = t302011000_x36()
        if call.Done():
            pass
        elif GetDistanceToPlayer() > val3 or GetTalkInterruptReason() == 6:
            """State 8"""
            assert t302011000_x1()
    """State 9"""
    return 0

def t302011000_x5():
    """State 0,1"""
    assert t302011000_x1()
    """State 2"""
    return 0

def t302011000_x6(flag1=3263, flag2=3261, flag3=3262, val1=5, val2=10, val3=12, val4=10, val5=12, actionbutton1=6000,
                  flag4=6000, flag5=6001, flag6=10009364, flag7=10009365, flag8=6000, z1=1, z2=1000000,
                  z3=1000000, z4=1000000, mode1=1, mode2=1):
    """State 0"""
    assert GetCurrentStateElapsedTime() > 1.5
    while True:
        """State 2"""
        call = t302011000_x23(flag1=flag1, flag2=flag2, flag3=flag3, val1=val1, val2=val2, val3=val3,
                              val4=val4, val5=val5, actionbutton1=actionbutton1, flag4=flag4, flag5=flag5,
                              flag6=flag6, flag7=flag7, flag8=flag8, z1=z1, z2=z2, z3=z3, z4=z4, mode1=mode1,
                              mode2=mode2)
        assert IsClientPlayer() == 1
        """State 1"""
        call = t302011000_x22()
        assert not IsClientPlayer()
    """Unused"""
    """State 3"""
    return 0

def t302011000_x7(val1=5, val2=10, val3=12, val4=10, val5=12, actionbutton1=6000, flag4=6000, flag5=6001,
                  flag6=10009364, flag7=10009365, flag8=6000, z1=1, z2=1000000, z3=1000000, z4=1000000,
                  mode1=1, mode2=1):
    """State 0"""
    while True:
        """State 2"""
        call = t302011000_x10(actionbutton1=actionbutton1, flag4=flag4, flag5=flag5, z2=z2, z3=z3, z4=z4)
        def WhilePaused():
            RemoveMyAggroIf(IsAttackedBySomeone() == 1 and (DoesSelfHaveSpEffect(9626) == 1 and DoesSelfHaveSpEffect(9627) == 1))
            GiveSpEffectToPlayerIf(not CheckSpecificPersonTalkHasEnded(0), 9640)
        if call.Done():
            """State 4"""
            Label('L0')
            c1_138(1000000)
            call = t302011000_x14(val1=val1, z1=z1)
            def WhilePaused():
                c5_138(GetDistanceToPlayer() > 2.5, -1)
                RemoveMyAggroIf(IsAttackedBySomeone() == 1 and (DoesSelfHaveSpEffect(9626) == 1 and DoesSelfHaveSpEffect(9627) == 1))
                GiveSpEffectToPlayer(9640)
                c5_139(1 == (mode1 == 1), -1, 0)
                c5_139(1 == (mode2 == 1), 0, -1)
            def ExitPause():
                c1_138(-1)
            if call.Done():
                continue
            elif IsAttackedBySomeone() == 1:
                pass
        elif IsAttackedBySomeone() == 1 and not DoesSelfHaveSpEffect(9626) and not DoesSelfHaveSpEffect(9627):
            pass
        elif GetEventFlag(flag8) == 1:
            Goto('L0')
        elif GetEventFlag(flag6) == 1 and not GetEventFlag(flag7) and GetDistanceToPlayer() < val4:
            """State 5"""
            call = t302011000_x16(val5=val5)
            if call.Done():
                continue
            elif IsAttackedBySomeone() == 1:
                pass
        elif ((GetDistanceToPlayer() > val5 or GetTalkInterruptReason() == 6) and not CheckSpecificPersonTalkHasEnded(0)
              and not DoesSelfHaveSpEffect(9625)):
            """State 6"""
            assert t302011000_x27() and CheckSpecificPersonTalkHasEnded(0) == 1
            continue
        elif GetEventFlag(9000) == 1:
            """State 1"""
            assert not GetEventFlag(9000)
            continue
        """State 3"""
        def ExitPause():
            RemoveMyAggro()
        assert t302011000_x12(val2=val2, val3=val3)
    """Unused"""
    """State 7"""
    return 0

def t302011000_x8(val2=10, val3=12):
    """State 0,1"""
    call = t302011000_x18(val2=val2, val3=val3)
    assert IsPlayerDead() == 1
    """State 2"""
    t302011000_x4(val2=val2, val3=val3)
    Quit()
    """Unused"""
    """State 3"""
    return 0

def t302011000_x9(flag1=3263, val2=10, val3=12):
    """State 0,8"""
    assert t302011000_x38()
    """State 1"""
    if GetEventFlag(flag1) == 1:
        """State 2"""
        pass
    else:
        """State 3"""
        if GetDistanceToPlayer() < val2:
            """State 4,6"""
            call = t302011000_x21()
            if call.Done():
                pass
            elif GetDistanceToPlayer() > val3 or GetTalkInterruptReason() == 6:
                """State 7"""
                assert t302011000_x1()
        else:
            """State 5"""
            pass
    """State 9"""
    return 0

def t302011000_x10(actionbutton1=6000, flag4=6000, flag5=6001, z2=1000000, z3=1000000, z4=1000000):
    """State 0,1"""
    call = t302011000_x11(z8=2000, val6=2000)
    if call.Get() == 1:
        """State 2"""
        assert (t302011000_x0(actionbutton1=actionbutton1, flag5=flag5, flag9=6000, flag10=6000, flag11=6000,
                flag12=6000, flag4=flag4))
    elif call.Done():
        pass
    """State 3"""
    return 0

def t302011000_x11(z8=_, val6=_):
    """State 0,1"""
    if f203(z8) == 1:
        """State 2"""
        assert GetCurrentStateElapsedFrames() > 1
        """State 4"""
        def WhilePaused():
            c1_119(z8)
        assert f202() == val6
        """State 5"""
        return 0
    else:
        """State 3,6"""
        return 1

def t302011000_x12(val2=10, val3=12):
    """State 0"""
    assert GetCurrentStateElapsedFrames() > 1
    """State 5"""
    assert t302011000_x1()
    """State 3"""
    if GetDistanceToPlayer() < val2:
        """State 1"""
        if IsPlayerAttacking() == 1:
            """State 6"""
            call = t302011000_x13()
            if call.Done():
                pass
            elif GetDistanceToPlayer() > val3 or GetTalkInterruptReason() == 6:
                """State 7"""
                assert t302011000_x28()
        else:
            """State 4"""
            pass
    else:
        """State 2"""
        pass
    """State 8"""
    return 0

def t302011000_x13():
    """State 0,1"""
    assert t302011000_x11(z8=1101, val6=1101)
    """State 2"""
    return 0

def t302011000_x14(val1=5, z1=1):
    """State 0,2"""
    assert t302011000_x24()
    """State 1"""
    call = t302011000_x15()
    if call.Done():
        pass
    elif (GetDistanceToPlayer() > val1 or GetTalkInterruptReason() == 6) and not DoesSelfHaveSpEffect(9625):
        """State 3"""
        assert t302011000_x26()
    """State 4"""
    return 0

def t302011000_x15():
    """State 0,1"""
    assert t302011000_x11(z8=1000, val6=1000)
    """State 2"""
    return 0

def t302011000_x16(val5=12):
    """State 0,1"""
    call = t302011000_x17()
    if call.Done():
        pass
    elif GetDistanceToPlayer() > val5 or GetTalkInterruptReason() == 6:
        """State 2"""
        assert t302011000_x27()
    """State 3"""
    return 0

def t302011000_x17():
    """State 0,1"""
    assert t302011000_x11(z8=1100, val6=1100)
    """State 2"""
    return 0

def t302011000_x18(val2=10, val3=12):
    """State 0,5"""
    assert t302011000_x38()
    """State 2"""
    assert not GetEventFlag(3000)
    while True:
        """State 1"""
        assert GetDistanceToPlayer() < val2
        """State 3"""
        call = t302011000_x19()
        if call.Done():
            pass
        elif GetDistanceToPlayer() > val3 or GetTalkInterruptReason() == 6:
            """State 4"""
            assert t302011000_x29()
    """Unused"""
    """State 6"""
    return 0

def t302011000_x19():
    """State 0,2"""
    call = t302011000_x11(z8=1102, val6=1102)
    if call.Get() == 1:
        """State 1"""
        Quit()
    elif call.Done():
        """State 3"""
        return 0

def t302011000_x20():
    """State 0,1"""
    assert t302011000_x11(z8=1001, val6=1001)
    """State 2"""
    return 0

def t302011000_x21():
    """State 0,1"""
    assert t302011000_x11(z8=1103, val6=1103)
    """State 2"""
    return 0

def t302011000_x22():
    """State 0"""
    Quit()
    """Unused"""
    """State 1"""
    return 0

def t302011000_x23(flag1=3263, flag2=3261, flag3=3262, val1=5, val2=10, val3=12, val4=10, val5=12, actionbutton1=6000,
                   flag4=6000, flag5=6001, flag6=10009364, flag7=10009365, flag8=6000, z1=1, z2=1000000,
                   z3=1000000, z4=1000000, mode1=1, mode2=1):
    """State 0"""
    while True:
        """State 1"""
        RemoveMyAggro()
        call = t302011000_x7(val1=val1, val2=val2, val3=val3, val4=val4, val5=val5, actionbutton1=actionbutton1,
                             flag4=flag4, flag5=flag5, flag6=flag6, flag7=flag7, flag8=flag8, z1=z1,
                             z2=z2, z3=z3, z4=z4, mode1=mode1, mode2=mode2)
        if CheckSelfDeath() == 1 or GetEventFlag(flag1) == 1:
            """State 3"""
            Label('L0')
            call = t302011000_x9(flag1=flag1, val2=val2, val3=val3)
            if not CheckSelfDeath() and not GetEventFlag(flag1):
                continue
            elif GetEventFlag(9000) == 1:
                pass
        elif GetEventFlag(flag2) == 1 or GetEventFlag(flag3) == 1:
            """State 2"""
            call = t302011000_x8(val2=val2, val3=val3)
            if CheckSelfDeath() == 1 or GetEventFlag(flag1) == 1:
                Goto('L0')
            elif not GetEventFlag(flag2) and not GetEventFlag(flag3):
                continue
            elif GetEventFlag(9000) == 1:
                pass
        elif GetEventFlag(9000) == 1 or IsPlayerDead() == 1:
            pass
        """State 4"""
        assert t302011000_x37() and not GetEventFlag(9000)
    """Unused"""
    """State 5"""
    return 0

def t302011000_x24():
    """State 0,1"""
    assert t302011000_x25()
    """State 2"""
    return 0

def t302011000_x25():
    """State 0,1"""
    assert t302011000_x11(z8=1104, val6=1104)
    """State 2"""
    return 0

def t302011000_x26():
    """State 0,1"""
    call = t302011000_x11(z8=1201, val6=1201)
    if call.Get() == 1:
        """State 2"""
        assert t302011000_x5()
    elif call.Done():
        pass
    """State 3"""
    return 0

def t302011000_x27():
    """State 0,1"""
    call = t302011000_x11(z8=1300, val6=1300)
    if call.Get() == 1:
        """State 2"""
        assert t302011000_x5()
    elif call.Done():
        pass
    """State 3"""
    return 0

def t302011000_x28():
    """State 0,1"""
    call = t302011000_x11(z8=1301, val6=1301)
    if call.Get() == 1:
        """State 2"""
        assert t302011000_x5()
    elif call.Done():
        pass
    """State 3"""
    return 0

def t302011000_x29():
    """State 0,1"""
    call = t302011000_x11(z8=1302, val6=1302)
    if call.Get() == 1:
        """State 2"""
        assert t302011000_x5()
    elif call.Done():
        pass
    """State 3"""
    return 0

def t302011000_x30(text5=_, z7=_, mode7=1):
    """State 0,5"""
    assert t302011000_x2() and CheckSpecificPersonTalkHasEnded(0) == 1
    """State 2"""
    SetEventFlag(z7, 1)
    """State 1"""
    TalkToPlayer(text5, -1, -1, 0)
    assert CheckSpecificPersonTalkHasEnded(0) == 1
    """State 4"""
    if not mode7:
        pass
    else:
        """State 3"""
        ReportConversationEndToHavokBehavior()
    """State 6"""
    return 0

def t302011000_x31(text4=_, z6=_, mode6=1):
    """State 0,5"""
    assert t302011000_x2() and CheckSpecificPersonTalkHasEnded(0) == 1
    """State 1"""
    TalkToPlayer(text4, -1, -1, 0)
    assert CheckSpecificPersonTalkHasEnded(0) == 1
    """State 4"""
    if not mode6:
        pass
    else:
        """State 3"""
        ReportConversationEndToHavokBehavior()
    """State 2"""
    SetEventFlag(z6, 1)
    """State 6"""
    return 0

def t302011000_x32(text3=_, mode5=1):
    """State 0,4"""
    assert t302011000_x2() and CheckSpecificPersonTalkHasEnded(0) == 1
    """State 1"""
    TalkToPlayer(text3, -1, -1, 0)
    assert CheckSpecificPersonTalkHasEnded(0) == 1
    """State 3"""
    if not mode5:
        pass
    else:
        """State 2"""
        ReportConversationEndToHavokBehavior()
    """State 5"""
    return 0

def t302011000_x33(text2=_, z5=_, mode4=1):
    """State 0,5"""
    assert t302011000_x35() and CheckSpecificPersonTalkHasEnded(0) == 1
    """State 2"""
    SetEventFlag(z5, 1)
    """State 1"""
    TalkToPlayer(text2, -1, -1, 1)
    """State 4"""
    if not mode4:
        pass
    else:
        """State 3"""
        ReportConversationEndToHavokBehavior()
    """State 6"""
    return 0

def t302011000_x34(text1=_, mode3=1):
    """State 0,4"""
    assert t302011000_x35() and CheckSpecificPersonTalkHasEnded(0) == 1
    """State 1"""
    TalkToPlayer(text1, -1, -1, 1)
    """State 3"""
    if not mode3:
        pass
    else:
        """State 2"""
        ReportConversationEndToHavokBehavior()
    """State 5"""
    return 0

def t302011000_x35():
    """State 0,1"""
    ClearTalkProgressData()
    StopEventAnimWithoutForcingConversationEnd(0)
    ReportConversationEndToHavokBehavior()
    """State 2"""
    return 0

def t302011000_x36():
    """State 0,1"""
    assert t302011000_x11(z8=1002, val6=1002)
    """State 2"""
    return 0

def t302011000_x37():
    """State 0,1"""
    assert t302011000_x1()
    """State 2"""
    return 0

def t302011000_x38():
    """State 0,1"""
    if CheckSpecificPersonGenericDialogIsOpen(0) == 1:
        """State 2"""
        ForceCloseGenericDialog()
    else:
        pass
    """State 3"""
    if CheckSpecificPersonMenuIsOpen(-1, 0) == 1 and not CheckSpecificPersonGenericDialogIsOpen(0):
        """State 4"""
        ForceCloseMenu()
    else:
        pass
    """State 5"""
    return 0

def t302011000_x39():
    """State 0,7"""
    SetEventFlag(10009549, 1)
    """State 6"""
    if not GetEventFlag(3269):
        """State 1"""
        if GetEventFlag(10009514) == 1:
            """State 5"""
            SetEventFlag(10009397, 1)
            """State 2"""
            if not GetEventFlag(10009356):
                """State 8"""
                assert t302011000_x44()
            else:
                """State 10"""
                assert t302011000_x45()
        else:
            """State 4"""
            SetEventFlag(10009389, 1)
            """State 3"""
            if not GetEventFlag(10009512):
                """State 9"""
                assert t302011000_x46()
            else:
                """State 11"""
                assert t302011000_x47()
    else:
        """State 12"""
        def WhilePaused():
            RequestAnimation(20035, -1)
        assert t302011000_x48()
    """State 13"""
    return 0

def t302011000_x40():
    """State 0,1"""
    if not GetEventFlag(3269):
        """State 2"""
        # talk:30280301:"Oh, don't worry, I've got big plans for what's left of you..."
        assert t302011000_x34(text1=30280301, mode3=1)
    else:
        """State 3"""
        # talk:30280400:"Hah! Do you feel it?"
        assert t302011000_x34(text1=30280400, mode3=1)
    """State 4"""
    return 0

def t302011000_x41():
    """State 0,1"""
    RemoveMyAggro()
    """State 2"""
    if not GetEventFlag(10002767):
        """State 4"""
        # talk:30280000:"Ouch!"
        assert t302011000_x33(text2=30280000, z5=10002767, mode4=1)
    elif not GetEventFlag(10002723):
        """State 5"""
        # talk:30280100:"Oi, what're you doing?"
        assert t302011000_x33(text2=30280100, z5=10002723, mode4=1)
    else:
        """State 3"""
        pass
    """State 6"""
    return 0

def t302011000_x42():
    """State 0,2"""
    if not GetEventFlag(10009398):
        """State 3,6"""
        # talk:30280200:"Blast, what's it to you!"
        assert t302011000_x33(text2=30280200, z5=10009398, mode4=1)
    elif not GetEventFlag(10002730):
        """State 4"""
        pass
    else:
        """State 5"""
        pass
    """State 1"""
    Quit()
    """Unused"""
    """State 7"""
    return 0

def t302011000_x43():
    """State 0,1"""
    if not GetEventFlag(3269):
        """State 2"""
        # talk:30280500:"Damn it all. Why is it always me..."
        assert t302011000_x34(text1=30280500, mode3=1)
    else:
        """State 3"""
        # talk:30280600:"But...I'm free..."
        assert t302011000_x34(text1=30280600, mode3=1)
    """State 4"""
    return 0

def t302011000_x44():
    """State 0,1"""
    if not GetEventFlag(10009355) and not GetEventFlag(10009354):
        """State 8"""
        if not GetEventFlag(10009351):
            """State 2"""
            SetEventFlag(10009397, 1)
            """State 28"""
            # talk:30200200:"You're Tarnished, aren't you?"
            assert t302011000_x31(text4=30200200, z6=10009351, mode6=1)
            """State 3"""
            ClearTalkListData()
            c1_110()
            """State 4"""
            # action:23021001:"Very well"
            AddTalkListData(1, 23021001, -1)
            # action:23021000:"No, I'll use the main gate"
            AddTalkListData(2, 23021000, -1)
            """State 5"""
            OpenConversationChoicesMenu(0)
            assert not (CheckSpecificPersonMenuIsOpen(12, 0) == 1 and not CheckSpecificPersonGenericDialogIsOpen(0))
            """State 6"""
            if GetTalkListEntryResult() == 1:
                """State 13"""
                SetEventFlag(10002731, 0)
                """State 17"""
                SetEventFlag(10002724, 1)
                """State 24"""
                # talk:30200300:"Yes, that's the spirit."
                assert t302011000_x32(text3=30200300, mode5=1)
            elif GetTalkListEntryResult() == 2:
                """State 7"""
                SetEventFlag(10002731, 1)
                """State 18"""
                SetEventFlag(10002724, 0)
                """State 23"""
                # talk:30200400:"Fair enough, you certainly don't have to trust me."
                assert t302011000_x32(text3=30200400, mode5=1)
            else:
                """State 14"""
                pass
        else:
            """State 16"""
            if not GetEventFlag(10009502):
                """State 29"""
                # talk:30200500:"Use that opening to breach the castle."
                assert t302011000_x31(text4=30200500, z6=10009352, mode6=1)
            else:
                """State 30"""
                # talk:30200800:"...You're just the kind of Tarnished that I like."
                assert t302011000_x32(text3=30200800, mode5=1)
            """State 9"""
            ClearTalkListData()
            c1_110()
            """State 10"""
            # action:23021001:"Very well"
            AddTalkListDataIf(not GetEventFlag(10009502), 1, 23021001, -1)
            # action:23021000:"No, I'll use the main gate"
            AddTalkListDataIf(not GetEventFlag(10009502), 2, 23021000, -1)
            # action:20000009:"Leave"
            AddTalkListDataIf(GetEventFlag(10009502) == 1, 99, 20000009, -1)
            # action:23021002:"I want to use the main gate"
            AddTalkListDataIf(GetEventFlag(10009502) == 1, 2, 23021002, -1)
            """State 11"""
            OpenConversationChoicesMenu(0)
            assert not (CheckSpecificPersonMenuIsOpen(12, 0) == 1 and not CheckSpecificPersonGenericDialogIsOpen(0))
            """State 12"""
            if GetTalkListEntryResult() == 1:
                """State 19"""
                SetEventFlag(10002731, 0)
                """State 20"""
                SetEventFlag(10002724, 1)
                """State 26"""
                # talk:30200300:"Yes, that's the spirit."
                assert t302011000_x32(text3=30200300, mode5=1)
            elif GetTalkListEntryResult() == 2:
                """State 21"""
                SetEventFlag(10002731, 1)
                """State 22"""
                SetEventFlag(10002724, 0)
                """State 25"""
                # talk:30200600:"Of course. I understand."
                assert t302011000_x32(text3=30200600, mode5=1)
            else:
                """State 15"""
                pass
    else:
        """State 27"""
        # talk:30200900:"The gates are open. Do as you like."
        assert t302011000_x30(text5=30200900, z7=10009352, mode7=1)
    """State 31"""
    return 0

def t302011000_x45():
    """State 0,1"""
    if not GetEventFlag(10009353):
        """State 13"""
        # talk:30204000:"Oh, hello... Glad to see you safe."
        assert t302011000_x31(text4=30204000, z6=10009353, mode6=1)
    else:
        """State 11"""
        # talk:30204100:"Oh, hello, anything you'd care to purchase?"
        assert t302011000_x32(text3=30204100, mode5=1)
    """State 2"""
    ClearTalkListData()
    ClearTalkActionState()
    """State 3"""
    #give bell bearing
    AwardItemLot(100510)
    # action:20000010:"Purchase"
    AddTalkListData(1, 20000010, -1)
    # action:23021002:"I want to use the main gate"
    AddTalkListDataIf(not GetEventFlag(10009355), 2, 23021002, -1)
    # action:20000009:"Leave"
    AddTalkListData(3, 20000009, -1)
    while True:
        """State 4"""
        ShowShopMessage(1)
        assert not (CheckSpecificPersonMenuIsOpen(1, 0) == 1 and not CheckSpecificPersonGenericDialogIsOpen(0))
        """State 5"""
        if GetTalkListEntryResult() == 1:
            """State 7"""
            OpenRegularShop(100000, 100024)
            c1_141(5)
            assert not (CheckSpecificPersonMenuIsOpen(5, 0) == 1 and not CheckSpecificPersonGenericDialogIsOpen(0))
            continue
        elif GetTalkListEntryResult() == 2:
            """State 6"""
            SetEventFlag(10002731, 1)
            """State 10"""
            # talk:30200600:"Of course. I understand."
            assert t302011000_x32(text3=30200600, mode5=1)
        else:
            """State 8,9"""
            if not DidYouDoSomethingInTheMenu(0):
                pass
            else:
                """State 12"""
                # talk:30204500:"Fare thee well."
                assert t302011000_x32(text3=30204500, mode5=1)
        """State 14"""
        return 0

def t302011000_x46():
    """State 0,1"""
    if not GetEventFlag(10009360):
        """State 7"""
        # talk:30202000:"Oh, oh, you..."
        assert t302011000_x32(text3=30202000, mode5=1)
        """State 2"""
        RequestAnimation(20014, -1)
        assert GetCurrentStateElapsedTime() > 1.5
        """State 3"""
        SetEventFlag(10009360, 1)
        """State 8"""
        # lot:100500:Grace Mimic
        assert t302011000_x3(lot1=100500) and not IsMenuOpen(63)
    elif not GetEventFlag(10009368):
        """State 6"""
        # talk:30202100:"Good, now let's be on our way, shall we?"
        assert t302011000_x32(text3=30202100, mode5=1)
        """State 4"""
        SetEventFlag(10009368, 1)
    else:
        """State 5"""
        # talk:30202200:"Hop along, will you?"
        assert t302011000_x32(text3=30202200, mode5=1)
    """State 9"""
    return 0

def t302011000_x47():
    """State 0,1"""
    if not GetEventFlag(10009362):
        """State 2"""
        SetEventFlag(10009356, 1)
        """State 4"""
        # talk:30202600:"Oh, you..."
        assert t302011000_x31(text4=30202600, z6=10009362, mode6=1)
    else:
        """State 3"""
        # talk:30202700:"Oh, hello. No, don't you mind me for a minute."
        assert t302011000_x32(text3=30202700, mode5=1)
    """State 5"""
    return 0

def t302011000_x48():
    """State 0,1"""
    if not GetEventFlag(10009399):
        """State 2"""
        # talk:30205100:"Oh...hello there."
        assert t302011000_x30(text5=30205100, z7=10009399, mode7=1)
    else:
        """State 3"""
        # talk:30205200:"Now, I suppose I'm free."
        assert t302011000_x32(text3=30205200, mode5=1)
    """State 4"""
    return 0

