Пример #1
0
 def handleWaitForSetZoneResponse(self, requestStatus):
     loaderName = requestStatus['loader']
     if loaderName == 'safeZoneLoader':
         if not loader.inBulkBlock:
             loader.beginBulkLoad('hood', TTLocalizer.HeadingToPlayground,
                                  safeZoneCountMap[self.id], 1,
                                  TTLocalizer.TIP_GENERAL, self.id)
         self.loadLoader(requestStatus)
         loader.endBulkLoad('hood')
     elif loaderName == 'townLoader':
         if not loader.inBulkBlock:
             zoneId = requestStatus['zoneId']
             toPhrase = StreetNames[ZoneUtil.getCanonicalBranchZone(
                 zoneId)][0]
             streetName = StreetNames[ZoneUtil.getCanonicalBranchZone(
                 zoneId)][-1]
             loader.beginBulkLoad(
                 'hood',
                 TTLocalizer.HeadingToStreet % {'street': streetName},
                 townCountMap[self.id], 1, TTLocalizer.TIP_STREET, zoneId)
         self.loadLoader(requestStatus)
         loader.endBulkLoad('hood')
     elif loaderName == 'minigame':
         pass
     elif loaderName == 'cogHQLoader':
         print 'should be loading HQ'
    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)
Пример #3
0
    def enter(self):
        ShtikerPage.ShtikerPage.enter(self)
        try:
            zone = base.cr.playGame.getPlace().getZoneId()
        except:
            zone = 0

        if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
        else:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground
        if zone and ZoneUtil.isPlayground(zone) or self.book.safeMode:
            self.safeZoneButton.hide()
        else:
            self.safeZoneButton.show()
        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate and base.cr.playGame.hood.loader.atMyEstate() or self.book.safeMode:
            self.goHomeButton.hide()
        elif base.housingEnabled:
            self.goHomeButton.show()
        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
            if base.cr.playGame.hood.loader.atMyEstate():
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtHome
                self.hoodLabel.show()
            else:
                avatar = base.cr.identifyAvatar(base.cr.playGame.hood.loader.estateOwnerId)
                if avatar:
                    avName = avatar.getName()
                    self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtSomeonesHome % TTLocalizer.GetPossesive(avName)
                    self.hoodLabel.show()
        elif zone:
            hoodName = ToontownGlobals.hoodNameMap.get(ZoneUtil.getCanonicalHoodId(zone), ('',))[-1]
            streetName = ToontownGlobals.StreetNames.get(ZoneUtil.getCanonicalBranchZone(zone), ('',))[-1]
            if hoodName:
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreHere % (hoodName, streetName)
                self.hoodLabel.show()
            else:
                self.hoodLabel.hide()
        else:
            self.hoodLabel.hide()
        safeZonesVisited = base.localAvatar.hoodsVisited
        hoodTeleportList = base.localAvatar.getTeleportAccess()
        for hood in self.allZones:
            label = self.labels[self.allZones.index(hood)]
            clouds = self.clouds[self.allZones.index(hood)]
            if not self.book.safeMode and hood in safeZonesVisited:
                label['text_fg'] = (0, 0, 0, 1)
                label.show()
                for cloud in clouds:
                    cloud.hide()

                fullname = base.cr.hoodMgr.getFullnameFromId(hood)
                if hood in hoodTeleportList:
                    text = TTLocalizer.MapPageGoTo % fullname
                    label['text'] = ('', text, text)
                else:
                    label['text'] = ('', fullname, fullname)
            else:
                label.hide()
                for cloud in clouds:
                    cloud.show()
