コード例 #1
0
    def findItemInWater(self, av, zoneId):
        # Similar to recoverItems, but this is called from the
        # DistributedFishingSpot to see if there are any quest items
        # in the water.  No cogs are involved; hence, the only valid
        # questCogType is Quests.AnyFish.

        # Only one item at a time is returned by this function; the
        # function either returns the item found, or None.
        # Note: this does not support two quests with same item
        avQuests = av.quests
        avId = av.getDoId()

        for questDesc in avQuests:
            questClass = Quests.getQuestClass(questDesc[0])
            if (questClass == Quests.RecoverItemQuest):
                quest = Quests.getQuest(questDesc[0])
                if ((quest.getType() == Quests.RecoverItemQuest)
                        and (quest.getHolder() == Quests.AnyFish) and
                    ((random.random() * 100) <= quest.getPercentChance())
                        and (questDesc[4] < quest.getNumItems())
                        and quest.isLocationMatch(zoneId)):
                    # FOUND IT! Increment progress by one item
                    questDesc[4] += 1
                    self.notify.debug("findItemInWater: av %s made progress" %
                                      (avId))
                    av.b_setQuests(avQuests)
                    # Return the item recovered
                    return quest.getItem()
            else:
                # Do not care about this quest here
                continue

        self.notify.debug("findItemInWater: av %s made NO progress" % (avId))
        return None
コード例 #2
0
    def toonPlayedMinigame(self, av, avList):
        # This is notifying us that a toon has entered a minigame.
        # See if this toon has a minigame quest.  If so, update the progress.
        avQuests = av.quests
        avId = av.getDoId()
        changed = 0

        for questDesc in avQuests:
            questClass = Quests.getQuestClass(questDesc[0])
            if (questClass == Quests.MinigameNewbieQuest):
                quest = Quests.getQuest(questDesc[0])
                num = quest.doesMinigameCount(av, avList)
                if (num > 0):
                    # Set progress
                    questDesc[4] += num
                    changed = 1

        # Now send the quests back to the avatar if the status changed
        if changed:
            self.notify.debug("toonPlayedMinigame: av %s made progress" %
                              (avId))
            av.b_setQuests(avQuests)
        else:
            self.notify.debug("toonPlayedMinigame: av %s made NO progress" %
                              (avId))
        return
コード例 #3
0
    def initQuestFrame(self, toon, avQuests):
        self.gagExpFrame.hide()
        self.newGagFrame.hide()
        self.questFrame.show()
        self.itemFrame.hide()
        self.missedItemFrame.hide()
        for i in range(ToontownGlobals.MaxQuestCarryLimit):
            questLabel = self.questLabelList[i]
            questLabel.hide()

        for i in range(len(avQuests)):
            questDesc = avQuests[i]
            questId, npcId, toNpcId, rewardId, toonProgress = questDesc
            quest = Quests.getQuest(questId)
            questString = quest.getString()
            progressString = quest.getProgressString(toon, questDesc)
            rewardString = quest.getRewardString(progressString)
            rewardString = Quests.fillInQuestNames(rewardString,
                                                   toNpcId=toNpcId)
            completed = quest.getCompletionStatus(toon,
                                                  questDesc) == Quests.COMPLETE
            questLabel = self.questLabelList[i]
            questLabel.show()
            questLabel['text'] = rewardString
            if completed:
                questLabel['text_fg'] = (0, 0.3, 0, 1)
コード例 #4
0
    def toonKilledCogs(self, av, cogList, zoneId, avList):
        # This is the battle notifying us that a toon killed some cogs
        # See if this toon has a quest on these cogs. If so, update the progress.
        avQuests = av.quests
        avId = av.getDoId()
        changed = 0

        self.notify.debug(
            "toonKilledCogs: avId: %s, avQuests: %s, cogList: %s, zoneId: %s" %
            (avId, avQuests, cogList, zoneId))

        for questDesc in avQuests:
            quest = Quests.getQuest(questDesc[0])
            if quest != None:
                for cogDict in cogList:
                    if cogDict['isVP']:
                        num = quest.doesVPCount(avId, cogDict, zoneId, avList)
                    elif cogDict['isCFO']:
                        num = quest.doesCFOCount(avId, cogDict, zoneId, avList)
                    else:
                        num = quest.doesCogCount(avId, cogDict, zoneId, avList)
                    if (num > 0):
                        questDesc[4] += num
                        changed = 1

        # Now send the quests back to the avatar if the status changed
        if changed:
            self.notify.debug("toonKilledCogs: av %s made progress" % (avId))
            av.b_setQuests(avQuests)
        else:
            self.notify.debug("toonKilledCogs: av %s made NO progress" %
                              (avId))
        return
コード例 #5
0
 def showChoicePoster(self, questId, fromNpcId, toNpcId, rewardId,
                      callback):
     self.update((questId, fromNpcId, toNpcId, rewardId, 0))
     quest = Quests.getQuest(questId)
     self.rewardText.show()
     self.rewardText.setZ(-0.205)
     self.questProgress.hide()
     if not hasattr(self, 'chooseButton'):
         guiButton = loader.loadModel('phase_3/models/gui/quit_button')
         self.chooseButton = DirectButton(
             parent=self.questFrame,
             relief=None,
             image=(guiButton.find('**/QuitBtn_UP'),
                    guiButton.find('**/QuitBtn_DN'),
                    guiButton.find('**/QuitBtn_RLVR')),
             image_scale=(0.7, 1, 1),
             text=TTLocalizer.QuestPageChoose,
             text_scale=0.06,
             text_pos=(0, -0.02),
             pos=(0.285, 0, 0.245),
             scale=0.65)
         guiButton.removeNode()
     npcZone = NPCToons.getNPCZone(toNpcId)
     hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
     self.chooseButton['command'] = callback
     self.chooseButton['extraArgs'] = [questId]
     self.unbind(DGG.WITHIN)
     self.unbind(DGG.WITHOUT)
     if not quest.getType() == Quests.TrackChoiceQuest:
         self.questInfo.setZ(-0.0625)
     return
コード例 #6
0
 def showChoicePoster(self, questId, fromNpcId, toNpcId, rewardId,
                      callback):
     self.update((questId, fromNpcId, toNpcId, rewardId, 0))
     quest = Quests.getQuest(questId)
     self.rewardText.show()
     self.rewardText.setZ(-0.205)
     self.questProgress.hide()
     if not hasattr(self, 'chooseButton'):
         guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
         self.chooseButton = DirectButton(
             parent=self.questFrame,
             relief=None,
             image=(guiButton.find('**/QuitBtn_UP'),
                    guiButton.find('**/QuitBtn_DN'),
                    guiButton.find('**/QuitBtn_RLVR')),
             image_scale=(0.7, 1, 1),
             text=Localizer.QuestPageChoose,
             text_scale=0.06,
             text_pos=(0, -0.02),
             pos=(0.27, 0, 0.24),
             scale=0.65)
         guiButton.removeNode()
     self.chooseButton['command'] = callback
     self.chooseButton['extraArgs'] = [questId]
     self.unbind(WITHIN)
     self.unbind(WITHOUT)
     return
コード例 #7
0
    def showChoicePoster(self, questId, fromNpcId, toNpcId, rewardId, callback):
        self.update((questId,
         fromNpcId,
         toNpcId,
         rewardId,
         0))
        quest = Quests.getQuest(questId)
        self.rewardText.show()
        self.rewardText.setZ(-0.205)
        self.questProgress.hide()
        if not hasattr(self, 'chooseButton'):
            guiButton = loader.loadModel('phase_3/models/gui/quit_button')
            self.chooseButton = DirectButton(parent=self.questFrame, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.7, 1, 1), text=TTLocalizer.QuestPageChoose, text_scale=0.06, text_pos=(0, -0.02), pos=(0.285, 0, 0.245), scale=0.65)
            guiButton.removeNode()
        npcZone = NPCToons.getNPCZone(toNpcId)
        hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
        if not base.cr.isPaid() and (questId == 401 or hasattr(quest, 'getLocation') and quest.getLocation() == 1000 or hoodId == 1000):

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

            self.chooseButton['command'] = showTeaserPanel
        else:
            self.chooseButton['command'] = callback
            self.chooseButton['extraArgs'] = [questId]
        self.unbind(DGG.WITHIN)
        self.unbind(DGG.WITHOUT)
        if not quest.getType() == Quests.TrackChoiceQuest:
            self.questInfo.setZ(-0.0625)
        return
コード例 #8
0
 def toonMadeFriend(self, av, otherAv):
     # This is notifying us that a toon has made a friend.
     # See if this toon has a friend quest.
     # If so, update the progress.
     avQuests = av.quests
     avId = av.getDoId()
     changed = 0
     for questDesc in avQuests:
         questClass = Quests.getQuestClass(questDesc[0])
         if ((questClass == Quests.FriendQuest)
                 or (questClass == Quests.FriendNewbieQuest)):
             quest = Quests.getQuest(questDesc[0])
             if (quest.doesFriendCount(av, otherAv)):
                 # Set progress
                 questDesc[4] += 1
                 changed = 1
         else:
             # Do not care about this quest here
             continue
     # Now send the quests back to the avatar if the status changed
     if changed:
         self.notify.debug("toonMadeFriend: av %s made progress" % (avId))
         av.b_setQuests(avQuests)
     else:
         self.notify.debug("toonMadeFriend: av %s made NO progress" %
                           (avId))
コード例 #9
0
 def isQuestComplete(self, av, npc, questDesc):
     # The quest in question
     quest = Quests.getQuest(questDesc[0])
     if quest == None:
         return 0
     self.notify.debug("isQuestComplete: avId: %s, quest: %s" %
                       (av.getDoId(), quest))
     return quest.getCompletionStatus(av, questDesc, npc)
コード例 #10
0
ファイル: QTQuestNode.py プロジェクト: Toonerz/Toontown-2003
    def _QTQuestNode__questsChanged(self):
        
        try:
            lt = toonbase.localToon
        except:
            return None

        self.phraseList = []
        self.encodedMsgList = []
        
        def addMsg(msg, packet):
            for phrase in self.phraseList:
                if msg == phrase[0]:
                    return None
                
            
            self.phraseList.append([
                msg,
                QTQuestSend,
                QTNode.QT_TEXT_NODE])
            self.encodedMsgList.append(packet)

        for quest in lt.quests:
            (questId, fromNpcId, toNpcId, rewardId, toonProgress) = quest
            q = Quests.getQuest(questId)
            if q is None:
                continue
            
            msgs = q.getQTStrings(toNpcId, toonProgress)
            if type(msgs) != type([]):
                msgs = [
                    msgs]
            
            for i in xrange(len(msgs)):
                addMsg(msgs[i], [
                    questId,
                    toNpcId,
                    toonProgress,
                    i])
            
        
        needToontask = 1
        
        try:
            needToontask = len(lt.quests) != lt.questCarryLimit
        except:
            pass

        if needToontask:
            addMsg(Localizer.QTQuestNodeNeedATask, [])
        
        self.createMenu()
コード例 #11
0
    def getQuestIntervalList(self, toon, deathList, toonList=[]):
        avQuests = copy.deepcopy(toon.quests)
        avId = toon.getDoId()
        changed = 0
        tickDelay = 0.5
        intervalList = []
        cogList = []
        for i in range(0, len(deathList), 2):
            cogIndex = deathList[i]
            cogLevel = deathList[i + 1]
            cogType = AvatarDNA.suitHeadTypes[cogIndex]
            cogTrack = AvatarDNA.getSuitDept(cogType)
            cogList.append({
                'type': cogType,
                'level': cogLevel,
                'track': cogTrack,
                'activeToons': [avId]
            })

        try:
            zoneId = toonbase.tcr.playGame.getPlace().getZoneId()
        except:
            zoneId = 0
        else:
            for i in range(len(avQuests)):
                questDesc = avQuests[i]
                questId, npcId, toNpcId, rewardId, toonProgress = questDesc
                quest = Quests.getQuest(questId)
                questString = quest.getString()
                progressString = quest.getProgressString(toon, questDesc)
                questLabel = self.questLabelList[i]
                for cogDict in cogList:
                    if quest.doesCogCount(avId, cogDict, zoneId, toonList):
                        questDesc[4] += 1
                        changed = 1
                        progressString = quest.getProgressString(
                            toon, questDesc)
                        str = '%s : %s' % (questString, progressString)
                        if quest.getCompletionStatus(
                                toon, questDesc) == Quests.COMPLETE:
                            intervalList.append(
                                Func(questLabel.setProp, 'text_fg',
                                     (0, 0.3, 0, 1)))
                        intervalList.append(
                            Func(questLabel.setProp, 'text', str))
                        intervalList.append(Wait(tickDelay))

        return intervalList
コード例 #12
0
def decodeQTQuestMsg(msg):
    if len(msg) == 0:
        return Localizer.QTQuestNodeNeedATask
    if len(msg) != 4:
        return None
    questId, toNpcId, toonProgress, index = msg
    quest = Quests.getQuest(questId)
    if not quest:
        return None
    msgs = quest.getQTStrings(toNpcId, toonProgress)
    if type(msgs) != type([]):
        msgs = [msgs]
    if index >= len(msgs):
        return None
    return msgs[index]
    return
コード例 #13
0
ファイル: QuestPoster.py プロジェクト: Toonerz/Toontown-2003
 def showChoicePoster(self, questId, fromNpcId, toNpcId, rewardId, callback):
     self.update((questId, fromNpcId, toNpcId, rewardId, 0))
     quest = Quests.getQuest(questId)
     self.rewardText.show()
     self.rewardText.setZ(-0.20499999999999999)
     self.questProgress.hide()
     if not hasattr(self, 'chooseButton'):
         guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
         self.chooseButton = DirectButton(parent = self.questFrame, relief = None, image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale = (0.69999999999999996, 1, 1), text = Localizer.QuestPageChoose, text_scale = 0.059999999999999998, text_pos = (0, -0.02), pos = (0.27000000000000002, 0, 0.23999999999999999), scale = 0.65000000000000002)
         guiButton.removeNode()
     
     self.chooseButton['command'] = callback
     self.chooseButton['extraArgs'] = [
         questId]
     self.unbind(WITHIN)
     self.unbind(WITHOUT)
コード例 #14
0
    def toonRecoveredCogSuitPart(self, av, location, avList):
        avQuests = av.quests
        avId = av.getDoId()
        changed = 0

        for questDesc in avQuests:
            quest = Quests.getQuest(questDesc[0])
            num = quest.doesCogPartCount(avId, location, avList)
            if num > 0:
                questDesc[4] += num
                changed = 1

        # Now send the quests back to the avatar if the status changed
        if changed:
            self.notify.debug("toonRecoveredCogSuitPart: av made progress")
            av.b_setQuests(avQuests)
        else:
            self.notify.debug("toonRecoveredCogSuitPart: av made NO progress")
コード例 #15
0
    def _QTQuestNode__questsChanged(self):

        try:
            lt = toonbase.localToon
        except:
            return None

        self.phraseList = []
        self.encodedMsgList = []

        def addMsg(msg, packet):
            for phrase in self.phraseList:
                if msg == phrase[0]:
                    return None

            self.phraseList.append([msg, QTQuestSend, QTNode.QT_TEXT_NODE])
            self.encodedMsgList.append(packet)

        for quest in lt.quests:
            (questId, fromNpcId, toNpcId, rewardId, toonProgress) = quest
            q = Quests.getQuest(questId)
            if q is None:
                continue

            msgs = q.getQTStrings(toNpcId, toonProgress)
            if type(msgs) != type([]):
                msgs = [msgs]

            for i in xrange(len(msgs)):
                addMsg(msgs[i], [questId, toNpcId, toonProgress, i])

        needToontask = 1

        try:
            needToontask = len(lt.quests) != lt.questCarryLimit
        except:
            pass

        if needToontask:
            addMsg(Localizer.QTQuestNodeNeedATask, [])

        self.createMenu()
コード例 #16
0
ファイル: QTQuestNode.py プロジェクト: Toonerz/Toontown-2003
def decodeQTQuestMsg(msg):
    if len(msg) == 0:
        return Localizer.QTQuestNodeNeedATask
    
    if len(msg) != 4:
        return None
    
    (questId, toNpcId, toonProgress, index) = msg
    quest = Quests.getQuest(questId)
    if not quest:
        return None
    
    msgs = quest.getQTStrings(toNpcId, toonProgress)
    if type(msgs) != type([]):
        msgs = [
            msgs]
    
    if index >= len(msgs):
        return None
    
    return msgs[index]
コード例 #17
0
    def toonDefeatedMint(self, av, mintId, avList):
        # mint is telling us that this avatar just defeated it.
        # see if this toon has a quest on this mint. If so,
        # update the progress.
        avQuests = av.quests
        avId = av.getDoId()
        changed = 0

        for questDesc in avQuests:
            quest = Quests.getQuest(questDesc[0])
            num = quest.doesMintCount(avId, mintId, avList)
            if num > 0:
                questDesc[4] += num
                changed = 1

        # Now send the quests back to the avatar if the status changed
        if changed:
            self.notify.debug("toonDefeatedMint: av made progress")
            av.b_setQuests(avQuests)
        else:
            self.notify.debug("toonDefeatedMint: av made NO progress")
