예제 #1
0
        public FpsQueue(NodeName name, ITargetQueue <TPayload> next, IStreamerBase streamerBase, PayloadPool <TPayload> payloadPool, int fps, int maxDeviation, AVRational timeBase,
                        OverloadController overloadController, int version)
        {
            Name                = name;
            _next               = next;
            _payloadPool        = payloadPool;
            Fps                 = fps;
            _maxDeviation       = maxDeviation;
            _overloadController = overloadController;
            _version            = version;
            _statisticKeeper    = new StatisticKeeper <StatisticDataOfFpsQueue>(name);

            if (timeBase.den != 10_000_000)
            {
                throw new InvalidOperationException($"FpsQueue {name} requires correct timeBase (not {timeBase.num}/{timeBase.den})");
            }
        }
예제 #2
0
        public Attackers(IMeCache meCache, IConfiguration configuration, IShip ship, IDrones drones,
                         IEntityProvider entityProvider, IAlerts alerts, IAsteroidBelts asteroidBelts, IPossibleEwarNpcs possibleEwarNpcs,
                         ITargetQueue targetQueue, IModuleManager moduleManager)
        {
            _meCache          = meCache;
            _configuration    = configuration;
            _ship             = ship;
            _drones           = drones;
            _entityProvider   = entityProvider;
            _alerts           = alerts;
            _asteroidBelts    = asteroidBelts;
            _possibleEwarNpcs = possibleEwarNpcs;
            _targetQueue      = targetQueue;
            _moduleManager    = moduleManager;

            ModuleManager.ModulesToPulse.Add(this);
            ModuleName     = "Attackers";
            IsEnabled      = true;
            PulseFrequency = 1;
        }
예제 #3
0
        public Targeting(ILogging logging, IMaxRuntimeConfiguration maxRuntimeConfiguration, IMeCache meCache, IShip ship,
                         IDrones drones, IAlerts alerts, IModuleManager moduleManager, ITargetQueue targetQueue, IEntityProvider entityProvider, IMovement movement)
            : base(logging)
        {
            _meCache        = meCache;
            _ship           = ship;
            _drones         = drones;
            _alerts         = alerts;
            _moduleManager  = moduleManager;
            _targetQueue    = targetQueue;
            _entityProvider = entityProvider;
            _movement       = movement;

            ModuleManager.ModulesToPulse.Add(this);
            ModuleName = "Targeting";

            _randomWait = new RandomWaitObject("Targeting", logging, maxRuntimeConfiguration);
            _randomWait.AddWait(new KeyValuePair <int, int>(3, 5), 5);
            _randomWait.AddWait(new KeyValuePair <int, int>(1, 2), 15);
        }
예제 #4
0
        public Ratting(ISocial social, IMeCache meCache, IBookmarks bookmarks, ISalvageConfiguration salvageConfiguration, IRattingConfiguration rattingConfiguration, IAnomalyProvider anomalyProvider,
                       IEntityProvider entityProvider, IAnomalyClaimTracker anomalyClaimTracker, ISafespots safespots, IMovement movement, IShip ship, IAsteroidBelts asteroidBelts, IMovementConfiguration movementConfiguration,
                       IAlerts alerts, ITargetQueue targetQueue, IAttackers attackers)
        {
            _social               = social;
            _meCache              = meCache;
            _bookmarks            = bookmarks;
            _salvageConfiguration = salvageConfiguration;
            _rattingConfiguration = rattingConfiguration;
            _anomalyProvider      = anomalyProvider;
            _entityProvider       = entityProvider;
            _anomalyClaimTracker  = anomalyClaimTracker;
            _safespots            = safespots;
            _movement             = movement;
            _ship                  = ship;
            _asteroidBelts         = asteroidBelts;
            _movementConfiguration = movementConfiguration;
            _alerts                = alerts;
            _targetQueue           = targetQueue;
            _attackers             = attackers;

            BehaviorManager.BehaviorsToPulse.Add(BotModes.Ratting, this);
            ModuleName     = "Ratting";
            IsEnabled      = true;
            PulseFrequency = 2;

            var knownEwarPointTargetTags = new List <string> {
                "Dire Guristas", "Arch Angel Hijacker", "Arch Angel Outlaw", "Arch Angel Rogue",
                "Arch Angel Thug", "Sansha's Loyal", "Guardian Agent", "Guardian Initiate",
                "Guardian Scout", "Guardian Spy", " Watchman", " Patroller",
                "Elder Blood Upholder", "Elder Blood Worshipper", "Elder Blood Follower", "Elder Blood Herald",
                "Blood Wraith", "Blood Disciple", "Strain "
            };

            _cachedResourcesByKeys.Add(KnownEwarPointTargetTags, knownEwarPointTargetTags);

            _randomWaitObject = new RandomWaitObject(ModuleName);
            _randomWaitObject.AddWait(new KeyValuePair <int, int>(30, 70), 5);
            _randomWaitObject.AddWait(new KeyValuePair <int, int>(5, 15), 10);
        }
