def setInvasionStatus(self, msgType, suitType, remaining, flags): if msgType not in ToontownGlobals.SuitInvasions: return if suitType in SuitDNA.suitHeadTypes: attributes = SuitBattleGlobals.SuitAttributes[suitType] suitNames = { 'singular': attributes['name'], 'plural': attributes['pluralname'] } elif suitType in SuitDNA.suitDepts: suitNames = { 'singular': SuitDNA.getDeptFullname(suitType), 'plural': SuitDNA.getDeptFullnameP(suitType) } else: return track = Sequence() base.localAvatar.inventory.setInvasionCreditMultiplier( 1 if msgType in ToontownGlobals. EndingInvasions else ToontownBattleGlobals.getInvasionMultiplier()) for i, message in enumerate(ToontownGlobals.SuitInvasions[msgType]): track.append(Wait(5 if i else 1)) track.append( Func(base.localAvatar.setSystemMessage, 0, (TTLocalizer.SuitInvasionPrefix + message) % suitNames)) track.start()
def enterBattle(self, event): mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) self.townBattle.enter( event, self.fsm.getStateNamed('battle'), bldg=1, creditMultiplier=mult) base.localAvatar.b_setAnimState('off', 1) base.localAvatar.cantLeaveGame = 1
def setInvasionStatus(self, msgType, cogType, numRemaining, specialSuit): self.notify.info( 'setInvasionStatus: msgType: %s cogType: %s, numRemaining: %s, specialSuit: %s' % (msgType, cogType, numRemaining, specialSuit)) if specialSuit == 1: cogName = TTLocalizer.Skeleton cogNameP = TTLocalizer.SkeletonP else: if specialSuit == 2: cogName = TTLocalizer.SkeleReviveCogName % { 'cog_name': SuitBattleGlobals.SuitAttributes[cogType]['name'] } cogNameP = TTLocalizer.SkeleReviveCogName % { 'cog_name': SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] } else: cogName = SuitBattleGlobals.SuitAttributes[cogType]['name'] cogNameP = SuitBattleGlobals.SuitAttributes[cogType][ 'pluralname'] if msgType == ToontownGlobals.SuitInvasionBegin: msg1 = TTLocalizer.SuitInvasionBegin1 msg2 = TTLocalizer.SuitInvasionBegin2 % cogNameP self.invading = 1 self.invadingSuit = cogType else: if msgType == ToontownGlobals.SuitInvasionUpdate: msg1 = TTLocalizer.SuitInvasionUpdate1 % numRemaining msg2 = TTLocalizer.SuitInvasionUpdate2 % cogNameP self.invading = 1 self.invadingSuit = cogType else: if msgType == ToontownGlobals.SuitInvasionEnd: msg1 = TTLocalizer.SuitInvasionEnd1 % cogName msg2 = TTLocalizer.SuitInvasionEnd2 self.invading = 0 self.invadingSuit = None else: if msgType == ToontownGlobals.SuitInvasionBulletin: msg1 = TTLocalizer.SuitInvasionBulletin1 msg2 = TTLocalizer.SuitInvasionBulletin2 % cogNameP self.invading = 1 self.invadingSuit = cogType else: self.notify.warning( 'setInvasionStatus: invalid msgType: %s' % msgType) return if self.invading: mult = ToontownBattleGlobals.getInvasionMultiplier() else: mult = 1 base.localAvatar.inventory.setInvasionCreditMultiplier(mult) Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), name='newsManagerWait', autoPause=1).start() return
def makeBattle(self, bossCogPosHpr, battlePosHpr, roundCallback, finishCallback, battleNumber, battleSide): if battleNumber == 1: battle = DistributedBattleWaitersAI.DistributedBattleWaitersAI( self.air, self, roundCallback, finishCallback, battleSide) else: battle = DistributedBattleDinersAI.DistributedBattleDinersAI( self.air, self, roundCallback, finishCallback, battleSide) self.setBattlePos(battle, bossCogPosHpr, battlePosHpr) battle.suitsKilled = self.suitsKilled battle.battleCalc.toonSkillPtsGained = self.toonSkillPtsGained battle.toonExp = self.toonExp battle.toonOrigQuests = self.toonOrigQuests battle.toonItems = self.toonItems battle.toonOrigMerits = self.toonOrigMerits battle.toonMerits = self.toonMerits battle.toonParts = self.toonParts battle.helpfulToons = self.helpfulToons mult = ToontownBattleGlobals.getBossBattleCreditMultiplier( battleNumber) battle.battleCalc.setSkillCreditMultiplier(mult) activeSuits = self.activeSuitsA if battleSide: activeSuits = self.activeSuitsB for suit in activeSuits: battle.addSuit(suit) battle.generateWithRequired(self.zoneId) return battle
def setInvasionStatus(self, msgType, cogType, numRemaining, skeleton): self.notify.info('setInvasionStatus: msgType: %s cogType: %s, numRemaining: %s, skeleton: %s' % (msgType, cogType, numRemaining, skeleton)) cogName = SuitBattleGlobals.SuitAttributes[cogType]['name'] cogNameP = SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] if skeleton: cogName = TTLocalizer.Skeleton cogNameP = TTLocalizer.SkeletonP if msgType == ToontownGlobals.SuitInvasionBegin: msg1 = TTLocalizer.SuitInvasionBegin1 msg2 = TTLocalizer.SuitInvasionBegin2 % cogNameP self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionUpdate: msg1 = TTLocalizer.SuitInvasionUpdate1 % numRemaining msg2 = TTLocalizer.SuitInvasionUpdate2 % cogNameP self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionEnd: msg1 = TTLocalizer.SuitInvasionEnd1 % cogName msg2 = TTLocalizer.SuitInvasionEnd2 self.invading = 0 elif msgType == ToontownGlobals.SuitInvasionBulletin: msg1 = TTLocalizer.SuitInvasionBulletin1 msg2 = TTLocalizer.SuitInvasionBulletin2 % cogNameP self.invading = 1 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) return if self.invading: mult = ToontownBattleGlobals.getInvasionMultiplier() else: mult = 1 base.localAvatar.inventory.setInvasionCreditMultiplier(mult) Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), name='newsManagerWait', autoPause=1).start()
def enterElevator(self, ts=0): # Load model for the current floor and the suit models for the floor assert (self.notify.debug('enterElevator()')) if not self._CogdoGameRepeat: self.currentFloor += 1 self.cr.playGame.getPlace().currentFloor = self.currentFloor self.setElevatorLights(self.elevatorModelIn) self.setElevatorLights(self.elevatorModelOut) # hide elevator from previous floor (if any) # unless it's the top floor, in that case leave it where it is if not self.isBossFloor(self.currentFloor): self.elevatorModelOut.detachNode() messenger.send('sellbotFieldOfficeChanged', [True]) else: self._movie = CogdoElevatorMovie() self._movie.load() self._movie.play() self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone) # Get the floor multiplier mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) # Now set the inventory battleCreditMult base.localAvatar.inventory.setBattleCreditMultiplier(mult)
def enterTownBattle(self, event): mult = ToontownBattleGlobals.getFactoryCreditMultiplier(self.zoneId) base.localAvatar.inventory.setBattleCreditMultiplier(mult) self.loader.townBattle.enter(event, self.fsm.getStateNamed('battle'), bldg=1, creditMultiplier=mult)
def setInvasionStatus(self, msgType, cogType, numRemaining, skeleton): # Let the player know the status of any cog invasion taking place self.notify.info("setInvasionStatus: msgType: %s cogType: %s, numRemaining: %s, skeleton: %s" % (msgType, cogType, numRemaining, skeleton)) cogName = SuitBattleGlobals.SuitAttributes[cogType]['name'] cogNameP = SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] if skeleton: cogName = TTLocalizer.Skeleton cogNameP = TTLocalizer.SkeletonP if msgType == ToontownGlobals.SuitInvasionBegin: msg1 = TTLocalizer.SuitInvasionBegin1 msg2 = TTLocalizer.SuitInvasionBegin2 % cogNameP # Now are invading self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionUpdate: msg1 = TTLocalizer.SuitInvasionUpdate1 % numRemaining msg2 = TTLocalizer.SuitInvasionUpdate2 % cogNameP # Still invading self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionEnd: msg1 = TTLocalizer.SuitInvasionEnd1 % cogName msg2 = TTLocalizer.SuitInvasionEnd2 # No longer invading self.invading = 0 elif msgType == ToontownGlobals.SuitInvasionBulletin: msg1 = TTLocalizer.SuitInvasionBulletin1 msg2 = TTLocalizer.SuitInvasionBulletin2 % cogNameP # Still invading self.invading = 1 else: self.notify.warning("setInvasionStatus: invalid msgType: %s" % (msgType)) return # Update our local display of skill credit to take the invasion # multiplier into account. The actual math and credit is given # on the AI, this is just to inform the player # TODO: this is slightly out of sync because this will get updated # as soon as the invasion is over, whereas the AI multiplier will # not, it is only updated at the start of each battle. Nobody should # complain since the error is in the favor of the Toons (we show less # than you might actually get) if self.invading: mult = ToontownBattleGlobals.getInvasionMultiplier() else: mult = 1 base.localAvatar.inventory.setInvasionCreditMultiplier(mult) # TODO: this gets stomped at load time Sequence( Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), name = 'newsManagerWait', autoPause = 1, ).start() return
def makeBattle(self, bossCogPosHpr, battlePosHpr, roundCallback, finishCallback, battleNumber, battleSide): if battleNumber == 1: battle = DistributedBattleWaitersAI.DistributedBattleWaitersAI(self.air, self, roundCallback, finishCallback, battleSide) else: battle = DistributedBattleDinersAI.DistributedBattleDinersAI(self.air, self, roundCallback, finishCallback, battleSide) self.setBattlePos(battle, bossCogPosHpr, battlePosHpr) battle.suitsKilled = self.suitsKilled battle.battleCalc.toonSkillPtsGained = self.toonSkillPtsGained battle.toonExp = self.toonExp battle.toonOrigQuests = self.toonOrigQuests battle.toonItems = self.toonItems battle.toonOrigMerits = self.toonOrigMerits battle.toonMerits = self.toonMerits battle.toonParts = self.toonParts battle.helpfulToons = self.helpfulToons mult = ToontownBattleGlobals.getBossBattleCreditMultiplier(battleNumber) battle.battleCalc.setSkillCreditMultiplier(mult) activeSuits = self.activeSuitsA if battleSide: activeSuits = self.activeSuitsB for suit in activeSuits: battle.addSuit(suit) battle.generateWithRequired(self.zoneId) return battle
def makeBattle(self, bossCogPosHpr, battlePosHpr, roundCallback, finishCallback, battleNumber, battleSide): battle = DistributedBattleFinalAI.DistributedBattleFinalAI( self.air, self, roundCallback, finishCallback, battleSide) self.setBattlePos(battle, bossCogPosHpr, battlePosHpr) # Just like the DistributedSuitInteriorAI class, we save a # reference to our suitsKilled and toonSkillPtsGained # structures in each battle we create. That way, the battle # will directly adjust these structures and we accumulate the # toon credits for all battles. battle.suitsKilled = self.suitsKilled battle.battleCalc.toonSkillPtsGained = self.toonSkillPtsGained battle.toonExp = self.toonExp battle.toonOrigQuests = self.toonOrigQuests battle.toonItems = self.toonItems battle.toonOrigMerits = self.toonOrigMerits battle.toonMerits = self.toonMerits battle.toonParts = self.toonParts battle.helpfulToons = self.helpfulToons # We get a bonus factor applied toward each attack's # experience credit. mult = ToontownBattleGlobals.getBossBattleCreditMultiplier( battleNumber) # We don't, however, get any particular bonus for an invasion # here. battle.battleCalc.setSkillCreditMultiplier(mult) battle.generateWithRequired(self.zoneId) return battle
def enterTownBattle(self, event): # this assumes that our 'zoneId' is going to be set to the appropriate # faux-zone, and that we continue to use the faux-zone as the CountryClub # ID mult = ToontownBattleGlobals.getCountryClubCreditMultiplier(self.zoneId) base.localAvatar.inventory.setBattleCreditMultiplier(mult) self.loader.townBattle.enter(event, self.fsm.getStateNamed("battle"), bldg=1, creditMultiplier=mult)
def enterElevator(self, ts=0): self.currentFloor += 1 self.cr.playGame.getPlace().currentFloor = self.currentFloor self.setElevatorLights(self.elevatorModelIn) self.setElevatorLights(self.elevatorModelOut) self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone) mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) base.localAvatar.inventory.setBattleCreditMultiplier(mult)
def enterBattleOne(self): self.cleanupIntervals() mult = ToontownBattleGlobals.getBossBattleCreditMultiplier(1) localAvatar.inventory.setBattleCreditMultiplier(mult) self.toonsToBattlePosition(self.toonsA, self.battleANode) self.toonsToBattlePosition(self.toonsB, self.battleBNode) self.releaseToons() base.playMusic(self.battleOneMusic, looping=1, volume=0.9)
def enterBattle(self, event): mult = 1 if self.bossCog: mult = ToontownBattleGlobals.getBossBattleCreditMultiplier(self.bossCog.battleNumber) self.townBattle.enter(event, self.fsm.getStateNamed('battle'), bldg=1, creditMultiplier=mult) base.localAvatar.b_setAnimState('off', 1) base.localAvatar.setTeleportAvailable(0) base.localAvatar.cantLeaveGame = 1
def enterBattle(self, event): mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) self.townBattle.enter(event, self.fsm.getStateNamed('battle'), bldg=1, creditMultiplier=mult) base.localAvatar.b_setAnimState('off', 1) base.localAvatar.cantLeaveGame = 1
def enterTownBattle(self, event): mult = ToontownBattleGlobals.getStageCreditMultiplier( bboard.get(DistributedStage.DistributedStage.FloorNum)) base.localAvatar.inventory.setBattleCreditMultiplier(mult) self.loader.townBattle.enter(event, self.fsm.getStateNamed('battle'), bldg=1, creditMultiplier=mult)
def enterElevator(self, ts = 0): self.currentFloor += 1 self.cr.playGame.getPlace().currentFloor = self.currentFloor self.setElevatorLights(self.elevatorModelIn) self.setElevatorLights(self.elevatorModelOut) self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone) mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) base.localAvatar.inventory.setBattleCreditMultiplier(mult)
def startInvasion(self, suitName, skel, waiter, startTime, duration): self.startTime = globalClockDelta.networkToLocalTime(startTime, bits = 32) self.notify.info("New invasion! Duration: %s" % duration) self._name, msgs = self.formatInvasionMessage(suitName, skel, waiter, self.__formatBegin) self.displayMsgs(msgs) mult = ToontownBattleGlobals.getInvasionMultiplier(duration == 1) base.localAvatar.inventory.setInvasionCreditMultiplier(mult)
def enterTownBattle(self, event): # this assumes that our 'zoneId' is going to be set to the appropriate # faux-zone, and that we continue to use the faux-zone as the stage # ID mult = ToontownBattleGlobals.getStageCreditMultiplier( bboard.get(DistributedStage.DistributedStage.FloorNum)) base.localAvatar.inventory.setBattleCreditMultiplier(mult) self.loader.townBattle.enter(event, self.fsm.getStateNamed("battle"), bldg=1, creditMultiplier=mult)
def startInvasion(self, suitName, skel, waiter, startTime, duration): self.startTime = globalClockDelta.networkToLocalTime(startTime, bits=32) self.notify.info("New invasion! Duration: %s" % duration) self._name, msgs = self.formatInvasionMessage(suitName, skel, waiter, self.__formatBegin) self.displayMsgs(msgs) mult = ToontownBattleGlobals.getInvasionMultiplier(duration == 1) base.localAvatar.inventory.setInvasionCreditMultiplier(mult)
def setInvasionStatus(self, msgType, cogType, numRemaining, specialSuit): self.notify.info( 'setInvasionStatus: msgType: %s cogType: %s, numRemaining: %s, specialSuit: %s' % (msgType, cogType, numRemaining, specialSuit)) # Determine if we are spawning a special type of suit. 1 is Skelecog, 2 is v2.0. # If they are a Skelecog or v2.0 cog, we need to change the Cog name. if specialSuit == 1: cogName = TTLocalizer.Skeleton cogNameP = TTLocalizer.SkeletonP elif specialSuit == 2: cogName = TTLocalizer.SkeleReviveCogName % { 'cog_name': SuitBattleGlobals.SuitAttributes[cogType]['name'] } cogNameP = TTLocalizer.SkeleReviveCogName % { 'cog_name': SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] } else: cogName = SuitBattleGlobals.SuitAttributes[cogType]['name'] cogNameP = SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] # Figure out the message type to send if msgType == ToontownGlobals.SuitInvasionBegin: msg1 = TTLocalizer.SuitInvasionBegin1 msg2 = TTLocalizer.SuitInvasionBegin2 % cogNameP self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionUpdate: msg1 = TTLocalizer.SuitInvasionUpdate1 % numRemaining msg2 = TTLocalizer.SuitInvasionUpdate2 % cogNameP self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionEnd: msg1 = TTLocalizer.SuitInvasionEnd1 % cogName msg2 = TTLocalizer.SuitInvasionEnd2 self.invading = 0 elif msgType == ToontownGlobals.SuitInvasionBulletin: msg1 = TTLocalizer.SuitInvasionBulletin1 msg2 = TTLocalizer.SuitInvasionBulletin2 % cogNameP self.invading = 1 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) return if self.invading: mult = ToontownBattleGlobals.getInvasionMultiplier() else: mult = 1 base.localAvatar.inventory.setInvasionCreditMultiplier(mult) Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), name='newsManagerWait', autoPause=1).start()
def enterBattle(self, event): assert(self.notify.debug("enterBattle()")) # Get the floor multiplier mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) self.townBattle.enter(event, self.fsm.getStateNamed("battle"), bldg=1, creditMultiplier=mult) # Make sure the toon's anim state gets reset base.localAvatar.b_setAnimState('off', 1) # Disable leave to pay / set parent password base.localAvatar.cantLeaveGame = 1
def enterElevator(self, ts=0): # Load model for the current floor and the suit models for the floor assert(self.notify.debug('enterElevator()')) self.currentFloor += 1 self.cr.playGame.getPlace().currentFloor = self.currentFloor self.setElevatorLights(self.elevatorModelIn) self.setElevatorLights(self.elevatorModelOut) self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone) # Get the floor multiplier mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) # Now set the inventory battleCreditMult base.localAvatar.inventory.setBattleCreditMultiplier(mult)
def enterElevator(self, ts = 0): if not self._CogdoGameRepeat: self.currentFloor += 1 self.cr.playGame.getPlace().currentFloor = self.currentFloor self.setElevatorLights(self.elevatorModelIn) self.setElevatorLights(self.elevatorModelOut) if not self.isBossFloor(self.currentFloor): self.elevatorModelOut.detachNode() messenger.send('sellbotFieldOfficeChanged', [True]) else: self._movie = CogdoElevatorMovie() self._movie.load() self._movie.play() self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone) mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) base.localAvatar.inventory.setBattleCreditMultiplier(mult)
def enterElevator(self, ts=0): if not self._CogdoGameRepeat: self.currentFloor += 1 self.cr.playGame.getPlace().currentFloor = self.currentFloor self.setElevatorLights(self.elevatorModelIn) self.setElevatorLights(self.elevatorModelOut) if not self.isBossFloor(self.currentFloor): self.elevatorModelOut.detachNode() messenger.send('sellbotFieldOfficeChanged', [True]) else: self._movie = CogdoElevatorMovie() self._movie.load() self._movie.play() self.__playElevator(ts, self.elevatorName, self.__handleElevatorDone) mult = ToontownBattleGlobals.getCreditMultiplier(self.currentFloor) base.localAvatar.inventory.setBattleCreditMultiplier(mult)
def setCurrentInvasion(self, suitName, skel, waiter, startTime, duration): if duration == 0: self.notify.info('duration 0') return self.startTime = globalClockDelta.networkToLocalTime(startTime, bits = 32) elapsed = globalClock.getRealTime() - self.startTime remaining = duration - elapsed self.notify.info("Invasion in progress! Remaining time: %s" % remaining) mult = ToontownBattleGlobals.getInvasionMultiplier(duration == 1) base.localAvatar.inventory.setInvasionCreditMultiplier(mult) if not self.__announced: self._name, msgs = self.formatInvasionMessage(suitName, skel, False, self.__formatProgress) self.displayMsgs(msgs)
def enterBattle(self, event): assert(self.notify.debug("enterBattle()")) mult = 1 if self.bossCog: mult = ToontownBattleGlobals.getBossBattleCreditMultiplier(self.bossCog.battleNumber) assert(self.notify.debug("creditMultiplier = %s" % (mult))) self.townBattle.enter(event, self.fsm.getStateNamed("battle"), bldg = 1, creditMultiplier = mult) # Make sure the toon's anim state gets reset base.localAvatar.b_setAnimState('off', 1) base.localAvatar.setTeleportAvailable(0) # Disable leave to pay / set parent password base.localAvatar.cantLeaveGame = 1
def setInvasionStatus(self, msgType, cogType, numRemaining, specialSuit): self.notify.info('setInvasionStatus: msgType: %s cogType: %s, numRemaining: %s, specialSuit: %s' % (msgType, cogType, numRemaining, specialSuit)) # Determine if we are spawning a special type of suit. 1 is Skelecog, 2 is v2.0. # If they are a Skelecog or v2.0 cog, we need to change the Cog name. if specialSuit == 1: cogName = TTLocalizer.Skeleton cogNameP = TTLocalizer.SkeletonP elif specialSuit == 2: cogName = TTLocalizer.SkeleReviveCogName % {'cog_name':SuitBattleGlobals.SuitAttributes[cogType]['name']} cogNameP = TTLocalizer.SkeleReviveCogName % {'cog_name':SuitBattleGlobals.SuitAttributes[cogType]['pluralname']} else: cogName = SuitBattleGlobals.SuitAttributes[cogType]['name'] cogNameP = SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] # Figure out the message type to send if msgType == ToontownGlobals.SuitInvasionBegin: msg1 = TTLocalizer.SuitInvasionBegin1 msg2 = TTLocalizer.SuitInvasionBegin2 % cogNameP self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionUpdate: msg1 = TTLocalizer.SuitInvasionUpdate1 % numRemaining msg2 = TTLocalizer.SuitInvasionUpdate2 % cogNameP self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionEnd: msg1 = TTLocalizer.SuitInvasionEnd1 % cogName msg2 = TTLocalizer.SuitInvasionEnd2 self.invading = 0 elif msgType == ToontownGlobals.SuitInvasionBulletin: msg1 = TTLocalizer.SuitInvasionBulletin1 msg2 = TTLocalizer.SuitInvasionBulletin2 % cogNameP self.invading = 1 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) return if self.invading: mult = ToontownBattleGlobals.getInvasionMultiplier() else: mult = 1 base.localAvatar.inventory.setInvasionCreditMultiplier(mult) Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), name='newsManagerWait', autoPause=1).start()
def getToonUberStatus(toons, numToons): fieldList = [] uberIndex = ToontownBattleGlobals.LAST_REGULAR_GAG_LEVEL + 1 for toonId in toons: toonList = [] toon = simbase.air.doId2do.get(toonId) if toon == None: fieldList.append(-1) else: for trackIndex in range(ToontownBattleGlobals.MAX_TRACK_INDEX + 1): toonList.append(toon.inventory.numItem(trackIndex, uberIndex)) fieldList.append(ToontownBattleGlobals.encodeUber(toonList)) lenDif = numToons - len(toons) if lenDif > 0: for index in range(lenDif): fieldList.append(-1) return fieldList
def setCurrentInvasion(self, suitName, skel, waiter, startTime, duration): if duration == 0: self.notify.info('duration 0') return self.startTime = globalClockDelta.networkToLocalTime(startTime, bits=32) elapsed = globalClock.getRealTime() - self.startTime remaining = duration - elapsed self.notify.info("Invasion in progress! Remaining time: %s" % remaining) mult = ToontownBattleGlobals.getInvasionMultiplier(duration == 1) base.localAvatar.inventory.setInvasionCreditMultiplier(mult) if not self.__announced: self._name, msgs = self.formatInvasionMessage( suitName, skel, False, self.__formatProgress) self.displayMsgs(msgs)
def enterBattleTwo(self): self.cleanupIntervals() mult = ToontownBattleGlobals.getBossBattleCreditMultiplier(2) localAvatar.inventory.setBattleCreditMultiplier(mult) self.reparentTo(render) self.setPosHpr(*ToontownGlobals.SellbotBossBattleTwoPosHpr) self.clearChat() self.cagedToon.clearChat() self.rampA.request('retract') self.rampB.request('retract') self.rampC.request('retract') self.releaseToons() self.toonsToBattlePosition(self.toonsA, self.battleANode) self.toonsToBattlePosition(self.toonsB, self.battleBNode) if self.battleA is None or self.battleB is None: cageIndex = 3 else: cageIndex = 2 self.setCageIndex(cageIndex) base.playMusic(self.battleTwoMusic, looping=1, volume=0.9) return
def getBattleCreditMultiplier(self): return ToontownBattleGlobals.getBoardOfficeCreditMultiplier( self.boardofficeId)
def getBattleCreditMultiplier(self): return ToontownBattleGlobals.getMintCreditMultiplier(self.mintId)
def setInvasionStatus(self, msgType, suitType, remaining, flags): if suitType in SuitDNA.suitHeadTypes: suitName = SuitBattleGlobals.SuitAttributes[suitType]['name'] suitNamePlural = SuitBattleGlobals.SuitAttributes[suitType]['pluralname'] elif suitType in SuitDNA.suitDepts: suitName = SuitDNA.getDeptFullname(suitType) suitNamePlural = SuitDNA.getDeptFullnameP(suitType) messages = [] if msgType == ToontownGlobals.SuitInvasionBegin: messages.append(TTLocalizer.SuitInvasionBegin1) messages.append(TTLocalizer.SuitInvasionBegin2 % suitNamePlural) self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionEnd: messages.append(TTLocalizer.SuitInvasionEnd1 % suitName) messages.append(TTLocalizer.SuitInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.SuitInvasionUpdate: messages.append(TTLocalizer.SuitInvasionUpdate1) messages.append(TTLocalizer.SuitInvasionUpdate2) self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionBulletin: messages.append(TTLocalizer.SuitInvasionBulletin1) messages.append(TTLocalizer.SuitInvasionBulletin2 % suitNamePlural) self.invading = 1 elif msgType == ToontownGlobals.SkelecogInvasionBegin: messages.append(TTLocalizer.SkelecogInvasionBegin1) messages.append(TTLocalizer.SkelecogInvasionBegin2) messages.append(TTLocalizer.SkelecogInvasionBegin3) self.invading = 1 elif msgType == ToontownGlobals.SkelecogInvasionEnd: messages.append(TTLocalizer.SkelecogInvasionEnd1) messages.append(TTLocalizer.SkelecogInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.SkelecogInvasionBulletin: messages.append(TTLocalizer.SkelecogInvasionBulletin1) messages.append(TTLocalizer.SkelecogInvasionBulletin2) messages.append(TTLocalizer.SkelecogInvasionBulletin3) self.invading = 1 elif msgType == ToontownGlobals.WaiterInvasionBegin: messages.append(TTLocalizer.WaiterInvasionBegin1) messages.append(TTLocalizer.WaiterInvasionBegin2) self.invading = 1 elif msgType == ToontownGlobals.WaiterInvasionEnd: messages.append(TTLocalizer.WaiterInvasionEnd1) messages.append(TTLocalizer.WaiterInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.WaiterInvasionBulletin: messages.append(TTLocalizer.WaiterInvasionBulletin1) messages.append(TTLocalizer.WaiterInvasionBulletin2) messages.append(TTLocalizer.WaiterInvasionBulletin3) self.invading = 1 elif msgType == ToontownGlobals.V2InvasionBegin: messages.append(TTLocalizer.V2InvasionBegin1) messages.append(TTLocalizer.V2InvasionBegin2) messages.append(TTLocalizer.V2InvasionBegin3) self.invading = 1 elif msgType == ToontownGlobals.V2InvasionEnd: messages.append(TTLocalizer.V2InvasionEnd1) messages.append(TTLocalizer.V2InvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.V2InvasionBulletin: messages.append(TTLocalizer.V2InvasionBulletin1) messages.append(TTLocalizer.V2InvasionBulletin2) messages.append(TTLocalizer.V2InvasionBulletin3) self.invading = 1 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) return multiplier = 1 if self.invading: multiplier = ToontownBattleGlobals.getInvasionMultiplier() base.localAvatar.inventory.setInvasionCreditMultiplier(multiplier) track = Sequence(name='newsManagerWait', autoPause=1) for i, message in enumerate(messages): if i == 0: track.append(Wait(1)) else: track.append(Wait(5)) track.append(Func(base.localAvatar.setSystemMessage, 0, message)) track.start()
def getBattleCreditMultiplier(self): return ToontownBattleGlobals.getStageCreditMultiplier( self.getFloorNum())
def velvetRoped(self): return not base.cr.isPaid() and ToontownBattleGlobals.gagIsPaidOnly(self.gagTrack, self.gagLevel)
def getExpTrack(self, toon, origExp, earnedExp, deathList, origQuestsList, itemList, missedItemList, origMeritList, meritList, partList, toonList, uberEntry, helpfulToonsList, noSkip=False): track = Sequence( Func(self.initGagFrame, toon, origExp, origMeritList, noSkip=noSkip), Wait(1.0)) endTracks = [0, 0, 0, 0, 0, 0, 0] trackEnded = 0 for trackIndex in xrange(len(earnedExp)): if earnedExp[trackIndex] > 0 or origExp[ trackIndex] >= ToontownBattleGlobals.MaxSkill: track += self.getTrackIntervalList( toon, trackIndex, origExp[trackIndex], earnedExp[trackIndex], ToontownBattleGlobals.getUberFlagSafe( uberEntry, trackIndex)) maxExp = ToontownBattleGlobals.MaxSkill - ToontownBattleGlobals.UberSkill if origExp[trackIndex] < maxExp and earnedExp[ trackIndex] + origExp[trackIndex] >= maxExp: endTracks[trackIndex] = 1 trackEnded = 1 for dept in xrange(len(SuitDNA.suitDepts)): if meritList[dept]: track += self.getMeritIntervalList(toon, dept, origMeritList[dept], meritList[dept]) track.append(Wait(0.75)) itemInterval = self.getItemIntervalList(toon, itemList) if itemInterval: track.append(Func(self.initItemFrame, toon)) track.append(Wait(0.25)) track += itemInterval track.append(Wait(0.5)) missedItemInterval = self.getMissedItemIntervalList( toon, missedItemList) if missedItemInterval: track.append(Func(self.initMissedItemFrame, toon)) track.append(Wait(0.25)) track += missedItemInterval track.append(Wait(0.5)) self.notify.debug('partList = %s' % partList) newPart = 0 for part in partList: if part != 0: newPart = 1 break if newPart: partList = self.getCogPartIntervalList(toon, partList) if partList: track.append(Func(self.initCogPartFrame, toon)) track.append(Wait(0.25)) track += partList track.append(Wait(0.5)) questList = self.getQuestIntervalList(toon, deathList, toonList, origQuestsList, itemList, helpfulToonsList) if questList: avQuests = [] for i in xrange(0, len(origQuestsList), 5): avQuests.append(origQuestsList[i:i + 5]) track.append( Func(self.initQuestFrame, toon, copy.deepcopy(avQuests))) track.append(Wait(0.25)) track += questList track.append(Wait(0.5)) track.append(Wait(0.25)) if trackEnded: track.append(Func(self.vanishFrames)) track.append(Fanfare.makeFanfare(0, toon)[0]) for i in xrange(len(endTracks)): if endTracks[i] is 1: track += self.getEndTrackIntervalList(toon, toonList, i) track.append(Func(self.cleanupEndTrack)) return track
def setInvasionStatus(self, msgType, suitType, remaining, flags): if suitType in SuitDNA.suitHeadTypes: suitName = SuitBattleGlobals.SuitAttributes[suitType]['name'] suitNamePlural = SuitBattleGlobals.SuitAttributes[suitType][ 'pluralname'] elif suitType in SuitDNA.suitDepts: suitName = SuitDNA.getDeptFullname(suitType) suitNamePlural = SuitDNA.getDeptFullnameP(suitType) messages = [] if msgType == ToontownGlobals.SuitInvasionBegin: messages.append(TTLocalizer.SuitInvasionBegin1) messages.append(TTLocalizer.SuitInvasionBegin2 % suitNamePlural) self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionEnd: messages.append(TTLocalizer.SuitInvasionEnd1 % suitName) messages.append(TTLocalizer.SuitInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.SuitInvasionUpdate: messages.append(TTLocalizer.SuitInvasionUpdate1) messages.append(TTLocalizer.SuitInvasionUpdate2) self.invading = 1 elif msgType == ToontownGlobals.SuitInvasionBulletin: messages.append(TTLocalizer.SuitInvasionBulletin1) messages.append(TTLocalizer.SuitInvasionBulletin2 % suitNamePlural) self.invading = 1 elif msgType == ToontownGlobals.SkelecogInvasionBegin: messages.append(TTLocalizer.SkelecogInvasionBegin1) messages.append(TTLocalizer.SkelecogInvasionBegin2) messages.append(TTLocalizer.SkelecogInvasionBegin3) self.invading = 1 elif msgType == ToontownGlobals.SkelecogInvasionEnd: messages.append(TTLocalizer.SkelecogInvasionEnd1) messages.append(TTLocalizer.SkelecogInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.SkelecogInvasionBulletin: messages.append(TTLocalizer.SkelecogInvasionBulletin1) messages.append(TTLocalizer.SkelecogInvasionBulletin2) messages.append(TTLocalizer.SkelecogInvasionBulletin3) self.invading = 1 elif msgType == ToontownGlobals.WaiterInvasionBegin: messages.append(TTLocalizer.WaiterInvasionBegin1) messages.append(TTLocalizer.WaiterInvasionBegin2) self.invading = 1 elif msgType == ToontownGlobals.WaiterInvasionEnd: messages.append(TTLocalizer.WaiterInvasionEnd1) messages.append(TTLocalizer.WaiterInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.WaiterInvasionBulletin: messages.append(TTLocalizer.WaiterInvasionBulletin1) messages.append(TTLocalizer.WaiterInvasionBulletin2) messages.append(TTLocalizer.WaiterInvasionBulletin3) self.invading = 1 elif msgType == ToontownGlobals.V2InvasionBegin: messages.append(TTLocalizer.V2InvasionBegin1) messages.append(TTLocalizer.V2InvasionBegin2) messages.append(TTLocalizer.V2InvasionBegin3) self.invading = 1 elif msgType == ToontownGlobals.V2InvasionEnd: messages.append(TTLocalizer.V2InvasionEnd1) messages.append(TTLocalizer.V2InvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.V2InvasionBulletin: messages.append(TTLocalizer.V2InvasionBulletin1) messages.append(TTLocalizer.V2InvasionBulletin2) messages.append(TTLocalizer.V2InvasionBulletin3) self.invading = 1 elif msgType == ToontownGlobals.VirtualInvasionBegin: messages.append(TTLocalizer.VirtualInvasionBegin1) messages.append(TTLocalizer.VirtualInvasionBegin2) messages.append(TTLocalizer.VirtualInvasionBegin3) self.invading = 1 elif msgType == ToontownGlobals.VirtualInvasionEnd: messages.append(TTLocalizer.VirtualInvasionEnd1) messages.append(TTLocalizer.VirtualInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.VirtualInvasionBulletin: messages.append(TTLocalizer.VirtualInvasionBulletin1) messages.append(TTLocalizer.VirtualInvasionBulletin2) messages.append(TTLocalizer.VirtualInvasionBulletin3) self.invading = 1 elif msgType == ToontownGlobals.RentalInvasionBegin: messages.append(TTLocalizer.RentalInvasionBegin1) messages.append(TTLocalizer.RentalInvasionBegin2) messages.append(TTLocalizer.RentalInvasionBegin3) self.invading = 1 elif msgType == ToontownGlobals.RentalInvasionEnd: messages.append(TTLocalizer.RentalInvasionEnd1) messages.append(TTLocalizer.RentalInvasionEnd2) self.invading = 0 elif msgType == ToontownGlobals.RentalInvasionBulletin: messages.append(TTLocalizer.RentalInvasionBulletin1) messages.append(TTLocalizer.RentalInvasionBulletin2) messages.append(TTLocalizer.RentalInvasionBulletin3) self.invading = 1 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) return multiplier = 1 if self.invading: multiplier = ToontownBattleGlobals.getInvasionMultiplier() base.localAvatar.inventory.setInvasionCreditMultiplier(multiplier) track = Sequence(name='newsManagerWait', autoPause=1) for i, message in enumerate(messages): if i == 0: track.append(Wait(1)) else: track.append(Wait(5)) track.append(Func(base.localAvatar.setSystemMessage, 0, message)) track.start()
def getBattleCreditMultiplier(self): return ToontownBattleGlobals.getFactoryCreditMultiplier(self.factoryId)
def getExpTrack(self, toon, origExp, earnedExp, deathList, origQuestsList, itemList, missedItemList, origMeritList, meritList, partList, toonList, uberEntry, helpfulToonsList, noSkip = False): track = Sequence(Func(self.initGagFrame, toon, origExp, origMeritList, noSkip=noSkip), Wait(1.0)) endTracks = [0, 0, 0, 0, 0, 0, 0] trackEnded = 0 for trackIndex in xrange(len(earnedExp)): if earnedExp[trackIndex] > 0 or origExp[trackIndex] >= ToontownBattleGlobals.MaxSkill: track += self.getTrackIntervalList(toon, trackIndex, origExp[trackIndex], earnedExp[trackIndex], ToontownBattleGlobals.getUberFlagSafe(uberEntry, trackIndex)) maxExp = ToontownBattleGlobals.MaxSkill - ToontownBattleGlobals.UberSkill if origExp[trackIndex] < maxExp and earnedExp[trackIndex] + origExp[trackIndex] >= maxExp: endTracks[trackIndex] = 1 trackEnded = 1 for dept in xrange(len(SuitDNA.suitDepts)): if meritList[dept]: track += self.getMeritIntervalList(toon, dept, origMeritList[dept], meritList[dept]) track.append(Wait(0.75)) itemInterval = self.getItemIntervalList(toon, itemList) if itemInterval: track.append(Func(self.initItemFrame, toon)) track.append(Wait(0.25)) track += itemInterval track.append(Wait(0.5)) missedItemInterval = self.getMissedItemIntervalList(toon, missedItemList) if missedItemInterval: track.append(Func(self.initMissedItemFrame, toon)) track.append(Wait(0.25)) track += missedItemInterval track.append(Wait(0.5)) self.notify.debug('partList = %s' % partList) newPart = 0 for part in partList: if part != 0: newPart = 1 break if newPart: partList = self.getCogPartIntervalList(toon, partList) if partList: track.append(Func(self.initCogPartFrame, toon)) track.append(Wait(0.25)) track += partList track.append(Wait(0.5)) questList = self.getQuestIntervalList(toon, deathList, toonList, origQuestsList, itemList, helpfulToonsList) if questList: avQuests = [] for i in xrange(0, len(origQuestsList), 5): avQuests.append(origQuestsList[i:i + 5]) track.append(Func(self.initQuestFrame, toon, copy.deepcopy(avQuests))) track.append(Wait(0.25)) track += questList track.append(Wait(0.5)) track.append(Wait(0.25)) if trackEnded: track.append(Func(self.vanishFrames)) track.append(Fanfare.makeFanfare(0, toon)[0]) for i in xrange(len(endTracks)): if endTracks[i] is 1: track += self.getEndTrackIntervalList(toon, toonList, i) track.append(Func(self.cleanupEndTrack)) return track
def setInvasionStatus(self, msgType, suitType, remaining, flags): if msgType not in ToontownGlobals.SuitInvasions: return if suitType in SuitDNA.suitHeadTypes: attributes = SuitBattleGlobals.SuitAttributes[suitType] suitNames = {'singular': attributes['name'], 'plural': attributes['pluralname']} elif suitType in SuitDNA.suitDepts: suitNames = {'singular': SuitDNA.getDeptFullname(suitType), 'plural': SuitDNA.getDeptFullnameP(suitType)} else: return track = Sequence() base.localAvatar.inventory.setInvasionCreditMultiplier(1 if msgType in ToontownGlobals.EndingInvasions else ToontownBattleGlobals.getInvasionMultiplier()) for i, message in enumerate(ToontownGlobals.SuitInvasions[msgType]): track.append(Wait(5 if i else 1)) track.append(Func(base.localAvatar.setSystemMessage, 0, (TTLocalizer.SuitInvasionPrefix + message) % suitNames)) track.start()
def getBattleCreditMultiplier(self): return ToontownBattleGlobals.getFactoryCreditMultiplier( self.lawOfficeId)
def getBattleCreditMultiplier(self): return ToontownBattleGlobals.getCountryClubCreditMultiplier(self.countryClubId)
def getBattleCreditMultiplier(self): return ToontownBattleGlobals.getStageCreditMultiplier(self.getFloorNum())
def enterTownBattle(self, event): mult = ToontownBattleGlobals.getStageCreditMultiplier(bboard.get(DistributedStage.DistributedStage.FloorNum)) base.localAvatar.inventory.setBattleCreditMultiplier(mult) self.loader.townBattle.enter(event, self.fsm.getStateNamed("battle"), bldg=1, creditMultiplier=mult)