From 86223ef6dfaf60f4d3ebd2d72f0b3bb1c9de9cdf Mon Sep 17 00:00:00 2001 From: John Date: Tue, 4 Aug 2015 19:59:47 +0300 Subject: [PATCH] Take that colorful coons! --- toontown/makeatoon/NameShop.py | 2 +- toontown/rpc/ToontownRPCHandler.py | 4 +-- toontown/toon/DistributedToonAI.py | 2 +- toontown/toon/ToonDNA.py | 32 +++++++++------------ toontown/toonbase/TTLocalizerEnglish.py | 2 ++ toontown/uberdog/ClientServicesManagerUD.py | 2 +- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/toontown/makeatoon/NameShop.py b/toontown/makeatoon/NameShop.py index 3755cf9a..9ef6b73b 100755 --- a/toontown/makeatoon/NameShop.py +++ b/toontown/makeatoon/NameShop.py @@ -673,7 +673,7 @@ class NameShop(StateData.StateData): self.nameResult['text'] = self.names[0] def findTempName(self): - colorstring = TTLocalizer.NumToColor[self.toon.style.headColor] + colorstring = TTLocalizer.ColorfulToon animaltype = TTLocalizer.AnimalToSpecies[self.toon.style.getAnimal()] tempname = colorstring + ' ' + animaltype if not TTLocalizer.NScolorPrecede: diff --git a/toontown/rpc/ToontownRPCHandler.py b/toontown/rpc/ToontownRPCHandler.py index 0f98f723..c40c4850 100755 --- a/toontown/rpc/ToontownRPCHandler.py +++ b/toontown/rpc/ToontownRPCHandler.py @@ -626,7 +626,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): { 'name': 'Toon Name', 'species': 'cat', - 'head-color': 'Red', + 'head-color': (1, 0, 0, 1), 'max-hp': 15, 'online': True } @@ -642,7 +642,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): dna.makeFromNetString(fields['setDNAString'][0]) result['species'] = ToonDNA.getSpeciesName(dna.head) - result['head-color'] = TTLocalizer.NumToColor[dna.headColor] + result['head-color'] = dna.headColor result['max-hp'] = fields['setMaxHp'][0] result['online'] = (avId in self.air.friendsManager.onlineToons) diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index a9bea6ad..ab78b47f 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -4616,7 +4616,7 @@ def badName(): """ target = spellbook.getTarget() _name = target.getName() - colorString = TTLocalizer.NumToColor[target.dna.headColor] + colorString = TTLocalizer.ColorfulToon animalType = TTLocalizer.AnimalToSpecies[target.dna.getAnimal()] target.b_setName(colorString + ' ' + animalType) target.sendUpdate('setWishNameState', ['REJECTED']) diff --git a/toontown/toon/ToonDNA.py b/toontown/toon/ToonDNA.py index a2230a16..6c522961 100755 --- a/toontown/toon/ToonDNA.py +++ b/toontown/toon/ToonDNA.py @@ -2452,7 +2452,9 @@ class ToonDNA: dg.addUint8(self.sleeveTexColor) dg.addUint8(self.botTex) dg.addUint8(self.botTexColor) - dg.addString(str((self.armColor, self.gloveColor, self.legColor, self.headColor))) + for colors in (self.armColor, self.gloveColor, self.legColor, self.headColor): + for color in colors[:-1]: + dg.addFloat64(color) elif self.type == 'u': notify.error('undefined avatar') else: @@ -2485,12 +2487,10 @@ class ToonDNA: sleeveTexColor = dgi.getUint8() botTex = dgi.getUint8() botTexColor = dgi.getUint8() - colors = ast.literal_eval(dgi.getString()) - armColor = colors[0] - gloveColor = colors[1] - legColor = colors[2] - headColor = colors[3] - print armColor, gloveColor, legColor, headColor + armColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) + gloveColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) + legColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) + headColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) if topTex >= len(Shirts): return False if topTexColor >= len(ClothesColors): @@ -2518,14 +2518,10 @@ class ToonDNA: return True def isValid(self, color): - print 'isvalid %s' % (color,) - if color + (1.0,) in allColorsList: - print 'all colors' + if color in allColorsList: return True - hsv = colorsys.rgb_to_hsv(*color) - print 'hsv %s' % (hsv,) - print str(0.36 <= hsv[1] <= 0.7 and 0.5 <= hsv[2] <= 0.8) + hsv = colorsys.rgb_to_hsv(*color[:-1]) return 0.36 <= hsv[1] <= 0.7 and 0.5 <= hsv[2] <= 0.8 def makeFromNetString(self, string): @@ -2550,14 +2546,12 @@ class ToonDNA: self.sleeveTexColor = dgi.getUint8() self.botTex = dgi.getUint8() self.botTexColor = dgi.getUint8() - colors = ast.literal_eval(dgi.getString()) - self.armColor = colors[0] - self.gloveColor = colors[1] - self.legColor = colors[2] - self.headColor = colors[3] + self.armColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) + self.gloveColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) + self.legColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) + self.headColor = (dgi.getFloat64(), dgi.getFloat64(), dgi.getFloat64(), 1.0) else: notify.error('unknown avatar type: ', self.type) - return None def defaultColor(self): return 25 diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index b1bc447d..ec030a2d 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8723,6 +8723,8 @@ TVPacks = ['QuackityHQ'] GagPopup = '%s: %s\nGags: %s' +ColorfulToon = 'Colorful' + Blacklist = [ "$1ut", "$h1t", diff --git a/toontown/uberdog/ClientServicesManagerUD.py b/toontown/uberdog/ClientServicesManagerUD.py index f2d49683..462b59d2 100755 --- a/toontown/uberdog/ClientServicesManagerUD.py +++ b/toontown/uberdog/ClientServicesManagerUD.py @@ -499,7 +499,7 @@ class CreateAvatarFSM(OperationFSM): def enterCreateAvatar(self): dna = ToonDNA() dna.makeFromNetString(self.dna) - colorString = TTLocalizer.NumToColor[dna.headColor] + colorString = TTLocalizer.ColorfulToon animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()] name = ' '.join((colorString, animalType)) toonFields = {