Beispiel #1
0
 def testWallpaperCombo(self, wallpaperType, wallpaperColorIndex, borderIndex, borderColorIndex, mouldingType, mouldingColorIndex, flooringType, flooringColorIndex, wainscotingType, wainscotingColorIndex):
     wallpaperItem = CatalogWallpaperItem.CatalogWallpaperItem(wallpaperType, wallpaperColorIndex, borderIndex, borderColorIndex)
     mouldingItem = CatalogMouldingItem.CatalogMouldingItem(mouldingType, mouldingColorIndex)
     flooringItem = CatalogFlooringItem.CatalogFlooringItem(flooringType, flooringColorIndex)
     wainscotingItem = CatalogWainscotingItem.CatalogWainscotingItem(wainscotingType, wainscotingColorIndex)
     self.wallpaper = CatalogItemList.CatalogItemList([wallpaperItem,
      mouldingItem,
      flooringItem,
      wainscotingItem,
      wallpaperItem,
      mouldingItem,
      flooringItem,
      wainscotingItem], store=CatalogItem.Customization)
     if self.interior:
         self.__colorWalls()
Beispiel #2
0
def testWallpapers():
    xPos = -0.9
    zPos = 1.2
    itemList = []
    for i in range(12):
        if (i % 4) == 0:
            xPos = -0.9
            zPos -= 0.6
        index = 1000 + i * 100
        item = CatalogItemPanel(item = CatalogWallpaperItem(index),
                                type = CatalogItem.CatalogTypeWeekly,
                                frameSize = (-0.3, 0.3, -0.3, 0.3),
                                relief = DGG.RAISED,
                                pos = (xPos,1,zPos))
        item.load()
        itemList.append(item)
        xPos += 0.6
    return itemList
def convertItem(item, fCatalog):
    patternIndex = item.patternIndex
    colorIndex = item.colorIndex
    # This may be None
    newColorIndex = colorIndex
    if (patternIndex >= 101) and (patternIndex <= 111):
        # Flooring
        newPatternIndex = flooringBase + (patternIndex - 101) * 10
        if fCatalog:
            newColorIndex = None
        newItem = CatalogFlooringItem.CatalogFlooringItem(
            newPatternIndex, newColorIndex)
    elif (patternIndex >= 151) and (patternIndex <= 153):
        # Moulding
        if (patternIndex == 151) or (patternIndex == 152):
            newPatternIndex = 1000
        elif patternIndex == 153:
            newPatternIndex = 1010
        if newColorIndex == None:
            newColorIndex = 0
        newItem = CatalogMouldingItem.CatalogMouldingItem(
            newPatternIndex, newColorIndex)
    elif (patternIndex == 201) or (patternIndex == 202):
        # Wainscoting
        if newColorIndex == None:
            newColorIndex = 0
        newPatternIndex = wainscotingBase + (patternIndex - 201) * 10
        newItem = CatalogWainscotingItem.CatalogWainscotingItem(
            newPatternIndex, newColorIndex)
    else:
        # Wallpaper
        newBorderIndex = 0
        newBorderColorIndex = 0
        # Adjust pattern index
        if patternIndex == 1:
            newPatternIndex = 1200
        elif patternIndex == 2:
            newPatternIndex = 1300
        elif patternIndex == 3:
            newPatternIndex = 1600
        elif patternIndex == 4:
            newPatternIndex = 1100
        elif patternIndex == 5:
            newPatternIndex = 1000
        elif patternIndex == 1010:
            newPatternIndex = 1000
        elif patternIndex == 1102:
            newPatternIndex = 1100
        elif patternIndex == 1112:
            newPatternIndex = 1110
        elif patternIndex == 1122:
            newPatternIndex = 1120
        elif patternIndex == 1132:
            newPatternIndex = 1130
        elif patternIndex == 1142:
            newPatternIndex = 1140
        elif patternIndex == 1152:
            newPatternIndex = 1150
        else:
            newPatternIndex = patternIndex
        # Adjust colors
        if patternIndex <= 5:
            if colorIndex is not None:
                newColorIndex = 0
        # Adjust borders
        if patternIndex in [1010]:
            # Now use border pattern 1000
            newBorderIndex = 1000
        elif patternIndex in [4, 1102, 1132]:
            # Now use border pattern 1010
            newBorderIndex = 1010
        elif patternIndex in [1142, 1152]:
            # Now use border pattern 1020
            newBorderIndex = 1020
        elif patternIndex in [1122]:
            # Now use border pattern 1030
            newBorderIndex = 1030
        elif patternIndex in [1112]:
            # Now use border pattern 1040
            newBorderIndex = 1040
        elif patternIndex in [2000, 2100, 2110]:
            # Now use border pattern 1050
            newBorderIndex = 1050
        elif patternIndex in [2010, 2120]:
            # Now use border pattern 1060
            newBorderIndex = 1060
        elif patternIndex in [2020, 2130, 2140]:
            # Now use border pattern 1070
            newBorderIndex = 1070
        else:
            # No border
            newBorderIndex = 0
        # If catalog, change pattern number to group pattern index
        # and set colorIndex and borderIndex to None (non-customized)
        if fCatalog:
            newPatternIndex = newPatternIndex - (newPatternIndex % 100)
            newColorIndex = None
            newBorderIndex = None
        # Return brand shiny new catalog wallpaper item
        newItem = CatalogWallpaperItem.CatalogWallpaperItem(
            newPatternIndex, newColorIndex,
            newBorderIndex, newBorderColorIndex)
    # Copy over som essential fields
    newItem.deliveryDate = item.deliveryDate
    newItem.posHpr = item.posHpr
    return newItem
