Esempio n. 1
0
 def generate(self):
     DistributedObject.DistributedObject.generate(self)
     self.grounds = loader.loadModel('phase_6/models/events/ttr_m_tf_quizStage')
     self.grounds.reparentTo(self.geom)
     self.grounds.setPosHpr(247.54, 74.37, 4.6, 345, 0, 0)
     if base.cr.newsManager.isHolidayRunning(ToontownGlobals.TRICK_OR_TREAT) or base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN_PROPS) or base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN):
         self.quizzer = NPCToons.createLocalNPC(14108)
     else:
         self.quizzer = NPCToons.createLocalNPC(14008)
         self.quizzer.setHat(24, 0, 0)
         self.quizzer.setGlasses(17, 0, 0)
     self.quizzer.useLOD(1000)
     self.quizzer.addActive()
     npcOrigin = self.grounds.find('**/NPC_origin')
     self.quizzer.reparentTo(npcOrigin)
     self.quizzer.setH(180)
     self.quizzer.setBlend(animBlend=True)
     self.quizzer.setControlEffect('neutral', 1.0)
     self.beanBag = loader.loadModel('phase_6/models/events/ttr_m_ww_beanBag')
     self.beanBag.reparentTo(self.quizzer.rightHand)
     self.beanBag.setScale(0)
     self.beanBag.setPosHpr(0.38, -0.28, 0.29, 90, 180, 90)
     self.collider = self.grounds.find('**/ww_stage_trigger')
     self.colEventName = 'enter' + self.collider.getName()
     self.accept(self.colEventName, self.handleEnter)
     self.fenceDoor = self.grounds.find('**/fenceDoor')
     self.fenceDoor.setZ(-2.25)
     self.gui = QuizGui.QuizGui(self)
     self.fsm.request('Idle')
Esempio n. 2
0
def createToon(toonId,
               x=0,
               y=0,
               z=0,
               h=0,
               p=0,
               r=0,
               parent=render,
               anim='neutral',
               LOD=1000,
               isDisguised=False,
               suitType='f',
               coll=True):
    newToon = NPCToons.createLocalNPC(toonId)
    if not newToon:
        newToon = NPCToons.createLocalNPC(1)
    newToon.head = newToon.find('**/__Actor_head')
    if isDisguised:
        newToon.putOnSuit(suitType, False, False)
        if coll:
            collTube = CollisionTube(0, 0, 0.5, 0, 0, 4, 2)
            collNode = CollisionNode('suit')
            collNode.addSolid(collTube)
            newToon.attachNewNode(collNode)
    else:
        newToon.useLOD(LOD)
        if coll:
            newToon.initializeBodyCollisions('toon')
    newToon.setPosHpr(x, y, z, h, p, r)
    newToon.reparentTo(parent)
    newToon.loop(anim)
    return newToon
 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')
Esempio n. 4
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 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)
Esempio n. 6
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 __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 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)
Esempio n. 9
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)
Esempio n. 10
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 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!')
Esempio n. 12
0
    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 __healJuggle(heal, hasInteractivePropHealBonus):
    npcId = 0
    if 'npcId' in heal:
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon is 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 = 4.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = Func(
            __healToon,
            targetToon,
            hp,
            ineffective,
            hasInteractivePropHealBonus)
        if first == 1:
            targetTrack.append(Wait(delay))
            first = 0
        targetTrack.append(reactIval)

    cube = globalPropPool.getProp('cubes')
    cube2 = MovieUtil.copyProp(cube)
    cubes = [cube, cube2]
    hips = [
        toon.getLOD(
            toon.getLODNames()[0]).find('**/joint_hips'),
        toon.getLOD(
            toon.getLODNames()[1]).find('**/joint_hips')]
    cubeTrack = Sequence(
        Func(
            MovieUtil.showProps, cubes, hips), MovieUtil.getActorIntervals(
            cubes, 'cubes'), Func(
                MovieUtil.removeProps, cubes))
    mtrack = Parallel(
        cubeTrack, __getSoundTrack(
            level, 0.7, duration=7.7, node=toon), ActorInterval(
            toon, 'juggle'), targetTrack)
    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 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)
Esempio n. 15
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 __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 loadToonJuror(self):
     self.cleanupToonJuror()
     self.toonJuror = NPCToons.createLocalNPC(
         ToontownGlobals.LawbotBossBaseJurorNpcId + self.toonJurorIndex)
     self.toonJuror.nametag3d.stash()
     self.toonJuror.nametag.destroy()
     self.toonJuror.hide()
Esempio n. 18
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
Esempio n. 19
0
    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)
Esempio n. 20
0
 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()
Esempio n. 21
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
Esempio n. 22
0
def __healJoke(heal, hasInteractivePropHealBonus):
    npcId = 0
    if heal.has_key('npcId'):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return None
        
    else:
        toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    jokeIndex = heal['hpbonus'] % len(HealJokes.toonHealJokes)
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    tracks = Parallel()
    fSpeakPunchline = 58
    tSpeakSetup = 0.0
    tSpeakPunchline = 3.0
    dPunchLine = 3.0
    tTargetReact = tSpeakPunchline + 1.0
    dTargetLaugh = 1.5
    tRunBack = tSpeakPunchline + dPunchLine
    tDoSoundAnimation = tSpeakPunchline - float(fSpeakPunchline) / toon.getFrameRate('sound')
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [
        megaphone,
        megaphone2]
    hands = toon.getRightHands()
    dMegaphoneScale = 0.5
    tracks.append(Sequence(Wait(tDoSoundAnimation), Func(MovieUtil.showProps, megaphones, hands), MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE), Wait(toon.getDuration('sound') - 2.0 * dMegaphoneScale), MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO), Func(MovieUtil.removeProps, megaphones)))
    tracks.append(Sequence(Wait(tDoSoundAnimation), ActorInterval(toon, 'sound')))
    soundTrack = __getSoundTrack(level, 2.0, node = toon)
    tracks.append(soundTrack)
    joke = HealJokes.toonHealJokes[jokeIndex]
    tracks.append(Sequence(Wait(tSpeakSetup), Func(toon.setChatAbsolute, joke[0], CFSpeech | CFTimeout)))
    tracks.append(Sequence(Wait(tSpeakPunchline), Func(toon.setChatAbsolute, joke[1], CFSpeech | CFTimeout)))
    reactTrack = Sequence(Wait(tTargetReact))
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactTrack.append(Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus))
    
    reactTrack.append(Wait(dTargetLaugh))
    for target in targets:
        targetToon = target['toon']
        reactTrack.append(Func(targetToon.clearChat))
    
    tracks.append(reactTrack)
    if npcId != 0:
        track.append(Sequence(Wait(tRunBack), Func(toon.clearChat), *MovieNPCSOS.teleportOut(heal, toon)))
    else:
        tracks.append(Sequence(Wait(tRunBack), Func(toon.clearChat), *__returnToBase(heal)))
    track.append(tracks)
    return track
