Ejemplo n.º 1
0
        //
        // ItemID (of module), DateTime of activation, TargetId (what are we shooting at), Target.TypeID, Targets Distance, Targets Velocity, Targets Shield %, Targets Armor %, Targets Hull %, Targets Shield HitPoints, Targets Armor HitPoints, Targets Hull HitPoints
        //
        public EachWeaponsVolleyCache(EveCom.Module module, EntityCache target)
        {
            //
            // reminder: this class and all the info within it is created (and destroyed!) each frame for each module!
            //
            //_module = module;
            //_target = target;
            //_self = self;
            ThisVolleyCacheCreated = DateTime.UtcNow;
            targetName = target.Name; // Name of target entity
            targetTypeID = target.TypeId; // TypeID of target entity
            targetGroupID = target.GroupId; // GroupID of target entity
            targetItemID = target.Id; // ItemID of target entity - tells us which entity specifically (globally unique)
            targetVelocity = target.Velocity; // Velocity of target entity
            targetDistance = target.Distance; // Distance of target entity from me
            targetShieldPercentage = target.ShieldPct; // Shield percentage of target entity
            targetArmorPercentage = target.ArmorPct; // Armor percentage of target entity
            targetHullPercentage = target.StructurePct; // Hull percentage of target entity
            //targetAngularVelocity = target.AngularVelocity;
            targetXCoordinate = target.XCoordinate;
            targetYCoordinate = target.YCoordinate;
            targetZCoordinate = target.ZCoordinate;

            myShipName = EveCom.MyShip.ToItem.Name; // Name of target entity
            myShipTypeID = QuestorCache.Instance.ActiveShip.TypeID; // TypeID of target entity
            myShipGroupID = (int)QuestorCache.Instance.ActiveShip.GroupID; // GroupID of target entity
            myShipVelocity = QuestorCache.Instance.MyShipEntity.Velocity; // Velocity of target entity
            myShipShieldPercentage = QuestorCache.Instance.ActiveShip.ShieldPct; // Shield percentage of target entity
            myShipArmorPercentage = QuestorCache.Instance.ActiveShip.ArmorPct; // Armor percentage of target entity
            myShipHullPercentage = QuestorCache.Instance.ActiveShip.HullPct; // Hull percentage of target entity
            myShipShieldHitPoints = EveCom.MyShip.Shield; // Shield HitPoints of target entity
            myShipArmorHitPoints = EveCom.MyShip.Armor; // Shield HitPoints of target entity
            myShipHullHitPoints = EveCom.MyShip.Hull; // Shield HitPoints of target entity
            myShipCapacitorPercentage = EveCom.MyShip.Capacitor;
            myShipXCoordinate = QuestorCache.Instance.MyShipEntity.XCoordinate;
            myShipYCoordinate = QuestorCache.Instance.MyShipEntity.YCoordinate;
            myShipZCoordinate = QuestorCache.Instance.MyShipEntity.ZCoordinate;

            moduleName = module.Type;
            moduleItemID = module.ID;
            moduleTypeID = module.TypeID;
            moduleGroupID = (int)module.GroupID;
            moduleFalloff = module.FalloffRange;
            moduleOptimal = module.OptimalRange;
            //moduleTargetID = module.TargetId;

            if (moduleGroupID != 53 && module.Charge != null)
            {
                if (Logging.DebugEachWeaponsVolleyCache) Logging.Log("DebugEachWeaponsVolleyCache", "[" + thisWasVolleyNumber + "] ModuleItemID [" + moduleItemID + "] ModuleTypeID [" + moduleTypeID + "] ModuleGroupID [" + moduleGroupID + "] ModuleCurrentCharges [" + moduleCurrentCharges + "]", Logging.Debug);
                moduleAmmoTypeName = module.Charge.Type;
                moduleAmmoTypeID = module.Charge.TypeID;
                moduleCurrentCharges = module.Charge.TypeID;
            }

            thisWasVolleyNumber = QuestorCache.Instance.VolleyCount;
            QuestorCache.Instance.VolleyCount++;

            ThisVolleyCacheCreated = DateTime.UtcNow;
        }
Ejemplo n.º 2
0
 public ModuleCache(EveCom.Module module)
 {
     //
     // reminder: this class and all the info within it is created (and destroyed!) each frame for each module!
     //
     _module = module;
     _thisModuleCacheCreated = DateTime.UtcNow;
 }
