Ejemplo n.º 1
0
 public override void Read(PacketReader stream)
 {
     Statistic = (Statistics)stream.ReadInt();
     Amount = stream.ReadByte();
 }
Ejemplo n.º 2
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
     Slot = stream.ReadShort();
     Item = ItemStack.Read(stream);
 }
Ejemplo n.º 3
0
 void read_invoke_res(PacketReader r, out ValueImpl v, out ValueImpl exc, out ValueImpl out_this, out ValueImpl[] out_args)
 {
     int resflags = r.ReadByte ();
     v = null;
     exc = null;
     out_this = null;
     out_args = null;
     if (resflags == 0) {
         exc = r.ReadValue ();
     } else {
         v = r.ReadValue ();
         if ((resflags & 2) != 0)
             out_this = r.ReadValue ();
         if ((resflags & 4) != 0) {
             int nargs = r.ReadInt ();
             out_args = new ValueImpl [nargs];
             for (int i = 0; i < nargs; ++i)
                 out_args [i] = r.ReadValue ();
         }
     }
 }
Ejemplo n.º 4
0
 public override void Read(PacketReader stream)
 {
     X = stream.ReadInt();
     Y = stream.ReadSByte();
     Z = stream.ReadInt();
     Type = stream.ReadShort();
     Data = stream.ReadByte();
 }
Ejemplo n.º 5
0
 public override void Read(PacketReader stream)
 {
     PlayerId = stream.ReadInt();
     Action = (ActionType)stream.ReadSByte();
 }
Ejemplo n.º 6
0
 public override void Read(PacketReader stream)
 {
     X = stream.ReadInt();
     Y = stream.ReadShort();
     Z = stream.ReadInt();
     Lines = new string[4];
     for (int i = 0; i < Lines.Length; i++)
         Lines[i] = stream.ReadString16(15);
 }
Ejemplo n.º 7
0
 public override void Read(PacketReader stream)
 {
     PlayerId = stream.ReadInt();
     InBed = stream.ReadSByte();
     X = stream.ReadInt();
     Y = stream.ReadSByte();
     Z = stream.ReadInt();
 }
Ejemplo n.º 8
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();
 }
Ejemplo n.º 9
0
 public override void Read(PacketReader stream)
 {
     SoundName = stream.ReadString16(20);
     EffectX = stream.ReadInt();
     EffectY = stream.ReadInt();
     EffectZ = stream.ReadInt();
     Volume = stream.ReadFloat();
     Pitch = stream.ReadByte();
 }
Ejemplo n.º 10
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();
 }
Ejemplo n.º 11
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();
 }
Ejemplo n.º 12
0
 public override void Read(PacketReader stream)
 {
     PlayerId = stream.ReadInt();
     Animation = stream.ReadSByte();
 }
Ejemplo n.º 13
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();
 }
Ejemplo n.º 14
0
 public override void Read(PacketReader stream)
 {
     KeepAliveID = stream.ReadInt();
 }
Ejemplo n.º 15
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();
 }
Ejemplo n.º 16
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
        }
Ejemplo n.º 17
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
     Unknown = stream.ReadBool();
     X = stream.ReadDoublePacked();
     Y = stream.ReadDoublePacked();
     Z = stream.ReadDoublePacked();
 }
Ejemplo n.º 18
0
 public override void Read(PacketReader stream)
 {
     Action = (DigAction)stream.ReadByte();
     X = stream.ReadInt();
     Y = stream.ReadSByte();
     Z = stream.ReadInt();
     Face = stream.ReadSByte();
 }
Ejemplo n.º 19
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();
 }
Ejemplo n.º 20
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
     Effect = (EntityEffects)stream.ReadByte();
 }
Ejemplo n.º 21
0
 public override void Read(PacketReader stream)
 {
     User = stream.ReadInt();
     Target = stream.ReadInt();
     LeftClick = stream.ReadBool();
 }
Ejemplo n.º 22
0
 public override void Read(PacketReader stream)
 {
     World = stream.ReadInt();
     Difficulty = stream.ReadSByte();
     CreativeMode = stream.ReadSByte();
     WorldHeight = stream.ReadShort();
     LevelType = stream.ReadString16(9);
 }
Ejemplo n.º 23
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
 }
Ejemplo n.º 24
0
 public override void Read(PacketReader stream)
 {
     EffectID = (SoundOrParticleEffect)stream.ReadInt();
     X = stream.ReadInt();
     Y = stream.ReadByte();
     Z = stream.ReadInt();
     SoundData = stream.ReadInt();
 }
Ejemplo n.º 25
0
 public override void Read(PacketReader stream)
 {
     EntityId = stream.ReadInt();
     Effect = (EntityEffects)stream.ReadByte();
     Amplifier = stream.ReadByte();
     Duration = stream.ReadShort();
 }
Ejemplo n.º 26
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();
 }
