예제 #1
0
    def __resistanceMessagesChanged(self):
        # clear out everything from our menu
        self.clearMenu()

        # if local toon has not been created, don't panic
        try:
            lt = base.localAvatar
        except:
            return

        #create the necessary items in the appropriate submenus
        phrases = lt.resistanceMessages
        #create the menus
        for menuIndex in ResistanceChat.resistanceMenu:
            # build a submenu of a particular type (toonup, etc)
            menu = SCMenu()
            for itemIndex in ResistanceChat.getItems(menuIndex):
                textId = ResistanceChat.encodeId(menuIndex, itemIndex)
                charges = lt.getResistanceMessageCharges(textId)
                if charges > 0:
                    menu.append(TTSCResistanceTerminal(textId, charges))

            # add the menu to self (SpeedChat won't display empty menus)
            textId = ResistanceChat.encodeId(menuIndex, 0)
            menuName = ResistanceChat.getMenuName(textId)
            self.append(SCMenuHolder(menuName, menu))
    def __resistanceMessagesChanged(self):
        self.clearMenu()
        try:
            lt = base.localAvatar
        except:
            return

        phrases = lt.resistanceMessages
        for menuIndex in ResistanceChat.resistanceMenu:
            menu = SCMenu()
            for itemIndex in ResistanceChat.getItems(menuIndex):
                textId = ResistanceChat.encodeId(menuIndex, itemIndex)
                charges = lt.getResistanceMessageCharges(textId)
                if charges > 0:
                    menu.append(TTSCResistanceTerminal(textId, charges))

            textId = ResistanceChat.encodeId(menuIndex, 0)
            menuName = ResistanceChat.getMenuName(textId)
            self.append(SCMenuHolder(menuName, menu))
    def __resistanceMessagesChanged(self):
        self.clearMenu()
        try:
            lt = base.localAvatar
        except:
            return

        phrases = lt.resistanceMessages
        for menuIndex in ResistanceChat.resistanceMenu:
            menu = SCMenu()
            for itemIndex in ResistanceChat.getItems(menuIndex):
                textId = ResistanceChat.encodeId(menuIndex, itemIndex)
                charges = lt.getResistanceMessageCharges(textId)
                if charges > 0:
                    menu.append(TTSCResistanceTerminal(textId, charges))

            textId = ResistanceChat.encodeId(menuIndex, 0)
            menuName = ResistanceChat.getMenuName(textId)
            self.append(SCMenuHolder(menuName, menu))
    def giveReward(self):
        for avId in self.participants:
            av = self.air.doId2do.get(avId)
            if av is None:
                continue

            for _ in xrange(self.uniteCount):
                if self.uniteType == 'any':
                    menuIndex = random.choice(ALLOWED_UNITES)
                else:
                    menuIndex = self.uniteType

                itemIndex = random.choice(ResistanceChat.getItems(menuIndex))
                textId = ResistanceChat.encodeId(menuIndex, itemIndex)

                av.addResistanceMessage(textId)
    def giveReward(self):
        for avId in self.participants:
            av = self.air.doId2do.get(avId)
            if av is None:
                continue

            for _ in xrange(self.uniteCount):
                if self.uniteType == 'any':
                    menuIndex = random.choice(ALLOWED_UNITES)
                else:
                    menuIndex = self.uniteType

                itemIndex = random.choice(ResistanceChat.getItems(menuIndex))
                textId = ResistanceChat.encodeId(menuIndex, itemIndex)

                av.addResistanceMessage(textId)