Ejemplo n.º 3
0
        public BookmarkDestination(EveCom.Bookmark bookmark)
        {
            if (bookmark == null)
            {
                Logging.Log("TravelerDestination.BookmarkDestination", "Invalid bookmark destination!", Logging.Red);

                SolarSystemId = EveCom.Session.SolarSystemID;
                BookmarkId = -1;
                return;
            }

            Logging.Log("TravelerDestination.BookmarkDestination", "Destination set to bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
            BookmarkId = bookmark.ID;
            SolarSystemId = bookmark.LocationID;
        }
Ejemplo n.º 4
0
        //
        // what is this for really? Why can we not just use the bookmark? why try to convert it tinto a 'location?'
        //
        public BookmarkDestination2(EveCom.Bookmark bookmark)
        {
            if (!EveCom.Session.Safe) return;

            if (bookmark == null)
            {
                Logging.Log("QuestorManager.BookmarkDestination", "Invalid bookmark destination!", Logging.White);
                SolarSystemId = EveCom.Session.SolarSystemID;
                BookmarkId = -1;
                return;
            }

            Logging.Log("QuestorManager.BookmarkDestination", "Destination set to bookmark [" + bookmark.Title + "]", Logging.White);

            BookmarkId = bookmark.ID;
            SolarSystemId = bookmark.LocationID;
        }
        public MissionBookmarkDestination2(EveCom.AgentBookmark bookmark)
        {
            if (!EveCom.Session.Safe) return;

            if (bookmark == null)
            {
                Logging.Log("QuestorManager.MissionBookmarkDestination", "Invalid mission bookmark!", Logging.Red);

                AgentId = -1;
                Title = null;
                SolarSystemId = EveCom.Session.SolarSystemID;
                return;
            }

            Logging.Log("QuestorManager.MissionBookmarkDestination", "Destination set to mission bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
            AgentId = bookmark.AgentID;
            Title = bookmark.Title;
            SolarSystemId = bookmark.SolarSystemID;
        }
Ejemplo n.º 6
0
 public QuestorAgent(EveCom.Agent eveComAgent)
 {
     EveComAgent = eveComAgent;
 }
Ejemplo n.º 7
0
        private static void ActivateRemoteRepair(EveCom.Entity target)
        {
            EntityCache entityCacheTarget = new EntityCache(target);
            if (QuestorCache.Instance.Modules == null) return;
            List<ModuleCache> RemoteRepairers = QuestorCache.Instance.Modules.Where(m => m.GroupId == (int)Group.RemoteArmorRepairer
                                                                               || m.GroupId == (int)Group.RemoteShieldRepairer
                                                                               || m.GroupId == (int)Group.RemoteHullRepairer
                                                                               ).ToList();

            // Find the first active weapon
            // Assist this weapon
            _weaponNumber = 0;
            if (RemoteRepairers.Any())
            {
                if (Logging.DebugRemoteRepair) Logging.Log("ActivateRemoteRepair", "RemoteRepairers [" + RemoteRepairers.Count() + "] Target Distance [" + Math.Round(target.Distance / 1000, 0) + "] RemoteRepairDistance [" + Math.Round(((double)Combat.RemoteRepairDistance / 1000), digits: 0) + "]", Logging.Debug);
                foreach (ModuleCache RemoteRepairer in RemoteRepairers)
                {
                    _weaponNumber++;

                    if (Time.Instance.LastActivatedTimeStamp != null && Time.Instance.LastActivatedTimeStamp.ContainsKey(RemoteRepairer.ItemId))
                    {
                        if (Time.Instance.LastActivatedTimeStamp[RemoteRepairer.ItemId].AddMilliseconds(Time.Instance.RemoteRepairerDelay_milliseconds) > DateTime.UtcNow)
                        {
                            continue;
                        }
                    }

                    // Are we on the right target?
                    if (RemoteRepairer.IsActive)
                    {
                        if (RemoteRepairer.TargetId != entityCacheTarget.Id)
                        {
                            if (RemoteRepairer.Click()) return;

                            return;
                        }

                        continue;
                    }

                    // Are we deactivating?
                    if (RemoteRepairer.IsDeactivating)
                        continue;

                    // Target is out of RemoteRepair range
                    if (target.Distance >= RemoteRepairer.MaxRange)
                        continue;

                    if (CanActivate(RemoteRepairer, entityCacheTarget, false))
                    {
                        if (RemoteRepairer.Activate(target))
                        {
                            Logging.Log("Combat", "Activating [" + RemoteRepairer.TypeName + "][" + _weaponNumber + "] on [" + entityCacheTarget.Name + "][" + entityCacheTarget.MaskedId + "]", Logging.Teal);
                            return;
                        }

                        continue;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public bool Activate(EveCom.Entity target)
        {
            try
            {
                if (InLimboState || IsActive || _activateCountThisFrame > 0)
                    return false;

                //if (!DisableAutoReload)
                //    return false;

                //
                // if their are ANY changes in space (NOT JUST OUR OWN!, but ANY)
                // that are headed to the same target we want to shoot and are going
                // to likely hit in the next 1 sec do not shoot yet, wait until their
                // is no ammo that close (we assume this will eliminate some exceptions
                // we were seeing trying to shoot things that were dead/dieing
                //
                EntityCache targetEntityCache = new EntityCache(target);

                try
                {
                    if (QuestorCache.Instance.ChargeEntities.Any(e => e.FollowId == target.ID && e.DistanceFromEntity(targetEntityCache) < e.Velocity))
                    {
                        IEnumerable<EntityCache> AmmoNeartarget = QuestorCache.Instance.ChargeEntities.Where(e => e.FollowId == target.ID && e.DistanceFromEntity(targetEntityCache) < e.Velocity).ToList();
                        if (AmmoNeartarget.Any())
                        {
                            EntityCache closestAmmoToTarget = AmmoNeartarget.OrderByDescending(i => i.Distance).FirstOrDefault();
                            if (closestAmmoToTarget != null)
                            {
                                double? ammosDistanceFromTarget = closestAmmoToTarget.DistanceFromEntity(targetEntityCache);
                                if (ammosDistanceFromTarget != null)
                                {
                                    if (Logging.DebugActivateWeapons) Logging.Log("ModuleCache.Activate", "Not Shooting Yet: Waiting on [" + closestAmmoToTarget.Name + "] that is [" + Math.Round((double)ammosDistanceFromTarget / 1000, 0) + "k] from [" + target.Name + "][" + Math.Round(target.Distance /1000, 0) + "k][" + target.ID + "]", Logging.Debug);
                                    return false;
                                }

                                if (Logging.DebugActivateWeapons) Logging.Log("ModuleCache.Activate", "AmmosDistanceFromTarget is null", Logging.Debug);
                            }

                            if (Logging.DebugActivateWeapons) Logging.Log("ModuleCache.Activate", "ClosestAmmoToTarget is null", Logging.Debug);
                            //return false; if we cant log it correctly just shoot something
                        }

                        if (Logging.DebugActivateWeapons) Logging.Log("ModuleCache.Activate", "AmmoNeartarget is null)", Logging.Debug);
                        //return false; if we cant log it correctly just shoot something
                    }
                }
                catch (Exception ex)
                {
                    Logging.Log("ModuleCache.Activate","Exception [" + ex + "]",Logging.Debug);
                }

                _activateCountThisFrame++;

                if (Time.Instance.LastReloadedTimeStamp != null && Time.Instance.LastReloadedTimeStamp.ContainsKey(ItemId))
                {
                    if (DateTime.UtcNow < Time.Instance.LastReloadedTimeStamp[ItemId].AddSeconds(Time.Instance.ReloadWeaponDelayBeforeUsable_seconds))
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Activate", "TypeName: [" + _module.Type + "] This module is likely still reloading! aborting activating this module.", Logging.Debug);
                        return false;
                    }
                }

                if (Time.Instance.LastChangedAmmoTimeStamp != null && Time.Instance.LastChangedAmmoTimeStamp.ContainsKey(ItemId))
                {
                    if (DateTime.UtcNow < Time.Instance.LastChangedAmmoTimeStamp[ItemId].AddSeconds(Time.Instance.ReloadWeaponDelayBeforeUsable_seconds))
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Activate", "TypeName: [" + _module.Type + "] This module is likely still changing ammo! aborting activating this module.", Logging.Debug);
                        return false;
                    }
                }

                if (!targetEntityCache.IsLockedTarget)
                {
                    Logging.Log("Activate", "Target [" + target.Name + "][" + Math.Round(target.Distance / 1000, 2) + "]IsTargeting[" + targetEntityCache.IsTargeting + "] was not locked, aborting activating module as we cant activate a module on something that is not locked!", Logging.Debug);
                    return false;
                }

                if (targetEntityCache.IsEwarImmune && IsEwarModule)
                {
                    Logging.Log("Activate", "Target [" + target.Name + "][" + Math.Round(target.Distance / 1000, 2) + "]IsEwarImmune[" + targetEntityCache.IsEwarImmune + "] is EWar Immune and Module [" + _module.Type + "] isEwarModule [" + IsEwarModule + "]", Logging.Debug);
                    return false;
                }

                if (IsMissileLauncher && QuestorSettings.Instance.AvoidShootingTargetsWithMissilesIfweKNowTheyAreAboutToBeHitWithAPreviousVolley)
                {
                    //TRUE Max Missile Range
                    //
                    //r = Range
                    //v = Velocity of missile
                    //f = Flight time of missile
                    //m = Mass of missile
                    //a = Agility of missile

                    //Quote:
                    //r = v*(f-(10^6/(m*a)
                    //

                }

                //DateTime.UtcNow > i.ThisVolleyCacheCreated.AddSeconds(10)))

                _module.Activate(target);
                SnapshotOfVolleyData = new EachWeaponsVolleyCache(_module, targetEntityCache);
                if (IsMissileLauncher || IsTurret)
                {
                    QuestorCache.Instance.ListofEachWeaponsVolleyData.Add(SnapshotOfVolleyData);
                }

                Time.Instance.LastActivatedTimeStamp[ItemId] = DateTime.UtcNow;
                QuestorCache.Instance.LastModuleTargetIDs[ItemId] = target.ID;
                return true;
            }
            catch (Exception exception)
            {
                Logging.Log("Activate", "IterateUnloadLootTheseItemsAreLootItems - Exception: [" + exception + "]", Logging.Red);
                return false;
            }
        }
Ejemplo n.º 9
0
        public bool ReloadAmmoInModule(EveCom.Item charge, int weaponNumber, double range)
        {
            if (!IsReloadingAmmo)
            {
                if (!IsChangingAmmo)
                {
                    if (!InLimboState)
                    {
                        Logging.Log("ReloadAmmo", "Reloading [" + weaponNumber + "] [" + _module.Type + "] with [" + charge.Type + "][" + Math.Round(range / 1000, 0) + "]", Logging.Teal);
                        _module.LoadAmmo(charge);
                        Time.Instance.LastReloadedTimeStamp[ItemId] = DateTime.UtcNow;
                        if (Time.Instance.ReloadTimePerModule.ContainsKey(ItemId))
                        {
                            Time.Instance.ReloadTimePerModule[ItemId] = Time.Instance.ReloadTimePerModule[ItemId] + Time.Instance.ReloadWeaponDelayBeforeUsable_seconds;
                        }
                        else
                        {
                            Time.Instance.ReloadTimePerModule[ItemId] = Time.Instance.ReloadWeaponDelayBeforeUsable_seconds;
                        }

                        return true;
                    }

                    Logging.Log("ReloadAmmo", "[" + weaponNumber + "][" + _module.Type + "] is currently in a limbo state, waiting", Logging.Teal);
                    return false;
                }

                Logging.Log("ReloadAmmo", "[" + weaponNumber + "][" + _module.Type + "] is already changing ammo, waiting", Logging.Teal);
                return false;
            }

            Logging.Log("ReloadAmmo", "[" + weaponNumber + "][" + _module.Type + "] is already reloading, waiting", Logging.Teal);
            return false;
        }
Ejemplo n.º 10
0
 public EntityCache(EveCom.Entity entity)
 {
     //
     // reminder: this class and all the info within it is created (and destroyed!) each frame for each entity!
     //
     EveComEntity = entity;
     //Interlocked.Increment(ref EntityCacheInstances);
     _thisEntityCacheCreated = DateTime.UtcNow;
 }
Ejemplo n.º 11
0
        private static bool LookForItem(string itemToFind, EveCom.InventoryContainer hangarToCheckForItemsdWeAlreadyMoved)
        {
            try
            {
                _weHaveThisManyOfThoseItemsInCargo = 0;
                _weHaveThisManyOfThoseItemsInItemHangar = 0;
                _weHaveThisManyOfThoseItemsInAmmoHangar = 0;
                _weHaveThisManyOfThoseItemsInLootHangar = 0;
                _cargoItems = new List<EveCom.Item>();

                _itemHangarItems = new List<EveCom.Item>();
                _itemHangarItem = null;

                _ammoHangarItems = new List<EveCom.Item>();
                _ammoHangarItem = null;

                _lootHangarItems = new List<EveCom.Item>();
                _lootHangarItem = null;
                //
                // check the local cargo for items and subtract the items in the cargo from the quantity we still need to move to our cargohold
                //
                if (hangarToCheckForItemsdWeAlreadyMoved != null && hangarToCheckForItemsdWeAlreadyMoved.Items.Any())
                {
                    _cargoItems = hangarToCheckForItemsdWeAlreadyMoved.Items.Where(i => (i.Type ?? string.Empty).ToLower() == itemToFind).ToList();
                    _weHaveThisManyOfThoseItemsInCargo = _cargoItems.Sum(i => i.Stacksize);
                    //do not return here
                }

                //
                // check itemhangar for the item
                //
                try
                {
                    if (QuestorCache.Instance.ItemHangar == null) return false;
                    if (QuestorCache.Instance.ItemHangar.Items.Any())
                    {
                        if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "We have [" + QuestorCache.Instance.ItemHangar.Items.Count() + "] total items in ItemHangar", Logging.Debug);
                        if (QuestorCache.Instance.ItemHangar.Items.Any(i => (i.Type ?? string.Empty).ToLower() == itemToFind.ToLower()))
                        {
                            _itemHangarItems = QuestorCache.Instance.ItemHangar.Items.Where(i => (i.Type ?? string.Empty).ToLower() == itemToFind.ToLower()).ToList();
                            _itemHangarItem = _itemHangarItems.FirstOrDefault();
                            _weHaveThisManyOfThoseItemsInItemHangar = _itemHangarItems.Sum(i => i.Stacksize);
                            if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "We have [" + _weHaveThisManyOfThoseItemsInItemHangar + "] [" + itemToFind + "] in ItemHangar", Logging.Debug);
                        }
                        else if (QuestorCache.Instance.ItemHangar.Items.Any(i => i.TypeID == Drones.DroneTypeId))
                        {
                            IEnumerable<EveCom.Item> dronesInItemHangar = QuestorCache.Instance.ItemHangar.Items.Where(i => i.TypeID == Drones.DroneTypeId).ToList();
                            Logging.Log(WeAreInThisStateForLogs(), "[" + itemToFind + "] not found by typeName in ItemHangar, but we DID find DroneTypeID [" + Drones.DroneTypeId + "]. We found [" + dronesInItemHangar.Count() + "] of them in the Itemhangar", Logging.Debug);
                            _itemHangarItem = dronesInItemHangar.FirstOrDefault();
                            _weHaveThisManyOfThoseItemsInItemHangar = dronesInItemHangar.Sum(i => i.Stacksize);
                            return true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "Exception [" + ex + "]", Logging.Debug);
                }

                /**
                //
                // check ammohangar for the item
                //
                try
                {
                    if (!string.IsNullOrEmpty(Settings.Instance.AmmoHangarTabName))
                    {
                        if (Cache.Instance.AmmoHangar == null) return false;

                        if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "AmmoHangar is defined", Logging.Debug);

                        if (Cache.Instance.AmmoHangar.Items.Any())
                        {
                            if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "We have [" + Cache.Instance.AmmoHangar.Items.Count() + "] total items in AmmoHangar", Logging.Debug);
                            if (Cache.Instance.AmmoHangar.Items.Any(i => (i.Type ?? string.Empty).ToLower() == itemToFind.ToLower()))
                            {
                                _ammoHangarItems = Cache.Instance.AmmoHangar.Items.Where(i => (i.Type ?? string.Empty).ToLower() == itemToFind.ToLower()).ToList();
                                _ammoHangarItem = _ammoHangarItems.FirstOrDefault();
                                WeHaveThisManyOfThoseItemsInAmmoHangar = _ammoHangarItems.Sum(i => i.Stacksize);
                                if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "We have [" + WeHaveThisManyOfThoseItemsInAmmoHangar + "] [" + itemToFind + "] in AmmoHangar", Logging.Debug);
                            }
                            else if (Cache.Instance.AmmoHangar.Items.Any(i => i.TypeID == Drones.DroneTypeId))
                            {
                                IEnumerable<EveCom.Item> _dronesInItemHangar = Cache.Instance.AmmoHangar.Items.Where(i => i.TypeID == Drones.DroneTypeId).ToList();
                                Logging.Log(WeAreInThisStateForLogs(), "[" + itemToFind + "] not found by typeName in ItemHangar, but we DID find DroneTypeID [" + Drones.DroneTypeId + "]. We found [" + _dronesInItemHangar.Count() + "] of them in the AmmoHangar", Logging.Debug);
                                _ammoHangarItem = _dronesInItemHangar.FirstOrDefault();
                                WeHaveThisManyOfThoseItemsInAmmoHangar = _dronesInItemHangar.Sum(i => i.Stacksize);
                                return true;
                            }
                        }

                    }
                }
                catch (Exception ex)
                {
                    if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "Exception [" + ex + "]", Logging.Debug);
                }

                //
                // check loothangar for the item
                //
                try
                {
                    if (!string.IsNullOrEmpty(Settings.Instance.LootHangarTabName) && Settings.Instance.LootHangarTabName != Settings.Instance.AmmoHangarTabName)
                    {
                        if (Cache.Instance.LootHangar == null) return false;

                        if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "LootHangar is defined and is different from AmmoHangar", Logging.Debug);

                        if (Cache.Instance.LootHangar.Items.Any())
                        {
                            if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "We have [" + Cache.Instance.LootHangar.Items.Count() + "] total items in LootHangar", Logging.Debug);
                            if (Cache.Instance.LootHangar.Items.Any(i => (i.Type ?? string.Empty).ToLower() == itemToFind.ToLower()))
                            {
                                _lootHangarItems = Cache.Instance.LootHangar.Items.Where(i => (i.Type ?? string.Empty).ToLower() == itemToFind.ToLower()).ToList();
                                _lootHangarItem = _lootHangarItems.FirstOrDefault();
                                WeHaveThisManyOfThoseItemsInLootHangar = _lootHangarItems.Sum(i => i.Stacksize);
                                if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "We have [" + WeHaveThisManyOfThoseItemsInLootHangar + "] [" + itemToFind + "] in LootHangar", Logging.Debug);
                            }
                            else if (Cache.Instance.LootHangar.Items.Any(i => i.TypeId == Drones.DroneTypeId))
                            {
                                IEnumerable<EveCom.Item> dronesInItemHangar = Cache.Instance.LootHangar.Items.Where(i => i.TypeID == Drones.DroneTypeId).ToList();
                                Logging.Log(WeAreInThisStateForLogs(), "[" + itemToFind + "] not found by typeName in LootHangar, but we DID find DroneTypeID [" + Drones.DroneTypeId + "]. We found [" + dronesInItemHangar.Count() + "] of them in the Loothangar", Logging.Debug);
                                _lootHangarItem = dronesInItemHangar.FirstOrDefault();
                                WeHaveThisManyOfThoseItemsInLootHangar = dronesInItemHangar.Sum(i => i.Stacksize);
                                return true;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (Logging.DebugArm) Logging.Log(WeAreInThisStateForLogs(), "Exception [" + ex + "]", Logging.Debug);
                }

                **/
                //
                // we searched all hangars, hopefully found some items...
                //
                return true;
            }
            catch (Exception exception)
            {
                Logging.Log(WeAreInThisStateForLogs(), "Exception [" + exception + "]", Logging.Debug);
                return false;
            }
        }
Ejemplo n.º 12
0
        private static void ActivateWarpDisruptor(EveCom.Entity target)
        {
            EntityCache entityCacheTarget = new EntityCache(target);

            if (entityCacheTarget.IsEwarImmune)
            {
                if (Logging.DebugKillTargets) Logging.Log("Combat.KillTargets", "Ignoring WarpDisruptor Activation on [" + entityCacheTarget.Name + "]IsEwarImmune[" + entityCacheTarget.IsEwarImmune + "]", Logging.Debug);
                return;
            }

            if (QuestorCache.Instance.Modules == null) return;
            List<ModuleCache> WarpDisruptors = QuestorCache.Instance.Modules.Where(m => m.GroupId == (int)Group.WarpDisruptor).ToList();

            // Find the first active weapon
            // Assist this weapon
            _weaponNumber = 0;
            foreach (ModuleCache WarpDisruptor in WarpDisruptors)
            {
                _weaponNumber++;

                if (Time.Instance.LastActivatedTimeStamp != null && Time.Instance.LastActivatedTimeStamp.ContainsKey(WarpDisruptor.ItemId))
                {
                    if (Time.Instance.LastActivatedTimeStamp[WarpDisruptor.ItemId].AddMilliseconds(Time.Instance.WebDelay_milliseconds) > DateTime.UtcNow)
                    {
                        continue;
                    }
                }

                // Are we on the right target?
                if (WarpDisruptor.IsActive)
                {
                    if (WarpDisruptor.TargetId != entityCacheTarget.Id)
                    {
                        if (WarpDisruptor.Click()) return;

                        return;
                    }

                    continue;
                }

                // Are we deactivating?
                if (WarpDisruptor.IsDeactivating)
                    continue;

                // Target is out of web range
                if (target.Distance >= WarpDisruptor.OptimalRange)
                    continue;

                if (CanActivate(WarpDisruptor, entityCacheTarget, false))
                {
                    if (WarpDisruptor.Activate(target))
                    {
                        Logging.Log("Combat", "Activating [" + WarpDisruptor.TypeName + "][" + _weaponNumber + "] on [" + entityCacheTarget.Name + "][" + entityCacheTarget.MaskedId + "]", Logging.Teal);
                        return;
                    }

                    continue;
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary> Activate weapons
        /// </summary>
        private static void ActivateWeapons(EveCom.Entity target)
        {
            // When in warp there's nothing we can do, so ignore everything
            if (QuestorCache.Instance.InSpace && QuestorCache.Instance.InWarp)
            {
                if (Combat.PrimaryWeaponPriorityEntities != null && Combat.PrimaryWeaponPriorityEntities.Any())
                {
                    RemovePrimaryWeaponPriorityTargets(Combat.PrimaryWeaponPriorityEntities.ToList());
                }

                if (Drones.UseDrones && Drones.DronePriorityEntities != null && Drones.DronePriorityEntities.Any())
                {
                    Drones.RemoveDronePriorityTargets(Drones.DronePriorityEntities.ToList());
                }

                if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: we are in warp! doing nothing", Logging.Teal);
                return;
            }

            if (QuestorCache.Instance.Weapons == null || !QuestorCache.Instance.Weapons.Any())
            {
                if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: you have no weapons?", Logging.Teal);
                return;
            }

            //
            // Do we really want a non-mission action moving the ship around at all!! (other than speed tanking)?
            // If you are not in a mission by all means let combat actions move you around as needed
            /*
            if (!Cache.Instance.InMission)
            {
                if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: we are NOT in a mission: NavigateInToRange", Logging.Teal);
                NavigateOnGrid.NavigateIntoRange(target, "Combat");
            }
            if (Settings.Instance.SpeedTank)
            {
                if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: We are Speed Tanking: NavigateInToRange", Logging.Teal);
                NavigateOnGrid.NavigateIntoRange(target, "Combat");
            }
            */
            if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: after navigate into range...", Logging.Teal);

            // Get the weapons

            // TODO: Add check to see if there is better ammo to use! :)
            // Get distance of the target and compare that with the ammo currently loaded

            //Deactivate weapons that needs to be deactivated for this list of reasons...
            _weaponNumber = 0;
            if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: Do we need to deactivate any weapons?", Logging.Teal);

            if (QuestorCache.Instance.Weapons.Any())
            {
                foreach (ModuleCache weapon in QuestorCache.Instance.Weapons)
                {
                    _weaponNumber++;
                    if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: for each weapon [" + _weaponNumber + "] in weapons", Logging.Teal);

                    if (Time.Instance.LastActivatedTimeStamp != null && Time.Instance.LastActivatedTimeStamp.ContainsKey(weapon.ItemId))
                    {
                        if (Time.Instance.LastActivatedTimeStamp[weapon.ItemId].AddMilliseconds(Time.Instance.WeaponDelay_milliseconds) > DateTime.UtcNow)
                        {
                            continue;
                        }
                    }

                    if (!weapon.IsActive)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: [" + weapon.TypeName + "][" + _weaponNumber + "] is not active: no need to do anything", Logging.Teal);
                        continue;
                    }

                    if (weapon.IsReloadingAmmo)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: [" + weapon.TypeName + "][" + _weaponNumber + "] is reloading ammo: waiting", Logging.Teal);
                        continue;
                    }

                    if (weapon.IsDeactivating)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: [" + weapon.TypeName + "][" + _weaponNumber + "] is deactivating: waiting", Logging.Teal);
                        continue;
                    }

                    if (weapon.IsChangingAmmo)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: [" + weapon.TypeName + "][" + _weaponNumber + "] is changing ammo: waiting", Logging.Teal);
                        continue;
                    }

                    // No ammo loaded
                    if (weapon.Charge == null)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: no ammo loaded? [" + weapon.TypeName + "][" + _weaponNumber + "] reload will happen elsewhere", Logging.Teal);
                        continue;
                    }

                    Ammo ammo = Combat.Ammo.FirstOrDefault(a => a.TypeId == weapon.Charge.TypeID);

                    //use mission specific ammo
                    if (MissionSettings.AmmoTypesToLoad.Count() != 0)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: MissionAmmocount is not 0", Logging.Teal);
                        //var x = 0;
                        //ammo = MissionSettings.AmmoTypesToLoad.TryGetValue((Ammo)weapon.Charge.TypeName, DateTime.Now);
                    }

                    // How can this happen? Someone manually loaded ammo
                    if (ammo == null)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: ammo == null [" + weapon.TypeName + "][" + _weaponNumber + "] someone manually loaded ammo?", Logging.Teal);
                        continue;
                    }

                    // If we have already activated warp, deactivate the weapons
                    if ((long)weapon.MaxRange != 0)
                    {
                        if ((int)QuestorCache.Instance.ActiveShip.Mode != 3)
                        {
                            // Target is in range
                            if (target.Distance <= ammo.Range)
                            {
                                if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: target is in range: do nothing, wait until it is dead", Logging.Teal);
                                continue;
                            }
                        }
                    }

                    // Target is out of range, stop firing
                    if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: deactivate: target is out of range, stop firing", Logging.Teal);
                    if (weapon.Click()) return;
                    return;
                }

                int weaponsActivatedThisTick = 0;
                int weaponsToActivateThisTick = QuestorCache.Instance.RandomNumber(1, 4);

                // Activate the weapons (it not yet activated)))
                _weaponNumber = 0;
                if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: activate: Do we need to activate any weapons?", Logging.Teal);
                foreach (ModuleCache weapon in QuestorCache.Instance.Weapons)
                {
                    _weaponNumber++;

                    if (Time.Instance.LastActivatedTimeStamp != null && Time.Instance.LastActivatedTimeStamp.ContainsKey(weapon.ItemId))
                    {
                        if (Time.Instance.LastActivatedTimeStamp[weapon.ItemId].AddMilliseconds(Time.Instance.WeaponDelay_milliseconds) > DateTime.UtcNow)
                        {
                            continue;
                        }
                    }

                    // Are we reloading, deactivating or changing ammo?
                    if (weapon.IsReloadingAmmo)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: Activate: [" + weapon.TypeName + "][" + _weaponNumber + "] is reloading, waiting.", Logging.Teal);
                        continue;
                    }

                    if (weapon.IsDeactivating)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: Activate: [" + weapon.TypeName + "][" + _weaponNumber + "] is deactivating, waiting.", Logging.Teal);
                        continue;
                    }

                    if (weapon.IsChangingAmmo)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: Activate: [" + weapon.TypeName + "][" + _weaponNumber + "] is changing ammo, waiting.", Logging.Teal);
                        continue;
                    }

                    if (!target.LockedTarget)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: Activate: [" + weapon.TypeName + "][" + _weaponNumber + "] is [" + target.Name + "] is not locked, waiting.", Logging.Teal);
                        continue;
                    }

                    // Are we on the right target?
                    if (weapon.IsActive)
                    {
                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: Activate: [" + weapon.TypeName + "][" + _weaponNumber + "] is active already", Logging.Teal);
                        if (weapon.TargetId != target.ID && target.LockedTarget)
                        {
                            if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: Activate: [" + weapon.TypeName + "][" + _weaponNumber + "] is shooting at the wrong target: deactivating", Logging.Teal);
                            if (weapon.Click()) return;

                            return;
                        }
                        continue;
                    }

                    // No, check ammo type and if that is correct, activate weapon
                    if (weapon.ReloadAmmo(new EntityCache(target), _weaponNumber) && CanActivate(weapon, new EntityCache(target), true))
                    {
                        if (weaponsActivatedThisTick > weaponsToActivateThisTick)
                        {
                            if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: if we have already activated x number of weapons return, which will wait until the next ProcessState", Logging.Teal);
                            return;
                        }

                        if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: Activate: [" + weapon.TypeName + "][" + _weaponNumber + "] has the correct ammo: activate", Logging.Teal);
                        if (weapon.Activate(target))
                        {
                            weaponsActivatedThisTick++; //increment the number of weapons we have activated this ProcessState so that we might optionally activate more than one module per tick
                            Logging.Log("Combat", "Activating [" + weapon.TypeName + "][" + _weaponNumber + "] on [" + target.Name + "] at [" + Math.Round(target.Distance / 1000, 0) + "k][" + new EntityCache(target).MaskedId + "]", Logging.Teal);
                            continue;
                        }

                        continue;
                    }

                    if (Logging.DebugActivateWeapons) Logging.Log("Combat", "ActivateWeapons: ReloadReady [" + weapon.ReloadAmmo(new EntityCache(target), _weaponNumber) + "] CanActivateReady [" + CanActivate(weapon, new EntityCache(target), true) + "]", Logging.Teal);
                }
            }
            else
            {
                //Logging.Log("Combat", "ActivateWeapons: you have no weapons with groupID: [ " + Combat.WeaponGroupId + " ]", Logging.Debug);
                _icount = 0;
                if (QuestorCache.Instance.Modules == null) return;
                foreach (ModuleCache __module in QuestorCache.Instance.Modules.Where(e => e.IsOnline)) // && e.IsActivatable))
                {
                    _icount++;
                    Logging.Log("Fitted Modules", "[" + _icount + "] Module TypeID [ " + __module.TypeId + " ] ModuleGroupID [ " + __module.GroupId + " ] EveCentral Link [ http://eve-central.com/home/quicklook.html?typeid=" + __module.TypeId + " ]", Logging.Debug);
                }
            }
        }
