Example #1
0
        private UsersInventory UpdateSteamInventory(XUser User, uint SteamGameID, int GetItemsNum = 30)
        {
            UsersInventory UsersInventory = new UsersInventory();
            UsersInventory.Opened = false;
            if (!this.GetUpdatingInventories()[SteamGameID].ContainsKey(User.ID))
            {
                double TotalPrice = 0d;
                lock (_UpdatingInventories)
                {
                    UpdatingInventories[SteamGameID][User.ID] = Helper.GetCurrentTime();
                }
                try
                {
                    string data;
                    bool result = this.GetUsersSteamInventory_Json(User.ID, SteamGameID, out data, 1);
                    // Logger.ConsoleLog(data);
                    if (User.SteamInventoryHash.Equals(BaseFuncs.MD5(data)) && UsersInventories.ContainsKey(SteamGameID) && UsersInventories[SteamGameID].ContainsKey(User.ID)
                        && SteamItemsHelper.LastItemPricesUpdate < UsersInventories[SteamGameID][User.ID].LastUpdate)
                    {
                        UsersInventory = UsersInventories[SteamGameID][User.ID];
                    }
                    else if (result)
                    {
                        List<USteamItem> SteamItems = new List<USteamItem>();
                        string[] Item = Regex.Split(data, "{\"id\":\"");

                        for (int i = 1; i < Item.Length; i++)
                        {
                            //Logger.ConsoleLog("On " + i + " from " + (Item.Length - 1));
                            string classid = Regex.Split(Item[i], "\"classid\":\"")[1].Split('"')[0];
                            string ItemContent = Regex.Split(data, "{\"appid\":\"" + SteamGameID + "\",\"classid\":\"" + classid + "\"")[1];

                            string name = Regex.Split(ItemContent, "\"market_hash_name\":\"")[1].Split('"')[0];
                            name = Encoding.Unicode.GetString(Encoding.Unicode.GetBytes(name));

                            USteamItem SteamItem;
                            if (!Helper.SteamItemsHelper.SelectByName(name, SteamGameID, out SteamItem, User.Currency))
                            {
                                XSteamItem XSteamItem = new XSteamItem();
                                XSteamItem.Name = name;

                                SteamItem = new USteamItem();

                                SteamItem.Price = XSteamItem.Price = Helper.SteamItemsHelper.GetMarketPrice(XSteamItem.Name, SteamGameID);
                                if (XSteamItem.Price < 0)
                                {
                                    SteamItem.Price = XSteamItem.Price = 0;
                                }

                                SteamItem.Price_Str = SteamItem.Price.ToString("###,##0.00");

                                XSteamItem.Rarity = Regex.Split(ItemContent, "internal_name\":\"Rarity_")[1].Split('"')[0];
                                SteamItem.Color = XSteamItem.Color = Regex.Split(ItemContent, "\"name_color\":\"")[1].Split('"')[0]; ;

                                string RusName = Regex.Split(ItemContent, "\"market_name\":\"")[1].Split('"')[0];
                                XSteamItem.RusName = Helper.SteamItemsHelper.MakeTextFromRealDich(RusName);

                                if (SteamGameID == Configs.CSGO_STEAM_GAME_ID)
                                {
                                    if (XSteamItem.Rarity.Contains("_"))
                                    {
                                        XSteamItem.Rarity = XSteamItem.Rarity.Split('_')[0];
                                    }
                                }

                                if (User.Currency == 1)
                                {
                                    SteamItem.Name = XSteamItem.RusName;
                                }
                                else
                                {
                                    SteamItem.Name = XSteamItem.Name;
                                }

                                SteamItem.Image = XSteamItem.Image = "http://steamcommunity-a.akamaihd.net/economy/image/" + Regex.Split(ItemContent, "\"icon_url\":\"")[1].Split('"')[0];
                                SteamItem.Rarity = XSteamItem.Rarity;
                                SteamItem.RarityColor = Helper.SteamItemsHelper.GetRarityColor(XSteamItem.Rarity, SteamGameID);
                                SteamItem.SteamGameID = XSteamItem.SteamGameID = SteamGameID;
                                SteamItem.ID = Helper.SteamItemsHelper.Table.Insert(XSteamItem);
                            }

                            string iimgg;
                            if (!Helper.SteamItemsHelper.GetImageFromMemory(SteamItem.ID, SteamItem.SteamGameID, out iimgg))
                            {
                                SteamItemImageQueue SteamItemImageQueue = new SteamItemImageQueue();
                                SteamItem.ID = SteamItemImageQueue.ID = SteamItem.ID;
                                SteamItemImageQueue.SteamGameID = SteamItem.SteamGameID;
                                SteamItemImageQueue.ImageURL = SteamItem.Image;

                                Helper.SteamItemsHelper.AddToQueueDownloadImage(SteamItemImageQueue);
                            }

                            if (SteamItem.Price >= Configs.MIN_ITEMS_PRICE)
                            {
                                SteamItem.AssertID = Convert.ToUInt64(Item[i].Split('"')[0]);

                                XSteamItemsClassID XSteamItemsClassID;
                                if (!Helper.SteamItemsHelper.Table_ClassID.SelectOne(dt => dt.AssertID == SteamItem.AssertID, out XSteamItemsClassID))
                                {
                                    XSteamItemsClassID = new XSteamItemsClassID();
                                    XSteamItemsClassID.AssertID = SteamItem.AssertID;
                                    XSteamItemsClassID.ClassID = Convert.ToUInt64(classid);
                                    Helper.SteamItemsHelper.Table_ClassID.Insert(XSteamItemsClassID);
                                }

                                if (User.Currency == 1)
                                {
                                    SteamItem.Price = SteamItem.Price * Helper.Rub_ExchangeRate;
                                    SteamItem.Price_Str = SteamItem.Price.ToString("###,###,##0");
                                }
                                else
                                {
                                    SteamItem.Price_Str = SteamItem.Price.ToString("###,##0.00");
                                }

                                SteamItems.Add(SteamItem);
                                TotalPrice += SteamItem.Price;
                            }
                        }

                        UsersInventory.SteamItems = (from it in SteamItems orderby it.Price descending select it).ToList();
                        UsersInventory.TotalPrice = TotalPrice;
                        if (User.Currency == 1)
                        {
                            UsersInventory.TotalPrice_Str = TotalPrice.ToString("###,###,##0");
                        }
                        else
                        {
                            UsersInventory.TotalPrice_Str = TotalPrice.ToString("###,##0.00");
                        }

                        UsersInventory.Opened = true;

                        XUser cur_usr = this.Table.SelectByID(User.ID);
                        cur_usr.SteamInventoryHash = BaseFuncs.MD5(data);
                        this.Table.UpdateByID(cur_usr, User.ID);
                    }
                }
                catch (Exception Exception)
                {
                    Logger.ConsoleLog(Exception);
                }

                UsersInventory.LastUpdate = Helper.GetCurrentTime();
                lock (_UsersSteamInventories)
                {
                    UsersInventories[SteamGameID][User.ID] = UsersInventory;
                }

                lock (_UpdatingInventories)
                {
                    UpdatingInventories[SteamGameID].Remove(User.ID);
                }

                if (InventoryClients[SteamGameID].ContainsKey(User.ID))
                {
                    for (int i = 0; i < InventoryClients[SteamGameID][User.ID].Count; i++)
                    {
                        if (InventoryClients[SteamGameID][User.ID][i].Client != null && !InventoryClients[SteamGameID][User.ID][i].Client.Closed)
                        {
                            WebSocketPage.GetWebsocket_SteamInventory(UsersInventory, InventoryClients[SteamGameID][User.ID][i].Client, 0, 0, InventoryClients[SteamGameID][User.ID][i].ItemNum, SteamGameID, "");
                        }
                    }

                    InventoryClients[SteamGameID].Remove(User.ID);
                }
            }
            return UsersInventory;
        }
Example #2
0
        public override bool Init(Client client)
        {
            if (client.ConnType == ConnectionType.WebSocket && client.WSData != null)
            {
                //Logger.ConsoleLog(client.WSData, ConsoleColor.Yellow);
                string[] wsdata = Regex.Split(client.WSData, BaseFuncs.WSplit);

                if (wsdata[0].Equals("GetProfile"))
                {
                    XUser user;
                    uint userID;
                    if (uint.TryParse(wsdata[1], out userID) && Helper.UserHelper.Table.SelectByID(userID, out user))
                    {
                        int Winrate;
                        int GamesCount = user.CSGO_GamesCount + user.DOTA_GamesCount;
                        int WonCount = user.DOTA_WonCount + user.CSGO_WonCount;

                        if (WonCount > 0)
                        {
                            Winrate = (int)(WonCount / ((double)GamesCount / 100d));
                        }
                        else
                        {
                            Winrate = 0;
                        }

                        string BetPrice = "";
                        string WonPrice = "";
                        ushort currency = Helper.UserHelper.GetCurrency(client);
                        if(currency == 1)
                        {
                            BetPrice = (user.CSGO_RUB_TotalBetPrice + user.DOTA_RUB_TotalBetPrice).ToString("###,###,##0");
                            WonPrice = (user.CSGO_RUB_WonTotalPrice + user.DOTA_RUB_WonTotalPrice).ToString("###,###,##0");
                        }
                        else if(currency == 0)
                        {
                            BetPrice = (user.CSGO_TotalBetPrice + user.DOTA_TotalBetPrice).ToString("###,##0.00");
                            WonPrice = (user.CSGO_WonTotalPrice + user.DOTA_WonTotalPrice).ToString("###,##0.00");
                        }

                        string GroupName = "";
                        XUser owner;
                        if(user.GroupOwnerID >= 0 && Helper.UserHelper.Table.SelectByID((uint)user.GroupOwnerID, out owner))
                        {
                            GroupName = (owner.GroupName.Length > 0) ? owner.GroupName : owner.Name;
                        }

                        string Games = "";
                        int CurrentTime = Helper.GetCurrentTime();
                        XLottery[] Lots = new XLottery[0];
                        Helper.LotteryHelper.Table.SelectArrFromEnd(data =>
                        {
                            if (data.WinnersToken > 0)
                            {
                                XLotteryBet b;
                                if (Helper.LotteryHelper.TableBet.SelectOne(bt => bt.LotteryID == data.ID && bt.UserID == user.ID && (data.EndTime + 30) <= CurrentTime, out b))
                                {
                                    int wr = Convert.ToInt32(Math.Round((100 * data.WinnersBetPrice) / data.JackpotPrice));
                                    string jc = "";

                                    if (currency == 1)
                                    {
                                        jc = (data.JackpotPrice * data.RubCurrency).ToString("###,###,##0");
                                    }
                                    else if (currency == 0)
                                    {
                                        jc = data.JackpotPrice.ToString("###,##0.00");
                                    }

                                    ushort wnr = 0;
                                    if (data.Winner == user.ID)
                                    {
                                        wnr = 1;
                                    }

                                    Games += data.ID + ";" + data.ID.ToString("000-000-000") + ";" + wr + ";" + data.JackpotItemsNum + ";" + jc + ";" + wnr + "↑";

                                    return true;
                                }
                            }
                            return false;
                        }, out Lots, 0, 15);

                        client.SendWebsocket("GetProfile" + BaseFuncs.WSplit + user.Name + BaseFuncs.WSplit + user.Avatar + BaseFuncs.WSplit + GamesCount
                            + BaseFuncs.WSplit + WonCount + BaseFuncs.WSplit + Winrate + BaseFuncs.WSplit + (user.CSGO_TotalBetItemsCount + user.DOTA_TotalBetItemsCount)
                            + BaseFuncs.WSplit + (user.CSGO_WonItemsCount + user.DOTA_WonItemsCount) + BaseFuncs.WSplit + BetPrice
                            + BaseFuncs.WSplit + WonPrice + BaseFuncs.WSplit + user.ProfileURL + BaseFuncs.WSplit + user.GroupOwnerID + BaseFuncs.WSplit + GroupName + BaseFuncs.WSplit + Games
                            + BaseFuncs.WSplit + ((Lots.Length < 15) ? 0 : 1));
                    }
                }

                else if (wsdata[0].Equals("GroupPage"))
                {
                    //ws.send("GroupPage{{=BaseFuncs.WSplit}}EntryToGroup{{=BaseFuncs.WSplit}}{{=Group.ID}}");
                    uint GroupID;
                    XUser User;

                    if (uint.TryParse(wsdata[2], out GroupID))
                    {
                        if (wsdata[1].Equals("Connect"))
                        {

                            if (WebSocketPage.ClientsGroupPage.ContainsKey(GroupID))
                            {
                                WebSocketPage.ClientsGroupPage[GroupID].Add(client);
                            }
                            else
                            {
                                List<Client> cls = new List<Client>();
                                cls.Add(client);
                                WebSocketPage.ClientsGroupPage.Add(GroupID, cls);
                            }
                        }
                        else if (wsdata[1].Equals("EntryToGroup") && Helper.UserHelper.GetCurrentUser(client, out User))
                        {
                            int OldGroup = User.GroupOwnerID;
                            if (Helper.GroupHelper.EnterToGroup(GroupID, client))
                            {
                                WebSocketPage.UpdateGroupData(GroupID);
                                if (OldGroup > -1)
                                {
                                    WebSocketPage.UpdateGroupData(Convert.ToUInt32(OldGroup));
                                }
                            }
                        }

                        else if (wsdata[1].Equals("ExitFromGroup") && Helper.UserHelper.GetCurrentUser(client, out User))
                        {
                            if (Helper.GroupHelper.ExitFromGroup(GroupID, client))
                            {
                                WebSocketPage.UpdateGroupData(GroupID);
                            }
                        }

                    }
                }
                else if(wsdata[0].Equals("MyGroupPage"))
                {
                    XUser User;
                    if (Helper.UserHelper.GetCurrentUser(client, out User))
                    {
                        if (wsdata[1].Equals("ChangeName"))
                        {
                            if (Helper.GroupHelper.UpdateNameByID(User.ID, wsdata[2]))
                            {
                                WebSocketPage.UpdateGroupData(User.ID);
                            }
                        }
                    }
                }
                else if (wsdata[0].Equals("GetInventory"))
                {
                    XUser User;
                    uint SteamGameID;
                    int ItemsNum;
                    int FromNum;
                    ushort SortByLowPrice;

                    if (Helper.UserHelper.GetCurrentUser(client, out User) && uint.TryParse(wsdata[1], out SteamGameID) && int.TryParse(wsdata[2], out FromNum) && int.TryParse(wsdata[3], out ItemsNum) && ushort.TryParse(wsdata[4], out SortByLowPrice))
                    {
                        UsersInventory Inventory = null;
                        bool InList = Helper.UserHelper.GetSteamInventory(User.ID, SteamGameID, out Inventory);
                        if (InList)
                        {
                            WebSocketPage.GetWebsocket_SteamInventory(Inventory, client, SortByLowPrice, FromNum, ItemsNum, SteamGameID, wsdata[5]);
                        }
                        else
                        {
                            Helper.UserHelper.WaitingList_InventoryClient(User.ID, client, SteamGameID, ItemsNum);
                        }
                    }
                }
                else if (wsdata[0].Equals("GetLocalInventory"))
                {
                    XUser User;
                    uint SteamGameID;
                    int ItemsNum;
                    int FromNum;
                    ushort SortByLowPrice;
                    if (Helper.UserHelper.GetCurrentUser(client, out User) && uint.TryParse(wsdata[1], out SteamGameID) && int.TryParse(wsdata[2], out FromNum) && int.TryParse(wsdata[3], out ItemsNum) && ushort.TryParse(wsdata[4], out SortByLowPrice))
                    {
                        Logger.ConsoleLog("Local:" + ItemsNum);
                        string StrItems = "";
                        List<USteamItem> SteamItems = Helper.SteamItemsHelper.SearchByString(Helper.UserHelper.GetSteamLocalInventory(User.ID, SteamGameID), wsdata[5]);

                        if (SortByLowPrice == 1)
                        {
                            SteamItems = (from it in SteamItems orderby it.Price ascending select it).ToList();
                        }

                        if (FromNum < 0)
                        {
                            FromNum = 0;
                        }
                        else if (FromNum > ItemsNum && FromNum == SteamItems.Count)
                        {
                            FromNum -= ItemsNum;
                        }

                        for (int i = FromNum; i < Math.Min(FromNum + ItemsNum, SteamItems.Count); i++)
                        {
                            StrItems += WebSocketPage.InventoryItemToString(SteamItems[i]);
                        }
                        string total_price_str;
                        Helper.UserHelper.GetLocalSteamInventoryTotalPrice(User.ID, SteamGameID, out total_price_str);
                        WebSocketPage.UpdateLocalInventory(StrItems, total_price_str, SteamItems.Count, client);
                    }
                }
                else if (wsdata[0].Equals("LotteryPage"))
                {
                    XLottery x_lot;
                    uint LotteryID;
                    if (wsdata[1].Equals("Connect") && uint.TryParse(wsdata[2], out LotteryID) && Helper.LotteryHelper.Table.SelectByID(LotteryID, out x_lot))
                    {
                        if (WebSocketPage.ClientsLotteryPage.ContainsKey(x_lot.ID))
                        {
                            WebSocketPage.ClientsLotteryPage[x_lot.ID].Add(client);
                        }
                        else
                        {
                            List<Client> cls = new List<Client>();
                            cls.Add(client);
                            WebSocketPage.ClientsLotteryPage.Add(x_lot.ID, cls);
                        }
                    }
                    else if (wsdata[1].Equals("SetBet"))
                    {
                        /*assert_id : item_type (0: chip, 1: steam: 2: local) ; */

                        XUser user;
                        if (Helper.UserHelper.GetCurrentUser(client, out user))
                        {
                            if (uint.TryParse(wsdata[2], out LotteryID) && Helper.LotteryHelper.Table.SelectByID(LotteryID, out x_lot))
                            {
                                string[] bet = wsdata[3].Split(';');
                                if (bet.Length > 1)
                                {
                                    List<USteamItem> SteamItems = new List<USteamItem>();
                                    List<Chip> Chips = new List<Chip>();

                                    for (int i = 0; i < Math.Min(25, bet.Length); i++)
                                    {
                                        string[] item = bet[i].Split(':');
                                        int item_type;
                                        ulong assert_id;
                                        uint item_id;

                                        if (item.Length >= 2 && ulong.TryParse(item[0], out assert_id) && int.TryParse(item[1], out item_type) && uint.TryParse(item[2], out item_id))
                                        {
                                            if (item_type == 1 || item_type == 2)
                                            {
                                                USteamItem SteamItem = new USteamItem();
                                                SteamItem.ID = item_id;
                                                SteamItem.AssertID = assert_id;
                                                SteamItems.Add(SteamItem);
                                            }
                                            else if (item_type == 3)
                                            {
                                                Chip chip = new Chip();
                                                chip.ID = item_id;
                                                chip.AssertID = assert_id;
                                                Chips.Add(chip);
                                            }

                                        }
                                    }

                                    ushort result = Helper.LotteryHelper.SetBet(x_lot.ID, user.ID, SteamItems, Chips, client);
                                    Logger.ConsoleLog(result + "::test from: " + SteamItems.Count + "::" + Chips.Count);

                                    if (result != 2)
                                    {
                                        client.SendWebsocket("BetDone" + BaseFuncs.WSplit + result);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (wsdata[0].Equals("UpdateTradeURL"))
                {
                    XUser user;
                    if (Helper.UserHelper.GetCurrentUser(client, out user))
                    {
                        string token;
                        ulong partner;
                        if (wsdata[1].Contains("partner=") && wsdata[1].Contains("token=") && ulong.TryParse(Regex.Split(wsdata[1], "partner=")[1].Split('&')[0], out partner))
                        {
                            token = Regex.Split(wsdata[1], "token=")[1];
                            if (token.Length > 0 && partner > 0)
                            {
                                if (token != user.TradeToken || partner != user.TradePartner)
                                {
                                    user.TradeToken = token;
                                    user.TradePartner = partner;
                                    Helper.UserHelper.Table.UpdateByID(user, user.ID);
                                    Logger.ConsoleLog("Updated trade url (" + user.ID + "):" + user.TradeToken);
                                }

                                client.SendWebsocket("UpdateTradeURL" + BaseFuncs.WSplit + "1" + BaseFuncs.WSplit + partner + BaseFuncs.WSplit + token);
                            }
                        }
                        else
                        {
                            client.SendWebsocket("UpdateTradeURL" + BaseFuncs.WSplit + "0");
                        }
                    }
                }

                else if(wsdata[0].Equals("SendLocalItemsToSteam"))
                {
                    XUser user;
                    uint SteamGameID;
                    if (Helper.UserHelper.GetCurrentUser(client, out user) && uint.TryParse(wsdata[1], out SteamGameID))
                    {
                        Helper.SteamBotHelper.SendLocalItemsToSteam(user, SteamGameID, client);
                    }
                }

                else if (wsdata[0].Equals("BuyChip"))
                {
                    XUser user;
                    uint chipID;
                    if (Helper.UserHelper.GetCurrentUser(client, out user) && uint.TryParse(wsdata[1], out chipID))
                    {
                        Chip chip;
                        if(Helper.ChipHelper.SelectByID(chipID, out chip))
                        {
                            double ChipPrice = chip.Cost;

                            if(user.Currency == 1)
                            {
                                ChipPrice *= Helper.Rub_ExchangeRate;
                                if(user.Wallet >= ChipPrice)
                                {
                                    user.Wallet -= ChipPrice;
                                    Helper.UserHelper.Table.UpdateByID(user, user.ID);
                                    Helper.ChipHelper.AddChipToUser(chip.ID, user.ID);

                                    client.SendWebsocket("BuyChip" + BaseFuncs.WSplit + "1" + BaseFuncs.WSplit + chip.ID + BaseFuncs.WSplit + user.Wallet);
                                }
                                else
                                {
                                    client.SendWebsocket("BuyChip" + BaseFuncs.WSplit + "0");
                                }
                            }
                        }
                    }
                }

                else if(wsdata[0].Equals("GroupChat"))
                {
                    uint GroupID;
                    if (wsdata[1].Equals("Connect") && uint.TryParse(wsdata[2], out GroupID) && Helper.UserHelper.UserExist(GroupID))
                    {
                        if(WebSocketPage.GroupClients.ContainsKey(GroupID))
                        {
                            WebSocketPage.GroupClients[GroupID].Add(client);
                        }
                        else
                        {
                            List<Client> Clients = new List<Client>();
                            Clients.Add(client);
                            WebSocketPage.GroupClients.Add(GroupID, Clients);
                        }
                    }
                }
            }

            return false;
        }
Example #3
0
        public bool SelectByName(string name, uint SteamGameID, out USteamItem SteamItem, ushort currency)
        {
            XSteamItem XSteamItem;
            if (this.SelectByName(name, SteamGameID, out XSteamItem))
            {
                SteamItem = new USteamItem();
                SteamItem.ID = XSteamItem.ID;
                if (currency == 1)
                {
                    SteamItem.Name = XSteamItem.RusName;
                }
                else
                {
                    SteamItem.Name = XSteamItem.Name;
                }
                SteamItem.Image = XSteamItem.Image;
                SteamItem.Price = XSteamItem.Price;
                SteamItem.RarityColor = this.GetRarityColor(XSteamItem.Rarity, SteamGameID);
                SteamItem.Rarity = XSteamItem.Rarity;

                SteamItem.Color = XSteamItem.Color;
                SteamItem.SteamGameID = SteamGameID;

                return true;
            }

            SteamItem = null;
            return false;
        }
Example #4
0
 public static string InventoryItemToString(USteamItem SteamItem)
 {
     string image;
     Helper.SteamItemsHelper.GetImageFromMemory(SteamItem.ID, SteamItem.SteamGameID, out image);
     //Logger.ConsoleLog(image + "::" + SteamItem.ID + "::" + SteamItem.SteamGameID);
     // 4- last
     //return SteamItem.Name + "↓" + SteamItem.Price_Str + "↓" + SteamItem.SteamGameID + "↓" + SteamItem.ID + "↓" + SteamItem.AssertID + "↓" + SteamItem.Image + ";";
     //Logger.ConsoleLog("[" + SteamItem.Color);
     return SteamItem.Name + "↓" + SteamItem.Price_Str + "↓" + SteamItem.SteamGameID + "↓" + SteamItem.ID + "↓" + SteamItem.AssertID + "↓" + SteamItem.Color + "↓" + SteamItem.Rarity + "↓" + SteamItem.RarityColor + "→";
 }
Example #5
0
        public bool SelectByID(uint id, uint SteamGameID, out USteamItem SteamItem, ushort currency)
        {
            XSteamItem XSteamItem;
            if(this.SelectByID(id, SteamGameID, out XSteamItem))
            {
                SteamItem = new USteamItem();
                SteamItem.ID = XSteamItem.ID;
                if (currency == 1)
                {
                    SteamItem.Name = XSteamItem.RusName;
                }
                else if(currency == 0)
                {
                    SteamItem.Name = XSteamItem.Name;
                }

                SteamItem.Image = XSteamItem.Image;
                SteamItem.Price = XSteamItem.Price;
                SteamItem.Price_Str = XSteamItem.Price.ToString("###,##0.00");
                SteamItem.RarityColor = this.GetRarityColor(XSteamItem.Rarity, XSteamItem.SteamGameID);
                SteamItem.Rarity = XSteamItem.Rarity;

                SteamItem.Color = XSteamItem.Color;
                SteamItem.SteamGameID = SteamGameID;

                return true;
            }

            SteamItem = null;
            return false;
        }