Example #1
0
    def removeItem(self, item, topOrBottom):
        avId = self.air.getAvatarIdFromSender()

        if avId != self.furnitureMgr.ownerId:
            self.air.writeServerEvent('suspicious', avId, 'Tried to remove item from someone else\'s closet!')
            return

        if not self.verifyCustomer(avId):
            self.air.writeServerEvent('suspicious', avId, 'Tried to remove item while not interacting with closet!')
            return

        av = self.air.doId2do.get(avId)
        if not av:
            self.air.writeServerEvent('suspicious', avId, 'Tried to interact with a closet from another shard!')
            return

        tempDna = ToonDNA()
        if not tempDna.isValidNetString(item):
            self.air.writeServerEvent('suspicious', avId, 'Sent an invalid DNA string!')
            return

        tempDna.makeFromNetString(item)

        if topOrBottom == ClosetGlobals.SHIRT:
            self.removedTops.append([tempDna.topTex, tempDna.topTexColor, tempDna.sleeveTex, tempDna.sleeveTexColor])
        elif topOrBottom == ClosetGlobals.SHORTS:
            self.removedBottoms.append([tempDna.botTex, tempDna.botTexColor])
        else:
            self.air.writeServerEvent('suspicious', avId, 'Set an invalid topOrBottom value!')
 def enterCreateAvatar(self):
     dna = ToonDNA()
     dna.makeFromNetString(self.dna)
     colorString = TTLocalizer.NumToColor[dna.headColor]
     animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
     name = (' ').join((colorString, animalType))
     if self.name != '':
         toonFields = {
             'setName': (self.name, ),
             'WishNameState': ('LOCKED', ),
             'WishName': ('', ),
             'setDNAString': (self.dna, ),
             'setDISLid': (self.target, ),
             'setNametagStyle': (100, )
         }
     else:
         toonFields = {
             'setName': (name, ),
             'WishNameState': ('OPEN', ),
             'WishName': ('', ),
             'setDNAString': (self.dna, ),
             'setDISLid': (self.target, ),
             'setNametagStyle': (100, )
         }
     self.gameServicesManager.air.dbInterface.createObject(
         self.gameServicesManager.air.dbId,
         self.gameServicesManager.air.dclassesByName['DistributedToonUD'],
         toonFields, self.__handleCreate)
 def removeItem(self, item, topOrBottom):
     avId = self.air.getAvatarIdFromSender()
     if avId != self.furnitureMgr.ownerId:
         self.air.writeServerEvent(
             'suspicious', avId,
             'Tried to remove item from someone else\'s closet!')
         return
     if avId != self.avId:
         self.air.writeServerEvent(
             'suspicious', avId,
             'Tried to remove item while not interacting with closet!')
         return
     av = self.air.doId2do.get(avId)
     if not av:
         self.air.writeServerEvent(
             'suspicious', avId,
             'Tried to interact with a closet from another shard!')
         return
     tempDna = ToonDNA()
     if not tempDna.isValidNetString(item):
         self.air.writeServerEvent('suspicious', avId,
                                   'Sent an invalid DNA string!')
         return
     tempDna.makeFromNetString(item)
     if topOrBottom == ClosetGlobals.SHIRT:
         self.removedTops.append([
             tempDna.topTex, tempDna.topTexColor, tempDna.sleeveTex,
             tempDna.sleeveTexColor
         ])
     elif topOrBottom == ClosetGlobals.SHORTS:
         self.removedBottoms.append([tempDna.botTex, tempDna.botTexColor])
     else:
         self.air.writeServerEvent('suspicious', avId,
                                   'Set an invalid topOrBottom value!')
         return
 def enterLoadHouse(self):
     dna = ToonDNA()
     dna.makeFromNetString(self.toon['setDNAString'][0])
     gender = 1 if dna.getGender() == 'm' else 0
     self.mgr.air.sendActivate(self.houseId, self.mgr.air.districtId, self.estate.zoneId, self.mgr.air.dclassesByName['DistributedHouseAI'], {'setHousePos': [self.houseIndex],
      'setColor': [self.houseIndex],
      'setName': [self.toon['setName'][0]],
      'setAvatarId': [self.toon['ID']],
      'setGender': [gender]})
     self.acceptOnce('generate-%d' % self.houseId, self.__gotHouse)
