• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python coghq.CogDisguiseGlobals类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中toontown.coghq.CogDisguiseGlobals的典型用法代码示例。如果您正苦于以下问题:Python CogDisguiseGlobals类的具体用法?Python CogDisguiseGlobals怎么用?Python CogDisguiseGlobals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CogDisguiseGlobals类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: confirmJoinGroup

 def confirmJoinGroup(self, groupId, buttonTuple):
     doneStatus = self.joinDialog.doneStatus
     self.joinDialog.cleanup()
     del self.joinDialog
     if doneStatus is not 'ok':
         return
     for gid in base.cr.groupManager.id2type.keys():
         if base.cr.groupManager.isInGroup(base.localAvatar.doId, gid):
             self.rejectGroup(4)
             return
     #if len(base.cr.groupManager.getGroupPlayers(groupId)) >= 8:
     #    self.rejectGroup(3)
     #    return
     suitIdx = -1
     gids = {10000:0, 11000:1, 12000:2, 13000:3}
     suitIdx = gids.get(groupId)
     if suitIdx is not None:
         merits = base.localAvatar.cogMerits[suitIdx]
         if CogDisguiseGlobals.getTotalMerits(base.localAvatar, suitIdx) > merits:
             self.rejectGroup(2, suitIdx)
             return
         parts = base.localAvatar.getCogParts()
         if not CogDisguiseGlobals.isSuitComplete(parts, suitIdx):
             self.rejectGroup(1)
             return
     base.cr.groupManager.d_addPlayerToGroup(groupId, base.localAvatar.doId)
     self.currentGroupJoined = groupId
     try:
         place = base.cr.playGame.getPlace()
     except:
         try:
             place = base.cr.playGame.hood.loader.place
         except:
             place = base.cr.playGame.hood.place
     place.requestTeleport(groupId, groupId, base.localAvatar.defaultShard, -1)
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:35,代码来源:ShardPage.py


示例2: updateMeritBars

    def updateMeritBars(self):
        if not self.meritBars:
            return

        for i in xrange(len(self.meritBars)):
            meritBar = self.meritBars[i]

            if CogDisguiseGlobals.isSuitComplete(base.localAvatar.cogParts, i):
                meritBar.show()
                totalMerits = CogDisguiseGlobals.getTotalMerits(base.localAvatar, i)
                merits = base.localAvatar.cogMerits[i]

                if totalMerits:
                    meritBar['range'] = totalMerits
                    meritBar['value'] = merits

                    if merits == totalMerits:
                        meritBar['text'] = TTLocalizer.RewardPanelMeritAlert
                    else:
                        meritBar['text'] = '%s/%s %s' % (merits, totalMerits, TTLocalizer.RewardPanelMeritBarLabels[i])
                else:
                    meritBar['range'] = 1
                    meritBar['value'] = 1
                    meritBar['text'] = TTLocalizer.RewardPanelMeritsMaxed
            else:
                meritBar.hide()
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:26,代码来源:InventoryPage.py


示例3: update

    def update(self):
        if not CogDisguiseGlobals.isSuitComplete(base.localAvatar.cogParts, self.deptIndex):
            self.progressBar['text'] = '%s %s' % (
                CogDisguiseGlobals.getPartCountAsString(base.localAvatar.cogParts, self.deptIndex),
                TTLocalizer.DisguiseParts)

            self.progressBar['range'] = CogDisguiseGlobals.PartsPerSuit[self.deptIndex]
            self.progressBar['value'] = CogDisguiseGlobals.getPartCount(base.localAvatar.cogParts, self.deptIndex)
            return

        promoStatus = base.localAvatar.promotionStatus[self.deptIndex]

        if promoStatus != ToontownGlobals.PendingPromotion:
            totalMerits = CogDisguiseGlobals.getTotalMerits(base.localAvatar, self.deptIndex)
            merits = base.localAvatar.cogMerits[self.deptIndex]

            self.progressBar['range'] = totalMerits
            self.progressBar['value'] = merits

            self.progressBar['text'] = '%s/%s %s' % (
            merits, totalMerits, TTLocalizer.RewardPanelMeritBarLabels[self.deptIndex])
        else:
            self.progressBar['range'] = 1
            self.progressBar['value'] = 1

            maxSuitLevel = (SuitDNA.levelsPerSuit - 1) + (SuitDNA.suitsPerDept - 1)
            if base.localAvatar.cogLevels[self.deptIndex] == maxSuitLevel:
                self.progressBar['text'] = TTLocalizer.RewardPanelMeritsMaxed
            else:
                self.progressBar['text'] = TTLocalizer.RewardPanelPromotionPending
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:30,代码来源:CogMenuBar.py


