UNPKG

transformice.js

Version:

Node.js client for Transformice with full Typescript support.

95 lines (94 loc) 3.36 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var _1 = require("."); /** Represents player's profile from `/profile` command */ var Profile = /** @class */ (function (_super) { __extends(Profile, _super); /** * @hidden */ function Profile(client, player) { if (player === void 0) { player = {}; } var _this = _super.call(this, client) || this; Object.assign(_this, player); return _this; } /** * Returns member data from a packet * * @hidden */ Profile.prototype.read = function (packet) { this.name = packet.readUTF(); this.id = packet.readInt(); this.registrationDate = packet.readInt(); this.role = packet.readByte(); this.gender = packet.readByte(); this.tribeName = packet.readUTF(); this.soulmate = packet.readUTF(); var normal = packet.readInt(); this.shamanCheese = packet.readInt(); this.first = packet.readInt(); this.cheese = packet.readInt(); var hard = packet.readInt(); this.bootcamp = packet.readInt(); var divine = packet.readInt(); this.saves = { normal: normal, hard: hard, divine: divine, }; this.titleId = packet.readShort(); this.titles = []; var titleCount = packet.readShort(); for (var i = 0; i < titleCount; i++) { this.titles.push({ id: packet.readShort(), star: packet.readByte(), }); } this.look = packet.readUTF(); this.level = packet.readShort(); this.badges = []; var badgeCount = packet.readShort() / 2; for (var i = 0; i < badgeCount; i++) { this.badges.push({ id: packet.readShort(), quantity: packet.readShort(), }); } this.modeStatus = []; var modeStatusCount = packet.readByte(); for (var i = 0; i < modeStatusCount; i++) { this.modeStatus.push({ mode: packet.readByte(), progress: packet.readInt(), progressLimit: packet.readInt(), imageId: packet.readShort(), }); } this.orbId = packet.readByte(); this.orbs = []; var orbCount = packet.readByte(); for (var i = 0; i < orbCount; i++) { this.orbs.push(packet.readByte()); } this.adventurePoints = packet.readInt(); return this; }; return Profile; }(_1.Player)); exports.default = Profile;