mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-15 13:11:08 +01:00
Some cleneaup
This commit is contained in:
parent
7eb662ac21
commit
2cf68b7f17
6 changed files with 85 additions and 563 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -10,101 +9,101 @@ const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default class Resources extends HandlebarsApplicationMixin(ApplicationV2) {
|
export default class Resources extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
constructor(options={}) {
|
constructor(options = {}) {
|
||||||
super(options);
|
super(options);
|
||||||
}
|
|
||||||
|
|
||||||
/** @inheritDoc */
|
|
||||||
static DEFAULT_OPTIONS = {
|
|
||||||
id: "resources",
|
|
||||||
classes: [],
|
|
||||||
tag: "div",
|
|
||||||
window: {
|
|
||||||
frame: true,
|
|
||||||
title: "Fear",
|
|
||||||
positioned: true,
|
|
||||||
resizable: true,
|
|
||||||
minimizable: false
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
setFear: Resources.setFear,
|
|
||||||
increaseFear: Resources.increaseFear
|
|
||||||
},
|
|
||||||
position: {
|
|
||||||
width: 222,
|
|
||||||
height: 222,
|
|
||||||
// top: "200px",
|
|
||||||
// left: "120px"
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/** @override */
|
/** @inheritDoc */
|
||||||
static PARTS = {
|
static DEFAULT_OPTIONS = {
|
||||||
resources: {
|
id: 'resources',
|
||||||
root: true,
|
classes: [],
|
||||||
template: "systems/daggerheart/templates/views/resources.hbs"
|
tag: 'div',
|
||||||
// template: "templates/ui/players.hbs"
|
window: {
|
||||||
|
frame: true,
|
||||||
|
title: 'Fear',
|
||||||
|
positioned: true,
|
||||||
|
resizable: true,
|
||||||
|
minimizable: false
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
setFear: Resources.setFear,
|
||||||
|
increaseFear: Resources.increaseFear
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
width: 222,
|
||||||
|
height: 222
|
||||||
|
// top: "200px",
|
||||||
|
// left: "120px"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
resources: {
|
||||||
|
root: true,
|
||||||
|
template: 'systems/daggerheart/templates/views/resources.hbs'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
get currentFear() {
|
||||||
|
return game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
get currentFear() {
|
get maxFear() {
|
||||||
return game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
return game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.MaxFear);
|
||||||
}
|
}
|
||||||
|
|
||||||
get maxFear() {
|
/* -------------------------------------------- */
|
||||||
return game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.MaxFear);
|
/* Rendering */
|
||||||
}
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/** @override */
|
||||||
/* Rendering */
|
async _prepareContext(_options) {
|
||||||
/* -------------------------------------------- */
|
const display = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.DisplayFear),
|
||||||
|
current = this.currentFear,
|
||||||
|
max = this.maxFear,
|
||||||
|
percent = (current / max) * 100,
|
||||||
|
isGM = game.user.isGM;
|
||||||
|
// Return the data for rendering
|
||||||
|
return { display, current, max, percent, isGM };
|
||||||
|
}
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
async _prepareContext(_options) {
|
async _preFirstRender(context, options) {
|
||||||
const display = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.DisplayFear),
|
options.position = game.user.getFlag(SYSTEM.id, 'app.resources.position') ?? Resources.DEFAULT_OPTIONS.position;
|
||||||
current = this.currentFear,
|
}
|
||||||
max = this.maxFear,
|
|
||||||
percent = (current / max) * 100,
|
|
||||||
isGM = game.user.isGM;
|
|
||||||
// Return the data for rendering
|
|
||||||
return {display, current, max, percent, isGM};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
async _preFirstRender(context, options) {
|
async _preRender(context, options) {
|
||||||
options.position = game.user.getFlag(SYSTEM.id, 'app.resources.position') ?? Resources.DEFAULT_OPTIONS.position;
|
if (this.currentFear > this.maxFear)
|
||||||
}
|
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear, this.maxFear);
|
||||||
|
}
|
||||||
|
|
||||||
/** @override */
|
_onPosition(position) {
|
||||||
async _preRender(context, options) {
|
game.user.setFlag(SYSTEM.id, 'app.resources.position', position);
|
||||||
if(this.currentFear > this.maxFear) await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear, this.maxFear);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_onPosition(position) {
|
async close(options = {}) {
|
||||||
game.user.setFlag(SYSTEM.id, 'app.resources.position', position);
|
if (!options.allowed) return;
|
||||||
}
|
else super.close(options);
|
||||||
|
}
|
||||||
|
|
||||||
async close(options={}) {
|
static async setFear(event, target) {
|
||||||
if(!options.allowed) return;
|
if (!game.user.isGM) return;
|
||||||
else super.close(options);
|
const fearCount = Number(target.dataset.index ?? 0);
|
||||||
}
|
await this.updateFear(this.currentFear === fearCount + 1 ? fearCount : fearCount + 1);
|
||||||
|
}
|
||||||
|
|
||||||
static async setFear(event, target) {
|
static async increaseFear(event, target) {
|
||||||
if(!game.user.isGM) return;
|
let value = target.dataset.increment ?? 0,
|
||||||
const fearCount = Number(target.dataset.index ?? 0);
|
operator = value.split('')[0] ?? null;
|
||||||
await this.updateFear(this.currentFear === fearCount + 1 ? fearCount : fearCount + 1);
|
value = Number(value);
|
||||||
}
|
await this.updateFear(operator ? this.currentFear + value : value);
|
||||||
|
}
|
||||||
|
|
||||||
static async increaseFear(event, target) {
|
async updateFear(value) {
|
||||||
let value = target.dataset.increment ?? 0,
|
if (!game.user.isGM) return;
|
||||||
operator = value.split('')[0] ?? null;
|
value = Math.max(0, Math.min(this.maxFear, value));
|
||||||
value = Number(value);
|
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear, value);
|
||||||
await this.updateFear(operator ? this.currentFear + value : value);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async updateFear(value) {
|
|
||||||
if(!game.user.isGM) return;
|
|
||||||
value = Math.max(0, Math.min(this.maxFear, value));
|
|
||||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -20,34 +20,4 @@ export default class DhpCombat extends Combat {
|
||||||
|
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// async useActionToken(combatantId) {
|
|
||||||
// const automateActionPoints = await game.settings.get(
|
|
||||||
// SYSTEM.id,
|
|
||||||
// SYSTEM.SETTINGS.gameSettings.Automation.ActionPoints
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (game.user.isGM) {
|
|
||||||
// if (this.system.actions < 1) return;
|
|
||||||
|
|
||||||
// const update = automateActionPoints
|
|
||||||
// ? { 'system.activeCombatant': combatantId, 'system.actions': Math.max(this.system.actions - 1, 0) }
|
|
||||||
// : { 'system.activeCombatant': combatantId };
|
|
||||||
|
|
||||||
// await this.update(update);
|
|
||||||
// } else {
|
|
||||||
// const update = automateActionPoints
|
|
||||||
// ? { 'system.activeCombatant': combatantId, 'system.actions': this.system.actions + 1 }
|
|
||||||
// : { 'system.activeCombatant': combatantId };
|
|
||||||
|
|
||||||
// await game.socket.emit(`system.${SYSTEM.id}`, {
|
|
||||||
// action: socketEvent.GMUpdate,
|
|
||||||
// data: {
|
|
||||||
// action: GMUpdateEvent.UpdateDocument,
|
|
||||||
// uuid: this.uuid,
|
|
||||||
// update: update
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,199 +0,0 @@
|
||||||
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
|
||||||
|
|
||||||
export default class DhpCombatTracker extends foundry.applications.sidebar.tabs.CombatTracker {
|
|
||||||
constructor(data, context) {
|
|
||||||
super(data, context);
|
|
||||||
|
|
||||||
Hooks.on(socketEvent.DhpFearUpdate, this.onFearUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
get template() {
|
|
||||||
return 'systems/daggerheart/templates/ui/combatTracker.hbs';
|
|
||||||
}
|
|
||||||
|
|
||||||
activateListeners(html) {
|
|
||||||
super.activateListeners(html);
|
|
||||||
html.on('click', '.token-action-tokens .use-action-token', this.useActionToken.bind(this));
|
|
||||||
html.on('click', '.encounter-gm-resources .trade-actions', this.tradeActions.bind(this));
|
|
||||||
html.on('click', '.encounter-gm-resources .trade-fear', this.tradeFear.bind(this));
|
|
||||||
html.on('click', '.encounter-gm-resources .icon-button.up', this.increaseResource.bind(this));
|
|
||||||
html.on('click', '.encounter-gm-resources .icon-button.down', this.decreaseResource.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
async useActionToken(event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
const combatant = event.currentTarget.dataset.combatant;
|
|
||||||
await game.combat.useActionToken(combatant);
|
|
||||||
}
|
|
||||||
|
|
||||||
async tradeActions(event) {
|
|
||||||
if (event.currentTarget.classList.contains('disabled')) return;
|
|
||||||
|
|
||||||
const currentFear = await game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
|
||||||
const value = currentFear + 1;
|
|
||||||
|
|
||||||
if (value <= 6) {
|
|
||||||
Hooks.callAll(socketEvent.GMUpdate, GMUpdateEvent.UpdateFear, null, value);
|
|
||||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
|
||||||
action: socketEvent.GMUpdate,
|
|
||||||
data: { action: GMUpdateEvent.UpdateFear, update: value }
|
|
||||||
});
|
|
||||||
await game.combat.update({ 'system.actions': game.combat.system.actions - 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async tradeFear() {
|
|
||||||
if (event.currentTarget.classList.contains('disabled')) return;
|
|
||||||
|
|
||||||
const currentFear = await game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
|
||||||
const value = currentFear - 1;
|
|
||||||
if (value >= 0) {
|
|
||||||
Hooks.callAll(socketEvent.GMUpdate, GMUpdateEvent.UpdateFear, null, value);
|
|
||||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
|
||||||
action: socketEvent.GMUpdate,
|
|
||||||
data: { action: GMUpdateEvent.UpdateFear, update: value }
|
|
||||||
});
|
|
||||||
await game.combat.update({ 'system.actions': game.combat.system.actions + 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async increaseResource(event) {
|
|
||||||
if (event.currentTarget.dataset.type === 'action') {
|
|
||||||
await game.combat.update({ 'system.actions': game.combat.system.actions + 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentFear = await game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
|
||||||
const value = currentFear + 1;
|
|
||||||
if (event.currentTarget.dataset.type === 'fear' && value <= 6) {
|
|
||||||
Hooks.callAll(socketEvent.GMUpdate, GMUpdateEvent.UpdateFear, null, value);
|
|
||||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
|
||||||
action: socketEvent.GMUpdate,
|
|
||||||
data: { action: GMUpdateEvent.UpdateFear, update: value }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async decreaseResource(event) {
|
|
||||||
if (event.currentTarget.dataset.type === 'action' && game.combat.system.actions - 1 >= 0) {
|
|
||||||
await game.combat.update({ 'system.actions': game.combat.system.actions - 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentFear = await game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
|
||||||
const value = currentFear - 1;
|
|
||||||
if (event.currentTarget.dataset.type === 'fear' && value >= 0) {
|
|
||||||
Hooks.callAll(socketEvent.GMUpdate, GMUpdateEvent.UpdateFear, null, value);
|
|
||||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
|
||||||
action: socketEvent.GMUpdate,
|
|
||||||
data: { action: GMUpdateEvent.UpdateFear, update: value }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async getData(options = {}) {
|
|
||||||
let context = await super.getData(options);
|
|
||||||
|
|
||||||
// Get the combat encounters possible for the viewed Scene
|
|
||||||
const combat = this.viewed;
|
|
||||||
const hasCombat = combat !== null;
|
|
||||||
const combats = this.combats;
|
|
||||||
const currentIdx = combats.findIndex(c => c === combat);
|
|
||||||
const previousId = currentIdx > 0 ? combats[currentIdx - 1].id : null;
|
|
||||||
const nextId = currentIdx < combats.length - 1 ? combats[currentIdx + 1].id : null;
|
|
||||||
const settings = game.settings.get('core', Combat.CONFIG_SETTING);
|
|
||||||
|
|
||||||
// Prepare rendering data
|
|
||||||
context = foundry.utils.mergeObject(context, {
|
|
||||||
combats: combats,
|
|
||||||
currentIndex: currentIdx + 1,
|
|
||||||
combatCount: combats.length,
|
|
||||||
hasCombat: hasCombat,
|
|
||||||
combat,
|
|
||||||
turns: [],
|
|
||||||
previousId,
|
|
||||||
nextId,
|
|
||||||
started: this.started,
|
|
||||||
control: false,
|
|
||||||
settings,
|
|
||||||
linked: combat?.scene !== null,
|
|
||||||
labels: {}
|
|
||||||
});
|
|
||||||
context.labels.scope = game.i18n.localize(`COMBAT.${context.linked ? 'Linked' : 'Unlinked'}`);
|
|
||||||
if (!hasCombat) return context;
|
|
||||||
|
|
||||||
// Format information about each combatant in the encounter
|
|
||||||
let hasDecimals = false;
|
|
||||||
const turns = [];
|
|
||||||
for (let [i, combatant] of combat.turns.entries()) {
|
|
||||||
if (!combatant.visible) continue;
|
|
||||||
|
|
||||||
// Prepare turn data
|
|
||||||
const resource =
|
|
||||||
combatant.permission >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER ? combatant.resource : null;
|
|
||||||
const turn = {
|
|
||||||
id: combatant.id,
|
|
||||||
name: combatant.name,
|
|
||||||
img: await this._getCombatantThumbnail(combatant),
|
|
||||||
active: combatant.id === combat.system.activeCombatant,
|
|
||||||
owner: combatant.isOwner,
|
|
||||||
defeated: combatant.isDefeated,
|
|
||||||
hidden: combatant.hidden,
|
|
||||||
initiative: combatant.initiative,
|
|
||||||
hasRolled: combatant.initiative !== null,
|
|
||||||
hasResource: resource !== null,
|
|
||||||
resource: resource,
|
|
||||||
canPing: combatant.sceneId === canvas.scene?.id && game.user.hasPermission('PING_CANVAS'),
|
|
||||||
playerCharacter: game.user?.character?.id === combatant.actor.id,
|
|
||||||
ownedByPlayer: combatant.hasPlayerOwner
|
|
||||||
};
|
|
||||||
if (turn.initiative !== null && !Number.isInteger(turn.initiative)) hasDecimals = true;
|
|
||||||
turn.css = [turn.active ? 'active' : '', turn.hidden ? 'hidden' : '', turn.defeated ? 'defeated' : '']
|
|
||||||
.join(' ')
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
// Actor and Token status effects
|
|
||||||
turn.effects = new Set();
|
|
||||||
if (combatant.token) {
|
|
||||||
combatant.token.effects.forEach(e => turn.effects.add(e));
|
|
||||||
if (combatant.token.overlayEffect) turn.effects.add(combatant.token.overlayEffect);
|
|
||||||
}
|
|
||||||
if (combatant.actor) {
|
|
||||||
for (const effect of combatant.actor.temporaryEffects) {
|
|
||||||
if (effect.statuses.has(CONFIG.specialStatusEffects.DEFEATED)) turn.defeated = true;
|
|
||||||
else if (effect.icon) turn.effects.add(effect.icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
turns.push(turn);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format initiative numeric precision
|
|
||||||
const precision = CONFIG.Combat.initiative.decimals;
|
|
||||||
turns.forEach(t => {
|
|
||||||
if (t.initiative !== null) t.initiative = t.initiative.toFixed(hasDecimals ? precision : 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
const fear = await game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
|
||||||
|
|
||||||
// Merge update data for rendering
|
|
||||||
return foundry.utils.mergeObject(context, {
|
|
||||||
round: combat.round,
|
|
||||||
turn: combat.turn,
|
|
||||||
turns: turns,
|
|
||||||
control: combat.combatant?.players?.includes(game.user),
|
|
||||||
fear: fear
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onFearUpdate = async () => {
|
|
||||||
this.render(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
async close(options) {
|
|
||||||
Hooks.off(socketEvent.DhpFearUpdate, this.onFearUpdate);
|
|
||||||
|
|
||||||
return super.close(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
|
||||||
|
|
||||||
export default class DhpPlayers extends foundry.applications.ui.Players {
|
|
||||||
constructor(data, context) {
|
|
||||||
super(data, context);
|
|
||||||
|
|
||||||
Hooks.on(socketEvent.DhpFearUpdate, this.onFearUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
get template() {
|
|
||||||
return 'systems/daggerheart/templates/ui/players.hbs';
|
|
||||||
}
|
|
||||||
|
|
||||||
async getData(options = {}) {
|
|
||||||
const context = super.getData(options);
|
|
||||||
context.fear = await game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
|
||||||
context.user = game.user;
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
activateListeners(html) {
|
|
||||||
// Toggle online/offline
|
|
||||||
html.find('.players-mode').click(this._onToggleOfflinePlayers.bind(this));
|
|
||||||
html.find('.fear-control.up').click(async event => await this.updateFear(event, 1));
|
|
||||||
html.find('.fear-control.down').click(async event => await this.updateFear(event, -1));
|
|
||||||
|
|
||||||
// Context menu
|
|
||||||
const contextOptions = this._getUserContextOptions();
|
|
||||||
Hooks.call('getUserContextOptions', html, contextOptions);
|
|
||||||
new ContextMenu(html, '.player', contextOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
async updateFear(_, change) {
|
|
||||||
const fear = await game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear);
|
|
||||||
const value = Math.max(Math.min(fear + change, 6), 0);
|
|
||||||
Hooks.callAll(socketEvent.GMUpdate, GMUpdateEvent.UpdateFear, null, value);
|
|
||||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
|
||||||
action: socketEvent.GMUpdate,
|
|
||||||
data: { action: GMUpdateEvent.UpdateFear, update: value }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onFearUpdate = async () => {
|
|
||||||
this.render(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
async close(options) {
|
|
||||||
Hooks.off(socketEvent.DhpFearUpdate, this.onFearUpdate);
|
|
||||||
|
|
||||||
return super.close(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,160 +0,0 @@
|
||||||
<section class="{{cssClass}} directory flexcol" id="{{cssId}}" data-tab="{{tabName}}">
|
|
||||||
<header class="combat-tracker-header">
|
|
||||||
{{#if user.isGM}}
|
|
||||||
<nav class="encounters flexrow" aria-label="{{localize 'COMBAT.NavLabel'}}">
|
|
||||||
<a class="combat-button combat-create" aria-label="{{localize 'COMBAT.Create'}}" role="button" data-tooltip="COMBAT.Create">
|
|
||||||
<i class="fas fa-plus"></i>
|
|
||||||
</a>
|
|
||||||
{{#if combatCount}}
|
|
||||||
<a class="combat-button combat-cycle" aria-label="{{localize 'COMBAT.EncounterPrevious'}}" role="button" data-tooltip="COMBAT.EncounterPrevious"
|
|
||||||
{{#if previousId}}data-document-id="{{previousId}}"{{else}}disabled{{/if}}>
|
|
||||||
<i class="fas fa-caret-left"></i>
|
|
||||||
</a>
|
|
||||||
<h4 class="encounter">{{localize "COMBAT.Encounter"}} {{currentIndex}} / {{combatCount}}</h4>
|
|
||||||
<a class="combat-button combat-cycle" aria-label="{{localize 'COMBAT.EncounterNext'}}" role="button" data-tooltip="COMBAT.EncounterNext"
|
|
||||||
{{#if nextId}}data-document-id="{{nextId}}"{{else}}disabled{{/if}}>
|
|
||||||
<i class="fas fa-caret-right"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.Delete'}}" role="button" data-tooltip="COMBAT.Delete" data-control="endCombat" {{#unless combatCount}}disabled{{/unless}}>
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</nav>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="encounter-controls flexrow {{#if hasCombat}}combat{{/if}}">
|
|
||||||
{{#if user.isGM}}
|
|
||||||
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.RollAll'}}" role="button" data-tooltip="COMBAT.RollAll" data-control="rollAll" {{#unless turns}}disabled{{/unless}}>
|
|
||||||
<i class="fas fa-users"></i>
|
|
||||||
</a>
|
|
||||||
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.RollNPC'}}" role="button" data-tooltip="COMBAT.RollNPC" data-control="rollNPC" {{#unless turns}}disabled{{/unless}}>
|
|
||||||
<i class="fas fa-users-cog"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if combatCount}}
|
|
||||||
{{#if combat.round}}
|
|
||||||
<h3 class="encounter-title noborder">{{localize 'COMBAT.Round'}} {{combat.round}}</h3>
|
|
||||||
{{else}}
|
|
||||||
<h3 class="encounter-title noborder">{{localize 'COMBAT.NotStarted'}}</h3>
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
<h3 class="encounter-title noborder">{{localize "COMBAT.None"}}</h3>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if user.isGM}}
|
|
||||||
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.InitiativeReset'}}" role="button" data-tooltip="COMBAT.InitiativeReset" data-control="resetAll"
|
|
||||||
{{#unless hasCombat}}disabled{{/unless}}>
|
|
||||||
<i class="fas fa-undo"></i>
|
|
||||||
</a>
|
|
||||||
<a class="combat-button combat-control" aria-label="{{localize 'labels.scope'}}" role="button" data-tooltip="{{labels.scope}}"
|
|
||||||
data-control="toggleSceneLink" {{#unless hasCombat}}disabled{{/unless}}>
|
|
||||||
<i class="fas fa-{{#unless linked}}un{{/unless}}link"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
<a class="combat-button combat-settings" aria-label="{{localize 'COMBAT.Settings'}}" role="button" data-tooltip="COMBAT.Settings" data-control="trackerSettings">
|
|
||||||
<i class="fas fa-cog"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="encounter-gm-resources">
|
|
||||||
{{#if combat.system}}
|
|
||||||
<div class="gm-resource-controls">
|
|
||||||
<i class="fa-solid fa-caret-up icon-button up" data-type="action"></i>
|
|
||||||
<i class="fa-solid fa-caret-down icon-button down {{#if (lte combat.system.actions 0)}}disabled{{/if}}" data-type="action"></i>
|
|
||||||
</div>
|
|
||||||
<div class="gm-resource">
|
|
||||||
<i class="fa-solid fa-hand-sparkles"></i>
|
|
||||||
<span>{{combat.system.actions}}</span>
|
|
||||||
</div>
|
|
||||||
<div class="gm-resource-tools">
|
|
||||||
<i class="fa-solid fa-arrow-right-long trade-actions {{#if (lt combat.system.actions 2)}}disabled{{/if}}"></i>
|
|
||||||
<i class="fa-solid fa-arrow-left-long trade-fear {{#if (lt fear 1)}}disabled{{/if}}"></i>
|
|
||||||
</div>
|
|
||||||
<div class="gm-resource">
|
|
||||||
<i class="fa-solid fa-skull"></i>
|
|
||||||
<span>{{fear}}</span>
|
|
||||||
</div>
|
|
||||||
<div class="gm-resource-controls">
|
|
||||||
<i class="fa-solid fa-caret-up icon-button up {{#if (gte fear 6)}}disabled{{/if}}" data-type="fear"></i>
|
|
||||||
<i class="fa-solid fa-caret-down icon-button down {{#if (lte fear 0)}}disabled{{/if}}" data-type="fear"></i>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ol id="combat-tracker" class="directory-list">
|
|
||||||
{{#each turns}}
|
|
||||||
<li class="combatant actor directory-item flexrow {{this.css}}" data-combatant-id="{{this.id}}">
|
|
||||||
<img class="token-image" data-src="{{this.img}}" alt="{{this.name}}"/>
|
|
||||||
<div class="token-name flexcol">
|
|
||||||
<h4>{{this.name}}</h4>
|
|
||||||
<div class="combatant-controls flexrow">
|
|
||||||
{{#if ../user.isGM}}
|
|
||||||
<a class="combatant-control {{#if this.hidden}}active{{/if}}" aria-label="{{localize 'COMBAT.ToggleVis'}}" role="button" data-tooltip="COMBAT.ToggleVis" data-control="toggleHidden">
|
|
||||||
<i class="fas fa-eye-slash"></i>
|
|
||||||
</a>
|
|
||||||
<a class="combatant-control {{#if this.defeated}}active{{/if}}" aria-label="{{localize 'COMBAT.ToggleDead'}}" role="button" data-tooltip="COMBAT.ToggleDead" data-control="toggleDefeated">
|
|
||||||
<i class="fas fa-skull"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
{{#if this.canPing}}
|
|
||||||
<a class="combatant-control" aria-label="{{localize 'COMBAT.PingCombatant'}}" role="button" data-tooltip="COMBAT.PingCombatant" data-control="pingCombatant">
|
|
||||||
<i class="fa-solid fa-bullseye-arrow"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
{{#unless ../user.isGM}}
|
|
||||||
<a class="combatant-control" aria-label="{{localize 'COMBAT.PanToCombatant'}}" role="button" data-tooltip="COMBAT.PanToCombatant" data-control="panToCombatant">
|
|
||||||
<i class="fa-solid fa-arrows-to-eye"></i>
|
|
||||||
</a>
|
|
||||||
{{/unless}}
|
|
||||||
<div class="token-effects">
|
|
||||||
{{#each this.effects}}
|
|
||||||
<img class="token-effect" src="{{this}}"/>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if this.hasResource}}
|
|
||||||
<div class="token-resource">
|
|
||||||
<span class="resource">{{this.resource}}</span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="token-action-tokens">
|
|
||||||
{{#if this.playerCharacter}}
|
|
||||||
<i class="fa-solid fa-hand use-action-token" data-combatant="{{this.id}}"></i>
|
|
||||||
{{else if (and (not this.ownedByPlayer) ../user.isGM)}}
|
|
||||||
<i class="fa-solid fa-hand use-action-token {{#if (lt ../combat.system.actions 1)}}disabled{{/if}}" data-combatant="{{this.id}}"></i>
|
|
||||||
{{/if}}
|
|
||||||
{{!-- {{#if this.hasRolled}}
|
|
||||||
<span class="initiative">{{this.initiative}}</span>
|
|
||||||
{{else if this.owner}}
|
|
||||||
<a class="combatant-control roll" aria-label="{{localize 'COMBAT.InitiativeRoll'}}" role="button" data-tooltip="COMBAT.InitiativeRoll" data-control="rollInitiative"></a>
|
|
||||||
{{/if}} --}}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{{/each}}
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<nav id="combat-controls" class="directory-footer flexrow" data-tooltip-direction="UP">
|
|
||||||
{{#if hasCombat}}
|
|
||||||
{{#if user.isGM}}
|
|
||||||
{{#if round}}
|
|
||||||
<a class="combat-control" aria-label="{{localize 'COMBAT.RoundPrev'}}" role="button" data-tooltip="COMBAT.RoundPrev" data-control="previousRound"><i class="fas fa-step-backward"></i></a>
|
|
||||||
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnPrev'}}" role="button" data-tooltip="COMBAT.TurnPrev" data-control="previousTurn"><i class="fas fa-arrow-left"></i></a>
|
|
||||||
<a class="combat-control center" aria-label="{{localize 'COMBAT.End'}}" role="button" data-control="endCombat">{{localize 'COMBAT.End'}}</a>
|
|
||||||
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnNext'}}" role="button" data-tooltip="COMBAT.TurnNext" data-control="nextTurn"><i class="fas fa-arrow-right"></i></a>
|
|
||||||
<a class="combat-control" aria-label="{{localize 'COMBAT.RoundNext'}}" role="button" data-tooltip="COMBAT.RoundNext" data-control="nextRound"><i class="fas fa-step-forward"></i></a>
|
|
||||||
{{else}}
|
|
||||||
<a class="combat-control center" aria-label="{{localize 'COMBAT.Begin'}}" role="button" data-control="startCombat">{{localize 'COMBAT.Begin'}}</a>
|
|
||||||
{{/if}}
|
|
||||||
{{else if control}}
|
|
||||||
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnPrev'}}" role="button" data-tooltip="COMBAT.TurnPrev" data-control="previousTurn"><i class="fas fa-arrow-left"></i></a>
|
|
||||||
<a class="combat-control center" aria-label="{{localize 'COMBAT.TurnEnd'}}" role="button" data-control="nextTurn">{{localize 'COMBAT.TurnEnd'}}</a>
|
|
||||||
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnNext'}}" role="button" data-tooltip="COMBAT.TurnNext" data-control="nextTurn"><i class="fas fa-arrow-right"></i></a>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
</nav>
|
|
||||||
</section>
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
<aside id="players" class="app daggerheart {{#if hide}}hidden{{/if}}">
|
|
||||||
<h3 aria-label="{{localize 'PLAYERS.Title'}}" role="button">
|
|
||||||
<div class="flex-centered">
|
|
||||||
<i class="fas fa-users"></i>
|
|
||||||
{{ localize "PLAYERS.Title" }}
|
|
||||||
{{#if showOffline}}
|
|
||||||
<i class="players-mode fas fa-angle-down"></i>
|
|
||||||
{{else}}
|
|
||||||
<i class="players-mode fas fa-angle-up"></i>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
<div class="players-container">
|
|
||||||
<i class="fa-solid fa-skull"></i>
|
|
||||||
<div>{{this.fear}}</div>
|
|
||||||
{{#if user.isGM}}
|
|
||||||
<div class="flexcol">
|
|
||||||
<i class="fa-solid fa-chevron-up fear-control up {{#if (gte this.fear 6)}}disabled{{/if}}"></i>
|
|
||||||
<i class="fa-solid fa-chevron-down fear-control down {{#if (lte this.fear 0)}}disabled{{/if}}"></i>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<ol aria-label="{{localize 'PLAYERS.List'}}" tabIndex="0" id="player-list">
|
|
||||||
{{#each users as |user|}}
|
|
||||||
<li class="player {{#if user.isGM}}gm{{/if}} flexrow" data-user-id="{{user._id}}">
|
|
||||||
<span class="player-active {{#if user.active}}active{{else}}inactive{{/if}}"
|
|
||||||
style="background: {{user.color}}; border: 1px solid {{user.border.css}}"></span>
|
|
||||||
<span class="player-name {{#if user.isSelf}}self{{/if}}" data-tooltip="{{user.displayName}}">
|
|
||||||
{{user.displayName}}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
{{/each}}
|
|
||||||
</ol>
|
|
||||||
</aside>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue