def addWhiteList(self):
     if self.whiteList == None:
         TTSCWhiteListTerminal = TTSCWhiteListTerminal
         import toontown.chat.TTSCWhiteListTerminal
         self.whiteList = TTSCWhiteListTerminal(4, self)
         self.speedChat[1:1] = [
             self.whiteList]
示例#2
0
 def addWhiteList(self):
     if self.whiteList == None:
         TTSCWhiteListTerminal = TTSCWhiteListTerminal
         import toontown.chat.TTSCWhiteListTerminal
         self.whiteList = TTSCWhiteListTerminal(4, self)
         self.speedChat[1:1] = [self.whiteList]
示例#3
0
class TTChatInputSpeedChat(DirectObject.DirectObject):
    DefaultSCColorScheme = SCColorScheme()

    def __init__(self, chatMgr):
        self.chatMgr = chatMgr
        self.whisperAvatarId = None
        self.toPlayer = 0
        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
        okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'),
                         buttons.find('**/ChtBx_OKBtn_DN'),
                         buttons.find('**/ChtBx_OKBtn_Rllvr'))
        self.emoteNoAccessPanel = DirectFrame(
            parent=hidden,
            relief=None,
            state='normal',
            text=OTPLocalizer.SCEmoteNoAccessMsg,
            frameSize=(-1, 1, -1, 1),
            geom=DGG.getDefaultDialogGeom(),
            geom_color=OTPGlobals.GlobalDialogColor,
            geom_scale=(0.92000000000000004, 1, 0.59999999999999998),
            geom_pos=(0, 0, -0.080000000000000002),
            text_scale=0.080000000000000002)
        self.okButton = DirectButton(parent=self.emoteNoAccessPanel,
                                     image=okButtonImage,
                                     relief=None,
                                     text=OTPLocalizer.SCEmoteNoAccessOK,
                                     text_scale=0.050000000000000003,
                                     text_pos=(0.0, -0.10000000000000001),
                                     textMayChange=0,
                                     pos=(0.0, 0.0, -0.20000000000000001),
                                     command=self.handleEmoteNoAccessDone)
        self.insidePartiesMenu = None
        self.createSpeedChat()
        self.whiteList = None
        self.allowWhiteListSpeedChat = base.config.GetBool(
            'white-list-speed-chat', 0)
        if self.allowWhiteListSpeedChat:
            self.addWhiteList()

        self.factoryMenu = None
        self.kartRacingMenu = None
        self.cogMenu = None
        self.cfoMenu = None
        self.cjMenu = None
        self.ceoMenu = None
        self.golfMenu = None
        self.boardingGroupMenu = None
        self.singingGroupMenu = None
        self.aprilToonsMenu = None
        self.victoryPartiesMenu = None
        self.sillyPhaseOneMenu = None
        self.sillyPhaseTwoMenu = None
        self.sillyPhaseThreeMenu = None
        self.sillyPhaseFourMenu = None
        self.sillyPhaseFiveMenu = None
        self.sellbotNerfMenu = None
        self.jellybeanJamMenu = None
        self.halloweenMenu = None
        self.winterMenu = None
        self.sellbotInvasionMenu = None
        self.sellbotFieldOfficeMenu = None
        self.idesOfMarchMenu = None

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

        listenForSCEvent(SpeedChatGlobals.SCTerminalLinkedEmoteEvent,
                         self.handleLinkedEmote)
        listenForSCEvent(SpeedChatGlobals.SCStaticTextMsgEvent,
                         self.handleStaticTextMsg)
        listenForSCEvent(SpeedChatGlobals.SCCustomMsgEvent,
                         self.handleCustomMsg)
        listenForSCEvent(SpeedChatGlobals.SCEmoteMsgEvent, self.handleEmoteMsg)
        listenForSCEvent(SpeedChatGlobals.SCEmoteNoAccessEvent,
                         self.handleEmoteNoAccess)
        listenForSCEvent(TTSpeedChatGlobals.TTSCToontaskMsgEvent,
                         self.handleToontaskMsg)
        listenForSCEvent(TTSpeedChatGlobals.TTSCResistanceMsgEvent,
                         self.handleResistanceMsg)
        listenForSCEvent(TTSCSingingTerminal.TTSCSingingMsgEvent,
                         self.handleSingingMsg)
        listenForSCEvent('SpeedChatStyleChange',
                         self.handleSpeedChatStyleChange)
        listenForSCEvent(TTSCIndexedTerminal.TTSCIndexedMsgEvent,
                         self.handleStaticTextMsg)
        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()

    def delete(self):
        self.ignoreAll()
        self.removeWhiteList()
        self.okButton.destroy()
        self.emoteNoAccessPanel.destroy()
        del self.emoteNoAccessPanel
        self.speedChat.destroy()
        del self.speedChat
        del self.fsm
        del self.chatMgr

    def show(self, whisperAvatarId=None, toPlayer=0):
        self.whisperAvatarId = whisperAvatarId
        self.toPlayer = toPlayer
        self.fsm.request('active')

    def hide(self):
        self.fsm.request('off')

    def createSpeedChat(self):
        structure = []
        if launcher or not launcher.isTestServer() or __dev__:
            structure.append(
                [TTSCPromotionalMenu, OTPLocalizer.SCMenuPromotion])

        structure.append([SCEmoteMenu, OTPLocalizer.SCMenuEmotions])
        structure.append([SCCustomMenu, OTPLocalizer.SCMenuCustom])
        structure.append([TTSCResistanceMenu, OTPLocalizer.SCMenuResistance])
        if hasattr(base, 'wantPets') and base.wantPets:
            structure += scPetMenuStructure

        structure += scStructure
        self.createSpeedChatObject(structure)

    def enterOff(self):
        pass

    def exitOff(self):
        pass

    def enterActive(self):
        def handleCancel(self=self):
            self.chatMgr.fsm.request('mainMenu')

        self.accept('mouse1', handleCancel)

        def selectionMade(self=self):
            self.chatMgr.fsm.request('mainMenu')

        self.terminalSelectedEvent = self.speedChat.getEventName(
            SpeedChatGlobals.SCTerminalSelectedEvent)
        if base.config.GetBool('want-sc-auto-hide', 1):
            self.accept(self.terminalSelectedEvent, selectionMade)

        self.speedChat.reparentTo(aspect2dp, DGG.FOREGROUND_SORT_INDEX)
        scZ = 0.95999999999999996
        self.speedChat.setPos(-1.05, 0, scZ)
        self.speedChat.setWhisperMode(self.whisperAvatarId != None)
        self.speedChat.enter()

    def exitActive(self):
        self.ignore('mouse1')
        self.ignore(self.terminalSelectedEvent)
        self.speedChat.exit()
        self.speedChat.reparentTo(hidden)
        self.emoteNoAccessPanel.reparentTo(hidden)

    def handleLinkedEmote(self, emoteId):
        if self.whisperAvatarId is None:
            lt = base.localAvatar
            lt.b_setEmoteState(emoteId, animMultiplier=lt.animMultiplier)

    def handleStaticTextMsg(self, textId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCChatMessage(textId)
        else:
            self.chatMgr.sendSCWhisperMessage(textId, self.whisperAvatarId,
                                              self.toPlayer)
        self.toPlayer = 0

    def handleSingingMsg(self, textId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCSingingChatMessage(textId)
        else:
            self.chatMgr.sendSCSingingWhisperMessage(textId)
        self.toPlayer = 0

    def handleCustomMsg(self, textId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCCustomChatMessage(textId)
        else:
            self.chatMgr.sendSCCustomWhisperMessage(textId,
                                                    self.whisperAvatarId,
                                                    self.toPlayer)
        self.toPlayer = 0

    def handleEmoteMsg(self, emoteId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCEmoteChatMessage(emoteId)
        else:
            self.chatMgr.sendSCEmoteWhisperMessage(emoteId,
                                                   self.whisperAvatarId,
                                                   self.toPlayer)
        self.toPlayer = 0

    def handleEmoteNoAccess(self):
        if self.whisperAvatarId is None:
            self.emoteNoAccessPanel.setPos(0, 0, 0)
        else:
            self.emoteNoAccessPanel.setPos(0.37, 0, 0)
        self.emoteNoAccessPanel.reparentTo(aspect2d)

    def handleEmoteNoAccessDone(self):
        self.emoteNoAccessPanel.reparentTo(hidden)

    def handleToontaskMsg(self, taskId, toNpcId, toonProgress, msgIndex):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCToontaskChatMessage(taskId, toNpcId,
                                                   toonProgress, msgIndex)
        else:
            self.chatMgr.sendSCToontaskWhisperMessage(taskId, toNpcId,
                                                      toonProgress, msgIndex,
                                                      self.whisperAvatarId,
                                                      self.toPlayer)
        self.toPlayer = 0

    def handleResistanceMsg(self, textId):
        self.chatMgr.sendSCResistanceChatMessage(textId)

    def handleSpeedChatStyleChange(self):
        (nameKey, arrowColor, rolloverColor, frameColor
         ) = speedChatStyles[base.localAvatar.getSpeedChatStyleIndex()]
        newSCColorScheme = SCColorScheme(arrowColor=arrowColor,
                                         rolloverColor=rolloverColor,
                                         frameColor=frameColor)
        self.speedChat.setColorScheme(newSCColorScheme)

    def createSpeedChatObject(self, structure):
        if hasattr(self, 'speedChat'):
            self.speedChat.exit()
            self.speedChat.destroy()
            del self.speedChat

        self.speedChat = SpeedChat(
            structure=structure,
            backgroundModelName='phase_3/models/gui/ChatPanel',
            guiModelName='phase_3.5/models/gui/speedChatGui')
        self.speedChat.setScale(TTLocalizer.TTCISCspeedChat)
        self.speedChat.setBin('gui-popup', 0)
        self.speedChat.setTopLevelOverlap(TTLocalizer.TTCISCtopLevelOverlap)
        self.speedChat.setColorScheme(self.DefaultSCColorScheme)
        self.speedChat.finalizeAll()

    def addFactoryMenu(self):
        if self.factoryMenu == None:
            menu = TTSCFactoryMenu()
            self.factoryMenu = SCMenuHolder(OTPLocalizer.SCMenuFactory,
                                            menu=menu)
            self.speedChat[2:2] = [self.factoryMenu]

    def removeFactoryMenu(self):
        if self.factoryMenu:
            i = self.speedChat.index(self.factoryMenu)
            del self.speedChat[i]
            self.factoryMenu.destroy()
            self.factoryMenu = None

    def addKartRacingMenu(self):
        if self.kartRacingMenu == None:
            menu = TTSCKartRacingMenu()
            self.kartRacingMenu = SCMenuHolder(OTPLocalizer.SCMenuKartRacing,
                                               menu=menu)
            self.speedChat[2:2] = [self.kartRacingMenu]

    def removeKartRacingMenu(self):
        if self.kartRacingMenu:
            i = self.speedChat.index(self.kartRacingMenu)
            del self.speedChat[i]
            self.kartRacingMenu.destroy()
            self.kartRacingMenu = None

    def addCogMenu(self, indices):
        if self.cogMenu == None:
            menu = TTSCCogMenu(indices)
            self.cogMenu = SCMenuHolder(OTPLocalizer.SCMenuCog, menu=menu)
            self.speedChat[2:2] = [self.cogMenu]

    def removeCogMenu(self):
        if self.cogMenu:
            i = self.speedChat.index(self.cogMenu)
            del self.speedChat[i]
            self.cogMenu.destroy()
            self.cogMenu = None

    def addCFOMenu(self):
        if self.cfoMenu == None:
            menu = SCMenu()
            menu.rebuildFromStructure(cfoMenuStructure)
            self.cfoMenu = SCMenuHolder(OTPLocalizer.SCMenuCFOBattle,
                                        menu=menu)
            self.speedChat[2:2] = [self.cfoMenu]

    def removeCFOMenu(self):
        if self.cfoMenu:
            i = self.speedChat.index(self.cfoMenu)
            del self.speedChat[i]
            self.cfoMenu.destroy()
            self.cfoMenu = None

    def addCJMenu(self, bonusWeight=-1):
        if self.cjMenu == None:
            menu = SCMenu()
            myMenuCopy = cjMenuStructure[:]
            if bonusWeight >= 0:
                myMenuCopy.append(2211 + bonusWeight)

            menu.rebuildFromStructure(myMenuCopy)
            self.cjMenu = SCMenuHolder(OTPLocalizer.SCMenuCJBattle, menu=menu)
            self.speedChat[2:2] = [self.cjMenu]

    def removeCJMenu(self):
        if self.cjMenu:
            i = self.speedChat.index(self.cjMenu)
            del self.speedChat[i]
            self.cjMenu.destroy()
            self.cjMenu = None

    def addCEOMenu(self):
        if self.ceoMenu == None:
            menu = SCMenu()
            menu.rebuildFromStructure(ceoMenuStructure)
            self.ceoMenu = SCMenuHolder(OTPLocalizer.SCMenuCEOBattle,
                                        menu=menu)
            self.speedChat[2:2] = [self.ceoMenu]

    def removeCEOMenu(self):
        if self.ceoMenu:
            i = self.speedChat.index(self.ceoMenu)
            del self.speedChat[i]
            self.ceoMenu.destroy()
            self.ceoMenu = None

    def addInsidePartiesMenu(self):
        def isActivityInParty(activityId):
            activityList = base.distributedParty.partyInfo.activityList
            for activity in activityList:
                if activity.activityId == activityId:
                    return True
                    continue

            return False

        def isDecorInParty(decorId):
            decorList = base.distributedParty.partyInfo.decors
            for decor in decorList:
                if decor.decorId == decorId:
                    return True
                    continue

            return False

        insidePartiesMenuStructure = [5305, 5306, 5307, 5308, 5309]
        if self.insidePartiesMenu == None:
            menu = SCMenu()
            if hasattr(base, 'distributedParty') and base.distributedParty:
                if base.distributedParty.partyInfo.hostId == localAvatar.doId:
                    insidePartiesMenuStructure.insert(0, 5304)

                if isActivityInParty(0):
                    insidePartiesMenuStructure.extend([5310, 5311])

                if isActivityInParty(1):
                    insidePartiesMenuStructure.append(5312)

                if isActivityInParty(2):
                    insidePartiesMenuStructure.extend([5313, 5314])

                if isActivityInParty(3):
                    insidePartiesMenuStructure.append(5315)

                if isActivityInParty(4):
                    insidePartiesMenuStructure.extend([5316, 5317])

                if isActivityInParty(5):
                    insidePartiesMenuStructure.append(5318)

                if isActivityInParty(6):
                    insidePartiesMenuStructure.extend([5319, 5320])

                if len(base.distributedParty.partyInfo.decors):
                    insidePartiesMenuStructure.append(5321)
                    if isDecorInParty(3):
                        insidePartiesMenuStructure.append(5322)

            menu.rebuildFromStructure(insidePartiesMenuStructure)
            self.insidePartiesMenu = SCMenuHolder(OTPLocalizer.SCMenuParties,
                                                  menu=menu)
            self.speedChat[2:2] = [self.insidePartiesMenu]

    def removeInsidePartiesMenu(self):
        if self.insidePartiesMenu:
            i = self.speedChat.index(self.insidePartiesMenu)
            del self.speedChat[i]
            self.insidePartiesMenu.destroy()
            self.insidePartiesMenu = None

    def addGolfMenu(self):
        if self.golfMenu == None:
            menu = TTSCGolfMenu()
            self.golfMenu = SCMenuHolder(OTPLocalizer.SCMenuGolf, menu=menu)
            self.speedChat[2:2] = [self.golfMenu]

    def removeGolfMenu(self):
        if self.golfMenu:
            i = self.speedChat.index(self.golfMenu)
            del self.speedChat[i]
            self.golfMenu.destroy()
            self.golfMenu = None

    def addBoardingGroupMenu(self, zoneId):
        if self.boardingGroupMenu == None:
            menu = TTSCBoardingMenu(zoneId)
            self.boardingGroupMenu = SCMenuHolder(
                OTPLocalizer.SCMenuBoardingGroup, menu=menu)
            self.speedChat[2:2] = [self.boardingGroupMenu]

    def removeBoardingGroupMenu(self):
        if self.boardingGroupMenu:
            i = self.speedChat.index(self.boardingGroupMenu)
            del self.speedChat[i]
            self.boardingGroupMenu.destroy()
            self.boardingGroupMenu = None

    def addSingingGroupMenu(self):
        if self.singingGroupMenu == None:
            menu = TTSCSingingMenu()
            self.singingGroupMenu = SCMenuHolder(
                OTPLocalizer.SCMenuSingingGroup, menu=menu)
            self.speedChat[2:2] = [self.singingGroupMenu]

    def removeSingingMenu(self):
        if self.singingGroupMenu:
            i = self.speedChat.index(self.singingGroupMenu)
            del self.speedChat[i]
            self.singingGroupMenu.destroy()
            self.singingGroupMenu = None

    def addAprilToonsMenu(self):
        if self.aprilToonsMenu == None:
            menu = TTSCAprilToonsMenu()
            self.aprilToonsMenu = SCMenuHolder(OTPLocalizer.SCMenuAprilToons,
                                               menu=menu)
            self.speedChat[3:3] = [self.aprilToonsMenu]

    def removeAprilToonsMenu(self):
        if self.aprilToonsMenu:
            i = self.speedChat.index(self.aprilToonsMenu)
            del self.speedChat[i]
            self.aprilToonsMenu.destroy()
            self.aprilToonsMenu = None

    def addSillyPhaseOneMenu(self):
        if self.sillyPhaseOneMenu == None:
            menu = TTSCSillyPhaseOneMenu()
            self.sillyPhaseOneMenu = SCMenuHolder(
                OTPLocalizer.SCMenuSillyHoliday, menu=menu)
            self.speedChat[3:3] = [self.sillyPhaseOneMenu]

    def removeSillyPhaseOneMenu(self):
        if self.sillyPhaseOneMenu:
            i = self.speedChat.index(self.sillyPhaseOneMenu)
            del self.speedChat[i]
            self.sillyPhaseOneMenu.destroy()
            self.sillyPhaseOneMenu = None

    def addSillyPhaseTwoMenu(self):
        if self.sillyPhaseTwoMenu == None:
            menu = TTSCSillyPhaseTwoMenu()
            self.sillyPhaseTwoMenu = SCMenuHolder(
                OTPLocalizer.SCMenuSillyHoliday, menu=menu)
            self.speedChat[3:3] = [self.sillyPhaseTwoMenu]

    def removeSillyPhaseTwoMenu(self):
        if self.sillyPhaseTwoMenu:
            i = self.speedChat.index(self.sillyPhaseTwoMenu)
            del self.speedChat[i]
            self.sillyPhaseTwoMenu.destroy()
            self.sillyPhaseTwoMenu = None

    def addSillyPhaseThreeMenu(self):
        if self.sillyPhaseThreeMenu == None:
            menu = TTSCSillyPhaseThreeMenu()
            self.sillyPhaseThreeMenu = SCMenuHolder(
                OTPLocalizer.SCMenuSillyHoliday, menu=menu)
            self.speedChat[3:3] = [self.sillyPhaseThreeMenu]

    def removeSillyPhaseThreeMenu(self):
        if self.sillyPhaseThreeMenu:
            i = self.speedChat.index(self.sillyPhaseThreeMenu)
            del self.speedChat[i]
            self.sillyPhaseThreeMenu.destroy()
            self.sillyPhaseThreeMenu = None

    def addSillyPhaseFourMenu(self):
        if self.sillyPhaseFourMenu == None:
            menu = TTSCSillyPhaseFourMenu()
            self.sillyPhaseFourMenu = SCMenuHolder(
                OTPLocalizer.SCMenuSillyHoliday, menu=menu)
            self.speedChat[3:3] = [self.sillyPhaseFourMenu]

    def removeSillyPhaseFourMenu(self):
        if self.sillyPhaseFourMenu:
            i = self.speedChat.index(self.sillyPhaseFourMenu)
            del self.speedChat[i]
            self.sillyPhaseFourMenu.destroy()
            self.sillyPhaseFourMenu = None

    def addSillyPhaseFiveMenu(self):
        if self.sillyPhaseFiveMenu == None:
            menu = TTSCSillyPhaseFiveMenu()
            self.sillyPhaseFiveMenu = SCMenuHolder(
                OTPLocalizer.SCMenuSillyHoliday, menu=menu)
            self.speedChat[3:3] = [self.sillyPhaseFiveMenu]

    def removeSillyPhaseFiveMenu(self):
        if self.sillyPhaseFiveMenu:
            i = self.speedChat.index(self.sillyPhaseFiveMenu)
            del self.speedChat[i]
            self.sillyPhaseFiveMenu.destroy()
            self.sillyPhaseFiveMenu = None

    def addVictoryPartiesMenu(self):
        if self.victoryPartiesMenu == None:
            menu = TTSCVictoryPartiesMenu()
            self.victoryPartiesMenu = SCMenuHolder(
                OTPLocalizer.SCMenuVictoryParties, menu=menu)
            self.speedChat[3:3] = [self.victoryPartiesMenu]

    def removeVictoryPartiesMenu(self):
        if self.victoryPartiesMenu:
            i = self.speedChat.index(self.victoryPartiesMenu)
            del self.speedChat[i]
            self.victoryPartiesMenu.destroy()
            self.victoryPartiesMenu = None

    def addSellbotNerfMenu(self):
        if self.sellbotNerfMenu == None:
            menu = TTSCSellbotNerfMenu()
            self.sellbotNerfMenu = SCMenuHolder(OTPLocalizer.SCMenuSellbotNerf,
                                                menu=menu)
            self.speedChat[2:2] = [self.sellbotNerfMenu]

    def removeSellbotNerfMenu(self):
        if self.sellbotNerfMenu:
            i = self.speedChat.index(self.sellbotNerfMenu)
            del self.speedChat[i]
            self.sellbotNerfMenu.destroy()
            self.sellbotNerfMenu = None

    def addJellybeanJamMenu(self, phase):
        if self.jellybeanJamMenu == None:
            menu = TTSCJellybeanJamMenu(phase)
            self.jellybeanJamMenu = SCMenuHolder(
                OTPLocalizer.SCMenuJellybeanJam, menu=menu)
            self.speedChat[2:2] = [self.jellybeanJamMenu]

    def removeJellybeanJamMenu(self):
        if self.jellybeanJamMenu:
            i = self.speedChat.index(self.jellybeanJamMenu)
            del self.speedChat[i]
            self.jellybeanJamMenu.destroy()
            self.jellybeanJamMenu = None

    def addHalloweenMenu(self):
        if self.halloweenMenu == None:
            menu = TTSCHalloweenMenu()
            self.halloweenMenu = SCMenuHolder(OTPLocalizer.SCMenuHalloween,
                                              menu=menu)
            self.speedChat[2:2] = [self.halloweenMenu]

    def removeHalloweenMenu(self):
        if self.halloweenMenu:
            i = self.speedChat.index(self.halloweenMenu)
            del self.speedChat[i]
            self.halloweenMenu.destroy()
            self.halloweenMenu = None

    def addWinterMenu(self, carol=False):
        if self.winterMenu == None:
            menu = TTSCWinterMenu(carol)
            self.winterMenu = SCMenuHolder(OTPLocalizer.SCMenuWinter,
                                           menu=menu)
            self.speedChat[2:2] = [self.winterMenu]

    def removeWinterMenu(self):
        if self.winterMenu:
            i = self.speedChat.index(self.winterMenu)
            del self.speedChat[i]
            self.winterMenu.destroy()
            self.winterMenu = None

    def addCarolMenu(self):
        self.removeWinterMenu()
        self.addWinterMenu(carol=True)

    def removeCarolMenu(self):
        pass

    def addWhiteList(self):
        if self.whiteList == None:
            TTSCWhiteListTerminal = TTSCWhiteListTerminal
            import toontown.chat.TTSCWhiteListTerminal
            self.whiteList = TTSCWhiteListTerminal(4, self)
            self.speedChat[1:1] = [self.whiteList]

    def removeWhiteList(self):
        if self.whiteList:
            i = self.speedChat.index(self.whiteList)
            del self.speedChat[i]
            self.whiteList.destroy()
            self.whiteList = None

    def addSellbotInvasionMenu(self):
        if self.sellbotInvasionMenu == None:
            menu = TTSCSellbotInvasionMenu()
            self.sellbotInvasionMenu = SCMenuHolder(
                OTPLocalizer.SCMenuSellbotInvasion, menu=menu)
            self.speedChat[2:2] = [self.sellbotInvasionMenu]

    def removeSellbotInvasionMenu(self):
        if self.sellbotInvasionMenu:
            i = self.speedChat.index(self.sellbotInvasionMenu)
            del self.speedChat[i]
            self.sellbotInvasionMenu.destroy()
            self.sellbotInvasionMenu = None

    def addSellbotFieldOfficeMenu(self):
        if self.sellbotFieldOfficeMenu == None:
            menu = TTSCSellbotFieldOfficeMenu()
            self.sellbotFieldOfficeMenu = SCMenuHolder(
                OTPLocalizer.SCMenuFieldOffice, menu=menu)
            self.speedChat[2:2] = [self.sellbotFieldOfficeMenu]

    def removeSellbotFieldOfficeMenu(self):
        if self.sellbotFieldOfficeMenu:
            i = self.speedChat.index(self.sellbotFieldOfficeMenu)
            del self.speedChat[i]
            self.sellbotFieldOfficeMenu.destroy()
            self.sellbotFieldOfficeMenu = None

    def addIdesOfMarchMenu(self):
        if self.idesOfMarchMenu == None:
            menu = TTSCIdesOfMarchMenu()
            self.idesOfMarchMenu = SCMenuHolder(OTPLocalizer.SCMenuIdesOfMarch,
                                                menu=menu)
            self.speedChat[2:2] = [self.idesOfMarchMenu]

    def removeIdesOfMarchMenu(self):
        if self.idesOfMarchMenu:
            i = self.speedChat.index(self.idesOfMarchMenu)
            del self.speedChat[i]
            self.idesOfMarchMenu.destroy()
            self.idesOfMarchMenu = None
class TTChatInputSpeedChat(DirectObject.DirectObject):
    DefaultSCColorScheme = SCColorScheme()
    
    def __init__(self, chatMgr):
        self.chatMgr = chatMgr
        self.whisperAvatarId = None
        self.toPlayer = 0
        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
        okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
        self.emoteNoAccessPanel = DirectFrame(parent = hidden, relief = None, state = 'normal', text = OTPLocalizer.SCEmoteNoAccessMsg, frameSize = (-1, 1, -1, 1), geom = DGG.getDefaultDialogGeom(), geom_color = OTPGlobals.GlobalDialogColor, geom_scale = (0.92000000000000004, 1, 0.59999999999999998), geom_pos = (0, 0, -0.080000000000000002), text_scale = 0.080000000000000002)
        self.okButton = DirectButton(parent = self.emoteNoAccessPanel, image = okButtonImage, relief = None, text = OTPLocalizer.SCEmoteNoAccessOK, text_scale = 0.050000000000000003, text_pos = (0.0, -0.10000000000000001), textMayChange = 0, pos = (0.0, 0.0, -0.20000000000000001), command = self.handleEmoteNoAccessDone)
        self.insidePartiesMenu = None
        self.createSpeedChat()
        self.whiteList = None
        self.allowWhiteListSpeedChat = base.config.GetBool('white-list-speed-chat', 0)
        if self.allowWhiteListSpeedChat:
            self.addWhiteList()
        
        self.factoryMenu = None
        self.kartRacingMenu = None
        self.cogMenu = None
        self.cfoMenu = None
        self.cjMenu = None
        self.ceoMenu = None
        self.golfMenu = None
        self.boardingGroupMenu = None
        self.singingGroupMenu = None
        self.aprilToonsMenu = None
        self.victoryPartiesMenu = None
        self.sillyPhaseOneMenu = None
        self.sillyPhaseTwoMenu = None
        self.sillyPhaseThreeMenu = None
        self.sillyPhaseFourMenu = None
        self.sillyPhaseFiveMenu = None
        self.sellbotNerfMenu = None
        self.jellybeanJamMenu = None
        self.halloweenMenu = None
        self.winterMenu = None
        self.sellbotInvasionMenu = None
        self.sellbotFieldOfficeMenu = None
        self.idesOfMarchMenu = None
        
        def listenForSCEvent(eventBaseName, handler, self = self):
            eventName = self.speedChat.getEventName(eventBaseName)
            self.accept(eventName, handler)

        listenForSCEvent(SpeedChatGlobals.SCTerminalLinkedEmoteEvent, self.handleLinkedEmote)
        listenForSCEvent(SpeedChatGlobals.SCStaticTextMsgEvent, self.handleStaticTextMsg)
        listenForSCEvent(SpeedChatGlobals.SCCustomMsgEvent, self.handleCustomMsg)
        listenForSCEvent(SpeedChatGlobals.SCEmoteMsgEvent, self.handleEmoteMsg)
        listenForSCEvent(SpeedChatGlobals.SCEmoteNoAccessEvent, self.handleEmoteNoAccess)
        listenForSCEvent(TTSpeedChatGlobals.TTSCToontaskMsgEvent, self.handleToontaskMsg)
        listenForSCEvent(TTSpeedChatGlobals.TTSCResistanceMsgEvent, self.handleResistanceMsg)
        listenForSCEvent(TTSCSingingTerminal.TTSCSingingMsgEvent, self.handleSingingMsg)
        listenForSCEvent('SpeedChatStyleChange', self.handleSpeedChatStyleChange)
        listenForSCEvent(TTSCIndexedTerminal.TTSCIndexedMsgEvent, self.handleStaticTextMsg)
        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()

    
    def delete(self):
        self.ignoreAll()
        self.removeWhiteList()
        self.okButton.destroy()
        self.emoteNoAccessPanel.destroy()
        del self.emoteNoAccessPanel
        self.speedChat.destroy()
        del self.speedChat
        del self.fsm
        del self.chatMgr

    
    def show(self, whisperAvatarId = None, toPlayer = 0):
        self.whisperAvatarId = whisperAvatarId
        self.toPlayer = toPlayer
        self.fsm.request('active')

    
    def hide(self):
        self.fsm.request('off')

    
    def createSpeedChat(self):
        structure = []
        if launcher or not launcher.isTestServer() or __dev__:
            structure.append([
                TTSCPromotionalMenu,
                OTPLocalizer.SCMenuPromotion])
        
        structure.append([
            SCEmoteMenu,
            OTPLocalizer.SCMenuEmotions])
        structure.append([
            SCCustomMenu,
            OTPLocalizer.SCMenuCustom])
        structure.append([
            TTSCResistanceMenu,
            OTPLocalizer.SCMenuResistance])
        if hasattr(base, 'wantPets') and base.wantPets:
            structure += scPetMenuStructure
        
        structure += scStructure
        self.createSpeedChatObject(structure)

    
    def enterOff(self):
        pass

    
    def exitOff(self):
        pass

    
    def enterActive(self):
        
        def handleCancel(self = self):
            self.chatMgr.fsm.request('mainMenu')

        self.accept('mouse1', handleCancel)
        
        def selectionMade(self = self):
            self.chatMgr.fsm.request('mainMenu')

        self.terminalSelectedEvent = self.speedChat.getEventName(SpeedChatGlobals.SCTerminalSelectedEvent)
        if base.config.GetBool('want-sc-auto-hide', 1):
            self.accept(self.terminalSelectedEvent, selectionMade)
        
        self.speedChat.reparentTo(aspect2dp, DGG.FOREGROUND_SORT_INDEX)
        scZ = 0.95999999999999996
        self.speedChat.setPos(-1.05, 0, scZ)
        self.speedChat.setWhisperMode(self.whisperAvatarId != None)
        self.speedChat.enter()

    
    def exitActive(self):
        self.ignore('mouse1')
        self.ignore(self.terminalSelectedEvent)
        self.speedChat.exit()
        self.speedChat.reparentTo(hidden)
        self.emoteNoAccessPanel.reparentTo(hidden)

    
    def handleLinkedEmote(self, emoteId):
        if self.whisperAvatarId is None:
            lt = base.localAvatar
            lt.b_setEmoteState(emoteId, animMultiplier = lt.animMultiplier)
        

    
    def handleStaticTextMsg(self, textId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCChatMessage(textId)
        else:
            self.chatMgr.sendSCWhisperMessage(textId, self.whisperAvatarId, self.toPlayer)
        self.toPlayer = 0

    
    def handleSingingMsg(self, textId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCSingingChatMessage(textId)
        else:
            self.chatMgr.sendSCSingingWhisperMessage(textId)
        self.toPlayer = 0

    
    def handleCustomMsg(self, textId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCCustomChatMessage(textId)
        else:
            self.chatMgr.sendSCCustomWhisperMessage(textId, self.whisperAvatarId, self.toPlayer)
        self.toPlayer = 0

    
    def handleEmoteMsg(self, emoteId):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCEmoteChatMessage(emoteId)
        else:
            self.chatMgr.sendSCEmoteWhisperMessage(emoteId, self.whisperAvatarId, self.toPlayer)
        self.toPlayer = 0

    
    def handleEmoteNoAccess(self):
        if self.whisperAvatarId is None:
            self.emoteNoAccessPanel.setPos(0, 0, 0)
        else:
            self.emoteNoAccessPanel.setPos(0.37, 0, 0)
        self.emoteNoAccessPanel.reparentTo(aspect2d)

    
    def handleEmoteNoAccessDone(self):
        self.emoteNoAccessPanel.reparentTo(hidden)

    
    def handleToontaskMsg(self, taskId, toNpcId, toonProgress, msgIndex):
        if self.whisperAvatarId is None:
            self.chatMgr.sendSCToontaskChatMessage(taskId, toNpcId, toonProgress, msgIndex)
        else:
            self.chatMgr.sendSCToontaskWhisperMessage(taskId, toNpcId, toonProgress, msgIndex, self.whisperAvatarId, self.toPlayer)
        self.toPlayer = 0

    
    def handleResistanceMsg(self, textId):
        self.chatMgr.sendSCResistanceChatMessage(textId)

    
    def handleSpeedChatStyleChange(self):
        (nameKey, arrowColor, rolloverColor, frameColor) = speedChatStyles[base.localAvatar.getSpeedChatStyleIndex()]
        newSCColorScheme = SCColorScheme(arrowColor = arrowColor, rolloverColor = rolloverColor, frameColor = frameColor)
        self.speedChat.setColorScheme(newSCColorScheme)

    
    def createSpeedChatObject(self, structure):
        if hasattr(self, 'speedChat'):
            self.speedChat.exit()
            self.speedChat.destroy()
            del self.speedChat
        
        self.speedChat = SpeedChat(structure = structure, backgroundModelName = 'phase_3/models/gui/ChatPanel', guiModelName = 'phase_3.5/models/gui/speedChatGui')
        self.speedChat.setScale(TTLocalizer.TTCISCspeedChat)
        self.speedChat.setBin('gui-popup', 0)
        self.speedChat.setTopLevelOverlap(TTLocalizer.TTCISCtopLevelOverlap)
        self.speedChat.setColorScheme(self.DefaultSCColorScheme)
        self.speedChat.finalizeAll()

    
    def addFactoryMenu(self):
        if self.factoryMenu == None:
            menu = TTSCFactoryMenu()
            self.factoryMenu = SCMenuHolder(OTPLocalizer.SCMenuFactory, menu = menu)
            self.speedChat[2:2] = [
                self.factoryMenu]
        

    
    def removeFactoryMenu(self):
        if self.factoryMenu:
            i = self.speedChat.index(self.factoryMenu)
            del self.speedChat[i]
            self.factoryMenu.destroy()
            self.factoryMenu = None
        

    
    def addKartRacingMenu(self):
        if self.kartRacingMenu == None:
            menu = TTSCKartRacingMenu()
            self.kartRacingMenu = SCMenuHolder(OTPLocalizer.SCMenuKartRacing, menu = menu)
            self.speedChat[2:2] = [
                self.kartRacingMenu]
        

    
    def removeKartRacingMenu(self):
        if self.kartRacingMenu:
            i = self.speedChat.index(self.kartRacingMenu)
            del self.speedChat[i]
            self.kartRacingMenu.destroy()
            self.kartRacingMenu = None
        

    
    def addCogMenu(self, indices):
        if self.cogMenu == None:
            menu = TTSCCogMenu(indices)
            self.cogMenu = SCMenuHolder(OTPLocalizer.SCMenuCog, menu = menu)
            self.speedChat[2:2] = [
                self.cogMenu]
        

    
    def removeCogMenu(self):
        if self.cogMenu:
            i = self.speedChat.index(self.cogMenu)
            del self.speedChat[i]
            self.cogMenu.destroy()
            self.cogMenu = None
        

    
    def addCFOMenu(self):
        if self.cfoMenu == None:
            menu = SCMenu()
            menu.rebuildFromStructure(cfoMenuStructure)
            self.cfoMenu = SCMenuHolder(OTPLocalizer.SCMenuCFOBattle, menu = menu)
            self.speedChat[2:2] = [
                self.cfoMenu]
        

    
    def removeCFOMenu(self):
        if self.cfoMenu:
            i = self.speedChat.index(self.cfoMenu)
            del self.speedChat[i]
            self.cfoMenu.destroy()
            self.cfoMenu = None
        

    
    def addCJMenu(self, bonusWeight = -1):
        if self.cjMenu == None:
            menu = SCMenu()
            myMenuCopy = cjMenuStructure[:]
            if bonusWeight >= 0:
                myMenuCopy.append(2211 + bonusWeight)
            
            menu.rebuildFromStructure(myMenuCopy)
            self.cjMenu = SCMenuHolder(OTPLocalizer.SCMenuCJBattle, menu = menu)
            self.speedChat[2:2] = [
                self.cjMenu]
        

    
    def removeCJMenu(self):
        if self.cjMenu:
            i = self.speedChat.index(self.cjMenu)
            del self.speedChat[i]
            self.cjMenu.destroy()
            self.cjMenu = None
        

    
    def addCEOMenu(self):
        if self.ceoMenu == None:
            menu = SCMenu()
            menu.rebuildFromStructure(ceoMenuStructure)
            self.ceoMenu = SCMenuHolder(OTPLocalizer.SCMenuCEOBattle, menu = menu)
            self.speedChat[2:2] = [
                self.ceoMenu]
        

    
    def removeCEOMenu(self):
        if self.ceoMenu:
            i = self.speedChat.index(self.ceoMenu)
            del self.speedChat[i]
            self.ceoMenu.destroy()
            self.ceoMenu = None
        

    
    def addInsidePartiesMenu(self):
        
        def isActivityInParty(activityId):
            activityList = base.distributedParty.partyInfo.activityList
            for activity in activityList:
                if activity.activityId == activityId:
                    return True
                    continue
            
            return False

        
        def isDecorInParty(decorId):
            decorList = base.distributedParty.partyInfo.decors
            for decor in decorList:
                if decor.decorId == decorId:
                    return True
                    continue
            
            return False

        insidePartiesMenuStructure = [
            5305,
            5306,
            5307,
            5308,
            5309]
        if self.insidePartiesMenu == None:
            menu = SCMenu()
            if hasattr(base, 'distributedParty') and base.distributedParty:
                if base.distributedParty.partyInfo.hostId == localAvatar.doId:
                    insidePartiesMenuStructure.insert(0, 5304)
                
                if isActivityInParty(0):
                    insidePartiesMenuStructure.extend([
                        5310,
                        5311])
                
                if isActivityInParty(1):
                    insidePartiesMenuStructure.append(5312)
                
                if isActivityInParty(2):
                    insidePartiesMenuStructure.extend([
                        5313,
                        5314])
                
                if isActivityInParty(3):
                    insidePartiesMenuStructure.append(5315)
                
                if isActivityInParty(4):
                    insidePartiesMenuStructure.extend([
                        5316,
                        5317])
                
                if isActivityInParty(5):
                    insidePartiesMenuStructure.append(5318)
                
                if isActivityInParty(6):
                    insidePartiesMenuStructure.extend([
                        5319,
                        5320])
                
                if len(base.distributedParty.partyInfo.decors):
                    insidePartiesMenuStructure.append(5321)
                    if isDecorInParty(3):
                        insidePartiesMenuStructure.append(5322)
                    
                
            
            menu.rebuildFromStructure(insidePartiesMenuStructure)
            self.insidePartiesMenu = SCMenuHolder(OTPLocalizer.SCMenuParties, menu = menu)
            self.speedChat[2:2] = [
                self.insidePartiesMenu]
        

    
    def removeInsidePartiesMenu(self):
        if self.insidePartiesMenu:
            i = self.speedChat.index(self.insidePartiesMenu)
            del self.speedChat[i]
            self.insidePartiesMenu.destroy()
            self.insidePartiesMenu = None
        

    
    def addGolfMenu(self):
        if self.golfMenu == None:
            menu = TTSCGolfMenu()
            self.golfMenu = SCMenuHolder(OTPLocalizer.SCMenuGolf, menu = menu)
            self.speedChat[2:2] = [
                self.golfMenu]
        

    
    def removeGolfMenu(self):
        if self.golfMenu:
            i = self.speedChat.index(self.golfMenu)
            del self.speedChat[i]
            self.golfMenu.destroy()
            self.golfMenu = None
        

    
    def addBoardingGroupMenu(self, zoneId):
        if self.boardingGroupMenu == None:
            menu = TTSCBoardingMenu(zoneId)
            self.boardingGroupMenu = SCMenuHolder(OTPLocalizer.SCMenuBoardingGroup, menu = menu)
            self.speedChat[2:2] = [
                self.boardingGroupMenu]
        

    
    def removeBoardingGroupMenu(self):
        if self.boardingGroupMenu:
            i = self.speedChat.index(self.boardingGroupMenu)
            del self.speedChat[i]
            self.boardingGroupMenu.destroy()
            self.boardingGroupMenu = None
        

    
    def addSingingGroupMenu(self):
        if self.singingGroupMenu == None:
            menu = TTSCSingingMenu()
            self.singingGroupMenu = SCMenuHolder(OTPLocalizer.SCMenuSingingGroup, menu = menu)
            self.speedChat[2:2] = [
                self.singingGroupMenu]
        

    
    def removeSingingMenu(self):
        if self.singingGroupMenu:
            i = self.speedChat.index(self.singingGroupMenu)
            del self.speedChat[i]
            self.singingGroupMenu.destroy()
            self.singingGroupMenu = None
        

    
    def addAprilToonsMenu(self):
        if self.aprilToonsMenu == None:
            menu = TTSCAprilToonsMenu()
            self.aprilToonsMenu = SCMenuHolder(OTPLocalizer.SCMenuAprilToons, menu = menu)
            self.speedChat[3:3] = [
                self.aprilToonsMenu]
        

    
    def removeAprilToonsMenu(self):
        if self.aprilToonsMenu:
            i = self.speedChat.index(self.aprilToonsMenu)
            del self.speedChat[i]
            self.aprilToonsMenu.destroy()
            self.aprilToonsMenu = None
        

    
    def addSillyPhaseOneMenu(self):
        if self.sillyPhaseOneMenu == None:
            menu = TTSCSillyPhaseOneMenu()
            self.sillyPhaseOneMenu = SCMenuHolder(OTPLocalizer.SCMenuSillyHoliday, menu = menu)
            self.speedChat[3:3] = [
                self.sillyPhaseOneMenu]
        

    
    def removeSillyPhaseOneMenu(self):
        if self.sillyPhaseOneMenu:
            i = self.speedChat.index(self.sillyPhaseOneMenu)
            del self.speedChat[i]
            self.sillyPhaseOneMenu.destroy()
            self.sillyPhaseOneMenu = None
        

    
    def addSillyPhaseTwoMenu(self):
        if self.sillyPhaseTwoMenu == None:
            menu = TTSCSillyPhaseTwoMenu()
            self.sillyPhaseTwoMenu = SCMenuHolder(OTPLocalizer.SCMenuSillyHoliday, menu = menu)
            self.speedChat[3:3] = [
                self.sillyPhaseTwoMenu]
        

    
    def removeSillyPhaseTwoMenu(self):
        if self.sillyPhaseTwoMenu:
            i = self.speedChat.index(self.sillyPhaseTwoMenu)
            del self.speedChat[i]
            self.sillyPhaseTwoMenu.destroy()
            self.sillyPhaseTwoMenu = None
        

    
    def addSillyPhaseThreeMenu(self):
        if self.sillyPhaseThreeMenu == None:
            menu = TTSCSillyPhaseThreeMenu()
            self.sillyPhaseThreeMenu = SCMenuHolder(OTPLocalizer.SCMenuSillyHoliday, menu = menu)
            self.speedChat[3:3] = [
                self.sillyPhaseThreeMenu]
        

    
    def removeSillyPhaseThreeMenu(self):
        if self.sillyPhaseThreeMenu:
            i = self.speedChat.index(self.sillyPhaseThreeMenu)
            del self.speedChat[i]
            self.sillyPhaseThreeMenu.destroy()
            self.sillyPhaseThreeMenu = None
        

    
    def addSillyPhaseFourMenu(self):
        if self.sillyPhaseFourMenu == None:
            menu = TTSCSillyPhaseFourMenu()
            self.sillyPhaseFourMenu = SCMenuHolder(OTPLocalizer.SCMenuSillyHoliday, menu = menu)
            self.speedChat[3:3] = [
                self.sillyPhaseFourMenu]
        

    
    def removeSillyPhaseFourMenu(self):
        if self.sillyPhaseFourMenu:
            i = self.speedChat.index(self.sillyPhaseFourMenu)
            del self.speedChat[i]
            self.sillyPhaseFourMenu.destroy()
            self.sillyPhaseFourMenu = None
        

    
    def addSillyPhaseFiveMenu(self):
        if self.sillyPhaseFiveMenu == None:
            menu = TTSCSillyPhaseFiveMenu()
            self.sillyPhaseFiveMenu = SCMenuHolder(OTPLocalizer.SCMenuSillyHoliday, menu = menu)
            self.speedChat[3:3] = [
                self.sillyPhaseFiveMenu]
        

    
    def removeSillyPhaseFiveMenu(self):
        if self.sillyPhaseFiveMenu:
            i = self.speedChat.index(self.sillyPhaseFiveMenu)
            del self.speedChat[i]
            self.sillyPhaseFiveMenu.destroy()
            self.sillyPhaseFiveMenu = None
        

    
    def addVictoryPartiesMenu(self):
        if self.victoryPartiesMenu == None:
            menu = TTSCVictoryPartiesMenu()
            self.victoryPartiesMenu = SCMenuHolder(OTPLocalizer.SCMenuVictoryParties, menu = menu)
            self.speedChat[3:3] = [
                self.victoryPartiesMenu]
        

    
    def removeVictoryPartiesMenu(self):
        if self.victoryPartiesMenu:
            i = self.speedChat.index(self.victoryPartiesMenu)
            del self.speedChat[i]
            self.victoryPartiesMenu.destroy()
            self.victoryPartiesMenu = None
        

    
    def addSellbotNerfMenu(self):
        if self.sellbotNerfMenu == None:
            menu = TTSCSellbotNerfMenu()
            self.sellbotNerfMenu = SCMenuHolder(OTPLocalizer.SCMenuSellbotNerf, menu = menu)
            self.speedChat[2:2] = [
                self.sellbotNerfMenu]
        

    
    def removeSellbotNerfMenu(self):
        if self.sellbotNerfMenu:
            i = self.speedChat.index(self.sellbotNerfMenu)
            del self.speedChat[i]
            self.sellbotNerfMenu.destroy()
            self.sellbotNerfMenu = None
        

    
    def addJellybeanJamMenu(self, phase):
        if self.jellybeanJamMenu == None:
            menu = TTSCJellybeanJamMenu(phase)
            self.jellybeanJamMenu = SCMenuHolder(OTPLocalizer.SCMenuJellybeanJam, menu = menu)
            self.speedChat[2:2] = [
                self.jellybeanJamMenu]
        

    
    def removeJellybeanJamMenu(self):
        if self.jellybeanJamMenu:
            i = self.speedChat.index(self.jellybeanJamMenu)
            del self.speedChat[i]
            self.jellybeanJamMenu.destroy()
            self.jellybeanJamMenu = None
        

    
    def addHalloweenMenu(self):
        if self.halloweenMenu == None:
            menu = TTSCHalloweenMenu()
            self.halloweenMenu = SCMenuHolder(OTPLocalizer.SCMenuHalloween, menu = menu)
            self.speedChat[2:2] = [
                self.halloweenMenu]
        

    
    def removeHalloweenMenu(self):
        if self.halloweenMenu:
            i = self.speedChat.index(self.halloweenMenu)
            del self.speedChat[i]
            self.halloweenMenu.destroy()
            self.halloweenMenu = None
        

    
    def addWinterMenu(self, carol = False):
        if self.winterMenu == None:
            menu = TTSCWinterMenu(carol)
            self.winterMenu = SCMenuHolder(OTPLocalizer.SCMenuWinter, menu = menu)
            self.speedChat[2:2] = [
                self.winterMenu]
        

    
    def removeWinterMenu(self):
        if self.winterMenu:
            i = self.speedChat.index(self.winterMenu)
            del self.speedChat[i]
            self.winterMenu.destroy()
            self.winterMenu = None
        

    
    def addCarolMenu(self):
        self.removeWinterMenu()
        self.addWinterMenu(carol = True)

    
    def removeCarolMenu(self):
        pass

    
    def addWhiteList(self):
        if self.whiteList == None:
            TTSCWhiteListTerminal = TTSCWhiteListTerminal
            import toontown.chat.TTSCWhiteListTerminal
            self.whiteList = TTSCWhiteListTerminal(4, self)
            self.speedChat[1:1] = [
                self.whiteList]
        

    
    def removeWhiteList(self):
        if self.whiteList:
            i = self.speedChat.index(self.whiteList)
            del self.speedChat[i]
            self.whiteList.destroy()
            self.whiteList = None
        

    
    def addSellbotInvasionMenu(self):
        if self.sellbotInvasionMenu == None:
            menu = TTSCSellbotInvasionMenu()
            self.sellbotInvasionMenu = SCMenuHolder(OTPLocalizer.SCMenuSellbotInvasion, menu = menu)
            self.speedChat[2:2] = [
                self.sellbotInvasionMenu]
        

    
    def removeSellbotInvasionMenu(self):
        if self.sellbotInvasionMenu:
            i = self.speedChat.index(self.sellbotInvasionMenu)
            del self.speedChat[i]
            self.sellbotInvasionMenu.destroy()
            self.sellbotInvasionMenu = None
        

    
    def addSellbotFieldOfficeMenu(self):
        if self.sellbotFieldOfficeMenu == None:
            menu = TTSCSellbotFieldOfficeMenu()
            self.sellbotFieldOfficeMenu = SCMenuHolder(OTPLocalizer.SCMenuFieldOffice, menu = menu)
            self.speedChat[2:2] = [
                self.sellbotFieldOfficeMenu]
        

    
    def removeSellbotFieldOfficeMenu(self):
        if self.sellbotFieldOfficeMenu:
            i = self.speedChat.index(self.sellbotFieldOfficeMenu)
            del self.speedChat[i]
            self.sellbotFieldOfficeMenu.destroy()
            self.sellbotFieldOfficeMenu = None
        

    
    def addIdesOfMarchMenu(self):
        if self.idesOfMarchMenu == None:
            menu = TTSCIdesOfMarchMenu()
            self.idesOfMarchMenu = SCMenuHolder(OTPLocalizer.SCMenuIdesOfMarch, menu = menu)
            self.speedChat[2:2] = [
                self.idesOfMarchMenu]
        

    
    def removeIdesOfMarchMenu(self):
        if self.idesOfMarchMenu:
            i = self.speedChat.index(self.idesOfMarchMenu)
            del self.speedChat[i]
            self.idesOfMarchMenu.destroy()
            self.idesOfMarchMenu = None