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 __init__(self, parent, titleId, position, panelIndex, titlesPage, defaultOnLand=0, defaultOnSea=0): DirectFrame.__init__(self, parent, pos=position) self.iconModel = loader.loadModel(TitleGlobals.getModelPath(titleId)) tempModel = loader.loadModel('models/textureCards/skillIcons') self.titleId = titleId self.rank = 1 self.maxRank = 1 self.expPoints = 241 self.expBase = 150 self.expTarget = 400 self.landActive = defaultOnLand self.seaActive = defaultOnSea self.panelIndex = panelIndex self.titlesPage = titlesPage self.booleanTitle = TitleGlobals.isBooleanTitle(self.titleId) topgui = loader.loadModel('models/gui/toplevel_gui') self.titleNameFrame = BorderFrame.BorderFrame( parent=self, relief=None, pos=(0.12, 0, 0.01), frameSize=(-0.14999999999999999, 0.5, -0.14999999999999999, 0.029999999999999999), modelName='pir_m_gui_frm_subframe', imageColorScale=VBase4(0.75, 0.75, 0.90000000000000002, 0.75), text=TitleGlobals.getTitleRankName(self.titleId, self.expPoints), text_align=TextNode.ALeft, text_scale=0.035000000000000003, text_pos=(0, -0.02), text_fg=PiratesGuiGlobals.TextFG1, text_wordwrap=15, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceFont()) self.titleDescFrame = DirectFrame( parent=self, relief=None, pos=(0.125, 0, -0.095000000000000001), text=TitleGlobals.getTitleDesc(self.titleId), text_align=TextNode.ALeft, text_scale=0.029999999999999999, text_pos=(0, -0.01), text_fg=PiratesGuiGlobals.TextFG2, text_wordwrap=15, text_shadow=(0, 0, 0, 1), textMayChange=0, text_font=PiratesGlobals.getInterfaceFont()) shipcard = loader.loadModel('models/gui/ship_battle') tex = shipcard.find('**/ship_battle_speed_bar*') self.expFrame = DirectFrame(parent=self, pos=(0.35999999999999999, 0, -0.050000000000000003), relief=None, image=tex, image_scale=(0.23000000000000001, 1, 0.5), scale=(1.48, 1, 1.2)) self.expMeter = DirectWaitBar( parent=self.expFrame, relief=DGG.RAISED, borderWidth=(0.0040000000000000001, 0.0040000000000000001), range=100, value=50, frameColor=(0, 0, 0, 0), barColor=(223 / 255.0, 137 / 255.0, 28 / 255.0, 1), frameSize=(-0.222, 0.084000000000000005, -0.012, 0.012), pos=(0.069000000000000006, 0, 0.0)) self.expMeterText = DirectFrame( parent=self, relief=None, pos=(0.59999999999999998, 0, 0.0), text='%s / %s' % (self.expBase, self.expTarget), text_align=TextNode.ARight, text_scale=0.029999999999999999, text_pos=(0, -0.01), text_fg=PiratesGuiGlobals.TextFG2, text_wordwrap=15, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceFont()) if self.booleanTitle: self.expFrame.hide() self.expMeterText.hide() imgScale = TitleGlobals.getScale(self.titleId) self.iconFrame = GuiButton.GuiButton( parent=self, pos=(0.040000000000000001, 0, -0.050000000000000003), helpText=TitleGlobals.getTitleName(self.titleId), helpPos=(-0.26000000000000001, 0, 0.080000000000000002), relief=None, image=self.iconModel.find( '**/' + TitleGlobals.getIconName(self.titleId, 1)), image_scale=(0.14999999999999999 * imgScale, 1, 0.14999999999999999 * imgScale)) self.landButton = DirectButton.DirectButton( parent=self, pos=(0.70999999999999996, 0, -0.050000000000000003), relief=None, scale=0.22, image_color=VBase4(0.75, 0.84999999999999998, 1.0, 1.0), image=(topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle'), topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle')), command=self.selectLandBadge, extraArgs=[self.panelIndex]) self.titlesPage.landButtons.append(self.landButton) self.seaButton = DirectButton.DirectButton( parent=self, pos=(0.87, 0, -0.050000000000000003), relief=None, scale=0.22, image_color=VBase4(0.75, 0.84999999999999998, 1.0, 1.0), image=(topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle'), topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle')), command=self.selectSeaBadge, extraArgs=[self.panelIndex]) self.titlesPage.seaButtons.append(self.seaButton)
def __init__(self, parent, titleId, position, panelIndex, titlesPage, defaultOnLand = 0, defaultOnSea = 0): DirectFrame.__init__(self, parent, pos = position) self.iconModel = loader.loadModel(TitleGlobals.getModelPath(titleId)) tempModel = loader.loadModel('models/textureCards/skillIcons') self.titleId = titleId self.rank = 1 self.maxRank = 1 self.expPoints = 241 self.expBase = 150 self.expTarget = 400 self.landActive = defaultOnLand self.seaActive = defaultOnSea self.panelIndex = panelIndex self.titlesPage = titlesPage self.booleanTitle = TitleGlobals.isBooleanTitle(self.titleId) topgui = loader.loadModel('models/gui/toplevel_gui') self.titleNameFrame = BorderFrame.BorderFrame(parent = self, relief = None, pos = (0.12, 0, 0.01), frameSize = (-0.14999999999999999, 0.5, -0.14999999999999999, 0.029999999999999999), modelName = 'pir_m_gui_frm_subframe', imageColorScale = VBase4(0.75, 0.75, 0.90000000000000002, 0.75), text = TitleGlobals.getTitleRankName(self.titleId, self.expPoints), text_align = TextNode.ALeft, text_scale = 0.035000000000000003, text_pos = (0, -0.02), text_fg = PiratesGuiGlobals.TextFG1, text_wordwrap = 15, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceFont()) self.titleDescFrame = DirectFrame(parent = self, relief = None, pos = (0.125, 0, -0.095000000000000001), text = TitleGlobals.getTitleDesc(self.titleId), text_align = TextNode.ALeft, text_scale = 0.029999999999999999, text_pos = (0, -0.01), text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 15, text_shadow = (0, 0, 0, 1), textMayChange = 0, text_font = PiratesGlobals.getInterfaceFont()) shipcard = loader.loadModel('models/gui/ship_battle') tex = shipcard.find('**/ship_battle_speed_bar*') self.expFrame = DirectFrame(parent = self, pos = (0.35999999999999999, 0, -0.050000000000000003), relief = None, image = tex, image_scale = (0.23000000000000001, 1, 0.5), scale = (1.48, 1, 1.2)) self.expMeter = DirectWaitBar(parent = self.expFrame, relief = DGG.RAISED, borderWidth = (0.0040000000000000001, 0.0040000000000000001), range = 100, value = 50, frameColor = (0, 0, 0, 0), barColor = (223 / 255.0, 137 / 255.0, 28 / 255.0, 1), frameSize = (-0.222, 0.084000000000000005, -0.012, 0.012), pos = (0.069000000000000006, 0, 0.0)) self.expMeterText = DirectFrame(parent = self, relief = None, pos = (0.59999999999999998, 0, 0.0), text = '%s / %s' % (self.expBase, self.expTarget), text_align = TextNode.ARight, text_scale = 0.029999999999999999, text_pos = (0, -0.01), text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 15, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceFont()) if self.booleanTitle: self.expFrame.hide() self.expMeterText.hide() imgScale = TitleGlobals.getScale(self.titleId) self.iconFrame = GuiButton.GuiButton(parent = self, pos = (0.040000000000000001, 0, -0.050000000000000003), helpText = TitleGlobals.getTitleName(self.titleId), helpPos = (-0.26000000000000001, 0, 0.080000000000000002), relief = None, image = self.iconModel.find('**/' + TitleGlobals.getIconName(self.titleId, 1)), image_scale = (0.14999999999999999 * imgScale, 1, 0.14999999999999999 * imgScale)) self.landButton = DirectButton.DirectButton(parent = self, pos = (0.70999999999999996, 0, -0.050000000000000003), relief = None, scale = 0.22, image_color = VBase4(0.75, 0.84999999999999998, 1.0, 1.0), image = (topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle'), topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle')), command = self.selectLandBadge, extraArgs = [ self.panelIndex]) self.titlesPage.landButtons.append(self.landButton) self.seaButton = DirectButton.DirectButton(parent = self, pos = (0.87, 0, -0.050000000000000003), relief = None, scale = 0.22, image_color = VBase4(0.75, 0.84999999999999998, 1.0, 1.0), image = (topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle'), topgui.find('**/pir_t_gui_frm_base_circle_over'), topgui.find('**/pir_t_gui_frm_base_circle')), command = self.selectSeaBadge, extraArgs = [ self.panelIndex]) self.titlesPage.seaButtons.append(self.seaButton)
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()