def enableStatsOV(self, shipOV): self.snapShot = ShipSnapshot(self, shipOV, self['siegeTeam'], pos=self['snapShotPos']) typeStr = '' if self['siegeTeam']: hp = shipOV.maxHp sp = shipOV.maxSp else: hp = shipOV.Hp sp = shipOV.Sp if hp <= 0: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip stateStr = '\x01Ired\x01%s\x02' % PLocalizer.ShipSunk self['shipColorScale'] = VBase4(1, 0.4, 0.4, 1) self.button['image3_color'] = VBase4( *PiratesGuiGlobals.ButtonColor3[2]) self.button['geom3_color'] = VBase4(0.4, 0.4, 0.4, 0.4) self.button['text3_color'] = VBase4(0.4, 0.4, 0.4, 0.4) self.button['helpText'] = PLocalizer.ShipSunk else: if len(shipOV.crew) >= shipOV.maxCrew: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.BoardShip self.button['helpText'] = PLocalizer.ShipFull stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull, ) self['shipColorScale'] = VBase4(0.4, 0.4, 0.4, 1) elif localAvatar.getActiveShipId( ) and shipOV.doId != localAvatar.getActiveShipId(): self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip self.button['helpText'] = PLocalizer.OtherShipOut stateStr = '\x01Ired\x01%s\x02' % PLocalizer.OtherShipOut self['shipColorScale'] = VBase4(0.4, 0.4, 0.4, 1) elif shipOV.state in 'Off': self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.DeployShip stateStr = PLocalizer.ShipInBottle self.button['helpText'] = PLocalizer.ShipInBottle else: self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.BoardShip stateStr = PLocalizer.ShipAtSea self.button['helpText'] = PLocalizer.ShipAtSea if not Freebooter.getPaidStatus(base.localAvatar.getDoId( )) and shipOV.shipClass not in ShipGlobals.UNPAID_SHIPS: self.button['command'] = base.localAvatar.guiMgr.showNonPayer self.button['extraArgs'] = ['Restricted_ShipFrame_Deploy', 3] self.button['text'] = PLocalizer.Locked subgui = loader.loadModel('models/gui/toplevel_gui') if subgui: self.button['geom'] = subgui.find( '**/pir_t_gui_gen_key_subscriber') self.button['geom_scale'] = 0.15 self.button['geom_color'] = Vec4(0.7, 0.7, 0.7, 1.0) subgui.removeNode() if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr
def enableStats(self, shipName='', shipClass=0, mastInfo=[], hp=0, sp=0, cargo=0, crew=0, time=0): hullInfo = ShipGlobals.getShipConfig(shipClass) self.shipClass = shipClass self.snapShot = ShipSnapshot(self, None, self['siegeTeam'], shipName, shipClass, mastInfo, hp, hullInfo['hp'], sp, hullInfo['sp'], cargo, hullInfo['maxCargo'], crew, hullInfo['maxCrew'], time, pos=self['snapShotPos']) typeStr = self['avatarName'] if self['shipType'] is ShipFrameSelect.STBand: self.button['text'] = PLocalizer.BoardShip else: if self['shipType'] is ShipFrameSelect.STGuild: self.button['text'] = PLocalizer.BoardShip else: if self['shipType'] is ShipFrameSelect.STFriend: self.button['text'] = PLocalizer.BoardShip else: if self['shipType'] is ShipFrameSelect.STPublic: self.button['text'] = PLocalizer.BoardShip else: typeStr = '' stateStr = PLocalizer.ShipAtSea if hp <= 0: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipSunk,) self['shipColorScale'] = VBase4(0.8, 0.3, 0.3, 1) else: if crew >= hullInfo['maxCrew']: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull,) self['shipColorScale'] = VBase4(0.4, 0.4, 0.4, 1) else: self.button['state'] = DGG.NORMAL if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr return
def enableStatsOV(self, shipOV): self.snapShot = ShipSnapshot(self, shipOV, pos=self['snapShotPos']) typeStr = PLocalizer.YourShip if shipOV.state not in ('Off', ): self.button['state'] = DGG.DISABLED else: self.button['state'] = DGG.NORMAL if shipOV.Hp <= 0: self['shipColorScale'] = VBase4(1, 0.40000000000000002, 0.40000000000000002, 1) if self['mode'] == 'repair': self.button['text'] = PLocalizer.InteractRepair if shipOV.Hp == shipOV.maxHp: self.button['state'] = DGG.DISABLED elif self['mode'] == 'sell': self.button['text'] = PLocalizer.InteractSellShips elif self['mode'] == 'overhaul': self.button['text'] = PLocalizer.InteractOverhaul elif self['mode'] == 'upgrade': self.button['text'] = PLocalizer.InteractUpgrade if shipOV.shipClass not in ShipUpgradeGlobals.HULLS_THAT_CAN_UPGRADE: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.InteractNoUpgrade
def enableStats(self, shipName = '', shipClass = 0, mastInfo = [], hp = 0, sp = 0, cargo = 0, crew = 0, time = 0): hullInfo = ShipGlobals.getShipConfig(shipClass) self.shipClass = shipClass self.snapShot = ShipSnapshot(self, None, self['siegeTeam'], shipName, shipClass, mastInfo, hp, hullInfo['hp'], sp, hullInfo['sp'], cargo, hullInfo['maxCargo'], crew, hullInfo['maxCrew'], time, pos = self['snapShotPos']) typeStr = self['avatarName'] if self['shipType'] is ShipFrameSelect.STBand: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STGuild: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STFriend: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STPublic: self.button['text'] = PLocalizer.BoardShip else: typeStr = '' stateStr = PLocalizer.ShipAtSea if hp <= 0: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipSunk,) self['shipColorScale'] = VBase4(0.80000000000000004, 0.29999999999999999, 0.29999999999999999, 1) elif crew >= hullInfo['maxCrew']: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull,) self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) else: self.button['state'] = DGG.NORMAL if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr
def __init__(self, parent, shipOV = None, shipName = '', shipClass = 0, mastInfo = [], hp = 0, maxHp = 0, sp = 0, maxSp = 0, cargo = 0, maxCargo = 0, crew = 0, maxCrew = 0, adventureTime = 0, **kw): optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (0.050000000000000003, 0.64000000000000001, 0.040000000000000001, 0.39000000000000001), None)) self.defineoptions(kw, optiondefs) BorderFrame.__init__(self, parent) self.initialiseoptions(ShipStatFrame) self.showTask = None self.snapShot = ShipSnapshot(self, shipOV, shipName, shipClass, mastInfo, hp, maxHp, sp, maxSp, cargo, maxCargo, crew, maxCrew, adventureTime, pos = (0, 0, 0))
def enableStatsOV(self, shipOV): self.snapShot = ShipSnapshot(self, shipOV, self['siegeTeam'], pos = self['snapShotPos']) typeStr = '' if self['siegeTeam']: hp = shipOV.maxHp sp = shipOV.maxSp else: hp = shipOV.Hp sp = shipOV.Sp if hp <= 0: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip stateStr = '\x01Ired\x01%s\x02' % PLocalizer.ShipSunk self['shipColorScale'] = VBase4(1, 0.40000000000000002, 0.40000000000000002, 1) self.button['image3_color'] = VBase4(*PiratesGuiGlobals.ButtonColor3[2]) self.button['geom3_color'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 0.40000000000000002) self.button['text3_color'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 0.40000000000000002) self.button['helpText'] = PLocalizer.ShipSunk elif len(shipOV.crew) >= shipOV.maxCrew: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.BoardShip self.button['helpText'] = PLocalizer.ShipFull stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull,) self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) elif localAvatar.getActiveShipId() and shipOV.doId != localAvatar.getActiveShipId(): self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip self.button['helpText'] = PLocalizer.OtherShipOut stateStr = '\x01Ired\x01%s\x02' % PLocalizer.OtherShipOut self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) elif shipOV.state in 'Off': self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.DeployShip stateStr = PLocalizer.ShipInBottle self.button['helpText'] = PLocalizer.ShipInBottle else: self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.BoardShip stateStr = PLocalizer.ShipAtSea self.button['helpText'] = PLocalizer.ShipAtSea if not Freebooter.getPaidStatus(base.localAvatar.getDoId()) and shipOV.shipClass not in ShipGlobals.UNPAID_SHIPS: self.button['command'] = base.localAvatar.guiMgr.showNonPayer self.button['extraArgs'] = [ 'Restricted_ShipFrame_Deploy', 3] self.button['text'] = PLocalizer.Locked subgui = loader.loadModel('models/gui/toplevel_gui') if subgui: self.button['geom'] = subgui.find('**/pir_t_gui_gen_key_subscriber') self.button['geom_scale'] = 0.14999999999999999 self.button['geom_color'] = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1.0) subgui.removeNode() if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr
def enableStatsOV(self, shipOV): self.snapShot = ShipSnapshot(self, shipOV, pos=self['snapShotPos']) typeStr = '' if shipOV.Hp <= 0: self.button['state'] = DGG.DISABLED stateStr = '\x01Ired\x01%s\x02' % PLocalizer.ShipSunk self['shipColorScale'] = VBase4(1, 0.4, 0.4, 1) elif shipOV.state in 'Off': self.button['state'] = DGG.NORMAL stateStr = PLocalizer.ShipInBottle else: self.button['state'] = DGG.NORMAL stateStr = PLocalizer.ShipAtSea self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr
class ShipFrameDeploy(ShipFrameSelect): def __init__(self, parent, **kw): optiondefs = (('avatarName', '', None), ) self.defineoptions(kw, optiondefs) ShipFrameSelect.__init__(self, parent, **None) self.initialiseoptions(ShipFrameDeploy) def enableStats(self, shipName='', shipClass=0, mastInfo=[], hp=0, sp=0, cargo=0, crew=0, time=0): hullInfo = ShipGlobals.getShipConfig(shipClass) self.shipClass = shipClass self.snapShot = ShipSnapshot(self, None, self['siegeTeam'], shipName, shipClass, mastInfo, hp, hullInfo['hp'], sp, hullInfo['sp'], cargo, hullInfo['maxCargo'], crew, hullInfo['maxCrew'], time, pos=self['snapShotPos']) typeStr = self['avatarName'] if self['shipType'] is ShipFrameSelect.STBand: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STGuild: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STFriend: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STPublic: self.button['text'] = PLocalizer.BoardShip else: typeStr = '' stateStr = PLocalizer.ShipAtSea if hp <= 0: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipSunk, ) self['shipColorScale'] = VBase4(0.80000000000000004, 0.29999999999999999, 0.29999999999999999, 1) elif crew >= hullInfo['maxCrew']: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull, ) self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) else: self.button['state'] = DGG.NORMAL if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr def setCustomization(self, customHull, customRigging, customPattern, customLogo): ShipFrameSelect.setCustomization(self, customHull, customRigging, customPattern, customLogo) self.snapShot.setCustomization(customHull, customRigging, customPattern, customLogo) def enableStatsOV(self, shipOV): self.snapShot = ShipSnapshot(self, shipOV, self['siegeTeam'], pos=self['snapShotPos']) typeStr = '' if self['siegeTeam']: hp = shipOV.maxHp sp = shipOV.maxSp else: hp = shipOV.Hp sp = shipOV.Sp if hp <= 0: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip stateStr = '\x01Ired\x01%s\x02' % PLocalizer.ShipSunk self['shipColorScale'] = VBase4(1, 0.40000000000000002, 0.40000000000000002, 1) self.button['image3_color'] = VBase4( *PiratesGuiGlobals.ButtonColor3[2]) self.button['geom3_color'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 0.40000000000000002) self.button['text3_color'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 0.40000000000000002) self.button['helpText'] = PLocalizer.ShipSunk elif len(shipOV.crew) >= shipOV.maxCrew: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.BoardShip self.button['helpText'] = PLocalizer.ShipFull stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull, ) self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) elif localAvatar.getActiveShipId( ) and shipOV.doId != localAvatar.getActiveShipId(): self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip self.button['helpText'] = PLocalizer.OtherShipOut stateStr = '\x01Ired\x01%s\x02' % PLocalizer.OtherShipOut self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) elif shipOV.state in 'Off': self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.DeployShip stateStr = PLocalizer.ShipInBottle self.button['helpText'] = PLocalizer.ShipInBottle else: self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.BoardShip stateStr = PLocalizer.ShipAtSea self.button['helpText'] = PLocalizer.ShipAtSea if not Freebooter.getPaidStatus(base.localAvatar.getDoId( )) and shipOV.shipClass not in ShipGlobals.UNPAID_SHIPS: self.button['command'] = base.localAvatar.guiMgr.showNonPayer self.button['extraArgs'] = ['Restricted_ShipFrame_Deploy', 3] self.button['text'] = PLocalizer.Locked subgui = loader.loadModel('models/gui/toplevel_gui') if subgui: self.button['geom'] = subgui.find( '**/pir_t_gui_gen_key_subscriber') self.button['geom_scale'] = 0.14999999999999999 self.button['geom_color'] = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1.0) subgui.removeNode() if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr def addCrewMemberName(self, name): if name not in self.snapShot['crewNames']: self.snapShot['crewNames'] += [name]
class ShipFrameDeploy(ShipFrameSelect): def __init__(self, parent, **kw): optiondefs = (('avatarName', '', None),) self.defineoptions(kw, optiondefs) ShipFrameSelect.__init__(self, parent, **None) self.initialiseoptions(ShipFrameDeploy) def enableStats(self, shipName = '', shipClass = 0, mastInfo = [], hp = 0, sp = 0, cargo = 0, crew = 0, time = 0): hullInfo = ShipGlobals.getShipConfig(shipClass) self.shipClass = shipClass self.snapShot = ShipSnapshot(self, None, self['siegeTeam'], shipName, shipClass, mastInfo, hp, hullInfo['hp'], sp, hullInfo['sp'], cargo, hullInfo['maxCargo'], crew, hullInfo['maxCrew'], time, pos = self['snapShotPos']) typeStr = self['avatarName'] if self['shipType'] is ShipFrameSelect.STBand: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STGuild: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STFriend: self.button['text'] = PLocalizer.BoardShip elif self['shipType'] is ShipFrameSelect.STPublic: self.button['text'] = PLocalizer.BoardShip else: typeStr = '' stateStr = PLocalizer.ShipAtSea if hp <= 0: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipSunk,) self['shipColorScale'] = VBase4(0.80000000000000004, 0.29999999999999999, 0.29999999999999999, 1) elif crew >= hullInfo['maxCrew']: self.button['state'] = DGG.DISABLED stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull,) self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) else: self.button['state'] = DGG.NORMAL if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr def setCustomization(self, customHull, customRigging, customPattern, customLogo): ShipFrameSelect.setCustomization(self, customHull, customRigging, customPattern, customLogo) self.snapShot.setCustomization(customHull, customRigging, customPattern, customLogo) def enableStatsOV(self, shipOV): self.snapShot = ShipSnapshot(self, shipOV, self['siegeTeam'], pos = self['snapShotPos']) typeStr = '' if self['siegeTeam']: hp = shipOV.maxHp sp = shipOV.maxSp else: hp = shipOV.Hp sp = shipOV.Sp if hp <= 0: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip stateStr = '\x01Ired\x01%s\x02' % PLocalizer.ShipSunk self['shipColorScale'] = VBase4(1, 0.40000000000000002, 0.40000000000000002, 1) self.button['image3_color'] = VBase4(*PiratesGuiGlobals.ButtonColor3[2]) self.button['geom3_color'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 0.40000000000000002) self.button['text3_color'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 0.40000000000000002) self.button['helpText'] = PLocalizer.ShipSunk elif len(shipOV.crew) >= shipOV.maxCrew: self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.BoardShip self.button['helpText'] = PLocalizer.ShipFull stateStr = '\x01red\x01%s\x02' % (PLocalizer.ShipFull,) self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) elif localAvatar.getActiveShipId() and shipOV.doId != localAvatar.getActiveShipId(): self.button['state'] = DGG.DISABLED self.button['text'] = PLocalizer.DeployShip self.button['helpText'] = PLocalizer.OtherShipOut stateStr = '\x01Ired\x01%s\x02' % PLocalizer.OtherShipOut self['shipColorScale'] = VBase4(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1) elif shipOV.state in 'Off': self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.DeployShip stateStr = PLocalizer.ShipInBottle self.button['helpText'] = PLocalizer.ShipInBottle else: self.button['state'] = DGG.NORMAL self.button['text'] = PLocalizer.BoardShip stateStr = PLocalizer.ShipAtSea self.button['helpText'] = PLocalizer.ShipAtSea if not Freebooter.getPaidStatus(base.localAvatar.getDoId()) and shipOV.shipClass not in ShipGlobals.UNPAID_SHIPS: self.button['command'] = base.localAvatar.guiMgr.showNonPayer self.button['extraArgs'] = [ 'Restricted_ShipFrame_Deploy', 3] self.button['text'] = PLocalizer.Locked subgui = loader.loadModel('models/gui/toplevel_gui') if subgui: self.button['geom'] = subgui.find('**/pir_t_gui_gen_key_subscriber') self.button['geom_scale'] = 0.14999999999999999 self.button['geom_color'] = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1.0) subgui.removeNode() if typeStr: self.typeLabel['text'] = '\x01smallCaps\x01(%s)\x02' % typeStr def addCrewMemberName(self, name): if name not in self.snapShot['crewNames']: self.snapShot['crewNames'] += [ name]