예제 #1
0
 def compareTo(self, object, goalOwner=None):
     if self.__goalType == types.DictType:
         goalLevel = self.__goalData.get(self.LEVEL_IDX, 0)
         if goalLevel > 0:
             if goalLevel > object.getLevel():
                 return 1
             hasIsShip = hasattr(object, '_isShip')
             if game.process == 'ai':
                 if not hasIsShip:
                     return -1
                 goalLocation = self.__goalData.get(self.LOCATION_IDX, None)
                 objectLocation = object.getParentObj()
                 if goalLocation and objectLocation and hasattr(
                         objectLocation, 'getUniqueId'
                 ) and not goalLocation == LocationConstants.LocationIds.ANY_LOCATION and not LocationConstants.isInArea(
                         goalLocation, objectLocation.getUniqueId())[0]:
                     return 1
                 goalFaction = hasIsShip and object._isShip(
                 ) and self.getTargetTypeOnlyOnOcean(
                 ) and self.__goalData.get(self.FACTION_IDX, None)
                 if goalFaction:
                     isEnemy = False
                     if goalOwner:
                         isEnemy = TeamUtils.friendOrFoe(
                             goalOwner, object) == PiratesGlobals.ENEMY
                     objFaction = object.getFaction()
                     if goalFaction != None and objFaction != None and goalFaction.getFaction(
                     ) != objFaction.getFaction() or not isEnemy:
                         return 1
                 goalHull = self.__goalData.get(self.HULL_IDX, None)
                 if goalHull != None:
                     shipClassList = QuestConstants.getShipList(goalHull)
                     if shipClassList == None:
                         shipClassList = [goalHull]
                     if object.shipClass not in shipClassList:
                         return 1
                 goalFlagship = self.__goalData.get(self.FLAGSHIP_IDX,
                                                    False)
                 if goalFlagship != object.isFlagship:
                     return 1
                 if object.getTeam() == PiratesGlobals.PLAYER_TEAM:
                     return 1
                 return 0
         elif self.getTargetTypeOnlyOnOcean() or self.__goalData.get(
                 self.TYPE_IDX) == AvatarTypes.AnyAvatar:
             if goalOwner:
                 if TeamUtils.friendOrFoe(goalOwner,
                                          object) == PiratesGlobals.ENEMY:
                     return 0
             elif object.getAvatarType().isA(
                     self.__goalData.get(self.TYPE_IDX)):
                 return 0
     else:
         if self.__goalData and object.getUniqueId() in self.__goalData:
             return 0
     return 1
예제 #2
0
 def __shipHit(self, shipId, hitObject, entry, skillId, ammoSkillId):
     ship = self.cr.doId2do.get(shipId)
     if not ship or ship.queryGameState() == 'Inactive':
         return
     if self.localAvatarUsingWeapon:
         cannonCode = 0
         cannonCodeStr = hitObject.getNetTag('cannonCode')
         if cannonCodeStr:
             cannonCode = int(cannonCodeStr)
         hullCode = 0
         hullCodeStr = hitObject.getNetTag('hullCode')
         if hullCodeStr:
             hullCode = int(hullCodeStr)
         sailCode = 0
         sailCodeStr = hitObject.getNetTag('sailCode')
         if sailCodeStr:
             sailCode = int(sailCodeStr)
         codes = [cannonCode, hullCode, sailCode]
         pos = entry.getSurfacePoint(ship)
         normal = entry.getSurfaceNormal(render)
         timestamp32 = globalClockDelta.getFrameNetworkTime(bits=32)
         attackerId = 0
         attackerStr = entry.getFromNodePath().getNetTag('attackerId')
         if attackerStr:
             attackerId = int(attackerStr)
         attacker = self.cr.doId2do.get(attackerId)
         if not attacker:
             return
         if not TeamUtils.damageAllowed(attacker, ship):
             if hasattr(attacker, 'getName') and hasattr(ship, 'getName'):
                 if TeamUtils.friendOrFoe(
                         attacker, ship) == PiratesGlobals.PVP_FRIEND:
                     localAvatar.guiMgr.createWarning(
                         PLocalizer.TeamFireWarning,
                         PiratesGuiGlobals.TextFG6)
                 else:
                     localAvatar.guiMgr.createWarning(
                         PLocalizer.FriendlyFireWarning,
                         PiratesGuiGlobals.TextFG6)
             attacker.battleRandom.advanceAttackSeed()
             return
         areaList = self.getAreaList(skillId, ammoSkillId, ship, pos,
                                     attackerId)
         result = self.cr.battleMgr.doAttack(attacker, skillId, ammoSkillId,
                                             shipId, areaList, pos)
         self.sendSuggestProjectileSkillResult(
             skillId, ammoSkillId, result, shipId, areaList,
             [pos[0], pos[1], pos[2]], [normal[0], normal[1], normal[2]],
             codes, timestamp32)
         for doId in [shipId] + areaList:
             target = self.cr.doId2do.get(doId)
             attackerEffects, targetEffects, itemEffects = self.cr.battleMgr.getModifiedSkillEffects(
                 attacker, target, skillId, ammoSkillId)
             target.projectileWeaponHit(skillId, ammoSkillId, result,
                                        targetEffects, pos, normal, codes,
                                        attacker, itemEffects)
