def announceGenerate(self):
     self._respawnLocation = None
     self._respawnResponseDelayedCall = None
     DistributedSimpleShip.announceGenerate(self)
     self._repairSpotMgr.setShipId(self.doId)
     if self.badInitTeam != None:
         self._verifyTeam(self.badInitTeam)
    def setupLocalStats(self):
        DistributedSimpleShip.setupLocalStats(self)
        if self.customHull:
            tempArmorState = [
                100.0 * self.armor[0] / self.maxArmor[0],
                100.0 * self.armor[1] / self.maxArmor[1],
                100.0 * self.armor[2] / self.maxArmor[2]
            ]
            tempHealthState = 100.0 * self.Hp / self.maxHp
            tempMastState = []
            for mastIndex in range(len(self.maxMastHealth)):
                if self.maxMastHealth[mastIndex] > 0.0:
                    tempMastState.append(100.0 * self.mastHealth[mastIndex] /
                                         self.maxMastHealth[mastIndex])
                    continue
                tempMastState.append(0.0)

            armorUpgrade = ShipUpgradeGlobals.HULL_TYPES[
                self.customHull]['Armor']
            self.maxHp *= armorUpgrade
            self.Hp *= armorUpgrade
            newArmor = []
            for entry in self.maxArmor:
                newArmor.append(entry * armorUpgrade)

            self.maxArmor = newArmor
            newMastHealth = []
            for entry in self.maxMastHealth:
                newMastHealth.append(entry * armorUpgrade)

            self.maxMastHealth = newMastHealth
            self.maxSp *= armorUpgrade
            cargoUpgrade = ShipUpgradeGlobals.HULL_TYPES[
                self.customHull]['Cargo']
            self.setMaxCargo(int(cargoUpgrade * self.maxCargo))
 def setLocation(self, parentId, zoneId):
     DistributedSimpleShip.setLocation(self, parentId, zoneId)
     if self._respawnLocation is not None and self._respawnLocation == (parentId, zoneId):
         self.updateCurrentZone()
         self._respawnLocation = None
         if not self._respawnResponseDelayedCall:
             self._respawnResponseDelayedCall = FrameDelayedCall('PlayerShip-respawnLocation-gridInterestComplete', Functor(base.cr.setAllInterestsCompleteCallback, self._sendRespawnLocationResponse))
 def announceGenerate(self):
     self._respawnLocation = None
     self._respawnResponseDelayedCall = None
     DistributedSimpleShip.announceGenerate(self)
     self._repairSpotMgr.setShipId(self.doId)
     if self.badInitTeam != None:
         self._verifyTeam(self.badInitTeam)
 def announceGenerate(self):
     self.setupAggroCollisions()
     DistributedSimpleShip.announceGenerate(self)
     if self.gameFSM.state in ['Docked', 'Pinned', 'Adrift']:
         self.model.instantDocked()
     else:
         self.model.instantSailing()
