mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 12:12:36 -06:00
Fix 63 or nick
This commit is contained in:
parent
50297ca489
commit
cc91c43036
1 changed files with 47 additions and 138 deletions
|
@ -92,53 +92,15 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
|
||||||
self.interior.b_setWindows(self.windows.getBlob())
|
self.interior.b_setWindows(self.windows.getBlob())
|
||||||
|
|
||||||
def setItems(self, items):
|
def setItems(self, items):
|
||||||
# Decode the blob:
|
|
||||||
items = CatalogItemList(items, store=CatalogItem.Customization|CatalogItem.Location)
|
items = CatalogItemList(items, store=CatalogItem.Customization|CatalogItem.Location)
|
||||||
|
|
||||||
# Throw out our old items:
|
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
item.destroy()
|
item.destroy()
|
||||||
|
|
||||||
self.items = []
|
self.items = []
|
||||||
|
|
||||||
items.removeDuplicates(FLCloset)
|
|
||||||
|
|
||||||
# Due to a bug, some people are missing their closets...
|
|
||||||
hasCloset = False
|
|
||||||
for item in items:
|
for item in items:
|
||||||
if item.getFlags() & FLCloset:
|
self.generateItem(item)
|
||||||
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:
|
|
||||||
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 getItems(self):
|
def getItems(self):
|
||||||
items = CatalogItemList(store=CatalogItem.Customization|CatalogItem.Location)
|
items = CatalogItemList(store=CatalogItem.Customization|CatalogItem.Location)
|
||||||
|
@ -271,6 +233,25 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Furniture-manipulation:
|
# Furniture-manipulation:
|
||||||
|
|
||||||
|
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 moveItemToAttic(self, doId):
|
def moveItemToAttic(self, doId):
|
||||||
item = self.getItemObject(doId)
|
item = self.getItemObject(doId)
|
||||||
|
|
||||||
|
@ -289,32 +270,9 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
|
||||||
self.d_setAtticItems(self.getAtticItems())
|
self.d_setAtticItems(self.getAtticItems())
|
||||||
|
|
||||||
item.posHpr = (x, y, z, h, p, r)
|
item.posHpr = (x, y, z, h, p, r)
|
||||||
|
object = self.generateItem(item)
|
||||||
|
|
||||||
if item.getFlags() & FLTrunk:
|
return (ToontownGlobals.FM_MovedItem, object.doId)
|
||||||
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)
|
|
||||||
|
|
||||||
do.generateWithRequired(self.zoneId)
|
|
||||||
self.items.append(do)
|
|
||||||
|
|
||||||
return (ToontownGlobals.FM_MovedItem, do.doId)
|
|
||||||
|
|
||||||
def deleteItemFromAttic(self, blob, index):
|
def deleteItemFromAttic(self, blob, index):
|
||||||
item = self.getAtticFurniture(self.atticItems, index)
|
item = self.getAtticFurniture(self.atticItems, index)
|
||||||
|
@ -493,96 +451,47 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
|
||||||
return window
|
return window
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_PROGRAMMER, types=[])
|
@magicWord(category=CATEGORY_PROGRAMMER)
|
||||||
def findCloset():
|
|
||||||
"""
|
|
||||||
find the closet
|
|
||||||
"""
|
|
||||||
target = spellbook.getTarget()
|
|
||||||
if not target:
|
|
||||||
target = spellbook.getInvoker()
|
|
||||||
if not target:
|
|
||||||
return "Strange.. who are we talking about?"
|
|
||||||
|
|
||||||
if not hasattr(target, "estate") or not hasattr(target.estate, "houses"):
|
|
||||||
return "no houses in the state"
|
|
||||||
|
|
||||||
for house in target.estate.houses:
|
|
||||||
if house.doId == target.houseId:
|
|
||||||
fm = house.interior.furnitureManager
|
|
||||||
for item in fm.items:
|
|
||||||
if item.catalogItem.getFlags() & FLCloset:
|
|
||||||
return 'items: %s'%(str(item.catalogItem))
|
|
||||||
for item in fm.atticItems:
|
|
||||||
if item.getFlags() & FLCloset:
|
|
||||||
return 'atticItems: %s'%(str(item))
|
|
||||||
return "I cannot find your closet"
|
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_PROGRAMMER, types=[])
|
|
||||||
def recoverCloset():
|
|
||||||
"""
|
|
||||||
recover the closet
|
|
||||||
"""
|
|
||||||
target = spellbook.getTarget()
|
|
||||||
if not target:
|
|
||||||
target = spellbook.getInvoker()
|
|
||||||
if not target:
|
|
||||||
return "Strange.. who are we talking about?"
|
|
||||||
|
|
||||||
if not hasattr(target, "estate") or not hasattr(target.estate, "houses"):
|
|
||||||
return "no houses in the state"
|
|
||||||
|
|
||||||
for house in target.estate.houses:
|
|
||||||
if house.doId == target.houseId:
|
|
||||||
fm = house.interior.furnitureManager
|
|
||||||
for item in reversed(fm.items):
|
|
||||||
if item.catalogItem.getFlags() & FLCloset:
|
|
||||||
fm.moveItemToAttic(item.doId);
|
|
||||||
return "Moved the closet"
|
|
||||||
fm.saveToHouse()
|
|
||||||
return "I cannot find your closet"
|
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_PROGRAMMER, types=[])
|
|
||||||
def fillAttic():
|
def fillAttic():
|
||||||
"""
|
"""
|
||||||
move everything to the attic
|
Move everything to the attic.
|
||||||
"""
|
"""
|
||||||
target = spellbook.getTarget()
|
target = spellbook.getTarget()
|
||||||
if not target:
|
|
||||||
target = spellbook.getInvoker()
|
|
||||||
if not target:
|
|
||||||
return "Strange.. who are we talking about?"
|
|
||||||
|
|
||||||
if not hasattr(target, "estate") or not hasattr(target.estate, "houses"):
|
if not hasattr(target, "estate") or not hasattr(target.estate, "houses"):
|
||||||
return "no houses in the state"
|
return "The target is not in an estate!"
|
||||||
|
|
||||||
for house in target.estate.houses:
|
for house in target.estate.houses:
|
||||||
if house.doId == target.houseId:
|
if house.doId == target.houseId:
|
||||||
fm = house.interior.furnitureManager
|
manager = house.interior.furnitureManager
|
||||||
for item in reversed(fm.items):
|
|
||||||
fm.moveItemToAttic(item.doId);
|
|
||||||
fm.saveToHouse()
|
|
||||||
return "everything has been moved to the attic"
|
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_PROGRAMMER, types=[])
|
for item in reversed(manager.items):
|
||||||
|
manager.moveItemToAttic(item.doId)
|
||||||
|
|
||||||
|
manager.saveToHouse()
|
||||||
|
return "Everything has been moved to the attic!"
|
||||||
|
|
||||||
|
return "The target is not in his estate!"
|
||||||
|
|
||||||
|
@magicWord(category=CATEGORY_PROGRAMMER)
|
||||||
def emptyHouse():
|
def emptyHouse():
|
||||||
"""
|
"""
|
||||||
delete everything in the house
|
Delete everything in the house.
|
||||||
"""
|
"""
|
||||||
target = spellbook.getTarget()
|
target = spellbook.getTarget()
|
||||||
if not target:
|
|
||||||
target = spellbook.getInvoker()
|
|
||||||
if not target:
|
|
||||||
return "Strange.. who are we talking about?"
|
|
||||||
|
|
||||||
if not hasattr(target, "estate") or not hasattr(target.estate, "houses"):
|
if not hasattr(target, "estate") or not hasattr(target.estate, "houses"):
|
||||||
return "no houses in the state"
|
return "The target is not in an estate!"
|
||||||
|
|
||||||
for house in target.estate.houses:
|
for house in target.estate.houses:
|
||||||
if house.doId == target.houseId:
|
if house.doId == target.houseId:
|
||||||
fm = house.interior.furnitureManager
|
manager = house.interior.furnitureManager
|
||||||
for item in reversed(fm.items):
|
|
||||||
|
for item in reversed(manager.items):
|
||||||
item.destroy()
|
item.destroy()
|
||||||
fm.items.remove(item)
|
|
||||||
fm.saveToHouse()
|
manager.items = []
|
||||||
return "The house is empty"
|
manager.saveToHouse()
|
||||||
|
return "Everything has been deleted!"
|
||||||
|
|
||||||
|
return "The target is not in his estate!"
|
Loading…
Reference in a new issue