public IGameEvent DeSerialize(IBitStream stream) { var createPlayerEvent = new CreatePlayerEvent(); createPlayerEvent.PlayerTeam = stream.ReadBits(3); createPlayerEvent.SpawnGroup = stream.ReadBits(4); var v3 = stream.ReadBits(1); createPlayerEvent.PlayerId = stream.ReadBits(8); //id given by gameserver, not actual gamespy id createPlayerEvent.PlayerIndex = stream.ReadBits(0x10); //another server id? This one does not start at 0 var v6 = stream.ReadBits(0x10); //always 0 createPlayerEvent.IsAI = stream.ReadBool(); createPlayerEvent.PlayerName = stream.ReadString(32).Replace("\0", ""); return(createPlayerEvent); }
public IGameEvent DeSerialize(IBitStream stream) { var block = new DataBlockEvent(); var newBlock = stream.ReadBool(); if (!newBlock) { uint blockLength = stream.ReadBits(8); //actual formula in the game exe: 8 * stream.ReadBits(8) & 0x7F8; we just read the bytes since this formula is used to read it as bits block.Block = stream.ReadBytes(blockLength); } else { block.BlockEventId = stream.ReadBits(32); //triggers specific event in EventManager, 0=ServerInfo, 1=ClientInfo, 5=MapList block.BlockLength = stream.ReadBits(32); //full length of incoming data(in case it's sent in multiple packets) block.NewBlock = true; } return(block); }
public IGameEvent DeSerialize(IBitStream stream) { var templateId = stream.ReadBits(0x20); var objectId = stream.ReadBits(0x10); var v3 = stream.ReadBits(2); var isMultiSpawn = stream.ReadBits(1);//if true means spawn the same object multiple times if (isMultiSpawn == 1) { var spawnAmount = stream.ReadBits(8); } else { var v5 = stream.ReadBits(1); if (v5 == 1) { var v6 = stream.ReadBits(0x20) ^ 0x80000000; var v7 = stream.ReadBits(0x20) ^ 0x80000000; var v8 = stream.ReadBits(0x20) ^ 0x80000000; var v222 = 0; } else { } var hasVector = stream.ReadBool(); if (hasVector) { var v6 = stream.ReadBits(0x20) ^ 0x80000000; var v7 = stream.ReadBits(0x20) ^ 0x80000000; var v8 = stream.ReadBits(0x20) ^ 0x80000000; var v222 = 0; } else { } } return(null); }