示例#1
0
        /// <summary>
        /// Gets an item from a TradeEvent, and passes it into the UserHandler's implemented OnUserRemoveItem([...]) routine.
        /// Passes in null items if something went wrong.
        /// </summary>
        /// <param name="tradeEvent">TradeEvent to get item from</param>
        /// <returns></returns>
        private void FireOnUserRemoveItem(TradeEvent tradeEvent)
        {
            ulong itemID = (ulong)tradeEvent.assetid;

            if (OtherInventory != null)
            {
                Inventory.Item item = OtherInventory.GetItem(itemID);
                if (item != null)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (schemaItem == null)
                    {
                        // TODO: Add log (counldn't find item in CurrentSchema)
                    }

                    OnUserRemoveItem(schemaItem, item);
                }
                else
                {
                    // TODO: Log this (Couldn't find item in user's inventory can't find item in CurrentSchema
                    OnUserRemoveItem(null, item);
                }
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                if (schemaItem == null)
                {
                    // TODO: Add log (counldn't find item in CurrentSchema)
                }

                OnUserRemoveItem(schemaItem, null);
            }
        }
示例#2
0
        /// <summary>
        /// Gets an item from a TradeEvent, and passes it into the UserHandler's implemented OnUserAddItem([...]) routine.
        /// Passes in null items if something went wrong.
        /// </summary>
        /// <param name="tradeEvent">TradeEvent to get item from</param>
        /// <returns></returns>
        private void FireOnUserAddItem(TradeEvent tradeEvent)
        {
            ulong itemID = tradeEvent.assetid;

            if (OtherInventory != null)
            {
                Inventory.Item item = OtherInventory.GetItem(itemID);
                if (item != null)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (schemaItem == null)
                    {
                        Console.WriteLine("User added an unknown item to the trade.");
                    }

                    OnUserAddItem(schemaItem, item);
                }
                else
                {
                    Console.WriteLine("User added an unknown item to the trade.");
                    OnUserAddItem(null, item);
                }
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                if (schemaItem == null)
                {
                    Console.WriteLine("User added an unknown item to the trade.");
                }

                OnUserAddItem(schemaItem, null);
                // todo: figure out what to send in with Inventory item.....
            }
        }
示例#3
0
 /// <summary>
 /// Removes an item with the given Defindex from the trade.
 /// </summary>
 /// <returns>
 /// Returns <c>true</c> if it found a corresponding item; <c>false</c> otherwise.
 /// </returns>
 public bool RemoveItemByDefindex(int defindex)
 {
     foreach (ulong id in myOfferedItems.Values)
     {
         Inventory.Item item = MyInventory.GetItem(id);
         if (item.Defindex == defindex)
         {
             return(RemoveItem(item.Id));
         }
     }
     return(false);
 }
示例#4
0
 /// <summary>
 /// Removes an item with the given Defindex from the trade.
 /// </summary>
 /// <returns>
 /// Returns <c>true</c> if it found a corresponding item; <c>false</c> otherwise.
 /// </returns>
 public bool RemoveItemByDefindex(int defindex)
 {
     foreach (TradeUserAssets asset in myOfferedItemsLocalCopy.Values)
     {
         Inventory.Item item = MyInventory.GetItem(asset.assetid);
         if (item != null && item.Defindex == defindex)
         {
             return(RemoveItem(item.Id));
         }
     }
     return(false);
 }
