コード例 #1
0
ファイル: MakeClothesGUI.py プロジェクト: MasterLoopyBM/c0d3
 def setupScrollInterface(self):
     self.dna = self.toon.getStyle()
     gender = self.dna.getGender()
     if gender != self.gender:
         self.tops = ToonDNA.getRandomizedTops(gender, tailorId=ToonDNA.MAKE_A_TOON)
         self.bottoms = ToonDNA.getRandomizedBottoms(gender, tailorId=ToonDNA.MAKE_A_TOON)
         self.gender = gender
         self.topChoice = 0
         self.bottomChoice = 0
     self.setupButtons()
コード例 #2
0
ファイル: BodyShop.py プロジェクト: BmanGames/ToontownStride
 def __swapTorso(self, offset):
     gender = self.toon.style.getGender()
     if not self.clothesPicked:
         length = len(ToonDNA.toonTorsoTypes[6:])
         torsoOffset = 6
     elif gender == "m":
         length = len(ToonDNA.toonTorsoTypes[:3])
         torsoOffset = 0
         if self.toon.style.topTex not in ToonDNA.MakeAToonBoyShirts:
             randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
             shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt
             self.toon.style.topTex = shirtTex
             self.toon.style.topTexColor = shirtColor
             self.toon.style.sleeveTex = sleeveTex
             self.toon.style.sleeveTexColor = sleeveColor
         if self.toon.style.botTex not in ToonDNA.MakeAToonBoyBottoms:
             botTex, botTexColor = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON)
             self.toon.style.botTex = botTex
             self.toon.style.botTexColor = botTexColor
     else:
         length = len(ToonDNA.toonTorsoTypes[3:6])
         if self.toon.style.torso[1] == "d":
             torsoOffset = 3
         else:
             torsoOffset = 0
         if self.toon.style.topTex not in ToonDNA.MakeAToonGirlShirts:
             randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
             shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt
             self.toon.style.topTex = shirtTex
             self.toon.style.topTexColor = shirtColor
             self.toon.style.sleeveTex = sleeveTex
             self.toon.style.sleeveTexColor = sleeveColor
         if self.toon.style.botTex not in ToonDNA.MakeAToonGirlBottoms:
             if self.toon.style.torso[1] == "d":
                 botTex, botTexColor = ToonDNA.getRandomBottom(
                     gender, ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SKIRT
                 )
                 self.toon.style.botTex = botTex
                 self.toon.style.botTexColor = botTexColor
                 torsoOffset = 3
             else:
                 botTex, botTexColor = ToonDNA.getRandomBottom(
                     gender, ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SHORTS
                 )
                 self.toon.style.botTex = botTex
                 self.toon.style.botTexColor = botTexColor
                 torsoOffset = 0
     self.torsoChoice = (self.torsoChoice + offset) % length
     self.__updateScrollButtons(self.torsoChoice, length, self.torsoStart, self.torsoLButton, self.torsoRButton)
     torso = ToonDNA.toonTorsoTypes[torsoOffset + self.torsoChoice]
     self.dna.torso = torso
     self.toon.swapToonTorso(torso)
     self.toon.loop("neutral", 0)
     self.toon.swapToonColor(self.dna)
コード例 #3
0
 def enter(self, toon, shopsVisited = []):
     base.disableMouse()
     self.toon = toon
     self.dna = self.toon.getStyle()
     gender = self.toon.style.getGender()
     self.speciesStart = self.getSpeciesStart()
     self.speciesChoice = self.speciesStart
     self.headStart = 0
     self.headChoice = ToonDNA.toonHeadTypes.index(self.dna.head) - ToonDNA.getHeadStartIndex(self.species)
     self.torsoStart = 0
     self.torsoChoice = ToonDNA.toonTorsoTypes.index(self.dna.torso) % 3
     self.legStart = 0
     self.legChoice = ToonDNA.toonLegTypes.index(self.dna.legs)
     if CLOTHESSHOP in shopsVisited:
         self.clothesPicked = 1
     else:
         self.clothesPicked = 0
     self.clothesPicked = 1
     if gender == 'm' or ToonDNA.GirlBottoms[self.dna.botTex][1] == ToonDNA.SHORTS:
         torsoStyle = 's'
         torsoPool = ToonDNA.toonTorsoTypes[:3]
     else:
         torsoStyle = 'd'
         torsoPool = ToonDNA.toonTorsoTypes[3:6]
     self.__swapSpecies(0)
     self.__swapHead(0)
     self.__swapTorso(0)
     self.__swapLegs(0)
     choicePool = [ToonDNA.toonHeadTypes, torsoPool, ToonDNA.toonLegTypes]
     self.shuffleButton.setChoicePool(choicePool)
     self.accept(self.shuffleFetchMsg, self.changeBody)
     self.acceptOnce('last', self.__handleBackward)
     self.accept('next', self.__handleForward)
     self.acceptOnce('MAT-newToonCreated', self.shuffleButton.cleanHistory)
     self.restrictHeadType(self.dna.head)
コード例 #4
0
    def removeItem(self, dnaString, itemType):
        avId = self.air.getAvatarIdFromSender()
        av = self.air.doId2do.get(avId)
        if not av:
            self.air.writeServerEvent('suspicious', avId,
                                      'av not in same shard as closet!')
            return

        if av.getLocation() != self.getLocation():
            self.air.writeServerEvent('suspicious', avId,
                                      'av not in same zone as closet!')
            return

        testDNA = ToonDNA.ToonDNA()
        if not testDNA.isValidNetString(dnaString):
            self.air.writeServerEvent(
                'suspicious', avId,
                'DistributedClosetAI.removeItem: invalid dna: %s' % dnaString)
            return

        testDNA.makeFromNetString(dnaString)
        if itemType == ClosetGlobals.SHIRT:
            self.removedShirts.append(
                (testDNA.topTex, testDNA.topTexColor, testDNA.sleeveTex,
                 testDNA.sleeveTexColor))
        elif itemType == ClosetGlobals.SHORTS:
            self.removedBottoms.append((testDNA.botTex, testDNA.botTexColor))
コード例 #5
0
    def __handleAvatarChooserDone(self, avList, doneStatus):
        done = doneStatus['mode']
        if done == 'exit':
            self.loginFSM.request('shutdown')
        index = self.avChoice.getChoice()
        for av in avList:
            if av.position == index:
                avatarChoice = av
                dna = ToonDNA.ToonDNA()
                dna.makeFromNetString(av.dna)
                print('__handleAvatarChooserDone: %r, %r, %r, %r' % (av.id, av.name, dna.asTuple(), av.position))

        if done == 'chose':
            self.avChoice.exit()
            if avatarChoice.approvedName != '':
                self.congratulations(avatarChoice)
                avatarChoice.approvedName = ''
            elif avatarChoice.rejectedName != '':
                avatarChoice.rejectedName = ''
                self.betterlucknexttime(avList, index)
            else:
                base.localAvatarStyle = dna
                base.localAvatarName = avatarChoice.name
                self.loginFSM.request('waitForSetAvatarResponse', [avatarChoice])
        elif done == 'nameIt':
            self.accept('downloadAck-response', self.__handleDownloadAck, [avList, index])
            self.downloadAck = DownloadForceAcknowledge('downloadAck-response')
            self.downloadAck.enter(4)
        elif done == 'create':
            self.loginFSM.request('createAvatar', [avList, index])
        elif done == 'delete':
            self.loginFSM.request('waitForDeleteAvatarResponse', [avatarChoice])
