def __init__(self, callback, skillId, skillRank): if not AmmoPanelButton.SkillIcons: AmmoPanelButton.SkillIcons = loader.loadModel('models/textureCards/skillIcons') AmmoPanelButton.Image = (AmmoPanelButton.SkillIcons.find('**/base'), AmmoPanelButton.SkillIcons.find('**/base_down'), AmmoPanelButton.SkillIcons.find('**/base_over')) self.locked = True self.purchaseable = True self.cost = CannonDefenseGlobals.getDefenseCannonAmmoCost(skillId) self.amount = CannonDefenseGlobals.getDefenseCannonAmmoAmount(skillId) if self.amount == -1: self.amount = PLocalizer.Unlimited self.skillId = skillId self.skillRank = skillRank self.infoBox = None self.flashIval = None asset = RadialMenu.getSkillIconName(skillId, 0) geom = AmmoPanelButton.SkillIcons.find('**/%s' % asset) self.geom = geom if self.locked: asset = None geom = None DirectButton.__init__(self, relief = None, pos = (0, 0, 0), text = '?', text_scale = 0.10000000000000001, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_pos = (0.0050000000000000001, -0.035000000000000003), text_align = TextNode.ACenter, image = AmmoPanelButton.Image, image_scale = 0.12, geom = geom, geom_scale = 0.12, command = callback, textMayChange = 1, sortOrder = 70, extraArgs = [ skillId]) self.initialiseoptions(AmmoPanelButton) gui = loader.loadModel('models/gui/toplevel_gui') self.lockIcon = gui.find('**/pir_t_gui_gen_key_subscriber') if not Freebooter.getPaidStatus(base.localAvatar.doId) and skillId > CannonDefenseGlobals.FREEBOOTER_LAST_AMMO_AVAILABLE: self.lock = DirectFrame(parent = self, relief = None, image = self.lockIcon, image_scale = 0.14000000000000001, image_pos = (0.050000000000000003, 0, -0.025000000000000001), sortOrder = 99) self.bind(DGG.ENTER, self.showDetails) self.bind(DGG.EXIT, self.hideDetails)
def __init__(self, callback, skillId, skillRank): if not SkillpageGuiButton.SkillIcons: SkillpageGuiButton.SkillIcons = loader.loadModel( 'models/textureCards/skillIcons') SkillpageGuiButton.Image = ( SkillpageGuiButton.SkillIcons.find('**/base'), SkillpageGuiButton.SkillIcons.find('**/base_down'), SkillpageGuiButton.SkillIcons.find('**/base_over')) asset = RadialMenu.getSkillIconName(skillId, 0) geom = SkillpageGuiButton.SkillIcons.find('**/%s' % asset) DirectButton.__init__(self, relief=None, pos=(0, 0, 0), image=SkillpageGuiButton.Image, image_scale=0.12, geom=geom, geom_scale=0.12, command=callback, textMayChange=1, sortOrder=70, extraArgs=[skillId]) self.initialiseoptions(SkillpageGuiButton) self.skillId = skillId self.skillRank = skillRank self.showUpgrade = 0 self.helpBox = None self.quantity = None self.bind(DGG.ENTER, self.showDetails) self.bind(DGG.EXIT, self.hideDetails) return
def __init__(self, callback, skillId, skillRank): if not AmmoPanelButton.SkillIcons: AmmoPanelButton.SkillIcons = loader.loadModel( 'models/textureCards/skillIcons') AmmoPanelButton.Image = ( AmmoPanelButton.SkillIcons.find('**/base'), AmmoPanelButton.SkillIcons.find('**/base_down'), AmmoPanelButton.SkillIcons.find('**/base_over')) self.locked = True self.purchaseable = True self.cost = CannonDefenseGlobals.getDefenseCannonAmmoCost(skillId) self.amount = CannonDefenseGlobals.getDefenseCannonAmmoAmount(skillId) if self.amount == -1: self.amount = PLocalizer.Unlimited self.skillId = skillId self.skillRank = skillRank self.infoBox = None self.flashIval = None asset = RadialMenu.getSkillIconName(skillId, 0) geom = AmmoPanelButton.SkillIcons.find('**/%s' % asset) self.geom = geom if self.locked: asset = None geom = None DirectButton.__init__(self, relief=None, pos=(0, 0, 0), text='?', text_scale=0.1, text_fg=PiratesGuiGlobals.TextFG2, text_shadow=PiratesGuiGlobals.TextShadow, text_pos=(0.005, -0.035), text_align=TextNode.ACenter, image=AmmoPanelButton.Image, image_scale=0.12, geom=geom, geom_scale=0.12, command=callback, textMayChange=1, sortOrder=70, extraArgs=[skillId]) self.initialiseoptions(AmmoPanelButton) gui = loader.loadModel('models/gui/toplevel_gui') self.lockIcon = gui.find('**/pir_t_gui_gen_key_subscriber') if not Freebooter.getPaidStatus( base.localAvatar.doId ) and skillId > CannonDefenseGlobals.FREEBOOTER_LAST_AMMO_AVAILABLE: self.lock = DirectFrame(parent=self, relief=None, image=self.lockIcon, image_scale=0.14, image_pos=(0.05, 0, -0.025), sortOrder=99) self.bind(DGG.ENTER, self.showDetails) self.bind(DGG.EXIT, self.hideDetails) return
def __init__(self, callback, skillId, skillRank): if not SkillpageGuiButton.SkillIcons: SkillpageGuiButton.SkillIcons = loader.loadModel('models/textureCards/skillIcons') SkillpageGuiButton.Image = (SkillpageGuiButton.SkillIcons.find('**/base'), SkillpageGuiButton.SkillIcons.find('**/base_down'), SkillpageGuiButton.SkillIcons.find('**/base_over')) asset = RadialMenu.getSkillIconName(skillId, 0) geom = SkillpageGuiButton.SkillIcons.find('**/%s' % asset) DirectButton.__init__(self, relief = None, pos = (0, 0, 0), image = SkillpageGuiButton.Image, image_scale = 0.12, geom = geom, geom_scale = 0.12, command = callback, textMayChange = 1, sortOrder = 70, extraArgs = [ skillId]) self.initialiseoptions(SkillpageGuiButton) self.skillId = skillId self.skillRank = skillRank self.showUpgrade = 0 self.helpBox = None self.quantity = None self.bind(DGG.ENTER, self.showDetails) self.bind(DGG.EXIT, self.hideDetails)
def showSkill(self, skillId, ammoSkillId=0, timestamp=0): if ammoSkillId: visSkillId = skillId != EnemySkills.PISTOL_RELOAD and skillId != EnemySkills.GRENADE_RELOAD and ammoSkillId else: visSkillId = skillId self.activeName['text'] = PLocalizer.InventoryTypeNames[visSkillId] asset = RadialMenu.getSkillIconName(visSkillId, 0) if self.card: tex = self.card.find('**/%s' % asset) self.skillFrame['image'] = tex self.skillFrame['image_scale'] = 0.075 self.skillFrame.setPos(-0.105, 0, -0.255) ts = globalClockDelta.localElapsedTime(timestamp) delay = self.SHOW_SKILL_DURATION - ts if delay > 0: if self.fader: self.fader.finish() self.reloadFrame.show() self.reloadFrame.setAlphaScale(1.0) taskMgr.remove('hideSkillTask') taskMgr.doMethodLater(delay, self.hideSkill, 'hideSkillTask')
def showSkill(self, skillId, ammoSkillId = 0, timestamp = 0): if ammoSkillId and skillId != EnemySkills.PISTOL_RELOAD and skillId != EnemySkills.GRENADE_RELOAD: visSkillId = ammoSkillId else: visSkillId = skillId self.activeName['text'] = PLocalizer.InventoryTypeNames[visSkillId] asset = RadialMenu.getSkillIconName(visSkillId, 0) if self.card: tex = self.card.find('**/%s' % asset) self.skillFrame['image'] = tex self.skillFrame['image_scale'] = 0.074999999999999997 self.skillFrame.setPos(-0.105, 0, -0.255) ts = globalClockDelta.localElapsedTime(timestamp) delay = self.SHOW_SKILL_DURATION - ts if delay > 0: if self.fader: self.fader.finish() self.reloadFrame.show() self.reloadFrame.setAlphaScale(1.0) taskMgr.remove('hideSkillTask') taskMgr.doMethodLater(delay, self.hideSkill, 'hideSkillTask')
def update(self, repId=None, fromUser=0): inv = localAvatar.getInventory() if not inv: self.notify.warning('SkillPage unable to find inventory') return if self.tabBar == None: return if self.demo: return if fromUser: self.lastUserSelectedTab = repId if repId == None: if localAvatar.getGameState() == 'Fishing': if self.lastUserSelectedTab: repId = self.lastUserSelectedTab else: repId = InventoryType.CannonRep elif localAvatar.cannon: repId = InventoryType.CannonRep elif localAvatar.gameFSM.state == 'ShipPilot': repId = InventoryType.SailingRep elif localAvatar.currentWeaponId and localAvatar.isWeaponDrawn: repId = WeaponGlobals.getRepId(localAvatar.currentWeaponId) elif localAvatar.currentWeaponId and not localAvatar.isWeaponDrawn and self.lastUserSelectedTab: repId = self.lastUserSelectedTab else: repId = InventoryType.CannonRep self.setRep(repId) self.tabBar.selectTab(str(repId)) self.repMeter.setCategory(repId) self.repMeter.update(inv.getReputation(repId)) unSpentId = self.getUnspent() amt = inv.getStackQuantity(unSpentId) if unSpentId in self.localMods: amt = self.localMods[unSpentId] self.unspent['text'] = PLocalizer.SkillPageUnspentPoints % amt if amt > 0: self.unspent['text_fg'] = (0.8, 1, 0.8, 1) else: self.unspent['text_fg'] = (1, 1, 1, 1) comboSkills = RadialMenu.ComboSkills(repId, 1) totalComboSkills = RadialMenu.ComboSkills(repId, 0) activeSkills = RadialMenu.ActiveSkills(repId, 1) totalActiveSkills = RadialMenu.ActiveSkills(repId, 0) passiveSkills = RadialMenu.PassiveSkills(repId, 1) totalPassiveSkills = RadialMenu.PassiveSkills(repId, 0) self.linkedSkillIds = {} linkedSkills = ItemGlobals.getLinkedSkills(localAvatar.currentWeaponId) if linkedSkills: for skillId in linkedSkills: realSkillId = WeaponGlobals.getLinkedSkillId(skillId) self.linkedSkillIds[realSkillId] = skillId for excludedSkillId in self.EXCLUDED_SKILLS: for skillId in activeSkills: if excludedSkillId == skillId: activeSkills.remove(skillId) totalActiveSkills.remove(skillId) for spot in self.skillFrames.keys(): if spot not in totalComboSkills: self.skillFrames[spot].hide() count = 0 for skill in totalComboSkills: skillPts = inv.getStackQuantity(skill) if skill in self.localMods: skillPts = self.localMods[skill] showIcon = skill in comboSkills or skillPts > 0 freeLock = False if not Freebooter.getPaidStatus(base.localAvatar.getDoId()): if not WeaponGlobals.canFreeUse(skill): freeLock = True if self.linkedSkillIds.has_key(skill): if self.skillFrames.has_key(skill): self.skillFrames[skill].hide() skill = self.linkedSkillIds[skill] self.createFrame(skill, skillPts, amt, freeLock, showIcon) x = 0.2 + 0.175 * count y = 1.11 self.skillFrames[skill].setPos(x, 0, y) if showIcon and skillPts > 1: self.makeBoostDisplay(skill, skillPts - 1) if not Freebooter.getPaidStatus(base.localAvatar.getDoId()): if not WeaponGlobals.canFreeUse(skill): self.skillFrames[skill].skillButton[ 'command'] = base.localAvatar.guiMgr.showNonPayer self.skillFrames[skill].skillButton['extraArgs'] = [ 'Restricted_Skill_' + WeaponGlobals.getSkillName(skill), 5 ] count += 1 count = 0 for skill in totalActiveSkills: skillPts = inv.getStackQuantity(skill) if skill in self.localMods: skillPts = self.localMods[skill] xMod, yMod = self.ringOffset(count) xMod *= 0.9 yMod *= 0.9 showIcon = skill in activeSkills or skillPts > 0 freeLock = False if not Freebooter.getPaidStatus(base.localAvatar.getDoId()): if not WeaponGlobals.canFreeUse(skill): freeLock = True if self.linkedSkillIds.has_key(skill): if self.skillFrames.has_key(skill): self.skillFrames[skill].hide() skill = self.linkedSkillIds[skill] self.createFrame(skill, skillPts, amt, freeLock, showIcon) x = xMod + 0.53 y = yMod + 0.615 self.skillFrames[skill].setPos(x, 0, y) if showIcon and skillPts > 1: self.makeBoostDisplay(skill, skillPts - 1) if not Freebooter.getPaidStatus(base.localAvatar.getDoId()): if not WeaponGlobals.canFreeUse(skill): self.skillFrames[skill].skillButton[ 'command'] = base.localAvatar.guiMgr.showNonPayer self.skillFrames[skill].skillButton['extraArgs'] = [ 'Restricted_Skill_' + WeaponGlobals.getSkillName(skill), 5 ] ammo = self.getAmmo(skill) if ammo != None and showIcon: self.skillFrames[skill].showQuantity = True self.skillFrames[skill].updateQuantity(ammo) count += 1 count = 0 for skill in totalPassiveSkills: skillPts = inv.getStackQuantity(skill) if skill in self.localMods: skillPts = self.localMods[skill] showIcon = skill in passiveSkills or skillPts > 0 freeLock = False if not Freebooter.getPaidStatus(base.localAvatar.getDoId()): if not WeaponGlobals.canFreeUse(skill): freeLock = True if self.linkedSkillIds.has_key(skill): if self.skillFrames.has_key(skill): self.skillFrames[skill].hide() skill = self.linkedSkillIds[skill] self.createFrame(skill, skillPts, amt, freeLock, showIcon) x = 0.2 + 0.175 * count y = 0.15 self.skillFrames[skill].setPos(x, 0, y) if showIcon and skillPts > 1: self.makeBoostDisplay(skill, skillPts - 1) if not Freebooter.getPaidStatus(base.localAvatar.getDoId()): if not WeaponGlobals.canFreeUse(skill): self.skillFrames[skill].skillButton[ 'command'] = base.localAvatar.guiMgr.showNonPayer self.skillFrames[skill].skillButton['extraArgs'] = [ 'Restricted_Skill_' + WeaponGlobals.getSkillName(skill), 5 ] count += 1 self.dataChanged = False return