def createZone(self):
     HoodAI.createZone(self)
     self.air.dnaStoreMap[self.HOOD] = self.air.loadDNA(self.air.genDNAFileName(self.HOOD)).generateData()
     self.createTrolley()
     self.createTreasurePlanner()
     self.buildingMgr = DistributedBuildingMgrAI(self.air, self.HOOD, self.air.dnaStoreMap[self.HOOD], self.air.trophyMgr)
     NPCToons.createNpcsInZone(self.air, self.HOOD)
def spawn(air, zone, element, match):
    if zone % 1000 != 0:
        # This should hopefully create the Fishermen NPCs on streets.
        NPCToons.createNpcsInZone(air, zone)
    pond = DistributedFishingPondAI(air)
    area = ZoneUtil.getBranchZone(zone)
    pond.setArea(area)
    pond.generateWithRequired(zone)
    bingoMgr = DistributedPondBingoManagerAI(air)
    bingoMgr.setPondDoId(pond.getDoId())
    bingoMgr.generateWithRequired(zone)
    pond.bingoMgr = bingoMgr
    pond.bingoMgr.createGame()
    simbase.air.fishManager.ponds[zone] = pond
    
    for i in range(FishingTargetGlobals.getNumTargets(area)):
                target = DistributedFishingTargetAI(simbase.air)
                target.setPondDoId(pond.getDoId())
                target.generateWithRequired(zone)
    for child in element.children:
        if isinstance(child, DNAProp) and 'fishing_spot' in child.code:
            spot = DistributedFishingSpotAI(air)
            spot.setPondDoId(pond.getDoId())
            x, y, z = child.getPos()
            h, p, r = child.getHpr()
            spot.setPosHpr(x, y, z, h, p, r)
            spot.generateWithRequired(zone)
    def startup(self):
        HoodAI.HoodAI.startup(self)

        if simbase.config.GetBool('want-minigames', True):
            self.createTrolley()
        if simbase.config.GetBool('want-classic-chars', True):
            if simbase.config.GetBool('want-mickey', True):
                self.createClassicChar()
        if simbase.config.GetBool('want-butterflies', True):
            self.createButterflies()

        if simbase.air.wantYinYang:
            NPCToons.createNPC(
                simbase.air, 2021,
                (ToontownGlobals.ToontownCentral, TTLocalizer.NPCToonNames[2021], ('css', 'ms', 'm', 'm', 26, 0, 26, 26, 0, 27, 0, 27, 0, 27), 'm', 1, NPCToons.NPC_YIN),
                ToontownGlobals.ToontownCentral, posIndex=0)
            NPCToons.createNPC(
                simbase.air, 2022,
                (ToontownGlobals.ToontownCentral, TTLocalizer.NPCToonNames[2022], ('bss', 'ms', 'm', 'm', 0, 0, 0, 0, 0, 31, 0, 31, 0, 31), 'm', 1, NPCToons.NPC_YANG),
                ToontownGlobals.ToontownCentral, posIndex=0)

        if simbase.air.wantHalloween:
            self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air)
            self.TrickOrTreatTargetManager.generateWithRequired(2649)

        if simbase.air.wantChristmas:
            self.WinterCarolingTargetManager = DistributedWinterCarolingTargetAI.DistributedWinterCarolingTargetAI(self.air)
            self.WinterCarolingTargetManager.generateWithRequired(2649)

        if simbase.config.GetBool('want-experiment-event'):
            self.createExperimentEvent()
    def setVictors(self, victorIds):
        DistributedFactoryAI.DistributedFactoryAI.setVictors(self, victorIds)

        activeVictors = []
        for victorId in victorIds:
            toon = self.air.doId2do.get(victorId)
            if toon is not None:
                activeVictors.append(toon)
        npcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 3))
        for toon in activeVictors:
            toon.attemptAddNPCFriend(npcId)
            toon.d_setSystemMessage(0, 'You got a %s SOS card.' % (NPCToons.getNPCName(npcId)))
 def __makeShopOwnerNpc(self):
     if self.shopOwnerNpc:
         return
     self.shopOwnerNpc = NPCToons.createLocalNPC(self.shopOwnerNpcId)
     if not self.shopOwnerNpc:
         self.notify.warning('No shopkeeper in this cogdominium, using FunnyFarm Sellbot FO NPCToons')
         random.seed(self.doId)
         shopkeeper = random.randint(7001, 7009)
         self.shopOwnerNpc = NPCToons.createLocalNPC(shopkeeper)
     self.shopOwnerNpc.addActive()
     self.shopOwnerNpc.reparentTo(self.cage)
     self.shopOwnerNpc.setPosHpr(0, -2, 0, 180, 0, 0)
     self.shopOwnerNpc.loop('neutral')
 def __init__(self, air, zones, avId):
     FSM.__init__(self, 'TutorialFSM')
     self.avId = avId
     self.zones = zones
     self.air = air
     npcDesc = NPCToons.NPCToonDict.get(20000)
     self.tom = NPCToons.createNPC(self.air, 20000, npcDesc, self.zones.shop, 0)
     self.tom.setTutorial(1)
     npcDesc = NPCToons.NPCToonDict.get(20002)
     self.harry = NPCToons.createNPC(self.air, 20002, npcDesc, self.zones.hq, 0)
     self.harry.setTutorial(1)
     self.building = ToontorialBuildingAI(self.air, zones.street, zones.shop, self.tom.getDoId())
     self.hq = HQBuildingAI(self.air, zones.street, zones.hq, 1)
     self.forceTransition('Introduction')
 def createCogHeadquarters(self):
     NPCToons.generateZone2NpcDict()
     if self.config.GetBool('want-sellbot-headquarters', True):
         self.factoryMgr = FactoryManagerAI.FactoryManagerAI(self)
         self.cogHeadquarters.append(SellbotHQAI.SellbotHQAI(self))
     if self.config.GetBool('want-cashbot-headquarters', True):
         self.mintMgr = MintManagerAI.MintManagerAI(self)
         self.cogHeadquarters.append(CashbotHQAI.CashbotHQAI(self))
     if self.config.GetBool('want-lawbot-headquarters', True):
         self.lawOfficeMgr = LawOfficeManagerAI.LawOfficeManagerAI(self)
         self.cogHeadquarters.append(LawbotHQAI.LawbotHQAI(self))
     if self.config.GetBool('want-bossbot-headquarters', True):
         self.countryClubMgr = CountryClubManagerAI.CountryClubManagerAI(self)
         self.cogHeadquarters.append(BossbotHQAI.BossbotHQAI(self))
Exemple #8
0
 def createFishingPonds(self):
     self.fishingPonds = []
     fishingPondGroups = []
     for zoneId in self.getZoneTable():
         dnaData = self.air.dnaDataMap.get(zoneId, None)
         if dnaData.getName() == 'root':
             area = ZoneUtil.getCanonicalZoneId(zoneId)
             (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area)
             self.fishingPonds.extend(foundFishingPonds)
             fishingPondGroups.extend(foundFishingPondGroups)
     for fishingPond in self.fishingPonds:
         NPCToons.createNpcsInZone(self.air, fishingPond.zoneId)
     fishingSpots = []
     for (dnaGroup, fishingPond) in zip(fishingPondGroups, self.fishingPonds):
         fishingSpots.extend(self.findFishingSpots(dnaGroup, fishingPond))
 def __makeShopOwnerNpc(self):
     if self.shopOwnerNpc:
         return
     self.shopOwnerNpc = NPCToons.createLocalNPC(self.shopOwnerNpcId)
     if not self.shopOwnerNpc:
         self.notify.warning(
             'No shopkeeper in this cogdominium, using FunnyFarm Sellbot FO NPCToons'
         )
         random.seed(self.doId)
         shopkeeper = random.randint(7001, 7009)
         self.shopOwnerNpc = NPCToons.createLocalNPC(shopkeeper)
     self.shopOwnerNpc.addActive()
     self.shopOwnerNpc.reparentTo(self.cage)
     self.shopOwnerNpc.setPosHpr(0, -2, 0, 180, 0, 0)
     self.shopOwnerNpc.loop('neutral')
