private bool CheckTradeCurrency() { if (Win32.GetActiveWindowTitle() != "Path of Exile") { Win32.PoE_MainWindow(); } Item currency; List <Item> lCurrency = new List <Item>(); double totalChaos = 0; Bitmap cell; Bitmap template = new Bitmap($"Assets/{Properties.Settings.Default.UI_Fragments}/empty_cel2.png"); Win32.MoveTo(0, 0); Thread.Sleep(100); for (int i = 0; i < 12; i++) { for (int j = 0; j < 5; j++) { int xInit = x_trade + (tab_width * i) - i / 2; int yInit = y_trade + (tab_height * j) - j / 2; cell = ScreenCapture.CaptureRectangle(xInit, yInit, tab_width, tab_height); if (!OpenCV_Service.Match(cell, template, 0.80f)) { Win32.MoveTo(xInit + (tab_width / 2), yInit + (tab_height / 2)); Thread.Sleep(100); string clip = CommandsService.CtrlC_PoE(); currency = _ItemService.GetCurrency(clip); if (currency != null) { lCurrency.Add(currency); totalChaos += currency.Price.Cost; } } } } // validate price if (CurrentCustomer != null) { // Check value if (CurrentCustomer.Chaos_Price < totalChaos) { return(true); } } return(false); }