diff --git a/CHANGELOG.md b/CHANGELOG.md index 260b3ad..bbd4799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ [Token Note Hover](https://foundryvtt.com/packages/token-note-hover) +## [4.0.10](https://github.com/jendave/token-note-hover/blob/main/CHANGELOG.md) (2026-03-23) + +* Added support for [LANCER](https://foundryvtt.com/packages/lancer). + ## [4.0.9](https://github.com/jendave/token-note-hover/blob/main/CHANGELOG.md) (2026-03-27) * Updated *Group* Actor type for [D&D 5E](https://foundryvtt.com/packages/dnd5e). diff --git a/README.md b/README.md index 6df672c..5b3b494 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ Many systems are directly supported by [Token Note Hover](https://foundryvtt.com * [Forbidden Lands](#forbidden-lands) * [GURPS 4th Edition Game Aid (Unofficial)](#gurps-4th-edition-game-aid-unofficial) * [Ironsworn/Starforged](#ironswornstarforged) +* [LANCER](https://foundryvtt.com/packages/lancer) * [Level Up: Advanced 5th Edition](#level-up-advanced-5th-edition) * [Mutant Year Zero](#mutant-year-zero) * [Old-School Essentials](#old-school-essentials) @@ -377,6 +378,19 @@ Then in a Character Actor, use the Template with the following fields: | **Starship** | Notes | | **Location** | Text entry area | +### LANCER + +[LANCER](https://foundryvtt.com/packages/lancer) + + + +| Actor Type | Note Location | +| -------------- | ------------- | +| **Deployable** | Details | +| **Mech** | [None] | +| **NPC** | Notes | +| **Pilot** | Notes | + ### Level Up: Advanced 5th Edition [Level Up: Advanced 5th Edition](https://foundryvtt.com/packages/a5e) diff --git a/docs/screenshot_lancer.jpg b/docs/screenshot_lancer.jpg new file mode 100644 index 0000000..1624e63 Binary files /dev/null and b/docs/screenshot_lancer.jpg differ diff --git a/src/scripts/TokenNoteHoverHUD.js b/src/scripts/TokenNoteHoverHUD.js index f09bf0d..d7ee6b5 100644 --- a/src/scripts/TokenNoteHoverHUD.js +++ b/src/scripts/TokenNoteHoverHUD.js @@ -36,6 +36,7 @@ import { wod5e } from './systems/wod5e.js'; import { universalTabletopSystem } from './systems/universal-tabletop-system.js'; import { starwarsffg } from './systems/starwarsffg.js'; import { sandbox } from './systems/sandbox.js'; +import { lancer } from './systems/lancer.js'; /** * A HUD extension that shows the Note preview @@ -180,6 +181,8 @@ export default class TokenNoteHoverHUD extends foundry.applications.hud.BasePlac tempContent = await starwarsffg(actor, displayImages); } else if (game.data.system.id === 'sandbox') { tempContent = await sandbox(actor, displayImages); + } else if (game.data.system.id === 'lancer') { + tempContent = await lancer(actor, displayImages); } diff --git a/src/scripts/systems/lancer.js b/src/scripts/systems/lancer.js new file mode 100644 index 0000000..c2f1b28 --- /dev/null +++ b/src/scripts/systems/lancer.js @@ -0,0 +1,65 @@ +import CONSTANTS from '../constants.js'; +import { processNotes } from "../textUtil.js"; + +export async function lancer(actor, displayImages) { + // Using a guard here looks cleaner + if (!actor) { + return null; + } + + const actorIsOwner = actor.isOwner ?? true; + + switch (actor.type) { + case "pilot": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayPC')) { + return await getCharacterNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + case "deployable": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayPC')) { + return await getDeployableNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + case "mech": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayPC')) { + return await getMechNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + case "npc": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayNPC')) { + return await getNpcNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + default: + return null; + } +} + +async function getCharacterNotes(displayImages, actor, actorIsOwner) { + return await processNotes(actor.system?.notes, actorIsOwner, displayImages); +} + +async function getDeployableNotes(displayImages, actor, actorIsOwner) { + return await processNotes(actor.system?.detail, actorIsOwner, displayImages); +} + +async function getMechNotes(displayImages, actor, actorIsOwner) { + return await processNotes(actor.system?.notes, actorIsOwner, displayImages); +} + +async function getNpcNotes(displayImages, actor, actorIsOwner) { + const publicNotes = ""; + const privateNotes = actor.system?.notes; + let notes = publicNotes; + + if (!game.settings.get(CONSTANTS.MODULE_ID, 'hidePrivateNotes') && game.user.isGM && privateNotes) { + notes += "