3.1.0 • Published 2 years ago

lancer-initiative v3.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

lancer-initiative

NPM module for Lancer Initiative

A module providing Combat, Combatant and CombatTracker classes compatible with Foundry v9 that can be used to implement a popcorn style combat tracker in your Foundry VTT system.

Instructions

Install with npm

$ npm install lancer-initiative

Create or copy the necessary handlebars templates. Examples can be found in the main Lancer Intiative module repository.

Css rules for the tracker can be found in the Lancer Intiative main repository, as well as an example configuration form.

Configure your system to use the classes. This exapmle assumes you are using @league-of-foundry-developers/foundry-vtt-types.

// global.d.ts
import type { LancerInitiativeConfig } from "lancer-initiative";

declare global {
  interface CONFIG {
    LancerInitiative: LancerInitiativeConfig<"system-name">;
  }
}

// entrypoint.ts
import {
  LancerCombat,
  LancerCombatant,
  getTrackerAppearance,
  setAppaearance,
} from "lancer-initiative";

Hooks.on("init", () => {
  CONFIG.LancerInitiative = {
    module: game.system.id,
    templatePath: `path/to/the/combat-tracker-template.hbs`,
    def_appearance: {
      icon: "fas fa-chevron-circle-right",
      icon_size: 1.5,
      player_color: "#44abe0",
      friendly_color: "#44abe0",
      neutral_color: "#146464",
      enemy_color: "#d98f30",
      done_color: "#444444",
    },
  };

  // A config form for this can be found at
  // https://github.com/BoltsJ/lancer-initiative
  game.settings.register(game.system.id, "combat-tracker-appearance", {
    scope: "world",
    config: false,
    type: Object,
    onChange: setAppearance,
  });
  // Optional for systems
  game.settings.register(game.system.id, "combat-tracker-sort", {
    name: "LANCERINITIATIVE.SortTracker",
    hint: "LANCERINITIATIVE.SortTrackerDesc",
    scope: "world",
    config: true,
    type: Boolean,
    onChange: v => {
      CONFIG.LancerInitiative.sort = v;
      game.combats?.render();
    },
    default: false,
  });
  CONFIG.LancerInitiative.sort = game.settings.get(
    game.system.id,
    "combat-tracker-sort"
  );

  // Recommended to allow integrations to set up
  Hooks.callAll("LancerInitiativeInit");
  setAppearance(getTrackerAppearance());
});
3.1.0

2 years ago

3.0.0

2 years ago

2.0.2

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago