{"size": 1292, "ext": "js", "max_stars_repo_path": "module/actor/sheet/hub-sheet.js", "max_stars_repo_name": "fvtt-fria-ligan/deathinspace-foundry-vtt", "max_stars_repo_stars_event_min_datetime": "2021-09-14T12:09:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-20T11:37:49.000Z", "max_issues_repo_path": "module/actor/sheet/hub-sheet.js", "max_issues_repo_name": "fvtt-fria-ligan/deathinspace-foundry-vtt", "max_issues_repo_issues_event_min_datetime": "2021-11-30T03:37:50.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T20:08:27.000Z", "max_forks_repo_path": "module/actor/sheet/hub-sheet.js", "max_forks_repo_name": "fvtt-fria-ligan/deathinspace-foundry-vtt", "max_forks_repo_forks_event_min_datetime": "2021-05-05T02:05:25.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-05T02:05:25.000Z"}
{"max_stars_count": 3, "max_issues_count": 20, "max_forks_count": 1, "avg_line_length": 34.9189189189, "max_line_length": 108, "alphanum_fraction": 0.6377708978}
import DISActorSheet from "./actor-sheet.js";

/**
 * @extends {ActorSheet}
 */
export class DISHubSheet extends DISActorSheet {

  /** @override */
  static get defaultOptions() {
    return mergeObject(super.defaultOptions, {
      classes: ["deathinspace", "sheet", "actor", "hub"],
      template: "systems/deathinspace/templates/actor/hub-sheet.html",
      width: 730,
      height: 680,
      tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "specifics"}],
      dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}]
    });
  }

  /** @override */
  activateListeners(html) {
    super.activateListeners(html);
  }

  /** @override */
  getData() {
    const superData = super.getData();
    const data = superData.data;
    const byName = (a, b) => (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0);
    data.data.frame = data.items.filter(item => item.type === CONFIG.DIS.itemTypes.frame).pop();
    data.data.powerSystem = data.items.filter(item => item.type === CONFIG.DIS.itemTypes.powerSystem).pop();
    data.data.hubModules = data.items.filter(item => item.type === "hubModule").sort(byName);
    data.data.totalPowerCost = data.data.hubModules.reduce((a, b) => a + parseInt(b.data.powerCost), 0);  
    return superData;
  }  
}
  