Exemple #10
0
 def createCogHeadquarters(self):
     NPCToons.generateZone2NpcDict()
     if self.config.GetBool('want-sellbot-headquarters', True):
         self.factoryMgr = FactoryManagerAI.FactoryManagerAI(self)
         self.cogHeadquarters.append(SellbotHQAI.SellbotHQAI(self))
     if self.config.GetBool('want-cashbot-headquarters', True):
         self.mintMgr = MintManagerAI.MintManagerAI(self)
         self.cogHeadquarters.append(CashbotHQAI.CashbotHQAI(self))
     if self.config.GetBool('want-lawbot-headquarters', True):
         self.lawOfficeMgr = LawOfficeManagerAI.LawOfficeManagerAI(self)
         self.cogHeadquarters.append(LawbotHQAI.LawbotHQAI(self))
     if self.config.GetBool('want-bossbot-headquarters', True):
         self.countryClubMgr = CountryClubManagerAI.CountryClubManagerAI(
             self)
         self.cogHeadquarters.append(BossbotHQAI.BossbotHQAI(self))
    def generate(self):
        DistributedObject.DistributedObject.generate(self)
        self.interior = loader.loadModel(
            'phase_3.5/models/modules/HQ_interior')
        self.interior.reparentTo(render)
        self.interior.find('**/cream').hide()
        self.interior.find('**/crashed_piano').hide()
        self.interior.find('**/periscope').hide()

        self.buildLeaderBoard()
        self.pillar = loader.loadModel('phase_3.5/models/props/HQ_pillar')
        self.pillar.reparentTo(render)
        self.periscope = Actor(
            'phase_3.5/models/props/HQ_periscope-base-mod',
            {'anim': 'phase_3.5/models/props/HQ_periscope-base-chan'})
        self.periscope.setPos(-5.25, 30.2, 6.5)
        self.periscope.setScale(0.75)
        self.periscope.setBlend(frameBlend=True)
        self.coolNPC = NPCToons.createLocalNPC(1069)
        self.coolNPC.setPickable(0)
        self.coolNPC.setPos(-5.25, 32.45, 5.45)
        self.coolNPC.setH(180)
        self.coolNPC.addActive()
        self.coolNPC.startBlink()
        self.periscope.loop('anim')
        self.coolNPC.loop('periscope')
        self.periscope.reparentTo(render)
        self.coolNPC.reparentTo(render)
def findToonAttack(toons, attacks, track):
    foundAttacks = []
    for t in toons:
        if attacks.has_key(t):
            attack = attacks[t]
            local_track = attack[TOON_TRACK_COL]
            if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS:
                local_track = NPCToons.getNPCTrack(attack[TOON_TGT_COL])
            if local_track == track:
                if local_track == FIRE:
                    canFire = 1
                    for attackCheck in foundAttacks:
                        if attackCheck[TOON_TGT_COL] == attack[TOON_TGT_COL]:
                            canFire = 0

                    if canFire:
                        foundAttacks.append(attack)
                else:
                    foundAttacks.append(attack)

    def compFunc(a, b):
        if a[TOON_LVL_COL] > b[TOON_LVL_COL]:
            return 1
        elif a[TOON_LVL_COL] < b[TOON_LVL_COL]:
            return -1
        return 0

    foundAttacks.sort(compFunc)
    return foundAttacks
Exemple #13
0
    def __init__(self, cr):
        DistributedObject.__init__(self, cr)

        # I'm debating whether to make this class depend on FSM

        # Let's create the ducktank
        self.ducktank = loader.loadModel('phase_6/models/events/ttr_m_tf_ducktank')
        self.ducktank.reparentTo(base.render)
        self.ducktank.setPos(170.29, -332.146, 8)
        self.ducktank.setH(180)

        self.target = self.ducktank.find('**/target')

        # A Different Toon XD
        self.Slappy = NPCToons.createLocalNPC(99996)
        self.Slappy.reparentTo(self.ducktank.find('**/tank_seat'))
        self.Slappy.setH(180)
        self.Slappy.setPos(0, -1.80, -0.40)
        self.Slappy.loop('periscope')

        # This is to ensure no Z-Fighting takes place 
        self.Slappy.getGeomNode().setDepthWrite(1)
        self.Slappy.getGeomNode().setDepthTest(1)

        # This is so that pies can hit the target
        self.target.setTag('pieCode', str(ToontownGlobals.PieCodeNotBossCog))
        self.accept('pieSplat', self.__hitTarget)
    def load(self):
        SafeZoneLoader.SafeZoneLoader.load(self)
        self.seagullSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_Seagull.ogg')
        self.underwaterSound = base.loadSfx('phase_4/audio/sfx/AV_ambient_water.ogg')
        self.swimSound = base.loadSfx('phase_4/audio/sfx/AV_swim_single_stroke.ogg')
        self.submergeSound = base.loadSfx('phase_5.5/audio/sfx/AV_jump_in_water.ogg')
        self.boat = self.geom.find('**/donalds_boat')
        self.dockSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_dockcreak.ogg')
        self.foghornSound = base.loadSfx('phase_5/audio/sfx/SZ_DD_foghorn.ogg')
        self.bellSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_shipbell.ogg')
        self.waterSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.ogg')

        if not self.boat.isEmpty():
            wheel = self.boat.find('**/wheel')

            if not wheel.isEmpty():
                wheel.hide()

            self.boat.stash()
            self.donald = NPCToons.createLocalNPC(7011)

            self.donald.setPos(0, -1, 3.95)
            self.donald.reparentTo(self.boat)
            self.donald.setHat(48, 0, 0)
            
            random.shuffle(TTLocalizer.DonaldChatter)
            self.donaldSpeech = self.donald.createTalkSequence(TTLocalizer.DonaldChatter, 15)
            self.donaldSpeech.loop(0)
Exemple #15
0
    def createShop(self, streetZone, shopZone, hqZone):
        shopInterior = DistributedTutorialInteriorAI(2, self.air, shopZone)

        desc = NPCToons.NPCToonDict.get(20000)
        npc = NPCToons.createNPC(self.air, 20000, desc, shopZone)
        npc.setTutorial(1)
        shopInterior.setTutorialNpcId(npc.doId)
        shopInterior.generateWithRequired(shopZone)

        extShopDoor = DistributedDoorAI.DistributedDoorAI(
            self.air,
            2,
            DoorTypes.EXT_STANDARD,
            lockValue=FADoorCodes.DEFEAT_FLUNKY_TOM)
        intShopDoor = DistributedDoorAI.DistributedDoorAI(
            self.air,
            2,
            DoorTypes.INT_STANDARD,
            lockValue=FADoorCodes.TALK_TO_TOM)
        extShopDoor.setOtherDoor(intShopDoor)
        intShopDoor.setOtherDoor(extShopDoor)
        extShopDoor.zoneId = streetZone
        intShopDoor.zoneId = shopZone
        extShopDoor.generateWithRequired(streetZone)
        extShopDoor.sendUpdate('setDoorIndex', [extShopDoor.getDoorIndex()])
        intShopDoor.generateWithRequired(shopZone)
        intShopDoor.sendUpdate('setDoorIndex', [intShopDoor.getDoorIndex()])

        self.accept('intShopDoor-{0}'.format(shopZone),
                    intShopDoor.setDoorLock)
        self.accept('extShopDoor-{0}'.format(streetZone),
                    extShopDoor.setDoorLock)
    def updateQuestInfo(self):
        for marker in self.buildingMarkers:
            marker.destroy()

        self.buildingMarkers = []
        dnaData = base.cr.playGame.dnaData
        for questIndex in self.av.questPage.quests.keys():
            questDesc = self.av.questPage.quests.get(questIndex)
            if questDesc is None:
                continue
            mapIndex = questIndex + 1
            questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
            quest = Quests.getQuest(questId)
            fComplete = quest.getCompletionStatus(self.av, questDesc) == Quests.COMPLETE
            if not fComplete:
                if quest.getType() == Quests.RecoverItemQuest:
                    if quest.getHolder() == Quests.AnyFish:
                        self.putBuildingMarker(self.fishingSpotInfo, mapIndex=mapIndex)
                    continue
                elif quest.getType() != Quests.DeliverGagQuest and quest.getType() != Quests.DeliverItemQuest and quest.getType() != Quests.VisitQuest and quest.getType() != Quests.TrackChoiceQuest:
                    continue
            if toNpcId == Quests.ToonHQ:
                self.putBuildingMarker(self.hqPosInfo, mapIndex=mapIndex)
            else:
                npcZone = NPCToons.getNPCZone(toNpcId)
                hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
                branchId = ZoneUtil.getCanonicalBranchZone(npcZone)
                if self.hoodId == hoodId and self.zoneId == branchId:
                    for blockId, block in dnaData.getBlocks():
                        zone = block.zone
                        branchZone = zone - zone % 100
                        finalZone = branchZone + 500 + blockId
                        if npcZone == finalZone:
                            building = block.node
                            self.putBuildingMarker(Point3(building.getPos()), building.getHpr(), mapIndex=mapIndex)
    def setup(self, blockNumber):
        self.kartShopInterior = DistributedKartShopInteriorAI(
            blockNumber, self.air, self.interiorZone)
        self.kartShopInterior.generateWithRequired(self.interiorZone)

        self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)

        self.outsideDoor0 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=1)
        self.outsideDoor1 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=2)
        self.insideDoor0 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_KS, doorIndex=1)
        self.insideDoor1 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_KS, doorIndex=2)
        self.outsideDoor0.setOtherDoor(self.insideDoor0)
        self.outsideDoor1.setOtherDoor(self.insideDoor1)
        self.insideDoor0.setOtherDoor(self.outsideDoor0)
        self.insideDoor1.setOtherDoor(self.outsideDoor1)
        self.outsideDoor0.zoneId = self.exteriorZone
        self.outsideDoor1.zoneId = self.exteriorZone
        self.insideDoor0.zoneId = self.interiorZone
        self.insideDoor1.zoneId = self.interiorZone
        self.outsideDoor0.generateWithRequired(self.exteriorZone)
        self.outsideDoor1.generateWithRequired(self.exteriorZone)
        self.insideDoor0.generateWithRequired(self.interiorZone)
        self.insideDoor1.generateWithRequired(self.interiorZone)
        self.outsideDoor0.sendUpdate('setDoorIndex', [self.outsideDoor0.getDoorIndex()])
        self.outsideDoor1.sendUpdate('setDoorIndex', [self.outsideDoor1.getDoorIndex()])
        self.insideDoor0.sendUpdate('setDoorIndex', [self.insideDoor0.getDoorIndex()])
        self.insideDoor1.sendUpdate('setDoorIndex', [self.insideDoor1.getDoorIndex()])