コード例 #6
0
 def __init__(self, cr):
     DistributedEvent.__init__(self, cr)
     self.cr = cr
     self.spark = loader.loadSfx('phase_11/audio/sfx/LB_sparks_1.ogg')
     self.prepostera = Toon.Toon()
     self.prepostera.setName('Professor Prepostera')
     self.prepostera.setPickable(0)
     self.prepostera.setPlayerType(NametagGlobals.CCNonPlayer)
     dna = ToonDNA.ToonDNA()
     dna.newToonFromProperties('hss', 'ms', 'm', 'm', 20, 0, 20, 20, 97, 27,
                               86, 27, 37, 27)
     self.prepostera.setDNA(dna)
     self.prepostera.loop('scientistEmcee')
     self.prepostera.reparentTo(render)
     self.prepostera.setPosHpr(68, -10, 4.024, 75, 0, 0)
     self.prepostera.blinkEyes()
     self.prepostera.head = self.prepostera.find('**/__Actor_head')
     self.prepostera.initializeBodyCollisions('toon')
     self.headHoncho1 = DistributedSuitBase.DistributedSuitBase(self.cr)
     headHoncho1suitDNA = SuitDNA.SuitDNA()
     headHoncho1suitDNA.newSuit('hho')
     self.headHoncho1.setDNA(headHoncho1suitDNA)
     self.headHoncho1.setDisplayName('???')
     self.headHoncho1.setPickable(0)
     self.headHoncho1.setPosHpr(0, 0, 0, 0, 0, 0)
     self.headHoncho1.reparentTo(render)
     self.headHoncho1.doId = 0
     self.headHoncho1.hide()
     self.headHoncho1.initializeBodyCollisions('toon')
     self.toonMusic = loader.loadMusic(
         'phase_14/audio/bgm/tt2_ambient_1.mp3')
     self.invasion1 = loader.loadMusic(
         'phase_14/audio/bgm/event_temp_1.ogg')
コード例 #7
0
    def handleGetFriendsListExtended(self, di):
        avatarHandleList = []
        error = di.getUint8()
        if error:
            self.notify.warning('Got error return from friends list extended.')
        else:
            count = di.getUint16()
            for i in xrange(0, count):
                abort = 0
                doId = di.getUint32()
                name = di.getString()
                if name == '':
                    abort = 1
                dnaString = di.getString()
                if dnaString == '':
                    abort = 1
                else:
                    dna = ToonDNA.ToonDNA()
                    dna.makeFromNetString(dnaString)
                petId = di.getUint32()
                if not abort:
                    handle = FriendHandle.FriendHandle(doId, name, dna, petId)
                    avatarHandleList.append(handle)

        if avatarHandleList:
            messenger.send('gotExtraFriendHandles', [avatarHandleList])
コード例 #8
0
 def showToon(self):
     av = [x for x in self.avatarList if x.position == self.selectedToon][0]
     dna = av.dna
     if av.allowedName == 1:
         self.toon.setName(av.name +
                           '\n\x01textShadow\x01NAME REJECTED!\x02')
         self.changeName.show()
     elif av.wantName != '':
         self.toon.setName(av.name +
                           '\n\x01textShadow\x01NAME PENDING!\x02')
         self.changeName.hide()
     else:
         self.toon.setName(av.name)
         self.changeName.hide()
     self.toon.setDNAString(dna)
     self.laffMeter = LaffMeter.LaffMeter(ToonDNA.ToonDNA(dna), av.hp,
                                          av.maxHp)
     self.laffMeter.set_pos(-0.6, 0, -0.5)
     self.laffMeter.reparent_to(self.patNode2d)
     self.laffMeter.start()
     self.toon.setHat(av.hat[0], av.hat[1], av.hat[2])
     self.toon.setGlasses(av.glasses[0], av.glasses[1], av.glasses[2])
     self.toon.setBackpack(av.backpack[0], av.backpack[1], av.backpack[2])
     self.toon.setShoes(av.shoes[0], av.shoes[1], av.shoes[2])
     self.jumpIn = Sequence(Func(self.toon.loop, 'wave'),
                            Wait(self.toon.getDuration('wave')),
                            Func(self.toon.animFSM.request, 'neutral'))
     self.jumpIn.start()
     self.toon.animFSM.request('neutral')
     self.toon.show()
コード例 #9
0
    def _createRandomToon(self, gender):
        """
        Creates a random toon with a given gender.
        """
        # Cleanup any old toon.
        if self.toon:
            self.toon.stopBlink()
            self.toon.stopLookAroundNow()
            self.toon.delete()

        self.dna = ToonDNA.ToonDNA()
        # stage = 1 is MAKE_A_TOON
        self.dna.newToonRandom(gender=gender, stage=1)

        self.toon = Toon.Toon()
        self.toon.setDNA(self.dna)
        # make sure the avatar uses its highest LOD
        self.toon.useLOD(1000)
        # make sure his name doesn't show up
        self.toon.setNameVisible(0)
        self.toon.startBlink()
        self.toon.startLookAround()
        self.toon.reparentTo(render)
        self.toon.setPos(self.makeAToon.toonPosition)
        self.toon.setHpr(self.makeAToon.toonHpr)
        self.toon.setScale(self.makeAToon.toonScale)
        self.toon.loop("neutral")

        # Make the Next Button Active if a gender selection is made.
        self.makeAToon.setNextButtonState(DGG.NORMAL)
        self.makeAToon.setToon(self.toon)

        messenger.send("MAT-newToonCreated")
コード例 #10
0
    def rpc_listPendingNames(self, request, count=50):
        """Returns up to 50 pending names, sorted by time spent in the queue.

        It is recommended that the name moderation app call this periodically
        to update its database, in order to ensure that no names got lost.
        """

        cursor = self.air.mongodb.astron.objects.find({'fields.WishNameState': WISHNAME_PENDING})

        cursor.sort('fields.WishNameTimestamp', pymongo.ASCENDING)
        cursor.limit(count)

        result = []
        for item in cursor:
            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(item['fields']['setDNAString']['dnaString'])

            obj = {
                'avId': item['_id'],
                'name': item['fields']['WishName'],
                'time': item['fields']['WishNameTimestamp'],
                'dna': {
                    'species': ToonDNA.getSpeciesName(dna.head),
                    'headType': dna.head,
                    'headColor': list(ToonDNA.allColorsList[dna.headColor]),
                }
            }
            result.append(obj)

        return result
コード例 #11
0
    def __init__(self, cr, name, dnaName):
        try:
            self.DistributedCCharBase_initialized
            return
        except:
            self.DistributedCCharBase_initialized = 1

        DistributedChar.DistributedChar.__init__(self, cr)
        if dnaName == 'riggy':
            dna = ToonDNA.ToonDNA()
            toon = DistributedToon.DistributedToon(cr)
            toon.setDNA(dna)
            toon.setName(name)
        else:
            dna = CharDNA.CharDNA()
            dna.newChar(dnaName)
            self.setDNA(dna)
            self.setName(name)
        self.setTransparency(TransparencyAttrib.MDual, 1)
        fadeIn = self.colorScaleInterval(0.5, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0), blendType='easeInOut')
        fadeIn.start()
        self.diffPath = None
        self.transitionToCostume = 0
        self.__initCollisions()
        self.setBlend(frameBlend=config.GetBool('interpolate-animations', True))
        return
コード例 #12
0
        def callback(dclass, fields):
            if dclass is None:
                return request.result(None)

            if dclass.getName() is None:
                return request.result(None)

            name = fields['setName'][0]
            hp = fields['setHp'][0]
            maxHp = fields['setMaxHp'][0]
            dnaString = fields['setDNAString'][0]
            lastSeen = fields.get('setLastSeen', [0])[0]

            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(dnaString)

            return request.result({
                'name': name,
                'hp': hp,
                'maxHp': maxHp,
                'lastSeen': lastSeen,
                'dna': {
                    'species': ToonDNA.getSpeciesName(dna.head),
                    'headType': dna.head,
                    'headColor': list(ToonDNA.allColorsList[dna.headColor]),
                }
            })