def __doSmooch(attack, hp=0):
    toon = NPCToons.createLocalNPC(attack["npcId"])
    if toon == None:
        return
    targets = attack["toons"]
    level = 2
    battle = attack["battle"]
    track = Sequence(teleportIn(attack, toon))
    lipstick = globalPropPool.getProp("lipstick")
    lipstick2 = MovieUtil.copyProp(lipstick)
    lipsticks = [lipstick, lipstick2]
    rightHands = toon.getRightHands()
    dScale = 0.5
    lipstickTrack = Sequence(
        Func(MovieUtil.showProps, lipsticks, rightHands, Point3(-0.27, -0.24, -0.95), Point3(-118, -10.6, -25.9)),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE),
        Wait(toon.getDuration("smooch") - 2.0 * dScale),
        MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO),
    )
    lips = globalPropPool.getProp("lips")
    dScale = 0.5
    tLips = 2.5
    tThrow = 115.0 / toon.getFrameRate("smooch")
    dThrow = 0.5

    def getLipPos(toon=toon):
        toon.pose("smooch", 57)
        toon.update(0)
        hand = toon.getRightHands()[0]
        return hand.getPos(render)

    effectTrack = Sequence()
    for target in targets:
        lipcopy = MovieUtil.copyProp(lips)
        lipsTrack = Sequence(
            Wait(tLips),
            Func(MovieUtil.showProp, lipcopy, render, getLipPos),
            Func(lipcopy.setBillboardPointWorld),
            LerpScaleInterval(lipcopy, dScale, Point3(3, 3, 3), startScale=MovieUtil.PNT3_NEARZERO),
            Wait(tThrow - tLips - dScale),
            LerpPosInterval(lipcopy, dThrow, Point3(target.getPos() + Point3(0, 0, target.getHeight()))),
            Func(MovieUtil.removeProp, lipcopy),
        )
        delay = tThrow + dThrow
        mtrack = Parallel(
            lipstickTrack,
            lipsTrack,
            __getSoundTrack(level, 2, node=toon),
            Sequence(ActorInterval(toon, "smooch")),
            Sequence(Wait(delay), ActorInterval(target, "conked")),
            Sequence(Wait(delay), Func(__healToon, target, hp)),
        )
        effectTrack.append(mtrack)

    effectTrack.append(Func(MovieUtil.removeProps, lipsticks))
    track.append(effectTrack)
    track.append(teleportOut(attack, toon))
    track.append(Func(target.clearChat))
    return track
Esempio n. 24
0
def __healJoke(heal, hasInteractivePropHealBonus):
    npcId = 0
    if heal.has_key('npcId'):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return None
        
    else:
        toon = heal['toon']
    targets = heal['target']
    ineffective = heal['sidestep']
    level = heal['level']
    jokeIndex = heal['hpbonus'] % len(HealJokes.toonHealJokes)
    if npcId != 0:
        track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
    else:
        track = Sequence(__runToHealSpot(heal))
    tracks = Parallel()
    fSpeakPunchline = 58
    tSpeakSetup = 0.0
    tSpeakPunchline = 3.0
    dPunchLine = 3.0
    tTargetReact = tSpeakPunchline + 1.0
    dTargetLaugh = 1.5
    tRunBack = tSpeakPunchline + dPunchLine
    tDoSoundAnimation = tSpeakPunchline - float(fSpeakPunchline) / toon.getFrameRate('sound')
    megaphone = globalPropPool.getProp('megaphone')
    megaphone2 = MovieUtil.copyProp(megaphone)
    megaphones = [
        megaphone,
        megaphone2]
    hands = toon.getRightHands()
    dMegaphoneScale = 0.5
    tracks.append(Sequence(Wait(tDoSoundAnimation), Func(MovieUtil.showProps, megaphones, hands), MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE), Wait(toon.getDuration('sound') - 2.0 * dMegaphoneScale), MovieUtil.getScaleIntervals(megaphones, dMegaphoneScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO), Func(MovieUtil.removeProps, megaphones)))
    tracks.append(Sequence(Wait(tDoSoundAnimation), ActorInterval(toon, 'sound')))
    soundTrack = __getSoundTrack(level, 2.0, node = toon)
    tracks.append(soundTrack)
    joke = HealJokes.toonHealJokes[jokeIndex]
    tracks.append(Sequence(Wait(tSpeakSetup), Func(toon.setChatAbsolute, joke[0], CFSpeech | CFTimeout)))
    tracks.append(Sequence(Wait(tSpeakPunchline), Func(toon.setChatAbsolute, joke[1], CFSpeech | CFTimeout)))
    reactTrack = Sequence(Wait(tTargetReact))
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactTrack.append(Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus))
    
    reactTrack.append(Wait(dTargetLaugh))
    for target in targets:
        targetToon = target['toon']
        reactTrack.append(Func(targetToon.clearChat))
    
    tracks.append(reactTrack)
    if npcId != 0:
        track.append(Sequence(Wait(tRunBack), Func(toon.clearChat), *MovieNPCSOS.teleportOut(heal, toon)))
    else:
        tracks.append(Sequence(Wait(tRunBack), Func(toon.clearChat), *__returnToBase(heal)))
    track.append(tracks)
    return track
Esempio n. 25
0
 def makeMeetHereSequence(self, npcId, avId):
     place = base.cr.playGame.getPlace()
     geom = place.loader.geom
     self.npc = NPCToons.createLocalNPC(npcId)
     toon = base.cr.doId2do.get(avId)
     if not toon:
         return
     self.portalSeq = Sequence(Wait(2), Func(self.npc.reparentTo, geom), Func(self.npc.setPos, 121.2, -53.5, 2.525), Func(self.npc.setH, 180), Func(self.npc.addActive), Func(self.npc.pose, 'teleport', self.npc.getNumFrames('teleport') - 1), Func(self.npc.setChatAbsolute, OTPLocalizer.TeleportGreeting % toon.getName(), CFSpeech | CFTimeout), self.npc.getTeleportInTrack(), Func(self.npc.loop, 'neutral'), Wait(1), Func(self.npc.clearChat), Wait(1), Func(self.npc.setChatAbsolute, OTPLocalizer.SpeedChatStaticTextToontown[1003], CFSpeech | CFQuicktalker | CFTimeout))
Esempio n. 26
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 __init__(self, hood, parentFSM, doneEvent):
     SafeZoneLoader.__init__(self, hood, parentFSM, doneEvent)
     self.playgroundClass = OZPlayground
     self.musicFile = 'phase_6/audio/bgm/AA_nbrhood.ogg'
     self.activityMusicFile = 'phase_6/audio/bgm/AA_SZ_activity.ogg'
     self.dnaFile = 'phase_6/dna/outdoor_zone_sz.pdna'
     self.safeZoneStorageDNAFile = 'phase_6/dna/storage_OZ_sz.pdna'
     self.beaver = NPCToons.createLocalNPC(7011)
