/// <summary> /// Starts a new trade if a SteamID is available. If a trade is already open, it is /// closed and another is started. If Bot inventory is approaching maximum, /// AutoCraftAll() will be called. /// </summary> private void BeginNextTrade(SteamID tradeSID) { OtherInit = false; MeInit = false; // Thread.Sleep(100); // May change to smart inventory tracking to avoid getting inventory before every trade. Bot.GetInventory(); if (Bot.MyInventory.Items.Length > (Bot.MyInventory.NumSlots - 20)) { if (AutoCraftWeps) { AutoCraftAll(); } else { Log.Warn("Backpack approaching maximum capacity. May not be able to trade soon..."); } } else if (Bot.MyInventory.Items.Length >= Bot.MyInventory.NumSlots) { Log.Error("Backpack is at or over maximum capacity. Trade is unlikely to succeed."); } Log.Info("Starting Trade with: " + tradeSID); if (!Bot.OpenTrade(tradeSID)) { Log.Info("Bot already in trade, closing and starting another."); } }