public static void Init() { collectThread = new Thread(PacketCollectionThread); collectThread.Start(); RPCSerializer.Init(); CustomRPC.DocAllRPCAttributes(); }
public static CustomPacket ParseCustomPacket(byte[] data) { ulong packetID = BitConverter.ToUInt64(data, 0); bool ignoreID = BitConverter.ToUInt16(data, 8) == 0 ? false : true; int stringSize = 0; for (; stringSize + 8 < data.Length && data[stringSize + 10] != 0; stringSize++) { } string RPCName = Encoding.ASCII.GetString(data, 10, stringSize); byte[] clippedData = new byte[data.Length - 11 - stringSize]; for (int i = 0; i < clippedData.Length; i++) { clippedData[i] = data[i + 9 + stringSize]; } return(new CustomPacket(packetID, RPCName, ignoreID, RPCSerializer.GetCompleteDeserializedData(clippedData))); }
/// <summary> /// ONLY FOR DEBUG USE, DO NOT, I REPEAT, DO NOT USE THIS FOR ANYTHING OTHER THAN TESTING PACKET SENDING LOCALLY!!!!! /// </summary> /// <param name="rpcName"></param> /// <param name="args"></param> public static void SendRPCToSelf(string rpcName, params object[] args) { SendPacketToPlayer(SteamUser.GetSteamID(), rpcName, RPCSerializer.GetCompleteSerializedData(args)); }
public static void SendRPCToPlayersInGame(string rpcName, params object[] args) { SendPacketToPlayersInGame(rpcName, RPCSerializer.GetCompleteSerializedData(args)); }
public static void SendRPCToPlayersInGame(string rpcName, bool isTCP = false, bool ignoreID = false, params object[] args) { SendPacketToPlayersInGame(rpcName, RPCSerializer.GetCompleteSerializedData(args), isTCP, ignoreID); }