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)) 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 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)) 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 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.sendNetEvent('shardStatus', [self.air.ourChannel, status])
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.sendNetEvent("shardStatus", [self.air.ourChannel, status])