Exemple #18
0
    def playTutorialReward_3(self, value):
        self.tutRewardDialog_2.cleanup()
        from toontown.toon import NPCToons

        def doneChat1(page, elapsed = 0):
            self.track2.start()

        def doneChat2(elapsed):
            self.track2.pause()
            self.track3.start()

        def uniqueName(hook):
            return 'TutorialTom-' + hook

        self.tutorialTom = NPCToons.createLocalNPC(20000)
        self.tutorialTom.uniqueName = uniqueName
        if config.GetString('language', 'english') == 'japanese':
            self.tomDialogue03 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward01.ogg')
            self.tomDialogue04 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward02.ogg')
            self.tomDialogue05 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward03.ogg')
            self.musicVolume = config.GetFloat('tutorial-music-volume', 0.5)
        else:
            self.tomDialogue03 = None
            self.tomDialogue04 = None
            self.tomDialogue05 = None
            self.musicVolume = 0.9
        music = base.cr.playGame.place.loader.battleMusic
        if self.questList:
            self.track1 = Sequence(Wait(1.0), Func(self.rewardPanel.initQuestFrame, base.localAvatar, copy.deepcopy(base.localAvatar.quests)), Wait(1.0), Sequence(*self.questList), Wait(1.0), Func(self.rewardPanel.hide), Func(camera.setPosHpr, render, 34, 19.88, 3.48, -90, -2.36, 0), Func(base.localAvatar.animFSM.request, 'neutral'), Func(base.localAvatar.setPosHpr, 40.31, 22.0, -0.47, 150.0, 360.0, 0.0), Wait(0.5), Func(self.tutorialTom.reparentTo, render), Func(self.tutorialTom.show), Func(self.tutorialTom.setPosHpr, 40.29, 17.9, -0.47, 11.31, 0.0, 0.07), Func(self.tutorialTom.animFSM.request, 'TeleportIn'), Wait(1.517), Func(self.tutorialTom.animFSM.request, 'neutral'), Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat1), Func(self.tutorialTom.addActive), Func(music.setVolume, self.musicVolume), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward3, 0, None, [self.tomDialogue03]), name='tutorial-reward-3a')
            self.track2 = Sequence(Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat2), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward4, 1, None, [self.tomDialogue04]), Func(self.tutorialTom.setPlayRate, 1.5, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.5), Func(self.tutorialTom.loop, 'right-hand'), name='tutorial-reward-3b')
            self.track3 = Parallel(Sequence(Func(self.tutorialTom.setPlayRate, -1.8, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.8), Func(self.tutorialTom.animFSM.request, 'neutral'), name='tutorial-reward-3ca'), Sequence(Wait(0.5), Func(self.tutorialTom.setChatAbsolute, TTLocalizer.MovieTutorialReward5, CFSpeech | CFTimeout, self.tomDialogue05), Wait(1.0), Func(self.tutorialTom.animFSM.request, 'TeleportOut'), Wait(self.tutorialTom.getDuration('teleport')), Wait(1.0), Func(self.playTutorialReward_4, 0), name='tutorial-reward-3cb'), name='tutorial-reward-3c')
            self.track1.start()
        else:
            self.playTutorialReward_4(0)
        return
def __doNPCSOS(sos):
    npcId = sos['npcId']
    track, level, hp = NPCToons.getNPCTrackLevelHp(npcId)
    if track != None:
        return NPCSOSfn_dict[track](sos, level, hp)
    else:
        return __cogsMiss(sos, 0, 0)