Esempio n. 28
0
def __healDance(heal, hasInteractivePropHealBonus):
    npcId = 0
    if heal.has_key('npcId'):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return None
        
    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.23000000000000001, 0.089999999999999997, 0.68999999999999995), Point3(180, 0, 0)), Func(MovieUtil.showProps, canes, leftHands, Point3(-0.28000000000000003, 0.0, 0.14000000000000001), 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.20000000000000001, duration = 6.4000000000000004, node = toon), targetTrack)
    track.append(Func(toon.loop, 'neutral'))
    track.append(Wait(0.10000000000000001))
    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
Esempio n. 29
0
def __healDance(heal, hasInteractivePropHealBonus):
    npcId = 0
    if heal.has_key('npcId'):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return None
        
    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.23000000000000001, 0.089999999999999997, 0.68999999999999995), Point3(180, 0, 0)), Func(MovieUtil.showProps, canes, leftHands, Point3(-0.28000000000000003, 0.0, 0.14000000000000001), 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.20000000000000001, duration = 6.4000000000000004, node = toon), targetTrack)
    track.append(Func(toon.loop, 'neutral'))
    track.append(Wait(0.10000000000000001))
    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
Esempio n. 30
0
 def load(self):
     self.sceneRoot = NodePath('scene1')
     tn = TextNode('text')
     tn.setText('Flippy')
     tn.setAlign(tn.ACenter)
     self.tnnp = self.sceneRoot.attachNewNode(tn)
     self.tnnp.setPos(20, 30, 2)
     self.flippy = NPCToons.createLocalNPC(2001)
     self.flippy.reparentTo(self.sceneRoot)
     self.flippy.setPos(0, 10, -5)
     self.flippy.setH(180)
    def load(self):
        self.sceneRoot = NodePath('scene1')
        tn = TextNode('text')
        tn.setText('Flippy')
        tn.setAlign(tn.ACenter)
        self.tnnp = self.sceneRoot.attachNewNode(tn)
        self.tnnp.setPos(20, 30, 2)

        self.flippy = NPCToons.createLocalNPC(2001)
        self.flippy.reparentTo(self.sceneRoot)
        self.flippy.setPos(0, 10, -5)
        self.flippy.setH(180)
Esempio n. 32
0
 def __createToonModels(self):
     self.model_Created = 1
     self.jurorToon = NPCToons.createLocalNPC(ToontownGlobals.LawbotBossBaseJurorNpcId + self.index)
     self.toonScale = self.jurorToon.getScale()
     jurorToonParent = render.attachNewNode('toonOriginChange')
     self.jurorToon.wrtReparentTo(jurorToonParent)
     self.jurorToon.setPosHpr(0, 0, -(self.jurorToon.getHeight() / 2.0), 0, -90, 0)
     self.toonModel = jurorToonParent
     self.toonHead = ToonHead.ToonHead()
     self.toonHead.setupHead(self.jurorToon.style)
     self.toonHead.reparentTo(hidden)
     self.__loadToonInCannon()
 def __createToonModels(self):
     self.model_Created = 1
     self.jurorToon = NPCToons.createLocalNPC(ToontownGlobals.LawbotBossBaseJurorNpcId + self.index)
     self.toonScale = self.jurorToon.getScale()
     jurorToonParent = render.attachNewNode('toonOriginChange')
     self.jurorToon.wrtReparentTo(jurorToonParent)
     self.jurorToon.setPosHpr(0, 0, -(self.jurorToon.getHeight() / 2.0), 0, -90, 0)
     self.toonModel = jurorToonParent
     self.toonHead = ToonHead.ToonHead()
     self.toonHead.setupHead(self.jurorToon.style)
     self.toonHead.reparentTo(hidden)
     self.__loadToonInCannon()
Esempio n. 34
0
 def enterEvent(self, offset):
     base.localAvatar.disableSleeping()
     base.localAvatar.invPage.ignoreOnscreenHooks()
     base.localAvatar.questPage.ignoreOnscreenHooks()
     self.hideTunnel()
     self.eventInterval = Sequence(Wait(2), Func(NodePath(self.book).hide), Func(NodePath(self.laffMeter).hide), Func(base.localAvatar.obscureFriendsListButton, 1), Func(base.localAvatar.hideClarabelleGui), Func(base.localAvatar.invPage.ignoreOnscreenHooks), Func(base.localAvatar.questPage.ignoreOnscreenHooks), Func(self.newsky.reparentTo, camera), Func(self.beginSkySequence.start), Wait(6), Func(self.resetCameraFollow), Wait(8), Func(base.localAvatar.displayTalk, "Sure is smoggy around 'ere. The skies are getting darker too!"))
     self.handleCoachZ = Sequence(Func(self.newsky.reparentTo, camera), Func(self.beginSkySequence2.start), Wait(2), Func(NodePath(self.book).hide), Func(base.localAvatar.obscureFriendsListButton, 1), Func(base.localAvatar.hideClarabelleGui), Func(base.localAvatar.invPage.ignoreOnscreenHooks), Func(base.localAvatar.questPage.ignoreOnscreenHooks), Func(NodePath(base.marginManager).hide), Func(self.newsky.reparentTo, camera), Func(self.beginSkySequence2.start), Func(base.localAvatar.displayTalk, "What's going on?"), Wait(3), Func(base.localAvatar.disableAvatarControls), Func(self.doCogStuff))
     self.handleGyro = Sequence(Func(self.newsky.reparentTo, camera), Func(self.beginSkySequence2.start), Func(base.localAvatar.brickLay, 'daisygardens'), Wait(2), Func(base.localAvatar.disableAvatarControls), Func(base.localAvatar.invPage.ignoreOnscreenHooks), Func(base.localAvatar.questPage.ignoreOnscreenHooks), Func(base.localAvatar.stopUpdateSmartCamera), Func(base.localAvatar.shutdownSmartCamera), Func(base.camera.wrtReparentTo, base.localAvatar), Func(base.camera.setPosHpr, 0, 15, 3, 180, 0, 0), Func(base.localAvatar.setPosHpr, 15.242, 102.481, -0.475, 45.352, 0, 0), Wait(1), Func(base.localAvatar.loop, 'run'), Func(base.localAvatar.displayTalk, 'Oh no, why is it all dark now?'), base.localAvatar.posHprInterval(6, (-22.985,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           140.242,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           -0.475), (45.352,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     0)), Func(base.localAvatar.loop, 'neutral'), Func(base.localAvatar.brickLay, 'none'), Func(base.localAvatar.attachCamera), Func(base.localAvatar.initializeSmartCamera), Func(base.localAvatar.startUpdateSmartCamera), Func(base.localAvatar.enableAvatarControls))
     if base.cr.currentEpisode == 'prologue':
         self.eventInterval.start()
         self.eventInterval.setT(offset)
     if base.cr.currentEpisode == 'squirting_flower':
         self.handleCoachZ.start()
         self.handleCoachZ.setT(offset)
     if base.cr.currentEpisode == 'gyro_tale':
         self.handleGyro.start()
         self.handleGyro.setT(offset)
         self.dimm = NPCToons.createLocalNPC(2018)
         self.dimm.useLOD(1000)
         self.dimm.head = self.dimm.find('**/__Actor_head')
         self.dimm.initializeBodyCollisions('toon')
         self.dimm.setPosHpr(-322.91, 295.469, -0.284, 216.599, 0, 0)
         self.dimm.reparentTo(render)
         self.dimm.loop('neutral')
         self.dimm.addActive()
         self.prepostera = NPCToons.createLocalNPC(2020)
         self.prepostera.useLOD(1000)
         self.prepostera.head = self.prepostera.find('**/__Actor_head')
         self.prepostera.initializeBodyCollisions('toon')
         self.prepostera.setPosHpr(-325.829, 292.584, -0.284, 216.599, 0, 0)
         self.prepostera.setScale(1.2)
         self.prepostera.reparentTo(render)
         self.prepostera.loop('neutral')
         self.prepostera.addActive()
         self.warn = Sequence(Wait(15), Func(self.prepostera.setChatAbsolute, 'Gyro, the Robot has gone bonkers!', CFSpeech | CFTimeout), Wait(6.9), Func(self.dimm.setChatAbsolute, "Don't go inside- it has Scrooge!", CFSpeech | CFTimeout), Wait(10))
         self.warn.loop()
