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
1,169 lines (1,085 loc) • 2.03 MB
JavaScript
/*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"] = {});
/**
* P2P_Messages enum.
* @exports P2P_Messages
* @enum {number}
* @property {number} p2p_TextMessage=256 p2p_TextMessage value
* @property {number} p2p_Voice=257 p2p_Voice value
* @property {number} p2p_Ping=258 p2p_Ping value
* @property {number} p2p_VRAvatarPosition=259 p2p_VRAvatarPosition value
* @property {number} p2p_WatchSynchronization=260 p2p_WatchSynchronization value
* @property {number} p2p_FightingGame_GameData=261 p2p_FightingGame_GameData value
* @property {number} p2p_FightingGame_Connection=262 p2p_FightingGame_Connection value
*/
$root.P2P_Messages = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[256] = "p2p_TextMessage"] = 256;
values[valuesById[257] = "p2p_Voice"] = 257;
values[valuesById[258] = "p2p_Ping"] = 258;
values[valuesById[259] = "p2p_VRAvatarPosition"] = 259;
values[valuesById[260] = "p2p_WatchSynchronization"] = 260;
values[valuesById[261] = "p2p_FightingGame_GameData"] = 261;
values[valuesById[262] = "p2p_FightingGame_Connection"] = 262;
return values;
})();
$root.CP2P_TextMessage = (function() {
/**
* Properties of a CP2P_TextMessage.
* @exports ICP2P_TextMessage
* @interface ICP2P_TextMessage
* @property {Uint8Array|null} [text] CP2P_TextMessage text
*/
/**
* Constructs a new CP2P_TextMessage.
* @exports CP2P_TextMessage
* @classdesc Represents a CP2P_TextMessage.
* @implements ICP2P_TextMessage
* @constructor
* @param {ICP2P_TextMessage=} [properties] Properties to set
*/
function CP2P_TextMessage(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]];
}
/**
* CP2P_TextMessage text.
* @member {Uint8Array} text
* @memberof CP2P_TextMessage
* @instance
*/
CP2P_TextMessage.prototype.text = $util.newBuffer([]);
/**
* Creates a new CP2P_TextMessage instance using the specified properties.
* @function create
* @memberof CP2P_TextMessage
* @static
* @param {ICP2P_TextMessage=} [properties] Properties to set
* @returns {CP2P_TextMessage} CP2P_TextMessage instance
*/
CP2P_TextMessage.create = function create(properties) {
return new CP2P_TextMessage(properties);
};
/**
* Encodes the specified CP2P_TextMessage message. Does not implicitly {@link CP2P_TextMessage.verify|verify} messages.
* @function encode
* @memberof CP2P_TextMessage
* @static
* @param {ICP2P_TextMessage} message CP2P_TextMessage message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_TextMessage.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.text != null && Object.hasOwnProperty.call(message, "text"))
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.text);
return writer;
};
/**
* Encodes the specified CP2P_TextMessage message, length delimited. Does not implicitly {@link CP2P_TextMessage.verify|verify} messages.
* @function encodeDelimited
* @memberof CP2P_TextMessage
* @static
* @param {ICP2P_TextMessage} message CP2P_TextMessage message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_TextMessage.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CP2P_TextMessage message from the specified reader or buffer.
* @function decode
* @memberof CP2P_TextMessage
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CP2P_TextMessage} CP2P_TextMessage
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_TextMessage.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.CP2P_TextMessage();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.text = reader.bytes();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CP2P_TextMessage message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CP2P_TextMessage
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CP2P_TextMessage} CP2P_TextMessage
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_TextMessage.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CP2P_TextMessage message.
* @function verify
* @memberof CP2P_TextMessage
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CP2P_TextMessage.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.text != null && message.hasOwnProperty("text"))
if (!(message.text && typeof message.text.length === "number" || $util.isString(message.text)))
return "text: buffer expected";
return null;
};
/**
* Creates a CP2P_TextMessage message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CP2P_TextMessage
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CP2P_TextMessage} CP2P_TextMessage
*/
CP2P_TextMessage.fromObject = function fromObject(object) {
if (object instanceof $root.CP2P_TextMessage)
return object;
var message = new $root.CP2P_TextMessage();
if (object.text != null)
if (typeof object.text === "string")
$util.base64.decode(object.text, message.text = $util.newBuffer($util.base64.length(object.text)), 0);
else if (object.text.length >= 0)
message.text = object.text;
return message;
};
/**
* Creates a plain object from a CP2P_TextMessage message. Also converts values to other types if specified.
* @function toObject
* @memberof CP2P_TextMessage
* @static
* @param {CP2P_TextMessage} message CP2P_TextMessage
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CP2P_TextMessage.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
if (options.bytes === String)
object.text = "";
else {
object.text = [];
if (options.bytes !== Array)
object.text = $util.newBuffer(object.text);
}
if (message.text != null && message.hasOwnProperty("text"))
object.text = options.bytes === String ? $util.base64.encode(message.text, 0, message.text.length) : options.bytes === Array ? Array.prototype.slice.call(message.text) : message.text;
return object;
};
/**
* Converts this CP2P_TextMessage to JSON.
* @function toJSON
* @memberof CP2P_TextMessage
* @instance
* @returns {Object.<string,*>} JSON object
*/
CP2P_TextMessage.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CP2P_TextMessage
* @function getTypeUrl
* @memberof CP2P_TextMessage
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CP2P_TextMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CP2P_TextMessage";
};
return CP2P_TextMessage;
})();
$root.CSteam_Voice_Encoding = (function() {
/**
* Properties of a CSteam_Voice_Encoding.
* @exports ICSteam_Voice_Encoding
* @interface ICSteam_Voice_Encoding
* @property {Uint8Array|null} [voice_data] CSteam_Voice_Encoding voice_data
*/
/**
* Constructs a new CSteam_Voice_Encoding.
* @exports CSteam_Voice_Encoding
* @classdesc Represents a CSteam_Voice_Encoding.
* @implements ICSteam_Voice_Encoding
* @constructor
* @param {ICSteam_Voice_Encoding=} [properties] Properties to set
*/
function CSteam_Voice_Encoding(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]];
}
/**
* CSteam_Voice_Encoding voice_data.
* @member {Uint8Array} voice_data
* @memberof CSteam_Voice_Encoding
* @instance
*/
CSteam_Voice_Encoding.prototype.voice_data = $util.newBuffer([]);
/**
* Creates a new CSteam_Voice_Encoding instance using the specified properties.
* @function create
* @memberof CSteam_Voice_Encoding
* @static
* @param {ICSteam_Voice_Encoding=} [properties] Properties to set
* @returns {CSteam_Voice_Encoding} CSteam_Voice_Encoding instance
*/
CSteam_Voice_Encoding.create = function create(properties) {
return new CSteam_Voice_Encoding(properties);
};
/**
* Encodes the specified CSteam_Voice_Encoding message. Does not implicitly {@link CSteam_Voice_Encoding.verify|verify} messages.
* @function encode
* @memberof CSteam_Voice_Encoding
* @static
* @param {ICSteam_Voice_Encoding} message CSteam_Voice_Encoding message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSteam_Voice_Encoding.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.voice_data != null && Object.hasOwnProperty.call(message, "voice_data"))
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.voice_data);
return writer;
};
/**
* Encodes the specified CSteam_Voice_Encoding message, length delimited. Does not implicitly {@link CSteam_Voice_Encoding.verify|verify} messages.
* @function encodeDelimited
* @memberof CSteam_Voice_Encoding
* @static
* @param {ICSteam_Voice_Encoding} message CSteam_Voice_Encoding message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSteam_Voice_Encoding.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CSteam_Voice_Encoding message from the specified reader or buffer.
* @function decode
* @memberof CSteam_Voice_Encoding
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CSteam_Voice_Encoding} CSteam_Voice_Encoding
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSteam_Voice_Encoding.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.CSteam_Voice_Encoding();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.voice_data = reader.bytes();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CSteam_Voice_Encoding message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CSteam_Voice_Encoding
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CSteam_Voice_Encoding} CSteam_Voice_Encoding
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSteam_Voice_Encoding.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CSteam_Voice_Encoding message.
* @function verify
* @memberof CSteam_Voice_Encoding
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CSteam_Voice_Encoding.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
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";
return null;
};
/**
* Creates a CSteam_Voice_Encoding message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CSteam_Voice_Encoding
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CSteam_Voice_Encoding} CSteam_Voice_Encoding
*/
CSteam_Voice_Encoding.fromObject = function fromObject(object) {
if (object instanceof $root.CSteam_Voice_Encoding)
return object;
var message = new $root.CSteam_Voice_Encoding();
if (object.voice_data != null)
if (typeof object.voice_data === "string")
$util.base64.decode(object.voice_data, message.voice_data = $util.newBuffer($util.base64.length(object.voice_data)), 0);
else if (object.voice_data.length >= 0)
message.voice_data = object.voice_data;
return message;
};
/**
* Creates a plain object from a CSteam_Voice_Encoding message. Also converts values to other types if specified.
* @function toObject
* @memberof CSteam_Voice_Encoding
* @static
* @param {CSteam_Voice_Encoding} message CSteam_Voice_Encoding
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CSteam_Voice_Encoding.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
if (options.bytes === String)
object.voice_data = "";
else {
object.voice_data = [];
if (options.bytes !== Array)
object.voice_data = $util.newBuffer(object.voice_data);
}
if (message.voice_data != null && message.hasOwnProperty("voice_data"))
object.voice_data = options.bytes === String ? $util.base64.encode(message.voice_data, 0, message.voice_data.length) : options.bytes === Array ? Array.prototype.slice.call(message.voice_data) : message.voice_data;
return object;
};
/**
* Converts this CSteam_Voice_Encoding to JSON.
* @function toJSON
* @memberof CSteam_Voice_Encoding
* @instance
* @returns {Object.<string,*>} JSON object
*/
CSteam_Voice_Encoding.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CSteam_Voice_Encoding
* @function getTypeUrl
* @memberof CSteam_Voice_Encoding
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CSteam_Voice_Encoding.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CSteam_Voice_Encoding";
};
return CSteam_Voice_Encoding;
})();
$root.CP2P_Voice = (function() {
/**
* Properties of a CP2P_Voice.
* @exports ICP2P_Voice
* @interface ICP2P_Voice
* @property {ICMsgVoiceAudio|null} [audio] CP2P_Voice audio
* @property {number|null} [broadcast_group] CP2P_Voice broadcast_group
*/
/**
* Constructs a new CP2P_Voice.
* @exports CP2P_Voice
* @classdesc Represents a CP2P_Voice.
* @implements ICP2P_Voice
* @constructor
* @param {ICP2P_Voice=} [properties] Properties to set
*/
function CP2P_Voice(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]];
}
/**
* CP2P_Voice audio.
* @member {ICMsgVoiceAudio|null|undefined} audio
* @memberof CP2P_Voice
* @instance
*/
CP2P_Voice.prototype.audio = null;
/**
* CP2P_Voice broadcast_group.
* @member {number} broadcast_group
* @memberof CP2P_Voice
* @instance
*/
CP2P_Voice.prototype.broadcast_group = 0;
/**
* Creates a new CP2P_Voice instance using the specified properties.
* @function create
* @memberof CP2P_Voice
* @static
* @param {ICP2P_Voice=} [properties] Properties to set
* @returns {CP2P_Voice} CP2P_Voice instance
*/
CP2P_Voice.create = function create(properties) {
return new CP2P_Voice(properties);
};
/**
* Encodes the specified CP2P_Voice message. Does not implicitly {@link CP2P_Voice.verify|verify} messages.
* @function encode
* @memberof CP2P_Voice
* @static
* @param {ICP2P_Voice} message CP2P_Voice message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_Voice.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.audio != null && Object.hasOwnProperty.call(message, "audio"))
$root.CMsgVoiceAudio.encode(message.audio, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.broadcast_group != null && Object.hasOwnProperty.call(message, "broadcast_group"))
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.broadcast_group);
return writer;
};
/**
* Encodes the specified CP2P_Voice message, length delimited. Does not implicitly {@link CP2P_Voice.verify|verify} messages.
* @function encodeDelimited
* @memberof CP2P_Voice
* @static
* @param {ICP2P_Voice} message CP2P_Voice message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_Voice.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CP2P_Voice message from the specified reader or buffer.
* @function decode
* @memberof CP2P_Voice
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CP2P_Voice} CP2P_Voice
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_Voice.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.CP2P_Voice();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.audio = $root.CMsgVoiceAudio.decode(reader, reader.uint32());
break;
}
case 2: {
message.broadcast_group = reader.uint32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CP2P_Voice message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CP2P_Voice
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CP2P_Voice} CP2P_Voice
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_Voice.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CP2P_Voice message.
* @function verify
* @memberof CP2P_Voice
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CP2P_Voice.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.audio != null && message.hasOwnProperty("audio")) {
var error = $root.CMsgVoiceAudio.verify(message.audio);
if (error)
return "audio." + error;
}
if (message.broadcast_group != null && message.hasOwnProperty("broadcast_group"))
if (!$util.isInteger(message.broadcast_group))
return "broadcast_group: integer expected";
return null;
};
/**
* Creates a CP2P_Voice message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CP2P_Voice
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CP2P_Voice} CP2P_Voice
*/
CP2P_Voice.fromObject = function fromObject(object) {
if (object instanceof $root.CP2P_Voice)
return object;
var message = new $root.CP2P_Voice();
if (object.audio != null) {
if (typeof object.audio !== "object")
throw TypeError(".CP2P_Voice.audio: object expected");
message.audio = $root.CMsgVoiceAudio.fromObject(object.audio);
}
if (object.broadcast_group != null)
message.broadcast_group = object.broadcast_group >>> 0;
return message;
};
/**
* Creates a plain object from a CP2P_Voice message. Also converts values to other types if specified.
* @function toObject
* @memberof CP2P_Voice
* @static
* @param {CP2P_Voice} message CP2P_Voice
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CP2P_Voice.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.audio = null;
object.broadcast_group = 0;
}
if (message.audio != null && message.hasOwnProperty("audio"))
object.audio = $root.CMsgVoiceAudio.toObject(message.audio, options);
if (message.broadcast_group != null && message.hasOwnProperty("broadcast_group"))
object.broadcast_group = message.broadcast_group;
return object;
};
/**
* Converts this CP2P_Voice to JSON.
* @function toJSON
* @memberof CP2P_Voice
* @instance
* @returns {Object.<string,*>} JSON object
*/
CP2P_Voice.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CP2P_Voice
* @function getTypeUrl
* @memberof CP2P_Voice
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CP2P_Voice.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CP2P_Voice";
};
/**
* Handler_Flags enum.
* @name CP2P_Voice.Handler_Flags
* @enum {number}
* @property {number} Played_Audio=1 Played_Audio value
*/
CP2P_Voice.Handler_Flags = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[1] = "Played_Audio"] = 1;
return values;
})();
return CP2P_Voice;
})();
$root.CP2P_Ping = (function() {
/**
* Properties of a CP2P_Ping.
* @exports ICP2P_Ping
* @interface ICP2P_Ping
* @property {number|Long} send_time CP2P_Ping send_time
* @property {boolean} is_reply CP2P_Ping is_reply
*/
/**
* Constructs a new CP2P_Ping.
* @exports CP2P_Ping
* @classdesc Represents a CP2P_Ping.
* @implements ICP2P_Ping
* @constructor
* @param {ICP2P_Ping=} [properties] Properties to set
*/
function CP2P_Ping(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]];
}
/**
* CP2P_Ping send_time.
* @member {number|Long} send_time
* @memberof CP2P_Ping
* @instance
*/
CP2P_Ping.prototype.send_time = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
/**
* CP2P_Ping is_reply.
* @member {boolean} is_reply
* @memberof CP2P_Ping
* @instance
*/
CP2P_Ping.prototype.is_reply = false;
/**
* Creates a new CP2P_Ping instance using the specified properties.
* @function create
* @memberof CP2P_Ping
* @static
* @param {ICP2P_Ping=} [properties] Properties to set
* @returns {CP2P_Ping} CP2P_Ping instance
*/
CP2P_Ping.create = function create(properties) {
return new CP2P_Ping(properties);
};
/**
* Encodes the specified CP2P_Ping message. Does not implicitly {@link CP2P_Ping.verify|verify} messages.
* @function encode
* @memberof CP2P_Ping
* @static
* @param {ICP2P_Ping} message CP2P_Ping message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_Ping.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.send_time);
writer.uint32(/* id 2, wireType 0 =*/16).bool(message.is_reply);
return writer;
};
/**
* Encodes the specified CP2P_Ping message, length delimited. Does not implicitly {@link CP2P_Ping.verify|verify} messages.
* @function encodeDelimited
* @memberof CP2P_Ping
* @static
* @param {ICP2P_Ping} message CP2P_Ping message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_Ping.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CP2P_Ping message from the specified reader or buffer.
* @function decode
* @memberof CP2P_Ping
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CP2P_Ping} CP2P_Ping
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_Ping.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.CP2P_Ping();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.send_time = reader.uint64();
break;
}
case 2: {
message.is_reply = reader.bool();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
if (!message.hasOwnProperty("send_time"))
throw $util.ProtocolError("missing required 'send_time'", { instance: message });
if (!message.hasOwnProperty("is_reply"))
throw $util.ProtocolError("missing required 'is_reply'", { instance: message });
return message;
};
/**
* Decodes a CP2P_Ping message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CP2P_Ping
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CP2P_Ping} CP2P_Ping
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_Ping.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CP2P_Ping message.
* @function verify
* @memberof CP2P_Ping
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CP2P_Ping.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (!$util.isInteger(message.send_time) && !(message.send_time && $util.isInteger(message.send_time.low) && $util.isInteger(message.send_time.high)))
return "send_time: integer|Long expected";
if (typeof message.is_reply !== "boolean")
return "is_reply: boolean expected";
return null;
};
/**
* Creates a CP2P_Ping message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CP2P_Ping
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CP2P_Ping} CP2P_Ping
*/
CP2P_Ping.fromObject = function fromObject(object) {
if (object instanceof $root.CP2P_Ping)
return object;
var message = new $root.CP2P_Ping();
if (object.send_time != null)
if ($util.Long)
(message.send_time = $util.Long.fromValue(object.send_time)).unsigned = true;
else if (typeof object.send_time === "string")
message.send_time = parseInt(object.send_time, 10);
else if (typeof object.send_time === "number")
message.send_time = object.send_time;
else if (typeof object.send_time === "object")
message.send_time = new $util.LongBits(object.send_time.low >>> 0, object.send_time.high >>> 0).toNumber(true);
if (object.is_reply != null)
message.is_reply = Boolean(object.is_reply);
return message;
};
/**
* Creates a plain object from a CP2P_Ping message. Also converts values to other types if specified.
* @function toObject
* @memberof CP2P_Ping
* @static
* @param {CP2P_Ping} message CP2P_Ping
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CP2P_Ping.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.send_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.send_time = options.longs === String ? "0" : 0;
object.is_reply = false;
}
if (message.send_time != null && message.hasOwnProperty("send_time"))
if (typeof message.send_time === "number")
object.send_time = options.longs === String ? String(message.send_time) : message.send_time;
else
object.send_time = options.longs === String ? $util.Long.prototype.toString.call(message.send_time) : options.longs === Number ? new $util.LongBits(message.send_time.low >>> 0, message.send_time.high >>> 0).toNumber(true) : message.send_time;
if (message.is_reply != null && message.hasOwnProperty("is_reply"))
object.is_reply = message.is_reply;
return object;
};
/**
* Converts this CP2P_Ping to JSON.
* @function toJSON
* @memberof CP2P_Ping
* @instance
* @returns {Object.<string,*>} JSON object
*/
CP2P_Ping.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CP2P_Ping
* @function getTypeUrl
* @memberof CP2P_Ping
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CP2P_Ping.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CP2P_Ping";
};
return CP2P_Ping;
})();
$root.CP2P_VRAvatarPosition = (function() {
/**
* Properties of a CP2P_VRAvatarPosition.
* @exports ICP2P_VRAvatarPosition
* @interface ICP2P_VRAvatarPosition
* @property {Array.<CP2P_VRAvatarPosition.ICOrientation>|null} [body_parts] CP2P_VRAvatarPosition body_parts
* @property {number|null} [hat_id] CP2P_VRAvatarPosition hat_id
* @property {number|null} [scene_id] CP2P_VRAvatarPosition scene_id
* @property {number|null} [world_scale] CP2P_VRAvatarPosition world_scale
*/
/**
* Constructs a new CP2P_VRAvatarPosition.
* @exports CP2P_VRAvatarPosition
* @classdesc Represents a CP2P_VRAvatarPosition.
* @implements ICP2P_VRAvatarPosition
* @constructor
* @param {ICP2P_VRAvatarPosition=} [properties] Properties to set
*/
function CP2P_VRAvatarPosition(properties) {
this.body_parts = [];
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]];
}
/**
* CP2P_VRAvatarPosition body_parts.
* @member {Array.<CP2P_VRAvatarPosition.ICOrientation>} body_parts
* @memberof CP2P_VRAvatarPosition
* @instance
*/
CP2P_VRAvatarPosition.prototype.body_parts = $util.emptyArray;
/**
* CP2P_VRAvatarPosition hat_id.
* @member {number} hat_id
* @memberof CP2P_VRAvatarPosition
* @instance
*/
CP2P_VRAvatarPosition.prototype.hat_id = 0;
/**
* CP2P_VRAvatarPosition scene_id.
* @member {number} scene_id
* @memberof CP2P_VRAvatarPosition
* @instance
*/
CP2P_VRAvatarPosition.prototype.scene_id = 0;
/**
* CP2P_VRAvatarPosition world_scale.
* @member {number} world_scale
* @memberof CP2P_VRAvatarPosition
* @instance
*/
CP2P_VRAvatarPosition.prototype.world_scale = 0;
/**
* Creates a new CP2P_VRAvatarPosition instance using the specified properties.
* @function create
* @memberof CP2P_VRAvatarPosition
* @static
* @param {ICP2P_VRAvatarPosition=} [properties] Properties to set
* @returns {CP2P_VRAvatarPosition} CP2P_VRAvatarPosition instance
*/
CP2P_VRAvatarPosition.create = function create(properties) {
return new CP2P_VRAvatarPosition(properties);
};
/**
* Encodes the specified CP2P_VRAvatarPosition message. Does not implicitly {@link CP2P_VRAvatarPosition.verify|verify} messages.
* @function encode
* @memberof CP2P_VRAvatarPosition
* @static
* @param {ICP2P_VRAvatarPosition} message CP2P_VRAvatarPosition message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_VRAvatarPosition.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.body_parts != null && message.body_parts.length)
for (var i = 0; i < message.body_parts.length; ++i)
$root.CP2P_VRAvatarPosition.COrientation.encode(message.body_parts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.hat_id != null && Object.hasOwnProperty.call(message, "hat_id"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.hat_id);
if (message.scene_id != null && Object.hasOwnProperty.call(message, "scene_id"))
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.scene_id);
if (message.world_scale != null && Object.hasOwnProperty.call(message, "world_scale"))
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.world_scale);
return writer;
};
/**
* Encodes the specified CP2P_VRAvatarPosition message, length delimited. Does not implicitly {@link CP2P_VRAvatarPosition.verify|verify} messages.
* @function encodeDelimited
* @memberof CP2P_VRAvatarPosition
* @static
* @param {ICP2P_VRAvatarPosition} message CP2P_VRAvatarPosition message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CP2P_VRAvatarPosition.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CP2P_VRAvatarPosition message from the specified reader or buffer.
* @function decode
* @memberof CP2P_VRAvatarPosition
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CP2P_VRAvatarPosition} CP2P_VRAvatarPosition
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_VRAvatarPosition.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.CP2P_VRAvatarPosition();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
if (!(message.body_parts && message.body_parts.length))
message.body_parts = [];
message.body_parts.push($root.CP2P_VRAvatarPosition.COrientation.decode(reader, reader.uint32()));
break;
}
case 2: {
message.hat_id = reader.int32();
break;
}
case 3: {
message.scene_id = reader.int32();
break;
}
case 4: {
message.world_scale = reader.int32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CP2P_VRAvatarPosition message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CP2P_VRAvatarPosition
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CP2P_VRAvatarPosition} CP2P_VRAvatarPosition
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CP2P_VRAvatarPosition.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CP2P_VRAvatarPosition message.
* @function verify
* @memberof CP2P_VRAvatarPosition
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CP2P_VRAvatarPosition.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.body_parts != null && message.hasOwnProperty("body_parts")) {
if (!Array.isArray(message.body_parts))
return "body_parts: array expected";
for (var i = 0; i < message.body_parts.length; ++i) {
var error = $root.CP2P_VRAvatarPosition.COrientation.verify(message.body_parts[i]);
if (error)
return "body_parts." + error;
}
}
if (message.hat_id != null && message.hasOwnProperty("hat_id"))
if (!$util.isInteger(message.hat_id))
return "hat_id: integer expected";
if (message.scene_id != null && message.hasOwnProperty("scene_id"))
if (!$util.isInteger(message.scene_id))
return "scene_id: integer expected";
if (message.world_scale != null && message.hasOwnProperty("world_scale"))
if (!$util.isInteger(message.world_scale))
return "world_scale: integer expected";
return null;
};
/**
* Creates a CP2P_VRAvatarPosition message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CP2P_VRAvatarPosition
* @static
* @param {Object.<string,*>} object Plain object