UNPKG

@openskindb/cs2-gc

Version:

Exposes a simple API for interacting with the Counter-Strike: Global Offensive/CS2 game coordinator

1,107 lines (1,037 loc) 1.9 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"] = {}); /** * CLC_Messages enum. * @exports CLC_Messages * @enum {number} * @property {number} clc_ClientInfo=20 clc_ClientInfo value * @property {number} clc_Move=21 clc_Move value * @property {number} clc_VoiceData=22 clc_VoiceData value * @property {number} clc_BaselineAck=23 clc_BaselineAck value * @property {number} clc_RespondCvarValue=25 clc_RespondCvarValue value * @property {number} clc_FileCRCCheck=26 clc_FileCRCCheck value * @property {number} clc_LoadingProgress=27 clc_LoadingProgress value * @property {number} clc_SplitPlayerConnect=28 clc_SplitPlayerConnect value * @property {number} clc_SplitPlayerDisconnect=30 clc_SplitPlayerDisconnect value * @property {number} clc_ServerStatus=31 clc_ServerStatus value * @property {number} clc_RequestPause=33 clc_RequestPause value * @property {number} clc_CmdKeyValues=34 clc_CmdKeyValues value * @property {number} clc_RconServerDetails=35 clc_RconServerDetails value * @property {number} clc_HltvReplay=36 clc_HltvReplay value * @property {number} clc_Diagnostic=37 clc_Diagnostic value */ $root.CLC_Messages = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[20] = "clc_ClientInfo"] = 20; values[valuesById[21] = "clc_Move"] = 21; values[valuesById[22] = "clc_VoiceData"] = 22; values[valuesById[23] = "clc_BaselineAck"] = 23; values[valuesById[25] = "clc_RespondCvarValue"] = 25; values[valuesById[26] = "clc_FileCRCCheck"] = 26; values[valuesById[27] = "clc_LoadingProgress"] = 27; values[valuesById[28] = "clc_SplitPlayerConnect"] = 28; values[valuesById[30] = "clc_SplitPlayerDisconnect"] = 30; values[valuesById[31] = "clc_ServerStatus"] = 31; values[valuesById[33] = "clc_RequestPause"] = 33; values[valuesById[34] = "clc_CmdKeyValues"] = 34; values[valuesById[35] = "clc_RconServerDetails"] = 35; values[valuesById[36] = "clc_HltvReplay"] = 36; values[valuesById[37] = "clc_Diagnostic"] = 37; return values; })(); /** * SVC_Messages enum. * @exports SVC_Messages * @enum {number} * @property {number} svc_ServerInfo=40 svc_ServerInfo value * @property {number} svc_FlattenedSerializer=41 svc_FlattenedSerializer value * @property {number} svc_ClassInfo=42 svc_ClassInfo value * @property {number} svc_SetPause=43 svc_SetPause value * @property {number} svc_CreateStringTable=44 svc_CreateStringTable value * @property {number} svc_UpdateStringTable=45 svc_UpdateStringTable value * @property {number} svc_VoiceInit=46 svc_VoiceInit value * @property {number} svc_VoiceData=47 svc_VoiceData value * @property {number} svc_Print=48 svc_Print value * @property {number} svc_Sounds=49 svc_Sounds value * @property {number} svc_SetView=50 svc_SetView value * @property {number} svc_ClearAllStringTables=51 svc_ClearAllStringTables value * @property {number} svc_CmdKeyValues=52 svc_CmdKeyValues value * @property {number} svc_BSPDecal=53 svc_BSPDecal value * @property {number} svc_SplitScreen=54 svc_SplitScreen value * @property {number} svc_PacketEntities=55 svc_PacketEntities value * @property {number} svc_Prefetch=56 svc_Prefetch value * @property {number} svc_Menu=57 svc_Menu value * @property {number} svc_GetCvarValue=58 svc_GetCvarValue value * @property {number} svc_StopSound=59 svc_StopSound value * @property {number} svc_PeerList=60 svc_PeerList value * @property {number} svc_PacketReliable=61 svc_PacketReliable value * @property {number} svc_HLTVStatus=62 svc_HLTVStatus value * @property {number} svc_ServerSteamID=63 svc_ServerSteamID value * @property {number} svc_FullFrameSplit=70 svc_FullFrameSplit value * @property {number} svc_RconServerDetails=71 svc_RconServerDetails value * @property {number} svc_UserMessage=72 svc_UserMessage value * @property {number} svc_Broadcast_Command=74 svc_Broadcast_Command value * @property {number} svc_HltvFixupOperatorStatus=75 svc_HltvFixupOperatorStatus value * @property {number} svc_UserCmds=76 svc_UserCmds value */ $root.SVC_Messages = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[40] = "svc_ServerInfo"] = 40; values[valuesById[41] = "svc_FlattenedSerializer"] = 41; values[valuesById[42] = "svc_ClassInfo"] = 42; values[valuesById[43] = "svc_SetPause"] = 43; values[valuesById[44] = "svc_CreateStringTable"] = 44; values[valuesById[45] = "svc_UpdateStringTable"] = 45; values[valuesById[46] = "svc_VoiceInit"] = 46; values[valuesById[47] = "svc_VoiceData"] = 47; values[valuesById[48] = "svc_Print"] = 48; values[valuesById[49] = "svc_Sounds"] = 49; values[valuesById[50] = "svc_SetView"] = 50; values[valuesById[51] = "svc_ClearAllStringTables"] = 51; values[valuesById[52] = "svc_CmdKeyValues"] = 52; values[valuesById[53] = "svc_BSPDecal"] = 53; values[valuesById[54] = "svc_SplitScreen"] = 54; values[valuesById[55] = "svc_PacketEntities"] = 55; values[valuesById[56] = "svc_Prefetch"] = 56; values[valuesById[57] = "svc_Menu"] = 57; values[valuesById[58] = "svc_GetCvarValue"] = 58; values[valuesById[59] = "svc_StopSound"] = 59; values[valuesById[60] = "svc_PeerList"] = 60; values[valuesById[61] = "svc_PacketReliable"] = 61; values[valuesById[62] = "svc_HLTVStatus"] = 62; values[valuesById[63] = "svc_ServerSteamID"] = 63; values[valuesById[70] = "svc_FullFrameSplit"] = 70; values[valuesById[71] = "svc_RconServerDetails"] = 71; values[valuesById[72] = "svc_UserMessage"] = 72; values[valuesById[74] = "svc_Broadcast_Command"] = 74; values[valuesById[75] = "svc_HltvFixupOperatorStatus"] = 75; values[valuesById[76] = "svc_UserCmds"] = 76; return values; })(); /** * VoiceDataFormat_t enum. * @exports VoiceDataFormat_t * @enum {number} * @property {number} VOICEDATA_FORMAT_STEAM=0 VOICEDATA_FORMAT_STEAM value * @property {number} VOICEDATA_FORMAT_ENGINE=1 VOICEDATA_FORMAT_ENGINE value * @property {number} VOICEDATA_FORMAT_OPUS=2 VOICEDATA_FORMAT_OPUS value */ $root.VoiceDataFormat_t = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "VOICEDATA_FORMAT_STEAM"] = 0; values[valuesById[1] = "VOICEDATA_FORMAT_ENGINE"] = 1; values[valuesById[2] = "VOICEDATA_FORMAT_OPUS"] = 2; return values; })(); /** * RequestPause_t enum. * @exports RequestPause_t * @enum {number} * @property {number} RP_PAUSE=0 RP_PAUSE value * @property {number} RP_UNPAUSE=1 RP_UNPAUSE value * @property {number} RP_TOGGLEPAUSE=2 RP_TOGGLEPAUSE value */ $root.RequestPause_t = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "RP_PAUSE"] = 0; values[valuesById[1] = "RP_UNPAUSE"] = 1; values[valuesById[2] = "RP_TOGGLEPAUSE"] = 2; return values; })(); /** * PrefetchType enum. * @exports PrefetchType * @enum {number} * @property {number} PFT_SOUND=0 PFT_SOUND value */ $root.PrefetchType = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "PFT_SOUND"] = 0; return values; })(); /** * ESplitScreenMessageType enum. * @exports ESplitScreenMessageType * @enum {number} * @property {number} MSG_SPLITSCREEN_ADDUSER=0 MSG_SPLITSCREEN_ADDUSER value * @property {number} MSG_SPLITSCREEN_REMOVEUSER=1 MSG_SPLITSCREEN_REMOVEUSER value */ $root.ESplitScreenMessageType = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "MSG_SPLITSCREEN_ADDUSER"] = 0; values[valuesById[1] = "MSG_SPLITSCREEN_REMOVEUSER"] = 1; return values; })(); /** * EQueryCvarValueStatus enum. * @exports EQueryCvarValueStatus * @enum {number} * @property {number} eQueryCvarValueStatus_ValueIntact=0 eQueryCvarValueStatus_ValueIntact value * @property {number} eQueryCvarValueStatus_CvarNotFound=1 eQueryCvarValueStatus_CvarNotFound value * @property {number} eQueryCvarValueStatus_NotACvar=2 eQueryCvarValueStatus_NotACvar value * @property {number} eQueryCvarValueStatus_CvarProtected=3 eQueryCvarValueStatus_CvarProtected value */ $root.EQueryCvarValueStatus = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "eQueryCvarValueStatus_ValueIntact"] = 0; values[valuesById[1] = "eQueryCvarValueStatus_CvarNotFound"] = 1; values[valuesById[2] = "eQueryCvarValueStatus_NotACvar"] = 2; values[valuesById[3] = "eQueryCvarValueStatus_CvarProtected"] = 3; return values; })(); /** * DIALOG_TYPE enum. * @exports DIALOG_TYPE * @enum {number} * @property {number} DIALOG_MSG=0 DIALOG_MSG value * @property {number} DIALOG_MENU=1 DIALOG_MENU value * @property {number} DIALOG_TEXT=2 DIALOG_TEXT value * @property {number} DIALOG_ENTRY=3 DIALOG_ENTRY value * @property {number} DIALOG_ASKCONNECT=4 DIALOG_ASKCONNECT value */ $root.DIALOG_TYPE = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "DIALOG_MSG"] = 0; values[valuesById[1] = "DIALOG_MENU"] = 1; values[valuesById[2] = "DIALOG_TEXT"] = 2; values[valuesById[3] = "DIALOG_ENTRY"] = 3; values[valuesById[4] = "DIALOG_ASKCONNECT"] = 4; return values; })(); /** * SVC_Messages_LowFrequency enum. * @exports SVC_Messages_LowFrequency * @enum {number} * @property {number} svc_dummy=600 svc_dummy value */ $root.SVC_Messages_LowFrequency = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[600] = "svc_dummy"] = 600; return values; })(); /** * Bidirectional_Messages enum. * @exports Bidirectional_Messages * @enum {number} * @property {number} bi_RebroadcastGameEvent=16 bi_RebroadcastGameEvent value * @property {number} bi_RebroadcastSource=17 bi_RebroadcastSource value * @property {number} bi_GameEvent=18 bi_GameEvent value */ $root.Bidirectional_Messages = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[16] = "bi_RebroadcastGameEvent"] = 16; values[valuesById[17] = "bi_RebroadcastSource"] = 17; values[valuesById[18] = "bi_GameEvent"] = 18; return values; })(); /** * Bidirectional_Messages_LowFrequency enum. * @exports Bidirectional_Messages_LowFrequency * @enum {number} * @property {number} bi_RelayInfo=700 bi_RelayInfo value * @property {number} bi_RelayPacket=701 bi_RelayPacket value */ $root.Bidirectional_Messages_LowFrequency = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[700] = "bi_RelayInfo"] = 700; values[valuesById[701] = "bi_RelayPacket"] = 701; return values; })(); /** * ReplayEventType_t enum. * @exports ReplayEventType_t * @enum {number} * @property {number} REPLAY_EVENT_CANCEL=0 REPLAY_EVENT_CANCEL value * @property {number} REPLAY_EVENT_DEATH=1 REPLAY_EVENT_DEATH value * @property {number} REPLAY_EVENT_GENERIC=2 REPLAY_EVENT_GENERIC value * @property {number} REPLAY_EVENT_STUCK_NEED_FULL_UPDATE=3 REPLAY_EVENT_STUCK_NEED_FULL_UPDATE value * @property {number} REPLAY_EVENT_VICTORY=4 REPLAY_EVENT_VICTORY value */ $root.ReplayEventType_t = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "REPLAY_EVENT_CANCEL"] = 0; values[valuesById[1] = "REPLAY_EVENT_DEATH"] = 1; values[valuesById[2] = "REPLAY_EVENT_GENERIC"] = 2; values[valuesById[3] = "REPLAY_EVENT_STUCK_NEED_FULL_UPDATE"] = 3; values[valuesById[4] = "REPLAY_EVENT_VICTORY"] = 4; return values; })(); $root.CCLCMsg_ClientInfo = (function() { /** * Properties of a CCLCMsg_ClientInfo. * @exports ICCLCMsg_ClientInfo * @interface ICCLCMsg_ClientInfo * @property {number|null} [send_table_crc] CCLCMsg_ClientInfo send_table_crc * @property {number|null} [server_count] CCLCMsg_ClientInfo server_count * @property {boolean|null} [is_hltv] CCLCMsg_ClientInfo is_hltv * @property {number|null} [friends_id] CCLCMsg_ClientInfo friends_id * @property {string|null} [friends_name] CCLCMsg_ClientInfo friends_name */ /** * Constructs a new CCLCMsg_ClientInfo. * @exports CCLCMsg_ClientInfo * @classdesc Represents a CCLCMsg_ClientInfo. * @implements ICCLCMsg_ClientInfo * @constructor * @param {ICCLCMsg_ClientInfo=} [properties] Properties to set */ function CCLCMsg_ClientInfo(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]]; } /** * CCLCMsg_ClientInfo send_table_crc. * @member {number} send_table_crc * @memberof CCLCMsg_ClientInfo * @instance */ CCLCMsg_ClientInfo.prototype.send_table_crc = 0; /** * CCLCMsg_ClientInfo server_count. * @member {number} server_count * @memberof CCLCMsg_ClientInfo * @instance */ CCLCMsg_ClientInfo.prototype.server_count = 0; /** * CCLCMsg_ClientInfo is_hltv. * @member {boolean} is_hltv * @memberof CCLCMsg_ClientInfo * @instance */ CCLCMsg_ClientInfo.prototype.is_hltv = false; /** * CCLCMsg_ClientInfo friends_id. * @member {number} friends_id * @memberof CCLCMsg_ClientInfo * @instance */ CCLCMsg_ClientInfo.prototype.friends_id = 0; /** * CCLCMsg_ClientInfo friends_name. * @member {string} friends_name * @memberof CCLCMsg_ClientInfo * @instance */ CCLCMsg_ClientInfo.prototype.friends_name = ""; /** * Creates a new CCLCMsg_ClientInfo instance using the specified properties. * @function create * @memberof CCLCMsg_ClientInfo * @static * @param {ICCLCMsg_ClientInfo=} [properties] Properties to set * @returns {CCLCMsg_ClientInfo} CCLCMsg_ClientInfo instance */ CCLCMsg_ClientInfo.create = function create(properties) { return new CCLCMsg_ClientInfo(properties); }; /** * Encodes the specified CCLCMsg_ClientInfo message. Does not implicitly {@link CCLCMsg_ClientInfo.verify|verify} messages. * @function encode * @memberof CCLCMsg_ClientInfo * @static * @param {ICCLCMsg_ClientInfo} message CCLCMsg_ClientInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CCLCMsg_ClientInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.send_table_crc != null && Object.hasOwnProperty.call(message, "send_table_crc")) writer.uint32(/* id 1, wireType 5 =*/13).fixed32(message.send_table_crc); if (message.server_count != null && Object.hasOwnProperty.call(message, "server_count")) writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.server_count); if (message.is_hltv != null && Object.hasOwnProperty.call(message, "is_hltv")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.is_hltv); if (message.friends_id != null && Object.hasOwnProperty.call(message, "friends_id")) writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.friends_id); if (message.friends_name != null && Object.hasOwnProperty.call(message, "friends_name")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.friends_name); return writer; }; /** * Encodes the specified CCLCMsg_ClientInfo message, length delimited. Does not implicitly {@link CCLCMsg_ClientInfo.verify|verify} messages. * @function encodeDelimited * @memberof CCLCMsg_ClientInfo * @static * @param {ICCLCMsg_ClientInfo} message CCLCMsg_ClientInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CCLCMsg_ClientInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CCLCMsg_ClientInfo message from the specified reader or buffer. * @function decode * @memberof CCLCMsg_ClientInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CCLCMsg_ClientInfo} CCLCMsg_ClientInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CCLCMsg_ClientInfo.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.CCLCMsg_ClientInfo(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.send_table_crc = reader.fixed32(); break; } case 2: { message.server_count = reader.uint32(); break; } case 3: { message.is_hltv = reader.bool(); break; } case 5: { message.friends_id = reader.uint32(); break; } case 6: { message.friends_name = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CCLCMsg_ClientInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CCLCMsg_ClientInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CCLCMsg_ClientInfo} CCLCMsg_ClientInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CCLCMsg_ClientInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CCLCMsg_ClientInfo message. * @function verify * @memberof CCLCMsg_ClientInfo * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CCLCMsg_ClientInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.send_table_crc != null && message.hasOwnProperty("send_table_crc")) if (!$util.isInteger(message.send_table_crc)) return "send_table_crc: integer expected"; if (message.server_count != null && message.hasOwnProperty("server_count")) if (!$util.isInteger(message.server_count)) return "server_count: integer expected"; if (message.is_hltv != null && message.hasOwnProperty("is_hltv")) if (typeof message.is_hltv !== "boolean") return "is_hltv: boolean expected"; if (message.friends_id != null && message.hasOwnProperty("friends_id")) if (!$util.isInteger(message.friends_id)) return "friends_id: integer expected"; if (message.friends_name != null && message.hasOwnProperty("friends_name")) if (!$util.isString(message.friends_name)) return "friends_name: string expected"; return null; }; /** * Creates a CCLCMsg_ClientInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CCLCMsg_ClientInfo * @static * @param {Object.<string,*>} object Plain object * @returns {CCLCMsg_ClientInfo} CCLCMsg_ClientInfo */ CCLCMsg_ClientInfo.fromObject = function fromObject(object) { if (object instanceof $root.CCLCMsg_ClientInfo) return object; var message = new $root.CCLCMsg_ClientInfo(); if (object.send_table_crc != null) message.send_table_crc = object.send_table_crc >>> 0; if (object.server_count != null) message.server_count = object.server_count >>> 0; if (object.is_hltv != null) message.is_hltv = Boolean(object.is_hltv); if (object.friends_id != null) message.friends_id = object.friends_id >>> 0; if (object.friends_name != null) message.friends_name = String(object.friends_name); return message; }; /** * Creates a plain object from a CCLCMsg_ClientInfo message. Also converts values to other types if specified. * @function toObject * @memberof CCLCMsg_ClientInfo * @static * @param {CCLCMsg_ClientInfo} message CCLCMsg_ClientInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CCLCMsg_ClientInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.send_table_crc = 0; object.server_count = 0; object.is_hltv = false; object.friends_id = 0; object.friends_name = ""; } if (message.send_table_crc != null && message.hasOwnProperty("send_table_crc")) object.send_table_crc = message.send_table_crc; if (message.server_count != null && message.hasOwnProperty("server_count")) object.server_count = message.server_count; if (message.is_hltv != null && message.hasOwnProperty("is_hltv")) object.is_hltv = message.is_hltv; if (message.friends_id != null && message.hasOwnProperty("friends_id")) object.friends_id = message.friends_id; if (message.friends_name != null && message.hasOwnProperty("friends_name")) object.friends_name = message.friends_name; return object; }; /** * Converts this CCLCMsg_ClientInfo to JSON. * @function toJSON * @memberof CCLCMsg_ClientInfo * @instance * @returns {Object.<string,*>} JSON object */ CCLCMsg_ClientInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CCLCMsg_ClientInfo * @function getTypeUrl * @memberof CCLCMsg_ClientInfo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CCLCMsg_ClientInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/CCLCMsg_ClientInfo"; }; return CCLCMsg_ClientInfo; })(); $root.CCLCMsg_Move = (function() { /** * Properties of a CCLCMsg_Move. * @exports ICCLCMsg_Move * @interface ICCLCMsg_Move * @property {Uint8Array|null} [data] CCLCMsg_Move data * @property {number|null} [last_command_number] CCLCMsg_Move last_command_number */ /** * Constructs a new CCLCMsg_Move. * @exports CCLCMsg_Move * @classdesc Represents a CCLCMsg_Move. * @implements ICCLCMsg_Move * @constructor * @param {ICCLCMsg_Move=} [properties] Properties to set */ function CCLCMsg_Move(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]]; } /** * CCLCMsg_Move data. * @member {Uint8Array} data * @memberof CCLCMsg_Move * @instance */ CCLCMsg_Move.prototype.data = $util.newBuffer([]); /** * CCLCMsg_Move last_command_number. * @member {number} last_command_number * @memberof CCLCMsg_Move * @instance */ CCLCMsg_Move.prototype.last_command_number = 0; /** * Creates a new CCLCMsg_Move instance using the specified properties. * @function create * @memberof CCLCMsg_Move * @static * @param {ICCLCMsg_Move=} [properties] Properties to set * @returns {CCLCMsg_Move} CCLCMsg_Move instance */ CCLCMsg_Move.create = function create(properties) { return new CCLCMsg_Move(properties); }; /** * Encodes the specified CCLCMsg_Move message. Does not implicitly {@link CCLCMsg_Move.verify|verify} messages. * @function encode * @memberof CCLCMsg_Move * @static * @param {ICCLCMsg_Move} message CCLCMsg_Move message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CCLCMsg_Move.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.data != null && Object.hasOwnProperty.call(message, "data")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.data); if (message.last_command_number != null && Object.hasOwnProperty.call(message, "last_command_number")) writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.last_command_number); return writer; }; /** * Encodes the specified CCLCMsg_Move message, length delimited. Does not implicitly {@link CCLCMsg_Move.verify|verify} messages. * @function encodeDelimited * @memberof CCLCMsg_Move * @static * @param {ICCLCMsg_Move} message CCLCMsg_Move message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CCLCMsg_Move.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CCLCMsg_Move message from the specified reader or buffer. * @function decode * @memberof CCLCMsg_Move * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CCLCMsg_Move} CCLCMsg_Move * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CCLCMsg_Move.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.CCLCMsg_Move(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 3: { message.data = reader.bytes(); break; } case 4: { message.last_command_number = reader.uint32(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CCLCMsg_Move message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CCLCMsg_Move * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CCLCMsg_Move} CCLCMsg_Move * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CCLCMsg_Move.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CCLCMsg_Move message. * @function verify * @memberof CCLCMsg_Move * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CCLCMsg_Move.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.data != null && message.hasOwnProperty("data")) if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) return "data: buffer expected"; if (message.last_command_number != null && message.hasOwnProperty("last_command_number")) if (!$util.isInteger(message.last_command_number)) return "last_command_number: integer expected"; return null; }; /** * Creates a CCLCMsg_Move message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CCLCMsg_Move * @static * @param {Object.<string,*>} object Plain object * @returns {CCLCMsg_Move} CCLCMsg_Move */ CCLCMsg_Move.fromObject = function fromObject(object) { if (object instanceof $root.CCLCMsg_Move) return object; var message = new $root.CCLCMsg_Move(); if (object.data != null) if (typeof object.data === "string") $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); else if (object.data.length >= 0) message.data = object.data; if (object.last_command_number != null) message.last_command_number = object.last_command_number >>> 0; return message; }; /** * Creates a plain object from a CCLCMsg_Move message. Also converts values to other types if specified. * @function toObject * @memberof CCLCMsg_Move * @static * @param {CCLCMsg_Move} message CCLCMsg_Move * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CCLCMsg_Move.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) object.data = ""; else { object.data = []; if (options.bytes !== Array) object.data = $util.newBuffer(object.data); } object.last_command_number = 0; } if (message.data != null && message.hasOwnProperty("data")) object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; if (message.last_command_number != null && message.hasOwnProperty("last_command_number")) object.last_command_number = message.last_command_number; return object; }; /** * Converts this CCLCMsg_Move to JSON. * @function toJSON * @memberof CCLCMsg_Move * @instance * @returns {Object.<string,*>} JSON object */ CCLCMsg_Move.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CCLCMsg_Move * @function getTypeUrl * @memberof CCLCMsg_Move * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CCLCMsg_Move.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/CCLCMsg_Move"; }; return CCLCMsg_Move; })(); $root.CMsgVoiceAudio = (function() { /** * Properties of a CMsgVoiceAudio. * @exports ICMsgVoiceAudio * @interface ICMsgVoiceAudio * @property {VoiceDataFormat_t|null} [format] CMsgVoiceAudio format * @property {Uint8Array|null} [voice_data] CMsgVoiceAudio voice_data * @property {number|null} [sequence_bytes] CMsgVoiceAudio sequence_bytes * @property {number|null} [section_number] CMsgVoiceAudio section_number * @property {number|null} [sample_rate] CMsgVoiceAudio sample_rate * @property {number|null} [uncompressed_sample_offset] CMsgVoiceAudio uncompressed_sample_offset * @property {number|null} [num_packets] CMsgVoiceAudio num_packets * @property {Array.<number>|null} [packet_offsets] CMsgVoiceAudio packet_offsets * @property {number|null} [voice_level] CMsgVoiceAudio voice_level */ /** * Constructs a new CMsgVoiceAudio. * @exports CMsgVoiceAudio * @classdesc Represents a CMsgVoiceAudio. * @implements ICMsgVoiceAudio * @constructor * @param {ICMsgVoiceAudio=} [properties] Properties to set */ function CMsgVoiceAudio(properties) { this.packet_offsets = []; 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]]; } /** * CMsgVoiceAudio format. * @member {VoiceDataFormat_t} format * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.format = 0; /** * CMsgVoiceAudio voice_data. * @member {Uint8Array} voice_data * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.voice_data = $util.newBuffer([]); /** * CMsgVoiceAudio sequence_bytes. * @member {number} sequence_bytes * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.sequence_bytes = 0; /** * CMsgVoiceAudio section_number. * @member {number} section_number * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.section_number = 0; /** * CMsgVoiceAudio sample_rate. * @member {number} sample_rate * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.sample_rate = 0; /** * CMsgVoiceAudio uncompressed_sample_offset. * @member {number} uncompressed_sample_offset * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.uncompressed_sample_offset = 0; /** * CMsgVoiceAudio num_packets. * @member {number} num_packets * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.num_packets = 0; /** * CMsgVoiceAudio packet_offsets. * @member {Array.<number>} packet_offsets * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.packet_offsets = $util.emptyArray; /** * CMsgVoiceAudio voice_level. * @member {number} voice_level * @memberof CMsgVoiceAudio * @instance */ CMsgVoiceAudio.prototype.voice_level = 0; /** * Creates a new CMsgVoiceAudio instance using the specified properties. * @function create * @memberof CMsgVoiceAudio * @static * @param {ICMsgVoiceAudio=} [properties] Properties to set * @returns {CMsgVoiceAudio} CMsgVoiceAudio instance */ CMsgVoiceAudio.create = function create(properties) { return new CMsgVoiceAudio(properties); }; /** * Encodes the specified CMsgVoiceAudio message. Does not implicitly {@link CMsgVoiceAudio.verify|verify} messages. * @function encode * @memberof CMsgVoiceAudio * @static * @param {ICMsgVoiceAudio} message CMsgVoiceAudio message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgVoiceAudio.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.format != null && Object.hasOwnProperty.call(message, "format")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); if (message.voice_data != null && Object.hasOwnProperty.call(message, "voice_data")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.voice_data); if (message.sequence_bytes != null && Object.hasOwnProperty.call(message, "sequence_bytes")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.sequence_bytes); if (message.section_number != null && Object.hasOwnProperty.call(message, "section_number")) writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.section_number); if (message.sample_rate != null && Object.hasOwnProperty.call(message, "sample_rate")) writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.sample_rate); if (message.uncompressed_sample_offset != null && Object.hasOwnProperty.call(message, "uncompressed_sample_offset")) writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.uncompressed_sample_offset); if (message.num_packets != null && Object.hasOwnProperty.call(message, "num_packets")) writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.num_packets); if (message.packet_offsets != null && message.packet_offsets.length) { writer.uint32(/* id 8, wireType 2 =*/66).fork(); for (var i = 0; i < message.packet_offsets.length; ++i) writer.uint32(message.packet_offsets[i]); writer.ldelim(); } if (message.voice_level != null && Object.hasOwnProperty.call(message, "voice_level")) writer.uint32(/* id 9, wireType 5 =*/77).float(message.voice_level); return writer; }; /** * Encodes the specified CMsgVoiceAudio message, length delimited. Does not implicitly {@link CMsgVoiceAudio.verify|verify} messages. * @function encodeDelimited * @memberof CMsgVoiceAudio * @static * @param {ICMsgVoiceAudio} message CMsgVoiceAudio message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgVoiceAudio.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CMsgVoiceAudio message from the specified reader or buffer. * @function decode * @memberof CMsgVoiceAudio * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CMsgVoiceAudio} CMsgVoiceAudio * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgVoiceAudio.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.CMsgVoiceAudio(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.format = reader.int32(); break; } case 2: { message.voice_data = reader.bytes(); break; } case 3: { message.sequence_bytes = reader.int32(); break; } case 4: { message.section_number = reader.uint32(); break; } case 5: { message.sample_rate = reader.uint32(); break; } case 6: { message.uncompressed_sample_offset = reader.uint32(); break; } case 7: { message.num_packets = reader.uint32(); break; } case 8: { if (!(message.packet_offsets && message.packet_offsets.length)) message.packet_offsets = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) message.packet_offsets.push(reader.uint32()); } else message.packet_offsets.push(reader.uint32()); break; } case 9: { message.voice_level = reader.float(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CMsgVoiceAudio message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CMsgVoiceAudio * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CMsgVoiceAudio} CMsgVoiceAudio * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgVoiceAudio.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CMsgVoiceAudio message. * @function verify * @memberof CMsgVoiceAudio * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CMsgVoiceAudio.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.format != null && message.hasOwnProperty("format")) switch (message.format) { default: return "format: enum value expected"; case 0: case 1: case 2: break; } if (message.voice_data != null && message.hasOwnProperty("voice_data")) if (!(message.voice_data && typeof message.voice_data.length === "number" || $util.isString(message.voice_data))) return "voice_data: buffer expected"; if (message.sequence_bytes != null && message.hasOwnProperty("sequence_bytes")) if (!$util.isInteger(message.sequence_bytes)) return "sequence_bytes: integer expected"; if (message.section_number != null && message.hasOwnProperty("section_number")) if (!$util.isInteger(message.section_number)) return "section_number: integer expected"; if (message.sample_rate != null && message.hasOwnProperty("sample_rate")) if (!$util.isI