private bool ProcessAPI(CustomerInfo customer) { // Trade Ready let's send the Invite if (!BotEngineUtils.InviteCustomer(customer)) { return(false); } switch (customer.ApiAction) { case CustomerInfo.ApiActions.TAKE: if (!ApiTakeCurrency(customer)) { return(NotifyItemSold(customer)); } break; case CustomerInfo.ApiActions.GET: break; case CustomerInfo.ApiActions.PUT: break; } return(ApiMakeTrade(customer)); }
private void StartTrader_PoEbota() { while (true) { if (!Statics.CustomerQueue.Any() || ClientManager.Instance.IsAFKTick) { Thread.Sleep(500); continue; } // We have a customer in queue CustomerInfo customer = Statics.CustomerQueue.First(); if (customer.OrderType == CustomerInfo.OrderTypes.CURRENCY && ProcessCurrencySale(customer)) { ClientManager.Instance.ChatCommand($"@{customer.Nickname} Thank you for the trade."); } if (customer.OrderType == CustomerInfo.OrderTypes.ITEM && ProcessItemSale(customer)) { ClientManager.Instance.ChatCommand($"@{customer.Nickname} Thank you for the trade."); } if (customer.OrderType == CustomerInfo.OrderTypes.API && ProcessAPI(customer)) { ClientManager.Instance.ChatCommand($"@{customer.Nickname} Thank you for the trade."); } // Cleanup After Trade - We are going to send the Kick command even if we didn't add customer BotEngineUtils.KickFromParty(customer); if (!ClientManager.Instance.ClearInventory()) { Logger.Console.Error("Stash not found. I cant clean inventory after trade."); } Statics.CompletedTrades.Add(customer); Statics.CustomerQueue.Remove(customer); Logger.Console.Info("Trade Complete"); ClientManager.Instance.SendKey("{ESC}"); } }
private bool ProcessCurrencySale(CustomerInfo customer) { if (!ClientManager.Instance.OpenStash()) { return(NotifyItemSold(customer)); // We have an issue opening the Stash } if (!TakeCurrency(customer)) { return(NotifyItemSold(customer)); } // Trade Ready let's send the Invite if (!BotEngineUtils.InviteCustomer(customer)) { return(false); } return(MakeTrade(customer)); }