示例#5
0
        public bool ContainsItem(Inventory.Item item)
        {
            foreach (Inventory.Item InvItem in Items)
            {
                if (item.Id == InvItem.Id)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#6
0
        /// <summary>
        /// Gets an item from a TradeEvent, and passes it into the UserHandler's implemented OnUserAddItem([...]) routine.
        /// Passes in null items if something went wrong.
        /// </summary>
        /// <param name="tradeEvent">TradeEvent to get item from</param>
        /// <returns></returns>
        private void FireOnUserAddItem(TradeEvent tradeEvent)
        {
            // TODO: Add log
            // Customer removed item

            ulong itemID = tradeEvent.assetid;

            if (null != OtherInventory)
            {
                Inventory.Item item = OtherInventory.GetItem(itemID);
                if (null != item)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (null == schemaItem)
                    {
                        // TODO: Log this
                        // Could not find item in schema.
                    }

                    OnUserAddItem(schemaItem, item);
                    return;
                }
                else
                {
                    // TODO: Log this
                    // Could not find item in customer's inventory."
                    // Cannot look for item in schema.

                    OnUserAddItem(null, item);
                    return;
                }
            }
            else
            {
                // Customer inventory is private.

                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                if (null == schemaItem)
                {
                    // TODO: Log this
                    // Could not find item in schema.
                }

                OnUserAddItem(schemaItem, null);
                // todo: figure out what to send in with Inventory item.....

                return;
            }
        }
示例#7
0
        private void FireOnUserRemoveItem(TradeEvent tradeEvent)
        {
            ulong itemID = (ulong)tradeEvent.assetid;

            // TODO: Add log
            // Customer removed item [itemID]

            if (OtherInventory != null)
            {
                Inventory.Item item = OtherInventory.GetItem(itemID);
                if (null != item)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (null == schemaItem)
                    {
                        // TODO: Add log
                        // Could not find item in schema.
                    }

                    OnUserRemoveItem(schemaItem, item);
                    return;
                }
                else
                {
                    // TODO: Add log
                    // Could not find item in customer's inventory.
                    // Cannot look for item in schema.

                    OnUserAddItem(null, item);
                    return;
                }
            }
            else
            {
                // TODO: Add log
                // Customer inventory is private.

                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                if (null == schemaItem)
                {
                    // TODO: Add log
                    // Could not find item in schema.
                }

                OnUserRemoveItem(schemaItem, null);
                return;
            }
        }
示例#8
0
        private void FireOnUserRemoveItem(TradeEvent tradeEvent)
        {
            ulong itemID = (ulong)tradeEvent.assetid;

            if (OtherInventory != null)
            {
                Inventory.Item item       = OtherInventory.GetItem(itemID);
                Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                OnUserRemoveItem(schemaItem, item);
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                OnUserRemoveItem(schemaItem, null);
            }
        }
示例#9
0
        private void FireOnUserAddItem(TradeEvent tradeEvent)
        {
            ulong itemID = tradeEvent.assetid;

            if (OtherInventory != null)
            {
                Inventory.Item item       = OtherInventory.GetItem(itemID);
                Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                OnUserAddItem(schemaItem, item);
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                OnUserAddItem(schemaItem, null);
                // todo: figure out what to send in with Inventory item.....
            }
        }
示例#10
0
        /// <summary>
        /// Gets an item from a TradeEvent, and passes it into the UserHandler's implemented OnUserAddItem([...]) routine.
        /// Passes in null items if something went wrong.
        /// </summary>
        private void FireOnUserAddItem(TradeUserAssets asset)
        {
            if (MeIsReady)
            {
                SetReady(false);
            }

            if (OtherInventory != null && !OtherInventory.IsPrivate)
            {
                Inventory.Item item = OtherInventory.GetItem(asset.assetid);
                if (item != null)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (schemaItem == null)
                    {
                        Console.WriteLine("User added an unknown item to the trade.");
                    }

                    OnUserAddItem(schemaItem, item);
                }
                else
                {
                    item = new Inventory.Item
                    {
                        Id        = asset.assetid,
                        AppId     = asset.appid,
                        ContextId = asset.contextid
                    };
                    //Console.WriteLine("User added a non TF2 item to the trade.");
                    OnUserAddItem(null, item);
                }
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(asset);
                if (schemaItem == null)
                {
                    Console.WriteLine("User added an unknown item to the trade.");
                }

                OnUserAddItem(schemaItem, null);
                // todo: figure out what to send in with Inventory item.....
            }
        }
示例#11
0
        /// <summary>
        /// Gets an item from a TradeEvent, and passes it into the UserHandler's implemented OnUserRemoveItem([...]) routine.
        /// Passes in null items if something went wrong.
        /// </summary>
        /// <returns></returns>
        private void FireOnUserRemoveItem(TradeUserAssets asset)
        {
            if (MeIsReady)
            {
                SetReady(false);
            }

            if (OtherInventory != null)
            {
                Inventory.Item item = OtherInventory.GetItem(asset.assetid);
                if (item != null)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (schemaItem == null)
                    {
                        // TODO: Add log (counldn't find item in CurrentSchema)
                    }

                    OnUserRemoveItem(schemaItem, item);
                }
                else
                {
                    // TODO: Log this (Couldn't find item in user's inventory can't find item in CurrentSchema
                    item = new Inventory.Item
                    {
                        Id        = asset.assetid,
                        AppId     = asset.appid,
                        ContextId = asset.contextid
                    };
                    OnUserRemoveItem(null, item);
                }
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(asset);
                if (schemaItem == null)
                {
                    // TODO: Add log (counldn't find item in CurrentSchema)
                }

                OnUserRemoveItem(schemaItem, null);
            }
        }
