Esempio n. 1
0
        bool AddItem(ByteArrayBase data)
        {
            byte   slot;
            uint   id;
            ushort len;

            data.Get(out slot).Get(out id).Get(out len);

            ByteArray b = null;

            if (len > 0)
            {
                b = new ByteArray(data.GetArray(len));
            }
            Item n = new Item(gameServer);

            n = n.Create(this, id, b);
            if (n == null)
            {
                return(false);
            }
            return(AddItem((SlotID)slot, n));
        }
Esempio n. 2
0
        protected virtual bool Create(Character c, Hashtable data, ByteArrayBase moredata)
        {
            if (!data.Contains("model"))
            {
                return(false);
            }

            base.Create(c.NextGUID());

            model = (uint)(int)data["model"];

            SetUpdateValue(UpdateFields.ITEM_FIELD_OWNER, c.GUID);
            //SetUpdateValue(UpdateFields.ITEM_FIELD_OWNER_01, c.GUID);
            SetUpdateValue(UpdateFields.ITEM_FIELD_CONTAINED, c.GUID);
            //SetUpdateValue(UpdateFields.ITEM_FIELD_CONTAINED_01, c.GUID);

            if (data.Contains("inventorytype"))
            {
                wornType = (WORN)(int)data["inventorytype"];
            }
            if (data.Contains("quality"))
            {
                quality = (byte)(int)data["quality"];
            }

            uint moreflags = 0;

            if (moredata != null)
            {
                moredata.Get(out mdurability).Get(out durability).Get(out stackcount).Get(out flags).Get(out moreflags);
            }
            else
            {
                if (data.Contains("durability"))
                {
                    durability = mdurability = (ushort)(int)data["durability"];
                }
                if (data.Contains("stackcount"))
                {
                    stackcount = (byte)(int)data["stackcount"];
                }
            }

            bonusData  = data["bonus"] as int[];
            damageData = data["damage"] as int[];
            spellData  = data["spell"] as int[];
            resData    = new int[7];
            for (int i = 1; i <= 7; i++)
            {
                string str = "resistance" + i.ToString();
                if (data.Contains(str))
                {
                    resData[i - 1] = (int)data[str];
                }
            }
            if (data.Contains("delay"))
            {
                delay = (int)data["delay"];
            }

            SetUpdateValue(UpdateFields.ITEM_FIELD_STACK_COUNT, stackcount);
            SetUpdateValue(UpdateFields.ITEM_FIELD_FLAGS, flags);
            SetUpdateValue(UpdateFields.ITEM_FIELD_DURABILITY, (uint)durability);
            SetUpdateValue(UpdateFields.ITEM_FIELD_MAXDURABILITY, (uint)mdurability);
            return(true);
        }