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 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)