def __epilogueChatNext(self, pageNumber, elapsed):
     if pageNumber == 1:
         toon = self.resistanceToon
         playRate = 0.75
         track = Sequence(ActorInterval(toon, 'victory', playRate=playRate, startFrame=0, endFrame=9), ActorInterval(toon, 'victory', playRate=playRate, startFrame=9, endFrame=0), Func(self.resistanceToon.loop, 'neutral'))
         intervalName = 'EpilogueMovieToonAnim'
         self.storeInterval(track, intervalName)
         track.start()
     elif pageNumber == 3:
         self.d_applyReward()
         ResistanceChat.doEffect(self.rewardId, self.resistanceToon, self.involvedToons)
 def __init__(self, air):
     DistributedBossCogAI.DistributedBossCogAI.__init__(self, air, self.DEPT)
     FSM.FSM.__init__(self, 'DistributedCashbotBossAI')
     self.cranes = None
     self.safes = None
     self.goons = None
     self.treasures = {}
     self.grabbingTreasures = {}
     self.recycledTreasures = []
     self.healAmount = 0
     self.rewardId = ResistanceChat.getRandomId()
     self.rewardedToons = []
     self.scene = NodePath('scene')
     self.reparentTo(self.scene)
     cn = CollisionNode('walls')
     cs = CollisionSphere(0, 0, 0, 13)
     cn.addSolid(cs)
     cs = CollisionInvSphere(0, 0, 0, 42)
     cn.addSolid(cs)
     self.attachNewNode(cn)
     self.heldObject = None
     self.waitingForHelmet = 0
     self.avatarHelmets = {}
     self.bossMaxDamage = ToontownGlobals.CashbotBossMaxDamage
     self.stunBuildup = 0
    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)
 def __init__(self, air):
     DistributedBossCogAI.DistributedBossCogAI.__init__(self, air, 'm')
     FSM.FSM.__init__(self, 'DistributedCashbotBossAI')
     self.cranes = None
     self.safes = None
     self.goons = None
     self.treasures = {}
     self.grabbingTreasures = {}
     self.recycledTreasures = []
     self.healAmount = 0
     self.rewardId = ResistanceChat.getRandomId()
     self.rewardedToons = []
     self.scene = NodePath('scene')
     self.reparentTo(self.scene)
     cn = CollisionNode('walls')
     cs = CollisionSphere(0, 0, 0, 13)
     cn.addSolid(cs)
     cs = CollisionInvSphere(0, 0, 0, 42)
     cn.addSolid(cs)
     self.attachNewNode(cn)
     self.heldObject = None
     self.waitingForHelmet = 0
     self.avatarHelmets = {}
     self.bossMaxDamage = ToontownGlobals.CashbotBossMaxDamage
     return
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons,
                                      self.toonSkillPtsGained,
                                      self.suitsKilled,
                                      ToontownGlobals.dept2cogHQ(self.dept),
                                      self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             toon.addResistanceMessage(self.rewardId)
             if self.bonusUnites:
                 for x in xrange(self.bonusUnites):
                     toon.addResistanceMessage(ResistanceChat.getRandomId())
             toon.b_promote(self.deptIndex)
             toon.addStat(ToontownGlobals.STATS_CFO)
             simbase.air.questManager.toonDefeatedBoss(
                 toon, ToontownGlobals.dept2cogHQ(self.dept), self.dna.dept,
                 self.involvedToons)
         if len(self.involvedToons[:]) == 1 and self.begunSolo:
             isSolo = 1
         else:
             isSolo = 0
         self.air.achievementsManager.cfo(toonId, solo=isSolo)
