def getTaskInfo(self, speech=False, forcePlural=False):
        Objective.getTaskInfo(self, speech=speech)

        forcePlural = True if self.neededAmount > 1 or forcePlural else False

        infoText = '' if not speech else (QuestGlobals.DEFEAT + ' ')
        infoText += (str(self.neededAmount)
                     ) if forcePlural else 'a ' if not self.name else ''

        if self.level:
            infoText += (str('%s Level %s' % (infoText, str(self.level))))
        elif self.levelRange:
            infoText += str('%s Level %s+' %
                            (infoText, str(self.levelRange[0])))

        if self.variant:
            variantTxt = Variant.VariantToName.get(self.variant)
            if forcePlural:
                variantTxt = QuestGlobals.makePlural(variantTxt)
            infoText = str('%s %s' % (infoText, variantTxt))

        if self.dept:
            deptName = self.dept.getName(
            ) if not forcePlural else QuestGlobals.makePlural(
                self.dept.getName())
            infoText = str('%s %s' % (infoText, deptName))
        elif not self.name:
            text = CIGlobals.Suit if not forcePlural else CIGlobals.Suits
            infoText = str('%s %s' % (infoText, text))
        elif self.name:
            nameText = self.name if not forcePlural else QuestGlobals.makePlural(
                self.name)
            infoText = str('%s %s' % (infoText, nameText))

        return infoText
    def handleDeliverItemObjective(self):
        objective = self.quest.currentObjective

        # 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.neededAmount,
                              QuestGlobals.makePlural(objective.itemName))
        if objective.neededAmount == 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.amount, objective.neededAmount,
                                     QuestGlobals.makePastTense(
                                         QuestGlobals.DELIVER))
        self.progressBar['text'] = pgBarText

        self.handleNPCObjective(self.goalIcon,
                                auxText=QuestGlobals.DELIVER,
                                frameColor=QuestGlobals.RED)
    def handleRecoverItemObjective(self):
        objective = self.quest.currentObjective

        # 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.neededAmount,
                              QuestGlobals.makePlural(objective.itemName))
        if objective.neededAmount == 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

        self.handleCogObjective(self.goalIcon, frameColor=QuestGlobals.GREEN)

        # Let's set the progress bar text
        pgBarText = '%d of %d %s' % (objective.amount, objective.neededAmount,
                                     QuestGlobals.makePastTense(
                                         QuestGlobals.RECOVER))
        self.progressBar['text'] = pgBarText
Exemplo n.º 4
0
    def getTaskInfo(self, speech=False):
        visitInfo = VisitNPCObjective.getTaskInfo(self, speech=False)
        infoText = '' if not speech else (QuestGlobals.DELIVER + ' ')
        infoText += str(
            'a %s' % self.itemName) if self.neededAmount == 1 else str(
                '%d %s' %
                (self.neededAmount, QuestGlobals.makePlural(self.itemName)))
        infoText = str('%s to %s' % (infoText, visitInfo))

        return infoText
