예제 #1
1
        public CustomHousePacket(PacketReader reader)
            : base(0xD8, "Custom House Packet")
        {
            byte CompressionType = reader.ReadByte();
            if (CompressionType != 3)
            {
                _houseSerial = Serial.Null;
                return;
            }
            reader.ReadByte(); // unknown, always 0?
            _houseSerial = reader.ReadInt32();
            _revisionHash = reader.ReadInt32();

            // this is for compression type 3 only
            int bufferLength = reader.ReadInt16();
            int trueBufferLength = reader.ReadInt16();
            _numPlanes = reader.ReadByte();
            // end compression type 3

            _planes = new CustomHousePlane[_numPlanes];
            for (int i = 0; i < _numPlanes; i++)
            {
                _planes[i] = new CustomHousePlane(reader);
            }
        }
예제 #2
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;
        }
예제 #3
0
 public ServerRelayPacket(PacketReader reader)
     : base(0x8C, "Server Relay")
 {
     _ipAddress = reader.ReadInt32();
     _port = reader.ReadInt16();
     _accountId = reader.ReadInt32();
 }
예제 #4
0
 public DeathAnimationPacket(PacketReader reader)
     : base(0xAF, "Death Animation")
 {
     PlayerSerial = reader.ReadInt32();
     CorpseSerial = reader.ReadInt32();
     reader.ReadInt32(); // unknown - all zero's.
 }
예제 #5
0
 public SwingPacket(PacketReader reader)
     : base(0x2F, "Swing")
 {
     _flag = reader.ReadByte();
     _attacker = reader.ReadInt32();
     _defender = reader.ReadInt32();
 }
예제 #6
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();
            }
        }
예제 #7
0
 public WornItemPacket(PacketReader reader)
     : base(0x2E, "Worn Item")
 {
     _serial = reader.ReadInt32();
     _itemId = reader.ReadInt16();
     reader.ReadByte();
     _layer = reader.ReadByte();
     _parentSerial = reader.ReadInt32();
     _hue = reader.ReadInt16();
 }
예제 #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();
 }
예제 #9
0
 public UnicodeMessagePacket(PacketReader reader)
     : base(0xAE, "Unicode Message")
 {
     _serial = reader.ReadInt32();
     _model = reader.ReadInt16();
     _msgType = (MessageType)reader.ReadByte();
     _hue = reader.ReadInt16();
     _font = reader.ReadInt16();
     _language = reader.ReadInt32();
     _speakerName = reader.ReadString(30);
     _spokenText = reader.ReadUnicodeString((reader.Buffer.Length - 48) / 2);
 }
예제 #10
0
        public LoginConfirmPacket(PacketReader reader)
            : base(0x1B, "Login Confirm")
        {
            _serial = reader.ReadInt32();

            reader.ReadInt32();//unknown..

            _body = reader.ReadInt16();
            _x = reader.ReadInt16();
            _y = reader.ReadInt16();
            _z = reader.ReadInt16();
            _direction = 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();
 }
예제 #12
0
        public VendorBuyListPacket(PacketReader reader)
            : base(0x74, "Open Buy Window")
        {
            _vendorPackSerial = reader.ReadInt32();
            _itemCount = reader.ReadByte();
            _prices = new int[_itemCount];
            _descriptions = new string[_itemCount];

            for (int i = 0; i < this._itemCount; i++)
            {
                _prices[i] = reader.ReadInt32();
                int descriptionLegnth = reader.ReadByte();
                _descriptions[i] = reader.ReadString(descriptionLegnth);
            }
        }
예제 #13
0
 public UpdateStaminaPacket(PacketReader reader)
     : base(0xA3, "Update Stamina")
 {
     _serial = reader.ReadInt32();
     _max = reader.ReadInt16();
     _current = reader.ReadInt16();
 }
예제 #14
0
 public TargetCursorPacket(PacketReader reader)
     : base(0x6C, "Target Cursor")
 {
     _commandtype = reader.ReadByte(); // 0x00 = Select Object; 0x01 = Select X, Y, Z
     _cursorid = reader.ReadInt32();
     _cursortype = reader.ReadByte(); // 0 - 2 = unknown; 3 = Cancel current targetting RunUO seems to always send 0.
 }
예제 #15
0
 public UpdateHealthPacket(PacketReader reader)
     : base(0xA1, "Update Health")
 {
     _serial = reader.ReadInt32();
     _max = reader.ReadInt16();
     _current = reader.ReadInt16();
 }
예제 #16
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();
 }
예제 #17
0
        public MobileStatusCompactPacket(PacketReader reader)
            : base(0x11, "StatusInfo")
        {
            _serial = reader.ReadInt32();
            _playerName = reader.ReadString(30);
            _currentHealth = reader.ReadInt16();
            _maxHealth = reader.ReadInt16();
            _nameChangeFlag = reader.ReadByte(); // 0x1 = allowed, 0 = not allowed
            _statusTypeFlag = reader.ReadByte();
            sex = (Sex)reader.ReadByte(); // 0=male, 1=female
            _strength = reader.ReadInt16();
            _dexterity = reader.ReadInt16();
            _intelligence = reader.ReadInt16();
            _currentStamina = reader.ReadInt16();
            _maxStamina = reader.ReadInt16();
            _currentMana = reader.ReadInt16();
            _maxMana = reader.ReadInt16();
            _goldInInventory = reader.ReadInt32();
            _armorRating = reader.ReadInt16();
            _weight = reader.ReadInt16();

            if (_statusTypeFlag >= 5)
            {
                _maxWeight = reader.ReadInt16();
                _race = (Race)reader.ReadByte();
            }

            if (_statusTypeFlag >= 3)
            {
                _statCap = reader.ReadInt16();
                _followers = reader.ReadByte();
                _maxFollowers = reader.ReadByte();
            }

            if (_statusTypeFlag >= 4)
            {
                _resistFire = reader.ReadInt16();
                _resistCold = reader.ReadInt16();
                _resistPoison = reader.ReadInt16();
                _resistEnergy = reader.ReadInt16();
                _luck = reader.ReadInt16();
                _dmgMin = reader.ReadInt16();
                _dmgMax = reader.ReadInt16();
                _tithingPoints = reader.ReadInt16();
            }
        }
