private void Update() { var response = Client.GetAsync($"https://poe.ninja/api/data/currencyoverview?league={Properties.Settings.Default.League}&type=Currency&language=en").Result; var responseBody = response.Content.ReadAsStringAsync().Result; var ExchangeRatesJson = JsonConvert.DeserializeObject <CurrenciesJson>(responseBody); CurrenciesList.Clear(); foreach (Line l in ExchangeRatesJson.Lines) { Currency_ExRate c = new Currency_ExRate(l.CurrencyTypeName, l.ChaosEquivalent); CurrenciesList.Add(c); } CurrenciesList.Add(new Currency_ExRate("Chaos Orb", 1)); foreach (CurrencyDetail cd in ExchangeRatesJson.CurrencyDetails) { var img = "Assets/Currencies/" + cd.Name.ToLower().Replace(" ", "") + ".png"; if (!File.Exists(img)) { using (WebClient client = new WebClient()) { client.DownloadFile(cd.Icon, img); } } } _LoggerService.Log("Curencies updated!"); }
private void ReadLogsInBack() { if (isReading) { return; } isReading = true; using (FileStream fs = new FileStream(PoE_Logs_File, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using (var sr = new StreamReader(fs)) { int li = 0; string ll = string.Empty; while (!sr.EndOfStream) { li++; ll = sr.ReadLine(); if (not_first && li > last_index) { if (ll.Contains($"{Properties.Settings.Default.PreppendInfoClient} [INFO Client")) { _LoggerService.Log(ll); if (ll.Contains("AFK mode is now ON")) { AFK.Invoke(this, new EventArgs()); } else if (ll.Contains("has left the area")) { CustomerLeft.Invoke(this, new TradeArgs { CustomerName = GetCustomerNick(ll) }); } else if (ll.Contains("has joined the area")) { CustomerArrived.Invoke(this, new TradeArgs { CustomerName = GetCustomerNick(ll) }); } else if (ll.Contains("Trade accepted")) { TradeAccepted.Invoke(this, new TradeArgs { }); } else if (ll.Contains("Trade cancel")) { TradeCanceled.Invoke(this, new TradeArgs { }); } else if (ll.Contains("@")) { var customer = GetInfo(ll); if (customer != null) { TradeRequest.Invoke(this, new TradeArgs { customer = customer }); } } } } } if (li > last_index) { last_index = li; if (!not_first) { not_first = true; } } isReading = false; } } }
public bool OpenTab(string stash_tab) { _LoggerService.Log($"Search {stash_tab} trade tab..."); var screen = ScreenCapture.CaptureScreen(); var position = OpenCV_Service.ContainsText(screen, stash_tab); if (position != null) { Win32.MoveTo(position.Center.X, position.Center.Y); Thread.Sleep(50); Win32.DoMouseClick(); } return(false); }
private bool GetProduct() { int x_inventory = 925; int y_inventory = 440; int offset = 37; Bitmap screen_shot; for (int j = 0; j < 12; j++) { for (int i = 0; i < 5; i++) { Win32.MoveTo(x_inventory + offset * j, y_inventory + 175); Thread.Sleep(100); screen_shot = ScreenCapture.CaptureRectangle(x_inventory - 30 + offset * j, y_inventory - 30 + offset * i, 60, 60); Position pos = OpenCV_Service.FindObject(screen_shot, $"Assets/{Properties.Settings.Default.UI_Fragments}/empty_cel.png", 0.4); if (!pos.IsVisible) { Clipboard.Clear(); string ss = null; Thread.Sleep(100); Win32.MoveTo(x_inventory + offset * j, y_inventory + offset * i); var time = DateTime.Now + new TimeSpan(0, 0, 5); while (ss == null) { Win32.SendKeyInPoE("^c"); ss = Win32.GetText(); if (time < DateTime.Now) { ss = "empty_string"; } } if (ss == "empty_string") { continue; } if (CurrentCustomer.Product.Contains(CommandsService.GetNameItem_PoE(ss))) { _LoggerService.Log($"{ss} is found in inventory"); Win32.CtrlMouseClick(); screen_shot.Dispose(); return(true); } } screen_shot.Dispose(); } } Win32.SendKeyInPoE("{ESC}"); Win32.ChatCommand("@" + CurrentCustomer.Nickname + " I sold it, sry"); return(false); }