UNPKG

camelot-unchained

Version:
55 lines (46 loc) 2.52 kB
/** * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; //import * as Rest from '../util/RestAPI'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var RestAPI_1 = require('../../restapi/RestAPI'); var Ability = function () { function Ability() { var ability = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; _classCallCheck(this, Ability); this.cooldowns = []; this.buttons = []; this.awaitingUpdate = null; this.id = ability.id || ""; this.icon = ability.icon || ""; this.cooldowns = ability.cooldowns || []; this.duration = ability.duration || 0; this.triggerTimeOffset = ability.triggerTimeOffset || 0; this.name = ability.name || ""; this.tooltip = ability.tooltip || ""; this.buttons = ability.buttons || []; this.awaitingUpdate = ability.awaitingUpdate || null; this.abilityComponents = ability.abilityComponents || []; } _createClass(Ability, null, [{ key: "getAllAbilities", value: function getAllAbilities(loginToken, characterID, callback) { RestAPI_1.getCraftedAbilities(loginToken, characterID).then(function (data) { if (callback) { callback(data.map(function (o) { return new Ability(o); })); } }).catch(function (error) { console.log("error: " + error.message + " | response: " + error.response); }); } }]); return Ability; }(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Ability;