Пример #1
1
        public ObjectInfoPacket(PacketReader reader)
            : base(0x1A, "ObjectInfoPacket")
        {
            Serial = reader.ReadInt32();
            ItemID = reader.ReadUInt16();

            Amount = (ushort)(((Serial & 0x80000000) == 0x80000000) ? reader.ReadUInt16() : 0);

            X = reader.ReadInt16();
            Y = reader.ReadInt16();
                        
            Direction = (byte)(((X & 0x8000) == 0x8000) ? reader.ReadByte() : 0);

            Z = reader.ReadSByte();

            Hue = (ushort)(((Y & 0x8000) == 0x8000) ? reader.ReadUInt16() : 0);

            Flags = (byte)(((Y & 0x4000) == 0x4000) ? reader.ReadByte() : 0);

            // sanitize values
            Serial = (int)(Serial & 0x7FFFFFFF);
            ItemID = (ushort)(ItemID & 0x7FFF);
            X = (short)(X & 0x7FFF);
            Y = (short)(Y & 0x3FFF);
        }
Пример #2
1
 public OpenContainerPacket(PacketReader reader)
     : base(0x24, "Open Container")
 {
     m_serial = reader.ReadInt32();
     m_gumpId = reader.ReadUInt16();
     reader.ReadUInt16();
 }
Пример #3
1
 public UpdateHealthPacket(PacketReader reader)
     : base(0xA1, "Update Health")
 {
     m_serial = reader.ReadInt32();
     m_max = reader.ReadInt16();
     m_current = reader.ReadInt16();
 }
Пример #4
1
 public UpdateStaminaPacket(PacketReader reader)
     : base(0xA3, "Update Stamina")
 {
     m_serial = reader.ReadInt32();
     m_max = reader.ReadInt16();
     m_current = reader.ReadInt16();
 }
 public DeathAnimationPacket(PacketReader reader)
     : base(0xAF, "Death Animation")
 {
     PlayerSerial = reader.ReadInt32();
     CorpseSerial = reader.ReadInt32();
     reader.ReadInt32(); // unknown - all zero's.
 }
Пример #6
1
 public SwingPacket(PacketReader reader)
     : base(0x2F, "Swing")
 {
     m_flag = reader.ReadByte();
     m_attacker = reader.ReadInt32();
     m_defender = reader.ReadInt32();
 }
        public ObjectPropertyListPacket(PacketReader reader)
            : base(0xD6, "Object Property List")
        {
            reader.ReadInt16(); // Always 0x0001
            m_serial = reader.ReadInt32();

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

            m_clilocs = new List<int>();
            m_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)
            {
                m_clilocs.Add(clilocId);

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

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

                m_arguments.Add(args);

                clilocId = reader.ReadInt32();
            }
        }
Пример #8
0
 public ChatPacket(PacketReader reader)
     : base(0xB3, "Chat Packet")
 {
     m_language = reader.ReadString(3);
     reader.ReadInt16(); // unknown.
     m_commandtype = reader.ReadByte();
 }
Пример #9
0
 public ServerRelayPacket(PacketReader reader)
     : base(0x8C, "Server Relay")
 {
     m_ipAddress = reader.ReadInt32();
     m_port = reader.ReadInt16();
     m_accountId = reader.ReadInt32();
 }
Пример #10
0
 public TimePacket(PacketReader reader)
     : base(0x5B, "Time")
 {
     m_hour = reader.ReadByte();
     m_minute = reader.ReadByte();
     m_second = reader.ReadByte();
 }
        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));
            }

            m_items = items.ToArray();
            if (NextContainerContentsIsPre6017)
                NextContainerContentsIsPre6017 = false;
        }
Пример #12
0
        public CustomHousePacket(PacketReader reader)
            : base(0xD8, "Custom House Packet")
        {
            byte CompressionType = reader.ReadByte();
            if (CompressionType != 3)
            {
                m_houseSerial = Serial.Null;
                return;
            }
            reader.ReadByte(); // unknown, always 0?
            m_houseSerial = reader.ReadInt32();
            m_revisionHash = reader.ReadInt32();

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

            m_planes = new CustomHousePlane[m_numPlanes];
            for (int i = 0; i < m_numPlanes; i++)
            {
                m_planes[i] = new CustomHousePlane(reader);
            }
        }