示例4: doTab

    def doTab(self, index):
        self.activeTab = index
        self.tabs[index].reparentTo(self.pageFrame)
        for i in range(len(self.tabs)):
            tab = self.tabs[i]
            if i == index:
                tab['text0_fg'] = (1, 0, 0, 1)
                tab['text2_fg'] = (1, 0, 0, 1)
            else:
                tab['text0_fg'] = (0, 0, 0, 1)
                tab['text2_fg'] = (0.5, 0.4, 0.4, 1)

        self.bkgd.setColor(DeptColors[index])
        self.deptLabel['text'] = (SuitDNA.suitDeptFullnames[SuitDNA.suitDepts[index]],)
        cogIndex = base.localAvatar.cogTypes[index] + SuitDNA.suitsPerDept * index
        cog = SuitDNA.suitHeadTypes[cogIndex]
        self.progressTitle.hide()
        if SuitDNA.suitDepts[index] == 'm':
            self.progressTitle = self.cogbuckTitle
        elif SuitDNA.suitDepts[index] == 'l':
            self.progressTitle = self.juryNoticeTitle
        elif SuitDNA.suitDepts[index] == 'c':
            self.progressTitle = self.stockOptionTitle
        else:
            self.progressTitle = self.meritTitle
        self.progressTitle.show()
        self.cogName['text'] = SuitBattleGlobals.SuitAttributes[cog]['name']
        cogLevel = base.localAvatar.cogLevels[index]
        self.cogLevel['text'] = TTLocalizer.DisguisePageCogLevel % str(cogLevel + 1)
        numParts = base.localAvatar.cogParts[index]
        numPartsRequired = CogDisguiseGlobals.PartsPerSuit[index]
        self.updatePartsDisplay(index, numParts, numPartsRequired)
        self.updateMeritBar(index)
        self.cogPartRatio['text'] = '%d/%d' % (CogDisguiseGlobals.getTotalParts(numParts), numPartsRequired)
开发者ID:AdrianF98,项目名称:Toontown-Rewritten,代码行数:34,代码来源:DisguisePage.py


示例5: getNextMeritValue

 def getNextMeritValue(self, curMerits, toon, dept):
     totalMerits = CogDisguiseGlobals.getTotalMerits(toon, dept)
     retVal = totalMerits
     if curMerits > totalMerits:
         retVal = amount
     
     return retVal
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:7,代码来源:RewardPanel.py


示例6: getMeritIntervalList

 def getMeritIntervalList(self, toon, dept, origMerits, earnedMerits):
     tickDelay = 1.0 / 60
     intervalList = []
     totalMerits = CogDisguiseGlobals.getTotalMerits(toon, dept)
     neededMerits = 0
     if totalMerits and origMerits != totalMerits:
         neededMerits = totalMerits - origMerits
         intervalList.append(Func(self.showMeritIncLabel, dept, min(neededMerits, earnedMerits)))
     
     barTime = 0.5
     numTicks = int(math.ceil(barTime / tickDelay))
     for i in range(numTicks):
         t = (i + 1) / float(numTicks)
         newValue = int(origMerits + t * earnedMerits + 0.5)
         intervalList.append(Func(self.incrementMerits, toon, dept, newValue, totalMerits))
         intervalList.append(Wait(tickDelay))
     
     intervalList.append(Func(self.resetMeritBarColor, dept))
     intervalList.append(Wait(0.10000000000000001))
     if toon.cogLevels[dept] < ToontownGlobals.MaxCogSuitLevel:
         if neededMerits and toon.readyForPromotion(dept):
             intervalList.append(Wait(0.40000000000000002))
             intervalList += self.getPromotionIntervalList(toon, dept)
         
     
     return intervalList
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:26,代码来源:RewardPanel.py


