Exemplo n.º 1
0
        public void Execute(Character character)
        {
            Character = character;
            _itemsScanned = 0;
            _ordersCreated = 0;

            if (!IsEveRunningForSelectedCharacter())
                throw new Exception("Auto investor ould not find EVE Client for selected character.");
            Mouse.PointAndClick(Left, EveUi.MarketCloseButton, 0, 5, 5);
            GetCurrentOrders(character);
            List<String> potentialInvestments = GeneratePotentialInvestments();
            String pageIdentifier = GenerateInvestmentHtml(potentialInvestments);
            OpenBrowserWindow();
            NavigateToInvestmentsPage(pageIdentifier);

            try
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                CreateInvestments(potentialInvestments.Count);

                stopwatch.Stop();
                Logger.Log(character.Name + ": AI scanned " + _itemsScanned + " and made " + _ordersCreated +
                           " buys " + stopwatch.Elapsed.ToString());
            }
            catch (Exception e)
            {
                Logger.Log("Auto investor failed to complete run.");
                Logger.LogError(e.Message);
            }
        }
Exemplo n.º 2
0
        public void Login(Character character)
        {
            Character = character;

            if (!IsEveRunningForSelectedCharacter())
            {
                try
                {
                    LaunchClient();
                    SwapInUserSettings(character);
                    EnterCredentials();
                    SelectCharacter();
                    WaitForEnvironment();
                }
                catch (Exception e)
                {
                    Logger.Log(character.Name + e.Message);
                    throw;
                }
            }
            else
            {
                WaitForEnvironment();
            }
        }
Exemplo n.º 3
0
 public AutoInvestor(ClientConfig clientConfig, EveUi ui, Paths paths, Character character,
     Modules modules, OrderAnalyzer orderAnalyzer)
     : base(clientConfig, ui, paths, character, modules, orderAnalyzer)
 {
     _marketOrderio = new MarketOrderio();
     _marketOrderio.Path = paths.LogPath;
 }
Exemplo n.º 4
0
        public void Execute(Character character)
        {
            Character = character;
            if (!IsEveRunningForSelectedCharacter())
                return;

            var stopwatch = new Stopwatch();
            stopwatch.Start();

            try
            {
                Prepare();
            }
            catch (Exception)
            {
                Logger.Log("AL failed to prepare environment!");
                throw;
            }

            if (character.ShouldTradeItems && FreeOrders > 0)
                Trade(TradeItems, ItemHangarHotkey, ItemTerminalId);
            if (character.ShouldTradeShips && FreeOrders > 0)
                Trade(TradeShips, ShipHangarHotkey, ShipTerminalItemId);

            stopwatch.Stop();

            Teardown(stopwatch.Elapsed.ToString());
        }
Exemplo n.º 5
0
        public void Execute(Character character)
        {
            if (!character.ShouldAdjustBuys && !character.ShouldAdjustSells)
                return;
            Character = character;

            try
            {
                Prepare();
            }
            catch (Exception)
            {
                Logger.Log("AA failed to prepare environment!");
                throw;
            }

            var stopwatch = new Stopwatch();
            stopwatch.Start();

            if (character.ShouldAdjustBuys)
                Adjust(true, EveUi.WalletBuyListFirstRow, EveUi.WalletBuyListSortByType, EveUi.WalletVisibleRows[EtConstants.Buy]);
            if (character.ShouldAdjustSells)
                Adjust(false, EveUi.WalletSellListFirstRow, EveUi.WalletSellListSortByType, EveUi.WalletVisibleRows[EtConstants.Sell]);

            stopwatch.Stop();
            Logger.Log(character.Name + ": AA scanned " + _numScanned + ", adjusted " + _numModified + " in " +
                       stopwatch.Elapsed.ToString());
        }