示例#12
0
        /// <summary>
        /// Removes all offered items from the trade.
        /// </summary>
        /// <returns>Number of items removed.</returns>
        public uint RemoveAllItems()
        {
            uint removed = 0;

            var copy = new Dictionary <int, ulong>(myOfferedItems);

            foreach (var id in copy)
            {
                Inventory.Item item = MyInventory.GetItem(id.Value);

                bool success = RemoveItem(item.Id);

                if (success)
                {
                    removed++;
                }
            }

            return(removed);
        }
示例#13
0
        /// <summary>
        /// Removes all offered items from the trade.
        /// </summary>
        /// <returns>Number of items removed.</returns>
        public uint RemoveAllItems()
        {
            uint numRemoved = 0;

            foreach (var id in steamMyOfferedItems.Values.ToList())
            {
                Inventory.Item item = MyInventory.GetItem(id);

                if (item != null)
                {
                    bool wasRemoved = RemoveItem(item.Id);

                    if (wasRemoved)
                    {
                        numRemoved++;
                    }
                }
            }

            return(numRemoved);
        }
示例#14
0
        /// <summary>
        /// Removes all offered items from the trade.
        /// </summary>
        /// <returns>Number of items removed.</returns>
        public uint RemoveAllItems()
        {
            uint numRemoved = 0;

            foreach (TradeUserAssets asset in myOfferedItemsLocalCopy.Values.ToList())
            {
                Inventory.Item item = MyInventory.GetItem(asset.assetid);

                if (item != null)
                {
                    bool wasRemoved = RemoveItem(item.Id);

                    if (wasRemoved)
                    {
                        numRemoved++;
                    }
                }
            }

            return(numRemoved);
        }
示例#15
0
        /// <summary>
        /// Gets an item from a TradeEvent, and passes it into the UserHandler's implemented OnUserRemoveItem([...]) routine.
        /// Passes in null items if something went wrong.
        /// </summary>
        /// <param name="tradeEvent">TradeEvent to get item from</param>
        /// <returns></returns>
        private void FireOnUserRemoveItem(TradeEvent tradeEvent)
        {
            ulong itemID = (ulong) tradeEvent.assetid;
            Inventory.Item item;

            if (OtherInventory != null)
            {
                item = OtherInventory.GetItem(itemID);
                if (item != null)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (schemaItem == null)
                    {
                        // TODO: Add log (counldn't find item in CurrentSchema)
                    }

                    OnUserRemoveItem(schemaItem, item);
                }
                else
                {
                    // TODO: Log this (Couldn't find item in user's inventory can't find item in CurrentSchema
                    item = new Inventory.Item()
                    {
                        Id = itemID,
                        AppId = tradeEvent.appid,
                        ContextId = tradeEvent.contextid
                    };
                    OnUserRemoveItem(null, item);
                }
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                if (schemaItem == null)
                {
                    // TODO: Add log (counldn't find item in CurrentSchema)
                }

                OnUserRemoveItem(schemaItem, null);
            }
        }
示例#16
0
        /// <summary>
        /// Gets an item from a TradeEvent, and passes it into the UserHandler's implemented OnUserAddItem([...]) routine.
        /// Passes in null items if something went wrong.
        /// </summary>
        /// <param name="tradeEvent">TradeEvent to get item from</param>
        /// <returns></returns>
        private void FireOnUserAddItem(TradeEvent tradeEvent)
        {
            ulong itemID = tradeEvent.assetid;
            Inventory.Item item;

            if (OtherInventory != null)
            {
                item = OtherInventory.GetItem(itemID);
                if (item != null)
                {
                    Schema.Item schemaItem = CurrentSchema.GetItem(item.Defindex);
                    if (schemaItem == null)
                    {
                        Console.WriteLine("User added an unknown item to the trade.");
                    }

                    OnUserAddItem(schemaItem, item);
                }
                else
                {
                    item = new Inventory.Item()
                    {
                        Id=itemID,
                        AppId=tradeEvent.appid,
                        ContextId=tradeEvent.contextid
                    };
                    //Console.WriteLine("User added a non TF2 item to the trade.");
                    OnUserAddItem(null, item);
                }
            }
            else
            {
                var schemaItem = GetItemFromPrivateBp(tradeEvent, itemID);
                if (schemaItem == null)
                {
                    Console.WriteLine("User added an unknown item to the trade.");
                }

                OnUserAddItem(schemaItem, null);
                // todo: figure out what to send in with Inventory item.....
            }
        }