Exemple #20
0
    def setup(self, blockNumber):
        self.interior = DistributedHQInteriorAI.DistributedHQInteriorAI(
            blockNumber, self.air, self.interiorZone)
        self.interior.generateWithRequired(self.interiorZone)

        self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)

        door0 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=0)
        door1 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=1)
        insideDoor0 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=0)
        insideDoor1 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=1)
        door0.setOtherDoor(insideDoor0)
        insideDoor0.setOtherDoor(door0)
        door1.setOtherDoor(insideDoor1)
        insideDoor1.setOtherDoor(door1)
        door0.zoneId = self.exteriorZone
        door1.zoneId = self.exteriorZone
        insideDoor0.zoneId = self.interiorZone
        insideDoor1.zoneId = self.interiorZone
        door0.generateWithRequired(self.exteriorZone)
        door1.generateWithRequired(self.exteriorZone)
        door0.sendUpdate('setDoorIndex', [door0.getDoorIndex()])
        door1.sendUpdate('setDoorIndex', [door1.getDoorIndex()])
        insideDoor0.generateWithRequired(self.interiorZone)
        insideDoor1.generateWithRequired(self.interiorZone)
        insideDoor0.sendUpdate('setDoorIndex', [insideDoor0.getDoorIndex()])
        insideDoor1.sendUpdate('setDoorIndex', [insideDoor1.getDoorIndex()])
        self.door0 = door0
        self.door1 = door1
        self.insideDoor0 = insideDoor0
        self.insideDoor1 = insideDoor1
    def announceGenerate(self):
        PurchaseManager.PurchaseManager.announceGenerate(self)
        if self.hasLocalToon:
            self.npc = NPCToons.createLocalNPC(2011)
            self.npc.addActive()

            def getDoId():
                return 0

            self.npc.getDoId = getDoId

            def acquireDelayDelete(name):
                return serialNum()

            self.npc.acquireDelayDelete = acquireDelayDelete

            def releaseDelayDelete(token):
                pass

            self.npc.releaseDelayDelete = releaseDelayDelete

            def uniqueName(string):
                return string

            self.npc.uniqueName = uniqueName
            self.accept('gagScreenIsUp', self.playMovie)
            self.purchase = base.cr.playGame.hood.purchase
            self.purchase.enterTutorialMode(self.ownedNewbieId)
 def __init__(self, cr):
     DistributedObject.__init__(self, cr)
     FSM.__init__(self, 'ToonfestBalloonFSM')
     self.avId = 0
     self.flightPathIndex = 0
     self.balloon = loader.loadModel('phase_6/models/events/tf_balloon')
     self.balloon.reparentTo(base.render)
     self.balloon.setPos(*ToonfestBalloonGlobals.BalloonBasePosition)
     self.balloon.setH(250)
     self.balloon.setScale(ToonfestBalloonGlobals.BalloonScale)
     self.cr.parentMgr.registerParent(ToontownGlobals.SPToonfestBalloon, self.balloon)
     cs = CollisionSphere(0, 0, 0, 9)
     cs.setTangible(False)
     self.collisionNP = self.balloon.find('**/basket_wall_collision')
     self.collisionNP.node().addSolid(cs)
     self.alec = NPCToons.createLocalNPC(91915)
     self.alec.setPos(0.7, 0.7, 0.4)
     self.alec.setH(150)
     self.alec.setScale(1 / ToonfestBalloonGlobals.BalloonScale)
     self.alec.initializeBodyCollisions('toon')
     self.alec.setPickable(0)
     self.alec.addActive()
     self.alec.startBlink()
     self.alec.loop('neutral')
     self.flightPaths = ToonfestBalloonGlobals.generateFlightPaths(self)
     self.toonFlightPaths = ToonfestBalloonGlobals.generateToonFlightPaths(self)
     self.speechSequence = ToonfestBalloonGlobals.generateSpeechSequence(self)
 def cogSummonsDone(self, returnCode, suitIndex, buildingId):
     self.cancel['state'] = DGG.NORMAL
     if self.summonsType == 'building' or self.summonsType == 'cogdo':
         if returnCode == 'success':
             building = base.cr.doId2do.get(buildingId)
             dnaStore = base.cr.playGame.dnaStore
             buildingTitle = dnaStore.getTitleFromBlockNumber(
                 building.block)
             buildingInteriorZone = building.zoneId + 500 + building.block
             npcName = TTLocalizer.SummonDlgShopkeeper
             npcId = NPCToons.zone2NpcDict.get(buildingInteriorZone)
             if npcId:
                 npcName = NPCToons.getNPCName(npcId[0])
             if buildingTitle:
                 self.statusLabel[
                     'text'] = TTLocalizer.SummonDlgBldgSuccess % (
                         npcName, buildingTitle)
             else:
                 self.statusLabel[
                     'text'] = TTLocalizer.SummonDlgBldgSuccess2
         elif returnCode == 'badlocation':
             self.statusLabel['text'] = TTLocalizer.SummonDlgBldgBadLoc
         elif returnCode == 'fail':
             self.statusLabel['text'] = TTLocalizer.SummonDlgInvasionFail
         elif returnCode == 'disabled':
             self.statusLabel['text'] = TTLocalizer.SummonDlgBldgNoCogdos
     elif self.summonsType.endswith('invasion'):
         if returnCode == 'success':
             self.statusLabel['text'] = TTLocalizer.SummonDlgInvasionSuccess
         elif returnCode == 'busy':
             self.statusLabel[
                 'text'] = TTLocalizer.SummonDlgInvasionBusy % self.suitFullName
         elif returnCode == 'fail':
             self.statusLabel['text'] = TTLocalizer.SummonDlgInvasionFail
    def showChoicePoster(self, questId, fromNpcId, toNpcId, rewardId, callback):
        self.update((questId,
         fromNpcId,
         toNpcId,
         rewardId,
         0))
        quest = Quests.getQuest(questId)
        self.rewardText.show()
        self.rewardText.setZ(-0.205)
        self.questProgress.hide()
        if not hasattr(self, 'chooseButton'):
            guiButton = loader.loadModel('phase_3/models/gui/quit_button')
            self.chooseButton = DirectButton(parent=self.questFrame, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.7, 1, 1), text=TTLocalizer.QuestPageChoose, text_scale=0.06, text_pos=(0, -0.02), pos=(0.285, 0, 0.245), scale=0.65)
            guiButton.removeNode()
        npcZone = NPCToons.getNPCZone(toNpcId)
        hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
        if not base.cr.isPaid() and (questId == 401 or hasattr(quest, 'getLocation') and quest.getLocation() == 1000 or hoodId == 1000):

            def showTeaserPanel():
                TeaserPanel(pageName='getGags')

            self.chooseButton['command'] = showTeaserPanel
        else:
            self.chooseButton['command'] = callback
            self.chooseButton['extraArgs'] = [questId]
        self.unbind(DGG.WITHIN)
        self.unbind(DGG.WITHOUT)
        if not quest.getType() == Quests.TrackChoiceQuest:
            self.questInfo.setZ(-0.0625)
        return
    def __init__(self, block, air, zoneId, building):
        """blockNumber: the landmark building number (from the name)"""
        #self.air=air
        DistributedObjectAI.DistributedObjectAI.__init__(self, air)
        self.block = block
        self.zoneId = zoneId
        self.building = building
        assert (self.debugPrint(
            "DistributedToonInteriorAI(air=%s, zoneId=%s, building=%s)" %
            (air, zoneId, building)))

        # Make any npcs that may be in this interior zone
        # If there are none specified, this will just be an empty list
        self.npcs = NPCToons.createNpcsInZone(air, zoneId)

        # TODO
        #for i in range(len(self.npcs)):
        #    npc = self.npcs[i]
        #    npc.d_setIndex(i)

        self.fsm = ClassicFSM.ClassicFSM(
            'DistributedToonInteriorAI',
            [
                State.State('toon', self.enterToon, self.exitToon,
                            ['beingTakenOver']),
                State.State('beingTakenOver', self.enterBeingTakenOver,
                            self.exitBeingTakenOver, []),
                State.State('off', self.enterOff, self.exitOff, []),
            ],
            # Initial State
            'toon',
            # Final State
            'off',
        )
        self.fsm.enterInitialState()
 def createFishingPonds(self):
     self.fishingPonds = []
     fishingPondGroups = []
     for zoneId in self.getZoneTable():
         dnaData = self.air.dnaDataMap.get(zoneId, None)
         zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
         if dnaData.getName() == 'root':
             area = ZoneUtil.getCanonicalZoneId(zoneId)
             (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area)
             self.fishingPonds.extend(foundFishingPonds)
             fishingPondGroups.extend(foundFishingPondGroups)
     for fishingPond in self.fishingPonds:
         NPCToons.createNpcsInZone(self.air, fishingPond.zoneId)
     fishingSpots = []
     for (dnaGroup, fishingPond) in zip(fishingPondGroups, self.fishingPonds):
         fishingSpots.extend(self.findFishingSpots(dnaGroup, fishingPond))
 def enterTunnel(self):
     npcDesc = NPCToons.NPCToonDict.get(20001)
     self.flippy = NPCToons.createNPC(self.air, 20001, npcDesc,
                                      self.zones.street, 0)
     self.hq.insideDoor1.setDoorLock(FADoorCodes.UNLOCKED)
     self.hq.door1.setDoorLock(FADoorCodes.GO_TO_PLAYGROUND)
     self.hq.insideDoor0.setDoorLock(FADoorCodes.WRONG_DOOR_HQ)
    def generateWithRequired(self, zoneId):
        DistributedObjectAI.generateWithRequired(self, zoneId)

        self.npc = NPCToons.createNPC(self.air, self.npcId,
                                      NPCToons.NPCToonDict[self.npcId],
                                      self.zoneId)
        self.npc.setScienceFair(self)
    def setup(self, blockNumber):
        self.interior = DistributedHQInteriorAI.DistributedHQInteriorAI(
            blockNumber, self.air, self.interiorZone)
        self.interior.generateWithRequired(self.interiorZone)

        self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)

        door0 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=0)
        door1 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=1)
        insideDoor0 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=0)
        insideDoor1 = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=1)
        door0.setOtherDoor(insideDoor0)
        insideDoor0.setOtherDoor(door0)
        door1.setOtherDoor(insideDoor1)
        insideDoor1.setOtherDoor(door1)
        door0.zoneId = self.exteriorZone
        door1.zoneId = self.exteriorZone
        insideDoor0.zoneId = self.interiorZone
        insideDoor1.zoneId = self.interiorZone
        door0.generateWithRequired(self.exteriorZone)
        door1.generateWithRequired(self.exteriorZone)
        door0.sendUpdate('setDoorIndex', [door0.getDoorIndex()])
        door1.sendUpdate('setDoorIndex', [door1.getDoorIndex()])
        insideDoor0.generateWithRequired(self.interiorZone)
        insideDoor1.generateWithRequired(self.interiorZone)
        insideDoor0.sendUpdate('setDoorIndex', [insideDoor0.getDoorIndex()])
        insideDoor1.sendUpdate('setDoorIndex', [insideDoor1.getDoorIndex()])
        self.door0 = door0
        self.door1 = door1
        self.insideDoor0 = insideDoor0
        self.insideDoor1 = insideDoor1
    def teleportToShop(self, npcId):
        if base.cr.playGame.getPlace().getState() != 'walk':
            return

        npcZone = NPCToons.getNPCZone(npcId)
        npcHood = ZoneUtil.getCanonicalHoodId(npcZone)
        hqZone = {2000:2520, 1000:1507, 3000:3508, 4000:4504, 5000:5502, 7000:7503, 9000:9505}

        if npcZone in (-1, 0, None):
            zoneId = base.localAvatar.getZoneId()
            if ZoneUtil.isDynamicZone(zoneId) or ZoneUtil.isCogHQZone(zoneId):
                zoneId = 2000 
            npcHood = ZoneUtil.getCanonicalHoodId(zoneId)
            npcZone = hqZone.get(npcHood, 2520)
        
        cost = ToontownGlobals.getTeleportButtonCost(npcHood)
        self.destroyDialog()
        base.cr.playGame.getPlace().setState('stopped')
        
        if base.localAvatar.getTotalMoney() < cost:
            self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.TeleportButtonNoMoney % cost, command=self.destroyDialog)
        else:
            self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.TeleportButtonConfirm % cost, command=lambda value: self.teleportToShopConfirm(npcZone, npcHood, cost, value))

        self.dialog.show()
 def loadToonJuror(self):
     self.cleanupToonJuror()
     self.toonJuror = NPCToons.createLocalNPC(
         ToontownGlobals.LawbotBossBaseJurorNpcId + self.toonJurorIndex)
     self.toonJuror.nametag3d.stash()
     self.toonJuror.nametag.destroy()
     self.toonJuror.hide()
