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,016 lines (953 loc) • 881 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"] = {});
$root.CSGOInterpolationInfoPB = (function() {
/**
* Properties of a CSGOInterpolationInfoPB.
* @exports ICSGOInterpolationInfoPB
* @interface ICSGOInterpolationInfoPB
* @property {number|null} [src_tick] CSGOInterpolationInfoPB src_tick
* @property {number|null} [dst_tick] CSGOInterpolationInfoPB dst_tick
* @property {number|null} [frac] CSGOInterpolationInfoPB frac
*/
/**
* Constructs a new CSGOInterpolationInfoPB.
* @exports CSGOInterpolationInfoPB
* @classdesc Represents a CSGOInterpolationInfoPB.
* @implements ICSGOInterpolationInfoPB
* @constructor
* @param {ICSGOInterpolationInfoPB=} [properties] Properties to set
*/
function CSGOInterpolationInfoPB(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]];
}
/**
* CSGOInterpolationInfoPB src_tick.
* @member {number} src_tick
* @memberof CSGOInterpolationInfoPB
* @instance
*/
CSGOInterpolationInfoPB.prototype.src_tick = -1;
/**
* CSGOInterpolationInfoPB dst_tick.
* @member {number} dst_tick
* @memberof CSGOInterpolationInfoPB
* @instance
*/
CSGOInterpolationInfoPB.prototype.dst_tick = -1;
/**
* CSGOInterpolationInfoPB frac.
* @member {number} frac
* @memberof CSGOInterpolationInfoPB
* @instance
*/
CSGOInterpolationInfoPB.prototype.frac = 0;
/**
* Creates a new CSGOInterpolationInfoPB instance using the specified properties.
* @function create
* @memberof CSGOInterpolationInfoPB
* @static
* @param {ICSGOInterpolationInfoPB=} [properties] Properties to set
* @returns {CSGOInterpolationInfoPB} CSGOInterpolationInfoPB instance
*/
CSGOInterpolationInfoPB.create = function create(properties) {
return new CSGOInterpolationInfoPB(properties);
};
/**
* Encodes the specified CSGOInterpolationInfoPB message. Does not implicitly {@link CSGOInterpolationInfoPB.verify|verify} messages.
* @function encode
* @memberof CSGOInterpolationInfoPB
* @static
* @param {ICSGOInterpolationInfoPB} message CSGOInterpolationInfoPB message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGOInterpolationInfoPB.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.src_tick != null && Object.hasOwnProperty.call(message, "src_tick"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.src_tick);
if (message.dst_tick != null && Object.hasOwnProperty.call(message, "dst_tick"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.dst_tick);
if (message.frac != null && Object.hasOwnProperty.call(message, "frac"))
writer.uint32(/* id 3, wireType 5 =*/29).float(message.frac);
return writer;
};
/**
* Encodes the specified CSGOInterpolationInfoPB message, length delimited. Does not implicitly {@link CSGOInterpolationInfoPB.verify|verify} messages.
* @function encodeDelimited
* @memberof CSGOInterpolationInfoPB
* @static
* @param {ICSGOInterpolationInfoPB} message CSGOInterpolationInfoPB message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGOInterpolationInfoPB.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CSGOInterpolationInfoPB message from the specified reader or buffer.
* @function decode
* @memberof CSGOInterpolationInfoPB
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CSGOInterpolationInfoPB} CSGOInterpolationInfoPB
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGOInterpolationInfoPB.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.CSGOInterpolationInfoPB();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.src_tick = reader.int32();
break;
}
case 2: {
message.dst_tick = reader.int32();
break;
}
case 3: {
message.frac = reader.float();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CSGOInterpolationInfoPB message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CSGOInterpolationInfoPB
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CSGOInterpolationInfoPB} CSGOInterpolationInfoPB
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGOInterpolationInfoPB.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CSGOInterpolationInfoPB message.
* @function verify
* @memberof CSGOInterpolationInfoPB
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CSGOInterpolationInfoPB.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.src_tick != null && message.hasOwnProperty("src_tick"))
if (!$util.isInteger(message.src_tick))
return "src_tick: integer expected";
if (message.dst_tick != null && message.hasOwnProperty("dst_tick"))
if (!$util.isInteger(message.dst_tick))
return "dst_tick: integer expected";
if (message.frac != null && message.hasOwnProperty("frac"))
if (typeof message.frac !== "number")
return "frac: number expected";
return null;
};
/**
* Creates a CSGOInterpolationInfoPB message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CSGOInterpolationInfoPB
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CSGOInterpolationInfoPB} CSGOInterpolationInfoPB
*/
CSGOInterpolationInfoPB.fromObject = function fromObject(object) {
if (object instanceof $root.CSGOInterpolationInfoPB)
return object;
var message = new $root.CSGOInterpolationInfoPB();
if (object.src_tick != null)
message.src_tick = object.src_tick | 0;
if (object.dst_tick != null)
message.dst_tick = object.dst_tick | 0;
if (object.frac != null)
message.frac = Number(object.frac);
return message;
};
/**
* Creates a plain object from a CSGOInterpolationInfoPB message. Also converts values to other types if specified.
* @function toObject
* @memberof CSGOInterpolationInfoPB
* @static
* @param {CSGOInterpolationInfoPB} message CSGOInterpolationInfoPB
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CSGOInterpolationInfoPB.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.src_tick = -1;
object.dst_tick = -1;
object.frac = 0;
}
if (message.src_tick != null && message.hasOwnProperty("src_tick"))
object.src_tick = message.src_tick;
if (message.dst_tick != null && message.hasOwnProperty("dst_tick"))
object.dst_tick = message.dst_tick;
if (message.frac != null && message.hasOwnProperty("frac"))
object.frac = options.json && !isFinite(message.frac) ? String(message.frac) : message.frac;
return object;
};
/**
* Converts this CSGOInterpolationInfoPB to JSON.
* @function toJSON
* @memberof CSGOInterpolationInfoPB
* @instance
* @returns {Object.<string,*>} JSON object
*/
CSGOInterpolationInfoPB.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CSGOInterpolationInfoPB
* @function getTypeUrl
* @memberof CSGOInterpolationInfoPB
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CSGOInterpolationInfoPB.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CSGOInterpolationInfoPB";
};
return CSGOInterpolationInfoPB;
})();
$root.CSGOInterpolationInfoPB_CL = (function() {
/**
* Properties of a CSGOInterpolationInfoPB_CL.
* @exports ICSGOInterpolationInfoPB_CL
* @interface ICSGOInterpolationInfoPB_CL
* @property {number|null} [frac] CSGOInterpolationInfoPB_CL frac
*/
/**
* Constructs a new CSGOInterpolationInfoPB_CL.
* @exports CSGOInterpolationInfoPB_CL
* @classdesc Represents a CSGOInterpolationInfoPB_CL.
* @implements ICSGOInterpolationInfoPB_CL
* @constructor
* @param {ICSGOInterpolationInfoPB_CL=} [properties] Properties to set
*/
function CSGOInterpolationInfoPB_CL(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]];
}
/**
* CSGOInterpolationInfoPB_CL frac.
* @member {number} frac
* @memberof CSGOInterpolationInfoPB_CL
* @instance
*/
CSGOInterpolationInfoPB_CL.prototype.frac = 0;
/**
* Creates a new CSGOInterpolationInfoPB_CL instance using the specified properties.
* @function create
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {ICSGOInterpolationInfoPB_CL=} [properties] Properties to set
* @returns {CSGOInterpolationInfoPB_CL} CSGOInterpolationInfoPB_CL instance
*/
CSGOInterpolationInfoPB_CL.create = function create(properties) {
return new CSGOInterpolationInfoPB_CL(properties);
};
/**
* Encodes the specified CSGOInterpolationInfoPB_CL message. Does not implicitly {@link CSGOInterpolationInfoPB_CL.verify|verify} messages.
* @function encode
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {ICSGOInterpolationInfoPB_CL} message CSGOInterpolationInfoPB_CL message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGOInterpolationInfoPB_CL.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.frac != null && Object.hasOwnProperty.call(message, "frac"))
writer.uint32(/* id 3, wireType 5 =*/29).float(message.frac);
return writer;
};
/**
* Encodes the specified CSGOInterpolationInfoPB_CL message, length delimited. Does not implicitly {@link CSGOInterpolationInfoPB_CL.verify|verify} messages.
* @function encodeDelimited
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {ICSGOInterpolationInfoPB_CL} message CSGOInterpolationInfoPB_CL message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGOInterpolationInfoPB_CL.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CSGOInterpolationInfoPB_CL message from the specified reader or buffer.
* @function decode
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CSGOInterpolationInfoPB_CL} CSGOInterpolationInfoPB_CL
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGOInterpolationInfoPB_CL.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.CSGOInterpolationInfoPB_CL();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 3: {
message.frac = reader.float();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CSGOInterpolationInfoPB_CL message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CSGOInterpolationInfoPB_CL} CSGOInterpolationInfoPB_CL
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGOInterpolationInfoPB_CL.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CSGOInterpolationInfoPB_CL message.
* @function verify
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CSGOInterpolationInfoPB_CL.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.frac != null && message.hasOwnProperty("frac"))
if (typeof message.frac !== "number")
return "frac: number expected";
return null;
};
/**
* Creates a CSGOInterpolationInfoPB_CL message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CSGOInterpolationInfoPB_CL} CSGOInterpolationInfoPB_CL
*/
CSGOInterpolationInfoPB_CL.fromObject = function fromObject(object) {
if (object instanceof $root.CSGOInterpolationInfoPB_CL)
return object;
var message = new $root.CSGOInterpolationInfoPB_CL();
if (object.frac != null)
message.frac = Number(object.frac);
return message;
};
/**
* Creates a plain object from a CSGOInterpolationInfoPB_CL message. Also converts values to other types if specified.
* @function toObject
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {CSGOInterpolationInfoPB_CL} message CSGOInterpolationInfoPB_CL
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CSGOInterpolationInfoPB_CL.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.frac = 0;
if (message.frac != null && message.hasOwnProperty("frac"))
object.frac = options.json && !isFinite(message.frac) ? String(message.frac) : message.frac;
return object;
};
/**
* Converts this CSGOInterpolationInfoPB_CL to JSON.
* @function toJSON
* @memberof CSGOInterpolationInfoPB_CL
* @instance
* @returns {Object.<string,*>} JSON object
*/
CSGOInterpolationInfoPB_CL.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CSGOInterpolationInfoPB_CL
* @function getTypeUrl
* @memberof CSGOInterpolationInfoPB_CL
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CSGOInterpolationInfoPB_CL.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CSGOInterpolationInfoPB_CL";
};
return CSGOInterpolationInfoPB_CL;
})();
$root.CSGOInputHistoryEntryPB = (function() {
/**
* Properties of a CSGOInputHistoryEntryPB.
* @exports ICSGOInputHistoryEntryPB
* @interface ICSGOInputHistoryEntryPB
* @property {ICMsgQAngle|null} [view_angles] CSGOInputHistoryEntryPB view_angles
* @property {number|null} [render_tick_count] CSGOInputHistoryEntryPB render_tick_count
* @property {number|null} [render_tick_fraction] CSGOInputHistoryEntryPB render_tick_fraction
* @property {number|null} [player_tick_count] CSGOInputHistoryEntryPB player_tick_count
* @property {number|null} [player_tick_fraction] CSGOInputHistoryEntryPB player_tick_fraction
* @property {ICSGOInterpolationInfoPB_CL|null} [cl_interp] CSGOInputHistoryEntryPB cl_interp
* @property {ICSGOInterpolationInfoPB|null} [sv_interp0] CSGOInputHistoryEntryPB sv_interp0
* @property {ICSGOInterpolationInfoPB|null} [sv_interp1] CSGOInputHistoryEntryPB sv_interp1
* @property {ICSGOInterpolationInfoPB|null} [player_interp] CSGOInputHistoryEntryPB player_interp
* @property {number|null} [frame_number] CSGOInputHistoryEntryPB frame_number
* @property {number|null} [target_ent_index] CSGOInputHistoryEntryPB target_ent_index
* @property {ICMsgVector|null} [shoot_position] CSGOInputHistoryEntryPB shoot_position
* @property {ICMsgVector|null} [target_head_pos_check] CSGOInputHistoryEntryPB target_head_pos_check
* @property {ICMsgVector|null} [target_abs_pos_check] CSGOInputHistoryEntryPB target_abs_pos_check
* @property {ICMsgQAngle|null} [target_abs_ang_check] CSGOInputHistoryEntryPB target_abs_ang_check
*/
/**
* Constructs a new CSGOInputHistoryEntryPB.
* @exports CSGOInputHistoryEntryPB
* @classdesc Represents a CSGOInputHistoryEntryPB.
* @implements ICSGOInputHistoryEntryPB
* @constructor
* @param {ICSGOInputHistoryEntryPB=} [properties] Properties to set
*/
function CSGOInputHistoryEntryPB(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]];
}
/**
* CSGOInputHistoryEntryPB view_angles.
* @member {ICMsgQAngle|null|undefined} view_angles
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.view_angles = null;
/**
* CSGOInputHistoryEntryPB render_tick_count.
* @member {number} render_tick_count
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.render_tick_count = 0;
/**
* CSGOInputHistoryEntryPB render_tick_fraction.
* @member {number} render_tick_fraction
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.render_tick_fraction = 0;
/**
* CSGOInputHistoryEntryPB player_tick_count.
* @member {number} player_tick_count
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.player_tick_count = 0;
/**
* CSGOInputHistoryEntryPB player_tick_fraction.
* @member {number} player_tick_fraction
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.player_tick_fraction = 0;
/**
* CSGOInputHistoryEntryPB cl_interp.
* @member {ICSGOInterpolationInfoPB_CL|null|undefined} cl_interp
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.cl_interp = null;
/**
* CSGOInputHistoryEntryPB sv_interp0.
* @member {ICSGOInterpolationInfoPB|null|undefined} sv_interp0
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.sv_interp0 = null;
/**
* CSGOInputHistoryEntryPB sv_interp1.
* @member {ICSGOInterpolationInfoPB|null|undefined} sv_interp1
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.sv_interp1 = null;
/**
* CSGOInputHistoryEntryPB player_interp.
* @member {ICSGOInterpolationInfoPB|null|undefined} player_interp
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.player_interp = null;
/**
* CSGOInputHistoryEntryPB frame_number.
* @member {number} frame_number
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.frame_number = 0;
/**
* CSGOInputHistoryEntryPB target_ent_index.
* @member {number} target_ent_index
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.target_ent_index = -1;
/**
* CSGOInputHistoryEntryPB shoot_position.
* @member {ICMsgVector|null|undefined} shoot_position
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.shoot_position = null;
/**
* CSGOInputHistoryEntryPB target_head_pos_check.
* @member {ICMsgVector|null|undefined} target_head_pos_check
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.target_head_pos_check = null;
/**
* CSGOInputHistoryEntryPB target_abs_pos_check.
* @member {ICMsgVector|null|undefined} target_abs_pos_check
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.target_abs_pos_check = null;
/**
* CSGOInputHistoryEntryPB target_abs_ang_check.
* @member {ICMsgQAngle|null|undefined} target_abs_ang_check
* @memberof CSGOInputHistoryEntryPB
* @instance
*/
CSGOInputHistoryEntryPB.prototype.target_abs_ang_check = null;
/**
* Creates a new CSGOInputHistoryEntryPB instance using the specified properties.
* @function create
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {ICSGOInputHistoryEntryPB=} [properties] Properties to set
* @returns {CSGOInputHistoryEntryPB} CSGOInputHistoryEntryPB instance
*/
CSGOInputHistoryEntryPB.create = function create(properties) {
return new CSGOInputHistoryEntryPB(properties);
};
/**
* Encodes the specified CSGOInputHistoryEntryPB message. Does not implicitly {@link CSGOInputHistoryEntryPB.verify|verify} messages.
* @function encode
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {ICSGOInputHistoryEntryPB} message CSGOInputHistoryEntryPB message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGOInputHistoryEntryPB.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.view_angles != null && Object.hasOwnProperty.call(message, "view_angles"))
$root.CMsgQAngle.encode(message.view_angles, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.render_tick_count != null && Object.hasOwnProperty.call(message, "render_tick_count"))
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.render_tick_count);
if (message.render_tick_fraction != null && Object.hasOwnProperty.call(message, "render_tick_fraction"))
writer.uint32(/* id 5, wireType 5 =*/45).float(message.render_tick_fraction);
if (message.player_tick_count != null && Object.hasOwnProperty.call(message, "player_tick_count"))
writer.uint32(/* id 6, wireType 0 =*/48).int32(message.player_tick_count);
if (message.player_tick_fraction != null && Object.hasOwnProperty.call(message, "player_tick_fraction"))
writer.uint32(/* id 7, wireType 5 =*/61).float(message.player_tick_fraction);
if (message.cl_interp != null && Object.hasOwnProperty.call(message, "cl_interp"))
$root.CSGOInterpolationInfoPB_CL.encode(message.cl_interp, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim();
if (message.sv_interp0 != null && Object.hasOwnProperty.call(message, "sv_interp0"))
$root.CSGOInterpolationInfoPB.encode(message.sv_interp0, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();
if (message.sv_interp1 != null && Object.hasOwnProperty.call(message, "sv_interp1"))
$root.CSGOInterpolationInfoPB.encode(message.sv_interp1, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();
if (message.player_interp != null && Object.hasOwnProperty.call(message, "player_interp"))
$root.CSGOInterpolationInfoPB.encode(message.player_interp, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim();
if (message.frame_number != null && Object.hasOwnProperty.call(message, "frame_number"))
writer.uint32(/* id 64, wireType 0 =*/512).int32(message.frame_number);
if (message.target_ent_index != null && Object.hasOwnProperty.call(message, "target_ent_index"))
writer.uint32(/* id 65, wireType 0 =*/520).int32(message.target_ent_index);
if (message.shoot_position != null && Object.hasOwnProperty.call(message, "shoot_position"))
$root.CMsgVector.encode(message.shoot_position, writer.uint32(/* id 66, wireType 2 =*/530).fork()).ldelim();
if (message.target_head_pos_check != null && Object.hasOwnProperty.call(message, "target_head_pos_check"))
$root.CMsgVector.encode(message.target_head_pos_check, writer.uint32(/* id 67, wireType 2 =*/538).fork()).ldelim();
if (message.target_abs_pos_check != null && Object.hasOwnProperty.call(message, "target_abs_pos_check"))
$root.CMsgVector.encode(message.target_abs_pos_check, writer.uint32(/* id 68, wireType 2 =*/546).fork()).ldelim();
if (message.target_abs_ang_check != null && Object.hasOwnProperty.call(message, "target_abs_ang_check"))
$root.CMsgQAngle.encode(message.target_abs_ang_check, writer.uint32(/* id 69, wireType 2 =*/554).fork()).ldelim();
return writer;
};
/**
* Encodes the specified CSGOInputHistoryEntryPB message, length delimited. Does not implicitly {@link CSGOInputHistoryEntryPB.verify|verify} messages.
* @function encodeDelimited
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {ICSGOInputHistoryEntryPB} message CSGOInputHistoryEntryPB message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGOInputHistoryEntryPB.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CSGOInputHistoryEntryPB message from the specified reader or buffer.
* @function decode
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CSGOInputHistoryEntryPB} CSGOInputHistoryEntryPB
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGOInputHistoryEntryPB.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.CSGOInputHistoryEntryPB();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 2: {
message.view_angles = $root.CMsgQAngle.decode(reader, reader.uint32());
break;
}
case 4: {
message.render_tick_count = reader.int32();
break;
}
case 5: {
message.render_tick_fraction = reader.float();
break;
}
case 6: {
message.player_tick_count = reader.int32();
break;
}
case 7: {
message.player_tick_fraction = reader.float();
break;
}
case 12: {
message.cl_interp = $root.CSGOInterpolationInfoPB_CL.decode(reader, reader.uint32());
break;
}
case 13: {
message.sv_interp0 = $root.CSGOInterpolationInfoPB.decode(reader, reader.uint32());
break;
}
case 14: {
message.sv_interp1 = $root.CSGOInterpolationInfoPB.decode(reader, reader.uint32());
break;
}
case 15: {
message.player_interp = $root.CSGOInterpolationInfoPB.decode(reader, reader.uint32());
break;
}
case 64: {
message.frame_number = reader.int32();
break;
}
case 65: {
message.target_ent_index = reader.int32();
break;
}
case 66: {
message.shoot_position = $root.CMsgVector.decode(reader, reader.uint32());
break;
}
case 67: {
message.target_head_pos_check = $root.CMsgVector.decode(reader, reader.uint32());
break;
}
case 68: {
message.target_abs_pos_check = $root.CMsgVector.decode(reader, reader.uint32());
break;
}
case 69: {
message.target_abs_ang_check = $root.CMsgQAngle.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CSGOInputHistoryEntryPB message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CSGOInputHistoryEntryPB} CSGOInputHistoryEntryPB
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGOInputHistoryEntryPB.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CSGOInputHistoryEntryPB message.
* @function verify
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CSGOInputHistoryEntryPB.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.view_angles != null && message.hasOwnProperty("view_angles")) {
var error = $root.CMsgQAngle.verify(message.view_angles);
if (error)
return "view_angles." + error;
}
if (message.render_tick_count != null && message.hasOwnProperty("render_tick_count"))
if (!$util.isInteger(message.render_tick_count))
return "render_tick_count: integer expected";
if (message.render_tick_fraction != null && message.hasOwnProperty("render_tick_fraction"))
if (typeof message.render_tick_fraction !== "number")
return "render_tick_fraction: number expected";
if (message.player_tick_count != null && message.hasOwnProperty("player_tick_count"))
if (!$util.isInteger(message.player_tick_count))
return "player_tick_count: integer expected";
if (message.player_tick_fraction != null && message.hasOwnProperty("player_tick_fraction"))
if (typeof message.player_tick_fraction !== "number")
return "player_tick_fraction: number expected";
if (message.cl_interp != null && message.hasOwnProperty("cl_interp")) {
var error = $root.CSGOInterpolationInfoPB_CL.verify(message.cl_interp);
if (error)
return "cl_interp." + error;
}
if (message.sv_interp0 != null && message.hasOwnProperty("sv_interp0")) {
var error = $root.CSGOInterpolationInfoPB.verify(message.sv_interp0);
if (error)
return "sv_interp0." + error;
}
if (message.sv_interp1 != null && message.hasOwnProperty("sv_interp1")) {
var error = $root.CSGOInterpolationInfoPB.verify(message.sv_interp1);
if (error)
return "sv_interp1." + error;
}
if (message.player_interp != null && message.hasOwnProperty("player_interp")) {
var error = $root.CSGOInterpolationInfoPB.verify(message.player_interp);
if (error)
return "player_interp." + error;
}
if (message.frame_number != null && message.hasOwnProperty("frame_number"))
if (!$util.isInteger(message.frame_number))
return "frame_number: integer expected";
if (message.target_ent_index != null && message.hasOwnProperty("target_ent_index"))
if (!$util.isInteger(message.target_ent_index))
return "target_ent_index: integer expected";
if (message.shoot_position != null && message.hasOwnProperty("shoot_position")) {
var error = $root.CMsgVector.verify(message.shoot_position);
if (error)
return "shoot_position." + error;
}
if (message.target_head_pos_check != null && message.hasOwnProperty("target_head_pos_check")) {
var error = $root.CMsgVector.verify(message.target_head_pos_check);
if (error)
return "target_head_pos_check." + error;
}
if (message.target_abs_pos_check != null && message.hasOwnProperty("target_abs_pos_check")) {
var error = $root.CMsgVector.verify(message.target_abs_pos_check);
if (error)
return "target_abs_pos_check." + error;
}
if (message.target_abs_ang_check != null && message.hasOwnProperty("target_abs_ang_check")) {
var error = $root.CMsgQAngle.verify(message.target_abs_ang_check);
if (error)
return "target_abs_ang_check." + error;
}
return null;
};
/**
* Creates a CSGOInputHistoryEntryPB message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CSGOInputHistoryEntryPB} CSGOInputHistoryEntryPB
*/
CSGOInputHistoryEntryPB.fromObject = function fromObject(object) {
if (object instanceof $root.CSGOInputHistoryEntryPB)
return object;
var message = new $root.CSGOInputHistoryEntryPB();
if (object.view_angles != null) {
if (typeof object.view_angles !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.view_angles: object expected");
message.view_angles = $root.CMsgQAngle.fromObject(object.view_angles);
}
if (object.render_tick_count != null)
message.render_tick_count = object.render_tick_count | 0;
if (object.render_tick_fraction != null)
message.render_tick_fraction = Number(object.render_tick_fraction);
if (object.player_tick_count != null)
message.player_tick_count = object.player_tick_count | 0;
if (object.player_tick_fraction != null)
message.player_tick_fraction = Number(object.player_tick_fraction);
if (object.cl_interp != null) {
if (typeof object.cl_interp !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.cl_interp: object expected");
message.cl_interp = $root.CSGOInterpolationInfoPB_CL.fromObject(object.cl_interp);
}
if (object.sv_interp0 != null) {
if (typeof object.sv_interp0 !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.sv_interp0: object expected");
message.sv_interp0 = $root.CSGOInterpolationInfoPB.fromObject(object.sv_interp0);
}
if (object.sv_interp1 != null) {
if (typeof object.sv_interp1 !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.sv_interp1: object expected");
message.sv_interp1 = $root.CSGOInterpolationInfoPB.fromObject(object.sv_interp1);
}
if (object.player_interp != null) {
if (typeof object.player_interp !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.player_interp: object expected");
message.player_interp = $root.CSGOInterpolationInfoPB.fromObject(object.player_interp);
}
if (object.frame_number != null)
message.frame_number = object.frame_number | 0;
if (object.target_ent_index != null)
message.target_ent_index = object.target_ent_index | 0;
if (object.shoot_position != null) {
if (typeof object.shoot_position !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.shoot_position: object expected");
message.shoot_position = $root.CMsgVector.fromObject(object.shoot_position);
}
if (object.target_head_pos_check != null) {
if (typeof object.target_head_pos_check !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.target_head_pos_check: object expected");
message.target_head_pos_check = $root.CMsgVector.fromObject(object.target_head_pos_check);
}
if (object.target_abs_pos_check != null) {
if (typeof object.target_abs_pos_check !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.target_abs_pos_check: object expected");
message.target_abs_pos_check = $root.CMsgVector.fromObject(object.target_abs_pos_check);
}
if (object.target_abs_ang_check != null) {
if (typeof object.target_abs_ang_check !== "object")
throw TypeError(".CSGOInputHistoryEntryPB.target_abs_ang_check: object expected");
message.target_abs_ang_check = $root.CMsgQAngle.fromObject(object.target_abs_ang_check);
}
return message;
};
/**
* Creates a plain object from a CSGOInputHistoryEntryPB message. Also converts values to other types if specified.
* @function toObject
* @memberof CSGOInputHistoryEntryPB
* @static
* @param {CSGOInputHistoryEntryPB} message CSGOInputHistoryEntryPB
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CSGOInputHistoryEntryPB.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.view_angles = null;
object.render_tick_count = 0;
object.render_tick_fraction = 0;
object.player_tick_count = 0;
object.player_tick_fraction = 0;
object.cl_interp = null;
object.sv_interp0 = null;
object.sv_interp1 = null;
object.player_interp = null;
object.frame_number = 0;
object.target_ent_index = -1;
object.shoot_position = null;
object.target_head_pos_check = null;
object.target_abs_pos_check = null;
object.target_abs_ang_check = null;
}
if (message.view_angles != null && message.hasOwnProperty("view_angles"))
object.view_angles = $root.CMsgQAngle.toObject(message.view_angles, options);
if (message.render_tick_count != null && message.hasOwnProperty("render_tick_count"))
object.render_tick_count = message.render_tick_count;
if (message.render_tick_fraction != null && message.hasOwnProperty("render_tick_fraction"))
object.render_tick_fraction = options.json && !isFinite(message.render_tick_fraction) ? String(message.render_tick_fraction) : message.render_tick_fraction;
if (message.player_tick_count != null && message.hasOwnProperty("player_tick_count"))
object.player_tick_count = message.player_tick_count;
if (message.player_tick_fraction != null && message.hasOwnProperty("player_tick_fraction"))
object.player_tick_fraction = options.json && !isFinite(message.player_tick_fraction) ? String(message.player_tick_fraction) : message.player_tick_fraction;
if (message.cl_interp != null && message.hasOwnProperty("cl_interp"))
object.cl_interp = $root.CSGOInterpolationInfoPB_CL.toObject(message.cl_interp, options);
if (message.sv_interp0 != null && message.hasOwnProperty("sv_interp0"))
object.sv_interp0 = $root.CSGOInterpolationInfoPB.toObject(message.sv_interp0, options);
if (message.sv_interp1 != null && message.hasOwnProperty("sv_interp1"))
object.sv_interp1 = $root.CSGOInterpolationInfoPB.toObject(message.sv_interp1, options);
if (message.player_interp != null && message.hasOwnProperty("player_interp"))
object.player_interp = $root.CSGOInterpolationInfoPB.toObject(message.player_interp, options);
if (message.frame_number != null && message.hasOwnProperty("frame_number"))
object.frame_number = message.frame_number;
if (message.target_ent_index != null && message.hasOwnProperty("target_ent_index"))
object.target_ent_index = message.target_ent_index;
if (message.shoot_position != null && message.hasOwnProperty("shoot_position"))
object.shoot_position = $root.CMsgVector.toObject(message.shoot_position, options);
if (message.target_head_pos_check != null && message.hasOwnProperty("target_head_pos_check"))
object.target_head_pos_check = $root.CMsgVector.toObject(message.target_head_pos_check, options);
if (message.target_abs_pos_check != null && message.hasOwnProperty("target_abs_pos_check"))
object.target_abs_pos_check = $root.CMsgVector.toObject(message.target_abs_pos_check, options);
if (message.target_abs_ang_check != null && message.hasOwnProperty("target_abs_ang_check"))
object.target_abs_ang_check = $root.CMsgQAngle.toObject(message.target_abs_ang_