Beispiel #1
0
        public void EndTrade(CustomerInfo customer, bool succeed = false)
        {
            _loggerService.Log("Trade succeed with " + CurrentCustomer.Nickname);
            CurrentCustomer = null;
            CommandsService.KickFormParty(customer);
            if (succeed)
            {
                Win32.ChatCommand($"@{customer.Nickname} ty gl");
                CompletedTrades.Add(customer);
                _loggerService.Log("Trade comlete sucessfully");
            }
            else
            {
                _loggerService.Log($"Trade failed with {customer.Nickname}");
            }

            Customers.Remove(customer);

            if (!_StashHelper.OpenStash())
            {
                _loggerService.Log("Stash not found. I cant clean inventory after trade.");
            }
            else
            {
                if (succeed)
                {
                }
                else
                {
                    PutItemBack(customer);
                }
            }
            _InTrade = false;
        }
Beispiel #2
0
        private void RequestTrade()
        {
            _InTrade       = true;
            TradinngThread = new Thread(() =>
            {
                if (Win32.GetActiveWindowTitle() != "Path of Exile")
                {
                    Win32.PoE_MainWindow();
                }

                if (CurrentCustomer == null)
                {
                    Thread.CurrentThread.Abort();
                    return;
                }

                // check if im invited
                if (!AcceptTradeRequest())
                {
                    // Send trade request
                    SendTradeRequest();
                }
                // Move items to trade window
                while (!IsTradeStarted())
                {
                    Thread.Sleep(100);
                }

                if (!PutItems())
                {
                    _InTrade = false;
                    // TODO add actio to end trade if cant put items
                    Win32.ChatCommand($"@{CurrentCustomer.Nickname} Item gone, sorry");
                    CommandsService.KickFormParty(CurrentCustomer);
                    Thread.CurrentThread.Abort();
                    return;
                }

                // validate until cancel or ok
                bool IsNotPaidYet = true;
                while (IsNotPaidYet)
                {
                    IsNotPaidYet = !CheckTradeCurrency();
                }
                // accept trade
                while (!AccepTrade())
                {
                    Thread.Sleep(100);
                }
                Thread.CurrentThread.Abort();
            });
            TradinngThread.SetApartmentState(ApartmentState.STA);
            TradinngThread.Start();
        }