Ejemplo n.º 1
0
        public static ObjectPropertyList ResolveOPL(IEntity e, Mobile v)
        {
            if (e == null || e.Deleted)
            {
                return(null);
            }

            var opl = new ObjectPropertyList(e);

            if (e is Item)
            {
                var item = (Item)e;

                item.GetProperties(opl);
                item.AppendChildProperties(opl);
            }
            else if (e is Mobile)
            {
                var mob = (Mobile)e;

                mob.GetProperties(opl);
            }

            using (var eopl = new ExtendedOPL(opl))
            {
                InvokeOPLRequest(e, v, eopl);
            }

            opl.Terminate();
            opl.SetStatic();

            return(opl);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Forces the comilation of a new Item based ObjectPropertyList and sends it to the specified Mobile
        /// </summary>
        /// <param name="to">Mobile viewer, the Mobile viewing the OPL</param>
        /// <param name="item"></param>
        public static void SendPropertiesTo(Mobile to, Item item)
        {
            if (to == null || item == null)
            {
                return;
            }

            var opl = new ObjectPropertyList(item);

            item.GetProperties(opl);
            item.AppendChildProperties(opl);

            var eopl = new ExtendedOPL(opl);

            InvokeOPLRequest(item, to, eopl);

            eopl.Apply();

            opl = eopl.Opl;

            opl.Terminate();
            opl.SetStatic();

            to.Send(opl);

            Cache.Remove(opl);
        }
Ejemplo n.º 3
0
        private static void OnEncode0xD6(NetState state, PacketReader reader, ref byte[] buffer, ref int length)
        {
            if (state == null || reader == null || buffer == null || length < 0)
            {
                return;
            }

            int pos = reader.Seek(0, SeekOrigin.Current);

            reader.Seek(5, SeekOrigin.Begin);
            Serial serial = reader.ReadInt32();

            reader.Seek(pos, SeekOrigin.Begin);

            if (serial.IsItem)
            {
                Item item = World.FindItem(serial);

                if (item == null || item.Deleted)
                {
                    return;
                }

                var list = new ObjectPropertyList(item);

                item.GetProperties(list);
                item.AppendChildProperties(list);

                InvokeItemOPLRequest(item, state.Mobile, list);

                list.Terminate();
                list.SetStatic();

                buffer = list.Compile(state.CompressionEnabled, out length);
            }
            else if (serial.IsMobile)
            {
                Mobile mobile = World.FindMobile(serial);

                if (mobile == null || mobile.Deleted)
                {
                    return;
                }

                var list = new ObjectPropertyList(mobile);

                mobile.GetProperties(list);

                InvokeMobileOPLRequest(mobile, state.Mobile, list);

                list.Terminate();
                list.SetStatic();

                buffer = list.Compile(state.CompressionEnabled, out length);
            }
        }
Ejemplo n.º 4
0
        private static void OnEncode0xD6(NetState state, PacketReader reader, ref byte[] buffer, ref int length)
        {
            if (state == null || reader == null || buffer == null || length < 0)
            {
                return;
            }

            int pos = reader.Seek(0, SeekOrigin.Current);

            reader.Seek(5, SeekOrigin.Begin);
            Serial serial = reader.ReadInt32();

            reader.Seek(pos, SeekOrigin.Begin);

            var e = World.FindEntity(serial);

            if (e == null || e.Deleted)
            {
                return;
            }

            var opl = new ObjectPropertyList(e);

            if (e is Item)
            {
                var item = (Item)e;

                item.GetProperties(opl);
                item.AppendChildProperties(opl);
            }
            else if (e is Mobile)
            {
                var mob = (Mobile)e;

                mob.GetProperties(opl);
            }

            var eopl = new ExtendedOPL(opl);

            InvokeOPLRequest(e, state.Mobile, eopl);

            eopl.Apply();

            opl.Terminate();
            opl.SetStatic();

            buffer = opl.Compile(state.CompressionEnabled, out length);

            Cache.Remove(opl);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Forces the comilation of a new Mobile based ObjectPropertyList and sends it to the specified Mobile
        /// </summary>
        /// <param name="to">Mobile viewer, the Mobile viewing the OPL</param>
        /// <param name="m">Mobile owner, the Mobile which owns the OPL</param>
        public static void SendPropertiesTo(Mobile to, Mobile m)
        {
            if (to == null || m == null)
            {
                return;
            }

            var list = new ObjectPropertyList(m);

            m.GetProperties(list);

            InvokeMobileOPLRequest(m, to, list);

            list.Terminate();
            list.SetStatic();

            to.Send(list);
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Forces the comilation of a new Item based ObjectPropertyList and sends it to the specified Mobile
        /// </summary>
        /// <param name="to">Mobile viewer, the Mobile viewing the OPL</param>
        /// <param name="item"></param>
        public static void SendPropertiesTo(Mobile to, Item item)
        {
            if (to == null || item == null)
            {
                return;
            }

            var list = new ObjectPropertyList(item);

            item.GetProperties(list);
            item.AppendChildProperties(list);

            InvokeItemOPLRequest(item, to, list);

            list.Terminate();
            list.SetStatic();

            to.Send(list);
        }