示例#1
0
        void HandleTradeCommand(string msg, SteamID sender)
        {
            var pendingTrades = PendingTrades.ToList();

            foreach (var trade in pendingTrades)
            {
                if (trade.Target == sender)
                {
                    Logger.WriteLine("User already in trade queue, ignoring request...");
                    return;
                }
            }

            if (pendingTrades.Count != 0)
            {
                SteamFriends.SendChatMessage(sender, EChatEntryType.ChatMsg,
                                             string.Format("You were added to the trade queue at pos #{0}.",
                                                           pendingTrades.Count + 1));
            }

            var request = new TradeRequest();

            request.Timestamp = DateTime.Now;
            request.Target    = sender;

            PendingTrades.Enqueue(request);
        }
示例#2
0
        void ProcessTradeEvents()
        {
            // If we are not running a trade and are not waiting for the response
            // of a pending trade request, then we should dequeue a new trade.

            bool hasTrade         = CurrentTrade != null || PendingTradeRequest != null;
            bool hasPendingTrades = PendingTrades.Count > 0;

            if (!hasTrade && hasPendingTrades)
            {
                PendingTradeRequest = PendingTrades.Dequeue();
                SteamTrading.RequestTrade(PendingTradeRequest.Target);
                PendingTradeTimer.Change(PendingTradeTimeout, TimeSpan.FromTicks(-1));
            }

            ProcessCurrentTrade();
        }
示例#3
0
        void ProcessTradeEvents()
        {
            // If we are not running a trade and are not waiting for the response
            // of a pending trade request, then we should dequeue a new trade.

            bool hasTrade = CurrentTrade != null || PendingTradeRequest != null;
            bool hasPendingTrades = PendingTrades.Count > 0;

            if (!hasTrade && hasPendingTrades)
            {
                PendingTradeRequest = PendingTrades.Dequeue();
                SteamTrading.RequestTrade(PendingTradeRequest.Target);
                PendingTradeTimer.Change(PendingTradeTimeout, TimeSpan.FromTicks(-1));
            }

            ProcessCurrentTrade();
        }
示例#4
0
 void ResetPendingTrade()
 {
     PendingTradeRequest = null;
     PendingTradeTimer.Change(Timeout.Infinite, Timeout.Infinite);
 }
示例#5
0
 void ResetPendingTrade()
 {
     PendingTradeRequest = null;
     PendingTradeTimer.Change(Timeout.Infinite, Timeout.Infinite);
 }