Esempio n. 35
0
 def generate(self):
     self.toon = NPCToons.createLocalNPC(2222)
     self.toon.useLOD(1000)
     self.toon.head = self.toon.find('**/__Actor_head')
     self.toon.initializeBodyCollisions('toon')
     self.toon.setPosHpr(64.03, 12.352, 0.095, 274.359, 0, 0)
     self.toon.reparentTo(render)
     self.toon.loop('loop-dig')
     self.toon.addActive()
     self.shovel = loader.loadModel(self.shovelModelPath).find('**/shovelD')
     self.shovel.reparentTo(self.toon.find('**/rightHand'))
     self.shovel.setH(-90)
     self.shovel.setP(216)
     self.shovel.setX(0.2)
     self.cone = loader.loadModel(self.coneModelPath)
     self.cone.reparentTo(render)
     self.cone.setPosHpr(57.029, 18.531, 0.095, 45, 0, 0)
     self.cone2 = loader.loadModel(self.coneModelPath)
     self.cone2.reparentTo(render)
     self.cone2.setPosHpr(57.015, 12.556, 0.095, 135, 0, 0)
     self.cone3 = loader.loadModel(self.coneModelPath)
     self.cone3.reparentTo(render)
     self.cone3.setPosHpr(57.029, 5.055, 0.095, -45, 0, 0)
     self.barrel = loader.loadModel(self.barrelModelPath)
     self.barrel.setPosHpr(59.654, 18.275, 0.095, 167.548, 0, 0)
     self.barrel.reparentTo(render)
     self.barrel2 = loader.loadModel(self.barrelModelPath)
     self.barrel2.setPosHpr(61.975, 18.16, 0.095, 219.01, 0, 0)
     self.barrel2.reparentTo(render)
     self.barrel3 = loader.loadModel(self.barrelModelPath)
     self.barrel3.setPosHpr(60.456, 19.654, 0.095, 363.297, 0, 0)
     self.barrel3.reparentTo(render)
     self.wheelbarrel = loader.loadModel(self.wheelBarrelModelPath)
     self.wheelbarrel.reparentTo(render)
     self.wheelbarrel.setPosHpr(60.08, 4.339, 0.095, -29.058, 0, 0)
     self.creampieslice = loader.loadModel(self.creamPieSliceModelPath)
     self.creampieslice.setPosHpr(59.654, 18.275, 2.095, -514.649, 0, 0)
     self.creampieslice.reparentTo(render)
     self.clipboard = loader.loadModel(self.clipboardModelPath)
     self.clipboard.setPosHpr(60.456, 19.654, 2.095, -506.554, 0, 90)
     self.clipboard.reparentTo(render)
     self.construction = loader.loadModel(self.constructionSignModelPath)
     self.construction.setPosHpr(55.872, 9.394, 0.095, -448.917, 0, 0)
     self.construction.reparentTo(render)
     self.construction1 = loader.loadModel(self.constructionSignModelPath)
     self.construction1.setPosHpr(55.753, 15.855, 0.095, -450.165, 0, 0)
     self.construction1.reparentTo(render)
     self.props = [
         self.shovel, self.cone, self.cone2, self.cone3, self.barrel,
         self.barrel2, self.barrel3, self.wheelbarrel, self.creampieslice,
         self.clipboard, self.construction, self.construction1
     ]
def __doUnite(attack, hp=0, index=108):
    toon = NPCToons.createLocalNPC(attack['npcId'])
    chatString = TTSCDecoders.decodeTTSCResistanceMsg(index)
    delay = 2
    if toon == None:
        return
    targets = attack['toons']
    track = Sequence(teleportIn(attack, toon))
    track.append(Func(toon.setChatAbsolute, chatString, CFSpeech | CFTimeout))
    track.append(Func(ResistanceChat.doEffect, index, toon, targets))
    track.append(Wait(delay))
    track.append(teleportOut(attack, toon))
    return track
	def __makeCagedToon(self):
		if self.cagedToon:
			return
		self.cagedToon = NPCToons.createLocalNPC(self.cagedToonNpcId)
		self.cagedToon.addActive()
		self.cagedToon.reparentTo(self.cage)
		self.cagedToon.setPosHpr(0, -2, 0, 180, 0, 0)
		self.cagedToon.loop('neutral')

		touch = cs = CollisionSphere(0, 0, 0, 4)
		touchNode = CollisionNode('Cage')
		touchNode.setCollideMask(ToontownGlobals.WallBitmask)
		touchNode.addSolid(touch)
		self.cage.attachNewNode(touchNode)
