Crates finished :D

This commit is contained in:
John 2015-07-27 18:02:19 +03:00
parent 48ba472271
commit 75ffd52621
7 changed files with 62 additions and 11 deletions

View file

@ -290,6 +290,7 @@ from toontown.estate import DistributedBank/AI
from toontown.estate import DistributedCloset/AI from toontown.estate import DistributedCloset/AI
from toontown.estate import DistributedTrunk/AI from toontown.estate import DistributedTrunk/AI
from toontown.estate import DistributedPhone/AI from toontown.estate import DistributedPhone/AI
from toontown.estate import DistributedRewardCrate/AI
from toontown.effects import DistributedFireworkShow/AI from toontown.effects import DistributedFireworkShow/AI
from toontown.estate import DistributedFireworksCannon/AI from toontown.estate import DistributedFireworksCannon/AI
from toontown.coghq import LobbyManager/AI from toontown.coghq import LobbyManager/AI
@ -2089,6 +2090,11 @@ dclass DistributedPhone : DistributedFurnitureItem {
setGiftAvatar(blob); setGiftAvatar(blob);
}; };
dclass DistributedRewardCrate : DistributedFurnitureItem {
requestKeyUsage() airecv clsend;
useKeyResponse(uint8, uint32);
};
dclass DistributedFireworkShow : DistributedObject { dclass DistributedFireworkShow : DistributedObject {
startShow(uint8, uint8, uint8, int16) broadcast ram; startShow(uint8, uint8, uint8, int16) broadcast ram;
requestFirework(int16/10, int16/10, int16/100, uint8, uint8, uint8) airecv clsend; requestFirework(int16/10, int16/10, int16/100, uint8, uint8, uint8) airecv clsend;

View file

@ -18,10 +18,11 @@ FLPainting = 8
FLOnTable = 16 FLOnTable = 16
FLIsTable = 32 FLIsTable = 32
FLPhone = 64 FLPhone = 64
FLBillboard = 128 FLCrate = 128
FLTrunk = 256 FLBillboard = 256
FLBoysOnly = 512 FLTrunk = 512
FLGirlsOnly = 1024 FLBoysOnly = 1024
FLGirlsOnly = 2048
furnitureColors = [ furnitureColors = [
(0.792, 0.353, 0.29, 1.0), (0.792, 0.353, 0.29, 1.0),
(0.176, 0.592, 0.439, 1.0), (0.176, 0.592, 0.439, 1.0),
@ -896,7 +897,7 @@ FurnitureTypes = {
None, None,
None, None,
0, 0,
None, FLCrate,
0.5) 0.5)
} }

View file

@ -1,7 +1,7 @@
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.catalog.CatalogItemList import CatalogItemList from toontown.catalog.CatalogItemList import CatalogItemList
from toontown.catalog import CatalogItem 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.CatalogWallpaperItem import CatalogWallpaperItem
from toontown.catalog.CatalogMouldingItem import CatalogMouldingItem from toontown.catalog.CatalogMouldingItem import CatalogMouldingItem
from toontown.catalog.CatalogFlooringItem import CatalogFlooringItem from toontown.catalog.CatalogFlooringItem import CatalogFlooringItem
@ -12,6 +12,7 @@ from DistributedPhoneAI import DistributedPhoneAI
from DistributedClosetAI import DistributedClosetAI from DistributedClosetAI import DistributedClosetAI
from DistributedTrunkAI import DistributedTrunkAI from DistributedTrunkAI import DistributedTrunkAI
from DistributedBankAI import DistributedBankAI from DistributedBankAI import DistributedBankAI
from DistributedRewardCrateAI import DistributedRewardCrateAI
from otp.ai.MagicWordGlobal import * from otp.ai.MagicWordGlobal import *
class FurnitureError(Exception): class FurnitureError(Exception):
@ -243,6 +244,8 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
do = DistributedBankAI(self.air, self, item) do = DistributedBankAI(self.air, self, item)
elif item.getFlags() & FLPhone: elif item.getFlags() & FLPhone:
do = DistributedPhoneAI(self.air, self, item) do = DistributedPhoneAI(self.air, self, item)
elif item.getFlags() & FLCrate:
do = DistributedRewardCrateAI(self.air, self, item)
else: else:
do = DistributedFurnitureItemAI(self.air, self, item) do = DistributedFurnitureItemAI(self.air, self, item)
@ -285,8 +288,21 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
return ToontownGlobals.FM_DeletedItem return ToontownGlobals.FM_DeletedItem
def deleteItemFromRoom(self, blob, doId): def deleteItemFromRoom(self, doId, addToTrash=True):
pass 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): def moveWallpaperFromAttic(self, index, room):
retcode = ToontownGlobals.FM_SwappedItem retcode = ToontownGlobals.FM_SwappedItem
@ -372,7 +388,16 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
return ToontownGlobals.FM_DeletedItem return ToontownGlobals.FM_DeletedItem
def recoverDeletedItem(self, blob, index): 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): def handleMessage(self, func, response, *args):
context = args[-1] context = args[-1]
@ -409,7 +434,7 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
self.handleMessage(self.deleteItemFromAttic, 'deleteItemFromAtticResponse', blob, index, context) self.handleMessage(self.deleteItemFromAttic, 'deleteItemFromAtticResponse', blob, index, context)
def deleteItemFromRoomMessage(self, blob, doId, 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): def moveWallpaperFromAtticMessage(self, index, room, context):
self.handleMessage(self.moveWallpaperFromAttic, 'moveWallpaperFromAtticResponse', index, room, context) self.handleMessage(self.moveWallpaperFromAttic, 'moveWallpaperFromAtticResponse', index, room, context)

View file

@ -4432,6 +4432,7 @@ RewardDict = {
10003: (EPPReward, 3) # Sellbot 10003: (EPPReward, 3) # Sellbot
} }
BuffRewardIds = [3001, 3002, 3003, 3004]
def getNumTiers(): def getNumTiers():
return len(RequiredRewardTrackDict) - 1 return len(RequiredRewardTrackDict) - 1

View file

@ -3698,7 +3698,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def addCrateKeys(self, amountToAdd): def addCrateKeys(self, amountToAdd):
self.b_setCrateKeys(min(self.getCrateKeys() + amountToAdd, 255)) self.b_setCrateKeys(min(self.getCrateKeys() + amountToAdd, 255))
def removeeCrateKeys(self, amount): def removeCrateKeys(self, amount):
self.b_setCrateKeys(max(self.getCrateKeys() - amount, 0)) self.b_setCrateKeys(max(self.getCrateKeys() - amount, 0))
def b_setNametagStyle(self, nametagStyle): def b_setNametagStyle(self, nametagStyle):

View file

@ -8616,6 +8616,15 @@ CEOSpeech = [
CrateRewardMessage1 = 'Nice! You have earned a crate! It will arrive in your mailbox shortly.' CrateRewardMessage1 = 'Nice! You have earned a crate! It will arrive in your mailbox shortly.'
CrateRewardMessage2 = 'You can open it with keys from boss battles.' CrateRewardMessage2 = 'You can open it with keys from boss battles.'
CrateRewardMessages = [CrateRewardMessage1, CrateRewardMessage2] 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 = [ Blacklist = [
"$1ut", "$1ut",

View file

@ -1634,3 +1634,12 @@ CLERK_TOOKTOOLONG = 2
KnockKnockHeal = 12 KnockKnockHeal = 12
KnockKnockCooldown = 600 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