本文整理汇总了Python中toontown.toon.ToonDNA.ToonDNA.makeFromNetString方法的典型用法代码示例。如果您正苦于以下问题:Python ToonDNA.makeFromNetString方法的具体用法?Python ToonDNA.makeFromNetString怎么用?Python ToonDNA.makeFromNetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.toon.ToonDNA.ToonDNA
的用法示例。
在下文中一共展示了ToonDNA.makeFromNetString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: removeItem
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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!')
示例2: enterLoadHouse
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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)
示例3: requestBlackCatTransformation
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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])
示例4: requestBlackCatTransformation
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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", [])
示例5: requestTransformation
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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])
示例6: requestTransformation
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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])
示例7: enterCreateAvatar
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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)
示例8: enterLoadHouse
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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)
示例9: enterCreateAvatar
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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
)
示例10: enterCreateAvatar
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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(
#.........这里部分代码省略.........
示例11: setDNA
# 需要导入模块: from toontown.toon.ToonDNA import ToonDNA [as 别名]
# 或者: from toontown.toon.ToonDNA.ToonDNA import makeFromNetString [as 别名]
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