Esempio n. 38
0
    def load(self, zoneId):
        self.zoneId = zoneId
        self.parentFSMState.addChild(self.fsm)
        self.loadBattleAnims()
        self.branchZone = ZoneUtil.getBranchZone(zoneId)
        self.canonicalBranchZone = ZoneUtil.getCanonicalBranchZone(zoneId)
        self.music = base.loadMusic(self.musicFile)
        self.activityMusic = base.loadMusic(self.activityMusicFile)
        self.battleMusic = base.loadMusic(
            'phase_3.5/audio/bgm/encntr_general_bg.ogg')
        if settings['newGui'] == True:
            self.townBattle = TownBattleNEW.TownBattleNEW(
                self.townBattleDoneEvent)
            self.townBattle.load()
        else:
            self.townBattle = TownBattleOLD.TownBattleOLD(
                self.townBattleDoneEvent)
            self.townBattle.load()

        if config.GetBool('want-april-toons', 0):
            self.npc = NPCToons.createLocalNPC(91915)
            self.npc.reparentTo(base.localAvatar)
            self.npc.setZ(30)
            self.npc.hide()
            self.piano = loader.loadModel('phase_5/models/props/piano-mod')
            self.piano.setZ(250)
            self.piano.setHpr(0, 90, 0)
            self.piano.reparentTo(base.localAvatar)
            self.piano.setScale(0)
            self.pianoSfx = base.loadSfx('phase_5/audio/sfx/AA_drop_piano.ogg')
            self.dropSfx = base.loadSfx('phase_5/audio/sfx/cogbldg_drop.ogg')
            self.pianoDropSound = Sequence(
                Func(base.playSfx, self.dropSfx), Wait(6.7),
                Func(base.playSfx, self.pianoSfx),
                Func(base.localAvatar.b_setAnimState, 'Squish'), Wait(2.5),
                Func(self.pianoSfx.stop))
            self.pianoDropSequence = Sequence(
                Wait(randint(10, 60)), Func(self.pianoDropSound.start),
                Parallel(self.piano.scaleInterval(1, (3, 3, 3)),
                         self.piano.posInterval(7, (0, 0, 0))),
                self.piano.posInterval(0.1, (0, 0, 0.5)),
                self.piano.posInterval(0.1, (0, 0, 0)), Wait(0.4),
                Parallel(
                    Func(self.npc.addActive),
                    Func(self.npc.setChatAbsolute, 'Whoops! My bad!',
                         CFSpeech | CFTimeout)),
                self.piano.scaleInterval(1, (0, 0, 0)), Wait(5),
                Func(self.npc.removeActive))
            self.pianoDropSequence.loop()
Esempio n. 39
0
    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()
Esempio n. 40
0
 def pianoDropTask(self, task):
     if base.localAvatar.getIsTeleporting():
         task.delayTime = randint(10, 60)
         return task.again
     if hasattr(
             self, 'pianoDropSequence'
     ) and self.pianoDropSequence and self.pianoDropSequence.isPlaying():
         task.delayTime = randint(10, 60)
         return task.again
     self.npc = NPCToons.createLocalNPC(
         random.choice([
             91915, 14014, 14009, 14006, 14007, 14008, 14011, 14012, 14010,
             14035, 14036, 14037, 14038, 14039, 14044, 14045, 14046
         ]))
     self.npc.reparentTo(base.localAvatar)
     self.npc.setZ(30)
     self.npc.hide()
     self.piano = loader.loadModel('phase_5/models/props/piano-mod')
     self.piano.setZ(250)
     self.piano.setHpr(0, 90, 0)
     self.piano.reparentTo(base.localAvatar)
     self.piano.setScale(0)
     self.pianoSfx = base.loader.loadSfx(
         'phase_5/audio/sfx/AA_drop_piano.ogg')
     self.dropSfx = base.loader.loadSfx(
         'phase_5/audio/sfx/cogbldg_drop.ogg')
     self.pianoDropSound = Sequence(
         Func(base.playSfx, self.dropSfx), Wait(6.7),
         Func(base.playSfx, self.pianoSfx),
         Func(base.localAvatar.b_setAnimState, 'Squish'), Wait(2.5),
         Func(self.pianoSfx.stop))
     self.pianoDropSequence = Sequence(
         Func(self.pianoDropSound.start),
         Parallel(self.piano.scaleInterval(1, (3, 3, 3)),
                  self.piano.posInterval(7, (0, 0, 0))),
         self.piano.posInterval(0.1, (0, 0, 0.5)),
         self.piano.posInterval(0.1, (0, 0, 0)), Wait(0.4),
         Parallel(
             Func(self.npc.addActive),
             Func(self.npc.setChatAbsolute, 'Whoops! My bad!',
                  CFSpeech | CFTimeout)),
         self.piano.scaleInterval(1, (0, 0, 0)), Wait(5),
         Func(self.npc.removeActive))
     self.pianoDropSequence.start()
     task.delayTime = randint(10, 60)
     return task.again
    def load(self, zoneId):
        self.zoneId = zoneId
        self.parentFSMState.addChild(self.fsm)
        self.loadBattleAnims()
        self.branchZone = ZoneUtil.getBranchZone(zoneId)
        self.canonicalBranchZone = ZoneUtil.getCanonicalBranchZone(zoneId)
        self.music = base.loadMusic(self.musicFile)
        self.activityMusic = base.loadMusic(self.activityMusicFile)
        self.battleMusic = base.loadMusic('phase_3.5/audio/bgm/encntr_general_tt.ogg')
        self.townBattle = TownBattle.TownBattle(self.townBattleDoneEvent)
        self.townBattle.load()

        if config.GetBool('want-april-toons', 0):
            self.npc = NPCToons.createLocalNPC(91915)
            self.npc.reparentTo(base.localAvatar)
            self.npc.setZ(30)
            self.npc.hide()
            self.piano = loader.loadModel('phase_5/models/props/piano-mod')
            self.piano.setZ(250)
            self.piano.setHpr(0, 90, 0)
            self.piano.reparentTo(base.localAvatar)
            self.piano.setScale(0)
            self.pianoSfx = base.loadSfx('phase_5/audio/sfx/AA_drop_piano.ogg')
            self.dropSfx = base.loadSfx('phase_5/audio/sfx/cogbldg_drop.ogg')
            self.pianoDropSound = Sequence(
                Func(base.playSfx, self.dropSfx),
                Wait(6.7),
                Func(base.playSfx, self.pianoSfx),
                Func(base.localAvatar.b_setAnimState, 'Squish'),
                Wait(2.5),
                Func(self.pianoSfx.stop)
            )
            self.pianoDropSequence = Sequence(
                Wait(randint(10, 60)),
                Func(self.pianoDropSound.start),
                Parallel(self.piano.scaleInterval(1, (3, 3, 3)), self.piano.posInterval(7, (0, 0, 0))),
                self.piano.posInterval(0.1, (0, 0, 0.5)),
                self.piano.posInterval(0.1, (0, 0, 0)),
                Wait(0.4),
                Parallel(Func(self.npc.addActive), Func(self.npc.setChatAbsolute, 'Whoops! My bad!', CFSpeech|CFTimeout)),
                self.piano.scaleInterval(1, (0, 0, 0)),
                Wait(5),
                Func(self.npc.removeActive)
            )
            self.pianoDropSequence.loop()