示例7: __init__

    def __init__(self, cogMenu, dept):
        NodePath.__init__(self, 'CogMenuBar-%s' % dept)

        self.dept = dept
        self.deptIndex = CogDisguiseGlobals.dept2deptIndex(self.dept)

        icons = loader.loadModel('phase_3/models/gui/cog_icons')
        self.icon = icons.find(ICON_NODES[self.deptIndex]).copyTo(self)
        self.icon.setColor(ICON_COLORS[self.deptIndex])
        self.icon.setScale(0.07)
        self.icon.setX(-0.25)
        icons.removeNode()

        self.progressBar = DirectWaitBar(parent=self, relief=DirectGuiGlobals.SUNKEN,
                                         frameSize=(-1, 1, -0.15, 0.15),
                                         borderWidth=(0.02, 0.02),
                                         scale=0.20,
                                         frameColor=(DisguisePage.DeptColors[self.deptIndex][0] * 0.7,
                                                     DisguisePage.DeptColors[self.deptIndex][1] * 0.7,
                                                     DisguisePage.DeptColors[self.deptIndex][2] * 0.7,
                                                     1),
                                         barColor=(DisguisePage.DeptColors[self.deptIndex][0],
                                                   DisguisePage.DeptColors[self.deptIndex][1],
                                                   DisguisePage.DeptColors[self.deptIndex][2],
                                                   1),
                                         text='0/0 ' + TTLocalizer.RewardPanelMeritBarLabels[self.deptIndex],
                                         text_scale=TTLocalizer.RPmeritBarLabels, text_fg=(0, 0, 0, 1),
                                         text_align=TextNode.ALeft, text_pos=(-0.96, -0.05))

        self.reparentTo(cogMenu)
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:30,代码来源:CogMenuBar.py


示例8: dbCallback

        def dbCallback(dclass, fields, toonId=toonId, suitDeptIndex=suitDeptIndex):
            if dclass != self.air.dclassesByName['DistributedToonAI']:
                return

            parts = fields['setCogParts'][0]
            if CogDisguiseGlobals.isSuitComplete(parts, suitDeptIndex):
                # Code from DistributedToonAI.loseCogParts:
                loseCount = random.randrange(CogDisguiseGlobals.MinPartLoss,
                                             CogDisguiseGlobals.MaxPartLoss+1)

                partBitmask = parts[suitDeptIndex]
                partList = range(17)

                while loseCount > 0 and partList:
                    losePart = random.choice(partList)
                    partList.remove(losePart)

                    losePartBit = 1 << losePart
                    if partBitmask & losePartBit:
                        partBitmask &= ~losePartBit
                        loseCount -= 1

                parts[suitDeptIndex] = partBitmask

                # Update the cog parts in the db:
                self.air.dbInterface.updateObject(
                    self.air.dbId, toonId,
                    self.air.dclassesByName['DistributedToonAI'],
                    {'setCogParts': (parts,)}
                )
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:30,代码来源:CogSuitManagerAI.py


示例9: recoverMerits

 def recoverMerits(self, av, cogList, zoneId, multiplier = 1, extraMerits = None):
     avId = av.getDoId()
     meritsRecovered = [0, 0, 0, 0]
     if extraMerits is None:
         extraMerits = [0, 0, 0, 0]
     if self.air.suitInvasionManager.getInvading():
         multiplier *= getInvasionMultiplier()
     for i in xrange(len(extraMerits)):
         if CogDisguiseGlobals.isSuitComplete(av.getCogParts(), i):
             meritsRecovered[i] += extraMerits[i]
             self.notify.debug('recoverMerits: extra merits = %s' % extraMerits[i])
     self.notify.debug('recoverMerits: multiplier = %s' % multiplier)
     for cogDict in cogList:
         dept = SuitDNA.suitDepts.index(cogDict['track'])
         if avId in cogDict['activeToons']:
             if CogDisguiseGlobals.isSuitComplete(av.getCogParts(), SuitDNA.suitDepts.index(cogDict['track'])):
                 self.notify.debug('recoverMerits: checking against cogDict: %s' % cogDict)
                 rand = random.random() * 100
                 if rand <= self.getPercentChance() and not cogDict['isVirtual']:
                     merits = cogDict['level'] * MeritMultiplier
                     merits = int(round(merits))
                     if cogDict['hasRevives']:
                         merits *= 2
                     merits = merits * multiplier
                     merits = int(round(merits))
                     meritsRecovered[dept] += merits
                     self.notify.debug('recoverMerits: merits = %s' % merits)
                 else:
                     self.notify.debug('recoverMerits: virtual cog!')
     if meritsRecovered != [0, 0, 0, 0]:
         actualCounted = [0, 0, 0, 0]
         merits = av.getCogMerits()
         for i in xrange(len(meritsRecovered)):
             max = CogDisguiseGlobals.getTotalMerits(av, i)
             if max:
                 if merits[i] + meritsRecovered[i] <= max:
                     actualCounted[i] = meritsRecovered[i]
                     merits[i] += meritsRecovered[i]
                 else:
                     actualCounted[i] = max - merits[i]
                     merits[i] = max
                 av.b_setCogMerits(merits)
         if reduce(lambda x, y: x + y, actualCounted):
             self.air.writeServerEvent('merits', avId, '%s|%s|%s|%s' % tuple(actualCounted))
             self.notify.debug('recoverMerits: av %s recovered merits %s' % (avId, actualCounted))
     return meritsRecovered
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:46,代码来源:PromotionManagerAI.py