Ejemplo n.º 27
0
 CattrInfo[] ReadCattrs(PacketReader r)
 {
     CattrInfo[] res = new CattrInfo [r.ReadInt ()];
     for (int i = 0; i < res.Length; ++i) {
         CattrInfo info = new CattrInfo ();
         info.ctor_id = r.ReadId ();
         info.ctor_args = new ValueImpl [r.ReadInt ()];
         for (int j = 0; j < info.ctor_args.Length; ++j) {
             info.ctor_args [j] = r.ReadValue ();
         }
         info.named_args = new CattrNamedArgInfo [r.ReadInt ()];
         for (int j = 0; j < info.named_args.Length; ++j) {
             CattrNamedArgInfo arg = new CattrNamedArgInfo ();
             int arg_type = r.ReadByte ();
             arg.is_property = arg_type == 0x54;
             arg.id = r.ReadId ();
             arg.value = r.ReadValue ();
             info.named_args [j] = arg;
         }
         res [i] = info;
     }
     return res;
 }
Ejemplo n.º 28
0
 public override void Read(PacketReader stream)
 {
     X = stream.ReadInt();
     Y = stream.ReadInt();
     Z = stream.ReadInt();
 }
Ejemplo n.º 29
0
        bool ReceivePacket()
        {
            byte[] packet = ReadPacket ();

                if (packet.Length == 0) {
                    return false;
                }

                if (IsReplyPacket (packet)) {
                    int id = GetPacketId (packet);
                    ReplyCallback cb = null;
                    lock (reply_packets_monitor) {
                        reply_cbs.TryGetValue (id, out cb);
                        if (cb == null) {
                            reply_packets [id] = packet;
                            Monitor.PulseAll (reply_packets_monitor);
                        } else {
                            int c = reply_cb_counts [id];
                            c --;
                            if (c == 0) {
                                reply_cbs.Remove (id);
                                reply_cb_counts.Remove (id);
                            }
                        }
                    }

                    if (cb != null)
                        cb.Invoke (id, packet);
                } else {
                    PacketReader r = new PacketReader (packet);

                    if (r.CommandSet == CommandSet.EVENT && r.Command == (int)CmdEvent.COMPOSITE) {
                        int spolicy = r.ReadByte ();
                        int nevents = r.ReadInt ();

                        SuspendPolicy suspend_policy = decode_suspend_policy (spolicy);

                        EventInfo[] events = new EventInfo [nevents];

                        for (int i = 0; i < nevents; ++i) {
                            EventKind kind = (EventKind)r.ReadByte ();
                            int req_id = r.ReadInt ();

                            EventType etype = (EventType)kind;

                            long thread_id = r.ReadId ();
                            if (kind == EventKind.VM_START) {
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id };
                                //EventHandler.VMStart (req_id, thread_id, null);
                            } else if (kind == EventKind.VM_DEATH) {
                                int exit_code = 0;
                                if (Version.AtLeast (2, 27))
                                    exit_code = r.ReadInt ();
                                //EventHandler.VMDeath (req_id, 0, null);
                                events [i] = new EventInfo (etype, req_id) { ExitCode = exit_code };
                            } else if (kind == EventKind.THREAD_START) {
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = thread_id };
                                //EventHandler.ThreadStart (req_id, thread_id, thread_id);
                            } else if (kind == EventKind.THREAD_DEATH) {
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = thread_id };
                                //EventHandler.ThreadDeath (req_id, thread_id, thread_id);
                            } else if (kind == EventKind.ASSEMBLY_LOAD) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.AssemblyLoad (req_id, thread_id, id);
                            } else if (kind == EventKind.ASSEMBLY_UNLOAD) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.AssemblyUnload (req_id, thread_id, id);
                            } else if (kind == EventKind.TYPE_LOAD) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.TypeLoad (req_id, thread_id, id);
                            } else if (kind == EventKind.METHOD_ENTRY) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.MethodEntry (req_id, thread_id, id);
                            } else if (kind == EventKind.METHOD_EXIT) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.MethodExit (req_id, thread_id, id);
                            } else if (kind == EventKind.BREAKPOINT) {
                                long id = r.ReadId ();
                                long loc = r.ReadLong ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id, Location = loc };
                                //EventHandler.Breakpoint (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.STEP) {
                                long id = r.ReadId ();
                                long loc = r.ReadLong ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id, Location = loc };
                                //EventHandler.Step (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.EXCEPTION) {
                                long id = r.ReadId ();
                                long loc = 0; // FIXME
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id, Location = loc };
                                //EventHandler.Exception (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.APPDOMAIN_CREATE) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.AppDomainCreate (req_id, thread_id, id);
                            } else if (kind == EventKind.APPDOMAIN_UNLOAD) {
                                long id = r.ReadId ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
                                //EventHandler.AppDomainUnload (req_id, thread_id, id);
                            } else if (kind == EventKind.USER_BREAK) {
                                long id = 0;
                                long loc = 0;
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id, Location = loc };
                                //EventHandler.Exception (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.USER_LOG) {
                                int level = r.ReadInt ();
                                string category = r.ReadString ();
                                string message = r.ReadString ();
                                events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Level = level, Category = category, Message = message };
                                //EventHandler.Exception (req_id, thread_id, id, loc);
                            } else if (kind == EventKind.KEEPALIVE) {
                                events [i] = new EventInfo (etype, req_id) { };
                            } else {
                                throw new NotImplementedException ("Unknown event kind: " + kind);
                            }
                        }

                        EventHandler.Events (suspend_policy, events);
                    }
                }

                return true;
        }
Ejemplo n.º 30
0
 public override void Read(PacketReader stream)
 {
     ProtocolVersion = stream.ReadByte();
     Username = stream.ReadString16(64);
     ServerHost = stream.ReadString16(64);
     ServerPort = stream.ReadInt();
 }