Esempio n. 42
0
    def load(self):
        SafeZoneLoader.SafeZoneLoader.load(self)
        self.seagullSound = base.loader.loadSfx(
            'phase_6/audio/sfx/SZ_DD_Seagull.ogg')
        self.underwaterSound = base.loader.loadSfx(
            'phase_4/audio/sfx/AV_ambient_water.ogg')
        self.swimSound = base.loader.loadSfx(
            'phase_4/audio/sfx/AV_swim_single_stroke.ogg')
        self.submergeSound = base.loader.loadSfx(
            'phase_5.5/audio/sfx/AV_jump_in_water.ogg')
        self.boat = self.geom.find('**/donalds_boat')
        self.dockSound = base.loader.loadSfx(
            'phase_6/audio/sfx/SZ_DD_dockcreak.ogg')
        self.foghornSound = base.loader.loadSfx(
            'phase_5/audio/sfx/SZ_DD_foghorn.ogg')
        self.bellSound = base.loader.loadSfx(
            'phase_6/audio/sfx/SZ_DD_shipbell.ogg')
        self.waterSound = base.loader.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)
            self.donald.hideShadow()

            random.shuffle(TTLocalizer.DonaldChatter)
            self.donaldSpeech = self.donald.createTalkSequence(
                TTLocalizer.DonaldChatter, 15)
            self.donaldSpeech.loop(0)

        water = self.geom.find('**/water')

        water.setColorScale(1, 1, 1, 0.7)
        water.setTransparency(1)
Esempio n. 43
0
    def __makeResistanceToon(self):
        if self.resistanceToon:
            return
        self.resistanceToon = NPCToons.createLocalNPC(12002)
        self.resistanceToon.setPosHpr(*ToontownGlobals.CashbotRTBattleOneStartPosHpr)
        state = random.getstate()
        random.seed(self.doId)
        self.resistanceToon.suitType = SuitDNA.getRandomSuitByDept('m')
        random.setstate(state)
        self.fakeGoons = []
        for i in xrange(self.numFakeGoons):
            goon = DistributedCashbotBossGoon.DistributedCashbotBossGoon(base.cr)
            goon.doId = -1 - i
            goon.setBossCogId(self.doId)
            goon.generate()
            goon.announceGenerate()
            self.fakeGoons.append(goon)

        self.__hideFakeGoons()
Esempio n. 44
0
 def __init__(self, cr):
     DistributedObject.__init__(self, cr)
     FSM.__init__(self, 'HotAirBalloonFSM')
     self.avId = 0
     self.flightPathIndex = 0
     self.balloon = loader.loadModel(
         'phase_4/models/events/election_slappyBalloon-static')
     self.balloon.reparentTo(base.render)
     self.balloon.setPos(*ElectionGlobals.BalloonBasePosition)
     self.balloon.setScale(ElectionGlobals.BalloonScale)
     self.cr.parentMgr.registerParent(ToontownGlobals.SPSlappysBalloon,
                                      self.balloon)
     self.collisionNP = self.balloon.find('**/Collision_Outer')
     self.slappy = NPCToons.createLocalNPC(2021)
     self.slappy.setPos(0.7, 0.7, 0.4)
     self.slappy.setH(150)
     self.slappy.setScale(1 / ElectionGlobals.BalloonScale)
     self.slappy.loop('neutral')
     self.flightPaths = ElectionGlobals.generateFlightPaths(self)
     self.toonFlightPaths = ElectionGlobals.generateToonFlightPaths(self)
     self.speechSequence = ElectionGlobals.generateSpeechSequence(self)
Esempio n. 45
0
def __doSmooch(attack, hp=0):
    toon = NPCToons.createLocalNPC(attack['npcId'])
    if toon == None:
        return
    else:
        targets = attack['toons']
        level = 2
        battle = attack['battle']
        track = Sequence(teleportIn(attack, toon))
        lipstick = globalPropPool.getProp('lipstick')
        lipstick2 = MovieUtil.copyProp(lipstick)
        lipsticks = [lipstick, lipstick2]
        rightHands = toon.getRightHands()
        dScale = 0.5
        lipstickTrack = Sequence(Func(MovieUtil.showProps, lipsticks, rightHands, Point3(-0.27, -0.24, -0.95), Point3(-118, -10.6, -25.9)), MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE), Wait(toon.getDuration('smooch') - 2.0 * dScale), MovieUtil.getScaleIntervals(lipsticks, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO))
        lips = globalPropPool.getProp('lips')
        dScale = 0.5
        tLips = 2.5
        tThrow = 115.0 / toon.getFrameRate('smooch')
        dThrow = 0.5

        def getLipPos(toon=toon):
            toon.pose('smooch', 57)
            toon.update(0)
            hand = toon.getRightHands()[0]
            return hand.getPos(render)

        effectTrack = Sequence()
        for target in targets:
            lipcopy = MovieUtil.copyProp(lips)
            lipsTrack = Sequence(Wait(tLips), Func(MovieUtil.showProp, lipcopy, render, getLipPos), Func(lipcopy.setBillboardPointWorld), LerpScaleInterval(lipcopy, dScale, Point3(3, 3, 3), startScale=MovieUtil.PNT3_NEARZERO), Wait(tThrow - tLips - dScale), LerpPosInterval(lipcopy, dThrow, Point3(target.getPos() + Point3(0, 0, target.getHeight()))), Func(MovieUtil.removeProp, lipcopy))
            delay = tThrow + dThrow
            mtrack = Parallel(lipstickTrack, lipsTrack, __getSoundTrack(level, 2, node=toon), Sequence(ActorInterval(toon, 'smooch')), Sequence(Wait(delay), ActorInterval(target, 'conked')), Sequence(Wait(delay), Func(__healToon, target, hp)))
            effectTrack.append(mtrack)

        effectTrack.append(Func(MovieUtil.removeProps, lipsticks))
        track.append(effectTrack)
        track.append(teleportOut(attack, toon))
        track.append(Func(target.clearChat))
        return track
