public TF2Currency GetChange(TF2Currency other)
        {
            TF2Currency change = new TF2Currency();

            int weapons   = 0;
            int myweapons = 0;

            weapons += other.Hat * 24;
            weapons += other.Refined * 18;
            weapons += other.Reclaimed * 6;
            weapons += other.Scrap * 2;
            weapons += other.Weapon;
            weapons += (int)(clsFunctions.tfPriceToBuyCards.ToScrap() * this.Card) / 2;
            weapons += (int)(clsFunctions.tfPriceToBuyFoilCards.ToScrap() * this.FoilCard) / 2;

            myweapons += this.Hat * 24;
            myweapons += this.Refined * 18;
            myweapons += this.Reclaimed * 6;
            myweapons += this.Scrap * 2;
            myweapons += this.Weapon;
            myweapons += (int)(clsFunctions.tfPriceToSellCards.ToScrap() * this.Card) / 2;
            myweapons += (int)(clsFunctions.tfPriceToSellFoilCards.ToScrap() * this.FoilCard) / 2;

            int ichange = myweapons - weapons;

            if (ichange > 0)
            {
                while (ichange >= 18)
                {
                    ichange -= 18;
                    change.AddRef();
                }
                while (ichange >= 6)
                {
                    ichange -= 6;
                    change.AddRec();
                }
                while (ichange >= 2)
                {
                    ichange -= 2;
                    change.AddScrap();
                }
                while (ichange >= 1)
                {
                    ichange--;
                    change.AddWeapon();
                }
            }
            else
            {
                while (ichange <= -18)
                {
                    ichange += 18;
                    change.RemoveRef();
                }
                while (ichange <= -6)
                {
                    ichange += 6;
                    change.RemoveRec();
                }
                while (ichange <= -2)
                {
                    ichange += 2;
                    change.RemoveScrap();
                }
                while (ichange <= -1)
                {
                    ichange++;
                    change.RemoveWeapon();
                }
            }

            return(change);
        }
        public void Test()
        {
            if (UserKeyAdded > 0)
            {
                //they are selling keys
                //check amount of keys user added (make into scrap)
                //see if currencies are the same
                //+/- if not
                TF2Currency tempCurn = new TF2Currency(0, 0, 0, (int)clsFunctions.KEY_BUY_VALUE.ToScrap() * UserKeyAdded);

                string TempCurnDebug = String.Format("UserStuff Ref Change {0} Rec Change {1} Scrap Change {2} Key Buy Price {3} Key Sell Price {4}", tempCurn.Refined, tempCurn.Reclaimed, tempCurn.Scrap, clsFunctions.KEY_BUY_VALUE.ToPrice(), clsFunctions.KEY_SELL_VALUE.ToPrice());

                TF2Currency change = tempCurn.GetChange(Bot.myCurrency);

                string DebugFormat = String.Format("Ref Change {0} Rec Change {1} Scrap Change {2} Key Buy Price {3} Key Sell Price {4}", change.Refined, change.Reclaimed, change.Scrap, clsFunctions.KEY_BUY_VALUE.ToPrice(), clsFunctions.KEY_SELL_VALUE.ToPrice());

                Bot.log.Success(DebugFormat);

                if (change.Neutral())
                {
                }
                else if (change.Positive())
                {
                    //+ change means user is overpaying and bot needs to add correct change.
                    #region Refined Adding

                    if (change.Refined > 0)
                    {
                        if (InventoryRef - Bot.myCurrency.Refined >= change.Refined)
                        {
                            uint RefAdded = Trade.AddAllItemsByDefindex(5002, (uint)change.Refined);
                            Bot.myCurrency.AddRef((int)RefAdded);
                            if (RefAdded == change.Refined)
                            {
                                Bot.log.Success(String.Format("Added {0} refined.", RefAdded));
                            }
                        }
                        else
                        {
                            Trade.SendMessage("I'm sorry. I don't seem to have enough refined!");
                        }
                    }

                    #endregion

                    #region Reclaimed Adding

                    if (change.Reclaimed > 0)
                    {
                        if (InventoryRec - Bot.myCurrency.Reclaimed >= change.Reclaimed)
                        {
                            if (Bot.myCurrency.Reclaimed == 2)
                            {
                                if (InventoryRef - Bot.myCurrency.Refined >= 1)
                                {
                                    uint rectoremove = 2;
                                    if (change.Reclaimed == 2)
                                    {
                                        rectoremove = 1;
                                    }
                                    uint RecRemoved = Trade.RemoveAllItemsByDefindex(5001, rectoremove);
                                    Bot.myCurrency.RemoveRec((int)RecRemoved);
                                    if (RecRemoved == rectoremove)
                                    {
                                        Bot.log.Success(String.Format("Removed {0} reclaimed", RecRemoved));
                                        uint RefAdded = Trade.AddAllItemsByDefindex(5002, 1);

                                        if (RefAdded == 1)
                                        {
                                            Bot.myCurrency.AddRef();
                                            Bot.log.Success("Added 1 refined.");
                                            change.RemoveRec();
                                        }
                                        else
                                        {
                                            Trade.CancelTrade();
                                            Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                                            Bot.log.Error("Something went wrong removing 2 rec and adding a ref(adding ref part)");
                                        }
                                    }
                                }
                                else
                                {
                                    uint RecAdded = Trade.AddAllItemsByDefindex(5001, (uint)change.Reclaimed);
                                    Bot.myCurrency.AddRec((int)RecAdded);
                                    if (RecAdded == change.Reclaimed)
                                    {
                                        Bot.log.Success(String.Format("Added {0} rec", RecAdded));
                                    }
                                    else
                                    {
                                        Trade.CancelTrade();
                                        Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                                        Bot.log.Error("Couldn't add reclaimed");
                                    }
                                }
                            }
                            else
                            {
                                uint RecAdded = Trade.AddAllItemsByDefindex(5001, (uint)change.Reclaimed);
                                Bot.myCurrency.AddRec((int)RecAdded);
                                if (RecAdded == change.Reclaimed)
                                {
                                    Bot.log.Success(String.Format("Added {0} rec", RecAdded));
                                }
                                else
                                {
                                    Trade.CancelTrade();
                                    Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                                    Bot.log.Error("Couldn't add reclaimed");
                                }
                            }
                        }
                        else
                        {
                            Trade.SendMessage("Sorry. I do not have enough reclaimed!");
                        }
                    }
                    #endregion

                    #region Scrap Adding
                    if (change.Scrap > 0)
                    {
                        uint ScrapAdded = Trade.AddAllItemsByDefindex(5000, (uint)change.Scrap);
                        Bot.myCurrency.AddScrap((int)ScrapAdded);
                        if (ScrapAdded == change.Scrap)
                        {
                            Bot.log.Success(String.Format("Added {0} scrap", ScrapAdded));
                        }
                        else
                        {
                            Trade.CancelTrade();
                            Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                            Bot.log.Error("Couldn't add scrap");
                        }
                    }
                    #endregion
                }
                else if (change.Negative())
                {
                    change.MakePositive();
                    //- change means bot needs to remove items.

                    #region Refined Removing
                    if (change.Refined > 0)
                    {
                        if (Bot.myCurrency.Refined >= change.Refined)
                        {
                            uint RefRemoved = Trade.RemoveAllItemsByDefindex(5002, (uint)change.Refined);
                            Bot.myCurrency.RemoveRef((int)RefRemoved);
                            if (RefRemoved == change.Refined)
                            {
                                Bot.log.Success(String.Format("Removed {0} refined", RefRemoved));
                            }
                            else
                            {
                                Trade.CancelTrade();
                                Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                                Bot.log.Error("Something went wrong removing ref");
                            }
                        }
                        else
                        {
                            Trade.CancelTrade();
                            Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                            Bot.log.Error("Something went wrong removing ref");
                        }
                    }
                    #endregion

                    #region Reclaimed Removeing
                    if (change.Reclaimed > 0)
                    {
                        if (Bot.myCurrency.Reclaimed >= change.Reclaimed)
                        {
                            uint RecRemoved = Trade.RemoveAllItemsByDefindex(5001, (uint)change.Reclaimed);
                            Bot.myCurrency.RemoveRec((int)RecRemoved);
                            if (RecRemoved == change.Reclaimed)
                            {
                                Bot.log.Success(String.Format("Removed {0} rec", RecRemoved));
                            }
                            else
                            {
                                Trade.CancelTrade();
                                Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                                Bot.log.Error("Something went wrong removing rec");
                            }
                        }
                        else if (Bot.myCurrency.Refined >= change.Reclaimed / 3)
                        {
                            double reftoremove;
                            if (change.Reclaimed > 3)
                            {
                                reftoremove = Math.Abs(change.Reclaimed) / 3;
                            }
                            else
                            {
                                reftoremove = 1;
                            }
                            reftoremove = Math.Round(reftoremove, 0, MidpointRounding.AwayFromZero);
                            if (Bot.myCurrency.Refined >= reftoremove)
                            {
                                uint RefRemoved = Trade.RemoveAllItemsByDefindex(5002, (uint)reftoremove);
                                Bot.myCurrency.RemoveRef((int)RefRemoved);
                                if (RefRemoved == reftoremove)
                                {
                                    Bot.log.Success(String.Format("Removed {0} ref", RefRemoved));
                                    int  rectoadd = ((int)RefRemoved * 3) - change.Reclaimed;
                                    uint recadded = Trade.AddAllItemsByDefindex(5001, (uint)rectoadd);
                                    Bot.myCurrency.AddRec(rectoadd);
                                    if (recadded == rectoadd)
                                    {
                                        Bot.log.Success(String.Format("Added {0} rec.", recadded));
                                    }
                                }
                                else
                                {
                                    Trade.CancelTrade();
                                    Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                                    Bot.log.Error("Something went wrong removing ref");
                                }
                            }
                        }
                    }
                    #endregion

                    #region Scrap Removing

                    if (change.Scrap > 0)
                    {
                        uint ScrapRemoved = Trade.RemoveAllItemsByDefindex(5000, (uint)change.Scrap);
                        Bot.myCurrency.RemoveScrap((int)ScrapRemoved);
                        if (ScrapRemoved == change.Scrap)
                        {
                            Bot.log.Warn(String.Format("Removed {0} scrap", ScrapRemoved));
                        }
                        else
                        {
                            Trade.CancelTrade();
                            Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "Sorry. Something went wrong. Please trade me again.");
                            Bot.log.Error("Couldn't remove scrap");
                        }
                    }
                    #endregion
                }
            }
            else if (UserKeyAdded == 0 && (Bot.myCurrency.Refined > 0 || Bot.myCurrency.Reclaimed > 0 || Bot.myCurrency.Scrap > 0))
            {
                uint MetalRemoved = Trade.RemoveAllItemsByDefindex(5002);
                Bot.myCurrency.RemoveRef((int)MetalRemoved);
                MetalRemoved = Trade.RemoveAllItemsByDefindex(5001);
                Bot.myCurrency.RemoveRec((int)MetalRemoved);
                MetalRemoved = Trade.RemoveAllItemsByDefindex(5000);
                Bot.myCurrency.RemoveScrap((int)MetalRemoved);
                Bot.log.Warn("Removed all metal as all keys were removed");
            }
            else
            {
                //they are buying keys
                //check metal they have added
                //divide by key selling price
                //if they have enough for one add (after checking # added

                int iUserKeyAfford = Bot.userCurrency.ToKeys(false);
                int iKeysToAdd     = iUserKeyAfford - KeyBotAdded;

                if (iKeysToAdd == 0)
                {
                }
                else if (iKeysToAdd > 0)
                {
                    while (iKeysToAdd > 0)
                    {
                        try
                        {
                            if (Trade.AddItem(KeyIDS[KeyBotAdded]))
                            {
                                KeyBotAdded++;
                                Bot.log.Success("Added a key.");
                                iKeysToAdd--;
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            Trade.SendMessage("I don't have enough keys!");
                            iKeysToAdd = 0;
                        }
                    }
                }
                else if (iKeysToAdd < 0)
                {
                    while (iKeysToAdd < 0)
                    {
                        try
                        {
                            if (Trade.RemoveItem(KeyIDS[KeyBotAdded--]))
                            {
                                KeyBotAdded--;
                                Bot.log.Success("Removed a key");
                                iKeysToAdd++;
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            Trade.CancelTrade();
                            Bot.SteamFriends.SendChatMessage(OtherSID, EChatEntryType.ChatMsg, "I'm sorry. Something went wrong. Please try again.");
                            iKeysToAdd = 0;
                        }
                    }
                }
            }
        }