예제 #5
0
        public NonOffensive(IMeCache meCache, IMiningConfiguration miningConfiguration, IDefensiveConfiguration defensiveConfiguration, IEntityProvider entityProvider,
                            ITargetQueue targetQueue, IShip ship, IDrones drones, ITargeting targeting, IMovement movement)
        {
            _meCache                = meCache;
            _miningConfiguration    = miningConfiguration;
            _defensiveConfiguration = defensiveConfiguration;
            _entityProvider         = entityProvider;
            _targetQueue            = targetQueue;
            _ship      = ship;
            _drones    = drones;
            _targeting = targeting;
            _movement  = movement;

            ModuleManager.ModulesToPulse.Add(this);
            PulseFrequency = 1;
            ModuleName     = "NonOffensive";

            _randomWait.AddWait(new KeyValuePair <int, int>(16, 30), 1);
            _randomWait.AddWait(new KeyValuePair <int, int>(6, 15), 3);
            _randomWait.AddWait(new KeyValuePair <int, int>(3, 5), 6);
            _randomWait.AddWait(new KeyValuePair <int, int>(1, 2), 10);
        }
 public ChangeTimeBaseQueue(ITargetQueue <T> output, AVRational from, AVRational to)
 {
     _output = output;
     _from   = from;
     _to     = to;
 }