Example #5
0
 def requestPolarBearTransformation(self):
     avId = self.air.getAvatarIdFromSender()
     av = self.air.doId2do.get(avId)
     if not av:
         return
     if av.dna.getAnimal() == 'bear' and av.dna.headColor != 0:
         newDNA = ToonDNA()
         newDNA.makeFromNetString(av.getDNAString())
         newDNA.headColor = 0
         newDNA.armColor = 0
         newDNA.legColor = 0
         taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
     self.sendUpdate('doPolarBearTransformation', [avId])
    def requestBlackCatTransformation(self):
        avId = self.air.getAvatarIdFromSender()
        av = self.air.doId2do.get(avId)
        if not av: return

        if av.dna.getAnimal() == 'cat' and av.dna.headColor != 0x1a:
            newDNA = ToonDNA()
            newDNA.makeFromNetString(av.getDNAString())
            newDNA.headColor = 0x1a
            newDNA.armColor = 0x1a
            newDNA.legColor = 0x1a
            taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)

            self.sendUpdate('doBlackCatTransformation', [avId])
Example #7
0
 def requestTransformation(self):
     avId = self.air.getAvatarIdFromSender()
     av = self.air.doId2do.get(avId)
     if av is None:
         return
     if not hasattr(av, "dna"):
         return
     if (av.dna.getAnimal() == "cat") and (av.dna.headColor != 0x1A):
         newDNA = ToonDNA()
         newDNA.makeFromNetString(av.getDNAString())
         newDNA.headColor = 0x1A
         newDNA.armColor = 0x1A
         newDNA.legColor = 0x1A
         taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), "transform-%d" % avId)
         self.sendUpdate("doTransformation", [avId])
Example #8
0
 def requestTransformation(self):
     avId = self.air.getAvatarIdFromSender()
     av = self.air.doId2do.get(avId)
     if av is None:
         return
     if not hasattr(av, 'dna'):
         return
     if (av.dna.getAnimal() == 'bear') and (av.dna.headColor != 0x00):
         newDNA = ToonDNA()
         newDNA.makeFromNetString(av.getDNAString())
         newDNA.headColor = 0x00
         newDNA.armColor = 0x00
         newDNA.legColor = 0x00
         taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
         self.sendUpdate('doTransformation', [avId])
    def requestBlackCatTransformation(self):
        if not self.air.newsManager.isHolidayRunning(ToontownGlobals.BLACK_CAT_DAY):
            return

        avId = self.air.getAvatarIdFromSender()
        av = self.air.doId2do.get(avId)

        if not av or av.getTutorialAck() or av.dna.getAnimal() != "cat" or av.dna.headColor == 0x1A:
            return

        newDNA = ToonDNA()
        newDNA.makeFromNetString(av.getDNAString())
        newDNA.updateToonProperties(armColor=26, legColor=26, headColor=26)
        taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), "transform-%d" % avId)
        self.sendUpdateToAvatarId(avId, "doBlackCatTransformation", [])
Example #10
0
    def __handleCreateAvatar(self):
        dna = ToonDNA()
        dna.makeFromNetString(self.avDNA)
        colorString = TTLocalizer.NumToColor[dna.headColor]
        animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
        name = ' '.join((colorString, animalType))
        toonFields = {'setName': (name,),
                      'WishNameState': ('OPEN',),
                      'WishName': ('',),
                      'setDNAString': (self.avDNA,),
                      'setDISLid': (self.sender,)}

        self.loginManager.air.dbInterface.createObject(self.loginManager.air.dbId,
                                                       self.loginManager.air.dclassesByName['DistributedToonUD'],
                                                       toonFields, self.__handleToonCreated)
 def requestTransformation(self):
     avId = self.air.getAvatarIdFromSender()
     av = self.air.doId2do.get(avId)
     if av is None:
         return
     if not hasattr(av, 'dna'):
         return
     if (av.dna.headColor != 0x00):
         newDNA = ToonDNA()
         newDNA.makeFromNetString(av.getDNAString())
         newDNA.headColor = 0x00
         newDNA.armColor = 0x00
         newDNA.legColor = 0x00
         taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
         self.sendUpdate('doTransformation', [avId])