示例10: __talkAboutPromotion

 def __talkAboutPromotion(self, speech):
     if self.prevCogSuitLevel < ToontownGlobals.MaxCogSuitLevel:
         newCogSuitLevel = localAvatar.getCogLevels()[CogDisguiseGlobals.dept2deptIndex(self.style.dept)]
         if newCogSuitLevel == ToontownGlobals.MaxCogSuitLevel:
             speech += TTLocalizer.ResistanceToonLastPromotion % (ToontownGlobals.MaxCogSuitLevel + 1)
         if newCogSuitLevel in ToontownGlobals.CogSuitHPLevels:
             speech += TTLocalizer.ResistanceToonHPBoost
     else:
         speech += TTLocalizer.ResistanceToonMaxed % (ToontownGlobals.MaxCogSuitLevel + 1)
     return speech
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:10,代码来源:DistributedCashbotBoss.py


示例11: announceGenerate

 def announceGenerate(self):
     DistributedAvatar.DistributedAvatar.announceGenerate(self)
     self.prevCogSuitLevel = localAvatar.getCogLevels()[CogDisguiseGlobals.dept2deptIndex(self.style.dept)]
     nearBubble = CollisionSphere(0, 0, 0, 50)
     nearBubble.setTangible(0)
     nearBubbleNode = CollisionNode('NearBoss')
     nearBubbleNode.setCollideMask(ToontownGlobals.WallBitmask)
     nearBubbleNode.addSolid(nearBubble)
     self.attachNewNode(nearBubbleNode)
     self.accept('enterNearBoss', self.avatarNearEnter)
     self.accept('exitNearBoss', self.avatarNearExit)
     self.collNode.removeSolid(0)
     tube1 = CollisionTube(6.5, -7.5, 2, 6.5, 7.5, 2, 2.5)
     tube2 = CollisionTube(-6.5, -7.5, 2, -6.5, 7.5, 2, 2.5)
     roof = CollisionPolygon(Point3(-4.4, 7.1, 5.5), Point3(-4.4, -7.1, 5.5), Point3(4.4, -7.1, 5.5), Point3(4.4, 7.1, 5.5))
     side1 = CollisionPolygon(Point3(-4.4, -7.1, 5.5), Point3(-4.4, 7.1, 5.5), Point3(-4.4, 7.1, 0), Point3(-4.4, -7.1, 0))
     side2 = CollisionPolygon(Point3(4.4, 7.1, 5.5), Point3(4.4, -7.1, 5.5), Point3(4.4, -7.1, 0), Point3(4.4, 7.1, 0))
     front1 = CollisionPolygon(Point3(4.4, -7.1, 5.5), Point3(-4.4, -7.1, 5.5), Point3(-4.4, -7.1, 5.2), Point3(4.4, -7.1, 5.2))
     back1 = CollisionPolygon(Point3(-4.4, 7.1, 5.5), Point3(4.4, 7.1, 5.5), Point3(4.4, 7.1, 5.2), Point3(-4.4, 7.1, 5.2))
     self.collNode.addSolid(tube1)
     self.collNode.addSolid(tube2)
     self.collNode.addSolid(roof)
     self.collNode.addSolid(side1)
     self.collNode.addSolid(side2)
     self.collNode.addSolid(front1)
     self.collNode.addSolid(back1)
     self.collNodePath.reparentTo(self.axle)
     self.collNode.setCollideMask(ToontownGlobals.PieBitmask | ToontownGlobals.WallBitmask | ToontownGlobals.CameraBitmask)
     self.collNode.setName('BossZap')
     self.setTag('attackCode', str(ToontownGlobals.BossCogElectricFence))
     self.accept('enterBossZap', self.__touchedBoss)
     bubbleL = CollisionSphere(10, -5, 0, 10)
     bubbleL.setTangible(0)
     bubbleLNode = CollisionNode('BossZap')
     bubbleLNode.setCollideMask(ToontownGlobals.WallBitmask)
     bubbleLNode.addSolid(bubbleL)
     self.bubbleL = self.axle.attachNewNode(bubbleLNode)
     self.bubbleL.setTag('attackCode', str(ToontownGlobals.BossCogSwatLeft))
     self.bubbleL.stash()
     bubbleR = CollisionSphere(-10, -5, 0, 10)
     bubbleR.setTangible(0)
     bubbleRNode = CollisionNode('BossZap')
     bubbleRNode.setCollideMask(ToontownGlobals.WallBitmask)
     bubbleRNode.addSolid(bubbleR)
     self.bubbleR = self.axle.attachNewNode(bubbleRNode)
     self.bubbleR.setTag('attackCode', str(ToontownGlobals.BossCogSwatRight))
     self.bubbleR.stash()
     bubbleF = CollisionSphere(0, -25, 0, 12)
     bubbleF.setTangible(0)
     bubbleFNode = CollisionNode('BossZap')
     bubbleFNode.setCollideMask(ToontownGlobals.WallBitmask)
     bubbleFNode.addSolid(bubbleF)
     self.bubbleF = self.rotateNode.attachNewNode(bubbleFNode)
     self.bubbleF.setTag('attackCode', str(ToontownGlobals.BossCogFrontAttack))
     self.bubbleF.stash()
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:55,代码来源:DistributedBossCog.py