コード例 #18
0
    def toonKilledBuilding(self, av, track, difficulty, numFloors, zoneId,
                           avList):
        # This is the battle notifying us that a toon has defeated a
        # building.  See if this toon has a quest on this building.
        # If so, update the progress.
        avQuests = av.quests
        avId = av.getDoId()
        changed = 0

        #self.notify.debug("toonKilledBuilding: avId: %s, track: %s, diff: %s, numFloors: %s, zoneId: %s" %
        #                  (avId, track, difficulty, numFloors, zoneId))
        for questDesc in avQuests:
            questClass = Quests.getQuestClass(questDesc[0])
            if ((questClass == Quests.BuildingQuest)
                    or (questClass == Quests.BuildingNewbieQuest)):
                quest = Quests.getQuest(questDesc[0])
                matchedTrack = ((quest.getBuildingTrack() == Quests.Any)
                                or (quest.getBuildingTrack() == track))
                matchedNumFloors = (quest.getNumFloors() <= numFloors)
                matchedLocation = quest.isLocationMatch(zoneId)
                if matchedTrack and matchedNumFloors and matchedLocation:
                    num = quest.doesBuildingCount(avId, avList)
                    if (num > 0):
                        questDesc[4] += num
                        changed = 1
            else:
                # Do not care about this quest here
                continue

        # Now send the quests back to the avatar if the status changed
        if changed:
            self.notify.debug("toonKilledBuilding: av made progress")
            av.b_setQuests(avQuests)
        else:
            self.notify.debug("toonKilledBuilding: av made NO progress")
        return