Ejemplo n.º 14
0
        internal static bool PerformFinalDestinationTask2(EveCom.Bookmark bookmark, int warpDistance, ref DateTime nextAction)
        {
            // The bookmark no longer exists, assume we are there
            if (bookmark == null)
                return true;

            if (QuestorCache.Instance.InStation)
            {
                // We have arrived
                if (bookmark != null && bookmark.ID == EveCom.Session.StationID)
                    return true;

                if (DateTime.UtcNow > Time.Instance.LastInSpace.AddSeconds(45)) //do not try to leave the station until you have been docked for at least 45seconds! (this gives some overhead to load the station env + session change timer)
                {
                    // We are apparently in a station that is incorrect
                    Logging.Log("QuestorManager.BookmarkDestination", "We're docked in the wrong station, undocking", Logging.White);

                    EveCom.CommandExtenders.Execute(EveCom.Command.CmdExitStation);
                    nextAction = DateTime.UtcNow.AddSeconds(30);
                    return false;
                }

                return false;
            }

            // Is this a station bookmark?
            if ((int)bookmark.GroupID == (int)Group.Station)
            {
                bool arrived = StationDestination2.PerformFinalDestinationTask(bookmark.ID, bookmark.Title, ref nextAction);
                if (arrived)
                    Logging.Log("QuestorManager.BookmarkDestination", "Arrived at bookmark [" + bookmark.Title + "]", Logging.White);
                return arrived;
            }

            // Its not a station bookmark, make sure we are in space
            if (QuestorCache.Instance.InStation)
            {
                // We are in a station, but not the correct station!
                if (nextAction < DateTime.UtcNow)
                {
                    if (DateTime.UtcNow > Time.Instance.LastInSpace.AddSeconds(45)) //do not try to leave the station until you have been docked for at least 45seconds! (this gives some overhead to load the station env + session change timer)
                    {
                        Logging.Log("QuestorManager.BookmarkDestination", "We're docked but our destination is in space, undocking", Logging.White);
                        EveCom.CommandExtenders.Execute(EveCom.Command.CmdExitStation);
                        nextAction = DateTime.UtcNow.AddSeconds(30);
                    }
                }

                // We are not there yet
                return false;
            }

            if (!QuestorCache.Instance.InSpace)
            {
                // We are not in space and not in a station, wait a bit
                return false;
            }

            // This bookmark has no x / y / z, assume we are there.
            //if (bookmark..X == -1 || bookmark.Y == -1 || bookmark.Z == -1)
            //{
            //    Logging.Log("QuestorManager.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "][No XYZ]", Logging.White);
            //    return true;
            //}

            if (bookmark.Distance < warpDistance)
            {
                Logging.Log("QuestorManager.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "]", Logging.White);
                return true;
            }

            if (nextAction > DateTime.UtcNow)
                return false;

            if (QuestorCache.Instance.GateInGrid() && (bookmark.Distance / 1000) < (int)Distances.MaxPocketsDistanceKm)
            {
                Logging.Log("QuestorManager.BookmarkDestination", "Bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "][" + Logging.Yellow + Math.Round((bookmark.Distance / 1000) / 149598000, 2) + Logging.White + "] AU away. Which is [" + Logging.Yellow + Math.Round((bookmark.Distance / 1000), 2) + Logging.White + "].", Logging.White);
            }

            if (DateTime.UtcNow > Time.Instance.NextWarpAction && EveCom.MyShip.Mode != EveCom.EntityMode.Warping)
            {
                bookmark.WarpTo();
            }

            if (EveCom.MyShip.Mode == EveCom.EntityMode.Warping)
            {
                Logging.Log("QuestorManager.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.White + "][" + Math.Round((bookmark.Distance / 1000) / 149598000, 2) + "] AU away. Which is [" + Math.Round((bookmark.Distance / 1000), 2) + "]", Logging.White);
                nextAction = DateTime.UtcNow.AddSeconds(30);
                Time.Instance.NextWarpAction = DateTime.UtcNow.AddSeconds(5);
                return false;
            }

            return false;
        }
