Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Darkmode, Resizable actor sheets #405

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/chatty-cups-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"forbidden-lands": minor
---

**Improvements**

- Improved darkmode with a better color theme thanks to Perfecto Ignori.
- Sheets are now resizable using the resize handle again.
- Experience point / End of Session dialog is accessible from Party Sheet (thanks to @Sp0ken for the dialog)
Binary file modified assets/journal-art/box-border-large-dark.webp
Binary file not shown.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"EXPERIENCE.TITLE.PLAYERS": "Active player(s)",
"EXPERIENCE.TITLE.ACTIONS": "Did the player…",
"EXPERIENCE.BUTTON.OK": "Add experience point(s)",
"EXPERIENCE.BUTTON.OPEN": "End of session – XP",
"EXPERIENCE.BUTTON.CANCEL": "Cancel",
"EXPERIENCE.ACTIONS.SESSION": "Participate in the game session?",
"EXPERIENCE.ACTIONS.MAP": "Travel through at least one new hex?",
Expand Down Expand Up @@ -371,6 +372,8 @@
"SCENE.RENDER": "Toggle scene",
"SETTINGS.DARKMODE": "Dark Mode (Experimental)",
"SETTINGS.DARKMODE_HINT": "Set sheets to display in dark grey instead of white. This is an experimental feature and may give poor contrast with some sheets or UI controls.",
"SETTINGS.REMOVEBORDERS": "Remove borders",
"SETTINGS.REMOVEBORDERS_HINT": "Remove borders from the sheets to give a more minimalistic look (also improves compatibility with certain modules).",
"SHEET.CLOSE": "Close",
"SHEET.CONFIGURE": "Configure",
"SHEET.CREATE_ARMOR": "Create Armor",
Expand Down
118 changes: 59 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
{
"name": "forbidden-lands",
"version": "11.4.2",
"private": true,
"description": "<p align=\"center\">\r <a href=\"https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/releases/latest\" target=\"_blank\"><img alt=\"system version\" src=\"https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffvtt-fria-ligan%2Fforbidden-lands-foundry-vtt%2Fmain%2Fsystem.json&label=Version&query=$.version&colorB=blue\"/></a>\r <a href=\"https://foundryvtt.com\" target=\"_blank\">\r <img src=\"https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffvtt-fria-ligan%2Fforbidden-lands-foundry-vtt%2Fmain%2Fsystem.json&label=Foundry&query=$.compatibleCoreVersion&colorB=blue\" alt=\"foundry-compatibility-version\" style=\"max-width:100%;\"/>\r </a>\r <a href=\"https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/graphs/commit-activity\" target=\"_blank\">\r <img alt=\"Maintenance\" src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\"/>\r </a>\r <a href=\"https://gitlocalize.com/repo/5750/whole_project?utm_source=badge\" target=\"_blank\"><img alt=\"Localization\" src=\"https://gitlocalize.com/repo/5750/whole_project/badge.svg\" /></a>\r <a href=\"https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/blob/main/LICENSE\" target=\"_blank\">\r <img alt=\"License: GPL\" src=\"https://img.shields.io/github/license/fvtt-fria-ligan/forbidden-lands-foundry-vtt\"/>\r </a>\r <br/>\r <br/>\r <img src=\"https://user-images.githubusercontent.com/9851733/108728684-1a954b00-752a-11eb-9138-6fab6f83b2a8.jpg\" alt=\"Logo\" style=\"max-width:100%;\" />\r </p>",
"homepage": "https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt#readme",
"bugs": {
"url": "https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt.git"
},
"license": "GPL-3.0-or-later",
"contributors": [
{
"name": "aMediocreDad",
"email": "hello@amediocre.dev"
}
],
"type": "module",
"scripts": {
"build": "bun esbuild.config.ts",
"format": "biome format --write .",
"lint": "biome check --apply .",
"lint:ci": "bunx biome ci .",
"postinstall": "lefthook install && bun run setup",
"release": "bun tools/release.ts",
"setup": "bun tools/setup.ts",
"start": "bun run build --development",
"test": "bun run test:types && bun run lint:ci",
"test:types": "bunx tsc && bunx tsc -p ./src/tsconfig.json",
"version": "bun tools/version.ts"
},
"dependencies": {
"foundry-year-zero-roller": "Stefouch/foundry-year-zero-roller#v5.1.1",
"rpg-awesome": "0.2.0",
"ultrahtml": "1.5.2"
},
"devDependencies": {
"@arkweid/lefthook": "0.7.7",
"@biomejs/biome": "1.5.2",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@types/jquery": "3.5.29",
"@types/node": "20.11.5",
"@types/showdown": "2.0.6",
"bun": "latest",
"bun-types": "1.0.23",
"devmoji": "2.3.0",
"esbuild": "0.19.11",
"esbuild-sass-plugin": "2.16.1",
"execa": "8.0.1",
"globby": "14.0.0",
"gluegun": "5.1.6",
"typescript": "5.3.3"
},
"volta": {
"node": "20.11.0"
}
"name": "forbidden-lands",
"version": "11.4.2",
"private": true,
"description": "<p align=\"center\">\r <a href=\"https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/releases/latest\" target=\"_blank\"><img alt=\"system version\" src=\"https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffvtt-fria-ligan%2Fforbidden-lands-foundry-vtt%2Fmain%2Fsystem.json&label=Version&query=$.version&colorB=blue\"/></a>\r <a href=\"https://foundryvtt.com\" target=\"_blank\">\r <img src=\"https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffvtt-fria-ligan%2Fforbidden-lands-foundry-vtt%2Fmain%2Fsystem.json&label=Foundry&query=$.compatibleCoreVersion&colorB=blue\" alt=\"foundry-compatibility-version\" style=\"max-width:100%;\"/>\r </a>\r <a href=\"https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/graphs/commit-activity\" target=\"_blank\">\r <img alt=\"Maintenance\" src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\"/>\r </a>\r <a href=\"https://gitlocalize.com/repo/5750/whole_project?utm_source=badge\" target=\"_blank\"><img alt=\"Localization\" src=\"https://gitlocalize.com/repo/5750/whole_project/badge.svg\" /></a>\r <a href=\"https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/blob/main/LICENSE\" target=\"_blank\">\r <img alt=\"License: GPL\" src=\"https://img.shields.io/github/license/fvtt-fria-ligan/forbidden-lands-foundry-vtt\"/>\r </a>\r <br/>\r <br/>\r <img src=\"https://user-images.githubusercontent.com/9851733/108728684-1a954b00-752a-11eb-9138-6fab6f83b2a8.jpg\" alt=\"Logo\" style=\"max-width:100%;\" />\r </p>",
"homepage": "https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt#readme",
"bugs": {
"url": "https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fvtt-fria-ligan/forbidden-lands-foundry-vtt.git"
},
"license": "GPL-3.0-or-later",
"contributors": [
{
"name": "aMediocreDad",
"email": "hello@amediocre.dev"
}
],
"type": "module",
"scripts": {
"build": "bun esbuild.config.ts",
"format": "biome format --write .",
"lint": "biome check --apply .",
"lint:ci": "bunx biome ci .",
"postinstall": "lefthook install && bun run setup",
"release": "bun tools/release.ts",
"setup": "bun tools/setup.ts",
"start": "bun run build --development",
"test": "bun run test:types && bun run lint:ci",
"test:types": "bunx tsc && bunx tsc -p ./src/tsconfig.json",
"version": "bun tools/version.ts"
},
"dependencies": {
"foundry-year-zero-roller": "Stefouch/foundry-year-zero-roller#v5.1.1",
"rpg-awesome": "0.2.0",
"ultrahtml": "1.5.3"
},
"devDependencies": {
"@arkweid/lefthook": "0.7.7",
"@biomejs/biome": "1.6.1",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@types/jquery": "3.5.29",
"@types/node": "20.11.29",
"@types/showdown": "2.0.6",
"bun": "latest",
"bun-types": "1.0.33",
"devmoji": "2.3.0",
"esbuild": "0.20.2",
"esbuild-sass-plugin": "3.2.0",
"execa": "8.0.1",
"globby": "14.0.1",
"gluegun": "5.1.6",
"typescript": "5.4.2"
},
"volta": {
"node": "20.11.0"
}
}
8 changes: 4 additions & 4 deletions src/actor/actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ export class ForbiddenLandsActorSheet extends ActorSheet {

// Get the weight of all coins
const coinsCarried =
parseInt(data.system.currency.gold.value) +
parseInt(data.system.currency.silver.value) +
parseInt(data.system.currency.copper.value);
Number.parseInt(data.system.currency.gold.value) +
Number.parseInt(data.system.currency.silver.value) +
Number.parseInt(data.system.currency.copper.value);
weightCarried += Math.floor(coinsCarried / 100) * 0.5;
}

