Exemplo n.º 1
0
        public ContainerContentPacket(PacketReader reader)
            : base(0x3C, "Container ContentPacket")
        {
            int itemCount = reader.ReadUInt16();
            List<ContentItem> items = new List<ContentItem>(itemCount);

            for (int i = 0; i < itemCount; i++)
            {
                Serial serial = reader.ReadInt32();
                int iItemID = reader.ReadUInt16();
                int iUnknown = reader.ReadByte(); // signed, itemID offset. always 0 in RunUO.
                int iAmount = reader.ReadUInt16();
                int iX = reader.ReadInt16();
                int iY = reader.ReadInt16();
                int iGridLocation = 0;
                if (!NextContainerContentsIsPre6017)
                    iGridLocation = reader.ReadByte(); // always 0 in RunUO.
                int iContainerSerial = reader.ReadInt32();
                int iHue = reader.ReadUInt16();

                items.Add(new ContentItem(serial, iItemID, iAmount, iX, iY, iGridLocation, iContainerSerial, iHue));
            }

            _items = items.ToArray();
            if (NextContainerContentsIsPre6017)
                NextContainerContentsIsPre6017 = false;
        }
Exemplo n.º 2
0
 public MobileMovingPacket(PacketReader reader)
     : base(0x77, "Mobile Moving")
 {
     this.serial = reader.ReadInt32();
     this.bodyid = reader.ReadUInt16();
     this.x = reader.ReadInt16();
     this.y = reader.ReadInt16();
     this.z = reader.ReadSByte();
     this.direction = reader.ReadByte();
     this.hue = reader.ReadUInt16();
     this.Flags = new MobileFlags(reader.ReadByte());
     this.notoriety = reader.ReadByte();
 }
 public ContainerContentUpdatePacket(PacketReader reader)
     : base(0x25, "Add Single Item")
 {
     _serial = reader.ReadInt32();
     _itemId = reader.ReadUInt16();
     reader.ReadByte(); // unknown
     _amount = reader.ReadUInt16();
     _x = reader.ReadInt16();
     _y = reader.ReadInt16();
     _gridLocation = reader.ReadByte(); // always 0 in RunUO.
     _parentSerial = (Serial)reader.ReadInt32();
     _hue = reader.ReadUInt16();
 }
Exemplo n.º 4
0
        public ObjectPropertyListPacket(PacketReader reader)
            : base(0xD6, "Object Property List")
        {
            reader.ReadInt16(); // Always 0x0001
            _serial = reader.ReadInt32();

            reader.ReadInt16(); // Always 0x0000
            _hash = reader.ReadInt32();

            _clilocs = new List<int>();
            _arguments = new List<string>();

            // Loop of all the item/creature's properties to display in the order to display them. The name is always the first entry.
            int clilocId = reader.ReadInt32();

            while (clilocId != 0)
            {
                _clilocs.Add(clilocId);

                int textLength = reader.ReadUInt16();
                string args = string.Empty;

                if (textLength > 0)
                {
                    args = reader.ReadUnicodeStringReverse(textLength / 2);
                }

                _arguments.Add(args);

                clilocId = reader.ReadInt32();
            }
        }
Exemplo n.º 5
0
        public WorldItemPacket(PacketReader reader)
            : base(0x1A, "ObjectInfo")
        {
            Serial serial = reader.ReadInt32();
            ushort itemId = reader.ReadUInt16();

            _amount = 0;

            if ((serial & 0x80000000) == 0x80000000)
            {
                _amount = reader.ReadInt16();
            }

            // Doesn't exist this thing in the packet
            /*byte iIncrement = 0;
            if ((iItemID & 0x8000) == 0x8000)
            {
                iIncrement = reader.ReadByte();
                iObjectSerial += iIncrement;
            }*/

            ushort x = reader.ReadUInt16();
            ushort y = reader.ReadUInt16();

            _direction = 0;

            if ((x & 0x8000) == 0x8000)
                _direction = reader.ReadByte();

            _z = reader.ReadSByte();
            _hue = 0;

            if ((y & 0x8000) == 0x8000)
                _hue = reader.ReadUInt16();

            _flags = 0;

            if ((y & 0x4000) == 0x4000)
                _flags = reader.ReadByte();

            _serial = (int)(serial &= 0x7FFFFFFF);
            _itemid = (short)(itemId &= 0x7FFF);
            _x = (short)(x &= 0x7FFF);
            _y = (short)(y &= 0x3FFF);
        }
Exemplo n.º 6
0
 public SendSkillsPacket(PacketReader reader)
     : base(0x3A, "Send Skills List")
 {
     PacketType = reader.ReadByte();
     bool hasSkillCap = (PacketType == 0x02 || PacketType == 0xDF);
     int numSkills = (reader.Size - reader.Index - (PacketType == 0x00 ? 2 : 0)) / (hasSkillCap ? 9 : 7);
     Skills = new SendSkillsPacket_SkillEntry[numSkills];
     for (int i = 0; i < numSkills; i++)
     {
         Skills[i] = new SendSkillsPacket_SkillEntry(reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadByte());
         if (hasSkillCap)
             Skills[i].SetSkillCap(reader.ReadUInt16());
     }
     // 0x00: Full List of skills
     // 0xFF: Single skill update
     // 0x02: Full List of skills with skill cap for each skill
     // 0xDF: Single skill update with skill cap for skill
 }
