mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 13:41:07 +01:00
Temp
This commit is contained in:
parent
6c147a5c00
commit
0f77697614
14 changed files with 589 additions and 343 deletions
|
|
@ -3,11 +3,10 @@ import * as applications from './module/applications/_module.mjs';
|
||||||
import * as models from './module/data/_module.mjs';
|
import * as models from './module/data/_module.mjs';
|
||||||
import * as documents from './module/documents/_module.mjs';
|
import * as documents from './module/documents/_module.mjs';
|
||||||
import RegisterHandlebarsHelpers from './module/helpers/handlebarsHelper.mjs';
|
import RegisterHandlebarsHelpers from './module/helpers/handlebarsHelper.mjs';
|
||||||
import DhpCombatTracker from './module/ui/combatTracker.mjs';
|
import DhCombatTracker from './module/ui/combatTracker.mjs';
|
||||||
import { GMUpdateEvent, handleSocketEvent, socketEvent } from './module/helpers/socket.mjs';
|
import { GMUpdateEvent, handleSocketEvent, socketEvent } from './module/helpers/socket.mjs';
|
||||||
import { registerDHSettings } from './module/applications/settings.mjs';
|
import { registerDHSettings } from './module/applications/settings.mjs';
|
||||||
import DhpChatLog from './module/ui/chatLog.mjs';
|
import DhpChatLog from './module/ui/chatLog.mjs';
|
||||||
import DhpPlayers from './module/ui/players.mjs';
|
|
||||||
import DhpRuler from './module/ui/ruler.mjs';
|
import DhpRuler from './module/ui/ruler.mjs';
|
||||||
import DhpTokenRuler from './module/ui/tokenRuler.mjs';
|
import DhpTokenRuler from './module/ui/tokenRuler.mjs';
|
||||||
import { dualityRollEnricher } from './module/enrichers/DualityRollEnricher.mjs';
|
import { dualityRollEnricher } from './module/enrichers/DualityRollEnricher.mjs';
|
||||||
|
|
@ -65,11 +64,11 @@ Hooks.once('init', () => {
|
||||||
Actors.registerSheet(SYSTEM.id, applications.DhpEnvironment, { types: ['environment'], makeDefault: true });
|
Actors.registerSheet(SYSTEM.id, applications.DhpEnvironment, { types: ['environment'], makeDefault: true });
|
||||||
|
|
||||||
CONFIG.Combat.dataModels = {
|
CONFIG.Combat.dataModels = {
|
||||||
base: models.DhpCombat
|
base: models.DhCombat
|
||||||
};
|
};
|
||||||
|
|
||||||
CONFIG.Combatant.dataModels = {
|
CONFIG.Combatant.dataModels = {
|
||||||
base: models.DhpCombatant
|
base: models.DhCombatant
|
||||||
};
|
};
|
||||||
|
|
||||||
CONFIG.ChatMessage.dataModels = models.messages.config;
|
CONFIG.ChatMessage.dataModels = models.messages.config;
|
||||||
|
|
@ -77,7 +76,7 @@ Hooks.once('init', () => {
|
||||||
|
|
||||||
CONFIG.Canvas.rulerClass = DhpRuler;
|
CONFIG.Canvas.rulerClass = DhpRuler;
|
||||||
CONFIG.Combat.documentClass = documents.DhpCombat;
|
CONFIG.Combat.documentClass = documents.DhpCombat;
|
||||||
CONFIG.ui.combat = DhpCombatTracker;
|
CONFIG.ui.combat = DhCombatTracker;
|
||||||
CONFIG.ui.chat = DhpChatLog;
|
CONFIG.ui.chat = DhpChatLog;
|
||||||
// CONFIG.ui.players = DhpPlayers;
|
// CONFIG.ui.players = DhpPlayers;
|
||||||
CONFIG.Token.rulerClass = DhpTokenRuler;
|
CONFIG.Token.rulerClass = DhpTokenRuler;
|
||||||
|
|
@ -98,7 +97,7 @@ Hooks.once('init', () => {
|
||||||
Hooks.on('ready', () => {
|
Hooks.on('ready', () => {
|
||||||
ui.resources = new CONFIG.ui.resources();
|
ui.resources = new CONFIG.ui.resources();
|
||||||
ui.resources.render({ force: true });
|
ui.resources.render({ force: true });
|
||||||
})
|
});
|
||||||
|
|
||||||
Hooks.once('dicesoniceready', () => {});
|
Hooks.once('dicesoniceready', () => {});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,10 @@
|
||||||
"grimoire": "Grimoire"
|
"grimoire": "Grimoire"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Combat": {
|
||||||
|
"takeSpotlight": "Take The Spotlight",
|
||||||
|
"combatStarted": "Active"
|
||||||
|
},
|
||||||
"LevelUp": {
|
"LevelUp": {
|
||||||
"Tier1": {
|
"Tier1": {
|
||||||
"Label": "Level 2-4",
|
"Label": "Level 2-4",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
export { default as DhpPC } from './pc.mjs';
|
export { default as DhpPC } from './pc.mjs';
|
||||||
export { default as DhpCombat } from './combat.mjs';
|
export { default as DhCombat } from './combat.mjs';
|
||||||
export { default as DhpCombatant } from './combatant.mjs';
|
export { default as DhCombatant } from './combatant.mjs';
|
||||||
export { default as DhpAdversary } from './adversary.mjs';
|
export { default as DhpAdversary } from './adversary.mjs';
|
||||||
export { default as DhpEnvironment } from './environment.mjs';
|
export { default as DhpEnvironment } from './environment.mjs';
|
||||||
|
|
||||||
export * as items from "./item/_module.mjs";
|
export * as items from './item/_module.mjs';
|
||||||
export * as messages from "./chat-message/_modules.mjs";
|
export * as messages from './chat-message/_modules.mjs';
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
export default class DhpCombat extends foundry.abstract.TypeDataModel {
|
export default class DhCombat extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
actions: new fields.NumberField({ initial: 0, integer: true }),
|
actions: new fields.NumberField({ initial: 0, integer: true }),
|
||||||
activeCombatant: new fields.StringField({})
|
started: new fields.BooleanField({ required: true, initial: false })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
export default class DhpCombatant extends foundry.abstract.TypeDataModel {
|
export default class DhCombatant extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
active: new fields.BooleanField({ initial: false })
|
active: new fields.BooleanField({ initial: false }),
|
||||||
|
actionTokens: new fields.NumberField({ required: true, integer: true, initial: 3 })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,53 @@
|
||||||
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
|
||||||
|
|
||||||
export default class DhpCombat extends Combat {
|
export default class DhpCombat extends Combat {
|
||||||
_sortCombatants(a, b) {
|
get combatant() {
|
||||||
if (a.isNPC !== b.isNPC) {
|
return this.combatants.contents.find(x => x.system.active) ?? null;
|
||||||
const aVal = a.isNPC ? 0 : 1;
|
}
|
||||||
const bVal = b.isNPC ? 0 : 1;
|
|
||||||
|
|
||||||
return aVal - bVal;
|
async startCombat() {
|
||||||
|
this._playCombatSound('startEncounter');
|
||||||
|
const updateData = { 'system.started': true };
|
||||||
|
Hooks.callAll('combatStart', this, updateData);
|
||||||
|
await this.update(updateData);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
_sortCombatants(a, b) {
|
||||||
|
const aNPC = Number(a.isNPC);
|
||||||
|
const bNPC = Number(b.isNPC);
|
||||||
|
if (aNPC !== bNPC) {
|
||||||
|
return aNPC - bNPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
async useActionToken(combatantId) {
|
// async useActionToken(combatantId) {
|
||||||
const automateActionPoints = await game.settings.get(
|
// const automateActionPoints = await game.settings.get(
|
||||||
SYSTEM.id,
|
// SYSTEM.id,
|
||||||
SYSTEM.SETTINGS.gameSettings.Automation.ActionPoints
|
// SYSTEM.SETTINGS.gameSettings.Automation.ActionPoints
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (game.user.isGM) {
|
// if (game.user.isGM) {
|
||||||
if (this.system.actions < 1) return;
|
// if (this.system.actions < 1) return;
|
||||||
|
|
||||||
const update = automateActionPoints
|
// const update = automateActionPoints
|
||||||
? { 'system.activeCombatant': combatantId, 'system.actions': Math.max(this.system.actions - 1, 0) }
|
// ? { 'system.activeCombatant': combatantId, 'system.actions': Math.max(this.system.actions - 1, 0) }
|
||||||
: { 'system.activeCombatant': combatantId };
|
// : { 'system.activeCombatant': combatantId };
|
||||||
|
|
||||||
await this.update(update);
|
// await this.update(update);
|
||||||
} else {
|
// } else {
|
||||||
const update = automateActionPoints
|
// const update = automateActionPoints
|
||||||
? { 'system.activeCombatant': combatantId, 'system.actions': this.system.actions + 1 }
|
// ? { 'system.activeCombatant': combatantId, 'system.actions': this.system.actions + 1 }
|
||||||
: { 'system.activeCombatant': combatantId };
|
// : { 'system.activeCombatant': combatantId };
|
||||||
|
|
||||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
// await game.socket.emit(`system.${SYSTEM.id}`, {
|
||||||
action: socketEvent.GMUpdate,
|
// action: socketEvent.GMUpdate,
|
||||||
data: {
|
// data: {
|
||||||
action: GMUpdateEvent.UpdateDocument,
|
// action: GMUpdateEvent.UpdateDocument,
|
||||||
uuid: this.uuid,
|
// uuid: this.uuid,
|
||||||
update: update
|
// update: update
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,199 +1,45 @@
|
||||||
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
export default class DhCombatTracker extends foundry.applications.sidebar.tabs.CombatTracker {
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
actions: {
|
||||||
|
takeSpotlight: this.takeSpotlight
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export default class DhpCombatTracker extends foundry.applications.sidebar.tabs.CombatTracker {
|
static PARTS = {
|
||||||
constructor(data, context) {
|
header: {
|
||||||
super(data, context);
|
template: 'systems/daggerheart/templates/ui/combat/combatTrackerHeader.hbs'
|
||||||
|
},
|
||||||
|
tracker: {
|
||||||
|
template: 'systems/daggerheart/templates/ui/combat/combatTracker.hbs'
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
template: 'systems/daggerheart/templates/ui/combat/combatTrackerFooter.hbs'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Hooks.on(socketEvent.DhpFearUpdate, this.onFearUpdate);
|
_getCombatContextOptions() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: 'COMBAT.ClearMovementHistories',
|
||||||
|
icon: '<i class="fa-solid fa-shoe-prints"></i>',
|
||||||
|
condition: () => game.user.isGM && this.viewed?.combatants.size > 0,
|
||||||
|
callback: () => this.viewed.clearMovementHistories()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'COMBAT.Delete',
|
||||||
|
icon: '<i class="fa-solid fa-trash"></i>',
|
||||||
|
condition: () => game.user.isGM && !!this.viewed,
|
||||||
|
callback: () => this.viewed.endCombat()
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
get template() {
|
static async takeSpotlight(_, target) {
|
||||||
return 'systems/daggerheart/templates/ui/combatTracker.hbs';
|
const { combatantId } = target.closest('[data-combatant-id]')?.dataset ?? {};
|
||||||
}
|
for (var combatant of this.viewed.combatants) {
|
||||||
|
await combatant.update({ 'system.active': combatantId === combatant.id ? true : false });
|
||||||
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();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
199
module/ui/combatTrackerOld.mjs
Normal file
199
module/ui/combatTrackerOld.mjs
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1293,59 +1293,44 @@
|
||||||
.daggerheart.sheet.pc div[data-application-part] .sheet-body .inventory-container .inventory-item-list .inventory-row img {
|
.daggerheart.sheet.pc div[data-application-part] .sheet-body .inventory-container .inventory-item-list .inventory-row img {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
}
|
}
|
||||||
.combat-sidebar .encounter-gm-resources {
|
.combat-sidebar .encounter-controls.combat {
|
||||||
flex: 0;
|
justify-content: space-between;
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 8px 0;
|
|
||||||
}
|
}
|
||||||
.combat-sidebar .encounter-gm-resources .gm-resource-controls {
|
.combat-sidebar .encounter-controls.combat .encounter-control-fear-container {
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
.combat-sidebar .encounter-controls.combat .encounter-control-fear-container .dice {
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
.combat-sidebar .encounter-controls.combat .encounter-control-fear-container .encounter-control-fear {
|
||||||
|
position: absolute;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.combat-sidebar .encounter-controls.combat .encounter-control-fear-container .encounter-control-counter {
|
||||||
|
position: absolute;
|
||||||
|
right: -10px;
|
||||||
|
color: var(--color-text-secondary);
|
||||||
|
}
|
||||||
|
.combat-sidebar .encounter-controls.combat .control-buttons {
|
||||||
|
width: min-content;
|
||||||
|
}
|
||||||
|
.combat-sidebar .token-actions {
|
||||||
|
flex: 0 0 var(--input-height);
|
||||||
|
align-self: stretch;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 4px;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.combat-sidebar .encounter-gm-resources .gm-resource-tools {
|
.combat-sidebar .token-actions button {
|
||||||
display: flex;
|
font-size: 22px;
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0 5px 0 4px;
|
|
||||||
}
|
}
|
||||||
.combat-sidebar .encounter-gm-resources .gm-resource-tools i {
|
.combat-sidebar .token-actions button:hover {
|
||||||
margin: 0 2px;
|
background: inherit;
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
.combat-sidebar .encounter-gm-resources .gm-resource-tools i.disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
.combat-sidebar .encounter-gm-resources .gm-resource-tools i:hover:not(.disabled) {
|
|
||||||
cursor: pointer;
|
|
||||||
filter: drop-shadow(0 0 3px red);
|
|
||||||
}
|
|
||||||
.combat-sidebar .encounter-gm-resources .gm-resource {
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
padding: 4px;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 2px solid black;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
.combat-sidebar .token-action-tokens {
|
|
||||||
flex: 0 0 48px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.combat-sidebar .token-action-tokens .use-action-token.disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
.combat-sidebar .icon-button.spaced {
|
|
||||||
margin-left: 4px;
|
|
||||||
}
|
|
||||||
.combat-sidebar .icon-button.disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
.combat-sidebar .icon-button:hover:not(.disabled) {
|
|
||||||
cursor: pointer;
|
|
||||||
filter: drop-shadow(0 0 3px red);
|
|
||||||
}
|
}
|
||||||
.chat-message.duality {
|
.chat-message.duality {
|
||||||
border-color: black;
|
border-color: black;
|
||||||
|
|
@ -2903,7 +2888,7 @@ div.daggerheart.views.multiclass {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
src: url(https://fonts.gstatic.com/s/cinzeldecorative/v17/daaHSScvJGqLYhG8nNt8KPPswUAPniZoaelD.ttf) format('truetype');
|
src: url(https://fonts.gstatic.com/s/cinzeldecorative/v18/daaHSScvJGqLYhG8nNt8KPPswUAPniZoaelD.ttf) format('truetype');
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Montserrat';
|
font-family: 'Montserrat';
|
||||||
|
|
|
||||||
165
styles/ui.less
165
styles/ui.less
|
|
@ -1,71 +1,118 @@
|
||||||
.combat-sidebar {
|
.combat-sidebar {
|
||||||
.encounter-gm-resources {
|
// .encounter-gm-resources {
|
||||||
flex: 0;
|
// flex: 0;
|
||||||
display: flex;
|
// display: flex;
|
||||||
justify-content: center;
|
// justify-content: center;
|
||||||
padding: @largePadding 0;
|
// padding: @largePadding 0;
|
||||||
|
|
||||||
.gm-resource-controls {
|
// .gm-resource-controls {
|
||||||
|
// display: flex;
|
||||||
|
// flex-direction: column;
|
||||||
|
// align-items: center;
|
||||||
|
// padding: 0 4px;
|
||||||
|
// justify-content: center;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .gm-resource-tools {
|
||||||
|
// display: flex;
|
||||||
|
// flex-direction: column;
|
||||||
|
// justify-content: center;
|
||||||
|
// padding: 0 5px 0 @fullPadding;
|
||||||
|
|
||||||
|
// i {
|
||||||
|
// margin: 0 @tinyMargin;
|
||||||
|
// font-size: 16px;
|
||||||
|
|
||||||
|
// &.disabled {
|
||||||
|
// opacity: 0.6;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// &:hover:not(.disabled) {
|
||||||
|
// cursor: pointer;
|
||||||
|
// filter: drop-shadow(0 0 3px @mainShadow);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .gm-resource {
|
||||||
|
// background: rgba(255, 255, 255, 0.1);
|
||||||
|
// padding: @fullPadding;
|
||||||
|
// border-radius: 8px;
|
||||||
|
// border: @normalBorder solid black;
|
||||||
|
// font-size: 20px;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .token-action-tokens {
|
||||||
|
// flex: 0 0 48px;
|
||||||
|
// text-align: center;
|
||||||
|
|
||||||
|
// .use-action-token {
|
||||||
|
// &.disabled {
|
||||||
|
// opacity: 0.6;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .icon-button {
|
||||||
|
// &.spaced {
|
||||||
|
// margin-left: @halfMargin;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// &.disabled {
|
||||||
|
// opacity: 0.6;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// &:hover:not(.disabled) {
|
||||||
|
// cursor: pointer;
|
||||||
|
// filter: drop-shadow(0 0 3px @mainShadow);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
.encounter-controls.combat {
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.encounter-control-fear-container {
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: black;
|
||||||
|
|
||||||
|
.dice {
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.encounter-control-fear {
|
||||||
|
position: absolute;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.encounter-control-counter {
|
||||||
|
position: absolute;
|
||||||
|
right: -10px;
|
||||||
|
color: var(--color-text-secondary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-buttons {
|
||||||
|
width: min-content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.token-actions {
|
||||||
|
flex: 0 0 var(--input-height);
|
||||||
|
align-self: stretch;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 4px;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
|
||||||
|
|
||||||
.gm-resource-tools {
|
button {
|
||||||
display: flex;
|
font-size: 22px;
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0 5px 0 @fullPadding;
|
|
||||||
|
|
||||||
i {
|
&:hover {
|
||||||
margin: 0 @tinyMargin;
|
background: inherit;
|
||||||
font-size: 16px;
|
|
||||||
|
|
||||||
&.disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover:not(.disabled) {
|
|
||||||
cursor: pointer;
|
|
||||||
filter: drop-shadow(0 0 3px @mainShadow);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.gm-resource {
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
padding: @fullPadding;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: @normalBorder solid black;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.token-action-tokens {
|
|
||||||
flex: 0 0 48px;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
.use-action-token {
|
|
||||||
&.disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-button {
|
|
||||||
&.spaced {
|
|
||||||
margin-left: @halfMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover:not(.disabled) {
|
|
||||||
cursor: pointer;
|
|
||||||
filter: drop-shadow(0 0 3px @mainShadow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
53
templates/ui/combat/combatTracker.hbs
Normal file
53
templates/ui/combat/combatTracker.hbs
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<ol class="combat-tracker plain">
|
||||||
|
{{#each turns}}
|
||||||
|
<li class="combatant {{ css }}" data-combatant-id="{{ id }}" data-action="activateCombatant">
|
||||||
|
{{!-- TODO: Targets --}}
|
||||||
|
|
||||||
|
{{!-- Image --}}
|
||||||
|
<img class="token-image" src="{{ img }}" alt="{{ name }}" loading="lazy">
|
||||||
|
|
||||||
|
{{!-- Name & Controls --}}
|
||||||
|
<div class="token-name">
|
||||||
|
<strong class="name">{{ name }}</strong>
|
||||||
|
<div class="combatant-controls">
|
||||||
|
{{#if @root.user.isGM}}
|
||||||
|
<button type="button" class="inline-control combatant-control icon fa-solid fa-eye-slash {{#if hidden}}active{{/if}}"
|
||||||
|
data-action="toggleHidden" data-tooltip aria-label="{{ localize "COMBAT.ToggleVis" }}"></button>
|
||||||
|
<button type="button" class="inline-control combatant-control icon fa-solid fa-skull {{#if isDefeated}}active{{/if}}"
|
||||||
|
data-action="toggleDefeated" data-tooltip
|
||||||
|
aria-label="{{ localize "COMBAT.ToggleDead" }}"></button>
|
||||||
|
{{/if}}
|
||||||
|
{{#if canPing}}
|
||||||
|
<button type="button" class="inline-control combatant-control icon fa-solid fa-bullseye-arrow"
|
||||||
|
data-action="pingCombatant" data-tooltip
|
||||||
|
aria-label="{{ localize "COMBAT.PingCombatant" }}"></button>
|
||||||
|
{{/if}}
|
||||||
|
{{#unless @root.user.isGM}}
|
||||||
|
<button type="button" class="inline-control combatant-control icon fa-solid fa-arrows-to-eye"
|
||||||
|
data-action="panToCombatant" data-tooltip
|
||||||
|
aria-label="{{ localize "COMBAT.PanToCombatant" }}"></button>
|
||||||
|
{{/unless}}
|
||||||
|
{{!-- TODO: Target Control --}}
|
||||||
|
<div class="token-effects" data-tooltip-html="{{ effects.tooltip }}">
|
||||||
|
{{#each effects.icons}}
|
||||||
|
<img class="token-effect" src="{{ img }}" alt="{{ name }}">
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{!-- Resource --}}
|
||||||
|
{{#if resource includeZero=true}}
|
||||||
|
<div class="token-resource">
|
||||||
|
<span class="resource">{{ resource }}</span>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if ../combat.system.started}}
|
||||||
|
<div class="token-actions">
|
||||||
|
<button type="button" class="inline-control combatant-control icon fa-solid fa-hand" data-action="takeSpotlight" data-combatant-id="{{id}}" data-tooltip aria-label="{{ localize "DAGGERHEART.Combat.takeSpotlight" }}"></button>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
17
templates/ui/combat/combatTrackerFooter.hbs
Normal file
17
templates/ui/combat/combatTrackerFooter.hbs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<nav class="combat-controls" data-tooltip-direction="UP">
|
||||||
|
{{~#if hasCombat~}}
|
||||||
|
{{#if user.isGM}}
|
||||||
|
{{#if combat.system.started}}
|
||||||
|
<button type="button" class="combat-control combat-control-lg" data-action="endCombat">
|
||||||
|
<i class="fa-solid fa-xmark" inert></i>
|
||||||
|
<span>{{ localize "COMBAT.End" }}</span>
|
||||||
|
</button>
|
||||||
|
{{else}}
|
||||||
|
<button type="button" class="combat-control combat-control-lg" data-action="startCombat">
|
||||||
|
<i class="fa-solid fa-swords" inert></i>
|
||||||
|
<span>{{ localize "COMBAT.Begin" }}</span>
|
||||||
|
</button>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</nav>
|
||||||
86
templates/ui/combat/combatTrackerHeader.hbs
Normal file
86
templates/ui/combat/combatTrackerHeader.hbs
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
<header class="combat-tracker-header">
|
||||||
|
|
||||||
|
{{!-- Encounter Controls --}}
|
||||||
|
{{#if user.isGM}}
|
||||||
|
<nav class="encounters {{ css }}" aria-label="{{ localize "COMBAT.NavLabel" }}">
|
||||||
|
|
||||||
|
{{!-- Cycle Display --}}
|
||||||
|
{{#if displayCycle}}
|
||||||
|
<button type="button" class="inline-control icon fa-solid fa-plus" data-action="createCombat"
|
||||||
|
data-tooltip aria-label="{{ localize "COMBAT.Create" }}"></button>
|
||||||
|
|
||||||
|
<div class="cycle-combats">
|
||||||
|
<button type="button" class="inline-control icon fa-solid fa-caret-left" data-action="cycleCombat"
|
||||||
|
{{#if previousId}}data-combat-id="{{ previousId }}" {{else}}disabled{{/if}}
|
||||||
|
data-tooltip aria-label="{{ localize "COMBAT.EncounterPrevious" }}"></button>
|
||||||
|
<div class="encounter-count">
|
||||||
|
<span class="value">{{ currentIndex }}</span>
|
||||||
|
<span class="separator">/</span>
|
||||||
|
<span class="max">{{ combats.length }}</span>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="inline-control icon fa-solid fa-caret-right" data-action="cycleCombat"
|
||||||
|
{{#if nextId}}data-combat-id="{{ nextId }}" {{else}}disabled{{/if}}
|
||||||
|
data-tooltip aria-label="{{ localize "COMBAT.EncounterNext" }}"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="inline-control icon fa-solid fa-gear" data-action="trackerSettings"
|
||||||
|
data-tooltip aria-label="{{ localize "COMBAT.Settings" }}"></button>
|
||||||
|
|
||||||
|
{{!-- Tabbed Display --}}
|
||||||
|
{{else if combats.length}}
|
||||||
|
<button type="button" class="inline-control icon fa-solid fa-plus" data-action="createCombat"
|
||||||
|
data-tooltip aria-label="{{ localize "COMBAT.Create" }}"></button>
|
||||||
|
{{#each combats}}
|
||||||
|
<button type="button" class="inline-control {{#if active}}active{{/if}}" data-action="cycleCombat"
|
||||||
|
data-combat-id="{{ id }}">
|
||||||
|
{{ label }}
|
||||||
|
</button>
|
||||||
|
{{/each}}
|
||||||
|
<button type="button" class="inline-control icon fa-solid fa-gear" data-action="trackerSettings"
|
||||||
|
data-tooltip aria-label="{{ localize "COMBAT.Settings" }}"></button>
|
||||||
|
|
||||||
|
{{!-- No Combats --}}
|
||||||
|
{{else}}
|
||||||
|
<button type="button" class="combat-control-lg" data-action="createCombat">
|
||||||
|
<i class="fa-solid fa-plus" inert></i>
|
||||||
|
<span>{{ localize "COMBAT.Create" }}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
|
</nav>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="encounter-controls {{#if hasCombat}}combat{{/if}}">
|
||||||
|
{{#if hasCombat}}
|
||||||
|
<div class="encounter-control-fear-container">
|
||||||
|
<img class="dice " src="../icons/svg/d12-grey.svg"/>
|
||||||
|
<i class="fas fa-skull encounter-control-fear"></i>
|
||||||
|
<div class="encounter-control-counter">4</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{!-- Combat Status --}}
|
||||||
|
<strong class="encounter-title">
|
||||||
|
{{#if combats.length}}
|
||||||
|
{{#if combat.system.started}}
|
||||||
|
{{ localize "DAGGERHEART.Combat.combatStarted" }}
|
||||||
|
{{else}}
|
||||||
|
{{ localize "COMBAT.NotStarted" }}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{ localize "COMBAT.None" }}
|
||||||
|
{{/if}}
|
||||||
|
</strong>
|
||||||
|
|
||||||
|
{{!-- Combat Controls --}}
|
||||||
|
{{#if hasCombat}}
|
||||||
|
<div class="control-buttons right flexrow">
|
||||||
|
<div class="spacer"></div>
|
||||||
|
<button type="button" class="encounter-context-menu inline-control combat-control icon fa-solid fa-ellipsis-vertical"
|
||||||
|
{{#unless (and user.isGM hasCombat)}}disabled{{/unless}}></button>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</header>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue