def getProgressUpdateBrief(self):
        infoText = ''
        
        if self.level:
            infoText += 'Level %s' % (str(self.level))
        elif self.levelRange:
            infoText += 'Level %s+' % (str(self.levelRange[0]))
            
        if self.variant:
            variantTxt = Variant.VariantToName.get(self.variant)
            if self.goal > 1:
                variantTxt = CIGlobals.makePlural(variantTxt)
            infoText += variantTxt
            
        if self.dept:
            deptName = self.dept.getName() if not self.goal > 1 else CIGlobals.makePlural(self.dept.getName())
            infoText += deptName
        elif self.cog == QuestGlobals.Any:
            text = CIGlobals.Suit if not self.goal > 1 else CIGlobals.Suits
            infoText += text
        elif not self.cog == QuestGlobals.Any:
            nameText = self.cog if not self.goal > 1 else CIGlobals.makePlural(self.cog)
            infoText += nameText

        return ('{0} of {1} {2} {3}'.format(self.progress, self.goal, infoText, CIGlobals.makePastTense(self.Header)))
    def handleMinigameObjective(self,
                                iconElement=auxIcon,
                                auxText=QuestGlobals.PLAY,
                                frameColor=QuestGlobals.RED):
        objective = self.viewObjective
        infoText = objective.getTaskInfo()

        if not iconElement:
            iconElement = self.auxIcon

        # Let's make sure we have a current objective that is
        # an instance of the MinigameObjective class and this poster isn't destroyed.
        if not objective or not hasattr(self, 'titleLabel') or not isinstance(
                objective, MinigameObjective):
            return

        # Let's set the icon to the minigame icon.
        self.handleSimpleIcon(QuestGlobals.getTrolleyIcon(),
                              QuestGlobals.SIMPLE_IMAGE_SCALE, iconElement)

        # Let's set the progress bar text
        pgBarText = '%d of %d %s' % (objective.progress, objective.goal,
                                     CIGlobals.makePastTense(auxText))
        self.progressBar['text'] = pgBarText

        self.objectiveInfo['text'] = infoText
        self.auxText['text'] = auxText
        self.auxFrame['image_color'] = Vec4(*frameColor)
Exemple #3
0
    def handleDeliverItemObjective(self):
        objective = self.viewObjective

        # Let's make sure we have a current objective that is
        # an instance of the DeliverItemObjective class and this poster isn't destroyed.
        if not objective or not hasattr(self, 'titleLabel') or not isinstance(
                objective, DeliverItemObjective):
            return

        # Correct the scaling if we need to and set the icon.
        scale = 0.12 if objective.itemIcon.getName() == 'package' else 0.85
        self.handleSimpleIcon(objective.itemIcon, scale, self.auxIcon)
        self.auxFrame.setPos(QuestGlobals.RECOVER_LEFT_PICTURE_POS)
        self.auxFrame['image_color'] = QuestGlobals.RED

        infoText = '%d %s' % (objective.goal,
                              CIGlobals.makePlural(objective.itemName))
        if objective.goal == 1:
            infoText = objective.itemName
        self.objectiveInfo.setPos(QuestGlobals.RECOVER_INFO_POS)
        self.objectiveInfo['text'] = infoText
        self.fromToMiddleText['text'] = QuestGlobals.TO

        # Let's set the progress bar text
        pgBarText = '%d of %d %s' % (objective.progress, objective.goal,
                                     CIGlobals.makePastTense(
                                         QuestGlobals.DELIVER))
        self.progressBar['text'] = pgBarText
        self.progressBar['value'] = objective.progress & pow(2, 16) - 1

        self.handleNPCObjective(self.goalIcon,
                                auxText=QuestGlobals.DELIVER,
                                frameColor=QuestGlobals.RED)
    def getProgressUpdateBrief(self):
        taskInfo = ''

        if self.minFloors != QuestGlobals.Any:
            taskInfo += "%s+ Story " % QuestGlobals.getNumName(self.minFloors)
        
        name = '%s Buildings'
        
        if self.dept == QuestGlobals.Any:
            subject = name % CIGlobals.Suit
        else:
            subject = name % self.dept.getName()

        if self.goal > 1:
            subject = CIGlobals.makePlural(subject)

        taskInfo += subject
        return ('{0} of {1} {2} {3}'.format(self.progress, self.goal, taskInfo, CIGlobals.makePastTense(self.Header)))
    def handleCogBuildingObjective(self,
                                   iconElement=auxIcon,
                                   auxText=QuestGlobals.DEFEAT,
                                   frameColor=QuestGlobals.BLUE):
        objective = self.viewObjective
        infoText = objective.getTaskInfo()

        if not iconElement:
            iconElement = self.auxIcon

        # Let's make sure we have a current objective that is
        # an instance of the CogBuildingObjective class and this poster isn't destroyed.
        if not objective or not hasattr(self, 'titleLabel') or not isinstance(
                objective, CogBuildingObjective):
            return

        # If we aren't looking for any specific department of building.
        if objective.dept == QuestGlobals.Any:
            # Let's just use the good ol' generic building icon.
            self.handleSimpleIcon(QuestGlobals.getCogBuildingIcon(),
                                  QuestGlobals.SIMPLE_IMAGE_SCALE, iconElement)
        else:
            # Ah geez, we're looking for a specific department.
            # Bossbot tie names are messed up, so we need this if statement.
            dept = objective.dept.getTie(
            ) if not objective.dept == Dept.BOSS else 'corp'
            bldgMdl = loader.loadModel(
                'phase_4/models/modules/suit_landmark_%s.bam' % dept)

            # Next, we need to load the building elevator.
            elevator = loader.loadModel('phase_4/models/modules/elevator.bam')
            elevator.reparentTo(bldgMdl.find('**/*_door_origin'))

            self.handleComplexIcon(bldgMdl, iconElement)

        # Let's set the progress bar text
        pgBarText = '%d of %d %s' % (objective.progress, objective.goal,
                                     CIGlobals.makePastTense(auxText))
        self.progressBar['text'] = pgBarText

        self.objectiveInfo['text'] = infoText
        self.auxText['text'] = auxText
        self.auxFrame['image_color'] = Vec4(*frameColor)
Exemple #6
0
    def handleRecoverItemObjective(self):
        objective = self.viewObjective

        # Let's make sure we have a current objective that is
        # an instance of the RecoverItemObjective class and this poster isn't destroyed.
        if not objective or not hasattr(self, 'titleLabel') or not isinstance(
                objective, RecoverItemObjective):
            return

        # Let's make the left icon use the item icon we chose.
        self.handleSimpleIcon(objective.itemIcon, 0.12, self.auxIcon)

        # Handle the objective information.
        infoText = '%d %s' % (objective.goal,
                              CIGlobals.makePlural(objective.itemName))
        if objective.goal == 1:
            infoText = objective.itemName

        # Update the positions and information regarding the left side.
        self.auxFrame.setPos(QuestGlobals.RECOVER_LEFT_PICTURE_POS)
        self.auxFrame['image_color'] = QuestGlobals.GREEN
        self.objectiveInfo.setPos(QuestGlobals.RECOVER_INFO_POS)
        self.objectiveInfo['text'] = infoText
        self.fromToMiddleText[
            'text'] = QuestGlobals.FROM if not objective.isComplete(
            ) else QuestGlobals.TO

        if not objective.isComplete():
            self.handleCogObjective(self.goalIcon,
                                    auxText=QuestGlobals.RECOVER,
                                    frameColor=QuestGlobals.GREEN)

            # Let's set the progress bar text
            pgBarText = '%d of %d %s' % (objective.progress, objective.goal,
                                         CIGlobals.makePastTense(
                                             QuestGlobals.RECOVER))
            self.progressBar['text'] = pgBarText
            self.progressBar['value'] = objective.progress & pow(2, 16) - 1
        else:
            self.handleNPCObjective(self.goalIcon,
                                    auxText=QuestGlobals.RETURN,
                                    frameColor=QuestGlobals.BLUE)
    def handleCogObjective(self,
                           iconElement=auxIcon,
                           auxText=QuestGlobals.DEFEAT,
                           frameColor=QuestGlobals.BLUE):
        objective = self.viewObjective
        infoText = objective.getTaskInfo()

        if objective.__class__ == RecoverItemObjective:
            infoText = CIGlobals.makePlural(objective.cog)

        if not iconElement:
            iconElement = self.auxIcon

        # Let's make sure we have a current objective that is
        # an instance of the CogObjective class and this poster isn't destroyed.
        if not objective or not hasattr(self, 'titleLabel') or not isinstance(
                objective, CogObjective):
            return

        if objective.dept:
            icons = loader.loadModel('phase_3/models/gui/cog_icons.bam')
            deptIcon = None

            if objective.dept == Dept.BOSS:
                deptIcon = icons.find('**/CorpIcon')
            else:
                deptIcon = icons.find('**/%sIcon' %
                                      objective.dept.getTie().title())

            # Correct the medallion color.
            deptIcon.setColor(SuitGlobals.medallionColors[objective.dept])

            # Setup the icon and remove the icons node.
            self.handleSimpleIcon(deptIcon, 0.13, iconElement)
            icons.removeNode()
        elif objective.cog == QuestGlobals.Any:
            # We aren't fighting a Cog in particular.
            cogIcon = QuestGlobals.getCogIcon()
            self.handleSimpleIcon(cogIcon, 0.13, iconElement)

        # We're fighting a Cog in particular.
        if not objective.cog == QuestGlobals.Any:
            cogHeadInstance = SuitBank.getSuitByName(objective.cog).getHead()
            cogHead = cogHeadInstance.generate()
            cogHead.setName('%sHead' % CIGlobals.Suit)
            cogHead.setPythonTag('Settings', cogHeadInstance.head)
            cogHead.setScale(2)
            cogHead.setLightOff()
            self.handleComplexIcon(cogHead, iconElement)

            # HACK FIX: Corrects the buggy Flunky glasses.
            glasses = cogHead.find('**/glasses')
            if glasses and not glasses.isEmpty():
                glasses.setScale(1)
                glasses.reparentTo(cogHead)

        if not iconElement is self.auxIcon:
            if hasattr(self, 'goalInfo'):
                # We're working with the second frame, on the right.
                # Let's update the information pertaining to this side.
                self.goalInfo['text'] = infoText
                self.goalInfo.setPos(QuestGlobals.RECOVER_INFO2_POS)
                self.auxText.setPos(QuestGlobals.RECOVER_AUX_POS)
            else:
                raise AttributeError(
                    'Attempted to setup DoubleFrame information for poster using default style.'
                )
        else:
            self.objectiveInfo['text'] = infoText

        # Let's set the progress bar text
        pgBarText = '%d of %d %s' % (objective.progress, objective.goal,
                                     CIGlobals.makePastTense(auxText))
        self.progressBar['text'] = pgBarText

        self.auxText['text'] = auxText

        # Let's set the color of the poster.
        frame = self.auxFrame if iconElement is self.auxIcon else self.goalFrame
        frame['image_color'] = Vec4(*frameColor)
 def getProgressText(self):
     return "%d of %d " % (self.progress, self.goal) + CIGlobals.makePastTense(self.Header)
 def getProgressUpdateBrief(self):
     return ('{0} of {1} {2} {3}'.format(self.progress, self.goal, CIGlobals.makePlural(self.itemName), 
         CIGlobals.makePastTense(self.Header)))