예제 #18
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();
            }
        }
예제 #19
0
        public CompressedGumpPacket(PacketReader reader)
            : base(0xDD, "Compressed Gump")
        {
            Serial = reader.ReadInt32();
            GumpID = reader.ReadInt32();
            X = reader.ReadInt32();
            Y = reader.ReadInt32();

            int compressedLength = reader.ReadInt32() - 4;
            int decompressedLength = reader.ReadInt32();
            byte[] compressedData = reader.ReadBytes(compressedLength);
            byte[] decompressedData = new byte[decompressedLength];

            if (Compression.Unpack(decompressedData, ref decompressedLength, compressedData, compressedLength) != ZLibError.Okay)
            {
                // Problem decompressing, go ahead and quit.
                return;
            }
            else
            {
                GumpData = Encoding.ASCII.GetString(decompressedData);

                int numTextLines = reader.ReadInt32();
                int compressedTextLength = reader.ReadInt32() - 4;
                int decompressedTextLength = reader.ReadInt32();
                byte[] decompressedText = new byte[decompressedTextLength];
                if (numTextLines > 0 && decompressedTextLength > 0)
                {
                    byte[] compressedTextData = reader.ReadBytes(compressedTextLength);
                    Compression.Unpack(decompressedText, ref decompressedTextLength, compressedTextData, compressedTextLength);
                    int index = 0;
                    List<string> lines = new List<string>();
                    for (int i = 0; i < numTextLines; i++)
                    {
                        int length = decompressedText[index] * 256 + decompressedText[index + 1];
                        index += 2;
                        byte[] b = new byte[length * 2];
                        Array.Copy(decompressedText, index, b, 0, length * 2);
                        index += length * 2;
                        lines.Add(Encoding.BigEndianUnicode.GetString(b));
                    }
                    TextLines = lines.ToArray();
                }
                else
                {
                    TextLines = new string[0];
                }
            }
        }
예제 #20
0
 public CorpseClothingPacket(PacketReader reader)
     : base(0x89, "Corpse Clothing")
 {
     CorpseSerial = reader.ReadInt32(); // BYTE[4] corpseID
     bool isNotTerminated = false;
     while (isNotTerminated)
     {
         int layer = reader.ReadByte();
         if (layer == 0x00)
         {
             isNotTerminated = false;
         }
         else
         {
             Serial itemSerial = reader.ReadInt32();
             Items.Add(new CorpseClothingItemWithLayer(layer, itemSerial));
         }
     }
 }
예제 #21
0
 public MobileAttributesPacket(PacketReader reader)
     : base(0x2D, "Mobile Attributes")
 {
     _serial = reader.ReadInt32();
     _maxHits = reader.ReadInt16();
     _currentHits = reader.ReadInt16();
     _maxMana = reader.ReadInt16();
     _currentMana = reader.ReadInt16();
     _maxStamina = reader.ReadInt16();
     _currentStamina = reader.ReadInt16();
 }
예제 #22
0
 public AsciiMessagePacket(PacketReader reader)
     : base(0x1C, "Ascii Message")
 {
     _serial = reader.ReadInt32();
     _graphic = reader.ReadInt16();
     _type = (MessageType)reader.ReadByte();
     _hue = reader.ReadInt16();
     _font = reader.ReadInt16();
     _name = reader.ReadString(30);
     _text = reader.ReadString();
 }
예제 #23
0
 public MobileAnimationPacket(PacketReader reader)
     : base(0x6E, "Mobile Animation")
 {
     _serial = reader.ReadInt32();
     _action = reader.ReadInt16();
     _framecount = reader.ReadInt16();
     _repeatcount = reader.ReadInt16();
     _reverse = reader.ReadByte(); // 0x00=forward, 0x01=backwards
     _repeat = reader.ReadByte(); // 0 - Don't repeat / 1 repeat
     _delay = reader.ReadByte();
 }
예제 #24
0
 // This is called when the packet is received.
 public TargetCursorMultiPacket(PacketReader reader)
     : base(0x99, "Target Cursor For Multi")
 {
     reader.ReadByte(); // (0x01 from server, 0x00 from client)
     _deedSerial = reader.ReadInt32();
     reader.ReadByte(); // flag byte. Harmful = 1, Beneficial = 2. Unused.
     reader.ReadBytes(11); // unknown (all 0)
     _multiModel = reader.ReadInt16();
     _offsetX = reader.ReadInt16();
     _offsetY = reader.ReadInt16();
     _offsetZ = reader.ReadInt16();
 }
예제 #25
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();
 }
예제 #26
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();
 }
예제 #27
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);
        }
예제 #28
0
 public RemoveEntityPacket(PacketReader reader)
     : base(0x1D, "Remove Entity")
 {
     _serial = reader.ReadInt32();
 }
예제 #29
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);
 }
예제 #30
0
 public GraphicEffectHuedPacket(int id, PacketReader reader)
     : base(id, reader)
 {
     Hue = reader.ReadInt32();
     BlendMode = (GraphicEffectBlendMode)reader.ReadInt32();
 }