@openskindb/cs2-gc
Version:
Exposes a simple API for interacting with the Counter-Strike: Global Offensive/CS2 game coordinator
1,212 lines (1,127 loc) • 753 kB
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"] = {});
/**
* SignonState_t enum.
* @exports SignonState_t
* @enum {number}
* @property {number} SIGNONSTATE_NONE=0 SIGNONSTATE_NONE value
* @property {number} SIGNONSTATE_CHALLENGE=1 SIGNONSTATE_CHALLENGE value
* @property {number} SIGNONSTATE_CONNECTED=2 SIGNONSTATE_CONNECTED value
* @property {number} SIGNONSTATE_NEW=3 SIGNONSTATE_NEW value
* @property {number} SIGNONSTATE_PRESPAWN=4 SIGNONSTATE_PRESPAWN value
* @property {number} SIGNONSTATE_SPAWN=5 SIGNONSTATE_SPAWN value
* @property {number} SIGNONSTATE_FULL=6 SIGNONSTATE_FULL value
* @property {number} SIGNONSTATE_CHANGELEVEL=7 SIGNONSTATE_CHANGELEVEL value
*/
$root.SignonState_t = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "SIGNONSTATE_NONE"] = 0;
values[valuesById[1] = "SIGNONSTATE_CHALLENGE"] = 1;
values[valuesById[2] = "SIGNONSTATE_CONNECTED"] = 2;
values[valuesById[3] = "SIGNONSTATE_NEW"] = 3;
values[valuesById[4] = "SIGNONSTATE_PRESPAWN"] = 4;
values[valuesById[5] = "SIGNONSTATE_SPAWN"] = 5;
values[valuesById[6] = "SIGNONSTATE_FULL"] = 6;
values[valuesById[7] = "SIGNONSTATE_CHANGELEVEL"] = 7;
return values;
})();
/**
* NET_Messages enum.
* @exports NET_Messages
* @enum {number}
* @property {number} net_NOP=0 net_NOP value
* @property {number} net_Disconnect_Legacy=1 net_Disconnect_Legacy value
* @property {number} net_SplitScreenUser=3 net_SplitScreenUser value
* @property {number} net_Tick=4 net_Tick value
* @property {number} net_StringCmd=5 net_StringCmd value
* @property {number} net_SetConVar=6 net_SetConVar value
* @property {number} net_SignonState=7 net_SignonState value
* @property {number} net_SpawnGroup_Load=8 net_SpawnGroup_Load value
* @property {number} net_SpawnGroup_ManifestUpdate=9 net_SpawnGroup_ManifestUpdate value
* @property {number} net_SpawnGroup_SetCreationTick=11 net_SpawnGroup_SetCreationTick value
* @property {number} net_SpawnGroup_Unload=12 net_SpawnGroup_Unload value
* @property {number} net_SpawnGroup_LoadCompleted=13 net_SpawnGroup_LoadCompleted value
* @property {number} net_DebugOverlay=15 net_DebugOverlay value
*/
$root.NET_Messages = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "net_NOP"] = 0;
values[valuesById[1] = "net_Disconnect_Legacy"] = 1;
values[valuesById[3] = "net_SplitScreenUser"] = 3;
values[valuesById[4] = "net_Tick"] = 4;
values[valuesById[5] = "net_StringCmd"] = 5;
values[valuesById[6] = "net_SetConVar"] = 6;
values[valuesById[7] = "net_SignonState"] = 7;
values[valuesById[8] = "net_SpawnGroup_Load"] = 8;
values[valuesById[9] = "net_SpawnGroup_ManifestUpdate"] = 9;
values[valuesById[11] = "net_SpawnGroup_SetCreationTick"] = 11;
values[valuesById[12] = "net_SpawnGroup_Unload"] = 12;
values[valuesById[13] = "net_SpawnGroup_LoadCompleted"] = 13;
values[valuesById[15] = "net_DebugOverlay"] = 15;
return values;
})();
/**
* SpawnGroupFlags_t enum.
* @exports SpawnGroupFlags_t
* @enum {number}
* @property {number} SPAWN_GROUP_LOAD_ENTITIES_FROM_SAVE=1 SPAWN_GROUP_LOAD_ENTITIES_FROM_SAVE value
* @property {number} SPAWN_GROUP_DONT_SPAWN_ENTITIES=2 SPAWN_GROUP_DONT_SPAWN_ENTITIES value
* @property {number} SPAWN_GROUP_SYNCHRONOUS_SPAWN=4 SPAWN_GROUP_SYNCHRONOUS_SPAWN value
* @property {number} SPAWN_GROUP_IS_INITIAL_SPAWN_GROUP=8 SPAWN_GROUP_IS_INITIAL_SPAWN_GROUP value
* @property {number} SPAWN_GROUP_CREATE_CLIENT_ONLY_ENTITIES=16 SPAWN_GROUP_CREATE_CLIENT_ONLY_ENTITIES value
* @property {number} SPAWN_GROUP_BLOCK_UNTIL_LOADED=64 SPAWN_GROUP_BLOCK_UNTIL_LOADED value
* @property {number} SPAWN_GROUP_LOAD_STREAMING_DATA=128 SPAWN_GROUP_LOAD_STREAMING_DATA value
* @property {number} SPAWN_GROUP_CREATE_NEW_SCENE_WORLD=256 SPAWN_GROUP_CREATE_NEW_SCENE_WORLD value
*/
$root.SpawnGroupFlags_t = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[1] = "SPAWN_GROUP_LOAD_ENTITIES_FROM_SAVE"] = 1;
values[valuesById[2] = "SPAWN_GROUP_DONT_SPAWN_ENTITIES"] = 2;
values[valuesById[4] = "SPAWN_GROUP_SYNCHRONOUS_SPAWN"] = 4;
values[valuesById[8] = "SPAWN_GROUP_IS_INITIAL_SPAWN_GROUP"] = 8;
values[valuesById[16] = "SPAWN_GROUP_CREATE_CLIENT_ONLY_ENTITIES"] = 16;
values[valuesById[64] = "SPAWN_GROUP_BLOCK_UNTIL_LOADED"] = 64;
values[valuesById[128] = "SPAWN_GROUP_LOAD_STREAMING_DATA"] = 128;
values[valuesById[256] = "SPAWN_GROUP_CREATE_NEW_SCENE_WORLD"] = 256;
return values;
})();
$root.CMsgVector = (function() {
/**
* Properties of a CMsgVector.
* @exports ICMsgVector
* @interface ICMsgVector
* @property {number|null} [x] CMsgVector x
* @property {number|null} [y] CMsgVector y
* @property {number|null} [z] CMsgVector z
* @property {number|null} [w] CMsgVector w
*/
/**
* Constructs a new CMsgVector.
* @exports CMsgVector
* @classdesc Represents a CMsgVector.
* @implements ICMsgVector
* @constructor
* @param {ICMsgVector=} [properties] Properties to set
*/
function CMsgVector(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]];
}
/**
* CMsgVector x.
* @member {number} x
* @memberof CMsgVector
* @instance
*/
CMsgVector.prototype.x = 0;
/**
* CMsgVector y.
* @member {number} y
* @memberof CMsgVector
* @instance
*/
CMsgVector.prototype.y = 0;
/**
* CMsgVector z.
* @member {number} z
* @memberof CMsgVector
* @instance
*/
CMsgVector.prototype.z = 0;
/**
* CMsgVector w.
* @member {number} w
* @memberof CMsgVector
* @instance
*/
CMsgVector.prototype.w = 0;
/**
* Creates a new CMsgVector instance using the specified properties.
* @function create
* @memberof CMsgVector
* @static
* @param {ICMsgVector=} [properties] Properties to set
* @returns {CMsgVector} CMsgVector instance
*/
CMsgVector.create = function create(properties) {
return new CMsgVector(properties);
};
/**
* Encodes the specified CMsgVector message. Does not implicitly {@link CMsgVector.verify|verify} messages.
* @function encode
* @memberof CMsgVector
* @static
* @param {ICMsgVector} message CMsgVector message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgVector.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.x != null && Object.hasOwnProperty.call(message, "x"))
writer.uint32(/* id 1, wireType 5 =*/13).float(message.x);
if (message.y != null && Object.hasOwnProperty.call(message, "y"))
writer.uint32(/* id 2, wireType 5 =*/21).float(message.y);
if (message.z != null && Object.hasOwnProperty.call(message, "z"))
writer.uint32(/* id 3, wireType 5 =*/29).float(message.z);
if (message.w != null && Object.hasOwnProperty.call(message, "w"))
writer.uint32(/* id 4, wireType 5 =*/37).float(message.w);
return writer;
};
/**
* Encodes the specified CMsgVector message, length delimited. Does not implicitly {@link CMsgVector.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgVector
* @static
* @param {ICMsgVector} message CMsgVector message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgVector.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgVector message from the specified reader or buffer.
* @function decode
* @memberof CMsgVector
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgVector} CMsgVector
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgVector.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.CMsgVector();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.x = reader.float();
break;
}
case 2: {
message.y = reader.float();
break;
}
case 3: {
message.z = reader.float();
break;
}
case 4: {
message.w = reader.float();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgVector message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgVector
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgVector} CMsgVector
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgVector.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgVector message.
* @function verify
* @memberof CMsgVector
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgVector.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.x != null && message.hasOwnProperty("x"))
if (typeof message.x !== "number")
return "x: number expected";
if (message.y != null && message.hasOwnProperty("y"))
if (typeof message.y !== "number")
return "y: number expected";
if (message.z != null && message.hasOwnProperty("z"))
if (typeof message.z !== "number")
return "z: number expected";
if (message.w != null && message.hasOwnProperty("w"))
if (typeof message.w !== "number")
return "w: number expected";
return null;
};
/**
* Creates a CMsgVector message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgVector
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgVector} CMsgVector
*/
CMsgVector.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgVector)
return object;
var message = new $root.CMsgVector();
if (object.x != null)
message.x = Number(object.x);
if (object.y != null)
message.y = Number(object.y);
if (object.z != null)
message.z = Number(object.z);
if (object.w != null)
message.w = Number(object.w);
return message;
};
/**
* Creates a plain object from a CMsgVector message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgVector
* @static
* @param {CMsgVector} message CMsgVector
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgVector.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.x = 0;
object.y = 0;
object.z = 0;
object.w = 0;
}
if (message.x != null && message.hasOwnProperty("x"))
object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x;
if (message.y != null && message.hasOwnProperty("y"))
object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y;
if (message.z != null && message.hasOwnProperty("z"))
object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z;
if (message.w != null && message.hasOwnProperty("w"))
object.w = options.json && !isFinite(message.w) ? String(message.w) : message.w;
return object;
};
/**
* Converts this CMsgVector to JSON.
* @function toJSON
* @memberof CMsgVector
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgVector.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgVector
* @function getTypeUrl
* @memberof CMsgVector
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgVector.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgVector";
};
return CMsgVector;
})();
$root.CMsgVector2D = (function() {
/**
* Properties of a CMsgVector2D.
* @exports ICMsgVector2D
* @interface ICMsgVector2D
* @property {number|null} [x] CMsgVector2D x
* @property {number|null} [y] CMsgVector2D y
*/
/**
* Constructs a new CMsgVector2D.
* @exports CMsgVector2D
* @classdesc Represents a CMsgVector2D.
* @implements ICMsgVector2D
* @constructor
* @param {ICMsgVector2D=} [properties] Properties to set
*/
function CMsgVector2D(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]];
}
/**
* CMsgVector2D x.
* @member {number} x
* @memberof CMsgVector2D
* @instance
*/
CMsgVector2D.prototype.x = 0;
/**
* CMsgVector2D y.
* @member {number} y
* @memberof CMsgVector2D
* @instance
*/
CMsgVector2D.prototype.y = 0;
/**
* Creates a new CMsgVector2D instance using the specified properties.
* @function create
* @memberof CMsgVector2D
* @static
* @param {ICMsgVector2D=} [properties] Properties to set
* @returns {CMsgVector2D} CMsgVector2D instance
*/
CMsgVector2D.create = function create(properties) {
return new CMsgVector2D(properties);
};
/**
* Encodes the specified CMsgVector2D message. Does not implicitly {@link CMsgVector2D.verify|verify} messages.
* @function encode
* @memberof CMsgVector2D
* @static
* @param {ICMsgVector2D} message CMsgVector2D message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgVector2D.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.x != null && Object.hasOwnProperty.call(message, "x"))
writer.uint32(/* id 1, wireType 5 =*/13).float(message.x);
if (message.y != null && Object.hasOwnProperty.call(message, "y"))
writer.uint32(/* id 2, wireType 5 =*/21).float(message.y);
return writer;
};
/**
* Encodes the specified CMsgVector2D message, length delimited. Does not implicitly {@link CMsgVector2D.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgVector2D
* @static
* @param {ICMsgVector2D} message CMsgVector2D message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgVector2D.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgVector2D message from the specified reader or buffer.
* @function decode
* @memberof CMsgVector2D
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgVector2D} CMsgVector2D
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgVector2D.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.CMsgVector2D();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.x = reader.float();
break;
}
case 2: {
message.y = reader.float();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgVector2D message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgVector2D
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgVector2D} CMsgVector2D
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgVector2D.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgVector2D message.
* @function verify
* @memberof CMsgVector2D
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgVector2D.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.x != null && message.hasOwnProperty("x"))
if (typeof message.x !== "number")
return "x: number expected";
if (message.y != null && message.hasOwnProperty("y"))
if (typeof message.y !== "number")
return "y: number expected";
return null;
};
/**
* Creates a CMsgVector2D message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgVector2D
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgVector2D} CMsgVector2D
*/
CMsgVector2D.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgVector2D)
return object;
var message = new $root.CMsgVector2D();
if (object.x != null)
message.x = Number(object.x);
if (object.y != null)
message.y = Number(object.y);
return message;
};
/**
* Creates a plain object from a CMsgVector2D message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgVector2D
* @static
* @param {CMsgVector2D} message CMsgVector2D
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgVector2D.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.x = 0;
object.y = 0;
}
if (message.x != null && message.hasOwnProperty("x"))
object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x;
if (message.y != null && message.hasOwnProperty("y"))
object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y;
return object;
};
/**
* Converts this CMsgVector2D to JSON.
* @function toJSON
* @memberof CMsgVector2D
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgVector2D.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgVector2D
* @function getTypeUrl
* @memberof CMsgVector2D
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgVector2D.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgVector2D";
};
return CMsgVector2D;
})();
$root.CMsgQAngle = (function() {
/**
* Properties of a CMsgQAngle.
* @exports ICMsgQAngle
* @interface ICMsgQAngle
* @property {number|null} [x] CMsgQAngle x
* @property {number|null} [y] CMsgQAngle y
* @property {number|null} [z] CMsgQAngle z
*/
/**
* Constructs a new CMsgQAngle.
* @exports CMsgQAngle
* @classdesc Represents a CMsgQAngle.
* @implements ICMsgQAngle
* @constructor
* @param {ICMsgQAngle=} [properties] Properties to set
*/
function CMsgQAngle(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]];
}
/**
* CMsgQAngle x.
* @member {number} x
* @memberof CMsgQAngle
* @instance
*/
CMsgQAngle.prototype.x = 0;
/**
* CMsgQAngle y.
* @member {number} y
* @memberof CMsgQAngle
* @instance
*/
CMsgQAngle.prototype.y = 0;
/**
* CMsgQAngle z.
* @member {number} z
* @memberof CMsgQAngle
* @instance
*/
CMsgQAngle.prototype.z = 0;
/**
* Creates a new CMsgQAngle instance using the specified properties.
* @function create
* @memberof CMsgQAngle
* @static
* @param {ICMsgQAngle=} [properties] Properties to set
* @returns {CMsgQAngle} CMsgQAngle instance
*/
CMsgQAngle.create = function create(properties) {
return new CMsgQAngle(properties);
};
/**
* Encodes the specified CMsgQAngle message. Does not implicitly {@link CMsgQAngle.verify|verify} messages.
* @function encode
* @memberof CMsgQAngle
* @static
* @param {ICMsgQAngle} message CMsgQAngle message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgQAngle.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.x != null && Object.hasOwnProperty.call(message, "x"))
writer.uint32(/* id 1, wireType 5 =*/13).float(message.x);
if (message.y != null && Object.hasOwnProperty.call(message, "y"))
writer.uint32(/* id 2, wireType 5 =*/21).float(message.y);
if (message.z != null && Object.hasOwnProperty.call(message, "z"))
writer.uint32(/* id 3, wireType 5 =*/29).float(message.z);
return writer;
};
/**
* Encodes the specified CMsgQAngle message, length delimited. Does not implicitly {@link CMsgQAngle.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgQAngle
* @static
* @param {ICMsgQAngle} message CMsgQAngle message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgQAngle.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgQAngle message from the specified reader or buffer.
* @function decode
* @memberof CMsgQAngle
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgQAngle} CMsgQAngle
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgQAngle.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.CMsgQAngle();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.x = reader.float();
break;
}
case 2: {
message.y = reader.float();
break;
}
case 3: {
message.z = reader.float();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgQAngle message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgQAngle
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgQAngle} CMsgQAngle
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgQAngle.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgQAngle message.
* @function verify
* @memberof CMsgQAngle
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgQAngle.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.x != null && message.hasOwnProperty("x"))
if (typeof message.x !== "number")
return "x: number expected";
if (message.y != null && message.hasOwnProperty("y"))
if (typeof message.y !== "number")
return "y: number expected";
if (message.z != null && message.hasOwnProperty("z"))
if (typeof message.z !== "number")
return "z: number expected";
return null;
};
/**
* Creates a CMsgQAngle message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgQAngle
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgQAngle} CMsgQAngle
*/
CMsgQAngle.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgQAngle)
return object;
var message = new $root.CMsgQAngle();
if (object.x != null)
message.x = Number(object.x);
if (object.y != null)
message.y = Number(object.y);
if (object.z != null)
message.z = Number(object.z);
return message;
};
/**
* Creates a plain object from a CMsgQAngle message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgQAngle
* @static
* @param {CMsgQAngle} message CMsgQAngle
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgQAngle.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.x = 0;
object.y = 0;
object.z = 0;
}
if (message.x != null && message.hasOwnProperty("x"))
object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x;
if (message.y != null && message.hasOwnProperty("y"))
object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y;
if (message.z != null && message.hasOwnProperty("z"))
object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z;
return object;
};
/**
* Converts this CMsgQAngle to JSON.
* @function toJSON
* @memberof CMsgQAngle
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgQAngle.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgQAngle
* @function getTypeUrl
* @memberof CMsgQAngle
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgQAngle.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgQAngle";
};
return CMsgQAngle;
})();
$root.CMsgQuaternion = (function() {
/**
* Properties of a CMsgQuaternion.
* @exports ICMsgQuaternion
* @interface ICMsgQuaternion
* @property {number|null} [x] CMsgQuaternion x
* @property {number|null} [y] CMsgQuaternion y
* @property {number|null} [z] CMsgQuaternion z
* @property {number|null} [w] CMsgQuaternion w
*/
/**
* Constructs a new CMsgQuaternion.
* @exports CMsgQuaternion
* @classdesc Represents a CMsgQuaternion.
* @implements ICMsgQuaternion
* @constructor
* @param {ICMsgQuaternion=} [properties] Properties to set
*/
function CMsgQuaternion(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]];
}
/**
* CMsgQuaternion x.
* @member {number} x
* @memberof CMsgQuaternion
* @instance
*/
CMsgQuaternion.prototype.x = 0;
/**
* CMsgQuaternion y.
* @member {number} y
* @memberof CMsgQuaternion
* @instance
*/
CMsgQuaternion.prototype.y = 0;
/**
* CMsgQuaternion z.
* @member {number} z
* @memberof CMsgQuaternion
* @instance
*/
CMsgQuaternion.prototype.z = 0;
/**
* CMsgQuaternion w.
* @member {number} w
* @memberof CMsgQuaternion
* @instance
*/
CMsgQuaternion.prototype.w = 0;
/**
* Creates a new CMsgQuaternion instance using the specified properties.
* @function create
* @memberof CMsgQuaternion
* @static
* @param {ICMsgQuaternion=} [properties] Properties to set
* @returns {CMsgQuaternion} CMsgQuaternion instance
*/
CMsgQuaternion.create = function create(properties) {
return new CMsgQuaternion(properties);
};
/**
* Encodes the specified CMsgQuaternion message. Does not implicitly {@link CMsgQuaternion.verify|verify} messages.
* @function encode
* @memberof CMsgQuaternion
* @static
* @param {ICMsgQuaternion} message CMsgQuaternion message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgQuaternion.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.x != null && Object.hasOwnProperty.call(message, "x"))
writer.uint32(/* id 1, wireType 5 =*/13).float(message.x);
if (message.y != null && Object.hasOwnProperty.call(message, "y"))
writer.uint32(/* id 2, wireType 5 =*/21).float(message.y);
if (message.z != null && Object.hasOwnProperty.call(message, "z"))
writer.uint32(/* id 3, wireType 5 =*/29).float(message.z);
if (message.w != null && Object.hasOwnProperty.call(message, "w"))
writer.uint32(/* id 4, wireType 5 =*/37).float(message.w);
return writer;
};
/**
* Encodes the specified CMsgQuaternion message, length delimited. Does not implicitly {@link CMsgQuaternion.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgQuaternion
* @static
* @param {ICMsgQuaternion} message CMsgQuaternion message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgQuaternion.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgQuaternion message from the specified reader or buffer.
* @function decode
* @memberof CMsgQuaternion
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgQuaternion} CMsgQuaternion
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgQuaternion.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.CMsgQuaternion();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.x = reader.float();
break;
}
case 2: {
message.y = reader.float();
break;
}
case 3: {
message.z = reader.float();
break;
}
case 4: {
message.w = reader.float();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgQuaternion message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgQuaternion
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgQuaternion} CMsgQuaternion
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgQuaternion.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgQuaternion message.
* @function verify
* @memberof CMsgQuaternion
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgQuaternion.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.x != null && message.hasOwnProperty("x"))
if (typeof message.x !== "number")
return "x: number expected";
if (message.y != null && message.hasOwnProperty("y"))
if (typeof message.y !== "number")
return "y: number expected";
if (message.z != null && message.hasOwnProperty("z"))
if (typeof message.z !== "number")
return "z: number expected";
if (message.w != null && message.hasOwnProperty("w"))
if (typeof message.w !== "number")
return "w: number expected";
return null;
};
/**
* Creates a CMsgQuaternion message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgQuaternion
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgQuaternion} CMsgQuaternion
*/
CMsgQuaternion.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgQuaternion)
return object;
var message = new $root.CMsgQuaternion();
if (object.x != null)
message.x = Number(object.x);
if (object.y != null)
message.y = Number(object.y);
if (object.z != null)
message.z = Number(object.z);
if (object.w != null)
message.w = Number(object.w);
return message;
};
/**
* Creates a plain object from a CMsgQuaternion message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgQuaternion
* @static
* @param {CMsgQuaternion} message CMsgQuaternion
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgQuaternion.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.x = 0;
object.y = 0;
object.z = 0;
object.w = 0;
}
if (message.x != null && message.hasOwnProperty("x"))
object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x;
if (message.y != null && message.hasOwnProperty("y"))
object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y;
if (message.z != null && message.hasOwnProperty("z"))
object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z;
if (message.w != null && message.hasOwnProperty("w"))
object.w = options.json && !isFinite(message.w) ? String(message.w) : message.w;
return object;
};
/**
* Converts this CMsgQuaternion to JSON.
* @function toJSON
* @memberof CMsgQuaternion
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgQuaternion.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgQuaternion
* @function getTypeUrl
* @memberof CMsgQuaternion
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgQuaternion.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgQuaternion";
};
return CMsgQuaternion;
})();
$root.CMsgTransform = (function() {
/**
* Properties of a CMsgTransform.
* @exports ICMsgTransform
* @interface ICMsgTransform
* @property {ICMsgVector|null} [position] CMsgTransform position
* @property {number|null} [scale] CMsgTransform scale
* @property {ICMsgQuaternion|null} [orientation] CMsgTransform orientation
*/
/**
* Constructs a new CMsgTransform.
* @exports CMsgTransform
* @classdesc Represents a CMsgTransform.
* @implements ICMsgTransform
* @constructor
* @param {ICMsgTransform=} [properties] Properties to set
*/
function CMsgTransform(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]];
}
/**
* CMsgTransform position.
* @member {ICMsgVector|null|undefined} position
* @memberof CMsgTransform
* @instance
*/
CMsgTransform.prototype.position = null;
/**
* CMsgTransform scale.
* @member {number} scale
* @memberof CMsgTransform
* @instance
*/
CMsgTransform.prototype.scale = 0;
/**
* CMsgTransform orientation.
* @member {ICMsgQuaternion|null|undefined} orientation
* @memberof CMsgTransform
* @instance
*/
CMsgTransform.prototype.orientation = null;
/**
* Creates a new CMsgTransform instance using the specified properties.
* @function create
* @memberof CMsgTransform
* @static
* @param {ICMsgTransform=} [properties] Properties to set
* @returns {CMsgTransform} CMsgTransform instance
*/
CMsgTransform.create = function create(properties) {
return new CMsgTransform(properties);
};
/**
* Encodes the specified CMsgTransform message. Does not implicitly {@link CMsgTransform.verify|verify} messages.
* @function encode
* @memberof CMsgTransform
* @static
* @param {ICMsgTransform} message CMsgTransform message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgTransform.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.position != nu