diff --git a/src/lang/de.json b/src/lang/de.json index 71d5f2a2..ffdfc5c9 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -211,5 +211,8 @@ "DS4.ChatVisibilityRoll": "Alle", "DS4.ChatVisibilityGmRoll": "Selbst & SL", "DS4.ChatVisibilityBlindRoll": "Nur SL", - "DS4.ChatVisibilitySelfRoll": "Nur selbst" + "DS4.ChatVisibilitySelfRoll": "Nur selbst", + "DS4.TooltipBaseValue": "Basiswert", + "DS4.TooltipModifier": "Modifikator", + "DS4.TooltipEffects": "Effekte" } diff --git a/src/lang/en.json b/src/lang/en.json index 4506977d..d5f817d6 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -211,5 +211,8 @@ "DS4.ChatVisibilityRoll": "All", "DS4.ChatVisibilityGmRoll": "Self & GM", "DS4.ChatVisibilityBlindRoll": "GM only", - "DS4.ChatVisibilitySelfRoll": "Self only" + "DS4.ChatVisibilitySelfRoll": "Self only", + "DS4.TooltipBaseValue": "Base Value", + "DS4.TooltipModifier": "Modifier", + "DS4.TooltipEffects": "Effects" } diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index 3edbbf0d..76448064 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -1,3 +1,4 @@ +import { ModifiableMaybeData } from "../../common/common-data"; import { DS4 } from "../../config"; import { DS4Item } from "../../item/item"; import { DS4ItemData } from "../../item/item-data"; @@ -50,7 +51,7 @@ export class DS4ActorSheet extends ActorSheet> { */ async getData(): Promise> { const data = { - ...(await super.getData()), + ...this._addTooltipsToData(await super.getData()), // Add the localization config to the data: config: DS4, // Add the items explicitly sorted by type to the data: @@ -59,6 +60,26 @@ export class DS4ActorSheet extends ActorSheet> { return data; } + protected _addTooltipsToData(data: ActorSheet.Data): ActorSheet.Data { + const valueGroups = [data.data.attributes, data.data.traits, data.data.combatValues]; + valueGroups.forEach((valueGroup) => { + Object.values(valueGroup).forEach( + (attribute: ModifiableMaybeData & { tooltip?: string }) => { + attribute.tooltip = this._getTooltipForValue(attribute); + }, + ); + }); + return data; + } + + protected _getTooltipForValue(value: ModifiableMaybeData): string { + return `${value.base ?? 0} (${game.i18n.localize("DS4.TooltipBaseValue")}) + ${ + value.mod ?? 0 + } (${game.i18n.localize("DS4.TooltipModifier")}) ➞ ${game.i18n.localize("DS4.TooltipEffects")} ➞ ${ + value.total ?? 0 + }`; + } + /** @override */ activateListeners(html: JQuery): void { super.activateListeners(html); diff --git a/src/scss/components/_attributes_traits.scss b/src/scss/components/_attributes_traits.scss index e0736bd4..ff99478f 100644 --- a/src/scss/components/_attributes_traits.scss +++ b/src/scss/components/_attributes_traits.scss @@ -18,6 +18,9 @@ grid-column: span 2; line-height: $default-input-height; } + .attribute-value-arrow { + padding: 0 5px; + } } } .trait { @@ -41,6 +44,9 @@ grid-column: span 2; line-height: $default-input-height; } + .trait-value-arrow { + padding: 0 5px; + } } } } diff --git a/src/templates/actor/partials/attributes-traits.hbs b/src/templates/actor/partials/attributes-traits.hbs index 9c12a6ae..e673c466 100644 --- a/src/templates/actor/partials/attributes-traits.hbs +++ b/src/templates/actor/partials/attributes-traits.hbs @@ -14,10 +14,13 @@
+ + name="data.attributes.{{attribute-key}}.base" value='{{attribute-data.base}}' data-dtype="Number" + title="{{attribute-label}} {{localize 'DS4.TooltipBaseValue'}}" /> + = - {{attribute-data.total}}
+ data-dtype="Number" title="{{attribute-label}} {{localize 'DS4.TooltipModifier'}}" />{{attribute-data.total}} +
{{/inline}} @@ -32,10 +35,11 @@ {{#*inline "trait"}}
+ - = - {{trait-data.total}}
+ value='{{trait-data.base}}' data-dtype="Number" + title="{{trait-label}} {{localize 'DS4.TooltipBaseValue'}}" /> + + {{trait-data.total}}
{{/inline}} @@ -49,4 +53,4 @@ {{#each config.i18n.traits as |trait-label trait-key|}} {{> trait trait-label=trait-label trait-key=trait-key trait-data=(lookup ../data.traits trait-key)}} {{/each}} - + \ No newline at end of file diff --git a/src/templates/actor/partials/combat-values.hbs b/src/templates/actor/partials/combat-values.hbs index 686a7a3a..7f477517 100644 --- a/src/templates/actor/partials/combat-values.hbs +++ b/src/templates/actor/partials/combat-values.hbs @@ -7,15 +7,18 @@ !-- !-- @param combat-value-key: The key of the combat value !-- @param combat-value-data: The data for the attribute +!-- @param combat-value-label: The label for the attribute --}} {{#*inline "combat-value"}}
-
{{combat-value-data.total}} +
{{combat-value-data.total}}
-
{{combat-value-data.base}}+{{combat-value-data.base}}+ + data-dtype="Number" title="{{combat-value-label}} {{localize 'DS4.TooltipModifier'}}" />
{{/inline}} @@ -25,6 +28,6 @@
{{#each config.i18n.combatValues as |combat-value-label combat-value-key|}} {{> combat-value combat-value-key=combat-value-key combat-value-data=(lookup ../data.combatValues - combat-value-key)}} + combat-value-key) combat-value-label=combat-value-label}} {{/each}} -
+
\ No newline at end of file