Exemple #1
0
        private static void EquipmentUpdate( PacketReader p )
        {
            Serial serial = p.ReadUInt32();

            Item i = World.FindItem( serial );
            if ( i == null )
            {
                World.AddItem( i=new Item( serial ) );
                Item.UpdateContainers();
            }

            if ( World.Player != null && World.Player.Holding == i )
                World.Player.Holding = null;

            ushort iid = p.ReadUInt16();
            i.ItemID = (ushort)(iid + p.ReadSByte()); // signed, itemID offset
            i.Layer = p.ReadByte();
            Serial ser = p.ReadUInt32();// cont must be set after hue (for counters)
            i.Hue = p.ReadUInt16();

            i.Container = ser;
        }
Exemple #2
0
        public override void Read(PacketReader stream)
        {
            X = stream.ReadDouble();
            Y = stream.ReadDouble();
            Z = stream.ReadDouble();
            Radius = stream.ReadFloat();
            Offsets = new sbyte[stream.ReadInt(), 3];
            for (int i = 0; i < Offsets.GetLength(0); i++)
            {
                Offsets[i, 0] = stream.ReadSByte();
                Offsets[i, 1] = stream.ReadSByte();
                Offsets[i, 2] = stream.ReadSByte();
            }

            UnknownA = stream.ReadFloat();
            UnknownB = stream.ReadFloat();
            UnknownC = stream.ReadFloat();
        }
Exemple #3
0
        private static void WorldItem( PacketReader p, PacketHandlerEventArgs args )
        {
            Item item;
            uint serial = p.ReadUInt32();
            item = World.FindItem( serial&0x7FFFFFFF );
            bool isNew = false;
            if ( item == null )
            {
                World.AddItem( item=new Item( serial&0x7FFFFFFF ) );
                isNew = true;
            }
            else
            {
                item.CancelRemove();
            }

            if ( !DragDropManager.EndHolding( serial ) )
                return;

            item.Container = null;
            Counter.Uncount( item );

            ushort itemID = p.ReadUInt16();
            item.ItemID = (ushort)(itemID&0x7FFF);

            if ( (serial & 0x80000000) != 0 )
                item.Amount = p.ReadUInt16();
            else
                item.Amount = 1;

            if ( (itemID & 0x8000) != 0 )
                item.ItemID = (ushort)(item.ItemID + p.ReadSByte());

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

            if ( (x & 0x8000) != 0 )
                item.Direction = p.ReadByte();
            else
                item.Direction = 0;

            short z = p.ReadSByte();

            item.Position = new Point3D( x&0x7FFF, y&0x3FFF, z );

            if ( ( y & 0x8000 ) != 0 )
                item.Hue = p.ReadUInt16();
            else
                item.Hue = 0;

            byte flags = 0;
            if ( ( y & 0x4000 ) != 0 )
                flags = p.ReadByte();

            item.ProcessPacketFlags( flags );

            if ( isNew && World.Player != null )
            {
                if ( item.ItemID == 0x2006 )// corpse itemid = 0x2006
                {
                    if ( Config.GetBool( "ShowCorpseNames" ) )
                        ClientCommunication.SendToServer( new SingleClick( item ) );
                    if ( Config.GetBool( "AutoOpenCorpses" ) && Utility.InRange( item.Position, World.Player.Position, Config.GetInt( "CorpseRange" ) ) && World.Player != null && World.Player.Visible )
                        PlayerData.DoubleClick( item ) ;
                }
                else if ( item.IsMulti )
                {
                    ClientCommunication.PostAddMulti( item.ItemID, item.Position );
                }
                else
                {
                    ScavengerAgent s = ScavengerAgent.Instance;
                    int dist = Utility.Distance( item.GetWorldPosition(), World.Player.Position );
                    if ( !World.Player.IsGhost && World.Player.Visible && dist <= 2 && s.Enabled && item.Movable )
                        s.Scavenge( item );
                }
            }

            Item.UpdateContainers();
        }
Exemple #4
0
        private static void SAWorldItem(PacketReader p, PacketHandlerEventArgs args)
        {
            /*
            New World Item Packet
            PacketID: 0xF3
            PacketLen: 24
            Format:

                BYTE - 0xF3 packetId
                WORD - 0x01
                BYTE - ArtDataID: 0x00 if the item uses art from TileData table, 0x02 if the item uses art from MultiData table)
                DWORD - item Serial
                WORD - item ID
                BYTE - item direction (same as old)
                WORD - amount
                WORD - amount
                WORD - X
                WORD - Y
                SBYTE - Z
                BYTE - item light
                WORD - item Hue
                BYTE - item flags (same as old packet)
            */

            // Post-7.0.9.0
            /*
            New World Item Packet
            PacketID: 0xF3
            PacketLen: 26
            Format:

                BYTE - 0xF3 packetId
                WORD - 0x01
                BYTE - ArtDataID: 0x00 if the item uses art from TileData table, 0x02 if the item uses art from MultiData table)
                DWORD - item Serial
                WORD - item ID
                BYTE - item direction (same as old)
                WORD - amount
                WORD - amount
                WORD - X
                WORD - Y
                SBYTE - Z
                BYTE - item light
                WORD - item Hue
                BYTE - item flags (same as old packet)
                WORD ???
            */

            ushort _unk1 = p.ReadUInt16();

            byte _artDataID = p.ReadByte();

            Item item;
            uint serial = p.ReadUInt32();
            item = World.FindItem(serial);
            bool isNew = false;
            if (item == null)
            {
                World.AddItem(item = new Item(serial));
                isNew = true;
            }
            else
            {
                item.CancelRemove();
            }

            if (!DragDropManager.EndHolding(serial))
                return;

            item.Container = null;
            Counter.Uncount(item);

            ushort itemID = p.ReadUInt16();
            item.ItemID = (ushort)( _artDataID == 0x02 ? itemID | 0x4000 : itemID );

            item.Direction = p.ReadByte();

            ushort _amount = p.ReadUInt16();
            item.Amount = _amount = p.ReadUInt16();

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();
            short z = p.ReadSByte();

            item.Position = new Point3D(x, y, z);

            byte _light = p.ReadByte();

            item.Hue = p.ReadUInt16();

            byte flags = p.ReadByte();

            item.ProcessPacketFlags(flags);

            if (Engine.UsePostHSChanges)
            {
                p.ReadUInt16();
            }

            if (isNew && World.Player != null)
            {
                if (item.ItemID == 0x2006)// corpse itemid = 0x2006
                {
                    if (Config.GetBool("ShowCorpseNames"))
                        ClientCommunication.SendToServer(new SingleClick(item));
                    if (Config.GetBool("AutoOpenCorpses") && Utility.InRange(item.Position, World.Player.Position, Config.GetInt("CorpseRange")) && World.Player != null && World.Player.Visible)
                        PlayerData.DoubleClick(item);
                }
                else if (item.IsMulti)
                {
                    ClientCommunication.PostAddMulti(item.ItemID, item.Position);
                }
                else
                {
                    ScavengerAgent s = ScavengerAgent.Instance;
                    int dist = Utility.Distance(item.GetWorldPosition(), World.Player.Position);
                    if (!World.Player.IsGhost && World.Player.Visible && dist <= 2 && s.Enabled && item.Movable)
                        s.Scavenge(item);
                }
            }

            Item.UpdateContainers();
        }
Exemple #5
0
        private static void MovementRej( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player != null )
            {
                byte seq = p.ReadByte();
                int x = p.ReadUInt16();
                int y = p.ReadUInt16();
                Direction dir = (Direction)p.ReadByte();
                sbyte z = p.ReadSByte();

                if ( WalkAction.IsMacroWalk( seq ) )
                    args.Block = true;
                World.Player.MoveRej( seq, dir, new Point3D( x, y, z ) );
            }
        }
Exemple #6
0
 public override void Read(PacketReader stream)
 {
     PlayerId = stream.ReadInt();
     Action = (ActionType)stream.ReadSByte();
 }
Exemple #7
0
 public override void Read(PacketReader stream)
 {
     X = stream.ReadInt();
     Y = stream.ReadSByte();
     Z = stream.ReadInt();
     Type = stream.ReadShort();
     Data = stream.ReadByte();
 }
Exemple #8
0
 public override void Read(PacketReader stream)
 {
     WindowId = stream.ReadSByte();
     Slot = stream.ReadShort();
     RightClick = stream.ReadBool();
     Transaction = stream.ReadShort();
     Shift = stream.ReadBool();
     Item = ItemStack.Read(stream);
 }
