Пример #1
0
        /// <summary>
        /// </summary>
        /// <returns>
        /// </returns>
        public bool Read()
        {
            foreach (DBItem item in ItemDao.GetAllInContainer((int)this.Identity.Type, this.Identity.Instance))
            {
                Item newItem = new Item(item.quality, item.lowid, item.highid);
                newItem.SetAttribute(412, item.multiplecount);
                this.Content.Add(item.containerplacement, newItem);

                // Make item visible
                // TODO: Other flags must be set too
                newItem.Flags |= 0x1;
            }

            foreach (DBInstancedItem item in
                     InstancedItemDao.GetAllInContainer((int)this.Identity.Type, this.Identity.Instance))
            {
                Item newItem = new Item(item.quality, item.lowid, item.highid);
                newItem.SetAttribute(412, item.multiplecount);
                Identity temp = new Identity();
                temp.Type        = (IdentityType)item.itemtype;
                temp.Instance    = item.iteminstance;
                newItem.Identity = temp;

                byte[] binaryStats = item.stats.ToArray();
                for (int i = 0; i < binaryStats.Length / 8; i++)
                {
                    int statid    = BitConverter.ToInt32(binaryStats, i * 8);
                    int statvalue = BitConverter.ToInt32(binaryStats, i * 8 + 4);
                    newItem.SetAttribute(statid, statvalue);
                }

                // Make item visible
                // TODO: Other flags must be set too
                // Anything ->    =0x01
                // Containers ->  =0x02
                // ????? ->       |0x20
                // ????? ->       |0x80 (maybe unique)

                // Found online: 0xa1 for nano instruction disc
                //               0x02 for any bag
                //               0x81 for unique totw rings
                newItem.Flags |= 0x1;
            }

            return(true);
        }