Пример #4
0
 def updateMap(self):
     if self.av:
         
         try:
             hoodId = ZoneUtil.getCanonicalHoodId(self.av.getLocation()[1])
             zoneId = ZoneUtil.getCanonicalBranchZone(self.av.getLocation()[1])
             mapsGeom = loader.loadModel('phase_4/models/questmap/%s_maps' % ToontownGlobals.dnaMap[hoodId])
             mapImage = mapsGeom.find('**/%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
             if not mapImage.isEmpty():
                 self.container['image'] = mapImage
                 self.resetFrameSize()
                 self.cornerPosInfo = QuestMapGlobals.CornerPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
                 self.hqPosInfo = QuestMapGlobals.HQPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
                 self.fishingSpotInfo = QuestMapGlobals.FishingSpotPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
                 self.cogInfoPos = QuestMapGlobals.CogInfoPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
                 self.cogInfoFrame.setPos(self.cogInfoPos)
                 self.hide()
                 self.hoodId = hoodId
                 self.zoneId = zoneId
                 self.updateQuestInfo()
                 self.updateCogInfo()
                 taskMgr.add(self.update, 'questMapUpdate')
             else:
                 self.stop()
             mapsGeom.removeNode()
         self.stop()
Пример #5
0
 def updateMap(self):
     if self.av:
         hoodId = ZoneUtil.getCanonicalHoodId(self.av.getLocation()[1])
         zoneId = ZoneUtil.getCanonicalBranchZone(self.av.getLocation()[1])
         try:
             mapsGeom = loader.loadModel('phase_4/models/questmap/%s_maps' % ToontownGlobals.dnaMap[hoodId])
         except:
             self.stop()
             return
         mapImage = mapsGeom.find('**/%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
         if not mapImage.isEmpty():
             self.container['image'] = mapImage
             self.resetFrameSize()
             self.cornerPosInfo = QuestMapGlobals.CornerPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
             self.hqPosInfo = QuestMapGlobals.HQPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
             self.fishingSpotInfo = QuestMapGlobals.FishingSpotPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
             self.cogInfoPos = QuestMapGlobals.CogInfoPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
             self.cogInfoFrame.setPos(self.cogInfoPos)
             self.hide()
             self.hoodId = hoodId
             self.zoneId = zoneId
             self.updateQuestInfo()
             self.updateCogInfo()
             taskMgr.add(self.update, 'questMapUpdate')
         else:
             self.stop()
             mapsGeom.removeNode()
    def completeSale(self, sell):
        avId = self.air.getAvatarIdFromSender()
        if self.busy != avId:
            self.air.writeServerEvent('suspicious', avId, 'DistributedNPCFishermanAI.completeSale busy with %s' % self.busy)
            self.notify.warning('somebody called setMovieDone that I was not busy with! avId: %s' % avId)
            return

        for spot in self.air.hoodId2Hood[ZoneUtil.getCanonicalBranchZone(self.zoneId)].fishingSpots:
            if spot.avId == avId:
                self.sendClearMovie(None)
                return

        if sell:
            av = simbase.air.doId2do.get(avId)
            if av:

                #maybe: recreate Disney-style fishManager that does the above code?
                trophyResult = self.air.fishManager.creditFishTank(av)
                if trophyResult:
                    movieType = NPCToons.SELL_MOVIE_TROPHY
                    extraArgs = [len(av.fishCollection), FishGlobals.getTotalNumFish()]
                else:
                    movieType = NPCToons.SELL_MOVIE_COMPLETE
                    extraArgs = []
                self.d_setMovie(avId, movieType, extraArgs)
        else:
            av = simbase.air.doId2do.get(avId)
            if av:
                self.d_setMovie(avId, NPCToons.SELL_MOVIE_NOFISH)
        self.sendClearMovie(None)
        return
    def avatarEnter(self):
        avId = self.air.getAvatarIdFromSender()
        if avId not in self.air.doId2do:
            self.notify.warning('Avatar: %s not found' % avId)
            return
        if self.isBusy():
            self.freeAvatar(avId)
            return
        for spot in self.air.hoodId2Hood[ZoneUtil.getCanonicalBranchZone(self.zoneId)].fishingSpots: 
            if spot.avId == avId:
                return

        av = self.air.doId2do[avId]
        self.busy = avId
        self.acceptOnce(self.air.getAvatarExitEvent(avId), self.__handleUnexpectedExit, extraArgs=[avId])
        value = av.fishTank.getTotalValue()
        if value > 0:
            flag = NPCToons.SELL_MOVIE_START
            self.d_setMovie(avId, flag)
            taskMgr.doMethodLater(30.0, self.sendTimeoutMovie, self.uniqueName('clearMovie'))
        else:
            flag = NPCToons.SELL_MOVIE_NOFISH
            self.d_setMovie(avId, flag)
            self.sendClearMovie(None)
        DistributedNPCToonBaseAI.avatarEnter(self)
        return
Пример #8
0
 def getHoodText(self, zoneId):
     hoodText = base.cr.hoodMgr.getFullnameFromId(self.id)
     if self.id != Tutorial:
         streetName = StreetNames.get(
             ZoneUtil.getCanonicalBranchZone(zoneId))
         if streetName:
             hoodText = hoodText + '\n' + streetName[-1]
     return hoodText
 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')
     self.townBattle = TownBattle.TownBattle(self.townBattleDoneEvent)
     self.townBattle.load()
Пример #10
0
    def updateQuestInfo(self):
        for marker in self.buildingMarkers:
            marker.destroy()

        self.buildingMarkers = []

        for (i, questDesc) in enumerate(self.av.quests):
            mapIndex = i + 1
            quest = Quests.getQuest(questDesc[0])
            toNpcId = questDesc[2]

            completed = quest.getCompletionStatus(self.av,
                                                  questDesc) == Quests.COMPLETE
            if not completed:
                if quest.getType() == Quests.RecoverItemQuest:
                    if quest.getHolder() == Quests.AnyFish:
                        self.putBuildingMarker(self.fishingSpotInfo,
                                               mapIndex=mapIndex)
                    continue
                elif quest.getType() not in (Quests.DeliverGagQuest,
                                             Quests.DeliverItemQuest,
                                             Quests.VisitQuest,
                                             Quests.TrackChoiceQuest):
                    continue

            if toNpcId == Quests.ToonHQ:
                self.putBuildingMarker(self.hqPosInfo, mapIndex=mapIndex)
                continue

            npcZoneId = NPCToons.getNPCZone(toNpcId)
            hoodId = ZoneUtil.getCanonicalHoodId(npcZoneId)
            branchId = ZoneUtil.getCanonicalBranchZone(npcZoneId)

            if (self.hoodId != hoodId) or (self.zoneId != branchId):
                continue

            for blockIndex in xrange(
                    base.cr.playGame.dnaStore.getNumBlockNumbers()):
                blockNumber = base.cr.playGame.dnaStore.getBlockNumberAt(
                    blockIndex)
                zoneId = base.cr.playGame.dnaStore.getZoneFromBlockNumber(
                    blockNumber)
                interiorZoneId = (zoneId - (zoneId % 100)) + 500 + blockNumber
                if npcZoneId == interiorZoneId:
                    self.putBuildingMarker(
                        base.cr.playGame.dnaStore.getDoorPosHprFromBlockNumber(
                            blockNumber).getPos(render),
                        base.cr.playGame.dnaStore.getDoorPosHprFromBlockNumber(
                            blockNumber).getHpr(render),
                        mapIndex=mapIndex,
                        zoneId=zoneId)
Пример #11
0
    def updateQuestInfo(self):
        for marker in self.buildingMarkers:
            marker.destroy()

        self.buildingMarkers = []
        dnaStore = base.cr.playGame.dnaStore
        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 blockIndex in xrange(dnaStore.getNumBlockTitles()):
                        blockNumber = dnaStore.getTitleBlockAt(blockIndex)
                        zone = dnaStore.getZoneFromBlockNumber(blockNumber)
                        branchZone = zone - zone % 100
                        finalZone = branchZone + 500 + blockNumber
                        buildingType = dnaStore.getBlockBuildingType(
                            blockNumber)
                        if npcZone == finalZone:
                            self.putBuildingMarker(
                                dnaStore.getDoorPosHprFromBlockNumber(
                                    blockNumber).getPos(),
                                dnaStore.getDoorPosHprFromBlockNumber(
                                    blockNumber).getHpr(),
                                mapIndex=mapIndex)

        return
Пример #12
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()
Пример #13
0
    def updateQuestInfo(self):
        for marker in self.buildingMarkers:
            marker.destroy()

        self.buildingMarkers = []
        dnaStore = base.cr.playGame.dnaStore
        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 blockIndex in xrange(dnaStore.getNumBlockTitles()):
                        blockNumber = dnaStore.getTitleBlockAt(blockIndex)
                        zone = dnaStore.getZoneFromBlockNumber(blockNumber)
                        branchZone = zone - zone % 100
                        finalZone = branchZone + 500 + blockNumber
                        buildingType = dnaStore.getBlockBuildingType(blockNumber)
                        if npcZone == finalZone:
                            self.putBuildingMarker(
                                dnaStore.getDoorPosHprFromBlockNumber(blockNumber).getPos(),
                                dnaStore.getDoorPosHprFromBlockNumber(blockNumber).getHpr(),
                                mapIndex=mapIndex,
                            )

        return
Пример #14
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.loader.loadMusic(self.musicFile)
     self.activityMusic = base.loader.loadMusic(self.activityMusicFile)
     if not self.battleMusic:
         self.battleMusic = base.loader.loadMusic(
             'phase_3.5/audio/bgm/encntr_general_bg.ogg')
     self.townBattle = TownBattle.TownBattle(self.townBattleDoneEvent)
     self.townBattle.load()
     if base.cr.newsManager:
         if base.cr.newsManager.isHolidayRunning(APRIL_FOOLS_COSTUMES):
             taskMgr.doMethodLater(randint(10, 60), self.pianoDropTask,
                                   'piano-drop-task')
    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()
Пример #16
0
    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)
Пример #17
0
    def updateQuestInfo(self):
        for marker in self.buildingMarkers:
            marker.destroy()

        self.buildingMarkers = []

        for (i, questDesc) in enumerate(self.av.quests):
            mapIndex = i + 1
            quest = Quests.getQuest(questDesc[0])
            toNpcId = questDesc[2]

            completed = quest.getCompletionStatus(self.av, questDesc) == Quests.COMPLETE
            if not completed:
                if quest.getType() == Quests.RecoverItemQuest:
                    if quest.getHolder() == Quests.AnyFish:
                        self.putBuildingMarker(self.fishingSpotInfo, mapIndex=mapIndex)
                    continue
                elif quest.getType() not in (
                    Quests.DeliverGagQuest, Quests.DeliverItemQuest,
                    Quests.VisitQuest, Quests.TrackChoiceQuest):
                    continue

            if toNpcId == Quests.ToonHQ:
                self.putBuildingMarker(self.hqPosInfo, mapIndex=mapIndex)
                continue

            npcZoneId = NPCToons.getNPCZone(toNpcId)
            hoodId = ZoneUtil.getCanonicalHoodId(npcZoneId)
            branchId = ZoneUtil.getCanonicalBranchZone(npcZoneId)

            if (self.hoodId != hoodId) or (self.zoneId != branchId):
                continue

            for blockIndex in xrange(base.cr.playGame.dnaStore.getNumBlockNumbers()):
                blockNumber = base.cr.playGame.dnaStore.getBlockNumberAt(blockIndex)
                zoneId = base.cr.playGame.dnaStore.getZoneFromBlockNumber(blockNumber)
                interiorZoneId = (zoneId - (zoneId%100)) + 500 + blockNumber
                if npcZoneId == interiorZoneId:
                    self.putBuildingMarker(
                        base.cr.playGame.dnaStore.getDoorPosHprFromBlockNumber(blockNumber).getPos(render),
                        base.cr.playGame.dnaStore.getDoorPosHprFromBlockNumber(blockNumber).getHpr(render),
                        mapIndex=mapIndex)
Пример #18
0
    def load(self, zoneId):
        assert self.notify.debug("load()")

        # We'll need to know this to rename the visibility zones
        # correctly.
        self.zoneId = zoneId

        # Prepare the state machine
        self.parentFSMState.addChild(self.fsm)
        # load Toon battle anims and props
        self.loadBattleAnims()
        # props loaded on the fly now
        #globalPropPool.loadProps()
        # TODO: Based on the zone id, load that branch
        self.branchZone = ZoneUtil.getBranchZone(zoneId)
        self.canonicalBranchZone = ZoneUtil.getCanonicalBranchZone(zoneId)
        # Load the music:
        self.music = base.loadMusic(self.musicFile)
        self.activityMusic = base.loadMusic(self.activityMusicFile)
        self.battleMusic = base.loadMusic(
            'phase_3.5/audio/bgm/encntr_general_bg.mid')
        # Load the battle UI:
        self.townBattle = TownBattle.TownBattle(self.townBattleDoneEvent)
        self.townBattle.load()
    def completeSale(self, type):
        avId = self.air.getAvatarIdFromSender()
        if self.busy != avId:
            self.air.writeServerEvent(
                'suspicious', avId,
                'DistributedNPCFishermanAI.completeSale busy with %s' %
                self.busy)
            self.notify.warning(
                'somebody called setMovieDone that I was not busy with! avId: %s'
                % avId)
            return

        for spot in self.air.hoodId2Hood[ZoneUtil.getCanonicalBranchZone(
                self.zoneId)].fishingSpots:
            if spot.avId == avId:
                self.sendClearMovie(None)
                return

        if type == 1:  # Rods
            av = simbase.air.doId2do.get(avId)
            if av:
                newIndex = 0
                for rod in av.getFishingRods():
                    if rod > newIndex:
                        newIndex = rod
                newIndex += 1
                extraArgs = []
                try:
                    if av.getTotalMoney(
                    ) >= ToontownGlobals.FishingRodCosts[newIndex]:
                        av.takeMoney(ToontownGlobals.FishingRodCosts[newIndex],
                                     bUseBank=True)
                        rods = av.getFishingRods()
                        rods.append(newIndex)
                        av.b_setFishingRods(rods)
                        av.b_setFishingRod(newIndex)
                        movieType = NPCToons.SELL_MOVIE_ROD
                    else:
                        movieType = NPCToons.SELL_MOVIE_NOROD
                        extraArgs = []
                except:
                    movieType = NPCToons.SELL_MOVIE_COMPLETE
                    extraArgs = []
                self.d_setMovie(avId, movieType, extraArgs)
        elif type == 2:  # Buckets
            av = simbase.air.doId2do.get(avId)
            if av:
                currMaxTank = av.getMaxFishTank()
                newTank = currMaxTank + 10
                extraArgs = []
                try:
                    if av.getTotalMoney() >= ToontownGlobals.BucketCosts.get(
                            newTank):
                        av.takeMoney(ToontownGlobals.BucketCosts.get(newTank),
                                     bUseBank=True)
                        av.b_setMaxFishTank(newTank)
                        movieType = NPCToons.SELL_MOVIE_BUCKET
                    else:
                        movieType = NPCToons.SELL_MOVIE_NOROD
                except:
                    movieType = NPCToons.SELL_MOVIE_COMPLETE
                    extraArgs = []
                self.d_setMovie(avId, movieType, extraArgs)
        else:
            av = simbase.air.doId2do.get(avId)
            if av:
                self.d_setMovie(avId, NPCToons.SELL_MOVIE_COMPLETE)
        self.sendClearMovie(None)
        return
Пример #20
0
    def enter(self):
        ShtikerPage.ShtikerPage.enter(self)
        # Get the current street name
        try:
            zone = base.cr.playGame.getPlace().getZoneId()
        except:
            zone = 0

        # if we are going to an HQ, change the button
        if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
        else:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground

        if ((zone and ZoneUtil.isPlayground(zone)) or self.book.safeMode):
            self.safeZoneButton.hide()
        else:
            self.safeZoneButton.show()

        if ((base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate
             and base.cr.playGame.hood.loader.atMyEstate())
                or self.book.safeMode):
            self.goHomeButton.hide()
        elif base.housingEnabled:
            self.goHomeButton.show()

        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
            if base.cr.playGame.hood.loader.atMyEstate():
                self.hoodLabel['text'] = (TTLocalizer.MapPageYouAreAtHome)
                self.hoodLabel.show()
            else:
                avatar = base.cr.identifyAvatar(
                    base.cr.playGame.hood.loader.estateOwnerId)
                if avatar:
                    avName = avatar.getName()
                    self.hoodLabel['text'] = (
                        TTLocalizer.MapPageYouAreAtSomeonesHome %
                        (TTLocalizer.GetPossesive(avName)))
                    self.hoodLabel.show()
        elif zone:
            hoodName = ToontownGlobals.hoodNameMap.get(
                ZoneUtil.getCanonicalHoodId(zone), ("", ))[-1]
            streetName = ToontownGlobals.StreetNames.get(
                ZoneUtil.getCanonicalBranchZone(zone), ("", ))[-1]
            # Make sure we have a hoodName to report
            # It is ok if we do not have a street name, it will just be empty
            if hoodName:
                self.hoodLabel['text'] = (TTLocalizer.MapPageYouAreHere %
                                          (hoodName, streetName))
                self.hoodLabel.show()
            else:
                self.hoodLabel.hide()
        else:
            self.hoodLabel.hide()

        safeZonesVisited = base.localAvatar.hoodsVisited
        hoodsAvailable = base.cr.hoodMgr.getAvailableZones()

        #print("### hoods visited = ", safeZonesVisited)
        #print("### hoods avail = ", hoodsAvailable)

        # The hoods that we can see is the intersection of the zones we have
        # visited and the hoods that are available
        hoodVisibleList = PythonUtil.intersection(safeZonesVisited,
                                                  hoodsAvailable)

        #print("### hoods viz = ", hoodVisibleList)

        # The hoods that we can teleport to is the intersection of the hoods
        # we can see and the hoods the local toon has teleport access to
        hoodTeleportList = base.localAvatar.getTeleportAccess()

        for hood in self.allZones:
            label = self.labels[self.allZones.index(hood)]
            clouds = self.clouds[self.allZones.index(hood)]
            # If we can see that hood, show the button, hide the clouds
            if ((not self.book.safeMode) and (hood in hoodVisibleList)):
                label.show()
                for cloud in clouds:
                    cloud.hide()
                fullname = base.cr.hoodMgr.getFullnameFromId(hood)
                if hood in hoodTeleportList:
                    text = (TTLocalizer.MapPageGoTo % fullname)
                    label['text'] = ("", text, text)
                else:
                    label['text'] = ("", fullname, fullname)

            # If we cannot see that hood, hide the button, show the clouds
            else:
                label.hide()
                for cloud in clouds:
                    cloud.show()

        return
Пример #21
0
    def enter(self):
        ShtikerPage.ShtikerPage.enter(self)
        try:
            zone = base.cr.playGame.getPlace().getZoneId()
        except:
            zone = 0

        if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
        else:
            self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground
        if zone and ZoneUtil.isPlayground(zone) or self.book.safeMode:
            self.safeZoneButton.hide()
        else:
            self.safeZoneButton.show()
        if base.cr.playGame.getPlaceId(
        ) == ToontownGlobals.MyEstate and base.cr.playGame.hood.loader.atMyEstate(
        ) or self.book.safeMode:
            self.goHomeButton.hide()
        elif base.housingEnabled:
            self.goHomeButton.show()
        if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
            if base.cr.playGame.hood.loader.atMyEstate():
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtHome
                self.hoodLabel.show()
            else:
                avatar = base.cr.identifyAvatar(
                    base.cr.playGame.hood.loader.estateOwnerId)
                if avatar:
                    avName = avatar.getName()
                    self.hoodLabel[
                        'text'] = TTLocalizer.MapPageYouAreAtSomeonesHome % TTLocalizer.GetPossesive(
                            avName)
                    self.hoodLabel.show()
        elif zone:
            hoodName = ToontownGlobals.hoodNameMap.get(
                ZoneUtil.getCanonicalHoodId(zone), ('', ))[-1]
            streetName = ToontownGlobals.StreetNames.get(
                ZoneUtil.getCanonicalBranchZone(zone), ('', ))[-1]
            if hoodName:
                self.hoodLabel['text'] = TTLocalizer.MapPageYouAreHere % (
                    hoodName, streetName)
                self.hoodLabel.show()
            else:
                self.hoodLabel.hide()
        else:
            self.hoodLabel.hide()
        safeZonesVisited = base.localAvatar.hoodsVisited
        hoodsAvailable = base.cr.hoodMgr.getAvailableZones()
        hoodVisibleList = PythonUtil.intersection(safeZonesVisited,
                                                  hoodsAvailable)
        hoodTeleportList = base.localAvatar.getTeleportAccess()
        for hood in self.allZones:
            label = self.labels[self.allZones.index(hood)]
            clouds = self.clouds[self.allZones.index(hood)]
            if not self.book.safeMode and hood in hoodVisibleList:
                label['text_fg'] = (0, 0, 0, 1)
                label.show()
                for cloud in clouds:
                    cloud.hide()

                fullname = base.cr.hoodMgr.getFullnameFromId(hood)
                if hood in hoodTeleportList:
                    text = TTLocalizer.MapPageGoTo % fullname
                    label['text'] = ('', text, text)
                else:
                    label['text'] = ('', fullname, fullname)
            else:
                label['text_fg'] = (0, 0, 0, 0.65)
                label.show()
                for cloud in clouds:
                    cloud.show()
Пример #22
0
 def __chooseFish(self, av, zoneId):
     rodId = av.getFishingRod()
     branchZone = ZoneUtil.getCanonicalBranchZone(zoneId)
     success, genus, species, weight = FishGlobals.getRandomFishVitals(
         branchZone, rodId)
     return (success, genus, species, weight)