From fea04b73e798a964149147ecf80d9a590b6a6892 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 17 Jul 2015 17:24:21 +0300 Subject: [PATCH] Give girls girl furniture --- dependencies/astron/dclass/stride.dc | 1 + toontown/estate/DNAFurnitureReaderAI.py | 11 +++++++---- toontown/estate/DistributedHouseAI.py | 14 +++++++------- toontown/estate/DistributedHouseInteriorAI.py | 2 +- toontown/estate/EstateManagerAI.py | 6 ++++++ 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 700c568a..65e1baf8 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -1264,6 +1264,7 @@ dclass DistributedHouse : DistributedObject { setAvatarId(uint32 toonId = 0) required broadcast db; setName(string toonName = "") required broadcast db; setColor(uint8 colorIndex = 0) required broadcast db; + setGender(uint8 = 0) required broadcast db; setAtticItems(blob = "") required db; setInteriorItems(blob = "") required db; setAtticWallpaper(blob = "") required db; diff --git a/toontown/estate/DNAFurnitureReaderAI.py b/toontown/estate/DNAFurnitureReaderAI.py index 020c7eee..53248c27 100755 --- a/toontown/estate/DNAFurnitureReaderAI.py +++ b/toontown/estate/DNAFurnitureReaderAI.py @@ -9,9 +9,9 @@ DNA2Furniture = { 'chairA': 100, 'chair': 110, - 'regular_bed': 200, + 'regular_bed': (200, 210), 'FireplaceSq': 400, - 'closetBoy': 500, + 'closetBoy': (500, 510), 'lamp_short': 600, 'lamp_tall': 610, 'couch_1person': 700, @@ -28,7 +28,7 @@ DNA2Furniture = { 'bookcase_low': 1130, 'ending_table': 1200, 'jellybeanBank': 1300, - 'trunkBoy': 4000 + 'trunkBoy': (4000, 4010) } @@ -39,8 +39,9 @@ class DNAFurnitureReaderAI: # house to the default furniture arrangement. notify = directNotify.newCategory("DNAFurnitureReaderAI") - def __init__(self, dnaData, phonePos): + def __init__(self, dnaData, gender, phonePos): self.dnaData = dnaData + self.gender = gender self.phonePos = phonePos self.itemList = None @@ -70,6 +71,8 @@ class DNAFurnitureReaderAI: itemId = DNA2Furniture[code] if itemId is None: continue + if hasattr(itemId, '__getitem__'): + itemId = itemId[self.gender] x, y, z = child.getPos() h, p, r = child.getHpr() diff --git a/toontown/estate/DistributedHouseAI.py b/toontown/estate/DistributedHouseAI.py index 20cda9c6..1b763e9e 100755 --- a/toontown/estate/DistributedHouseAI.py +++ b/toontown/estate/DistributedHouseAI.py @@ -21,7 +21,7 @@ class DistributedHouseAI(DistributedObjectAI): self.name = '' self.color = 0 self.housePos = 0 - self.gender = 1 + self.gender = 0 self.isInteriorInitialized = 1 self.atticItems = CatalogItemList(store=Customization) @@ -55,12 +55,6 @@ class DistributedHouseAI(DistributedObjectAI): if self.avatarId: self.mailbox = DistributedMailboxAI(self.air, self) self.mailbox.generateWithRequired(self.zoneId) - - if not self.isInteriorInitialized: - self.notify.info('Initializing interior...') - self.interior.initialize() - self.b_setInteriorInitialized(1) - self.sendUpdate('setHouseReady', []) def delete(self): @@ -305,3 +299,9 @@ class DistributedHouseAI(DistributedObjectAI): self.atticWallpaper.append(item) self.d_setAtticWallpaper(self.atticWallpaper.getBlob()) self.interior.furnitureManager.loadFromHouse() + + def initializeInterior(self): + if (not self.isInteriorInitialized): + self.notify.info('Initializing interior...') + self.interior.initialize() + self.b_setInteriorInitialized(1) \ No newline at end of file diff --git a/toontown/estate/DistributedHouseInteriorAI.py b/toontown/estate/DistributedHouseInteriorAI.py index c48727ff..1805f1f0 100755 --- a/toontown/estate/DistributedHouseInteriorAI.py +++ b/toontown/estate/DistributedHouseInteriorAI.py @@ -70,7 +70,7 @@ class DistributedHouseInteriorAI(DistributedObjectAI): dnaData = loadDNAFileAI(dnaStorage, dnaFile) # Read it into furniture... - furnitureReader = DNAFurnitureReaderAI(dnaData, [-11, 2, 0, 0, 0, 0]) + furnitureReader = DNAFurnitureReaderAI(dnaData, self.house.gender, [-11, 2, 0, 0, 0, 0]) # Set furniture: self.furnitureManager.setItems(furnitureReader.getBlob()) diff --git a/toontown/estate/EstateManagerAI.py b/toontown/estate/EstateManagerAI.py index 954259a0..709aa872 100755 --- a/toontown/estate/EstateManagerAI.py +++ b/toontown/estate/EstateManagerAI.py @@ -3,6 +3,7 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.fsm.FSM import FSM from toontown.estate.DistributedEstateAI import DistributedEstateAI from toontown.estate.DistributedHouseAI import DistributedHouseAI +from toontown.toon import ToonDNA import HouseGlobals import functools @@ -48,12 +49,16 @@ class LoadHouseFSM(FSM): self.demand('Off') def enterCreateHouse(self): + style = ToonDNA.ToonDNA() + style.makeFromNetString(self.toon['setDNAString'][0]) + self.mgr.air.dbInterface.createObject( self.mgr.air.dbId, self.mgr.air.dclassesByName['DistributedHouseAI'], { 'setName' : [self.toon['setName'][0]], 'setAvatarId' : [self.toon['ID']], + 'setGender': [0 if style.getGender() == 'm' else 1] }, self.__handleCreate) @@ -90,6 +95,7 @@ class LoadHouseFSM(FSM): def __gotHouse(self, house): self.house = house + house.initializeInterior() self.estate.houses[self.houseIndex] = self.house