Beispiel #7
0
    def enterEpilogue(self):
        self.cleanupIntervals()
        self.clearChat()
        self.resistanceToon.clearChat()
        self.stash()
        self.stopAnimate()
        self.controlToons()
        self._DistributedCashbotBoss__showResistanceToon(False)
        self.resistanceToon.setPosHpr(
            *ToontownGlobals.CashbotBossBattleThreePosHpr)
        self.resistanceToon.loop('neutral')
        self._DistributedCashbotBoss__arrangeToonsAroundResistanceToon()
        camera.reparentTo(render)
        camera.setPos(self.resistanceToon, -9, 12, 6)
        camera.lookAt(self.resistanceToon, 0, 0, 3)
        intervalName = 'EpilogueMovie'
        text = ResistanceChat.getChatText(self.rewardId)
        (menuIndex, itemIndex) = ResistanceChat.decodeId(self.rewardId)
        value = ResistanceChat.getItemValue(self.rewardId)
        if menuIndex == ResistanceChat.RESISTANCE_TOONUP:
            if value == -1:
                instructions = TTLocalizer.ResistanceToonToonupAllInstructions
            else:
                instructions = TTLocalizer.ResistanceToonToonupInstructions % value
        elif menuIndex == ResistanceChat.RESISTANCE_MONEY:
            if value == -1:
                instructions = TTLocalizer.ResistanceToonMoneyAllInstructions
            else:
                instructions = TTLocalizer.ResistanceToonMoneyInstructions % value
        elif menuIndex == ResistanceChat.RESISTANCE_RESTOCK:
            if value == -1:
                instructions = TTLocalizer.ResistanceToonRestockAllInstructions
            else:
                trackName = TTLocalizer.BattleGlobalTracks[value]
                instructions = TTLocalizer.ResistanceToonRestockInstructions % trackName

        speech = TTLocalizer.ResistanceToonCongratulations % (text,
                                                              instructions)
        speech = self._DistributedCashbotBoss__talkAboutPromotion(speech)
        self.resistanceToon.setLocalPageChat(speech, 0)
        self.accept('nextChatPage',
                    self._DistributedCashbotBoss__epilogueChatNext)
        self.accept('doneChatPage',
                    self._DistributedCashbotBoss__epilogueChatDone)
        base.playMusic(self.epilogueMusic,
                       looping=1,
                       volume=0.90000000000000002)
 def enterEpilogue(self):
     self.cleanupIntervals()
     self.clearChat()
     self.resistanceToon.clearChat()
     self.stash()
     self.stopAnimate()
     self.controlToons()
     self.__showResistanceToon(False)
     self.resistanceToon.setPosHpr(*ToontownGlobals.CashbotBossBattleThreePosHpr)
     self.resistanceToon.loop('neutral')
     self.__arrangeToonsAroundResistanceToon()
     base.camera.reparentTo(render)
     base.camera.setPos(self.resistanceToon, -9, 12, 6)
     base.camera.lookAt(self.resistanceToon, 0, 0, 3)
     intervalName = 'EpilogueMovie'
     text = ResistanceChat.getChatText(self.rewardId)
     menuIndex, itemIndex = ResistanceChat.decodeId(self.rewardId)
     value = ResistanceChat.getItemValue(self.rewardId)
     if menuIndex == ResistanceChat.RESISTANCE_TOONUP:
         if value == -1:
             instructions = TTLocalizer.ResistanceToonToonupAllInstructions
         else:
             instructions = TTLocalizer.ResistanceToonToonupInstructions % value
     elif menuIndex == ResistanceChat.RESISTANCE_MONEY:
         if value == -1:
             instructions = TTLocalizer.ResistanceToonMoneyAllInstructions
         else:
             instructions = TTLocalizer.ResistanceToonMoneyInstructions % value
     elif menuIndex == ResistanceChat.RESISTANCE_RESTOCK:
         if value == -1:
             instructions = TTLocalizer.ResistanceToonRestockAllInstructions
         else:
             trackName = TTLocalizer.BattleGlobalTracks[value]
             instructions = TTLocalizer.ResistanceToonRestockInstructions % trackName
     elif menuIndex == ResistanceChat.RESISTANCE_MERITS:
         if value == -1:
             instructions = TTLocalizer.ResistanceToonMeritsAllInstructions
         else:
             instructions = TTLocalizer.ResistanceToonMeritsInstructions % TTLocalizer.RewardPanelMeritBarLabels[value]
     elif menuIndex == ResistanceChat.RESISTANCE_TICKETS:
         instructions = TTLocalizer.ResistanceToonTicketsInstructions % value
     speech = TTLocalizer.ResistanceToonCongratulations % (text, instructions)
     speech = self.__talkAboutPromotion(speech)
     self.resistanceToon.setLocalPageChat(speech, 0)
     self.accept('nextChatPage', self.__epilogueChatNext)
     self.accept('doneChatPage', self.__epilogueChatDone)
     base.playMusic(self.epilogueMusic, looping=1, volume=0.9)
    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))