Example #12
0
 def enterCreateAvatar(self):
     dna = ToonDNA()
     dna.makeFromNetString(self.dna)
     colorString = TTLocalizer.ColorfulToon
     animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
     name = ' '.join((colorString, animalType))
     toonFields = {
         'setName': (name, ),
         'setWishNameState': ('OPEN', ),
         'setWishName': ('', ),
         'setDNAString': (self.dna, ),
         'setDISLid': (self.target, ),
     }
     self.csm.air.dbInterface.createObject(
         self.csm.air.dbId,
         self.csm.air.dclassesByName['DistributedToonUD'], toonFields,
         self.__handleCreate)
    def enterLoadHouse(self):
        # Quickly parse DNA and get gender.
        dna = ToonDNA()
        dna.makeFromNetString(self.toon['setDNAString'][0])
        gender = 1 if dna.getGender() == 'm' else 0

        # Activate the house:
        self.mgr.air.sendActivate(self.houseId, self.mgr.air.districtId, self.estate.zoneId,
                                  self.mgr.air.dclassesByName['DistributedHouseAI'],
                                  {'setHousePos': [self.houseIndex],
                                   'setColor': [self.houseIndex],
                                   'setName': [self.toon['setName'][0]],
                                   'setAvatarId': [self.toon['ID']],
                                   'setGender': [gender]})

        # Now we wait for the house to show up... We do this by hanging a messenger
        # hook which the DistributedHouseAI throws once it spawns.
        self.acceptOnce('generate-%d' % self.houseId, self.__gotHouse)
    def enterCreateAvatar(self):
        dna = ToonDNA()
        dna.makeFromNetString(self.dna)
        colorstring = TTLocalizer.NumToColor[dna.headColor]
        animaltype = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
        name = colorstring + " " + animaltype

        toonFields = {
            "setName": (name,),
            "WishNameState": WISHNAME_OPEN,
            "WishName": "",
            "setDNAString": (self.dna,),
            "setDISLid": (self.target,),
        }

        self.csm.air.dbInterface.createObject(
            self.csm.air.dbId, self.csm.air.dclassesByName["DistributedToonUD"], toonFields, self.__handleCreate
        )
    def enterCreateAvatar(self):
        # We will now construct a new Toon with the given values.
        dna = ToonDNA()
        dna.makeFromNetString(self.dna)
        colorString = TTLocalizer.NumToColor[dna.headColor]
        animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
        name = ' '.join((colorString, animalType))
        toonFields = {'setName': (name,),
                      'WishNameState': ('OPEN',),
                      'WishName': ('',),
                      'setDNAString': (self.dna,),
                      'setDISLid': (self.target,)}

        # Create this new Toon object in the database. self.__handleCreate is the
        # callback that will be called upon the completion of createObject.
        self.gameServicesManager.air.dbInterface.createObject(self.gameServicesManager.air.dbId,
                                                              self.gameServicesManager.air.dclassesByName[
                                                                  'DistributedToonUD'], toonFields, self.__handleCreate)
 def enterCreateAvatar(self):
     dna = ToonDNA()
     dna.makeFromNetString(self.dna)
     colorString = TTLocalizer.NumToColor[dna.headColor]
     animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
     name = ' '.join((colorString, animalType))
     toonFields = {
         'setName': (name,),
         'WishNameState': ('OPEN',),
         'WishName': ('',),
         'setDNAString': (self.dna,),
         'setDISLid': (self.target,)
     }
     self.csm.air.dbInterface.createObject(
         self.csm.air.dbId,
         self.csm.air.dclassesByName['DistributedToonUD'],
         toonFields,
         self.__handleCreate)
    def enterCreateAvatar(self):
        dna = ToonDNA()
        dna.makeFromNetString(self.dna)
        colorstring = TTLocalizer.NumToColor[dna.headColor]
        animaltype = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
        name = colorstring + ' ' + animaltype

        toonFields = {
            'setName': (name, ),
            'WishNameState': WISHNAME_OPEN,
            'WishName': '',
            'setDNAString': (self.dna, ),
            'setDISLid': (self.target, )
        }

        self.csm.air.dbInterface.createObject(
            self.csm.air.dbId,
            self.csm.air.dclassesByName['DistributedToonUD'], toonFields,
            self.__handleCreate)
    def requestBlackCatTransformation(self):
        if not self.air.newsManager.isHolidayRunning(
                ToontownGlobals.BLACK_CAT_DAY):
            return

        avId = self.air.getAvatarIdFromSender()
        av = self.air.doId2do.get(avId)

        if not av or av.getTutorialAck(
        ) or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a:
            return

        newDNA = ToonDNA()
        newDNA.makeFromNetString(av.getDNAString())
        newDNA.updateToonProperties(armColor=26, legColor=26, headColor=26)
        taskMgr.doMethodLater(
            1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()),
            'transform-%d' % avId)
        self.sendUpdateToAvatarId(avId, 'doBlackCatTransformation', [])