Exemple #32
0
def findToonAttack(toons, attacks, track):
    foundAttacks = []
    for t in toons:
        if t in attacks:
            attack = attacks[t]
            local_track = attack[TOON_TRACK_COL]
            if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS:
                local_track = NPCToons.getNPCTrack(attack[TOON_TGT_COL])
            if local_track == track:
                if local_track == FIRE:
                    canFire = 1
                    for attackCheck in foundAttacks:
                        if attackCheck[TOON_TGT_COL] == attack[TOON_TGT_COL]:
                            canFire = 0

                    if canFire:
                        foundAttacks.append(attack)
                else:
                    foundAttacks.append(attack)

    def compFunc(a, b):
        if a[TOON_LVL_COL] > b[TOON_LVL_COL]:
            return 1
        elif a[TOON_LVL_COL] < b[TOON_LVL_COL]:
            return -1
        return 0

    def sortOnThird(gagLevel):  # PY3
        return gagLevel[TOON_LVL_COL]

    #foundAttacks.sort(compFunc)
    foundAttacks.sort(key=sortOnThird)  # PY3 # NJF # IMPORTANT

    return foundAttacks
Exemple #33
0
def doNPCTeleports(attacks):
    npcs = []
    npcDatas = []
    arrivals = Sequence()
    departures = Parallel()
    for attack in attacks:
        if attack.has_key('npcId'):
            npcId = attack['npcId']
            npc = NPCToons.createLocalNPC(npcId)
            if npc != None:
                npcs.append(npc)
                attack['npc'] = npc
                toon = attack['toon']
                battle = attack['battle']
                pos = toon.getPos(battle) + offset
                hpr = toon.getHpr(battle)
                npcDatas.append((npc, battle, hpr))
                arrival = teleportIn(attack, npc, pos=pos)
                arrivals.append(arrival)
                departure = teleportOut(attack, npc)
                departures.append(departure)

    turns = Parallel()
    unturns = Parallel()
    hpr = Vec3(180.0, 0, 0)
    for npc in npcDatas:
        turns.append(Func(npc[0].setHpr, npc[1], npc[2]))
        unturns.append(Func(npc[0].setHpr, npc[1], hpr))

    arrivals.append(turns)
    unturns.append(departures)
    return (arrivals, unturns, npcs)
Exemple #34
0
def __healDance(heal, hasInteractivePropHealBonus):
    npcId = 0
    if "npcId" in heal:
        npcId = heal["npcId"]
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return
    else:
        toon = heal["toon"]
    targets = heal["target"]
    ineffective = heal["sidestep"]
    level = heal["level"]
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    delay = 3.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target["toon"]
        hp = target["hp"]
        reactIval = Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus)
        if first:
            targetTrack.append(Wait(delay))
            first = 0
        targetTrack.append(reactIval)

    hat = globalPropPool.getProp("hat")
    hat2 = MovieUtil.copyProp(hat)
    hats = [hat, hat2]
    cane = globalPropPool.getProp("cane")
    cane2 = MovieUtil.copyProp(cane)
    canes = [cane, cane2]
    leftHands = toon.getLeftHands()
    rightHands = toon.getRightHands()
    dScale = 0.5
    propTrack = Sequence(
        Func(MovieUtil.showProps, hats, rightHands, Point3(0.23, 0.09, 0.69), Point3(180, 0, 0)),
        Func(MovieUtil.showProps, canes, leftHands, Point3(-0.28, 0.0, 0.14), Point3(0.0, 0.0, -150.0)),
        MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE),
        Wait(toon.getDuration("happy-dance") - 2.0 * dScale),
        MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO),
        Func(MovieUtil.removeProps, hats + canes),
    )
    mtrack = Parallel(
        propTrack, ActorInterval(toon, "happy-dance"), __getSoundTrack(level, 0.2, duration=6.4, node=toon), targetTrack
    )
    track.append(Func(toon.loop, "neutral"))
    track.append(Wait(0.1))
    track.append(mtrack)
    if npcId != 0:
        track.append(MovieNPCSOS.teleportOut(heal, toon))
    else:
        track.append(__returnToBase(heal))
    for target in targets:
        targetToon = target["toon"]
        track.append(Func(targetToon.clearChat))

    return track
def findToonAttack(toons, attacks, track):
    foundAttacks = []
    for t in toons:
        if t in attacks:
            attack = attacks[t]
            local_track = attack[TOON_TRACK_COL]
            if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS:
                local_track = NPCToons.getNPCTrack(attack[TOON_TGT_COL])
            if local_track == track:
                if local_track == FIRE:
                    canFire = 1
                    for attackCheck in foundAttacks:
                        if attackCheck[TOON_TGT_COL] == attack[TOON_TGT_COL]:
                            canFire = 0

                    if canFire:
                        foundAttacks.append(attack)
                else:
                    foundAttacks.append(attack)

    def compFunc(a, b):
        if a[TOON_LVL_COL] > b[TOON_LVL_COL]:
            return 1
        elif a[TOON_LVL_COL] < b[TOON_LVL_COL]:
            return -1
        return 0

    foundAttacks.sort(compFunc)
    return foundAttacks
 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 returnCode == "success":
             building = base.cr.doId2do.get(buildingId)
             buildingTitle = base.cr.playGame.dnaData.getBlock(building.block).title
             buildingInteriorZone = building.zoneId + 500 + building.block
             npcName = TTLocalizer.SummonDlgShopkeeper
             npcId = NPCToons.zone2NpcDict.get(buildingInteriorZone)
             if npcId:
                 npcName = NPCToons.getNPCName(npcId[0])
             if buildingTitle:
                 self.statusLabel["text"] = TTL.SummonDlgBldgSuccess % (npcName, buildingTitle)
             else:
                 self.statusLabel["text"] = TTL.SummonDlgBldgSuccess2
         elif returnCode == "badlocation":
             self.statusLabel["text"] = TTL.SummonDlgBldgBadLoc
         elif returnCode == "fail":
             self.statusLabel["text"] = TTL.SummonDlgInvasionFail
     elif self.summonsType == "invasion":
         if returnCode == "success":
             self.statusLabel["text"] = TTL.SummonDlgInvasionSuccess
         elif returnCode == "busy":
             self.statusLabel["text"] = TTL.SummonDlgInvasionBusy % self.suitFullName
         elif returnCode == "fail":
             self.statusLabel["text"] = TTL.SummonDlgInvasionFail
    def enterTunnel(self):
        npcDesc = NPCToons.NPCToonDict.get(20001)
        self.flippy = NPCToons.createNPC(self.air, 20001, npcDesc, self.zones.street, 0)

        self.hq.insideDoor1.setDoorLock(FADoorCodes.UNLOCKED)
        self.hq.door1.setDoorLock(FADoorCodes.GO_TO_PLAYGROUND)
        self.hq.insideDoor0.setDoorLock(FADoorCodes.WRONG_DOOR_HQ)