예제 #3
0
    def makeRadarNode(self, obj, objType, objDoId=None, teamId=None):
        model = None
        outOfRangeNode = None
        camH = camera.getH(render)
        if objType != RADAR_OBJ_TYPE_QUEST and obj.getCollideMask(
        ).hasBitsInCommon(PiratesGlobals.RadarShipBitmask):
            modelDict = self.modelDict[RADAR_OBJ_TYPE_SHIP]
        else:
            modelDict = self.modelDict[objType]
        model = modelDict[0].copyTo(self.objTop)
        if modelDict[1]:
            outOfRangeNode = modelDict[1].copyTo(self.objTop)

        if objType == RADAR_OBJ_TYPE_DEFAULT:
            status = PiratesGlobals.NEUTRAL
            if teamId:
                status = TeamUtils.teamStatus(localAvatar.getTeam(), teamId)
            elif not objDoId:
                pass
            avId = obj.getNetTag('avId')
            if avId:
                avId = int(avId)
                av = base.cr.doId2do.get(avId)
                if av:
                    if DistributedBandMember.areSameCrew(
                            localAvatar.doId, avId):
                        status = PiratesGlobals.CREW
                    else:
                        status = TeamUtils.friendOrFoe(localAvatar, av)
                else:
                    return (model, outOfRangeNode)

            if status == PiratesGlobals.ENEMY or status == PiratesGlobals.PVP_ENEMY:
                model.setColorScale(MinimapGlobals.MAPCOLOR_ENEMY)
            elif status == PiratesGlobals.FRIEND or status == PiratesGlobals.PVP_FRIEND:
                model.setColorScale(MinimapGlobals.MAPCOLOR_FRIEND)
            elif status == PiratesGlobals.CREW:
                model.setColorScale(MinimapGlobals.MAPCOLOR_FRIEND)
            elif status == PiratesGlobals.NEUTRAL:
                model.setColorScale(MinimapGlobals.MAPCOLOR_NPC)
            else:
                model.setColorScale(MinimapGlobals.MAPCOLOR_NPC)
        elif objType == RADAR_OBJ_TYPE_QUEST:
            model.setColorScale(MinimapGlobals.MAPCOLOR_QUEST)
            if outOfRangeNode:
                outOfRangeNode.setColorScale(MinimapGlobals.MAPCOLOR_QUEST)
                outOfRangeNode.setScale(0.75)

        return (model, outOfRangeNode)
    def makeRadarNode(self, obj, objType, objDoId = None, teamId = None):
        model = None
        outOfRangeNode = None
        camH = camera.getH(render)
        if objType != RADAR_OBJ_TYPE_QUEST and obj.getCollideMask().hasBitsInCommon(PiratesGlobals.RadarShipBitmask):
            modelDict = self.modelDict[RADAR_OBJ_TYPE_SHIP]
        else:
            modelDict = self.modelDict[objType]
        model = modelDict[0].copyTo(self.objTop)
        if modelDict[1]:
            outOfRangeNode = modelDict[1].copyTo(self.objTop)

        if objType == RADAR_OBJ_TYPE_DEFAULT:
            status = PiratesGlobals.NEUTRAL
            if teamId:
                status = TeamUtils.teamStatus(localAvatar.getTeam(), teamId)
            elif not objDoId:
                pass
            avId = obj.getNetTag('avId')
            if avId:
                avId = int(avId)
                av = base.cr.doId2do.get(avId)
                if av:
                    if DistributedBandMember.areSameCrew(localAvatar.doId, avId):
                        status = PiratesGlobals.CREW
                    else:
                        status = TeamUtils.friendOrFoe(localAvatar, av)
                else:
                    return (model, outOfRangeNode)

            if status == PiratesGlobals.ENEMY or status == PiratesGlobals.PVP_ENEMY:
                model.setColorScale(MinimapGlobals.MAPCOLOR_ENEMY)
            elif status == PiratesGlobals.FRIEND or status == PiratesGlobals.PVP_FRIEND:
                model.setColorScale(MinimapGlobals.MAPCOLOR_FRIEND)
            elif status == PiratesGlobals.CREW:
                model.setColorScale(MinimapGlobals.MAPCOLOR_FRIEND)
            elif status == PiratesGlobals.NEUTRAL:
                model.setColorScale(MinimapGlobals.MAPCOLOR_NPC)
            else:
                model.setColorScale(MinimapGlobals.MAPCOLOR_NPC)
        elif objType == RADAR_OBJ_TYPE_QUEST:
            model.setColorScale(MinimapGlobals.MAPCOLOR_QUEST)
            if outOfRangeNode:
                outOfRangeNode.setColorScale(MinimapGlobals.MAPCOLOR_QUEST)
                outOfRangeNode.setScale(0.75)


        return (model, outOfRangeNode)
 def compareTo(self, object, goalOwner = None):
     if self._QuestGoal__goalType == types.DictType:
         goalLevel = self._QuestGoal__goalData.get(self.LEVEL_IDX, 0)
         if goalLevel > 0 and goalLevel > object.getLevel():
             return 1
         
         hasIsShip = hasattr(object, '_isShip')
         if game.process == 'ai' and not hasIsShip:
             return -1
         
         goalLocation = self._QuestGoal__goalData.get(self.LOCATION_IDX, None)
         objectLocation = object.getParentObj()
         if goalLocation and objectLocation and hasattr(objectLocation, 'getUniqueId') and not (goalLocation == LocationConstants.LocationIds.ANY_LOCATION) and not LocationConstants.isInArea(goalLocation, objectLocation.getUniqueId())[0]:
             return 1
         
         if hasIsShip and object._isShip():
             if self.getTargetTypeOnlyOnOcean():
                 goalFaction = self._QuestGoal__goalData.get(self.FACTION_IDX, None)
                 if goalFaction:
                     isEnemy = False
                     if goalOwner:
                         isEnemy = TeamUtils.friendOrFoe(goalOwner, object) == PiratesGlobals.ENEMY
                     
                     objFaction = object.getFaction()
                     if goalFaction != None and objFaction != None or goalFaction.getFaction() != objFaction.getFaction() or not isEnemy:
                         return 1
                     
                 
                 goalHull = self._QuestGoal__goalData.get(self.HULL_IDX, None)
                 if goalHull != None:
                     shipClassList = QuestConstants.getShipList(goalHull)
                     if shipClassList == None:
                         shipClassList = [
                             goalHull]
                     
                     if object.shipClass not in shipClassList:
                         return 1
                     
                 
                 goalFlagship = self._QuestGoal__goalData.get(self.FLAGSHIP_IDX, False)
                 if goalFlagship != object.isFlagship:
                     return 1
                 
                 if object.getTeam() == PiratesGlobals.PLAYER_TEAM:
                     return 1
                 
                 return 0
             
         elif not self.getTargetTypeOnlyOnOcean():
             if self._QuestGoal__goalData.get(self.TYPE_IDX) == AvatarTypes.AnyAvatar and goalOwner:
                 if TeamUtils.friendOrFoe(goalOwner, object) == PiratesGlobals.ENEMY:
                     return 0
                 
             elif object.getAvatarType().isA(self._QuestGoal__goalData.get(self.TYPE_IDX)):
                 return 0
             
         
     elif self._QuestGoal__goalData and object.getUniqueId() in self._QuestGoal__goalData:
         return 0
     
     return 1
예제 #6
0
 def __shippartHit(self, hitObject, entry, skillId, ammoSkillId):
     shipId = hitObject.getNetTag('shipId')
     if shipId:
         shipId = int(shipId)
         ship = base.cr.doId2do.get(shipId)
         if ship:
             if ship.queryGameState() in ('FadeOut', 'Sinking', 'Inactive'):
                 return
         else:
             return
         fromNodePath = entry.getFromNodePath()
         attackerShipId = fromNodePath.getNetTag('shipId')
         if attackerShipId:
             attackerShipId = int(attackerShipId)
             if attackerShipId == shipId:
                 return
         attackerId = 0
         attackerStr = entry.getFromNodePath().getNetTag('attackerId')
         if attackerStr:
             attackerId = int(attackerStr)
             attacker = self.cr.doId2do.get(attackerId)
             if not attacker:
                 return
         else:
             return
         cannonCode = 0
         cannonCodeStr = hitObject.getNetTag('cannonCode')
         if cannonCodeStr:
             cannonCode = int(cannonCodeStr)
         hullCode = 0
         hullCodeStr = hitObject.getNetTag('hullCode')
         if hullCodeStr:
             hullCode = int(hullCodeStr)
         sailCode = 0
         sailCodeStr = hitObject.getNetTag('sailCode')
         if sailCodeStr:
             sailCode = int(sailCodeStr)
         codes = [cannonCode, hullCode, sailCode]
         pos = entry.getSurfacePoint(ship)
         normal = entry.getSurfaceNormal(render)
         timestamp32 = globalClockDelta.getFrameNetworkTime(bits=32)
         if not TeamUtils.damageAllowed(attacker, ship):
             if TeamUtils.friendOrFoe(attacker,
                                      ship) == PiratesGlobals.PVP_FRIEND:
                 localAvatar.guiMgr.createWarning(
                     PLocalizer.TeamFireWarning, PiratesGuiGlobals.TextFG6)
             else:
                 localAvatar.guiMgr.createWarning(
                     PLocalizer.FriendlyFireWarning,
                     PiratesGuiGlobals.TextFG6)
             return
         areaList = self.getAreaList(skillId, ammoSkillId, ship, pos,
                                     attackerId)
         result = self.cr.battleMgr.doAttack(attacker, skillId, ammoSkillId,
                                             shipId, areaList, pos)
         self.sendSuggestProjectileSkillResult(
             skillId, ammoSkillId, result, shipId, areaList,
             [pos[0], pos[1], pos[2]], [normal[0], normal[1], normal[2]],
             codes, timestamp32)
         effectList = [shipId] + areaList
         propId = hitObject.getNetTag('propId')
         if propId:
             propId = int(propId)
             effectList += [propId]
             prop = self.cr.doId2do.get(propId)
             if prop:
                 result = self.cr.battleMgr.doAttack(
                     attacker, skillId, ammoSkillId, propId, [], pos)
                 self.sendSuggestProjectileSkillResult(
                     skillId, ammoSkillId, result, propId, [],
                     [pos[0], pos[1], pos[2]],
                     [normal[0], normal[1], normal[2]], codes, timestamp32)
         for doId in effectList:
             target = self.cr.doId2do.get(doId)
             if target:
                 attackerEffects, targetEffects, itemEffects = self.cr.battleMgr.getModifiedSkillEffects(
                     attacker, target, skillId, ammoSkillId)
                 target.projectileWeaponHit(skillId, ammoSkillId, result,
                                            targetEffects, pos, normal,
                                            codes, attacker, itemEffects)
