From 75ffd52621b022c73d41c4a271ad3bf2cb9c0e76 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 27 Jul 2015 18:02:19 +0300 Subject: [PATCH] Crates finished :D --- dependencies/astron/dclass/stride.dc | 6 ++++ toontown/catalog/CatalogFurnitureItem.py | 11 +++--- .../estate/DistributedFurnitureManagerAI.py | 35 ++++++++++++++++--- toontown/quest/Quests.py | 1 + toontown/toon/DistributedToonAI.py | 2 +- toontown/toonbase/TTLocalizerEnglish.py | 9 +++++ toontown/toonbase/ToontownGlobals.py | 9 +++++ 7 files changed, 62 insertions(+), 11 deletions(-) diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 1d71078d..3d4ee68c 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -290,6 +290,7 @@ from toontown.estate import DistributedBank/AI from toontown.estate import DistributedCloset/AI from toontown.estate import DistributedTrunk/AI from toontown.estate import DistributedPhone/AI +from toontown.estate import DistributedRewardCrate/AI from toontown.effects import DistributedFireworkShow/AI from toontown.estate import DistributedFireworksCannon/AI from toontown.coghq import LobbyManager/AI @@ -2089,6 +2090,11 @@ dclass DistributedPhone : DistributedFurnitureItem { setGiftAvatar(blob); }; +dclass DistributedRewardCrate : DistributedFurnitureItem { + requestKeyUsage() airecv clsend; + useKeyResponse(uint8, uint32); +}; + dclass DistributedFireworkShow : DistributedObject { startShow(uint8, uint8, uint8, int16) broadcast ram; requestFirework(int16/10, int16/10, int16/100, uint8, uint8, uint8) airecv clsend; diff --git a/toontown/catalog/CatalogFurnitureItem.py b/toontown/catalog/CatalogFurnitureItem.py index 5eebc067..21e10d13 100755 --- a/toontown/catalog/CatalogFurnitureItem.py +++ b/toontown/catalog/CatalogFurnitureItem.py @@ -18,10 +18,11 @@ FLPainting = 8 FLOnTable = 16 FLIsTable = 32 FLPhone = 64 -FLBillboard = 128 -FLTrunk = 256 -FLBoysOnly = 512 -FLGirlsOnly = 1024 +FLCrate = 128 +FLBillboard = 256 +FLTrunk = 512 +FLBoysOnly = 1024 +FLGirlsOnly = 2048 furnitureColors = [ (0.792, 0.353, 0.29, 1.0), (0.176, 0.592, 0.439, 1.0), @@ -896,7 +897,7 @@ FurnitureTypes = { None, None, 0, - None, + FLCrate, 0.5) } diff --git a/toontown/estate/DistributedFurnitureManagerAI.py b/toontown/estate/DistributedFurnitureManagerAI.py index 4f9a53cf..03a8fdc9 100755 --- a/toontown/estate/DistributedFurnitureManagerAI.py +++ b/toontown/estate/DistributedFurnitureManagerAI.py @@ -1,7 +1,7 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI from toontown.catalog.CatalogItemList import CatalogItemList from toontown.catalog import CatalogItem -from toontown.catalog.CatalogFurnitureItem import CatalogFurnitureItem, FLTrunk, FLCloset, FLBank, FLPhone +from toontown.catalog.CatalogFurnitureItem import CatalogFurnitureItem, FLTrunk, FLCloset, FLBank, FLPhone, FLCrate from toontown.catalog.CatalogWallpaperItem import CatalogWallpaperItem from toontown.catalog.CatalogMouldingItem import CatalogMouldingItem from toontown.catalog.CatalogFlooringItem import CatalogFlooringItem @@ -12,6 +12,7 @@ from DistributedPhoneAI import DistributedPhoneAI from DistributedClosetAI import DistributedClosetAI from DistributedTrunkAI import DistributedTrunkAI from DistributedBankAI import DistributedBankAI +from DistributedRewardCrateAI import DistributedRewardCrateAI from otp.ai.MagicWordGlobal import * class FurnitureError(Exception): @@ -243,6 +244,8 @@ class DistributedFurnitureManagerAI(DistributedObjectAI): do = DistributedBankAI(self.air, self, item) elif item.getFlags() & FLPhone: do = DistributedPhoneAI(self.air, self, item) + elif item.getFlags() & FLCrate: + do = DistributedRewardCrateAI(self.air, self, item) else: do = DistributedFurnitureItemAI(self.air, self, item) @@ -285,8 +288,21 @@ class DistributedFurnitureManagerAI(DistributedObjectAI): return ToontownGlobals.FM_DeletedItem - def deleteItemFromRoom(self, blob, doId): - pass + def deleteItemFromRoom(self, doId, addToTrash=True): + item = self.getItemObject(doId) + + if not item: + self.air.writeServerEvent('suspicious', avId=self.air.getAvatarIdFromSender(), issue='Tried to delete an invalid item with doId %s' % doId) + return ToontownGlobals.FM_InvalidIndex + + if addToTrash: + self.deletedItems.append(item.catalogItem) + self.d_setDeletedItems(self.getDeletedItems()) + + item.destroy() + self.items.remove(item) + + return ToontownGlobals.FM_DeletedItem def moveWallpaperFromAttic(self, index, room): retcode = ToontownGlobals.FM_SwappedItem @@ -372,7 +388,16 @@ class DistributedFurnitureManagerAI(DistributedObjectAI): return ToontownGlobals.FM_DeletedItem def recoverDeletedItem(self, blob, index): - pass + if len(self.deletedItems) <= index: + return + + item = self.deletedItems[index] + self.deletedItems.remove(item) + self.atticItems.append(item) + self.d_setDeletedItems(self.deletedItems) + self.d_setAtticItems(self.getAtticItems()) + + return ToontownGlobals.FM_MovedItem def handleMessage(self, func, response, *args): context = args[-1] @@ -409,7 +434,7 @@ class DistributedFurnitureManagerAI(DistributedObjectAI): self.handleMessage(self.deleteItemFromAttic, 'deleteItemFromAtticResponse', blob, index, context) def deleteItemFromRoomMessage(self, blob, doId, context): - self.handleMessage(self.deleteItemFromRoom, 'deleteItemFromRoomResponse', blob, doId, context) + self.handleMessage(self.deleteItemFromRoom, 'deleteItemFromRoomResponse', doId, context) def moveWallpaperFromAtticMessage(self, index, room, context): self.handleMessage(self.moveWallpaperFromAttic, 'moveWallpaperFromAtticResponse', index, room, context) diff --git a/toontown/quest/Quests.py b/toontown/quest/Quests.py index f88d54e9..b1d503fd 100755 --- a/toontown/quest/Quests.py +++ b/toontown/quest/Quests.py @@ -4432,6 +4432,7 @@ RewardDict = { 10003: (EPPReward, 3) # Sellbot } +BuffRewardIds = [3001, 3002, 3003, 3004] def getNumTiers(): return len(RequiredRewardTrackDict) - 1 diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 57f02bba..6fa7cdb4 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -3698,7 +3698,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def addCrateKeys(self, amountToAdd): self.b_setCrateKeys(min(self.getCrateKeys() + amountToAdd, 255)) - def removeeCrateKeys(self, amount): + def removeCrateKeys(self, amount): self.b_setCrateKeys(max(self.getCrateKeys() - amount, 0)) def b_setNametagStyle(self, nametagStyle): diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 2e80c9df..ae2f5348 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8616,6 +8616,15 @@ CEOSpeech = [ CrateRewardMessage1 = 'Nice! You have earned a crate! It will arrive in your mailbox shortly.' CrateRewardMessage2 = 'You can open it with keys from boss battles.' CrateRewardMessages = [CrateRewardMessage1, CrateRewardMessage2] +CrateNotOwner = 'Sorry, this is not your crate.' +CrateNoKeys = 'Sorry, but you have no keys. You can find some in the cog facilities.' +CrateAskToUse = 'Would you like to use a key to open this crate?' +CrateBeanPrize = "Congratulations! You found %s jellybeans. They've been automatically added to your jellybean bank!" +CrateBuffPrize = 'Congratulations! %s' +CrateNametagPrize = "Congratulations! You've received a nametag. Check your mailbox to find out which one!" +CrateEmotePrize = "Congratulations! You've unlocked a new emote. Check your mailbox to pick it up!" +CrateClothingPrize = "Congratulations! You've received a new clothing item. Check your mailbox to check it out!" +CrateAccessoryPrize = 'Congratulations! You found a new accessory for your Toon. Check your mailbox and rock it!' Blacklist = [ "$1ut", diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index aa3563dd..e4f98778 100755 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1634,3 +1634,12 @@ CLERK_TOOKTOOLONG = 2 KnockKnockHeal = 12 KnockKnockCooldown = 600 + +CRATE_NOT_OWNER = 0 +CRATE_NO_KEYS = 1 +CRATE_BEANS = 2 +CRATE_BUFFS = 3 +CRATE_NAMETAGS = 4 +CRATE_EMOTES = 5 +CRATE_CLOTHING = 6 +CRATE_ACCESSORIES = 7 \ No newline at end of file