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()
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
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