Exemplo n.º 7
0
        public MobileIncomingPacket(PacketReader reader)
            : base(0x78, "Mobile Incoming")
        {
            // Mobile
            _serial = reader.ReadInt32();
            _body = reader.ReadInt16();
            _x = reader.ReadInt16();
            _y = reader.ReadInt16();
            _z = reader.ReadSByte();
            _direction = reader.ReadByte();
            _hue = reader.ReadUInt16();
            this.Flags = new MobileFlags(reader.ReadByte());
            _notoriety = reader.ReadByte();

            // Read equipment - nine bytes ea.
            List<EquipmentEntry> items = new List<EquipmentEntry>();

            Serial serial = reader.ReadInt32();
            if (!serial.IsValid)
            {
                reader.ReadByte(); //zero terminated
                _equipment = new EquipmentEntry[0];
            }
            else
            {
                while (serial.IsValid)
                {
                    ushort gumpId = reader.ReadUInt16();
                    byte layer = reader.ReadByte();
                    ushort hue = 0;

                    if ((gumpId & 0x8000) == 0x8000)
                    {
                        gumpId = (ushort)((int)gumpId - 0x8000);
                        hue = reader.ReadUInt16();
                    }

                    items.Add(new EquipmentEntry(serial, gumpId, layer, hue));
                    // read the next serial and begin the loop again. break at 0x00000000
                    serial = reader.ReadInt32();
                }
                _equipment = items.ToArray();
            }
        }
Exemplo n.º 8
0
 public MessageLocalizedPacket(PacketReader reader)
     : base(0xC1, "Message Localized")
 {
     Serial = reader.ReadInt32(); // 0xffff for system message
     Body = reader.ReadInt16(); // (0xff for system message
     MessageType = (MessageType)reader.ReadByte(); // 6 - lower left, 7 on player
     Hue = reader.ReadUInt16();
     Font = reader.ReadInt16();
     CliLocNumber = reader.ReadInt32();
     SpeakerName = reader.ReadString(30);
     Arguements = reader.ReadUnicodeStringSafeReverse();
 }
Exemplo n.º 9
0
 public MobileUpdatePacket(PacketReader reader)
     : base(0x20, "Mobile Update")
 {
     _serial = reader.ReadInt32();
     _body = reader.ReadInt16();
     reader.ReadByte(); // Always 0
     _hue = reader.ReadUInt16(); // Skin hue
     _flags = new MobileFlags(reader.ReadByte());
     _x = reader.ReadInt16();
     _y = reader.ReadInt16();
     reader.ReadInt16(); // Always 0
     _direction = reader.ReadByte();
     _z = reader.ReadSByte();
 }
Exemplo n.º 10
0
 public DragEffectPacket(PacketReader reader)
     : base(0x23, "Dragging Item")
 {
     _itemId = reader.ReadUInt16();
     reader.ReadByte(); // 0x03 bytes unknown.
     reader.ReadByte(); //
     reader.ReadByte(); //
     _amount = reader.ReadUInt16();
     _sourceContainer = reader.ReadInt32(); // 0xFFFFFFFF for ground
     _sourceX = reader.ReadUInt16();
     _sourceY = reader.ReadUInt16();
     _sourceZ = reader.ReadByte();
     _destContainer = reader.ReadInt32(); // 0xFFFFFFFF for ground
     _destX = reader.ReadUInt16();
     _destY = reader.ReadUInt16();
     _destZ = reader.ReadByte();
 }
Exemplo n.º 11
0
 public GraphicEffectPacket(int id, PacketReader reader)
     : base(id, "Show Graphic Effect")
 {
     EffectType = (GraphicEffectType)reader.ReadByte();
     SourceSerial = reader.ReadInt32();
     TargetSerial = reader.ReadInt32();
     BaseItemID = reader.ReadUInt16();
     SourceX = reader.ReadUInt16();
     SourceY = reader.ReadUInt16();
     SourceZ = reader.ReadByte();
     TargetX = reader.ReadUInt16();
     TargetY = reader.ReadUInt16();
     TargetZ = reader.ReadByte();
     Speed = reader.ReadByte();
     Duration = reader.ReadByte();
     int unknown0 = reader.ReadUInt16();
     FixedDirection = (reader.ReadByte() != 0);
     DoesExplode = (reader.ReadByte() != 0);
 }
Exemplo n.º 12
0
        void receiveContextMenu(PacketReader reader)
        {
            reader.ReadByte(); // unknown (0x00)
            int iSubCommand = reader.ReadByte(); // 0x01 for 2D, 0x02 for KR
            _contextmenu = new ContextMenu(reader.ReadInt32());
            int iNumEntriesInContext = reader.ReadByte();

            for (int i = 0; i < iNumEntriesInContext; i++)
            {
                int iUniqueID = reader.ReadUInt16();
                int iClilocID = reader.ReadUInt16() + 3000000;
                int iFlags = reader.ReadUInt16(); // 0x00=enabled, 0x01=disabled, 0x02=arrow, 0x20 = color
                int iColor = 0;
                if ((iFlags & 0x20) == 0x20)
                {
                    iColor = reader.ReadUInt16();
                }
                _contextmenu.AddItem(iUniqueID, iClilocID, iFlags, iColor);
            }
            _contextmenu.FinalizeMenu();
        }
Exemplo n.º 13
0
 public OpenContainerPacket(PacketReader reader)
     : base(0x24, "Open Container")
 {
     this._serial = reader.ReadInt32();
     this._gumpId = reader.ReadUInt16();
 }