def setRenown(self, renown): self.renown = renown if self.displayType == SHIP_RENOWN_DISPLAY: self.rank = TitleGlobals.getRank(self.titleId, self.renown) elif self.displayType == LAND_RENOWN_DISPLAY: self.rank = TitleGlobals.getRank(self.titleId, self.renown) else: self.rank = 0 self.renownTarget = self.breakPoints[min(self.rank + 1, self.maxRank)] self.renownBase = self.breakPoints[self.rank] if self.rankBox: self.rankBox['text'] = self.titleMap[self.rank] self.rankBox['text_scale'] = 0.059999999999999998 if self.renownMeter: value = 0 if self.rank < self.maxRank and self.renownTarget - self.renownBase > 0: value = int((self.renown - self.renownBase) * 100 / (self.renownTarget - self.renownBase)) self.renownMeter['value'] = value if self.renownMeterText: if self.rank >= self.maxRank: self.renownBase = 0 self.renownTarget = 0 text = '0 / 0' if self.rank < self.maxRank and self.renownTarget - self.renownBase > 0: text = '%s / %s' % (self.renown - self.renownBase, self.renownTarget - self.renownBase) self.renownMeterText['text'] = text self.loadRankIcon()
def checkInfamyReq(self, itemId): landInfamyLevel = ItemGlobals.getLandInfamyRequirement(itemId) seaInfamyLevel = ItemGlobals.getSeaInfamyRequirement(itemId) if landInfamyLevel and TitleGlobals.getRank(TitleGlobals.LandPVPTitle, localAvatar.getInfamyLand()) < landInfamyLevel: self.highlightRed(PLocalizer.LandInfamyRequirement % landInfamyLevel) if seaInfamyLevel and TitleGlobals.getRank(TitleGlobals.ShipPVPTitle, localAvatar.getInfamySea()) < seaInfamyLevel: self.highlightRed(PLocalizer.SeaInfamyRequirement % seaInfamyLevel)
def refresh(self): inv = localAvatar.getInventory() origRank = self.rank if inv: invType = TitleGlobals.getInventoryType(self.titleId) if self.titleId == TitleGlobals.ShipPVPTitle: self.expPoints = localAvatar.getInventory().getStackQuantity(InventoryType.PVPTotalInfamySea) elif self.titleId == TitleGlobals.LandPVPTitle: self.expPoints = localAvatar.getInventory().getStackQuantity(InventoryType.PVPTotalInfamyLand) elif invType: self.expPoints = inv.getStackQuantity(invType) else: self.expPoints = 0 if self.titleId == TitleGlobals.FounderTitle and localAvatar.getFounder(): self.expPoints = 1 self.rank = TitleGlobals.getRank(self.titleId, self.expPoints) self.maxRank = TitleGlobals.getMaxRank(self.titleId) self.expTarget = TitleGlobals.getBreakpoints(self.titleId)[min(self.rank + 1, self.maxRank)] self.expBase = TitleGlobals.getBreakpoints(self.titleId)[self.rank] if self.titleNameFrame: self.titleNameFrame['text'] = TitleGlobals.getTitleRankName(self.titleId, self.expPoints) if self.expMeter: value = 0 if self.rank < self.maxRank and self.expTarget - self.expBase > 0: value = int((self.expPoints - self.expBase) * 100 / (self.expTarget - self.expBase)) self.expMeter['value'] = value if self.expMeterText: if self.rank >= self.maxRank: self.expBase = 0 self.expTarget = 0 text = '0 / 0' if self.rank < self.maxRank and self.expTarget - self.expBase > 0: text = '%s / %s' % (self.expPoints - self.expBase, self.expTarget - self.expBase) self.expMeterText['text'] = text if self.iconFrame: icName = TitleGlobals.getIconName(self.titleId, self.rank) if icName: img = self.iconModel.find('**/' + icName) else: img = None self.iconFrame['image'] = img imgScale = TitleGlobals.getScale(self.titleId) self.iconFrame['image_scale'] = (0.065000000000000002 * imgScale, 1, 0.065000000000000002 * imgScale) titleOnOff = [ PLocalizer.TitleOff, PLocalizer.TitleOn] if self.rank != origRank: if self.landActive: self.titlesPage.setLandActive(self.panelIndex, self.landActive) if self.seaActive: self.titlesPage.setSeaActive(self.panelIndex, self.seaActive) if self.rank == 0 or not Freebooter.getPaidStatus(localAvatar.doId): self.landButton.hide() self.seaButton.hide() else: self.landButton.show() self.seaButton.show()
def refresh(self): inv = localAvatar.getInventory() origRank = self.rank if inv: invType = TitleGlobals.getInventoryType(self.titleId) if self.titleId == TitleGlobals.ShipPVPTitle: self.expPoints = localAvatar.getInventory().getStackQuantity( InventoryType.PVPTotalInfamySea) elif self.titleId == TitleGlobals.LandPVPTitle: self.expPoints = localAvatar.getInventory().getStackQuantity( InventoryType.PVPTotalInfamyLand) elif invType: self.expPoints = inv.getStackQuantity(invType) else: self.expPoints = 0 if self.titleId == TitleGlobals.FounderTitle and localAvatar.getFounder( ): self.expPoints = 1 self.rank = TitleGlobals.getRank(self.titleId, self.expPoints) self.maxRank = TitleGlobals.getMaxRank(self.titleId) self.expTarget = TitleGlobals.getBreakpoints(self.titleId)[min( self.rank + 1, self.maxRank)] self.expBase = TitleGlobals.getBreakpoints(self.titleId)[self.rank] if self.titleNameFrame: self.titleNameFrame['text'] = TitleGlobals.getTitleRankName( self.titleId, self.expPoints) if self.expMeter: value = 0 if self.rank < self.maxRank and self.expTarget - self.expBase > 0: value = int((self.expPoints - self.expBase) * 100 / (self.expTarget - self.expBase)) self.expMeter['value'] = value if self.expMeterText: if self.rank >= self.maxRank: self.expBase = 0 self.expTarget = 0 text = '0 / 0' if self.rank < self.maxRank and self.expTarget - self.expBase > 0: text = '%s / %s' % (self.expPoints - self.expBase, self.expTarget - self.expBase) self.expMeterText['text'] = text if self.iconFrame: icName = TitleGlobals.getIconName(self.titleId, self.rank) if icName: img = self.iconModel.find('**/' + icName) else: img = None self.iconFrame['image'] = img imgScale = TitleGlobals.getScale(self.titleId) self.iconFrame['image_scale'] = (0.065000000000000002 * imgScale, 1, 0.065000000000000002 * imgScale) titleOnOff = [PLocalizer.TitleOff, PLocalizer.TitleOn] if self.rank != origRank: if self.landActive: self.titlesPage.setLandActive(self.panelIndex, self.landActive) if self.seaActive: self.titlesPage.setSeaActive(self.panelIndex, self.seaActive) if self.rank == 0 or not Freebooter.getPaidStatus(localAvatar.doId): self.landButton.hide() self.seaButton.hide() else: self.landButton.show() self.seaButton.show()