/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ "use strict"; var $protobuf = require("protobufjs/minimal"); // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); /** * ChatType enum. * @exports ChatType * @enum {number} * @property {number} CT_Unknown=0 CT_Unknown value * @property {number} CT_Private=1 CT_Private value * @property {number} CT_World=2 CT_World value * @property {number} CT_Marquee=3 CT_Marquee value */ $root.ChatType = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "CT_Unknown"] = 0; values[valuesById[1] = "CT_Private"] = 1; values[valuesById[2] = "CT_World"] = 2; values[valuesById[3] = "CT_Marquee"] = 3; return values; })(); $root.ReqChat = (function() { /** * Properties of a ReqChat. * @exports IReqChat * @interface IReqChat * @property {IChatUser|null} [srcUser] ReqChat srcUser * @property {IChatUser|null} [dstUser] ReqChat dstUser * @property {ChatType|null} [type] ReqChat type * @property {ServiceTypeId|null} [gameId] ReqChat gameId * @property {string|null} [content] ReqChat content */ /** * Constructs a new ReqChat. * @exports ReqChat * @classdesc Represents a ReqChat. * @implements IReqChat * @constructor * @param {IReqChat=} [properties] Properties to set */ function ReqChat(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]]; } /** * ReqChat srcUser. * @member {IChatUser|null|undefined} srcUser * @memberof ReqChat * @instance */ ReqChat.prototype.srcUser = null; /** * ReqChat dstUser. * @member {IChatUser|null|undefined} dstUser * @memberof ReqChat * @instance */ ReqChat.prototype.dstUser = null; /** * ReqChat type. * @member {ChatType} type * @memberof ReqChat * @instance */ ReqChat.prototype.type = 0; /** * ReqChat gameId. * @member {ServiceTypeId} gameId * @memberof ReqChat * @instance */ ReqChat.prototype.gameId = 0; /** * ReqChat content. * @member {string} content * @memberof ReqChat * @instance */ ReqChat.prototype.content = ""; /** * Creates a new ReqChat instance using the specified properties. * @function create * @memberof ReqChat * @static * @param {IReqChat=} [properties] Properties to set * @returns {ReqChat} ReqChat instance */ ReqChat.create = function create(properties) { return new ReqChat(properties); }; /** * Encodes the specified ReqChat message. Does not implicitly {@link ReqChat.verify|verify} messages. * @function encode * @memberof ReqChat * @static * @param {IReqChat} message ReqChat message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ReqChat.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.srcUser != null && Object.hasOwnProperty.call(message, "srcUser")) $root.ChatUser.encode(message.srcUser, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.dstUser != null && Object.hasOwnProperty.call(message, "dstUser")) $root.ChatUser.encode(message.dstUser, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); if (message.gameId != null && Object.hasOwnProperty.call(message, "gameId")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.gameId); if (message.content != null && Object.hasOwnProperty.call(message, "content")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.content); return writer; }; /** * Encodes the specified ReqChat message, length delimited. Does not implicitly {@link ReqChat.verify|verify} messages. * @function encodeDelimited * @memberof ReqChat * @static * @param {IReqChat} message ReqChat message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ReqChat.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ReqChat message from the specified reader or buffer. * @function decode * @memberof ReqChat * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {ReqChat} ReqChat * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ReqChat.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.ReqChat(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.srcUser = $root.ChatUser.decode(reader, reader.uint32()); break; } case 2: { message.dstUser = $root.ChatUser.decode(reader, reader.uint32()); break; } case 3: { message.type = reader.int32(); break; } case 4: { message.gameId = reader.int32(); break; } case 5: { message.content = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ReqChat message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof ReqChat * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {ReqChat} ReqChat * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ReqChat.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ReqChat message. * @function verify * @memberof ReqChat * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ReqChat.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.srcUser != null && message.hasOwnProperty("srcUser")) { var error = $root.ChatUser.verify(message.srcUser); if (error) return "srcUser." + error; } if (message.dstUser != null && message.hasOwnProperty("dstUser")) { var error = $root.ChatUser.verify(message.dstUser); if (error) return "dstUser." + error; } if (message.type != null && message.hasOwnProperty("type")) switch (message.type) { default: return "type: enum value expected"; case 0: case 1: case 2: case 3: break; } if (message.gameId != null && message.hasOwnProperty("gameId")) switch (message.gameId) { default: return "gameId: enum value expected"; case 0: case 10000: case 10005: case 10010: case 10015: case 10020: case 20000: case 20005: case 30000: break; } if (message.content != null && message.hasOwnProperty("content")) if (!$util.isString(message.content)) return "content: string expected"; return null; }; /** * Creates a ReqChat message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof ReqChat * @static * @param {Object.} object Plain object * @returns {ReqChat} ReqChat */ ReqChat.fromObject = function fromObject(object) { if (object instanceof $root.ReqChat) return object; var message = new $root.ReqChat(); if (object.srcUser != null) { if (typeof object.srcUser !== "object") throw TypeError(".ReqChat.srcUser: object expected"); message.srcUser = $root.ChatUser.fromObject(object.srcUser); } if (object.dstUser != null) { if (typeof object.dstUser !== "object") throw TypeError(".ReqChat.dstUser: object expected"); message.dstUser = $root.ChatUser.fromObject(object.dstUser); } switch (object.type) { default: if (typeof object.type === "number") { message.type = object.type; break; } break; case "CT_Unknown": case 0: message.type = 0; break; case "CT_Private": case 1: message.type = 1; break; case "CT_World": case 2: message.type = 2; break; case "CT_Marquee": case 3: message.type = 3; break; } switch (object.gameId) { default: if (typeof object.gameId === "number") { message.gameId = object.gameId; break; } break; case "STI_Unknown": case 0: message.gameId = 0; break; case "STI_Login": case 10000: message.gameId = 10000; break; case "STI_Chat": case 10005: message.gameId = 10005; break; case "STI_Match": case 10010: message.gameId = 10010; break; case "STI_Lobby": case 10015: message.gameId = 10015; break; case "STI_Admin": case 10020: message.gameId = 10020; break; case "STI_Gate": case 20000: message.gameId = 20000; break; case "STI_ColorGame": case 20005: message.gameId = 20005; break; case "STI_DB": case 30000: message.gameId = 30000; break; } if (object.content != null) message.content = String(object.content); return message; }; /** * Creates a plain object from a ReqChat message. Also converts values to other types if specified. * @function toObject * @memberof ReqChat * @static * @param {ReqChat} message ReqChat * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ ReqChat.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.srcUser = null; object.dstUser = null; object.type = options.enums === String ? "CT_Unknown" : 0; object.gameId = options.enums === String ? "STI_Unknown" : 0; object.content = ""; } if (message.srcUser != null && message.hasOwnProperty("srcUser")) object.srcUser = $root.ChatUser.toObject(message.srcUser, options); if (message.dstUser != null && message.hasOwnProperty("dstUser")) object.dstUser = $root.ChatUser.toObject(message.dstUser, options); if (message.type != null && message.hasOwnProperty("type")) object.type = options.enums === String ? $root.ChatType[message.type] === undefined ? message.type : $root.ChatType[message.type] : message.type; if (message.gameId != null && message.hasOwnProperty("gameId")) object.gameId = options.enums === String ? $root.ServiceTypeId[message.gameId] === undefined ? message.gameId : $root.ServiceTypeId[message.gameId] : message.gameId; if (message.content != null && message.hasOwnProperty("content")) object.content = message.content; return object; }; /** * Converts this ReqChat to JSON. * @function toJSON * @memberof ReqChat * @instance * @returns {Object.} JSON object */ ReqChat.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for ReqChat * @function getTypeUrl * @memberof ReqChat * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ ReqChat.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/ReqChat"; }; return ReqChat; })(); $root.ChatUser = (function() { /** * Properties of a ChatUser. * @exports IChatUser * @interface IChatUser * @property {Long|null} [userId] ChatUser userId * @property {string|null} [nickname] ChatUser nickname * @property {string|null} [avatar] ChatUser avatar * @property {string|null} [avatarFrame] ChatUser avatarFrame * @property {string|null} [vipLevel] ChatUser vipLevel */ /** * Constructs a new ChatUser. * @exports ChatUser * @classdesc Represents a ChatUser. * @implements IChatUser * @constructor * @param {IChatUser=} [properties] Properties to set */ function ChatUser(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]]; } /** * ChatUser userId. * @member {Long} userId * @memberof ChatUser * @instance */ ChatUser.prototype.userId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * ChatUser nickname. * @member {string} nickname * @memberof ChatUser * @instance */ ChatUser.prototype.nickname = ""; /** * ChatUser avatar. * @member {string} avatar * @memberof ChatUser * @instance */ ChatUser.prototype.avatar = ""; /** * ChatUser avatarFrame. * @member {string} avatarFrame * @memberof ChatUser * @instance */ ChatUser.prototype.avatarFrame = ""; /** * ChatUser vipLevel. * @member {string} vipLevel * @memberof ChatUser * @instance */ ChatUser.prototype.vipLevel = ""; /** * Creates a new ChatUser instance using the specified properties. * @function create * @memberof ChatUser * @static * @param {IChatUser=} [properties] Properties to set * @returns {ChatUser} ChatUser instance */ ChatUser.create = function create(properties) { return new ChatUser(properties); }; /** * Encodes the specified ChatUser message. Does not implicitly {@link ChatUser.verify|verify} messages. * @function encode * @memberof ChatUser * @static * @param {IChatUser} message ChatUser message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ChatUser.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.userId); if (message.nickname != null && Object.hasOwnProperty.call(message, "nickname")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nickname); if (message.avatar != null && Object.hasOwnProperty.call(message, "avatar")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.avatar); if (message.avatarFrame != null && Object.hasOwnProperty.call(message, "avatarFrame")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.avatarFrame); if (message.vipLevel != null && Object.hasOwnProperty.call(message, "vipLevel")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.vipLevel); return writer; }; /** * Encodes the specified ChatUser message, length delimited. Does not implicitly {@link ChatUser.verify|verify} messages. * @function encodeDelimited * @memberof ChatUser * @static * @param {IChatUser} message ChatUser message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ChatUser.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ChatUser message from the specified reader or buffer. * @function decode * @memberof ChatUser * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {ChatUser} ChatUser * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ChatUser.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.ChatUser(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.userId = reader.int64(); break; } case 2: { message.nickname = reader.string(); break; } case 3: { message.avatar = reader.string(); break; } case 4: { message.avatarFrame = reader.string(); break; } case 5: { message.vipLevel = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ChatUser message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof ChatUser * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {ChatUser} ChatUser * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ChatUser.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ChatUser message. * @function verify * @memberof ChatUser * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ChatUser.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.userId != null && message.hasOwnProperty("userId")) if (!$util.isInteger(message.userId) && !(message.userId && $util.isInteger(message.userId.low) && $util.isInteger(message.userId.high))) return "userId: integer|Long expected"; if (message.nickname != null && message.hasOwnProperty("nickname")) if (!$util.isString(message.nickname)) return "nickname: string expected"; if (message.avatar != null && message.hasOwnProperty("avatar")) if (!$util.isString(message.avatar)) return "avatar: string expected"; if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame")) if (!$util.isString(message.avatarFrame)) return "avatarFrame: string expected"; if (message.vipLevel != null && message.hasOwnProperty("vipLevel")) if (!$util.isString(message.vipLevel)) return "vipLevel: string expected"; return null; }; /** * Creates a ChatUser message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof ChatUser * @static * @param {Object.} object Plain object * @returns {ChatUser} ChatUser */ ChatUser.fromObject = function fromObject(object) { if (object instanceof $root.ChatUser) return object; var message = new $root.ChatUser(); if (object.userId != null) if ($util.Long) (message.userId = $util.Long.fromValue(object.userId)).unsigned = false; else if (typeof object.userId === "string") message.userId = parseInt(object.userId, 10); else if (typeof object.userId === "number") message.userId = object.userId; else if (typeof object.userId === "object") message.userId = new $util.LongBits(object.userId.low >>> 0, object.userId.high >>> 0).toNumber(); if (object.nickname != null) message.nickname = String(object.nickname); if (object.avatar != null) message.avatar = String(object.avatar); if (object.avatarFrame != null) message.avatarFrame = String(object.avatarFrame); if (object.vipLevel != null) message.vipLevel = String(object.vipLevel); return message; }; /** * Creates a plain object from a ChatUser message. Also converts values to other types if specified. * @function toObject * @memberof ChatUser * @static * @param {ChatUser} message ChatUser * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ ChatUser.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); object.userId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.userId = options.longs === String ? "0" : 0; object.nickname = ""; object.avatar = ""; object.avatarFrame = ""; object.vipLevel = ""; } if (message.userId != null && message.hasOwnProperty("userId")) if (typeof message.userId === "number") object.userId = options.longs === String ? String(message.userId) : message.userId; else object.userId = options.longs === String ? $util.Long.prototype.toString.call(message.userId) : options.longs === Number ? new $util.LongBits(message.userId.low >>> 0, message.userId.high >>> 0).toNumber() : message.userId; if (message.nickname != null && message.hasOwnProperty("nickname")) object.nickname = message.nickname; if (message.avatar != null && message.hasOwnProperty("avatar")) object.avatar = message.avatar; if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame")) object.avatarFrame = message.avatarFrame; if (message.vipLevel != null && message.hasOwnProperty("vipLevel")) object.vipLevel = message.vipLevel; return object; }; /** * Converts this ChatUser to JSON. * @function toJSON * @memberof ChatUser * @instance * @returns {Object.} JSON object */ ChatUser.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for ChatUser * @function getTypeUrl * @memberof ChatUser * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ ChatUser.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/ChatUser"; }; return ChatUser; })(); $root.GameUser = (function() { /** * Properties of a GameUser. * @exports IGameUser * @interface IGameUser * @property {Long|null} [userId] GameUser userId * @property {string|null} [nickname] GameUser nickname * @property {string|null} [avatar] GameUser avatar * @property {string|null} [avatarFrame] GameUser avatarFrame * @property {number|null} [vipLevel] GameUser vipLevel * @property {number|null} [vipExp] GameUser vipExp * @property {Long|null} [seat] GameUser seat * @property {Long|null} [gold] GameUser gold */ /** * Constructs a new GameUser. * @exports GameUser * @classdesc Represents a GameUser. * @implements IGameUser * @constructor * @param {IGameUser=} [properties] Properties to set */ function GameUser(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]]; } /** * GameUser userId. * @member {Long} userId * @memberof GameUser * @instance */ GameUser.prototype.userId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * GameUser nickname. * @member {string} nickname * @memberof GameUser * @instance */ GameUser.prototype.nickname = ""; /** * GameUser avatar. * @member {string} avatar * @memberof GameUser * @instance */ GameUser.prototype.avatar = ""; /** * GameUser avatarFrame. * @member {string} avatarFrame * @memberof GameUser * @instance */ GameUser.prototype.avatarFrame = ""; /** * GameUser vipLevel. * @member {number} vipLevel * @memberof GameUser * @instance */ GameUser.prototype.vipLevel = 0; /** * GameUser vipExp. * @member {number} vipExp * @memberof GameUser * @instance */ GameUser.prototype.vipExp = 0; /** * GameUser seat. * @member {Long} seat * @memberof GameUser * @instance */ GameUser.prototype.seat = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * GameUser gold. * @member {Long} gold * @memberof GameUser * @instance */ GameUser.prototype.gold = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * Creates a new GameUser instance using the specified properties. * @function create * @memberof GameUser * @static * @param {IGameUser=} [properties] Properties to set * @returns {GameUser} GameUser instance */ GameUser.create = function create(properties) { return new GameUser(properties); }; /** * Encodes the specified GameUser message. Does not implicitly {@link GameUser.verify|verify} messages. * @function encode * @memberof GameUser * @static * @param {IGameUser} message GameUser message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GameUser.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.userId); if (message.nickname != null && Object.hasOwnProperty.call(message, "nickname")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nickname); if (message.avatar != null && Object.hasOwnProperty.call(message, "avatar")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.avatar); if (message.avatarFrame != null && Object.hasOwnProperty.call(message, "avatarFrame")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.avatarFrame); if (message.vipLevel != null && Object.hasOwnProperty.call(message, "vipLevel")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.vipLevel); if (message.vipExp != null && Object.hasOwnProperty.call(message, "vipExp")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.vipExp); if (message.seat != null && Object.hasOwnProperty.call(message, "seat")) writer.uint32(/* id 20, wireType 0 =*/160).int64(message.seat); if (message.gold != null && Object.hasOwnProperty.call(message, "gold")) writer.uint32(/* id 25, wireType 0 =*/200).int64(message.gold); return writer; }; /** * Encodes the specified GameUser message, length delimited. Does not implicitly {@link GameUser.verify|verify} messages. * @function encodeDelimited * @memberof GameUser * @static * @param {IGameUser} message GameUser message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GameUser.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GameUser message from the specified reader or buffer. * @function decode * @memberof GameUser * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GameUser} GameUser * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GameUser.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.GameUser(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { message.userId = reader.int64(); break; } case 2: { message.nickname = reader.string(); break; } case 3: { message.avatar = reader.string(); break; } case 4: { message.avatarFrame = reader.string(); break; } case 5: { message.vipLevel = reader.int32(); break; } case 6: { message.vipExp = reader.int32(); break; } case 20: { message.seat = reader.int64(); break; } case 25: { message.gold = reader.int64(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GameUser message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GameUser * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GameUser} GameUser * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GameUser.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GameUser message. * @function verify * @memberof GameUser * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GameUser.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.userId != null && message.hasOwnProperty("userId")) if (!$util.isInteger(message.userId) && !(message.userId && $util.isInteger(message.userId.low) && $util.isInteger(message.userId.high))) return "userId: integer|Long expected"; if (message.nickname != null && message.hasOwnProperty("nickname")) if (!$util.isString(message.nickname)) return "nickname: string expected"; if (message.avatar != null && message.hasOwnProperty("avatar")) if (!$util.isString(message.avatar)) return "avatar: string expected"; if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame")) if (!$util.isString(message.avatarFrame)) return "avatarFrame: string expected"; if (message.vipLevel != null && message.hasOwnProperty("vipLevel")) if (!$util.isInteger(message.vipLevel)) return "vipLevel: integer expected"; if (message.vipExp != null && message.hasOwnProperty("vipExp")) if (!$util.isInteger(message.vipExp)) return "vipExp: integer expected"; if (message.seat != null && message.hasOwnProperty("seat")) if (!$util.isInteger(message.seat) && !(message.seat && $util.isInteger(message.seat.low) && $util.isInteger(message.seat.high))) return "seat: integer|Long expected"; if (message.gold != null && message.hasOwnProperty("gold")) if (!$util.isInteger(message.gold) && !(message.gold && $util.isInteger(message.gold.low) && $util.isInteger(message.gold.high))) return "gold: integer|Long expected"; return null; }; /** * Creates a GameUser message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GameUser * @static * @param {Object.} object Plain object * @returns {GameUser} GameUser */ GameUser.fromObject = function fromObject(object) { if (object instanceof $root.GameUser) return object; var message = new $root.GameUser(); if (object.userId != null) if ($util.Long) (message.userId = $util.Long.fromValue(object.userId)).unsigned = false; else if (typeof object.userId === "string") message.userId = parseInt(object.userId, 10); else if (typeof object.userId === "number") message.userId = object.userId; else if (typeof object.userId === "object") message.userId = new $util.LongBits(object.userId.low >>> 0, object.userId.high >>> 0).toNumber(); if (object.nickname != null) message.nickname = String(object.nickname); if (object.avatar != null) message.avatar = String(object.avatar); if (object.avatarFrame != null) message.avatarFrame = String(object.avatarFrame); if (object.vipLevel != null) message.vipLevel = object.vipLevel | 0; if (object.vipExp != null) message.vipExp = object.vipExp | 0; if (object.seat != null) if ($util.Long) (message.seat = $util.Long.fromValue(object.seat)).unsigned = false; else if (typeof object.seat === "string") message.seat = parseInt(object.seat, 10); else if (typeof object.seat === "number") message.seat = object.seat; else if (typeof object.seat === "object") message.seat = new $util.LongBits(object.seat.low >>> 0, object.seat.high >>> 0).toNumber(); if (object.gold != null) if ($util.Long) (message.gold = $util.Long.fromValue(object.gold)).unsigned = false; else if (typeof object.gold === "string") message.gold = parseInt(object.gold, 10); else if (typeof object.gold === "number") message.gold = object.gold; else if (typeof object.gold === "object") message.gold = new $util.LongBits(object.gold.low >>> 0, object.gold.high >>> 0).toNumber(); return message; }; /** * Creates a plain object from a GameUser message. Also converts values to other types if specified. * @function toObject * @memberof GameUser * @static * @param {GameUser} message GameUser * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ GameUser.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); object.userId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.userId = options.longs === String ? "0" : 0; object.nickname = ""; object.avatar = ""; object.avatarFrame = ""; object.vipLevel = 0; object.vipExp = 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.seat = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.seat = options.longs === String ? "0" : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); object.gold = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.gold = options.longs === String ? "0" : 0; } if (message.userId != null && message.hasOwnProperty("userId")) if (typeof message.userId === "number") object.userId = options.longs === String ? String(message.userId) : message.userId; else object.userId = options.longs === String ? $util.Long.prototype.toString.call(message.userId) : options.longs === Number ? new $util.LongBits(message.userId.low >>> 0, message.userId.high >>> 0).toNumber() : message.userId; if (message.nickname != null && message.hasOwnProperty("nickname")) object.nickname = message.nickname; if (message.avatar != null && message.hasOwnProperty("avatar")) object.avatar = message.avatar; if (message.avatarFrame != null && message.hasOwnProperty("avatarFrame")) object.avatarFrame = message.avatarFrame; if (message.vipLevel != null && message.hasOwnProperty("vipLevel")) object.vipLevel = message.vipLevel; if (message.vipExp != null && message.hasOwnProperty("vipExp")) object.vipExp = message.vipExp; if (message.seat != null && message.hasOwnProperty("seat")) if (typeof message.seat === "number") object.seat = options.longs === String ? String(message.seat) : message.seat; else object.seat = options.longs === String ? $util.Long.prototype.toString.call(message.seat) : options.longs === Number ? new $util.LongBits(message.seat.low >>> 0, message.seat.high >>> 0).toNumber() : message.seat; if (message.gold != null && message.hasOwnProperty("gold")) if (typeof message.gold === "number") object.gold = options.longs === String ? String(message.gold) : message.gold; else object.gold = options.longs === String ? $util.Long.prototype.toString.call(message.gold) : options.longs === Number ? new $util.LongBits(message.gold.low >>> 0, message.gold.high >>> 0).toNumber() : message.gold; return object; }; /** * Converts this GameUser to JSON. * @function toJSON * @memberof GameUser * @instance * @returns {Object.} JSON object */ GameUser.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for GameUser * @function getTypeUrl * @memberof GameUser * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ GameUser.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/GameUser"; }; return GameUser; })(); /** * ServiceTypeId enum. * @exports ServiceTypeId * @enum {number} * @property {number} STI_Unknown=0 STI_Unknown value * @property {number} STI_Login=10000 STI_Login value * @property {number} STI_Chat=10005 STI_Chat value * @property {number} STI_Match=10010 STI_Match value * @property {number} STI_Lobby=10015 STI_Lobby value * @property {number} STI_Admin=10020 STI_Admin value * @property {number} STI_Gate=20000 STI_Gate value * @property {number} STI_ColorGame=20005 STI_ColorGame value * @property {number} STI_DB=30000 STI_DB value */ $root.ServiceTypeId = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "STI_Unknown"] = 0; values[valuesById[10000] = "STI_Login"] = 10000; values[valuesById[10005] = "STI_Chat"] = 10005; values[valuesById[10010] = "STI_Match"] = 10010; values[valuesById[10015] = "STI_Lobby"] = 10015; values[valuesById[10020] = "STI_Admin"] = 10020; values[valuesById[20000] = "STI_Gate"] = 20000; values[valuesById[20005] = "STI_ColorGame"] = 20005; values[valuesById[30000] = "STI_DB"] = 30000; return values; })(); module.exports = $root;