示例#1
0
        public static EntityCache FindDronePriorityTarget(EntityCache currentTarget, DronePriority priorityType, bool AddECMTypeToDronePriorityTargetList, double Distance, bool FindAUnTargetedEntity = true)
        {
            if (AddECMTypeToDronePriorityTargetList)
            {
                //if (Logging.DebugGetBestTarget) Logging.Log(callingroutine + " Debug: GetBestTarget", "Checking for Neutralizing priority targets (currentTarget first)", Logging.Teal);
                // Choose any Neutralizing primary weapon priority targets
                try
                {
                    EntityCache target = null;
                    try
                    {
                        if (DronePriorityEntities.Any(pt => pt.DronePriorityLevel == priorityType))
                        {
                            target = DronePriorityEntities.Where(pt => ((FindAUnTargetedEntity || pt.IsReadyToShoot) && currentTarget != null && pt.Id == currentTarget.Id && (pt.Distance < Distance) && pt.IsActiveDroneEwarType == priorityType)
                                                                                                || ((FindAUnTargetedEntity || pt.IsReadyToShoot) && pt.Distance < Distance && pt.IsActiveDroneEwarType == priorityType))
                                                                                                       .OrderByDescending(pt => pt.IsNpcFrigate)
                                                                                                       .ThenByDescending(pt => pt.IsLastTargetDronesWereShooting)
                                                                                                       .ThenByDescending(pt => pt.IsInDroneRange)
                                                                                                       .ThenBy(pt => pt.IsEntityIShouldKeepShootingWithDrones)
                                                                                                       .ThenBy(pt => (pt.ShieldPct + pt.ArmorPct + pt.StructurePct))
                                                                                                       .ThenBy(pt => pt.Nearest5KDistance)
                                                                                                       .FirstOrDefault();
                        }
                    }
                    catch (NullReferenceException) { }  // Not sure why this happens, but seems to be no problem

                    if (target != null)
                    {
                        //if (Logging.DebugGetBestTarget) Logging.Log(callingroutine + " Debug: GetBestTarget", "NeutralizingPrimaryWeaponPriorityTarget [" + NeutralizingPriorityTarget.Name + "][" + Math.Round(NeutralizingPriorityTarget.Distance / 1000, 2) + "k][" + Cache.Instance.MaskedID(NeutralizingPriorityTarget.Id) + "] GroupID [" + NeutralizingPriorityTarget.GroupId + "]", Logging.Debug);

                        if (!FindAUnTargetedEntity)
                        {
                            Drones.PreferredDroneTarget = target;
                            Time.Instance.LastPreferredDroneTargetDateTime = DateTime.UtcNow;
                            return target;
                        }

                        return target;
                    }

                    return null;
                }
                catch (NullReferenceException) { }

                return null;
            }

            return null;
        }
示例#2
0
        public static void AddDronePriorityTargets(IEnumerable<EntityCache> ewarEntities, DronePriority priority, string module, bool AddEwarTypeToPriorityTargetList = true)
        {
            try
            {
                ewarEntities = ewarEntities.ToList();
                if (ewarEntities.Any())
                {
                    foreach (EntityCache ewarEntity in ewarEntities)
                    {
                        AddDronePriorityTarget(ewarEntity, priority, module, AddEwarTypeToPriorityTargetList);
                        continue;
                    }

                    return;
                }

                return;
            }
            catch (Exception ex)
            {
                Logging.Log("AddDronePriorityTargets", "Exception [" + ex + "]", Logging.Debug);
            }
        }
示例#3
0
        public void AddDronePriorityTargets(IEnumerable<EntityCache> ewarEntities, DronePriority priority, string module, bool AddEwarTypeToPriorityTargetList = true)
        {
            ewarEntities = ewarEntities.ToList();
            if (ewarEntities.Any())
            {
                foreach (EntityCache ewarEntity in ewarEntities)
                {
                    AddDronePriorityTarget(ewarEntity, priority, module, AddEwarTypeToPriorityTargetList);
                    continue;
                }

                return;
            }

            return;
        }
