From 6d24fb43902a8b3309ed5b477a7220263f051895 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 11 Jun 2015 17:27:22 +0300 Subject: [PATCH] Add merits unite which restocks 16.66% of the total merits required (meaning it needs a bit more than 6 unites to restock fully, even for BIg Cheese 23300 promotions.) --- toontown/battle/RewardPanel.py | 10 ++---- toontown/building/DistributedBuilding.py | 10 ++---- toontown/chat/ResistanceChat.py | 40 +++++++++++++++++++++--- toontown/quest/QuestPoster.py | 30 ++++-------------- toontown/shtiker/InventoryPage.py | 4 +-- toontown/shtiker/ShardPage.py | 15 +++------ toontown/suit/DistributedCashbotBoss.py | 5 +++ toontown/suit/Suit.py | 25 ++------------- toontown/suit/SuitDNA.py | 8 +++++ toontown/toon/DistributedToon.py | 2 +- toontown/toon/DistributedToonAI.py | 19 +++++++++++ toontown/toonbase/TTLocalizerEnglish.py | 11 +++++-- 12 files changed, 95 insertions(+), 84 deletions(-) diff --git a/toontown/battle/RewardPanel.py b/toontown/battle/RewardPanel.py index 5c826917..0390ce0b 100755 --- a/toontown/battle/RewardPanel.py +++ b/toontown/battle/RewardPanel.py @@ -515,14 +515,8 @@ class RewardPanel(DirectFrame): name = SuitDNA.suitDepts[dept] self.promotionFrame['text'] = TTLocalizer.RewardPanelPromotion % SuitDNA.suitDeptFullnames[name] icons = loader.loadModel('phase_3/models/gui/cog_icons') - if dept == 0: - self.deptIcon = icons.find('**/CorpIcon').copyTo(self.promotionFrame) - elif dept == 1: - self.deptIcon = icons.find('**/LegalIcon').copyTo(self.promotionFrame) - elif dept == 2: - self.deptIcon = icons.find('**/MoneyIcon').copyTo(self.promotionFrame) - elif dept == 3: - self.deptIcon = icons.find('**/SalesIcon').copyTo(self.promotionFrame) + if dept in SuitDNA.suitDeptModelPaths: + self.deptIcon = icons.find(SuitDNA.suitDeptModelPaths[dept]).copyTo(self.promotionFrame) icons.removeNode() self.deptIcon.setPos(0, 0, -0.225) self.deptIcon.setScale(0.33) diff --git a/toontown/building/DistributedBuilding.py b/toontown/building/DistributedBuilding.py index 3ce8c5f4..f954efe4 100755 --- a/toontown/building/DistributedBuilding.py +++ b/toontown/building/DistributedBuilding.py @@ -321,14 +321,8 @@ class DistributedBuilding(DistributedObject.DistributedObject): self.cab = self.elevatorModel.find('**/elevator') cogIcons = loader.loadModel('phase_3/models/gui/cog_icons') dept = chr(self.track) - if dept == 'c': - corpIcon = cogIcons.find('**/CorpIcon').copyTo(self.cab) - elif dept == 's': - corpIcon = cogIcons.find('**/SalesIcon').copyTo(self.cab) - elif dept == 'l': - corpIcon = cogIcons.find('**/LegalIcon').copyTo(self.cab) - elif dept == 'm': - corpIcon = cogIcons.find('**/MoneyIcon').copyTo(self.cab) + if dept in SuitDNA.suitDeptModelPaths: + corpIcon = cogIcons.find(SuitDNA.suitDeptModelPaths[dept]).copyTo(self.cab) corpIcon.setPos(0, 6.79, 6.8) corpIcon.setScale(3) from toontown.suit import Suit diff --git a/toontown/chat/ResistanceChat.py b/toontown/chat/ResistanceChat.py index 48b7dfa0..48ed1c61 100755 --- a/toontown/chat/ResistanceChat.py +++ b/toontown/chat/ResistanceChat.py @@ -4,6 +4,7 @@ import random from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals +from toontown.suit import SuitDNA if process == 'client': @@ -19,7 +20,8 @@ EFFECT_RADIUS = 30 RESISTANCE_TOONUP = 0 RESISTANCE_RESTOCK = 1 RESISTANCE_MONEY = 2 -resistanceMenu = [RESISTANCE_TOONUP, RESISTANCE_RESTOCK, RESISTANCE_MONEY] +RESISTANCE_MERITS = 3 +resistanceMenu = [RESISTANCE_TOONUP, RESISTANCE_RESTOCK, RESISTANCE_MONEY, RESISTANCE_MERITS] resistanceDict = { RESISTANCE_TOONUP: { 'menuName': TTLocalizer.ResistanceToonupMenu, @@ -60,6 +62,14 @@ resistanceDict = { TTLocalizer.MovieNPCSOSAll ], 'items': [0, 1, 2, 3, 4, 5, 6, 7] + }, + RESISTANCE_MERITS: { + 'menuName': TTLocalizer.ResistanceMeritsMenu, + 'itemText': TTLocalizer.ResistanceMeritsItem, + 'chatText': TTLocalizer.ResistanceMeritsChat, + 'values': range(len(SuitDNA.suitDepts)) + [-1], + 'extra': TTLocalizer.RewardPanelMeritBarLabels + [TTLocalizer.MovieNPCSOSAll], + 'items': range(len(SuitDNA.suitDepts) + 1) } } @@ -98,13 +108,14 @@ def getMenuName(textId): def getItemText(textId): menuIndex, itemIndex = decodeId(textId) - value = resistanceDict[menuIndex]['values'][itemIndex] - text = resistanceDict[menuIndex]['itemText'] + resistance = resistanceDict[menuIndex] + value = resistance['values'][itemIndex] + text = resistance['itemText'] if menuIndex is RESISTANCE_TOONUP: if value is -1: value = TTLocalizer.ResistanceToonupItemMax - elif menuIndex is RESISTANCE_RESTOCK: - value = resistanceDict[menuIndex]['extra'][itemIndex] + elif 'extra' in resistance: + value = resistance['extra'][itemIndex] return text % str(value) @@ -177,6 +188,25 @@ def doEffect(textId, speakingToon, nearbyToons): p = effect.getParticlesNamed(name) p.renderer.setFromNode(icon) fadeColor = VBase4(0, 0, 1, 1) + elif menuIndex == RESISTANCE_MERITS: + effect = BattleParticles.loadParticleFile('resistanceEffectSprite.ptf') + cogModel = loader.loadModel('phase_3/models/gui/cog_icons') + cogModel.flattenLight() + + if itemValue != -1: + iconDict = {'particles-1': cogModel.find(SuitDNA.suitDeptModelPaths[itemValue])} + else: + iconDict = {} + + for i in xrange(len(SuitDNA.suitDepts)): + iconDict['particles-%s' % (i + 1)] = cogModel.find(SuitDNA.suitDeptModelPaths[i]) + + for name, icon in iconDict.items(): + p = effect.getParticlesNamed(name) + p.renderer.setFromNode(icon) + + fadeColor = VBase4(0.7, 0.7, 0.7, 1.0) + cogModel.removeNode() else: return recolorToons = Parallel() diff --git a/toontown/quest/QuestPoster.py b/toontown/quest/QuestPoster.py index 4aeed6a7..1b81a18b 100755 --- a/toontown/quest/QuestPoster.py +++ b/toontown/quest/QuestPoster.py @@ -407,14 +407,8 @@ class QuestPoster(DirectFrame): else: if holderType == 'track': cogIcons = loader.loadModel('phase_3/models/gui/cog_icons') - if holder == 'c': - icon = cogIcons.find('**/CorpIcon') - elif holder == 's': - icon = cogIcons.find('**/SalesIcon') - elif holder == 'l': - icon = cogIcons.find('**/LegalIcon') - elif holder == 'm': - icon = cogIcons.find('**/MoneyIcon') + if holder in SuitDNA.suitDeptModelPaths: + icon = cogIcons.find(SuitDNA.suitDeptModelPaths[holder]) rIconGeom = icon.copyTo(hidden) rIconGeom.setColor(Suit.Suit.medallionColors[holder]) rIconGeomScale = 0.12 @@ -743,14 +737,8 @@ class QuestPoster(DirectFrame): dept = quest.getCogTrack() cogIcons = loader.loadModel('phase_3/models/gui/cog_icons') lIconGeomScale = 0.13 - if dept == 'c': - icon = cogIcons.find('**/CorpIcon') - elif dept == 's': - icon = cogIcons.find('**/SalesIcon') - elif dept == 'l': - icon = cogIcons.find('**/LegalIcon') - elif dept == 'm': - icon = cogIcons.find('**/MoneyIcon') + if dept in SuitDNA.suitDeptModelPaths: + icon = cogIcons.find(SuitDNA.suitDeptModelPaths[dept]) lIconGeom = icon.copyTo(hidden) lIconGeom.setColor(Suit.Suit.medallionColors[dept]) cogIcons.removeNode() @@ -795,14 +783,8 @@ class QuestPoster(DirectFrame): dept = quest.getCogTrack() cogIcons = loader.loadModel('phase_3/models/gui/cog_icons') lIconGeomScale = 0.13 - if dept == 'c': - icon = cogIcons.find('**/CorpIcon') - elif dept == 's': - icon = cogIcons.find('**/SalesIcon') - elif dept == 'l': - icon = cogIcons.find('**/LegalIcon') - elif dept == 'm': - icon = cogIcons.find('**/MoneyIcon') + if dept in SuitDNA.suitDeptModelPaths: + icon = cogIcons.find(SuitDNA.suitDeptModelPaths[dept]) lIconGeom = icon.copyTo(hidden) lIconGeom.setColor(Suit.Suit.medallionColors[dept]) cogIcons.removeNode() diff --git a/toontown/shtiker/InventoryPage.py b/toontown/shtiker/InventoryPage.py index 28f10b84..bba9471b 100755 --- a/toontown/shtiker/InventoryPage.py +++ b/toontown/shtiker/InventoryPage.py @@ -32,6 +32,7 @@ class InventoryPage(ShtikerPage.ShtikerPage): jarGui.removeNode() def unload(self): + self.ignoreAll() del self.title self.destroyMeritBars() ShtikerPage.ShtikerPage.unload(self) @@ -47,6 +48,7 @@ class InventoryPage(ShtikerPage.ShtikerPage): DisguisePage.DeptColors[i][1] * 0.7, DisguisePage.DeptColors[i][2] * 0.7, 1), barColor=(DisguisePage.DeptColors[i][0] * 0.8, DisguisePage.DeptColors[i][1] * 0.8, DisguisePage.DeptColors[i][2] * 0.8, 1))) + self.accept(localAvatar.uniqueName('cogMeritsChange'), self.updateMeritBars) self.updateMeritBars() def destroyMeritBars(self): @@ -110,7 +112,6 @@ class InventoryPage(ShtikerPage.ShtikerPage): self.accept('exitBookDelete', self.exitDeleteMode) self.accept('enterTrackFrame', self.updateTrackInfo) self.accept('exitTrackFrame', self.clearTrackInfo) - self.accept(localAvatar.uniqueName('cogMeritsChange'), self.updateMeritBars) self.accept(localAvatar.uniqueName('moneyChange'), self.__moneyChange) def exit(self): @@ -120,7 +121,6 @@ class InventoryPage(ShtikerPage.ShtikerPage): self.ignore('exitBookDelete') self.ignore('enterTrackFrame') self.ignore('exitTrackFrame') - self.ignore(localAvatar.uniqueName('cogMeritsChange')) self.ignore(localAvatar.uniqueName('moneyChange')) self.makePageWhite(None) base.localAvatar.inventory.hide() diff --git a/toontown/shtiker/ShardPage.py b/toontown/shtiker/ShardPage.py index 5565c2f7..305c5f74 100755 --- a/toontown/shtiker/ShardPage.py +++ b/toontown/shtiker/ShardPage.py @@ -41,19 +41,14 @@ def setupInvasionMarker(node, invasionStatus): return icons = loader.loadModel('phase_3/models/gui/cog_icons') - - if invasionStatus == 1: - icon = icons.find('**/CorpIcon').copyTo(markerNode) - elif invasionStatus == 2: - icon = icons.find('**/LegalIcon').copyTo(markerNode) - elif invasionStatus == 3: - icon = icons.find('**/MoneyIcon').copyTo(markerNode) - else: - icon = icons.find('**/SalesIcon').copyTo(markerNode) + iconStatus = invasionStatus - 1 + + if iconStatus in SuitDNA.suitDeptModelPaths: + icon = icons.find(SuitDNA.suitDeptModelPaths[iconStatus]).copyTo(markerNode) icons.removeNode() - icon.setColor(ICON_COLORS[invasionStatus - 1]) + icon.setColor(ICON_COLORS[iconStatus]) icon.setPos(0.50, 0, 0.0125) icon.setScale(0.0535) diff --git a/toontown/suit/DistributedCashbotBoss.py b/toontown/suit/DistributedCashbotBoss.py index bce110c5..9c7b09fc 100755 --- a/toontown/suit/DistributedCashbotBoss.py +++ b/toontown/suit/DistributedCashbotBoss.py @@ -892,6 +892,11 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): else: trackName = TTLocalizer.BattleGlobalTracks[value] instructions = TTLocalizer.ResistanceToonRestockInstructions % trackName + elif menuIndex == ResistanceChat.RESISTANCE_MERITS: + if value == -1: + instructions = TTLocalizer.ResistanceToonMeritsAllInstructions + else: + instructions = TTLocalizer.ResistanceToonMeritsInstructions % TTLocalizer.RewardPanelMeritBarLabels[value] speech = TTLocalizer.ResistanceToonCongratulations % (text, instructions) speech = self.__talkAboutPromotion(speech) self.resistanceToon.setLocalPageChat(speech, 0) diff --git a/toontown/suit/Suit.py b/toontown/suit/Suit.py index 5d83ddbf..9e1b612d 100755 --- a/toontown/suit/Suit.py +++ b/toontown/suit/Suit.py @@ -206,21 +206,6 @@ def loadSuitModelsAndAnims(level, flag = 0): filepath = 'phase_' + str(phase) + model + 'heads' Preloaded[filepath] = loader.loadModel(filepath) -def cogExists(filePrefix): - searchPath = DSearchPath() - if AppRunnerGlobal.appRunner: - searchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5')) - else: - basePath = os.path.expandvars('$TTMODELS') or './ttmodels' - searchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/built/phase_3.5')) - filePrefix = filePrefix.strip('/') - pfile = Filename(filePrefix) - found = vfs.resolveFilename(pfile, searchPath) - if not found: - return False - return True - - def loadSuitAnims(suit, flag = 1): if suit in SuitDNA.suitHeadTypes: try: @@ -594,14 +579,8 @@ class Suit(Avatar.Avatar): icons = loader.loadModel('phase_3/models/gui/cog_icons') dept = self.style.dept chestNull = self.find('**/joint_attachMeter') - if dept == 'c': - self.corpMedallion = icons.find('**/CorpIcon').copyTo(chestNull) - elif dept == 's': - self.corpMedallion = icons.find('**/SalesIcon').copyTo(chestNull) - elif dept == 'l': - self.corpMedallion = icons.find('**/LegalIcon').copyTo(chestNull) - elif dept == 'm': - self.corpMedallion = icons.find('**/MoneyIcon').copyTo(chestNull) + if dept in SuitDNA.suitDeptModelPaths: + self.corpMedallion = icons.find(SuitDNA.suitDeptModelPaths[dept]).copyTo(chestNull) self.corpMedallion.setPosHprScale(0.02, 0.05, 0.04, 180.0, 0.0, 0.0, 0.51, 0.51, 0.51) self.corpMedallion.setColor(self.medallionColors[dept]) icons.removeNode() diff --git a/toontown/suit/SuitDNA.py b/toontown/suit/SuitDNA.py index f74c1356..e71cd328 100755 --- a/toontown/suit/SuitDNA.py +++ b/toontown/suit/SuitDNA.py @@ -87,6 +87,14 @@ suitDeptFullnamesP = {'c': TTLocalizer.BossbotP, 'l': TTLocalizer.LawbotP, 'm': TTLocalizer.CashbotP, 's': TTLocalizer.SellbotP} +suitDeptModelPaths = {'c': '**/CorpIcon', + 0: '**/CorpIcon', + 'l': '**/LegalIcon', + 1: '**/LegalIcon', + 'm': '**/MoneyIcon', + 2: '**/MoneyIcon', + 's': '**/SalesIcon', + 3: '**/SalesIcon'} corpPolyColor = VBase4(0.95, 0.75, 0.75, 1.0) legalPolyColor = VBase4(0.75, 0.75, 0.95, 1.0) moneyPolyColor = VBase4(0.65, 0.95, 0.85, 1.0) diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 31987787..5abafd9e 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -650,7 +650,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def setHoodsVisited(self, hoods): self.hoodsVisited = hoods - if ToontownGlobals.SellbotHQ in hoods or ToontownGlobals.CashbotHQ in hoods or ToontownGlobals.LawbotHQ in hoods: + if ToontownGlobals.SellbotHQ in hoods or ToontownGlobals.CashbotHQ in hoods or ToontownGlobals.LawbotHQ in hoods or ToontownGlobals.BossbotHQ in hoods: self.setDisguisePageFlag(1) def wrtReparentTo(self, parent): diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index f32fb34d..53b8211a 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -2523,6 +2523,25 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo else: self.addMoney(msgValue) self.notify.debug('Money for ' + self.name) + elif msgType == ResistanceChat.RESISTANCE_MERITS: + if msgValue == -1: + for i in xrange(len(SuitDNA.suitDepts)): + self.doResistanceMerits(i) + else: + self.doResistanceMerits(msgValue) + + def doResistanceMerits(self, dept): + if not CogDisguiseGlobals.isSuitComplete(self.cogParts, dept): + return + + totalMerits = CogDisguiseGlobals.getTotalMerits(self, dept) + merits = self.cogMerits[dept] + + if totalMerits == 0 or merits >= totalMerits: + return + + self.cogMerits[dept] = min(totalMerits, merits + (totalMerits / 6)) + self.b_setCogMerits(self.cogMerits) def squish(self, damage): self.takeDamage(damage) diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 42b4f799..bdf985f7 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -4742,6 +4742,8 @@ ResistanceToonMoneyInstructions = 'all the Toons near you will gain %s Jellybean ResistanceToonMoneyAllInstructions = 'all the Toons near you will fill their Jellybean jars' ResistanceToonRestockInstructions = 'all the Toons near you will restock their "%s" gags' ResistanceToonRestockAllInstructions = 'all the Toons near you will restock all their gags' +ResistanceToonMeritsInstructions = 'all the Toons near you will fill part of their %s' +ResistanceToonMeritsAllInstructions = 'all the Toons near you will fill part of all their promotion papers' ResistanceToonLastPromotion = "\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!" ResistanceToonHPBoost = "\x07You've done a lot of work for the Resistance.\x07The Toon Council has decided to give you another Laff point. Congratulations!" ResistanceToonMaxed = '\x07I see that you have a level %s Cog suit. Very impressive!\x07On behalf of the Toon Council, thank you for coming back to rescue more Toons!' @@ -7235,6 +7237,9 @@ ResistanceRestockMenu = 'Gag-up' ResistanceRestockItem = 'Gag-up %s' ResistanceRestockItemAll = 'All' ResistanceRestockChat = 'Toons of the World, Gag-up!' +ResistanceMeritsMenu = 'Merits' +ResistanceMeritsItem = 'Merit-up %s' +ResistanceMeritsChat = 'Toons of the World, Merit-up!' ResistanceMoneyMenu = 'Jellybeans' ResistanceMoneyItem = '%s Jellybeans' ResistanceMoneyChat = 'Toons of the World, Spend Wisely!' @@ -8064,8 +8069,8 @@ BossbotBossName = 'C.E.O.' BossbotRTWelcome = 'You toons will need different disguises.' BossbotRTRemoveSuit = 'First take off your cog suits...' BossbotRTFightWaiter = 'and then fight these waiters.' -BossbotRTWearWaiter = "Good Job! Now put on the waiters' clothes." -BossbotBossPreTwo1 = "What's taking so long? " +BossbotRTWearWaiter = "Good job! Now put on the waiters' clothes." +BossbotBossPreTwo1 = "What's taking so long?" BossbotBossPreTwo2 = 'Get cracking and serve my banquet!' BossbotRTServeFood1 = 'Hehe, serve the food I place on these conveyor belts.' BossbotRTServeFood2 = 'If you serve a cog three times in a row it will explode.' @@ -8075,7 +8080,7 @@ BossbotPhase3Speech2 = 'These waiters are toons!' BossbotPhase3Speech3 = 'Get them!!!' BossbotPhase4Speech1 = 'Hrrmmpph. When I need a job done right...' BossbotPhase4Speech2 = "I'll do it myself." -BossbotRTPhase4Speech1 = 'Good Job! Now squirt the C.E.O. with the water on the tables...' +BossbotRTPhase4Speech1 = 'Good job! Now squirt the C.E.O. with the water on the tables...' BossbotRTPhase4Speech2 = 'or use golf balls to slow him down.' BossbotPitcherLeave = 'Leave Bottle' BossbotPitcherLeaving = 'Leaving Bottle'