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 = []

        for item in items:
            if item.getFlags() & FLCloset:
                if self.house.gender is 0:
                    # If they have a male closet, we need to make it a female closet.
                    if item.furnitureType - 500 < 10:
                        item.furnitureType += 10
                elif item.furnitureType - 500 > 10:
                    # If they have a female closet, we need to make it a male closet.
                    item.furnitureType -= 10
                do = DistributedClosetAI(self.air, self, item)
            elif item.getFlags() & FLBank:
                do = DistributedBankAI(self.air, self, item)
            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)
    def moveItemFromAttic(self, index, x, y, z, h, p, r):
        item = self.getAtticFurniture(self.atticItems, index)

        self.atticItems.remove(item)
        self.d_setAtticItems(self.getAtticItems())

        item.posHpr = (x, y, z, h, p, r)

        # TODO: Add DistributedTrunkAI when accessories are enabled
        # TODO2: Is there any point in repeating this? Perhaps we should unify this (and the above)
        # into a single self.__getDOFromItem(item)?
        if item.getFlags() & FLCloset:
            if self.house.gender is 0:
                # If they have a male closet, we need to make it a female closet.
                if item.furnitureType - 500 < 10:
                    item.furnitureType += 10
            elif item.furnitureType - 500 > 10:
                # If they have a female closet, we need to make it a male closet.
                item.furnitureType -= 10
            do = DistributedClosetAI(self.air, self, item)
        elif item.getFlags() & FLBank:
            do = DistributedBankAI(self.air, self, item)
        elif item.getFlags() & FLPhone:
            do = DistributedPhoneAI(self.air, self, item)
        else:
            do = DistributedFurnitureItemAI(self.air, self, item)

        do.generateWithRequired(self.zoneId)
        self.items.append(do)

        return (ToontownGlobals.FM_MovedItem, do.doId)
    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 = []

        for item in items:
            if item.getFlags() & FLCloset:
                if self.house.gender is 0:
                    # If they have a male closet, we need to make it a female closet.
                    if item.furnitureType - 500 < 10:
                        item.furnitureType += 10
                elif item.furnitureType - 500 > 10:
                    # If they have a female closet, we need to make it a male closet.
                    item.furnitureType -= 10
                do = DistributedClosetAI(self.air, self, item)
            elif item.getFlags() & FLBank:
                do = DistributedBankAI(self.air, self, item)
            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)
 def moveItemFromAttic(self, index, x, y, z, h, p, r):
     item = self.getAtticFurniture(self.atticItems, index)
     self.atticItems.remove(item)
     self.d_setAtticItems(self.getAtticItems())
     item.posHpr = (x, y, z, h, p, r)
     if item.getFlags() & FLCloset:
         if self.house.gender is 0:
             if item.furnitureType - 500 < 10:
                 item.furnitureType += 10
         else:
             if item.furnitureType - 500 > 10:
                 item.furnitureType -= 10
         do = DistributedClosetAI(self.air, self, item)
     else:
         if item.getFlags() & FLBank:
             do = DistributedBankAI(self.air, self, item)
         else:
             if item.getFlags() & FLPhone:
                 do = DistributedPhoneAI(self.air, self, item)
             else:
                 if item.getFlags() & FLTrunk:
                     if self.house.gender is 0:
                         if item.furnitureType - 500 > 10:
                             item.furnitureType += 10
                         else:
                             if item.furnitureType - 500 > 10:
                                 item.furnitureType -= 10
                         do = DistributedTrunkAI(self.air, self, item)
                 else:
                     do = DistributedFurnitureItemAI(self.air, self, item)
     do.generateWithRequired(self.zoneId)
     self.items.append(do)
     return (ToontownGlobals.FM_MovedItem, do.doId)
    def moveItemFromAttic(self, index, x, y, z, h, p, r):
        item = self.getAtticFurniture(self.atticItems, index)

        self.atticItems.remove(item)
        self.d_setAtticItems(self.getAtticItems())

        item.posHpr = (x, y, z, h, p, r)

        # TODO: Add DistributedTrunkAI when accessories are enabled
        # TODO2: Is there any point in repeating this? Perhaps we should unify this (and the above)
        # into a single self.__getDOFromItem(item)?
        if item.getFlags() & FLCloset:
            if self.house.gender is 0:
                # If they have a male closet, we need to make it a female closet.
                if item.furnitureType - 500 < 10:
                    item.furnitureType += 10
            elif item.furnitureType - 500 > 10:
                # If they have a female closet, we need to make it a male closet.
                item.furnitureType -= 10
            do = DistributedClosetAI(self.air, self, item)
        elif item.getFlags() & FLBank:
            do = DistributedBankAI(self.air, self, item)
        elif item.getFlags() & FLPhone:
            do = DistributedPhoneAI(self.air, self, item)
        else:
            do = DistributedFurnitureItemAI(self.air, self, item)

        do.generateWithRequired(self.zoneId)
        self.items.append(do)

        return (ToontownGlobals.FM_MovedItem, do.doId)