Expand All @@ -267,7 +267,7 @@ export class ForbiddenLandsActorSheet extends ActorSheet {
const weightAllowed =
baseEncumbrance * monsterEncumbranceMultiplier +
// Moidifers
modifiers.reduce((acc, m) => acc + parseInt(m?.value || 0), 0);
modifiers.reduce((acc, m) => acc + Number.parseInt(m?.value || 0), 0);
data.system.encumbrance = {
value: weightCarried,
max: weightAllowed,
Expand Down
2 changes: 1 addition & 1 deletion src/actor/character/character-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class ForbiddenLandsCharacterSheet extends ForbiddenLandsActorSheet {
classes: ["forbidden-lands", "sheet", "actor"],
width: 660,
height: useHealthAndResolve ? 790 : 740,
resizable: false,
resizable: true,
scrollY: [
".armors .item-list .items",
".critical-injuries .item-list .items",
Expand Down
4 changes: 2 additions & 2 deletions src/actor/monster/monster-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ForbiddenLandsMonsterSheet extends ForbiddenLandsActorSheet {
"systems/forbidden-lands/templates/actor/monster/monster-sheet.hbs",
width: 700,
height: 770,
resizable: false,
resizable: true,
scrollY: [
".monster-talents .item-list .items",
".monster-attacks .item-list .items",
Expand Down Expand Up @@ -60,7 +60,7 @@ export class ForbiddenLandsMonsterSheet extends ForbiddenLandsActorSheet {
async rollAttack() {
const attacks = this.actor.itemTypes.monsterAttack;
const roll = await new Roll(`1d${attacks.length}`).roll({ async: true });
const attack = attacks[parseInt(roll.result) - 1];
const attack = attacks[Number.parseInt(roll.result) - 1];
attack.sendToChat();
this.rollSpecificAttack(attack.id);
}
Expand Down
8 changes: 7 additions & 1 deletion src/actor/party/party-sheet.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { experienceDialog } from "$components/macros/experience-dialog.js";
import { TravelActionsConfig } from "@actor/party/components/travel-actions";
import { TableConfigMenu } from "@system/core/settings.js";
import localizeString from "@utils/localize-string.js";
Expand All @@ -12,7 +13,7 @@ export class ForbiddenLandsPartySheet extends ActorSheet {
classes: ["forbidden-lands", "sheet", "actor", "party"],
template: "systems/forbidden-lands/templates/actor/party/party-sheet.hbs",
width: window.innerWidth * 0.05 + 650,
resizable: false,
resizable: true,
tabs: [
{
navSelector: ".sheet-tabs",
Expand Down Expand Up @@ -69,6 +70,11 @@ export class ForbiddenLandsPartySheet extends ActorSheet {
this.render(true);
});

html.find(".party-experience").click(async (event) => {
event.preventDefault();
return experienceDialog();
});

let button;
for (const key in TravelActionsConfig) {
for (let i = 0; i < TravelActionsConfig[key].buttons.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/actor/stronghold/stronghold-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class ForbiddenLandsStrongholdSheet extends ForbiddenLandsActorSheet {
"systems/forbidden-lands/templates/actor/stronghold/stronghold-sheet.hbs",
width: 650,
height: 700,
resizable: false,
resizable: true,
scrollY: [
".buildings.item-list .items",
".hirelings.item-list .items",
Expand Down
2 changes: 1 addition & 1 deletion src/components/character-generator/character-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class CharacterConverter {

function increaseSkill(skillObj) {
for (const [skillName, skillValue] of Object.entries(skillObj)) {
skills[skillName].value += parseInt(skillValue);
skills[skillName].value += Number.parseInt(skillValue);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/components/character-generator/character-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class ForbiddenLandsCharacterGenerator extends Application {
game.i18n.localize("FLCG.ADULT"),
game.i18n.localize("FLCG.OLD"),
];
const ageNumber = parseInt($(event.currentTarget).val());
const ageNumber = Number.parseInt($(event.currentTarget).val());
const kin = this.dataset.kin[this.character.kin];
let ageKey = 2;
for (let i = 0; i < 3; i++) {
Expand Down Expand Up @@ -173,7 +173,7 @@ export class ForbiddenLandsCharacterGenerator extends Application {
}

handleInputPath(event) {
const pathKey = parseInt($(event.currentTarget).val());
const pathKey = Number.parseInt($(event.currentTarget).val());
this.character.path = pathKey;
this.render(true);

Expand All @@ -182,7 +182,7 @@ export class ForbiddenLandsCharacterGenerator extends Application {

handleInputEvent(event) {
const el = $(event.currentTarget);
const id = parseInt(el.data("key"));
const id = Number.parseInt(el.data("key"));
const eventKey = el.val();
const profession = this.dataset.profession[this.character.profession];

Expand Down Expand Up @@ -239,7 +239,7 @@ export class ForbiddenLandsCharacterGenerator extends Application {
handleRollEvent(event) {
const profession = this.dataset.profession[this.character.profession];
const button = $(event.currentTarget);
const id = parseInt(button.data("key"));
const id = Number.parseInt(button.data("key"));
const rolled = [];
let newEvent = {};
for (let i = 0; i < this.character.formativeEvents.length; i++) {
Expand Down Expand Up @@ -290,7 +290,7 @@ export class ForbiddenLandsCharacterGenerator extends Application {
character.kin = kin.key;
if (character.kin === "elf") {
character.age = {
ageNumber: NaN,
ageNumber: Number.NaN,
ageKey: 1,
ageString: game.i18n.localize("FLCG.ADULT"),
};
Expand Down
30 changes: 14 additions & 16 deletions src/components/macros/experience-dialog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(async () => {
export function experienceDialog() {
const gamePlayers = game.users.players;
const characters = {};
const players = {};
Expand All @@ -16,12 +16,12 @@
let form_html = `<form>
<h2>${game.i18n.localize("EXPERIENCE.TITLE.PLAYERS")}</h2>
<multi-checkbox name="players" class="players-choices">`;
playersName.forEach((playerName) => {
const isActive = players[playerName].active;
const selected = isActive ? "selected" : "";
for (const player of gamePlayers) {
const playerName = player.name;
const selected = player.active ? "selected" : "";
form_html += `<option value="${playerName}" ${selected}>${playerName}</option>`;
});
form_html += `</multi-checkbox><br>`;
}
form_html += "</multi-checkbox><br>";

form_html += `<h2>${game.i18n.localize("EXPERIENCE.TITLE.ACTIONS")}</h2>
<multi-checkbox name="actions" class="actions-choices">`;
Expand All @@ -38,12 +38,10 @@
"EXPLOIT",
];
for (const action of actions) {
const actionLabel = game.i18n.localize(
`EXPERIENCE.ACTIONS.${action}`,
);
const actionLabel = game.i18n.localize(`EXPERIENCE.ACTIONS.${action}`);
form_html += `<option value="${action}">${actionLabel}</option>`;
}
form_html += `</multi-checkbox></form><br>`;
form_html += "</multi-checkbox></form><br>";

form_html += `
<style>
Expand Down Expand Up @@ -76,12 +74,12 @@
"form .players-choices input:checked",
);

selectedPlayers.forEach((input) => {
const player = input.value;
const playerCharacter = characters[player];
for (const player of selectedPlayers) {
const playerName = player.value;
const playerCharacter = characters[playerName];
if (!playerCharacter) return;

const currentXp = parseInt(
const currentXp = Number.parseInt(
playerCharacter?.system?.bio?.experience?.value || 0,
);
const newXp = currentXp + xpGains;
Expand All @@ -101,7 +99,7 @@
},
{},
);
});
}
}

new Dialog(
Expand All @@ -127,4 +125,4 @@
},
{ width: 600 },
).render(true);
})();
}
2 changes: 1 addition & 1 deletion src/components/roll-engine/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class FBLRollHandler extends FormApplication {
const type = $(ev.currentTarget).data("type");
const operator = $(ev.currentTarget).data("operator");
const input = html.find(`#${type}`);
let value = parseInt(input.val(), 10) || 0;
let value = Number.parseInt(input.val(), 10) || 0;
value += operator === "plus" ? 1 : -1;
input.val(value > 0 ? value : 0);
});
Expand Down
3 changes: 3 additions & 0 deletions src/forbidden-lands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ Hooks.once("init", () => {
// Add dark mode class to html tag
if (game.settings.get("forbidden-lands", "darkmode"))
$("html").addClass("dark");
// Remove borders if the setting is enabled
if (game.settings.get("forbidden-lands", "removeBorders"))
$("html").addClass("no-borders");
});

Hooks.once("ready", () => {
Expand Down
2 changes: 0 additions & 2 deletions src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ declare global {
const CONFIG: ConfigFBL;

namespace globalThis {
// biome-ignore lint/style/noVar: <explanation>
var game: GameFBL;

// biome-ignore lint/style/noVar: <explanation>
var ui: FoundryUI<
ActorDirectory<Actor<null>>,
ItemDirectory<Item<null>>,
Expand Down
6 changes: 5 additions & 1 deletion src/item/item-document.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export class ForbiddenLandsItem extends Item {
}

get parryPenalty() {
if (this.category === "melee" && !this.itemProperties.features?.parrying)
if (
this.category === "melee" &&
!this.itemProperties.features?.parrying &&
!this.itemProperties.features?.shield
)
return CONFIG.fbl.actionModifiers.parry;
return 0;
}
Expand Down
Loading
Loading