ps2census
Version:
Client to connect to the PS2 Event Stream websocket.
43 lines • 1.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VehicleDestroy = exports.Destroy = void 0;
const ps2_constants_1 = require("../constants/ps2.constants");
const attacker_event_1 = require("./base/attacker.event");
var Destroy;
(function (Destroy) {
Destroy[Destroy["Normal"] = 0] = "Normal";
Destroy[Destroy["Friendly"] = 1] = "Friendly";
Destroy[Destroy["SelfDestruct"] = 2] = "SelfDestruct";
Destroy[Destroy["Neutral"] = 3] = "Neutral";
Destroy[Destroy["Game"] = 4] = "Game";
})(Destroy || (exports.Destroy = Destroy = {}));
class VehicleDestroy extends attacker_event_1.AttackerEvent {
constructor() {
super(...arguments);
this.emit = 'vehicleDestroy';
}
unclaimed() {
if (this.faction_id === '0')
return false;
return (this.attacker_character_id === this.character_id &&
(this.attacker_character_id === '0' ||
this.attacker_faction !== this.team_id));
}
get kill_type() {
if (this.faction_id === ps2_constants_1.Faction.NONE)
return Destroy.Neutral;
if (this.attacker_character_id === '0')
return Destroy.Game;
if (this.attacker_character_id === this.character_id &&
this.attacker_team_id === this.team_id)
return Destroy.SelfDestruct;
return this.attacker_team_id === this.team_id
? Destroy.Friendly
: Destroy.Normal;
}
toHash() {
return `VehicleDestroy:${this.character_id}:${this.timestamp}:${this.attacker_character_id}`;
}
}
exports.VehicleDestroy = VehicleDestroy;
//# sourceMappingURL=vehicle-destroy.event.js.map