コード例 #13
0
    def handleGetFriendsList(self, resp):
        print(len(resp))
        for toon in resp:
            doId = toon[0]
            name = toon[1]
            dnaString = toon[2]
            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(dnaString)
            petId = toon[3]
            handle = FriendHandle.FriendHandle(doId, name, dna, petId)
            self.friendsMap[doId] = handle
            if doId in self.friendsOnline:
                self.friendsOnline[doId] = handle
            if doId in self.friendPendingChatSettings:
                self.notify.debug('calling setCommonAndWL %s' % str(self.friendPendingChatSettings[doId]))
                handle.setCommonAndWhitelistChatFlags(*self.friendPendingChatSettings[doId])

        if base.wantPets and base.localAvatar.hasPet():

            def handleAddedPet():
                self.friendsMapPending = 0
                messenger.send('friendsMapComplete')

            self.addPetToFriendsMap(handleAddedPet)
            return
        self.friendsMapPending = 0
        messenger.send('friendsMapComplete')
コード例 #14
0
    def __handleDelete(self, t_or_b):
        if t_or_b == ClosetGlobals.SHIRT:
            itemList = self.closetGUI.tops
            trashIndex = self.closetGUI.topChoice
            swapFunc = self.closetGUI.swapTop
            removeFunc = self.closetGUI.removeTop
            self.topDeleted = self.topDeleted | 1

            def setItemChoice(i):
                self.closetGUI.topChoice = i

        else:
            itemList = self.closetGUI.bottoms
            trashIndex = self.closetGUI.bottomChoice
            swapFunc = self.closetGUI.swapBottom
            removeFunc = self.closetGUI.removeBottom
            self.bottomDeleted = self.bottomDeleted | 1

            def setItemChoice(i):
                self.closetGUI.bottomChoice = i

        if len(itemList) > 1:
            trashDNA = ToonDNA.ToonDNA()
            trashItem = self.av.getStyle().makeNetString()
            trashDNA.makeFromNetString(trashItem)
            if trashIndex == 0:
                swapFunc(1)
            else:
                swapFunc(-1)
            removeFunc(trashIndex)
            self.sendUpdate('removeItem', [trashItem, t_or_b])
            swapFunc(0)
            self.closetGUI.updateTrashButtons()
        else:
            self.notify.warning("cant delete this item(type = %s), since we don't have a replacement" % t_or_b)
コード例 #15
0
    def __init__(self, cr):
        DistributedEvent.__init__(self, cr)
        self.cr = cr
        self.spark = loader.loadSfx('phase_11/audio/sfx/LB_sparks_1.ogg'
                                    )  # i think this could be used somewhere

        # Create prepostera
        self.prepostera = Toon.Toon()
        self.prepostera.setName('Professor Prepostera')
        self.prepostera.setPickable(0)
        self.prepostera.setPlayerType(NametagGlobals.CCNonPlayer)
        dna = ToonDNA.ToonDNA()
        dna.newToonFromProperties('hss', 'ms', 'm', 'm', 20, 0, 20, 20, 97, 27,
                                  86, 27, 37, 27)
        self.prepostera.setDNA(dna)
        self.prepostera.loop('scientistEmcee')
        self.prepostera.reparentTo(render)
        self.prepostera.setPosHpr(4, -3, 1, 0, 0, 0)
        self.prepostera.blinkEyes()
        self.prepostera.head = self.prepostera.find('**/__Actor_head')
        self.prepostera.initializeBodyCollisions('toon')

        self.headHoncho1 = DistributedSuitBase.DistributedSuitBase(self.cr)
        headHoncho1suitDNA = SuitDNA.SuitDNA()
        headHoncho1suitDNA.newSuit('hho')
        self.headHoncho1.setDNA(headHoncho1suitDNA)
        self.headHoncho1.setDisplayName('???')
        self.headHoncho1.setPickable(0)
        self.headHoncho1.setPosHpr(0, 0, 0, 0, 0, 0)
        self.headHoncho1.reparentTo(render)
        self.headHoncho1.doId = 0
        self.headHoncho1.hide()
        self.headHoncho1.initializeBodyCollisions('toon')

        middlemanDNA = SuitDNA.SuitDNA()
        middlemanDNA.newSuit('mdm')

        self.middleman1 = DistributedSuitBase.DistributedSuitBase(self.cr)
        self.middleman1.setDNA(middlemanDNA)
        self.middleman1.setDisplayName('Middleman')
        self.middleman1.setPickable(0)
        self.middleman1.setPosHpr(0, 0, 0, 0, 0, 0)
        self.middleman1.reparentTo(render)
        self.middleman1.doId = 1
        self.middleman1.hide()
        self.middleman1.initializeBodyCollisions('toon')

        self.middleman2 = DistributedSuitBase.DistributedSuitBase(self.cr)
        self.middleman2.setDNA(middlemanDNA)
        self.middleman2.setDisplayName('Middleman')
        self.middleman2.setPickable(0)
        self.middleman2.setPosHpr(0, 0, 0, 0, 0, 0)
        self.middleman2.reparentTo(render)
        self.middleman2.doId = 2
        self.middleman2.hide()
        self.middleman2.initializeBodyCollisions('toon')

        #base.musicManager.stopAllSounds()
        self.toonMusic = loader.loadMusic(
            'phase_14/audio/bgm/tt2_ambient_1.mp3')  # Placeholder
コード例 #16
0
    def popupChangeClothesGUI(self, task):
        self.notify.debug("popupChangeClothesGUI")
        # this task only gets called if we are the local toon

        #self.setChatAbsolute('', CFSpeech)
        self.purchaseDoneEvent = self.uniqueName('purchaseDone')
        self.swapEvent = self.uniqueName('swap')
        self.cancelEvent = self.uniqueName('cancel')
        self.accept(self.purchaseDoneEvent, self.__proceedToCheckout)
        self.accept(self.swapEvent, self.__handleSwap)
        self.accept(self.cancelEvent, self.__handleCancel)
        # special buttons if we own the closet
        self.deleteEvent = self.uniqueName('delete')
        if (self.isOwner):
            self.accept(self.deleteEvent, self.__handleDelete)

        if not self.closetGUI:
            self.closetGUI = ClosetGUI.ClosetGUI(self.isOwner,
                                                 self.purchaseDoneEvent, self.cancelEvent,
                                                 self.swapEvent, self.deleteEvent,
                                                 self.topList, self.botList)
            self.closetGUI.load()
            if (self.gender != self.ownerGender):
                self.closetGUI.setGender(self.ownerGender)
            self.closetGUI.enter(base.localAvatar)
            self.closetGUI.showButtons()

            # save old clothes so we can revert back
            style = self.av.getStyle()
            self.oldStyle = ToonDNA.ToonDNA()
            self.oldStyle.makeFromNetString(style.makeNetString())

        return Task.done
コード例 #17
0
    def popupChangeClothesGUI(self, task):
        self.notify.debug('popupChangeClothesGUI')
        self.purchaseDoneEvent = self.uniqueName('purchaseDone')
        self.swapEvent = self.uniqueName('swap')
        self.cancelEvent = self.uniqueName('cancel')
        self.accept(self.purchaseDoneEvent,
                    self._DistributedCloset__proceedToCheckout)
        self.accept(self.swapEvent, self._DistributedCloset__handleSwap)
        self.accept(self.cancelEvent, self._handleCancel)
        self.deleteEvent = self.uniqueName('delete')
        if self.isOwner:
            self.accept(self.deleteEvent,
                        self._DistributedCloset__handleDelete)

        if not self.closetGUI:
            self.closetGUI = ClosetGUI.ClosetGUI(
                self.isOwner, self.purchaseDoneEvent, self.cancelEvent,
                self.swapEvent, self.deleteEvent, self.topList, self.botList)
            self.closetGUI.load()
            if self.gender != self.ownerGender:
                self.closetGUI.setGender(self.ownerGender)

            self.closetGUI.enter(base.localAvatar)
            self.closetGUI.showButtons()
            style = self.av.getStyle()
            self.oldStyle = ToonDNA.ToonDNA()
            self.oldStyle.makeFromNetString(style.makeNetString())

        return Task.done
