From ac60242003a507150ae0bc4995be07ee83dd3085 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 7 Jul 2015 21:16:55 +0300 Subject: [PATCH] Add skelecog and waiter invasions to summon page --- toontown/shtiker/SummonCogDialog.py | 31 ++++++++++++++++------ toontown/suit/DistributedLawbotBossAI.py | 18 +++++++++++-- toontown/toon/DistributedToon.py | 6 ++++- toontown/toon/DistributedToonAI.py | 33 +++++++++++++++++++----- toontown/toonbase/TTLocalizerEnglish.py | 24 ++++++++++------- 5 files changed, 84 insertions(+), 28 deletions(-) diff --git a/toontown/shtiker/SummonCogDialog.py b/toontown/shtiker/SummonCogDialog.py index b2279ee1..65a8aaac 100755 --- a/toontown/shtiker/SummonCogDialog.py +++ b/toontown/shtiker/SummonCogDialog.py @@ -15,7 +15,7 @@ class SummonCogDialog(DirectFrame, StateData.StateData): notify.setInfo(True) def __init__(self, suitIndex): - DirectFrame.__init__(self, parent=aspect2dp, pos=(0, 0, 0.3), relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(1.6, 1, 0.85), image_pos=(0, 0, 0.18), image_color=ToontownGlobals.GlobalDialogColor, text=TTLocalizer.SummonDlgTitle, text_scale=0.12, text_pos=(0, 0.5), borderWidth=(0.01, 0.01), sortOrder=NO_FADE_SORT_INDEX) + DirectFrame.__init__(self, parent=aspect2dp, pos=(0, 0, 0.3), relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(1.6, 1, 1.07), image_pos=(0, 0, 0.09), image_color=ToontownGlobals.GlobalDialogColor, text=TTLocalizer.SummonDlgTitle, text_scale=0.12, text_pos=(0, 0.5), borderWidth=(0.01, 0.01), sortOrder=NO_FADE_SORT_INDEX) StateData.StateData.__init__(self, 'summon-cog-done') self.initialiseoptions(SummonCogDialog) self.suitIndex = suitIndex @@ -41,17 +41,20 @@ class SummonCogDialog(DirectFrame, StateData.StateData): guiButton = loader.loadModel('phase_3/models/gui/quit_button') self.head = Suit.attachSuitHead(self, self.suitName) z = self.head.getZ() - self.head.setPos(-0.4, -0.1, z + 0.25) - self.suitLabel = DirectLabel(parent=self, relief=None, text=self.suitFullName, text_font=ToontownGlobals.getSuitFont(), pos=(-0.4, 0, 0.025), scale=0.07) + self.head.setPos(-0.4, -0.1, z + 0.14) + self.suitLabel = DirectLabel(parent=self, relief=None, text=self.suitFullName, text_font=ToontownGlobals.getSuitFont(), pos=(-0.4, 0, -0.085), scale=0.07) closeButtonImage = (gui.find('**/CloseBtn_UP'), gui.find('**/CloseBtn_DN'), gui.find('**/CloseBtn_Rllvr')) buttonImage = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')) disabledColor = Vec4(0.5, 0.5, 0.5, 1) - self.summonBuildingButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton2, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.06, text_pos=(0, -0.01), pos=(0.3, 0, 0.35), command=self.issueSummons, extraArgs=['building']) - self.summonInvasionButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton3, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.06, text_pos=(0, -0.01), pos=(0.3, 0, 0.225), command=self.issueSummons, extraArgs=['invasion']) - self.summonCogdoButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton4, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.06, text_pos=(0, -0.01), pos=(0.3, 0, 0.1), command=self.issueSummons, extraArgs=['cogdo']) - self.summonV2InvasionButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton5, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.048, text_pos=(0, -0.01), pos=(0.3, 0, -0.025), command=self.issueSummons, extraArgs=['v2invasion']) + base.cr.lmao = self + self.summonBuildingButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton1, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.06, text_pos=(0, -0.01), pos=(0.3, 0, 0.35), command=self.issueSummons, extraArgs=['building']) + self.summonInvasionButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton2, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.06, text_pos=(0, -0.01), pos=(0.3, 0, 0.225), command=self.issueSummons, extraArgs=['invasion']) + self.summonCogdoButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton3, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.06, text_pos=(0, -0.01), pos=(0.3, 0, 0.1), command=self.issueSummons, extraArgs=['cogdo']) + self.summonSkelInvasionButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton4, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.051, text_pos=(0, -0.01), pos=(0.3, 0, -0.025), command=self.issueSummons, extraArgs=['skelinvasion']) + self.summonWaiterInvasionButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton5, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.056, text_pos=(0, -0.01), pos=(0.3, 0, -0.15), command=self.issueSummons, extraArgs=['waiterinvasion']) + self.summonV2InvasionButton = DirectButton(parent=self, relief=None, text=TTLocalizer.SummonDlgButton6, image=buttonImage, image_scale=(1.7, 1, 1), image3_color=disabledColor, text_scale=0.048, text_pos=(0, -0.01), pos=(0.3, 0, -0.275), command=self.issueSummons, extraArgs=['v2invasion']) self.statusLabel = DirectLabel(parent=self, relief=None, text='', text_wordwrap=12, pos=(0.3, 0, 0.3), scale=0.07) - self.cancel = DirectButton(parent=self, relief=None, image=closeButtonImage, pos=(0.7, 0, -0.15), command=self.__cancel) + self.cancel = DirectButton(parent=self, relief=None, image=closeButtonImage, pos=(0.7, 0, -0.366), command=self.__cancel) gui.removeNode() guiButton.removeNode() self.hide() @@ -122,6 +125,8 @@ class SummonCogDialog(DirectFrame, StateData.StateData): self.summonBuildingButton.hide() self.summonInvasionButton.hide() self.summonCogdoButton.hide() + self.summonSkelInvasionButton.hide() + self.summonWaiterInvasionButton.hide() self.summonV2InvasionButton.hide() def issueSummons(self, summonsType): @@ -129,6 +134,10 @@ class SummonCogDialog(DirectFrame, StateData.StateData): text = TTLocalizer.SummonDlgBuildingConf elif summonsType == 'invasion': text = TTLocalizer.SummonDlgInvasionConf + elif summonsType == 'skelinvasion': + text = TTLocalizer.SummonDlgSkelInvasionConf + elif summonsType == 'waiterinvasion': + text = TTLocalizer.SummonDlgWaiterInvasionConf elif summonsType == 'v2invasion': text = TTLocalizer.SummonDlgV2InvasionConf text = text % self.suitFullName @@ -159,6 +168,8 @@ class SummonCogDialog(DirectFrame, StateData.StateData): self.summonBuildingButton['state'] = DGG.DISABLED self.summonInvasionButton['state'] = DGG.DISABLED self.summonCogdoButton['state'] = DGG.DISABLED + self.summonSkelInvasionButton['state'] = DGG.DISABLED + self.summonWaiterInvasionButton['state'] = DGG.DISABLED self.summonV2InvasionButton['state'] = DGG.DISABLED def enableButtons(self): @@ -168,6 +179,10 @@ class SummonCogDialog(DirectFrame, StateData.StateData): self.summonInvasionButton['state'] = DGG.NORMAL if base.localAvatar.hasCogSummons(self.suitIndex, 'cogdo'): self.summonCogdoButton['state'] = DGG.NORMAL + if base.localAvatar.hasCogSummons(self.suitIndex, 'skelinvasion'): + self.summonSkelInvasionButton['state'] = DGG.NORMAL + if base.localAvatar.hasCogSummons(self.suitIndex, 'waiterinvasion'): + self.summonWaiterInvasionButton['state'] = DGG.NORMAL if base.localAvatar.hasCogSummons(self.suitIndex, 'v2invasion'): self.summonV2InvasionButton['state'] = DGG.NORMAL diff --git a/toontown/suit/DistributedLawbotBossAI.py b/toontown/suit/DistributedLawbotBossAI.py index 4b6aeb97..2f1fd77d 100755 --- a/toontown/suit/DistributedLawbotBossAI.py +++ b/toontown/suit/DistributedLawbotBossAI.py @@ -646,7 +646,7 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons) preferredDept = random.randrange(len(SuitDNA.suitDepts)) #typeWeights = ['single'] * 70 + ['building'] * 27 + ['invasion'] * 3 - preferredSummonType = random.choice(['building', 'invasion', 'cogdo', 'v2invasion']) + preferredSummonType = random.choice(['building', 'invasion', 'cogdo', 'skelinvasion', 'waiterinvasion', 'v2invasion']) for toonId in self.involvedToons: toon = self.air.doId2do.get(toonId) if toon: @@ -665,6 +665,10 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM summonType = 'invasion' elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'cogdo'): summonType = 'cogdo' + elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'skelinvasion'): + summonType = 'skelinvasion' + elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'waiterinvasion'): + summonType = 'waiterinvasion' elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'v2invasion'): summonType = 'v2invasion' else: @@ -689,6 +693,16 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM deptIndex = curDeptIndex foundOne = True break + elif not toon.hasParticularCogSummons(curDeptIndex, cogLevel, 'skelinvasion'): + summonType = 'skelinvasion' + deptIndex = curDeptIndex + foundOne = True + break + elif not toon.hasParticularCogSummons(curDeptIndex, cogLevel, 'waiterinvasion'): + summonType = 'waiterinvasion' + deptIndex = curDeptIndex + foundOne = True + break elif not toon.hasParticularCogSummons(curDeptIndex, cogLevel, 'v2invasion'): summonType = 'v2invasion' deptIndex = curDeptIndex @@ -697,7 +711,7 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM possibleCogLevel = range(SuitDNA.suitsPerDept) possibleDeptIndex = range(len(SuitDNA.suitDepts)) - possibleSummonType = ['building', 'invasion', 'cogdo', 'v2invasion'] + possibleSummonType = ['building', 'invasion', 'cogdo', 'skelinvasion', 'waiterinvasion', 'v2invasion'] #typeWeights = ['single'] * 70 + ['building'] * 27 + ['invasion'] * 3 if not foundOne: for i in xrange(5): diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index aaabfd99..159bfcdc 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -1690,8 +1690,12 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute return curSetting & 2 elif type == 'cogdo': return curSetting & 4 - elif type == 'v2invasion': + elif type == 'skelinvasion': return curSetting & 8 + elif type == 'waiterinvasion': + return curSetting & 16 + elif type == 'v2invasion': + return curSetting & 32 return curSetting def setFlowerCollection(self, speciesList, varietyList): diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 8e61d9ee..e4da0b2f 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -3014,7 +3014,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.kart.start() def reqCogSummons(self, type, suitIndex): - if type not in ('building', 'invasion', 'cogdo', 'v2invasion'): + if type not in ('building', 'invasion', 'cogdo', 'skelinvasion', 'waiterinvasion', 'v2invasion'): self.air.writeServerEvent('suspicious', self.doId, 'invalid cog summons type: %s' % type) self.sendUpdate('cogSummonsResponse', ['fail', suitIndex, 0]) return @@ -3034,7 +3034,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo elif type.endswith('invasion'): suitDeptIndex = suitIndex / SuitDNA.suitsPerDept suitTypeIndex = suitIndex % SuitDNA.suitsPerDept - flags = SuitInvasionGlobals.IFV2 if type.startswith('v2') else 0 + if type.startswith('v2'): + flags = SuitInvasionGlobals.IFV2 + elif type.startswith('skel'): + flags = SuitInvasionGlobals.IFSkelecog + elif type.startswith('waiter'): + flags = SuitInvasionGlobals.IFWaiter + else: + flags = 0 returnCode = self.doCogInvasion(suitDeptIndex, suitTypeIndex, flags) if returnCode: if returnCode[0] == 'success': @@ -3149,8 +3156,12 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo curSetting |= 2 elif type == 'cogdo': curSetting |= 4 - elif type == 'v2invasion': + elif type == 'skelinvasion': curSetting |= 8 + elif type == 'waiterinvasion': + curSetting |= 16 + elif type == 'v2invasion': + curSetting |= 32 summons[suitIndex] = curSetting self.b_setCogSummonsEarned(summons) @@ -3164,8 +3175,12 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo curSetting &= -3 elif type == 'cogdo': curSetting &= -5 - elif type == 'v2invasion': + elif type == 'skelinvasion': curSetting &= -9 + elif type == 'waiterinvasion': + curSetting &= -17 + elif type == 'v2invasion': + curSetting &= -33 summons[suitIndex] = curSetting self.b_setCogSummonsEarned(summons) if hasattr(self, 'autoRestockSummons') and self.autoRestockSummons: @@ -3183,8 +3198,12 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return curSetting & 2 elif type == 'cogdo': return curSetting & 4 - elif type == 'v2invasion': + elif type == 'skelinvasion': return curSetting & 8 + elif type == 'waiterinvasion': + return curSetting & 16 + elif type == 'v2invasion': + return curSetting & 32 return curSetting def hasParticularCogSummons(self, deptIndex, level, type): @@ -3212,7 +3231,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo else: numSuits = len(SuitDNA.suitHeadTypes) suitIndex = random.randrange(0, numSuits) - summonTypes = ['building', 'invasion', 'cogdo', 'v2invasion'] + summonTypes = ['building', 'invasion', 'cogdo', 'skelinvasion', 'waiterinvasion', 'v2invasion'] if summonType in summonTypes: type = summonType else: @@ -4089,7 +4108,7 @@ def allSummons(): invoker = spellbook.getInvoker() numSuits = len(SuitDNA.suitHeadTypes) - fullSetForSuit = 1 | 2 | 4 | 8 + fullSetForSuit = 1 | 2 | 4 | 8 | 16 | 32 allSummons = numSuits * [fullSetForSuit] invoker.b_setCogSummonsEarned(allSummons) return 'Lots of summons!' diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index e2355b97..e9003364 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -4604,29 +4604,29 @@ SuitInvasionBulletin = [ SkelecogInvasionBegin = [ "Hmm... We're getting a strange reading over here...", 'The Cog factories are running out of parts to build new Cogs!', - 'Skelecogs have taken over Toontown!!!' + '%(singular)s Skelecogs have taken over Toontown!!!' ] SkelecogInvasionEnd = [ - 'The Skelecog invasion has ended!!!', + 'The %(singular)s Skelecog invasion has ended!!!', 'The Toons have saved the day once again!!!' ] SkelecogInvasionBulletin = [ 'There is a Cog invasion in progress!!!', 'The Cog factories are running out of parts to build new Cogs!', - 'Skelecogs have taken over Toontown!!!' + '%(singular)s Skelecogs have taken over Toontown!!!' ] WaiterInvasionBegin = [ 'It appears that the C.E.O. has fired all his waiters...', - 'The unemployed waiters are invading Toontown!!!' + 'The unemployed %(singular)s waiters are invading Toontown!!!' ] WaiterInvasionEnd = [ - 'The unemployed waiters have been defeated!!!', + 'The unemployed %(singular)s waiters have been defeated!!!', 'The Toons have saved the day once again!!!' ] WaiterInvasionBulletin = [ 'There is a Cog invasion in progress!!!', 'The C.E.O. has fired all of his waiters!!!', - 'The unemployed waiters are invading Toontown!!!' + 'The unemployed %(singular)s waiters are invading Toontown!!!' ] V2InvasionBegin = [ "Yikes!!! This isn't good, Toons!", @@ -7567,12 +7567,16 @@ WitnessToonJuryWeightBonusPlural = {6: 'This is a tough case. You seated %d Toon 8: 'This is the toughest case. You seated %d Toon jurors, so your evidence has a bonus weight of %d.'} IssueSummons = 'Summon' SummonDlgTitle = 'Issue a Cog Summon' -SummonDlgButton2 = 'Summon a Cog Building' -SummonDlgButton3 = 'Summon a Cog Invasion' -SummonDlgButton4 = 'Summon a Field Office' -SummonDlgButton5 = 'Summon a Version 2.0 Invasion' +SummonDlgButton1 = 'Summon a Cog Building' +SummonDlgButton2 = 'Summon a Cog Invasion' +SummonDlgButton3 = 'Summon a Field Office' +SummonDlgButton4 = 'Summon a Skelecog Invasion' +SummonDlgButton5 = 'Summon a Waiter Invasion' +SummonDlgButton6 = 'Summon a Version 2.0 Invasion' SummonDlgBuildingConf = 'Would you like to summon a %s to a nearby Toon building?' SummonDlgInvasionConf = 'Would you like to summon a %s invasion?' +SummonDlgSkelInvasionConf = 'Would you like to summon a %s (Skelecog) invasion?' +SummonDlgWaiterInvasionConf = 'Would you like to summon a %s (Waiter) invasion?' SummonDlgV2InvasionConf = 'Would you like to summon a Version 2.0 %s invasion?' SummonDlgNumLeft = 'You have %s left.' SummonDlgDelivering = 'Delivering Summons...'