mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge branch 'main' into Irk/176-view-options
# Conflicts: # module/applications/sheets/character.mjs
This commit is contained in:
commit
0cdbfa8bf7
8 changed files with 104 additions and 13 deletions
|
|
@ -112,6 +112,7 @@ Hooks.once('init', () => {
|
|||
CONFIG.Token.rulerClass = DhpTokenRuler;
|
||||
|
||||
CONFIG.ui.resources = Resources;
|
||||
CONFIG.ux.ContextMenu = applications.DhContextMenu;
|
||||
|
||||
game.socket.on(`system.${SYSTEM.id}`, handleSocketEvent);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,5 +13,6 @@ export { default as DhpArmor } from './sheets/items/armor.mjs';
|
|||
export { default as DhpChatMessage } from './chatMessage.mjs';
|
||||
export { default as DhpEnvironment } from './sheets/environment.mjs';
|
||||
export { default as DhActiveEffectConfig } from './sheets/activeEffectConfig.mjs';
|
||||
export { default as DhContextMenu } from './contextMenu.mjs';
|
||||
|
||||
export * as api from './sheets/api/_modules.mjs';
|
||||
|
|
|
|||
24
module/applications/contextMenu.mjs
Normal file
24
module/applications/contextMenu.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export default class DhContextMenu extends ContextMenu {
|
||||
constructor(container, selector, menuItems, options) {
|
||||
super(container, selector, menuItems, options);
|
||||
|
||||
/** @deprecated since v13 until v15 */
|
||||
this.#jQuery = options.jQuery;
|
||||
}
|
||||
|
||||
#jQuery;
|
||||
|
||||
activateListeners(menu) {
|
||||
menu.addEventListener('click', this.#onClickItem.bind(this));
|
||||
}
|
||||
|
||||
#onClickItem(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const element = event.target.closest('.context-item');
|
||||
if (!element) return;
|
||||
const item = this.menuItems.find(i => i.element === element);
|
||||
item?.callback(this.#jQuery ? $(this.target) : this.target, event);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -48,8 +48,8 @@ class Countdowns extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
htmlElement.querySelectorAll('.mini-countdown-container').forEach(element => {
|
||||
element.addEventListener('click', event => this.updateCountdownValue.bind(this)(event, true));
|
||||
element.addEventListener('contextmenu', event => this.updateCountdownValue.bind(this)(event, false));
|
||||
element.addEventListener('click', event => this.updateCountdownValue.bind(this)(event, false));
|
||||
element.addEventListener('contextmenu', event => this.updateCountdownValue.bind(this)(event, true));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
useItem: {
|
||||
name: 'DAGGERHEART.Sheets.PC.ContextMenu.UseItem',
|
||||
icon: '<i class="fa-solid fa-burst"></i>',
|
||||
callback: this.constructor.useItem.bind(this)
|
||||
callback: (element, event) => this.constructor.useItem.bind(this)(event, element)
|
||||
},
|
||||
equip: {
|
||||
name: 'DAGGERHEART.Sheets.PC.ContextMenu.Equip',
|
||||
|
|
@ -555,6 +555,12 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
this.render();
|
||||
}
|
||||
|
||||
static async toggleLoadoutView(_, button) {
|
||||
const newAbilityView = !(button.dataset.value === 'true');
|
||||
await game.user.setFlag(SYSTEM.id, SYSTEM.FLAGS.displayDomainCardsAsList, newAbilityView);
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async attackRoll(event, button) {
|
||||
const weapon = await fromUuid(button.dataset.weapon);
|
||||
if (!weapon) return;
|
||||
|
|
@ -652,10 +658,13 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
(await game.packs.get('daggerheart.communities'))?.render(true);
|
||||
}
|
||||
|
||||
static useItem(element, button) {
|
||||
const id = (button ?? element).closest('a').id,
|
||||
static async useItem(event, button) {
|
||||
const id = button.closest('a').id,
|
||||
item = this.document.items.get(id);
|
||||
item.use({});
|
||||
const wasUsed = await item.use(event);
|
||||
if (wasUsed && item.type === 'weapon') {
|
||||
Hooks.callAll(SYSTEM.HOOKS.characterAttack, {});
|
||||
}
|
||||
}
|
||||
|
||||
static async viewObject(element, button) {
|
||||
|
|
@ -707,7 +716,6 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
static async makeDeathMove() {
|
||||
if (this.document.system.resources.hitPoints.value === this.document.system.resources.hitPoints.max) {
|
||||
await new DhpDeathMove(this.document).render(true);
|
||||
await this.minimize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -763,7 +771,9 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
name: game.i18n.localize('DAGGERHEART.General.Experience.Single'),
|
||||
description: `${experience.description} ${experience.total < 0 ? experience.total : `+${experience.total}`}`
|
||||
description: `${experience.description} ${
|
||||
experience.total < 0 ? experience.total : `+${experience.total}`
|
||||
}`
|
||||
};
|
||||
const msg = new cls({
|
||||
type: 'abilityUse',
|
||||
|
|
@ -788,7 +798,9 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
? this.document.system.multiclass.subclass
|
||||
: this.document.system.class.subclass;
|
||||
const ability = item.system[`${button.dataset.key}Feature`];
|
||||
const title = `${item.name} - ${game.i18n.localize(`DAGGERHEART.Sheets.PC.DomainCard.${capitalize(button.dataset.key)}Title`)}`;
|
||||
const title = `${item.name} - ${game.i18n.localize(
|
||||
`DAGGERHEART.Sheets.PC.DomainCard.${capitalize(button.dataset.key)}Title`
|
||||
)}`;
|
||||
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
|
|
|
|||
|
|
@ -3619,13 +3619,35 @@ div.daggerheart.views.multiclass {
|
|||
.theme-light .application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet {
|
||||
background: transparent;
|
||||
}
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet img {
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait {
|
||||
position: relative;
|
||||
height: 235px;
|
||||
width: 275px;
|
||||
border-bottom: 1px solid light-dark(#18162e, #f3c267);
|
||||
cursor: pointer;
|
||||
}
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait img {
|
||||
height: 235px;
|
||||
width: 275px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait .death-roll-btn {
|
||||
display: none;
|
||||
}
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait.death-roll {
|
||||
filter: grayscale(1);
|
||||
}
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait.death-roll .death-roll-btn {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 30%;
|
||||
right: 30%;
|
||||
font-size: 6rem;
|
||||
color: #efe6d8;
|
||||
}
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .portrait.death-roll .death-roll-btn:hover {
|
||||
text-shadow: 0 0 8px #efe6d8;
|
||||
}
|
||||
.application.sheet.daggerheart.actor.dh-style.character .character-sidebar-sheet .info-section {
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -12,12 +12,39 @@
|
|||
background: transparent;
|
||||
}
|
||||
|
||||
img {
|
||||
.portrait {
|
||||
position: relative;
|
||||
height: 235px;
|
||||
width: 275px;
|
||||
border-bottom: 1px solid light-dark(@dark-blue, @golden);
|
||||
cursor: pointer;
|
||||
object-fit: cover;
|
||||
|
||||
img {
|
||||
height: 235px;
|
||||
width: 275px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.death-roll-btn {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.death-roll {
|
||||
filter: grayscale(1);
|
||||
|
||||
.death-roll-btn {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 30%;
|
||||
right: 30%;
|
||||
font-size: 6rem;
|
||||
color: @beige;
|
||||
|
||||
&:hover {
|
||||
text-shadow: 0 0 8px @beige;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info-section {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
<aside class="character-sidebar-sheet">
|
||||
<img class="portrait" src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||
<div class="portrait {{#if (gte document.system.resources.hitPoints.value document.system.resources.hitPoints.maxTotal)}}death-roll{{/if}}">
|
||||
<img src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||
<a class="death-roll-btn" data-tooltip="{{localize "DAGGERHEART.Sheets.PC.Health.DeathMoveTooltip"}}" data-action="makeDeathMove"><i class="fas fa-skull death-save" ></i></a>
|
||||
</div>
|
||||
|
||||
<div class="info-section">
|
||||
<div class="resources-section">
|
||||
<div class="status-bar">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue