def calculateLauncher(self, targetID, velocityModifier=1.0, radiusModifier=1.0):
     import blue, foo
     from common.eve.state import getCachedItem
     target = getCachedItem(targetID)
     targetBall = target.ball
     targetItem = target.slimItem
     
     ballpark = sm.services["michelle"].GetBallpark()        
     now = blue.os.GetTime()
        
     distance = max(ballpark.DistanceBetween(self.source.id, targetID), 0.00001)
             
     targetVelocity = max(
         targetBall.GetVectorDotAt(now).Length() * velocityModifier,
         0.00001
     )
     targetRadius = target.radius * radiusModifier
     
     estimatedDamage = self.baseDamage * min(
         min(
             targetRadius / self.explosionRadius, 1
         ), (
             (self.explosionVelocity / self.explosionRadius * targetRadius / targetVelocity) ** 
             (math.log(self.damageReductionFactor) / math.log(5.5))
         )
     )
     
     if distance > self.maxRange:                
         return 0
     else:                    
         return estimatedDamage / self.baseDamage
def getPriority(id):
    global priorities, priorityBoosts

    if not id:
        return -1

    ci = getCachedItem(id)

    if not ci.slimItem:
        return -1

    charID = getattr(ci.slimItem, "charID", None)
    if charID:
        priority = priorities.get("char:%d" % (charID, ), 0)
    else:
        priority = 0

    if priority == 0:
        priority = priorities.get("type:%d" % (ci.slimItem.typeID, ), 0)
        if priority == 0:
            priority = priorities.get("group:%d" % (ci.slimItem.groupID, ), 0)

    if priority == 0:
        flag = ci.flag

        if ((flag == "StandingGood") or (flag == "StandingHigh")
                or (flag == "SameGang") or (flag == "SameFleet")
                or (flag == "SameAlliance") or (flag == "SameCorp")):
            priority = -1

    priority += priorityBoosts.get(id, 0)

    return priority
예제 #3
0
    def calculateLauncher(self,
                          targetID,
                          velocityModifier=1.0,
                          radiusModifier=1.0):
        import blue, foo
        from common.eve.state import getCachedItem
        target = getCachedItem(targetID)
        targetBall = target.ball
        targetItem = target.slimItem

        ballpark = sm.services["michelle"].GetBallpark()
        now = blue.os.GetTime()

        distance = max(ballpark.DistanceBetween(self.source.id, targetID),
                       0.00001)

        targetVelocity = max(
            targetBall.GetVectorDotAt(now).Length() * velocityModifier,
            0.00001)
        targetRadius = target.radius * radiusModifier

        estimatedDamage = self.baseDamage * min(
            min(targetRadius / self.explosionRadius, 1),
            ((self.explosionVelocity / self.explosionRadius * targetRadius /
              targetVelocity)
             **(math.log(self.damageReductionFactor) / math.log(5.5))))

        if distance > self.maxRange:
            return 0
        else:
            return estimatedDamage / self.baseDamage
 def calculateECM(self, targetID, velocityModifier=1.0, radiusModifier=1.0):
     import blue, foo
     from common.eve.state import getCachedItem
     target = getCachedItem(targetID)
     
     ballpark = sm.services["michelle"].GetBallpark()        
     
     distance = max(ballpark.DistanceBetween(eve.session.shipid, targetID), 0.00001)
     distanceFactor = max(0.0, distance - self.optimal) / self.falloff
     
     result = 0.5 ** (distanceFactor ** 2)
     
     return result    
예제 #5
0
    def calculateECM(self, targetID, velocityModifier=1.0, radiusModifier=1.0):
        import blue, foo
        from common.eve.state import getCachedItem
        target = getCachedItem(targetID)

        ballpark = sm.services["michelle"].GetBallpark()

        distance = max(ballpark.DistanceBetween(eve.session.shipid, targetID),
                       0.00001)
        distanceFactor = max(0.0, distance - self.optimal) / self.falloff

        result = 0.5**(distanceFactor**2)

        return result
예제 #6
0
    def _DoBallsAdded(self, lst):
        for (ball, slimItem) in lst:
            if not slimItem:
                continue
            if not slimItem.categoryID in TargetableCategories:
                continue
            if slimItem.itemID == eve.session.shipid:
                continue

            bi = getCachedItem(slimItem.itemID, ball, slimItem)
            self.__balls[slimItem.itemID] = bi

            if self.isEligible(bi):
                self.__eligibleBalls.add(bi)
