コード例 #1
0
        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);
            }
        }