diff --git a/CHANGELOG.md b/CHANGELOG.md index b5801c2..1008667 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ [Token Note Hover](https://foundryvtt.com/packages/token-note-hover) +## [4.0.6](https://github.com/jendave/token-note-hover/blob/main/CHANGELOG.md) (2026-03-xx) + +* Added support for [Cyberpunk RED](https://foundryvtt.com/packages/cyberpunk-red-core) + ## [4.0.5](https://github.com/jendave/token-note-hover/blob/main/CHANGELOG.md) (2026-02-25) * Verified for Foundry v14. diff --git a/README.md b/README.md index 30dd25d..474e42e 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ Many systems are directly supported by [Token Note Hover](https://foundryvtt.com * [Cairn](#cairn) * [Call of Cthulhu 7th edition](#call-of-cthulhu-7th-edition) * [Custom System Builder](#custom-system-builder) +* [Cyberpunk RED](https://foundryvtt.com/packages/cyberpunk-red-core) * [Cypher System](#cypher-system) * [D\&D 5E](#dd-5e) * [Daggerheart](#daggerheart) @@ -232,6 +233,20 @@ Then in a Character Actor, use the Template with the following fields: | **Character** | Notes | | | Private Notes | +### Cyberpunk RED + +[Cyberpunk RED](https://foundryvtt.com/packages/cyberpunk-red-core) + +![Screenshot](https://github.com/jendave/token-note-hover/blob/main/docs/screenshot_cyberpunkred.jpg?raw=true) + +| Actor Type | Note Location | +| ---------------- | ---------------- | +| **Black ICE** | Notes | +| **Character** | Player Notes | +| **Container** | Item List | +| **Demon** | Notes | +| **Mook (NPC)** | Player Notes | + ### Cypher System [Cypher System](https://foundryvtt.com/packages/cyphersystem) diff --git a/docs/screenshot_cyberpunkred.jpg b/docs/screenshot_cyberpunkred.jpg new file mode 100644 index 0000000..e4bffdd Binary files /dev/null and b/docs/screenshot_cyberpunkred.jpg differ diff --git a/src/scripts/TokenNoteHoverHUD.js b/src/scripts/TokenNoteHoverHUD.js index ec47a6b..e1cdee0 100644 --- a/src/scripts/TokenNoteHoverHUD.js +++ b/src/scripts/TokenNoteHoverHUD.js @@ -34,6 +34,7 @@ import { dcc } from './systems/dcc.js'; import { mutantyearzero } from './systems/mutant-year-zero.js'; import { wod5e } from './systems/wod5e.js'; import { universalTabletopSystem } from './systems/universal-tabletop-system.js'; +import { cyberpunkRedCore } from './systems/cyberpunk-red-core.js'; /** * A HUD extension that shows the Note preview @@ -174,6 +175,8 @@ export default class TokenNoteHoverHUD extends foundry.applications.hud.BasePlac tempContent = await wod5e(actor, displayImages); } else if (game.data.system.id === 'universal-tabletop-system') { tempContent = await universalTabletopSystem(actor, displayImages); + } else if (game.data.system.id === 'cyberpunk-red-core') { + tempContent = await cyberpunkRedCore(actor, displayImages); } diff --git a/src/scripts/systems/cyberpunk-red-core.js b/src/scripts/systems/cyberpunk-red-core.js new file mode 100644 index 0000000..63f6507 --- /dev/null +++ b/src/scripts/systems/cyberpunk-red-core.js @@ -0,0 +1,79 @@ +import CONSTANTS from '../constants.js'; +import { processNotes } from "../textUtil.js"; + +export async function cyberpunkRedCore(actor, displayImages) { + // Using a guard here looks cleaner + if (!actor) { + return null; + } + + const actorIsOwner = actor.isOwner ?? true; + + switch (actor.type) { + case "character": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayPC')) { + return await getCharacterNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + case "container": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayPC')) { + return await getContainerNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + case "demon": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayPC')) { + return await getDemonNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + case "blackIce": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayPC')) { + return await getDemonNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + case "mook": + if (game.settings.get(CONSTANTS.MODULE_ID, 'displayNPC')) { + return await getCharacterNotes(displayImages, actor, actorIsOwner); + } else { + return null; + } + default: + return null; + } +} + +async function getCharacterNotes(displayImages, actor, actorIsOwner) { + return await processNotes(actor.system?.information?.notes, actorIsOwner, displayImages); +} + +async function getDemonNotes(displayImages, actor, actorIsOwner) { + return await processNotes(actor.system?.notes, actorIsOwner, displayImages); +} + +async function getContainerNotes(displayImages, actor, actorIsOwner) { + let containerNote = ""; + let test =""; + for (let i = 0; i < actor.items.contents.length; i += 1) { + containerNote = containerNote.concat("
"); + containerNote = containerNote.concat(actor.items.contents[i].name); + containerNote = containerNote.concat("
"); + containerNote = containerNote.concat("

"); + containerNote = containerNote.concat(actor.items.contents[i].type); + containerNote = containerNote.concat("

"); + } + return await processNotes(containerNote, actorIsOwner, displayImages); +} + +async function getNpcNotes(displayImages, actor, actorIsOwner) { + const privateNotes = actor.system?.information?.notes; + let notes = ""; + + if (!game.settings.get(CONSTANTS.MODULE_ID, 'hidePrivateNotes') && game.user.isGM && privateNotes) { + notes = privateNotes; + } + + return await processNotes(notes, actorIsOwner, displayImages); +}