def loadFromHouse(self):
        self.b_setAtticItems(self.house.getAtticItems())
        self.b_setAtticWallpaper(self.house.getAtticWallpaper())
        self.b_setAtticWindows(self.house.getAtticWindows())
        self.b_setDeletedItems(self.house.getDeletedItems())

        self.wallpaper = CatalogItemList(self.house.getInteriorWallpaper(),
                                         store=CatalogItem.Customization)
        self.applyWallpaper()
        self.windows = CatalogItemList(self.house.getInteriorWindows(),
                                       store=CatalogItem.Customization |
                                             CatalogItem.WindowPlacement)
        self.applyWindows()

        self.setItems(self.house.getInteriorItems())
    def buildList(self):
        self.itemList = CatalogItemList(store=(CatalogItem.Customization |
                                               CatalogItem.Location))

        # Find the interior node:
        for i in xrange(self.dnaData.getNumChildren()):
            child = self.dnaData.at(i)
            if child.getName() == 'interior':
                interior = child
                break
        else:
            self.notify.error('Could not find "interior" in DNA!')

        self.itemList.append(CatalogFurnitureItem(1399, posHpr=self.phonePos))
        # Every child in the interior node is a prop, thus:
        for i in xrange(interior.getNumChildren()):
            child = interior.at(i)
            code = child.getCode()

            if code not in DNA2Furniture:
                self.notify.warning('Unrecognized furniture code %r!' % code)
                continue

            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()
            self.itemList.append(CatalogFurnitureItem(itemId,
                                                      posHpr=(x, y, z, h, p, r)))
    def getItems(self):
        items = CatalogItemList(store=CatalogItem.Customization|CatalogItem.Location)

        for item in self.items:
            items.append(item.catalogItem)

        return items.getBlob()
    def setItems(self, items):
        items = CatalogItemList(items, store=CatalogItem.Customization|CatalogItem.Location)

        for item in self.items:
            item.destroy()

        self.items = []

        for item in items:
            self.generateItem(item)
Exemple #5
0
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)

        self.houseType = 0
        self.gardenPos = 0
        self.avatarId = 0
        self.name = ''
        self.color = 0
        self.housePos = 0
        self.gender = 0
        self.isInteriorInitialized = 1

        self.atticItems = CatalogItemList(store=Customization)
        self.interiorItems = CatalogItemList(store=Customization)
        self.interiorWallpaper = CatalogItemList(store=Customization)
        self.atticWallpaper = CatalogItemList(store=Customization)
        self.interiorWindows = CatalogItemList(store=Customization)
        self.atticWindows = CatalogItemList(store=Customization)
        self.deletedItems = CatalogItemList(store=Customization)
Exemple #6
0
    def calcHouseItems(self, avatar):
        houseId = avatar.houseId

        if not houseId:
            self.notify.warning('Avatar %s has no houseId associated.' %
                                avatar.doId)
            return 0

        house = simbase.air.doId2do.get(houseId)
        if not house:
            self.notify.warning('House %s (for avatar %s) not instantiated.' %
                                (houseId, avatar.doId))
            return 0

        mgr = house.interior.furnitureManager
        attic = (mgr.atticItems, mgr.atticWallpaper, mgr.atticWindows)
        numHouseItems = len(
            CatalogItemList(house.getInteriorItems(),
                            store=CatalogItem.Customization
                            | CatalogItem.Location))
        numAtticItems = sum(len(x) for x in attic)

        return numHouseItems + numAtticItems
Exemple #7
0
 def setDeletedItems(self, deletedItems):
     self.deletedItems = CatalogItemList(deletedItems, store=Customization)
Exemple #8
0
 def setInteriorWindows(self, interiorWindows):
     self.interiorWindows = CatalogItemList(interiorWindows,
                                            store=Customization
                                            | WindowPlacement)
Exemple #9
0
 def setAtticWindows(self, atticWindows):
     self.atticWindows = CatalogItemList(atticWindows, store=Customization)
Exemple #10
0
 def setInteriorWallpaper(self, interiorWallpaper):
     self.interiorWallpaper = CatalogItemList(interiorWallpaper,
                                              store=Customization)
Exemple #11
0
 def setAtticWallpaper(self, atticWallpaper):
     self.atticWallpaper = CatalogItemList(atticWallpaper,
                                           store=Customization)
Exemple #12
0
 def setInteriorItems(self, interiorItems):
     self.interiorItems = CatalogItemList(interiorItems,
                                          store=Customization | Location)
Exemple #13
0
 def setAtticItems(self, atticItems):
     self.atticItems = CatalogItemList(atticItems, store=Customization)
 def setAtticWindows(self, items):
     self.atticWindows = CatalogItemList(items, store=CatalogItem.Customization)
 def setAtticWallpaper(self, items):
     self.atticWallpaper = CatalogItemList(items, store=CatalogItem.Customization)