示例#4
0
        public static void AddDronePriorityTarget(EntityCache ewarEntity, DronePriority priority, string module, bool AddEwarTypeToPriorityTargetList = true)
        {
            try
            {
                if (AddEwarTypeToPriorityTargetList && Drones.UseDrones)
                {
                    if ((ewarEntity.IsIgnored) || DronePriorityTargets.Any(p => p.EntityID == ewarEntity.Id))
                    {
                        if (Logging.DebugAddDronePriorityTarget) Logging.Log("AddDronePriorityTargets", "if ((target.IsIgnored) || DronePriorityTargets.Any(p => p.Id == target.Id))", Logging.Debug);
                        return;
                    }

                    if (DronePriorityTargets.All(i => i.EntityID != ewarEntity.Id))
                    {
                        int DronePriorityTargetCount = 0;
                        if (DronePriorityTargets.Any())
                        {
                            DronePriorityTargetCount = DronePriorityTargets.Count();
                        }
                        Logging.Log(module, "Adding [" + ewarEntity.Name + "] Speed [" + Math.Round(ewarEntity.Velocity, 2) + " m/s] Distance [" + Math.Round(ewarEntity.Distance / 1000, 2) + "] [ID: " + ewarEntity.MaskedId + "] as a drone priority target [" + priority.ToString() + "] we have [" + DronePriorityTargetCount + "] other DronePriorityTargets", Logging.Teal);
                        _dronePriorityTargets.Add(new PriorityTarget { Name = ewarEntity.Name, EntityID = ewarEntity.Id, DronePriority = priority });
                    }

                    return;
                }

                if (Logging.DebugAddDronePriorityTarget) Logging.Log(module, "UseDrones is [" + Drones.UseDrones.ToString() + "] AddWarpScramblersToDronePriorityTargetList is [" + Drones.AddWarpScramblersToDronePriorityTargetList + "] [" + ewarEntity.Name + "] was not added as a Drone PriorityTarget (why did we even try?)", Logging.Teal);
                return;
            }
            catch (Exception ex)
            {
                Logging.Log("AddDronePriorityTarget", "Exception [" + ex + "]", Logging.Debug);
            }
        }
示例#5
0
文件: Cache.cs 项目: Grafalck/Questor
        /// <summary>
        ///   Add Drone priority targets
        /// </summary>
        /// <param name = "targets"></param>
        /// <param name = "priority"></param>
        /// <param name = "module"></param>
        public void AddDronePriorityTargets(IEnumerable<EntityCache> targets, DronePriority priority, string module)
        {
            foreach (EntityCache target in targets)
            {
                if (Cache.Instance.IgnoreTargets.Contains(target.Name.Trim()) || _dronePriorityTargets.Any(p => p.EntityID == target.Id))
                {
                    continue;
                }

                if (Cache.Instance.InMission && Cache.Instance.UseDrones)
                {
                    Logging.Log(module, "Adding [" + target.Name + "] Speed [" + Math.Round(target.Velocity / 1000, 2) + "k/s] Distance [" + Math.Round(target.Distance / 1000, 2) + "] [ID: " + Cache.Instance.MaskedID(target.Id) + "] as a drone priority target [" + priority.ToString() + "]", Logging.Teal);
                    _dronePriorityTargets.Add(new PriorityTarget { EntityID = target.Id, DronePriority = priority });
                }
                else if (Settings.Instance.UseDrones)
                {
                    Logging.Log(module, "Adding [" + target.Name + "] Speed [" + Math.Round(target.Velocity / 1000, 2) + "k/s] Distance [" + Math.Round(target.Distance / 1000, 2) + "] [ID: " + Cache.Instance.MaskedID(target.Id) + "] as a drone priority target [" + priority.ToString() + "]", Logging.Teal);
                    _dronePriorityTargets.Add(new PriorityTarget { EntityID = target.Id, DronePriority = priority });
                }
            }

            return;
        }