示例#17
0
        /// <summary>
        /// This updates the trade.  This is called at an interval of a
        /// default of 800ms, not including the execution time of the
        /// method itself.
        /// </summary>
        public void Poll()
        {
            if (!TradeStarted)
            {
                tradeStarted        = true;
                tradeStartTime      = DateTime.Now;
                lastOtherActionTime = DateTime.Now;
            }

            StatusObj status = GetStatus();

            if (status == null)
            {
                throw new TradeException("The web command to get the trade status failed.");
            }

            // I've noticed this when the trade is cancelled.
            if (status.trade_status == 3)
            {
                if (OnError != null)
                {
                    OnError("Trade was cancelled by other user.");
                }

                OtherUserCancelled = true;
                return;
            }

            if (status.events != null && numEvents != status.events.Length)
            {
                int numLoops = status.events.Length - numEvents;
                numEvents = status.events.Length;

                for (int i = numLoops; i > 0; i--)
                {
                    int EventID;

                    if (numLoops == 1)
                    {
                        EventID = numEvents - 1;
                    }
                    else
                    {
                        EventID = numEvents - i;
                    }

                    bool isBot = status.events [EventID].steamid == MySteamId.ConvertToUInt64().ToString();

                    /*
                     *
                     * Trade Action ID's
                     *
                     * 0 = Add item (itemid = "assetid")
                     * 1 = remove item (itemid = "assetid")
                     * 2 = Toggle ready
                     * 3 = Toggle not ready
                     * 4
                     * 5
                     * 6
                     * 7 = Chat (message = "text")
                     *
                     */
                    ulong itemID;

                    switch (status.events [EventID].action)
                    {
                    case 0:
                        itemID = (ulong)status.events [EventID].assetid;

                        if (isBot)
                        {
                            steamMyOfferedItems.Add(itemID);
                            ValidateSteamItemChanged(itemID, true);
                        }
                        else
                        {
                            OtherOfferedItems.Add(itemID);
                            Inventory.Item item       = OtherInventory.GetItem(itemID);
                            Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                            OnUserAddItem(schemaItem, item);
                        }

                        break;

                    case 1:
                        itemID = (ulong)status.events [EventID].assetid;

                        if (isBot)
                        {
                            steamMyOfferedItems.Remove(itemID);
                            ValidateSteamItemChanged(itemID, false);
                        }
                        else
                        {
                            OtherOfferedItems.Remove(itemID);
                            Inventory.Item item       = OtherInventory.GetItem(itemID);
                            Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                            OnUserRemoveItem(schemaItem, item);
                        }

                        break;

                    case 2:
                        if (!isBot)
                        {
                            otherIsReady = true;
                            OnUserSetReady(true);
                        }
                        break;

                    case 3:
                        if (!isBot)
                        {
                            otherIsReady = false;
                            OnUserSetReady(false);
                        }
                        break;

                    case 4:
                        if (!isBot)
                        {
                            OnUserAccept();
                        }
                        break;

                    case 7:
                        if (!isBot)
                        {
                            OnMessage(status.events [EventID].text);
                        }
                        break;

                    default:
                        // Todo: add an OnWarning or similar event
                        if (OnError != null)
                        {
                            OnError("Unkown Event ID: " + status.events [EventID].action);
                        }
                        break;
                    }

                    if (!isBot)
                    {
                        lastOtherActionTime = DateTime.Now;
                    }
                }
            }
            else
            {
                // check if the user is AFK
                var now = DateTime.Now;

                DateTime actionTimeout      = lastOtherActionTime.AddSeconds(MaximumActionGap);
                int      untilActionTimeout = (int)Math.Round((actionTimeout - now).TotalSeconds);

                DateTime tradeTimeout      = TradeStartTime.AddSeconds(MaximumTradeTime);
                int      untilTradeTimeout = (int)Math.Round((tradeTimeout - now).TotalSeconds);

                if (untilActionTimeout <= 0 || untilTradeTimeout <= 0)
                {
                    if (OnTimeout != null)
                    {
                        OnTimeout();
                    }
                    CancelTrade();
                }
                else if (untilActionTimeout <= 15 && untilActionTimeout % 5 == 0)
                {
                    SendMessageWebCmd("Are You AFK? The trade will be canceled in " + untilActionTimeout + " seconds if you don't do something.");
                }
            }

            // Update Local Variables
            if (status.them != null)
            {
                otherIsReady = status.them.ready == 1 ? true : false;
                meIsReady    = status.me.ready == 1 ? true : false;
            }

            // Update version
            if (status.newversion)
            {
                Version = status.version;
            }

            if (status.logpos != 0)
            {
                LogPos = status.logpos;
            }
        }