예제 #7
0
        public override bool Initialize()
        {
            IsCleanedUpOutOfFrame = false;

            _isxeveProvider    = new IsxeveProvider();
            _eveWindowProvider = new EveWindowProvider();

            #region Core object construction
            //Background stuff
            Logging     = new Logging();
            LogCallback = LogIsxeveMessage;
            Tracing.AddCallback(LogCallback);

            _mathUtility        = new MathUtility();
            Statistics          = new Statistics();
            EventCommunications = new EventCommunications(Logging);
            FileManager         = new FileManager();

            //moduleManager and BehaviorManager
            ModuleManager = new ModuleManager(_isxeveProvider, _eveWindowProvider);

            //Me cache. Contains the other caches.
            MeCache = new MeCache(_isxeveProvider, _eveWindowProvider);

            //ConfigurationManager
            Config = new Configuration();
            ConfigurationManager = new ConfigurationManager(Config, MeCache);

            Ship = new Ship(_isxeveProvider, _eveWindowProvider, MeCache, MeCache.Ship, Config.CargoConfig, Statistics, Config.MovementConfig);

            //Entity Populator object
            EntityProvider = new EntityProvider(_isxeveProvider);

            //Other Cache and Data classes
            MissionCache = new MissionCache(_isxeveProvider, _eveWindowProvider);
            AgentCache   = new AgentCache(FileManager, MeCache, Config, _eveWindowProvider);

            BookMarkCache  = new BookMarkCache(MeCache, EntityProvider, Logging, _isxeveProvider);
            NpcBountyCache = new NpcBountyCache();
            //EVEDB modules
            PilotCache       = new PilotCache();
            AllianceCache    = new AllianceCache(FileManager);
            CorporationCache = new CorporationCache();
            MissionDatabase  = new MissionDatabase();
            PossibleEwarNpcs = new PossibleEwarNpcs();

            //Core Functionality Providers, not necessarily caches
            TargetQueue          = new TargetQueue(MeCache, EntityProvider, Config.MiningConfig, Config.MainConfig);
            JetCan               = new JettisonContainer(_eveWindowProvider);
            Social               = new Social(_isxeveProvider);
            Station              = new Station(_isxeveProvider, _eveWindowProvider);
            AsteroidBelts        = new AsteroidBelts(Config, MeCache, EntityProvider, BookMarkCache, Ship);
            Bookmarks            = new Bookmarks(MeCache, Station, Config, BookMarkCache, AsteroidBelts, _isxeveProvider);
            Drones               = new Drones(_isxeveProvider);
            Fleet                = new Fleet();
            Alerts               = new Alerts(Config, MeCache, Logging);
            _anomalyProvider     = new AnomalyProvider(MeCache.Ship);
            _anomalyClaimTracker = new AnomalyClaimTracker(Logging, EventCommunications, MeCache);
            _safespots           = new Safespots(MeCache, BookMarkCache, Config.MovementConfig, MeCache.ToEntity, EntityProvider, _isxeveProvider, Ship, Social, _mathUtility, Logging);

            Attackers = new Attackers(MeCache, Config, Ship, Drones, EntityProvider, Alerts, AsteroidBelts, PossibleEwarNpcs, TargetQueue, ModuleManager);
            #endregion

            #region ActionModule construction
            //Action classes
            Movement     = new Movement(_isxeveProvider, EntityProvider, MeCache, _anomalyProvider, TargetQueue, Ship, Drones);
            Targeting    = new Targeting(Logging, Config.MaxRuntimeConfig, MeCache, Ship, Drones, Alerts, ModuleManager, TargetQueue, EntityProvider, Movement);
            Offensive    = new Offensive(Logging, TargetQueue, EntityProvider);
            NonOffensive = new NonOffensive(MeCache, Config.MiningConfig, Config.DefenseConfig, EntityProvider, TargetQueue, Ship, Drones, Targeting, Movement);
            Defense      = new Defense(_isxeveProvider, EntityProvider, Ship, MeCache, Config.DefenseConfig, Social, Drones, Alerts, _safespots, Movement);
            #endregion

            #region Processor construction
            MissionProcessor = new MissionProcessor(_eveWindowProvider, Movement);
            #endregion

            #region BehaviorModule construction
            _moveToDropOffLocationPartialBehavior = new MoveToDropOffLocationPartialBehavior(Movement, EntityProvider, Config.CargoConfig, BookMarkCache, Bookmarks,
                                                                                             Config.MovementConfig, MeCache, _mathUtility, _isxeveProvider);
            _dropOffCargoPartialBehavior = new DropOffCargoPartialBehavior(_eveWindowProvider, Config.CargoConfig, Config.MainConfig, Config.MiningConfig,
                                                                           MeCache, Ship, Station, JetCan, EntityProvider, EventCommunications);

            //Behavior classes
            BehaviorManager = new BehaviorManager();
            Mining          = new Mining(Config.CargoConfig, Config.MainConfig, MeCache, Ship, EntityProvider,
                                         _safespots, Movement, Social, Config.MovementConfig, AsteroidBelts, _moveToDropOffLocationPartialBehavior, _dropOffCargoPartialBehavior, Config.MiningConfig,
                                         _isxeveProvider, BookMarkCache, TargetQueue);
            Hauler = new Hauler(_eveWindowProvider, Config.CargoConfig, Config.MainConfig, Config.MiningConfig, MeCache, Ship, Station, JetCan, EntityProvider, EventCommunications,
                                _safespots, Movement, BookMarkCache, _moveToDropOffLocationPartialBehavior);
            BoostCanOrca = new BoostCanOrca();
            BoostOrca    = new BoostOrca(BookMarkCache, Config.MiningConfig, Bookmarks, _safespots, Movement, Config.MainConfig, Ship, MeCache);
            Freighter    = new Freighter(_eveWindowProvider, Config.CargoConfig, Config.MainConfig,
                                         Config.MiningConfig, MeCache, Ship, Station, JetCan, EntityProvider, EventCommunications, _moveToDropOffLocationPartialBehavior, _dropOffCargoPartialBehavior, Movement);
            MissionRunner     = new MissionRunner(Config, MissionCache, AgentCache, _eveWindowProvider);
            JumpStabilityTest = new JumpStabilityTest();
            Ratting           = new Ratting(Social, MeCache, Bookmarks, Config.SalvageConfig, Config.RattingConfig, _anomalyProvider, EntityProvider, _anomalyClaimTracker, _safespots,
                                            Movement, Ship, AsteroidBelts, Config.MovementConfig, Alerts, TargetQueue, Attackers);
            #endregion

            //StealthBotUI Interop construction
            //SbUiCommunication = new SbUiCommunication();

#if DEBUG
            LavishScript.ExecuteCommand("ISXEVE:Debug_SetHighPerfLogging[1]");
#endif

            return(true);
        }