Exemple #9
0
        public override void Read(PacketReader stream)
        {
            X = stream.ReadInt();
            Y = stream.ReadSByte();
            Z = stream.ReadInt();

            Face = (BlockFace)stream.ReadSByte();
            Item = ItemStack.Read(stream);

            CursorsX = stream.ReadByte();
            CursorsY = stream.ReadByte();
            CursorsZ = stream.ReadByte();
            //amount in hand and durability are handled int ItemStack.Read
        }
Exemple #10
0
 public override void Read(PacketReader stream)
 {
     WindowId = stream.ReadSByte();
     InventoryType = (InterfaceType)stream.ReadSByte();
     WindowTitle = stream.ReadString16(100);
     SlotCount = stream.ReadSByte();
 }
Exemple #11
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
     PlayerName = stream.ReadString16(16);
     X = stream.ReadInt() / 32.0d;
     Y = stream.ReadInt() / 32.0d;
     Z = stream.ReadInt() / 32.0d;
     Yaw = stream.ReadSByte();
     Pitch = stream.ReadSByte();
     CurrentItem = stream.ReadShort();
     Data = stream.ReadMetaData();
 }
Exemple #12
0
 public override void Read(PacketReader stream)
 {
     ChunkCoords = UniversalCoords.FromChunk(stream.ReadInt(), stream.ReadInt());
     short length = stream.ReadShort();
     CoordsArray = new short[length];
     Types = new sbyte[length];
     Metadata = new sbyte[length];
     for (int i = 0; i < CoordsArray.Length; i++)
         CoordsArray[i] = stream.ReadShort();
     for (int i = 0; i < Types.Length; i++)
         Types[i] = stream.ReadSByte();
     for (int i = 0; i < Metadata.Length; i++)
         Metadata[i] = stream.ReadSByte();
 }
Exemple #13
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
     Type = (MobType)stream.ReadByte();
     X = stream.ReadInt() / 32.0d;
     Y = stream.ReadInt() / 32.0d;
     Z = stream.ReadInt() / 32.0d;
     Yaw = stream.ReadSByte();
     Pitch = stream.ReadSByte();
     HeadYaw = stream.ReadSByte();
     VelocityX = stream.ReadShort();
     VelocityY = stream.ReadShort();
     VelocityZ = stream.ReadShort();
     Data = stream.ReadMetaData();
 }
Exemple #14
0
 public override void Read(PacketReader stream)
 {
     PlayerId = stream.ReadInt();
     Animation = stream.ReadSByte();
 }
Exemple #15
0
 public override void Read(PacketReader reader)
 {
     ProtocolOrEntityId = reader.ReadInt();
     LevelType = reader.ReadString16(9);
     ServerMode = reader.ReadSByte();
     Dimension = reader.ReadSByte();
     Difficulty = reader.ReadSByte();
     WorldHeight = reader.ReadByte();
     MaxPlayers = reader.ReadByte();
 }
Exemple #16
0
 public override void Read(PacketReader stream)
 {
     WindowId = stream.ReadSByte();
     Property = stream.ReadShort();
     Value = stream.ReadShort();
 }
Exemple #17
0
 public override void Read(PacketReader stream)
 {
     PlayerId = stream.ReadInt();
     InBed = stream.ReadSByte();
     X = stream.ReadInt();
     Y = stream.ReadSByte();
     Z = stream.ReadInt();
 }
Exemple #18
0
 public override void Read(PacketReader stream)
 {
     Action = (DigAction)stream.ReadByte();
     X = stream.ReadInt();
     Y = stream.ReadSByte();
     Z = stream.ReadInt();
     Face = stream.ReadSByte();
 }
Exemple #19
0
 public override void Read(PacketReader stream)
 {
     WindowId = stream.ReadSByte();
     Items = new ItemStack[stream.ReadShort()];
     for (int i = 0; i < Items.Length; i++)
         Items[i] = ItemStack.Read(stream);
 }
Exemple #20
0
 public override void Read(PacketReader stream)
 {
     World = stream.ReadInt();
     Difficulty = stream.ReadSByte();
     CreativeMode = stream.ReadSByte();
     WorldHeight = stream.ReadShort();
     LevelType = stream.ReadString16(9);
 }