Ejemplo n.º 15
0
        public static void TravelToBookmark(EveCom.Bookmark bookmark, string module)
        {
            // if we can't warp because we are scrambled, prevent next actions
            if(!_defendOnTravel(module))
                return;

            if (Logging.DebugGotobase) Logging.Log(module, "TravelToBookmark:      bookmark [" + bookmark.Title + "]", Logging.White);

            if (_destination == null)
            {
                Logging.Log(module, "Destination: bookmark[" + bookmark.Description + "]", Logging.White);

                _destination = new BookmarkDestination(bookmark);
                _States.CurrentTravelerState = TravelerState.Idle;
                return;
            }

            if (Logging.DebugGotobase) if (Traveler.Destination != null) Logging.Log("CombatMissionsBehavior", "TravelToAgentsStation: Traveler.Destination.SolarSystemId [" + Traveler.Destination.SolarSystemId + "]", Logging.White);
            Traveler.ProcessState();
            _processAtDestinationActions(module);

            return;
        }
Ejemplo n.º 16
0
        /// <summary> Activate Nos
        /// </summary>
        private static void ActivateNos(EveCom.Entity target)
        {
            EntityCache entityCacheTarget = new EntityCache(target);
            if (entityCacheTarget.IsEwarImmune)
            {
                if (Logging.DebugKillTargets) Logging.Log("Combat.KillTargets", "Ignoring NOS/NEUT Activation on [" + entityCacheTarget.Name + "]IsEwarImmune[" + entityCacheTarget.IsEwarImmune + "]", Logging.Debug);
                return;
            }

            if (QuestorCache.Instance.Modules == null) return;
            List<ModuleCache> noses = QuestorCache.Instance.Modules.Where(m => m.GroupId == (int)Group.NOS || m.GroupId == (int)Group.Neutralizer).ToList();

            //Logging.Log("Combat: we have " + noses.Count.ToString() + " Nos modules");
            // Find the first active weapon
            // Assist this weapon
            _weaponNumber = 0;
            foreach (ModuleCache nos in noses)
            {
                _weaponNumber++;

                if (Time.Instance.LastActivatedTimeStamp != null && Time.Instance.LastActivatedTimeStamp.ContainsKey(nos.ItemId))
                {
                    if (Time.Instance.LastActivatedTimeStamp[nos.ItemId].AddMilliseconds(Time.Instance.NosDelay_milliseconds) > DateTime.UtcNow)
                    {
                        continue;
                    }
                }

                // Are we on the right target?
                if (nos.IsActive)
                {
                    if (nos.TargetId != entityCacheTarget.Id)
                    {
                        if (nos.Click()) return;

                        return;
                    }

                    continue;
                }

                // Are we deactivating?
                if (nos.IsDeactivating)
                    continue;

                //Logging.Log("Combat: Distances Target[ " + Math.Round(target.Distance,0) + " Optimal[" + nos.OptimalRange.ToString()+"]");
                // Target is out of Nos range
                if (target.Distance >= nos.MaxRange)
                    continue;

                if (CanActivate(nos, entityCacheTarget, false))
                {
                    if (nos.Activate(target))
                    {
                        Logging.Log("Combat", "Activating [" + nos.TypeName + "][" + _weaponNumber + "] on [" + entityCacheTarget.Name + "][" + entityCacheTarget.MaskedId + "][" + Math.Round(target.Distance / 1000, 0) + "k away]", Logging.Teal);
                        return;
                    }

                    continue;
                }

                Logging.Log("Combat", "Cannot Activate [" + nos.TypeName + "][" + _weaponNumber + "] on [" + entityCacheTarget.Name + "][" + entityCacheTarget.MaskedId + "][" + Math.Round(target.Distance / 1000, 0) + "k away]", Logging.Teal);
            }
        }