Example #19
0
    def enterLoadHouse(self):
        # Quickly parse DNA and get gender.
        dna = ToonDNA()
        dna.makeFromNetString(self.toon['setDNAString'][0])
        gender = 1 if dna.getGender() == 'm' else 0

        # Activate the house:
        self.mgr.air.sendActivate(
            self.houseId, self.mgr.air.districtId, self.estate.zoneId,
            self.mgr.air.dclassesByName['DistributedHouseAI'], {
                'setHousePos': [self.houseIndex],
                'setColor': [self.houseIndex],
                'setName': [self.toon['setName'][0]],
                'setAvatarId': [self.toon['ID']],
                'setGender': [gender]
            })

        # Now we wait for the house to show up... We do this by hanging a messenger
        # hook which the DistributedHouseAI throws once it spawns.
        self.acceptOnce('generate-%d' % self.houseId, self.__gotHouse)
    def requestBlackCatTransformation(self):
        avId = self.air.getAvatarIdFromSender()
        av = self.air.doId2do.get(avId)
        if not av:
            return

        if not simbase.air.wantHalloween and not simbase.air.holidayManager.isHolidayRunning(
                HALLOWEEN):
            return

        if av.dna.getAnimal() == 'cat' and av.dna.headColor != 0x1a:
            newDNA = ToonDNA()
            newDNA.makeFromNetString(av.getDNAString())
            newDNA.headColor = 0x1a
            newDNA.armColor = 0x1a
            newDNA.legColor = 0x1a
            taskMgr.doMethodLater(
                1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()),
                'transform-%d' % avId)

            self.sendUpdate('doBlackCatTransformation', [avId])
 def setDNA(self, dnaString, finished, whichItem):
     avId = self.air.getAvatarIdFromSender()
     if avId != self.avId:
         self.air.writeServerEvent(
             'suspicious', avId,
             'Tried to set DNA from closet while not using it!')
         return
     av = self.air.doId2do.get(avId)
     if not av:
         self.air.writeServerEvent(
             'suspicious', avId,
             'Interacted with a closet from another shard!')
         return
     if not self.__verifyAvatarInMyZone(av):
         self.air.writeServerEvent(
             'suspicious', avId, 'Tried to setDNA while in another zone!')
         return
     testDna = ToonDNA()
     if not testDna.isValidNetString(dnaString):
         self.air.writeServerEvent('suspicious', avId,
                                   'Tried to set invalid DNA at a closet!')
         return
     if not finished:
         testDna.makeFromNetString(dnaString)
         if not self.__checkValidDNAChange(av, testDna):
             self.air.writeServerEvent(
                 'suspicious', avId,
                 'Tried to change their DNA temporarily!')
             return
         self.sendUpdate('setCustomerDNA', [avId, dnaString])
         return
     elif finished == 1:
         self.d_setMovie(ClosetGlobals.CLOSET_MOVIE_COMPLETE, avId,
                         globalClockDelta.getRealNetworkTime())
         self.resetMovie()
         self.d_setState(ClosetGlobals.CLOSED, 0, self.furnitureMgr.ownerId,
                         self.gender, self.topList, self.botList)
         av.b_setDNAString(self.customerDNA.makeNetString())
         self.removedBottoms = []
         self.removedTops = []
         self.customerDNA = None
         self.avId = None
     elif finished == 2:
         if avId != self.furnitureMgr.ownerId:
             self.air.writeServerEvent(
                 'suspicious', avId,
                 'Tried to set their clothes from somebody else\'s closet!')
             return
         testDna.makeFromNetString(dnaString)
         if whichItem & ClosetGlobals.SHIRT:
             success = av.replaceItemInClothesTopsList(
                 testDna.topTex, testDna.topTexColor, testDna.sleeveTex,
                 testDna.sleeveTexColor, self.customerDNA.topTex,
                 self.customerDNA.topTexColor, self.customerDNA.sleeveTex,
                 self.customerDNA.sleeveTexColor)
             if success:
                 self.customerDNA.topTex = testDna.topTex
                 self.customerDNA.topTexColor = testDna.topTexColor
                 self.customerDNA.sleeveTex = testDna.sleeveTex
                 self.customerDNA.sleeveTexColor = testDna.sleeveTexColor
             else:
                 self.air.writeServerEvent(
                     'suspicious', avId,
                     'Tried to set their shirt to a shirt they don\'t own!')
         if whichItem & ClosetGlobals.SHORTS:
             success = av.replaceItemInClothesBottomsList(
                 testDna.botTex, testDna.botTexColor,
                 self.customerDNA.botTex, self.customerDNA.botTexColor)
             if success:
                 self.customerDNA.botTex = testDna.botTex
                 self.customerDNA.botTexColor = testDna.botTexColor
                 if self.customerDNA.torso != testDna.torso:
                     if self.customerDNA.gender == 'm':
                         self.air.writeServerEvent(
                             'suspicious', avId,
                             'Tried to change their torso size!')
                         return
                     elif self.customerDNA.torso[0] != testDna.torso[0]:
                         self.air.writeServerEvent(
                             'suspicious', avId,
                             'Tried to change their torso size!')
                         return
                 self.customerDNA.torso = testDna.torso
             else:
                 self.air.writeServerEvent(
                     'suspicious', avId,
                     'Tried to set their shorts to a pair they don\'t own!')
         for bottom in self.removedBottoms:
             botTex, botTexColor = bottom
             success = av.removeItemInClothesBottomsList(
                 botTex, botTexColor)
             if not success:
                 self.air.writeServerEvent(
                     'suspicious', avId,
                     'Tried to remove a bottom they didn\'t have!')
         for top in self.removedTops:
             topTex, topTexColor, sleeveTex, sleeveTexColor = top
             success = av.removeItemInClothesTopsList(
                 topTex, topTexColor, sleeveTex, sleeveTexColor)
             if not success:
                 self.air.writeServerEvent(
                     'suspicious', avId,
                     'Tried to remove a top they didn\'t have!')
         av.b_setDNAString(self.customerDNA.makeNetString())
         av.b_setClothesTopsList(av.getClothesTopsList())
         av.b_setClothesBottomsList(av.getClothesBottomsList())
         self.topList = av.getClothesTopsList()
         self.botList = av.getClothesBottomsList()
         self.removedBottoms = []
         self.removedTops = []
         self.d_setMovie(ClosetGlobals.CLOSET_MOVIE_COMPLETE, avId,
                         globalClockDelta.getRealNetworkTime())
         self.resetMovie()
         self.d_setState(ClosetGlobals.CLOSED, 0, self.furnitureMgr.ownerId,
                         self.gender, self.topList, self.botList)
         self.customerDNA = None
         self.avId = None
 def setDNA(self, dnaString, finished, whichItem):
     avId = self.air.getAvatarIdFromSender()
     if avId != self.avId:
         self.air.writeServerEventMessage('suspicious', avId, 'Tried to set DNA from closet while not using it!')
         return
     av = self.air.doId2do.get(avId)
     if not av:
         self.air.writeServerEventMessage('suspicious', avId, 'Interacted with a closet from another shard!')
         return
     if not self.__verifyAvatarInMyZone(av):
         self.air.writeServerEventMessage('suspicious', avId, 'Tried to setDNA while in another zone!')
         return
     testDna = ToonDNA()
     if not testDna.isValidNetString(dnaString):
         self.air.writeServerEventMessage('suspicious', avId, 'Tried to set invalid DNA at a closet!')
         return
     if not finished:
         testDna.makeFromNetString(dnaString)
         if not self.__checkValidDNAChange(av, testDna):
                 self.air.writeServerEventMessage('suspicious', avId, 'Tried to change their DNA temporarily!')
                 return
         self.sendUpdate('setCustomerDNA', [avId, dnaString])
         return
     elif finished == 1:
         self.d_setMovie(ClosetGlobals.CLOSET_MOVIE_COMPLETE, avId, globalClockDelta.getRealNetworkTime())
         self.resetMovie()
         self.d_setState(ClosetGlobals.CLOSED, 0, self.furnitureMgr.ownerId, self.gender, self.topList, self.botList)
         av.b_setDNAString(self.customerDNA.makeNetString())
         self.removedBottoms = []
         self.removedTops = []
         self.customerDNA = None
         self.avId = None
     elif finished == 2:
         if avId != self.furnitureMgr.ownerId:
             self.air.writeServerEventMessage('suspicious', avId, 'Tried to set their clothes from somebody else\'s closet!')
             return
         testDna.makeFromNetString(dnaString)
         if whichItem & ClosetGlobals.SHIRT:
             success = av.replaceItemInClothesTopsList(testDna.topTex, testDna.topTexColor, testDna.sleeveTex, testDna.sleeveTexColor, self.customerDNA.topTex, self.customerDNA.topTexColor, self.customerDNA.sleeveTex, self.customerDNA.sleeveTexColor)
             if success:
                 self.customerDNA.topTex = testDna.topTex
                 self.customerDNA.topTexColor = testDna.topTexColor
                 self.customerDNA.sleeveTex = testDna.sleeveTex
                 self.customerDNA.sleeveTexColor = testDna.sleeveTexColor
             else:
                 self.air.writeServerEventMessage('suspicious', avId, 'Tried to set their shirt to a shirt they don\'t own!')
         if whichItem & ClosetGlobals.SHORTS:
             success = av.replaceItemInClothesBottomsList(testDna.botTex, testDna.botTexColor, self.customerDNA.botTex, self.customerDNA.botTexColor)
             if success:
                 self.customerDNA.botTex = testDna.botTex
                 self.customerDNA.botTexColor = testDna.botTexColor
                 if self.customerDNA.torso != testDna.torso:
                         if self.customerDNA.gender == 'm':
                             self.air.writeServerEventMessage('suspicious', avId, 'Tried to change their torso size!')
                             return
                         elif self.customerDNA.torso[0] != testDna.torso[0]:
                             self.air.writeServerEventMessage('suspicious', avId, 'Tried to change their torso size!')
                             return
                 self.customerDNA.torso = testDna.torso
             else:
                 self.air.writeServerEventMessage('suspicious', avId, 'Tried to set their shorts to a pair they don\'t own!')
         for bottom in self.removedBottoms:
             botTex, botTexColor = bottom
             success = av.removeItemInClothesBottomsList(botTex, botTexColor)
             if not success:
                 self.air.writeServerEventMessage('suspicious', avId, 'Tried to remove a bottom they didn\'t have!')
         for top in self.removedTops:
             topTex, topTexColor, sleeveTex, sleeveTexColor = top
             success = av.removeItemInClothesTopsList(topTex, topTexColor, sleeveTex, sleeveTexColor)
             if not success:
                 self.air.writeServerEventMessage('suspicious', avId, 'Tried to remove a top they didn\'t have!')
         av.b_setDNAString(self.customerDNA.makeNetString())
         av.b_setClothesTopsList(av.getClothesTopsList())
         av.b_setClothesBottomsList(av.getClothesBottomsList())
         self.topList = av.getClothesTopsList()
         self.botList = av.getClothesBottomsList()
         self.removedBottoms = []
         self.removedTops = []
         self.d_setMovie(ClosetGlobals.CLOSET_MOVIE_COMPLETE, avId, globalClockDelta.getRealNetworkTime())
         self.resetMovie()
         self.d_setState(ClosetGlobals.CLOSED, 0, self.furnitureMgr.ownerId, self.gender, self.topList, self.botList)
         self.customerDNA = None
         self.avId = None
    def enterCreateAvatar(self):
        dna = ToonDNA()
        dna.makeFromNetString(self.dna)
            
        dg = PyDatagram(self.name)
        dgi = PyDatagramIterator(dg)
        isPattern, name = isNamePattern(dgi, self.csm.namePattern, dna.gender)
        
        if not name:
            self.demand('Kill', 'There\'s an issue with your name request!')
            return
        
        if not isPattern:
            self.__pendingName = name
            colorstring = TTLocalizer.NumToColor[dna.headColor]
            animaltype = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
            name = colorstring + ' ' + animaltype

        toonFields = {
            'setName': (name,),
            'WishNameState': ('PENDING' if not isPattern else '',),
            'WishName': (self.__pendingName,),
            'setDNAString': (self.dna,),
            'setDISLid': (self.target,)
        }
        
        if not self.tf and not self.hood:
            toonFields['setTutorialAck'] = (1,)
            toonFields['setQuests'] = ([163, 1000, 1000, 100, 3],)
            
        if self.hood:
            hqZones = []
            
            if self.hood == 1: # dd
                if not -1 in self.trackChoice:
                    self.demand('Kill', 'Invalid track choice for DD!')
                    return
                    
                jarsize = 50
                gaglimit = 25
                hoodId = 1000
                prevZones = [2000]
                questlimit = 2
                tier = 4
                hp = 25
                expm = 1500
                
            elif self.hood == 2: # dg
                if -1 in self.trackChoice:
                    self.demand('Kill', 'Invalid track choice for DG!')
                    return
                    
                jarsize = 60
                gaglimit = 30
                hoodId = 5000
                prevZones = [1000, 2000]
                questlimit = 2
                tier = 7
                hp = 34
                expm = 2300
                
            elif self.hood == 3 and config.GetBool('csp-want-mm', False): # mm (MIGHT BE DISABLED)
                if -1 in self.trackChoice:
                    self.demand('Kill', 'Invalid track choice for MM!')
                    return
                    
                jarsize = 80
                gaglimit = 35
                hoodId = 4000
                prevZones = [1000, 2000, 5000]
                questlimit = 3
                tier = 8
                hp = 43
                expm = 4000
                hqZones = [11000]
                toonFields['setCogParts'] = ((0, 0, 0, 1),)
                
            else:
                self.demand('Kill', 'Invalid hood!')
                return
                
            ta = [0, 0, 0, 0, 1, 1, 0]
            for t in self.trackChoice:
                if t != -1:
                    ta[t] = 1
                
            toonFields['setMaxMoney'] = (jarsize,)
            toonFields['setMaxCarry'] = (gaglimit,)
            toonFields['setTrackAccess'] = (ta,)
            toonFields['setDefaultZone'] = (hoodId,)
            toonFields['setHoodsVisited'] = (prevZones + hqZones + [hoodId],)
            toonFields['setZonesVisited'] = (prevZones + hqZones + [hoodId],)
            toonFields['setTeleportAccess'] = (prevZones,)
            toonFields['setQuestCarryLimit'] = (questlimit,)
            toonFields['setRewardHistory'] = (tier, [])
            toonFields['setHp'] = (hp,)
            toonFields['setMaxHp'] = (hp,)
            toonFields['setTutorialAck'] = (1,)
            
            e = Experience()
            e.makeExpRegular(expm)
            
            for i, t in enumerate(ta):
                if not t:
                    e.experience[i] = 0
                    
            toonFields['setExperience'] = (e.makeNetString(),)

        self.csm.air.dbInterface.createObject(
            self.csm.air.dbId,
            self.csm.air.dclassesByName['DistributedToonUD'],
            toonFields,
            self.__handleCreate)
    def enterCreateAvatar(self):
        name = self.name
        if not isNamePattern(self.name):
            dna = ToonDNA()
            dna.makeFromNetString(self.dna)
            colorstring = TTLocalizer.NumToColor[dna.headColor]
            animaltype = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
            name = colorstring + ' ' + animaltype

        toonFields = {
            'setName': (name,),
            'WishNameState': ('PENDING' if not isNamePattern(self.name) else '',),
            'WishName': (self.name if not isNamePattern(self.name) else '',),
            'setDNAString': (self.dna,),
            'setDISLid': (self.target,)
        }
        
        if not self.tf and not self.hood:
            toonFields['setTutorialAck'] = (1,)
            toonFields['setQuests'] = ([163, 1000, 1000, 100, 3],)
            
        if self.hood:
            hqZones = []
            
            if self.hood == 1: # dd
                if not -1 in self.trackChoice:
                    self.demand('Kill', 'Invalid track choice for DD!')
                    return
                    
                jarsize = 50
                gaglimit = 25
                hoodId = 1000
                prevZones = [2000]
                questlimit = 2
                tier = 4
                hp = 25
                expm = 1500
                
            elif self.hood == 2: # dg
                if -1 in self.trackChoice:
                    self.demand('Kill', 'Invalid track choice for DG!')
                    return
                    
                jarsize = 60
                gaglimit = 30
                hoodId = 5000
                prevZones = [1000, 2000]
                questlimit = 2
                tier = 7
                hp = 34
                expm = 2300
                
            elif self.hood == 3 and config.GetBool('csp-want-mm', False): # mm (MIGHT BE DISABLED)
                if-1 in self.trackChoice:
                    self.demand('Kill', 'Invalid track choice for MM!')
                    return
                    
                jarsize = 80
                gaglimit = 35
                hoodId = 4000
                prevZones = [1000, 2000, 5000]
                questlimit = 3
                tier = 8
                hp = 43
                expm = 4000
                hqZones = [11000]
                toonFields['setCogParts'] = ((0, 0, 0, 1),)
                
            else:
                self.demand('Kill', 'Invalid hood!')
                return
                
            ta = [0, 0, 0, 0, 1, 1, 0]
            for t in self.trackChoice:
                if t != -1:
                    ta[t] = 1
                
            toonFields['setMaxMoney'] = (jarsize,)
            toonFields['setMaxCarry'] = (gaglimit,)
            toonFields['setTrackAccess'] = (ta,)
            toonFields['setDefaultZone'] = (hoodId,)
            toonFields['setHoodsVisited'] = (prevZones + hqZones + [hoodId],)
            toonFields['setZonesVisited'] = (prevZones + hqZones + [hoodId],)
            toonFields['setTeleportAccess'] = (prevZones,)
            toonFields['setQuestCarryLimit'] = (questlimit,)
            toonFields['setRewardHistory'] = (tier, [])
            toonFields['setHp'] = (hp,)
            toonFields['setMaxHp'] = (hp,)
            toonFields['setTutorialAck'] = (1,)
            
            e = Experience()
            e.makeExpRegular(expm)
            
            for i, t in enumerate(ta):
                if not t:
                    e.experience[i] = 0
                    
            toonFields['setExperience'] = (e.makeNetString(),)

        self.csm.air.dbInterface.createObject(
            self.csm.air.dbId,
            self.csm.air.dclassesByName['DistributedToonUD'],
            toonFields,
            self.__handleCreate)
    def enterCreateAvatar(self):
        dna = ToonDNA()
        dna.makeFromNetString(self.dna)
        colorString = TTLocalizer.NumToColor[dna.headColor]
        animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
        name = ' '.join((colorString, animalType))
		
        toonFields = {
            'setName': (name,),
            'WishNameState': ('OPEN',),
            'WishName': ('',),
            'setDNAString': (self.dna,),
            'setDISLid': (self.target,),
            'setUber': (self.uber,)
        }
		
        if self.pg > 0:
            if self.pg == 1:
                maxMoney = 50
                maxCarry = 25
                startingHood = 1000
                prevZones = [2000]
                questLimit = 3
                questTier = 4
                if self.uber == 1:
                    hp = 15
                else:
                    hp = 25
                experience = [600, 800]
                
            elif self.pg == 2: 
                maxMoney = 60
                maxCarry = 30
                startingHood = 5000
                prevZones = [1000, 2000]
                questLimit = 3
                questTier = 7
                if self.uber == 1:
                    hp = 15
                elif self.uber == 2:
                    hp = 25
                else:
                    hp = 34
                experience = [1000, 2400]
			
            exp = Experience()
            
            for i, t in enumerate(self.trackAccess):
                if t:
                    chosenExp = random.randint(experience[0], experience[1])
                    exp.setExp(i, chosenExp)

            toonFields['setExperience'] = (exp.makeNetString(),)
			
            toonFields['setMaxMoney'] = (maxMoney,)
            toonFields['setMaxCarry'] = (maxCarry,)
            toonFields['setTrackAccess'] = (self.trackAccess,)
            toonFields['setDefaultZone'] = (startingHood,)
            toonFields['setHoodsVisited'] = (prevZones + [startingHood],)
            toonFields['setZonesVisited'] = (prevZones + [startingHood],)
            toonFields['setTeleportAccess'] = (prevZones,)
            toonFields['setQuestCarryLimit'] = (questLimit,)
            toonFields['setRewardHistory'] = (questTier, [])
            toonFields['setHp'] = (hp,)
            toonFields['setMaxHp'] = (hp,)
            toonFields['setTutorialAck'] = (1,)
				
        self.csm.air.dbInterface.createObject(
            self.csm.air.dbId,
            self.csm.air.dclassesByName['DistributedToonUD'],
            toonFields,
            self.__handleCreate)