示例12: changeMeritBars

    def changeMeritBars(self, hide):
        if not self.meritBars:
            return

        for i in xrange(len(self.meritBars)):
            meritBar = self.meritBars[i]

            if CogDisguiseGlobals.isSuitComplete(base.localAvatar.cogParts, i):
                meritBar.hide() if hide else meritBar.show()
            else:
                meritBar.hide()
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:11,代码来源:InventoryPage.py


示例13: recoverMerits

 def recoverMerits(self, toon, suitsKilled, zoneId, mult = 1, extraMerits = None):
     if 1: #extraMerits is None:
         extraMerits = [0, 0, 0, 0]
         
     #else:
         # extraMerits = [0, extraMerits, 0, 0]
     
     # to do: figure out which track we should add extra merits to (check zoneId?)
         
     amounts = {x: y for x, y in zip(SuitDNA.suitDepts, extraMerits)}
     parts = toon.getCogParts()
     
     # calc
     for suit in suitsKilled:
         if suit['isVirtual']:
             continue
             
         track, level = suit['track'], suit['level']
         deptIdx = SuitDNA.suitDepts.index(track)
         if not CogDisguiseGlobals.isSuitComplete(parts, deptIdx):
             continue
         
         mult = (2 if self.air.suitInvasionManager.hasInvading() else 1)
         mult *= int(suit['hasRevives']) + 1
             
         amount = int((level + 1) / 2 * mult) * mult
         amounts[track] += amount
         
     merits = toon.getCogMerits()
     am2 = [0, 0, 0, 0]
     
     for dept, value in amounts.items():
         dept = SuitDNA.suitDepts.index(dept)
         needed = max(0, CogDisguiseGlobals.getTotalMerits(toon, dept) - merits[dept])
         am2[dept] = min(needed, value)
         
     # apply
     toon.b_setCogMerits([x + y for x, y in zip(merits, am2)])
     
     return am2
     
开发者ID:Teku16,项目名称:MikeyTheRepository,代码行数:40,代码来源:PromotionManagerAI.py