コード例 #18
0
 def getPartyPlannerStyle(self):
     if self.partyPlannerStyle:
         return self.partyPlannerStyle
     else:
         dna = ToonDNA.ToonDNA()
         dna.newToonRandom()
         return dna
コード例 #19
0
 def swapBottomStyle(self, offset):
     length = len(self.bottomStyles)
     self.bottomStyleChoice += offset
     if self.bottomStyleChoice <= 0:
         self.bottomStyleChoice = 0
     self.updateScrollButtons(self.bottomStyleChoice, length, 0,
                              self.bottomStyleLButton,
                              self.bottomStyleRButton)
     if self.bottomStyleChoice < 0 or self.bottomStyleChoice >= length:
         self.notify.warning('bottomChoice index is out of range!')
         return
     else:
         self.toon.style.botTex = self.bottomStyles[self.bottomStyleChoice]
         colors = ToonDNA.getBottomColors(
             self.gender,
             self.bottomStyles[self.bottomStyleChoice],
             tailorId=ToonDNA.MAKE_A_TOON)
         colorLength = len(colors)
         if self.bottomColorChoice < 0 or self.bottomColorChoice >= colorLength:
             self.bottomColorChoice = colorLength - 1
         self.updateScrollButtons(self.bottomColorChoice, colorLength, 0,
                                  self.bottomLButton, self.bottomRButton)
         self.toon.style.botTexColor = colors[self.bottomColorChoice]
         if self.toon.generateToonClothes() == 1:
             self.toon.loop('neutral', 0)
             self.swappedTorso = 1
         if self.swapEvent != None:
             messenger.send(self.swapEvent)
         messenger.send('wakeup')
         return
コード例 #20
0
 def avatarEnter(self):
     avId = self.air.getAvatarIdFromSender()
     if avId not in self.air.doId2do:
         self.notify.warning('Avatar: %s not found' % avId)
         return
     if self.isBusy():
         self.freeAvatar(avId)
         return
     av = self.air.doId2do[avId]
     self.customerDNA = ToonDNA.ToonDNA()
     self.customerDNA.makeFromNetString(av.getDNAString())
     self.customerId = avId
     av.b_setDNAString(self.customerDNA.makeNetString())
     self.acceptOnce(self.air.getAvatarExitEvent(avId),
                     self.__handleUnexpectedExit,
                     extraArgs=[avId])
     if self.useJellybeans:
         flag = NPCToons.PURCHASE_MOVIE_START_BROWSE_JBS
     else:
         flag = NPCToons.PURCHASE_MOVIE_START_BROWSE
     if self.freeClothes:
         flag = NPCToons.PURCHASE_MOVIE_START
     elif self.useJellybeans and self.hasEnoughJbs(av):
         flag = NPCToons.PURCHASE_MOVIE_START
     if self.housingEnabled and isClosetAlmostFull(av):
         flag = NPCToons.PURCHASE_MOVIE_START_NOROOM
     self.sendShoppingMovie(avId, flag)
     DistributedNPCToonBaseAI.avatarEnter(self)
コード例 #21
0
    def __makeResistanceToon(self):
        if self.resistanceToon:
            return
        npc = Toon.Toon()
        npc.setName(TTLocalizer.ResistanceToonName)
        npc.setPickable(0)
        npc.setPlayerType(NametagGroup.CCNonPlayer)
        dna = ToonDNA.ToonDNA()
        dna.newToonRandom(11237, 'f', 1)
        dna.head = 'pls'
        npc.setDNAString(dna.makeNetString())
        npc.animFSM.request('neutral')
        self.resistanceToon = npc
        self.resistanceToon.setPosHpr(*ToontownGlobals.CashbotRTBattleOneStartPosHpr)
        state = random.getstate()
        random.seed(self.doId)
        self.resistanceToon.suitType = SuitDNA.getRandomSuitByDept('m')
        random.setstate(state)
        self.fakeGoons = []
        for i in xrange(self.numFakeGoons):
            goon = DistributedCashbotBossGoon.DistributedCashbotBossGoon(base.cr)
            goon.doId = -1 - i
            goon.setBossCogId(self.doId)
            goon.generate()
            goon.announceGenerate()
            self.fakeGoons.append(goon)

        self.__hideFakeGoons()
コード例 #22
0
ファイル: GenderShop.py プロジェクト: perpi06/ttoffline
 def _createRandomToon(self, gender):
     if self.toon:
         self.toon.stopBlink()
         self.toon.stopLookAroundNow()
         self.toon.delete()
     self.dna = ToonDNA.ToonDNA()
     self.notify.warning(base.cr.isAprilFools)
     if base.cr.isAprilFools:
         if gender == 'm':
             self.dna.newToonFromProperties('hsl', 'ls', 'm', 'm', 14, 0, 14, 14, 0, 0, 0, 0, 0, 0)
         else:
             self.dna.newToonFromProperties('fss', 'ld', 'l', 'f', 16, 0, 16, 16, 0, 0, 0, 0, 0, 0)
     else:
         self.dna.newToonRandom(gender=gender, stage=1)
     self.toon = Toon.Toon()
     self.toon.setDNA(self.dna)
     self.toon.useLOD(1000)
     self.toon.setNameVisible(0)
     self.toon.startBlink()
     self.toon.startLookAround()
     self.toon.reparentTo(render)
     self.toon.setPos(self.makeAToon.toonPosition)
     self.toon.setHpr(self.makeAToon.toonHpr)
     self.toon.setScale(self.makeAToon.toonScale)
     self.toon.loop('neutral')
     self.makeAToon.setNextButtonState(DGG.NORMAL)
     self.makeAToon.setToon(self.toon)
     messenger.send('MAT-newToonCreated')