Ejemplo n.º 17
0
        public MissionBookmarkDestination(EveCom.AgentBookmark bookmark)
        {
            if (bookmark == null)
            {
                if (DateTime.UtcNow > Time.Instance.MissionBookmarkTimeout.AddMinutes(2))
                {
                    Logging.Log("TravelerDestination", "MissionBookmarkTimeout [ " + Time.Instance.MissionBookmarkTimeout.ToShortTimeString() + " ] did not get reset from last usage: resetting it now", Logging.Red);
                    Time.Instance.MissionBookmarkTimeout = DateTime.UtcNow.AddYears(1);
                }

                if (!QuestorCache.Instance.MissionBookmarkTimerSet)
                {
                    QuestorCache.Instance.MissionBookmarkTimerSet = true;
                    Time.Instance.MissionBookmarkTimeout = DateTime.UtcNow.AddSeconds(10);
                }

                if (DateTime.UtcNow > Time.Instance.MissionBookmarkTimeout) //if CurrentTime is after the TimeOut value, freak out
                {
                    AgentId = -1;
                    Title = null;
                    SolarSystemId = EveCom.Session.SolarSystemID;

                    QuestorCache.Instance.CloseQuestorCMDLogoff = false;
                    QuestorCache.Instance.CloseQuestorCMDExitGame = true;
                    Cleanup.ReasonToStopQuestor = "TravelerDestination.MissionBookmarkDestination: Invalid mission bookmark! - Lag?! Closing EVE";
                    Logging.Log("TravelerDestination", Cleanup.ReasonToStopQuestor, Logging.Red);
                    Cleanup.SignalToQuitQuestorAndEveAndRestartInAMoment = true;
                }
                else
                {
                    Logging.Log("TravelDestination.MissionBookmarkDestination", "Invalid Mission Bookmark! retrying for another [ " + Math.Round(Time.Instance.MissionBookmarkTimeout.Subtract(DateTime.UtcNow).TotalSeconds, 0) + " ]sec", Logging.Green);
                }
            }

            if (bookmark != null)
            {
                Logging.Log("TravelerDestination.MissionBookmarkDestination", "Destination set to mission bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
                AgentId = bookmark.AgentID;
                Title = bookmark.Title;
                SolarSystemId = bookmark.SolarSystemID;
                QuestorCache.Instance.MissionBookmarkTimerSet = false;
            }
        }
Ejemplo n.º 18
0
 public ItemCache(EveCom.Item item)
 {
     _item = item;
 }
Ejemplo n.º 19
0
        public ItemCache(EveCom.Item item, bool cacheRefineOutput)
        {
            try
            {
                //Id = item.ItemId;
                //Name = item.TypeName;
                //TypeId = item.TypeId;
                //Volume = item.Volume;
                //Quantity = item.Quantity;
                NameForSorting = item.Type.Replace("'", "");
                GroupId = (int)item.GroupID;
                CategoryId = (int)item.CategoryID;
                BasePrice = item.BasePrice;
                Capacity = item.Capacity;
                //MarketGroupId = item.MarketGroupID;
                PortionSize = item.PortionSize;

                QuantitySold = 0;

                //RefineOutput = new List<ItemCache>();
                //if (cacheRefineOutput)
                //{
                //    foreach (var i in item)
                //    {
                //        RefineOutput.Add(new ItemCache(i, false));
                //    }
                //}

                //maxVelocity = item.Attributes.TryGet<int>("maxVelocity");

                //emDamage = item.Attributes.TryGet<int>("emDamage");
                //explosiveDamage = item.Attributes.TryGet<int>("explosiveDamage");
                //kineticDamage = item.Attributes.TryGet<int>("explosiveDamage");
                //thermalDamage = item.Attributes.TryGet<int>("thermalDamage");
                //metaLevel = item.Attributes.TryGet<int>("metaLevel");
                //hp = item.Attributes.TryGet<int>("hp");
                //techLevel = item.Attributes.TryGet<int>("techLevel");
                //radius = item.Attributes.TryGet<int>("radius");

                //
                // only useful for missiles should we not pull this info for items that wont have these attributes?!
                //
                //aoeDamageReductionFactor = item.Attributes.TryGet<int>("aoeDamageReductionFactor");
                //detonationRange = item.Attributes.TryGet<int>("detonationRange");
                //aoeCloudSize = item.Attributes.TryGet<int>("aoeCloudSize");
                //aoeVelocity = item.Attributes.TryGet<int>("aoeVelocity");
                //agility = item.Attributes.TryGet<int>("agility");
                //explosionDelay = item.Attributes.TryGet<int>("explosionDelay");
                //maxVelocityBonus = item.Attributes.TryGet<int>("maxVelocityBonus");

                //
                // only useful for AutoCannon / Artillery and Blaster/RailGun ammo should we not pull this info for items that wont have these attributes?!
                //
                //fallofMultiplier = item.Attributes.TryGet<int>("fallofMultiplier");
                //weaponRangeMultiplier = item.Attributes.TryGet<int>("weaponRangeMultiplier");
                //trackingSpeedMultiplier = item.Attributes.TryGet<int>("trackingSpeedMultiplier");
                //powerNeedMultiplier = item.Attributes.TryGet<int>("powerNeedMultiplier");

            }
            catch (Exception exception)
            {
                Logging.Log("ItemCache", "Exception [" + exception + "]", Logging.Debug);
            }
        }
Ejemplo n.º 20
0
        internal static bool PerformFinalDestinationTask(EveCom.Bookmark bookmark, int warpDistance)
        {
            // The bookmark no longer exists, assume we are not there
            if (bookmark == null)
                return false;

            // Is this a station bookmark?
            if ((int)bookmark.GroupID == (int)Group.Station)
            {
                if (QuestorCache.Instance.InSpace && !QuestorCache.Instance.InStation)
                {
                    if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info title: [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
                    if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info locationID: [" + Logging.Yellow + bookmark.LocationID + Logging.Green + "]", Logging.Green);
                    if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info id: [" + Logging.Yellow + bookmark.ID + Logging.Green + "]", Logging.Green);
                    if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "bookmark info distance: [" + Logging.Yellow + bookmark.Distance + Logging.Green + "]", Logging.Green);
                    int stationNum = 0;
                    if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "---------------------------------", Logging.Green);

                    foreach (EntityCache station in QuestorCache.Instance.Stations)
                    {
                        stationNum++;
                        if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "[" + stationNum + "] Station Name [" + Logging.Yellow + station.Name + Logging.Green + "]", Logging.Green);
                        if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "[" + stationNum + "] Station Distance [" + Logging.Yellow + station.Distance + Logging.Green + "]", Logging.Green);
                        if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "[" + stationNum + "] Station ID [" + Logging.Yellow + station.EveComEntity.ID + Logging.Green + "]", Logging.Green);
                        if (station.Distance == bookmark.Distance)
                        {
                            ThisStation = station;
                        }
                    }

                    if (Logging.DebugTraveler) Logging.Log("TravelerDestination.BookmarkDestination", "---------------------------------", Logging.Green);
                }

                if (ThisStation == null)
                {
                    Logging.DebugTraveler = true;
                    Logging.Log("TravelerDestination.BookmarkDestination", "Station missing... bookmark distance doesnt match any of the stations in local", Logging.Debug);
                    return false;
                }

                bool arrived = StationDestination.PerformFinalDestinationTask(ThisStation.Id);
                if (arrived)
                {
                    Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
                }

                return arrived;
            }

            if (QuestorCache.Instance.InStation)
            {
                // We have arrived
                if (bookmark.ItemID == EveCom.Session.StationID)
                    return true;

                // We are in a station, but not the correct station!
                if (DateTime.UtcNow > Time.Instance.NextUndockAction)
                {
                    TravelerDestination.Undock();
                    return false;
                }

                return false;
            }

            if (!QuestorCache.Instance.InSpace)
            {
                // We are not in space and not in a station, wait a bit
                return false;
            }

            if (_nextTravelerDestinationAction > DateTime.UtcNow)
                return false;

            _undockAttempts = 0;

            if (!UseInstaBookmark()) return false;

            // This bookmark has no x / y / z, assume we are there.
            //if (bookmark.X = -1 || bookmark.Y == -1 || bookmark.Z == -1)
            //{
            //    Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][No XYZ]", Logging.Green);
            //    return true;
            //}

            if (bookmark.Distance < warpDistance)
            {
                Logging.Log("TravelerDestination.BookmarkDestination", "Arrived at the bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "]", Logging.Green);
                return true;
            }

            if (_nextTravelerDestinationAction > DateTime.UtcNow)
                return false;

            if (Math.Round((bookmark.Distance / 1000)) < (int)Distances.MaxPocketsDistanceKm && QuestorCache.Instance.AccelerationGates.Count() != 0)
            {
                Logging.Log("TravelerDestination.BookmarkDestination", "Warp to bookmark in same pocket requested but acceleration gate found delaying.", Logging.White);
                return true;
            }

            Defense.DoNotBreakInvul = false;
            string nameOfBookmark = "";
            if (QuestorSettings.Instance.EveServerName == "Tranquility") nameOfBookmark = "Encounter";
            if (QuestorSettings.Instance.EveServerName == "Serenity") nameOfBookmark = "遭遇战";
            if (nameOfBookmark == "") nameOfBookmark = "Encounter";
            //if (!Combat.ReloadAll(Cache.Instance.EntitiesNotSelf.OrderBy(t => t.Distance).FirstOrDefault(t => t.Distance < (double)Distance.OnGridWithMe))) return false;
            if (MissionSettings.MissionWarpAtDistanceRange != 0 && bookmark.Title.Contains(nameOfBookmark))
            {
                if (DateTime.UtcNow > Time.Instance.NextWarpAction && EveCom.MyShip.Mode != EveCom.EntityMode.Warping)
                {
                    bookmark.WarpTo(MissionSettings.MissionWarpAtDistanceRange * 1000);
                }

                if (EveCom.MyShip.Mode == EveCom.EntityMode.Warping)
                {
                    Logging.Log("TravelerDestination.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][" + Logging.Yellow + " At " + MissionSettings.MissionWarpAtDistanceRange + Logging.Green + " km]", Logging.Green);
                    Time.Instance.NextWarpAction = DateTime.UtcNow.AddSeconds(5);
                    return true;
                }
            }
            else
            {
                if (DateTime.UtcNow > Time.Instance.NextWarpAction && EveCom.MyShip.Mode != EveCom.EntityMode.Warping)
                {
                    bookmark.WarpTo();
                }

                if (EveCom.MyShip.Mode == EveCom.EntityMode.Warping)
                {
                    Logging.Log("TravelerDestination.BookmarkDestination", "Warping to bookmark [" + Logging.Yellow + bookmark.Title + Logging.Green + "][" + Logging.Yellow + Math.Round((bookmark.Distance / 1000) / 149598000, 2) + Logging.Green + " AU away]", Logging.Green);
                    Time.Instance.NextWarpAction = DateTime.UtcNow.AddSeconds(5);
                    return true;
                }
            }

            return false;
        }
