Example #1
0
    def buildList(self):
        self.itemList = CatalogItemList(store=CatalogItem.Customization
                                        | CatalogItem.Location)
        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!')

        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
            x, y, z = child.getPos()
            h, p, r = child.getHpr()
            self.itemList.append(
                CatalogFurnitureItem(itemId, posHpr=(x, y, z, h, p, r)))

        return
Example #2
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.estate = None
     self.housePos = 0
     self.houseType = 0
     self.gardenPos = 0
     self.avatarId = 0
     self.name = ''
     self.color = 0
     self.atticItems = CatalogItemList(store=CatalogItem.Customization)
     self.interiorItems = CatalogItemList(store=CatalogItem.Customization)
     self.atticWallpaper = CatalogItemList(store=CatalogItem.Customization)
     self.interiorWallpaper = CatalogItemList(
         store=CatalogItem.Customization)
     self.atticWindows = CatalogItemList(store=CatalogItem.Customization)
     self.interiorWindows = CatalogItemList(store=CatalogItem.Customization)
     self.deletedItems = CatalogItemList(store=CatalogItem.Customization)
     self.cannonEnabled = 0
     self.interiorZone = None
     self.exteriorDoor = None
     self.interiorDoor = None
     self.interior = None
     self.propGenerator = None
     self.mailbox = None
     self.gardenManager = None
     return
    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)
Example #4
0
    def setItems(self, items):
        # Decode the blob:
        items = CatalogItemList(items,
                                store=CatalogItem.Customization
                                | CatalogItem.Location)

        # Throw out our old items:
        for item in self.items:
            item.destroy()
        self.items = []

        items.removeDuplicates(FLCloset)

        # Due to a bug, some people are missing their closets...
        hasCloset = False
        for item in items:
            if item.getFlags() & FLCloset:
                hasCloset = True
                break

        if not hasCloset and self.ownerId != 0:
            item = CatalogFurnitureItem(500)  # the basic closet...
            item.posHpr = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
            items.append(item)
            # Since we have modified the items list, should we save it back to the house?

        for item in items:
            if item.getFlags() & FLTrunk:
                if self.house.gender is 0:
                    if item.furnitureType - 4000 < 10:
                        item.furnitureType += 10
                elif item.furnitureType - 4000 > 10:
                    item.furnitureType -= 10
                do = DistributedTrunkAI(self.air, self, item)
            elif item.getFlags() & FLCloset:
                if self.house.gender is 0:
                    if item.furnitureType - 500 < 10:
                        item.furnitureType += 10
                elif item.furnitureType - 500 > 10:
                    item.furnitureType -= 10
                do = DistributedClosetAI(self.air, self, item)
            elif item.getFlags() & FLBank:
                continue  # We dont want banks in the estates.
            elif item.getFlags() & FLPhone:
                do = DistributedPhoneAI(self.air, self, item)
            else:
                do = DistributedFurnitureItemAI(self.air, self, item)
            if self.isGenerated():
                do.generateWithRequired(self.zoneId)
            self.items.append(do)
Example #5
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