diff --git a/toontown/makeatoon/BodyShop.py b/toontown/makeatoon/BodyShop.py index deb5a39e..8ad8244b 100755 --- a/toontown/makeatoon/BodyShop.py +++ b/toontown/makeatoon/BodyShop.py @@ -166,6 +166,14 @@ class BodyShop(StateData.StateData): self.shuffleButton.unload() self.ignore('MAT-newToonCreated') + def checkColors(self): + if self.dna.armColor not in ToonDNA.defaultColorList: + self.dna.armColor = ToonDNA.defaultColorList[0] + if self.dna.legColor not in ToonDNA.defaultColorList: + self.dna.legColor = ToonDNA.defaultColorList[0] + if self.dna.headColor not in ToonDNA.defaultColorList: + self.dna.headColor = ToonDNA.defaultColorList[0] + def __swapTorso(self, offset): gender = self.toon.style.getGender() if not self.clothesPicked: @@ -174,12 +182,7 @@ class BodyShop(StateData.StateData): 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] + self.checkColors() if self.toon.style.topTex not in ToonDNA.MakeAToonBoyShirts: randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON) shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt @@ -197,12 +200,7 @@ class BodyShop(StateData.StateData): 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] + self.checkColors() if self.toon.style.topTex not in ToonDNA.MakeAToonGirlShirts: randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON) shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt diff --git a/toontown/makeatoon/ColorShop.py b/toontown/makeatoon/ColorShop.py index 03e80e05..80f24763 100755 --- a/toontown/makeatoon/ColorShop.py +++ b/toontown/makeatoon/ColorShop.py @@ -17,19 +17,14 @@ class ColorShop(StateData.StateData): self.colorAll = 1 return - def getGenderColorList(self, dna): - if self.dna.getGender() == 'm': - colorList = ToonDNA.defaultBoyColorList - else: - colorList = ToonDNA.defaultGirlColorList - - return colorList + def getColorList(self): + return ToonDNA.defaultColorList def enter(self, toon, shopsVisited = []): base.disableMouse() self.toon = toon self.dna = toon.getStyle() - colorList = self.getGenderColorList(self.dna) + colorList = self.getColorList() try: self.headChoice = colorList.index(self.dna.headColor) self.armChoice = colorList.index(self.dna.armColor) @@ -48,7 +43,7 @@ class ColorShop(StateData.StateData): self.startColor = 0 self.acceptOnce('last', self.__handleBackward) self.acceptOnce('next', self.__handleForward) - choicePool = [self.getGenderColorList(self.dna), self.getGenderColorList(self.dna), self.getGenderColorList(self.dna), self.getGenderColorList(self.dna)] + choicePool = [self.getColorList(), self.getColorList(), self.getColorList(), self.getColorList()] self.shuffleButton.setChoicePool(choicePool) self.accept(self.shuffleFetchMsg, self.changeColor) self.acceptOnce('MAT-newToonCreated', self.shuffleButton.cleanHistory) @@ -172,7 +167,7 @@ class ColorShop(StateData.StateData): self.ignore('MAT-newToonCreated') def __swapAllColor(self, offset): - colorList = self.getGenderColorList(self.dna) + colorList = self.getColorList() length = len(colorList) choice = (self.headChoice + offset) % length self.__updateScrollButtons(choice, length, self.allLButton, self.allRButton) @@ -185,7 +180,7 @@ class ColorShop(StateData.StateData): self.__swapLegColor(choice - oldLegColorIndex) def __swapHeadColor(self, offset): - colorList = self.getGenderColorList(self.dna) + colorList = self.getColorList() length = len(colorList) self.headChoice = (self.headChoice + offset) % length self.__updateScrollButtons(self.headChoice, length, self.headLButton, self.headRButton) @@ -194,7 +189,7 @@ class ColorShop(StateData.StateData): self.toon.swapToonColor(self.dna) def __swapArmColor(self, offset): - colorList = self.getGenderColorList(self.dna) + colorList = self.getColorList() length = len(colorList) self.armChoice = (self.armChoice + offset) % length self.__updateScrollButtons(self.armChoice, length, self.armLButton, self.armRButton) @@ -203,7 +198,7 @@ class ColorShop(StateData.StateData): self.toon.swapToonColor(self.dna) def __swapGloveColor(self, offset): - colorList = self.getGenderColorList(self.dna) + colorList = self.getColorList() length = len(colorList) self.gloveChoice = (self.gloveChoice + offset) % length self.__updateScrollButtons(self.gloveChoice, length, self.gloveLButton, self.gloveRButton) @@ -212,7 +207,7 @@ class ColorShop(StateData.StateData): self.toon.swapToonColor(self.dna) def __swapLegColor(self, offset): - colorList = self.getGenderColorList(self.dna) + colorList = self.getColorList() length = len(colorList) self.legChoice = (self.legChoice + offset) % length self.__updateScrollButtons(self.legChoice, length, self.legLButton, self.legRButton) @@ -240,7 +235,7 @@ class ColorShop(StateData.StateData): def changeColor(self): self.notify.debug('Entering changeColor') - colorList = self.getGenderColorList(self.dna) + colorList = self.getColorList() newChoice = self.shuffleButton.getCurrChoice() newHeadColorIndex = colorList.index(newChoice[0]) newArmColorIndex = colorList.index(newChoice[1]) diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index b0339dcc..bce07cd8 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -4755,47 +4755,29 @@ def dna(part, value): return 'Legs set to: ' + dna.legs if part == 'headcolor': - if dna.gender not in ('m', 'f'): - return 'Unknown gender.' - if (dna.gender == 'm') and (value not in ToonDNA.defaultBoyColorList): - return 'Invalid male head color index: ' + str(value) - if (dna.gender == 'f') and (value not in ToonDNA.defaultGirlColorList): - return 'Invalid female head color index: ' + str(value) + if value not in ToonDNA.defaultColorList: + return 'Invalid head color index: ' + str(value) dna.headColor = value invoker.b_setDNAString(dna.makeNetString()) return 'Head color index set to: ' + str(dna.headColor) if part == 'armcolor': - if dna.gender not in ('m', 'f'): - return 'Unknown gender.' - if (dna.gender == 'm') and (value not in ToonDNA.defaultBoyColorList): - return 'Invalid male arm color index: ' + str(value) - if (dna.gender == 'f') and (value not in ToonDNA.defaultGirlColorList): - return 'Invalid female arm color index: ' + str(value) + if value not in ToonDNA.defaultColorList: + return 'Invalid arm color index: ' + str(value) dna.armColor = value invoker.b_setDNAString(dna.makeNetString()) return 'Arm color index set to: ' + str(dna.armColor) if part == 'legcolor': - if dna.gender not in ('m', 'f'): - return 'Unknown gender.' - if (dna.gender == 'm') and (value not in ToonDNA.defaultBoyColorList): - return 'Invalid male leg color index: ' + str(value) - if (dna.gender == 'f') and (value not in ToonDNA.defaultGirlColorList): - return 'Invalid female leg color index: ' + str(value) + if value not in ToonDNA.defaultColorList: + return 'Invalid leg color index: ' + str(value) dna.legColor = value invoker.b_setDNAString(dna.makeNetString()) return 'Leg color index set to: ' + str(dna.legColor) if part == 'color': - if dna.gender not in ('m', 'f'): - return 'Unknown gender.' - if (dna.gender == 'm') and (value not in ToonDNA.defaultBoyColorList): - if (value != 0x1a) and (value != 0x00): - return 'Invalid male color index: ' + str(value) - if (dna.gender == 'f') and (value not in ToonDNA.defaultGirlColorList): - if (value != 0x1a) and (value != 0x00): - return 'Invalid female color index: ' + str(value) + if (value not in ToonDNA.defaultColorList) and (value != 0x1a) and (value != 0x00): + return 'Invalid color index: ' + str(value) if (value == 0x1a) and (dna.getAnimal() != 'cat'): return 'Invalid color index for species: ' + dna.getAnimal() if (value == 0x00) and (dna.getAnimal() != 'bear'): diff --git a/toontown/toon/ToonDNA.py b/toontown/toon/ToonDNA.py index 55ed726b..a5f05326 100755 --- a/toontown/toon/ToonDNA.py +++ b/toontown/toon/ToonDNA.py @@ -1931,47 +1931,7 @@ allColorsList = [VBase4(1.0, 1.0, 1.0, 1.0), VBase4(0.862745, 0.078431, 0.235294, 1.0), VBase4(0.0, 0.635294, 0.513725, 1.0), VBase4(0.803921, 0.498039, 0.196078, 1.0)] -defaultBoyColorList = [0, - 1, - 32, - 2, - 3, - 4, - 5, - 6, - 7, - 29, - 8, - 37, - 35, - 9, - 10, - 33, - 11, - 12, - 30, - 13, - 14, - 15, - 39, - 27, - 28, - 16, - 17, - 18, - 19, - 20, - 21, - 38, - 36, - 22, - 23, - 24, - 25, - 34, - 31, - 26] -defaultGirlColorList = [0, +defaultColorList = [0, 1, 32, 2, @@ -2012,7 +1972,7 @@ defaultGirlColorList = [0, 31, 26] allColorsListApproximations = map(lambda x: VBase4(round(x[0], 3), round(x[1], 3), round(x[2], 3), round(x[3], 3)), allColorsList) -allowedColors = set(map(lambda x: allColorsListApproximations[x], set([0] + defaultBoyColorList + defaultGirlColorList + [26]))) +allowedColors = set(map(lambda x: allColorsListApproximations[x], set([0] + defaultColorList + [26]))) HatModels = [None, 'phase_4/models/accessories/tt_m_chr_avt_acc_hat_baseball', 'phase_4/models/accessories/tt_m_chr_avt_acc_hat_safari', @@ -2715,6 +2675,7 @@ class ToonDNA: self.head = generator.choice(toonHeadTypes[:22]) top, topColor, sleeve, sleeveColor = getRandomTop(gender, generator=generator) bottom, bottomColor = getRandomBottom(gender, generator=generator) + color = generator.choice(defaultColorList) if gender == 'm': self.torso = generator.choice(toonTorsoTypes[:3]) self.topTex = top @@ -2723,10 +2684,6 @@ class ToonDNA: self.sleeveTexColor = sleeveColor self.botTex = bottom self.botTexColor = bottomColor - color = generator.choice(defaultBoyColorList) - self.armColor = color - self.legColor = color - self.headColor = color else: self.torso = generator.choice(toonTorsoTypes[:6]) self.topTex = top @@ -2739,10 +2696,9 @@ class ToonDNA: bottom, bottomColor = getRandomBottom(gender, generator=generator, girlBottomType=SHORTS) self.botTex = bottom self.botTexColor = bottomColor - color = generator.choice(defaultGirlColorList) - self.armColor = color - self.legColor = color - self.headColor = color + self.armColor = color + self.legColor = color + self.headColor = color self.gloveColor = 0 self.laughingMan = 0