UNPKG

node-cs2

Version:

Modern CS2/CS:GO Game Coordinator integration with latest GameTracking-CS2 protobuf definitions. Includes support for highlight_reel, wrapped_sticker, variations, Promise-based API, crate opening, sticker/patch/keychain operations, and all modern CS2 fiel

986 lines (924 loc) 2 MB
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ (function(global, factory) { /* global define, require, module */ /* AMD */ if (typeof define === 'function' && define.amd) define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) module.exports = factory(require("protobufjs/minimal")); })(this, function($protobuf) { "use strict"; // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); $root.C2S_CONNECT_SameProcessCheck = (function() { /** * Properties of a C2S_CONNECT_SameProcessCheck. * @exports IC2S_CONNECT_SameProcessCheck * @interface IC2S_CONNECT_SameProcessCheck * @property {number|Long|null} [localhost_process_id] C2S_CONNECT_SameProcessCheck localhost_process_id * @property {number|Long|null} [key] C2S_CONNECT_SameProcessCheck key */ /** * Constructs a new C2S_CONNECT_SameProcessCheck. * @exports C2S_CONNECT_SameProcessCheck * @classdesc Represents a C2S_CONNECT_SameProcessCheck. * @implements IC2S_CONNECT_SameProcessCheck * @constructor * @param {IC2S_CONNECT_SameProcessCheck=} [properties] Properties to set */ function C2S_CONNECT_SameProcessCheck(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * C2S_CONNECT_SameProcessCheck localhost_process_id. * @member {number|Long} localhost_process_id * @memberof C2S_CONNECT_SameProcessCheck * @instance */ C2S_CONNECT_SameProcessCheck.prototype.localhost_process_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * C2S_CONNECT_SameProcessCheck key. * @member {number|Long} key * @memberof C2S_CONNECT_SameProcessCheck * @instance */ C2S_CONNECT_SameProcessCheck.prototype.key = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * Creates a new C2S_CONNECT_SameProcessCheck instance using the specified properties. * @function create * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {IC2S_CONNECT_SameProcessCheck=} [properties] Properties to set * @returns {C2S_CONNECT_SameProcessCheck} C2S_CONNECT_SameProcessCheck instance */ C2S_CONNECT_SameProcessCheck.create = function create(properties) { return new C2S_CONNECT_SameProcessCheck(properties); }; /** * Encodes the specified C2S_CONNECT_SameProcessCheck message. Does not implicitly {@link C2S_CONNECT_SameProcessCheck.verify|verify} messages. * @function encode * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {IC2S_CONNECT_SameProcessCheck} message C2S_CONNECT_SameProcessCheck message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ C2S_CONNECT_SameProcessCheck.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.localhost_process_id != null && Object.hasOwnProperty.call(message, "localhost_process_id")) writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.localhost_process_id); if (message.key != null && Object.hasOwnProperty.call(message, "key")) writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.key); return writer; }; /** * Encodes the specified C2S_CONNECT_SameProcessCheck message, length delimited. Does not implicitly {@link C2S_CONNECT_SameProcessCheck.verify|verify} messages. * @function encodeDelimited * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {IC2S_CONNECT_SameProcessCheck} message C2S_CONNECT_SameProcessCheck message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ C2S_CONNECT_SameProcessCheck.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a C2S_CONNECT_SameProcessCheck message from the specified reader or buffer. * @function decode * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {C2S_CONNECT_SameProcessCheck} C2S_CONNECT_SameProcessCheck * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ C2S_CONNECT_SameProcessCheck.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.C2S_CONNECT_SameProcessCheck(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.localhost_process_id = reader.uint64(); break; } case 2: { message.key = reader.uint64(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a C2S_CONNECT_SameProcessCheck message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {C2S_CONNECT_SameProcessCheck} C2S_CONNECT_SameProcessCheck * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ C2S_CONNECT_SameProcessCheck.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a C2S_CONNECT_SameProcessCheck message. * @function verify * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ C2S_CONNECT_SameProcessCheck.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.localhost_process_id != null && message.hasOwnProperty("localhost_process_id")) if (!$util.isInteger(message.localhost_process_id) && !(message.localhost_process_id && $util.isInteger(message.localhost_process_id.low) && $util.isInteger(message.localhost_process_id.high))) return "localhost_process_id: integer|Long expected"; if (message.key != null && message.hasOwnProperty("key")) if (!$util.isInteger(message.key) && !(message.key && $util.isInteger(message.key.low) && $util.isInteger(message.key.high))) return "key: integer|Long expected"; return null; }; /** * Creates a C2S_CONNECT_SameProcessCheck message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {Object.<string,*>} object Plain object * @returns {C2S_CONNECT_SameProcessCheck} C2S_CONNECT_SameProcessCheck */ C2S_CONNECT_SameProcessCheck.fromObject = function fromObject(object) { if (object instanceof $root.C2S_CONNECT_SameProcessCheck) return object; var message = new $root.C2S_CONNECT_SameProcessCheck(); if (object.localhost_process_id != null) if ($util.Long) (message.localhost_process_id = $util.Long.fromValue(object.localhost_process_id)).unsigned = true; else if (typeof object.localhost_process_id === "string") message.localhost_process_id = parseInt(object.localhost_process_id, 10); else if (typeof object.localhost_process_id === "number") message.localhost_process_id = object.localhost_process_id; else if (typeof object.localhost_process_id === "object") message.localhost_process_id = new $util.LongBits(object.localhost_process_id.low >>> 0, object.localhost_process_id.high >>> 0).toNumber(true); if (object.key != null) if ($util.Long) (message.key = $util.Long.fromValue(object.key)).unsigned = true; else if (typeof object.key === "string") message.key = parseInt(object.key, 10); else if (typeof object.key === "number") message.key = object.key; else if (typeof object.key === "object") message.key = new $util.LongBits(object.key.low >>> 0, object.key.high >>> 0).toNumber(true); return message; }; /** * Creates a plain object from a C2S_CONNECT_SameProcessCheck message. Also converts values to other types if specified. * @function toObject * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {C2S_CONNECT_SameProcessCheck} message C2S_CONNECT_SameProcessCheck * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ C2S_CONNECT_SameProcessCheck.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, true); object.localhost_process_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.localhost_process_id = options.longs === String ? "0" : 0; if ($util.Long) { var long = new $util.Long(0, 0, true); object.key = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.key = options.longs === String ? "0" : 0; } if (message.localhost_process_id != null && message.hasOwnProperty("localhost_process_id")) if (typeof message.localhost_process_id === "number") object.localhost_process_id = options.longs === String ? String(message.localhost_process_id) : message.localhost_process_id; else object.localhost_process_id = options.longs === String ? $util.Long.prototype.toString.call(message.localhost_process_id) : options.longs === Number ? new $util.LongBits(message.localhost_process_id.low >>> 0, message.localhost_process_id.high >>> 0).toNumber(true) : message.localhost_process_id; if (message.key != null && message.hasOwnProperty("key")) if (typeof message.key === "number") object.key = options.longs === String ? String(message.key) : message.key; else object.key = options.longs === String ? $util.Long.prototype.toString.call(message.key) : options.longs === Number ? new $util.LongBits(message.key.low >>> 0, message.key.high >>> 0).toNumber(true) : message.key; return object; }; /** * Converts this C2S_CONNECT_SameProcessCheck to JSON. * @function toJSON * @memberof C2S_CONNECT_SameProcessCheck * @instance * @returns {Object.<string,*>} JSON object */ C2S_CONNECT_SameProcessCheck.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for C2S_CONNECT_SameProcessCheck * @function getTypeUrl * @memberof C2S_CONNECT_SameProcessCheck * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ C2S_CONNECT_SameProcessCheck.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/C2S_CONNECT_SameProcessCheck"; }; return C2S_CONNECT_SameProcessCheck; })(); $root.C2S_CONNECT_Message = (function() { /** * Properties of a C2S_CONNECT_Message. * @exports IC2S_CONNECT_Message * @interface IC2S_CONNECT_Message * @property {number|null} [host_version] C2S_CONNECT_Message host_version * @property {number|null} [auth_protocol] C2S_CONNECT_Message auth_protocol * @property {number|null} [challenge_number] C2S_CONNECT_Message challenge_number * @property {number|Long|null} [reservation_cookie] C2S_CONNECT_Message reservation_cookie * @property {boolean|null} [low_violence] C2S_CONNECT_Message low_violence * @property {Uint8Array|null} [encrypted_password] C2S_CONNECT_Message encrypted_password * @property {Array.<ICCLCMsg_SplitPlayerConnect>|null} [splitplayers] C2S_CONNECT_Message splitplayers * @property {Uint8Array|null} [auth_steam] C2S_CONNECT_Message auth_steam * @property {string|null} [challenge_context] C2S_CONNECT_Message challenge_context * @property {IC2S_CONNECT_SameProcessCheck|null} [localhost_same_process_check] C2S_CONNECT_Message localhost_same_process_check */ /** * Constructs a new C2S_CONNECT_Message. * @exports C2S_CONNECT_Message * @classdesc Represents a C2S_CONNECT_Message. * @implements IC2S_CONNECT_Message * @constructor * @param {IC2S_CONNECT_Message=} [properties] Properties to set */ function C2S_CONNECT_Message(properties) { this.splitplayers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * C2S_CONNECT_Message host_version. * @member {number} host_version * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.host_version = 0; /** * C2S_CONNECT_Message auth_protocol. * @member {number} auth_protocol * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.auth_protocol = 0; /** * C2S_CONNECT_Message challenge_number. * @member {number} challenge_number * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.challenge_number = 0; /** * C2S_CONNECT_Message reservation_cookie. * @member {number|Long} reservation_cookie * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.reservation_cookie = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * C2S_CONNECT_Message low_violence. * @member {boolean} low_violence * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.low_violence = false; /** * C2S_CONNECT_Message encrypted_password. * @member {Uint8Array} encrypted_password * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.encrypted_password = $util.newBuffer([]); /** * C2S_CONNECT_Message splitplayers. * @member {Array.<ICCLCMsg_SplitPlayerConnect>} splitplayers * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.splitplayers = $util.emptyArray; /** * C2S_CONNECT_Message auth_steam. * @member {Uint8Array} auth_steam * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.auth_steam = $util.newBuffer([]); /** * C2S_CONNECT_Message challenge_context. * @member {string} challenge_context * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.challenge_context = ""; /** * C2S_CONNECT_Message localhost_same_process_check. * @member {IC2S_CONNECT_SameProcessCheck|null|undefined} localhost_same_process_check * @memberof C2S_CONNECT_Message * @instance */ C2S_CONNECT_Message.prototype.localhost_same_process_check = null; /** * Creates a new C2S_CONNECT_Message instance using the specified properties. * @function create * @memberof C2S_CONNECT_Message * @static * @param {IC2S_CONNECT_Message=} [properties] Properties to set * @returns {C2S_CONNECT_Message} C2S_CONNECT_Message instance */ C2S_CONNECT_Message.create = function create(properties) { return new C2S_CONNECT_Message(properties); }; /** * Encodes the specified C2S_CONNECT_Message message. Does not implicitly {@link C2S_CONNECT_Message.verify|verify} messages. * @function encode * @memberof C2S_CONNECT_Message * @static * @param {IC2S_CONNECT_Message} message C2S_CONNECT_Message message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ C2S_CONNECT_Message.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.host_version != null && Object.hasOwnProperty.call(message, "host_version")) writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.host_version); if (message.auth_protocol != null && Object.hasOwnProperty.call(message, "auth_protocol")) writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.auth_protocol); if (message.challenge_number != null && Object.hasOwnProperty.call(message, "challenge_number")) writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.challenge_number); if (message.reservation_cookie != null && Object.hasOwnProperty.call(message, "reservation_cookie")) writer.uint32(/* id 4, wireType 1 =*/33).fixed64(message.reservation_cookie); if (message.low_violence != null && Object.hasOwnProperty.call(message, "low_violence")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.low_violence); if (message.encrypted_password != null && Object.hasOwnProperty.call(message, "encrypted_password")) writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.encrypted_password); if (message.splitplayers != null && message.splitplayers.length) for (var i = 0; i < message.splitplayers.length; ++i) $root.CCLCMsg_SplitPlayerConnect.encode(message.splitplayers[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.auth_steam != null && Object.hasOwnProperty.call(message, "auth_steam")) writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.auth_steam); if (message.challenge_context != null && Object.hasOwnProperty.call(message, "challenge_context")) writer.uint32(/* id 9, wireType 2 =*/74).string(message.challenge_context); if (message.localhost_same_process_check != null && Object.hasOwnProperty.call(message, "localhost_same_process_check")) $root.C2S_CONNECT_SameProcessCheck.encode(message.localhost_same_process_check, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); return writer; }; /** * Encodes the specified C2S_CONNECT_Message message, length delimited. Does not implicitly {@link C2S_CONNECT_Message.verify|verify} messages. * @function encodeDelimited * @memberof C2S_CONNECT_Message * @static * @param {IC2S_CONNECT_Message} message C2S_CONNECT_Message message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ C2S_CONNECT_Message.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a C2S_CONNECT_Message message from the specified reader or buffer. * @function decode * @memberof C2S_CONNECT_Message * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {C2S_CONNECT_Message} C2S_CONNECT_Message * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ C2S_CONNECT_Message.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.C2S_CONNECT_Message(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.host_version = reader.uint32(); break; } case 2: { message.auth_protocol = reader.uint32(); break; } case 3: { message.challenge_number = reader.uint32(); break; } case 4: { message.reservation_cookie = reader.fixed64(); break; } case 5: { message.low_violence = reader.bool(); break; } case 6: { message.encrypted_password = reader.bytes(); break; } case 7: { if (!(message.splitplayers && message.splitplayers.length)) message.splitplayers = []; message.splitplayers.push($root.CCLCMsg_SplitPlayerConnect.decode(reader, reader.uint32())); break; } case 8: { message.auth_steam = reader.bytes(); break; } case 9: { message.challenge_context = reader.string(); break; } case 10: { message.localhost_same_process_check = $root.C2S_CONNECT_SameProcessCheck.decode(reader, reader.uint32()); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a C2S_CONNECT_Message message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof C2S_CONNECT_Message * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {C2S_CONNECT_Message} C2S_CONNECT_Message * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ C2S_CONNECT_Message.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a C2S_CONNECT_Message message. * @function verify * @memberof C2S_CONNECT_Message * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ C2S_CONNECT_Message.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.host_version != null && message.hasOwnProperty("host_version")) if (!$util.isInteger(message.host_version)) return "host_version: integer expected"; if (message.auth_protocol != null && message.hasOwnProperty("auth_protocol")) if (!$util.isInteger(message.auth_protocol)) return "auth_protocol: integer expected"; if (message.challenge_number != null && message.hasOwnProperty("challenge_number")) if (!$util.isInteger(message.challenge_number)) return "challenge_number: integer expected"; if (message.reservation_cookie != null && message.hasOwnProperty("reservation_cookie")) if (!$util.isInteger(message.reservation_cookie) && !(message.reservation_cookie && $util.isInteger(message.reservation_cookie.low) && $util.isInteger(message.reservation_cookie.high))) return "reservation_cookie: integer|Long expected"; if (message.low_violence != null && message.hasOwnProperty("low_violence")) if (typeof message.low_violence !== "boolean") return "low_violence: boolean expected"; if (message.encrypted_password != null && message.hasOwnProperty("encrypted_password")) if (!(message.encrypted_password && typeof message.encrypted_password.length === "number" || $util.isString(message.encrypted_password))) return "encrypted_password: buffer expected"; if (message.splitplayers != null && message.hasOwnProperty("splitplayers")) { if (!Array.isArray(message.splitplayers)) return "splitplayers: array expected"; for (var i = 0; i < message.splitplayers.length; ++i) { var error = $root.CCLCMsg_SplitPlayerConnect.verify(message.splitplayers[i]); if (error) return "splitplayers." + error; } } if (message.auth_steam != null && message.hasOwnProperty("auth_steam")) if (!(message.auth_steam && typeof message.auth_steam.length === "number" || $util.isString(message.auth_steam))) return "auth_steam: buffer expected"; if (message.challenge_context != null && message.hasOwnProperty("challenge_context")) if (!$util.isString(message.challenge_context)) return "challenge_context: string expected"; if (message.localhost_same_process_check != null && message.hasOwnProperty("localhost_same_process_check")) { var error = $root.C2S_CONNECT_SameProcessCheck.verify(message.localhost_same_process_check); if (error) return "localhost_same_process_check." + error; } return null; }; /** * Creates a C2S_CONNECT_Message message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof C2S_CONNECT_Message * @static * @param {Object.<string,*>} object Plain object * @returns {C2S_CONNECT_Message} C2S_CONNECT_Message */ C2S_CONNECT_Message.fromObject = function fromObject(object) { if (object instanceof $root.C2S_CONNECT_Message) return object; var message = new $root.C2S_CONNECT_Message(); if (object.host_version != null) message.host_version = object.host_version >>> 0; if (object.auth_protocol != null) message.auth_protocol = object.auth_protocol >>> 0; if (object.challenge_number != null) message.challenge_number = object.challenge_number >>> 0; if (object.reservation_cookie != null) if ($util.Long) (message.reservation_cookie = $util.Long.fromValue(object.reservation_cookie)).unsigned = false; else if (typeof object.reservation_cookie === "string") message.reservation_cookie = parseInt(object.reservation_cookie, 10); else if (typeof object.reservation_cookie === "number") message.reservation_cookie = object.reservation_cookie; else if (typeof object.reservation_cookie === "object") message.reservation_cookie = new $util.LongBits(object.reservation_cookie.low >>> 0, object.reservation_cookie.high >>> 0).toNumber(); if (object.low_violence != null) message.low_violence = Boolean(object.low_violence); if (object.encrypted_password != null) if (typeof object.encrypted_password === "string") $util.base64.decode(object.encrypted_password, message.encrypted_password = $util.newBuffer($util.base64.length(object.encrypted_password)), 0); else if (object.encrypted_password.length >= 0) message.encrypted_password = object.encrypted_password; if (object.splitplayers) { if (!Array.isArray(object.splitplayers)) throw TypeError(".C2S_CONNECT_Message.splitplayers: array expected"); message.splitplayers = []; for (var i = 0; i < object.splitplayers.length; ++i) { if (typeof object.splitplayers[i] !== "object") throw TypeError(".C2S_CONNECT_Message.splitplayers: object expected"); message.splitplayers[i] = $root.CCLCMsg_SplitPlayerConnect.fromObject(object.splitplayers[i]); } } if (object.auth_steam != null) if (typeof object.auth_steam === "string") $util.base64.decode(object.auth_steam, message.auth_steam = $util.newBuffer($util.base64.length(object.auth_steam)), 0); else if (object.auth_steam.length >= 0) message.auth_steam = object.auth_steam; if (object.challenge_context != null) message.challenge_context = String(object.challenge_context); if (object.localhost_same_process_check != null) { if (typeof object.localhost_same_process_check !== "object") throw TypeError(".C2S_CONNECT_Message.localhost_same_process_check: object expected"); message.localhost_same_process_check = $root.C2S_CONNECT_SameProcessCheck.fromObject(object.localhost_same_process_check); } return message; }; /** * Creates a plain object from a C2S_CONNECT_Message message. Also converts values to other types if specified. * @function toObject * @memberof C2S_CONNECT_Message * @static * @param {C2S_CONNECT_Message} message C2S_CONNECT_Message * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ C2S_CONNECT_Message.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.splitplayers = []; if (options.defaults) { object.host_version = 0; object.auth_protocol = 0; object.challenge_number = 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.reservation_cookie = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.reservation_cookie = options.longs === String ? "0" : 0; object.low_violence = false; if (options.bytes === String) object.encrypted_password = ""; else { object.encrypted_password = []; if (options.bytes !== Array) object.encrypted_password = $util.newBuffer(object.encrypted_password); } if (options.bytes === String) object.auth_steam = ""; else { object.auth_steam = []; if (options.bytes !== Array) object.auth_steam = $util.newBuffer(object.auth_steam); } object.challenge_context = ""; object.localhost_same_process_check = null; } if (message.host_version != null && message.hasOwnProperty("host_version")) object.host_version = message.host_version; if (message.auth_protocol != null && message.hasOwnProperty("auth_protocol")) object.auth_protocol = message.auth_protocol; if (message.challenge_number != null && message.hasOwnProperty("challenge_number")) object.challenge_number = message.challenge_number; if (message.reservation_cookie != null && message.hasOwnProperty("reservation_cookie")) if (typeof message.reservation_cookie === "number") object.reservation_cookie = options.longs === String ? String(message.reservation_cookie) : message.reservation_cookie; else object.reservation_cookie = options.longs === String ? $util.Long.prototype.toString.call(message.reservation_cookie) : options.longs === Number ? new $util.LongBits(message.reservation_cookie.low >>> 0, message.reservation_cookie.high >>> 0).toNumber() : message.reservation_cookie; if (message.low_violence != null && message.hasOwnProperty("low_violence")) object.low_violence = message.low_violence; if (message.encrypted_password != null && message.hasOwnProperty("encrypted_password")) object.encrypted_password = options.bytes === String ? $util.base64.encode(message.encrypted_password, 0, message.encrypted_password.length) : options.bytes === Array ? Array.prototype.slice.call(message.encrypted_password) : message.encrypted_password; if (message.splitplayers && message.splitplayers.length) { object.splitplayers = []; for (var j = 0; j < message.splitplayers.length; ++j) object.splitplayers[j] = $root.CCLCMsg_SplitPlayerConnect.toObject(message.splitplayers[j], options); } if (message.auth_steam != null && message.hasOwnProperty("auth_steam")) object.auth_steam = options.bytes === String ? $util.base64.encode(message.auth_steam, 0, message.auth_steam.length) : options.bytes === Array ? Array.prototype.slice.call(message.auth_steam) : message.auth_steam; if (message.challenge_context != null && message.hasOwnProperty("challenge_context")) object.challenge_context = message.challenge_context; if (message.localhost_same_process_check != null && message.hasOwnProperty("localhost_same_process_check")) object.localhost_same_process_check = $root.C2S_CONNECT_SameProcessCheck.toObject(message.localhost_same_process_check, options); return object; }; /** * Converts this C2S_CONNECT_Message to JSON. * @function toJSON * @memberof C2S_CONNECT_Message * @instance * @returns {Object.<string,*>} JSON object */ C2S_CONNECT_Message.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for C2S_CONNECT_Message * @function getTypeUrl * @memberof C2S_CONNECT_Message * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ C2S_CONNECT_Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/C2S_CONNECT_Message"; }; return C2S_CONNECT_Message; })(); $root.C2S_CONNECTION_Message = (function() { /** * Properties of a C2S_CONNECTION_Message. * @exports IC2S_CONNECTION_Message * @interface IC2S_CONNECTION_Message * @property {string|null} [addon_name] C2S_CONNECTION_Message addon_name * @property {IC2S_CONNECT_SameProcessCheck|null} [localhost_same_process_check] C2S_CONNECTION_Message localhost_same_process_check */ /** * Constructs a new C2S_CONNECTION_Message. * @exports C2S_CONNECTION_Message * @classdesc Represents a C2S_CONNECTION_Message. * @implements IC2S_CONNECTION_Message * @constructor * @param {IC2S_CONNECTION_Message=} [properties] Properties to set */ function C2S_CONNECTION_Message(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * C2S_CONNECTION_Message addon_name. * @member {string} addon_name * @memberof C2S_CONNECTION_Message * @instance */ C2S_CONNECTION_Message.prototype.addon_name = ""; /** * C2S_CONNECTION_Message localhost_same_process_check. * @member {IC2S_CONNECT_SameProcessCheck|null|undefined} localhost_same_process_check * @memberof C2S_CONNECTION_Message * @instance */ C2S_CONNECTION_Message.prototype.localhost_same_process_check = null; /** * Creates a new C2S_CONNECTION_Message instance using the specified properties. * @function create * @memberof C2S_CONNECTION_Message * @static * @param {IC2S_CONNECTION_Message=} [properties] Properties to set * @returns {C2S_CONNECTION_Message} C2S_CONNECTION_Message instance */ C2S_CONNECTION_Message.create = function create(properties) { return new C2S_CONNECTION_Message(properties); }; /** * Encodes the specified C2S_CONNECTION_Message message. Does not implicitly {@link C2S_CONNECTION_Message.verify|verify} messages. * @function encode * @memberof C2S_CONNECTION_Message * @static * @param {IC2S_CONNECTION_Message} message C2S_CONNECTION_Message message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ C2S_CONNECTION_Message.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.addon_name != null && Object.hasOwnProperty.call(message, "addon_name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.addon_name); if (message.localhost_same_process_check != null && Object.hasOwnProperty.call(message, "localhost_same_process_check")) $root.C2S_CONNECT_SameProcessCheck.encode(message.localhost_same_process_check, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** * Encodes the specified C2S_CONNECTION_Message message, length delimited. Does not implicitly {@link C2S_CONNECTION_Message.verify|verify} messages. * @function encodeDelimited * @memberof C2S_CONNECTION_Message * @static * @param {IC2S_CONNECTION_Message} message C2S_CONNECTION_Message message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ C2S_CONNECTION_Message.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a C2S_CONNECTION_Message message from the specified reader or buffer. * @function decode * @memberof C2S_CONNECTION_Message * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {C2S_CONNECTION_Message} C2S_CONNECTION_Message * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ C2S_CONNECTION_Message.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.C2S_CONNECTION_Message(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.addon_name = reader.string(); break; } case 2: { message.localhost_same_process_check = $root.C2S_CONNECT_SameProcessCheck.decode(reader, reader.uint32()); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a C2S_CONNECTION_Message message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof C2S_CONNECTION_Message * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {C2S_CONNECTION_Message} C2S_CONNECTION_Message * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ C2S_CONNECTION_Message.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a C2S_CONNECTION_Message message. * @function verify * @memberof C2S_CONNECTION_Message * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ C2S_CONNECTION_Message.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.addon_name != null && message.hasOwnProperty("addon_name")) if (!$util.isString(message.addon_name)) return "addon_name: string expected"; if (message.localhost_same_process_check != null && message.hasOwnProperty("localhost_same_process_check")) { var error = $root.C2S_CONNECT_SameProcessCheck.verify(message.localhost_same_process_check); if (error) return "localhost_same_process_check." + error; } return null; }; /** * Creates a C2S_CONNECTION_Message message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof C2S_CONNECTION_Message * @static * @param {Object.<string,*>} object Plain object * @returns {C2S_CONNECTION_Message} C2S_CONNECTION_Message */ C2S_CONNECTION_Message.fromObject = function fromObject(object) { if (object instanceof $root.C2S_CONNECTION_Message) return object; var message = new $root.C2S_CONNECTION_Message(); if (object.addon_name != null) message.addon_name = String(object.addon_name); if (object.localhost_same_process_check != null) { if (typeof object.localhost_same_process_check !== "object") throw TypeError(".C2S_CONNECTION_Message.localhost_same_process_check: object expected"); message.localhost_same_process_check = $root.C2S_CONNECT_SameProcessCheck.fromObject(object.localhost_same_process_check); } return message; }; /** * Creates a plain object from a C2S_CONNECTION_Message message. Also converts values to other types if specified. * @function toObject * @memberof C2S_CONNECTION_Message * @static * @param {C2S_CONNECTION_Message} message C2S_CONNECTION_Message * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ C2S_CONNECTION_Message.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.addon_name = ""; object.localhost_same_process_check = null; } if (message.addon_name != null && message.hasOwnProperty("addon_name")) object.addon_name = message.addon_name; if (message.localhost_same_process_check != null && message.hasOwnProperty("localhost_same_process_check")) object.localhost_same_process_check = $root.C2S_CONNECT_SameProcessCheck.toObject(message.localhost_same_process_check, options); return object; }; /** * Converts this C2S_CONNECTION_Message to JSON. * @function toJSON * @memberof C2S_CONNECTION_Message * @instance * @returns {Object.<string,*>} JSON object */ C2S_CONNECTION_Message.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for C2S_CONNECTION_Message * @function getTypeUrl * @memberof C2S_CONNECTION_Message * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ C2S_CONNECTION_Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/C2S_CONNECTION_Message"; }; return C2S_CONNECTION_Message; })(); /** * CLC_Messages enum. * @exports CLC_Messages * @enum {number} * @property {number} clc_ClientIn