示例14: updateMeritBar

 def updateMeritBar(self, dept):
     merits = base.localAvatar.cogMerits[dept]
     totalMerits = CogDisguiseGlobals.getTotalMerits(base.localAvatar, dept)
     if totalMerits == 0:
         progress = 1
     else:
         progress = min(merits / float(totalMerits), 1)
     self.updateMeritDial(progress)
     if base.localAvatar.readyForPromotion(dept):
         self.cogMeritRatio['text'] = TTLocalizer.DisguisePageMeritFull
         self.promotionTitle.show()
         self.progressTitle.hide()
     else:
         self.cogMeritRatio['text'] = '%d/%d' % (merits, totalMerits)
         self.promotionTitle.hide()
         self.progressTitle.show()
开发者ID:AdrianF98,项目名称:Toontown-Rewritten,代码行数:16,代码来源:DisguisePage.py


示例15: __talkAboutPromotion

 def __talkAboutPromotion(self, speech):
     if self.prevCogSuitLevel < ToontownGlobals.MaxCogSuitLevel:
         deptIndex = CogDisguiseGlobals.dept2deptIndex(self.style.dept)
         cogLevels = base.localAvatar.getCogLevels()
         newCogSuitLevel = cogLevels[deptIndex]
         cogTypes = base.localAvatar.getCogTypes()
         maxCogSuitLevel = (SuitDNA.levelsPerSuit-1) + cogTypes[deptIndex]
         if self.prevCogSuitLevel != maxCogSuitLevel:
             speech += TTLocalizer.ResistanceToonLevelPromotion
         if newCogSuitLevel == maxCogSuitLevel:
             if newCogSuitLevel != ToontownGlobals.MaxCogSuitLevel:
                 suitIndex = (SuitDNA.suitsPerDept*deptIndex) + cogTypes[deptIndex]
                 cogTypeStr = SuitDNA.suitHeadTypes[suitIndex]
                 cogName = SuitBattleGlobals.SuitAttributes[cogTypeStr]['name']
                 speech += TTLocalizer.ResistanceToonSuitPromotion % cogName
     else:
         speech += TTLocalizer.ResistanceToonMaxed % (ToontownGlobals.MaxCogSuitLevel + 1)
     return speech
开发者ID:nate97,项目名称:src,代码行数:18,代码来源:DistributedCashbotBoss.py


示例16: removeParts

    def removeParts(self, toonId, suitDeptIndex):
        toon = self.air.doId2do.get(toonId)

        # Check if the toon is in our doId2do:
        if toon is not None:
            parts = toon.getCogParts()
            if CogDisguiseGlobals.isSuitComplete(parts, suitDeptIndex):
                toon.loseCogParts(suitDeptIndex)

        def dbCallback(dclass, fields, toonId=toonId, suitDeptIndex=suitDeptIndex):
            if dclass != self.air.dclassesByName['DistributedToonAI']:
                return

            parts = fields['setCogParts'][0]
            if CogDisguiseGlobals.isSuitComplete(parts, suitDeptIndex):
                # Code from DistributedToonAI.loseCogParts:
                loseCount = random.randrange(CogDisguiseGlobals.MinPartLoss,
                                             CogDisguiseGlobals.MaxPartLoss+1)

                partBitmask = parts[suitDeptIndex]
                partList = range(17)

                while loseCount > 0 and partList:
                    losePart = random.choice(partList)
                    partList.remove(losePart)

                    losePartBit = 1 << losePart
                    if partBitmask & losePartBit:
                        partBitmask &= ~losePartBit
                        loseCount -= 1

                parts[suitDeptIndex] = partBitmask

                # Update the cog parts in the db:
                self.air.dbInterface.updateObject(
                    self.air.dbId, toonId,
                    self.air.dclassesByName['DistributedToonAI'],
                    {'setCogParts': (parts,)}
                )

        # It doesn't look like the toon was in our doId2do. Lets query the db:
        self.air.dbInterface.queryObject(self.air.dbId, toonId, dbCallback)
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:42,代码来源:CogSuitManagerAI.py


示例17: getCogPartIntervalList

 def getCogPartIntervalList(self, toon, cogPartList):
     itemName = CogDisguiseGlobals.getPartName(cogPartList)
     intervalList = []
     intervalList.append(Func(self.cogPartLabel.setProp, 'text', itemName))
     intervalList.append(Wait(1))
     return intervalList
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:6,代码来源:RewardPanel.py


