本文整理汇总了Python中toontown.catalog.CatalogItemList.CatalogItemList类的典型用法代码示例。如果您正苦于以下问题:Python CatalogItemList类的具体用法?Python CatalogItemList怎么用?Python CatalogItemList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CatalogItemList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getItems
def getItems(self):
items = CatalogItemList(store=CatalogItem.Customization|CatalogItem.Location)
for item in self.items:
items.append(item.catalogItem)
return items.getBlob()
示例2: loadFromHouse
def loadFromHouse(self):
self.b_setAtticItems(self.house.getAtticItems())
self.b_setAtticWallpaper(self.house.getAtticWallpaper())
self.b_setAtticWindows(self.house.getAtticWindows())
self.b_setDeletedItems(self.house.getDeletedItems())
self.wallpaper = CatalogItemList(self.house.getInteriorWallpaper(), store=CatalogItem.Customization)
self.applyWallpaper()
self.windows = CatalogItemList(self.house.getInteriorWindows(), store=CatalogItem.Customization | CatalogItem.WindowPlacement)
self.applyWindows()
self.setItems(self.house.getInteriorItems())
示例3: __init__
class DNAFurnitureReaderAI:
# This object processes the house_interior*.dna files and produces a
# CatalogItemList representing the furniture in the DNA file. The resulting
# list is passed to the FurnitureManager in order to initialize a blank
# house to the default furniture arrangement.
notify = directNotify.newCategory("DNAFurnitureReaderAI")
def __init__(self, dnaData, gender, phonePos):
self.dnaData = dnaData
self.gender = gender
self.phonePos = phonePos
self.itemList = None
def buildList(self):
self.itemList = CatalogItemList(store=(CatalogItem.Customization |
CatalogItem.Location))
# Find the interior node:
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!')
self.itemList.append(CatalogFurnitureItem(1399, posHpr=self.phonePos))
# Every child in the interior node is a prop, thus:
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
if hasattr(itemId, '__getitem__'):
itemId = itemId[self.gender]
x, y, z = child.getPos()
h, p, r = child.getHpr()
self.itemList.append(CatalogFurnitureItem(itemId,
posHpr=(x, y, z, h, p, r)))
def getList(self):
if not self.itemList:
self.buildList()
return self.itemList
def getBlob(self):
return self.getList().getBlob()
示例4: setItems
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)
示例5: buildList
def buildList(self):
self.itemList = CatalogItemList(store=(CatalogItem.Customization |
CatalogItem.Location))
# Find the interior node:
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!')
self.itemList.append(CatalogFurnitureItem(1399, posHpr=self.phonePos))
# Every child in the interior node is a prop, thus:
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)))
示例6: __init__
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.houseType = 0
self.gardenPos = 0
self.avatarId = 0
self.name = ''
self.color = 0
self.housePos = 0
self.gender = 1
self.isInteriorInitialized = 1
self.atticItems = CatalogItemList(store=Customization)
self.interiorItems = CatalogItemList(store=Customization)
self.interiorWallpaper = CatalogItemList(store=Customization)
self.atticWallpaper = CatalogItemList(store=Customization)
self.interiorWindows = CatalogItemList(store=Customization)
self.atticWindows = CatalogItemList(store=Customization)
self.deletedItems = CatalogItemList(store=Customization)
示例7: __init__
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.houseType = 0
self.gardenPos = 0
self.avatarId = 0
self.name = ""
self.color = 0
self.housePos = 0
self.gender = 1
self.isInteriorInitialized = 1 # Only fresh DB houses are not inited.
# FIXME: Now I think I did this wrong...
self.atticItems = CatalogItemList(store=Customization)
self.interiorItems = CatalogItemList(store=Customization)
self.interiorWallpaper = CatalogItemList(store=Customization)
self.atticWallpaper = CatalogItemList(store=Customization)
self.interiorWindows = CatalogItemList(store=Customization)
self.atticWindows = CatalogItemList(store=Customization)
self.deletedItems = CatalogItemList(store=Customization)
示例8: setInteriorWindows
def setInteriorWindows(self, interiorWindows):
self.interiorWindows = CatalogItemList(interiorWindows, store=Customization | WindowPlacement)
示例9: setAtticWindows
def setAtticWindows(self, atticWindows):
self.atticWindows = CatalogItemList(atticWindows, store=Customization)
示例10: setInteriorWallpaper
def setInteriorWallpaper(self, interiorWallpaper):
self.interiorWallpaper = CatalogItemList(interiorWallpaper, store=Customization)
示例11: setAtticWallpaper
def setAtticWallpaper(self, atticWallpaper):
self.atticWallpaper = CatalogItemList(atticWallpaper, store=Customization)
示例12: setInteriorItems
def setInteriorItems(self, interiorItems):
self.interiorItems = CatalogItemList(interiorItems, store=Customization | Location)
示例13: DistributedFurnitureManagerAI
class DistributedFurnitureManagerAI(DistributedObjectAI):
notify = directNotify.newCategory("DistributedFurnitureManagerAI")
def __init__(self, air, house, interior):
DistributedObjectAI.__init__(self, air)
self.house = house
self.interior = interior
self.director = None
self.ownerId = house.avatarId
self.ownerName = house.name
self.atticItems = None
self.atticWallpaper = None
self.wallpaper = None
self.atticWindows = None
self.windows = None
self.deletedItems = None
self.items = []
# Initialize the above variables:
self.loadFromHouse()
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
for item in self.items:
item.generateWithRequired(self.zoneId)
def delete(self):
for item in self.items:
item.destroy()
DistributedObjectAI.delete(self)
def loadFromHouse(self):
self.b_setAtticItems(self.house.getAtticItems())
self.b_setAtticWallpaper(self.house.getAtticWallpaper())
self.b_setAtticWindows(self.house.getAtticWindows())
self.b_setDeletedItems(self.house.getDeletedItems())
self.wallpaper = CatalogItemList(self.house.getInteriorWallpaper(),
store=CatalogItem.Customization)
self.applyWallpaper()
self.windows = CatalogItemList(self.house.getInteriorWindows(),
store=CatalogItem.Customization |
CatalogItem.WindowPlacement)
self.applyWindows()
self.setItems(self.house.getInteriorItems())
def saveToHouse(self):
self.house.b_setAtticItems(self.getAtticItems())
self.house.b_setAtticWallpaper(self.getAtticWallpaper())
self.house.b_setAtticWindows(self.getAtticWindows())
self.house.b_setDeletedItems(self.getDeletedItems())
self.house.b_setInteriorWallpaper(self.wallpaper.getBlob())
self.house.b_setInteriorWindows(self.windows.getBlob())
self.house.b_setInteriorItems(self.getItems())
def applyWallpaper(self):
self.interior.b_setWallpaper(self.wallpaper.getBlob())
def applyWindows(self):
self.interior.b_setWindows(self.windows.getBlob())
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:
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
#.........这里部分代码省略.........
示例14: setDeletedItems
def setDeletedItems(self, items):
self.deletedItems = CatalogItemList(items, store=CatalogItem.Customization)
示例15: setAtticWallpaper
def setAtticWallpaper(self, items):
self.atticWallpaper = CatalogItemList(items, store=CatalogItem.Customization)