def __init__(self):
        self.whisperId = None
        self.toPlayer = 0
        structure = []
        structure.append([SCEmoteMenu, OTPLocalizer.SCMenuEmotions])
        self.emoteMenuIdx = len(structure) - 1
        structure.append([SCCustomMenu, OTPLocalizer.SCMenuCustom])
        structure += scStructure
        if base.config.GetInt('want-emotes', 1):
            emote_structure = None
            emote_dance_structure = None
            emote_general_structure = None
            emote_music_structure = None
            emote_expressions_structure = None
            avatar_gender = base.emoteGender
            idList = EmoteGlobals.emotes.keys()
            idList.sort()
            for id in idList:
                emote = EmoteGlobals.emotes.get(id)
                emote_group = EmoteGlobals.getEmoteGroup(id)
                emote_gender = EmoteGlobals.getEmoteGender(id)
                if id in [
                        EmoteGlobals.EMOTE_VALENTINES,
                        EmoteGlobals.EMOTE_NOISEMAKER,
                        EmoteGlobals.EMOTE_HALLOWEEN,
                        EmoteGlobals.EMOTE_COIN_TAILS
                ]:
                    continue

                if not emote_structure:
                    emote_structure = [OTPLocalizer.Emotes_Root]

                if not emote_dance_structure:
                    emote_dance_structure = [OTPLocalizer.Emotes_Dances]
                    structure.append(emote_dance_structure)

                if not emote_general_structure:
                    emote_general_structure = [OTPLocalizer.Emotes_General]
                    structure.append(emote_general_structure)

                if not emote_music_structure:
                    emote_music_structure = [OTPLocalizer.Emotes_Music]
                    structure.append(emote_music_structure)

                if not emote_expressions_structure:
                    emote_expressions_structure = [
                        OTPLocalizer.Emotes_Expressions
                    ]
                    structure.append(emote_expressions_structure)

                if emote_gender == avatar_gender or emote_gender is None:
                    if emote_group == OTPLocalizer.Emotes_Dances:
                        emote_dance_structure.append(id)
                    elif emote_group == OTPLocalizer.Emotes_General:
                        structure.append(id)
                    elif emote_group == OTPLocalizer.Emotes_Music:
                        emote_music_structure.append(id)
                    elif emote_group == OTPLocalizer.Emotes_Expressions:
                        emote_expressions_structure.append(id)

                emote_group == OTPLocalizer.Emotes_Dances

            if emote_structure:
                structure.insert(0, emote_structure)

        self.createSpeedChatObject(structure)

        def listenForSCEvent(eventBaseName, handler, self=self):
            eventName = self.speedChat.getEventName(eventBaseName)
            self.accept(eventName, handler)

        listenForSCEvent(SpeedChatGlobals.SCTerminalLinkedEmoteEvent,
                         self.handleLinkedEmote)
        self.fsm = ClassicFSM.ClassicFSM('SpeedChat', [
            State.State('off', self.enterOff, self.exitOff, ['active']),
            State.State('active', self.enterActive, self.exitActive, ['off'])
        ], 'off', 'off')
        self.fsm.enterInitialState()
        self.mode = 'AllChat'
        self.whisperId = None
    def __init__(self):
        self.whisperId = None
        self.toPlayer = 0
        structure = []
        structure.append([
            SCEmoteMenu,
            OTPLocalizer.SCMenuEmotions])
        self.emoteMenuIdx = len(structure) - 1
        structure.append([
            SCCustomMenu,
            OTPLocalizer.SCMenuCustom])
        structure += scStructure
        if base.config.GetInt('want-emotes', 1):
            emote_structure = None
            emote_dance_structure = None
            emote_general_structure = None
            emote_music_structure = None
            emote_expressions_structure = None
            avatar_gender = base.emoteGender
            idList = EmoteGlobals.emotes.keys()
            idList.sort()
            for id in idList:
                emote = EmoteGlobals.emotes.get(id)
                emote_group = EmoteGlobals.getEmoteGroup(id)
                emote_gender = EmoteGlobals.getEmoteGender(id)
                if id in [
                    EmoteGlobals.EMOTE_VALENTINES,
                    EmoteGlobals.EMOTE_NOISEMAKER,
                    EmoteGlobals.EMOTE_HALLOWEEN,
                    EmoteGlobals.EMOTE_COIN_TAILS]:
                    continue
                
                if not emote_structure:
                    emote_structure = [
                        OTPLocalizer.Emotes_Root]
                
                if not emote_dance_structure:
                    emote_dance_structure = [
                        OTPLocalizer.Emotes_Dances]
                    structure.append(emote_dance_structure)
                
                if not emote_general_structure:
                    emote_general_structure = [
                        OTPLocalizer.Emotes_General]
                    structure.append(emote_general_structure)
                
                if not emote_music_structure:
                    emote_music_structure = [
                        OTPLocalizer.Emotes_Music]
                    structure.append(emote_music_structure)
                
                if not emote_expressions_structure:
                    emote_expressions_structure = [
                        OTPLocalizer.Emotes_Expressions]
                    structure.append(emote_expressions_structure)
                
                if emote_gender == avatar_gender or emote_gender is None:
                    if emote_group == OTPLocalizer.Emotes_Dances:
                        emote_dance_structure.append(id)
                    elif emote_group == OTPLocalizer.Emotes_General:
                        structure.append(id)
                    elif emote_group == OTPLocalizer.Emotes_Music:
                        emote_music_structure.append(id)
                    elif emote_group == OTPLocalizer.Emotes_Expressions:
                        emote_expressions_structure.append(id)
                    
                emote_group == OTPLocalizer.Emotes_Dances
            
            if emote_structure:
                structure.insert(0, emote_structure)
            
        
        self.createSpeedChatObject(structure)
        
        def listenForSCEvent(eventBaseName, handler, self = self):
            eventName = self.speedChat.getEventName(eventBaseName)
            self.accept(eventName, handler)

        listenForSCEvent(SpeedChatGlobals.SCTerminalLinkedEmoteEvent, self.handleLinkedEmote)
        self.fsm = ClassicFSM.ClassicFSM('SpeedChat', [
            State.State('off', self.enterOff, self.exitOff, [
                'active']),
            State.State('active', self.enterActive, self.exitActive, [
                'off'])], 'off', 'off')
        self.fsm.enterInitialState()
        self.mode = 'AllChat'
        self.whisperId = None