Esempio n. 46
0
def __healDive(heal, hasInteractivePropHealBonus):
    splash = Splash.Splash(render)
    splash.reparentTo(render)
    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 = 7.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target["toon"]
        hp = target["hp"]
        reactIval = Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus)
        if first == 1:
            targetTrack.append(Wait(delay))
            first = 0
        targetTrack.append(reactIval)

    thisBattle = heal["battle"]
    toonsInBattle = thisBattle.toons
    glass = globalPropPool.getProp("glass")
    glass.setScale(4.0)
    glass.setHpr(0.0, 90.0, 0.0)
    ladder = globalPropPool.getProp("ladder")
    placeNode = NodePath("lookNode")
    diveProps = [glass, ladder]
    ladderScale = toon.getBodyScale() / 0.66
    scaleUpPoint = Point3(0.5, 0.5, 0.45) * ladderScale
    basePos = toon.getPos()
    glassOffset = Point3(0, 1.1, 0.2)
    glassToonOffset = Point3(0, 1.2, 0.2)
    splashOffset = Point3(0, 1.0, 0.4)
    ladderOffset = Point3(0, 4, 0)
    ladderToonSep = Point3(0, 1, 0) * ladderScale
    diveOffset = Point3(0, 0, 10)
    divePos = add3(add3(ladderOffset, diveOffset), ladderToonSep)
    ladder.setH(toon.getH())
    glassPos = render.getRelativePoint(toon, glassOffset)
    glassToonPos = render.getRelativePoint(toon, glassToonOffset)
    ladderPos = render.getRelativePoint(toon, ladderOffset)
    climbladderPos = render.getRelativePoint(toon, add3(ladderOffset, ladderToonSep))
    divePos = render.getRelativePoint(toon, divePos)
    topDivePos = render.getRelativePoint(toon, diveOffset)
    lookBase = render.getRelativePoint(toon, ladderOffset)
    lookTop = render.getRelativePoint(toon, add3(ladderOffset, diveOffset))
    lookGlass = render.getRelativePoint(toon, glassOffset)
    splash.setPos(splashOffset)
    walkToLadderTime = 1.0
    climbTime = 5.0
    diveTime = 1.0
    ladderGrowTime = 1.5
    splash.setPos(glassPos)
    toonNode = toon.getGeomNode()
    placeNode.reparentTo(render)
    placeNode.setScale(5.0)
    placeNode.setPos(toon.getPos(render))
    placeNode.setHpr(toon.getHpr(render))
    toonscale = toonNode.getScale()
    toonFacing = toon.getHpr()
    if base.localAvatar in thisBattle.activeToons:
        propTrack = Sequence(
            Func(MovieUtil.showProp, glass, render, glassPos),
            Func(MovieUtil.showProp, ladder, render, ladderPos),
            Func(toonsLook, toonsInBattle, placeNode, Point3(0, 0, 0)),
            Func(placeNode.setPos, lookBase),
            LerpScaleInterval(ladder, ladderGrowTime, scaleUpPoint, startScale=MovieUtil.PNT3_NEARZERO),
            Func(placeNode.setPos, lookTop),
            Wait(2.1),
            MovieCamera.toonGroupHighShot(None, 0),
            Wait(2.1),
            Func(placeNode.setPos, lookGlass),
            Wait(0.4),
            MovieCamera.allGroupLowShot(None, 0),
            Wait(1.8),
            LerpScaleInterval(ladder, ladderGrowTime, MovieUtil.PNT3_NEARZERO, startScale=scaleUpPoint),
            Func(MovieUtil.removeProps, diveProps),
        )
    else:
        propTrack = Sequence(
            Func(MovieUtil.showProp, glass, render, glassPos),
            Func(MovieUtil.showProp, ladder, render, ladderPos),
            Func(toonsLook, toonsInBattle, placeNode, Point3(0, 0, 0)),
            Func(placeNode.setPos, lookBase),
            LerpScaleInterval(ladder, ladderGrowTime, scaleUpPoint, startScale=MovieUtil.PNT3_NEARZERO),
            Func(placeNode.setPos, lookTop),
            Wait(4.2),
            Func(placeNode.setPos, lookGlass),
            Wait(2.2),
            LerpScaleInterval(ladder, ladderGrowTime, MovieUtil.PNT3_NEARZERO, startScale=scaleUpPoint),
            Func(MovieUtil.removeProps, diveProps),
        )
    mtrack = Parallel(
        propTrack,
        __getSoundTrack(level, 0.6, duration=9.0, node=toon),
        Sequence(
            Parallel(
                Sequence(
                    ActorInterval(toon, "walk", loop=0, duration=walkToLadderTime),
                    ActorInterval(toon, "neutral", loop=0, duration=0.1),
                ),
                LerpPosInterval(toon, walkToLadderTime, climbladderPos),
                Wait(ladderGrowTime),
            ),
            Parallel(
                ActorInterval(toon, "climb", loop=0, endFrame=116),
                Sequence(
                    Wait(4.6),
                    Func(toonNode.setTransparency, 1),
                    LerpColorScaleInterval(toonNode, 0.25, VBase4(1, 1.0, 1, 0.0), blendType="easeInOut"),
                    LerpScaleInterval(toonNode, 0.01, 0.1, startScale=toonscale),
                    LerpHprInterval(toon, 0.01, toonFacing),
                    LerpPosInterval(toon, 0.0, glassToonPos),
                    Func(toonNode.clearTransparency),
                    Func(toonNode.clearColorScale),
                    Parallel(ActorInterval(toon, "swim", loop=1, startTime=0.0, endTime=1.0), Wait(1.0)),
                ),
                Sequence(Wait(4.6), Func(splash.play), Wait(1.0), Func(splash.destroy)),
            ),
            Wait(0.5),
            Parallel(
                ActorInterval(toon, "jump", loop=0, startTime=0.2),
                LerpScaleInterval(toonNode, 0.5, toonscale, startScale=0.1),
                Func(stopLook, toonsInBattle),
            ),
        ),
        targetTrack,
    )
    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 loadToonJuror(self):
     self.cleanupToonJuror()
     self.toonJuror = NPCToons.createLocalNPC(ToontownGlobals.LawbotBossBaseJurorNpcId + self.toonJurorIndex)
     self.toonJuror.hide()
    def load(self):
        self.notify.debug('load')
        DistributedMinigame.load(self)
        self.timer = ToontownTimer.ToontownTimer()
        self.timer.posInTopRightCorner()
        self.timer.hide()
        self.room = loader.loadModel('phase_4/models/minigames/matching_room')
        self.buttonSounds = []
        for soundName in self.ButtonSoundNames:
            self.buttonSounds.append(base.loadSfx(soundName))

        self.correctSound = base.loadSfx('phase_4/audio/sfx/MG_pos_buzzer.ogg')
        self.incorrectSound = base.loadSfx('phase_4/audio/sfx/MG_neg_buzzer.ogg')
        self.perfectSound = base.loadSfx('phase_4/audio/sfx/MG_win.ogg')
        self.fallSound = base.loadSfx('phase_4/audio/sfx/MG_Tag_A.ogg')
        self.music = base.loadMusic(self.bgm)
        self.waitingText = DirectLabel(text=self.strPleaseWait, text_fg=(0.9, 0.9, 0.9, 1.0), frameColor=(1, 1, 1, 0), text_font=ToontownGlobals.getSignFont(), pos=(0, 0, -.78), scale=0.12)
        self.roundText = DirectLabel(text=self.strRound % 1, text_fg=self.normalTextColor, frameColor=(1, 1, 1, 0), text_font=ToontownGlobals.getSignFont(), pos=(0.014, 0, -.84), scale=0.12)
        self.roundText.hide()
        self.waitingText.hide()
        matchingGameGui = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
        minnieArrow = matchingGameGui.find('**/minnieArrow')
        minnieX = matchingGameGui.find('**/minnieX')
        minnieCircle = matchingGameGui.find('**/minnieCircle')
        self.arrows = [None] * 5
        for x in xrange(0, 5):
            self.arrows[x] = minnieArrow.copyTo(hidden)
            self.arrows[x].hide()

        self.xs = [None] * 5
        for x in xrange(0, 5):
            self.xs[x] = minnieX.copyTo(hidden)
            self.xs[x].hide()

        self.statusBalls = []
        self.totalMoves = PatternGameGlobals.INITIAL_ROUND_LENGTH + PatternGameGlobals.ROUND_LENGTH_INCREMENT * (PatternGameGlobals.NUM_ROUNDS - 1)
        for x in xrange(0, 4):
            self.statusBalls.append([None] * self.totalMoves)

        for x in xrange(0, 4):
            for y in xrange(0, self.totalMoves):
                self.statusBalls[x][y] = minnieCircle.copyTo(hidden)
                self.statusBalls[x][y].hide()

        minnieArrow.removeNode()
        minnieX.removeNode()
        minnieCircle.removeNode()
        matchingGameGui.removeNode()
        self.toon = NPCToons.createLocalNPC(7010)
        self.toon.reparentTo(hidden)
        self.backRowHome = Point3(3, 11, 0)
        self.backRowXSpacing = 1.8
        self.frontRowHome = Point3(0, 18, 0)
        self.frontRowXSpacing = 3.0
        self.stdNumDanceStepPingFrames = self.toon.getNumFrames(self.toonAnimNames[0])
        self.stdNumDanceStepPingPongFrames = self.__numPingPongFrames(self.stdNumDanceStepPingFrames)
        self.buttonPressDelayPercent = (self.stdNumDanceStepPingFrames - 1.0) / self.stdNumDanceStepPingPongFrames
        self.animPlayRates = []
        animPlayRate = 1.4
        animPlayRateMult = 1.06
        for i in xrange(PatternGameGlobals.NUM_ROUNDS):
            self.animPlayRates.append(animPlayRate)
            animPlayRate *= animPlayRateMult

        return
