transformice.js
Version:
Node.js client for Transformice with full Typescript support.
58 lines (57 loc) • 1.95 kB
JavaScript
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 a Tribe */
var Tribe = /** @class */ (function (_super) {
__extends(Tribe, _super);
/**
* @hidden
*/
function Tribe(client) {
var _this = _super.call(this, client) || this;
_this.id = 0;
_this.name = "";
_this.welcomeMessage = "";
_this.mapCode = 0;
_this.members = [];
_this.ranks = [];
return _this;
}
/**
* Returns tribe data from a packet
*
* @hidden
*/
Tribe.prototype.read = function (packet) {
this.id = packet.readInt();
this.name = packet.readUTF();
this.welcomeMessage = packet.readUTF();
this.mapCode = packet.readInt();
this.members = [];
this.ranks = [];
var length = packet.readShort();
for (var i = 0; i < length; i++) {
this.members.push(new _1.Member(this.client, { tribe: this }).read(packet));
}
length = packet.readShort();
for (var i = 0; i < length; i++) {
this.ranks.push(new _1.Rank(this.client, { id: i }).read(packet));
}
return this;
};
return Tribe;
}(_1.Base));
exports.default = Tribe;
;