예제 #7
0
 def _DoBallsAdded(self, lst):
     for (ball, slimItem) in lst:
         if not slimItem:
             continue
         if not slimItem.categoryID in TargetableCategories:
             continue
         if slimItem.itemID == eve.session.shipid:
             continue
         
         bi = getCachedItem(slimItem.itemID, ball, slimItem)
         self.__balls[slimItem.itemID] = bi
         
         if self.isEligible(bi):
             self.__eligibleBalls.add(bi)
예제 #8
0
 def __init__(self, droneID):
     self.id = droneID
     ci = getCachedItem(droneID)
     
     self.ci = ci
     self.slimItem = ci.slimItem
     self.target = None
     self.actionTimestamp = self.timestamp = 0
     self.shield = self.armor = self.structure = 1.0
     self.state = None
     
     if ci.slimItem:        
         attributes = getTypeAttributes(ci.slimItem.typeID, obj=ci.ball)
         self.isSentry = float(attributes.get("entityCruiseSpeed", 0.0)) <= 0.0
     else:
         self.isSentry = False
예제 #9
0
    def calculateTurret(self,
                        targetID,
                        velocityModifier=1.0,
                        radiusModifier=1.0):
        import blue, foo
        from common.eve.state import getCachedItem
        target = getCachedItem(targetID)

        ballpark = sm.services["michelle"].GetBallpark()
        now = blue.os.GetTime()

        shipVelocity = self.source.ball.GetVectorDotAt(now)
        shipPos = foo.Vector3(self.source.ball.x, self.source.ball.y,
                              self.source.ball.z)

        distance = max(ballpark.DistanceBetween(eve.session.shipid, targetID),
                       0.00001)
        distanceFactor = max(0.0, distance - self.optimal) / self.falloff

        targetBall = target.ball
        targetItem = target.slimItem
        targetVelocity = targetBall.GetVectorDotAt(now) * velocityModifier
        targetPos = foo.Vector3(targetBall.x, targetBall.y, targetBall.z)
        targetRadius = target.radius * radiusModifier

        combinedVelocity = foo.Vector3(targetVelocity.x - shipVelocity.x,
                                       targetVelocity.y - shipVelocity.y,
                                       targetVelocity.z - shipVelocity.z)

        radialVector = targetPos - shipPos
        if ((radialVector.x, radialVector.y, radialVector.z) !=
            (0.0, 0.0, 0.0)):
            radialVector = radialVector.Normalize()

        radialVelocity = combinedVelocity * radialVector
        transversalVelocity = (combinedVelocity -
                               (radialVelocity * radialVector)).Length()

        trackingFactor = transversalVelocity / distance * self.tracking

        resolutionFactor = self.sigResolution / targetRadius

        result = 0.5**(((trackingFactor * resolutionFactor)**2) +
                       (distanceFactor**2))

        return result
예제 #10
0
    def __init__(self, droneID):
        self.id = droneID
        ci = getCachedItem(droneID)

        self.ci = ci
        self.slimItem = ci.slimItem
        self.target = None
        self.actionTimestamp = self.timestamp = 0
        self.shield = self.armor = self.structure = 1.0
        self.state = None

        if ci.slimItem:
            attributes = getTypeAttributes(ci.slimItem.typeID, obj=ci.ball)
            self.isSentry = float(attributes.get("entityCruiseSpeed",
                                                 0.0)) <= 0.0
        else:
            self.isSentry = False
