steam-condenser
Version:
TypeScript port of steam-condenser.
47 lines • 2.06 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 (b.hasOwnProperty(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 __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var SteamPacket_1 = __importDefault(require("./SteamPacket"));
var SteamPlayer_1 = require("../SteamPlayer");
var S2APlayerPacket = /** @class */ (function (_super) {
__extends(S2APlayerPacket, _super);
function S2APlayerPacket(contentData) {
var _this = this;
if (typeof contentData === 'undefined') {
throw new Error('Wrong formatted S2A_PLAYER packet.');
}
_this = _super.call(this, SteamPacket_1.default.S2A_PLAYER_HEADER, contentData) || this;
_this.contentData.getByte();
_this.playerHash = {};
while (_this.contentData.remaining() > 0) {
var id = _this.contentData.getByte();
var name_1 = _this.contentData.getString();
var score = _this.contentData.getLong();
var connectTime = _this.contentData.getFloat();
// id playerData[0] is always 0?
_this.playerHash[name_1] = new SteamPlayer_1.SteamPlayer(id, name_1, score, connectTime);
}
return _this;
}
S2APlayerPacket.prototype.getPlayerHash = function () {
return this.playerHash;
};
return S2APlayerPacket;
}(SteamPacket_1.default));
exports.default = S2APlayerPacket;
//# sourceMappingURL=S2APlayerPacket.js.map