示例18: initGagFrame

    def initGagFrame(self, toon, expList, meritList, noSkip = False):
        self.avNameLabel['text'] = toon.getName()
        self.endTrackFrame.hide()
        self.gagExpFrame.show()
        self.newGagFrame.hide()
        self.promotionFrame.hide()
        self.questFrame.hide()
        self.itemFrame.hide()
        self.cogPartFrame.hide()
        self.missedItemFrame.hide()
        trackBarOffset = 0
        self.skipButton['state'] = choice(noSkip, DGG.DISABLED, DGG.NORMAL)
        for i in xrange(len(SuitDNA.suitDepts)):
            meritBar = self.meritBars[i]
            meritLabel = self.meritLabels[i]
            totalMerits = CogDisguiseGlobals.getTotalMerits(toon, i)
            merits = meritList[i]
            self.meritIncLabels[i].hide()
            if CogDisguiseGlobals.isSuitComplete(toon.cogParts, i):
                if not self.trackBarsOffset:
                    trackBarOffset = 0.47
                    self.trackBarsOffset = 1
                meritBar.show()
                meritLabel.show()
                meritLabel.show()
                if totalMerits:
                    meritBar['range'] = totalMerits
                    meritBar['value'] = merits
                    if merits == totalMerits:
                        meritBar['text'] = TTLocalizer.RewardPanelMeritAlert
                    else:
                        meritBar['text'] = '%s/%s %s' % (merits, totalMerits, TTLocalizer.RewardPanelMeritBarLabels[i])
                else:
                    meritBar['range'] = 1
                    meritBar['value'] = 1
                    meritBar['text'] = TTLocalizer.RewardPanelMeritsMaxed
                self.resetMeritBarColor(i)
            else:
                meritBar.hide()
                meritLabel.hide()

        for i in xrange(len(expList)):
            curExp = expList[i]
            trackBar = self.trackBars[i]
            trackLabel = self.trackLabels[i]
            trackIncLabel = self.trackIncLabels[i]
            trackBar.setX(trackBar.getX() - trackBarOffset)
            trackLabel.setX(trackLabel.getX() - trackBarOffset)
            trackIncLabel.setX(trackIncLabel.getX() - trackBarOffset)
            trackIncLabel.hide()
            if toon.hasTrackAccess(i):
                trackBar.show()
                if curExp >= ToontownBattleGlobals.UnpaidMaxSkills[i] and toon.getGameAccess() != OTPGlobals.AccessFull:
                    nextExp = self.getNextExpValue(curExp, i)
                    trackBar['range'] = nextExp
                    trackBar['value'] = ToontownBattleGlobals.UnpaidMaxSkills[i]
                    trackBar['text'] = TTLocalizer.InventoryGuestExp
                elif curExp >= ToontownBattleGlobals.regMaxSkill:
                    nextExp = self.getNextExpValueUber(curExp, i)
                    trackBar['range'] = nextExp
                    uberCurrExp = curExp - ToontownBattleGlobals.regMaxSkill
                    trackBar['value'] = uberCurrExp
                    trackBar['text'] = TTLocalizer.InventoryUberTrackExp % {'nextExp': ToontownBattleGlobals.MaxSkill - curExp}
                else:
                    nextExp = self.getNextExpValue(curExp, i)
                    trackBar['range'] = nextExp
                    trackBar['value'] = curExp
                    trackBar['text'] = '%s/%s' % (curExp, nextExp)
                self.resetBarColor(i)
            else:
                trackBar.hide()
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:71,代码来源:RewardPanel.py


示例19: removeParts

 def removeParts(self, toon, suitDept):
     parts = toon.getCogParts()
     if CogDisguiseGlobals.isSuitComplete(parts, suitDept):
         toon.loseCogParts(suitDept)
开发者ID:CalebSmith376,项目名称:src,代码行数:4,代码来源:CogSuitManagerAI.py



注:本文中的toontown.coghq.CogDisguiseGlobals类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python distributed.DelayDelete类代码示例发布时间:2022-05-27
下一篇:
Python DistCogdoLevelGame.DistCogdoLevelGame类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap