public InventoryComponent(uint userId, GameClient client, UserDataFactory userdata)
		{
			this.Session = client;
			this.UserId = userId;
       
			this.Items = new List<UserItem>();

			this.Pets = new Hashtable();
            this.Bots = new Hashtable();
			this.hashtable_1 = new Hashtable();

            this.Discs = new Hashtable();

			this.list_1 = new List<uint>();
			
			foreach (DataRow row in userdata.GetItems().Rows)
			{
                string str;

                uint id = Convert.ToUInt32(row["Id"]);
                uint baseItem = Convert.ToUInt32(row["base_item"]);
                int ltdi = Convert.ToInt32(row["ltd_id"]);
                int ltdc = Convert.ToInt32(row["ltd_cnt"]);
                string glddata = (string)row["guild_data"];
                if (!DBNull.Value.Equals(row["extra_data"]))
                    str = (string)row["extra_data"];
                else
                    str = string.Empty;

                UserItem item = new UserItem(id, baseItem, str, ltdi, ltdc, glddata);

                Items.Add(item);

               

                if (item.GetBaseItem().InteractionType == "musicdisc")
                    this.Discs.Add(item.uint_0, item);
			}

			foreach (DataRow row in userdata.GetPets().Rows)
			{
				Pet pet = Essential.GetGame().GetCatalog().GetPet(row);
				this.Pets.Add(pet.PetId, pet);
			}

           foreach (DataRow row in userdata.GetBots().Rows)
            {
                UserBot bot = Essential.GetGame().GetCatalog().RetrBot(row);
                this.Bots.Add(bot.BotId, bot);
            }
            
		}
Exemple #2
0
		public void method_3(uint uint_3, UserItem class39_0)
		{
			TradeUser @class = this.method_1(uint_3);
			if (@class != null && class39_0 != null && [email protected]_0 && this.int_0 == 1)
			{
				this.method_8();
				@class.OfferedItems.Remove(class39_0);
				this.method_9();
			}
		}
Exemple #3
0
		public void method_2(uint uint_3, UserItem class39_0)
		{
			TradeUser @class = this.method_1(uint_3);
			if (@class != null && class39_0 != null && class39_0.GetBaseItem().AllowTrade && [email protected]_0 && this.int_0 == 1)
			{
				this.method_8();
				@class.OfferedItems.Add(class39_0);
				this.method_9();
			}
		}
		public void method_11(uint uint_1, uint uint_2, string string_0, bool bool_0, int ltd_id, int ltd_count, string GuildData)
		{
            UserItem item = new UserItem(uint_1, uint_2, string_0, ltd_id, ltd_count, GuildData);
			this.Items.Add(item);
			if (this.list_1.Contains(uint_1))
			{
				this.list_1.Remove(uint_1);
			}
			if (!this.hashtable_1.ContainsKey(uint_1))
			{
				if (bool_0)
				{
					using (DatabaseClient @class = Essential.GetDatabase().GetClient())
					{
						@class.ExecuteQuery(string.Concat(new object[]
						{
							"INSERT INTO items (Id,user_id,base_item,wall_pos, ltd_id, ltd_cnt, guild_data) VALUES ('",
							uint_1,
							"','",
							this.UserId,
							"','",
							uint_2,
							"', '', '",
							ltd_id,
							"','",
							ltd_count,
							"','",
							GuildData,
							"')"
						}));

                        if (!string.IsNullOrEmpty(string_0))
                        {
                            @class.AddParamWithValue("extra_data", string_0);
                            @class.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "DELETE FROM items_extra_data WHERE item_id = '" + uint_1 + "'; ",
                                                "INSERT INTO items_extra_data (item_id,extra_data) VALUES ('" + uint_1 + "' , @extra_data); "
                                            }));
                        }
                        else
                        {
                            @class.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "DELETE FROM items_extra_data WHERE item_id = '" + uint_1 + "'; "
                                            }));
                        }
						return;
					}
				}

                if (item.GetBaseItem().InteractionType == "musicdisc")
                {
                    if (this.Discs.ContainsKey(item.uint_0))
                    {
                        this.Discs.Add(item.uint_0, item);
                    }
                }

				using (DatabaseClient @class = Essential.GetDatabase().GetClient())
				{
					@class.ExecuteQuery(string.Concat(new object[]
					{
						"UPDATE items SET room_id = 0, user_id = '",
						this.UserId,
						"' WHERE Id = '",
						uint_1,
						"'"
					}));
				}
			}
		}