Exemple #38
0
def __doSprinkle(attack, recipients, hp = 0):
    toon = NPCToons.createLocalNPC(attack['npcId'])
    if toon == None:
        return
    targets = attack[recipients]
    level = 4
    battle = attack['battle']
    track = Sequence(teleportIn(attack, toon))

    def face90(target, toon, battle):
        vec = Point3(target.getPos(battle) - toon.getPos(battle))
        vec.setZ(0)
        temp = vec[0]
        vec.setX(-vec[1])
        vec.setY(temp)
        targetPoint = Point3(toon.getPos(battle) + vec)
        toon.headsUp(battle, targetPoint)

    delay = 2.5
    effectTrack = Sequence()
    for target in targets:
        sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray')
        dropEffect = BattleParticles.createParticleEffect(file='pixieDrop')
        explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode')
        poofEffect = BattleParticles.createParticleEffect(file='pixiePoof')
        wallEffect = BattleParticles.createParticleEffect(file='pixieWall')
        mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=3.1, node=toon), Sequence(Func(face90, target, toon, battle), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp)))
        effectTrack.append(mtrack)

    track.append(effectTrack)
    track.append(Func(toon.setHpr, Vec3(180.0, 0.0, 0.0)))
    track.append(teleportOut(attack, toon))
    return track
Exemple #39
0
    def setup(self, blockNumber):
        # The interior
        self.interior = DistributedPetshopInteriorAI.DistributedPetshopInteriorAI(
            blockNumber, self.air, self.interiorZone)

        self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)

        seeds = self.air.petMgr.getAvailablePets(1, len(self.npcs))
        #for i in range(len(self.npcs)):
        #    self.wanderingPets = self.createPet(self.npcs[i].doId, seeds[i])

        self.interior.generateWithRequired(self.interiorZone)
        # Outside door
        door = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber,
                                                   DoorTypes.EXT_STANDARD)
        # Inside door
        insideDoor = DistributedDoorAI.DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_STANDARD)
        # Tell them about each other:
        door.setOtherDoor(insideDoor)
        insideDoor.setOtherDoor(door)
        # Put them in the right zones
        door.zoneId = self.exteriorZone
        insideDoor.zoneId = self.interiorZone
        # Now that they both now about each other, generate them:
        door.generateWithRequired(self.exteriorZone)
        insideDoor.generateWithRequired(self.interiorZone)
        # keep track of them:
        self.door = door
        self.insideDoor = insideDoor
        return
Exemple #40
0
 def startup(self):
     self.createLobbyManager()
     self.createLobbyElevator()
     self.extDoor = self.makeCogHQDoor(self.lobbyZoneId, 0, 0, self.lobbyFADoorCode)
     if simbase.config.GetBool('want-boarding-groups', True):
         self.createBoardingParty()
     self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
 def startup(self):
     self.createLobbyManager()
     self.createLobbyElevator()
     self.extDoor = self.makeCogHQDoor(self.lobbyZoneId, 0, 0, self.lobbyFADoorCode)
     if simbase.config.GetBool('want-boarding-groups', True):
         self.createBoardingParty()
     self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
    def setup(self, blockNumber):
        self.kartShopInterior = DistributedKartShopInteriorAI(
            blockNumber, self.air, self.interiorZone)
        self.kartShopInterior.generateWithRequired(self.interiorZone)

        self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)

        self.outsideDoor0 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=1)
        self.outsideDoor1 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=2)
        self.insideDoor0 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_KS, doorIndex=1)
        self.insideDoor1 = DistributedDoorAI(
            self.air, blockNumber, DoorTypes.INT_KS, doorIndex=2)
        self.outsideDoor0.setOtherDoor(self.insideDoor0)
        self.outsideDoor1.setOtherDoor(self.insideDoor1)
        self.insideDoor0.setOtherDoor(self.outsideDoor0)
        self.insideDoor1.setOtherDoor(self.outsideDoor1)
        self.outsideDoor0.zoneId = self.exteriorZone
        self.outsideDoor1.zoneId = self.exteriorZone
        self.insideDoor0.zoneId = self.interiorZone
        self.insideDoor1.zoneId = self.interiorZone
        self.outsideDoor0.generateWithRequired(self.exteriorZone)
        self.outsideDoor1.generateWithRequired(self.exteriorZone)
        self.insideDoor0.generateWithRequired(self.interiorZone)
        self.insideDoor1.generateWithRequired(self.interiorZone)
        self.outsideDoor0.sendUpdate('setDoorIndex', [self.outsideDoor0.getDoorIndex()])
        self.outsideDoor1.sendUpdate('setDoorIndex', [self.outsideDoor1.getDoorIndex()])
        self.insideDoor0.sendUpdate('setDoorIndex', [self.insideDoor0.getDoorIndex()])
        self.insideDoor1.sendUpdate('setDoorIndex', [self.insideDoor1.getDoorIndex()])
Exemple #43
0
    def showChoicePoster(self, questId, fromNpcId, toNpcId, rewardId, callback):
        self.update((questId,
         fromNpcId,
         toNpcId,
         rewardId,
         0))
        quest = Quests.getQuest(questId)
        self.rewardText.show()
        self.rewardText.setZ(-0.205)
        self.questProgress.hide()
        if not hasattr(self, 'chooseButton'):
            guiButton = loader.loadModel('phase_3/models/gui/quit_button')
            self.chooseButton = DirectButton(parent=self.questFrame, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.7, 1, 1), text=TTLocalizer.QuestPageChoose, text_scale=0.06, text_pos=(0, -0.02), pos=(0.285, 0, 0.245), scale=0.65)
            guiButton.removeNode()
        npcZone = NPCToons.getNPCZone(toNpcId)
        hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
        if not base.cr.isPaid() and (questId == 401 or hasattr(quest, 'getLocation') and quest.getLocation() == 1000 or hoodId == 1000):

            def showTeaserPanel():
                TeaserPanel(pageName='getGags')

            self.chooseButton['command'] = showTeaserPanel
        else:
            self.chooseButton['command'] = callback
            self.chooseButton['extraArgs'] = [questId]
        self.unbind(DGG.WITHIN)
        self.unbind(DGG.WITHOUT)
        if not quest.getType() == Quests.TrackChoiceQuest:
            self.questInfo.setZ(-0.0625)
        return
Exemple #44
0
def __doSprinkle(attack, recipients, hp = 0):
    toon = NPCToons.createLocalNPC(attack['npcId'])
    if toon == None:
        return
    targets = attack[recipients]
    level = 4
    battle = attack['battle']
    track = Sequence(teleportIn(attack, toon))

    def face90(target, toon, battle):
        vec = Point3(target.getPos(battle) - toon.getPos(battle))
        vec.setZ(0)
        temp = vec[0]
        vec.setX(-vec[1])
        vec.setY(temp)
        targetPoint = Point3(toon.getPos(battle) + vec)
        toon.headsUp(battle, targetPoint)

    delay = 2.5
    effectTrack = Sequence()
    for target in targets:
        sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray')
        dropEffect = BattleParticles.createParticleEffect(file='pixieDrop')
        explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode')
        poofEffect = BattleParticles.createParticleEffect(file='pixiePoof')
        wallEffect = BattleParticles.createParticleEffect(file='pixieWall')
        mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=3.1, node=toon), Sequence(Func(face90, target, toon, battle), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp)))
        effectTrack.append(mtrack)

    track.append(effectTrack)
    track.append(Func(toon.setHpr, Vec3(180.0, 0.0, 0.0)))
    track.append(teleportOut(attack, toon))
    return track
 def load(self):
     SafeZoneLoader.load(self)
     self.flippy = NPCToons.createLocalNPC(2001)
     self.flippy.reparentTo(render)
     self.flippy.setPickable(0)
     self.flippy.setPos(188, -260, 11.187)
     self.flippy.setH(108.411)
     self.flippy.initializeBodyCollisions('toon')
     self.flippy.addActive()
     self.flippy.startBlink()
     # Just keeping things relevant to 2.5.2, keeping away from TTR and TTO phrases...
     self.flippyBlatherSequence = Sequence(Wait(10), Func(self.flippy.setChatAbsolute, 'Hello and welcome Toons, far and wide!', CFSpeech | CFTimeout), Func(self.flippy.play, 'wave'), Func(self.flippy.loop, 'neutral'), Wait(12), Func(self.flippy.setChatAbsolute, "It's been a great time at Toontown, with you helping us stop the Cogs from ruining the experience with their destructive bugs, and we're glad you could join us!", CFSpeech | CFTimeout), Wait(10), Func(self.flippy.setChatAbsolute, "Oh, don't mind the little guy back there. That's my new-found lovable yet mysterious pet, Fluffy. That's what he calls himself.", CFSpeech | CFTimeout), Wait(8), Func(self.flippy.setChatAbsolute, "He came out of nowhere...", CFSpeech | CFTimeout), Wait(13), Func(self.flippy.setChatAbsolute,  "Just when I thought Toontown couldn't be any sillier! He's a real rascal, but he already has the Cog-fighting down to a science!", CFSpeech | CFTimeout), Wait(12), Func(self.flippy.setChatAbsolute, 'Doctor Surlee says he\'s some sort of creature called a "Doodle". Funny name, right?', CFSpeech | CFTimeout), Wait(16), Func(self.flippy.setChatAbsolute, "He also says Fluffy might have some friends and we may learn more about them soon.", CFSpeech | CFTimeout), Wait(8), Func(self.flippy.setChatAbsolute, 'Anyway, what are you waiting for?', CFSpeech | CFTimeout), Wait(8), Func(self.flippy.setChatAbsolute, 'Grab some pies and go for a spin. ToonFest is in full swing!', CFSpeech | CFTimeout), Wait(13), Func(self.flippy.setChatAbsolute, 'Buddy over there has made a few mistakes at the office so I have asked him to manage the balloon ride.', CFSpeech | CFTimeout), Wait(13), Func(self.flippy.setChatAbsolute, 'Hop in the balloon with Buddy and have a ride.', CFSpeech | CFTimeout))
     self.flippyBlatherSequence.loop()
     self.fluffy = Pet.Pet()
     self.fluffy.addActive()
     self.flippy.startBlink()
     self.fluffy.setDNA(PetDNA.getRandomPetDNA())
     self.fluffy.setName('Fluffy')
     self.fluffy.setPickable(0)
     self.fluffy.reparentTo(render)
     self.fluffy.setPos(191, -263, 11.382)
     self.fluffy.setH(829)
     self.fluffy.enterNeutralHappy()
     self.fluffy.initializeBodyCollisions('pet')
     try:
         self.towerGeom = self.geom.find('**/toonfest_tower_DNARoot')
         self.base1 = self.towerGeom.find('**/base1')
         self.base2 = self.towerGeom.find('**/base2')
         self.base3 = self.towerGeom.find('**/base3')
     except:
         self.notify.warning('Something messed up loading the tower bases!')