Exemplo n.º 6
0
 public AutoAdjuster(ClientConfig clientConfig, EveUi eveUi, Paths paths, Character character,
     Modules modules, OrderAnalyzer orderAnalyzer, OrderReviewer orderReviewer)
     : base(clientConfig, eveUi, paths, character, modules, orderAnalyzer)
 {
     _orderReviewer = orderReviewer;
     _marketOrderio = new MarketOrderio {Path = paths.LogPath};
 }
Exemplo n.º 7
0
 public AutoLister(ClientConfig clientConfig, EveUi eveUi, Paths paths, Character character,
     Modules modules, OrderAnalyzer orderAnalyzer)
     : base(clientConfig, eveUi, paths, character, modules, orderAnalyzer)
 {
     _marketOrderio = new MarketOrderio {Path = paths.LogPath};
     FreeOrders = 0;
     _pixelReader = new PixelReader();
 }
Exemplo n.º 8
0
 public void AddCharacter(Character character)
 {
     if (_characters.ContainsKey(character.Name))
     {
         _characters.Remove(character.Name);
     }
     _characters.Add(character.Name, character);
 }
Exemplo n.º 9
0
 public LoginBot(ClientConfig clientConfig, EveUi eveUi, Paths paths, Character character,
     OrderAnalyzer orderAnalyzer
     )
     : base(clientConfig, eveUi, paths, character, orderAnalyzer)
 {
     _pixelReader = new PixelReader(EveUi.CharacterSelectActiveSlot[0] - 5,
                                   EveUi.CharacterSelectActiveSlot[1] - 5);
 }
Exemplo n.º 10
0
        public GuiBot(ClientConfig clientConfig, EveUi eveUi, Paths paths, Character character,
            OrderAnalyzer orderAnalyzer)
        {
            ClientConfig = clientConfig;
            EveUi = eveUi;
            Paths = paths;
            Character = character;
            Logger = EventDispatcher.Instance;
            Timing = clientConfig.TimingMultiplier;
            Mouse = new Mouse(clientConfig.TimingMultiplier);
            Keyboard = new Keyboard();
            ErrorParser = new ErrorParser();
            OrderAnalyzer = orderAnalyzer;

            _shortContextMenuAdjustment = -eveUi.StandardRowHeight;
        }
Exemplo n.º 11
0
 public Dictionary<String, String> ConvertCharacterToDictionary(Character character)
 {
     var result = new Dictionary<String, String>
                      {
                          {EtConstants.AccountLoginKey, character.Account.UserName},
                          {EtConstants.AccountPasswordKey, character.Account.Password},
                          {EtConstants.AccountIdKey, character.Account.Id},
                          {EtConstants.CharacterIdKey, character.Id},
                          {EtConstants.CharacterStationIdKey, Convert.ToString(character.StationId)},
                          {EtConstants.CharacterTradeItemsKey, Convert.ToString(character.ShouldTradeItems)},
                          {EtConstants.CharacterTradeShipsKey, Convert.ToString(character.ShouldTradeShips)},
                          {EtConstants.CharacterAdjustBuysKey, Convert.ToString(character.ShouldAdjustBuys)},
                          {EtConstants.CharacterAdjustSellsKey, Convert.ToString(character.ShouldAdjustSells)},
                          {EtConstants.CharacterMaximumOrdersKey, Convert.ToString(character.MaximumOrders)},
                          {EtConstants.CharacterLoginColorKey, Convert.ToString(character.LoginColor)},
                          {
                              EtConstants.CharacterActiveState,
                              Convert.ToString(ActiveCharacters.Contains(character.Name))
                              }
                      };
     return result;
 }
Exemplo n.º 12
0
 private void GetCurrentOrders(Character character)
 {
     ExportOrders(4, 30);
     if (OrderAnalyzer.OrderSet.GetNumberOfActiveOrders() >= character.MaximumOrders)
     {
         throw new Exception(
             "This character already has the maximum number of orders! Cannot create additional investments");
     }
 }
