コード例 #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 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
コード例 #2
0
    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', [])
コード例 #3
0
 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, ),
         '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 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,),
         '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)
コード例 #5
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 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
コード例 #6
0
 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
コード例 #7
0
 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