Ejemplo n.º 21
0
        /// <summary> Activate target painters
        /// </summary>
        private static void ActivateTargetPainters(EveCom.Entity target)
        {
            EntityCache entityCacheTarget = new EntityCache(target);
            if (entityCacheTarget.IsEwarImmune)
            {
                if (Logging.DebugKillTargets) Logging.Log("Combat.KillTargets", "Ignoring TargetPainter Activation on [" + entityCacheTarget.Name + "]IsEwarImmune[" + entityCacheTarget.IsEwarImmune + "]", Logging.Debug);
                return;
            }

            if (QuestorCache.Instance.Modules == null) return;
            List<ModuleCache> targetPainters = QuestorCache.Instance.Modules.Where(m => m.GroupId == (int)Group.TargetPainter).ToList();

            // Find the first active weapon
            // Assist this weapon
            _weaponNumber = 0;
            foreach (ModuleCache painter in targetPainters)
            {
                if (Time.Instance.LastActivatedTimeStamp != null && Time.Instance.LastActivatedTimeStamp.ContainsKey(painter.ItemId))
                {
                    if (Time.Instance.LastActivatedTimeStamp[painter.ItemId].AddMilliseconds(Time.Instance.PainterDelay_milliseconds) > DateTime.UtcNow)
                    {
                        continue;
                    }
                }

                _weaponNumber++;

                // Are we on the right target?
                if (painter.IsActive)
                {
                    if (painter.TargetId != entityCacheTarget.Id)
                    {
                        if (painter.Click()) return;

                        return;
                    }

                    continue;
                }

                // Are we deactivating?
                if (painter.IsDeactivating)
                    continue;

                if (CanActivate(painter, entityCacheTarget, false))
                {
                    if (painter.Activate(target))
                    {
                        Logging.Log("Combat", "Activating [" + painter.TypeName + "][" + _weaponNumber + "] on [" + entityCacheTarget.Name + "][" + entityCacheTarget.MaskedId + "][" + Math.Round(entityCacheTarget.Distance / 1000, 0) + "k away]", Logging.Teal);
                        return;
                    }

                    continue;
                }
            }
        }