示例#18
0
        /// <summary>
        /// This updates the trade.  This is called at an interval of a
        /// default of 800ms, not including the execution time of the
        /// method itself.
        /// </summary>
        /// <returns><c>true</c> if the other trade partner performed an action; otherwise <c>false</c>.</returns>
        public bool Poll()
        {
            bool otherDidSomething = false;

            if (!TradeStarted)
            {
                tradeStarted = true;

                // since there is no feedback to let us know that the trade
                // is fully initialized we assume that it is when we start polling.
                if (OnAfterInit != null)
                {
                    OnAfterInit();
                }
            }

            StatusObj status = GetStatus();

            if (status == null)
            {
                throw new TradeException("The web command to get the trade status failed.");
            }

            // I've noticed this when the trade is cancelled.
            if (status.trade_status == 3)
            {
                if (OnError != null)
                {
                    OnError("Trade was cancelled by other user.");
                }

                OtherUserCancelled = true;
                return(otherDidSomething);
            }

            if (status.events != null && numEvents != status.events.Length)
            {
                int numLoops = status.events.Length - numEvents;
                numEvents = status.events.Length;

                for (int i = numLoops; i > 0; i--)
                {
                    int EventID;

                    if (numLoops == 1)
                    {
                        EventID = numEvents - 1;
                    }
                    else
                    {
                        EventID = numEvents - i;
                    }

                    bool isBot = status.events [EventID].steamid == MySteamId.ConvertToUInt64().ToString();

                    /*
                     *
                     * Trade Action ID's
                     *
                     * 0 = Add item (itemid = "assetid")
                     * 1 = remove item (itemid = "assetid")
                     * 2 = Toggle ready
                     * 3 = Toggle not ready
                     * 4
                     * 5
                     * 6
                     * 7 = Chat (message = "text")
                     *
                     */
                    ulong itemID;

                    switch (status.events [EventID].action)
                    {
                    case 0:
                        itemID = (ulong)status.events [EventID].assetid;

                        if (isBot)
                        {
                            steamMyOfferedItems.Add(itemID);
                            ValidateSteamItemChanged(itemID, true);
                        }
                        else
                        {
                            OtherOfferedItems.Add(itemID);
                            Inventory.Item item       = OtherInventory.GetItem(itemID);
                            Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                            OnUserAddItem(schemaItem, item);
                        }

                        break;

                    case 1:
                        itemID = (ulong)status.events [EventID].assetid;

                        if (isBot)
                        {
                            steamMyOfferedItems.Remove(itemID);
                            ValidateSteamItemChanged(itemID, false);
                        }
                        else
                        {
                            OtherOfferedItems.Remove(itemID);
                            Inventory.Item item       = OtherInventory.GetItem(itemID);
                            Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                            OnUserRemoveItem(schemaItem, item);
                        }

                        break;

                    case 2:
                        if (!isBot)
                        {
                            otherIsReady = true;
                            OnUserSetReady(true);
                        }
                        break;

                    case 3:
                        if (!isBot)
                        {
                            otherIsReady = false;
                            OnUserSetReady(false);
                        }
                        break;

                    case 4:
                        if (!isBot)
                        {
                            OnUserAccept();
                        }
                        break;

                    case 7:
                        if (!isBot)
                        {
                            OnMessage(status.events [EventID].text);
                        }
                        break;

                    default:
                        // Todo: add an OnWarning or similar event
                        if (OnError != null)
                        {
                            OnError("Unkown Event ID: " + status.events [EventID].action);
                        }
                        break;
                    }

                    if (!isBot)
                    {
                        otherDidSomething = true;
                    }
                }
            }

            // Update Local Variables
            if (status.them != null)
            {
                otherIsReady = status.them.ready == 1 ? true : false;
                meIsReady    = status.me.ready == 1 ? true : false;
            }

            // Update version
            if (status.newversion)
            {
                Version = status.version;
            }

            if (status.logpos != 0)
            {
                LogPos = status.logpos;
            }

            return(otherDidSomething);
        }