예제 #7
0
 def simpleShipHit(self, hitObject, entry, skillId, ammoSkillId):
     timestamp32 = globalClockDelta.getFrameNetworkTime(bits=32)
     ship = hitObject.getNetPythonTag('ship')
     if not ship:
         self.notify.warning('ignoring attack on destroyed ship')
         return
     attackerShipId = entry.getFromNodePath().getNetTag('shipId')
     hullCode = hitObject.getNetTag('Hull Code')
     if hullCode:
         hullCode = int(hullCode)
     else:
         hullCode = 255
     mastCode = hitObject.getNetTag('Mast Code')
     hitSail = hitObject.getNetTag('Sail')
     if not hitSail:
         hitSail = 0
     else:
         hitSail = 1
     if mastCode:
         mastCode = int(mastCode)
     else:
         mastCode = 255
     pos = entry.getSurfacePoint(ship)
     normal = entry.getSurfaceNormal(render)
     attackerId = 0
     attackerStr = entry.getFromNodePath().getNetTag('attackerId')
     if attackerStr:
         attackerId = int(attackerStr)
     attacker = self.cr.doId2do.get(attackerId)
     if not attacker:
         return
     if attackerShipId:
         if int(attackerShipId) == ship.doId:
             return
     if not TeamUtils.damageAllowed(attacker, ship):
         if TeamUtils.friendOrFoe(attacker,
                                  ship) == PiratesGlobals.PVP_FRIEND:
             localAvatar.guiMgr.createWarning(PLocalizer.TeamFireWarning,
                                              PiratesGuiGlobals.TextFG6)
         else:
             localAvatar.guiMgr.createWarning(
                 PLocalizer.FriendlyFireWarning, PiratesGuiGlobals.TextFG6)
         attacker.battleRandom.advanceAttackSeed()
         return
     if ship:
         ship.validateMastCode(mastCode)
     result = self.cr.battleMgr.doAttack(attacker, skillId, ammoSkillId,
                                         ship.doId, [], pos)
     ammo = entry.getFromNodePath().getNetPythonTag('ammo')
     if ammo:
         if ammo.hasTag('newAmmoId'):
             ammoSkillId = int(ammo.getTag('newAmmoId'))
             pos = (0, 0, 0)
     self.sendSuggestProjectileSkillResult(
         skillId, ammoSkillId, result, ship.doId, [],
         [pos[0], pos[1], pos[2]], [normal[0], normal[1], normal[2]],
         [hullCode, mastCode, hitSail], timestamp32)
     attackerEffects, targetEffects, itemEffects = self.cr.battleMgr.getModifiedSkillEffects(
         attacker, ship, skillId, ammoSkillId)
     ship.projectileWeaponHit(skillId, ammoSkillId, result, targetEffects,
                              pos, normal, (hullCode, mastCode, hitSail),
                              attacker, itemEffects)
     return True
    def _WeaponBase__propHit(self, shipId, propId, hitObject, entry, skillId, ammoSkillId):
        cannonCode = 0
        cannonCodeStr = hitObject.getNetTag("cannonCode")
        if cannonCodeStr:
            cannonCode = int(cannonCodeStr)

        hullCode = 0
        hullCodeStr = hitObject.getNetTag("hullCode")
        if hullCodeStr:
            hullCode = int(hullCodeStr)

        sailCode = 0
        sailCodeStr = hitObject.getNetTag("sailCode")
        if sailCodeStr:
            sailCode = int(sailCodeStr)

        codes = [cannonCode, hullCode, sailCode]
        ship = self.cr.doId2do.get(shipId)
        prop = self.cr.doId2do.get(propId)
        if not ship or ship.queryGameState() == "Inactive":
            return None

        if not prop:
            return None

        if self.localAvatarUsingWeapon:
            pos = entry.getSurfacePoint(ship)
            normal = entry.getSurfaceNormal(render)
            timestamp32 = globalClockDelta.getFrameNetworkTime(bits=32)
            attackerId = 0
            attackerStr = entry.getFromNodePath().getNetTag("attackerId")
            if attackerStr:
                attackerId = int(attackerStr)

            attacker = self.cr.doId2do.get(attackerId)
            if not attacker:
                return None

            if not TeamUtils.damageAllowed(attacker, prop) and not TeamUtils.damageAllowed(attacker, ship):
                if hasattr(attacker, "getName") and hasattr(prop, "getName"):
                    if TeamUtils.friendOrFoe(attacker, ship) == PiratesGlobals.PVP_FRIEND:
                        localAvatar.guiMgr.createWarning(PLocalizer.TeamFireWarning, PiratesGuiGlobals.TextFG6)
                    else:
                        localAvatar.guiMgr.createWarning(PLocalizer.FriendlyFireWarning, PiratesGuiGlobals.TextFG6)

                attacker.battleRandom.advanceAttackSeed()
                return None

            areaList = self.getAreaList(skillId, ammoSkillId, ship, pos, attackerId)
            result = self.cr.battleMgr.doAttack(attacker, skillId, ammoSkillId, propId, areaList, pos)
            self.sendSuggestProjectileSkillResult(
                skillId,
                ammoSkillId,
                result,
                propId,
                areaList,
                [pos[0], pos[1], pos[2]],
                [normal[0], normal[1], normal[2]],
                codes,
                timestamp32,
            )
            for doId in [propId] + areaList:
                target = self.cr.doId2do.get(doId)
                (attackerEffects, targetEffects, itemEffects) = self.cr.battleMgr.getModifiedSkillEffects(
                    attacker, target, skillId, ammoSkillId
                )
                target.projectileWeaponHit(
                    skillId, ammoSkillId, result, targetEffects, pos, normal, codes, attacker, itemEffects
                )
    def _WeaponBase__shippartHit(self, hitObject, entry, skillId, ammoSkillId):
        shipId = hitObject.getNetTag("shipId")
        if shipId:
            shipId = int(shipId)
            ship = base.cr.doId2do.get(shipId)
            if ship:
                if ship.queryGameState() in ("FadeOut", "Sinking", "Inactive"):
                    return None

            else:
                return None
            fromNodePath = entry.getFromNodePath()
            attackerShipId = fromNodePath.getNetTag("shipId")
            if attackerShipId:
                attackerShipId = int(attackerShipId)
                if attackerShipId == shipId:
                    return None

            attackerId = 0
            attackerStr = entry.getFromNodePath().getNetTag("attackerId")
            if attackerStr:
                attackerId = int(attackerStr)
                attacker = self.cr.doId2do.get(attackerId)
                if not attacker:
                    return None

            else:
                return None
            cannonCode = 0
            cannonCodeStr = hitObject.getNetTag("cannonCode")
            if cannonCodeStr:
                cannonCode = int(cannonCodeStr)

            hullCode = 0
            hullCodeStr = hitObject.getNetTag("hullCode")
            if hullCodeStr:
                hullCode = int(hullCodeStr)

            sailCode = 0
            sailCodeStr = hitObject.getNetTag("sailCode")
            if sailCodeStr:
                sailCode = int(sailCodeStr)

            codes = [cannonCode, hullCode, sailCode]
            pos = entry.getSurfacePoint(ship)
            normal = entry.getSurfaceNormal(render)
            timestamp32 = globalClockDelta.getFrameNetworkTime(bits=32)
            if not TeamUtils.damageAllowed(attacker, ship):
                if TeamUtils.friendOrFoe(attacker, ship) == PiratesGlobals.PVP_FRIEND:
                    localAvatar.guiMgr.createWarning(PLocalizer.TeamFireWarning, PiratesGuiGlobals.TextFG6)
                else:
                    localAvatar.guiMgr.createWarning(PLocalizer.FriendlyFireWarning, PiratesGuiGlobals.TextFG6)
                return None

            areaList = self.getAreaList(skillId, ammoSkillId, ship, pos, attackerId)
            result = self.cr.battleMgr.doAttack(attacker, skillId, ammoSkillId, shipId, areaList, pos)
            self.sendSuggestProjectileSkillResult(
                skillId,
                ammoSkillId,
                result,
                shipId,
                areaList,
                [pos[0], pos[1], pos[2]],
                [normal[0], normal[1], normal[2]],
                codes,
                timestamp32,
            )
            effectList = [shipId] + areaList
            propId = hitObject.getNetTag("propId")
            if propId:
                propId = int(propId)
                effectList += [propId]
                prop = self.cr.doId2do.get(propId)
                if prop:
                    result = self.cr.battleMgr.doAttack(attacker, skillId, ammoSkillId, propId, [], pos)
                    self.sendSuggestProjectileSkillResult(
                        skillId,
                        ammoSkillId,
                        result,
                        propId,
                        [],
                        [pos[0], pos[1], pos[2]],
                        [normal[0], normal[1], normal[2]],
                        codes,
                        timestamp32,
                    )

            for doId in effectList:
                target = self.cr.doId2do.get(doId)
                if target:
                    (attackerEffects, targetEffects, itemEffects) = self.cr.battleMgr.getModifiedSkillEffects(
                        attacker, target, skillId, ammoSkillId
                    )
                    target.projectileWeaponHit(
                        skillId, ammoSkillId, result, targetEffects, pos, normal, codes, attacker, itemEffects
                    )
                    continue
    def simpleShipHit(self, hitObject, entry, skillId, ammoSkillId):
        timestamp32 = globalClockDelta.getFrameNetworkTime(bits=32)
        ship = hitObject.getNetPythonTag("ship")
        if not ship:
            self.notify.warning("ignoring attack on destroyed ship")
            return None

        attackerShipId = entry.getFromNodePath().getNetTag("shipId")
        hullCode = hitObject.getNetTag("Hull Code")
        if hullCode:
            hullCode = int(hullCode)
        else:
            hullCode = 255
        mastCode = hitObject.getNetTag("Mast Code")
        hitSail = hitObject.getNetTag("Sail")
        if not hitSail:
            hitSail = 0
        else:
            hitSail = 1
        if mastCode:
            mastCode = int(mastCode)
        else:
            mastCode = 255
        pos = entry.getSurfacePoint(ship)
        normal = entry.getSurfaceNormal(render)
        attackerId = 0
        attackerStr = entry.getFromNodePath().getNetTag("attackerId")
        if attackerStr:
            attackerId = int(attackerStr)

        attacker = self.cr.doId2do.get(attackerId)
        if not attacker:
            return None

        if attackerShipId:
            if int(attackerShipId) == ship.doId:
                return None

        if not TeamUtils.damageAllowed(attacker, ship):
            if TeamUtils.friendOrFoe(attacker, ship) == PiratesGlobals.PVP_FRIEND:
                localAvatar.guiMgr.createWarning(PLocalizer.TeamFireWarning, PiratesGuiGlobals.TextFG6)
            else:
                localAvatar.guiMgr.createWarning(PLocalizer.FriendlyFireWarning, PiratesGuiGlobals.TextFG6)
            attacker.battleRandom.advanceAttackSeed()
            return None

        if ship:
            ship.validateMastCode(mastCode)

        result = self.cr.battleMgr.doAttack(attacker, skillId, ammoSkillId, ship.doId, [], pos)
        ammo = entry.getFromNodePath().getNetPythonTag("ammo")
        if ammo:
            if ammo.hasTag("newAmmoId"):
                ammoSkillId = int(ammo.getTag("newAmmoId"))
                pos = (0, 0, 0)

        self.sendSuggestProjectileSkillResult(
            skillId,
            ammoSkillId,
            result,
            ship.doId,
            [],
            [pos[0], pos[1], pos[2]],
            [normal[0], normal[1], normal[2]],
            [hullCode, mastCode, hitSail],
            timestamp32,
        )
        (attackerEffects, targetEffects, itemEffects) = self.cr.battleMgr.getModifiedSkillEffects(
            attacker, ship, skillId, ammoSkillId
        )
        ship.projectileWeaponHit(
            skillId,
            ammoSkillId,
            result,
            targetEffects,
            pos,
            normal,
            (hullCode, mastCode, hitSail),
            attacker,
            itemEffects,
        )
        return True