Пример #13
0
        public ContainerContentPacket(PacketReader reader)
            : base(0x3C, "Container ContentPacket")
        {
            int itemCount = reader.ReadUInt16();
            List<ItemInContainer> items = new List<ItemInContainer>(itemCount);

            bool PacketIsPre6017 = (reader.Buffer.Length == 5 + (19 * 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 (!PacketIsPre6017)
                    iGridLocation = reader.ReadByte(); // always 0 in RunUO.
                int iContainerSerial = reader.ReadInt32();
                int iHue = reader.ReadUInt16();

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

            m_items = items.ToArray();
        }
Пример #14
0
 public OpenPaperdollPacket(PacketReader reader)
     : base(0x88, "Open Paperdoll")
 {
     Serial = reader.ReadInt32();
     MobileName = reader.ReadStringSafe(60);
     //+flags
 }
Пример #15
0
 public ExtendedStatsInfo(PacketReader reader)
 {
     int clientFlag = reader.ReadByte(); // (0x2 for 2D client, 0x5 for KR client)
     Serial = reader.ReadInt32();
     byte unknown0 = reader.ReadByte(); // (always 0)
     byte lockFlags = reader.ReadByte();
     // Lock flags = bitflags 00SSDDII
     //     00 = up
     //     01 = down
     //     10 = locked
     // FF = update mobile status animation ( KR only )
     if (lockFlags != 0xFF) {
         int strengthLock = (lockFlags >> 4) & 0x03;
         int dexterityLock = (lockFlags >> 2) & 0x03;
         int inteligenceLock = (lockFlags) & 0x03;
         Locks = new StatLocks(strengthLock, dexterityLock, inteligenceLock);
     }
     if (clientFlag == 5) {
         Tracer.Warn("ClientFlags == 5 in GeneralInfoPacket ExtendedStats 0x19. This is not a KR client.");
         // If(Lock flags = 0xFF) //Update mobile status animation
         //  BYTE[1] Status // Unveryfied if lock flags == FF the locks will be handled here
         //  BYTE[1] unknown (0x00)
         //  BYTE[1] Animation
         //  BYTE[1] unknown (0x00)
         //  BYTE[1] Frame
         // else
         //  BYTE[1] unknown (0x00)
         //  BYTE[4] unknown (0x00000000)
         // endif
     }
 }
Пример #16
0
 public WeatherPacket(PacketReader reader)
     : base(0x65, "Set Weather")
 {
     m_weatherType = reader.ReadByte();
     m_effectId = reader.ReadByte();
     m_temperature = reader.ReadByte();
 }
Пример #17
0
 public TargetCursorPacket(PacketReader reader)
     : base(0x6C, "Target Cursor")
 {
     m_commandtype = reader.ReadByte(); // 0x00 = Select Object; 0x01 = Select X, Y, Z
     m_cursorid = reader.ReadInt32();
     m_cursortype = reader.ReadByte(); // 0 - 2 = unknown; 3 = Cancel current targetting RunUO seems to always send 0.
 }
Пример #18
0
 public ServerListEntry(PacketReader reader)
 {
     index = (ushort)reader.ReadInt16();
     name = reader.ReadString(30);
     percentFull = reader.ReadByte();
     timezone = reader.ReadByte();
     address = (uint)reader.ReadInt32();
 }
Пример #19
0
 public PartyMemberListInfo(PacketReader reader)
 {
     Count = reader.ReadByte();
     Serials = new int[Count];
     for (int i = 0; i < Count; i++) {
         Serials[i] = reader.ReadInt32();
     }
 }
Пример #20
0
 public ServerListEntry(PacketReader reader)
 {
     Index = (ushort)reader.ReadInt16();
     Name = reader.ReadString(32);
     PercentFull = reader.ReadByte();
     Timezone = reader.ReadByte();
     Address = (uint)reader.ReadInt32();
 }
Пример #21
0
 public ResurrectionMenuPacket(PacketReader reader)
     : base(0x2C, "Resurrection Menu")
 {
     ResurrectionAction = reader.ReadByte();
     // 0: Server sent
     // 1: Resurrect
     // 2: Ghost
     // The only use on OSI for this packet is now sending "2C02" for the "You Are Dead" screen upon character death.
 }
Пример #22
0
 public SpellBookContentsInfo(PacketReader reader)
 {
     ushort unknown = reader.ReadUInt16(); // always 1
     Serial serial = reader.ReadInt32();
     ushort itemID = reader.ReadUInt16();
     ushort spellbookType = reader.ReadUInt16(); // 1==regular, 101=necro, 201=paladin, 401=bushido, 501=ninjitsu, 601=spellweaving
     ulong spellBitfields = reader.ReadUInt32() + (((ulong)reader.ReadUInt32()) << 32); // first bit of first byte = spell #1, second bit of first byte = spell #2, first bit of second byte = spell #8, etc
     Spellbook = new SpellbookData(serial, itemID, spellbookType, spellBitfields);
 }
Пример #23
0
 public MovementRejectPacket(PacketReader reader)
     : base(0x21, "Move Request Rejected")
 {
     m_sequence = reader.ReadByte(); // (matches sent sequence)
     m_x = reader.ReadInt16();
     m_y = reader.ReadInt16();
     m_direction = reader.ReadByte();
     m_z = reader.ReadSByte();
 }
Пример #24
0
        public WarModePacket(PacketReader reader)
            : base(0x72, "Request War Mode")
        {
            m_warmode = reader.ReadByte();

            reader.ReadByte(); // always 0x00
            reader.ReadByte(); // always 0x32
            reader.ReadByte(); // always 0x00
        }
Пример #25
0
 public WornItemPacket(PacketReader reader)
     : base(0x2E, "Worn Item")
 {
     m_serial = reader.ReadInt32();
     m_itemId = reader.ReadInt16();
     reader.ReadByte();
     m_layer = reader.ReadByte();
     m_parentSerial = reader.ReadInt32();
     m_hue = reader.ReadInt16();
 }
Пример #26
0
 public MapDiffInfo(PacketReader reader)
 {
     MapCount = reader.ReadInt32();
     MapPatches = new int[MapCount];
     StaticPatches = new int[MapCount];
     for (int i = 0; i < MapCount; i++) {
         StaticPatches[i] = reader.ReadInt32();
         MapPatches[i] = reader.ReadInt32();
     }
 }
Пример #27
0
 public PlaySoundEffectPacket(PacketReader reader)
     : base(0x54, "Play Sound Effect")
 {
     Mode = reader.ReadByte();
     SoundModel = reader.ReadInt16();
     Unknown = reader.ReadInt16();
     X = reader.ReadInt16();
     Y = reader.ReadInt16();
     Z = reader.ReadInt16();
 }
Пример #28
0
 public AsciiMessagePacket(PacketReader reader)
     : base(0x1C, "Ascii Message")
 {
     Serial = reader.ReadInt32();
     Model = reader.ReadInt16();
     MsgType = (MessageTypes)reader.ReadByte();
     Hue = reader.ReadUInt16();
     Font = reader.ReadInt16();
     SpeakerName = reader.ReadString(30).Trim();
     Text = reader.ReadString();
 }
Пример #29
0
        public GraphicEffectExtendedPacket(int id, PacketReader reader)
            : base(id, reader)
        {
            // BYTE[2] effect # (tile ID)
            // BYTE[2] explode effect # (0 if no explosion)
            // BYTE[2] additional effect # that's only used for moving effects, 0 otherwise
            // BYTE[4] if target is item (type 2) that's itemId, 0 otherwise
            // BYTE[1] layer (of the character, e.g left hand, right hand, ... 0-4, 0xff: moving effect or target is no char)
            // BYTE[2] yet another (unknown) additional effect that's only set for moving effect, 0 otherwise
        	Tracer.Warn("Packet 0xC7 received; support for this packet is not yet implemented.");
		}
Пример #30
0
            public VendorSellItem(PacketReader reader)
            {
                ItemSerial = reader.ReadInt32();
                ItemID = reader.ReadUInt16();
                Hue = reader.ReadUInt16();
                Amount = reader.ReadUInt16();
                Price = reader.ReadUInt16();

                ushort nameLength = reader.ReadUInt16();
                Name = reader.ReadString(nameLength);
            }
Пример #31
0
 public IRecvPacket CreatePacket(PacketReader reader)
 {
     return((IRecvPacket)Activator.CreateInstance(m_Type, new object[] { reader }));
 }