Exemplo n.º 5
0
    def getTaskInfo(self, speech=False):
        cogObjInfo = CogObjective.getTaskInfo(self,
                                              speech=False,
                                              forcePlural=True)
        infoText = '' if not speech else (QuestGlobals.RECOVER + ' ')
        infoText += str(
            'a %s' % self.itemName) if self.neededAmount == 1 else str(
                '%d %s' %
                (self.neededAmount, QuestGlobals.makePlural(self.itemName)))
        infoText = str('%s from %s' % (infoText, cogObjInfo))

        return cogObjInfo
    def updateInfo(self):
        VisitNPCObjective.updateInfo(self, False, QuestGlobals.DELIVER,
                                     QuestGlobals.RED)
        scale = 0.12 if self.itemIcon.getName() == 'package' else 0.85

        self.quest.setLeftIconGeom(self.itemIcon)
        self.quest.setLeftIconScale(scale)
        self.quest.setLeftPicturePos(QuestGlobals.RECOVER_LEFT_PICTURE_POS)
        if self.itemAmount > 1:
            self.quest.setInfoText(
                '%d %s' %
                (self.itemAmount, QuestGlobals.makePlural(self.itemName)))
        else:
            self.quest.setInfoText(self.itemName)
        self.quest.setInfoPos(QuestGlobals.RECOVER_INFO_POS)
        self.quest.setMiddleText(QuestGlobals.TO)
    def updateInfo(self, leftFrame = True, auxText = QuestGlobals.DEFEAT, frameColor = QuestGlobals.BLUE):
        Objective.updateInfo(self)
        self.didEditLeft = leftFrame

        if self.neededAmount > 1:
            infoText = str(self.neededAmount)
        elif not self.name:
            infoText = 'A'
        else:
            infoText = ''

        if self.level:
            infoText = str('%s Level %s' % (infoText, str(self.level)))
        elif self.levelRange:
            infoText = str('%s Level %s+' % (infoText, str(self.levelRange[0])))

        if self.variant:
            variantText = CIGlobals.Skelesuit
            if self.neededAmount > 1:
                variantText = QuestGlobals.makePlural(variantText)
            infoText = str('%s %s' % (infoText, self.variant if self.neededAmount == 1 else QuestGlobals.makePlural(variantText)))

        if self.dept:
            deptName = self.dept.getName() if self.neededAmount == 1 else QuestGlobals.makePlural(self.dept.getName())
            infoText = str('%s %s' % (infoText, deptName))
            
            icons = loader.loadModel('phase_3/models/gui/cog_icons.bam')
            
            if self.dept == Dept.BOSS:
                icon = icons.find('**/CorpIcon')
            else:
                icon = icons.find('**/%sIcon' % self.dept.getTie().title())
            
            icon.setColor(SuitGlobals.medallionColors[self.dept])
            
            if leftFrame:
                self.quest.setLeftIconGeom(icon)
                self.quest.setLeftIconScale(0.13)
            else:
                self.quest.setRightIconGeom(icon)
                self.quest.setRightIconScale(0.13)
            icons.removeNode()
            
        elif not self.name:
            # Let's load up the general Cogs picture.
            icon = QuestGlobals.getCogIcon()

            if leftFrame:
                self.quest.setLeftIconGeom(icon)
                self.quest.setLeftIconScale(icon.getScale())
            else:
                self.quest.setRightIconGeom(icon)
                self.quest.setRightIconScale(icon.getScale())

            text = CIGlobals.Suit if self.neededAmount == 1 else CIGlobals.Suits
            infoText = str('%s %s' % (infoText, text))

        if self.name:
            nameText = self.name
            if self.neededAmount > 1:
                nameText = QuestGlobals.makePlural(self.name)
            infoText = str('%s %s' % (infoText, nameText))

            # Let's load up the head.
            head = SuitBank.getSuitByName(self.name).getHead().generate()
            head.setName('%sHead' % CIGlobals.Suit)
            head.setScale(2)
            head.setH(180)

            if leftFrame:
                self.quest.setLeftIconGeom(head)
            else:
                self.quest.setRightIconGeom(head)

        if leftFrame:
            self.quest.setInfoText(infoText)
            self.quest.setAuxText(auxText)
        else:
            self.quest.setInfo02Text(infoText)
            self.quest.setInfo02Pos(QuestGlobals.RECOVER_INFO2_POS)
            self.quest.setRightPicturePos(QuestGlobals.DEFAULT_RIGHT_PICTURE_POS)
        self.quest.setProgressText('%s of %s %s' % (self.amount, self.neededAmount, QuestGlobals.makePastTense(auxText).lower()))
        self.quest.setPictureFrameColor(frameColor)
Exemplo n.º 8
0
    def handleCogObjective(self,
                           iconElement=auxIcon,
                           auxText=QuestGlobals.DEFEAT,
                           frameColor=QuestGlobals.BLUE):
        objective = self.quest.currentObjective
        infoText = objective.getTaskInfo(speech=False)

        if objective.__class__ == RecoverItemObjective:
            infoText = QuestGlobals.makePlural(objective.name)
            print 'Yep'

        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 not objective.name:
            # We aren't fighting a Cog in particular.
            cogIcon = QuestGlobals.getCogIcon()
            self.handleSimpleIcon(cogIcon, cogIcon.getScale(), iconElement)

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

        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
            self.auxText['text'] = auxText

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

        # Let's set the color of the poster.
        frame = self.auxFrame if iconElement is self.auxIcon else self.goalFrame
        frame['image_color'] = Vec4(*frameColor)