Beispiel #11
0
 def __epilogueChatNext(self, pageNumber, elapsed):
     if pageNumber == 1:
         toon = self.resistanceToon
         playRate = 0.75
         track = Sequence(
             ActorInterval(toon,
                           'victory',
                           playRate=playRate,
                           startFrame=0,
                           endFrame=9),
             ActorInterval(toon,
                           'victory',
                           playRate=playRate,
                           startFrame=9,
                           endFrame=0),
             Func(self.resistanceToon.loop, 'neutral'))
         intervalName = 'EpilogueMovieToonAnim'
         self.storeInterval(track, intervalName)
         track.start()
     elif pageNumber == 3:
         self.d_applyReward()
         ResistanceChat.doEffect(self.rewardId, self.resistanceToon,
                                 self.involvedToons)
    def __init__(self, air):
        DistributedBossCogAI.DistributedBossCogAI.__init__(self, air, 'm')
        FSM.FSM.__init__(self, 'DistributedCashbotBossAI')
        self.cranes = None
        self.safes = None
        self.goons = None
        self.treasures = {}
        self.grabbingTreasures = {}
        self.recycledTreasures = []

        # The treasures will look for this quantity on their
        # "TreasurePlanner", which is the boss cog.  This is just the
        # initial default value; we reassign each treasure
        # differently.
        self.healAmount = 0

        # Choose a random reward up front in case they succeed.
        self.rewardId = ResistanceChat.getRandomId()
        self.rewardedToons = []

        # We need a scene to do the collision detection in.
        self.scene = NodePath('scene')
        self.reparentTo(self.scene)

        # And some solids to keep the goons constrained to our room.
        cn = CollisionNode('walls')
        cs = CollisionSphere(0, 0, 0, 13)
        cn.addSolid(cs)
        cs = CollisionInvSphere(0, 0, 0, 42)
        cn.addSolid(cs)
        self.attachNewNode(cn)


        # By "heldObject", we mean the safe he's currently wearing as
        # a helmet, if any.  It's called a heldObject because this is
        # the way the cranes refer to the same thing, and we use the
        # same interface to manage this.
        self.heldObject = None

        self.waitingForHelmet = 0
        self.avatarHelmets = {}

        self.bossMaxDamage = ToontownGlobals.CashbotBossMaxDamage
    def __init__(self, air):
        DistributedCashbotBossAI.__init__(self, air)

        self.rewardId = ResistanceChat.getRandomBrutalId()
        self.bossMaxDamage = ToontownGlobals.BrutalCashbotBossMaxDamage
def decodeTTSCResistanceMsg(textId):
    return ResistanceChat.getChatText(textId)
 def __init__(self, textId, charges):
     SCTerminal.__init__(self)
     self.setCharges(charges)
     self.textId = textId
     self.text = ResistanceChat.getItemText(self.textId)
    def __init__(self, air):
        DistributedCashbotBossAI.__init__(self, air)

        self.rewardId = ResistanceChat.getRandomBrutalId()
        self.bossMaxDamage = ToontownGlobals.BrutalCashbotBossMaxDamage
def decodeTTSCResistanceMsg(textId):
    return ResistanceChat.getChatText(textId)
 def __init__(self, textId, charges):
     SCTerminal.__init__(self)
     self.setCharges(charges)
     self.textId = textId
     self.text = ResistanceChat.getItemText(self.textId)