UNPKG

node-cs2

Version:

Modern CS2/CS:GO Game Coordinator integration with latest GameTracking-CS2 protobuf definitions. Includes support for highlight_reel, variations, and all modern CS2 fields.

1,066 lines (997 loc) 1.07 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"] = {}); /** * GCClientLauncherType enum. * @exports GCClientLauncherType * @enum {number} * @property {number} GCClientLauncherType_DEFAULT=0 GCClientLauncherType_DEFAULT value * @property {number} GCClientLauncherType_PERFECTWORLD=1 GCClientLauncherType_PERFECTWORLD value * @property {number} GCClientLauncherType_STEAMCHINA=2 GCClientLauncherType_STEAMCHINA value * @property {number} GCClientLauncherType_SOURCE2=3 GCClientLauncherType_SOURCE2 value */ $root.GCClientLauncherType = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "GCClientLauncherType_DEFAULT"] = 0; values[valuesById[1] = "GCClientLauncherType_PERFECTWORLD"] = 1; values[valuesById[2] = "GCClientLauncherType_STEAMCHINA"] = 2; values[valuesById[3] = "GCClientLauncherType_SOURCE2"] = 3; return values; })(); /** * GCConnectionStatus enum. * @exports GCConnectionStatus * @enum {number} * @property {number} GCConnectionStatus_HAVE_SESSION=0 GCConnectionStatus_HAVE_SESSION value * @property {number} GCConnectionStatus_GC_GOING_DOWN=1 GCConnectionStatus_GC_GOING_DOWN value * @property {number} GCConnectionStatus_NO_SESSION=2 GCConnectionStatus_NO_SESSION value * @property {number} GCConnectionStatus_NO_SESSION_IN_LOGON_QUEUE=3 GCConnectionStatus_NO_SESSION_IN_LOGON_QUEUE value * @property {number} GCConnectionStatus_NO_STEAM=4 GCConnectionStatus_NO_STEAM value */ $root.GCConnectionStatus = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "GCConnectionStatus_HAVE_SESSION"] = 0; values[valuesById[1] = "GCConnectionStatus_GC_GOING_DOWN"] = 1; values[valuesById[2] = "GCConnectionStatus_NO_SESSION"] = 2; values[valuesById[3] = "GCConnectionStatus_NO_SESSION_IN_LOGON_QUEUE"] = 3; values[valuesById[4] = "GCConnectionStatus_NO_STEAM"] = 4; return values; })(); $root.CMsgSOIDOwner = (function() { /** * Properties of a CMsgSOIDOwner. * @exports ICMsgSOIDOwner * @interface ICMsgSOIDOwner * @property {number|null} [type] CMsgSOIDOwner type * @property {number|Long|null} [id] CMsgSOIDOwner id */ /** * Constructs a new CMsgSOIDOwner. * @exports CMsgSOIDOwner * @classdesc Represents a CMsgSOIDOwner. * @implements ICMsgSOIDOwner * @constructor * @param {ICMsgSOIDOwner=} [properties] Properties to set */ function CMsgSOIDOwner(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]]; } /** * CMsgSOIDOwner type. * @member {number} type * @memberof CMsgSOIDOwner * @instance */ CMsgSOIDOwner.prototype.type = 0; /** * CMsgSOIDOwner id. * @member {number|Long} id * @memberof CMsgSOIDOwner * @instance */ CMsgSOIDOwner.prototype.id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * Creates a new CMsgSOIDOwner instance using the specified properties. * @function create * @memberof CMsgSOIDOwner * @static * @param {ICMsgSOIDOwner=} [properties] Properties to set * @returns {CMsgSOIDOwner} CMsgSOIDOwner instance */ CMsgSOIDOwner.create = function create(properties) { return new CMsgSOIDOwner(properties); }; /** * Encodes the specified CMsgSOIDOwner message. Does not implicitly {@link CMsgSOIDOwner.verify|verify} messages. * @function encode * @memberof CMsgSOIDOwner * @static * @param {ICMsgSOIDOwner} message CMsgSOIDOwner message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgSOIDOwner.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.type); if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.id); return writer; }; /** * Encodes the specified CMsgSOIDOwner message, length delimited. Does not implicitly {@link CMsgSOIDOwner.verify|verify} messages. * @function encodeDelimited * @memberof CMsgSOIDOwner * @static * @param {ICMsgSOIDOwner} message CMsgSOIDOwner message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgSOIDOwner.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CMsgSOIDOwner message from the specified reader or buffer. * @function decode * @memberof CMsgSOIDOwner * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CMsgSOIDOwner} CMsgSOIDOwner * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgSOIDOwner.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.CMsgSOIDOwner(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.type = reader.uint32(); break; } case 2: { message.id = reader.uint64(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CMsgSOIDOwner message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CMsgSOIDOwner * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CMsgSOIDOwner} CMsgSOIDOwner * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgSOIDOwner.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CMsgSOIDOwner message. * @function verify * @memberof CMsgSOIDOwner * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CMsgSOIDOwner.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.type != null && message.hasOwnProperty("type")) if (!$util.isInteger(message.type)) return "type: integer expected"; if (message.id != null && message.hasOwnProperty("id")) if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) return "id: integer|Long expected"; return null; }; /** * Creates a CMsgSOIDOwner message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CMsgSOIDOwner * @static * @param {Object.<string,*>} object Plain object * @returns {CMsgSOIDOwner} CMsgSOIDOwner */ CMsgSOIDOwner.fromObject = function fromObject(object) { if (object instanceof $root.CMsgSOIDOwner) return object; var message = new $root.CMsgSOIDOwner(); if (object.type != null) message.type = object.type >>> 0; if (object.id != null) if ($util.Long) (message.id = $util.Long.fromValue(object.id)).unsigned = true; else if (typeof object.id === "string") message.id = parseInt(object.id, 10); else if (typeof object.id === "number") message.id = object.id; else if (typeof object.id === "object") message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true); return message; }; /** * Creates a plain object from a CMsgSOIDOwner message. Also converts values to other types if specified. * @function toObject * @memberof CMsgSOIDOwner * @static * @param {CMsgSOIDOwner} message CMsgSOIDOwner * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CMsgSOIDOwner.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.type = 0; if ($util.Long) { var long = new $util.Long(0, 0, true); object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.id = options.longs === String ? "0" : 0; } if (message.type != null && message.hasOwnProperty("type")) object.type = message.type; if (message.id != null && message.hasOwnProperty("id")) if (typeof message.id === "number") object.id = options.longs === String ? String(message.id) : message.id; else object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id; return object; }; /** * Converts this CMsgSOIDOwner to JSON. * @function toJSON * @memberof CMsgSOIDOwner * @instance * @returns {Object.<string,*>} JSON object */ CMsgSOIDOwner.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CMsgSOIDOwner * @function getTypeUrl * @memberof CMsgSOIDOwner * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CMsgSOIDOwner.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/CMsgSOIDOwner"; }; return CMsgSOIDOwner; })(); $root.CMsgSOSingleObject = (function() { /** * Properties of a CMsgSOSingleObject. * @exports ICMsgSOSingleObject * @interface ICMsgSOSingleObject * @property {number|null} [type_id] CMsgSOSingleObject type_id * @property {Uint8Array|null} [object_data] CMsgSOSingleObject object_data * @property {number|Long|null} [version] CMsgSOSingleObject version * @property {ICMsgSOIDOwner|null} [owner_soid] CMsgSOSingleObject owner_soid */ /** * Constructs a new CMsgSOSingleObject. * @exports CMsgSOSingleObject * @classdesc Represents a CMsgSOSingleObject. * @implements ICMsgSOSingleObject * @constructor * @param {ICMsgSOSingleObject=} [properties] Properties to set */ function CMsgSOSingleObject(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]]; } /** * CMsgSOSingleObject type_id. * @member {number} type_id * @memberof CMsgSOSingleObject * @instance */ CMsgSOSingleObject.prototype.type_id = 0; /** * CMsgSOSingleObject object_data. * @member {Uint8Array} object_data * @memberof CMsgSOSingleObject * @instance */ CMsgSOSingleObject.prototype.object_data = $util.newBuffer([]); /** * CMsgSOSingleObject version. * @member {number|Long} version * @memberof CMsgSOSingleObject * @instance */ CMsgSOSingleObject.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * CMsgSOSingleObject owner_soid. * @member {ICMsgSOIDOwner|null|undefined} owner_soid * @memberof CMsgSOSingleObject * @instance */ CMsgSOSingleObject.prototype.owner_soid = null; /** * Creates a new CMsgSOSingleObject instance using the specified properties. * @function create * @memberof CMsgSOSingleObject * @static * @param {ICMsgSOSingleObject=} [properties] Properties to set * @returns {CMsgSOSingleObject} CMsgSOSingleObject instance */ CMsgSOSingleObject.create = function create(properties) { return new CMsgSOSingleObject(properties); }; /** * Encodes the specified CMsgSOSingleObject message. Does not implicitly {@link CMsgSOSingleObject.verify|verify} messages. * @function encode * @memberof CMsgSOSingleObject * @static * @param {ICMsgSOSingleObject} message CMsgSOSingleObject message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgSOSingleObject.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.type_id != null && Object.hasOwnProperty.call(message, "type_id")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type_id); if (message.object_data != null && Object.hasOwnProperty.call(message, "object_data")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.object_data); if (message.version != null && Object.hasOwnProperty.call(message, "version")) writer.uint32(/* id 4, wireType 1 =*/33).fixed64(message.version); if (message.owner_soid != null && Object.hasOwnProperty.call(message, "owner_soid")) $root.CMsgSOIDOwner.encode(message.owner_soid, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** * Encodes the specified CMsgSOSingleObject message, length delimited. Does not implicitly {@link CMsgSOSingleObject.verify|verify} messages. * @function encodeDelimited * @memberof CMsgSOSingleObject * @static * @param {ICMsgSOSingleObject} message CMsgSOSingleObject message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgSOSingleObject.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CMsgSOSingleObject message from the specified reader or buffer. * @function decode * @memberof CMsgSOSingleObject * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CMsgSOSingleObject} CMsgSOSingleObject * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgSOSingleObject.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.CMsgSOSingleObject(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 2: { message.type_id = reader.int32(); break; } case 3: { message.object_data = reader.bytes(); break; } case 4: { message.version = reader.fixed64(); break; } case 5: { message.owner_soid = $root.CMsgSOIDOwner.decode(reader, reader.uint32()); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CMsgSOSingleObject message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CMsgSOSingleObject * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CMsgSOSingleObject} CMsgSOSingleObject * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgSOSingleObject.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CMsgSOSingleObject message. * @function verify * @memberof CMsgSOSingleObject * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CMsgSOSingleObject.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.type_id != null && message.hasOwnProperty("type_id")) if (!$util.isInteger(message.type_id)) return "type_id: integer expected"; if (message.object_data != null && message.hasOwnProperty("object_data")) if (!(message.object_data && typeof message.object_data.length === "number" || $util.isString(message.object_data))) return "object_data: buffer expected"; if (message.version != null && message.hasOwnProperty("version")) if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) return "version: integer|Long expected"; if (message.owner_soid != null && message.hasOwnProperty("owner_soid")) { var error = $root.CMsgSOIDOwner.verify(message.owner_soid); if (error) return "owner_soid." + error; } return null; }; /** * Creates a CMsgSOSingleObject message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CMsgSOSingleObject * @static * @param {Object.<string,*>} object Plain object * @returns {CMsgSOSingleObject} CMsgSOSingleObject */ CMsgSOSingleObject.fromObject = function fromObject(object) { if (object instanceof $root.CMsgSOSingleObject) return object; var message = new $root.CMsgSOSingleObject(); if (object.type_id != null) message.type_id = object.type_id | 0; if (object.object_data != null) if (typeof object.object_data === "string") $util.base64.decode(object.object_data, message.object_data = $util.newBuffer($util.base64.length(object.object_data)), 0); else if (object.object_data.length >= 0) message.object_data = object.object_data; if (object.version != null) if ($util.Long) (message.version = $util.Long.fromValue(object.version)).unsigned = false; else if (typeof object.version === "string") message.version = parseInt(object.version, 10); else if (typeof object.version === "number") message.version = object.version; else if (typeof object.version === "object") message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); if (object.owner_soid != null) { if (typeof object.owner_soid !== "object") throw TypeError(".CMsgSOSingleObject.owner_soid: object expected"); message.owner_soid = $root.CMsgSOIDOwner.fromObject(object.owner_soid); } return message; }; /** * Creates a plain object from a CMsgSOSingleObject message. Also converts values to other types if specified. * @function toObject * @memberof CMsgSOSingleObject * @static * @param {CMsgSOSingleObject} message CMsgSOSingleObject * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CMsgSOSingleObject.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.type_id = 0; if (options.bytes === String) object.object_data = ""; else { object.object_data = []; if (options.bytes !== Array) object.object_data = $util.newBuffer(object.object_data); } if ($util.Long) { var long = new $util.Long(0, 0, false); object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.version = options.longs === String ? "0" : 0; object.owner_soid = null; } if (message.type_id != null && message.hasOwnProperty("type_id")) object.type_id = message.type_id; if (message.object_data != null && message.hasOwnProperty("object_data")) object.object_data = options.bytes === String ? $util.base64.encode(message.object_data, 0, message.object_data.length) : options.bytes === Array ? Array.prototype.slice.call(message.object_data) : message.object_data; if (message.version != null && message.hasOwnProperty("version")) if (typeof message.version === "number") object.version = options.longs === String ? String(message.version) : message.version; else object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; if (message.owner_soid != null && message.hasOwnProperty("owner_soid")) object.owner_soid = $root.CMsgSOIDOwner.toObject(message.owner_soid, options); return object; }; /** * Converts this CMsgSOSingleObject to JSON. * @function toJSON * @memberof CMsgSOSingleObject * @instance * @returns {Object.<string,*>} JSON object */ CMsgSOSingleObject.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CMsgSOSingleObject * @function getTypeUrl * @memberof CMsgSOSingleObject * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CMsgSOSingleObject.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/CMsgSOSingleObject"; }; return CMsgSOSingleObject; })(); $root.CMsgSOMultipleObjects = (function() { /** * Properties of a CMsgSOMultipleObjects. * @exports ICMsgSOMultipleObjects * @interface ICMsgSOMultipleObjects * @property {Array.<CMsgSOMultipleObjects.ISingleObject>|null} [objects_modified] CMsgSOMultipleObjects objects_modified * @property {number|Long|null} [version] CMsgSOMultipleObjects version * @property {ICMsgSOIDOwner|null} [owner_soid] CMsgSOMultipleObjects owner_soid */ /** * Constructs a new CMsgSOMultipleObjects. * @exports CMsgSOMultipleObjects * @classdesc Represents a CMsgSOMultipleObjects. * @implements ICMsgSOMultipleObjects * @constructor * @param {ICMsgSOMultipleObjects=} [properties] Properties to set */ function CMsgSOMultipleObjects(properties) { this.objects_modified = []; 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]]; } /** * CMsgSOMultipleObjects objects_modified. * @member {Array.<CMsgSOMultipleObjects.ISingleObject>} objects_modified * @memberof CMsgSOMultipleObjects * @instance */ CMsgSOMultipleObjects.prototype.objects_modified = $util.emptyArray; /** * CMsgSOMultipleObjects version. * @member {number|Long} version * @memberof CMsgSOMultipleObjects * @instance */ CMsgSOMultipleObjects.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * CMsgSOMultipleObjects owner_soid. * @member {ICMsgSOIDOwner|null|undefined} owner_soid * @memberof CMsgSOMultipleObjects * @instance */ CMsgSOMultipleObjects.prototype.owner_soid = null; /** * Creates a new CMsgSOMultipleObjects instance using the specified properties. * @function create * @memberof CMsgSOMultipleObjects * @static * @param {ICMsgSOMultipleObjects=} [properties] Properties to set * @returns {CMsgSOMultipleObjects} CMsgSOMultipleObjects instance */ CMsgSOMultipleObjects.create = function create(properties) { return new CMsgSOMultipleObjects(properties); }; /** * Encodes the specified CMsgSOMultipleObjects message. Does not implicitly {@link CMsgSOMultipleObjects.verify|verify} messages. * @function encode * @memberof CMsgSOMultipleObjects * @static * @param {ICMsgSOMultipleObjects} message CMsgSOMultipleObjects message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgSOMultipleObjects.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.objects_modified != null && message.objects_modified.length) for (var i = 0; i < message.objects_modified.length; ++i) $root.CMsgSOMultipleObjects.SingleObject.encode(message.objects_modified[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.version != null && Object.hasOwnProperty.call(message, "version")) writer.uint32(/* id 3, wireType 1 =*/25).fixed64(message.version); if (message.owner_soid != null && Object.hasOwnProperty.call(message, "owner_soid")) $root.CMsgSOIDOwner.encode(message.owner_soid, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** * Encodes the specified CMsgSOMultipleObjects message, length delimited. Does not implicitly {@link CMsgSOMultipleObjects.verify|verify} messages. * @function encodeDelimited * @memberof CMsgSOMultipleObjects * @static * @param {ICMsgSOMultipleObjects} message CMsgSOMultipleObjects message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgSOMultipleObjects.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CMsgSOMultipleObjects message from the specified reader or buffer. * @function decode * @memberof CMsgSOMultipleObjects * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CMsgSOMultipleObjects} CMsgSOMultipleObjects * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgSOMultipleObjects.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.CMsgSOMultipleObjects(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 2: { if (!(message.objects_modified && message.objects_modified.length)) message.objects_modified = []; message.objects_modified.push($root.CMsgSOMultipleObjects.SingleObject.decode(reader, reader.uint32())); break; } case 3: { message.version = reader.fixed64(); break; } case 6: { message.owner_soid = $root.CMsgSOIDOwner.decode(reader, reader.uint32()); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CMsgSOMultipleObjects message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CMsgSOMultipleObjects * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CMsgSOMultipleObjects} CMsgSOMultipleObjects * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgSOMultipleObjects.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CMsgSOMultipleObjects message. * @function verify * @memberof CMsgSOMultipleObjects * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CMsgSOMultipleObjects.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.objects_modified != null && message.hasOwnProperty("objects_modified")) { if (!Array.isArray(message.objects_modified)) return "objects_modified: array expected"; for (var i = 0; i < message.objects_modified.length; ++i) { var error = $root.CMsgSOMultipleObjects.SingleObject.verify(message.objects_modified[i]); if (error) return "objects_modified." + error; } } if (message.version != null && message.hasOwnProperty("version")) if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) return "version: integer|Long expected"; if (message.owner_soid != null && message.hasOwnProperty("owner_soid")) { var error = $root.CMsgSOIDOwner.verify(message.owner_soid); if (error) return "owner_soid." + error; } return null; }; /** * Creates a CMsgSOMultipleObjects message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CMsgSOMultipleObjects * @static * @param {Object.<string,*>} object Plain object * @returns {CMsgSOMultipleObjects} CMsgSOMultipleObjects */ CMsgSOMultipleObjects.fromObject = function fromObject(object) { if (object instanceof $root.CMsgSOMultipleObjects) return object; var message = new $root.CMsgSOMultipleObjects(); if (object.objects_modified) { if (!Array.isArray(object.objects_modified)) throw TypeError(".CMsgSOMultipleObjects.objects_modified: array expected"); message.objects_modified = []; for (var i = 0; i < object.objects_modified.length; ++i) { if (typeof object.objects_modified[i] !== "object") throw TypeError(".CMsgSOMultipleObjects.objects_modified: object expected"); message.objects_modified[i] = $root.CMsgSOMultipleObjects.SingleObject.fromObject(object.objects_modified[i]); } } if (object.version != null) if ($util.Long) (message.version = $util.Long.fromValue(object.version)).unsigned = false; else if (typeof object.version === "string") message.version = parseInt(object.version, 10); else if (typeof object.version === "number") message.version = object.version; else if (typeof object.version === "object") message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); if (object.owner_soid != null) { if (typeof object.owner_soid !== "object") throw TypeError(".CMsgSOMultipleObjects.owner_soid: object expected"); message.owner_soid = $root.CMsgSOIDOwner.fromObject(object.owner_soid); } return message; }; /** * Creates a plain object from a CMsgSOMultipleObjects message. Also converts values to other types if specified. * @function toObject * @memberof CMsgSOMultipleObjects * @static * @param {CMsgSOMultipleObjects} message CMsgSOMultipleObjects * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CMsgSOMultipleObjects.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.objects_modified = []; if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.version = options.longs === String ? "0" : 0; object.owner_soid = null; } if (message.objects_modified && message.objects_modified.length) { object.objects_modified = []; for (var j = 0; j < message.objects_modified.length; ++j) object.objects_modified[j] = $root.CMsgSOMultipleObjects.SingleObject.toObject(message.objects_modified[j], options); } if (message.version != null && message.hasOwnProperty("version")) if (typeof message.version === "number") object.version = options.longs === String ? String(message.version) : message.version; else object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; if (message.owner_soid != null && message.hasOwnProperty("owner_soid")) object.owner_soid = $root.CMsgSOIDOwner.toObject(message.owner_soid, options); return object; }; /** * Converts this CMsgSOMultipleObjects to JSON. * @function toJSON * @memberof CMsgSOMultipleObjects * @instance * @returns {Object.<string,*>} JSON object */ CMsgSOMultipleObjects.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CMsgSOMultipleObjects * @function getTypeUrl * @memberof CMsgSOMultipleObjects * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CMsgSOMultipleObjects.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/CMsgSOMultipleObjects"; }; CMsgSOMultipleObjects.SingleObject = (function() { /** * Properties of a SingleObject. * @memberof CMsgSOMultipleObjects * @interface ISingleObject * @property {number|null} [type_id] SingleObject type_id * @property {Uint8Array|null} [object_data] SingleObject object_data */ /** * Constructs a new SingleObject. * @memberof CMsgSOMultipleObjects * @classdesc Represents a SingleObject. * @implements ISingleObject * @constructor * @param {CMsgSOMultipleObjects.ISingleObject=} [properties] Properties to set */ function SingleObject(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]]; } /** * SingleObject type_id. * @member {number} type_id * @memberof CMsgSOMultipleObjects.SingleObject * @instance */ SingleObject.prototype.type_id = 0; /** * SingleObject object_data. * @member {Uint8Array} object_data * @memberof CMsgSOMultipleObjects.SingleObject * @instance */ SingleObject.prototype.object_data = $util.newBuffer([]); /** * Creates a new SingleObject instance using the specified properties. * @function create * @memberof CMsgSOMultipleObjects.SingleObject * @static * @param {CMsgSOMultipleObjects.ISingleObject=} [properties] Properties to set * @returns {CMsgSOMultipleObjects.SingleObject} SingleObject instance */ SingleObject.create = function create(properties) { return new SingleObject(properties); }; /** * Encodes the specified SingleObject message. Does not implicitly {@link CMsgSOMultipleObjects.SingleObject.verify|verify} messages. * @function encode * @memberof CMsgSOMultipleObjects.SingleObject * @static * @param {CMsgSOMultipleObjects.ISingleObject} message SingleObject message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ SingleObject.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.type_id != null && Object.hasOwnProperty.call(message, "type_id")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type_id); if (message.object_data != null && Object.hasOwnProperty.call(message, "object_data")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.object_data); return writer; }; /** * Encodes the specified SingleObject message, length delimited. Does not implicitly {@link CMsgSOMultipleObjects.SingleObject.verify|verify} messages. * @function encodeDelimited * @memberof CMsgSOMultipleObjects.SingleObject * @static * @param {CMsgSOMultipleObjects.ISingleObject} message SingleObject message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ SingleObject.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a SingleObject message from the specified reader or buffer. * @function decode * @memberof CMsgSOMultipleObjects.SingleObject * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CMsgSOMultipleObjects.SingleObject} SingleObject * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ SingleObject.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.CMsgSOMultipleObjects.SingleObject(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.type_id = reader.int32(); break; } case 2: { message.object_data = reader.bytes(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a SingleObject message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CMsgSOMultipleObjects.SingleObject * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CMsgSOMultipleObjects.SingleObject} SingleObject * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ SingleObject.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a SingleObject message. * @function verify * @memberof CMsgSOMultipleObjects.SingleObject * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ SingleObject.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.type_id != null && message.hasOwnProperty("type_id")) if (!$util.isInteger(message.type_id)) return "type_id: integer expected"; if (message.object_data != null && message.hasOwnProperty("object_data")) if (!(message.object_data && typeof message.object_data.length === "number" || $util.isString(message.object_data))) return "object_data: buffer expected"; return null; }; /** * Creates a SingleObject message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CMsgSOMultipleObjects.SingleObject * @static * @param {Object.<string,*>} object Plain object * @returns {CMsgSOMultipleObjects.SingleObject} SingleObject */ SingleObject.fromObject = function fromObject(object) { if (object instanceof $root.CMsgSOMultipleObjects.SingleObject) return object; var message = new $root.CMsgSOMultipleObjects.SingleObject(); if (object.type_id != null) message.type_id = object.type_id | 0; if (object.object_data != null) if (typeof object.object_data === "string") $util.base64.decode(object.objec