Bundle.js 115 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281
  1. /*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/
  2. (function(global, factory) { /* global define, require, module */
  3. /* AMD */ if (typeof define === 'function' && define.amd)
  4. define(["protobufjs/minimal"], factory);
  5. /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
  6. module.exports = factory(require("protobufjs/minimal"));
  7. })(this, function($protobuf) {
  8. "use strict";
  9. // Common aliases
  10. var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
  11. // Exported root namespace
  12. var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
  13. $root.tutorial = (function() {
  14. /**
  15. * Namespace tutorial.
  16. * @exports tutorial
  17. * @namespace
  18. */
  19. var tutorial = {};
  20. tutorial.Message = (function() {
  21. /**
  22. * Properties of a Message.
  23. * @memberof tutorial
  24. * @interface IMessage
  25. * @property {tutorial.Message.Type|null} [type] Message type
  26. * @property {tutorial.Message.IDataMessage|null} [dataMessage] Message dataMessage
  27. * @property {tutorial.Message.INotificationMessage|null} [notificationMessage] Message notificationMessage
  28. * @property {tutorial.Message.IRoleOptMessage|null} [roleOptMessage] Message roleOptMessage
  29. * @property {tutorial.Message.IReportData|null} [reportData] Message reportData
  30. * @property {string|null} [msg] Message msg
  31. * @property {tutorial.Message.IBuildingItems|null} [buildingItems] Message buildingItems
  32. * @property {number|Long|null} [rUid] Message rUid
  33. */
  34. /**
  35. * Constructs a new Message.
  36. * @memberof tutorial
  37. * @classdesc Represents a Message.
  38. * @implements IMessage
  39. * @constructor
  40. * @param {tutorial.IMessage=} [properties] Properties to set
  41. */
  42. function Message(properties) {
  43. if (properties)
  44. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  45. if (properties[keys[i]] != null)
  46. this[keys[i]] = properties[keys[i]];
  47. }
  48. /**
  49. * Message type.
  50. * @member {tutorial.Message.Type} type
  51. * @memberof tutorial.Message
  52. * @instance
  53. */
  54. Message.prototype.type = 0;
  55. /**
  56. * Message dataMessage.
  57. * @member {tutorial.Message.IDataMessage|null|undefined} dataMessage
  58. * @memberof tutorial.Message
  59. * @instance
  60. */
  61. Message.prototype.dataMessage = null;
  62. /**
  63. * Message notificationMessage.
  64. * @member {tutorial.Message.INotificationMessage|null|undefined} notificationMessage
  65. * @memberof tutorial.Message
  66. * @instance
  67. */
  68. Message.prototype.notificationMessage = null;
  69. /**
  70. * Message roleOptMessage.
  71. * @member {tutorial.Message.IRoleOptMessage|null|undefined} roleOptMessage
  72. * @memberof tutorial.Message
  73. * @instance
  74. */
  75. Message.prototype.roleOptMessage = null;
  76. /**
  77. * Message reportData.
  78. * @member {tutorial.Message.IReportData|null|undefined} reportData
  79. * @memberof tutorial.Message
  80. * @instance
  81. */
  82. Message.prototype.reportData = null;
  83. /**
  84. * Message msg.
  85. * @member {string} msg
  86. * @memberof tutorial.Message
  87. * @instance
  88. */
  89. Message.prototype.msg = "";
  90. /**
  91. * Message buildingItems.
  92. * @member {tutorial.Message.IBuildingItems|null|undefined} buildingItems
  93. * @memberof tutorial.Message
  94. * @instance
  95. */
  96. Message.prototype.buildingItems = null;
  97. /**
  98. * Message rUid.
  99. * @member {number|Long} rUid
  100. * @memberof tutorial.Message
  101. * @instance
  102. */
  103. Message.prototype.rUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  104. /**
  105. * Creates a new Message instance using the specified properties.
  106. * @function create
  107. * @memberof tutorial.Message
  108. * @static
  109. * @param {tutorial.IMessage=} [properties] Properties to set
  110. * @returns {tutorial.Message} Message instance
  111. */
  112. Message.create = function create(properties) {
  113. return new Message(properties);
  114. };
  115. /**
  116. * Encodes the specified Message message. Does not implicitly {@link tutorial.Message.verify|verify} messages.
  117. * @function encode
  118. * @memberof tutorial.Message
  119. * @static
  120. * @param {tutorial.IMessage} message Message message or plain object to encode
  121. * @param {$protobuf.Writer} [writer] Writer to encode to
  122. * @returns {$protobuf.Writer} Writer
  123. */
  124. Message.encode = function encode(message, writer) {
  125. if (!writer)
  126. writer = $Writer.create();
  127. if (message.type != null && message.hasOwnProperty("type"))
  128. writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
  129. if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
  130. $root.tutorial.Message.DataMessage.encode(message.dataMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
  131. if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage"))
  132. $root.tutorial.Message.NotificationMessage.encode(message.notificationMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
  133. if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage"))
  134. $root.tutorial.Message.RoleOptMessage.encode(message.roleOptMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
  135. if (message.reportData != null && message.hasOwnProperty("reportData"))
  136. $root.tutorial.Message.ReportData.encode(message.reportData, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
  137. if (message.msg != null && message.hasOwnProperty("msg"))
  138. writer.uint32(/* id 6, wireType 2 =*/50).string(message.msg);
  139. if (message.buildingItems != null && message.hasOwnProperty("buildingItems"))
  140. $root.tutorial.Message.BuildingItems.encode(message.buildingItems, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
  141. if (message.rUid != null && message.hasOwnProperty("rUid"))
  142. writer.uint32(/* id 8, wireType 0 =*/64).int64(message.rUid);
  143. return writer;
  144. };
  145. /**
  146. * Encodes the specified Message message, length delimited. Does not implicitly {@link tutorial.Message.verify|verify} messages.
  147. * @function encodeDelimited
  148. * @memberof tutorial.Message
  149. * @static
  150. * @param {tutorial.IMessage} message Message message or plain object to encode
  151. * @param {$protobuf.Writer} [writer] Writer to encode to
  152. * @returns {$protobuf.Writer} Writer
  153. */
  154. Message.encodeDelimited = function encodeDelimited(message, writer) {
  155. return this.encode(message, writer).ldelim();
  156. };
  157. /**
  158. * Decodes a Message message from the specified reader or buffer.
  159. * @function decode
  160. * @memberof tutorial.Message
  161. * @static
  162. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  163. * @param {number} [length] Message length if known beforehand
  164. * @returns {tutorial.Message} Message
  165. * @throws {Error} If the payload is not a reader or valid buffer
  166. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  167. */
  168. Message.decode = function decode(reader, length) {
  169. if (!(reader instanceof $Reader))
  170. reader = $Reader.create(reader);
  171. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message();
  172. while (reader.pos < end) {
  173. var tag = reader.uint32();
  174. switch (tag >>> 3) {
  175. case 1:
  176. message.type = reader.int32();
  177. break;
  178. case 2:
  179. message.dataMessage = $root.tutorial.Message.DataMessage.decode(reader, reader.uint32());
  180. break;
  181. case 3:
  182. message.notificationMessage = $root.tutorial.Message.NotificationMessage.decode(reader, reader.uint32());
  183. break;
  184. case 4:
  185. message.roleOptMessage = $root.tutorial.Message.RoleOptMessage.decode(reader, reader.uint32());
  186. break;
  187. case 5:
  188. message.reportData = $root.tutorial.Message.ReportData.decode(reader, reader.uint32());
  189. break;
  190. case 6:
  191. message.msg = reader.string();
  192. break;
  193. case 7:
  194. message.buildingItems = $root.tutorial.Message.BuildingItems.decode(reader, reader.uint32());
  195. break;
  196. case 8:
  197. message.rUid = reader.int64();
  198. break;
  199. default:
  200. reader.skipType(tag & 7);
  201. break;
  202. }
  203. }
  204. return message;
  205. };
  206. /**
  207. * Decodes a Message message from the specified reader or buffer, length delimited.
  208. * @function decodeDelimited
  209. * @memberof tutorial.Message
  210. * @static
  211. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  212. * @returns {tutorial.Message} Message
  213. * @throws {Error} If the payload is not a reader or valid buffer
  214. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  215. */
  216. Message.decodeDelimited = function decodeDelimited(reader) {
  217. if (!(reader instanceof $Reader))
  218. reader = new $Reader(reader);
  219. return this.decode(reader, reader.uint32());
  220. };
  221. /**
  222. * Verifies a Message message.
  223. * @function verify
  224. * @memberof tutorial.Message
  225. * @static
  226. * @param {Object.<string,*>} message Plain object to verify
  227. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  228. */
  229. Message.verify = function verify(message) {
  230. if (typeof message !== "object" || message === null)
  231. return "object expected";
  232. if (message.type != null && message.hasOwnProperty("type"))
  233. switch (message.type) {
  234. default:
  235. return "type: enum value expected";
  236. case 0:
  237. case 1:
  238. case 2:
  239. case 3:
  240. case 4:
  241. case 5:
  242. case 6:
  243. break;
  244. }
  245. if (message.dataMessage != null && message.hasOwnProperty("dataMessage")) {
  246. var error = $root.tutorial.Message.DataMessage.verify(message.dataMessage);
  247. if (error)
  248. return "dataMessage." + error;
  249. }
  250. if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage")) {
  251. var error = $root.tutorial.Message.NotificationMessage.verify(message.notificationMessage);
  252. if (error)
  253. return "notificationMessage." + error;
  254. }
  255. if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage")) {
  256. var error = $root.tutorial.Message.RoleOptMessage.verify(message.roleOptMessage);
  257. if (error)
  258. return "roleOptMessage." + error;
  259. }
  260. if (message.reportData != null && message.hasOwnProperty("reportData")) {
  261. var error = $root.tutorial.Message.ReportData.verify(message.reportData);
  262. if (error)
  263. return "reportData." + error;
  264. }
  265. if (message.msg != null && message.hasOwnProperty("msg"))
  266. if (!$util.isString(message.msg))
  267. return "msg: string expected";
  268. if (message.buildingItems != null && message.hasOwnProperty("buildingItems")) {
  269. var error = $root.tutorial.Message.BuildingItems.verify(message.buildingItems);
  270. if (error)
  271. return "buildingItems." + error;
  272. }
  273. if (message.rUid != null && message.hasOwnProperty("rUid"))
  274. if (!$util.isInteger(message.rUid) && !(message.rUid && $util.isInteger(message.rUid.low) && $util.isInteger(message.rUid.high)))
  275. return "rUid: integer|Long expected";
  276. return null;
  277. };
  278. /**
  279. * Creates a Message message from a plain object. Also converts values to their respective internal types.
  280. * @function fromObject
  281. * @memberof tutorial.Message
  282. * @static
  283. * @param {Object.<string,*>} object Plain object
  284. * @returns {tutorial.Message} Message
  285. */
  286. Message.fromObject = function fromObject(object) {
  287. if (object instanceof $root.tutorial.Message)
  288. return object;
  289. var message = new $root.tutorial.Message();
  290. switch (object.type) {
  291. case "SELF":
  292. case 0:
  293. message.type = 0;
  294. break;
  295. case "DATA":
  296. case 1:
  297. message.type = 1;
  298. break;
  299. case "NOTIFY":
  300. case 2:
  301. message.type = 2;
  302. break;
  303. case "ROLEOPT":
  304. case 3:
  305. message.type = 3;
  306. break;
  307. case "REPORT":
  308. case 4:
  309. message.type = 4;
  310. break;
  311. case "BD_ITEM":
  312. case 5:
  313. message.type = 5;
  314. break;
  315. case "HB":
  316. case 6:
  317. message.type = 6;
  318. break;
  319. }
  320. if (object.dataMessage != null) {
  321. if (typeof object.dataMessage !== "object")
  322. throw TypeError(".tutorial.Message.dataMessage: object expected");
  323. message.dataMessage = $root.tutorial.Message.DataMessage.fromObject(object.dataMessage);
  324. }
  325. if (object.notificationMessage != null) {
  326. if (typeof object.notificationMessage !== "object")
  327. throw TypeError(".tutorial.Message.notificationMessage: object expected");
  328. message.notificationMessage = $root.tutorial.Message.NotificationMessage.fromObject(object.notificationMessage);
  329. }
  330. if (object.roleOptMessage != null) {
  331. if (typeof object.roleOptMessage !== "object")
  332. throw TypeError(".tutorial.Message.roleOptMessage: object expected");
  333. message.roleOptMessage = $root.tutorial.Message.RoleOptMessage.fromObject(object.roleOptMessage);
  334. }
  335. if (object.reportData != null) {
  336. if (typeof object.reportData !== "object")
  337. throw TypeError(".tutorial.Message.reportData: object expected");
  338. message.reportData = $root.tutorial.Message.ReportData.fromObject(object.reportData);
  339. }
  340. if (object.msg != null)
  341. message.msg = String(object.msg);
  342. if (object.buildingItems != null) {
  343. if (typeof object.buildingItems !== "object")
  344. throw TypeError(".tutorial.Message.buildingItems: object expected");
  345. message.buildingItems = $root.tutorial.Message.BuildingItems.fromObject(object.buildingItems);
  346. }
  347. if (object.rUid != null)
  348. if ($util.Long)
  349. (message.rUid = $util.Long.fromValue(object.rUid)).unsigned = false;
  350. else if (typeof object.rUid === "string")
  351. message.rUid = parseInt(object.rUid, 10);
  352. else if (typeof object.rUid === "number")
  353. message.rUid = object.rUid;
  354. else if (typeof object.rUid === "object")
  355. message.rUid = new $util.LongBits(object.rUid.low >>> 0, object.rUid.high >>> 0).toNumber();
  356. return message;
  357. };
  358. /**
  359. * Creates a plain object from a Message message. Also converts values to other types if specified.
  360. * @function toObject
  361. * @memberof tutorial.Message
  362. * @static
  363. * @param {tutorial.Message} message Message
  364. * @param {$protobuf.IConversionOptions} [options] Conversion options
  365. * @returns {Object.<string,*>} Plain object
  366. */
  367. Message.toObject = function toObject(message, options) {
  368. if (!options)
  369. options = {};
  370. var object = {};
  371. if (options.defaults) {
  372. object.type = options.enums === String ? "SELF" : 0;
  373. object.dataMessage = null;
  374. object.notificationMessage = null;
  375. object.roleOptMessage = null;
  376. object.reportData = null;
  377. object.msg = "";
  378. object.buildingItems = null;
  379. if ($util.Long) {
  380. var long = new $util.Long(0, 0, false);
  381. object.rUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  382. } else
  383. object.rUid = options.longs === String ? "0" : 0;
  384. }
  385. if (message.type != null && message.hasOwnProperty("type"))
  386. object.type = options.enums === String ? $root.tutorial.Message.Type[message.type] : message.type;
  387. if (message.dataMessage != null && message.hasOwnProperty("dataMessage"))
  388. object.dataMessage = $root.tutorial.Message.DataMessage.toObject(message.dataMessage, options);
  389. if (message.notificationMessage != null && message.hasOwnProperty("notificationMessage"))
  390. object.notificationMessage = $root.tutorial.Message.NotificationMessage.toObject(message.notificationMessage, options);
  391. if (message.roleOptMessage != null && message.hasOwnProperty("roleOptMessage"))
  392. object.roleOptMessage = $root.tutorial.Message.RoleOptMessage.toObject(message.roleOptMessage, options);
  393. if (message.reportData != null && message.hasOwnProperty("reportData"))
  394. object.reportData = $root.tutorial.Message.ReportData.toObject(message.reportData, options);
  395. if (message.msg != null && message.hasOwnProperty("msg"))
  396. object.msg = message.msg;
  397. if (message.buildingItems != null && message.hasOwnProperty("buildingItems"))
  398. object.buildingItems = $root.tutorial.Message.BuildingItems.toObject(message.buildingItems, options);
  399. if (message.rUid != null && message.hasOwnProperty("rUid"))
  400. if (typeof message.rUid === "number")
  401. object.rUid = options.longs === String ? String(message.rUid) : message.rUid;
  402. else
  403. object.rUid = options.longs === String ? $util.Long.prototype.toString.call(message.rUid) : options.longs === Number ? new $util.LongBits(message.rUid.low >>> 0, message.rUid.high >>> 0).toNumber() : message.rUid;
  404. return object;
  405. };
  406. /**
  407. * Converts this Message to JSON.
  408. * @function toJSON
  409. * @memberof tutorial.Message
  410. * @instance
  411. * @returns {Object.<string,*>} JSON object
  412. */
  413. Message.prototype.toJSON = function toJSON() {
  414. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  415. };
  416. /**
  417. * Type enum.
  418. * @name tutorial.Message.Type
  419. * @enum {string}
  420. * @property {number} SELF=0 SELF value
  421. * @property {number} DATA=1 DATA value
  422. * @property {number} NOTIFY=2 NOTIFY value
  423. * @property {number} ROLEOPT=3 ROLEOPT value
  424. * @property {number} REPORT=4 REPORT value
  425. * @property {number} BD_ITEM=5 BD_ITEM value
  426. * @property {number} HB=6 HB value
  427. */
  428. Message.Type = (function() {
  429. var valuesById = {}, values = Object.create(valuesById);
  430. values[valuesById[0] = "SELF"] = 0;
  431. values[valuesById[1] = "DATA"] = 1;
  432. values[valuesById[2] = "NOTIFY"] = 2;
  433. values[valuesById[3] = "ROLEOPT"] = 3;
  434. values[valuesById[4] = "REPORT"] = 4;
  435. values[valuesById[5] = "BD_ITEM"] = 5;
  436. values[valuesById[6] = "HB"] = 6;
  437. return values;
  438. })();
  439. Message.DataMessage = (function() {
  440. /**
  441. * Properties of a DataMessage.
  442. * @memberof tutorial.Message
  443. * @interface IDataMessage
  444. * @property {number|null} [code] DataMessage code
  445. * @property {number|null} [result] DataMessage result
  446. * @property {string|null} [data] DataMessage data
  447. * @property {string|null} [msg] DataMessage msg
  448. */
  449. /**
  450. * Constructs a new DataMessage.
  451. * @memberof tutorial.Message
  452. * @classdesc Represents a DataMessage.
  453. * @implements IDataMessage
  454. * @constructor
  455. * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
  456. */
  457. function DataMessage(properties) {
  458. if (properties)
  459. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  460. if (properties[keys[i]] != null)
  461. this[keys[i]] = properties[keys[i]];
  462. }
  463. /**
  464. * DataMessage code.
  465. * @member {number} code
  466. * @memberof tutorial.Message.DataMessage
  467. * @instance
  468. */
  469. DataMessage.prototype.code = 0;
  470. /**
  471. * DataMessage result.
  472. * @member {number} result
  473. * @memberof tutorial.Message.DataMessage
  474. * @instance
  475. */
  476. DataMessage.prototype.result = 0;
  477. /**
  478. * DataMessage data.
  479. * @member {string} data
  480. * @memberof tutorial.Message.DataMessage
  481. * @instance
  482. */
  483. DataMessage.prototype.data = "";
  484. /**
  485. * DataMessage msg.
  486. * @member {string} msg
  487. * @memberof tutorial.Message.DataMessage
  488. * @instance
  489. */
  490. DataMessage.prototype.msg = "";
  491. /**
  492. * Creates a new DataMessage instance using the specified properties.
  493. * @function create
  494. * @memberof tutorial.Message.DataMessage
  495. * @static
  496. * @param {tutorial.Message.IDataMessage=} [properties] Properties to set
  497. * @returns {tutorial.Message.DataMessage} DataMessage instance
  498. */
  499. DataMessage.create = function create(properties) {
  500. return new DataMessage(properties);
  501. };
  502. /**
  503. * Encodes the specified DataMessage message. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
  504. * @function encode
  505. * @memberof tutorial.Message.DataMessage
  506. * @static
  507. * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
  508. * @param {$protobuf.Writer} [writer] Writer to encode to
  509. * @returns {$protobuf.Writer} Writer
  510. */
  511. DataMessage.encode = function encode(message, writer) {
  512. if (!writer)
  513. writer = $Writer.create();
  514. if (message.code != null && message.hasOwnProperty("code"))
  515. writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code);
  516. if (message.result != null && message.hasOwnProperty("result"))
  517. writer.uint32(/* id 2, wireType 0 =*/16).int32(message.result);
  518. if (message.data != null && message.hasOwnProperty("data"))
  519. writer.uint32(/* id 3, wireType 2 =*/26).string(message.data);
  520. if (message.msg != null && message.hasOwnProperty("msg"))
  521. writer.uint32(/* id 4, wireType 2 =*/34).string(message.msg);
  522. return writer;
  523. };
  524. /**
  525. * Encodes the specified DataMessage message, length delimited. Does not implicitly {@link tutorial.Message.DataMessage.verify|verify} messages.
  526. * @function encodeDelimited
  527. * @memberof tutorial.Message.DataMessage
  528. * @static
  529. * @param {tutorial.Message.IDataMessage} message DataMessage message or plain object to encode
  530. * @param {$protobuf.Writer} [writer] Writer to encode to
  531. * @returns {$protobuf.Writer} Writer
  532. */
  533. DataMessage.encodeDelimited = function encodeDelimited(message, writer) {
  534. return this.encode(message, writer).ldelim();
  535. };
  536. /**
  537. * Decodes a DataMessage message from the specified reader or buffer.
  538. * @function decode
  539. * @memberof tutorial.Message.DataMessage
  540. * @static
  541. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  542. * @param {number} [length] Message length if known beforehand
  543. * @returns {tutorial.Message.DataMessage} DataMessage
  544. * @throws {Error} If the payload is not a reader or valid buffer
  545. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  546. */
  547. DataMessage.decode = function decode(reader, length) {
  548. if (!(reader instanceof $Reader))
  549. reader = $Reader.create(reader);
  550. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.DataMessage();
  551. while (reader.pos < end) {
  552. var tag = reader.uint32();
  553. switch (tag >>> 3) {
  554. case 1:
  555. message.code = reader.int32();
  556. break;
  557. case 2:
  558. message.result = reader.int32();
  559. break;
  560. case 3:
  561. message.data = reader.string();
  562. break;
  563. case 4:
  564. message.msg = reader.string();
  565. break;
  566. default:
  567. reader.skipType(tag & 7);
  568. break;
  569. }
  570. }
  571. return message;
  572. };
  573. /**
  574. * Decodes a DataMessage message from the specified reader or buffer, length delimited.
  575. * @function decodeDelimited
  576. * @memberof tutorial.Message.DataMessage
  577. * @static
  578. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  579. * @returns {tutorial.Message.DataMessage} DataMessage
  580. * @throws {Error} If the payload is not a reader or valid buffer
  581. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  582. */
  583. DataMessage.decodeDelimited = function decodeDelimited(reader) {
  584. if (!(reader instanceof $Reader))
  585. reader = new $Reader(reader);
  586. return this.decode(reader, reader.uint32());
  587. };
  588. /**
  589. * Verifies a DataMessage message.
  590. * @function verify
  591. * @memberof tutorial.Message.DataMessage
  592. * @static
  593. * @param {Object.<string,*>} message Plain object to verify
  594. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  595. */
  596. DataMessage.verify = function verify(message) {
  597. if (typeof message !== "object" || message === null)
  598. return "object expected";
  599. if (message.code != null && message.hasOwnProperty("code"))
  600. if (!$util.isInteger(message.code))
  601. return "code: integer expected";
  602. if (message.result != null && message.hasOwnProperty("result"))
  603. if (!$util.isInteger(message.result))
  604. return "result: integer expected";
  605. if (message.data != null && message.hasOwnProperty("data"))
  606. if (!$util.isString(message.data))
  607. return "data: string expected";
  608. if (message.msg != null && message.hasOwnProperty("msg"))
  609. if (!$util.isString(message.msg))
  610. return "msg: string expected";
  611. return null;
  612. };
  613. /**
  614. * Creates a DataMessage message from a plain object. Also converts values to their respective internal types.
  615. * @function fromObject
  616. * @memberof tutorial.Message.DataMessage
  617. * @static
  618. * @param {Object.<string,*>} object Plain object
  619. * @returns {tutorial.Message.DataMessage} DataMessage
  620. */
  621. DataMessage.fromObject = function fromObject(object) {
  622. if (object instanceof $root.tutorial.Message.DataMessage)
  623. return object;
  624. var message = new $root.tutorial.Message.DataMessage();
  625. if (object.code != null)
  626. message.code = object.code | 0;
  627. if (object.result != null)
  628. message.result = object.result | 0;
  629. if (object.data != null)
  630. message.data = String(object.data);
  631. if (object.msg != null)
  632. message.msg = String(object.msg);
  633. return message;
  634. };
  635. /**
  636. * Creates a plain object from a DataMessage message. Also converts values to other types if specified.
  637. * @function toObject
  638. * @memberof tutorial.Message.DataMessage
  639. * @static
  640. * @param {tutorial.Message.DataMessage} message DataMessage
  641. * @param {$protobuf.IConversionOptions} [options] Conversion options
  642. * @returns {Object.<string,*>} Plain object
  643. */
  644. DataMessage.toObject = function toObject(message, options) {
  645. if (!options)
  646. options = {};
  647. var object = {};
  648. if (options.defaults) {
  649. object.code = 0;
  650. object.result = 0;
  651. object.data = "";
  652. object.msg = "";
  653. }
  654. if (message.code != null && message.hasOwnProperty("code"))
  655. object.code = message.code;
  656. if (message.result != null && message.hasOwnProperty("result"))
  657. object.result = message.result;
  658. if (message.data != null && message.hasOwnProperty("data"))
  659. object.data = message.data;
  660. if (message.msg != null && message.hasOwnProperty("msg"))
  661. object.msg = message.msg;
  662. return object;
  663. };
  664. /**
  665. * Converts this DataMessage to JSON.
  666. * @function toJSON
  667. * @memberof tutorial.Message.DataMessage
  668. * @instance
  669. * @returns {Object.<string,*>} JSON object
  670. */
  671. DataMessage.prototype.toJSON = function toJSON() {
  672. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  673. };
  674. return DataMessage;
  675. })();
  676. Message.NotificationMessage = (function() {
  677. /**
  678. * Properties of a NotificationMessage.
  679. * @memberof tutorial.Message
  680. * @interface INotificationMessage
  681. * @property {number|null} [nType] NotificationMessage nType
  682. */
  683. /**
  684. * Constructs a new NotificationMessage.
  685. * @memberof tutorial.Message
  686. * @classdesc Represents a NotificationMessage.
  687. * @implements INotificationMessage
  688. * @constructor
  689. * @param {tutorial.Message.INotificationMessage=} [properties] Properties to set
  690. */
  691. function NotificationMessage(properties) {
  692. if (properties)
  693. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  694. if (properties[keys[i]] != null)
  695. this[keys[i]] = properties[keys[i]];
  696. }
  697. /**
  698. * NotificationMessage nType.
  699. * @member {number} nType
  700. * @memberof tutorial.Message.NotificationMessage
  701. * @instance
  702. */
  703. NotificationMessage.prototype.nType = 0;
  704. /**
  705. * Creates a new NotificationMessage instance using the specified properties.
  706. * @function create
  707. * @memberof tutorial.Message.NotificationMessage
  708. * @static
  709. * @param {tutorial.Message.INotificationMessage=} [properties] Properties to set
  710. * @returns {tutorial.Message.NotificationMessage} NotificationMessage instance
  711. */
  712. NotificationMessage.create = function create(properties) {
  713. return new NotificationMessage(properties);
  714. };
  715. /**
  716. * Encodes the specified NotificationMessage message. Does not implicitly {@link tutorial.Message.NotificationMessage.verify|verify} messages.
  717. * @function encode
  718. * @memberof tutorial.Message.NotificationMessage
  719. * @static
  720. * @param {tutorial.Message.INotificationMessage} message NotificationMessage message or plain object to encode
  721. * @param {$protobuf.Writer} [writer] Writer to encode to
  722. * @returns {$protobuf.Writer} Writer
  723. */
  724. NotificationMessage.encode = function encode(message, writer) {
  725. if (!writer)
  726. writer = $Writer.create();
  727. if (message.nType != null && message.hasOwnProperty("nType"))
  728. writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nType);
  729. return writer;
  730. };
  731. /**
  732. * Encodes the specified NotificationMessage message, length delimited. Does not implicitly {@link tutorial.Message.NotificationMessage.verify|verify} messages.
  733. * @function encodeDelimited
  734. * @memberof tutorial.Message.NotificationMessage
  735. * @static
  736. * @param {tutorial.Message.INotificationMessage} message NotificationMessage message or plain object to encode
  737. * @param {$protobuf.Writer} [writer] Writer to encode to
  738. * @returns {$protobuf.Writer} Writer
  739. */
  740. NotificationMessage.encodeDelimited = function encodeDelimited(message, writer) {
  741. return this.encode(message, writer).ldelim();
  742. };
  743. /**
  744. * Decodes a NotificationMessage message from the specified reader or buffer.
  745. * @function decode
  746. * @memberof tutorial.Message.NotificationMessage
  747. * @static
  748. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  749. * @param {number} [length] Message length if known beforehand
  750. * @returns {tutorial.Message.NotificationMessage} NotificationMessage
  751. * @throws {Error} If the payload is not a reader or valid buffer
  752. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  753. */
  754. NotificationMessage.decode = function decode(reader, length) {
  755. if (!(reader instanceof $Reader))
  756. reader = $Reader.create(reader);
  757. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.NotificationMessage();
  758. while (reader.pos < end) {
  759. var tag = reader.uint32();
  760. switch (tag >>> 3) {
  761. case 1:
  762. message.nType = reader.int32();
  763. break;
  764. default:
  765. reader.skipType(tag & 7);
  766. break;
  767. }
  768. }
  769. return message;
  770. };
  771. /**
  772. * Decodes a NotificationMessage message from the specified reader or buffer, length delimited.
  773. * @function decodeDelimited
  774. * @memberof tutorial.Message.NotificationMessage
  775. * @static
  776. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  777. * @returns {tutorial.Message.NotificationMessage} NotificationMessage
  778. * @throws {Error} If the payload is not a reader or valid buffer
  779. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  780. */
  781. NotificationMessage.decodeDelimited = function decodeDelimited(reader) {
  782. if (!(reader instanceof $Reader))
  783. reader = new $Reader(reader);
  784. return this.decode(reader, reader.uint32());
  785. };
  786. /**
  787. * Verifies a NotificationMessage message.
  788. * @function verify
  789. * @memberof tutorial.Message.NotificationMessage
  790. * @static
  791. * @param {Object.<string,*>} message Plain object to verify
  792. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  793. */
  794. NotificationMessage.verify = function verify(message) {
  795. if (typeof message !== "object" || message === null)
  796. return "object expected";
  797. if (message.nType != null && message.hasOwnProperty("nType"))
  798. if (!$util.isInteger(message.nType))
  799. return "nType: integer expected";
  800. return null;
  801. };
  802. /**
  803. * Creates a NotificationMessage message from a plain object. Also converts values to their respective internal types.
  804. * @function fromObject
  805. * @memberof tutorial.Message.NotificationMessage
  806. * @static
  807. * @param {Object.<string,*>} object Plain object
  808. * @returns {tutorial.Message.NotificationMessage} NotificationMessage
  809. */
  810. NotificationMessage.fromObject = function fromObject(object) {
  811. if (object instanceof $root.tutorial.Message.NotificationMessage)
  812. return object;
  813. var message = new $root.tutorial.Message.NotificationMessage();
  814. if (object.nType != null)
  815. message.nType = object.nType | 0;
  816. return message;
  817. };
  818. /**
  819. * Creates a plain object from a NotificationMessage message. Also converts values to other types if specified.
  820. * @function toObject
  821. * @memberof tutorial.Message.NotificationMessage
  822. * @static
  823. * @param {tutorial.Message.NotificationMessage} message NotificationMessage
  824. * @param {$protobuf.IConversionOptions} [options] Conversion options
  825. * @returns {Object.<string,*>} Plain object
  826. */
  827. NotificationMessage.toObject = function toObject(message, options) {
  828. if (!options)
  829. options = {};
  830. var object = {};
  831. if (options.defaults)
  832. object.nType = 0;
  833. if (message.nType != null && message.hasOwnProperty("nType"))
  834. object.nType = message.nType;
  835. return object;
  836. };
  837. /**
  838. * Converts this NotificationMessage to JSON.
  839. * @function toJSON
  840. * @memberof tutorial.Message.NotificationMessage
  841. * @instance
  842. * @returns {Object.<string,*>} JSON object
  843. */
  844. NotificationMessage.prototype.toJSON = function toJSON() {
  845. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  846. };
  847. return NotificationMessage;
  848. })();
  849. Message.RoleOptMessage = (function() {
  850. /**
  851. * Properties of a RoleOptMessage.
  852. * @memberof tutorial.Message
  853. * @interface IRoleOptMessage
  854. * @property {number|Long|null} [targetUid] RoleOptMessage targetUid
  855. * @property {number|Long|null} [exBossUid] RoleOptMessage exBossUid
  856. * @property {number|null} [opt] RoleOptMessage opt
  857. */
  858. /**
  859. * Constructs a new RoleOptMessage.
  860. * @memberof tutorial.Message
  861. * @classdesc Represents a RoleOptMessage.
  862. * @implements IRoleOptMessage
  863. * @constructor
  864. * @param {tutorial.Message.IRoleOptMessage=} [properties] Properties to set
  865. */
  866. function RoleOptMessage(properties) {
  867. if (properties)
  868. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  869. if (properties[keys[i]] != null)
  870. this[keys[i]] = properties[keys[i]];
  871. }
  872. /**
  873. * RoleOptMessage targetUid.
  874. * @member {number|Long} targetUid
  875. * @memberof tutorial.Message.RoleOptMessage
  876. * @instance
  877. */
  878. RoleOptMessage.prototype.targetUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  879. /**
  880. * RoleOptMessage exBossUid.
  881. * @member {number|Long} exBossUid
  882. * @memberof tutorial.Message.RoleOptMessage
  883. * @instance
  884. */
  885. RoleOptMessage.prototype.exBossUid = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  886. /**
  887. * RoleOptMessage opt.
  888. * @member {number} opt
  889. * @memberof tutorial.Message.RoleOptMessage
  890. * @instance
  891. */
  892. RoleOptMessage.prototype.opt = 0;
  893. /**
  894. * Creates a new RoleOptMessage instance using the specified properties.
  895. * @function create
  896. * @memberof tutorial.Message.RoleOptMessage
  897. * @static
  898. * @param {tutorial.Message.IRoleOptMessage=} [properties] Properties to set
  899. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage instance
  900. */
  901. RoleOptMessage.create = function create(properties) {
  902. return new RoleOptMessage(properties);
  903. };
  904. /**
  905. * Encodes the specified RoleOptMessage message. Does not implicitly {@link tutorial.Message.RoleOptMessage.verify|verify} messages.
  906. * @function encode
  907. * @memberof tutorial.Message.RoleOptMessage
  908. * @static
  909. * @param {tutorial.Message.IRoleOptMessage} message RoleOptMessage message or plain object to encode
  910. * @param {$protobuf.Writer} [writer] Writer to encode to
  911. * @returns {$protobuf.Writer} Writer
  912. */
  913. RoleOptMessage.encode = function encode(message, writer) {
  914. if (!writer)
  915. writer = $Writer.create();
  916. if (message.targetUid != null && message.hasOwnProperty("targetUid"))
  917. writer.uint32(/* id 1, wireType 0 =*/8).int64(message.targetUid);
  918. if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
  919. writer.uint32(/* id 2, wireType 0 =*/16).int64(message.exBossUid);
  920. if (message.opt != null && message.hasOwnProperty("opt"))
  921. writer.uint32(/* id 3, wireType 0 =*/24).int32(message.opt);
  922. return writer;
  923. };
  924. /**
  925. * Encodes the specified RoleOptMessage message, length delimited. Does not implicitly {@link tutorial.Message.RoleOptMessage.verify|verify} messages.
  926. * @function encodeDelimited
  927. * @memberof tutorial.Message.RoleOptMessage
  928. * @static
  929. * @param {tutorial.Message.IRoleOptMessage} message RoleOptMessage message or plain object to encode
  930. * @param {$protobuf.Writer} [writer] Writer to encode to
  931. * @returns {$protobuf.Writer} Writer
  932. */
  933. RoleOptMessage.encodeDelimited = function encodeDelimited(message, writer) {
  934. return this.encode(message, writer).ldelim();
  935. };
  936. /**
  937. * Decodes a RoleOptMessage message from the specified reader or buffer.
  938. * @function decode
  939. * @memberof tutorial.Message.RoleOptMessage
  940. * @static
  941. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  942. * @param {number} [length] Message length if known beforehand
  943. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
  944. * @throws {Error} If the payload is not a reader or valid buffer
  945. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  946. */
  947. RoleOptMessage.decode = function decode(reader, length) {
  948. if (!(reader instanceof $Reader))
  949. reader = $Reader.create(reader);
  950. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.RoleOptMessage();
  951. while (reader.pos < end) {
  952. var tag = reader.uint32();
  953. switch (tag >>> 3) {
  954. case 1:
  955. message.targetUid = reader.int64();
  956. break;
  957. case 2:
  958. message.exBossUid = reader.int64();
  959. break;
  960. case 3:
  961. message.opt = reader.int32();
  962. break;
  963. default:
  964. reader.skipType(tag & 7);
  965. break;
  966. }
  967. }
  968. return message;
  969. };
  970. /**
  971. * Decodes a RoleOptMessage message from the specified reader or buffer, length delimited.
  972. * @function decodeDelimited
  973. * @memberof tutorial.Message.RoleOptMessage
  974. * @static
  975. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  976. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
  977. * @throws {Error} If the payload is not a reader or valid buffer
  978. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  979. */
  980. RoleOptMessage.decodeDelimited = function decodeDelimited(reader) {
  981. if (!(reader instanceof $Reader))
  982. reader = new $Reader(reader);
  983. return this.decode(reader, reader.uint32());
  984. };
  985. /**
  986. * Verifies a RoleOptMessage message.
  987. * @function verify
  988. * @memberof tutorial.Message.RoleOptMessage
  989. * @static
  990. * @param {Object.<string,*>} message Plain object to verify
  991. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  992. */
  993. RoleOptMessage.verify = function verify(message) {
  994. if (typeof message !== "object" || message === null)
  995. return "object expected";
  996. if (message.targetUid != null && message.hasOwnProperty("targetUid"))
  997. if (!$util.isInteger(message.targetUid) && !(message.targetUid && $util.isInteger(message.targetUid.low) && $util.isInteger(message.targetUid.high)))
  998. return "targetUid: integer|Long expected";
  999. if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
  1000. if (!$util.isInteger(message.exBossUid) && !(message.exBossUid && $util.isInteger(message.exBossUid.low) && $util.isInteger(message.exBossUid.high)))
  1001. return "exBossUid: integer|Long expected";
  1002. if (message.opt != null && message.hasOwnProperty("opt"))
  1003. if (!$util.isInteger(message.opt))
  1004. return "opt: integer expected";
  1005. return null;
  1006. };
  1007. /**
  1008. * Creates a RoleOptMessage message from a plain object. Also converts values to their respective internal types.
  1009. * @function fromObject
  1010. * @memberof tutorial.Message.RoleOptMessage
  1011. * @static
  1012. * @param {Object.<string,*>} object Plain object
  1013. * @returns {tutorial.Message.RoleOptMessage} RoleOptMessage
  1014. */
  1015. RoleOptMessage.fromObject = function fromObject(object) {
  1016. if (object instanceof $root.tutorial.Message.RoleOptMessage)
  1017. return object;
  1018. var message = new $root.tutorial.Message.RoleOptMessage();
  1019. if (object.targetUid != null)
  1020. if ($util.Long)
  1021. (message.targetUid = $util.Long.fromValue(object.targetUid)).unsigned = false;
  1022. else if (typeof object.targetUid === "string")
  1023. message.targetUid = parseInt(object.targetUid, 10);
  1024. else if (typeof object.targetUid === "number")
  1025. message.targetUid = object.targetUid;
  1026. else if (typeof object.targetUid === "object")
  1027. message.targetUid = new $util.LongBits(object.targetUid.low >>> 0, object.targetUid.high >>> 0).toNumber();
  1028. if (object.exBossUid != null)
  1029. if ($util.Long)
  1030. (message.exBossUid = $util.Long.fromValue(object.exBossUid)).unsigned = false;
  1031. else if (typeof object.exBossUid === "string")
  1032. message.exBossUid = parseInt(object.exBossUid, 10);
  1033. else if (typeof object.exBossUid === "number")
  1034. message.exBossUid = object.exBossUid;
  1035. else if (typeof object.exBossUid === "object")
  1036. message.exBossUid = new $util.LongBits(object.exBossUid.low >>> 0, object.exBossUid.high >>> 0).toNumber();
  1037. if (object.opt != null)
  1038. message.opt = object.opt | 0;
  1039. return message;
  1040. };
  1041. /**
  1042. * Creates a plain object from a RoleOptMessage message. Also converts values to other types if specified.
  1043. * @function toObject
  1044. * @memberof tutorial.Message.RoleOptMessage
  1045. * @static
  1046. * @param {tutorial.Message.RoleOptMessage} message RoleOptMessage
  1047. * @param {$protobuf.IConversionOptions} [options] Conversion options
  1048. * @returns {Object.<string,*>} Plain object
  1049. */
  1050. RoleOptMessage.toObject = function toObject(message, options) {
  1051. if (!options)
  1052. options = {};
  1053. var object = {};
  1054. if (options.defaults) {
  1055. if ($util.Long) {
  1056. var long = new $util.Long(0, 0, false);
  1057. object.targetUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  1058. } else
  1059. object.targetUid = options.longs === String ? "0" : 0;
  1060. if ($util.Long) {
  1061. var long = new $util.Long(0, 0, false);
  1062. object.exBossUid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  1063. } else
  1064. object.exBossUid = options.longs === String ? "0" : 0;
  1065. object.opt = 0;
  1066. }
  1067. if (message.targetUid != null && message.hasOwnProperty("targetUid"))
  1068. if (typeof message.targetUid === "number")
  1069. object.targetUid = options.longs === String ? String(message.targetUid) : message.targetUid;
  1070. else
  1071. object.targetUid = options.longs === String ? $util.Long.prototype.toString.call(message.targetUid) : options.longs === Number ? new $util.LongBits(message.targetUid.low >>> 0, message.targetUid.high >>> 0).toNumber() : message.targetUid;
  1072. if (message.exBossUid != null && message.hasOwnProperty("exBossUid"))
  1073. if (typeof message.exBossUid === "number")
  1074. object.exBossUid = options.longs === String ? String(message.exBossUid) : message.exBossUid;
  1075. else
  1076. object.exBossUid = options.longs === String ? $util.Long.prototype.toString.call(message.exBossUid) : options.longs === Number ? new $util.LongBits(message.exBossUid.low >>> 0, message.exBossUid.high >>> 0).toNumber() : message.exBossUid;
  1077. if (message.opt != null && message.hasOwnProperty("opt"))
  1078. object.opt = message.opt;
  1079. return object;
  1080. };
  1081. /**
  1082. * Converts this RoleOptMessage to JSON.
  1083. * @function toJSON
  1084. * @memberof tutorial.Message.RoleOptMessage
  1085. * @instance
  1086. * @returns {Object.<string,*>} JSON object
  1087. */
  1088. RoleOptMessage.prototype.toJSON = function toJSON() {
  1089. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  1090. };
  1091. return RoleOptMessage;
  1092. })();
  1093. Message.ReportData = (function() {
  1094. /**
  1095. * Properties of a ReportData.
  1096. * @memberof tutorial.Message
  1097. * @interface IReportData
  1098. * @property {number|null} [seq] * 上报序号,每次重新获取时重置
  1099. * @property {number|Long|null} [t] 时间戳
  1100. * @property {number|null} [cmd] @see com.duowan.allstar.model.enumeration.Cmd
  1101. * @property {number|Long|null} [gi] grossIncome
  1102. * @property {number|Long|null} [s] @see com.duowan.allstar.model.home.UserExtra#stars
  1103. * @property {Array.<tutorial.Message.IBuildingInfo>|null} [b] @see BuildingInfoForm
  1104. * @property {Array.<tutorial.Message.IBuildingInfo>|null} [ub] 未解锁建筑
  1105. */
  1106. /**
  1107. * Constructs a new ReportData.
  1108. * @memberof tutorial.Message
  1109. * @classdesc Represents a ReportData.
  1110. * @implements IReportData
  1111. * @constructor
  1112. * @param {tutorial.Message.IReportData=} [properties] Properties to set
  1113. */
  1114. function ReportData(properties) {
  1115. this.b = [];
  1116. this.ub = [];
  1117. if (properties)
  1118. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  1119. if (properties[keys[i]] != null)
  1120. this[keys[i]] = properties[keys[i]];
  1121. }
  1122. /**
  1123. * * 上报序号,每次重新获取时重置
  1124. * @member {number} seq
  1125. * @memberof tutorial.Message.ReportData
  1126. * @instance
  1127. */
  1128. ReportData.prototype.seq = 0;
  1129. /**
  1130. * 时间戳
  1131. * @member {number|Long} t
  1132. * @memberof tutorial.Message.ReportData
  1133. * @instance
  1134. */
  1135. ReportData.prototype.t = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  1136. /**
  1137. * @see com.duowan.allstar.model.enumeration.Cmd
  1138. * @member {number} cmd
  1139. * @memberof tutorial.Message.ReportData
  1140. * @instance
  1141. */
  1142. ReportData.prototype.cmd = 0;
  1143. /**
  1144. * grossIncome
  1145. * @member {number|Long} gi
  1146. * @memberof tutorial.Message.ReportData
  1147. * @instance
  1148. */
  1149. ReportData.prototype.gi = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  1150. /**
  1151. * @see com.duowan.allstar.model.home.UserExtra#stars
  1152. * @member {number|Long} s
  1153. * @memberof tutorial.Message.ReportData
  1154. * @instance
  1155. */
  1156. ReportData.prototype.s = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  1157. /**
  1158. * @see BuildingInfoForm
  1159. * @member {Array.<tutorial.Message.IBuildingInfo>} b
  1160. * @memberof tutorial.Message.ReportData
  1161. * @instance
  1162. */
  1163. ReportData.prototype.b = $util.emptyArray;
  1164. /**
  1165. * 未解锁建筑
  1166. * @member {Array.<tutorial.Message.IBuildingInfo>} ub
  1167. * @memberof tutorial.Message.ReportData
  1168. * @instance
  1169. */
  1170. ReportData.prototype.ub = $util.emptyArray;
  1171. /**
  1172. * Creates a new ReportData instance using the specified properties.
  1173. * @function create
  1174. * @memberof tutorial.Message.ReportData
  1175. * @static
  1176. * @param {tutorial.Message.IReportData=} [properties] Properties to set
  1177. * @returns {tutorial.Message.ReportData} ReportData instance
  1178. */
  1179. ReportData.create = function create(properties) {
  1180. return new ReportData(properties);
  1181. };
  1182. /**
  1183. * Encodes the specified ReportData message. Does not implicitly {@link tutorial.Message.ReportData.verify|verify} messages.
  1184. * @function encode
  1185. * @memberof tutorial.Message.ReportData
  1186. * @static
  1187. * @param {tutorial.Message.IReportData} message ReportData message or plain object to encode
  1188. * @param {$protobuf.Writer} [writer] Writer to encode to
  1189. * @returns {$protobuf.Writer} Writer
  1190. */
  1191. ReportData.encode = function encode(message, writer) {
  1192. if (!writer)
  1193. writer = $Writer.create();
  1194. if (message.seq != null && message.hasOwnProperty("seq"))
  1195. writer.uint32(/* id 1, wireType 0 =*/8).int32(message.seq);
  1196. if (message.t != null && message.hasOwnProperty("t"))
  1197. writer.uint32(/* id 2, wireType 0 =*/16).int64(message.t);
  1198. if (message.cmd != null && message.hasOwnProperty("cmd"))
  1199. writer.uint32(/* id 3, wireType 0 =*/24).int32(message.cmd);
  1200. if (message.gi != null && message.hasOwnProperty("gi"))
  1201. writer.uint32(/* id 4, wireType 0 =*/32).int64(message.gi);
  1202. if (message.s != null && message.hasOwnProperty("s"))
  1203. writer.uint32(/* id 5, wireType 0 =*/40).int64(message.s);
  1204. if (message.b != null && message.b.length)
  1205. for (var i = 0; i < message.b.length; ++i)
  1206. $root.tutorial.Message.BuildingInfo.encode(message.b[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
  1207. if (message.ub != null && message.ub.length)
  1208. for (var i = 0; i < message.ub.length; ++i)
  1209. $root.tutorial.Message.BuildingInfo.encode(message.ub[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
  1210. return writer;
  1211. };
  1212. /**
  1213. * Encodes the specified ReportData message, length delimited. Does not implicitly {@link tutorial.Message.ReportData.verify|verify} messages.
  1214. * @function encodeDelimited
  1215. * @memberof tutorial.Message.ReportData
  1216. * @static
  1217. * @param {tutorial.Message.IReportData} message ReportData message or plain object to encode
  1218. * @param {$protobuf.Writer} [writer] Writer to encode to
  1219. * @returns {$protobuf.Writer} Writer
  1220. */
  1221. ReportData.encodeDelimited = function encodeDelimited(message, writer) {
  1222. return this.encode(message, writer).ldelim();
  1223. };
  1224. /**
  1225. * Decodes a ReportData message from the specified reader or buffer.
  1226. * @function decode
  1227. * @memberof tutorial.Message.ReportData
  1228. * @static
  1229. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  1230. * @param {number} [length] Message length if known beforehand
  1231. * @returns {tutorial.Message.ReportData} ReportData
  1232. * @throws {Error} If the payload is not a reader or valid buffer
  1233. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  1234. */
  1235. ReportData.decode = function decode(reader, length) {
  1236. if (!(reader instanceof $Reader))
  1237. reader = $Reader.create(reader);
  1238. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.ReportData();
  1239. while (reader.pos < end) {
  1240. var tag = reader.uint32();
  1241. switch (tag >>> 3) {
  1242. case 1:
  1243. message.seq = reader.int32();
  1244. break;
  1245. case 2:
  1246. message.t = reader.int64();
  1247. break;
  1248. case 3:
  1249. message.cmd = reader.int32();
  1250. break;
  1251. case 4:
  1252. message.gi = reader.int64();
  1253. break;
  1254. case 5:
  1255. message.s = reader.int64();
  1256. break;
  1257. case 6:
  1258. if (!(message.b && message.b.length))
  1259. message.b = [];
  1260. message.b.push($root.tutorial.Message.BuildingInfo.decode(reader, reader.uint32()));
  1261. break;
  1262. case 7:
  1263. if (!(message.ub && message.ub.length))
  1264. message.ub = [];
  1265. message.ub.push($root.tutorial.Message.BuildingInfo.decode(reader, reader.uint32()));
  1266. break;
  1267. default:
  1268. reader.skipType(tag & 7);
  1269. break;
  1270. }
  1271. }
  1272. return message;
  1273. };
  1274. /**
  1275. * Decodes a ReportData message from the specified reader or buffer, length delimited.
  1276. * @function decodeDelimited
  1277. * @memberof tutorial.Message.ReportData
  1278. * @static
  1279. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  1280. * @returns {tutorial.Message.ReportData} ReportData
  1281. * @throws {Error} If the payload is not a reader or valid buffer
  1282. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  1283. */
  1284. ReportData.decodeDelimited = function decodeDelimited(reader) {
  1285. if (!(reader instanceof $Reader))
  1286. reader = new $Reader(reader);
  1287. return this.decode(reader, reader.uint32());
  1288. };
  1289. /**
  1290. * Verifies a ReportData message.
  1291. * @function verify
  1292. * @memberof tutorial.Message.ReportData
  1293. * @static
  1294. * @param {Object.<string,*>} message Plain object to verify
  1295. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  1296. */
  1297. ReportData.verify = function verify(message) {
  1298. if (typeof message !== "object" || message === null)
  1299. return "object expected";
  1300. if (message.seq != null && message.hasOwnProperty("seq"))
  1301. if (!$util.isInteger(message.seq))
  1302. return "seq: integer expected";
  1303. if (message.t != null && message.hasOwnProperty("t"))
  1304. if (!$util.isInteger(message.t) && !(message.t && $util.isInteger(message.t.low) && $util.isInteger(message.t.high)))
  1305. return "t: integer|Long expected";
  1306. if (message.cmd != null && message.hasOwnProperty("cmd"))
  1307. if (!$util.isInteger(message.cmd))
  1308. return "cmd: integer expected";
  1309. if (message.gi != null && message.hasOwnProperty("gi"))
  1310. if (!$util.isInteger(message.gi) && !(message.gi && $util.isInteger(message.gi.low) && $util.isInteger(message.gi.high)))
  1311. return "gi: integer|Long expected";
  1312. if (message.s != null && message.hasOwnProperty("s"))
  1313. if (!$util.isInteger(message.s) && !(message.s && $util.isInteger(message.s.low) && $util.isInteger(message.s.high)))
  1314. return "s: integer|Long expected";
  1315. if (message.b != null && message.hasOwnProperty("b")) {
  1316. if (!Array.isArray(message.b))
  1317. return "b: array expected";
  1318. for (var i = 0; i < message.b.length; ++i) {
  1319. var error = $root.tutorial.Message.BuildingInfo.verify(message.b[i]);
  1320. if (error)
  1321. return "b." + error;
  1322. }
  1323. }
  1324. if (message.ub != null && message.hasOwnProperty("ub")) {
  1325. if (!Array.isArray(message.ub))
  1326. return "ub: array expected";
  1327. for (var i = 0; i < message.ub.length; ++i) {
  1328. var error = $root.tutorial.Message.BuildingInfo.verify(message.ub[i]);
  1329. if (error)
  1330. return "ub." + error;
  1331. }
  1332. }
  1333. return null;
  1334. };
  1335. /**
  1336. * Creates a ReportData message from a plain object. Also converts values to their respective internal types.
  1337. * @function fromObject
  1338. * @memberof tutorial.Message.ReportData
  1339. * @static
  1340. * @param {Object.<string,*>} object Plain object
  1341. * @returns {tutorial.Message.ReportData} ReportData
  1342. */
  1343. ReportData.fromObject = function fromObject(object) {
  1344. if (object instanceof $root.tutorial.Message.ReportData)
  1345. return object;
  1346. var message = new $root.tutorial.Message.ReportData();
  1347. if (object.seq != null)
  1348. message.seq = object.seq | 0;
  1349. if (object.t != null)
  1350. if ($util.Long)
  1351. (message.t = $util.Long.fromValue(object.t)).unsigned = false;
  1352. else if (typeof object.t === "string")
  1353. message.t = parseInt(object.t, 10);
  1354. else if (typeof object.t === "number")
  1355. message.t = object.t;
  1356. else if (typeof object.t === "object")
  1357. message.t = new $util.LongBits(object.t.low >>> 0, object.t.high >>> 0).toNumber();
  1358. if (object.cmd != null)
  1359. message.cmd = object.cmd | 0;
  1360. if (object.gi != null)
  1361. if ($util.Long)
  1362. (message.gi = $util.Long.fromValue(object.gi)).unsigned = false;
  1363. else if (typeof object.gi === "string")
  1364. message.gi = parseInt(object.gi, 10);
  1365. else if (typeof object.gi === "number")
  1366. message.gi = object.gi;
  1367. else if (typeof object.gi === "object")
  1368. message.gi = new $util.LongBits(object.gi.low >>> 0, object.gi.high >>> 0).toNumber();
  1369. if (object.s != null)
  1370. if ($util.Long)
  1371. (message.s = $util.Long.fromValue(object.s)).unsigned = false;
  1372. else if (typeof object.s === "string")
  1373. message.s = parseInt(object.s, 10);
  1374. else if (typeof object.s === "number")
  1375. message.s = object.s;
  1376. else if (typeof object.s === "object")
  1377. message.s = new $util.LongBits(object.s.low >>> 0, object.s.high >>> 0).toNumber();
  1378. if (object.b) {
  1379. if (!Array.isArray(object.b))
  1380. throw TypeError(".tutorial.Message.ReportData.b: array expected");
  1381. message.b = [];
  1382. for (var i = 0; i < object.b.length; ++i) {
  1383. if (typeof object.b[i] !== "object")
  1384. throw TypeError(".tutorial.Message.ReportData.b: object expected");
  1385. message.b[i] = $root.tutorial.Message.BuildingInfo.fromObject(object.b[i]);
  1386. }
  1387. }
  1388. if (object.ub) {
  1389. if (!Array.isArray(object.ub))
  1390. throw TypeError(".tutorial.Message.ReportData.ub: array expected");
  1391. message.ub = [];
  1392. for (var i = 0; i < object.ub.length; ++i) {
  1393. if (typeof object.ub[i] !== "object")
  1394. throw TypeError(".tutorial.Message.ReportData.ub: object expected");
  1395. message.ub[i] = $root.tutorial.Message.BuildingInfo.fromObject(object.ub[i]);
  1396. }
  1397. }
  1398. return message;
  1399. };
  1400. /**
  1401. * Creates a plain object from a ReportData message. Also converts values to other types if specified.
  1402. * @function toObject
  1403. * @memberof tutorial.Message.ReportData
  1404. * @static
  1405. * @param {tutorial.Message.ReportData} message ReportData
  1406. * @param {$protobuf.IConversionOptions} [options] Conversion options
  1407. * @returns {Object.<string,*>} Plain object
  1408. */
  1409. ReportData.toObject = function toObject(message, options) {
  1410. if (!options)
  1411. options = {};
  1412. var object = {};
  1413. if (options.arrays || options.defaults) {
  1414. object.b = [];
  1415. object.ub = [];
  1416. }
  1417. if (options.defaults) {
  1418. object.seq = 0;
  1419. if ($util.Long) {
  1420. var long = new $util.Long(0, 0, false);
  1421. object.t = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  1422. } else
  1423. object.t = options.longs === String ? "0" : 0;
  1424. object.cmd = 0;
  1425. if ($util.Long) {
  1426. var long = new $util.Long(0, 0, false);
  1427. object.gi = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  1428. } else
  1429. object.gi = options.longs === String ? "0" : 0;
  1430. if ($util.Long) {
  1431. var long = new $util.Long(0, 0, false);
  1432. object.s = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  1433. } else
  1434. object.s = options.longs === String ? "0" : 0;
  1435. }
  1436. if (message.seq != null && message.hasOwnProperty("seq"))
  1437. object.seq = message.seq;
  1438. if (message.t != null && message.hasOwnProperty("t"))
  1439. if (typeof message.t === "number")
  1440. object.t = options.longs === String ? String(message.t) : message.t;
  1441. else
  1442. object.t = options.longs === String ? $util.Long.prototype.toString.call(message.t) : options.longs === Number ? new $util.LongBits(message.t.low >>> 0, message.t.high >>> 0).toNumber() : message.t;
  1443. if (message.cmd != null && message.hasOwnProperty("cmd"))
  1444. object.cmd = message.cmd;
  1445. if (message.gi != null && message.hasOwnProperty("gi"))
  1446. if (typeof message.gi === "number")
  1447. object.gi = options.longs === String ? String(message.gi) : message.gi;
  1448. else
  1449. object.gi = options.longs === String ? $util.Long.prototype.toString.call(message.gi) : options.longs === Number ? new $util.LongBits(message.gi.low >>> 0, message.gi.high >>> 0).toNumber() : message.gi;
  1450. if (message.s != null && message.hasOwnProperty("s"))
  1451. if (typeof message.s === "number")
  1452. object.s = options.longs === String ? String(message.s) : message.s;
  1453. else
  1454. object.s = options.longs === String ? $util.Long.prototype.toString.call(message.s) : options.longs === Number ? new $util.LongBits(message.s.low >>> 0, message.s.high >>> 0).toNumber() : message.s;
  1455. if (message.b && message.b.length) {
  1456. object.b = [];
  1457. for (var j = 0; j < message.b.length; ++j)
  1458. object.b[j] = $root.tutorial.Message.BuildingInfo.toObject(message.b[j], options);
  1459. }
  1460. if (message.ub && message.ub.length) {
  1461. object.ub = [];
  1462. for (var j = 0; j < message.ub.length; ++j)
  1463. object.ub[j] = $root.tutorial.Message.BuildingInfo.toObject(message.ub[j], options);
  1464. }
  1465. return object;
  1466. };
  1467. /**
  1468. * Converts this ReportData to JSON.
  1469. * @function toJSON
  1470. * @memberof tutorial.Message.ReportData
  1471. * @instance
  1472. * @returns {Object.<string,*>} JSON object
  1473. */
  1474. ReportData.prototype.toJSON = function toJSON() {
  1475. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  1476. };
  1477. return ReportData;
  1478. })();
  1479. Message.BuildingInfo = (function() {
  1480. /**
  1481. * Properties of a BuildingInfo.
  1482. * @memberof tutorial.Message
  1483. * @interface IBuildingInfo
  1484. * @property {number|Long|null} [id] BuildingInfo id
  1485. * @property {number|null} [l] BuildingInfo l
  1486. * @property {number|null} [cc] BuildingInfo cc
  1487. */
  1488. /**
  1489. * Constructs a new BuildingInfo.
  1490. * @memberof tutorial.Message
  1491. * @classdesc Represents a BuildingInfo.
  1492. * @implements IBuildingInfo
  1493. * @constructor
  1494. * @param {tutorial.Message.IBuildingInfo=} [properties] Properties to set
  1495. */
  1496. function BuildingInfo(properties) {
  1497. if (properties)
  1498. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  1499. if (properties[keys[i]] != null)
  1500. this[keys[i]] = properties[keys[i]];
  1501. }
  1502. /**
  1503. * BuildingInfo id.
  1504. * @member {number|Long} id
  1505. * @memberof tutorial.Message.BuildingInfo
  1506. * @instance
  1507. */
  1508. BuildingInfo.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  1509. /**
  1510. * BuildingInfo l.
  1511. * @member {number} l
  1512. * @memberof tutorial.Message.BuildingInfo
  1513. * @instance
  1514. */
  1515. BuildingInfo.prototype.l = 0;
  1516. /**
  1517. * BuildingInfo cc.
  1518. * @member {number} cc
  1519. * @memberof tutorial.Message.BuildingInfo
  1520. * @instance
  1521. */
  1522. BuildingInfo.prototype.cc = 0;
  1523. /**
  1524. * Creates a new BuildingInfo instance using the specified properties.
  1525. * @function create
  1526. * @memberof tutorial.Message.BuildingInfo
  1527. * @static
  1528. * @param {tutorial.Message.IBuildingInfo=} [properties] Properties to set
  1529. * @returns {tutorial.Message.BuildingInfo} BuildingInfo instance
  1530. */
  1531. BuildingInfo.create = function create(properties) {
  1532. return new BuildingInfo(properties);
  1533. };
  1534. /**
  1535. * Encodes the specified BuildingInfo message. Does not implicitly {@link tutorial.Message.BuildingInfo.verify|verify} messages.
  1536. * @function encode
  1537. * @memberof tutorial.Message.BuildingInfo
  1538. * @static
  1539. * @param {tutorial.Message.IBuildingInfo} message BuildingInfo message or plain object to encode
  1540. * @param {$protobuf.Writer} [writer] Writer to encode to
  1541. * @returns {$protobuf.Writer} Writer
  1542. */
  1543. BuildingInfo.encode = function encode(message, writer) {
  1544. if (!writer)
  1545. writer = $Writer.create();
  1546. if (message.id != null && message.hasOwnProperty("id"))
  1547. writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id);
  1548. if (message.l != null && message.hasOwnProperty("l"))
  1549. writer.uint32(/* id 2, wireType 0 =*/16).int32(message.l);
  1550. if (message.cc != null && message.hasOwnProperty("cc"))
  1551. writer.uint32(/* id 3, wireType 0 =*/24).int32(message.cc);
  1552. return writer;
  1553. };
  1554. /**
  1555. * Encodes the specified BuildingInfo message, length delimited. Does not implicitly {@link tutorial.Message.BuildingInfo.verify|verify} messages.
  1556. * @function encodeDelimited
  1557. * @memberof tutorial.Message.BuildingInfo
  1558. * @static
  1559. * @param {tutorial.Message.IBuildingInfo} message BuildingInfo message or plain object to encode
  1560. * @param {$protobuf.Writer} [writer] Writer to encode to
  1561. * @returns {$protobuf.Writer} Writer
  1562. */
  1563. BuildingInfo.encodeDelimited = function encodeDelimited(message, writer) {
  1564. return this.encode(message, writer).ldelim();
  1565. };
  1566. /**
  1567. * Decodes a BuildingInfo message from the specified reader or buffer.
  1568. * @function decode
  1569. * @memberof tutorial.Message.BuildingInfo
  1570. * @static
  1571. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  1572. * @param {number} [length] Message length if known beforehand
  1573. * @returns {tutorial.Message.BuildingInfo} BuildingInfo
  1574. * @throws {Error} If the payload is not a reader or valid buffer
  1575. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  1576. */
  1577. BuildingInfo.decode = function decode(reader, length) {
  1578. if (!(reader instanceof $Reader))
  1579. reader = $Reader.create(reader);
  1580. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.BuildingInfo();
  1581. while (reader.pos < end) {
  1582. var tag = reader.uint32();
  1583. switch (tag >>> 3) {
  1584. case 1:
  1585. message.id = reader.int64();
  1586. break;
  1587. case 2:
  1588. message.l = reader.int32();
  1589. break;
  1590. case 3:
  1591. message.cc = reader.int32();
  1592. break;
  1593. default:
  1594. reader.skipType(tag & 7);
  1595. break;
  1596. }
  1597. }
  1598. return message;
  1599. };
  1600. /**
  1601. * Decodes a BuildingInfo message from the specified reader or buffer, length delimited.
  1602. * @function decodeDelimited
  1603. * @memberof tutorial.Message.BuildingInfo
  1604. * @static
  1605. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  1606. * @returns {tutorial.Message.BuildingInfo} BuildingInfo
  1607. * @throws {Error} If the payload is not a reader or valid buffer
  1608. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  1609. */
  1610. BuildingInfo.decodeDelimited = function decodeDelimited(reader) {
  1611. if (!(reader instanceof $Reader))
  1612. reader = new $Reader(reader);
  1613. return this.decode(reader, reader.uint32());
  1614. };
  1615. /**
  1616. * Verifies a BuildingInfo message.
  1617. * @function verify
  1618. * @memberof tutorial.Message.BuildingInfo
  1619. * @static
  1620. * @param {Object.<string,*>} message Plain object to verify
  1621. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  1622. */
  1623. BuildingInfo.verify = function verify(message) {
  1624. if (typeof message !== "object" || message === null)
  1625. return "object expected";
  1626. if (message.id != null && message.hasOwnProperty("id"))
  1627. if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
  1628. return "id: integer|Long expected";
  1629. if (message.l != null && message.hasOwnProperty("l"))
  1630. if (!$util.isInteger(message.l))
  1631. return "l: integer expected";
  1632. if (message.cc != null && message.hasOwnProperty("cc"))
  1633. if (!$util.isInteger(message.cc))
  1634. return "cc: integer expected";
  1635. return null;
  1636. };
  1637. /**
  1638. * Creates a BuildingInfo message from a plain object. Also converts values to their respective internal types.
  1639. * @function fromObject
  1640. * @memberof tutorial.Message.BuildingInfo
  1641. * @static
  1642. * @param {Object.<string,*>} object Plain object
  1643. * @returns {tutorial.Message.BuildingInfo} BuildingInfo
  1644. */
  1645. BuildingInfo.fromObject = function fromObject(object) {
  1646. if (object instanceof $root.tutorial.Message.BuildingInfo)
  1647. return object;
  1648. var message = new $root.tutorial.Message.BuildingInfo();
  1649. if (object.id != null)
  1650. if ($util.Long)
  1651. (message.id = $util.Long.fromValue(object.id)).unsigned = false;
  1652. else if (typeof object.id === "string")
  1653. message.id = parseInt(object.id, 10);
  1654. else if (typeof object.id === "number")
  1655. message.id = object.id;
  1656. else if (typeof object.id === "object")
  1657. message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber();
  1658. if (object.l != null)
  1659. message.l = object.l | 0;
  1660. if (object.cc != null)
  1661. message.cc = object.cc | 0;
  1662. return message;
  1663. };
  1664. /**
  1665. * Creates a plain object from a BuildingInfo message. Also converts values to other types if specified.
  1666. * @function toObject
  1667. * @memberof tutorial.Message.BuildingInfo
  1668. * @static
  1669. * @param {tutorial.Message.BuildingInfo} message BuildingInfo
  1670. * @param {$protobuf.IConversionOptions} [options] Conversion options
  1671. * @returns {Object.<string,*>} Plain object
  1672. */
  1673. BuildingInfo.toObject = function toObject(message, options) {
  1674. if (!options)
  1675. options = {};
  1676. var object = {};
  1677. if (options.defaults) {
  1678. if ($util.Long) {
  1679. var long = new $util.Long(0, 0, false);
  1680. object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  1681. } else
  1682. object.id = options.longs === String ? "0" : 0;
  1683. object.l = 0;
  1684. object.cc = 0;
  1685. }
  1686. if (message.id != null && message.hasOwnProperty("id"))
  1687. if (typeof message.id === "number")
  1688. object.id = options.longs === String ? String(message.id) : message.id;
  1689. else
  1690. object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id;
  1691. if (message.l != null && message.hasOwnProperty("l"))
  1692. object.l = message.l;
  1693. if (message.cc != null && message.hasOwnProperty("cc"))
  1694. object.cc = message.cc;
  1695. return object;
  1696. };
  1697. /**
  1698. * Converts this BuildingInfo to JSON.
  1699. * @function toJSON
  1700. * @memberof tutorial.Message.BuildingInfo
  1701. * @instance
  1702. * @returns {Object.<string,*>} JSON object
  1703. */
  1704. BuildingInfo.prototype.toJSON = function toJSON() {
  1705. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  1706. };
  1707. return BuildingInfo;
  1708. })();
  1709. Message.BuildingItems = (function() {
  1710. /**
  1711. * Properties of a BuildingItems.
  1712. * @memberof tutorial.Message
  1713. * @interface IBuildingItems
  1714. * @property {number|Long|null} [buildingId] BuildingItems buildingId
  1715. * @property {tutorial.Message.IItem|null} [item] BuildingItems item
  1716. */
  1717. /**
  1718. * Constructs a new BuildingItems.
  1719. * @memberof tutorial.Message
  1720. * @classdesc Represents a BuildingItems.
  1721. * @implements IBuildingItems
  1722. * @constructor
  1723. * @param {tutorial.Message.IBuildingItems=} [properties] Properties to set
  1724. */
  1725. function BuildingItems(properties) {
  1726. if (properties)
  1727. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  1728. if (properties[keys[i]] != null)
  1729. this[keys[i]] = properties[keys[i]];
  1730. }
  1731. /**
  1732. * BuildingItems buildingId.
  1733. * @member {number|Long} buildingId
  1734. * @memberof tutorial.Message.BuildingItems
  1735. * @instance
  1736. */
  1737. BuildingItems.prototype.buildingId = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  1738. /**
  1739. * BuildingItems item.
  1740. * @member {tutorial.Message.IItem|null|undefined} item
  1741. * @memberof tutorial.Message.BuildingItems
  1742. * @instance
  1743. */
  1744. BuildingItems.prototype.item = null;
  1745. /**
  1746. * Creates a new BuildingItems instance using the specified properties.
  1747. * @function create
  1748. * @memberof tutorial.Message.BuildingItems
  1749. * @static
  1750. * @param {tutorial.Message.IBuildingItems=} [properties] Properties to set
  1751. * @returns {tutorial.Message.BuildingItems} BuildingItems instance
  1752. */
  1753. BuildingItems.create = function create(properties) {
  1754. return new BuildingItems(properties);
  1755. };
  1756. /**
  1757. * Encodes the specified BuildingItems message. Does not implicitly {@link tutorial.Message.BuildingItems.verify|verify} messages.
  1758. * @function encode
  1759. * @memberof tutorial.Message.BuildingItems
  1760. * @static
  1761. * @param {tutorial.Message.IBuildingItems} message BuildingItems message or plain object to encode
  1762. * @param {$protobuf.Writer} [writer] Writer to encode to
  1763. * @returns {$protobuf.Writer} Writer
  1764. */
  1765. BuildingItems.encode = function encode(message, writer) {
  1766. if (!writer)
  1767. writer = $Writer.create();
  1768. if (message.buildingId != null && message.hasOwnProperty("buildingId"))
  1769. writer.uint32(/* id 1, wireType 0 =*/8).int64(message.buildingId);
  1770. if (message.item != null && message.hasOwnProperty("item"))
  1771. $root.tutorial.Message.Item.encode(message.item, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
  1772. return writer;
  1773. };
  1774. /**
  1775. * Encodes the specified BuildingItems message, length delimited. Does not implicitly {@link tutorial.Message.BuildingItems.verify|verify} messages.
  1776. * @function encodeDelimited
  1777. * @memberof tutorial.Message.BuildingItems
  1778. * @static
  1779. * @param {tutorial.Message.IBuildingItems} message BuildingItems message or plain object to encode
  1780. * @param {$protobuf.Writer} [writer] Writer to encode to
  1781. * @returns {$protobuf.Writer} Writer
  1782. */
  1783. BuildingItems.encodeDelimited = function encodeDelimited(message, writer) {
  1784. return this.encode(message, writer).ldelim();
  1785. };
  1786. /**
  1787. * Decodes a BuildingItems message from the specified reader or buffer.
  1788. * @function decode
  1789. * @memberof tutorial.Message.BuildingItems
  1790. * @static
  1791. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  1792. * @param {number} [length] Message length if known beforehand
  1793. * @returns {tutorial.Message.BuildingItems} BuildingItems
  1794. * @throws {Error} If the payload is not a reader or valid buffer
  1795. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  1796. */
  1797. BuildingItems.decode = function decode(reader, length) {
  1798. if (!(reader instanceof $Reader))
  1799. reader = $Reader.create(reader);
  1800. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.BuildingItems();
  1801. while (reader.pos < end) {
  1802. var tag = reader.uint32();
  1803. switch (tag >>> 3) {
  1804. case 1:
  1805. message.buildingId = reader.int64();
  1806. break;
  1807. case 2:
  1808. message.item = $root.tutorial.Message.Item.decode(reader, reader.uint32());
  1809. break;
  1810. default:
  1811. reader.skipType(tag & 7);
  1812. break;
  1813. }
  1814. }
  1815. return message;
  1816. };
  1817. /**
  1818. * Decodes a BuildingItems message from the specified reader or buffer, length delimited.
  1819. * @function decodeDelimited
  1820. * @memberof tutorial.Message.BuildingItems
  1821. * @static
  1822. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  1823. * @returns {tutorial.Message.BuildingItems} BuildingItems
  1824. * @throws {Error} If the payload is not a reader or valid buffer
  1825. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  1826. */
  1827. BuildingItems.decodeDelimited = function decodeDelimited(reader) {
  1828. if (!(reader instanceof $Reader))
  1829. reader = new $Reader(reader);
  1830. return this.decode(reader, reader.uint32());
  1831. };
  1832. /**
  1833. * Verifies a BuildingItems message.
  1834. * @function verify
  1835. * @memberof tutorial.Message.BuildingItems
  1836. * @static
  1837. * @param {Object.<string,*>} message Plain object to verify
  1838. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  1839. */
  1840. BuildingItems.verify = function verify(message) {
  1841. if (typeof message !== "object" || message === null)
  1842. return "object expected";
  1843. if (message.buildingId != null && message.hasOwnProperty("buildingId"))
  1844. if (!$util.isInteger(message.buildingId) && !(message.buildingId && $util.isInteger(message.buildingId.low) && $util.isInteger(message.buildingId.high)))
  1845. return "buildingId: integer|Long expected";
  1846. if (message.item != null && message.hasOwnProperty("item")) {
  1847. var error = $root.tutorial.Message.Item.verify(message.item);
  1848. if (error)
  1849. return "item." + error;
  1850. }
  1851. return null;
  1852. };
  1853. /**
  1854. * Creates a BuildingItems message from a plain object. Also converts values to their respective internal types.
  1855. * @function fromObject
  1856. * @memberof tutorial.Message.BuildingItems
  1857. * @static
  1858. * @param {Object.<string,*>} object Plain object
  1859. * @returns {tutorial.Message.BuildingItems} BuildingItems
  1860. */
  1861. BuildingItems.fromObject = function fromObject(object) {
  1862. if (object instanceof $root.tutorial.Message.BuildingItems)
  1863. return object;
  1864. var message = new $root.tutorial.Message.BuildingItems();
  1865. if (object.buildingId != null)
  1866. if ($util.Long)
  1867. (message.buildingId = $util.Long.fromValue(object.buildingId)).unsigned = false;
  1868. else if (typeof object.buildingId === "string")
  1869. message.buildingId = parseInt(object.buildingId, 10);
  1870. else if (typeof object.buildingId === "number")
  1871. message.buildingId = object.buildingId;
  1872. else if (typeof object.buildingId === "object")
  1873. message.buildingId = new $util.LongBits(object.buildingId.low >>> 0, object.buildingId.high >>> 0).toNumber();
  1874. if (object.item != null) {
  1875. if (typeof object.item !== "object")
  1876. throw TypeError(".tutorial.Message.BuildingItems.item: object expected");
  1877. message.item = $root.tutorial.Message.Item.fromObject(object.item);
  1878. }
  1879. return message;
  1880. };
  1881. /**
  1882. * Creates a plain object from a BuildingItems message. Also converts values to other types if specified.
  1883. * @function toObject
  1884. * @memberof tutorial.Message.BuildingItems
  1885. * @static
  1886. * @param {tutorial.Message.BuildingItems} message BuildingItems
  1887. * @param {$protobuf.IConversionOptions} [options] Conversion options
  1888. * @returns {Object.<string,*>} Plain object
  1889. */
  1890. BuildingItems.toObject = function toObject(message, options) {
  1891. if (!options)
  1892. options = {};
  1893. var object = {};
  1894. if (options.defaults) {
  1895. if ($util.Long) {
  1896. var long = new $util.Long(0, 0, false);
  1897. object.buildingId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  1898. } else
  1899. object.buildingId = options.longs === String ? "0" : 0;
  1900. object.item = null;
  1901. }
  1902. if (message.buildingId != null && message.hasOwnProperty("buildingId"))
  1903. if (typeof message.buildingId === "number")
  1904. object.buildingId = options.longs === String ? String(message.buildingId) : message.buildingId;
  1905. else
  1906. object.buildingId = options.longs === String ? $util.Long.prototype.toString.call(message.buildingId) : options.longs === Number ? new $util.LongBits(message.buildingId.low >>> 0, message.buildingId.high >>> 0).toNumber() : message.buildingId;
  1907. if (message.item != null && message.hasOwnProperty("item"))
  1908. object.item = $root.tutorial.Message.Item.toObject(message.item, options);
  1909. return object;
  1910. };
  1911. /**
  1912. * Converts this BuildingItems to JSON.
  1913. * @function toJSON
  1914. * @memberof tutorial.Message.BuildingItems
  1915. * @instance
  1916. * @returns {Object.<string,*>} JSON object
  1917. */
  1918. BuildingItems.prototype.toJSON = function toJSON() {
  1919. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  1920. };
  1921. return BuildingItems;
  1922. })();
  1923. Message.Item = (function() {
  1924. /**
  1925. * Properties of an Item.
  1926. * @memberof tutorial.Message
  1927. * @interface IItem
  1928. * @property {number|Long|null} [id] Item id
  1929. * @property {number|null} [count] Item count
  1930. */
  1931. /**
  1932. * Constructs a new Item.
  1933. * @memberof tutorial.Message
  1934. * @classdesc Represents an Item.
  1935. * @implements IItem
  1936. * @constructor
  1937. * @param {tutorial.Message.IItem=} [properties] Properties to set
  1938. */
  1939. function Item(properties) {
  1940. if (properties)
  1941. for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
  1942. if (properties[keys[i]] != null)
  1943. this[keys[i]] = properties[keys[i]];
  1944. }
  1945. /**
  1946. * Item id.
  1947. * @member {number|Long} id
  1948. * @memberof tutorial.Message.Item
  1949. * @instance
  1950. */
  1951. Item.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
  1952. /**
  1953. * Item count.
  1954. * @member {number} count
  1955. * @memberof tutorial.Message.Item
  1956. * @instance
  1957. */
  1958. Item.prototype.count = 0;
  1959. /**
  1960. * Creates a new Item instance using the specified properties.
  1961. * @function create
  1962. * @memberof tutorial.Message.Item
  1963. * @static
  1964. * @param {tutorial.Message.IItem=} [properties] Properties to set
  1965. * @returns {tutorial.Message.Item} Item instance
  1966. */
  1967. Item.create = function create(properties) {
  1968. return new Item(properties);
  1969. };
  1970. /**
  1971. * Encodes the specified Item message. Does not implicitly {@link tutorial.Message.Item.verify|verify} messages.
  1972. * @function encode
  1973. * @memberof tutorial.Message.Item
  1974. * @static
  1975. * @param {tutorial.Message.IItem} message Item message or plain object to encode
  1976. * @param {$protobuf.Writer} [writer] Writer to encode to
  1977. * @returns {$protobuf.Writer} Writer
  1978. */
  1979. Item.encode = function encode(message, writer) {
  1980. if (!writer)
  1981. writer = $Writer.create();
  1982. if (message.id != null && message.hasOwnProperty("id"))
  1983. writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id);
  1984. if (message.count != null && message.hasOwnProperty("count"))
  1985. writer.uint32(/* id 2, wireType 0 =*/16).int32(message.count);
  1986. return writer;
  1987. };
  1988. /**
  1989. * Encodes the specified Item message, length delimited. Does not implicitly {@link tutorial.Message.Item.verify|verify} messages.
  1990. * @function encodeDelimited
  1991. * @memberof tutorial.Message.Item
  1992. * @static
  1993. * @param {tutorial.Message.IItem} message Item message or plain object to encode
  1994. * @param {$protobuf.Writer} [writer] Writer to encode to
  1995. * @returns {$protobuf.Writer} Writer
  1996. */
  1997. Item.encodeDelimited = function encodeDelimited(message, writer) {
  1998. return this.encode(message, writer).ldelim();
  1999. };
  2000. /**
  2001. * Decodes an Item message from the specified reader or buffer.
  2002. * @function decode
  2003. * @memberof tutorial.Message.Item
  2004. * @static
  2005. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  2006. * @param {number} [length] Message length if known beforehand
  2007. * @returns {tutorial.Message.Item} Item
  2008. * @throws {Error} If the payload is not a reader or valid buffer
  2009. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  2010. */
  2011. Item.decode = function decode(reader, length) {
  2012. if (!(reader instanceof $Reader))
  2013. reader = $Reader.create(reader);
  2014. var end = length === undefined ? reader.len : reader.pos + length, message = new $root.tutorial.Message.Item();
  2015. while (reader.pos < end) {
  2016. var tag = reader.uint32();
  2017. switch (tag >>> 3) {
  2018. case 1:
  2019. message.id = reader.int64();
  2020. break;
  2021. case 2:
  2022. message.count = reader.int32();
  2023. break;
  2024. default:
  2025. reader.skipType(tag & 7);
  2026. break;
  2027. }
  2028. }
  2029. return message;
  2030. };
  2031. /**
  2032. * Decodes an Item message from the specified reader or buffer, length delimited.
  2033. * @function decodeDelimited
  2034. * @memberof tutorial.Message.Item
  2035. * @static
  2036. * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
  2037. * @returns {tutorial.Message.Item} Item
  2038. * @throws {Error} If the payload is not a reader or valid buffer
  2039. * @throws {$protobuf.util.ProtocolError} If required fields are missing
  2040. */
  2041. Item.decodeDelimited = function decodeDelimited(reader) {
  2042. if (!(reader instanceof $Reader))
  2043. reader = new $Reader(reader);
  2044. return this.decode(reader, reader.uint32());
  2045. };
  2046. /**
  2047. * Verifies an Item message.
  2048. * @function verify
  2049. * @memberof tutorial.Message.Item
  2050. * @static
  2051. * @param {Object.<string,*>} message Plain object to verify
  2052. * @returns {string|null} `null` if valid, otherwise the reason why it is not
  2053. */
  2054. Item.verify = function verify(message) {
  2055. if (typeof message !== "object" || message === null)
  2056. return "object expected";
  2057. if (message.id != null && message.hasOwnProperty("id"))
  2058. if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
  2059. return "id: integer|Long expected";
  2060. if (message.count != null && message.hasOwnProperty("count"))
  2061. if (!$util.isInteger(message.count))
  2062. return "count: integer expected";
  2063. return null;
  2064. };
  2065. /**
  2066. * Creates an Item message from a plain object. Also converts values to their respective internal types.
  2067. * @function fromObject
  2068. * @memberof tutorial.Message.Item
  2069. * @static
  2070. * @param {Object.<string,*>} object Plain object
  2071. * @returns {tutorial.Message.Item} Item
  2072. */
  2073. Item.fromObject = function fromObject(object) {
  2074. if (object instanceof $root.tutorial.Message.Item)
  2075. return object;
  2076. var message = new $root.tutorial.Message.Item();
  2077. if (object.id != null)
  2078. if ($util.Long)
  2079. (message.id = $util.Long.fromValue(object.id)).unsigned = false;
  2080. else if (typeof object.id === "string")
  2081. message.id = parseInt(object.id, 10);
  2082. else if (typeof object.id === "number")
  2083. message.id = object.id;
  2084. else if (typeof object.id === "object")
  2085. message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber();
  2086. if (object.count != null)
  2087. message.count = object.count | 0;
  2088. return message;
  2089. };
  2090. /**
  2091. * Creates a plain object from an Item message. Also converts values to other types if specified.
  2092. * @function toObject
  2093. * @memberof tutorial.Message.Item
  2094. * @static
  2095. * @param {tutorial.Message.Item} message Item
  2096. * @param {$protobuf.IConversionOptions} [options] Conversion options
  2097. * @returns {Object.<string,*>} Plain object
  2098. */
  2099. Item.toObject = function toObject(message, options) {
  2100. if (!options)
  2101. options = {};
  2102. var object = {};
  2103. if (options.defaults) {
  2104. if ($util.Long) {
  2105. var long = new $util.Long(0, 0, false);
  2106. object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
  2107. } else
  2108. object.id = options.longs === String ? "0" : 0;
  2109. object.count = 0;
  2110. }
  2111. if (message.id != null && message.hasOwnProperty("id"))
  2112. if (typeof message.id === "number")
  2113. object.id = options.longs === String ? String(message.id) : message.id;
  2114. else
  2115. object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id;
  2116. if (message.count != null && message.hasOwnProperty("count"))
  2117. object.count = message.count;
  2118. return object;
  2119. };
  2120. /**
  2121. * Converts this Item to JSON.
  2122. * @function toJSON
  2123. * @memberof tutorial.Message.Item
  2124. * @instance
  2125. * @returns {Object.<string,*>} JSON object
  2126. */
  2127. Item.prototype.toJSON = function toJSON() {
  2128. return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
  2129. };
  2130. return Item;
  2131. })();
  2132. return Message;
  2133. })();
  2134. return tutorial;
  2135. })();
  2136. return $root;
  2137. });