def sendInvasionStatus(self): if self.invading: if self.suitDeptIndex is not None: if self.suitTypeIndex is not None: type = SuitBattleGlobals.SuitAttributes[ self.getSuitName()]['name'] else: type = SuitDNA.getDeptFullname(self.getSuitName()) else: type = None status = { 'invasion': { 'type': type, 'flags': self.flags, 'remaining': self.remaining, 'total': self.total, 'start': self.start } } else: status = {'invasion': None} self.air.netMessenger.send('shardStatus', [self.air.ourChannel, status])
def announceGenerate(self): DistributedBossCog.DistributedBossCog.announceGenerate(self) self.setName(TTLocalizer.CashbotBossName) nameInfo = TTLocalizer.BossCogNameWithDept % {'name': self.name, 'dept': SuitDNA.getDeptFullname(self.style.dept)} self.setDisplayName(nameInfo) target = CollisionSphere(2, 0, 0, 3) targetNode = CollisionNode('headTarget') targetNode.addSolid(target) targetNode.setCollideMask(ToontownGlobals.PieBitmask) self.headTarget = self.neck.attachNewNode(targetNode) shield = CollisionSphere(0, 0, 0.8, 7) shieldNode = CollisionNode('shield') shieldNode.addSolid(shield) shieldNode.setCollideMask(ToontownGlobals.PieBitmask) shieldNodePath = self.pelvis.attachNewNode(shieldNode) self.heldObject = None self.bossDamage = 0 self.loadEnvironment() self.__makeResistanceToon() self.physicsMgr = PhysicsManager() integrator = LinearEulerIntegrator() self.physicsMgr.attachLinearIntegrator(integrator) fn = ForceNode('gravity') self.fnp = self.geom.attachNewNode(fn) gravity = LinearVectorForce(0, 0, -32) fn.addForce(gravity) self.physicsMgr.addLinearForce(gravity) base.localAvatar.chatMgr.chatInputSpeedChat.addCFOMenu() global OneBossCog if OneBossCog != None: self.notify.warning('Multiple BossCogs visible.') OneBossCog = self return
def invasionBegan(self, msgType, suitType): 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) if msgType == ToontownGlobals.SuitInvasionBegin: message = TTLocalizer.SuitInvasionBegin2 % suitNamePlural elif msgType == ToontownGlobals.SuitInvasionEnd: message = TTLocalizer.SuitInvasionEnd1 % suitName elif msgType == ToontownGlobals.SkelecogInvasionBegin: message = TTLocalizer.SkelecogInvasionBegin3 elif msgType == ToontownGlobals.SkelecogInvasionEnd: message = TTLocalizer.SkelecogInvasionEnd1 elif msgType == ToontownGlobals.WaiterInvasionBegin: message = TTLocalizer.WaiterInvasionBegin2 elif msgType == ToontownGlobals.WaiterInvasionEnd: message = TTLocalizer.WaiterInvasionEnd1 elif msgType == ToontownGlobals.V2InvasionBegin: message = TTLocalizer.V2InvasionBegin3 elif msgType == ToontownGlobals.V2InvasionEnd: message = TTLocalizer.V2InvasionEnd1 else: self.notify.warning('invasionBegan: invalid msgType: %s' % msgType) return print (message)
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 setupSuitBuilding(self, nodePath): if nodePath.isEmpty(): return dnaStore = self.cr.playGame.dnaStore level = int(self.difficulty / 2) + 1 suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) + str(level)) # if the suit node path is not in the dna store, dont setup # the building specified if not suitNP: self.notify.warning("Suit NP could not be found for building!") return zoneId = dnaStore.getZoneFromBlockNumber(self.block) zoneId = ZoneUtil.getTrueZoneId(zoneId, self.interiorZoneId) newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId] suitBuildingNP = suitNP.copyTo(newParentNP) if self.block not in dnaStore.suitBlocks: dnaStore.storeSuitBlock(self.block, chr(self.track)) buildingTitle = dnaStore.getTitleFromBlockNumber(self.block) if not buildingTitle: buildingTitle = TTLocalizer.CogsInc else: buildingTitle += TTLocalizer.CogsIncExt buildingTitle += '\n%s' % SuitDNA.getDeptFullname(chr(self.track)) textNode = TextNode('sign') textNode.setTextColor(1.0, 1.0, 1.0, 1.0) textNode.setFont(ToontownGlobals.getSuitFont()) textNode.setAlign(TextNode.ACenter) textNode.setWordwrap(17.0) textNode.setText(buildingTitle) textHeight = textNode.getHeight() zScale = (textHeight + 2) / 3.0 signOrigin = suitBuildingNP.find('**/sign_origin;+s') backgroundNP = loader.loadModel('phase_5/models/modules/suit_sign') backgroundNP.reparentTo(signOrigin) backgroundNP.setPosHprScale(0.0, 0.0, textHeight * 0.8 / zScale, 0.0, 0.0, 0.0, 8.0, 8.0, 8.0 * zScale) #backgroundNP.node().setEffect(DecalEffect.make()) signTextNodePath = backgroundNP.attachNewNode(textNode.generate()) signTextNodePath.setPosHprScale(0.0, -0.001, -0.21 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1 / zScale) signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0) frontNP = suitBuildingNP.find('**/*_front/+GeomNode;+s') backgroundNP.wrtReparentTo(frontNP) frontNP.node().setEffect(DecalEffect.make()) suitBuildingNP.setName('sb' + str(self.block) + ':_landmark__DNARoot') suitBuildingNP.setPosHprScale(nodePath, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0) suitBuildingNP.flattenMedium() self.loadElevator(suitBuildingNP) return suitBuildingNP
def setupSuitBuilding(self, nodePath): dnaStore = self.cr.playGame.dnaStore level = 1 if chr(self.track) != "x": suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) + str(level)) else: suitNP = loader.loadModel( 'phase_5/models/modules/suit_landmark_money2') zoneId = dnaStore.getZoneFromBlockNumber(self.block) zoneId = ZoneUtil.getTrueZoneId(zoneId, self.interiorZoneId) newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId] suitBuildingNP = suitNP.copyTo(newParentNP) buildingTitle = dnaStore.getTitleFromBlockNumber(self.block) if not buildingTitle: buildingTitle = TTLocalizer.CogsInc else: buildingTitle += TTLocalizer.CogsIncExt buildingTitle += '\n%s' % (SuitDNA.getDeptFullname(chr( self.track)) if chr(self.track) != "x" else "Loblao's Troll") textNode = TextNode('sign') textNode.setTextColor(1.0, 1.0, 1.0, 1.0) textNode.setFont(ToontownGlobals.getSuitFont()) textNode.setAlign(TextNode.ACenter) textNode.setWordwrap(17.0) textNode.setText(buildingTitle.decode(sys.getdefaultencoding())) textHeight = textNode.getHeight() zScale = (textHeight + 2) / 3.0 signOrigin = suitBuildingNP.find('**/sign_origin;+s') if signOrigin.isEmpty(): signOrigin = hidden.attachNewNode("garbage") backgroundNP = loader.loadModel('phase_5/models/modules/suit_sign') backgroundNP.reparentTo(signOrigin) backgroundNP.setPosHprScale(0.0, 0.0, textHeight * 0.8 / zScale, 0.0, 0.0, 0.0, 8.0, 8.0, 8.0 * zScale) backgroundNP.node().setEffect(DecalEffect.make()) signTextNodePath = backgroundNP.attachNewNode(textNode.generate()) signTextNodePath.setPosHprScale(0.0, 0.0, -0.21 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1 / zScale) signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0) frontNP = suitBuildingNP.find('**/*_front/+GeomNode;+s') if frontNP.isEmpty(): frontNP = hidden.attachNewNode("garbage") backgroundNP.wrtReparentTo(frontNP) frontNP.node().setEffect(DecalEffect.make()) suitBuildingNP.setName('sb' + str(self.block) + ':_landmark__DNARoot') suitBuildingNP.setPosHprScale(nodePath, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0) suitBuildingNP.flattenMedium() self.loadElevator(suitBuildingNP) return suitBuildingNP
def setupSuitBuilding(self, nodePath): if nodePath.isEmpty(): return dnaStore = self.cr.playGame.dnaStore level = int(self.difficulty / 2) + 1 if level > 5: self.notify.warning('Level is bigger than 5: %s' % level) suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) + str(min(level, 5))) zoneId = dnaStore.getZoneFromBlockNumber(self.block) newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId] suitBuildingNP = suitNP.copyTo(newParentNP) buildingTitle = dnaStore.getTitleFromBlockNumber(self.block) if not buildingTitle: buildingTitle = TTLocalizer.CogsInc else: buildingTitle += TTLocalizer.CogsIncExt buildingTitle += '\n%s' % SuitDNA.getDeptFullname(chr(self.track)) textNode = TextNode('sign') textNode.setTextColor(1.0, 1.0, 1.0, 1.0) textNode.setFont(ToontownGlobals.getSuitFont()) textNode.setAlign(TextNode.ACenter) textNode.setWordwrap(17.0) textNode.setText(buildingTitle) textHeight = textNode.getHeight() zScale = (textHeight + 2) / 3.0 signOrigin = suitBuildingNP.find('**/sign_origin;+s') backgroundNP = loader.loadModel('phase_5/models/modules/suit_sign') backgroundNP.reparentTo(signOrigin) backgroundNP.setPosHprScale(0.0, 0.0, textHeight * 0.8 / zScale, 0.0, 0.0, 0.0, 8.0, 8.0, 8.0 * zScale) signTextNodePath = backgroundNP.attachNewNode(textNode.generate()) signTextNodePath.setPosHprScale(0.0, 0.0, -0.21 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1 / zScale) signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0) frontNP = suitBuildingNP.find('**/*_front/+GeomNode;+s') backgroundNP.wrtReparentTo(frontNP) frontNP.node().setEffect(DecalEffect.make()) signTextNodePath.setAttrib(DepthOffsetAttrib.make(1)) suitBuildingNP.setName('sb' + str(self.block) + ':_landmark__DNARoot') suitBuildingNP.setPosHprScale(nodePath, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0) suitBuildingNP.flattenMedium() self.loadElevator(suitBuildingNP) return suitBuildingNP
def setupSuitBuilding(self, nodePath): if nodePath.isEmpty(): return dnaStore = self.cr.playGame.dnaStore level = int(self.difficulty / 2) + 1 suitNP = dnaStore.findNode("suit_landmark_" + chr(self.track) + str(level)) zoneId = dnaStore.getZoneFromBlockNumber(self.block) zoneId = ZoneUtil.getTrueZoneId(zoneId, self.interiorZoneId) newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId] suitBuildingNP = suitNP.copyTo(newParentNP) buildingTitle = dnaStore.getTitleFromBlockNumber(self.block) if not buildingTitle: buildingTitle = TTLocalizer.CogsInc else: buildingTitle += TTLocalizer.CogsIncExt buildingTitle += "\n%s" % SuitDNA.getDeptFullname(chr(self.track)) textNode = TextNode("sign") textNode.setTextColor(1.0, 1.0, 1.0, 1.0) textNode.setFont(ToontownGlobals.getSuitFont()) textNode.setAlign(TextNode.ACenter) textNode.setWordwrap(17.0) textNode.setText(buildingTitle) textHeight = textNode.getHeight() zScale = (textHeight + 2) / 3.0 signOrigin = suitBuildingNP.find("**/sign_origin;+s") backgroundNP = loader.loadModel("phase_5/models/modules/suit_sign") backgroundNP.reparentTo(signOrigin) backgroundNP.setPosHprScale(0.0, 0.0, textHeight * 0.8 / zScale, 0.0, 0.0, 0.0, 8.0, 8.0, 8.0 * zScale) backgroundNP.node().setEffect(DecalEffect.make()) signTextNodePath = backgroundNP.attachNewNode(textNode.generate()) signTextNodePath.setPosHprScale( 0.0, 0.0, -0.21 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1 / zScale ) signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0) frontNP = suitBuildingNP.find("**/*_front/+GeomNode;+s") backgroundNP.wrtReparentTo(frontNP) frontNP.node().setEffect(DecalEffect.make()) suitBuildingNP.setName("sb" + str(self.block) + ":_landmark__DNARoot") suitBuildingNP.setPosHprScale(nodePath, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0) suitBuildingNP.flattenMedium() self.loadElevator(suitBuildingNP) return suitBuildingNP
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 setupSuitBuilding(self, nodePath): dnaStore = self.cr.playGame.dnaStore level = 1 if chr(self.track) != "x": suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) + str(level)) else: suitNP = loader.loadModel('phase_5/models/modules/suit_landmark_money2') zoneId = dnaStore.getZoneFromBlockNumber(self.block) zoneId = ZoneUtil.getTrueZoneId(zoneId, self.interiorZoneId) newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId] suitBuildingNP = suitNP.copyTo(newParentNP) buildingTitle = dnaStore.getTitleFromBlockNumber(self.block) if not buildingTitle: buildingTitle = TTLocalizer.CogsInc else: buildingTitle += TTLocalizer.CogsIncExt buildingTitle += '\n%s' % (SuitDNA.getDeptFullname(chr(self.track)) if chr(self.track) != "x" else "Loblao's Troll") textNode = TextNode('sign') textNode.setTextColor(1.0, 1.0, 1.0, 1.0) textNode.setFont(ToontownGlobals.getSuitFont()) textNode.setAlign(TextNode.ACenter) textNode.setWordwrap(17.0) textNode.setText(buildingTitle.decode(sys.getdefaultencoding())) textHeight = textNode.getHeight() zScale = (textHeight + 2) / 3.0 signOrigin = suitBuildingNP.find('**/sign_origin;+s') if signOrigin.isEmpty(): signOrigin = hidden.attachNewNode("garbage") backgroundNP = loader.loadModel('phase_5/models/modules/suit_sign') backgroundNP.reparentTo(signOrigin) backgroundNP.setPosHprScale(0.0, 0.0, textHeight * 0.8 / zScale, 0.0, 0.0, 0.0, 8.0, 8.0, 8.0 * zScale) backgroundNP.node().setEffect(DecalEffect.make()) signTextNodePath = backgroundNP.attachNewNode(textNode.generate()) signTextNodePath.setPosHprScale(0.0, 0.0, -0.21 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1, 0.1, 0.1 / zScale) signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0) frontNP = suitBuildingNP.find('**/*_front/+GeomNode;+s') if frontNP.isEmpty(): frontNP = hidden.attachNewNode("garbage") backgroundNP.wrtReparentTo(frontNP) frontNP.node().setEffect(DecalEffect.make()) suitBuildingNP.setName('sb' + str(self.block) + ':_landmark__DNARoot') suitBuildingNP.setPosHprScale(nodePath, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0) suitBuildingNP.flattenMedium() self.loadElevator(suitBuildingNP) return suitBuildingNP
def sendInvasionStatus(self): if self.invading: if self.suitDeptIndex is not None: if self.suitTypeIndex is not None: type = SuitBattleGlobals.SuitAttributes[self.getSuitName()]['name'] else: type = SuitDNA.getDeptFullname(self.getSuitName()) else: type = None status = { 'invasion': { 'type': type, 'flags': self.flags, 'remaining': self.remaining, 'total': self.total, 'start': self.start } } else: status = {'invasion': None} self.air.netMessenger.send('shardStatus', [self.air.ourChannel, status])
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 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 getStyleDept(self): if hasattr(self, 'dna') and self.dna: return SuitDNA.getDeptFullname(self.dna.dept) else: self.notify.error('called getStyleDept() before dna was set!') return 'unknown'
def setInvasionStatus(self, msgType, cogType, numRemaining, skeleton): self.notify.info( 'setInvasionStatus: msgType: %s cogType: %s, numRemaining: %s, skeleton: %s' % (msgType, cogType, numRemaining, skeleton)) if msgType < ToontownGlobals.DepartmentInvasionBegin: cogName = SuitBattleGlobals.SuitAttributes[cogType]['name'] cogNameP = SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] messages = 2 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 elif msgType == ToontownGlobals.SkelecogInvasionBegin: msg1 = TTLocalizer.SkelecogInvasionBegin1 msg2 = TTLocalizer.SkelecogInvasionBegin2 msg3 = TTLocalizer.SkelecogInvasionBegin3 messages = 3 elif msgType == ToontownGlobals.SkelecogInvasionEnd: msg1 = TTLocalizer.SkelecogInvasionEnd1 msg2 = TTLocalizer.SkelecogInvasionEnd2 elif msgType == ToontownGlobals.V2InvasionBegin: msg1 = TTLocalizer.V2InvasionBegin1 msg2 = TTLocalizer.V2InvasionBegin2 msg3 = TTLocalizer.V2InvasionBegin3 messages = 3 elif msgType == ToontownGlobals.V2InvasionEnd: msg1 = TTLocalizer.V2InvasionEnd1 msg2 = TTLocalizer.V2InvasionEnd2 elif msgType == ToontownGlobals.DepartmentInvasionBegin: deptNameP = SuitDNA.getDeptFullnameP(cogType) msg1 = TTLocalizer.SuitInvasionBegin1 msg2 = TTLocalizer.DepartmentInvasionBegin1 % deptNameP elif msgType == ToontownGlobals.DepartmentInvasionEnd: deptName = SuitDNA.getDeptFullname(cogType) msg1 = TTLocalizer.DepartmentInvasionEnd1 % deptName msg2 = TTLocalizer.SuitInvasionEnd2 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) return if self.invading: mult = ToontownBattleGlobals.getInvasionMultiplier() else: mult = 1 base.localAvatar.inventory.setInvasionCreditMultiplier(mult) if messages == 2: Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), name='newsManagerWait', autoPause=1).start() elif messages == 3: Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg3), name='newsManagerWait', autoPause=1).start()
def setInvasionStatus(self, msgType, cogType, numRemaining, skeleton): self.notify.info('setInvasionStatus: msgType: %s cogType: %s, numRemaining: %s, skeleton: %s' % (msgType, cogType, numRemaining, skeleton)) if msgType < ToontownGlobals.DepartmentInvasionBegin: cogName = SuitBattleGlobals.SuitAttributes[cogType]['name'] cogNameP = SuitBattleGlobals.SuitAttributes[cogType]['pluralname'] messages = 2 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 elif msgType == ToontownGlobals.SkelecogInvasionBegin: msg1 = TTLocalizer.SkelecogInvasionBegin1 msg2 = TTLocalizer.SkelecogInvasionBegin2 msg3 = TTLocalizer.SkelecogInvasionBegin3 messages = 3 elif msgType == ToontownGlobals.SkelecogInvasionEnd: msg1 = TTLocalizer.SkelecogInvasionEnd1 msg2 = TTLocalizer.SkelecogInvasionEnd2 elif msgType == ToontownGlobals.V2InvasionBegin: msg1 = TTLocalizer.V2InvasionBegin1 msg2 = TTLocalizer.V2InvasionBegin2 msg3 = TTLocalizer.V2InvasionBegin3 messages = 3 elif msgType == ToontownGlobals.V2InvasionEnd: msg1 = TTLocalizer.V2InvasionEnd1 msg2 = TTLocalizer.V2InvasionEnd2 elif msgType == ToontownGlobals.DepartmentInvasionBegin: deptNameP = SuitDNA.getDeptFullnameP(cogType) msg1 = TTLocalizer.SuitInvasionBegin1 msg2 = TTLocalizer.DepartmentInvasionBegin1 % deptNameP elif msgType == ToontownGlobals.DepartmentInvasionEnd: deptName = SuitDNA.getDeptFullname(cogType) msg1 = TTLocalizer.DepartmentInvasionEnd1 % deptName msg2 = TTLocalizer.SuitInvasionEnd2 else: self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) return if self.invading: mult = ToontownBattleGlobals.getInvasionMultiplier() else: mult = 1 base.localAvatar.inventory.setInvasionCreditMultiplier(mult) if messages == 2: Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), name='newsManagerWait', autoPause=1).start() elif messages == 3: Sequence(Wait(1.0), Func(base.localAvatar.setSystemMessage, 0, msg1), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg2), Wait(5.0), Func(base.localAvatar.setSystemMessage, 0, msg3), name='newsManagerWait', autoPause=1).start()