public void ParsePacket(IBitStream bitstream) { while (true) { var type = (SVC_Messages)bitstream.ReadProtobufVarInt(); if (type != SVC_Messages.svc_SendTable) { throw new Exception("Expected SendTable, got " + type); } var size = bitstream.ReadProtobufVarInt(); bitstream.BeginChunk(size * 8); var sendTable = new SendTable(bitstream); bitstream.EndChunk(); if (sendTable.IsEnd) { break; } DataTables.Add(sendTable); } var serverClassCount = checked ((int)bitstream.ReadInt(16)); for (var i = 0; i < serverClassCount; i++) { var entry = new ServerClass { ClassID = checked ((int)bitstream.ReadInt(16)) }; if (entry.ClassID > serverClassCount) { throw new Exception("Invalid class index"); } entry.Name = bitstream.ReadDataTableString(); entry.DTName = bitstream.ReadDataTableString(); entry.DataTableID = DataTables.FindIndex(a => a.Name == entry.DTName); ServerClasses.Add(entry); } for (var i = 0; i < serverClassCount; i++) { FlattenDataTable(i); } }
public EntityCreatedEventArgs(ServerClass c, Entity e) { Class = c; Entity = e; }