예제 #1
0
            public GMItemPacket(Item item)
                : base(0x1A)
            {
                EnsureCapacity(20);

                // 14 base length
                // +2 - Amount
                // +2 - Hue
                // +1 - Flags

                uint serial = (uint)item.Serial.Value;
                int itemID = 0x1183;
                int amount = item.Amount;
                Point3D loc = item.Location;
                int x = loc.X;
                int y = loc.Y;
                int hue = item.Hue;
                int flags = item.GetPacketFlags();
                int direction = (int)item.Direction;

                if (amount != 0)
                    serial |= 0x80000000;
                else
                    serial &= 0x7FFFFFFF;

                m_Stream.Write(serial);
                m_Stream.Write((short)(itemID & 0x7FFF));

                if (amount != 0)
                    m_Stream.Write((short)amount);

                x &= 0x7FFF;

                if (direction != 0)
                    x |= 0x8000;

                m_Stream.Write((short)x);

                y &= 0x3FFF;

                if (hue != 0)
                    y |= 0x8000;

                if (flags != 0)
                    y |= 0x4000;

                m_Stream.Write((short)y);

                if (direction != 0)
                    m_Stream.Write((byte)direction);

                m_Stream.Write((sbyte)loc.Z);

                if (hue != 0)
                    m_Stream.Write((ushort)hue);

                if (flags != 0)
                    m_Stream.Write((byte)flags);
            }
예제 #2
0
            public GMItemPacket(Item item)
                : base(0x1A)
            {
                this.EnsureCapacity(20);

                // 14 base length
                // +2 - Amount
                // +2 - Hue
                // +1 - Flags

                uint    serial    = (uint)item.Serial.Value;
                int     itemID    = 0x36FF;
                int     amount    = item.Amount;
                Point3D loc       = item.Location;
                int     x         = loc.X;
                int     y         = loc.Y;
                int     hue       = item.Hue;
                int     flags     = item.GetPacketFlags();
                int     direction = (int)item.Direction;

                if (amount != 0)
                {
                    serial |= 0x80000000;
                }
                else
                {
                    serial &= 0x7FFFFFFF;
                }

                m_Stream.Write((uint)serial);
                m_Stream.Write((short)(itemID & TileData.MaxItemValue));

                if (amount != 0)
                {
                    m_Stream.Write((short)amount);
                }

                x &= 0x7FFF;

                if (direction != 0)
                {
                    x |= 0x8000;
                }

                m_Stream.Write((short)x);

                y &= 0x3FFF;

                if (hue != 0)
                {
                    y |= 0x8000;
                }

                if (flags != 0)
                {
                    y |= 0x4000;
                }

                m_Stream.Write((short)y);

                if (direction != 0)
                {
                    m_Stream.Write((byte)direction);
                }

                m_Stream.Write((sbyte)loc.Z);

                if (hue != 0)
                {
                    m_Stream.Write((ushort)hue);
                }

                if (flags != 0)
                {
                    m_Stream.Write((byte)flags);
                }
            }
예제 #3
0
        public OldEtherealResidueWorldItem(Item item) : base(0x1A)
        {
            this.EnsureCapacity(20);

            uint    serial    = (uint)item.Serial.Value;
            int     itemID    = 0x0F8F & 0x3FFF;      //grave dust
            int     amount    = item.Amount;
            Point3D loc       = item.Location;
            int     x         = loc.X;
            int     y         = loc.Y;
            int     hue       = item.Hue == 0 ? 1151 : item.Hue;   //pretty close in hue
            int     flags     = item.GetPacketFlags();
            int     direction = (int)item.Direction;

            if (amount != 0)
            {
                serial |= 0x80000000;
            }
            else
            {
                serial &= 0x7FFFFFFF;
            }

            m_Stream.Write((uint)serial);

            if (item is BaseMulti)
            {
                m_Stream.Write((short)(itemID | 0x4000));
            }
            else
            {
                m_Stream.Write((short)itemID);
            }

            if (amount != 0)
            {
                m_Stream.Write((short)amount);
            }

            x &= 0x7FFF;

            if (direction != 0)
            {
                x |= 0x8000;
            }

            m_Stream.Write((short)x);

            y &= 0x3FFF;

            if (hue != 0)
            {
                y |= 0x8000;
            }

            if (flags != 0)
            {
                y |= 0x4000;
            }

            m_Stream.Write((short)y);

            if (direction != 0)
            {
                m_Stream.Write((byte)direction);
            }

            m_Stream.Write((sbyte)loc.Z);

            if (hue != 0)
            {
                m_Stream.Write((ushort)hue);
            }

            if (flags != 0)
            {
                m_Stream.Write((byte)flags);
            }
        }