예제 #8
0
        public IInputContext PrepareVersion(UpdateVersionContext update, ITargetQueue <Packet> outputQueue, InputSetup setup)
        {
            update.RuntimeConfig.Add(this, setup);
            update.AddDeploy(() =>
            {
                bool startOpenThread = false;
                lock (this)
                {
                    var last        = _inputThreadCurrentContext;
                    bool sameConfig = last != null && last.ContextSetup.Equals(setup);
                    bool sameDevice = last != null && last.ContextSetup.Input.Equals(setup.Input);
                    if (!sameConfig)
                    {
                        Core.LogInfo($"Change {_name}: {last?.ContextSetup} >> {setup}");
                    }

                    int version = update.Version;
                    var ver     = new ContextVersion <IInputContext, InputSetup, Packet>
                    {
                        Version      = version,
                        ContextSetup = setup,
                        OutputQueue  = outputQueue,
                    };

                    if (sameConfig)
                    {
                        ver.Context = last.Context.AddRef();

                        _inputThreadPendingContext?.Dispose();
                        _inputThreadPendingContext = ver;
                    }
                    else
                    {
                        if (sameDevice || last == null || _openThreadDenied)
                        {
                            _inputThreadPendingContext?.Dispose();
                            _inputThreadPendingContext = ver;

                            if (_inputThreadCurrentContext != null && _inputThreadCurrentContext.Context != null)
                            {
                                _inputThreadCurrentContext.Context.Instance.Interrupt();
                            }
                        }
                        else
                        {
                            _openThreadPendingContext?.Dispose();
                            _openThreadPendingContext = ver;

                            if (_openThreadRunningContext != null && _openThreadRunningContext.Context != null)
                            {
                                _openThreadRunningContext.Context.Instance.Interrupt();
                            }

                            if (!_openThreadIsRunning)
                            {
                                _openThreadIsRunning = true;
                                startOpenThread      = true;
                            }
                        }
                    }
                }

                if (!_inputThreadIsRunning)
                {
                    _inputThreadIsRunning = true;
                    _inputThread.Start();
                }
                if (startOpenThread)
                {
                    _openThread      = new Thread(() => OnOpenThread());
                    _openThread.Name = $"Streamer:{Name} input-open thread";
                    _openThread.Start();
                }
            });

            var last = _inputThreadCurrentContext;

            // same config and at least one time opened
            return((last != null && last.Context != null && last.Context.Instance.Config != null) ? last.Context.Instance : null);
        }
예제 #9
0
        public TContext PrepareVersion(UpdateVersionContext update, ISourceQueue <TInput> inputQueue, ITargetQueue <TOutput> outputQueue, TContextConfig setup, Action <TContext, bool> prepareContext = null, int uniqueVersionsLimit = int.MaxValue)
        {
            update.RuntimeConfig.Add(this, setup);

            var  last          = _versions.Last?.Value;// no need to sync as it is changed from the same thread
            bool sameConfig    = last != null && last.ContextSetup.Equals(setup);
            int  uniqueVersion = last?.UniqueContextVersion ?? 0;

            if (!sameConfig)
            {
                uniqueVersion++;
                if (last != null)
                {
                    Core.LogInfo($"Change {Name}: {last.ContextSetup} >> {setup}");
                }
                else
                {
                    Core.LogInfo($"Change {Name}:  >> {setup}");
                }
            }

            var ctx = sameConfig ? last.Context.AddRef() : CreateAndOpenContextRef(setup);
            ContextVersion <TContext, TContextConfig, TOutput> pending = new ContextVersion <TContext, TContextConfig, TOutput>
            {
                Version              = update.Version,
                Context              = ctx,
                ContextSetup         = setup,
                OutputQueue          = outputQueue,
                UniqueContextVersion = uniqueVersion
            };

            update.AddDeploy(() =>
            {
                lock (this)
                {
                    if (_versions.Last != null)
                    {
                        _versions.Last.Value.TimeWhenOutdated = DateTime.UtcNow;
                    }
                    _versions.AddLast(pending);

                    InputQueue = inputQueue;
                    if (inputQueue != null)
                    {
                        InputQueue.OnChanged = Activate;
                    }

                    prepareContext?.Invoke(pending.Context.Instance, sameConfig);
                    _uniqueVersionsLimit = uniqueVersionsLimit;
                    TryRemoveOldVersions();
                }
            });
            return(pending.Context.Instance);
        }
예제 #10
0
 public SetSourceIdQueue(ITargetQueue <T> output, int sourceId)
 {
     _output   = output;
     _sourceId = sourceId;
 }