Skip to content

Commit 76a97e8

Browse files
authored
Merge pull request #115 from Cussa/master
Use Foundry's tooltip + Adjust conditions name in changelog
2 parents 852593e + 18c8be7 commit 76a97e8

File tree

8 files changed

+36
-18
lines changed

8 files changed

+36
-18
lines changed

Diff for: README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ This system provides character sheets and items for your play, if you would lik
2929

3030

3131
## Release Notes
32-
=======
3332

34-
4.5.3
33+
v4.6.0
34+
- ✨ Use Foundry's tooltip instead of browser `title`
35+
- 🐛 Conditions was showing as `undefined` in changelog
36+
37+
v4.5.3
3538
- 🐛 Fix: Fixed CSS on member data tab for lists to populate correctly
3639

37-
4.5.2
40+
v4.5.2
3841
- 🐛 Fix: Removed rollable tag from skills on member data tab of headquarter sheet
3942

40-
4.5.1
43+
v4.5.1
4144
- 🐛 Fix: HQ was losing data when updating ownership, editor for notes was hidden.
4245

4346
v4.5.0

Diff for: script/actor/vaesen-actor-sheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ export class VaesenActorSheet extends ActorSheet {
518518
.localize("HEADER.CRITICAL_INJURIES")
519519
.toLowerCase()
520520
.replace(/\b(\w)/g, (x) => x.toUpperCase());
521-
return { name: label, value: bonus, tooltip: tooltip.join("\n") };
521+
return { name: label, value: bonus, tooltip: tooltip.join("<br>") };
522522
}
523523