コード例 #19
0
    def update(self, questDesc):
        questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
        quest = Quests.getQuest(questId)
        if quest == None:
            self.notify.warning('Tried to display poster for unknown quest %s' % questId)
            return
        if rewardId == Quests.NA:
            finalReward = Quests.getFinalRewardId(questId, fAll=1)
            transformedReward = Quests.transformReward(finalReward, base.localAvatar)
            reward = Quests.getReward(transformedReward)
        else:
            reward = Quests.getReward(rewardId)
        if reward and questId not in Quests.NoRewardTierZeroQuests:
            rewardString = reward.getPosterString()
        else:
            rewardString = ''
        self.rewardText['text'] = rewardString
        self.fitLabel(self.rewardText)
        if Quests.isQuestJustForFun(questId, rewardId):
            self.funQuest.show()
        else:
            self.funQuest.hide()
        if self._deleteCallback:
            self.showDeleteButton(questDesc)
        else:
            self.hideDeleteButton()
            
        fComplete = quest.getCompletionStatus(base.localAvatar, questDesc) == Quests.COMPLETE

        if Quests.isQuestJustForFun(questId, rewardId):
            if fComplete:
                self.funQuest.hide()
        
        if toNpcId == Quests.ToonHQ:
            toNpcName = TTLocalizer.QuestPosterHQOfficer
            toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
            toNpcLocationName = TTLocalizer.QuestPosterHQLocationName
            
        elif toNpcId == Quests.ToonTailor:
            toNpcName = TTLocalizer.QuestPosterTailor
            toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
            toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName
            
        else:
            toNpcName = NPCToons.getNPCName(toNpcId)
            toNpcZone = NPCToons.getNPCZone(toNpcId)
            toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
            toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
            toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
            toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
            toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
            
        lPos = Vec3(0, 0, 0.13)
        lIconGeom = None
        lIconGeomScale = 1
        rIconGeom = None
        rIconGeomScale = 1
        infoText = ''
        infoZ = TTLocalizer.QPinfoZ
        auxText = None
        auxTextPos = Vec3(0, 0, 0.12)
        headlineString = quest.getHeadlineString()
        objectiveStrings = quest.getObjectiveStrings()
        captions = map(lambda x: str(x).title(), quest.getObjectiveStrings())
        imageColor = Vec4(*self.colors['white'])
        if quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest:
            frameBgColor = 'red'
            
            if quest.getType() == Quests.DeliverGagQuest:
                invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
                track, item = quest.getGagType()
                lIconGeom = invModel.find('**/' + AvPropsNew[track][item])
                invModel.removeNode()
                
            else:
                bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/package')
                lIconGeomScale = 0.12
                bookModel.removeNode()
                
            if not fComplete:
                captions.append(toNpcName)
                auxText = TTLocalizer.QuestPosterAuxTo
                auxTextPos.setZ(0.12)
                lPos.setX(-0.18)
                infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
                rIconGeom = self.createNpcToonHead(toNpcId)
                rIconGeomScale = IMAGE_SCALE_SMALL
                
        elif quest.getType() == Quests.RecoverItemQuest:
            frameBgColor = 'green'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            
            if not fComplete:
                rIconGeomScale = IMAGE_SCALE_SMALL
                holder = quest.getHolder()
                holderType = quest.getHolderType()
                
                if holder == Quests.Any:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    rIconGeom = cogIcons.find('**/cog')
                    cogIcons.removeNode()
                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom
                    
                elif holder == Quests.AnyFish:
                    headlineString = TTLocalizer.QuestPosterFishing
                    auxText = TTLocalizer.QuestPosterAuxFor
                    auxTextPos.setX(-0.18)
                    captions = captions[:1]
                    
                else:
                    if holderType == 'track':
                        cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                        if holder == 'c':
                            icon = cogIcons.find('**/CorpIcon')
                        elif holder == 's':
                            icon = cogIcons.find('**/SalesIcon')
                        elif holder == 'l':
                            icon = cogIcons.find('**/LegalIcon')
                        elif holder == 'm':
                            icon = cogIcons.find('**/MoneyIcon')
                        rIconGeom = icon.copyTo(hidden)
                        rIconGeom.setColor(Suit.Suit.medallionColors[holder])
                        rIconGeomScale = 0.12
                        cogIcons.removeNode()
                        
                    elif holderType == 'level':
                        cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                        rIconGeom = cogIcons.find('**/cog')
                        rIconGeomScale = IMAGE_SCALE_SMALL
                        cogIcons.removeNode()
                        
                    else:
                        rIconGeom = self.createSuitHead(holder)
                        
                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom
                    
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
                    
        elif quest.getType() == Quests.VisitQuest:
            frameBgColor = 'brown'
            captions[0] = '%s' % toNpcName
            lIconGeom = self.createNpcToonHead(toNpcId)
            lIconGeomScale = IMAGE_SCALE_SMALL
            
            if not fComplete:
                infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
                
        elif quest.getType() == Quests.TrackChoiceQuest:
            frameBgColor = 'green'
            invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
            track1, track2 = quest.getChoices()
            lIconGeom = invModel.find('**/' + AvPropsNew[track1][1])
            
            if not fComplete:
                auxText = TTLocalizer.QuestPosterAuxOr
                lPos.setX(-0.18)
                rIconGeom = invModel.find('**/' + AvPropsNew[track2][1])
                infoText = TTLocalizer.QuestPageNameAndDestination % (toNpcName,
                 toNpcBuildingName,
                 toNpcStreetName,
                 toNpcLocationName)
                infoZ = -0.02
                
            invModel.removeNode()
            
        elif quest.getType() == Quests.BuildingQuest:
            frameBgColor = 'blue'
            track = quest.getBuildingTrack()
            numFloors = quest.getNumFloors()
            
            if track == 'c':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_corp')
                
            elif track == 'l':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_legal')
                
            elif track == 'm':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_money')
                
            elif track == 's':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_sales')
                
            else:
                bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/COG_building')
                bookModel.removeNode()
                
            if lIconGeom and track != Quests.Any:
                self.loadElevator(lIconGeom, numFloors)
                lIconGeom.setH(180)
                self.fitGeometry(lIconGeom, fFlip=0)
                lIconGeomScale = IMAGE_SCALE_SMALL
                
            else:
                lIconGeomScale = 0.13
                
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
                    
        # cogdo quest
        elif quest.getType() == Quests.CogdoQuest:
            frameBgColor = 'lightGreen'
            track = quest.getBuildingTrack()
            
            if track == 'c':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_corp')
                
            elif track == 'l':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_legal')
                    
            elif track == 'm':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_money')
                
            elif track == 's':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_sales')
                
            else:
                lIconGeom = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_cbe_fieldOfficeMoverShaker')
                
            if lIconGeom and track != Quests.Any:
                lIconGeom.setH(180)
            
            else:
                lIconGeom.setH(180)
            
            self.fitGeometry(lIconGeom)
            lIconGeomScale = IMAGE_SCALE_SMALL
                            
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        
        elif quest.getType() == Quests.FactoryQuest:
            frameBgColor = 'blue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/factoryIcon2')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        
        elif quest.getType() == Quests.MintQuest:
            frameBgColor = 'blue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/CashBotMint')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        
        elif quest.getType() == Quests.ForemanQuest or quest.getType() == Quests.SupervisorQuest:
            frameBgColor = 'blue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/skelecog5')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
                    
        elif quest.getType() == Quests.BossQuest:
            frameBgColor = 'blue'
            cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
            lIconGeom = cogIcons.find('**/cog')
            lIconGeomScale = IMAGE_SCALE_SMALL
            cogIcons.removeNode()
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
     
        elif quest.getType() == Quests.VPQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel('phase_9/models/char/sellbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.055]
            lIconGeomHpr = [-90, 0, -90]
            lIconGeomScale = 0.015
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        
        elif quest.getType() == Quests.CFOQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel('phase_10/models/char/cashbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.055]
            lIconGeomHpr = [90, 0, -90]
            lIconGeomScale = 0.015
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
                    
        elif quest.getType() == Quests.CJQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel('phase_11/models/char/lawbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.055]
            lIconGeomHpr = [90, 0, -90]
            lIconGeomScale = 0.025
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
                    
        elif quest.getType() == Quests.CEOQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel('phase_12/models/char/bossbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.065]
            lIconGeomHpr = [90, 0, -90]
            lIconGeomScale = 0.0125
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        
        elif 0:#quest.getType() == Quests.FriendQuest:
            frameBgColor = 'brown'
            gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
            lIconGeom = gui.find('**/FriendsBox_Closed')
            lIconGeomScale = 0.45
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterAnywhere
        
        elif quest.getType() == Quests.TrolleyQuest:
            frameBgColor = 'lightBlue'
            gui = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = gui.find('**/trolley')
            lIconGeomScale = 0.13
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterPlayground
        
        elif quest.getType() == Quests.MailboxQuest:
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterAtHome
        
        elif quest.getType() == Quests.PhoneQuest:
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/clarabelleCow')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterOnPhone
            
        else:
            frameBgColor = 'blue'
            if quest.getType() == Quests.CogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept == 'c':
                    icon = cogIcons.find('**/CorpIcon')
                elif dept == 's':
                    icon = cogIcons.find('**/SalesIcon')
                elif dept == 'l':
                    icon = cogIcons.find('**/LegalIcon')
                elif dept == 'm':
                    icon = cogIcons.find('**/MoneyIcon')
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()
                
            elif quest.getType() == Quests.CogQuest:
                if quest.getCogType() != Quests.Any:
                    lIconGeom = self.createSuitHead(quest.getCogType())
                    lIconGeomScale = IMAGE_SCALE_SMALL
                else:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    lIconGeom = cogIcons.find('**/cog')
                    lIconGeomScale = IMAGE_SCALE_SMALL
                    cogIcons.removeNode()
                    
            elif quest.getType() == Quests.CogLevelQuest:
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeom = cogIcons.find('**/cog')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
                
            elif quest.getType() == Quests.SkelecogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept == 'c':
                    icon = cogIcons.find('**/CorpIcon')
                elif dept == 's':
                    icon = cogIcons.find('**/SalesIcon')
                elif dept == 'l':
                    icon = cogIcons.find('**/LegalIcon')
                elif dept == 'm':
                    icon = cogIcons.find('**/MoneyIcon')
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()
                
            elif quest.getType() == Quests.SkelecogQuest:
                cogIcons = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
                
            elif quest.getType() == Quests.SkelecogLevelQuest:
                cogIcons = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()

            elif quest.getType() == Quests.SkeleReviveQuest:
                cogIcons = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
                
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
                    
        if fComplete:
            textColor = (0, 0.3, 0, 1)
            imageColor = Vec4(*self.colors['lightGreen'])
            lPos.setX(-0.18)
            rIconGeom = self.createNpcToonHead(toNpcId)
            rIconGeomScale = IMAGE_SCALE_SMALL
            captions = captions[:1]
            captions.append(toNpcName)
            auxText = TTLocalizer.QuestPosterAuxReturnTo
            headlineString = TTLocalizer.QuestPosterComplete
            infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
            if self.laffMeter != None:
                self.laffMeter.reparentTo(hidden)
                self.laffMeter.destroy()
                self.laffMeter = None
        else:
            textColor = self.normalTextColor
            
        self.show()
        self['image_color'] = imageColor
        self.headline['text_fg'] = textColor
        self.headline['text'] = headlineString
        self.lPictureFrame.show()
        self.lPictureFrame.setPos(lPos)
        self.lPictureFrame['text_scale'] = TEXT_SCALE
        if lPos[0] != 0:
            self.lPictureFrame['text_scale'] = 0.0325
        self.lPictureFrame['text'] = captions[0]
        self.lPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
        if len(captions) > 1:
            self.rPictureFrame.show()
            self.rPictureFrame['text'] = captions[1]
            self.rPictureFrame['text_scale'] = 0.0325
            self.rPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
        else:
            self.rPictureFrame.hide()
        self._deleteGeoms()
        
        self.lQuestIcon['geom'] = lIconGeom
        self.lQuestIcon['geom_pos'] = (0, 10, 0)
            
        if lIconGeom:
            try:
                self.lQuestIcon['geom_scale'] = lIconGeomScale
            except:
                pass
            try:
                self.lQuestIcon['geom_pos'] = Point3(lIconGeomPos[0], lIconGeomPos[1], lIconGeomPos[2])
            except:
                pass
            try:
                self.lQuestIcon['geom_hpr'] = Point3(lIconGeomHpr[0], lIconGeomHpr[1], lIconGeomHpr[2])
            except:
                pass
            
        if self.laffMeter != None:
            self.laffMeter.reparentTo(self.lQuestIcon)
            
        self.rQuestIcon['geom'] = rIconGeom
        self.rQuestIcon['geom_pos'] = (0, 10, 0)
        if rIconGeom:
            self.rQuestIcon['geom_scale'] = rIconGeomScale
            
        if auxText:
            self.auxText.show()
            self.auxText['text'] = auxText
            self.auxText.setPos(auxTextPos)
        else:
            self.auxText.hide()
        self.bind(DGG.WITHIN, self.mouseEnterPoster)
        self.bind(DGG.WITHOUT, self.mouseExitPoster)
        numQuestItems = quest.getNumQuestItems()
        if fComplete or numQuestItems <= 1:
            self.questProgress.hide()
            if not quest.getType() == Quests.TrackChoiceQuest:
                infoZ = -0.075
        else:
            self.questProgress.show()
            self.questProgress['value'] = toonProgress & pow(2, 16) - 1
            self.questProgress['range'] = numQuestItems
            self.questProgress['text'] = quest.getProgressString(base.localAvatar, questDesc)
        self.questInfo['text'] = infoText
        self.questInfo.setZ(infoZ)
        self.fitLabel(self.questInfo)
        return
コード例 #20
0
ファイル: QuestPoster.py プロジェクト: Toonerz/Toontown-2003
 def update(self, questDesc):
     (questId, fromNpcId, toNpcId, rewardId, toonProgress) = questDesc
     quest = Quests.getQuest(questId)
     if rewardId == Quests.NA:
         finalReward = Quests.getFinalRewardId(questId, fAll = 1)
         transformedReward = Quests.transformReward(finalReward, toonbase.localToon)
         reward = Quests.getReward(transformedReward)
     else:
         reward = Quests.getReward(rewardId)
     if reward:
         rewardString = reward.getPosterString()
     else:
         rewardString = ''
     self.rewardText['text'] = rewardString
     self.fitLabel(self.rewardText)
     questEntry = Quests.QuestDict.get(questId)
     if questEntry:
         tier = questEntry[0]
         fOptional = Quests.isRewardOptional(tier, rewardId)
     else:
         fOptional = 0
     if fOptional:
         self.funQuest.show()
     else:
         self.funQuest.hide()
     fComplete = quest.getCompletionStatus(toonbase.localToon, questDesc) == Quests.COMPLETE
     fromNpcName = NPCToons.getNPCName(fromNpcId)
     npcZone = NPCToons.getNPCZone(fromNpcId)
     hoodId = ZoneUtil.getHoodId(npcZone)
     branchId = ZoneUtil.getBranchZone(npcZone)
     if fromNpcId == Quests.ToonHQ:
         locationName = Localizer.QuestPosterHQLocationName
         buildingName = Localizer.QuestPosterHQBuildingName
         streetName = Localizer.QuestPosterHQStreetName
     elif fromNpcId == Quests.ToonTailor:
         locationName = Localizer.QuestPosterTailorLocationName
         buildingName = Localizer.QuestPosterTailorBuildingName
         streetName = Localizer.QuestPosterTailorStreetName
     else:
         locationName = toonbase.tcr.hoodMgr.getFullnameFromId(hoodId)
         buildingName = NPCToons.getBuildingTitle(npcZone)
         streetName = ZoneUtil.getStreetName(branchId)
     if toNpcId == Quests.ToonHQ:
         toNpcName = Localizer.QuestPosterHQOfficer
         toNpcBuildingName = Localizer.QuestPosterHQBuildingName
         toNpcStreetName = Localizer.QuestPosterHQStreetName
         toNpcLocationName = Localizer.QuestPosterHQLocationName
     elif toNpcId == Quests.ToonTailor:
         toNpcName = Localizer.QuestPosterTailor
         toNpcBuildingName = Localizer.QuestPosterTailorBuildingName
         toNpcStreetName = Localizer.QuestPosterTailorStreetName
         toNpcLocationName = Localizer.QuestPosterTailorLocationName
     else:
         toNpcName = NPCToons.getNPCName(toNpcId)
         toNpcZone = NPCToons.getNPCZone(toNpcId)
         toNpcHoodId = ZoneUtil.getHoodId(toNpcZone)
         toNpcLocationName = toonbase.tcr.hoodMgr.getFullnameFromId(toNpcHoodId)
         toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
         toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
         toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
     lPos = Vec3(0, 0, 0.13)
     lIconGeom = None
     lIconGeomScale = 1
     rIconGeom = None
     rIconGeomScale = 1
     infoText = ''
     infoZ = -0.0625
     auxText = None
     auxTextPos = Vec3(0, 0, 0.12)
     headlineString = quest.getHeadlineString()
     captions = map(string.capwords, quest.getObjectiveStrings())
     imageColor = Vec4(*self.colors['white'])
     if quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest:
         frameBgColor = 'red'
         if quest.getType() == Quests.DeliverGagQuest:
             invModel = loader.loadModelOnce('phase_3.5/models/gui/inventory_icons')
             (track, item) = quest.getGagType()
             lIconGeom = invModel.find('**/' + AvPropsNew[track][item])
             invModel.removeNode()
         else:
             bookModel = loader.loadModelOnce('phase_3.5/models/gui/stickerbook_gui')
             lIconGeom = bookModel.find('**/package')
             lIconGeomScale = 0.12
             bookModel.removeNode()
         if not fComplete:
             captions.append(toNpcName)
             auxText = Localizer.QuestPosterAuxTo
             auxTextPos.setZ(0.12)
             lPos.setX(-0.17999999999999999)
             infoText = Localizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
             rIconGeom = self.createNpcToonHead(toNpcId)
             rIconGeomScale = IMAGE_SCALE_SMALL
         
     elif quest.getType() == Quests.RecoverItemQuest:
         frameBgColor = 'green'
         bookModel = loader.loadModelOnce('phase_3.5/models/gui/stickerbook_gui')
         lIconGeom = bookModel.find('**/package')
         lIconGeomScale = 0.12
         bookModel.removeNode()
         if not fComplete:
             rIconGeomScale = IMAGE_SCALE_SMALL
             holder = quest.getHolder()
             holderType = quest.getHolderType()
             if holder == Quests.Any:
                 cogIcons = loader.loadModelOnce('phase_3/models/gui/cog_icons')
                 rIconGeom = cogIcons.find('**/cog')
                 cogIcons.removeNode()
                 lPos.setX(-0.17999999999999999)
                 auxText = Localizer.QuestPosterAuxFrom
             elif holder == Quests.AnyFish:
                 headlineString = 'GO FISHING'
                 auxText = Localizer.QuestPosterAuxFor
                 auxTextPos.setX(-0.17999999999999999)
                 captions = captions[:1]
             elif holderType == 'track':
                 cogIcons = loader.loadModelOnce('phase_3/models/gui/cog_icons')
                 if holder == 'c':
                     icon = cogIcons.find('**/CorpIcon')
                 elif holder == 's':
                     icon = cogIcons.find('**/SalesIcon')
                 elif holder == 'l':
                     icon = cogIcons.find('**/LegalIcon')
                 elif holder == 'm':
                     icon = cogIcons.find('**/MoneyIcon')
                 
                 rIconGeom = icon.copyTo(hidden)
                 rIconGeom.setColor(Suit.Suit.medallionColors[holder])
                 rIconGeomScale = 0.12
                 cogIcons.removeNode()
             elif holderType == 'level':
                 cogIcons = loader.loadModelOnce('phase_3/models/gui/cog_icons')
                 rIconGeom = cogIcons.find('**/cog')
                 rIconGeomScale = IMAGE_SCALE_SMALL
                 cogIcons.removeNode()
             else:
                 rIconGeom = self.createSuitHead(holder)
             lPos.setX(-0.17999999999999999)
             auxText = Localizer.QuestPosterAuxFrom
             infoText = string.capwords(quest.getLocationName())
             if infoText == '':
                 infoText = Localizer.QuestPosterAnywhere
             
         
     elif quest.getType() == Quests.VisitQuest:
         frameBgColor = 'brown'
         captions[0] = '%s' % toNpcName
         lIconGeom = self.createNpcToonHead(toNpcId)
         lIconGeomScale = IMAGE_SCALE_SMALL
         if not fComplete:
             infoText = Localizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
         
     elif quest.getType() == Quests.TrackChoiceQuest:
         frameBgColor = 'green'
         invModel = loader.loadModelOnce('phase_3.5/models/gui/inventory_icons')
         (track1, track2) = quest.getChoices()
         lIconGeom = invModel.find('**/' + AvPropsNew[track1][1])
         if not fComplete:
             auxText = Localizer.QuestPosterAuxOr
             lPos.setX(-0.17999999999999999)
             rIconGeom = invModel.find('**/' + AvPropsNew[track2][1])
             infoText = Localizer.QuestPageNameAndDestination % (toNpcName, toNpcBuildingName, toNpcStreetName, toNpcLocationName)
             infoZ = -0.02
         
         invModel.removeNode()
     elif quest.getType() == Quests.BuildingQuest:
         frameBgColor = 'blue'
         track = quest.getBuildingTrack()
         numFloors = quest.getNumFloors()
         if track == 'c':
             lIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_corp')
         elif track == 'l':
             lIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_legal')
         elif track == 'm':
             lIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_money')
         elif track == 's':
             lIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_sales')
         else:
             bookModel = loader.loadModelCopy('phase_3.5/models/gui/stickerbook_gui')
             lIconGeom = bookModel.find('**/COG_building')
             bookModel.removeNode()
         if lIconGeom and track != Quests.Any:
             self.loadElevator(lIconGeom, numFloors)
             self.fitGeometry(lIconGeom, fFlip = 1)
             lIconGeomScale = IMAGE_SCALE_SMALL
         else:
             lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == '':
                 infoText = Localizer.QuestPosterAnywhere
             
         
     elif quest.getType() == Quests.BuildingNewbieQuest:
         frameBgColor = 'blue'
         track = quest.getBuildingTrack()
         numFloors = quest.getNumFloors()
         if track == 'c':
             rIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_corp')
         elif track == 'l':
             rIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_legal')
         elif track == 'm':
             rIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_money')
         elif track == 's':
             rIconGeom = loader.loadModelCopy('phase_5/models/modules/suit_landmark_sales')
         else:
             bookModel = loader.loadModelCopy('phase_3.5/models/gui/stickerbook_gui')
             rIconGeom = bookModel.find('**/COG_building')
             bookModel.removeNode()
         if rIconGeom and track != Quests.Any:
             self.loadElevator(rIconGeom, numFloors)
             self.fitGeometry(rIconGeom, fFlip = 1)
             rIconGeomScale = IMAGE_SCALE_SMALL
         else:
             rIconGeomScale = 0.13
         if not fComplete:
             headlineString = Localizer.QuestsNewbieQuestHeadline
             captions = [
                 Localizer.QuestsCogNewbieQuestCaption % quest.getNewbieLevel()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = Localizer.QuestsCogNewbieQuestAux
             lPos.setX(-0.17999999999999999)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.040000000000000001)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == '':
                 infoText = Localizer.QuestPosterAnywhere
             
         else:
             lIconGeom = rIconGeom
             lIconGeomScale = rIconGeomScale
     elif quest.getType() == Quests.FriendQuest:
         frameBgColor = 'brown'
         gui = loader.loadModelOnce('phase_3.5/models/gui/friendslist_gui')
         lIconGeom = gui.find('**/FriendsBox_Closed')
         lIconGeomScale = 0.45000000000000001
         gui.removeNode()
         infoText = Localizer.QuestPosterAnywhere
     elif quest.getType() == Quests.FriendNewbieQuest:
         frameBgColor = 'brown'
         gui = loader.loadModelOnce('phase_3.5/models/gui/friendslist_gui')
         lIconGeom = gui.find('**/FriendsBox_Closed')
         lIconGeomScale = 0.45000000000000001
         gui.removeNode()
         infoText = Localizer.QuestPosterAnywhere
     elif quest.getType() == Quests.TrolleyQuest:
         frameBgColor = 'lightBlue'
         gui = loader.loadModelOnce('phase_3.5/models/gui/stickerbook_gui')
         lIconGeom = gui.find('**/trolley')
         lIconGeomScale = 0.13
         gui.removeNode()
         infoText = Localizer.QuestPosterPlayground
     elif quest.getType() == Quests.MinigameNewbieQuest:
         frameBgColor = 'lightBlue'
         gui = loader.loadModelOnce('phase_3.5/models/gui/stickerbook_gui')
         rIconGeom = gui.find('**/trolley')
         rIconGeomScale = 0.13
         gui.removeNode()
         infoText = Localizer.QuestPosterPlayground
         if not fComplete:
             captions = [
                 Localizer.QuestsMinigameNewbieQuestCaption % quest.getNewbieLevel()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = Localizer.QuestsMinigameNewbieQuestAux
             lPos.setX(-0.17999999999999999)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.040000000000000001)
             lIconGeom = None
         else:
             lIconGeom = rIconGeom
             lIconGeomScale = rIconGeomScale
     else:
         frameBgColor = 'blue'
         if quest.getType() == Quests.CogTrackQuest:
             dept = quest.getCogTrack()
             cogIcons = loader.loadModelOnce('phase_3/models/gui/cog_icons')
             lIconGeomScale = 0.13
             if dept == 'c':
                 icon = cogIcons.find('**/CorpIcon')
             elif dept == 's':
                 icon = cogIcons.find('**/SalesIcon')
             elif dept == 'l':
                 icon = cogIcons.find('**/LegalIcon')
             elif dept == 'm':
                 icon = cogIcons.find('**/MoneyIcon')
             
             lIconGeom = icon.copyTo(hidden)
             lIconGeom.setColor(Suit.Suit.medallionColors[dept])
             cogIcons.removeNode()
         elif quest.getType() == Quests.CogQuest:
             if quest.getCogType() != Quests.Any:
                 lIconGeom = self.createSuitHead(quest.getCogType())
                 lIconGeomScale = IMAGE_SCALE_SMALL
             else:
                 cogIcons = loader.loadModelOnce('phase_3/models/gui/cog_icons')
                 lIconGeom = cogIcons.find('**/cog')
                 lIconGeomScale = IMAGE_SCALE_SMALL
                 cogIcons.removeNode()
         elif quest.getType() == Quests.CogLevelQuest:
             cogIcons = loader.loadModelOnce('phase_3/models/gui/cog_icons')
             lIconGeom = cogIcons.find('**/cog')
             lIconGeomScale = IMAGE_SCALE_SMALL
             cogIcons.removeNode()
         elif quest.getType() == Quests.CogNewbieQuest:
             if quest.getCogType() != Quests.Any:
                 rIconGeom = self.createSuitHead(quest.getCogType())
                 rIconGeomScale = IMAGE_SCALE_SMALL
             else:
                 cogIcons = loader.loadModelOnce('phase_3/models/gui/cog_icons')
                 rIconGeom = cogIcons.find('**/cog')
                 rIconGeomScale = IMAGE_SCALE_SMALL
                 cogIcons.removeNode()
             if not fComplete:
                 headlineString = Localizer.QuestsNewbieQuestHeadline
                 captions = [
                     Localizer.QuestsCogNewbieQuestCaption % quest.getNewbieLevel()]
                 captions.append(map(string.capwords, quest.getObjectiveStrings()))
                 auxText = Localizer.QuestsCogNewbieQuestAux
                 lPos.setX(-0.17999999999999999)
                 self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
                 self.laffMeter.setScale(0.040000000000000001)
                 lIconGeom = None
             else:
                 lIconGeom = rIconGeom
                 lIconGeomScale = rIconGeomScale
         
         if not fComplete:
             infoText = string.capwords(quest.getLocationName())
             if infoText == '':
                 infoText = Localizer.QuestPosterAnywhere
             
         
     if fComplete:
         textColor = (0, 0.29999999999999999, 0, 1)
         imageColor = Vec4(*self.colors['lightGreen'])
         lPos.setX(-0.17999999999999999)
         rIconGeom = self.createNpcToonHead(toNpcId)
         rIconGeomScale = IMAGE_SCALE_SMALL
         captions = captions[:1]
         captions.append(toNpcName)
         auxText = Localizer.QuestPosterAuxReturnTo
         headlineString = 'COMPLETE'
         infoText = Localizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
         if self.laffMeter != None:
             self.laffMeter.reparentTo(hidden)
             self.laffMeter.destroy()
             self.laffMeter = None
         
     else:
         textColor = self.normalTextColor
     self.show()
     self['image_color'] = imageColor
     self.headline['text_fg'] = textColor
     self.headline['text'] = headlineString
     self.lPictureFrame.show()
     self.lPictureFrame.setPos(lPos)
     self.lPictureFrame['text'] = captions[0]
     self.lPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
     if len(captions) > 1:
         self.rPictureFrame.show()
         self.rPictureFrame['text'] = captions[1]
         self.rPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
     else:
         self.rPictureFrame.hide()
     self.lQuestIcon['geom'] = lIconGeom
     self.lQuestIcon['geom_pos'] = (0, 10, 0)
     if lIconGeom:
         self.lQuestIcon['geom_scale'] = lIconGeomScale
     
     if self.laffMeter != None:
         self.laffMeter.reparentTo(self.lQuestIcon)
     
     self.rQuestIcon['geom'] = rIconGeom
     self.rQuestIcon['geom_pos'] = (0, 10, 0)
     if rIconGeom:
         self.rQuestIcon['geom_scale'] = rIconGeomScale
     
     self.questInfo['text'] = infoText
     self.questInfo.setZ(infoZ)
     self.fitLabel(self.questInfo)
     if auxText:
         self.auxText.show()
         self.auxText['text'] = auxText
         self.auxText.setPos(auxTextPos)
     else:
         self.auxText.hide()
     self.bind(WITHIN, self.mouseEnterPoster)
     self.bind(WITHOUT, self.mouseExitPoster)
     numQuestItems = quest.getNumQuestItems()
     if fComplete or numQuestItems <= 1:
         self.questProgress.hide()
     else:
         self.questProgress.show()
         self.questProgress['value'] = toonProgress
         self.questProgress['range'] = numQuestItems
         self.questProgress['text'] = quest.getProgressString(toonbase.localToon, questDesc)
コード例 #21
0
    def update(self, questDesc):
        questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
        quest = Quests.getQuest(questId)
        self.teleportButton['command'] = self.teleportToShop
        self.teleportButton['extraArgs'] = [toNpcId]
        if quest == None:
            self.notify.warning(
                'Tried to display poster for unknown quest %s' % questId)
            return
        if rewardId == Quests.NA:
            finalReward = Quests.getFinalRewardId(questId, fAll=1)
            transformedReward = Quests.transformReward(finalReward,
                                                       base.localAvatar)
            reward = Quests.getReward(transformedReward)
        else:
            reward = Quests.getReward(rewardId)
        if reward and questId not in Quests.NoRewardTierZeroQuests:
            rewardString = reward.getPosterString()
        else:
            rewardString = ''
        self.rewardText['text'] = rewardString
        self.fitLabel(self.rewardText)

        if Quests.isQuestJustForFun(questId, rewardId):
            self.funQuest.show()
        else:
            self.funQuest.hide()

        if self._deleteCallback:
            self.showDeleteButton(questDesc)
        else:
            self.hideDeleteButton()
        if self.laffMeter:
            self.laffMeter.destroy()
        fComplete = quest.getCompletionStatus(base.localAvatar,
                                              questDesc) == Quests.COMPLETE

        if Quests.isQuestJustForFun(questId, rewardId):
            if fComplete:
                self.funQuest.hide()
                self.teleportButton.show()
            else:
                self.teleportButton.hide()

        if toNpcId == Quests.ToonHQ:
            self.teleportButton.show()
            self.teleportButton.setPos(0.285, 0, -0.15)
            toNpcName = TTLocalizer.QuestPosterHQOfficer
            toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
            toNpcLocationName = TTLocalizer.QuestPosterHQLocationName
        elif toNpcId == Quests.ToonTailor:
            self.teleportButton.show()
            self.teleportButton.setPos(0.285, 0, -0.15)
            toNpcName = TTLocalizer.QuestPosterTailor
            toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
            toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName
        else:
            self.teleportButton.show()
            self.teleportButton.setPos(0.285, 0, -0.15)
            toNpcName = NPCToons.getNPCName(toNpcId)
            toNpcZone = NPCToons.getNPCZone(toNpcId)
            toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
            toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
            toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
            toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
            toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
        lPos = Vec3(0, 0, 0.13)
        lIconGeom = None
        lIconGeomScale = 1
        rIconGeom = None
        rIconGeomScale = 1
        infoText = ''
        infoZ = TTLocalizer.QPinfoZ
        auxText = None
        auxTextPos = Vec3(0, 0, 0.12)
        headlineString = quest.getHeadlineString()
        objectiveStrings = quest.getObjectiveStrings()
        captions = map(string.capwords, quest.getObjectiveStrings())
        imageColor = Vec4(*self.colors['white'])
        if isinstance(quest, Quests.TexturedQuest) and quest.hasFrame():
            self.teleportButton.hide()
            frame = quest.getFrame()
            frameBgColor = frame[1]
            lIconGeom = frame[0]
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.DeliverGagQuest or quest.getType(
        ) == Quests.DeliverItemQuest:
            frameBgColor = 'red'
            if fComplete:
                self.teleportButton.show()
                self.teleportButton.setPos(0.175, 0, -0.125)
            if quest.getType() == Quests.DeliverGagQuest:
                invModel = loader.loadModel(
                    'phase_3.5/models/gui/inventory_icons')
                track, item = quest.getGagType()
                lIconGeom = invModel.find('**/' + AvPropsNew[track][item])
                invModel.removeNode()
            else:
                bookModel = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/package')
                lIconGeomScale = 0.12
                bookModel.removeNode()
            if not fComplete:
                captions.append(toNpcName)
                auxText = TTLocalizer.QuestPosterAuxTo
                auxTextPos.setZ(0.12)
                lPos.setX(-0.18)
                infoText = TTLocalizer.QuestPageDestination % (
                    toNpcBuildingName, toNpcStreetName, toNpcLocationName)
                rIconGeom = self.createNpcToonHead(toNpcId)
                rIconGeomScale = IMAGE_SCALE_SMALL
                self.teleportButton.setPos(0.285, 0, -0.15)
        elif quest.getType() == Quests.RecoverItemQuest:
            frameBgColor = 'green'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            if not fComplete:
                rIconGeomScale = IMAGE_SCALE_SMALL
                holder = quest.getHolder()
                holderType = quest.getHolderType()
                if holder == Quests.Any:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    rIconGeom = cogIcons.find('**/cog')
                    cogIcons.removeNode()
                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom
                elif holder == Quests.AnyFish:
                    headlineString = TTLocalizer.QuestPosterFishing
                    auxText = TTLocalizer.QuestPosterAuxFor
                    auxTextPos.setX(-0.18)
                    captions = captions[:1]
                else:
                    if holderType == 'track':
                        cogIcons = loader.loadModel(
                            'phase_3/models/gui/cog_icons')
                        if holder in SuitDNA.suitDeptModelPaths:
                            icon = cogIcons.find(
                                SuitDNA.suitDeptModelPaths[holder])
                        rIconGeom = icon.copyTo(hidden)
                        rIconGeom.setColor(Suit.Suit.medallionColors[holder])
                        rIconGeomScale = 0.12
                        cogIcons.removeNode()
                    elif holderType == 'level':
                        cogIcons = loader.loadModel(
                            'phase_3/models/gui/cog_icons')
                        rIconGeom = cogIcons.find('**/cog')
                        rIconGeomScale = IMAGE_SCALE_SMALL
                        cogIcons.removeNode()
                    else:
                        rIconGeom = self.createSuitHead(holder)
                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
            else:
                self.teleportButton.show()
        elif quest.getType() == Quests.VisitQuest:
            self.teleportButton.show()
            frameBgColor = 'brown'
            captions[0] = '%s' % toNpcName
            lIconGeom = self.createNpcToonHead(toNpcId)
            lIconGeomScale = IMAGE_SCALE_SMALL
            if not fComplete:
                infoText = TTLocalizer.QuestPageDestination % (
                    toNpcBuildingName, toNpcStreetName, toNpcLocationName)
        elif quest.getType() == Quests.TrackChoiceQuest:
            frameBgColor = 'green'
            filmstrip = loader.loadModel('phase_3.5/models/gui/filmstrip')
            lIconGeom = DirectFrame(parent=self,
                                    relief=None,
                                    image=filmstrip,
                                    image_scale=.5)
            self.question = DirectLabel(parent=lIconGeom,
                                        relief=None,
                                        pos=(0, 0, 0),
                                        text='?',
                                        text_scale=0.2,
                                        text_pos=(0, -0.04),
                                        text_fg=(0.72, 0.72, 0.72, 1))
            lIconGeom['image_color'] = Vec4(0.7, 0.7, 0.7, 1)
            self.question['text_fg'] = Vec4(0.6, 0.6, 0.6, 1)
            rIconGeom = None
            filmstrip.removeNode()
        elif quest.getType() == Quests.BuildingQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            track = quest.getBuildingTrack()
            numFloors = quest.getNumFloors()
            if track == 'c':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_corp')
            elif track == 'l':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_legal')
            elif track == 'm':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_money')
            elif track == 's':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_sales')
            else:
                bookModel = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/COG_building')
                bookModel.removeNode()
            if lIconGeom and track != Quests.Any:
                self.loadElevator(lIconGeom, numFloors)
                lIconGeom.setH(180)
                self.fitGeometry(lIconGeom, fFlip=0)
                lIconGeomScale = IMAGE_SCALE_SMALL
            else:
                lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.FactoryQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/factoryIcon2')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.MintQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/CashBotMint')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.CogPartQuest:
            self.teleportButton.hide()
            frameBgColor = 'green'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/CogArmIcon2')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.ForemanQuest or quest.getType(
        ) == Quests.SupervisorQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/skelecog5')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.RescueQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            lIconGeom = self.createNpcToonHead(
                random.choice(NPCToons.HQnpcFriends.keys()))
            lIconGeomScale = 0.13
            infoText = quest.getLocationName().strip()
        elif quest.getType() == Quests.FriendQuest:
            self.teleportButton.hide()
            frameBgColor = 'brown'
            gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
            lIconGeom = gui.find('**/FriendsBox_Closed')
            lIconGeomScale = 0.45
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.TrolleyQuest:
            self.teleportButton.hide()
            frameBgColor = 'lightBlue'
            gui = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = gui.find('**/trolley')
            lIconGeomScale = 0.13
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterPlayground
        elif quest.getType() == Quests.MailboxQuest:
            self.teleportButton.hide()
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterAtHome
        elif quest.getType() == Quests.PhoneQuest:
            self.teleportButton.hide()
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/clarabelleCow')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterOnPhone
        else:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            if quest.getType() == Quests.CogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept in SuitDNA.suitDeptModelPaths:
                    icon = cogIcons.find(SuitDNA.suitDeptModelPaths[dept])
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()
            elif quest.getType() == Quests.CogQuest:
                if quest.getCogType() != Quests.Any:
                    lIconGeom = self.createSuitHead(quest.getCogType())
                    lIconGeomScale = IMAGE_SCALE_SMALL
                else:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    lIconGeom = cogIcons.find('**/cog')
                    lIconGeomScale = IMAGE_SCALE_SMALL
                    cogIcons.removeNode()
            elif quest.getType() == Quests.CogLevelQuest:
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeom = cogIcons.find('**/cog')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkelecogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept in SuitDNA.suitDeptModelPaths:
                    icon = cogIcons.find(SuitDNA.suitDeptModelPaths[dept])
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkelecogQuest:
                cogIcons = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkelecogLevelQuest:
                cogIcons = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkeleReviveQuest:
                cogIcons = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        if fComplete:
            self.teleportButton.show()
            textColor = (0, 0.3, 0, 1)
            imageColor = Vec4(*self.colors['lightGreen'])
            lPos.setX(-0.18)
            rIconGeom = self.createNpcToonHead(toNpcId)
            rIconGeomScale = IMAGE_SCALE_SMALL
            captions = captions[:1]
            captions.append(toNpcName)
            auxText = TTLocalizer.QuestPosterAuxReturnTo
            headlineString = TTLocalizer.QuestPosterComplete
            infoText = TTLocalizer.QuestPageDestination % (
                toNpcBuildingName, toNpcStreetName, toNpcLocationName)
            if self.laffMeter is not None:
                self.laffMeter.reparentTo(hidden)
                self.laffMeter.destroy()
                self.laffMeter = None
        else:
            textColor = self.normalTextColor
        self.show()
        self['image_color'] = imageColor
        self.headline['text_fg'] = textColor
        self.headline['text'] = headlineString
        if quest.getType() != Quests.TrackChoiceQuest:
            self.lPictureFrame.show()
            self.lPictureFrame.setPos(lPos)
            self.lPictureFrame['text_scale'] = TEXT_SCALE
            if lPos[0] != 0:
                self.lPictureFrame['text_scale'] = 0.0325
            self.lPictureFrame['text'] = captions[0]
            self.lPictureFrame['image_color'] = Vec4(
                *self.colors[frameBgColor])
        else:
            self.lPictureFrame['text'] = 'Track Choice'
            self.lPictureFrame['image_color'] = Vec4(
                *self.colors[frameBgColor])
        if len(captions) > 1 and quest.getType() != Quests.TrackChoiceQuest:
            self.rPictureFrame['text'] = captions[1]
            self.rPictureFrame['text_scale'] = 0.0325
            self.rPictureFrame['image_color'] = Vec4(
                *self.colors[frameBgColor])
        else:
            self.rPictureFrame.hide()
        self._deleteGeoms()
        self.lQuestIcon['geom'] = lIconGeom
        self.lQuestIcon['geom_pos'] = (0, 10, 0)
        if lIconGeom:
            try:
                self.lQuestIcon['geom_scale'] = lIconGeomScale
            except:
                pass
            try:
                self.lQuestIcon['geom_pos'] = Point3(lIconGeomPos[0],
                                                     lIconGeomPos[1],
                                                     lIconGeomPos[2])
            except:
                pass
            try:
                self.lQuestIcon['geom_hpr'] = Point3(lIconGeomHpr[0],
                                                     lIconGeomHpr[1],
                                                     lIconGeomHpr[2])
            except:
                pass
        if self.laffMeter != None:
            self.laffMeter.reparentTo(self.lQuestIcon)
        self.rQuestIcon['geom'] = rIconGeom
        self.rQuestIcon['geom_pos'] = (0, 10, 0)
        if rIconGeom:
            self.rQuestIcon['geom_scale'] = rIconGeomScale
        if auxText:
            self.auxText.show()
            self.auxText['text'] = auxText
            self.auxText.setPos(auxTextPos)
        else:
            self.auxText.hide()
        self.bind(DGG.WITHIN, self.mouseEnterPoster)
        self.bind(DGG.WITHOUT, self.mouseExitPoster)
        numQuestItems = quest.getNumQuestItems()
        if fComplete or numQuestItems <= 1:
            self.questProgress.hide()
            if not quest.getType() == Quests.TrackChoiceQuest:
                infoZ = -0.075
        else:
            self.questProgress.show()
            self.questProgress['value'] = toonProgress & pow(2, 16) - 1
            self.questProgress['range'] = numQuestItems
            self.questProgress['text'] = quest.getProgressString(
                base.localAvatar, questDesc)
        self.questInfo['text'] = infoText
        self.questInfo.setZ(infoZ)
        self.fitLabel(self.questInfo)
        if not Quests.QuestDict[questId][0] >= 11:
            self.teleportButton.hide()
        return
コード例 #22
0
 def update(self, questDesc):
     questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
     quest = Quests.getQuest(questId)
     if quest == None:
         self.notify.warning("Tried to display poster for unknown quest %s" % questId)
         return
     if rewardId == Quests.NA:
         finalReward = Quests.getFinalRewardId(questId, fAll=1)
         transformedReward = Quests.transformReward(finalReward, base.localAvatar)
         reward = Quests.getReward(transformedReward)
     else:
         reward = Quests.getReward(rewardId)
     if reward and questId not in Quests.NoRewardTierZeroQuests:
         rewardString = reward.getPosterString()
     else:
         rewardString = ""
     self.rewardText["text"] = rewardString
     self.fitLabel(self.rewardText)
     if Quests.isQuestJustForFun(questId, rewardId):
         self.funQuest.show()
     else:
         self.funQuest.hide()
     if self._deleteCallback:
         self.showDeleteButton(questDesc)
     else:
         self.hideDeleteButton()
     fComplete = quest.getCompletionStatus(base.localAvatar, questDesc) == Quests.COMPLETE
     if toNpcId == Quests.ToonHQ:
         toNpcName = TTLocalizer.QuestPosterHQOfficer
         toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
         toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
         toNpcLocationName = TTLocalizer.QuestPosterHQLocationName
     elif toNpcId == Quests.ToonTailor:
         toNpcName = TTLocalizer.QuestPosterTailor
         toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
         toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
         toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName
     else:
         toNpcName = NPCToons.getNPCName(toNpcId)
         toNpcZone = NPCToons.getNPCZone(toNpcId)
         toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
         toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
         toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
         toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
         toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
     lPos = Vec3(0, 0, 0.13)
     lIconGeom = None
     lIconGeomScale = 1
     rIconGeom = None
     rIconGeomScale = 1
     infoText = ""
     infoZ = TTLocalizer.QPinfoZ
     auxText = None
     auxTextPos = Vec3(0, 0, 0.12)
     headlineString = quest.getHeadlineString()
     objectiveStrings = quest.getObjectiveStrings()
     captions = map(string.capwords, quest.getObjectiveStrings())
     imageColor = Vec4(*self.colors["white"])
     if quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest:
         frameBgColor = "red"
         if quest.getType() == Quests.DeliverGagQuest:
             invModel = loader.loadModel("phase_3.5/models/gui/inventory_icons")
             track, item = quest.getGagType()
             lIconGeom = invModel.find("**/" + AvPropsNew[track][item])
             invModel.removeNode()
         else:
             bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
             lIconGeom = bookModel.find("**/package")
             lIconGeomScale = 0.12
             bookModel.removeNode()
         if not fComplete:
             captions.append(toNpcName)
             auxText = TTLocalizer.QuestPosterAuxTo
             auxTextPos.setZ(0.12)
             lPos.setX(-0.18)
             infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
             rIconGeom = self.createNpcToonHead(toNpcId)
             rIconGeomScale = IMAGE_SCALE_SMALL
     elif quest.getType() == Quests.RecoverItemQuest:
         frameBgColor = "green"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/package")
         lIconGeomScale = 0.12
         bookModel.removeNode()
         if not fComplete:
             rIconGeomScale = IMAGE_SCALE_SMALL
             holder = quest.getHolder()
             holderType = quest.getHolderType()
             if holder == Quests.Any:
                 cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
                 rIconGeom = cogIcons.find("**/cog")
                 cogIcons.removeNode()
                 lPos.setX(-0.18)
                 auxText = TTLocalizer.QuestPosterAuxFrom
             elif holder == Quests.AnyFish:
                 headlineString = TTLocalizer.QuestPosterFishing
                 auxText = TTLocalizer.QuestPosterAuxFor
                 auxTextPos.setX(-0.18)
                 captions = captions[:1]
             else:
                 if holderType == "track":
                     cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
                     if holder == "c":
                         icon = cogIcons.find("**/CorpIcon")
                     elif holder == "s":
                         icon = cogIcons.find("**/SalesIcon")
                     elif holder == "l":
                         icon = cogIcons.find("**/LegalIcon")
                     elif holder == "m":
                         icon = cogIcons.find("**/MoneyIcon")
                     rIconGeom = icon.copyTo(hidden)
                     rIconGeom.setColor(Suit.Suit.medallionColors[holder])
                     rIconGeomScale = 0.12
                     cogIcons.removeNode()
                 elif holderType == "level":
                     cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
                     rIconGeom = cogIcons.find("**/cog")
                     rIconGeomScale = IMAGE_SCALE_SMALL
                     cogIcons.removeNode()
                 else:
                     rIconGeom = self.createSuitHead(holder)
                 lPos.setX(-0.18)
                 auxText = TTLocalizer.QuestPosterAuxFrom
             infoText = string.capwords(quest.getLocationName())
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.VisitQuest:
         frameBgColor = "brown"
         captions[0] = "%s" % toNpcName
         lIconGeom = self.createNpcToonHead(toNpcId)
         lIconGeomScale = IMAGE_SCALE_SMALL
         if not fComplete:
             infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
     elif quest.getType() == Quests.TrackChoiceQuest:
         frameBgColor = "green"
         invModel = loader.loadModel("phase_3.5/models/gui/inventory_icons")
         track1, track2 = quest.getChoices()
         lIconGeom = invModel.find("**/" + AvPropsNew[track1][1])
         if not fComplete:
             auxText = TTLocalizer.QuestPosterAuxOr
             lPos.setX(-0.18)
             rIconGeom = invModel.find("**/" + AvPropsNew[track2][1])
             infoText = TTLocalizer.QuestPageNameAndDestination % (
                 toNpcName,
                 toNpcBuildingName,
                 toNpcStreetName,
                 toNpcLocationName,
             )
             infoZ = -0.02
         invModel.removeNode()
     elif quest.getType() == Quests.BuildingQuest:
         frameBgColor = "blue"
         track = quest.getBuildingTrack()
         numFloors = quest.getNumFloors()
         if track == "c":
             lIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_corp")
         elif track == "l":
             lIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_legal")
         elif track == "m":
             lIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_money")
         elif track == "s":
             lIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_sales")
         else:
             bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
             lIconGeom = bookModel.find("**/COG_building")
             bookModel.removeNode()
         if lIconGeom and track != Quests.Any:
             self.loadElevator(lIconGeom, numFloors)
             lIconGeom.setH(180)
             self.fitGeometry(lIconGeom, fFlip=0)
             lIconGeomScale = IMAGE_SCALE_SMALL
         else:
             lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.BuildingNewbieQuest:
         frameBgColor = "blue"
         track = quest.getBuildingTrack()
         numFloors = quest.getNumFloors()
         if track == "c":
             rIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_corp")
         elif track == "l":
             rIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_legal")
         elif track == "m":
             rIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_money")
         elif track == "s":
             rIconGeom = loader.loadModel("phase_4/models/modules/suit_landmark_sales")
         else:
             bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
             rIconGeom = bookModel.find("**/COG_building")
             bookModel.removeNode()
         if rIconGeom and track != Quests.Any:
             self.loadElevator(rIconGeom, numFloors)
             rIconGeom.setH(180)
             self.fitGeometry(rIconGeom, fFlip=0)
             rIconGeomScale = IMAGE_SCALE_SMALL
         else:
             rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsCogNewbieQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.FactoryQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/factoryIcon2")
         bookModel.removeNode()
         lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.FactoryNewbieQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         rIconGeom = bookModel.find("**/factoryIcon2")
         bookModel.removeNode()
         rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsCogNewbieQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.MintQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/CashBotMint")
         bookModel.removeNode()
         lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.MintNewbieQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         rIconGeom = bookModel.find("**/CashBotMint")
         bookModel.removeNode()
         rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsCogNewbieQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.CogPartQuest:
         frameBgColor = "green"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/CogArmIcon2")
         bookModel.removeNode()
         lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.CogPartNewbieQuest:
         frameBgColor = "green"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         rIconGeom = bookModel.find("**/CogArmIcon2")
         bookModel.removeNode()
         rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsCogPartQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.ForemanQuest or quest.getType() == Quests.SupervisorQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/skelecog5")
         bookModel.removeNode()
         lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.ForemanNewbieQuest or quest.getType() == Quests.SupervisorNewbieQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         rIconGeom = bookModel.find("**/skelecog5")
         bookModel.removeNode()
         rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsCogNewbieQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.VPQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/BossHead3Icon")
         bookModel.removeNode()
         lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.VPNewbieQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         rIconGeom = bookModel.find("**/BossHead3Icon")
         bookModel.removeNode()
         rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsCogNewbieQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.CFOQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/CashBotBossHeadIcon")
         bookModel.removeNode()
         lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.CFONewbieQuest:
         frameBgColor = "blue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         rIconGeom = bookModel.find("**/CashBotBossHeadIcon")
         bookModel.removeNode()
         rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsCogNewbieQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.RescueQuest:
         frameBgColor = "blue"
         lIconGeom = self.createNpcToonHead(2001)
         lIconGeomScale = 0.13
         if not fComplete:
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.RescueNewbieQuest:
         frameBgColor = "blue"
         rIconGeom = self.createNpcToonHead(2001)
         rIconGeomScale = 0.13
         if not fComplete:
             headlineString = TTLocalizer.QuestsNewbieQuestHeadline
             captions = [quest.getCaption()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsRescueQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
             infoText = quest.getLocationName()
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     elif quest.getType() == Quests.FriendQuest:
         frameBgColor = "brown"
         gui = loader.loadModel("phase_3.5/models/gui/friendslist_gui")
         lIconGeom = gui.find("**/FriendsBox_Closed")
         lIconGeomScale = 0.45
         gui.removeNode()
         infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.FriendNewbieQuest:
         frameBgColor = "brown"
         gui = loader.loadModel("phase_3.5/models/gui/friendslist_gui")
         lIconGeom = gui.find("**/FriendsBox_Closed")
         lIconGeomScale = 0.45
         gui.removeNode()
         infoText = TTLocalizer.QuestPosterAnywhere
     elif quest.getType() == Quests.TrolleyQuest:
         frameBgColor = "lightBlue"
         gui = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = gui.find("**/trolley")
         lIconGeomScale = 0.13
         gui.removeNode()
         infoText = TTLocalizer.QuestPosterPlayground
     elif quest.getType() == Quests.MailboxQuest:
         frameBgColor = "lightBlue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/package")
         lIconGeomScale = 0.12
         bookModel.removeNode()
         infoText = TTLocalizer.QuestPosterAtHome
     elif quest.getType() == Quests.PhoneQuest:
         frameBgColor = "lightBlue"
         bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         lIconGeom = bookModel.find("**/clarabelleCow")
         lIconGeomScale = 0.12
         bookModel.removeNode()
         infoText = TTLocalizer.QuestPosterOnPhone
     elif quest.getType() == Quests.MinigameNewbieQuest:
         frameBgColor = "lightBlue"
         gui = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
         rIconGeom = gui.find("**/trolley")
         rIconGeomScale = 0.13
         gui.removeNode()
         infoText = TTLocalizer.QuestPosterPlayground
         if not fComplete:
             captions = [TTLocalizer.QuestsMinigameNewbieQuestCaption % quest.getNewbieLevel()]
             captions.append(map(string.capwords, quest.getObjectiveStrings()))
             auxText = TTLocalizer.QuestsMinigameNewbieQuestAux
             lPos.setX(-0.18)
             self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
             self.laffMeter.setScale(0.04)
             lIconGeom = None
         else:
             lIconGeom = rIconGeom
             rIconGeom = None
             lIconGeomScale = rIconGeomScale
             rIconGeomScale = 1
     else:
         frameBgColor = "blue"
         if quest.getType() == Quests.CogTrackQuest:
             dept = quest.getCogTrack()
             cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
             lIconGeomScale = 0.13
             if dept == "c":
                 icon = cogIcons.find("**/CorpIcon")
             elif dept == "s":
                 icon = cogIcons.find("**/SalesIcon")
             elif dept == "l":
                 icon = cogIcons.find("**/LegalIcon")
             elif dept == "m":
                 icon = cogIcons.find("**/MoneyIcon")
             lIconGeom = icon.copyTo(hidden)
             lIconGeom.setColor(Suit.Suit.medallionColors[dept])
             cogIcons.removeNode()
         elif quest.getType() == Quests.CogQuest:
             if quest.getCogType() != Quests.Any:
                 lIconGeom = self.createSuitHead(quest.getCogType())
                 lIconGeomScale = IMAGE_SCALE_SMALL
             else:
                 cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
                 lIconGeom = cogIcons.find("**/cog")
                 lIconGeomScale = IMAGE_SCALE_SMALL
                 cogIcons.removeNode()
         elif quest.getType() == Quests.CogLevelQuest:
             cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
             lIconGeom = cogIcons.find("**/cog")
             lIconGeomScale = IMAGE_SCALE_SMALL
             cogIcons.removeNode()
         elif quest.getType() == Quests.CogNewbieQuest:
             if quest.getCogType() != Quests.Any:
                 rIconGeom = self.createSuitHead(quest.getCogType())
                 rIconGeomScale = IMAGE_SCALE_SMALL
             else:
                 cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
                 rIconGeom = cogIcons.find("**/cog")
                 rIconGeomScale = IMAGE_SCALE_SMALL
                 cogIcons.removeNode()
             if not fComplete:
                 headlineString = TTLocalizer.QuestsNewbieQuestHeadline
                 captions = [quest.getCaption()]
                 captions.append(map(string.capwords, quest.getObjectiveStrings()))
                 auxText = TTLocalizer.QuestsCogNewbieQuestAux
                 lPos.setX(-0.18)
                 self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
                 self.laffMeter.setScale(0.04)
                 lIconGeom = None
             else:
                 lIconGeom = rIconGeom
                 rIconGeom = None
                 lIconGeomScale = rIconGeomScale
                 rIconGeomScale = 1
         elif quest.getType() == Quests.SkelecogTrackQuest:
             dept = quest.getCogTrack()
             cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
             lIconGeomScale = 0.13
             if dept == "c":
                 icon = cogIcons.find("**/CorpIcon")
             elif dept == "s":
                 icon = cogIcons.find("**/SalesIcon")
             elif dept == "l":
                 icon = cogIcons.find("**/LegalIcon")
             elif dept == "m":
                 icon = cogIcons.find("**/MoneyIcon")
             lIconGeom = icon.copyTo(hidden)
             lIconGeom.setColor(Suit.Suit.medallionColors[dept])
             cogIcons.removeNode()
         elif quest.getType() == Quests.SkelecogQuest:
             cogIcons = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
             lIconGeom = cogIcons.find("**/skelecog5")
             lIconGeomScale = IMAGE_SCALE_SMALL
             cogIcons.removeNode()
         elif quest.getType() == Quests.SkelecogLevelQuest:
             cogIcons = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
             lIconGeom = cogIcons.find("**/skelecog5")
             lIconGeomScale = IMAGE_SCALE_SMALL
             cogIcons.removeNode()
         elif quest.getType() == Quests.SkelecogNewbieQuest:
             cogIcons = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
             rIconGeom = cogIcons.find("**/skelecog5")
             rIconGeomScale = IMAGE_SCALE_SMALL
             cogIcons.removeNode()
             if not fComplete:
                 headlineString = TTLocalizer.QuestsNewbieQuestHeadline
                 captions = [quest.getCaption()]
                 captions.append(map(string.capwords, quest.getObjectiveStrings()))
                 auxText = TTLocalizer.QuestsCogNewbieQuestAux
                 lPos.setX(-0.18)
                 self.laffMeter = self.createLaffMeter(quest.getNewbieLevel())
                 self.laffMeter.setScale(0.04)
                 lIconGeom = None
             else:
                 lIconGeom = rIconGeom
                 rIconGeom = None
                 lIconGeomScale = rIconGeomScale
                 rIconGeomScale = 1
         elif quest.getType() == Quests.SkeleReviveQuest:
             cogIcons = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
             lIconGeom = cogIcons.find("**/skelecog5")
             lIconGeomScale = IMAGE_SCALE_SMALL
             cogIcons.removeNode()
         if not fComplete:
             infoText = string.capwords(quest.getLocationName())
             if infoText == "":
                 infoText = TTLocalizer.QuestPosterAnywhere
     if fComplete:
         textColor = (0, 0.3, 0, 1)
         imageColor = Vec4(*self.colors["lightGreen"])
         lPos.setX(-0.18)
         rIconGeom = self.createNpcToonHead(toNpcId)
         rIconGeomScale = IMAGE_SCALE_SMALL
         captions = captions[:1]
         captions.append(toNpcName)
         auxText = TTLocalizer.QuestPosterAuxReturnTo
         headlineString = TTLocalizer.QuestPosterComplete
         infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
         if self.laffMeter != None:
             self.laffMeter.reparentTo(hidden)
             self.laffMeter.destroy()
             self.laffMeter = None
     else:
         textColor = self.normalTextColor
     self.show()
     self["image_color"] = imageColor
     self.headline["text_fg"] = textColor
     self.headline["text"] = headlineString
     self.lPictureFrame.show()
     self.lPictureFrame.setPos(lPos)
     self.lPictureFrame["text_scale"] = TEXT_SCALE
     if lPos[0] != 0:
         self.lPictureFrame["text_scale"] = 0.0325
     self.lPictureFrame["text"] = captions[0]
     self.lPictureFrame["image_color"] = Vec4(*self.colors[frameBgColor])
     if len(captions) > 1:
         self.rPictureFrame.show()
         self.rPictureFrame["text"] = captions[1]
         self.rPictureFrame["text_scale"] = 0.0325
         self.rPictureFrame["image_color"] = Vec4(*self.colors[frameBgColor])
     else:
         self.rPictureFrame.hide()
     self._deleteGeoms()
     self.lQuestIcon["geom"] = lIconGeom
     self.lQuestIcon["geom_pos"] = (0, 10, 0)
     if lIconGeom:
         self.lQuestIcon["geom_scale"] = lIconGeomScale
     if self.laffMeter != None:
         self.laffMeter.reparentTo(self.lQuestIcon)
     self.rQuestIcon["geom"] = rIconGeom
     self.rQuestIcon["geom_pos"] = (0, 10, 0)
     if rIconGeom:
         self.rQuestIcon["geom_scale"] = rIconGeomScale
     if auxText:
         self.auxText.show()
         self.auxText["text"] = auxText
         self.auxText.setPos(auxTextPos)
     else:
         self.auxText.hide()
     self.bind(DGG.WITHIN, self.mouseEnterPoster)
     self.bind(DGG.WITHOUT, self.mouseExitPoster)
     numQuestItems = quest.getNumQuestItems()
     if fComplete or numQuestItems <= 1:
         self.questProgress.hide()
         if not quest.getType() == Quests.TrackChoiceQuest:
             infoZ = -0.075
     else:
         self.questProgress.show()
         self.questProgress["value"] = toonProgress & pow(2, 16) - 1
         self.questProgress["range"] = numQuestItems
         self.questProgress["text"] = quest.getProgressString(base.localAvatar, questDesc)
     self.questInfo["text"] = infoText
     self.questInfo.setZ(infoZ)
     self.fitLabel(self.questInfo)
     return
コード例 #23
0
 def __toonQuestsList2Quests(self, quests):
     return [ Quests.getQuest(x[0]) for x in quests ]
コード例 #24
0
 def update(self, questDesc):
     questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
     quest = Quests.getQuest(questId)
     if rewardId == Quests.NA:
         finalReward = Quests.getFinalRewardId(questId, fAll=1)
         transformedReward = Quests.transformReward(finalReward,
                                                    toonbase.localToon)
         reward = Quests.getReward(transformedReward)
     else:
         reward = Quests.getReward(rewardId)
     if reward:
         rewardString = reward.getPosterString()
     else:
         rewardString = ''
     self.rewardText['text'] = rewardString
     self.fitLabel(self.rewardText)
     questEntry = Quests.QuestDict.get(questId)
     if questEntry:
         tier = questEntry[0]
         fOptional = Quests.isRewardOptional(tier, rewardId)
     else:
         fOptional = 0
     if fOptional:
         self.funQuest.show()
     else:
         self.funQuest.hide()
     fComplete = quest.getCompletionStatus(toonbase.localToon,
                                           questDesc) == Quests.COMPLETE
     fromNpcName = NPCToons.getNPCName(fromNpcId)
     npcZone = NPCToons.getNPCZone(fromNpcId)
     hoodId = ZoneUtil.getHoodId(npcZone)
     branchId = ZoneUtil.getBranchZone(npcZone)
     if fromNpcId == Quests.ToonHQ:
         locationName = Localizer.QuestPosterHQLocationName
         buildingName = Localizer.QuestPosterHQBuildingName
         streetName = Localizer.QuestPosterHQStreetName
     else:
         if fromNpcId == Quests.ToonTailor:
             locationName = Localizer.QuestPosterTailorLocationName
             buildingName = Localizer.QuestPosterTailorBuildingName
             streetName = Localizer.QuestPosterTailorStreetName
         else:
             locationName = toonbase.tcr.hoodMgr.getFullnameFromId(hoodId)
             buildingName = NPCToons.getBuildingTitle(npcZone)
             streetName = ZoneUtil.getStreetName(branchId)
     if toNpcId == Quests.ToonHQ:
         toNpcName = Localizer.QuestPosterHQOfficer
         toNpcBuildingName = Localizer.QuestPosterHQBuildingName
         toNpcStreetName = Localizer.QuestPosterHQStreetName
         toNpcLocationName = Localizer.QuestPosterHQLocationName
     else:
         if toNpcId == Quests.ToonTailor:
             toNpcName = Localizer.QuestPosterTailor
             toNpcBuildingName = Localizer.QuestPosterTailorBuildingName
             toNpcStreetName = Localizer.QuestPosterTailorStreetName
             toNpcLocationName = Localizer.QuestPosterTailorLocationName
         else:
             toNpcName = NPCToons.getNPCName(toNpcId)
             toNpcZone = NPCToons.getNPCZone(toNpcId)
             toNpcHoodId = ZoneUtil.getHoodId(toNpcZone)
             toNpcLocationName = toonbase.tcr.hoodMgr.getFullnameFromId(
                 toNpcHoodId)
             toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
             toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
             toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
     lPos = Vec3(0, 0, 0.13)
     lIconGeom = None
     lIconGeomScale = 1
     rIconGeom = None
     rIconGeomScale = 1
     infoText = ''
     infoZ = -0.0625
     auxText = None
     auxTextPos = Vec3(0, 0, 0.12)
     headlineString = quest.getHeadlineString()
     captions = map(string.capwords, quest.getObjectiveStrings())
     imageColor = Vec4(*self.colors['white'])
     if quest.getType() == Quests.DeliverGagQuest or quest.getType(
     ) == Quests.DeliverItemQuest:
         frameBgColor = 'red'
         if quest.getType() == Quests.DeliverGagQuest:
             invModel = loader.loadModelOnce(
                 'phase_3.5/models/gui/inventory_icons')
             track, item = quest.getGagType()
             lIconGeom = invModel.find('**/' + AvPropsNew[track][item])
             invModel.removeNode()
         else:
             bookModel = loader.loadModelOnce(
                 'phase_3.5/models/gui/stickerbook_gui')
             lIconGeom = bookModel.find('**/package')
             lIconGeomScale = 0.12
             bookModel.removeNode()
         if not fComplete:
             captions.append(toNpcName)
             auxText = Localizer.QuestPosterAuxTo
             auxTextPos.setZ(0.12)
             lPos.setX(-0.18)
             infoText = Localizer.QuestPageDestination % (
                 toNpcBuildingName, toNpcStreetName, toNpcLocationName)
             rIconGeom = self.createNpcToonHead(toNpcId)
             rIconGeomScale = IMAGE_SCALE_SMALL
     else:
         if quest.getType() == Quests.RecoverItemQuest:
             frameBgColor = 'green'
             bookModel = loader.loadModelOnce(
                 'phase_3.5/models/gui/stickerbook_gui')
             lIconGeom = bookModel.find('**/package')
             lIconGeomScale = 0.12
             bookModel.removeNode()
             if not fComplete:
                 rIconGeomScale = IMAGE_SCALE_SMALL
                 holder = quest.getHolder()
                 holderType = quest.getHolderType()
                 if holder == Quests.Any:
                     cogIcons = loader.loadModelOnce(
                         'phase_3/models/gui/cog_icons')
                     rIconGeom = cogIcons.find('**/cog')
                     cogIcons.removeNode()
                     lPos.setX(-0.18)
                     auxText = Localizer.QuestPosterAuxFrom
                 else:
                     if holder == Quests.AnyFish:
                         headlineString = 'GO FISHING'
                         auxText = Localizer.QuestPosterAuxFor
                         auxTextPos.setX(-0.18)
                         captions = captions[:1]
                     else:
                         if holderType == 'track':
                             cogIcons = loader.loadModelOnce(
                                 'phase_3/models/gui/cog_icons')
                             if holder == 'c':
                                 icon = cogIcons.find('**/CorpIcon')
                             else:
                                 if holder == 's':
                                     icon = cogIcons.find('**/SalesIcon')
                                 else:
                                     if holder == 'l':
                                         icon = cogIcons.find(
                                             '**/LegalIcon')
                                     else:
                                         if holder == 'm':
                                             icon = cogIcons.find(
                                                 '**/MoneyIcon')
                             rIconGeom = icon.copyTo(hidden)
                             rIconGeom.setColor(
                                 Suit.Suit.medallionColors[holder])
                             rIconGeomScale = 0.12
                             cogIcons.removeNode()
                         else:
                             if holderType == 'level':
                                 cogIcons = loader.loadModelOnce(
                                     'phase_3/models/gui/cog_icons')
                                 rIconGeom = cogIcons.find('**/cog')
                                 rIconGeomScale = IMAGE_SCALE_SMALL
                                 cogIcons.removeNode()
                             else:
                                 rIconGeom = self.createSuitHead(holder)
                         lPos.setX(-0.18)
                         auxText = Localizer.QuestPosterAuxFrom
                 infoText = string.capwords(quest.getLocationName())
                 if infoText == '':
                     infoText = Localizer.QuestPosterAnywhere
         else:
             if quest.getType() == Quests.VisitQuest:
                 frameBgColor = 'brown'
                 captions[0] = '%s' % toNpcName
                 lIconGeom = self.createNpcToonHead(toNpcId)
                 lIconGeomScale = IMAGE_SCALE_SMALL
                 if not fComplete:
                     infoText = Localizer.QuestPageDestination % (
                         toNpcBuildingName, toNpcStreetName,
                         toNpcLocationName)
             else:
                 if quest.getType() == Quests.TrackChoiceQuest:
                     frameBgColor = 'green'
                     invModel = loader.loadModelOnce(
                         'phase_3.5/models/gui/inventory_icons')
                     track1, track2 = quest.getChoices()
                     lIconGeom = invModel.find('**/' +
                                               AvPropsNew[track1][1])
                     if not fComplete:
                         auxText = Localizer.QuestPosterAuxOr
                         lPos.setX(-0.18)
                         rIconGeom = invModel.find('**/' +
                                                   AvPropsNew[track2][1])
                         infoText = Localizer.QuestPageNameAndDestination % (
                             toNpcName, toNpcBuildingName, toNpcStreetName,
                             toNpcLocationName)
                         infoZ = -0.02
                     invModel.removeNode()
                 else:
                     if quest.getType() == Quests.BuildingQuest:
                         frameBgColor = 'blue'
                         track = quest.getBuildingTrack()
                         numFloors = quest.getNumFloors()
                         if track == 'c':
                             lIconGeom = loader.loadModelCopy(
                                 'phase_5/models/modules/suit_landmark_corp'
                             )
                         else:
                             if track == 'l':
                                 lIconGeom = loader.loadModelCopy(
                                     'phase_5/models/modules/suit_landmark_legal'
                                 )
                             else:
                                 if track == 'm':
                                     lIconGeom = loader.loadModelCopy(
                                         'phase_5/models/modules/suit_landmark_money'
                                     )
                                 else:
                                     if track == 's':
                                         lIconGeom = loader.loadModelCopy(
                                             'phase_5/models/modules/suit_landmark_sales'
                                         )
                                     else:
                                         bookModel = loader.loadModelCopy(
                                             'phase_3.5/models/gui/stickerbook_gui'
                                         )
                                         lIconGeom = bookModel.find(
                                             '**/COG_building')
                                         bookModel.removeNode()
                         if lIconGeom and track != Quests.Any:
                             self.loadElevator(lIconGeom, numFloors)
                             self.fitGeometry(lIconGeom, fFlip=1)
                             lIconGeomScale = IMAGE_SCALE_SMALL
                         else:
                             lIconGeomScale = 0.13
                         if not fComplete:
                             infoText = quest.getLocationName()
                             if infoText == '':
                                 infoText = Localizer.QuestPosterAnywhere
                     else:
                         if quest.getType() == Quests.BuildingNewbieQuest:
                             frameBgColor = 'blue'
                             track = quest.getBuildingTrack()
                             numFloors = quest.getNumFloors()
                             if track == 'c':
                                 rIconGeom = loader.loadModelCopy(
                                     'phase_5/models/modules/suit_landmark_corp'
                                 )
                             else:
                                 if track == 'l':
                                     rIconGeom = loader.loadModelCopy(
                                         'phase_5/models/modules/suit_landmark_legal'
                                     )
                                 else:
                                     if track == 'm':
                                         rIconGeom = loader.loadModelCopy(
                                             'phase_5/models/modules/suit_landmark_money'
                                         )
                                     else:
                                         if track == 's':
                                             rIconGeom = loader.loadModelCopy(
                                                 'phase_5/models/modules/suit_landmark_sales'
                                             )
                                         else:
                                             bookModel = loader.loadModelCopy(
                                                 'phase_3.5/models/gui/stickerbook_gui'
                                             )
                                             rIconGeom = bookModel.find(
                                                 '**/COG_building')
                                             bookModel.removeNode()
                             if rIconGeom and track != Quests.Any:
                                 self.loadElevator(rIconGeom, numFloors)
                                 self.fitGeometry(rIconGeom, fFlip=1)
                                 rIconGeomScale = IMAGE_SCALE_SMALL
                             else:
                                 rIconGeomScale = 0.13
                             if not fComplete:
                                 headlineString = Localizer.QuestsNewbieQuestHeadline
                                 captions = [
                                     Localizer.QuestsCogNewbieQuestCaption %
                                     quest.getNewbieLevel()
                                 ]
                                 captions.append(
                                     map(string.capwords,
                                         quest.getObjectiveStrings()))
                                 auxText = Localizer.QuestsCogNewbieQuestAux
                                 lPos.setX(-0.18)
                                 self.laffMeter = self.createLaffMeter(
                                     quest.getNewbieLevel())
                                 self.laffMeter.setScale(0.04)
                                 lIconGeom = None
                                 infoText = quest.getLocationName()
                                 if infoText == '':
                                     infoText = Localizer.QuestPosterAnywhere
                             else:
                                 lIconGeom = rIconGeom
                                 lIconGeomScale = rIconGeomScale
                         else:
                             if quest.getType() == Quests.FriendQuest:
                                 frameBgColor = 'brown'
                                 gui = loader.loadModelOnce(
                                     'phase_3.5/models/gui/friendslist_gui')
                                 lIconGeom = gui.find(
                                     '**/FriendsBox_Closed')
                                 lIconGeomScale = 0.45
                                 gui.removeNode()
                                 infoText = Localizer.QuestPosterAnywhere
                             else:
                                 if quest.getType(
                                 ) == Quests.FriendNewbieQuest:
                                     frameBgColor = 'brown'
                                     gui = loader.loadModelOnce(
                                         'phase_3.5/models/gui/friendslist_gui'
                                     )
                                     lIconGeom = gui.find(
                                         '**/FriendsBox_Closed')
                                     lIconGeomScale = 0.45
                                     gui.removeNode()
                                     infoText = Localizer.QuestPosterAnywhere
                                 else:
                                     if quest.getType(
                                     ) == Quests.TrolleyQuest:
                                         frameBgColor = 'lightBlue'
                                         gui = loader.loadModelOnce(
                                             'phase_3.5/models/gui/stickerbook_gui'
                                         )
                                         lIconGeom = gui.find('**/trolley')
                                         lIconGeomScale = 0.13
                                         gui.removeNode()
                                         infoText = Localizer.QuestPosterPlayground
                                     else:
                                         if quest.getType(
                                         ) == Quests.MinigameNewbieQuest:
                                             frameBgColor = 'lightBlue'
                                             gui = loader.loadModelOnce(
                                                 'phase_3.5/models/gui/stickerbook_gui'
                                             )
                                             rIconGeom = gui.find(
                                                 '**/trolley')
                                             rIconGeomScale = 0.13
                                             gui.removeNode()
                                             infoText = Localizer.QuestPosterPlayground
                                             if not fComplete:
                                                 captions = [
                                                     Localizer.
                                                     QuestsMinigameNewbieQuestCaption
                                                     %
                                                     quest.getNewbieLevel()
                                                 ]
                                                 captions.append(
                                                     map(
                                                         string.capwords,
                                                         quest.
                                                         getObjectiveStrings(
                                                         )))
                                                 auxText = Localizer.QuestsMinigameNewbieQuestAux
                                                 lPos.setX(-0.18)
                                                 self.laffMeter = self.createLaffMeter(
                                                     quest.getNewbieLevel())
                                                 self.laffMeter.setScale(
                                                     0.04)
                                                 lIconGeom = None
                                             else:
                                                 lIconGeom = rIconGeom
                                                 lIconGeomScale = rIconGeomScale
                                         else:
                                             frameBgColor = 'blue'
                                             if quest.getType(
                                             ) == Quests.CogTrackQuest:
                                                 dept = quest.getCogTrack()
                                                 cogIcons = loader.loadModelOnce(
                                                     'phase_3/models/gui/cog_icons'
                                                 )
                                                 lIconGeomScale = 0.13
                                                 if dept == 'c':
                                                     icon = cogIcons.find(
                                                         '**/CorpIcon')
                                                 else:
                                                     if dept == 's':
                                                         icon = cogIcons.find(
                                                             '**/SalesIcon')
                                                     else:
                                                         if dept == 'l':
                                                             icon = cogIcons.find(
                                                                 '**/LegalIcon'
                                                             )
                                                         else:
                                                             if dept == 'm':
                                                                 icon = cogIcons.find(
                                                                     '**/MoneyIcon'
                                                                 )
                                                 lIconGeom = icon.copyTo(
                                                     hidden)
                                                 lIconGeom.setColor(
                                                     Suit.Suit.
                                                     medallionColors[dept])
                                                 cogIcons.removeNode()
                                             else:
                                                 if quest.getType(
                                                 ) == Quests.CogQuest:
                                                     if quest.getCogType(
                                                     ) != Quests.Any:
                                                         lIconGeom = self.createSuitHead(
                                                             quest.
                                                             getCogType())
                                                         lIconGeomScale = IMAGE_SCALE_SMALL
                                                     else:
                                                         cogIcons = loader.loadModelOnce(
                                                             'phase_3/models/gui/cog_icons'
                                                         )
                                                         lIconGeom = cogIcons.find(
                                                             '**/cog')
                                                         lIconGeomScale = IMAGE_SCALE_SMALL
                                                         cogIcons.removeNode(
                                                         )
                                                 else:
                                                     if quest.getType(
                                                     ) == Quests.CogLevelQuest:
                                                         cogIcons = loader.loadModelOnce(
                                                             'phase_3/models/gui/cog_icons'
                                                         )
                                                         lIconGeom = cogIcons.find(
                                                             '**/cog')
                                                         lIconGeomScale = IMAGE_SCALE_SMALL
                                                         cogIcons.removeNode(
                                                         )
                                                     else:
                                                         if quest.getType(
                                                         ) == Quests.CogNewbieQuest:
                                                             if quest.getCogType(
                                                             ) != Quests.Any:
                                                                 rIconGeom = self.createSuitHead(
                                                                     quest.
                                                                     getCogType(
                                                                     ))
                                                                 rIconGeomScale = IMAGE_SCALE_SMALL
                                                             else:
                                                                 cogIcons = loader.loadModelOnce(
                                                                     'phase_3/models/gui/cog_icons'
                                                                 )
                                                                 rIconGeom = cogIcons.find(
                                                                     '**/cog'
                                                                 )
                                                                 rIconGeomScale = IMAGE_SCALE_SMALL
                                                                 cogIcons.removeNode(
                                                                 )
                                                             if not fComplete:
                                                                 headlineString = Localizer.QuestsNewbieQuestHeadline
                                                                 captions = [
                                                                     Localizer
                                                                     .
                                                                     QuestsCogNewbieQuestCaption
                                                                     %
                                                                     quest.
                                                                     getNewbieLevel(
                                                                     )
                                                                 ]
                                                                 captions.append(
                                                                     map(
                                                                         string
                                                                         .
                                                                         capwords,
                                                                         quest
                                                                         .
                                                                         getObjectiveStrings(
                                                                         )))
                                                                 auxText = Localizer.QuestsCogNewbieQuestAux
                                                                 lPos.setX(
                                                                     -0.18)
                                                                 self.laffMeter = self.createLaffMeter(
                                                                     quest.
                                                                     getNewbieLevel(
                                                                     ))
                                                                 self.laffMeter.setScale(
                                                                     0.04)
                                                                 lIconGeom = None
                                                             else:
                                                                 lIconGeom = rIconGeom
                                                                 lIconGeomScale = rIconGeomScale
                                             if not fComplete:
                                                 infoText = string.capwords(
                                                     quest.getLocationName(
                                                     ))
                                                 if infoText == '':
                                                     infoText = Localizer.QuestPosterAnywhere
     if fComplete:
         textColor = (0, 0.3, 0, 1)
         imageColor = Vec4(*self.colors['lightGreen'])
         lPos.setX(-0.18)
         rIconGeom = self.createNpcToonHead(toNpcId)
         rIconGeomScale = IMAGE_SCALE_SMALL
         captions = captions[:1]
         captions.append(toNpcName)
         auxText = Localizer.QuestPosterAuxReturnTo
         headlineString = 'COMPLETE'
         infoText = Localizer.QuestPageDestination % (
             toNpcBuildingName, toNpcStreetName, toNpcLocationName)
         if self.laffMeter != None:
             self.laffMeter.reparentTo(hidden)
             self.laffMeter.destroy()
             self.laffMeter = None
     else:
         textColor = self.normalTextColor
     self.show()
     self['image_color'] = imageColor
     self.headline['text_fg'] = textColor
     self.headline['text'] = headlineString
     self.lPictureFrame.show()
     self.lPictureFrame.setPos(lPos)
     self.lPictureFrame['text'] = captions[0]
     self.lPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
     if len(captions) > 1:
         self.rPictureFrame.show()
         self.rPictureFrame['text'] = captions[1]
         self.rPictureFrame['image_color'] = Vec4(
             *self.colors[frameBgColor])
     else:
         self.rPictureFrame.hide()
     self.lQuestIcon['geom'] = lIconGeom
     self.lQuestIcon['geom_pos'] = (0, 10, 0)
     if lIconGeom:
         self.lQuestIcon['geom_scale'] = lIconGeomScale
     if self.laffMeter != None:
         self.laffMeter.reparentTo(self.lQuestIcon)
     self.rQuestIcon['geom'] = rIconGeom
     self.rQuestIcon['geom_pos'] = (0, 10, 0)
     if rIconGeom:
         self.rQuestIcon['geom_scale'] = rIconGeomScale
     self.questInfo['text'] = infoText
     self.questInfo.setZ(infoZ)
     self.fitLabel(self.questInfo)
     if auxText:
         self.auxText.show()
         self.auxText['text'] = auxText
         self.auxText.setPos(auxTextPos)
     else:
         self.auxText.hide()
     self.bind(WITHIN, self.mouseEnterPoster)
     self.bind(WITHOUT, self.mouseExitPoster)
     numQuestItems = quest.getNumQuestItems()
     if fComplete or numQuestItems <= 1:
         self.questProgress.hide()
     else:
         self.questProgress.show()
         self.questProgress['value'] = toonProgress
         self.questProgress['range'] = numQuestItems
         self.questProgress['text'] = quest.getProgressString(
             toonbase.localToon, questDesc)
     return
コード例 #25
0
    def completeQuest(self, av, npc, questId):
        self.notify.info("completeQuest: avId: %s, npcId: %s, questId: %s" %
                         (av.getDoId(), npc.getNpcId(), questId))

        # If this is a track choice, we do not actually complete the quest,
        # We present the track choice gui. This can be cancelled which will
        # not complete the quest.
        questClass = Quests.getQuestClass(questId)
        if questClass == Quests.TrackChoiceQuest:
            self.notify.debug(
                "completeQuest: presentTrackChoice avId: %s, npcId: %s, questId: %s"
                % (av.getDoId(), npc.getNpcId(), questId))
            quest = Quests.getQuest(questId)
            tracks = quest.getChoices()
            npc.presentTrackChoice(av.getDoId(), questId, tracks)
            # Do not increment reward until avatar has chosen track
            # This happens in avatarChoseTrack
            return

        # If this is a deliver gag quest, we need to actually remove the
        # gags delivered from the player's inventory
        if questClass == Quests.DeliverGagQuest:
            self.notify.debug(
                "completeQuest: presentTrackChoice avId: %s, npcId: %s, questId: %s"
                % (av.getDoId(), npc.getNpcId(), questId))
            # Use the items from the inventory now
            quest = Quests.getQuest(questId)
            track, level = quest.getGagType()
            for i in range(0, quest.getNumGags()):
                av.inventory.useItem(track, level)
            av.d_setInventory(av.inventory.makeNetString())

        # See if this quest is part of a multiquest. If it is, we assign
        # the next part of the multiquest.
        nextQuestId, nextToNpcId = Quests.getNextQuest(questId, npc, av)
        eventLogMessage = "%s|%s|%s|%s" % (questId, npc.getNpcId(),
                                           questClass.__name__, nextQuestId)

        if nextQuestId == Quests.NA:
            rewardId = Quests.getAvatarRewardId(av, questId)
            # Update the toon with the reward
            reward = Quests.getReward(rewardId)

            # Clothing quests should have been handled by the Tailor.
            # Just to make sure
            if (reward.getType() == Quests.ClothingTicketReward):
                self.notify.warning(
                    "completeQuest: rogue ClothingTicketReward avId: %s, npcId: %s, questId: %s"
                    % (av.getDoId(), npc.getNpcId(), questId))
                npc.freeAvatar(av.getDoId())
                return

            # Nope, this is the end, dish out the reward
            av.removeQuest(questId)
            # TODO: put this in the movie
            reward.sendRewardAI(av)
            # Full heal for completing a quest
            av.toonUp(av.maxHp)
            # Tell the npc to deliver the movie which will
            # complete the quest, display the reward, and do nothing else
            npc.completeQuest(av.getDoId(), questId, rewardId)
            # Bump the reward
            self.incrementReward(av)

            eventLogMessage += "|%s|%s" % (reward.__class__.__name__,
                                           reward.getAmount())

        else:
            # Full heal for completing part of a multistage quest
            av.toonUp(av.maxHp)
            # The user is not presented with a choice here
            av.removeQuest(questId)
            nextRewardId = Quests.getQuestReward(nextQuestId, av)
            if npc.getHq():
                fromNpcId = Quests.ToonHQ
            else:
                fromNpcId = npc.getNpcId()
            self.assignQuest(av.getDoId(),
                             fromNpcId,
                             nextQuestId,
                             nextRewardId,
                             nextToNpcId,
                             startingQuest=0)
            npc.assignQuest(av.getDoId(), nextQuestId, nextRewardId,
                            nextToNpcId)
            eventLogMessage += "|next %s" % (nextQuestId)

        self.air.writeServerEvent('questComplete', av.getDoId(),
                                  eventLogMessage)
コード例 #26
0
 def __toonQuestsList2Quests(self, quests):
     return [Quests.getQuest(x[0]) for x in quests]
コード例 #27
0
    def recoverItems(self, av, cogList, zoneId):
        avQuests = av.quests
        avId = av.getDoId()
        itemsRecovered = []
        itemsNotRecovered = []
        changed = 0

        for questDesc in avQuests:
            questClass = Quests.getQuestClass(questDesc[0])
            if (questClass == Quests.RecoverItemQuest):
                quest = Quests.getQuest(questDesc[0])
                # See if the cog that stole the item is in the cogList
                questCogType = quest.getHolder()
                qualifier = quest.getHolderType()
                for cogDict in cogList:
                    # If the cogType is Quests.Any, that means any cog
                    # Ok, now check to see if we recovered the item based
                    # on the percent chance of finding it stored in the quest
                    # Only find items if we still need them
                    self.notify.debug(
                        "recoverItems: checking against cogDict: %s" %
                        (cogDict))
                    if ((questCogType == Quests.Any)
                            or (questCogType == cogDict[qualifier]) or
                            # If it is level based, count those higher too
                        ((qualifier == 'level') and
                         (questCogType <= cogDict[qualifier]))):
                        if avId in cogDict['activeToons']:
                            if not quest.testDone(
                                    questDesc[4]
                            ):  #if questDesc[4] < quest.getNumItems():
                                if quest.isLocationMatch(zoneId):
                                    #rand = random.random() * 100
                                    #if rand <= quest.getPercentChance():
                                    check, count = quest.testRecover(
                                        questDesc[4])
                                    if check:
                                        # FOUND IT! Increment progress by one item
                                        #questDesc[4] += 1
                                        # Keep track of all the items recovered
                                        itemsRecovered.append(quest.getItem())
                                        #changed = 1
                                        self.notify.debug(
                                            "recoverItems: av %s made progress: %s"
                                            % (avId, questDesc[4]))
                                    else:
                                        self.notify.debug(
                                            "recoverItems: av %s made NO progress (item not found) [%s > %s])"
                                            % (avId, check,
                                               quest.getPercentChance()))
                                        itemsNotRecovered.append(
                                            quest.getItem())
                                    #keeping track of missed items
                                    changed = 1
                                    questDesc[4] = count
                                else:
                                    self.notify.debug(
                                        "recoverItems: av %s made NO progress (wrong location)"
                                        % (avId))
                            else:
                                self.notify.debug(
                                    "recoverItems: av %s made NO progress (have enough already)"
                                    % (avId))
                        else:
                            self.notify.debug(
                                "recoverItems: av %s made NO progress (av not active)"
                                % (avId))
                    else:
                        self.notify.debug(
                            "recoverItems: av %s made NO progress (wrong cog type)"
                            % (avId))
            else:
                # Do not care about this quest here
                continue

        # Now send the quests back to the avatar if the status changed

        # Note: this means that an avatar will immediately get credit
        # for finding an item, even if the item is found in the middle
        # floor of a building and the avatar later is killed on a
        # later floor, thus failing the building.
        if changed:
            av.b_setQuests(avQuests)

        return (itemsRecovered, itemsNotRecovered)
コード例 #28
0
    def update(self, questDesc):
        questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
        quest = Quests.getQuest(questId)
        self.teleportButton['command'] = self.teleportToShop
        self.teleportButton['extraArgs'] = [toNpcId]
        if quest == None:
            self.notify.warning('Tried to display poster for unknown quest %s' % questId)
            return
        if rewardId == Quests.NA:
            finalReward = Quests.getFinalRewardId(questId, fAll=1)
            transformedReward = Quests.transformReward(finalReward, base.localAvatar)
            reward = Quests.getReward(transformedReward)
        else:
            reward = Quests.getReward(rewardId)
        if reward and questId not in Quests.NoRewardTierZeroQuests:
            rewardString = reward.getPosterString()
        else:
            rewardString = ''
        self.rewardText['text'] = rewardString
        self.fitLabel(self.rewardText)

        if Quests.isQuestJustForFun(questId, rewardId):
            self.funQuest.show()
        else:
            self.funQuest.hide()

        if self._deleteCallback:
            self.showDeleteButton(questDesc)
        else:
            self.hideDeleteButton()
        if self.laffMeter:
            self.laffMeter.destroy()
        fComplete = quest.getCompletionStatus(base.localAvatar, questDesc) == Quests.COMPLETE

        if Quests.isQuestJustForFun(questId, rewardId):
            if fComplete:
                self.funQuest.hide()
                self.teleportButton.show()
            else:
                self.teleportButton.hide()

        if toNpcId == Quests.ToonHQ:
            self.teleportButton.show()
            self.teleportButton.setPos(0.285, 0, -0.15)
            toNpcName = TTLocalizer.QuestPosterHQOfficer
            toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
            toNpcLocationName = TTLocalizer.QuestPosterHQLocationName
        elif toNpcId == Quests.ToonTailor:
            self.teleportButton.show()
            self.teleportButton.setPos(0.285, 0, -0.15)
            toNpcName = TTLocalizer.QuestPosterTailor
            toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
            toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName
        else:
            self.teleportButton.show()
            self.teleportButton.setPos(0.285, 0, -0.15)
            toNpcName = NPCToons.getNPCName(toNpcId)
            toNpcZone = NPCToons.getNPCZone(toNpcId)
            toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
            toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
            toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
            toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
            toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
        lPos = Vec3(0, 0, 0.13)
        lIconGeom = None
        lIconGeomScale = 1
        rIconGeom = None
        rIconGeomScale = 1
        infoText = ''
        infoZ = TTLocalizer.QPinfoZ
        auxText = None
        auxTextPos = Vec3(0, 0, 0.12)
        headlineString = quest.getHeadlineString()
        objectiveStrings = quest.getObjectiveStrings()
        captions = map(string.capwords, quest.getObjectiveStrings())
        imageColor = Vec4(*self.colors['white'])
        if isinstance(quest, Quests.TexturedQuest) and quest.hasFrame():
            self.teleportButton.hide()
            frame = quest.getFrame()
            frameBgColor = frame[1]
            lIconGeom = frame[0]
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest:
            frameBgColor = 'red'
            if fComplete:
                self.teleportButton.show()
                self.teleportButton.setPos(0.175, 0, -0.125)
            if quest.getType() == Quests.DeliverGagQuest:
                invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
                track, item = quest.getGagType()
                lIconGeom = invModel.find('**/' + AvPropsNew[track][item])
                invModel.removeNode()
            else:
                bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/package')
                lIconGeomScale = 0.12
                bookModel.removeNode()
            if not fComplete:
                captions.append(toNpcName)
                auxText = TTLocalizer.QuestPosterAuxTo
                auxTextPos.setZ(0.12)
                lPos.setX(-0.18)
                infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
                rIconGeom = self.createNpcToonHead(toNpcId)
                rIconGeomScale = IMAGE_SCALE_SMALL
                self.teleportButton.setPos(0.285, 0, -0.15)
        elif quest.getType() == Quests.RecoverItemQuest:
            frameBgColor = 'green'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            if not fComplete:
                rIconGeomScale = IMAGE_SCALE_SMALL
                holder = quest.getHolder()
                holderType = quest.getHolderType()
                if holder == Quests.Any:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    rIconGeom = cogIcons.find('**/cog')
                    cogIcons.removeNode()
                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom
                elif holder == Quests.AnyFish:
                    headlineString = TTLocalizer.QuestPosterFishing
                    auxText = TTLocalizer.QuestPosterAuxFor
                    auxTextPos.setX(-0.18)
                    captions = captions[:1]
                else:
                    if holderType == 'track':
                        cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                        if holder in SuitDNA.suitDeptModelPaths:
                            icon = cogIcons.find(SuitDNA.suitDeptModelPaths[holder])
                        rIconGeom = icon.copyTo(hidden)
                        rIconGeom.setColor(Suit.Suit.medallionColors[holder])
                        rIconGeomScale = 0.12
                        cogIcons.removeNode()
                    elif holderType == 'level':
                        cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                        rIconGeom = cogIcons.find('**/cog')
                        rIconGeomScale = IMAGE_SCALE_SMALL
                        cogIcons.removeNode()
                    else:
                        rIconGeom = self.createSuitHead(holder)
                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
            else:
                self.teleportButton.show()
        elif quest.getType() == Quests.VisitQuest:
            self.teleportButton.show()
            frameBgColor = 'brown'
            captions[0] = '%s' % toNpcName
            lIconGeom = self.createNpcToonHead(toNpcId)
            lIconGeomScale = IMAGE_SCALE_SMALL
            if not fComplete:
                infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
        elif quest.getType() == Quests.TrackChoiceQuest:
            frameBgColor = 'green'
            filmstrip = loader.loadModel('phase_3.5/models/gui/filmstrip')
            lIconGeom = DirectFrame(parent=self, relief=None, image=filmstrip, image_scale=.5)
            self.question = DirectLabel(parent=lIconGeom, relief=None, pos=(0, 0, 0), text='?', text_scale=0.2, text_pos=(0, -0.04), text_fg=(0.72, 0.72, 0.72, 1))
            lIconGeom['image_color'] = Vec4(0.7, 0.7, 0.7, 1)
            self.question['text_fg'] = Vec4(0.6, 0.6, 0.6, 1)
            rIconGeom = None
            filmstrip.removeNode()
        elif quest.getType() == Quests.BuildingQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            track = quest.getBuildingTrack()
            numFloors = quest.getNumFloors()
            if track == 'c':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_corp')
            elif track == 'l':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_legal')
            elif track == 'm':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_money')
            elif track == 's':
                lIconGeom = loader.loadModel('phase_4/models/modules/suit_landmark_sales')
            else:
                bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/COG_building')
                bookModel.removeNode()
            if lIconGeom and track != Quests.Any:
                self.loadElevator(lIconGeom, numFloors)
                lIconGeom.setH(180)
                self.fitGeometry(lIconGeom, fFlip=0)
                lIconGeomScale = IMAGE_SCALE_SMALL
            else:
                lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.FactoryQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/factoryIcon2')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.MintQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/CashBotMint')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.CogPartQuest:
            self.teleportButton.hide()
            frameBgColor = 'green'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/CogArmIcon2')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.ForemanQuest or quest.getType() == Quests.SupervisorQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/skelecog5')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.RescueQuest:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            lIconGeom = self.createNpcToonHead(random.choice(NPCToons.HQnpcFriends.keys()))
            lIconGeomScale = 0.13
            infoText = quest.getLocationName().strip()
        elif quest.getType() == Quests.FriendQuest:
            self.teleportButton.hide()
            frameBgColor = 'brown'
            gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
            lIconGeom = gui.find('**/FriendsBox_Closed')
            lIconGeomScale = 0.45
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterAnywhere
        elif quest.getType() == Quests.TrolleyQuest:
            self.teleportButton.hide()
            frameBgColor = 'lightBlue'
            gui = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = gui.find('**/trolley')
            lIconGeomScale = 0.13
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterPlayground
        elif quest.getType() == Quests.MailboxQuest:
            self.teleportButton.hide()
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterAtHome
        elif quest.getType() == Quests.PhoneQuest:
            self.teleportButton.hide()
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/clarabelleCow')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterOnPhone
        else:
            self.teleportButton.hide()
            frameBgColor = 'blue'
            if quest.getType() == Quests.CogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept in SuitDNA.suitDeptModelPaths:
                    icon = cogIcons.find(SuitDNA.suitDeptModelPaths[dept])
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()
            elif quest.getType() == Quests.CogQuest:
                if quest.getCogType() != Quests.Any:
                    lIconGeom = self.createSuitHead(quest.getCogType())
                    lIconGeomScale = IMAGE_SCALE_SMALL
                else:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    lIconGeom = cogIcons.find('**/cog')
                    lIconGeomScale = IMAGE_SCALE_SMALL
                    cogIcons.removeNode()
            elif quest.getType() == Quests.CogLevelQuest:
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeom = cogIcons.find('**/cog')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkelecogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept in SuitDNA.suitDeptModelPaths:
                    icon = cogIcons.find(SuitDNA.suitDeptModelPaths[dept])
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkelecogQuest:
                cogIcons = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkelecogLevelQuest:
                cogIcons = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            elif quest.getType() == Quests.SkeleReviveQuest:
                cogIcons = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere
        if fComplete:
            self.teleportButton.show()
            textColor = (0, 0.3, 0, 1)
            imageColor = Vec4(*self.colors['lightGreen'])
            lPos.setX(-0.18)
            rIconGeom = self.createNpcToonHead(toNpcId)
            rIconGeomScale = IMAGE_SCALE_SMALL
            captions = captions[:1]
            captions.append(toNpcName)
            auxText = TTLocalizer.QuestPosterAuxReturnTo
            headlineString = TTLocalizer.QuestPosterComplete
            infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
            if self.laffMeter is not None:
                self.laffMeter.reparentTo(hidden)
                self.laffMeter.destroy()
                self.laffMeter = None
        else:
            textColor = self.normalTextColor
        self.show()
        self['image_color'] = imageColor
        self.headline['text_fg'] = textColor
        self.headline['text'] = headlineString
        if quest.getType() != Quests.TrackChoiceQuest:
            self.lPictureFrame.show()
            self.lPictureFrame.setPos(lPos)
            self.lPictureFrame['text_scale'] = TEXT_SCALE
            if lPos[0] != 0:
                self.lPictureFrame['text_scale'] = 0.0325
            self.lPictureFrame['text'] = captions[0]
            self.lPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
        else:
            self.lPictureFrame['text'] = 'Track Choice'
            self.lPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
        if len(captions) > 1 and quest.getType() != Quests.TrackChoiceQuest:
            self.rPictureFrame['text'] = captions[1]
            self.rPictureFrame['text_scale'] = 0.0325
            self.rPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
        else:
            self.rPictureFrame.hide()
        self._deleteGeoms()
        self.lQuestIcon['geom'] = lIconGeom
        self.lQuestIcon['geom_pos'] = (0, 10, 0)
        if lIconGeom:
            try:
                self.lQuestIcon['geom_scale'] = lIconGeomScale
            except: pass
            try:
                self.lQuestIcon['geom_pos'] = Point3(lIconGeomPos[0], lIconGeomPos[1], lIconGeomPos[2])
            except: pass
            try:
                self.lQuestIcon['geom_hpr'] = Point3(lIconGeomHpr[0], lIconGeomHpr[1], lIconGeomHpr[2])
            except: pass
        if self.laffMeter != None:
            self.laffMeter.reparentTo(self.lQuestIcon)
        self.rQuestIcon['geom'] = rIconGeom
        self.rQuestIcon['geom_pos'] = (0, 10, 0)
        if rIconGeom:
            self.rQuestIcon['geom_scale'] = rIconGeomScale
        if auxText:
            self.auxText.show()
            self.auxText['text'] = auxText
            self.auxText.setPos(auxTextPos)
        else:
            self.auxText.hide()
        self.bind(DGG.WITHIN, self.mouseEnterPoster)
        self.bind(DGG.WITHOUT, self.mouseExitPoster)
        numQuestItems = quest.getNumQuestItems()
        if fComplete or numQuestItems <= 1:
            self.questProgress.hide()
            if not quest.getType() == Quests.TrackChoiceQuest:
                infoZ = -0.075
        else:
            self.questProgress.show()
            self.questProgress['value'] = toonProgress & pow(2, 16) - 1
            self.questProgress['range'] = numQuestItems
            self.questProgress['text'] = quest.getProgressString(base.localAvatar, questDesc)
        self.questInfo['text'] = infoText
        self.questInfo.setZ(infoZ)
        self.fitLabel(self.questInfo)
        if not Quests.QuestDict[questId][0] >= 11:
            self.teleportButton.hide()
        return