예제 #6
0
 def localPirateArrived(self, av):
     DistributedSimpleShip.localPirateArrived(self, av)
     self.enableOnDeckInteractions()
     localAvatar.guiMgr.radarGui.zoomFSM.setLevels([1000])
     mapObj = self.getMinimapObject()
     if mapObj:
         mapObj.setAsLocalAvShip(av.getCrewShipId() == self.doId)
 def handleChildArrive(self, child, zoneId):
     DistributedSimpleShip.handleChildArrive(self, child, zoneId)
     if child.isLocal():
         localAvatar.guiMgr.radarGui.zoomFSM.setLevels([1000])
         mapObj = self.getMinimapObject()
         if mapObj:
             mapObj.setAsLocalAvShip(child.getCrewShipId() == self.doId)
 def d_setLocation(self, parentId, zoneId):
     theStack = StackTrace(start = 1)
     if self.prevLocStack and len(theStack.trace) == len(self.prevLocStack.trace) and map(lambda x: x[1], theStack.trace) == map(lambda x: x[1], self.prevLocStack.trace):
         base.cr.centralLogger.writeClientEvent('bad ship team: %s setLoc' % self.doId)
     else:
         base.cr.centralLogger.writeClientEvent('bad ship team: %s' % self.doId + theStack.compact()[1:len(theStack.compact())])
         self.prevLocStack = theStack
     DistributedSimpleShip.d_setLocation(self, parentId, zoneId)
 def loadStats(self):
     DistributedSimpleShip.loadStats(self)
     speedUpgrade = 1.0
     turningUpgrade = 1.0
     if self.customHull:
         speedUpgrade = ShipUpgradeGlobals.HULL_TYPES[self.customHull]['Speed']
         turningUpgrade = ShipUpgradeGlobals.HULL_TYPES[self.customHull]['Turning']
         self.setSpeedMods(baseMod = None, speedUpgradeMod = speedUpgrade, turnUpgradeMod = turningUpgrade)
 def localPirateArrived(self, av):
     DistributedSimpleShip.localPirateArrived(self, av)
     self.enableOnDeckInteractions()
     localAvatar.guiMgr.radarGui.zoomFSM.setLevels([
         1000])
     mapObj = self.getMinimapObject()
     if mapObj:
         mapObj.setAsLocalAvShip(av.getCrewShipId() == self.doId)
 def handleChildArrive(self, child, zoneId):
     DistributedSimpleShip.handleChildArrive(self, child, zoneId)
     if child.isLocal():
         localAvatar.guiMgr.radarGui.zoomFSM.setLevels([
             1000])
         mapObj = self.getMinimapObject()
         if mapObj:
             mapObj.setAsLocalAvShip(child.getCrewShipId() == self.doId)
 def d_setLocation(self, parentId, zoneId):
     theStack = StackTrace(start = 1)
     if self.prevLocStack and len(theStack.trace) == len(self.prevLocStack.trace) and map(lambda x: x[1], theStack.trace) == map(lambda x: x[1], self.prevLocStack.trace):
         base.cr.centralLogger.writeClientEvent('bad ship team: %s setLoc' % self.doId)
     else:
         base.cr.centralLogger.writeClientEvent('bad ship team: %s' % self.doId + theStack.compact()[1:len(theStack.compact())])
         self.prevLocStack = theStack
     DistributedSimpleShip.d_setLocation(self, parentId, zoneId)
 def generate(self):
     DistributedSimpleShip.generate(self)
     self._repairSpotWoodPile = None
     self._repairSpotWoodPiles = {}
     self._repairSpotHole = None
     self._repairSpotHoleFixed = None
     self._repairSpotHoles = {}
     self._repairSpotIvals = {}
     self._wheelInUse = StateVar(False)
 def setSiegeTeam(self, team):
     different = team != self.getSiegeTeam()
     DistributedSimpleShip.setSiegeTeam(self, team)
     if different:
         self._doSiegeAndPVPTeamColors()
         self._repairSpotMgr.updateSiegeTeam(team)
         minimapObj = self.getMinimapObject()
         if minimapObj:
             minimapObj.setSiegeTeam(team)
 def generate(self):
     DistributedSimpleShip.generate(self)
     self._repairSpotWoodPile = None
     self._repairSpotWoodPiles = { }
     self._repairSpotHole = None
     self._repairSpotHoleFixed = None
     self._repairSpotHoles = { }
     self._repairSpotIvals = { }
     self._wheelInUse = StateVar(False)
 def setSiegeTeam(self, team):
     different = team != self.getSiegeTeam()
     DistributedSimpleShip.setSiegeTeam(self, team)
     if different:
         self._doSiegeAndPVPTeamColors()
         self._repairSpotMgr.updateSiegeTeam(team)
         minimapObj = self.getMinimapObject()
         if minimapObj:
             minimapObj.setSiegeTeam(team)
 def announceGenerate(self):
     self.setupAggroCollisions()
     DistributedSimpleShip.announceGenerate(self)
     if self.gameFSM.state in [
         'Docked',
         'Pinned',
         'Adrift']:
         self.model.instantDocked()
     else:
         self.model.instantSailing()
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
     self._respawnLocation = None
     self.checkAnchor = None
     self.lastAttacked = None
     self.threatLevel = 0
     self.openPort = 0
     self.allowCrewState = True
     self.allowFriendState = True
     self.allowGuildState = False
     self.allowPublicState = False
     self._repairSpotMgr = ShipRepairSpotMgr(self.cr)
     self._team = PiratesGlobals.PLAYER_TEAM
     self.badInitTeam = None
     self.prevLocStack = None
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
     self._respawnLocation = None
     self.checkAnchor = None
     self.lastAttacked = None
     self.threatLevel = 0
     self.openPort = 0
     self.allowCrewState = True
     self.allowFriendState = True
     self.allowGuildState = False
     self.allowPublicState = False
     self._repairSpotMgr = ShipRepairSpotMgr(self.cr)
     self._team = PiratesGlobals.PLAYER_TEAM
     self.badInitTeam = None
     self.prevLocStack = None
    def disable(self):
        self._wheelInUse.destroy()
        if self._respawnResponseDelayedCall:
            self._respawnResponseDelayedCall.destroy()
            self._respawnResponseDelayedCall = None

        if self.checkAnchor:
            self.checkAnchor.remove()
            self.checkAnchor = None

        self._repairSpotMgr.destroy()
        for ival in self._repairSpotIvals.itervalues():
            ival.pause()

        del self._repairSpotIvals
        self.prevLocStack = None
        DistributedSimpleShip.disable(self)
    def disable(self):
        self._wheelInUse.destroy()
        if self._respawnResponseDelayedCall:
            self._respawnResponseDelayedCall.destroy()
            self._respawnResponseDelayedCall = None

        if self.checkAnchor:
            self.checkAnchor.remove()
            self.checkAnchor = None

        self._repairSpotMgr.destroy()
        for ival in self._repairSpotIvals.itervalues():
            ival.pause()

        del self._repairSpotIvals
        self.prevLocStack = None
        DistributedSimpleShip.disable(self)
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
     self._respawnLocation = None
     self.checkAnchor = None
     self.lastAttacked = None
     self.threatLevel = 0
     self.openPort = 0
     self.allowCrewState = True
     self.allowFriendState = True
     self.allowGuildState = False
     self.allowPublicState = False
     self._repairSpotMgr = ShipRepairSpotMgr(self.cr)
     self._team = PiratesGlobals.PLAYER_TEAM
     self.badInitTeam = None
     self.prevLocStack = None
     self.customHull = 0
     self.customRigging = 0
     self.customSailPattern = 0
     self.customSailLogo = 0
     self.customProw = 0
     self.customCannon = 0
     self.boardingPanel = None
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
     self.interactTube = None
 def setArmorStates(self, rear, left, right):
     DistributedSimpleShip.setArmorStates(self, rear, left, right)
     self._repairSpotMgr.updateArmor((rear + left + right) / 3.0)
    def setTeam(self, team):
        if not self._verifyTeam(team):
            return None

        DistributedSimpleShip.setTeam(self, team)
 def loadShipStatusDisplay(self):
     DistributedSimpleShip.loadShipStatusDisplay(self)
     self.shipStatusDisplay.hidePermissionButton()
 def setupLocalStats(self):
     DistributedSimpleShip.setupLocalStats(self)
 def localPirateArrived(self, av):
     DistributedSimpleShip.localPirateArrived(self, av)
     self.enableOnDeckInteractions()
     mapObj = self.getMinimapObject()
     if mapObj:
         mapObj.setAsLocalAvShip(av.getCrewShipId() == self.doId)
    def setTeam(self, team):
        if not self._verifyTeam(team):
            return None

        DistributedSimpleShip.setTeam(self, team)
 def setShipClass(self, shipClass):
     DistributedSimpleShip.setShipClass(self, shipClass)
     self._repairSpotMgr.updateShipClass(self.shipClass)
 def setShipClass(self, shipClass):
     (self.hpModifier, self.cargoModifier, self.expModifier) = ShipGlobals.getModifiedShipStats(self.level)
     DistributedSimpleShip.setShipClass(self, shipClass)
 def recoverFromSunk(self):
     self.lastAttacked = None
     DistributedSimpleShip.recoverFromSunk(self)
 def setWheelInUse(self, wheelInUse):
     DistributedSimpleShip.setWheelInUse(self, wheelInUse)
     self._wheelInUse.set(wheelInUse)
 def setHealthState(self, health):
     DistributedSimpleShip.setHealthState(self, health)
     self._repairSpotMgr.updateHealth(self.healthState)
 def setMastStates(self, mainMast1, mainMast2, mainMast3, aftMast, foreMast):
     DistributedSimpleShip.setMastStates(self, mainMast1, mainMast2, mainMast3, aftMast, foreMast)
     self._repairSpotMgr.updateSpeed(100.0 * self.Sp / self.maxSp)
 def setWheelInUse(self, wheelInUse):
     DistributedSimpleShip.setWheelInUse(self, wheelInUse)
     self._wheelInUse.set(wheelInUse)
 def setArmorStates(self, rear, left, right):
     DistributedSimpleShip.setArmorStates(self, rear, left, right)
     self._repairSpotMgr.updateArmor((rear + left + right) / 3.0)
 def setLocation(self, parentId, zoneId):
     DistributedSimpleShip.setLocation(self, parentId, zoneId)
     if self._respawnLocation is not None and self._respawnLocation == (parentId, zoneId):
         self._respawnLocation = None
         if not self._respawnResponseDelayedCall:
             self._respawnResponseDelayedCall = FrameDelayedCall('PlayerShip-respawnLocation-gridInterestComplete', Functor(base.cr.setAllInterestsCompleteCallback, self._sendRespawnLocationResponse))
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
 def localPirateArrived(self, av):
     DistributedSimpleShip.localPirateArrived(self, av)
     if av.isLocal():
         self.gameFSM.stopCurrentMusic()
         self.gameFSM.startCurrentMusic(SoundGlobals.MUSIC_CUBA_COMBAT)
 def setHealthState(self, health):
     DistributedSimpleShip.setHealthState(self, health)
     self._repairSpotMgr.updateHealth(self.healthState)
 def localPirateLeft(self, av):
     DistributedSimpleShip.localPirateLeft(self, av)
 def recoverFromSunk(self):
     self.lastAttacked = None
     DistributedSimpleShip.recoverFromSunk(self)
 def setShipClass(self, shipClass):
     self.hpModifier, self.cargoModifier, self.expModifier = ShipGlobals.getModifiedShipStats(
         self.level)
     DistributedSimpleShip.setShipClass(self, shipClass)
 def disable(self):
     self.cleanupAggroCollisions()
     DistributedSimpleShip.disable(self)
 def disable(self):
     self.removeBoardingSphere()
     DistributedSimpleShip.disable(self)
 def localAvatarExitShip(self, boardingFlagship = 0):
     DistributedSimpleShip.localAvatarExitShip(self, boardingFlagship)
     self.gameFSM.stopCurrentMusic()
 def setMastStates(self, mainMast1, mainMast2, mainMast3, aftMast,
                   foreMast):
     DistributedSimpleShip.setMastStates(self, mainMast1, mainMast2,
                                         mainMast3, aftMast, foreMast)
     self._repairSpotMgr.updateSpeed(100.0 * self.Sp / self.maxSp)
 def setShipClass(self, shipClass):
     DistributedSimpleShip.setShipClass(self, shipClass)
     self._repairSpotMgr.updateShipClass(self.shipClass)
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
     self.isNpc = 1
     self.hunterLevel = 0
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
     self.isNpc = 1
     self.hunterLevel = 0
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
 def disable(self):
     self.cleanupAggroCollisions()
     DistributedSimpleShip.disable(self)
 def announceGenerate(self):
     DistributedSimpleShip.announceGenerate(self)
     self.setupBoardingSphere(bitmask=PiratesGlobals.WallBitmask
                              | PiratesGlobals.SelectBitmask
                              | PiratesGlobals.RadarShipBitmask)
     self.addDeckInterest()
 def announceGenerate(self):
     DistributedSimpleShip.announceGenerate(self)
     self.setupBoardingSphere(bitmask = PiratesGlobals.WallBitmask | PiratesGlobals.SelectBitmask | PiratesGlobals.RadarShipBitmask)
     self.addDeckInterest()
 def localPirateArrived(self, av):
     DistributedSimpleShip.localPirateArrived(self, av)
     if av.isLocal():
         self.gameFSM.stopCurrentMusic()
         self.gameFSM.startCurrentMusic(SoundGlobals.MUSIC_CUBA_COMBAT)
 def handleChildArrive(self, child, zoneId):
     DistributedSimpleShip.handleChildArrive(self, child, zoneId)
     if child.isLocal():
         self.gameFSM.stopCurrentMusic()
         self.gameFSM.startCurrentMusic(SoundGlobals.MUSIC_CUBA_COMBAT)
 def localPirateLeft(self, av):
     DistributedSimpleShip.localPirateLeft(self, av)
 def __init__(self, cr):
     DistributedSimpleShip.__init__(self, cr)
     self.interactTube = None
 def loadShipStatusDisplay(self):
     DistributedSimpleShip.loadShipStatusDisplay(self)
     self.shipStatusDisplay.hidePermissionButton()