예제 #11
0
 def calculateTurret(self, targetID, velocityModifier=1.0, radiusModifier=1.0):
     import blue, foo
     from common.eve.state import getCachedItem
     target = getCachedItem(targetID)
     
     ballpark = sm.services["michelle"].GetBallpark()        
     now = blue.os.GetTime()
     
     shipVelocity = self.source.ball.GetVectorDotAt(now)
     shipPos = foo.Vector3(
         self.source.ball.x, self.source.ball.y, self.source.ball.z
     )
     
     distance = max(ballpark.DistanceBetween(eve.session.shipid, targetID), 0.00001)
     distanceFactor = max(0.0, distance - self.optimal) / self.falloff
     
     targetBall = target.ball
     targetItem = target.slimItem
     targetVelocity = targetBall.GetVectorDotAt(now) * velocityModifier
     targetPos = foo.Vector3(targetBall.x, targetBall.y, targetBall.z)            
     targetRadius = target.radius * radiusModifier
     
     combinedVelocity = foo.Vector3(
         targetVelocity.x - shipVelocity.x,
         targetVelocity.y - shipVelocity.y,
         targetVelocity.z - shipVelocity.z
     )
     
     radialVector = targetPos - shipPos
     if ((radialVector.x, radialVector.y, radialVector.z) != (0.0, 0.0, 0.0)):
         radialVector = radialVector.Normalize()
     
     radialVelocity = combinedVelocity * radialVector
     transversalVelocity = (combinedVelocity - (radialVelocity * radialVector)).Length()
     
     trackingFactor = transversalVelocity / distance * self.tracking
     
     resolutionFactor = self.sigResolution / targetRadius
                     
     result = 0.5 ** (((trackingFactor * resolutionFactor) ** 2) + (distanceFactor ** 2))
     
     return result    
예제 #12
0
    def setDrone(self, id):
        from common.eve.state import getCachedItem
        self.source = getCachedItem(id)

        si = self.source.slimItem
        ball = self.source.ball
        droneAttrs = getTypeAttributes(si.typeID, obj=ball)

        self.baseDamage = float(
            droneAttrs.get("kineticDamage", 0) +
            droneAttrs.get("emDamage", 0) +
            droneAttrs.get("explosiveDamage", 0) +
            droneAttrs.get("thermalDamage", 0))

        self.optimal = float(droneAttrs["maxRange"])
        self.falloff = float(droneAttrs["falloff"])
        self.tracking = float(droneAttrs["trackingSpeed"])
        self.sigResolution = float(droneAttrs["optimalSigRadius"])

        self.calculate = self.calculateTurret
예제 #13
0
 def setDrone(self, id):
     from common.eve.state import getCachedItem
     self.source = getCachedItem(id)
     
     si = self.source.slimItem
     ball = self.source.ball
     droneAttrs = getTypeAttributes(si.typeID, obj=ball)
     
     self.baseDamage = float(
         droneAttrs.get("kineticDamage", 0) + 
         droneAttrs.get("emDamage", 0) +
         droneAttrs.get("explosiveDamage", 0) +
         droneAttrs.get("thermalDamage", 0)
     )
     
     self.optimal = float(droneAttrs["maxRange"])
     self.falloff = float(droneAttrs["falloff"])
     self.tracking = float(droneAttrs["trackingSpeed"])
     self.sigResolution = float(droneAttrs["optimalSigRadius"])
     
     self.calculate = self.calculateTurret
예제 #14
0
def getPriority(id):
    global priorities, priorityBoosts

    if not id:
        return -1

    ci = getCachedItem(id)

    if not ci.slimItem:
        return -1

    charID = getattr(ci.slimItem, "charID", None)
    if charID:
        priority = priorities.get("char:%d" % (charID,), 0)
    else:
        priority = 0

    if priority == 0:
        priority = priorities.get("type:%d" % (ci.slimItem.typeID,), 0)
        if priority == 0:
            priority = priorities.get("group:%d" % (ci.slimItem.groupID,), 0)

    if priority == 0:
        flag = ci.flag

        if (
            (flag == "StandingGood")
            or (flag == "StandingHigh")
            or (flag == "SameGang")
            or (flag == "SameFleet")
            or (flag == "SameAlliance")
            or (flag == "SameCorp")
        ):
            priority = -1

    priority += priorityBoosts.get(id, 0)

    return priority
예제 #15
0
 def setSource(self, sourceID):
     from common.eve.state import getCachedItem
     self.source = getCachedItem(sourceID)
예제 #16
0
def getFlagName(id, slimItem=None):
    from shootblues.common.eve.state import getCachedItem
    return getCachedItem(id=id, slimItem=slimItem).flag
예제 #17
0
def getFlagName(id, slimItem=None):
    from shootblues.common.eve.state import getCachedItem
    return getCachedItem(id=id, slimItem=slimItem).flag
예제 #18
0
 def setSource(self, sourceID):
     from common.eve.state import getCachedItem
     self.source = getCachedItem(sourceID)