コード例 #29
0
    def update(self, questDesc):
        questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
        quest = Quests.getQuest(questId)
        if quest == None:
            self.notify.warning(
                'Tried to display poster for unknown quest %s' % questId)
            return
        if rewardId == Quests.NA:
            finalReward = Quests.getFinalRewardId(questId, fAll=1)
            transformedReward = Quests.transformReward(finalReward,
                                                       base.localAvatar)
            reward = Quests.getReward(transformedReward)
        else:
            reward = Quests.getReward(rewardId)
        if reward and questId not in Quests.NoRewardTierZeroQuests:
            rewardString = reward.getPosterString()
        else:
            rewardString = ''
        self.rewardText['text'] = rewardString
        self.fitLabel(self.rewardText)
        if Quests.isQuestJustForFun(questId, rewardId):
            self.funQuest.show()
        else:
            self.funQuest.hide()
        if self._deleteCallback:
            self.showDeleteButton(questDesc)
        else:
            self.hideDeleteButton()

        fComplete = quest.getCompletionStatus(base.localAvatar,
                                              questDesc) == Quests.COMPLETE

        if Quests.isQuestJustForFun(questId, rewardId):
            if fComplete:
                self.funQuest.hide()

        if toNpcId == Quests.ToonHQ:
            toNpcName = TTLocalizer.QuestPosterHQOfficer
            toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
            toNpcLocationName = TTLocalizer.QuestPosterHQLocationName

        elif toNpcId == Quests.ToonTailor:
            toNpcName = TTLocalizer.QuestPosterTailor
            toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
            toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
            toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName

        else:
            toNpcName = NPCToons.getNPCName(toNpcId)
            toNpcZone = NPCToons.getNPCZone(toNpcId)
            toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
            toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
            toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
            toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
            toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)

        lPos = Vec3(0, 0, 0.13)
        lIconGeom = None
        lIconGeomScale = 1
        rIconGeom = None
        rIconGeomScale = 1
        infoText = ''
        infoZ = TTLocalizer.QPinfoZ
        auxText = None
        auxTextPos = Vec3(0, 0, 0.12)
        headlineString = quest.getHeadlineString()
        objectiveStrings = quest.getObjectiveStrings()
        captions = map(lambda x: str(x).title(), quest.getObjectiveStrings())
        imageColor = Vec4(*self.colors['white'])
        if quest.getType() == Quests.DeliverGagQuest or quest.getType(
        ) == Quests.DeliverItemQuest:
            frameBgColor = 'red'

            if quest.getType() == Quests.DeliverGagQuest:
                invModel = loader.loadModel(
                    'phase_3.5/models/gui/inventory_icons')
                track, item = quest.getGagType()
                lIconGeom = invModel.find('**/' + AvPropsNew[track][item])
                invModel.removeNode()

            else:
                bookModel = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/package')
                lIconGeomScale = 0.12
                bookModel.removeNode()

            if not fComplete:
                captions.append(toNpcName)
                auxText = TTLocalizer.QuestPosterAuxTo
                auxTextPos.setZ(0.12)
                lPos.setX(-0.18)
                infoText = TTLocalizer.QuestPageDestination % (
                    toNpcBuildingName, toNpcStreetName, toNpcLocationName)
                rIconGeom = self.createNpcToonHead(toNpcId)
                rIconGeomScale = IMAGE_SCALE_SMALL

        elif quest.getType() == Quests.RecoverItemQuest:
            frameBgColor = 'green'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()

            if not fComplete:
                rIconGeomScale = IMAGE_SCALE_SMALL
                holder = quest.getHolder()
                holderType = quest.getHolderType()

                if holder == Quests.Any:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    rIconGeom = cogIcons.find('**/cog')
                    cogIcons.removeNode()
                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom

                elif holder == Quests.AnyFish:
                    headlineString = TTLocalizer.QuestPosterFishing
                    auxText = TTLocalizer.QuestPosterAuxFor
                    auxTextPos.setX(-0.18)
                    captions = captions[:1]

                else:
                    if holderType == 'track':
                        cogIcons = loader.loadModel(
                            'phase_3/models/gui/cog_icons')
                        if holder == 'c':
                            icon = cogIcons.find('**/CorpIcon')
                        elif holder == 's':
                            icon = cogIcons.find('**/SalesIcon')
                        elif holder == 'l':
                            icon = cogIcons.find('**/LegalIcon')
                        elif holder == 'm':
                            icon = cogIcons.find('**/MoneyIcon')
                        rIconGeom = icon.copyTo(hidden)
                        rIconGeom.setColor(Suit.Suit.medallionColors[holder])
                        rIconGeomScale = 0.12
                        cogIcons.removeNode()

                    elif holderType == 'level':
                        cogIcons = loader.loadModel(
                            'phase_3/models/gui/cog_icons')
                        rIconGeom = cogIcons.find('**/cog')
                        rIconGeomScale = IMAGE_SCALE_SMALL
                        cogIcons.removeNode()

                    else:
                        rIconGeom = self.createSuitHead(holder)

                    lPos.setX(-0.18)
                    auxText = TTLocalizer.QuestPosterAuxFrom

                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.VisitQuest:
            frameBgColor = 'brown'
            captions[0] = '%s' % toNpcName
            lIconGeom = self.createNpcToonHead(toNpcId)
            lIconGeomScale = IMAGE_SCALE_SMALL

            if not fComplete:
                infoText = TTLocalizer.QuestPageDestination % (
                    toNpcBuildingName, toNpcStreetName, toNpcLocationName)

        elif quest.getType() == Quests.TrackChoiceQuest:
            frameBgColor = 'green'
            invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
            track1, track2 = quest.getChoices()
            lIconGeom = invModel.find('**/' + AvPropsNew[track1][1])

            if not fComplete:
                auxText = TTLocalizer.QuestPosterAuxOr
                lPos.setX(-0.18)
                rIconGeom = invModel.find('**/' + AvPropsNew[track2][1])
                infoText = TTLocalizer.QuestPageNameAndDestination % (
                    toNpcName, toNpcBuildingName, toNpcStreetName,
                    toNpcLocationName)
                infoZ = -0.02

            invModel.removeNode()

        elif quest.getType() == Quests.BuildingQuest:
            frameBgColor = 'blue'
            track = quest.getBuildingTrack()
            numFloors = quest.getNumFloors()

            if track == 'c':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_corp')

            elif track == 'l':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_legal')

            elif track == 'm':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_money')

            elif track == 's':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_sales')

            else:
                bookModel = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = bookModel.find('**/COG_building')
                bookModel.removeNode()

            if lIconGeom and track != Quests.Any:
                self.loadElevator(lIconGeom, numFloors)
                lIconGeom.setH(180)
                self.fitGeometry(lIconGeom, fFlip=0)
                lIconGeomScale = IMAGE_SCALE_SMALL

            else:
                lIconGeomScale = 0.13

            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        # cogdo quest
        elif quest.getType() == Quests.CogdoQuest:
            frameBgColor = 'lightGreen'
            track = quest.getBuildingTrack()

            if track == 'c':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_corp')

            elif track == 'l':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_legal')

            elif track == 'm':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_money')

            elif track == 's':
                lIconGeom = loader.loadModel(
                    'phase_4/models/modules/suit_landmark_sales')

            else:
                lIconGeom = loader.loadModel(
                    'phase_5/models/cogdominium/tt_m_ara_cbe_fieldOfficeMoverShaker'
                )

            if lIconGeom and track != Quests.Any:
                lIconGeom.setH(180)

            else:
                lIconGeom.setH(180)

            self.fitGeometry(lIconGeom)
            lIconGeomScale = IMAGE_SCALE_SMALL

            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.FactoryQuest:
            frameBgColor = 'blue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/factoryIcon2')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.MintQuest:
            frameBgColor = 'blue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/CashBotMint')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.ForemanQuest or quest.getType(
        ) == Quests.SupervisorQuest:
            frameBgColor = 'blue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/skelecog5')
            bookModel.removeNode()
            lIconGeomScale = 0.13
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.BossQuest:
            frameBgColor = 'blue'
            cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
            lIconGeom = cogIcons.find('**/cog')
            lIconGeomScale = IMAGE_SCALE_SMALL
            cogIcons.removeNode()
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.VPQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel(
                'phase_9/models/char/sellbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.055]
            lIconGeomHpr = [-90, 0, -90]
            lIconGeomScale = 0.015
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.CFOQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel(
                'phase_10/models/char/cashbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.055]
            lIconGeomHpr = [90, 0, -90]
            lIconGeomScale = 0.015
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.CJQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel(
                'phase_11/models/char/lawbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.055]
            lIconGeomHpr = [90, 0, -90]
            lIconGeomScale = 0.025
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.CEOQuest:
            frameBgColor = 'blue'
            lIconGeom = loader.loadModel(
                'phase_12/models/char/bossbotBoss-head-zero')
            lIconGeomPos = [0, 0, -0.065]
            lIconGeomHpr = [90, 0, -90]
            lIconGeomScale = 0.0125
            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        elif 0:  #quest.getType() == Quests.FriendQuest:
            frameBgColor = 'brown'
            gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
            lIconGeom = gui.find('**/FriendsBox_Closed')
            lIconGeomScale = 0.45
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterAnywhere

        elif quest.getType() == Quests.TrolleyQuest:
            frameBgColor = 'lightBlue'
            gui = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = gui.find('**/trolley')
            lIconGeomScale = 0.13
            gui.removeNode()
            infoText = TTLocalizer.QuestPosterPlayground

        elif quest.getType() == Quests.MailboxQuest:
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/package')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterAtHome

        elif quest.getType() == Quests.PhoneQuest:
            frameBgColor = 'lightBlue'
            bookModel = loader.loadModel(
                'phase_3.5/models/gui/stickerbook_gui')
            lIconGeom = bookModel.find('**/clarabelleCow')
            lIconGeomScale = 0.12
            bookModel.removeNode()
            infoText = TTLocalizer.QuestPosterOnPhone

        else:
            frameBgColor = 'blue'
            if quest.getType() == Quests.CogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept == 'c':
                    icon = cogIcons.find('**/CorpIcon')
                elif dept == 's':
                    icon = cogIcons.find('**/SalesIcon')
                elif dept == 'l':
                    icon = cogIcons.find('**/LegalIcon')
                elif dept == 'm':
                    icon = cogIcons.find('**/MoneyIcon')
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()

            elif quest.getType() == Quests.CogQuest:
                if quest.getCogType() != Quests.Any:
                    lIconGeom = self.createSuitHead(quest.getCogType())
                    lIconGeomScale = IMAGE_SCALE_SMALL
                else:
                    cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                    lIconGeom = cogIcons.find('**/cog')
                    lIconGeomScale = IMAGE_SCALE_SMALL
                    cogIcons.removeNode()

            elif quest.getType() == Quests.CogLevelQuest:
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeom = cogIcons.find('**/cog')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()

            elif quest.getType() == Quests.SkelecogTrackQuest:
                dept = quest.getCogTrack()
                cogIcons = loader.loadModel('phase_3/models/gui/cog_icons')
                lIconGeomScale = 0.13
                if dept == 'c':
                    icon = cogIcons.find('**/CorpIcon')
                elif dept == 's':
                    icon = cogIcons.find('**/SalesIcon')
                elif dept == 'l':
                    icon = cogIcons.find('**/LegalIcon')
                elif dept == 'm':
                    icon = cogIcons.find('**/MoneyIcon')
                lIconGeom = icon.copyTo(hidden)
                lIconGeom.setColor(Suit.Suit.medallionColors[dept])
                cogIcons.removeNode()

            elif quest.getType() == Quests.SkelecogQuest:
                cogIcons = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()

            elif quest.getType() == Quests.SkelecogLevelQuest:
                cogIcons = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()

            elif quest.getType() == Quests.SkeleReviveQuest:
                cogIcons = loader.loadModel(
                    'phase_3.5/models/gui/stickerbook_gui')
                lIconGeom = cogIcons.find('**/skelecog5')
                lIconGeomScale = IMAGE_SCALE_SMALL
                cogIcons.removeNode()

            if not fComplete:
                infoText = quest.getLocationName()
                if infoText == '':
                    infoText = TTLocalizer.QuestPosterAnywhere

        if fComplete:
            textColor = (0, 0.3, 0, 1)
            imageColor = Vec4(*self.colors['lightGreen'])
            lPos.setX(-0.18)
            rIconGeom = self.createNpcToonHead(toNpcId)
            rIconGeomScale = IMAGE_SCALE_SMALL
            captions = captions[:1]
            captions.append(toNpcName)
            auxText = TTLocalizer.QuestPosterAuxReturnTo
            headlineString = TTLocalizer.QuestPosterComplete
            infoText = TTLocalizer.QuestPageDestination % (
                toNpcBuildingName, toNpcStreetName, toNpcLocationName)
            if self.laffMeter != None:
                self.laffMeter.reparentTo(hidden)
                self.laffMeter.destroy()
                self.laffMeter = None
        else:
            textColor = self.normalTextColor

        self.show()
        self['image_color'] = imageColor
        self.headline['text_fg'] = textColor
        self.headline['text'] = headlineString
        self.lPictureFrame.show()
        self.lPictureFrame.setPos(lPos)
        self.lPictureFrame['text_scale'] = TEXT_SCALE
        if lPos[0] != 0:
            self.lPictureFrame['text_scale'] = 0.0325
        self.lPictureFrame['text'] = captions[0]
        self.lPictureFrame['image_color'] = Vec4(*self.colors[frameBgColor])
        if len(captions) > 1:
            self.rPictureFrame.show()
            self.rPictureFrame['text'] = captions[1]
            self.rPictureFrame['text_scale'] = 0.0325
            self.rPictureFrame['image_color'] = Vec4(
                *self.colors[frameBgColor])
        else:
            self.rPictureFrame.hide()
        self._deleteGeoms()

        self.lQuestIcon['geom'] = lIconGeom
        self.lQuestIcon['geom_pos'] = (0, 10, 0)

        if lIconGeom:
            try:
                self.lQuestIcon['geom_scale'] = lIconGeomScale
            except:
                pass
            try:
                self.lQuestIcon['geom_pos'] = Point3(lIconGeomPos[0],
                                                     lIconGeomPos[1],
                                                     lIconGeomPos[2])
            except:
                pass
            try:
                self.lQuestIcon['geom_hpr'] = Point3(lIconGeomHpr[0],
                                                     lIconGeomHpr[1],
                                                     lIconGeomHpr[2])
            except:
                pass

        if self.laffMeter != None:
            self.laffMeter.reparentTo(self.lQuestIcon)

        self.rQuestIcon['geom'] = rIconGeom
        self.rQuestIcon['geom_pos'] = (0, 10, 0)
        if rIconGeom:
            self.rQuestIcon['geom_scale'] = rIconGeomScale

        if auxText:
            self.auxText.show()
            self.auxText['text'] = auxText
            self.auxText.setPos(auxTextPos)
        else:
            self.auxText.hide()
        self.bind(DGG.WITHIN, self.mouseEnterPoster)
        self.bind(DGG.WITHOUT, self.mouseExitPoster)
        numQuestItems = quest.getNumQuestItems()
        if fComplete or numQuestItems <= 1:
            self.questProgress.hide()
            if not quest.getType() == Quests.TrackChoiceQuest:
                infoZ = -0.075
        else:
            self.questProgress.show()
            self.questProgress['value'] = toonProgress & pow(2, 16) - 1
            self.questProgress['range'] = numQuestItems
            self.questProgress['text'] = quest.getProgressString(
                base.localAvatar, questDesc)
        self.questInfo['text'] = infoText
        self.questInfo.setZ(infoZ)
        self.fitLabel(self.questInfo)
        return