Beispiel #4
0
    def setInitialFurniture(self):
        # Resets the furniture to the initial default furniture for an
        # avatar.  Normally this is called only when the house is
        # first assigned, and for debugging.

        avatar = self.air.doId2do.get(self.ownerId)

        # Boys are given the boy wardrobe initially, while girls are
        # given the girl wardrobe.
        wardrobeItem = 500
        if avatar and avatar.getStyle().getGender() == 'f':
            wardrobeItem = 510

        InitialFurnitureA = CatalogItemList.CatalogItemList([
            CatalogFurnitureItem.CatalogFurnitureItem(200,
                                                      posHpr=(-23.618, 16.1823,
                                                              0.025, 90, 0,
                                                              0)),
            CatalogFurnitureItem.CatalogFurnitureItem(wardrobeItem,
                                                      posHpr=(-22.5835,
                                                              21.8784, 0.025,
                                                              90, 0, 0)),
            CatalogFurnitureItem.CatalogFurnitureItem(1300,
                                                      posHpr=(-21.4932,
                                                              5.76027, 0.025,
                                                              120, 0, 0)),
            CatalogFurnitureItem.CatalogFurnitureItem(400,
                                                      posHpr=(-18.6, -12.0,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(100,
                                                      posHpr=(-18.9, -20.5,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(100,
                                                      posHpr=(-18.9, -3.5,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(700,
                                                      posHpr=(-3.34375,
                                                              22.3644, 0.025,
                                                              -90, 0, 0)),
            CatalogFurnitureItem.CatalogFurnitureItem(710,
                                                      posHpr=(0, -23, 0.025,
                                                              180, 0, 0)),
            CatalogFurnitureItem.CatalogFurnitureItem(700,
                                                      posHpr=(4.44649,
                                                              -0.463924, 0.025,
                                                              0, 0, 0)),
            CatalogFurnitureItem.CatalogFurnitureItem(1399,
                                                      posHpr=(-10.1, 2.0, 0.1,
                                                              0, 0, 0)),
        ])

        InitialFurnitureB = CatalogItemList.CatalogItemList([
            CatalogFurnitureItem.CatalogFurnitureItem(200,
                                                      posHpr=(-3.2, 17.0,
                                                              0.025, -0.2, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(400,
                                                      posHpr=(-18.6, -7.1,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(700,
                                                      posHpr=(3.6, -23.7,
                                                              0.025, 179.9,
                                                              0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(710,
                                                      posHpr=(-16.6, -19.1,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(700,
                                                      posHpr=(-1.8, -23.6,
                                                              0.025, 179.9,
                                                              0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(wardrobeItem,
                                                      posHpr=(-20.1, 4.4,
                                                              0.025, -180.0,
                                                              0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(100,
                                                      posHpr=(-1.1, 22.4,
                                                              0.025, -90.2,
                                                              0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(1300,
                                                      posHpr=(-21.7, 19.5,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(100,
                                                      posHpr=(4.0, 1.9, 0.025,
                                                              -0.1, 0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(1399,
                                                      posHpr=(-10.1, 2.0, 0.1,
                                                              0, 0, 0)),
        ])

        InitialFurnitureC = CatalogItemList.CatalogItemList([
            CatalogFurnitureItem.CatalogFurnitureItem(200,
                                                      posHpr=(-22.1, 6.5,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(400,
                                                      posHpr=(-0.2, -25.7,
                                                              0.025, 179.9,
                                                              0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(710,
                                                      posHpr=(-16.6, -12.2,
                                                              0.025, 90.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(wardrobeItem,
                                                      posHpr=(-4.7, 24.5,
                                                              0.025, 0.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(1300,
                                                      posHpr=(-20.5, 22.3,
                                                              0.025, 45.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(100,
                                                      posHpr=(-12.0, 25.9,
                                                              0.025, 0.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(700,
                                                      posHpr=(9.4, -8.6, 0.025,
                                                              67.5, 0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(700,
                                                      posHpr=(9.7, -15.1,
                                                              0.025, 112.5,
                                                              0.0, 0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(100,
                                                      posHpr=(-14.7, 1.88,
                                                              0.025, 0.0, 0.0,
                                                              0.0)),
            CatalogFurnitureItem.CatalogFurnitureItem(1399,
                                                      posHpr=(-10.1, 2.0, 0.1,
                                                              0, 0, 0)),
        ])

        self.b_setDeletedItems(CatalogItemList.CatalogItemList())
        self.b_setAtticItems(CatalogItemList.CatalogItemList())
        self.b_setInteriorItems(
            random.choice((
                InitialFurnitureA,
                InitialFurnitureB,
                InitialFurnitureC,
            )))
        self.b_setAtticWallpaper(CatalogItemList.CatalogItemList())

        # Choose a random set of wallpapers, and use the same set for
        # both rooms.
        wallpaper = [
            # Wallpaper
            random.choice(CatalogWallpaperItem.getWallpaperRange(1000, 1299)),
            # Moulding
            random.choice(CatalogMouldingItem.getAllMouldings(1000, 1010)),
            # Flooring
            random.choice(CatalogFlooringItem.getAllFloorings(1000, 1010)),
            # Wainscoting
            random.choice(CatalogWainscotingItem.getAllWainscotings(
                1000, 1010)),
        ]

        self.b_setInteriorWallpaper(
            CatalogItemList.CatalogItemList(wallpaper + wallpaper))
        self.b_setAtticWindows(CatalogItemList.CatalogItemList())

        # Everyone starts out with a simple garden view, twice.
        self.b_setInteriorWindows(
            CatalogItemList.CatalogItemList([
                CatalogWindowItem.CatalogWindowItem(20, placement=2),
                CatalogWindowItem.CatalogWindowItem(20, placement=4),
            ]))
Beispiel #5
0
 def _getCatalogItemObj(self, itemType, itemIndex):
     if itemType == CatalogItemTypes.CLOTHING_ITEM:
         clothingNumber = itemIndex
         #itemObj = CatalogBeanItem.CatalogBeanItem(amount)
         # for now always the first color choice
         itemObj = CatalogClothingItem.CatalogClothingItem(
             clothingNumber, 0)
         itemObj.giftTag = 0
         itemObj.giftCode = 1
     elif itemType == CatalogItemTypes.FURNITURE_ITEM:
         furnitureNumber = itemIndex
         itemObj = CatalogFurnitureItem.CatalogFurnitureItem(
             furnitureNumber, colorOption=0)
     elif itemType == CatalogItemTypes.CHAT_ITEM:
         chatIndex = itemIndex
         itemObj = CatalogChatItem.CatalogChatItem(chatIndex)
     elif itemType == CatalogItemTypes.EMOTE_ITEM:
         emoteIndex = itemIndex
         itemObj = CatalogEmoteItem.CatalogEmoteItem(emoteIndex)
     elif itemType == CatalogItemTypes.BEAN_ITEM:
         numBeans = itemIndex
         if not numBeans in JellybeanRewardValues:
             self.air.writeServerEvent("suspicious",
                                       replyTo.getSourceAddress(),
                                       "giving %s beans" % numBeans)
         # an assertion exception will occur so the jellybean won't get rewarded
         assert (numBeans in JellybeanRewardValues)
         itemObj = CatalogBeanItem.CatalogBeanItem(numBeans)
     elif itemType == CatalogItemTypes.WALLPAPER_ITEM:
         wallPaperNumber = itemIndex
         itemObj = CatalogWallpaperItem.CatalogWallpaperItem(
             wallPaperNumber, colorIndex=0)
     elif itemType == CatalogItemTypes.WINDOW_ITEM:
         windowNumber = itemIndex
         itemObj = CatalogWindowItem.CatalogWindowItem(windowNumber,
                                                       placement=0)
     elif itemType == CatalogItemTypes.FLOORING_ITEM:
         flooringNumber = itemIndex
         itemObj = CatalogFlooringItem.CatalogFlooringItem(flooringNumber,
                                                           colorIndex=0)
     elif itemType == CatalogItemTypes.MOULDING_ITEM:
         mouldingNumber = itemIndex
         itemObj = CatalogMouldingItem.CatalogMouldingItem(mouldingNumber,
                                                           colorIndex=0)
     elif itemType == CatalogItemTypes.WAINSCOTING_ITEM:
         wainscotingNumber = itemIndex
         itemObj = CatalogWainscotingItem.CatalogWainscotingItem(
             wainscotingNumber, colorIndex=0)
     elif itemType == CatalogItemTypes.PET_TRICK_ITEM:
         trickId = itemIndex
         itemObj = CatalogPetTrickItem.CatalogPetTrickItem(trickId)
     elif itemType == CatalogItemTypes.RENTAL_ITEM:
         # TODO since all we offer so far is 48 hours of cannons, values pulled for CatalogGenerator
         # do something else if we have different durations
         rentalType = itemIndex
         itemObj = CatalogRentalItem.CatalogRentalItem(
             rentalType, 2880, 1000)
     elif itemType == CatalogItemTypes.ANIMATED_FURNITURE_ITEM:
         furnitureNumber = itemIndex
         itemObj = CatalogAnimatedFurnitureItem.CatalogAnimatedFurnitureItem(
             furnitureNumber, colorOption=0)
     return itemObj