Exemple #21
0
 public override void Read(PacketReader stream)
 {
     WindowId = stream.ReadSByte();
 }
Exemple #22
0
 public override void Read(PacketReader stream)
 {
     WindowId = stream.ReadSByte();
     Slot = stream.ReadShort();
     Item = ItemStack.Read(stream);
 }
Exemple #23
0
        private static void DropRequest(PacketReader p, PacketHandlerEventArgs args)
        {
            Serial serial = p.ReadUInt32();
            int x = p.ReadInt16();
            int y = p.ReadInt16();
            int z = p.ReadSByte();
            Item container = World.FindItem(p.ReadUInt32());

            if (items.ContainsKey(serial))
            {
                args.Block = true;
                FakeItem fake = items[serial];
                if (container == World.Player.Backpack)
                    fake.Position = new Point3D(x, y, z);
                else
                    foreach (Serial s in fake.List.Take(lifting))
                        DragDrop.Move(World.FindItem(s), container);
                lifting = 0;
                Resend();
            }
            else
                args.Block = PacketHandler.ProcessViewers(dropRequest, p);
        }
Exemple #24
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
     ItemId = stream.ReadShort();
     Count = stream.ReadSByte();
     Durability = stream.ReadShort();
     X = stream.ReadInt() / 32.0d;
     Y = stream.ReadInt() / 32.0d;
     Z = stream.ReadInt() / 32.0d;
     Yaw = stream.ReadSByte();
     Pitch = stream.ReadSByte();
     Roll = stream.ReadSByte();
 }
Exemple #25
0
 private static void PersonalLight( PacketReader p, PacketHandlerEventArgs args )
 {
     if ( World.Player != null && !args.Block )
     {
         p.ReadUInt32(); // serial
         World.Player.LocalLightLevel = p.ReadSByte();
     }
 }
Exemple #26
0
 public override void Read(PacketReader stream)
 {
     X = stream.ReadInt();
     Y = stream.ReadShort();
     Z = stream.ReadInt();
     DataA = stream.ReadSByte();
     DataB = stream.ReadSByte();
     BlockId = stream.ReadShort();
 }
Exemple #27
0
        private static void ServerList( PacketReader p, PacketHandlerEventArgs args )
        {
            p.ReadByte(); //unknown
            ushort numServers = p.ReadUInt16();

            for ( int i = 0; i < numServers; ++i )
            {
                ushort num = p.ReadUInt16();
                World.Servers[num] = p.ReadString( 32 );
                p.ReadByte(); // full %
                p.ReadSByte(); // time zone
                p.ReadUInt32(); // ip
            }
        }
Exemple #28
0
 public override void Read(PacketReader stream)
 {
     WindowId = stream.ReadSByte();
     Transaction = stream.ReadShort();
     Accepted = stream.ReadBool();
 }
Exemple #29
0
        private static void DropRequest( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial iser = p.ReadUInt32();
            int x = p.ReadInt16();
            int y = p.ReadInt16();
            int z = p.ReadSByte();
            if ( Engine.UsePostKRPackets )
                /* grid num */p.ReadByte();
            Point3D newPos = new Point3D( x, y, z );
            Serial dser = p.ReadUInt32();

            if ( Macros.MacroManager.AcceptActions )
                MacroManager.Action( new DropAction( dser, newPos ) );

            Item i = World.FindItem( iser );
            if ( i == null )
                return;

            Item dest = World.FindItem( dser );
            if ( dest != null && dest.IsContainer && World.Player != null && ( dest.IsChildOf( World.Player.Backpack ) || dest.IsChildOf( World.Player.Quiver ) ) )
                i.IsNew = true;

            if ( Config.GetBool( "QueueActions" ) )
                args.Block = DragDropManager.Drop( i, dser, newPos );
        }
Exemple #30
0
 public override void Read(PacketReader reader)
 {
     X = reader.ReadInt();
     Y = reader.ReadShort();
     Z = reader.ReadInt();
     Action = reader.ReadSByte();
     Custom1 = reader.ReadInt();
     Custom2 = reader.ReadInt();
     Custom3 = reader.ReadInt();
 }