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 getTaskInfo(self, speech = False): infoText = QuestGlobals.DEFEAT + ' ' if speech else '' infoText += (str(self.goal)) if self.goal > 1 else ('A' if not speech else 'a') 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 self.goal > 1: variantTxt = CIGlobals.makePlural(variantTxt) infoText = str('%s %s' % (infoText, variantTxt)) if self.dept: deptName = self.dept.getName() if not self.goal > 1 else CIGlobals.makePlural(self.dept.getName()) infoText = str('%s %s' % (infoText, deptName)) elif self.cog == QuestGlobals.Any: text = CIGlobals.Suit if not self.goal > 1 else CIGlobals.Suits infoText = str('%s %s' % (infoText, text)) elif not self.cog == QuestGlobals.Any: nameText = self.cog if not self.goal > 1 else CIGlobals.makePlural(self.cog) infoText = str('%s %s' % (infoText, nameText)) return infoText
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 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 getTaskInfo(self, speech = False): taskInfo = ('A ' if not speech else 'a ') if self.goal == 1 else '%d ' % self.goal if self.minFloors != QuestGlobals.Any: taskInfo += "%s+ Story " % QuestGlobals.getNumName(self.minFloors) name = self.Name if not speech: name = '%s Building' 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 taskInfo
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 getProgressUpdateBrief(self): return ('{0} of {1} {2} {3}'.format(self.progress, self.goal, CIGlobals.makePlural(self.itemName), CIGlobals.makePastTense(self.Header)))