UNPKG

@openskindb/cs2-gc

Version:

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

993 lines (932 loc) 1.5 MB
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ (function(global, factory) { /* global define, require, module */ /* AMD */ if (typeof define === 'function' && define.amd) define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) module.exports = factory(require("protobufjs/minimal")); })(this, function($protobuf) { "use strict"; // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); /** * EGCBaseMsg enum. * @exports EGCBaseMsg * @enum {number} * @property {number} k_EMsgGCSystemMessage=4001 k_EMsgGCSystemMessage value * @property {number} k_EMsgGCReplicateConVars=4002 k_EMsgGCReplicateConVars value * @property {number} k_EMsgGCConVarUpdated=4003 k_EMsgGCConVarUpdated value * @property {number} k_EMsgGCInQueue=4008 k_EMsgGCInQueue value * @property {number} k_EMsgGCInviteToParty=4501 k_EMsgGCInviteToParty value * @property {number} k_EMsgGCInvitationCreated=4502 k_EMsgGCInvitationCreated value * @property {number} k_EMsgGCPartyInviteResponse=4503 k_EMsgGCPartyInviteResponse value * @property {number} k_EMsgGCKickFromParty=4504 k_EMsgGCKickFromParty value * @property {number} k_EMsgGCLeaveParty=4505 k_EMsgGCLeaveParty value * @property {number} k_EMsgGCServerAvailable=4506 k_EMsgGCServerAvailable value * @property {number} k_EMsgGCClientConnectToServer=4507 k_EMsgGCClientConnectToServer value * @property {number} k_EMsgGCGameServerInfo=4508 k_EMsgGCGameServerInfo value * @property {number} k_EMsgGCError=4509 k_EMsgGCError value * @property {number} k_EMsgGCReplay_UploadedToYouTube=4510 k_EMsgGCReplay_UploadedToYouTube value * @property {number} k_EMsgGCLANServerAvailable=4511 k_EMsgGCLANServerAvailable value */ $root.EGCBaseMsg = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[4001] = "k_EMsgGCSystemMessage"] = 4001; values[valuesById[4002] = "k_EMsgGCReplicateConVars"] = 4002; values[valuesById[4003] = "k_EMsgGCConVarUpdated"] = 4003; values[valuesById[4008] = "k_EMsgGCInQueue"] = 4008; values[valuesById[4501] = "k_EMsgGCInviteToParty"] = 4501; values[valuesById[4502] = "k_EMsgGCInvitationCreated"] = 4502; values[valuesById[4503] = "k_EMsgGCPartyInviteResponse"] = 4503; values[valuesById[4504] = "k_EMsgGCKickFromParty"] = 4504; values[valuesById[4505] = "k_EMsgGCLeaveParty"] = 4505; values[valuesById[4506] = "k_EMsgGCServerAvailable"] = 4506; values[valuesById[4507] = "k_EMsgGCClientConnectToServer"] = 4507; values[valuesById[4508] = "k_EMsgGCGameServerInfo"] = 4508; values[valuesById[4509] = "k_EMsgGCError"] = 4509; values[valuesById[4510] = "k_EMsgGCReplay_UploadedToYouTube"] = 4510; values[valuesById[4511] = "k_EMsgGCLANServerAvailable"] = 4511; return values; })(); /** * EGCBaseProtoObjectTypes enum. * @exports EGCBaseProtoObjectTypes * @enum {number} * @property {number} k_EProtoObjectPartyInvite=1001 k_EProtoObjectPartyInvite value * @property {number} k_EProtoObjectLobbyInvite=1002 k_EProtoObjectLobbyInvite value */ $root.EGCBaseProtoObjectTypes = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[1001] = "k_EProtoObjectPartyInvite"] = 1001; values[valuesById[1002] = "k_EProtoObjectLobbyInvite"] = 1002; return values; })(); /** * GC_BannedWordType enum. * @exports GC_BannedWordType * @enum {number} * @property {number} GC_BANNED_WORD_DISABLE_WORD=0 GC_BANNED_WORD_DISABLE_WORD value * @property {number} GC_BANNED_WORD_ENABLE_WORD=1 GC_BANNED_WORD_ENABLE_WORD value */ $root.GC_BannedWordType = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "GC_BANNED_WORD_DISABLE_WORD"] = 0; values[valuesById[1] = "GC_BANNED_WORD_ENABLE_WORD"] = 1; return values; })(); $root.CGCStorePurchaseInit_LineItem = (function() { /** * Properties of a CGCStorePurchaseInit_LineItem. * @exports ICGCStorePurchaseInit_LineItem * @interface ICGCStorePurchaseInit_LineItem * @property {number|null} [item_def_id] CGCStorePurchaseInit_LineItem item_def_id * @property {number|null} [quantity] CGCStorePurchaseInit_LineItem quantity * @property {number|null} [cost_in_local_currency] CGCStorePurchaseInit_LineItem cost_in_local_currency * @property {number|null} [purchase_type] CGCStorePurchaseInit_LineItem purchase_type * @property {number|Long|null} [supplemental_data] CGCStorePurchaseInit_LineItem supplemental_data */ /** * Constructs a new CGCStorePurchaseInit_LineItem. * @exports CGCStorePurchaseInit_LineItem * @classdesc Represents a CGCStorePurchaseInit_LineItem. * @implements ICGCStorePurchaseInit_LineItem * @constructor * @param {ICGCStorePurchaseInit_LineItem=} [properties] Properties to set */ function CGCStorePurchaseInit_LineItem(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]]; } /** * CGCStorePurchaseInit_LineItem item_def_id. * @member {number} item_def_id * @memberof CGCStorePurchaseInit_LineItem * @instance */ CGCStorePurchaseInit_LineItem.prototype.item_def_id = 0; /** * CGCStorePurchaseInit_LineItem quantity. * @member {number} quantity * @memberof CGCStorePurchaseInit_LineItem * @instance */ CGCStorePurchaseInit_LineItem.prototype.quantity = 0; /** * CGCStorePurchaseInit_LineItem cost_in_local_currency. * @member {number} cost_in_local_currency * @memberof CGCStorePurchaseInit_LineItem * @instance */ CGCStorePurchaseInit_LineItem.prototype.cost_in_local_currency = 0; /** * CGCStorePurchaseInit_LineItem purchase_type. * @member {number} purchase_type * @memberof CGCStorePurchaseInit_LineItem * @instance */ CGCStorePurchaseInit_LineItem.prototype.purchase_type = 0; /** * CGCStorePurchaseInit_LineItem supplemental_data. * @member {number|Long} supplemental_data * @memberof CGCStorePurchaseInit_LineItem * @instance */ CGCStorePurchaseInit_LineItem.prototype.supplemental_data = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * Creates a new CGCStorePurchaseInit_LineItem instance using the specified properties. * @function create * @memberof CGCStorePurchaseInit_LineItem * @static * @param {ICGCStorePurchaseInit_LineItem=} [properties] Properties to set * @returns {CGCStorePurchaseInit_LineItem} CGCStorePurchaseInit_LineItem instance */ CGCStorePurchaseInit_LineItem.create = function create(properties) { return new CGCStorePurchaseInit_LineItem(properties); }; /** * Encodes the specified CGCStorePurchaseInit_LineItem message. Does not implicitly {@link CGCStorePurchaseInit_LineItem.verify|verify} messages. * @function encode * @memberof CGCStorePurchaseInit_LineItem * @static * @param {ICGCStorePurchaseInit_LineItem} message CGCStorePurchaseInit_LineItem message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CGCStorePurchaseInit_LineItem.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.item_def_id != null && Object.hasOwnProperty.call(message, "item_def_id")) writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.item_def_id); if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.quantity); if (message.cost_in_local_currency != null && Object.hasOwnProperty.call(message, "cost_in_local_currency")) writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.cost_in_local_currency); if (message.purchase_type != null && Object.hasOwnProperty.call(message, "purchase_type")) writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.purchase_type); if (message.supplemental_data != null && Object.hasOwnProperty.call(message, "supplemental_data")) writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.supplemental_data); return writer; }; /** * Encodes the specified CGCStorePurchaseInit_LineItem message, length delimited. Does not implicitly {@link CGCStorePurchaseInit_LineItem.verify|verify} messages. * @function encodeDelimited * @memberof CGCStorePurchaseInit_LineItem * @static * @param {ICGCStorePurchaseInit_LineItem} message CGCStorePurchaseInit_LineItem message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CGCStorePurchaseInit_LineItem.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CGCStorePurchaseInit_LineItem message from the specified reader or buffer. * @function decode * @memberof CGCStorePurchaseInit_LineItem * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CGCStorePurchaseInit_LineItem} CGCStorePurchaseInit_LineItem * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CGCStorePurchaseInit_LineItem.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.CGCStorePurchaseInit_LineItem(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.item_def_id = reader.uint32(); break; } case 2: { message.quantity = reader.uint32(); break; } case 3: { message.cost_in_local_currency = reader.uint32(); break; } case 4: { message.purchase_type = reader.uint32(); break; } case 5: { message.supplemental_data = reader.uint64(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CGCStorePurchaseInit_LineItem message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CGCStorePurchaseInit_LineItem * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CGCStorePurchaseInit_LineItem} CGCStorePurchaseInit_LineItem * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CGCStorePurchaseInit_LineItem.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CGCStorePurchaseInit_LineItem message. * @function verify * @memberof CGCStorePurchaseInit_LineItem * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CGCStorePurchaseInit_LineItem.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.item_def_id != null && message.hasOwnProperty("item_def_id")) if (!$util.isInteger(message.item_def_id)) return "item_def_id: integer expected"; if (message.quantity != null && message.hasOwnProperty("quantity")) if (!$util.isInteger(message.quantity)) return "quantity: integer expected"; if (message.cost_in_local_currency != null && message.hasOwnProperty("cost_in_local_currency")) if (!$util.isInteger(message.cost_in_local_currency)) return "cost_in_local_currency: integer expected"; if (message.purchase_type != null && message.hasOwnProperty("purchase_type")) if (!$util.isInteger(message.purchase_type)) return "purchase_type: integer expected"; if (message.supplemental_data != null && message.hasOwnProperty("supplemental_data")) if (!$util.isInteger(message.supplemental_data) && !(message.supplemental_data && $util.isInteger(message.supplemental_data.low) && $util.isInteger(message.supplemental_data.high))) return "supplemental_data: integer|Long expected"; return null; }; /** * Creates a CGCStorePurchaseInit_LineItem message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CGCStorePurchaseInit_LineItem * @static * @param {Object.<string,*>} object Plain object * @returns {CGCStorePurchaseInit_LineItem} CGCStorePurchaseInit_LineItem */ CGCStorePurchaseInit_LineItem.fromObject = function fromObject(object) { if (object instanceof $root.CGCStorePurchaseInit_LineItem) return object; var message = new $root.CGCStorePurchaseInit_LineItem(); if (object.item_def_id != null) message.item_def_id = object.item_def_id >>> 0; if (object.quantity != null) message.quantity = object.quantity >>> 0; if (object.cost_in_local_currency != null) message.cost_in_local_currency = object.cost_in_local_currency >>> 0; if (object.purchase_type != null) message.purchase_type = object.purchase_type >>> 0; if (object.supplemental_data != null) if ($util.Long) (message.supplemental_data = $util.Long.fromValue(object.supplemental_data)).unsigned = true; else if (typeof object.supplemental_data === "string") message.supplemental_data = parseInt(object.supplemental_data, 10); else if (typeof object.supplemental_data === "number") message.supplemental_data = object.supplemental_data; else if (typeof object.supplemental_data === "object") message.supplemental_data = new $util.LongBits(object.supplemental_data.low >>> 0, object.supplemental_data.high >>> 0).toNumber(true); return message; }; /** * Creates a plain object from a CGCStorePurchaseInit_LineItem message. Also converts values to other types if specified. * @function toObject * @memberof CGCStorePurchaseInit_LineItem * @static * @param {CGCStorePurchaseInit_LineItem} message CGCStorePurchaseInit_LineItem * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CGCStorePurchaseInit_LineItem.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.item_def_id = 0; object.quantity = 0; object.cost_in_local_currency = 0; object.purchase_type = 0; if ($util.Long) { var long = new $util.Long(0, 0, true); object.supplemental_data = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.supplemental_data = options.longs === String ? "0" : 0; } if (message.item_def_id != null && message.hasOwnProperty("item_def_id")) object.item_def_id = message.item_def_id; if (message.quantity != null && message.hasOwnProperty("quantity")) object.quantity = message.quantity; if (message.cost_in_local_currency != null && message.hasOwnProperty("cost_in_local_currency")) object.cost_in_local_currency = message.cost_in_local_currency; if (message.purchase_type != null && message.hasOwnProperty("purchase_type")) object.purchase_type = message.purchase_type; if (message.supplemental_data != null && message.hasOwnProperty("supplemental_data")) if (typeof message.supplemental_data === "number") object.supplemental_data = options.longs === String ? String(message.supplemental_data) : message.supplemental_data; else object.supplemental_data = options.longs === String ? $util.Long.prototype.toString.call(message.supplemental_data) : options.longs === Number ? new $util.LongBits(message.supplemental_data.low >>> 0, message.supplemental_data.high >>> 0).toNumber(true) : message.supplemental_data; return object; }; /** * Converts this CGCStorePurchaseInit_LineItem to JSON. * @function toJSON * @memberof CGCStorePurchaseInit_LineItem * @instance * @returns {Object.<string,*>} JSON object */ CGCStorePurchaseInit_LineItem.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CGCStorePurchaseInit_LineItem * @function getTypeUrl * @memberof CGCStorePurchaseInit_LineItem * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CGCStorePurchaseInit_LineItem.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/CGCStorePurchaseInit_LineItem"; }; return CGCStorePurchaseInit_LineItem; })(); $root.CMsgGCStorePurchaseInit = (function() { /** * Properties of a CMsgGCStorePurchaseInit. * @exports ICMsgGCStorePurchaseInit * @interface ICMsgGCStorePurchaseInit * @property {string|null} [country] CMsgGCStorePurchaseInit country * @property {number|null} [language] CMsgGCStorePurchaseInit language * @property {number|null} [currency] CMsgGCStorePurchaseInit currency * @property {Array.<ICGCStorePurchaseInit_LineItem>|null} [line_items] CMsgGCStorePurchaseInit line_items */ /** * Constructs a new CMsgGCStorePurchaseInit. * @exports CMsgGCStorePurchaseInit * @classdesc Represents a CMsgGCStorePurchaseInit. * @implements ICMsgGCStorePurchaseInit * @constructor * @param {ICMsgGCStorePurchaseInit=} [properties] Properties to set */ function CMsgGCStorePurchaseInit(properties) { this.line_items = []; 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]]; } /** * CMsgGCStorePurchaseInit country. * @member {string} country * @memberof CMsgGCStorePurchaseInit * @instance */ CMsgGCStorePurchaseInit.prototype.country = ""; /** * CMsgGCStorePurchaseInit language. * @member {number} language * @memberof CMsgGCStorePurchaseInit * @instance */ CMsgGCStorePurchaseInit.prototype.language = 0; /** * CMsgGCStorePurchaseInit currency. * @member {number} currency * @memberof CMsgGCStorePurchaseInit * @instance */ CMsgGCStorePurchaseInit.prototype.currency = 0; /** * CMsgGCStorePurchaseInit line_items. * @member {Array.<ICGCStorePurchaseInit_LineItem>} line_items * @memberof CMsgGCStorePurchaseInit * @instance */ CMsgGCStorePurchaseInit.prototype.line_items = $util.emptyArray; /** * Creates a new CMsgGCStorePurchaseInit instance using the specified properties. * @function create * @memberof CMsgGCStorePurchaseInit * @static * @param {ICMsgGCStorePurchaseInit=} [properties] Properties to set * @returns {CMsgGCStorePurchaseInit} CMsgGCStorePurchaseInit instance */ CMsgGCStorePurchaseInit.create = function create(properties) { return new CMsgGCStorePurchaseInit(properties); }; /** * Encodes the specified CMsgGCStorePurchaseInit message. Does not implicitly {@link CMsgGCStorePurchaseInit.verify|verify} messages. * @function encode * @memberof CMsgGCStorePurchaseInit * @static * @param {ICMsgGCStorePurchaseInit} message CMsgGCStorePurchaseInit message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgGCStorePurchaseInit.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.country != null && Object.hasOwnProperty.call(message, "country")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.country); if (message.language != null && Object.hasOwnProperty.call(message, "language")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.language); if (message.currency != null && Object.hasOwnProperty.call(message, "currency")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.currency); if (message.line_items != null && message.line_items.length) for (var i = 0; i < message.line_items.length; ++i) $root.CGCStorePurchaseInit_LineItem.encode(message.line_items[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** * Encodes the specified CMsgGCStorePurchaseInit message, length delimited. Does not implicitly {@link CMsgGCStorePurchaseInit.verify|verify} messages. * @function encodeDelimited * @memberof CMsgGCStorePurchaseInit * @static * @param {ICMsgGCStorePurchaseInit} message CMsgGCStorePurchaseInit message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgGCStorePurchaseInit.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CMsgGCStorePurchaseInit message from the specified reader or buffer. * @function decode * @memberof CMsgGCStorePurchaseInit * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CMsgGCStorePurchaseInit} CMsgGCStorePurchaseInit * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgGCStorePurchaseInit.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.CMsgGCStorePurchaseInit(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.country = reader.string(); break; } case 2: { message.language = reader.int32(); break; } case 3: { message.currency = reader.int32(); break; } case 4: { if (!(message.line_items && message.line_items.length)) message.line_items = []; message.line_items.push($root.CGCStorePurchaseInit_LineItem.decode(reader, reader.uint32())); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CMsgGCStorePurchaseInit message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CMsgGCStorePurchaseInit * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CMsgGCStorePurchaseInit} CMsgGCStorePurchaseInit * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgGCStorePurchaseInit.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CMsgGCStorePurchaseInit message. * @function verify * @memberof CMsgGCStorePurchaseInit * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CMsgGCStorePurchaseInit.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.country != null && message.hasOwnProperty("country")) if (!$util.isString(message.country)) return "country: string expected"; if (message.language != null && message.hasOwnProperty("language")) if (!$util.isInteger(message.language)) return "language: integer expected"; if (message.currency != null && message.hasOwnProperty("currency")) if (!$util.isInteger(message.currency)) return "currency: integer expected"; if (message.line_items != null && message.hasOwnProperty("line_items")) { if (!Array.isArray(message.line_items)) return "line_items: array expected"; for (var i = 0; i < message.line_items.length; ++i) { var error = $root.CGCStorePurchaseInit_LineItem.verify(message.line_items[i]); if (error) return "line_items." + error; } } return null; }; /** * Creates a CMsgGCStorePurchaseInit message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CMsgGCStorePurchaseInit * @static * @param {Object.<string,*>} object Plain object * @returns {CMsgGCStorePurchaseInit} CMsgGCStorePurchaseInit */ CMsgGCStorePurchaseInit.fromObject = function fromObject(object) { if (object instanceof $root.CMsgGCStorePurchaseInit) return object; var message = new $root.CMsgGCStorePurchaseInit(); if (object.country != null) message.country = String(object.country); if (object.language != null) message.language = object.language | 0; if (object.currency != null) message.currency = object.currency | 0; if (object.line_items) { if (!Array.isArray(object.line_items)) throw TypeError(".CMsgGCStorePurchaseInit.line_items: array expected"); message.line_items = []; for (var i = 0; i < object.line_items.length; ++i) { if (typeof object.line_items[i] !== "object") throw TypeError(".CMsgGCStorePurchaseInit.line_items: object expected"); message.line_items[i] = $root.CGCStorePurchaseInit_LineItem.fromObject(object.line_items[i]); } } return message; }; /** * Creates a plain object from a CMsgGCStorePurchaseInit message. Also converts values to other types if specified. * @function toObject * @memberof CMsgGCStorePurchaseInit * @static * @param {CMsgGCStorePurchaseInit} message CMsgGCStorePurchaseInit * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CMsgGCStorePurchaseInit.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.line_items = []; if (options.defaults) { object.country = ""; object.language = 0; object.currency = 0; } if (message.country != null && message.hasOwnProperty("country")) object.country = message.country; if (message.language != null && message.hasOwnProperty("language")) object.language = message.language; if (message.currency != null && message.hasOwnProperty("currency")) object.currency = message.currency; if (message.line_items && message.line_items.length) { object.line_items = []; for (var j = 0; j < message.line_items.length; ++j) object.line_items[j] = $root.CGCStorePurchaseInit_LineItem.toObject(message.line_items[j], options); } return object; }; /** * Converts this CMsgGCStorePurchaseInit to JSON. * @function toJSON * @memberof CMsgGCStorePurchaseInit * @instance * @returns {Object.<string,*>} JSON object */ CMsgGCStorePurchaseInit.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CMsgGCStorePurchaseInit * @function getTypeUrl * @memberof CMsgGCStorePurchaseInit * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CMsgGCStorePurchaseInit.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/CMsgGCStorePurchaseInit"; }; return CMsgGCStorePurchaseInit; })(); $root.CMsgGCStorePurchaseInitResponse = (function() { /** * Properties of a CMsgGCStorePurchaseInitResponse. * @exports ICMsgGCStorePurchaseInitResponse * @interface ICMsgGCStorePurchaseInitResponse * @property {number|null} [result] CMsgGCStorePurchaseInitResponse result * @property {number|Long|null} [txn_id] CMsgGCStorePurchaseInitResponse txn_id * @property {string|null} [url] CMsgGCStorePurchaseInitResponse url * @property {Array.<number|Long>|null} [item_ids] CMsgGCStorePurchaseInitResponse item_ids */ /** * Constructs a new CMsgGCStorePurchaseInitResponse. * @exports CMsgGCStorePurchaseInitResponse * @classdesc Represents a CMsgGCStorePurchaseInitResponse. * @implements ICMsgGCStorePurchaseInitResponse * @constructor * @param {ICMsgGCStorePurchaseInitResponse=} [properties] Properties to set */ function CMsgGCStorePurchaseInitResponse(properties) { this.item_ids = []; 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]]; } /** * CMsgGCStorePurchaseInitResponse result. * @member {number} result * @memberof CMsgGCStorePurchaseInitResponse * @instance */ CMsgGCStorePurchaseInitResponse.prototype.result = 0; /** * CMsgGCStorePurchaseInitResponse txn_id. * @member {number|Long} txn_id * @memberof CMsgGCStorePurchaseInitResponse * @instance */ CMsgGCStorePurchaseInitResponse.prototype.txn_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * CMsgGCStorePurchaseInitResponse url. * @member {string} url * @memberof CMsgGCStorePurchaseInitResponse * @instance */ CMsgGCStorePurchaseInitResponse.prototype.url = ""; /** * CMsgGCStorePurchaseInitResponse item_ids. * @member {Array.<number|Long>} item_ids * @memberof CMsgGCStorePurchaseInitResponse * @instance */ CMsgGCStorePurchaseInitResponse.prototype.item_ids = $util.emptyArray; /** * Creates a new CMsgGCStorePurchaseInitResponse instance using the specified properties. * @function create * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {ICMsgGCStorePurchaseInitResponse=} [properties] Properties to set * @returns {CMsgGCStorePurchaseInitResponse} CMsgGCStorePurchaseInitResponse instance */ CMsgGCStorePurchaseInitResponse.create = function create(properties) { return new CMsgGCStorePurchaseInitResponse(properties); }; /** * Encodes the specified CMsgGCStorePurchaseInitResponse message. Does not implicitly {@link CMsgGCStorePurchaseInitResponse.verify|verify} messages. * @function encode * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {ICMsgGCStorePurchaseInitResponse} message CMsgGCStorePurchaseInitResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgGCStorePurchaseInitResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.result != null && Object.hasOwnProperty.call(message, "result")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); if (message.txn_id != null && Object.hasOwnProperty.call(message, "txn_id")) writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.txn_id); if (message.url != null && Object.hasOwnProperty.call(message, "url")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.url); if (message.item_ids != null && message.item_ids.length) for (var i = 0; i < message.item_ids.length; ++i) writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.item_ids[i]); return writer; }; /** * Encodes the specified CMsgGCStorePurchaseInitResponse message, length delimited. Does not implicitly {@link CMsgGCStorePurchaseInitResponse.verify|verify} messages. * @function encodeDelimited * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {ICMsgGCStorePurchaseInitResponse} message CMsgGCStorePurchaseInitResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CMsgGCStorePurchaseInitResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CMsgGCStorePurchaseInitResponse message from the specified reader or buffer. * @function decode * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {CMsgGCStorePurchaseInitResponse} CMsgGCStorePurchaseInitResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgGCStorePurchaseInitResponse.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.CMsgGCStorePurchaseInitResponse(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.result = reader.int32(); break; } case 2: { message.txn_id = reader.uint64(); break; } case 3: { message.url = reader.string(); break; } case 4: { if (!(message.item_ids && message.item_ids.length)) message.item_ids = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) message.item_ids.push(reader.uint64()); } else message.item_ids.push(reader.uint64()); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CMsgGCStorePurchaseInitResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {CMsgGCStorePurchaseInitResponse} CMsgGCStorePurchaseInitResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CMsgGCStorePurchaseInitResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CMsgGCStorePurchaseInitResponse message. * @function verify * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CMsgGCStorePurchaseInitResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.result != null && message.hasOwnProperty("result")) if (!$util.isInteger(message.result)) return "result: integer expected"; if (message.txn_id != null && message.hasOwnProperty("txn_id")) if (!$util.isInteger(message.txn_id) && !(message.txn_id && $util.isInteger(message.txn_id.low) && $util.isInteger(message.txn_id.high))) return "txn_id: integer|Long expected"; if (message.url != null && message.hasOwnProperty("url")) if (!$util.isString(message.url)) return "url: string expected"; if (message.item_ids != null && message.hasOwnProperty("item_ids")) { if (!Array.isArray(message.item_ids)) return "item_ids: array expected"; for (var i = 0; i < message.item_ids.length; ++i) if (!$util.isInteger(message.item_ids[i]) && !(message.item_ids[i] && $util.isInteger(message.item_ids[i].low) && $util.isInteger(message.item_ids[i].high))) return "item_ids: integer|Long[] expected"; } return null; }; /** * Creates a CMsgGCStorePurchaseInitResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {Object.<string,*>} object Plain object * @returns {CMsgGCStorePurchaseInitResponse} CMsgGCStorePurchaseInitResponse */ CMsgGCStorePurchaseInitResponse.fromObject = function fromObject(object) { if (object instanceof $root.CMsgGCStorePurchaseInitResponse) return object; var message = new $root.CMsgGCStorePurchaseInitResponse(); if (object.result != null) message.result = object.result | 0; if (object.txn_id != null) if ($util.Long) (message.txn_id = $util.Long.fromValue(object.txn_id)).unsigned = true; else if (typeof object.txn_id === "string") message.txn_id = parseInt(object.txn_id, 10); else if (typeof object.txn_id === "number") message.txn_id = object.txn_id; else if (typeof object.txn_id === "object") message.txn_id = new $util.LongBits(object.txn_id.low >>> 0, object.txn_id.high >>> 0).toNumber(true); if (object.url != null) message.url = String(object.url); if (object.item_ids) { if (!Array.isArray(object.item_ids)) throw TypeError(".CMsgGCStorePurchaseInitResponse.item_ids: array expected"); message.item_ids = []; for (var i = 0; i < object.item_ids.length; ++i) if ($util.Long) (message.item_ids[i] = $util.Long.fromValue(object.item_ids[i])).unsigned = true; else if (typeof object.item_ids[i] === "string") message.item_ids[i] = parseInt(object.item_ids[i], 10); else if (typeof object.item_ids[i] === "number") message.item_ids[i] = object.item_ids[i]; else if (typeof object.item_ids[i] === "object") message.item_ids[i] = new $util.LongBits(object.item_ids[i].low >>> 0, object.item_ids[i].high >>> 0).toNumber(true); } return message; }; /** * Creates a plain object from a CMsgGCStorePurchaseInitResponse message. Also converts values to other types if specified. * @function toObject * @memberof CMsgGCStorePurchaseInitResponse * @static * @param {CMsgGCStorePurchaseInitResponse} message CMsgGCStorePurchaseInitResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CMsgGCStorePurchaseInitResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.item_ids = []; if (options.defaults) { object.result = 0; if ($util.Long) { var long = new $util.Long(0, 0, true); object.txn_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.txn_id = options.longs === String ? "0" : 0; object.url = ""; } if (message.result != null && message.hasOwnProperty("result")) object.result = message.result; if (message.txn_id != null && message.hasOwnProperty("txn_id")) if (typeof message.txn_id === "number") object.txn_id = options.longs === String ? String(message.txn_id) : message.txn_id; else object.txn_id = options.longs === String ? $util.Long.prototype.toString.call(message.txn_id) : options.longs === Number ? new $util.LongBits(message.txn_id.low >>> 0, message.txn_id.high >>> 0).toNumber(true) : message.txn_id; if (message.url != null && message.hasOwnProperty("url")) object.url = message.url; if (message.item_ids && message.item_ids.length) { object.item_ids = []; for (var j = 0; j < message.item_ids.length; ++j) if (typeof message.item_ids[j] === "number") object.item_ids[j] = options.longs === String ? String(message.item_ids[j]) : message.item_ids[j]; else object.item_ids[j] = options.longs === String ? $util.Long.prototype.toString.call(message.item_ids[j]) : options.longs === Number ? new $util.LongBits(message.item_ids[j].low >>> 0, message.item_ids[j].high >>> 0).toNumber(true) : message.item_ids[j]; } return object; }; /** * Converts this CMsgGCStorePurchaseInitResponse to JSON. * @function toJSON * @memberof CMsgGCStorePurchaseInitResponse * @instance * @return