示例#19
0
        /// <summary>
        /// This updates the trade.  This is called at an interval of a
        /// default of 800ms, not including the execution time of the
        /// method itself.
        /// </summary>
        /// <returns><c>true</c> if the other trade partner performed an action; otherwise <c>false</c>.</returns>
        public bool Poll()
        {
            bool otherDidSomething = false;

            if (!TradeStarted)
            {
                tradeStarted = true;

                // since there is no feedback to let us know that the trade
                // is fully initialized we assume that it is when we start polling.
                if (OnAfterInit != null)
                {
                    OnAfterInit();
                }
            }

            StatusObj status = GetStatus();

            if (status == null)
            {
                throw new TradeException("The web command to get the trade status failed.");
            }

            // I've noticed this when the trade is cancelled.
            if (status.trade_status == 3)
            {
                if (OnError != null)
                {
                    OnError("Trade was cancelled by other user.");
                }

                OtherUserCancelled = true;
                return(otherDidSomething);
            }

            if (status.events != null)
            {
                foreach (TradeEvent trdEvent in status.events)
                {
                    if (!eventList.Contains(trdEvent))
                    {
                        eventList.Add(trdEvent);//add event to processed list, as we are taking care of this event now
                        bool isBot = trdEvent.steamid == MySteamId.ConvertToUInt64().ToString();

                        /*
                         *
                         * Trade Action ID's
                         *
                         * 0 = Add item (itemid = "assetid")
                         * 1 = remove item (itemid = "assetid")
                         * 2 = Toggle ready
                         * 3 = Toggle not ready
                         * 4
                         * 5
                         * 6
                         * 7 = Chat (message = "text")
                         *
                         */
                        ulong itemID;

                        switch ((TradeEventType)trdEvent.action)
                        {
                        case TradeEventType.ItemAdded:
                            itemID = (ulong)trdEvent.assetid;

                            if (isBot)
                            {
                                steamMyOfferedItems.Add(itemID);
                                ValidateSteamItemChanged(itemID, true);
                                Inventory.Item item       = MyInventory.GetItem(itemID);
                                Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                            }
                            else
                            {
                                OtherOfferedItems.Add(itemID);
                                Inventory.Item item       = OtherInventory.GetItem(itemID);
                                Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                                OnUserAddItem(schemaItem, item);
                            }

                            break;

                        case TradeEventType.ItemRemoved:
                            itemID = (ulong)trdEvent.assetid;

                            if (isBot)
                            {
                                steamMyOfferedItems.Remove(itemID);
                                ValidateSteamItemChanged(itemID, false);
                                Inventory.Item item       = MyInventory.GetItem(itemID);
                                Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                            }
                            else
                            {
                                OtherOfferedItems.Remove(itemID);
                                Inventory.Item item       = OtherInventory.GetItem(itemID);
                                Schema.Item    schemaItem = CurrentSchema.GetItem(item.Defindex);
                                OnUserRemoveItem(schemaItem, item);
                            }
                            break;

                        case TradeEventType.UserSetReady:
                            if (!isBot)
                            {
                                otherIsReady = true;
                                OnUserSetReady(true);
                            }
                            break;

                        case TradeEventType.UserSetUnReady:
                            if (!isBot)
                            {
                                otherIsReady = false;
                                OnUserSetReady(false);
                            }
                            break;

                        case TradeEventType.UserAccept:
                            if (!isBot)
                            {
                                OnUserAccept();
                            }
                            break;

                        case TradeEventType.UserChat:
                            if (!isBot)
                            {
                                OnMessage(trdEvent.text);
                            }
                            break;

                        default:
                            // Todo: add an OnWarning or similar event
                            if (OnError != null)
                            {
                                OnError("Unknown Event ID: " + trdEvent.action);
                            }
                            break;
                        }

                        if (!isBot)
                        {
                            otherDidSomething = true;
                        }
                    } //if (!eventList.Contains(trdEvent))
                }     // foreach (TradeEvent trdEvent in status.events)
            }         //if (status.events != null)

            // Update Local Variables
            if (status.them != null)
            {
                otherIsReady = status.them.ready == 1 ? true : false;
                meIsReady    = status.me.ready == 1 ? true : false;
            }

            // Update version
            if (status.newversion)
            {
                Version = status.version;
            }

            if (status.logpos != 0)
            {
                LogPos = status.logpos;
            }

            return(otherDidSomething);
        }