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 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 generateItem(self, item):
        if item.getFlags() & FLTrunk:
            do = DistributedTrunkAI(self.air, self, item)
        elif item.getFlags() & FLCloset:
            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)
        return do
    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:
            if item.getHashContents() in (1300, 1310, 1320, 1330, 1340, 1350):
                do = DistributedBankAI(self.air, self, item)
            elif 500 <= item.getHashContents() <= 518:
                do = DistributedClosetAI(self.air, self, item)
                do.setOwnerId(self.avId)
            elif item.getHashContents() == 1399:
                do = DistributedPhoneAI(self.air, self, item)
            elif item.getHashContents() in (4000, 4010):
                do = DistributedTrunkAI(self.air, self, item)
                do.setOwnerId(self.avId)
            else:
                do = DistributedFurnitureItemAI(self.air, self, item)
            if self.isGenerated():
                do.generateWithRequired(self.zoneId)
            self.items.append(do)
    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:
            if item.getHashContents() in (1300, 1310, 1320, 1330, 1340, 1350):
                do = DistributedBankAI(self.air, self, item)
            else:
                if item.getHashContents() >= 500 and item.getHashContents(
                ) <= 518:
                    do = DistributedClosetAI(self.air, self, item)
                    do.setOwnerId(self.avId)
                else:
                    if item.getHashContents() == 1399:
                        do = DistributedPhoneAI(self.air, self, item)
                    else:
                        if item.getHashContents() in (4000, 4010):
                            do = DistributedTrunkAI(self.air, self, item)
                            do.setOwnerId(self.avId)
                        else:
                            do = DistributedFurnitureItemAI(
                                self.air, self, item)
            if self.isGenerated():
                do.generateWithRequired(self.zoneId)
            self.items.append(do)
Exemplo n.º 7
0
    def setItems(self, items):
        items = CatalogItemList(items, store=CatalogItem.Customization | CatalogItem.Location)
        for item in self.items:
            item.destroy()

        self.items = []
        items.removeDuplicates(FLCloset)
        items.removeDuplicates(FLPhone)
        items.removeDuplicates(FLBank)
        hasCloset = False
        for item in items:
            try:
                if item.getFlags() & FLCloset:
                    hasCloset = True
                    break
            except:
                pass

        hasAGodDamnPhone = False
        for killme in items:
            try:
                if killme.getFlags() & FLPhone:
                    hasAGodDamnPhone = True
                    break
            except:
                pass

        if not hasAGodDamnPhone and self.ownerId != 0:
            phone = CatalogFurnitureItem(1399)
            phone.posHpr = (-5, 0, 0, 0, 0, 0)
            items.append(phone)
            print 'spawned a phone for someone'
        hasBank = False
        for bank in items:
            try:
                if bank.getFlags() & FLBank:
                    hasBank = True
                    break
            except:
                pass

        if not hasBank and self.ownerId != 0:
            bank = CatalogFurnitureItem(1300)
            bank.posHpr = (5, 0, 0, 0, 0, 0)
            items.append(bank)
            print 'spawned a bank for someone'
        if not hasCloset and self.ownerId != 0:
            item = CatalogFurnitureItem(500)
            item.posHpr = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
            items.append(item)
            print 'spawned a closet for someone'
        for item in items:
            try:
                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:
                    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)
            except:
                print 'another user with a broken estate hurray!!!!!!!!!!!!!!!!!!'
    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)
        items.removeDuplicates(FLPhone)
        items.removeDuplicates(FLBank)

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

        # kys
        hasAGodDamnPhone = False
        for killme in items:
            try:
                if killme.getFlags() & FLPhone:
                    hasAGodDamnPhone = True
                    break
            except:
                pass
        if not hasAGodDamnPhone and self.ownerId != 0:
            phone = CatalogFurnitureItem(1399)
            phone.posHpr = (-5, 0, 0, 0, 0, 0)
            items.append(phone)
            print('spawned a phone for someone')

        # banks
        hasBank = False
        for bank in items:
            try:
                if bank.getFlags() & FLBank:
                    hasBank = True
                    break
            except:
                pass

        if not hasBank and self.ownerId != 0:
            bank = CatalogFurnitureItem(1300)
            bank.posHpr = (5, 0, 0, 0, 0, 0)
            items.append(bank)
            print('spawned a bank for someone')

        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)
            print('spawned a closet for someone')

        # Since we have modified the items list, should we save it back to the house?
        for item in items:
            try:
                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:
                    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)
            except:
                print(
                    "another user with a broken estate hurray!!!!!!!!!!!!!!!!!!"
                )