diff --git a/toontown/ai/NewsManager.py b/toontown/ai/NewsManager.py index 34aacfa8..5f5af92c 100755 --- a/toontown/ai/NewsManager.py +++ b/toontown/ai/NewsManager.py @@ -120,7 +120,7 @@ class NewsManager(DistributedObject.DistributedObject): elif msgType == ToontownGlobals.V2InvasionBegin: messages.append(TTLocalizer.V2InvasionBegin1) messages.append(TTLocalizer.V2InvasionBegin2) - messages.append(TTLocalizer.V2InvasionBegin3) + messages.append(TTLocalizer.V2InvasionBegin3 % suitNamePlural) self.invading = 1 elif msgType == ToontownGlobals.V2InvasionEnd: messages.append(TTLocalizer.V2InvasionEnd1) @@ -129,7 +129,7 @@ class NewsManager(DistributedObject.DistributedObject): elif msgType == ToontownGlobals.V2InvasionBulletin: messages.append(TTLocalizer.V2InvasionBulletin1) messages.append(TTLocalizer.V2InvasionBulletin2) - messages.append(TTLocalizer.V2InvasionBulletin3) + messages.append(TTLocalizer.V2InvasionBulletin3 % suitNamePlural) self.invading = 1 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) diff --git a/toontown/cogdominium/CogdoUtil.py b/toontown/cogdominium/CogdoUtil.py index 1d208432..2d7d6683 100755 --- a/toontown/cogdominium/CogdoUtil.py +++ b/toontown/cogdominium/CogdoUtil.py @@ -1,4 +1,7 @@ from pandac.PandaModules import ColorBlendAttrib +from toontown.suit import SuitDNA +import random + ModelPhase = 5 ModelTypes = {'animation': 'a', 'model': 'm', @@ -9,6 +12,26 @@ Games = {'flying': 'cfg', 'maze': 'cmg', 'shared': 'csa'} +def getAllowedTracks(): + tracks = [] + + if config.GetBool('want-sellbot-cogdo', True): + tracks.append('s') + if config.GetBool('want-lawbot-cogdo', True): + tracks.append('l') + + return tracks + +def getCogdoTrack(suitName): + tracks = getAllowedTracks() + + if not tracks: + return None + + track = SuitDNA.getSuitDept(suitName) + + return track if track in tracks else random.choice(tracks) + def loadFlyingModel(baseName, type = 'model', group = 'area'): return loadModel(baseName, 'flying', type=type, group=group) @@ -144,4 +167,4 @@ def rotateTable(table, angle): t.append(row) - return t + return t \ No newline at end of file diff --git a/toontown/shtiker/SummonCogDialog.py b/toontown/shtiker/SummonCogDialog.py index a944b6e1..306efd6f 100755 --- a/toontown/shtiker/SummonCogDialog.py +++ b/toontown/shtiker/SummonCogDialog.py @@ -9,14 +9,13 @@ from toontown.suit import SuitDNA from toontown.suit import Suit from toontown.battle import SuitBattleGlobals from toontown.toon import NPCToons -TTL = TTLocalizer class SummonCogDialog(DirectFrame, StateData.StateData): notify = DirectNotifyGlobal.directNotify.newCategory('SummonCogDialog') 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.7), image_pos=(0, 0, 0.18), image_color=ToontownGlobals.GlobalDialogColor, text=TTL.SummonDlgTitle, text_scale=0.12, text_pos=(0, 0.4), 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, 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) StateData.StateData.__init__(self, 'summon-cog-done') self.initialiseoptions(SummonCogDialog) self.suitIndex = suitIndex @@ -42,16 +41,17 @@ 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.2) - self.suitLabel = DirectLabel(parent=self, relief=None, text=self.suitFullName, text_font=ToontownGlobals.getSuitFont(), pos=(-0.4, 0, 0), scale=0.07) + 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) 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.summonSingleButton = DirectButton(parent=self, relief=None, text=TTL.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.25), command=self.issueSummons, extraArgs=['single']) - self.summonBuildingButton = DirectButton(parent=self, relief=None, text=TTL.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.125), command=self.issueSummons, extraArgs=['building']) - self.summonInvasionButton = DirectButton(parent=self, relief=None, text=TTL.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.0), command=self.issueSummons, extraArgs=['invasion']) - self.statusLabel = DirectLabel(parent=self, relief=None, text='', text_wordwrap=12, pos=(0.3, 0, 0.25), scale=0.07) - self.cancel = DirectButton(parent=self, relief=None, image=closeButtonImage, pos=(0.7, 0, -0.1), command=self.__cancel) + 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']) + 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) gui.removeNode() guiButton.removeNode() self.hide() @@ -90,14 +90,7 @@ class SummonCogDialog(DirectFrame, StateData.StateData): def cogSummonsDone(self, returnCode, suitIndex, buildingId): self.cancel['state'] = DGG.NORMAL - if self.summonsType == 'single': - if returnCode == 'success': - self.statusLabel['text'] = TTL.SummonDlgSingleSuccess - elif returnCode == 'badlocation': - self.statusLabel['text'] = TTL.SummonDlgSingleBadLoc - elif returnCode == 'fail': - self.statusLabel['text'] = TTL.SummonDlgInvasionFail - elif self.summonsType == 'building': + if self.summonsType == 'building' or self.summonsType == 'cogdo': if returnCode == 'success': building = base.cr.doId2do.get(buildingId) dnaStore = base.cr.playGame.dnaStore @@ -108,33 +101,36 @@ class SummonCogDialog(DirectFrame, StateData.StateData): if npcId: npcName = NPCToons.getNPCName(npcId[0]) if buildingTitle: - self.statusLabel['text'] = TTL.SummonDlgBldgSuccess % (npcName, buildingTitle) + self.statusLabel['text'] = TTLocalizer.SummonDlgBldgSuccess % (npcName, buildingTitle) else: - self.statusLabel['text'] = TTL.SummonDlgBldgSuccess2 + self.statusLabel['text'] = TTLocalizer.SummonDlgBldgSuccess2 elif returnCode == 'badlocation': - self.statusLabel['text'] = TTL.SummonDlgBldgBadLoc + self.statusLabel['text'] = TTLocalizer.SummonDlgBldgBadLoc elif returnCode == 'fail': - self.statusLabel['text'] = TTL.SummonDlgInvasionFail - elif self.summonsType == 'invasion': + self.statusLabel['text'] = TTLocalizer.SummonDlgInvasionFail + elif returnCode == 'disabled': + self.statusLabel['text'] = TTLocalizer.SummonDlgBldgNoCogdos + elif self.summonsType.endswith('invasion'): if returnCode == 'success': - self.statusLabel['text'] = TTL.SummonDlgInvasionSuccess + self.statusLabel['text'] = TTLocalizer.SummonDlgInvasionSuccess elif returnCode == 'busy': - self.statusLabel['text'] = TTL.SummonDlgInvasionBusy % self.suitFullName + self.statusLabel['text'] = TTLocalizer.SummonDlgInvasionBusy % self.suitFullName elif returnCode == 'fail': - self.statusLabel['text'] = TTL.SummonDlgInvasionFail + self.statusLabel['text'] = TTLocalizer.SummonDlgInvasionFail def hideSummonButtons(self): - self.summonSingleButton.hide() self.summonBuildingButton.hide() self.summonInvasionButton.hide() + self.summonCogdoButton.hide() + self.summonV2InvasionButton.hide() def issueSummons(self, summonsType): - if summonsType == 'single': - text = TTL.SummonDlgSingleConf - elif summonsType == 'building': - text = TTL.SummonDlgBuildingConf + if summonsType == 'building' or summonsType == 'cogdo': + text = TTLocalizer.SummonDlgBuildingConf elif summonsType == 'invasion': - text = TTL.SummonDlgInvasionConf + text = TTLocalizer.SummonDlgInvasionConf + elif summonsType == 'v2invasion': + text = TTLocalizer.SummonDlgV2InvasionConf text = text % self.suitFullName def handleResponse(resp): @@ -157,20 +153,23 @@ class SummonCogDialog(DirectFrame, StateData.StateData): def doIssueSummonsText(self): self.disableButtons() - self.statusLabel['text'] = TTL.SummonDlgDelivering + self.statusLabel['text'] = TTLocalizer.SummonDlgDelivering def disableButtons(self): - self.summonSingleButton['state'] = DGG.DISABLED self.summonBuildingButton['state'] = DGG.DISABLED self.summonInvasionButton['state'] = DGG.DISABLED + self.summonCogdoButton['state'] = DGG.DISABLED + self.summonV2InvasionButton['state'] = DGG.DISABLED def enableButtons(self): - if base.localAvatar.hasCogSummons(self.suitIndex, 'single'): - self.summonSingleButton['state'] = DGG.NORMAL if base.localAvatar.hasCogSummons(self.suitIndex, 'building'): self.summonBuildingButton['state'] = DGG.NORMAL if base.localAvatar.hasCogSummons(self.suitIndex, 'invasion'): self.summonInvasionButton['state'] = DGG.NORMAL + if base.localAvatar.hasCogSummons(self.suitIndex, 'cogdo'): + self.summonCogdoButton['state'] = DGG.NORMAL + if base.localAvatar.hasCogSummons(self.suitIndex, 'v2invasion'): + self.summonV2InvasionButton['state'] = DGG.NORMAL def __cancel(self): self.exit() diff --git a/toontown/suit/DistributedLawbotBossAI.py b/toontown/suit/DistributedLawbotBossAI.py index 16bf5cb8..106b02ee 100755 --- a/toontown/suit/DistributedLawbotBossAI.py +++ b/toontown/suit/DistributedLawbotBossAI.py @@ -645,8 +645,8 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM self.b_setState('Reward') 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(typeWeights) + #typeWeights = ['single'] * 70 + ['building'] * 27 + ['invasion'] * 3 + preferredSummonType = random.choice(['building', 'invasion', 'cogdo', 'v2invasion']) for toonId in self.involvedToons: toon = self.air.doId2do.get(toonId) if toon: @@ -659,12 +659,14 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM summonType = prefSummonType hasSummon = toon.hasParticularCogSummons(prefDeptIndex, cogLevel, prefSummonType) self.notify.debug('trying to find another reward') - if not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'single'): - summonType = 'single' - elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'building'): + if not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'building'): summonType = 'building' elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'invasion'): summonType = 'invasion' + elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'cogdo'): + summonType = 'cogdo' + elif not toon.hasParticularCogSummons(prefDeptIndex, cogLevel, 'v2invasion'): + summonType = 'v2invasion' else: foundOne = False for curDeptIndex in xrange(len(SuitDNA.suitDepts)): @@ -672,11 +674,6 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM deptIndex = curDeptIndex foundOne = True break - elif not toon.hasParticularCogSummons(curDeptIndex, cogLevel, 'single'): - deptIndex = curDeptIndex - summonType = 'single' - foundOne = True - break elif not toon.hasParticularCogSummons(curDeptIndex, cogLevel, 'building'): deptIndex = curDeptIndex summonType = 'building' @@ -687,15 +684,25 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM deptIndex = curDeptIndex foundOne = True break + elif not toon.hasParticularCogSummons(curDeptIndex, cogLevel, 'cogdo'): + summonType = 'cogdo' + deptIndex = curDeptIndex + foundOne = True + break + elif not toon.hasParticularCogSummons(curDeptIndex, cogLevel, 'v2invasion'): + summonType = 'v2invasion' + deptIndex = curDeptIndex + foundOne = True + break possibleCogLevel = range(SuitDNA.suitsPerDept) possibleDeptIndex = range(len(SuitDNA.suitDepts)) - possibleSummonType = ['single', 'building', 'invasion'] - typeWeights = ['single'] * 70 + ['building'] * 27 + ['invasion'] * 3 + possibleSummonType = ['building', 'invasion', 'cogdo', 'v2invasion'] + #typeWeights = ['single'] * 70 + ['building'] * 27 + ['invasion'] * 3 if not foundOne: for i in xrange(5): randomCogLevel = random.choice(possibleCogLevel) - randomSummonType = random.choice(typeWeights) + randomSummonType = random.choice(possibleSummonType) randomDeptIndex = random.choice(possibleDeptIndex) if not toon.hasParticularCogSummons(randomDeptIndex, randomCogLevel, randomSummonType): foundOne = True diff --git a/toontown/suit/SuitInvasionManagerAI.py b/toontown/suit/SuitInvasionManagerAI.py index 36d80b6a..e0bde083 100755 --- a/toontown/suit/SuitInvasionManagerAI.py +++ b/toontown/suit/SuitInvasionManagerAI.py @@ -37,7 +37,7 @@ class SuitInvasionManagerAI: def startInvasion(self, suitDeptIndex=None, suitTypeIndex=None, flags=0, type=INVASION_TYPE_NORMAL): - if self.invading: + if self.invading: # An invasion is currently in progress; ignore this request. return False @@ -45,10 +45,6 @@ class SuitInvasionManagerAI: # This invasion is no-op. return False - if flags and ((suitDeptIndex is not None) or (suitTypeIndex is not None)): - # For invasion flags to be present, it must be a generic invasion. - return False - if (suitDeptIndex is None) and (suitTypeIndex is not None): # It's impossible to determine the invading Cog. return False diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 6e00e8c0..5d89425a 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -1793,12 +1793,6 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.effect.play() def d_reqCogSummons(self, type, suitIndex): - if type == 'single': - pass - elif type == 'building': - pass - elif type == 'invasion': - pass self.sendUpdate('reqCogSummons', [type, suitIndex]) def cogSummonsResponse(self, returnCode, suitIndex, doId): @@ -1813,12 +1807,14 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def hasCogSummons(self, suitIndex, type = None): summons = self.getCogSummonsEarned() curSetting = summons[suitIndex] - if type == 'single': + if type == 'building': return curSetting & 1 - elif type == 'building': - return curSetting & 2 elif type == 'invasion': + return curSetting & 2 + elif type == 'cogdo': return curSetting & 4 + elif type == 'v2invasion': + return curSetting & 8 return curSetting def setFlowerCollection(self, speciesList, varietyList): diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 4bbe048b..f78ec3b3 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -11,6 +11,7 @@ from otp.avatar import DistributedAvatarAI, DistributedPlayerAI from otp.otpbase import OTPGlobals, OTPLocalizer from toontown.battle import SuitBattleGlobals from toontown.catalog import CatalogAccessoryItem, CatalogItem, CatalogItemList +from toontown.cogdominium import CogdoUtil from toontown.chat import ResistanceChat from toontown.coghq import CogDisguiseGlobals from toontown.estate import FlowerBasket, FlowerCollection, GardenGlobals @@ -25,7 +26,7 @@ from toontown.parties.PartyReplyInfo import PartyReplyInfoBase from toontown.quest import QuestRewardCounter, Quests from toontown.racing import RaceGlobals from toontown.shtiker import CogPageGlobals -from toontown.suit import SuitDNA +from toontown.suit import SuitDNA, SuitInvasionGlobals from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer, ToontownBattleGlobals, ToontownGlobals from toontown.toonbase.ToontownGlobals import * @@ -3057,7 +3058,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.kart.start() def reqCogSummons(self, type, suitIndex): - if type not in ('single', 'building', 'invasion'): + if type not in ('building', 'invasion', 'cogdo', 'v2invasion'): self.air.writeServerEvent('suspicious', self.doId, 'invalid cog summons type: %s' % type) self.sendUpdate('cogSummonsResponse', ['fail', suitIndex, 0]) return @@ -3070,14 +3071,15 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.sendUpdate('cogSummonsResponse', ['fail', suitIndex, 0]) return returnCode = None - if type == 'single': - returnCode = self.doSummonSingleCog(suitIndex) - elif type == 'building': + if type == 'building': returnCode = self.doBuildingTakeover(suitIndex) - elif type == 'invasion': + elif type == 'cogdo': + returnCode = self.doCogdoTakeOver(suitIndex) + elif type.endswith('invasion'): suitDeptIndex = suitIndex / SuitDNA.suitsPerDept suitTypeIndex = suitIndex % SuitDNA.suitsPerDept - returnCode = self.doCogInvasion(suitDeptIndex, suitTypeIndex) + flags = SuitInvasionGlobals.IFV2 if type.startswith('v2') else 0 + returnCode = self.doCogInvasion(suitDeptIndex, suitTypeIndex, flags) if returnCode: if returnCode[0] == 'success': self.air.writeServerEvent('cogSummoned', self.doId, '%s|%s|%s' % (type, suitIndex, self.zoneId)) @@ -3129,19 +3131,28 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo building.block, self.zoneId)) return ['success', suitIndex, building.doId] - - def doCogdoTakeOver(self, difficulty, buildingHeight): + + def doCogdoTakeOver(self, suitIndex): + if suitIndex >= len(SuitDNA.suitHeadTypes): + self.notify.warning('Bad suit index: %s' % suitIndex) + return ['badIndex', suitIndex, 0] + suitName = SuitDNA.suitHeadTypes[suitIndex] + track = CogdoUtil.getCogdoTrack(suitName) + if not track: + return ['disabled', 0, 0] streetId = ZoneUtil.getBranchZone(self.zoneId) if streetId not in self.air.suitPlanners: self.notify.warning('Street %d is not known.' % streetId) - return ['badlocation', difficulty, 0] + return ['badlocation', 0, 0] building = self.findClosestDoor() - if building is None: - return ['badlocation', difficulty, 0] - building.cogdoTakeOver(difficulty, buildingHeight) - return ['success', difficulty, building.doId] + if building == None: + return ['badlocation', 0, 0] + sp = self.air.suitPlanners[streetId] + level, type, track = sp.pickLevelTypeAndTrack(None, SuitDNA.getSuitType(suitName), track) + building.cogdoTakeOver(level, 2, track) + return ['success', level, building.doId] - def doCogInvasion(self, suitDeptIndex, suitTypeIndex): + def doCogInvasion(self, suitDeptIndex, suitTypeIndex, flags=0): if self.air.suitInvasionManager.getInvading(): return ['busy', 0, 0] @@ -3149,7 +3160,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo suitIndex = SuitDNA.suitHeadTypes.index(suitName) if self.air.suitInvasionManager.startInvasion( - suitDeptIndex=suitDeptIndex, suitTypeIndex=suitTypeIndex): + suitDeptIndex=suitDeptIndex, suitTypeIndex=suitTypeIndex, flags=flags): return ['success', suitIndex, 0] return ['fail', suitIndex, 0] @@ -3169,19 +3180,21 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def restockAllCogSummons(self): numSuits = len(SuitDNA.suitHeadTypes) - fullSetForSuit = 1 | 2 | 4 + fullSetForSuit = 1 | 2 | 4 | 8 allSummons = numSuits * [fullSetForSuit] self.b_setCogSummonsEarned(allSummons) def addCogSummonsEarned(self, suitIndex, type): summons = self.getCogSummonsEarned() curSetting = summons[suitIndex] - if type == 'single': + if type == 'building': curSetting |= 1 - elif type == 'building': - curSetting |= 2 elif type == 'invasion': + curSetting |= 2 + elif type == 'cogdo': curSetting |= 4 + elif type == 'v2invasion': + curSetting |= 8 summons[suitIndex] = curSetting self.b_setCogSummonsEarned(summons) @@ -3189,12 +3202,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo summons = self.getCogSummonsEarned() curSetting = summons[suitIndex] if self.hasCogSummons(suitIndex, type): - if type == 'single': + if type == 'building': curSetting &= -2 - elif type == 'building': - curSetting &= -3 elif type == 'invasion': + curSetting &= -3 + elif type == 'cogdo': curSetting &= -5 + elif type == 'v2invasion': + curSetting &= -9 summons[suitIndex] = curSetting self.b_setCogSummonsEarned(summons) if hasattr(self, 'autoRestockSummons') and self.autoRestockSummons: @@ -3206,12 +3221,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def hasCogSummons(self, suitIndex, type = None): summons = self.getCogSummonsEarned() curSetting = summons[suitIndex] - if type == 'single': + if type == 'building': return curSetting & 1 - elif type == 'building': - return curSetting & 2 elif type == 'invasion': + return curSetting & 2 + elif type == 'cogdo': return curSetting & 4 + elif type == 'v2invasion': + return curSetting & 8 return curSetting def hasParticularCogSummons(self, deptIndex, level, type): @@ -3239,11 +3256,12 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo else: numSuits = len(SuitDNA.suitHeadTypes) suitIndex = random.randrange(0, numSuits) - if summonType in ['single', 'building', 'invasion']: + summonTypes = ['building', 'invasion', 'cogdo', 'v2invasion'] + if summonType in summonTypes: type = summonType else: - typeWeights = ['single'] * 70 + ['building'] * 25 + ['invasion'] * 5 - type = random.choice(typeWeights) + #typeWeights = ['single'] * 70 + ['building'] * 25 + ['invasion'] * 5 + type = random.choice(summonTypes) if suitIndex >= len(SuitDNA.suitHeadTypes): self.notify.warning('Bad suit index: %s' % suitIndex) self.addCogSummonsEarned(suitIndex, type) @@ -4139,7 +4157,7 @@ def allSummons(): invoker = spellbook.getInvoker() numSuits = len(SuitDNA.suitHeadTypes) - fullSetForSuit = 1 | 2 | 4 + fullSetForSuit = 1 | 2 | 4 | 8 allSummons = numSuits * [fullSetForSuit] invoker.b_setCogSummonsEarned(allSummons) return 'Lots of summons!' @@ -4948,9 +4966,8 @@ def immortal(): @magicWord(category=CATEGORY_PROGRAMMER, types=[str, int]) def summoncogdo(track="s", difficulty=5): - tracks = ['s'] - if config.GetBool('want-lawbot-cogdo', True): - tracks.append('l') + tracks = CogdoUtil.getAllowedTracks() + if track not in tracks: return "Invalid track!" diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index d6c87533..7f0af9b2 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -4635,12 +4635,12 @@ WaiterInvasionBulletin2 = lToonHQ + ': The C.E.O. has fired all of his waiters!! WaiterInvasionBulletin3 = lToonHQ + ": The unemployed waiters are invading Toontown!!!" V2InvasionBegin1 = lToonHQ + ": Yikes!!! This isn't good, Toons!" V2InvasionBegin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!' -V2InvasionBegin3 = lToonHQ + ': Version 2.0 Cogs have taken over Toontown!!!' +V2InvasionBegin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!' V2InvasionEnd1 = lToonHQ + ': The version 2.0 Cog invasion has ended!!!' V2InvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' V2InvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' V2InvasionBulletin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!' -V2InvasionBulletin3 = lToonHQ + ': Version 2.0 Cogs have taken over Toontown!!!' +V2InvasionBulletin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!' LeaderboardTitle = 'Toon Platoon' QuestScript101_0 = 'Come here! Use the arrow keys to move.' QuestScript101_1 = 'These are Cogs. They are robots that are trying to take over Toontown.' @@ -7567,20 +7567,20 @@ WitnessToonJuryWeightBonusPlural = {6: 'This is a tough case. You seated %d Toon 7: 'This is a very tough case. You seated %d Toon jurors, so your evidence has a bonus weight of %d.', 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 Summons' -SummonDlgButton1 = 'Summon a Cog' +SummonDlgTitle = 'Issue a Cog Summon' SummonDlgButton2 = 'Summon a Cog Building' SummonDlgButton3 = 'Summon a Cog Invasion' -SummonDlgSingleConf = 'Would you like to issue a summons to a %s?' +SummonDlgButton4 = 'Summon a Field Office' +SummonDlgButton5 = '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?' +SummonDlgV2InvasionConf = 'Would you like to summon a Version 2.0 %s invasion?' SummonDlgNumLeft = 'You have %s left.' SummonDlgDelivering = 'Delivering Summons...' -SummonDlgSingleSuccess = 'You have successfully summoned the Cog.' -SummonDlgSingleBadLoc = "Sorry, Cogs aren't allowed here. Try somewhere else." SummonDlgBldgSuccess = 'You have successfully summoned the Cogs. %s has agreed to let them temporarily take over %s!' SummonDlgBldgSuccess2 = 'You have successfully summoned the Cogs. A Shopkeeper has agreed to let them temporarily take over their building!' SummonDlgBldgBadLoc = 'Sorry, there are no Toon buildings nearby for the Cogs to take over.' +SummonDlgBldgNoCogdos = "Sorry, but you can't summon a Field Office right now. Please try again later." SummonDlgInvasionSuccess = "You have successfully summoned the Cogs. It's an invasion!" SummonDlgInvasionBusy = 'A %s cannot be found now. Try again when the Cog invasion is over.' SummonDlgInvasionFail = 'Sorry, the Cog invasion has failed.'