Exemple #46
0
    def announceGenerate(self):
        PurchaseManager.PurchaseManager.announceGenerate(self)
        if self.hasLocalToon:
            self.npc = NPCToons.createLocalNPC(2011)
            self.npc.addActive()

            def getDoId():
                return 0

            self.npc.getDoId = getDoId

            def acquireDelayDelete(name):
                return serialNum()

            self.npc.acquireDelayDelete = acquireDelayDelete

            def releaseDelayDelete(token):
                pass

            self.npc.releaseDelayDelete = releaseDelayDelete

            def uniqueName(string):
                return string

            self.npc.uniqueName = uniqueName
            self.accept('gagScreenIsUp', self.playMovie)
            self.purchase = base.cr.playGame.hood.purchase
            self.purchase.enterTutorialMode(self.ownedNewbieId)
 def createNPC(self):
     if not config.GetBool('want-fnaf', False):
         return
         
     self.npc = NPCToons.createLocalNPC(357)
     self.npc.reparentTo(self.loader.geom)
     self.npc.setPos(13, -77, 0)
     self.npc.setH(180)
     
     cNode = CollisionNode('fnaf-npc')
     cNode.addSolid(CollisionSphere(0, 0, 0, 1))
     cNode.setCollideMask(ToontownGlobals.WallBitmask)
     cnp = self.npc.attachNewNode(cNode)
     
     self.accept('enterfnaf-npc', self.__handleNPC)
     
     self.panel = aspect2d.attachNewNode(CardMaker('fnaf-npc-panel').generate())
     self.panel.setTexture(loader.loadTexture('phase_9/maps/tt_fnaf_news.png'))
     self.panel.setScale(2, 1, 1.5)
     self.panel.setPos(-1, 0, -.75)
     
     guiButton = loader.loadModel('phase_3/models/gui/quit_button')
     imageList = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))
     
     playButton = DirectButton(text="Accept this job", image=imageList, relief=None, text_scale=.05,
                               command=self.__handleNPCPanelStatus, extraArgs=[1])
     exitButton = DirectButton(text=TTLocalizer.GardenDropExit, image=imageList, relief=None, text_scale=.05,
                               command=self.__handleNPCPanelStatus, extraArgs=[0])
     
     playButton.wrtReparentTo(self.panel)
     exitButton.wrtReparentTo(self.panel)
     playButton.setPos(playButton, (.69, 0, -.69))
     exitButton.setPos(exitButton, (-.69, 0, -.69))
     
     self.panel.stash()
Exemple #48
0
    def createFishingPonds(self):
        self.fishingPonds = []
        fishingPondGroups = []
        for zone in self.air.zoneTable[self.canonicalHoodId]:
            zoneId = ZoneUtil.getTrueZoneId(zone[0], self.zoneId)
            dnaData = self.air.dnaDataMap.get(zone[0], None)
            if isinstance(dnaData, DNAData):
                area = ZoneUtil.getCanonicalZoneId(zoneId)
                foundFishingPonds, foundFishingPondGroups = self.air.findFishingPonds(dnaData, zoneId, area)
                self.fishingPonds += foundFishingPonds
                fishingPondGroups += foundFishingPondGroups

        for distObj in self.fishingPonds:
            self.addDistObj(distObj)
            npcs = NPCToons.createNpcsInZone(self.air, distObj.zoneId)
            for npc in npcs:
                self.addDistObj(npc)

        fishingSpots = []
        for dnaGroup, distPond in zip(fishingPondGroups, self.fishingPonds):
            fishingSpots += self.air.findFishingSpots(dnaGroup, distPond)

        for distObj in fishingSpots:
            self.addDistObj(distObj)

        return
def __doNPCSOS(sos):
    npcId = sos['npcId']
    (track, level, hp) = NPCToons.getNPCTrackLevelHp(npcId)
    if track != None:
        return NPCSOSfn_dict[track](sos, level, hp)
    else:
        return __cogsMiss(sos, 0, 0)
    def createInitialSuitBuildings(self):
        if self.buildingMgr is None:
            return

        # If we aren't at our minimum number of buildings, let's spawn some!
        suitBlockCount = len(self.buildingMgr.getSuitBlocks())
        if suitBlockCount < self.targetNumSuitBuildings:
            for _ in xrange(self.targetNumSuitBuildings - suitBlockCount):
                blockNumber = random.choice(self.buildingMgr.getToonBlocks())
                building = self.buildingMgr.getBuilding(blockNumber)
                if building is None:
                    continue
                if NPCToons.isZoneProtected(
                        building.getExteriorAndInteriorZoneId()[1]):
                    continue
                suitName = self.air.suitInvasionManager.getInvadingCog()[0]
                if suitName is None:
                    suitName = self.defaultSuitName
                suitType = None
                suitTrack = None
                if suitName is not None:
                    suitType = SuitDNA.getSuitType(suitName)
                    suitTrack = SuitDNA.getSuitDept(suitName)
                (suitLevel, suitType, suitTrack) = self.pickLevelTypeAndTrack(
                    None, suitType, suitTrack)
                building.suitTakeOver(suitTrack, suitLevel, None)

        # Save the building manager's state:
        self.buildingMgr.save()