Ejemplo n.º 22
0
        private static bool LoadthisScript(EveCom.Item scriptToLoad, ModuleCache module)
        {
            if (scriptToLoad != null)
            {
                if (module.IsReloadingAmmo || module.IsActive || module.IsDeactivating || module.IsChangingAmmo || module.InLimboState || !module.IsOnline)
                    return false;

                // We have enough ammo loaded
                if (module.Charge != null && module.Charge.TypeID == scriptToLoad.TypeID)
                {
                    Logging.Log("LoadthisScript", "module is already loaded with the script we wanted", Logging.Teal);
                    NextScriptReload[module.ItemId] = DateTime.UtcNow.AddSeconds(15); //mark this weapon as reloaded... by the time we need to reload this timer will have aged enough...
                    return false;
                }

                // We are reloading, wait 15
                if (NextScriptReload.ContainsKey(module.ItemId) && DateTime.UtcNow < NextScriptReload[module.ItemId].AddSeconds(15))
                {
                    Logging.Log("LoadthisScript", "module was reloaded recently... skipping", Logging.Teal);
                    return false;
                }
                NextScriptReload[module.ItemId] = DateTime.UtcNow.AddSeconds(15);

                // Reload or change ammo
                if (module.Charge != null && module.Charge.TypeID == scriptToLoad.TypeID)
                {
                    if (DateTime.UtcNow.Subtract(Time.Instance.LastLoggingAction).TotalSeconds > 10)
                    {
                        Time.Instance.LastLoggingAction = DateTime.UtcNow;
                    }

                    if (module.ReloadAmmoInModule(scriptToLoad, 0, 0))
                    {
                        Logging.Log("Defense", "Reloading [" + module.TypeId + "] with [" + scriptToLoad.Type + "][TypeID: " + scriptToLoad.TypeID + "]", Logging.Teal);
                        return true;
                    }

                    return false;
                }

                if (DateTime.UtcNow.Subtract(Time.Instance.LastLoggingAction).TotalSeconds > 10)
                {
                    Time.Instance.LastLoggingAction = DateTime.UtcNow;
                }

                if (module.ChangeAmmoInModule(scriptToLoad, 0, 0))
                {
                    Logging.Log("Defense", "Changing [" + module.TypeId + "] with [" + scriptToLoad.Type + "][TypeID: " + scriptToLoad.TypeID + "]", Logging.Teal);
                    return true;
                }

                return false;
            }
            Logging.Log("LoadthisScript", "script to load was NULL!", Logging.Teal);
            return false;
        }