def makeSuit(self, initPointData, isChair, boss=False): bldgInfo = SuitBuildingGlobals.buildingInfo[self.hood] if self.currentFloor < self.numFloors - 1: levelRange = bldgInfo[SuitBuildingGlobals.LEVEL_RANGE] else: levelRange = bldgInfo[SuitBuildingGlobals.BOSS_LEVEL_RANGE] battlePoint = None level, availableSuits = SuitBank.chooseLevelAndGetAvailableSuits( levelRange, self.deptClass, boss) if isChair: for suit in availableSuits: if suit.getSuitType() == SuitType.B: availableSuits.remove(suit) plan = random.choice(availableSuits) suit = DistributedCogOfficeSuitAI(self.air, self, initPointData, isChair, self.hood) suit.setManager(self) suit.generateWithRequired(self.zoneId) suit.d_setHood(suit.hood) suit.b_setLevel(level) variant = Variant.NORMAL hood = self.hood if self.hood == CIGlobals.ToontownCentral: hood = CIGlobals.BattleTTC if CogBattleGlobals.hi2hi[hood] == CogBattleGlobals.WaiterHoodIndex: variant = Variant.WAITER suit.b_setSuit(plan, variant) suit.b_setPlace(self.zoneId) suit.b_setName(plan.getName()) return suit
def __makeEagle(self): if not self.air: return eagle = DistributedEagleSuitAI(self.air) eagle.setMinigame(self) eagle.generateWithRequired(self.zoneId) eagle.b_setLevel(0) eagle.b_setSuit(SuitBank.getIdFromSuit(SuitBank.LegalEagle), 3) eagle.b_setName(SuitBank.LegalEagle.getName()) eagle.b_setPlace(self.zoneId) self.eagleId2eagle[eagle.doId] = eagle
def __spawnSuit(self, task): plan = random.choice(SuitBank.getSuits()) level = 0 variant = Variant.NORMAL suit = DistributedDeliveryGameSuitAI(self.air, self) suit.generateWithRequired(self.zoneId) suit.b_setLevel(level) suit.b_setSuit(plan, variant) suit.b_setPlace(self.zoneId) suit.b_setName(plan.getName()) suit.b_setParent(CIGlobals.SPHidden) self.suits.append(suit) task.delayTime = self.getSuitSpawnTime() return task.again
def createSuit(self, anySuit = 0, levelRange = None, variant = Variant.NORMAL, plan = None): if self.isCogCountFull(): return if anySuit: if not levelRange: levelRange = CogBattleGlobals.HoodIndex2LevelRange[self.battle.getHoodIndex()] availableSuits = [] level = random.randint(levelRange[0], levelRange[1]) for suit in SuitBank.getSuits(): if level >= suit.getLevelRange()[0] and level <= suit.getLevelRange()[1]: availableSuits.append(suit) plan = random.choice(availableSuits) else: if not plan: return level = random.randint(plan.getLevelRange()[0], plan.getLevelRange()[1]) if self.battle.getHoodIndex() == CogBattleGlobals.SkeletonHoodIndex: variant = Variant.SKELETON suit = DistributedSuitAI(self.air) suit.setManager(self) suit.generateWithRequired(self.zoneId) suit.d_setHood(suit.hood) suit.b_setLevel(level) suit.b_setSuit(plan, variant) suit.b_setPlace(self.zoneId) if variant == Variant.SKELETON: suit.b_setName(CIGlobals.Skelesuit) else: suit.b_setName(plan.getName()) suit.b_setParent(CIGlobals.SPHidden) self.suits[suit.doId] = suit self.numSuits += 1 if self.numSuits == 1: if self.tournament.inTournament and self.tournament.getRound() == 1 or not self.tournament.inTournament: self.sendUpdate('newSuit', []) if self.tournament.inTournament and self.tournament.getRound() == 1: self.sendUpdate('tournamentSpawned', []) if self.getActiveInvasion(): self.suitsSpawnedThisInvasion += 1 if self.suitsSpawnedThisInvasion == 1: if not self.tournament.inTournament: self.sendUpdate('invasionSpawned', []) if plan == SuitBank.VicePresident or plan == SuitBank.LucyCrossbill: self.sendUpdate('bossSpawned', []) return suit
def setupNameTag(self, tempName = None): if not self.name and not tempName: return offset = 0.0 if self.avatarType: if self.avatarType == CIGlobals.Suit: if self.charName: offset = 0.5 z = SuitBank.getSuitByName(self.charName).getNametagZ() elif self.avatarType == CIGlobals.CChar: z = 5 elif self.avatarType == CIGlobals.Toon: offset = 0.5 else: z = 0 self.deleteNameTag() if tempName: name = tempName else: name = self.name tag = NameTag(name, self.avatarType) tag.setTextColor(tag.NameTagColors[self.avatarType]['fg']) tag.setCardColor(tag.NameTagBackgrounds['up']) self.nameTag = tag np = tag.getNodePath() np.setEffect(BillboardEffect.make(Vec3(0, 0, 1), True, False, 3.0, camera, Point3(0, 0, 0))) ToonTalker.ToonTalker.setAvatar(self, self, np) np.reparentTo(self) if self.avatarType == CIGlobals.Toon: np.setZ(self.getHeight() + offset) self.nameTag.setClickable(1) elif self.avatarType == CIGlobals.Suit or self.avatarType == CIGlobals.CChar: np.setZ(z + offset) if self.avatarType == CIGlobals.Suit: self.nameTag.setFont(CIGlobals.getSuitFont()) else: self.nameTag.setFont(CIGlobals.getToonFont()) ls = LabelScaler() ls.resize(np)
def d_setSuit(self, plan, variant = 0): if isinstance(plan, SuitPlan): plan = SuitBank.getIdFromSuit(plan) self.sendUpdate('setSuit', [plan, variant])
def createSuit(self, anySuit=0, levelRange=None, variant=Variant.NORMAL, plan=None): if self.isCogCountFull(): return if anySuit: if not levelRange: levelRange = CogBattleGlobals.HoodIndex2LevelRange[ self.battle.getHoodIndex()] availableSuits = [] level = random.choice(levelRange) for suit in SuitBank.getSuits(): if level >= suit.getLevelRange( )[0] and level <= suit.getLevelRange()[1]: availableSuits.append(suit) plan = random.choice(availableSuits) else: if not plan: return level = random.randint(plan.getLevelRange()[0], plan.getLevelRange()[1]) if self.battle.getHoodIndex( ) == CogBattleGlobals.SkeletonHoodIndex and variant == Variant.NORMAL: variant = Variant.SKELETON elif self.battle.getHoodIndex( ) == CogBattleGlobals.WaiterHoodIndex and variant == Variant.NORMAL: variant = Variant.WAITER suit = DistributedSuitAI(self.air) suit.setManager(self) suit.generateWithRequired(self.zoneId) suit.d_setHood(suit.hood) suit.b_setLevel(level) suit.b_setSuit(plan, variant) suit.b_setPlace(self.zoneId) if variant == Variant.SKELETON: suit.b_setName(CIGlobals.Skelesuit) else: suit.b_setName(plan.getName()) #suit.startPosHprBroadcast() #suit.d_clearSmoothing() #suit.d_broadcastPosHpr() suit.b_setParent(CIGlobals.SPHidden) self.suits[suit.doId] = suit self.numSuits += 1 if self.numSuits == 1: if (self.tournament.inTournament and self.tournament.getRound() == 1 or not self.tournament.inTournament): self.sendUpdate('newSuit', []) if self.tournament.inTournament and self.tournament.getRound( ) == 1: self.sendUpdate('tournamentSpawned', []) if self.getActiveInvasion(): self.suitsSpawnedThisInvasion += 1 if self.suitsSpawnedThisInvasion == 1: if not self.tournament.inTournament: self.sendUpdate('invasionSpawned', []) if plan in [SuitBank.VicePresident, SuitBank.LucyCrossbill]: self.sendUpdate('bossSpawned', []) return suit