コード例 #23
0
 def swapBottomStyle(self, offset):
     length = len(self.bottomStyles)
     self.bottomStyleChoice += offset
     if self.bottomStyleChoice <= 0:
         self.bottomStyleChoice = 0
     self.updateScrollButtons(self.bottomStyleChoice, length, 0, self.bottomStyleLButton, self.bottomStyleRButton)
     if self.bottomStyleChoice < 0 or self.bottomStyleChoice >= length:
     #if self.topStyleChoice < 0 or self.topStyleChoice >= len(self.topStyles) or len(self.topStyles[self.topStyleChoice]) != 4:
         self.notify.warning('bottomChoice index is out of range!')
         return None
     self.toon.style.botTex = self.bottomStyles[self.bottomStyleChoice]
     colors = ToonDNA.getBottomColors(self.gender, self.bottomStyles[self.bottomStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     colorLength = len(colors)
     if self.bottomColorChoice < 0 or self.bottomColorChoice >= colorLength:
         self.bottomColorChoice = colorLength - 1
     self.updateScrollButtons(self.bottomColorChoice, colorLength, 0, self.bottomLButton, self.bottomRButton)
     self.toon.style.botTexColor = colors[self.bottomColorChoice]      
     #colors = ToonDNA.getTopColors(self.gender, self.topStyles[self.topStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     #self.toon.style.topTexColor = colors[self.topColorChoice][0]
     if self.toon.generateToonClothes() == 1:
         self.toon.loop('neutral', 0)
         self.swappedTorso = 1
     if self.swapEvent != None:
         messenger.send(self.swapEvent)
     messenger.send('wakeup')
コード例 #24
0
 def changeBody(self):
     newChoice = self.shuffleButton.getCurrChoice()
     newHead = newChoice[0]
     newSpeciesIndex = ToonDNA.toonSpeciesTypes.index(ToonDNA.getSpecies(newHead))
     newHeadIndex = ToonDNA.toonHeadTypes.index(newHead) - ToonDNA.getHeadStartIndex(ToonDNA.getSpecies(newHead))
     newTorsoIndex = ToonDNA.toonTorsoTypes.index(newChoice[1])
     newLegsIndex = ToonDNA.toonLegTypes.index(newChoice[2])
     oldHead = self.toon.style.head
     oldSpeciesIndex = ToonDNA.toonSpeciesTypes.index(ToonDNA.getSpecies(oldHead))
     oldHeadIndex = ToonDNA.toonHeadTypes.index(oldHead) - ToonDNA.getHeadStartIndex(ToonDNA.getSpecies(oldHead))
     oldTorsoIndex = ToonDNA.toonTorsoTypes.index(self.toon.style.torso)
     oldLegsIndex = ToonDNA.toonLegTypes.index(self.toon.style.legs)
     self.__swapSpecies(newSpeciesIndex - oldSpeciesIndex)
     self.__swapHead(newHeadIndex - oldHeadIndex)
     self.__swapTorso(newTorsoIndex - oldTorsoIndex)
     self.__swapLegs(newLegsIndex - oldLegsIndex)
コード例 #25
0
    def rpc_getAvatarDetails(self, avId):
        """
        Summary:
            Responds with basic details on the avatar associated with the
            provided [avId].

        Parameters:
            [int avId] = The ID of the avatar to query basic details on.

        Example response:
            On success:
                {
                   'name': 'Toon Name',
                   'species': 'cat',
                   'head-color': 'Red',
                   'max-hp': 15,
                   'online': True
                }
            On failure: None
        """
        dclassName, fields = self.rpc_queryObject(avId)
        if dclassName == 'DistributedToon':
            result = {}

            result['name'] = fields['setName'][0]

            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(fields['setDNAString'][0])
            result['species'] = ToonDNA.getSpeciesName(dna.head)

            result['head-color'] = TTLocalizer.NumToColor[dna.headColor]
            result['max-hp'] = fields['setMaxHp'][0]
            result['online'] = (avId in self.air.friendsManager.onlineToons)

            return result
コード例 #26
0
    def rpc_getAvatarDetailsByName(self, request, name):
        """Fetch a list of avatars that match the provided name.
        Each element is a dict containing their hp/maxHp, lastSeen and
        a few DNA attributes.

        This list can be empty (meaning no avatars matched).
        """

        self.air.mongodb.astron.objects.ensure_index('fields.setName')
        avatars = self.air.mongodb.astron.objects.find({'fields.setName':{'name':name}})

        result = []
        for avatar in avatars:
            fields = avatar['fields']
            dna = ToonDNA.ToonDNA()
            dna.makeFromNetString(fields['setDNAString']['dnaString'])

            # In this case, we don't need to return the name, as that was already
            # a parameter should already be considered "known".
            result.append({
                'id': avatar['_id'], # Instead of a name, return the avId.
                'hp': fields['setHp']['hp'], # WTF did we do here?? hp and hitPoints, pls?
                'maxHp': fields['setMaxHp']['hitPoints'],
                'lastSeen': fields.get('setLastSeen',{}).get('timestamp',0),
                'dna': {
                    'species': ToonDNA.getSpeciesName(dna.head),
                    'headType': dna.head,
                    'headColor': list(ToonDNA.allColorsList[dna.headColor]),
                }
            })

        return result
コード例 #27
0
 def buildFrame(self, name, dnaTuple):
     frame = loader.loadModel('phase_3.5/models/modules/trophy_frame')
     dna = ToonDNA.ToonDNA()
     apply(dna.newToonFromProperties, dnaTuple)
     head = ToonHead.ToonHead()
     head.setupHead(dna)
     head.setPosHprScale(0, -0.05, -0.05, 180, 0, 0, 0.55, 0.02, 0.55)
     if dna.head[0] == 'r':
         head.setZ(-0.15)
     elif dna.head[0] == 'h':
         head.setZ(0.05)
     elif dna.head[0] == 'm':
         head.setScale(0.45, 0.02, 0.45)
     head.reparentTo(frame)
     nameText = TextNode('trophy')
     nameText.setFont(ToontownGlobals.getToonFont())
     nameText.setAlign(TextNode.ACenter)
     nameText.setTextColor(0, 0, 0, 1)
     nameText.setWordwrap(5.36 * FrameScale)
     nameText.setText(name)
     namePath = frame.attachNewNode(nameText.generate())
     namePath.setPos(0, -0.03, -.6)
     namePath.setScale(0.186 / FrameScale)
     frame.setScale(FrameScale, 1.0, FrameScale)
     return frame
コード例 #28
0
ファイル: BodyShop.py プロジェクト: DarthNihilus1/src
 def changeBody(self):
     newChoice = self.shuffleButton.getCurrChoice()
     newHead = newChoice[0]
     newSpeciesIndex = ToonDNA.toonSpeciesTypes.index(ToonDNA.getSpecies(newHead))
     newHeadIndex = ToonDNA.toonHeadTypes.index(newHead) - ToonDNA.getHeadStartIndex(ToonDNA.getSpecies(newHead))
     newTorsoIndex = ToonDNA.toonTorsoTypes.index(newChoice[1])
     newLegsIndex = ToonDNA.toonLegTypes.index(newChoice[2])
     oldHead = self.toon.style.head
     oldSpeciesIndex = ToonDNA.toonSpeciesTypes.index(ToonDNA.getSpecies(oldHead))
     oldHeadIndex = ToonDNA.toonHeadTypes.index(oldHead) - ToonDNA.getHeadStartIndex(ToonDNA.getSpecies(oldHead))
     oldTorsoIndex = ToonDNA.toonTorsoTypes.index(self.toon.style.torso)
     oldLegsIndex = ToonDNA.toonLegTypes.index(self.toon.style.legs)
     self.__swapSpecies(newSpeciesIndex - oldSpeciesIndex)
     self.__swapHead(newHeadIndex - oldHeadIndex)
     self.__swapTorso(newTorsoIndex - oldTorsoIndex)
     self.__swapLegs(newLegsIndex - oldLegsIndex)
コード例 #29
0
ファイル: BodyShop.py プロジェクト: DarthNihilus1/src
 def enter(self, toon, shopsVisited = []):
     base.disableMouse()
     self.toon = toon
     self.dna = self.toon.getStyle()
     gender = self.toon.style.getGender()
     self.speciesStart = self.getSpeciesStart()
     self.speciesChoice = self.speciesStart
     self.headStart = 0
     self.headChoice = ToonDNA.toonHeadTypes.index(self.dna.head) - ToonDNA.getHeadStartIndex(self.species)
     self.torsoStart = 0
     self.torsoChoice = ToonDNA.toonTorsoTypes.index(self.dna.torso) % 3
     self.legStart = 0
     self.legChoice = ToonDNA.toonLegTypes.index(self.dna.legs)
     if CLOTHESSHOP in shopsVisited:
         self.clothesPicked = 1
     else:
         self.clothesPicked = 0
     self.clothesPicked = 1
     if gender == 'm' or ToonDNA.GirlBottoms[self.dna.botTex][1] == ToonDNA.SHORTS:
         torsoStyle = 's'
         torsoPool = ToonDNA.toonTorsoTypes[:3]
     else:
         torsoStyle = 'd'
         torsoPool = ToonDNA.toonTorsoTypes[3:6]
     self.__swapSpecies(0)
     self.__swapHead(0)
     self.__swapTorso(0)
     self.__swapLegs(0)
     choicePool = [ToonDNA.toonHeadTypes, torsoPool, ToonDNA.toonLegTypes]
     self.shuffleButton.setChoicePool(choicePool)
     self.accept(self.shuffleFetchMsg, self.changeBody)
     self.acceptOnce('last', self.__handleBackward)
     self.accept('next', self.__handleForward)
     self.acceptOnce('MAT-newToonCreated', self.shuffleButton.cleanHistory)
     self.restrictHeadType(self.dna.head)
コード例 #30
0
    def load(self):
        CogdoGameMovie.load(self)
        self.toonDNA = ToonDNA.ToonDNA()
        self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2,
                                           1, 8, 1, 8, 1, 14)
        self.toonHead = Toon.Toon()
        self.toonHead.setDNA(self.toonDNA)
        self.makeSuit('sc')
        self.toonHead.getGeomNode().setDepthWrite(1)
        self.toonHead.getGeomNode().setDepthTest(1)
        self.toonHead.loop('neutral')
        self.toonHead.setPosHprScale(-0.73, 0, -1.27, 180, 0, 0, 0.18, 0.18,
                                     0.18)
        self.toonHead.reparentTo(hidden)
        self.toonHead.startBlink()
        self.cogHead = Suit.Suit()
        self.cogDNA = SuitDNA.SuitDNA()
        self.cogDNA.newSuit('le')
        self.cogHead.setDNA(self.cogDNA)
        self.cogHead.getGeomNode().setDepthWrite(1)
        self.cogHead.getGeomNode().setDepthTest(1)
        self.cogHead.loop('neutral')
        self.cogHead.setPosHprScale(-0.74, 0, -1.79, 180, 0, 0, 0.12, 0.14,
                                    0.14)
        self.cogHead.reparentTo(hidden)
        self.clipPlane = self.toonHead.attachNewNode(PlaneNode('clip'))
        self.clipPlane.node().setPlane(Plane(0, 0, 1, 0))
        self.clipPlane.setPos(0, 0, 2.45)
        audioMgr = base.cogdoGameAudioMgr
        self._cogDialogueSfx = audioMgr.createSfx('cogDialogue')
        self._toonDialogueSfx = audioMgr.createSfx('toonDialogue')

        def start():
            camera.wrtReparentTo(render)
            self._startUpdateTask()

        def end():
            self._stopUpdateTask()

        introDuration = Globals.Gameplay.IntroDurationSeconds
        dialogue = TTLocalizer.CogdoFlyingIntroMovieDialogue
        waitDur = introDuration / len(dialogue)
        flyDur = introDuration - waitDur * 0.5
        flyThroughIval = Parallel(
            camera.posInterval(flyDur,
                               self._exit.getPos(render) + Point3(0, -22, 1),
                               blendType='easeInOut'),
            camera.hprInterval(flyDur, Point3(0, 5, 0), blendType='easeInOut'))
        self._ival = Sequence(
            Func(start),
            Parallel(
                flyThroughIval,
                Sequence(
                    Func(self.displayLine, 'cog',
                         self._getRandomLine(dialogue[0])), Wait(waitDur),
                    Func(self.displayLine, 'toon',
                         self._getRandomLine(dialogue[1])), Wait(waitDur),
                    Func(self.displayLine, 'cog',
                         self._getRandomLine(dialogue[2])), Wait(waitDur))),
            Func(end))
コード例 #31
0
    def getPicture(self, avatar):
        from toontown.toon import Toon
        self.hasPicture = True
        dna = ToonDNA.ToonDNA(type='t', dna=avatar.style)
        str = ClothingTypes[self.clothingType][CTString]
        if self.isShirt():
            defn = ToonDNA.ShirtStyles[str]
            dna.topTex = defn[0]
            dna.topTexColor = defn[2][self.colorIndex][0]
            dna.sleeveTex = defn[1]
            dna.sleeveTexColor = defn[2][self.colorIndex][1]
            pieceNames = ('**/1000/**/torso-top', '**/1000/**/sleeves')
        else:
            defn = ToonDNA.BottomStyles[str]
            dna.botTex = defn[0]
            dna.botTexColor = defn[1][self.colorIndex]
            pieceNames = ('**/1000/**/torso-bot', )
        toon = Toon.Toon()
        toon.setDNA(dna)
        model = NodePath('clothing')
        for name in pieceNames:
            for piece in toon.findAllMatches(name):
                piece.wrtReparentTo(model)

        model.setH(180)
        toon.delete()
        return self.makeFrameModel(model)
コード例 #32
0
 def swapTopStyle(self, offset):
     length = len(self.topStyles)
     self.topStyleChoice += offset
     if self.topStyleChoice <= 0:
         self.topStyleChoice = 0
     self.updateScrollButtons(self.topStyleChoice, length, 0,
                              self.shirtStyleLButton,
                              self.shirtStyleRButton)
     if self.topStyleChoice < 0 or self.topStyleChoice >= length:
         self.notify.warning('topChoice index is out of range!')
         return
     else:
         self.toon.style.topTex = self.topStyles[self.topStyleChoice][0]
         self.toon.style.sleeveTex = self.topStyles[self.topStyleChoice][1]
         colors = ToonDNA.getTopColors(self.gender,
                                       self.topStyles[self.topStyleChoice],
                                       tailorId=ToonDNA.MAKE_A_TOON)
         colorLength = len(colors)
         if self.topColorChoice < 0 or self.topColorChoice >= colorLength:
             self.topColorChoice = colorLength - 1
         self.updateScrollButtons(self.topColorChoice, colorLength, 0,
                                  self.topLButton, self.topRButton)
         self.toon.style.topTexColor = colors[self.topColorChoice][0]
         self.toon.style.sleeveTexColor = colors[self.topColorChoice][1]
         self.toon.generateToonClothes()
         if self.swapEvent != None:
             messenger.send(self.swapEvent)
         messenger.send('wakeup')
         return
コード例 #33
0
 def setDNA(self, blob, finished, which):
     avId = self.air.getAvatarIdFromSender()
     if avId != self.customerId:
         if self.customerId:
             self.air.writeServerEvent('suspicious', avId, 'DistributedNPCTailorAI.setDNA customer is %s' % self.customerId)
             self.notify.warning('customerId: %s, but got setDNA for: %s' % (self.customerId, avId))
         return
     testDNA = ToonDNA.ToonDNA()
     if not testDNA.isValidNetString(blob):
         self.air.writeServerEvent('suspicious', avId, 'DistributedNPCTailorAI.setDNA: invalid dna: %s' % blob)
         return
     if avId in self.air.doId2do:
         av = self.air.doId2do.get(avId)
         if finished == 2 and which > 0:
             if self.freeClothes or av.takeMoney(self.jbCost, bUseBank = True):
                 av.b_setDNAString(blob)
                 if which & ClosetGlobals.SHIRT:
                     if av.addToClothesTopsList(self.customerDNA.topTex, self.customerDNA.topTexColor, self.customerDNA.sleeveTex, self.customerDNA.sleeveTexColor) == 1:
                         av.b_setClothesTopsList(av.getClothesTopsList())
                     else:
                         self.notify.warning('NPCTailor: setDNA() - unable to save old tops - we exceeded the tops list length')
                 if which & ClosetGlobals.SHORTS:
                     if av.addToClothesBottomsList(self.customerDNA.botTex, self.customerDNA.botTexColor) == 1:
                         av.b_setClothesBottomsList(av.getClothesBottomsList())
                     else:
                         self.notify.warning('NPCTailor: setDNA() - unable to save old bottoms - we exceeded the bottoms list length')
                 self.air.writeServerEvent('boughtTailorClothes', avId, '%s|%s|%s' % (self.doId, which, self.customerDNA.asTuple()))
             elif self.useJellybeans:
                 self.air.writeServerEvent('suspicious', avId, 'DistributedNPCTailorAI.setDNA tried to purchase with insufficient jellybeans')
                 self.notify.warning('NPCTailor: setDNA() - client tried to purchase with insufficient jellybeans!')
             elif self.air.questManager.hasTailorClothingTicket(av, self):
                 self.air.questManager.removeClothingTicket(av, self)
                 av.b_setDNAString(blob)
                 if which & ClosetGlobals.SHIRT:
                     if av.addToClothesTopsList(self.customerDNA.topTex, self.customerDNA.topTexColor, self.customerDNA.sleeveTex, self.customerDNA.sleeveTexColor) == 1:
                         av.b_setClothesTopsList(av.getClothesTopsList())
                     else:
                         self.notify.warning('NPCTailor: setDNA() - unable to save old tops - we exceeded the tops list length')
                 if which & ClosetGlobals.SHORTS:
                     if av.addToClothesBottomsList(self.customerDNA.botTex, self.customerDNA.botTexColor) == 1:
                         av.b_setClothesBottomsList(av.getClothesBottomsList())
                     else:
                         self.notify.warning('NPCTailor: setDNA() - unable to save old bottoms - we exceeded the bottoms list length')
                 self.air.writeServerEvent('boughtTailorClothes', avId, '%s|%s|%s' % (self.doId, which, self.customerDNA.asTuple()))
         elif finished == 1:
             if self.customerDNA:
                 av.b_setDNAString(self.customerDNA.makeNetString())
         else:
             self.sendUpdate('setCustomerDNA', [avId, blob])
     else:
         self.notify.warning('no av for avId: %d' % avId)
     if self.timedOut == 1 or finished == 0:
         return
     if self.busy == avId:
         taskMgr.remove(self.uniqueName('clearMovie'))
         self.completePurchase(avId)
     elif self.busy:
         self.air.writeServerEvent('suspicious', avId, 'DistributedNPCTailorAI.setDNA busy with %s' % self.busy)
         self.notify.warning('setDNA from unknown avId: %s busy: %s' % (avId, self.busy))
コード例 #34
0
 def __init__(self, air, furnitureMgr, catalogItem, ownerId):
     DistributedFurnitureItemAI.__init__(self, air, furnitureMgr,
                                         catalogItem)
     self.ownerId = ownerId
     self.busy = 0
     self.customerId = 0
     self.customerDNA = ToonDNA.ToonDNA()
     self.timedOut = 0
コード例 #35
0
 def __handleOwnerQuery(self, dclass, fields):
     self.topList = fields['setClothesTopsList'][0]
     self.bottomList = fields['setClothesBottomsList'][0]
     style = ToonDNA.ToonDNA()
     style.makeFromNetString(fields['setDNAString'][0])
     self.gender = style.gender
     self.d_setState(ClosetGlobals.OPEN, self.customerId, self.ownerId, self.gender, self.topList, self.bottomList)
     taskMgr.doMethodLater(ClosetGlobals.TIMEOUT_TIME, self.__handleClosetTimeout, 'closet-timeout-%d' % self.customerId, extraArgs=[self.customerId])
コード例 #36
0
 def __updateHead(self):
     self.__updateScrollButtons(self.headChoice, len(self.headList), self.headStart, self.headLButton, self.headRButton)
     headIndex = ToonDNA.getHeadStartIndex(self.species) + self.headChoice
     newHead = ToonDNA.toonHeadTypes[headIndex]
     self.dna.head = newHead
     self.toon.swapToonHead(newHead)
     self.toon.loop('neutral', 0)
     self.toon.swapToonColor(self.dna)
コード例 #37
0
 def __updateHead(self):
     self.__updateScrollButtons(self.headChoice, len(self.headList), self.headStart, self.headLButton, self.headRButton)
     headIndex = ToonDNA.getHeadStartIndex(self.species) + self.headChoice
     newHead = ToonDNA.toonHeadTypes[headIndex]
     self.dna.head = newHead
     self.toon.swapToonHead(newHead)
     self.toon.loop('neutral', 0)
     self.toon.swapToonColor(self.dna)
コード例 #38
0
 def setupScrollInterface(self):
     self.dna = self.toon.getStyle()
     gender = self.dna.getGender()
     if self.swapEvent != None:
         self.topStyles = ToonDNA.getTopStyles(gender,
                                               tailorId=self.tailorId)
         self.tops = ToonDNA.getTops(gender, tailorId=self.tailorId)
         self.bottomStyles = ToonDNA.getBottomStyles(gender,
                                                     tailorId=self.tailorId)
         self.bottoms = ToonDNA.getBottoms(gender, tailorId=self.tailorId)
         self.gender = gender
         self.topChoice = -1
         self.topStyleChoice = -1
         self.topColorChoice = -1
         self.bottomChoice = -1
         self.bottomStyleChoice = -1
         self.bottomColorChoice = -1
     self.setupButtons()
コード例 #39
0
 def loadModel(self):
     DistributedStatuary.DistributedStatuary.loadModel(self)
     self.model.setScale(self.worldScale * 1.5, self.worldScale * 1.5, self.worldScale)
     self.getToonPropertiesFromOptional()
     dna = ToonDNA.ToonDNA()
     dna.newToonFromProperties(self.headType, self.torsoType, self.legType, self.gender, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
     self.setupStoneToon(dna)
     self.poseToonFromTypeIndex(self.typeIndex)
     self.toon.reparentTo(self.model)
コード例 #40
0
 def getIntroToon(toonProperties, parent, pos):
     toon = Toon.Toon()
     dna = ToonDNA.ToonDNA()
     dna.newToonFromProperties(*toonProperties)
     toon.setDNA(dna)
     toon.reparentTo(parent)
     toon.setPos(*pos)
     toon.setH(180)
     toon.startBlink()
     return toon
コード例 #41
0
 def __swapSpecies(self, offset):
     length = len(ToonDNA.toonSpeciesTypes)
     self.speciesChoice = (self.speciesChoice + offset) % length
     self.__updateScrollButtons(self.speciesChoice, length, self.speciesStart, self.speciesLButton, self.speciesRButton)
     self.species = ToonDNA.toonSpeciesTypes[self.speciesChoice]
     self.headList = ToonDNA.getHeadList(self.species)
     self.__changeSpeciesName(self.species)
     maxHeadChoice = len(self.headList) - 1
     if self.headChoice > maxHeadChoice:
         self.headChoice = maxHeadChoice
     self.__updateHead()
コード例 #42
0
 def swapTopColor(self, offset):
     self.topColorChoice += offset    
     colors = ToonDNA.getTopColors(self.gender, self.topStyles[self.topStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     length = len(colors)
     if self.topColorChoice <= 0:
         self.topColorChoice = 0
     self.updateScrollButtons(self.topColorChoice, length, 0, self.topLButton, self.topRButton)
     if self.topColorChoice < 0 or self.topColorChoice >= length:
         self.notify.warning('topChoice index is out of range!')
         self.topColorChoice = len(colors)
         self.updateScrollButtons(self.topColorChoice, length, 0, self.topLButton, self.topRButton)
     self.toon.style.topTexColor = colors[self.topColorChoice][0]
     self.toon.style.sleeveTexColor = colors[self.topColorChoice][1]
     self.toon.generateToonClothes()
     if self.swapEvent != None:
         messenger.send(self.swapEvent)
     messenger.send('wakeup')
コード例 #43
0
 def swapBottomColor(self, offset):
     self.bottomColorChoice += offset    
     colors = ToonDNA.getBottomColors(self.gender, self.bottomStyles[self.bottomStyleChoice], tailorId=ToonDNA.MAKE_A_TOON)
     length = len(colors)
     if self.bottomColorChoice <= 0:
         self.bottomColorChoice = 0
     self.updateScrollButtons(self.bottomColorChoice, length, 0, self.bottomLButton, self.bottomRButton)
     if self.bottomColorChoice < 0 or self.bottomColorChoice >= length:
         self.notify.warning('bottomColor choice index is out of range!')
         self.bottomColorChoice = len(colors)
         self.updateScrollButtons(self.bottomColorChoice, length, 0, self.bottomLButton, self.bottomRButton)            
     self.toon.style.botTexColor = colors[self.bottomColorChoice]
     if self.toon.generateToonClothes() == 1:
         self.toon.loop('neutral', 0)
         self.swappedTorso = 1
     if self.swapEvent != None:
         messenger.send(self.swapEvent)
     messenger.send('wakeup')
コード例 #44
0
ファイル: BodyShop.py プロジェクト: OldToontown/OldToontown
 def _BodyShop__swapTorso(self, offset):
     gender = self.toon.style.getGender()
     if not self.clothesPicked:
         length = len(ToonDNA.toonTorsoTypes[6:])
         torsoOffset = 6
     elif gender == 'm':
         length = len(ToonDNA.toonTorsoTypes[:3])
         torsoOffset = 0
         if self.dna.armColor not in ToonDNA.defaultBoyColorList:
             self.dna.armColor = ToonDNA.defaultBoyColorList[0]
         
         if self.dna.legColor not in ToonDNA.defaultBoyColorList:
             self.dna.legColor = ToonDNA.defaultBoyColorList[0]
         
         if self.dna.headColor not in ToonDNA.defaultBoyColorList:
             self.dna.headColor = ToonDNA.defaultBoyColorList[0]
         
         if self.toon.style.topTex not in ToonDNA.MakeAToonBoyShirts:
             randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
             (shirtTex, shirtColor, sleeveTex, sleeveColor) = randomShirt
             self.toon.style.topTex = shirtTex
             self.toon.style.topTexColor = shirtColor
             self.toon.style.sleeveTex = sleeveTex
             self.toon.style.sleeveTexColor = sleeveColor
         
         if self.toon.style.botTex not in ToonDNA.MakeAToonBoyBottoms:
             (botTex, botTexColor) = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON)
             self.toon.style.botTex = botTex
             self.toon.style.botTexColor = botTexColor
         
     else:
         length = len(ToonDNA.toonTorsoTypes[3:6])
         if self.toon.style.torso[1] == 'd':
             torsoOffset = 3
         else:
             torsoOffset = 0
         if self.dna.armColor not in ToonDNA.defaultGirlColorList:
             self.dna.armColor = ToonDNA.defaultGirlColorList[0]
         
         if self.dna.legColor not in ToonDNA.defaultGirlColorList:
             self.dna.legColor = ToonDNA.defaultGirlColorList[0]
         
         if self.dna.headColor not in ToonDNA.defaultGirlColorList:
             self.dna.headColor = ToonDNA.defaultGirlColorList[0]
         
         if self.toon.style.topTex not in ToonDNA.MakeAToonGirlShirts:
             randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
             (shirtTex, shirtColor, sleeveTex, sleeveColor) = randomShirt
             self.toon.style.topTex = shirtTex
             self.toon.style.topTexColor = shirtColor
             self.toon.style.sleeveTex = sleeveTex
             self.toon.style.sleeveTexColor = sleeveColor
         
         if self.toon.style.botTex not in ToonDNA.MakeAToonGirlBottoms:
             if self.toon.style.torso[1] == 'd':
                 (botTex, botTexColor) = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON, girlBottomType = ToonDNA.SKIRT)
                 self.toon.style.botTex = botTex
                 self.toon.style.botTexColor = botTexColor
                 torsoOffset = 3
             else:
                 (botTex, botTexColor) = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON, girlBottomType = ToonDNA.SHORTS)
                 self.toon.style.botTex = botTex
                 self.toon.style.botTexColor = botTexColor
                 torsoOffset = 0
         
     self.torsoChoice = (self.torsoChoice + offset) % length
     self._BodyShop__updateScrollButtons(self.torsoChoice, length, self.torsoStart, self.torsoLButton, self.torsoRButton)
     torso = ToonDNA.toonTorsoTypes[torsoOffset + self.torsoChoice]
     self.dna.torso = torso
     self.toon.swapToonTorso(torso)
     self.toon.loop('neutral', 0)
     self.toon.swapToonColor(self.dna)
コード例 #45
0
    def __init__(self, serverVersion, launcher = None):
        OTPClientRepository.OTPClientRepository.__init__(self, serverVersion, launcher, playGame=PlayGame.PlayGame)
        self._playerAvDclass = self.dclassesByName['DistributedToon']
        setInterfaceFont(TTLocalizer.InterfaceFont)
        setSignFont(TTLocalizer.SignFont)
        setFancyFont(TTLocalizer.FancyFont)
        nameTagFontIndex = 0
        for font in TTLocalizer.NametagFonts:
            setNametagFont(nameTagFontIndex, TTLocalizer.NametagFonts[nameTagFontIndex])
            nameTagFontIndex += 1

        self.toons = {}
        if self.http.getVerifySsl() != HTTPClient.VSNoVerify:
            self.http.setVerifySsl(HTTPClient.VSNoDateCheck)
        prepareAvatar(self.http)
        self.__forbidCheesyEffects = 0
        self.friendManager = None
        self.speedchatRelay = None
        self.trophyManager = None
        self.bankManager = None
        self.catalogManager = None
        self.welcomeValleyManager = None
        self.newsManager = None
        self.streetSign = None
        self.distributedDistrict = None
        self.partyManager = None
        self.inGameNewsMgr = None
        self.whitelistMgr = None
        self.toontownTimeManager = ToontownTimeManager.ToontownTimeManager()
        self.avatarFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_AVATAR_FRIENDS_MANAGER, 'AvatarFriendsManager')
        self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager')
        self.speedchatRelay = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_SPEEDCHAT_RELAY, 'TTSpeedchatRelay')
        self.deliveryManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
        if config.GetBool('want-code-redemption', 1):
            self.codeRedemptionManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_CODE_REDEMPTION_MANAGER, 'TTCodeRedemptionMgr')
        self.streetSign = None
        self.furnitureManager = None
        self.objectManager = None
        self.friendsMap = {}
        self.friendsOnline = {}
        self.friendsMapPending = 0
        self.friendsListError = 0
        self.friendPendingChatSettings = {}
        self.elderFriendsMap = {}
        self.__queryAvatarMap = {}
        self.dateObject = DateObject.DateObject()
        self.accountServerDate = AccountServerDate.AccountServerDate()
        self.hoodMgr = HoodMgr.HoodMgr(self)
        self.setZonesEmulated = 0
        self.old_setzone_interest_handle = None
        self.setZoneQueue = Queue()
        self.accept(ToontownClientRepository.SetZoneDoneEvent, self._handleEmuSetZoneDone)
        self._deletedSubShardDoIds = set()
        self.toonNameDict = {}
        self.gameFSM.addState(State.State('skipTutorialRequest', self.enterSkipTutorialRequest, self.exitSkipTutorialRequest, ['playGame', 'gameOff', 'tutorialQuestion']))
        state = self.gameFSM.getStateNamed('waitOnEnterResponses')
        state.addTransition('skipTutorialRequest')
        state = self.gameFSM.getStateNamed('playGame')
        state.addTransition('skipTutorialRequest')
        self.wantCogdominiums = base.config.GetBool('want-cogdominiums', 1)
        self.wantEmblems = base.config.GetBool('want-emblems', 0)
        if base.config.GetBool('tt-node-check', 0):
            for species in ToonDNA.toonSpeciesTypes:
                for head in ToonDNA.getHeadList(species):
                    for torso in ToonDNA.toonTorsoTypes:
                        for legs in ToonDNA.toonLegTypes:
                            for gender in ('m', 'f'):
                                print 'species: %s, head: %s, torso: %s, legs: %s, gender: %s' % (species,
                                 head,
                                 torso,
                                 legs,
                                 gender)
                                dna = ToonDNA.ToonDNA()
                                dna.newToon((head,
                                 torso,
                                 legs,
                                 gender))
                                toon = Toon.Toon()
                                try:
                                    toon.setDNA(dna)
                                except Exception as e:
                                    print e

        return
コード例 #46
0
 def __swapHead(self, offset):
     self.headList = ToonDNA.getHeadList(self.species)
     length = len(self.headList)
     self.headChoice = (self.headChoice + offset) % length
     self.__updateHead()