Exemplo n.º 13
0
        private void Automate(Character character)
        {
            LoginBot.Login(character);

            _autoAdjuster.Execute(character);
            _characterManager.Save(character.Name);

            if (_autoAdjuster.GetNumberOfFreeOrders() < 5)
                return;

            _autoLister.Execute(character);
            _characterManager.Save(character.Name);

            if (_autoLister.FreeOrders < 5)
                return;

            _autoInvestor.Execute(character);
            _characterManager.Save(character.Name);
        }
Exemplo n.º 14
0
        private Character Load(string name)
        {
            List<String> characterData = _textFileio.Read(_paths.ConfigPath, name + ".ini");
            var character = new Character(name);

            var characterSettings = new Dictionary<string, string>();
            var threshholdPrices = new List<int>();
            var threshholdQuantities = new List<int>();

            foreach (string line in characterData)
            {
                string[] split = line.Split('=');

                if (split[0].Equals(EtConstants.CharacterThreshholdPrice))
                {
                    threshholdPrices.Add(int.Parse(split[1]));
                }
                else if (split[0].Equals(EtConstants.CharacterThreshholdQuantity))
                {
                    threshholdQuantities.Add(int.Parse(split[1]));
                }
                else
                {
                    characterSettings.Add(split[0], split[1]);
                }
            }

            var account = new Account(characterSettings[EtConstants.AccountLoginKey],
                                      characterSettings[EtConstants.AccountPasswordKey],
                                      characterSettings[EtConstants.AccountIdKey]);
            _accountManager.AddAccount(account);
            character.Account = account;
            character.Id = characterSettings[EtConstants.CharacterIdKey];
            character.StationId = Convert.ToInt32(characterSettings[EtConstants.CharacterStationIdKey]);
            character.ShouldTradeItems = Convert.ToBoolean(characterSettings[EtConstants.CharacterTradeItemsKey]);
            character.ShouldTradeShips = Convert.ToBoolean(characterSettings[EtConstants.CharacterTradeShipsKey]);
            character.ShouldAdjustSells = Convert.ToBoolean(characterSettings[EtConstants.CharacterAdjustSellsKey]);
            character.ShouldAdjustBuys = Convert.ToBoolean(characterSettings[EtConstants.CharacterAdjustBuysKey]);
            character.MaximumOrders = Convert.ToInt32(characterSettings[EtConstants.CharacterMaximumOrdersKey]);
            character.LoginColor = Convert.ToInt32(characterSettings[EtConstants.CharacterLoginColorKey]);

            if (Convert.ToBoolean(characterSettings[EtConstants.CharacterActiveState]))
                ActiveCharacters.Add(name);
            else
                InactiveCharacters.Add(name);

            for (int i = 0; i < threshholdPrices.Count; i++)
            {
                character.QuantityThreshHolds.Add(new[] {threshholdPrices[i], threshholdQuantities[i]});
            }
            _characters.Add(name, character);

            character.TradeQueue = LoadTradeQueue(character.Name);
            character.TradeHistory = LoadTradeHistory(character.Name);

            return character;
        }
Exemplo n.º 15
0
        private void SwapInUserSettings(Character character)
        {
            const string characterFilePrefix = "core_char_";
            const string userFilePrefix = "core_user_";
            const string fileSuffix = ".dat";

            String source = Paths.ConfigPath + Paths.ClientSettingsSubDir + characterFilePrefix + character.Id +
                            fileSuffix;
            String destination = Paths.EveSettingsPath + characterFilePrefix + character.Id + fileSuffix;
            File.Copy(source, destination, true);

            source = Paths.ConfigPath + Paths.ClientSettingsSubDir + userFilePrefix + character.Account.Id +
                     character.Name + fileSuffix;
            destination = Paths.EveSettingsPath + userFilePrefix + character.Account.Id + fileSuffix;
            File.Copy(source, destination, true);
        }
Exemplo n.º 16
0
 public OrderBot(ClientConfig clientConfig, EveUi eveUi, Paths paths, Character character,
     Modules modules, OrderAnalyzer orderAnalyzer)
     : base(clientConfig, eveUi, paths, character, orderAnalyzer)
 {
     Modules = modules;
 }