Esempio n. 49
0
def __healDive(heal, hasInteractivePropHealBonus):
    splash = Splash.Splash(render)
    splash.reparentTo(render)
    npcId = 0
    if heal.has_key('npcId'):
        npcId = heal['npcId']
        toon = NPCToons.createLocalNPC(npcId)
        if toon == None:
            return None
        
    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 = 7.0
    first = 1
    targetTrack = Sequence()
    for target in targets:
        targetToon = target['toon']
        hp = target['hp']
        reactIval = Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus)
        if first == 1:
            targetTrack.append(Wait(delay))
            first = 0
        
        targetTrack.append(reactIval)
    
    thisBattle = heal['battle']
    toonsInBattle = thisBattle.toons
    glass = globalPropPool.getProp('glass')
    glass.setScale(4.0)
    glass.setHpr(0.0, 90.0, 0.0)
    ladder = globalPropPool.getProp('ladder')
    placeNode = NodePath('lookNode')
    diveProps = [
        glass,
        ladder]
    ladderScale = toon.getBodyScale() / 0.66000000000000003
    scaleUpPoint = Point3(0.5, 0.5, 0.45000000000000001) * ladderScale
    basePos = toon.getPos()
    glassOffset = Point3(0, 1.1000000000000001, 0.20000000000000001)
    glassToonOffset = Point3(0, 1.2, 0.20000000000000001)
    splashOffset = Point3(0, 1.0, 0.40000000000000002)
    ladderOffset = Point3(0, 4, 0)
    ladderToonSep = Point3(0, 1, 0) * ladderScale
    diveOffset = Point3(0, 0, 10)
    divePos = add3(add3(ladderOffset, diveOffset), ladderToonSep)
    ladder.setH(toon.getH())
    glassPos = render.getRelativePoint(toon, glassOffset)
    glassToonPos = render.getRelativePoint(toon, glassToonOffset)
    ladderPos = render.getRelativePoint(toon, ladderOffset)
    climbladderPos = render.getRelativePoint(toon, add3(ladderOffset, ladderToonSep))
    divePos = render.getRelativePoint(toon, divePos)
    topDivePos = render.getRelativePoint(toon, diveOffset)
    lookBase = render.getRelativePoint(toon, ladderOffset)
    lookTop = render.getRelativePoint(toon, add3(ladderOffset, diveOffset))
    LookGlass = render.getRelativePoint(toon, glassOffset)
    splash.setPos(splashOffset)
    walkToLadderTime = 1.0
    climbTime = 5.0
    diveTime = 1.0
    ladderGrowTime = 1.5
    splash.setPos(glassPos)
    toonNode = toon.getGeomNode()
    placeNode.reparentTo(render)
    placeNode.setScale(5.0)
    placeNode.setPos(toon.getPos(render))
    placeNode.setHpr(toon.getHpr(render))
    toonscale = toonNode.getScale()
    toonFacing = toon.getHpr()
    propTrack = Sequence(Func(MovieUtil.showProp, glass, render, glassPos), Func(MovieUtil.showProp, ladder, render, ladderPos), Func(toonsLook, toonsInBattle, placeNode, Point3(0, 0, 0)), Func(placeNode.setPos, lookBase), LerpScaleInterval(ladder, ladderGrowTime, scaleUpPoint, startScale = MovieUtil.PNT3_NEARZERO), Func(placeNode.setPos, lookTop), Wait(2.1000000000000001), MovieCamera.toonGroupHighShot(None, 0), Wait(2.1000000000000001), Func(placeNode.setPos, LookGlass), Wait(0.40000000000000002), MovieCamera.allGroupLowShot(None, 0), Wait(1.8), LerpScaleInterval(ladder, ladderGrowTime, MovieUtil.PNT3_NEARZERO, startScale = scaleUpPoint), Func(MovieUtil.removeProps, diveProps))
    mtrack = Parallel(propTrack, __getSoundTrack(level, 0.59999999999999998, duration = 9.0, node = toon), Sequence(Parallel(Sequence(ActorInterval(toon, 'walk', loop = 0, duration = walkToLadderTime), ActorInterval(toon, 'neutral', loop = 0, duration = 0.10000000000000001)), LerpPosInterval(toon, walkToLadderTime, climbladderPos), Wait(ladderGrowTime)), Parallel(ActorInterval(toon, 'climb', loop = 0, endFrame = 116), Sequence(Wait(4.5999999999999996), Func(toonNode.setTransparency, 1), LerpColorScaleInterval(toonNode, 0.25, VBase4(1, 1.0, 1, 0.0), blendType = 'easeInOut'), LerpScaleInterval(toonNode, 0.01, 0.10000000000000001, startScale = toonscale), LerpHprInterval(toon, 0.01, toonFacing), LerpPosInterval(toon, 0.0, glassToonPos), Func(toonNode.clearTransparency), Func(toonNode.clearColorScale), Parallel(ActorInterval(toon, 'swim', loop = 1, startTime = 0.0, endTime = 1.0), Wait(1.0))), Sequence(Wait(4.5999999999999996), Func(splash.play), Wait(1.0), Func(splash.destroy))), Wait(0.5), Parallel(ActorInterval(toon, 'jump', loop = 0, startTime = 0.20000000000000001), LerpScaleInterval(toonNode, 0.5, toonscale, startScale = 0.10000000000000001), Func(stopLook, toonsInBattle))), targetTrack)
    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