Exemple #51
0
 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 returnCode == 'success':
             building = base.cr.doId2do.get(buildingId)
             dnaStore = base.cr.playGame.dnaStore
             buildingTitle = dnaStore.getTitleFromBlockNumber(building.block)
             buildingInteriorZone = building.zoneId + 500 + building.block
             npcName = TTLocalizer.SummonDlgShopkeeper
             npcId = NPCToons.zone2NpcDict.get(buildingInteriorZone)
             if npcId:
                 npcName = NPCToons.getNPCName(npcId[0])
             if buildingTitle:
                 self.statusLabel['text'] = TTL.SummonDlgBldgSuccess % (npcName, buildingTitle)
             else:
                 self.statusLabel['text'] = TTL.SummonDlgBldgSuccess2
         elif returnCode == 'badlocation':
             self.statusLabel['text'] = TTL.SummonDlgBldgBadLoc
         elif returnCode == 'fail':
             self.statusLabel['text'] = TTL.SummonDlgInvasionFail
     elif self.summonsType == 'invasion':
         if returnCode == 'success':
             self.statusLabel['text'] = TTL.SummonDlgInvasionSuccess
         elif returnCode == 'busy':
             self.statusLabel['text'] = TTL.SummonDlgInvasionBusy % self.suitFullName
         elif returnCode == 'fail':
             self.statusLabel['text'] = TTL.SummonDlgInvasionFail
 def __init__(self, cr):
     DistributedObject.__init__(self, cr)
     FSM.__init__(self, 'ToonfestBalloonFSM')
     self.avId = 0
     self.flightPathIndex = 0
     self.geom = base.cr.playGame.hood.loader.geom
     self.balloon = loader.loadModel('phase_6/models/events/tf_balloon')
     self.balloon.reparentTo(self.geom)
     self.balloon.setPos(*ToonfestBalloonGlobals.BalloonBasePosition)
     self.balloon.setH(0)
     self.balloon.setScale(ToonfestBalloonGlobals.BalloonScale)
     self.cr.parentMgr.registerParent(ToontownGlobals.SPToonfestBalloon,
                                      self.balloon)
     cs = CollisionSphere(0, 0, 0, 9)
     cs.setTangible(False)
     self.collisionNP = self.balloon.find('**/basket_wall_collision')
     self.collisionNP.node().addSolid(cs)
     self.alec = None
     self.alec = NPCToons.createLocalNPC(2022)
     self.alec.setPos(0.7, 0.7, 0.4)
     self.alec.setH(150)
     self.alec.setScale(1 / ToonfestBalloonGlobals.BalloonScale)
     self.alec.initializeBodyCollisions('toon')
     self.alec.setPickable(0)
     self.alec.addActive()
     self.alec.startBlink()
     self.alec.loop('neutral')
     self.flightPaths = ToonfestBalloonGlobals.generateFlightPaths(self)
     self.toonFlightPaths = ToonfestBalloonGlobals.generateToonFlightPaths(
         self)
     self.speechSequence = ToonfestBalloonGlobals.generateSpeechSequence(
         self)
     self.laffMeter = base.localAvatar.laffMeter
     self.book = base.localAvatar.book.bookOpenButton
     return
    def announceGenerate(self):
        DistributedObject.DistributedObject.announceGenerate(self)
        self.setupDoors()
        self.interior.flattenMedium()
        emptyBoard = self.interior.find('**/empty_board')
        self.leaderBoard.reparentTo(emptyBoard.getChild(0))
        self.periscopeNPCs = [
         (2520, 15000), (2832, 15001), (2742, 15002), (2671, 15003),
         (5502, 15004), (5802, 15005), (5627, 15006), (5728, 15007),
         (1507, 15008), (1629, 15009), (3508, 15010), (4659, 15011),
         (4739, 15012), (9505, 15013), (9652, 15014)]
        for entry in self.periscopeNPCs:
            if self.zoneId == entry[0] and base.classicVisuals == 0:
                self.periscopeNPC = NPCToons.createLocalNPC(entry[1])
                self.periscopeNPC.setPickable(0)
                adjustScale = (0.85 - self.periscopeNPC.scale) * 2.5
                self.periscopeNPC.setPos(-5.25, 32.45 - adjustScale, 5.45)
                self.periscope.setZ(self.periscope.getZ() - adjustScale)
                self.periscopeNPC.setH(180)
                self.periscopeNPC.addActive()
                self.periscopeNPC.startBlink()

        if self.periscopeNPC:
            self.pillar.reparentTo(render)
            self.periscopeNPC.reparentTo(render)
            self.periscope.reparentTo(render)
            self.interior.find('**/periscope').hide()
            self.periscope.loop('anim')
            self.periscopeNPC.loop('periscope')
def doNPCTeleports(attacks):
    npcs = []
    npcDatas = []
    arrivals = Sequence()
    departures = Parallel()
    for attack in attacks:
        if 'npcId' in attack:
            npcId = attack['npcId']
            npc = NPCToons.createLocalNPC(npcId)
            if npc != None:
                npcs.append(npc)
                attack['npc'] = npc
                toon = attack['toon']
                battle = attack['battle']
                pos = toon.getPos(battle) + offset
                hpr = toon.getHpr(battle)
                npcDatas.append((npc, battle, hpr))
                arrival = teleportIn(attack, npc, pos=pos)
                arrivals.append(arrival)
                departure = teleportOut(attack, npc)
                departures.append(departure)

    turns = Parallel()
    unturns = Parallel()
    hpr = Vec3(180.0, 0, 0)
    for npc in npcDatas:
        turns.append(Func(npc[0].setHpr, npc[1], npc[2]))
        unturns.append(Func(npc[0].setHpr, npc[1], hpr))

    arrivals.append(turns)
    unturns.append(departures)
    return (arrivals, unturns, npcs)
Exemple #55
0
    def createFishingPonds(self):
        # Note: A list of fishing ponds is now maintanied for easier access
        #       when generating Pond Bingo Managers for Bingo Night.
        #       (JJT - 07/22/04)
        self.fishingPonds = []
        fishingPondGroups = []
        for zone in self.air.zoneTable[self.canonicalHoodId]:
            zoneId = ZoneUtil.getTrueZoneId(zone[0], self.zoneId)
            dnaData = self.air.dnaDataMap.get(zone[0], None)
            if isinstance(dnaData, DNAData):
                area = ZoneUtil.getCanonicalZoneId(zoneId)
                foundFishingPonds, foundFishingPondGroups = self.air.findFishingPonds(
                    dnaData, zoneId, area)
                self.fishingPonds += foundFishingPonds
                fishingPondGroups += foundFishingPondGroups
        for distObj in self.fishingPonds:
            self.addDistObj(distObj)
            # Every pond gets a fisherman
            npcs = NPCToons.createNpcsInZone(self.air, distObj.zoneId)
            # TODO-parties : Ask for clarification on this.
            # Since this creates all the NPCs in the zone, this creates the
            # party people for the party hat as well... but what if there are
            # no fishing ponds??
            for npc in npcs:
                self.addDistObj(npc)

        # Now look in the fishing pond DNAGroups for fishing spots
        fishingSpots = []
        for dnaGroup, distPond in zip(fishingPondGroups, self.fishingPonds):
            fishingSpots += self.air.findFishingSpots(dnaGroup, distPond)
        for distObj in fishingSpots:
            self.addDistObj(distObj)
    def createInitialSuitBuildings(self):
        if self.buildingMgr is None:
            return

        # If we aren't at our minimum number of buildings, let's spawn some!
        suitBlockCount = len(self.buildingMgr.getSuitBlocks())
        if suitBlockCount < self.targetNumSuitBuildings:
            for _ in xrange(self.targetNumSuitBuildings - suitBlockCount):
                blockNumber = random.choice(self.buildingMgr.getToonBlocks())
                building = self.buildingMgr.getBuilding(blockNumber)
                if building is None:
                    continue
                if NPCToons.isZoneProtected(building.getExteriorAndInteriorZoneId()[1]):
                    continue
                suitName = self.air.suitInvasionManager.getInvadingCog()[0]
                if suitName is None:
                    suitName = self.defaultSuitName
                suitType = None
                suitTrack = None
                if suitName is not None:
                    suitType = SuitDNA.getSuitType(suitName)
                    suitTrack = SuitDNA.getSuitDept(suitName)
                (suitLevel, suitType, suitTrack) = self.pickLevelTypeAndTrack(None, suitType, suitTrack)
                building.suitTakeOver(suitTrack, suitLevel, None)

        # Save the building manager's state:
        self.buildingMgr.save()
def findToonAttack(toons, attacks, track):
    """ findToonAttack(toons, attacks, track) 
        Return all attacks of the specified track sorted by increasing level
    """
    foundAttacks = []
    for t in toons:
        if (attacks.has_key(t)):
            attack = attacks[t]
            local_track = attack[TOON_TRACK_COL]
            # If it's an NPC, convert to the appropriate track
            if (track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS):
                local_track = NPCToons.getNPCTrack(attack[TOON_TGT_COL])    
            if (local_track == track):
                if local_track == FIRE:
                    canFire = 1
                    for attackCheck in foundAttacks:
                        if attackCheck[TOON_TGT_COL] == attack[TOON_TGT_COL]:
                            canFire = 0
                        else:
                            pass
                    if canFire:
                        assert(t == attack[TOON_ID_COL])
                        foundAttacks.append(attack)
                        
                else:
                    assert(t == attack[TOON_ID_COL])
                    foundAttacks.append(attack)
    def compFunc(a, b):
        if (a[TOON_LVL_COL] > b[TOON_LVL_COL]):
            return 1
        elif (a[TOON_LVL_COL] < b[TOON_LVL_COL]):
            return -1
        return 0
    foundAttacks.sort(compFunc)
    return foundAttacks