diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 1a15b4ba..1d71078d 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -720,7 +720,7 @@ dclass DistributedToon : DistributedPlayer { setUnlimitedSwing(uint8) broadcast ownrecv ram; logSuspiciousEvent(char [0-1024]) ownsend airecv; forceLogoutWithNotify() ownrecv; - setPinkSlips(uint8 = 0) required ownrecv db; + setSpecialInventory(uint8[] = [0, 0]) required ownrecv db; setNametagStyle(uint8 = 0) required broadcast ownrecv db; setNametagStyles(uint8[] = [0]) required broadcast ownrecv db; setMail(simpleMail []) ownrecv; @@ -825,6 +825,7 @@ dclass DistributedBossCog : DistributedNode { setToonIds(uint32[], uint32[], uint32[]) broadcast ram; setBattleIds(uint8, uint32, uint32) broadcast ram; setArenaSide(uint8) broadcast ram; + setKeyReward(bool) required broadcast ram; avatarEnter() airecv clsend; avatarExit() airecv clsend; avatarNearEnter() airecv clsend; @@ -974,6 +975,7 @@ dclass DistributedBattleTutorial : DistributedBattle { }; dclass DistributedLevelBattle : DistributedBattle { + announceCrateReward() broadcast; }; dclass DistributedBattleFactory : DistributedLevelBattle { diff --git a/toontown/catalog/CatalogFurnitureItem.py b/toontown/catalog/CatalogFurnitureItem.py index 268ad292..5eebc067 100755 --- a/toontown/catalog/CatalogFurnitureItem.py +++ b/toontown/catalog/CatalogFurnitureItem.py @@ -891,7 +891,13 @@ FurnitureTypes = { None, None, 200, - FLPainting) + FLPainting), + 10040: ('phase_10/models/cashbotHQ/CBWoodCrate', + None, + None, + 0, + None, + 0.5) } class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem): diff --git a/toontown/coghq/DistributedBattleFactoryAI.py b/toontown/coghq/DistributedBattleFactoryAI.py index c8ef63ed..bd675395 100755 --- a/toontown/coghq/DistributedBattleFactoryAI.py +++ b/toontown/coghq/DistributedBattleFactoryAI.py @@ -22,6 +22,7 @@ class DistributedBattleFactoryAI(DistributedLevelBattleAI.DistributedLevelBattle return self.level.factoryId def handleToonsWon(self, toons): + self.handleCrateReward(toons) for toon in toons: recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId()) self.toonItems[toon.doId][0].extend(recovered) diff --git a/toontown/coghq/DistributedCountryClubBattleAI.py b/toontown/coghq/DistributedCountryClubBattleAI.py index 25597265..6950a9e7 100755 --- a/toontown/coghq/DistributedCountryClubBattleAI.py +++ b/toontown/coghq/DistributedCountryClubBattleAI.py @@ -29,6 +29,7 @@ class DistributedCountryClubBattleAI(DistributedLevelBattleAI.DistributedLevelBa amount = ToontownGlobals.CountryClubCogBuckRewards[self.level.countryClubId] index = ToontownGlobals.cogHQZoneId2deptIndex(self.level.countryClubId) extraMerits[index] = amount + self.handleCrateReward(toons) for toon in toons: recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId()) self.toonItems[toon.doId][0].extend(recovered) diff --git a/toontown/coghq/DistributedFactory.py b/toontown/coghq/DistributedFactory.py index 5aa044b4..c32e2d80 100755 --- a/toontown/coghq/DistributedFactory.py +++ b/toontown/coghq/DistributedFactory.py @@ -28,7 +28,6 @@ class DistributedFactory(DistributedLevel.DistributedLevel, FactoryBase.FactoryB self.joiningReserves = [] self.suitsInitialized = 0 self.goonClipPlanes = {} - base.localAvatar.physControls.setCollisionRayHeight(10.0) def createEntityCreator(self): return FactoryEntityCreator.FactoryEntityCreator(level=self) @@ -39,14 +38,15 @@ class DistributedFactory(DistributedLevel.DistributedLevel, FactoryBase.FactoryB self.factoryViews = FactoryCameraViews.FactoryCameraViews(self) base.localAvatar.chatMgr.chatInputSpeedChat.addFactoryMenu() self.accept('SOSPanelEnter', self.handleSOSPanel) + base.factory = self def delete(self): DistributedLevel.DistributedLevel.delete(self) base.localAvatar.chatMgr.chatInputSpeedChat.removeFactoryMenu() self.factoryViews.delete() del self.factoryViews + del base.factory self.ignore('SOSPanelEnter') - base.localAvatar.physControls.setCollisionRayHeight(CollisionHandlerRayStart) def setFactoryId(self, id): FactoryBase.FactoryBase.setFactoryId(self, id) @@ -166,10 +166,7 @@ def factoryWarp(zoneNum): """ Warp to a specific factory zone. """ - factory = [base.cr.doFind('DistributedFactory'), base.cr.doFind('DistributedMegaCorp')] - for f in factory: - if (not f) or (not isinstance(f, DistributedFactory)): - return 'You must be in a factory.' - factory = f - factory.warpToZone(zoneNum) + if not hasattr(base, 'factory'): + return 'You must be in a factory!' + base.factory.warpToZone(zoneNum) return 'Warped to zone: %d' % zoneNum diff --git a/toontown/coghq/DistributedLevelBattle.py b/toontown/coghq/DistributedLevelBattle.py index ad1d758e..2d94a34e 100755 --- a/toontown/coghq/DistributedLevelBattle.py +++ b/toontown/coghq/DistributedLevelBattle.py @@ -89,6 +89,15 @@ class DistributedLevelBattle(DistributedBattle.DistributedBattle): def onWaitingForJoin(self): self.lockLevelViz() + + def announceCrateReward(self): + track = Sequence() + + for i, message in enumerate(TTLocalizer.CrateRewardMessages): + track.append(Func(base.localAvatar.setSystemMessage, 0, message)) + track.append(Wait(1.5)) + + track.start() def __faceOff(self, ts, name, callback): if len(self.suits) == 0: diff --git a/toontown/coghq/DistributedLevelBattleAI.py b/toontown/coghq/DistributedLevelBattleAI.py index 8201ec92..06d85f96 100755 --- a/toontown/coghq/DistributedLevelBattleAI.py +++ b/toontown/coghq/DistributedLevelBattleAI.py @@ -1,11 +1,13 @@ from toontown.battle import DistributedBattleAI from toontown.battle import DistributedBattleBaseAI +from toontown.catalog import CatalogFurnitureItem from direct.directnotify import DirectNotifyGlobal from direct.fsm import State from direct.fsm import ClassicFSM from toontown.battle.BattleBase import * import CogDisguiseGlobals from direct.showbase.PythonUtil import addListsByValue +import time class DistributedLevelBattleAI(DistributedBattleAI.DistributedBattleAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLevelBattleAI') @@ -96,6 +98,18 @@ class DistributedLevelBattleAI(DistributedBattleAI.DistributedBattleAI): def handleToonsWon(self, toons): pass + + def handleCrateReward(self, toons): + if not (config.GetBool('get-crate-reward-always', False) or random.random() <= 0.25): + return + + self.sendUpdate('announceCrateReward') + item = CatalogFurnitureItem.CatalogFurnitureItem(10040) + item.deliveryDate = int(time.time() / 60. + .5) + + for toon in toons: + toon.onOrder.append(item) + toon.b_setDeliverySchedule(toon.onOrder) def enterFaceOff(self): self.notify.debug('DistributedLevelBattleAI.enterFaceOff()') diff --git a/toontown/coghq/DistributedMintBattleAI.py b/toontown/coghq/DistributedMintBattleAI.py index 1ffbbfc1..47f5f99c 100755 --- a/toontown/coghq/DistributedMintBattleAI.py +++ b/toontown/coghq/DistributedMintBattleAI.py @@ -28,6 +28,7 @@ class DistributedMintBattleAI(DistributedLevelBattleAI.DistributedLevelBattleAI) amount = ToontownGlobals.MintCogBuckRewards[self.level.mintId] index = ToontownGlobals.cogHQZoneId2deptIndex(self.level.mintId) extraMerits[index] = amount + self.handleCrateReward(toons) for toon in toons: recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId()) self.toonItems[toon.doId][0].extend(recovered) diff --git a/toontown/coghq/DistributedStageBattleAI.py b/toontown/coghq/DistributedStageBattleAI.py index da1613d4..32e162ba 100755 --- a/toontown/coghq/DistributedStageBattleAI.py +++ b/toontown/coghq/DistributedStageBattleAI.py @@ -36,6 +36,7 @@ class DistributedStageBattleAI(DistributedLevelBattleAI.DistributedLevelBattleAI amount = ToontownGlobals.StageNoticeRewards[self.level.stageId] index = ToontownGlobals.cogHQZoneId2deptIndex(self.level.stageId) extraMerits[index] = amount + self.handleCrateReward(toons) for toon in toons: recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId()) self.toonItems[toon.doId][0].extend(recovered) diff --git a/toontown/suit/DistributedBossCog.py b/toontown/suit/DistributedBossCog.py index c2a1089b..89704c59 100755 --- a/toontown/suit/DistributedBossCog.py +++ b/toontown/suit/DistributedBossCog.py @@ -44,6 +44,7 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): self.battleB = None self.battleRequest = None self.arenaSide = 0 + self.keyReward = False self.toonSphere = None self.localToonIsSafe = 0 self.__toonsStuckToFloor = [] @@ -303,6 +304,9 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): def setArenaSide(self, arenaSide): self.arenaSide = arenaSide + + def setKeyReward(self, reward): + self.keyReward = reward def setState(self, state): self.request(state) diff --git a/toontown/suit/DistributedBossCogAI.py b/toontown/suit/DistributedBossCogAI.py index b73af025..d36e75ba 100755 --- a/toontown/suit/DistributedBossCogAI.py +++ b/toontown/suit/DistributedBossCogAI.py @@ -44,8 +44,8 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): self.attackCode = None self.attackAvId = 0 self.hitCount = 0 + self.keyReward = config.GetBool('get-key-reward-always', False) or random.random() <= 0.15 AllBossCogs.append(self) - return def delete(self): self.ignoreAll() @@ -182,6 +182,9 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): def getState(self): return self.state + + def getKeyReward(self): + return self.keyReward def formatReward(self): return 'unspecified' @@ -259,7 +262,7 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): pass def enterEpilogue(self): - pass + self.giveKeyReward() def exitEpilogue(self): pass @@ -606,3 +609,13 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): def doNextAttack(self, task): self.b_setAttackCode(ToontownGlobals.BossCogNoAttack) + + def giveKeyReward(self): + if not self.keyReward: + return + + for toonId in self.involvedToons: + toon = self.air.doId2do.get(toonId) + + if toon: + toon.addCrateKeys(1) \ No newline at end of file diff --git a/toontown/suit/DistributedBossbotBoss.py b/toontown/suit/DistributedBossbotBoss.py index 0fb4c400..132fed89 100755 --- a/toontown/suit/DistributedBossbotBoss.py +++ b/toontown/suit/DistributedBossbotBoss.py @@ -861,6 +861,10 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): speech += TTLocalizer.BossbotRTHPBoost else: speech += TTLocalizer.BossbotRTMaxed % (ToontownGlobals.MaxCogSuitLevel + 1) + + if self.keyReward: + speech += TTLocalizer.BossRTKeyReward + return speech def __arrangeToonsAroundResistanceToonForReward(self): diff --git a/toontown/suit/DistributedCashbotBoss.py b/toontown/suit/DistributedCashbotBoss.py index ec868102..c990a973 100755 --- a/toontown/suit/DistributedCashbotBoss.py +++ b/toontown/suit/DistributedCashbotBoss.py @@ -659,6 +659,10 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): speech += TTLocalizer.ResistanceToonHPBoost else: speech += TTLocalizer.ResistanceToonMaxed % (ToontownGlobals.MaxCogSuitLevel + 1) + + if self.keyReward: + speech += TTLocalizer.BossRTKeyReward + return speech def enterOff(self): diff --git a/toontown/suit/DistributedLawbotBoss.py b/toontown/suit/DistributedLawbotBoss.py index 683393f8..580f6cb4 100755 --- a/toontown/suit/DistributedLawbotBoss.py +++ b/toontown/suit/DistributedLawbotBoss.py @@ -1643,6 +1643,10 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): speech += TTLocalizer.WitnessToonHPBoost else: speech += TTLocalizer.WitnessToonMaxed % (ToontownGlobals.MaxCogSuitLevel + 1) + + if self.keyReward: + speech += TTLocalizer.BossRTKeyReward + return speech def __positionToonsInFrontOfCannons(self): diff --git a/toontown/suit/DistributedSellbotBoss.py b/toontown/suit/DistributedSellbotBoss.py index 529bb821..d0386886 100755 --- a/toontown/suit/DistributedSellbotBoss.py +++ b/toontown/suit/DistributedSellbotBoss.py @@ -457,6 +457,12 @@ class DistributedSellbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): speech += TTLocalizer.CagedToonHPBoost else: speech += TTLocalizer.CagedToonMaxed % (ToontownGlobals.MaxCogSuitLevel + 1) + + if self.keyReward: + speech += TTLocalizer.BossRTKeyReward + + return speech + return speech def __makeCageOpenMovie(self): diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 39958ec3..764ead33 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -172,6 +172,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.ignored = [] self.reported = [] self.trueFriends = [] + self.specialInventory = [0, 0, 0, 0, 0] def disable(self): for soundSequence in self.soundSequenceList: @@ -1936,13 +1937,16 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute return self.unlimitedSwing def getPinkSlips(self): - if hasattr(self, 'pinkSlips'): - return self.pinkSlips - else: - return 0 + return self.specialInventory[0] + + def getCrateKeys(self): + return self.specialInventory[1] - def setPinkSlips(self, pinkSlips): - self.pinkSlips = pinkSlips + def setSpecialInventory(self, specialInventory): + self.specialInventory = specialInventory + + def getSpecialInventory(self): + return self.specialInventory def setDisplayName(self, str): if not self.isDisguised: diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 02be0bcd..57f02bba 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -3662,27 +3662,44 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.sendUpdate('setUnlimitedSwing', [unlimitedSwing]) def b_setPinkSlips(self, pinkSlips): - self.d_setPinkSlips(pinkSlips) - self.setPinkSlips(pinkSlips) + self.specialInventory[0] = pinkSlips + self.b_setSpecialInventory(self.specialInventory) + + def b_setCrateKeys(self, crateKeys): + self.specialInventory[1] = crateKeys + self.b_setSpecialInventory(self.specialInventory) + + def b_setSpecialInventory(self, specialInventory): + self.d_setSpecialInventory(specialInventory) + self.setSpecialInventory(specialInventory) - def d_setPinkSlips(self, pinkSlips): - self.sendUpdate('setPinkSlips', [pinkSlips]) + def d_setSpecialInventory(self, specialInventory): + self.sendUpdate('setSpecialInventory', [specialInventory]) - def setPinkSlips(self, pinkSlips): - self.pinkSlips = pinkSlips + def setSpecialInventory(self, specialInventory): + self.specialInventory = specialInventory def getPinkSlips(self): - return self.pinkSlips + return self.specialInventory[0] + + def getCrateKeys(self): + return self.specialInventory[1] def addPinkSlips(self, amountToAdd): - pinkSlips = min(self.pinkSlips + amountToAdd, 255) + pinkSlips = min(self.getPinkSlips() + amountToAdd, 255) self.b_setPinkSlips(pinkSlips) def removePinkSlips(self, amount): if hasattr(self, 'autoRestockPinkSlips') and self.autoRestockPinkSlips: amount = 0 - pinkSlips = max(self.pinkSlips - amount, 0) + pinkSlips = max(self.getPinkSlips() - amount, 0) self.b_setPinkSlips(pinkSlips) + + def addCrateKeys(self, amountToAdd): + self.b_setCrateKeys(min(self.getCrateKeys() + amountToAdd, 255)) + + def removeeCrateKeys(self, amount): + self.b_setCrateKeys(max(self.getCrateKeys() - amount, 0)) def b_setNametagStyle(self, nametagStyle): self.d_setNametagStyle(nametagStyle) @@ -4350,6 +4367,17 @@ def fires(count): invoker.b_setPinkSlips(count) return 'You were given %d fires.' % count +@magicWord(category=CATEGORY_PROGRAMMER, types=[int]) +def crateKeys(count): + """ + Modifies the invoker's crate key count. + """ + invoker = spellbook.getInvoker() + if not 0 <= count <= 255: + return 'Your crate key must be in range (0-255).' + invoker.b_setCrateKeys(count) + return 'You were given %d crate keys.' % count + @magicWord(category=CATEGORY_PROGRAMMER, types=[int]) def maxMoney(maxMoney): """ diff --git a/toontown/toon/DistributedToonUD.py b/toontown/toon/DistributedToonUD.py index 9ce23763..b791f78f 100755 --- a/toontown/toon/DistributedToonUD.py +++ b/toontown/toon/DistributedToonUD.py @@ -460,7 +460,7 @@ class DistributedToonUD(DistributedObjectUD): def forceLogoutWithNotify(self): pass - def setPinkSlips(self, todo0): + def setSpecialInventory(self, todo0): pass def setNametagStyle(self, todo0): diff --git a/toontown/toon/InventoryNew.py b/toontown/toon/InventoryNew.py index 69742fce..48ecd678 100755 --- a/toontown/toon/InventoryNew.py +++ b/toontown/toon/InventoryNew.py @@ -116,11 +116,20 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame): DirectFrame.hide(self) def updateTotalPropsText(self): - textTotal = TTLocalizer.InventoryTotalGags % (self.totalProps, self.toon.getMaxCarry()) + textTotal = '%s\n\n' % (TTLocalizer.InventoryTotalGags % (self.totalProps, self.toon.getMaxCarry())) + if localAvatar.getPinkSlips() > 1: - textTotal = textTotal + '\n\n' + TTLocalizer.InventroyPinkSlips % localAvatar.getPinkSlips() + textTotal += TTLocalizer.InventoryPinkSlips % localAvatar.getPinkSlips() + textTotal += '\n' elif localAvatar.getPinkSlips() == 1: - textTotal = textTotal + '\n\n' + TTLocalizer.InventroyPinkSlip + textTotal += TTLocalizer.InventoryPinkSlip + textTotal += '\n' + + if localAvatar.getCrateKeys() > 1: + textTotal += TTLocalizer.InventoryCrateKeys % localAvatar.getCrateKeys() + elif localAvatar.getCrateKeys() == 1: + textTotal += TTLocalizer.InventoryCrateKey + self.totalLabel['text'] = textTotal def unload(self): diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 117f19fd..458c4da8 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -1659,8 +1659,8 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.tipPage.load() self.book.addPage(self.tipPage, pageName=TTLocalizer.TIPPageTitle) - def setPinkSlips(self, pinkSlips): - DistributedToon.DistributedToon.setPinkSlips(self, pinkSlips) + def setSpecialInventory(self, specialInventory): + DistributedToon.DistributedToon.setSpecialInventory(self, specialInventory) self.inventory.updateTotalPropsText() def hasActiveBoardingGroup(self): diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 0b4e1d47..2e80c9df 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -3982,8 +3982,10 @@ TIPPageTitle = 'TIP' SuitBaseNameWithLevel = '%(name)s\n%(dept)s\nLevel %(level)s' HealthForceAcknowledgeMessage = 'You cannot leave the playground until your Laff meter is smiling!' InventoryTotalGags = 'Total gags\n%d / %d' -InventroyPinkSlips = '%s Pink Slips' -InventroyPinkSlip = '1 Pink Slip' +InventoryPinkSlips = '%s Pink Slips' +InventoryPinkSlip = '1 Pink Slip' +InventoryCrateKeys = '%s Crate Keys' +InventoryCrateKey = '1 Crate Key' InventoryDelete = 'DELETE' InventoryDeleteAll = 'DELETE ALL' InventoryDone = 'DONE' @@ -5188,7 +5190,8 @@ FurnitureNames = {100: 'Armchair', 10000: 'Short Pumpkin', 10010: 'Tall Pumpkin', 10020: 'Winter Tree', - 10030: 'Winter Wreath'} + 10030: 'Winter Wreath', + 10040: 'Cog Nation Crate'} ClothingArticleNames = ('Shirt', 'Shirt', 'Shirt', @@ -8118,6 +8121,7 @@ BossbotRTCongratulations = "You did it! You've demoted the C.E.O.!\x07Here, tak BossbotRTHPBoost = "\x07You've done a lot of work for the Resistance.\x07The Toon Council has decided to give you another Laff point. Congratulations!" BossbotRTMaxed = '\x07I see that you have a level %s Cog Suit. Very impressive!\x07On behalf of the Toon Council, thank you for coming back to defend more Toons!' BossbotRTLastPromotion = "\x07Wow, you've reached level %s on your Cog Suit!\x07Cogs don't get promoted higher than that.\x07You can't upgrade your Cog Suit anymore, but you can certainly keep working for the Resistance!" +BossRTKeyReward = '\x07By the way, thanks to your exquisite performance, the Toon Council has decided to offer to you a Cog Nation Crate key!\x07Using this, you will be able to open the crates you have earned in the cog factories.' GolfAreaAttackTaunt = 'Fore!' OvertimeAttackTaunts = ["It's time to reorganize.", "Now let's downsize."] ElevatorBossBotBoss = 'Bossbot Clubhouse' @@ -8608,6 +8612,11 @@ CEOSpeech = [ 'I am very delighted by this news, I just wanted to thank you all for working so hard for this news.', "Wait, what's going on? I can't see but I hear explosions." ] # Len of words + 10 + +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] + Blacklist = [ "$1ut", "$h1t",