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,121 lines (1,051 loc) • 823 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"] = {});
/**
* ECsgoGameEvents enum.
* @exports ECsgoGameEvents
* @enum {number}
* @property {number} GE_PlayerAnimEventId=450 GE_PlayerAnimEventId value
* @property {number} GE_RadioIconEventId=451 GE_RadioIconEventId value
* @property {number} GE_FireBulletsId=452 GE_FireBulletsId value
* @property {number} GE_PlayerBulletHitId=453 GE_PlayerBulletHitId value
*/
$root.ECsgoGameEvents = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[450] = "GE_PlayerAnimEventId"] = 450;
values[valuesById[451] = "GE_RadioIconEventId"] = 451;
values[valuesById[452] = "GE_FireBulletsId"] = 452;
values[valuesById[453] = "GE_PlayerBulletHitId"] = 453;
return values;
})();
$root.CMsgTEPlayerAnimEvent = (function() {
/**
* Properties of a CMsgTEPlayerAnimEvent.
* @exports ICMsgTEPlayerAnimEvent
* @interface ICMsgTEPlayerAnimEvent
* @property {number|null} [player] CMsgTEPlayerAnimEvent player
* @property {number|null} [event] CMsgTEPlayerAnimEvent event
* @property {number|null} [data] CMsgTEPlayerAnimEvent data
*/
/**
* Constructs a new CMsgTEPlayerAnimEvent.
* @exports CMsgTEPlayerAnimEvent
* @classdesc Represents a CMsgTEPlayerAnimEvent.
* @implements ICMsgTEPlayerAnimEvent
* @constructor
* @param {ICMsgTEPlayerAnimEvent=} [properties] Properties to set
*/
function CMsgTEPlayerAnimEvent(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]];
}
/**
* CMsgTEPlayerAnimEvent player.
* @member {number} player
* @memberof CMsgTEPlayerAnimEvent
* @instance
*/
CMsgTEPlayerAnimEvent.prototype.player = 16777215;
/**
* CMsgTEPlayerAnimEvent event.
* @member {number} event
* @memberof CMsgTEPlayerAnimEvent
* @instance
*/
CMsgTEPlayerAnimEvent.prototype.event = 0;
/**
* CMsgTEPlayerAnimEvent data.
* @member {number} data
* @memberof CMsgTEPlayerAnimEvent
* @instance
*/
CMsgTEPlayerAnimEvent.prototype.data = 0;
/**
* Creates a new CMsgTEPlayerAnimEvent instance using the specified properties.
* @function create
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {ICMsgTEPlayerAnimEvent=} [properties] Properties to set
* @returns {CMsgTEPlayerAnimEvent} CMsgTEPlayerAnimEvent instance
*/
CMsgTEPlayerAnimEvent.create = function create(properties) {
return new CMsgTEPlayerAnimEvent(properties);
};
/**
* Encodes the specified CMsgTEPlayerAnimEvent message. Does not implicitly {@link CMsgTEPlayerAnimEvent.verify|verify} messages.
* @function encode
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {ICMsgTEPlayerAnimEvent} message CMsgTEPlayerAnimEvent message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgTEPlayerAnimEvent.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.player != null && Object.hasOwnProperty.call(message, "player"))
writer.uint32(/* id 1, wireType 5 =*/13).fixed32(message.player);
if (message.event != null && Object.hasOwnProperty.call(message, "event"))
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.event);
if (message.data != null && Object.hasOwnProperty.call(message, "data"))
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.data);
return writer;
};
/**
* Encodes the specified CMsgTEPlayerAnimEvent message, length delimited. Does not implicitly {@link CMsgTEPlayerAnimEvent.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {ICMsgTEPlayerAnimEvent} message CMsgTEPlayerAnimEvent message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgTEPlayerAnimEvent.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgTEPlayerAnimEvent message from the specified reader or buffer.
* @function decode
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgTEPlayerAnimEvent} CMsgTEPlayerAnimEvent
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgTEPlayerAnimEvent.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.CMsgTEPlayerAnimEvent();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.player = reader.fixed32();
break;
}
case 2: {
message.event = reader.uint32();
break;
}
case 3: {
message.data = reader.int32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgTEPlayerAnimEvent message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgTEPlayerAnimEvent} CMsgTEPlayerAnimEvent
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgTEPlayerAnimEvent.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgTEPlayerAnimEvent message.
* @function verify
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgTEPlayerAnimEvent.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.player != null && message.hasOwnProperty("player"))
if (!$util.isInteger(message.player))
return "player: integer expected";
if (message.event != null && message.hasOwnProperty("event"))
if (!$util.isInteger(message.event))
return "event: integer expected";
if (message.data != null && message.hasOwnProperty("data"))
if (!$util.isInteger(message.data))
return "data: integer expected";
return null;
};
/**
* Creates a CMsgTEPlayerAnimEvent message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgTEPlayerAnimEvent} CMsgTEPlayerAnimEvent
*/
CMsgTEPlayerAnimEvent.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgTEPlayerAnimEvent)
return object;
var message = new $root.CMsgTEPlayerAnimEvent();
if (object.player != null)
message.player = object.player >>> 0;
if (object.event != null)
message.event = object.event >>> 0;
if (object.data != null)
message.data = object.data | 0;
return message;
};
/**
* Creates a plain object from a CMsgTEPlayerAnimEvent message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {CMsgTEPlayerAnimEvent} message CMsgTEPlayerAnimEvent
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgTEPlayerAnimEvent.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.player = 16777215;
object.event = 0;
object.data = 0;
}
if (message.player != null && message.hasOwnProperty("player"))
object.player = message.player;
if (message.event != null && message.hasOwnProperty("event"))
object.event = message.event;
if (message.data != null && message.hasOwnProperty("data"))
object.data = message.data;
return object;
};
/**
* Converts this CMsgTEPlayerAnimEvent to JSON.
* @function toJSON
* @memberof CMsgTEPlayerAnimEvent
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgTEPlayerAnimEvent.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgTEPlayerAnimEvent
* @function getTypeUrl
* @memberof CMsgTEPlayerAnimEvent
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgTEPlayerAnimEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgTEPlayerAnimEvent";
};
return CMsgTEPlayerAnimEvent;
})();
$root.CMsgTERadioIcon = (function() {
/**
* Properties of a CMsgTERadioIcon.
* @exports ICMsgTERadioIcon
* @interface ICMsgTERadioIcon
* @property {number|null} [player] CMsgTERadioIcon player
*/
/**
* Constructs a new CMsgTERadioIcon.
* @exports CMsgTERadioIcon
* @classdesc Represents a CMsgTERadioIcon.
* @implements ICMsgTERadioIcon
* @constructor
* @param {ICMsgTERadioIcon=} [properties] Properties to set
*/
function CMsgTERadioIcon(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]];
}
/**
* CMsgTERadioIcon player.
* @member {number} player
* @memberof CMsgTERadioIcon
* @instance
*/
CMsgTERadioIcon.prototype.player = 16777215;
/**
* Creates a new CMsgTERadioIcon instance using the specified properties.
* @function create
* @memberof CMsgTERadioIcon
* @static
* @param {ICMsgTERadioIcon=} [properties] Properties to set
* @returns {CMsgTERadioIcon} CMsgTERadioIcon instance
*/
CMsgTERadioIcon.create = function create(properties) {
return new CMsgTERadioIcon(properties);
};
/**
* Encodes the specified CMsgTERadioIcon message. Does not implicitly {@link CMsgTERadioIcon.verify|verify} messages.
* @function encode
* @memberof CMsgTERadioIcon
* @static
* @param {ICMsgTERadioIcon} message CMsgTERadioIcon message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgTERadioIcon.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.player != null && Object.hasOwnProperty.call(message, "player"))
writer.uint32(/* id 1, wireType 5 =*/13).fixed32(message.player);
return writer;
};
/**
* Encodes the specified CMsgTERadioIcon message, length delimited. Does not implicitly {@link CMsgTERadioIcon.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgTERadioIcon
* @static
* @param {ICMsgTERadioIcon} message CMsgTERadioIcon message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgTERadioIcon.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgTERadioIcon message from the specified reader or buffer.
* @function decode
* @memberof CMsgTERadioIcon
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgTERadioIcon} CMsgTERadioIcon
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgTERadioIcon.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.CMsgTERadioIcon();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.player = reader.fixed32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgTERadioIcon message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgTERadioIcon
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgTERadioIcon} CMsgTERadioIcon
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgTERadioIcon.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgTERadioIcon message.
* @function verify
* @memberof CMsgTERadioIcon
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgTERadioIcon.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.player != null && message.hasOwnProperty("player"))
if (!$util.isInteger(message.player))
return "player: integer expected";
return null;
};
/**
* Creates a CMsgTERadioIcon message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgTERadioIcon
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgTERadioIcon} CMsgTERadioIcon
*/
CMsgTERadioIcon.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgTERadioIcon)
return object;
var message = new $root.CMsgTERadioIcon();
if (object.player != null)
message.player = object.player >>> 0;
return message;
};
/**
* Creates a plain object from a CMsgTERadioIcon message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgTERadioIcon
* @static
* @param {CMsgTERadioIcon} message CMsgTERadioIcon
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgTERadioIcon.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults)
object.player = 16777215;
if (message.player != null && message.hasOwnProperty("player"))
object.player = message.player;
return object;
};
/**
* Converts this CMsgTERadioIcon to JSON.
* @function toJSON
* @memberof CMsgTERadioIcon
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgTERadioIcon.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgTERadioIcon
* @function getTypeUrl
* @memberof CMsgTERadioIcon
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgTERadioIcon.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgTERadioIcon";
};
return CMsgTERadioIcon;
})();
$root.CMsgTEFireBullets = (function() {
/**
* Properties of a CMsgTEFireBullets.
* @exports ICMsgTEFireBullets
* @interface ICMsgTEFireBullets
* @property {ICMsgVector|null} [origin] CMsgTEFireBullets origin
* @property {ICMsgQAngle|null} [angles] CMsgTEFireBullets angles
* @property {number|null} [weapon_id] CMsgTEFireBullets weapon_id
* @property {number|null} [mode] CMsgTEFireBullets mode
* @property {number|null} [seed] CMsgTEFireBullets seed
* @property {number|null} [player] CMsgTEFireBullets player
* @property {number|null} [inaccuracy] CMsgTEFireBullets inaccuracy
* @property {number|null} [recoil_index] CMsgTEFireBullets recoil_index
* @property {number|null} [spread] CMsgTEFireBullets spread
* @property {number|null} [sound_type] CMsgTEFireBullets sound_type
* @property {number|null} [item_def_index] CMsgTEFireBullets item_def_index
* @property {number|null} [sound_dsp_effect] CMsgTEFireBullets sound_dsp_effect
* @property {ICMsgVector|null} [ent_origin] CMsgTEFireBullets ent_origin
* @property {number|null} [num_bullets_remaining] CMsgTEFireBullets num_bullets_remaining
* @property {number|null} [attack_type] CMsgTEFireBullets attack_type
* @property {boolean|null} [player_inair] CMsgTEFireBullets player_inair
* @property {boolean|null} [player_scoped] CMsgTEFireBullets player_scoped
* @property {number|null} [tick] CMsgTEFireBullets tick
* @property {CMsgTEFireBullets.IExtra|null} [extra] CMsgTEFireBullets extra
*/
/**
* Constructs a new CMsgTEFireBullets.
* @exports CMsgTEFireBullets
* @classdesc Represents a CMsgTEFireBullets.
* @implements ICMsgTEFireBullets
* @constructor
* @param {ICMsgTEFireBullets=} [properties] Properties to set
*/
function CMsgTEFireBullets(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]];
}
/**
* CMsgTEFireBullets origin.
* @member {ICMsgVector|null|undefined} origin
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.origin = null;
/**
* CMsgTEFireBullets angles.
* @member {ICMsgQAngle|null|undefined} angles
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.angles = null;
/**
* CMsgTEFireBullets weapon_id.
* @member {number} weapon_id
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.weapon_id = 16777215;
/**
* CMsgTEFireBullets mode.
* @member {number} mode
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.mode = 0;
/**
* CMsgTEFireBullets seed.
* @member {number} seed
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.seed = 0;
/**
* CMsgTEFireBullets player.
* @member {number} player
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.player = 16777215;
/**
* CMsgTEFireBullets inaccuracy.
* @member {number} inaccuracy
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.inaccuracy = 0;
/**
* CMsgTEFireBullets recoil_index.
* @member {number} recoil_index
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.recoil_index = 0;
/**
* CMsgTEFireBullets spread.
* @member {number} spread
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.spread = 0;
/**
* CMsgTEFireBullets sound_type.
* @member {number} sound_type
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.sound_type = 0;
/**
* CMsgTEFireBullets item_def_index.
* @member {number} item_def_index
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.item_def_index = 0;
/**
* CMsgTEFireBullets sound_dsp_effect.
* @member {number} sound_dsp_effect
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.sound_dsp_effect = 0;
/**
* CMsgTEFireBullets ent_origin.
* @member {ICMsgVector|null|undefined} ent_origin
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.ent_origin = null;
/**
* CMsgTEFireBullets num_bullets_remaining.
* @member {number} num_bullets_remaining
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.num_bullets_remaining = 0;
/**
* CMsgTEFireBullets attack_type.
* @member {number} attack_type
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.attack_type = 0;
/**
* CMsgTEFireBullets player_inair.
* @member {boolean} player_inair
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.player_inair = false;
/**
* CMsgTEFireBullets player_scoped.
* @member {boolean} player_scoped
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.player_scoped = false;
/**
* CMsgTEFireBullets tick.
* @member {number} tick
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.tick = 0;
/**
* CMsgTEFireBullets extra.
* @member {CMsgTEFireBullets.IExtra|null|undefined} extra
* @memberof CMsgTEFireBullets
* @instance
*/
CMsgTEFireBullets.prototype.extra = null;
/**
* Creates a new CMsgTEFireBullets instance using the specified properties.
* @function create
* @memberof CMsgTEFireBullets
* @static
* @param {ICMsgTEFireBullets=} [properties] Properties to set
* @returns {CMsgTEFireBullets} CMsgTEFireBullets instance
*/
CMsgTEFireBullets.create = function create(properties) {
return new CMsgTEFireBullets(properties);
};
/**
* Encodes the specified CMsgTEFireBullets message. Does not implicitly {@link CMsgTEFireBullets.verify|verify} messages.
* @function encode
* @memberof CMsgTEFireBullets
* @static
* @param {ICMsgTEFireBullets} message CMsgTEFireBullets message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgTEFireBullets.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.origin != null && Object.hasOwnProperty.call(message, "origin"))
$root.CMsgVector.encode(message.origin, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.angles != null && Object.hasOwnProperty.call(message, "angles"))
$root.CMsgQAngle.encode(message.angles, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.weapon_id != null && Object.hasOwnProperty.call(message, "weapon_id"))
writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.weapon_id);
if (message.mode != null && Object.hasOwnProperty.call(message, "mode"))
writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.mode);
if (message.seed != null && Object.hasOwnProperty.call(message, "seed"))
writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.seed);
if (message.player != null && Object.hasOwnProperty.call(message, "player"))
writer.uint32(/* id 6, wireType 5 =*/53).fixed32(message.player);
if (message.inaccuracy != null && Object.hasOwnProperty.call(message, "inaccuracy"))
writer.uint32(/* id 7, wireType 5 =*/61).float(message.inaccuracy);
if (message.recoil_index != null && Object.hasOwnProperty.call(message, "recoil_index"))
writer.uint32(/* id 8, wireType 5 =*/69).float(message.recoil_index);
if (message.spread != null && Object.hasOwnProperty.call(message, "spread"))
writer.uint32(/* id 9, wireType 5 =*/77).float(message.spread);
if (message.sound_type != null && Object.hasOwnProperty.call(message, "sound_type"))
writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sound_type);
if (message.item_def_index != null && Object.hasOwnProperty.call(message, "item_def_index"))
writer.uint32(/* id 11, wireType 0 =*/88).uint32(message.item_def_index);
if (message.sound_dsp_effect != null && Object.hasOwnProperty.call(message, "sound_dsp_effect"))
writer.uint32(/* id 12, wireType 5 =*/101).fixed32(message.sound_dsp_effect);
if (message.ent_origin != null && Object.hasOwnProperty.call(message, "ent_origin"))
$root.CMsgVector.encode(message.ent_origin, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();
if (message.num_bullets_remaining != null && Object.hasOwnProperty.call(message, "num_bullets_remaining"))
writer.uint32(/* id 14, wireType 0 =*/112).uint32(message.num_bullets_remaining);
if (message.attack_type != null && Object.hasOwnProperty.call(message, "attack_type"))
writer.uint32(/* id 15, wireType 0 =*/120).uint32(message.attack_type);
if (message.extra != null && Object.hasOwnProperty.call(message, "extra"))
$root.CMsgTEFireBullets.Extra.encode(message.extra, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim();
if (message.player_inair != null && Object.hasOwnProperty.call(message, "player_inair"))
writer.uint32(/* id 17, wireType 0 =*/136).bool(message.player_inair);
if (message.player_scoped != null && Object.hasOwnProperty.call(message, "player_scoped"))
writer.uint32(/* id 18, wireType 0 =*/144).bool(message.player_scoped);
if (message.tick != null && Object.hasOwnProperty.call(message, "tick"))
writer.uint32(/* id 19, wireType 0 =*/152).int32(message.tick);
return writer;
};
/**
* Encodes the specified CMsgTEFireBullets message, length delimited. Does not implicitly {@link CMsgTEFireBullets.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgTEFireBullets
* @static
* @param {ICMsgTEFireBullets} message CMsgTEFireBullets message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgTEFireBullets.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgTEFireBullets message from the specified reader or buffer.
* @function decode
* @memberof CMsgTEFireBullets
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgTEFireBullets} CMsgTEFireBullets
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgTEFireBullets.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.CMsgTEFireBullets();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.origin = $root.CMsgVector.decode(reader, reader.uint32());
break;
}
case 2: {
message.angles = $root.CMsgQAngle.decode(reader, reader.uint32());
break;
}
case 3: {
message.weapon_id = reader.uint32();
break;
}
case 4: {
message.mode = reader.uint32();
break;
}
case 5: {
message.seed = reader.uint32();
break;
}
case 6: {
message.player = reader.fixed32();
break;
}
case 7: {
message.inaccuracy = reader.float();
break;
}
case 8: {
message.recoil_index = reader.float();
break;
}
case 9: {
message.spread = reader.float();
break;
}
case 10: {
message.sound_type = reader.int32();
break;
}
case 11: {
message.item_def_index = reader.uint32();
break;
}
case 12: {
message.sound_dsp_effect = reader.fixed32();
break;
}
case 13: {
message.ent_origin = $root.CMsgVector.decode(reader, reader.uint32());
break;
}
case 14: {
message.num_bullets_remaining = reader.uint32();
break;
}
case 15: {
message.attack_type = reader.uint32();
break;
}
case 17: {
message.player_inair = reader.bool();
break;
}
case 18: {
message.player_scoped = reader.bool();
break;
}
case 19: {
message.tick = reader.int32();
break;
}
case 16: {
message.extra = $root.CMsgTEFireBullets.Extra.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgTEFireBullets message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgTEFireBullets
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgTEFireBullets} CMsgTEFireBullets
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgTEFireBullets.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgTEFireBullets message.
* @function verify
* @memberof CMsgTEFireBullets
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgTEFireBullets.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.origin != null && message.hasOwnProperty("origin")) {
var error = $root.CMsgVector.verify(message.origin);
if (error)
return "origin." + error;
}
if (message.angles != null && message.hasOwnProperty("angles")) {
var error = $root.CMsgQAngle.verify(message.angles);
if (error)
return "angles." + error;
}
if (message.weapon_id != null && message.hasOwnProperty("weapon_id"))
if (!$util.isInteger(message.weapon_id))
return "weapon_id: integer expected";
if (message.mode != null && message.hasOwnProperty("mode"))
if (!$util.isInteger(message.mode))
return "mode: integer expected";
if (message.seed != null && message.hasOwnProperty("seed"))
if (!$util.isInteger(message.seed))
return "seed: integer expected";
if (message.player != null && message.hasOwnProperty("player"))
if (!$util.isInteger(message.player))
return "player: integer expected";
if (message.inaccuracy != null && message.hasOwnProperty("inaccuracy"))
if (typeof message.inaccuracy !== "number")
return "inaccuracy: number expected";
if (message.recoil_index != null && message.hasOwnProperty("recoil_index"))
if (typeof message.recoil_index !== "number")
return "recoil_index: number expected";
if (message.spread != null && message.hasOwnProperty("spread"))
if (typeof message.spread !== "number")
return "spread: number expected";
if (message.sound_type != null && message.hasOwnProperty("sound_type"))
if (!$util.isInteger(message.sound_type))
return "sound_type: integer expected";
if (message.item_def_index != null && message.hasOwnProperty("item_def_index"))
if (!$util.isInteger(message.item_def_index))
return "item_def_index: integer expected";
if (message.sound_dsp_effect != null && message.hasOwnProperty("sound_dsp_effect"))
if (!$util.isInteger(message.sound_dsp_effect))
return "sound_dsp_effect: integer expected";
if (message.ent_origin != null && message.hasOwnProperty("ent_origin")) {
var error = $root.CMsgVector.verify(message.ent_origin);
if (error)
return "ent_origin." + error;
}
if (message.num_bullets_remaining != null && message.hasOwnProperty("num_bullets_remaining"))
if (!$util.isInteger(message.num_bullets_remaining))
return "num_bullets_remaining: integer expected";
if (message.attack_type != null && message.hasOwnProperty("attack_type"))
if (!$util.isInteger(message.attack_type))
return "attack_type: integer expected";
if (message.player_inair != null && message.hasOwnProperty("player_inair"))
if (typeof message.player_inair !== "boolean")
return "player_inair: boolean expected";
if (message.player_scoped != null && message.hasOwnProperty("player_scoped"))
if (typeof message.player_scoped !== "boolean")
return "player_scoped: boolean expected";
if (message.tick != null && message.hasOwnProperty("tick"))
if (!$util.isInteger(message.tick))
return "tick: integer expected";
if (message.extra != null && message.hasOwnProperty("extra")) {
var error = $root.CMsgTEFireBullets.Extra.verify(message.extra);
if (error)
return "extra." + error;
}
return null;
};
/**
* Creates a CMsgTEFireBullets message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgTEFireBullets
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgTEFireBullets} CMsgTEFireBullets
*/
CMsgTEFireBullets.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgTEFireBullets)
return object;
var message = new $root.CMsgTEFireBullets();
if (object.origin != null) {
if (typeof object.origin !== "object")
throw TypeError(".CMsgTEFireBullets.origin: object expected");
message.origin = $root.CMsgVector.fromObject(object.origin);
}
if (object.angles != null) {
if (typeof object.angles !== "object")
throw TypeError(".CMsgTEFireBullets.angles: object expected");
message.angles = $root.CMsgQAngle.fromObject(object.angles);
}
if (object.weapon_id != null)
message.weapon_id = object.weapon_id >>> 0;
if (object.mode != null)
message.mode = object.mode >>> 0;
if (object.seed != null)
message.seed = object.seed >>> 0;
if (object.player != null)
message.player = object.player >>> 0;
if (object.inaccuracy != null)
message.inaccuracy = Number(object.inaccuracy);
if (object.recoil_index != null)
message.recoil_index = Number(object.recoil_index);
if (object.spread != null)
message.spread = Number(object.spread);
if (object.sound_type != null)
message.sound_type = object.sound_type | 0;
if (object.item_def_index != null)
message.item_def_index = object.item_def_index >>> 0;
if (object.sound_dsp_effect != null)
message.sound_dsp_effect = object.sound_dsp_effect >>> 0;
if (object.ent_origin != null) {
if (typeof object.ent_origin !== "object")
throw TypeError(".CMsgTEFireBullets.ent_origin: object expected");
message.ent_origin = $root.CMsgVector.fromObject(object.ent_origin);
}
if (object.num_bullets_remaining != null)
message.num_bullets_remaining = object.num_bullets_remaining >>> 0;
if (object.attack_type != null)
message.attack_type = object.attack_type >>> 0;
if (object.player_inair != null)
message.player_inair = Boolean(object.player_inair);
if (object.player_scoped != null)
message.player_scoped = Boolean(object.player_scoped);
if (object.tick != null)
message.tick = object.tick | 0;
if (object.extra != null) {
if (typeof object.extra !== "object")
throw TypeError(".CMsgTEFireBullets.extra: object expected");
message.extra = $root.CMsgTEFireBullets.Extra.fromObject(object.extra);
}
return message;
};
/**
* Creates a plain object from a CMsgTEFireBullets message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgTEFireBullets
* @static
* @param {CMsgTEFireBullets} message CMsgTEFireBullets
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgTEFireBullets.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.origin = null;
object.angles = null;
object.weapon_id = 16777215;
object.mode = 0;
object.seed = 0;
object.player = 16777215;
object.inaccuracy = 0;
object.recoil_index = 0;
object.spread = 0;
object.sound_type = 0;
object.item_def_index = 0;
object.sound_dsp_effect = 0;
object.ent_origin = null;
object.num_bullets_remaining = 0;
object.attack_type = 0;
object.extra = null;
object.player_inair = false;
object.player_scoped = false;
object.tick = 0;
}
if (message.origin != null && message.hasOwnProperty("origin"))
object.origin = $root.CMsgVector.toObject(message.origin, options);
if (message.angles != null && message.hasOwnProperty("angles"))
object.angles = $root.CMsgQAngle.toObject(message.angles, options);
if (message.weapon_id != null && message.hasOwnProperty("weapon_id"))
object.weapon_id = message.weapon_id;
if (message.mode != null && message.hasOwnProperty("mode"))
object.mode = message.mode;
if (message.seed != null && message.hasOwnProperty("seed"))
object.seed = message.seed;
if (message.player != null && message.hasOwnProperty("player"))
object.player = message.player;
if (message.inaccuracy != null && message.hasOwnProperty("inaccuracy"))
object.inaccuracy = options.json && !isFinite(message.inaccuracy) ? String(message.inaccuracy) : message.inaccuracy;
if (message.recoil_index != null && message.hasOwnProperty("recoil_index"))
object.recoil_index = options.json && !isFinite(message.recoil_index) ? String(message.recoil_index) : message.recoil_index;
if (message.spread != null && message.hasOwnProperty("spread"))
object.spread = options.json && !isFinite(message.spread) ? String(message.spread) : message.spread;
if (message.sound_type != null && message.hasOwnProperty("sound_type"))
object.sound_type = message.sound_type;
if (message.item_def_index != null && message.hasOwnProperty("item_def_index"))
object.item_def_index = message.item_def_index;
if (message.sound_dsp_effect != null && message.hasOwnProperty("sound_dsp_effect"))
object.sound_dsp_effect = message.sound_dsp_effect;
if (message.ent_origin != null && message.hasOwnProperty("ent_origin"))
object.ent_origin = $root.CMsgVector.toObject(message.ent_origin, options);
if (message.num_bullets_remaining != null && message.hasOwnProperty("num_bullets_remaining"))
object.num_bullets_remaining = message.num_bullets_remaining;
if (message.attack_type != null && message.hasOwnProperty("attack_type"))
object.attack_type = message.attack_type;
if (message.extra != null && message.hasOwnProperty("extra"))
object.extra = $root.CMsgTEFireBullets.Extra.toObject(message.extra, options);
if (message.player_inair != null && message.hasOwnProperty("player_inair"))
object.player_inair = message.player_inair;
if (message.player_scoped != null && message.hasOwnProperty("player_scoped"))
object.player_scoped = message.player_scoped;
if (message.tick != null && message.hasOwnProperty("tick"))
object.tick = message.tick;
return object;
};
/**
* Converts this CMsgTEFireBullets to JSON.
* @function toJSON
* @memberof CMsgTEFireBullets
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgTEFireBullets.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgTEFireBullets
* @function getTypeUrl
* @memberof CMsgTEFireBullets
* @static
* @param {strin