def __init__(self, uid): SimpleEconomyItem.__init__(self, uid) self.icon = self.Icons.find('**/%s' % EconomyGlobals.getItemIcons(uid)) if uid in range(InventoryType.begin_PistolPouches, InventoryType.end_PistolPouches): self.shortDesc = PLocalizer.makeHeadingString( PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1) else: if uid in range(InventoryType.begin_DaggerPouches, InventoryType.end_DaggerPouches): self.shortDesc = PLocalizer.makeHeadingString( PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1) else: if uid in range(InventoryType.begin_GrenadePouches, InventoryType.end_GrenadePouches): self.shortDesc = PLocalizer.makeHeadingString( PLocalizer.GrenadeShort, 1) else: if uid in range(InventoryType.begin_CannonPouches, InventoryType.end_CannonPouches): self.shortDesc = PLocalizer.makeHeadingString( PLocalizer.ShipCannonShort, 1) else: self.shortDesc = PLocalizer.makeHeadingString( self.itemType, 1) self.itemName = self.shortDesc self.longDesc = self.shortDesc
def checkPlayerInventory(self, itemId, extraQty = 0): if self.available: inventory = base.localAvatar.getInventory() currStock = inventory.getStackQuantity(itemId) currStockLimit = inventory.getStackLimit(itemId) if currStock == 0: if base.cr.newsManager.getHoliday(21): pass if not (itemId in InventoryType.WinterHolidaySongs): self.name = PLocalizer.makeHeadingString(PLocalizer.SongTitleUnknown, 2) self.nameTag['text'] = PLocalizer.makeHeadingString(PLocalizer.SongTitleUnknown, 2) self.itemTypeName['text'] = PLocalizer.makeHeadingString(PLocalizer.SongComingSoon, 1) self.disable() not (itemId in InventoryType.WinterHolidaySongs)
def __init__(self, uid): SimpleEconomyItem.__init__(self, uid) self.icon = self.Icons.find('**/%s' % EconomyGlobals.getItemIcons(uid)) if uid in range(InventoryType.begin_PistolPouches, InventoryType.end_PistolPouches): self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1) elif uid in range(InventoryType.begin_DaggerPouches, InventoryType.end_DaggerPouches): self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1) elif uid in range(InventoryType.begin_GrenadePouches, InventoryType.end_GrenadePouches): self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.GrenadeShort, 1) elif uid in range(InventoryType.begin_CannonPouches, InventoryType.end_CannonPouches): self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.ShipCannonShort, 1) else: self.shortDesc = PLocalizer.makeHeadingString(self.itemType, 1) self.itemName = self.shortDesc self.longDesc = self.shortDesc
def checkPlayerInventory(self, itemId, extraQty=0): if self.available: inventory = base.localAvatar.getInventory() currStock = inventory.getStackQuantity(itemId) currStockLimit = inventory.getStackLimit(itemId) if currStock == 0 and not (base.cr.newsManager.getHoliday(21) and itemId in InventoryType.WinterHolidaySongs): self.name = PLocalizer.makeHeadingString( PLocalizer.SongTitleUnknown, 2) self.nameTag['text'] = PLocalizer.makeHeadingString( PLocalizer.SongTitleUnknown, 2) self.itemTypeName['text'] = PLocalizer.makeHeadingString( PLocalizer.SongComingSoon, 1) self.disable()
def createTextBox(self): if self.infoBox: return None globalPos = self.getPos(base.a2dLeftCenter) self.infoBox = None self.infoBox = BorderFrame(parent=base.a2dLeftCenter, frameSize=(-0.040000000000000001, 0.5, -0.25, 0.050000000000000003), pos=(globalPos.getX() + 0.12, 0, globalPos.getZ()), state=DGG.DISABLED) self.label = DirectLabel( parent=self.infoBox, relief=None, text=PLocalizer.CannonDefenseAmmoDesc % (PLocalizer.makeHeadingString( PLocalizer.InventoryTypeNames[self.skillId], 2), self.cost, self.amount, PLocalizer.CannonDefenseAmmoTypeDesc[self.skillId]), text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleLarge, text_fg=PiratesGuiGlobals.TextFG2, text_wordwrap=12, textMayChange=1) if self.locked: memberText = '' if self.skillId > CannonDefenseGlobals.FREEBOOTER_LAST_AMMO_AVAILABLE: memberText = PLocalizer.VR_AuthAccess self.label['text'] = PLocalizer.CannonDefenseAmmoUnlockedAt % ( CannonDefenseGlobals.getLevelUnlockedAt( self.skillId), memberText) self.infoBox.setBin('gui-cannonDefense', 4)
def loadData(self): itemId = self.data[0] item, quantity = self.data self.quantity = quantity itemType = EconomyGlobals.getItemType(itemId) if itemType <= ItemType.WAND: itemTypeName = PLocalizer.getItemSubtypeName( ItemGlobals.getSubtype(itemId)) else: itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType) if itemType <= ItemType.WAND or itemType == ItemType.POTION: name = PLocalizer.getItemName(itemId) self.price = ItemGlobals.getGoldCost(itemId) else: name = PLocalizer.InventoryTypeNames.get(item) self.price = EconomyGlobals.getItemCost(item) if self.sell: self.price /= 2 if self.buy: if itemType > ItemType.WAND and itemType != ItemType.POTION: self.quantity = EconomyGlobals.getItemQuantity(itemId) self.price *= self.quantity self.price = int(self.price) self.name = PLocalizer.makeHeadingString(name, 2) self.itemType = itemTypeName if itemType != ItemType.FISHING_LURE: if itemType != ItemType.POTION: self.minLvl = ItemGlobals.getWeaponRequirement(itemId) else: self.minLvl = 0 else: self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
def loadData(self): itemId = self.data[0] (item, quantity) = self.data self.quantity = quantity itemType = EconomyGlobals.getItemType(itemId) if itemType <= ItemType.WAND: itemTypeName = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId)) else: itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType) if itemType <= ItemType.WAND or itemType == ItemType.POTION: name = PLocalizer.getItemName(itemId) self.price = ItemGlobals.getGoldCost(itemId) else: name = PLocalizer.InventoryTypeNames.get(item) self.price = EconomyGlobals.getItemCost(item) if self.sell: self.price /= 2 if self.buy: if itemType > ItemType.WAND and itemType != ItemType.POTION: self.quantity = EconomyGlobals.getItemQuantity(itemId) self.price *= self.quantity self.price = int(self.price) self.name = PLocalizer.makeHeadingString(name, 2) self.itemType = itemTypeName if itemType != ItemType.FISHING_LURE: if itemType != ItemType.POTION: self.minLvl = ItemGlobals.getWeaponRequirement(itemId) else: self.minLvl = 0 else: self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
def createGui(self): itemId = self.data[0] self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.16, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont()) if itemId in range(InventoryType.begin_PistolPouches, InventoryType.end_PistolPouches): self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1) elif itemId in range(InventoryType.begin_DaggerPouches, InventoryType.end_DaggerPouches): self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1) elif itemId in range(InventoryType.begin_GrenadePouches, InventoryType.end_GrenadePouches): self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.GrenadeShort, 1) elif itemId in range(InventoryType.begin_CannonPouches, InventoryType.end_CannonPouches): self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.ShipCannonShort, 1) else: self.itemTypeFormatted = PLocalizer.makeHeadingString(self.itemType, 1) self.itemTypeName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.itemTypeFormatted, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.16, 0, 0.065000000000000002)) self.miscText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.16, 0, 0.025000000000000001)) if self.minLvl > 0: repId = WeaponGlobals.getRepId(itemId) if repId: self.checkLevel(repId, self.minLvl) self.checkFreebooter(itemId, base.localAvatar.getDoId()) trainingReq = EconomyGlobals.getItemTrainingReq(itemId) if trainingReq: self.checkTrainingReq(trainingReq) if EconomyGlobals.getItemCategory(itemId) == ItemType.AMMO: skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId) self.checkSkillReq(skillId) self.checkInfamyReq(itemId) if self.buy: self.checkPlayerInventory(itemId) self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = InventoryListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.065000000000000002), text_font = PiratesGlobals.getInterfaceFont()) if self.quantity and self.quantity > 1: self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), frameColor = (0, 0, 0, 1), frameSize = (-0.01, 0.02, -0.01, 0.025000000000000001), text_scale = 0.0275, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.02, 0, 0.025000000000000001), text_font = PiratesGlobals.getPirateBoldOutlineFont()) geomParams = InventoryItemGui.getGeomParams(itemId) self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, geom = geomParams['geom'], geom_pos = geomParams['geom_pos'], geom_scale = geomParams['geom_scale'], pos = (0.01, 0, 0.01)) self.flattenStrong()
def loadData(self): itemId = self.data[0] if UberDogGlobals.InventoryId.isStackable(itemId): (item, quantity) = self.data name = PLocalizer.InventoryTypeNames.get(item) self.quantity = 1 itemType = None itemTypeName = None self.price = 5 else: (category, doId) = self.data name = PLocalizer.InventoryCategoryNames.get(category) self.quantity = 1 itemTypeName = 'Object' self.price = 5 if self.buy: self.price *= self.quantity self.price = int(self.price) self.name = PLocalizer.makeHeadingString(name, 2) self.itemType = itemTypeName self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
def __init__(self, category, width = 0.40000000000000002): DirectFrame.__init__(self, parent = NodePath(), relief = None) self.initialiseoptions(ReputationMeter) self.category = category self.level = 0 self.value = 0 self.max = 0 self.masteredIval = None name = PLocalizer.makeHeadingString(self.getCategoryName(), 2) self.categoryLabel = DirectLabel(parent = self, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = (-width * 0.5, 0, 0.02), textMayChange = 1) self.levelLabel = DirectLabel(parent = self, relief = None, text = '', text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (width * 0.5, 0, 0.02), textMayChange = 1) gui = loader.loadModel('models/gui/ship_battle') guiModel = loader.loadModel('models/gui/toplevel_gui') self.meter = DirectWaitBar(parent = self, relief = DGG.FLAT, state = DGG.DISABLED, range = self.max, value = self.value, frameSize = (-width * 0.5, width * 0.5, -0.01, 0.01), frameColor = (65 / 255.0, 40 / 255.0, 8 / 255.0, 1), barColor = (223 / 255.0, 137 / 255.0, 28 / 255.0, 1), pos = (0, 0, 0.0)) self.meterFrame = DirectFrame(parent = self.meter, relief = None, image = gui.find('**/ship_battle_speed_bar*'), image_scale = (width * 0.75, 1.0, 0.59999999999999998), pos = (0, 0, 0.0)) self.clamp1 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (-width * 0.33300000000000002, 0, 0)) self.clamp2 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (-width * 0.16700000000000001, 0, 0)) self.clamp3 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (0, 0, 0)) self.clamp4 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (width * 0.16700000000000001, 0, 0)) self.clamp5 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (width * 0.33300000000000002, 0, 0)) self.valueLabel = DirectLabel(parent = self.meter, relief = None, text = '', text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0, 0.032000000000000001), pos = (0, 0, -0.01), textMayChange = 1) logoModel = loader.loadModel('models/gui/potcLogo') self.levelCapScroll = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/main_gui_quest_scroll')) self.levelCapScroll.setPos(0.0, 0.0, 0.01) self.levelCapScroll.setScale(0.115, 1.0, 0.050000000000000003) self.levelCapScroll.hide() self.levelCapIcon = DirectFrame(parent = self.meter, relief = None, image = logoModel.find('**/skull')) self.levelCapIcon.setPos(0.0, 0.0, 0.025000000000000001) self.levelCapIcon.setScale(0.40000000000000002) self.levelCapIcon.setBin('gui-popup', 0) self.levelCapIcon.hide() self.masteredLabel = DirectLabel(parent = self.meter, relief = None, text = PLocalizer.RepCapText_Skill, text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont()) self.masteredLabel.setPos(0.0, 0.0, -0.01) self.masteredLabel.hide() self.levelCapScroll.setTransparency(1) self.levelCapIcon.setTransparency(1) self.masteredLabel.setTransparency(1) self.update(self.value) self.flattenStrong()
def createGui(self): itemId = self.data[0] (item, quantity) = self.data name = ItemGlobals.getName(item) itemType = ItemGlobals.getType(item) itemTypeName = name repCategory = ItemGlobals.getItemRepId(itemId) if quantity: repValue = localAvatar.getInventory().getReputation(repCategory) self.repMeter = ReputationMeter(repCategory, width = 0.66000000000000003) self.repMeter.setPos(0.62, 0, 0.041000000000000002) self.repMeter.update(repValue) self.repMeter.reparentTo(self) self.repMeter.flattenLight() hotkeyLabel = '' hotkeys = () desc = PLocalizer.WeaponDescriptions.get(itemId) helpText = PLocalizer.InventoryTypeNames[repCategory] self.weaponButton = CombatTray.WeaponButton(hotkeys = hotkeys, hotkeyLabel = hotkeyLabel, helpOpaque = True, helpText = helpText, parent = self, showQuant = 0, pos = (0.10000000000000001, 0, -0.02), scale = 1.1000000000000001) self.weaponButton.ignoreHotkeys() self.weaponButton.setWeaponId(itemId) self.weaponButton['extraArgs'] = [ itemId] self.weaponButton.helpDelay = 0 self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001) self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.WeaponAlreadyUnlocked, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001), text_font = PiratesGlobals.getInterfaceFont()) else: self.repMeter = None name = PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames[repCategory], 2) self.categoryLabel = DirectLabel(parent = self, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.059999999999999998), textMayChange = 0) self.weaponButton = CombatTray.WeaponButton(parent = self, state = DGG.DISABLED, showQuant = 0, scale = 1.1000000000000001) self.weaponButton.setPos(0.10000000000000001, 0, -0.02) self.weaponButton.setWeaponId(itemId) self.weaponButton.helpDelay = 0 self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001) unlockDesc = PLocalizer.WeaponUnlockText[repCategory] self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = unlockDesc, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.025000000000000001), text_font = PiratesGlobals.getInterfaceFont()) self.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1, 1)
def createGui(self): itemId = self.data[0] (item, quantity) = self.data name = ItemGlobals.getName(item) itemType = ItemGlobals.getType(item) itemTypeName = name repCategory = ItemGlobals.getItemRepId(itemId) if quantity: repValue = localAvatar.getInventory().getReputation(repCategory) self.repMeter = ReputationMeter(repCategory, width=0.66000000000000003) self.repMeter.setPos(0.62, 0, 0.041000000000000002) self.repMeter.update(repValue) self.repMeter.reparentTo(self) self.repMeter.flattenLight() hotkeyLabel = '' hotkeys = () desc = PLocalizer.WeaponDescriptions.get(itemId) helpText = PLocalizer.InventoryTypeNames[repCategory] self.weaponButton = CombatTray.WeaponButton( hotkeys=hotkeys, hotkeyLabel=hotkeyLabel, helpOpaque=True, helpText=helpText, parent=self, showQuant=0, pos=(0.10000000000000001, 0, -0.02), scale=1.1000000000000001) self.weaponButton.ignoreHotkeys() self.weaponButton.setWeaponId(itemId) self.weaponButton['extraArgs'] = [itemId] self.weaponButton.helpDelay = 0 self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001) self.desc = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.WeaponAlreadyUnlocked, text_scale=PiratesGuiGlobals.TextScaleSmall, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, pos=(0.28999999999999998, 0, -0.0050000000000000001), text_font=PiratesGlobals.getInterfaceFont()) else: self.repMeter = None name = PLocalizer.makeHeadingString( PLocalizer.InventoryTypeNames[repCategory], 2) self.categoryLabel = DirectLabel( parent=self, relief=None, text=name, text_scale=PiratesGuiGlobals.TextScaleLarge, text_align=TextNode.ALeft, text_shadow=PiratesGuiGlobals.TextShadow, pos=(0.28999999999999998, 0, 0.059999999999999998), textMayChange=0) self.weaponButton = CombatTray.WeaponButton( parent=self, state=DGG.DISABLED, showQuant=0, scale=1.1000000000000001) self.weaponButton.setPos(0.10000000000000001, 0, -0.02) self.weaponButton.setWeaponId(itemId) self.weaponButton.helpDelay = 0 self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001) unlockDesc = PLocalizer.WeaponUnlockText[repCategory] self.desc = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=unlockDesc, text_scale=PiratesGuiGlobals.TextScaleSmall, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, pos=(0.28999999999999998, 0, 0.025000000000000001), text_font=PiratesGlobals.getInterfaceFont()) self.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1, 1)
def loadData(self): itemId = self.data[0] name = PLocalizer.LocationNames[itemId] self.price = EconomyGlobals.StowawayCost[itemId] self.name = PLocalizer.makeHeadingString(name, 2) self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
def setCategory(self, category): self.category = category name = PLocalizer.makeHeadingString(self.getCategoryName(), 2) self.categoryLabel['text'] = name
def createGui(self): ShipFrame.createGui(self) self.nameLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(self['shipName'], 2), text_align=TextNode.ALeft, text_scale=0.05, text_pos=(0.06, 0.015), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, frameColor=PiratesGuiGlobals.ButtonColor1[3], frameSize=(self['frameSize'][0] + 0.04, self['frameSize'][1] - 0.03, -0.0, 0.05), pos=(0, 0, self['frameSize'][3] - 0.09)) self.classLabel = DirectLabel( parent=self.nameLabel, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString( PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font=PiratesGlobals.getInterfaceFont(), text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), textMayChange=1, text_pos=(self.nameLabel['frameSize'][0] + 0.02, -0.03)) self.timer = PiratesTimer.PiratesTimer(showMinutes=True, mode=None, titleText='', titleFg='', infoText='', cancelText='', cancelCallback=None) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setScale(0.55) self.timer.setPos(0.62, 0, 0.315) self.timer.unstash() self.timer.countdown(self['time']) self.mainText = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text='How will you lead your crew?', text_pos=(0.62, 0.2), text_font=PiratesGlobals.getInterfaceFont(), text_scale=PiratesGuiGlobals.TextScaleLarge, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_wordwrap=10, text_shadow=(0, 0, 0, 1), textMayChange=1) gui = loader.loadModel('models/gui/toplevel_gui') geomCheck = gui.find('**/generic_check') self.yesButton = DialogButton( parent=self, buttonStyle=DialogButton.YES, pos=(0.5, 0, 0.08), text=PLocalizer.BoardShip, text_scale=PiratesGuiGlobals.TextScaleLarge, text_font=PiratesGlobals.getInterfaceFont(), text_pos=(0.035, -0.014), geom=(geomCheck, ) * 4, geom_pos=(-0.06, 0, 0), geom_scale=0.5, geom0_color=PiratesGuiGlobals.ButtonColor6[0], geom1_color=PiratesGuiGlobals.ButtonColor6[1], geom2_color=PiratesGuiGlobals.ButtonColor6[2], geom3_color=PiratesGuiGlobals.ButtonColor6[3], image3_color=(0.8, 0.8, 0.8, 1), helpPos=(0, 0, -0.12), helpDelay=0.3, command=self['command'], extraArgs=[True]) self.noButton = DialogButton( parent=self, buttonStyle=DialogButton.NO, pos=(0.74, 0, 0.08), text=PLocalizer.ParlayShip, text_scale=PiratesGuiGlobals.TextScaleLarge, text_font=PiratesGlobals.getInterfaceFont(), text_pos=(0.035, -0.014), helpPos=(0, 0, -0.12), helpDelay=0.3, command=self['command'], extraArgs=[False]) return
def createTextBox(self): if self.infoBox: return None globalPos = self.getPos(base.a2dLeftCenter) self.infoBox = None self.infoBox = BorderFrame(parent = base.a2dLeftCenter, frameSize = (-0.040000000000000001, 0.5, -0.25, 0.050000000000000003), pos = (globalPos.getX() + 0.12, 0, globalPos.getZ()), state = DGG.DISABLED) self.label = DirectLabel(parent = self.infoBox, relief = None, text = PLocalizer.CannonDefenseAmmoDesc % (PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames[self.skillId], 2), self.cost, self.amount, PLocalizer.CannonDefenseAmmoTypeDesc[self.skillId]), text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 12, textMayChange = 1) if self.locked: memberText = '' if self.skillId > CannonDefenseGlobals.FREEBOOTER_LAST_AMMO_AVAILABLE: memberText = PLocalizer.VR_AuthAccess self.label['text'] = PLocalizer.CannonDefenseAmmoUnlockedAt % (CannonDefenseGlobals.getLevelUnlockedAt(self.skillId), memberText) self.infoBox.setBin('gui-cannonDefense', 4)
def createHelpFrame(self, args=None): if self.helpFrame: return None inv = localAvatar.getInventory() if not inv: return None baseRank = max(self.skillRank, 1) lvlDamageMod = WeaponGlobals.getLevelDamageModifier( localAvatar.getLevel()) buff = WeaponGlobals.getSkillEffectFlag(self.skillId) dur = WeaponGlobals.getAttackDuration(self.skillId) effect = dur + dur * (baseRank - 1) / 4.0 bonus = localAvatar.getSkillRankBonus(self.skillId) upgradeAmt = WeaponGlobals.getAttackUpgrade(self.skillId) rank = localAvatar.getSkillRank(self.skillId) skillBoost = 0 if self.skillId in ItemGlobals.getLinkedSkills( localAvatar.currentWeaponId): linkedSkillId = WeaponGlobals.getLinkedSkillId(self.skillId) skillBoost = ItemGlobals.getWeaponBoosts( localAvatar.currentWeaponId, linkedSkillId) skillBoost += ItemGlobals.getWeaponBoosts( localAvatar.getCurrentCharm(), linkedSkillId) else: skillBoost = ItemGlobals.getWeaponBoosts( localAvatar.currentWeaponId, self.skillId) skillBoost += ItemGlobals.getWeaponBoosts( localAvatar.getCurrentCharm(), self.skillId) manaCost = 0 if WeaponGlobals.getSkillTrack( self.skillId) != WeaponGlobals.PASSIVE_SKILL_INDEX: manaCost = WeaponGlobals.getMojoCost(self.skillId) if manaCost < 0: amt = localAvatar.getSkillRankBonus( InventoryType.StaffConservation) manaCost = min(manaCost - manaCost * amt, 1.0) damage = 0 loDamage = 0 mpDamage = 0 mpLoDamage = 0 if WeaponGlobals.getSkillTrack( self.skillId) == WeaponGlobals.TONIC_SKILL_INDEX: damage = WeaponGlobals.getAttackSelfHP(self.skillId) elif WeaponGlobals.getSkillTrack( self.skillId) != WeaponGlobals.PASSIVE_SKILL_INDEX: mod = (1.0 + bonus) * lvlDamageMod damage = int(WeaponGlobals.getAttackTargetHP(self.skillId) * mod) loDamage = damage / 2 mpDamage = int( WeaponGlobals.getAttackTargetMojo(self.skillId) * mod) mpLoDamage = mpDamage / 2 try: skillInfo = PLocalizer.SkillDescriptions.get(self.skillId) skillTitle = PLocalizer.makeHeadingString( PLocalizer.InventoryTypeNames.get(self.skillId), 2) skillType = PLocalizer.makeHeadingString(skillInfo[0], 1) except: self.notify.error('Error getting skill info for skillId %s' % self.skillId) description = skillInfo[1] if damage < 0: description += ' ' + PLocalizer.DealsDamage elif damage > 0: if loDamage: loDamage = 0 description += ' ' + PLocalizer.HealsDamageRange else: description += ' ' + PLocalizer.HealsDamage if mpDamage < 0: description += ' ' + PLocalizer.DealsMpDamage effectId = WeaponGlobals.getSkillEffectFlag(self.skillId) if effectId: description += ' ' + SkillEffectDescriptions.get(effectId)[0] if bonus: if self.skillId == InventoryType.SailBroadsideLeft or self.skillId == InventoryType.SailBroadsideRight: description += ' ' + PLocalizer.BroadsideDesc if self.skillId == InventoryType.CannonShoot: description += ' ' + PLocalizer.CannonShootDesc if self.skillId == InventoryType.DollAttune: description += ' ' + PLocalizer.MultiAttuneDesc if WeaponGlobals.getSkillInterrupt(self.skillId): description += ' ' + PLocalizer.InterruptDesc if WeaponGlobals.getSkillUnattune(self.skillId): description += ' ' + PLocalizer.UnattuneDesc upgradeInfo = '' if self.showUpgrade and rank < 5: if rank > 0: upgradeInfo = skillInfo[2] if upgradeInfo == '': if damage < 0: upgradeInfo += PLocalizer.UpgradesDamage elif damage > 0: upgradeInfo += PLocalizer.UpgradesHealing if mpDamage < 0: upgradeInfo += ' ' + PLocalizer.UpgradesMpDamage if effectId: entry = SkillEffectDescriptions.get(effectId) if len(entry) > 1: if not damage: upgradeInfo += PLocalizer.UpgradesDuration else: upgradeInfo += ' ' + PLocalizer.And upgradeInfo += ' ' + entry[1] upgradeInfo += '!' elif len(upgradeInfo) >= 4: upgradeInfo = skillInfo[3] else: upgradeInfo = PLocalizer.ClickToLearn elif not self.showIcon: unlockLevel = RepChart.getSkillUnlockLevel(self.skillId) if unlockLevel > 0: upgradeInfo = PLocalizer.UnlocksAtLevel % unlockLevel if self.skillId in SkillComboReq and SkillComboReq[ self.skillId] and inv.getStackQuantity(self.skillId - 1) < 2: color = 'red' if rank == 0: color = 'red' upgradeInfo = '' description += '\n' + color + SkillComboReq[self.skillId] + '.' skillDesc = skillTitle + '\n' + skillType + '\n\n' + description + '\ngreen' + upgradeInfo stats = [] if manaCost: stats.append(abs(manaCost)) if damage and loDamage: stats.append(abs(loDamage)) stats.append(abs(damage)) elif damage: stats.append(abs(damage)) if mpDamage: stats.append(abs(mpLoDamage)) stats.append(abs(mpDamage)) if buff == WeaponGlobals.C_CURSE: stats.append(WeaponGlobals.CURSED_DAM_AMP * 100) if buff == WeaponGlobals.C_WEAKEN: stats.append(WeaponGlobals.WEAKEN_PENALTY * 100) if effect > 0: stats.append(effect) if skillInfo[4]: if bonus == 0 and upgradeAmt > 0: if not self.skillId == InventoryType.SailBroadsideLeft and self.skillId == InventoryType.SailBroadsideRight: pass if not (self.skillId == InventoryType.CannonShoot): bonus = upgradeAmt if upgradeAmt < 1.0 and upgradeAmt > 0: bonus *= 100 if self.skillId == InventoryType.SailTreasureSense: bonus /= 2.0 elif self.skillId == InventoryType.CutlassParry: bonus += WeaponGlobals.getSubtypeParryBonus( localAvatar.currentWeaponId) if bonus: stats.append(abs(bonus)) if self.skillId == InventoryType.DollAttune: stats.append(rank) if self.skillRank: rankText = DirectFrame(parent=self, relief=None, text=PLocalizer.makeHeadingString( PLocalizer.Rank + ' %s' % (self.skillRank + skillBoost), 2), text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleSmall, text_fg=PiratesGuiGlobals.TextFG2, text_wordwrap=15, text_shadow=(0, 0, 0, 1), pos=(0.45000000000000001, 0, 0), textMayChange=1, sortOrder=92, state=DGG.DISABLED) stats = [stat + 0.01 for stat in stats] try: pass except TypeError: self.notify.error('Error formatting skillDesc(%s): %s' % (self.skillId, stats)) helpText = DirectFrame(parent=self, relief=None, text=skillDesc % stats, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleSmall, text_fg=PiratesGuiGlobals.TextFG2, text_wordwrap=17, textMayChange=1, state=DGG.DISABLED, sortOrder=91) height = -(helpText.getHeight() + 0.01) if self.lock: height = height - 0.040000000000000001 width = 0.55000000000000004 self.helpFrame = BorderFrame(parent=self, state=DGG.DISABLED, frameSize=(-0.040000000000000001, width, height, 0.050000000000000003), pos=(0, 0, -0.12), sortOrder=90) self.helpFrame.setBin('gui-popup', 0) helpText.reparentTo(self.helpFrame) if self.skillRank: rankText.reparentTo(self.helpFrame) if self.lock: self.lockedFrame = DirectFrame( parent=self.helpFrame, relief=None, pos=(0.087999999999999995, 0, height + 0.029999999999999999), image=SkillButton.SubLock, image_scale=0.13, image_pos=(-0.055, 0, 0.012999999999999999), text=PLocalizer.VR_AuthAccess, text_scale=PiratesGuiGlobals.TextScaleSmall, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG13) self.notify.debug('locked!') pos = self.helpFrame.getPos(aspect2d) x = min(pos[0], base.a2dRight - width) z = max(pos[2], base.a2dBottom - height) self.helpFrame.setPos(aspect2d, x, 0, z)
def setShipClass(self, shipClass): self.classLabel["text"] = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(shipClass), 1)
def __init__(self, shipPage, shipId, **kwargs): self.shipPage = shipPage self.emptyBottle = True self.setShipId(shipId) self.timer = None self.lBroadsideLimit = 0 self.rBroadsideLimit = 0 kwargs.setdefault("relief", None) kwargs.setdefault("frameSize", (0, self.Width, 0, self.Height)) DirectFrame.__init__(self, **None) self.initialiseoptions(ShipPanel) gui = loader.loadModel("models/gui/toplevel_gui") inventoryGui = loader.loadModel("models/gui/gui_icons_inventory") chestIcon = inventoryGui.find("**/pir_t_ico_trs_chest_01*") cannonIcon = gui.find("**/topgui_icon_ship_cannon_single") skillIcons = loader.loadModel("models/textureCards/skillIcons") broadsideId = InventoryType.CannonRoundShot ammoIconName = WeaponGlobals.getSkillIcon(broadsideId) broadsideIcon = skillIcons.find("**/%s" % ammoIconName) crewIcon = (gui.find("**/pir_t_gui_gen_friends_pirates"),) self.bottleFrame = ShipFrameBottle( parent=self, shipId=shipId, relief=None, state=DGG.DISABLED, pos=(0.074999999999999997, 0, 0.75), scale=0.83499999999999996, ) gui = loader.loadModel("models/gui/gui_ship_window") bottleImage = gui.find("**/ship_bottle") self.shipBottle = DirectLabel( parent=self.bottleFrame, relief=None, state=DGG.DISABLED, geom=bottleImage, geom_scale=0.29999999999999999, geom_pos=(0, 0, 0), pos=(0.5, 0, -0.0), ) self.nameLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2), text_fg=PiratesGuiGlobals.TextFG1, text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_align=TextNode.ACenter, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getPirateFont(), pos=(0.55000000000000004, 0, 1.22), ) self.classLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1), text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getInterfaceFont(), pos=(0.55000000000000004, 0, 1.1799999999999999), ) self.timer = PiratesTimer.PiratesTimer( showMinutes=True, mode=None, titleText="", titleFg="", infoText="", cancelText="", cancelCallback=None ) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setPos(0.45000000000000001, 0, 0.93999999999999995) self.timer.setScale(0.59999999999999998) self.timer.stash() self.hpMeter = DirectWaitBar( parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), frameSize=(0, 0.31, 0, 0.018599999999999998), text="", text_align=TextNode.ARight, text_scale=0.029999999999999999, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.29999999999999999, 0.029999999999999999), pos=(0.55000000000000004, 0.0, 0.45000000000000001), scale=1.2, ) hpLabel = DirectLabel( parent=self.hpMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.HP, text_scale=0.029999999999999999, text_align=TextNode.ALeft, text_pos=(0.014999999999999999, 0.029999999999999999), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.speedMeter = DirectWaitBar( parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize=(0, 0.31, 0, 0.018599999999999998), text="", text_align=TextNode.ARight, text_scale=0.029999999999999999, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.29999999999999999, 0.029999999999999999), pos=(0.55000000000000004, 0.0, 0.34999999999999998), scale=1.2, ) speedLabel = DirectLabel( parent=self.speedMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.Sails, text_scale=0.029999999999999999, text_align=TextNode.ALeft, text_pos=(0.014999999999999999, 0.029999999999999999), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.customHullLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.14999999999999999, geom_pos=(0, 0, 0), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=(0, -0.070000000000000007), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.34999999999999998, 0, 0.68000000000000005), ) self.customHullLabel.hide() self.customRiggingLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.14999999999999999, geom_pos=(0, 0, 0), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=(0, -0.070000000000000007), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.75, 0, 0.68000000000000005), ) self.customRiggingLabel.hide() textPos = (0.0, -0.16) self.plunderLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.10000000000000001, geom_pos=(0, 0, -0.050000000000000003), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.20000000000000001, 0, 0.20000000000000001), ) plunderLabel = DirectLabel( parent=self.plunderLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cargo, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_pos=(0, 0.040000000000000001), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.cannonLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=cannonIcon, geom_scale=0.45000000000000001, geom_pos=(0, 0, -0.050000000000000003), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.37, 0, 0.20000000000000001), ) cannonLabel = DirectLabel( parent=self.cannonLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cannon, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_pos=(0, 0.040000000000000001), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.cannonLabel = cannonLabel self.broadsideLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=broadsideIcon, geom_scale=0.14999999999999999, geom_pos=(0, 0, -0.050000000000000003), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.81000000000000005, 0, 0.20000000000000001), ) broadsideLabel = DirectLabel( parent=self.broadsideLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Broadsides, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.0, 0.040000000000000001), ) self.broadsideLabel = broadsideLabel self.crewLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=crewIcon, geom_scale=0.40000000000000002, geom_pos=(0, 0, 0.10000000000000001), text="", text_scale=0.044999999999999998, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.56000000000000005, 0, 0.040000000000000001), ) crewLabel = DirectLabel( parent=self.crewLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Crew, text_scale=0.035999999999999997, text_align=TextNode.ACenter, text_pos=(0.0, 0.20000000000000001), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), ) self.crewLabel = crewLabel shipOV = base.cr.getOwnerView(self.shipId) if shipOV: self.setShipName(shipOV.name) self.setShipClass(shipOV.shipClass) self.setShipHp(shipOV.Hp, shipOV.maxHp) self.setShipSp(shipOV.Sp, shipOV.maxSp) self.setShipCrew(shipOV.crew, shipOV.maxCrew) self.setShipCargo([], shipOV.maxCargo) if hasattr(shipOV, "cannonConfig"): self.setShipMaxCannons(shipOV.cannonConfig) self.setShipMaxBroadside(shipOV.lBroadsideConfig, shipOV.rBroadsideConfig) self.updateIcons() if self.emptyBottle: self.hpMeter.hide() self.speedMeter.hide() self.plunderLimit.hide() self.cannonLimit.hide() self.broadsideLimit.hide() self.crewLimit.hide() self.accept("setName-%s" % self.shipId, self.setShipName) self.accept("setShipClass-%s" % self.shipId, self.setShipClass) self.accept("setShipHp-%s" % self.shipId, self.setShipHp) self.accept("setShipSp-%s" % self.shipId, self.setShipSp) self.accept("setShipCargo-%s" % self.shipId, self.setShipCargo) self.accept("setShipCrew-%s" % self.shipId, self.setShipCrew) self.accept("setShipTimer-%s" % self.shipId, self.setShipTimer) self.accept("setHullCannonConfig-%s" % self.shipId, self.setShipMaxCannons) self.accept("setHullLeftBroadsideConfig-%s" % self.shipId, self.setShipMaxLeftBroadside) self.accept("setHullRightBroadsideConfig-%s" % self.shipId, self.setShipMaxRightBroadside) self.accept("ShipChanged-%s" % self.shipId, self.handleShipChanged) if base.config.GetBool("want-deploy-button", 0): pass 1
def createGui(self): ShipFrame.createGui(self) self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(self['shipName'], 2), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_pos = (0.059999999999999998, 0.014999999999999999), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, frameColor = PiratesGuiGlobals.ButtonColor1[3], frameSize = (self['frameSize'][0] + 0.040000000000000001, self['frameSize'][1] - 0.029999999999999999, -0.0, 0.050000000000000003), pos = (0, 0, self['frameSize'][3] - 0.089999999999999997)) self.classLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font = PiratesGlobals.getInterfaceFont(), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_pos = (self.nameLabel['frameSize'][0] + 0.02, -0.029999999999999999)) self.typeLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = '', text_pos = (0.59999999999999998, -0.029999999999999999), text_font = PiratesGlobals.getInterfaceFont(), text_scale = 0.032000000000000001, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 0) self.stateLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_font = PiratesGlobals.getInterfaceFont(), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), text_pos = (0.19, 0.070000000000000007), text_scale = PiratesGuiGlobals.TextScaleLarge, textMayChange = 0) gui = loader.loadModel('models/gui/toplevel_gui') geomCheck = gui.find('**/generic_check') self.button = GuiButton(parent = self, pos = (0.73999999999999999, 0, 0.080000000000000002), text = PLocalizer.SelectShip, text_scale = PiratesGuiGlobals.TextScaleLarge, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0.035000000000000003, -0.014), geom = (geomCheck,) * 4, geom_pos = (-0.059999999999999998, 0, 0), geom_scale = 0.5, geom0_color = PiratesGuiGlobals.ButtonColor6[0], geom1_color = PiratesGuiGlobals.ButtonColor6[1], geom2_color = PiratesGuiGlobals.ButtonColor6[2], geom3_color = PiratesGuiGlobals.ButtonColor6[3], image3_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), helpPos = (-0.40000000000000002, 0, 0.029999999999999999), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = self['extraArgs'])
def __init__(self, shipPage, shipId, **kwargs): self.shipPage = shipPage self.emptyBottle = True self.setShipId(shipId) self.timer = None self.lBroadsideLimit = 0 self.rBroadsideLimit = 0 kwargs.setdefault('relief', None) kwargs.setdefault('frameSize', (0, self.Width, 0, self.Height)) DirectFrame.__init__(self, **kwargs) self.initialiseoptions(ShipPanel) gui = loader.loadModel('models/gui/toplevel_gui') inventoryGui = loader.loadModel('models/gui/gui_icons_inventory') chestIcon = inventoryGui.find('**/pir_t_ico_trs_chest_01*') cannonIcon = gui.find('**/topgui_icon_ship_cannon_single') skillIcons = loader.loadModel('models/textureCards/skillIcons') broadsideId = InventoryType.CannonRoundShot ammoIconName = WeaponGlobals.getSkillIcon(broadsideId) broadsideIcon = skillIcons.find('**/%s' % ammoIconName) crewIcon = (gui.find('**/pir_t_gui_gen_friends_pirates'), ) self.bottleFrame = ShipFrameBottle(parent=self, shipId=shipId, relief=None, state=DGG.DISABLED, pos=(0.075, 0, 0.75), scale=0.835) gui = loader.loadModel('models/gui/gui_ship_window') bottleImage = gui.find('**/ship_bottle') self.shipBottle = DirectLabel(parent=self.bottleFrame, relief=None, state=DGG.DISABLED, geom=bottleImage, geom_scale=0.3, geom_pos=(0, 0, 0), pos=(0.5, 0, -0.0)) self.nameLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2), text_fg=PiratesGuiGlobals.TextFG1, text_scale=PiratesGuiGlobals.TextScaleTitleSmall, text_align=TextNode.ACenter, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getPirateFont(), pos=(0.55, 0, 1.22)) self.classLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1), text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ACenter, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), text_wordwrap=30, textMayChange=1, text_font=PiratesGlobals.getInterfaceFont(), pos=(0.55, 0, 1.18)) self.timer = PiratesTimer.PiratesTimer(showMinutes=True, mode=None, titleText='', titleFg='', infoText='', cancelText='', cancelCallback=None) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setPos(0.45, 0, 0.94) self.timer.setScale(0.6) self.timer.stash() self.hpMeter = DirectWaitBar(parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.1, 0.7, 0.1, 1), frameSize=(0, 0.31, 0, 0.0186), text='', text_align=TextNode.ARight, text_scale=0.03, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.3, 0.03), pos=(0.55, 0.0, 0.45), scale=1.2) hpLabel = DirectLabel(parent=self.hpMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.HP, text_scale=0.03, text_align=TextNode.ALeft, text_pos=(0.015, 0.03), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.speedMeter = DirectWaitBar(parent=self, relief=DGG.RAISED, state=DGG.DISABLED, range=1, value=0, frameColor=(0.0, 0.0, 0.0, 0.0), barColor=(0.7, 0.7, 0.1, 1), frameSize=(0, 0.31, 0, 0.0186), text='', text_align=TextNode.ARight, text_scale=0.03, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.3, 0.03), pos=(0.55, 0.0, 0.35), scale=1.2) speedLabel = DirectLabel(parent=self.speedMeter, relief=None, state=DGG.DISABLED, text=PLocalizer.Sails, text_scale=0.03, text_align=TextNode.ALeft, text_pos=(0.015, 0.03), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.customHullLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.15, geom_pos=(0, 0, 0), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=(0, -0.07), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.35, 0, 0.68)) self.customHullLabel.hide() self.customRiggingLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.15, geom_pos=(0, 0, 0), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=(0, -0.07), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.75, 0, 0.68)) self.customRiggingLabel.hide() textPos = (0.0, -0.16) self.plunderLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=chestIcon, geom_scale=0.1, geom_pos=(0, 0, -0.05), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.2, 0, 0.2)) plunderLabel = DirectLabel(parent=self.plunderLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cargo, text_scale=0.036, text_align=TextNode.ACenter, text_pos=(0, 0.04), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.cannonLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=cannonIcon, geom_scale=0.45, geom_pos=(0, 0, -0.05), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.37, 0, 0.2)) cannonLabel = DirectLabel(parent=self.cannonLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Cannon, text_scale=0.036, text_align=TextNode.ACenter, text_pos=(0, 0.04), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.cannonLabel = cannonLabel self.broadsideLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=broadsideIcon, geom_scale=0.15, geom_pos=(0, 0, -0.05), text='', text_scale=0.045, text_align=TextNode.ACenter, text_pos=textPos, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.81, 0, 0.2)) broadsideLabel = DirectLabel(parent=self.broadsideLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Broadsides, text_scale=0.036, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_pos=(0.0, 0.04)) self.broadsideLabel = broadsideLabel self.crewLimit = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, geom=crewIcon, geom_scale=0.4, geom_pos=(0, 0, 0.1), text='', text_scale=0.045, text_align=TextNode.ACenter, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), textMayChange=1, text_font=PiratesGlobals.getInterfaceOutlineFont(), pos=(0.56, 0, 0.04)) crewLabel = DirectLabel(parent=self.crewLimit, relief=None, state=DGG.DISABLED, text=PLocalizer.Crew, text_scale=0.036, text_align=TextNode.ACenter, text_pos=(0.0, 0.2), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.crewLabel = crewLabel shipOV = base.cr.getOwnerView(self.shipId) if shipOV: self.setShipName(shipOV.name) self.setShipClass(shipOV.shipClass) self.setShipHp(shipOV.Hp, shipOV.maxHp) self.setShipSp(shipOV.Sp, shipOV.maxSp) self.setShipCrew(shipOV.crew, shipOV.maxCrew) self.setShipCargo([], shipOV.maxCargo) if hasattr(shipOV, 'cannonConfig'): self.setShipMaxCannons(shipOV.cannonConfig) self.setShipMaxBroadside(shipOV.lBroadsideConfig, shipOV.rBroadsideConfig) self.updateIcons() if self.emptyBottle: self.hpMeter.hide() self.speedMeter.hide() self.plunderLimit.hide() self.cannonLimit.hide() self.broadsideLimit.hide() self.crewLimit.hide() self.accept('setName-%s' % self.shipId, self.setShipName) self.accept('setShipClass-%s' % self.shipId, self.setShipClass) self.accept('setShipHp-%s' % self.shipId, self.setShipHp) self.accept('setShipSp-%s' % self.shipId, self.setShipSp) self.accept('setShipCargo-%s' % self.shipId, self.setShipCargo) self.accept('setShipCrew-%s' % self.shipId, self.setShipCrew) self.accept('setShipTimer-%s' % self.shipId, self.setShipTimer) self.accept('setHullCannonConfig-%s' % self.shipId, self.setShipMaxCannons) self.accept('setHullLeftBroadsideConfig-%s' % self.shipId, self.setShipMaxLeftBroadside) self.accept('setHullRightBroadsideConfig-%s' % self.shipId, self.setShipMaxRightBroadside) self.accept('ShipChanged-%s' % self.shipId, self.handleShipChanged) if base.config.GetBool('want-deploy-button', 0): pass return
def setShipName(self, name, team=None): self.nameLabel["text"] = PLocalizer.makeHeadingString(name, 2)
def __init__(self, shipPage, shipId, **kwargs): self.shipPage = shipPage self.setShipId(shipId) self.timer = None self.crewDots = [] self.lBroadsideLimit = 0 self.rBroadsideLimit = 0 kwargs.setdefault('relief', None) kwargs.setdefault('frameSize', (0, self.Width, 0, self.Height)) DirectFrame.__init__(self) self.initialiseoptions(ShipPanel) gui = loader.loadModel('models/gui/toplevel_gui') chestIcon = gui.find('**/icon_crate') cannonIcon = gui.find('**/topgui_icon_ship_cannon_single') broadsideIcon = gui.find('**/topgui_icon_ship_cannon_multiple') self.bottleFrame = ShipFrameBottle(parent = self, shipId = shipId, relief = None, state = DGG.DISABLED, pos = (0.074999999999999997, 0, 0.75), scale = 0.83499999999999996) ornament = loader.loadModel('models/gui/gui_ship_window') ornament.reparentTo(self) ornament.setScale(0.29999999999999999) ornament.setPos(0.54000000000000004, 0, 0.72999999999999998) ornament.flattenStrong() self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2), text_fg = PiratesGuiGlobals.TextFG1, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_shadow = (0, 0, 0, 1), text_wordwrap = 30, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), pos = (0.55000000000000004, 0, 1.22)) self.classLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), text_wordwrap = 30, textMayChange = 1, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.55000000000000004, 0, 1.1799999999999999)) self.timer = PiratesTimer.PiratesTimer(showMinutes = True, mode = None, titleText = '', titleFg = '', infoText = '', cancelText = '', cancelCallback = None) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setPos(0.45000000000000001, 0, 0.93999999999999995) self.timer.setScale(0.59999999999999998) self.timer.stash() self.hpMeter = DirectWaitBar(parent = self, relief = DGG.RAISED, state = DGG.DISABLED, range = 1, value = 0, frameColor = (0.0, 0.0, 0.0, 0.0), barColor = (0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (0, 0.31, 0, 0.018599999999999998), text = '', text_align = TextNode.ARight, text_scale = 0.029999999999999999, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_pos = (0.29999999999999999, 0.029999999999999999), pos = (0.36099999999999999, 0.0, 0.621), scale = 1.2) hpLabel = DirectLabel(parent = self.hpMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.HP, text_scale = 0.029999999999999999, text_align = TextNode.ALeft, text_pos = (0.014999999999999999, 0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.speedMeter = DirectWaitBar(parent = self, relief = DGG.RAISED, state = DGG.DISABLED, range = 1, value = 0, frameColor = (0.0, 0.0, 0.0, 0.0), barColor = (0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (0, 0.31, 0, 0.018599999999999998), text = '', text_align = TextNode.ARight, text_scale = 0.029999999999999999, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_pos = (0.29999999999999999, 0.029999999999999999), pos = (0.36099999999999999, 0.0, 0.55000000000000004), scale = 1.2) speedLabel = DirectLabel(parent = self.speedMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.Speed, text_scale = 0.029999999999999999, text_align = TextNode.ALeft, text_pos = (0.014999999999999999, 0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) textPos = (0.0, -0.16) self.plunderLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = chestIcon, geom_scale = 0.10000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.20000000000000001, 0, 0.31)) plunderLabel = DirectLabel(parent = self.plunderLimit, relief = None, state = DGG.DISABLED, text = PLocalizer.Cargo, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_pos = (0, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.cannonLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = cannonIcon, geom_scale = 0.45000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.37, 0, 0.31)) cannonLabel = DirectLabel(parent = self.cannonLimit, relief = None, state = DGG.DISABLED, text = PLocalizer.Cannon, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_pos = (0, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.broadsideLeftLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = broadsideIcon, geom_scale = (-0.45000000000000001, 0.45000000000000001, 0.45000000000000001), text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.73999999999999999, 0, 0.31)) self.broadsideRightLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = broadsideIcon, geom_scale = 0.45000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.88500000000000001, 0, 0.31)) broadsideLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.Broadsides, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), pos = (0.81000000000000005, 0, 0.46000000000000002)) crewLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.Crew, text_scale = 0.035999999999999997, text_align = TextNode.ALeft, text_pos = (0.47499999999999998, 0.46000000000000002), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1)) self.crewLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = (0.56000000000000005, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont()) shipOV = base.cr.getOwnerView(self.shipId) if shipOV: self.setShipName(shipOV.name) self.setShipClass(shipOV.shipClass) self.setShipHp(shipOV.Hp, shipOV.maxHp) self.setShipSp(shipOV.Sp, shipOV.maxSp) self.setShipCrew(shipOV.crew, shipOV.maxCrew) self.setShipCargo([], shipOV.maxCargo) if hasattr(shipOV, 'cannonConfig'): self.setShipMaxCannons(shipOV.cannonConfig) self.setShipMaxLeftBroadside(shipOV.lBroadsideConfig) self.setShipMaxRightBroadside(shipOV.rBroadsideConfig) self.accept('setName-%s' % self.shipId, self.setShipName) self.accept('setShipClass-%s' % self.shipId, self.setShipClass) self.accept('setShipHp-%s' % self.shipId, self.setShipHp) self.accept('setShipSp-%s' % self.shipId, self.setShipSp) self.accept('setShipCargo-%s' % self.shipId, self.setShipCargo) self.accept('setShipCrew-%s' % self.shipId, self.setShipCrew) self.accept('setShipTimer-%s' % self.shipId, self.setShipTimer) self.accept('setHullCannonConfig-%s' % self.shipId, self.setShipMaxCannons) self.accept('setHullLeftBroadsideConfig-%s' % self.shipId, self.setShipMaxLeftBroadside) self.accept('setHullRightBroadsideConfig-%s' % self.shipId, self.setShipMaxRightBroadside) if base.config.GetBool('want-deploy-button', 0): pass 1
def createGui(self): ShipFrame.createGui(self) self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(self['shipName'], 2), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_pos = (0.059999999999999998, 0.014999999999999999), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, frameColor = PiratesGuiGlobals.ButtonColor1[3], frameSize = (self['frameSize'][0] + 0.040000000000000001, self['frameSize'][1] - 0.029999999999999999, -0.0, 0.050000000000000003), pos = (0, 0, self['frameSize'][3] - 0.089999999999999997)) self.classLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font = PiratesGlobals.getInterfaceFont(), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_pos = (self.nameLabel['frameSize'][0] + 0.02, -0.029999999999999999)) self.timer = PiratesTimer.PiratesTimer(showMinutes = True, mode = None, titleText = '', titleFg = '', infoText = '', cancelText = '', cancelCallback = None) self.timer.setFontColor(PiratesGuiGlobals.TextFG2) self.timer.reparentTo(self) self.timer.setScale(0.55000000000000004) self.timer.setPos(0.62, 0, 0.315) self.timer.unstash() self.timer.countdown(self['time']) self.mainText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = 'How will you lead your crew?', text_pos = (0.62, 0.20000000000000001), text_font = PiratesGlobals.getInterfaceFont(), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 10, text_shadow = (0, 0, 0, 1), textMayChange = 1) gui = loader.loadModel('models/gui/toplevel_gui') geomCheck = gui.find('**/generic_check') self.yesButton = DialogButton(parent = self, buttonStyle = DialogButton.YES, pos = (0.5, 0, 0.080000000000000002), text = PLocalizer.BoardShip, text_scale = PiratesGuiGlobals.TextScaleLarge, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0.035000000000000003, -0.014), geom = (geomCheck,) * 4, geom_pos = (-0.059999999999999998, 0, 0), geom_scale = 0.5, geom0_color = PiratesGuiGlobals.ButtonColor6[0], geom1_color = PiratesGuiGlobals.ButtonColor6[1], geom2_color = PiratesGuiGlobals.ButtonColor6[2], geom3_color = PiratesGuiGlobals.ButtonColor6[3], image3_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), helpPos = (0, 0, -0.12), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = [ True]) self.noButton = DialogButton(parent = self, buttonStyle = DialogButton.NO, pos = (0.73999999999999999, 0, 0.080000000000000002), text = PLocalizer.ParlayShip, text_scale = PiratesGuiGlobals.TextScaleLarge, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0.035000000000000003, -0.014), helpPos = (0, 0, -0.12), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = [ False]) self.noButton.hide()
def setCategory(self, category): self.category = category name = PLocalizer.makeHeadingString(self.getCategoryName(), 2) self.categoryLabel["text"] = name
def createGui(self): ShipFrame.createGui(self) self.nameLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString(self['shipName'], 2), text_align=TextNode.ALeft, text_scale=0.050000000000000003, text_pos=(0.059999999999999998, 0.014999999999999999), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=PiratesGuiGlobals.TextShadow, textMayChange=1, frameColor=PiratesGuiGlobals.ButtonColor1[3], frameSize=(self['frameSize'][0] + 0.040000000000000001, self['frameSize'][1] - 0.029999999999999999, -0.0, 0.050000000000000003), pos=(0, 0, self['frameSize'][3] - 0.089999999999999997)) self.classLabel = DirectLabel( parent=self.nameLabel, relief=None, state=DGG.DISABLED, text=PLocalizer.makeHeadingString( PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font=PiratesGlobals.getInterfaceFont(), text_scale=PiratesGuiGlobals.TextScaleMed, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), textMayChange=1, text_pos=(self.nameLabel['frameSize'][0] + 0.02, -0.029999999999999999)) self.typeLabel = DirectLabel( parent=self.nameLabel, relief=None, state=DGG.DISABLED, text='', text_pos=(0.59999999999999998, -0.029999999999999999), text_font=PiratesGlobals.getInterfaceFont(), text_scale=0.032000000000000001, text_align=TextNode.ARight, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), textMayChange=0) self.stateLabel = DirectLabel( parent=self, relief=None, state=DGG.DISABLED, text='', text_font=PiratesGlobals.getInterfaceFont(), text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=(0, 0, 0, 1), text_pos=(0.19, 0.070000000000000007), text_scale=PiratesGuiGlobals.TextScaleLarge, textMayChange=0) gui = loader.loadModel('models/gui/toplevel_gui') geomCheck = gui.find('**/generic_check') self.button = GuiButton( parent=self, pos=(0.73999999999999999, 0, 0.080000000000000002), text=PLocalizer.SelectShip, text_scale=PiratesGuiGlobals.TextScaleLarge, text_font=PiratesGlobals.getInterfaceFont(), text_pos=(0.035000000000000003, -0.014), geom=(geomCheck, ) * 4, geom_pos=(-0.059999999999999998, 0, 0), geom_scale=0.5, geom0_color=PiratesGuiGlobals.ButtonColor6[0], geom1_color=PiratesGuiGlobals.ButtonColor6[1], geom2_color=PiratesGuiGlobals.ButtonColor6[2], geom3_color=PiratesGuiGlobals.ButtonColor6[3], image3_color=(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), helpPos=(-0.40000000000000002, 0, 0.029999999999999999), helpDelay=0.29999999999999999, command=self['command'], extraArgs=self['extraArgs'])
def setShipName(self, name, team = None): self.nameLabel['text'] = PLocalizer.makeHeadingString(name, 2)
def setShipClass(self, shipClass): self.classLabel['text'] = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(shipClass), 1)
def createHelpFrame(self, args = None): if self.helpFrame: return None inv = localAvatar.getInventory() if not inv: return None baseRank = max(self.skillRank, 1) lvlDamageMod = WeaponGlobals.getLevelDamageModifier(localAvatar.getLevel()) buff = WeaponGlobals.getSkillEffectFlag(self.skillId) dur = WeaponGlobals.getAttackDuration(self.skillId) effect = dur + dur * (baseRank - 1) / 4.0 bonus = localAvatar.getSkillRankBonus(self.skillId) upgradeAmt = WeaponGlobals.getAttackUpgrade(self.skillId) rank = localAvatar.getSkillRank(self.skillId) skillBoost = 0 if self.skillId in ItemGlobals.getLinkedSkills(localAvatar.currentWeaponId): linkedSkillId = WeaponGlobals.getLinkedSkillId(self.skillId) skillBoost = ItemGlobals.getWeaponBoosts(localAvatar.currentWeaponId, linkedSkillId) skillBoost += ItemGlobals.getWeaponBoosts(localAvatar.getCurrentCharm(), linkedSkillId) else: skillBoost = ItemGlobals.getWeaponBoosts(localAvatar.currentWeaponId, self.skillId) skillBoost += ItemGlobals.getWeaponBoosts(localAvatar.getCurrentCharm(), self.skillId) manaCost = 0 if WeaponGlobals.getSkillTrack(self.skillId) != WeaponGlobals.PASSIVE_SKILL_INDEX: manaCost = WeaponGlobals.getMojoCost(self.skillId) if manaCost < 0: amt = localAvatar.getSkillRankBonus(InventoryType.StaffConservation) manaCost = min(manaCost - manaCost * amt, 1.0) damage = 0 loDamage = 0 mpDamage = 0 mpLoDamage = 0 if WeaponGlobals.getSkillTrack(self.skillId) == WeaponGlobals.TONIC_SKILL_INDEX: damage = WeaponGlobals.getAttackSelfHP(self.skillId) elif WeaponGlobals.getSkillTrack(self.skillId) != WeaponGlobals.PASSIVE_SKILL_INDEX: mod = (1.0 + bonus) * lvlDamageMod damage = int(WeaponGlobals.getAttackTargetHP(self.skillId) * mod) loDamage = damage / 2 mpDamage = int(WeaponGlobals.getAttackTargetMojo(self.skillId) * mod) mpLoDamage = mpDamage / 2 try: skillInfo = PLocalizer.SkillDescriptions.get(self.skillId) skillTitle = PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames.get(self.skillId), 2) skillType = PLocalizer.makeHeadingString(skillInfo[0], 1) except: self.notify.error('Error getting skill info for skillId %s' % self.skillId) description = skillInfo[1] if damage < 0: description += ' ' + PLocalizer.DealsDamage elif damage > 0: if loDamage: loDamage = 0 description += ' ' + PLocalizer.HealsDamageRange else: description += ' ' + PLocalizer.HealsDamage if mpDamage < 0: description += ' ' + PLocalizer.DealsMpDamage effectId = WeaponGlobals.getSkillEffectFlag(self.skillId) if effectId: description += ' ' + SkillEffectDescriptions.get(effectId)[0] if bonus: if self.skillId == InventoryType.SailBroadsideLeft or self.skillId == InventoryType.SailBroadsideRight: description += ' ' + PLocalizer.BroadsideDesc if self.skillId == InventoryType.CannonShoot: description += ' ' + PLocalizer.CannonShootDesc if self.skillId == InventoryType.DollAttune: description += ' ' + PLocalizer.MultiAttuneDesc if WeaponGlobals.getSkillInterrupt(self.skillId): description += ' ' + PLocalizer.InterruptDesc if WeaponGlobals.getSkillUnattune(self.skillId): description += ' ' + PLocalizer.UnattuneDesc upgradeInfo = '' if self.showUpgrade and rank < 5: if rank > 0: upgradeInfo = skillInfo[2] if upgradeInfo == '': if damage < 0: upgradeInfo += PLocalizer.UpgradesDamage elif damage > 0: upgradeInfo += PLocalizer.UpgradesHealing if mpDamage < 0: upgradeInfo += ' ' + PLocalizer.UpgradesMpDamage if effectId: entry = SkillEffectDescriptions.get(effectId) if len(entry) > 1: if not damage: upgradeInfo += PLocalizer.UpgradesDuration else: upgradeInfo += ' ' + PLocalizer.And upgradeInfo += ' ' + entry[1] upgradeInfo += '!' elif len(upgradeInfo) >= 4: upgradeInfo = skillInfo[3] else: upgradeInfo = PLocalizer.ClickToLearn elif not self.showIcon: unlockLevel = RepChart.getSkillUnlockLevel(self.skillId) if unlockLevel > 0: upgradeInfo = PLocalizer.UnlocksAtLevel % unlockLevel if self.skillId in SkillComboReq and SkillComboReq[self.skillId] and inv.getStackQuantity(self.skillId - 1) < 2: color = 'red' if rank == 0: color = 'red' upgradeInfo = '' description += '\n' + color + SkillComboReq[self.skillId] + '.' skillDesc = skillTitle + '\n' + skillType + '\n\n' + description + '\ngreen' + upgradeInfo stats = [] if manaCost: stats.append(abs(manaCost)) if damage and loDamage: stats.append(abs(loDamage)) stats.append(abs(damage)) elif damage: stats.append(abs(damage)) if mpDamage: stats.append(abs(mpLoDamage)) stats.append(abs(mpDamage)) if buff == WeaponGlobals.C_CURSE: stats.append(WeaponGlobals.CURSED_DAM_AMP * 100) if buff == WeaponGlobals.C_WEAKEN: stats.append(WeaponGlobals.WEAKEN_PENALTY * 100) if effect > 0: stats.append(effect) if skillInfo[4]: if bonus == 0 and upgradeAmt > 0: if not self.skillId == InventoryType.SailBroadsideLeft and self.skillId == InventoryType.SailBroadsideRight: pass if not (self.skillId == InventoryType.CannonShoot): bonus = upgradeAmt if upgradeAmt < 1.0 and upgradeAmt > 0: bonus *= 100 if self.skillId == InventoryType.SailTreasureSense: bonus /= 2.0 elif self.skillId == InventoryType.CutlassParry: bonus += WeaponGlobals.getSubtypeParryBonus(localAvatar.currentWeaponId) if bonus: stats.append(abs(bonus)) if self.skillId == InventoryType.DollAttune: stats.append(rank) if self.skillRank: rankText = DirectFrame(parent = self, relief = None, text = PLocalizer.makeHeadingString(PLocalizer.Rank + ' %s' % (self.skillRank + skillBoost), 2), text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleSmall, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 15, text_shadow = (0, 0, 0, 1), pos = (0.45000000000000001, 0, 0), textMayChange = 1, sortOrder = 92, state = DGG.DISABLED) stats = [stat + 0.01 for stat in stats] try: pass except TypeError: self.notify.error('Error formatting skillDesc(%s): %s' % (self.skillId, stats)) helpText = DirectFrame(parent = self, relief = None, text = skillDesc % stats, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleSmall, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 17, textMayChange = 1, state = DGG.DISABLED, sortOrder = 91) height = -(helpText.getHeight() + 0.01) if self.lock: height = height - 0.040000000000000001 width = 0.55000000000000004 self.helpFrame = BorderFrame(parent = self, state = DGG.DISABLED, frameSize = (-0.040000000000000001, width, height, 0.050000000000000003), pos = (0, 0, -0.12), sortOrder = 90) self.helpFrame.setBin('gui-popup', 0) helpText.reparentTo(self.helpFrame) if self.skillRank: rankText.reparentTo(self.helpFrame) if self.lock: self.lockedFrame = DirectFrame(parent = self.helpFrame, relief = None, pos = (0.087999999999999995, 0, height + 0.029999999999999999), image = SkillButton.SubLock, image_scale = 0.13, image_pos = (-0.055, 0, 0.012999999999999999), text = PLocalizer.VR_AuthAccess, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG13) self.notify.debug('locked!') pos = self.helpFrame.getPos(aspect2d) x = min(pos[0], base.a2dRight - width) z = max(pos[2], base.a2dBottom - height) self.helpFrame.setPos(aspect2d, x, 0, z)