524524
computeInfoFromArmor(skillName) {

Diff for: script/actor/vaesen.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,13 @@ export class VaesenActor extends Actor {
193193
const dateChanged = new Date().toLocaleString();
194194
const userName = game.users.get(userId)?.name;
195195
let changelogArray = this.system.changelog;
196+
let documentType = document.type;
197+
if (document.statuses)
198+
documentType = "condition";
196199

197200
const log = {
198201
name: document.name,
199-
change: `${document.type} ${textType}`,
202+
change: `${documentType} ${textType}`,
200203
by: userName,
201204
at: dateChanged,
202205
};

Diff for: script/hooks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { PlayerCharacterSheet } from "./sheet/player.js";
33
import { NpcCharacterSheet } from "./sheet/npc.js";
44
import { VaesenCharacterSheet } from "./sheet/vaesen.js";
55
import { HeadquarterCharacterSheet } from "./sheet/headquarter.js";
6-
import { prepareRollNewDialog, push, totalRoll as totalRoll } from "./util/roll.js";
6+
import { prepareRollNewDialog, push, registerGearSelectTooltip, totalRoll as totalRoll } from "./util/roll.js";
77
import { registerSystemSettings } from "./util/settings.js";
88
import { vaesen } from "./config.js";
99
import { conditions } from "./util/conditions.js";
@@ -106,7 +106,7 @@ Hooks.once("ready", async function () {
106106
Hooks.on("hotbarDrop", (bar, data, slot) => createRollMacro(data, slot));
107107
Hooks.on("chatMessage", (_, messageText, chatData) => totalRoll(messageText, chatData));
108108
migrate();
109-
109+
registerGearSelectTooltip();
110110
});
111111

112112
Hooks.on('canvasReady', () => {

Diff for: script/sheet/player.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class PlayerCharacterSheet extends VaesenActorSheet {
331331
if (bonus === 0)
332332
return null;
333333
const conditionLabel = game.i18n.localize("HEADER.CONDITIONS").toLowerCase().replace(/\b(\w)/g, x => x.toUpperCase());
334-
return { name: conditionLabel, value: bonus, tooltip: info.join("\n"), type: "conditions" };
334+
return { name: conditionLabel, value: bonus, tooltip: info.join("<br>"), type: "conditions" };
335335
}
336336

337337
computePossibleBonusFromUpgrades(recoveryType) {

Diff for: script/util/roll.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ export function prepareRollNewDialog(
2626
`: </p>
2727
<input style="text-align: center" type="text" value="` +
2828
element.value +
29-
`" readonly title="` +
29+
`" readonly data-tooltip="` +
3030
tooltip +
31-
`"/></div>`
31+
`" data-tooltip-direction="RIGHT" data-tooltip-class="vaesen-tooltip"/></div>`
3232
);
3333

3434
baseLinesDice += parseInt(element.value, 10);
3535
var moreInfo = tooltip
36-
? `<ul><li>${tooltip.replace("\n", "</li><li>")}</li></ul>`
36+
? `<ul><li>${tooltip.replaceAll("<br>", "</li><li>")}</li></ul>`
3737
: "";
3838
breakdown.push(
3939
`${element.name}: ${adjustBonusText(element.value)}${moreInfo}`
@@ -284,15 +284,15 @@ function buildGearSelectHtmlDialog(options) {
284284
`: </p></div>`
285285
);
286286
html.push(`<div class="flex row" style="width: 100%;">`);
287-
html.push(`<select id="gear" style="width: 100%;">`);
287+
html.push(`<select id="gear" style="width: 100%;" data-tooltip-direction="RIGHT" data-tooltip-class="vaesen-tooltip">`);
288288
html.push(`<option value="0">None (0)</option>`);
289289
options.forEach((element) => {
290290
let bonusValue = adjustBonusText(element.bonus);
291291
var descriptionWithoutTags = $("<p>").html(element.description).text();
292292
html.push(
293293
`<option value="` +
294294
element.bonus +
295-
`" title="` +
295+
`" data-tooltip="` +
296296
descriptionWithoutTags +
297297
`">` +
298298
element.name +
@@ -318,7 +318,7 @@ function buildSelectMultipleHtmlDialog(options, name, id) {
318318
`<p style="text-transform: capitalize; white-space:nowrap; margin-top: 4px;">${game.i18n.localize(name)}: </p></div>`
319319
);
320320
html.push(`<div class="flex row" style="width: 100%;">`);
321-
html.push(`<select id="${id}" style="width: 100%;" multiple>`);
321+
html.push(`<select id="${id}" style="width: 100%;" multiple data-tooltip-direction="RIGHT" data-tooltip-class="vaesen-tooltip">`);
322322
options.forEach((element) => {
323323
let descriptionWithoutTags = $("<p>").html(element.description).text();
324324
let requiresBonus =
@@ -329,9 +329,9 @@ function buildSelectMultipleHtmlDialog(options, name, id) {
329329
(element.bonusType
330330
? game.i18n.localize(CONFIG.vaesen.bonusType[element.bonusType])
331331
: "") + (bonusValue ?? "");
332-
const fullDescription = `${element.name}\n${bonusInfo}\n${descriptionWithoutTags}`;
332+
const fullDescription = `${element.name}<br>${bonusInfo}<br>${element.description}`;
333333
html.push(
334-
`<option value="${element.name}" title="${fullDescription}">${element.name} (${bonusInfo})</option>`
334+
`<option value="${element.name}" data-tooltip="${fullDescription}">${element.name} (${bonusInfo})</option>`
335335
);
336336
});
337337
html.push(`</select></div>`);
@@ -448,4 +448,12 @@ async function createCustomRoll(actor, formula, name) {
448448
let rollMode = game.settings.get("core", "rollMode");
449449

450450
await roll.toMessage(messageData, { rollMode });
451+
}
452+
453+
export function registerGearSelectTooltip() {
454+
$("body").on("change", "#gear", function(e) {
455+
var optionSelected = $("option:selected", this);
456+
var tooltip = optionSelected.attr("data-tooltip") ?? "";
457+
$(this).attr("data-tooltip", tooltip);
458+
});
451459
}

Diff for: style/dialog/roll.css

+4
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@
2525
flex-basis: 35px;
2626
margin-bottom: 5px;
2727
}
28+
29+
#tooltip.vaesen-tooltip {
30+
text-align: left;
31+
}

Diff for: system.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": "Vaesen",
33
"description": "Nordic horror role-playing",
4-
"version": "4.5.3",
4+
"version": "4.6.0",
55
"esmodules": [
66
"script/hooks.js"
77
],

0 commit comments

Comments
 (0)