Add toolip and trait descriptions
This commit is contained in:
@@ -7,10 +7,21 @@ import * as applications from "./module/applications/_module.mjs"
|
||||
import { SystemManager } from "./module/applications/hud/system-manager.js"
|
||||
import { MODULE, REQUIRED_CORE_MODULE_VERSION } from "./module/applications/hud/constants.js"
|
||||
|
||||
Hooks.once("init", function () {
|
||||
Hooks.once("init", async function () {
|
||||
console.info("Adventures with Emmy | Initializing System")
|
||||
console.info(SYSTEM.ASCII)
|
||||
|
||||
// Load trait tooltip descriptions from external JSON
|
||||
try {
|
||||
const resp = await fetch("systems/fvtt-adventures-with-emmy/module/config/trait-descriptions.json")
|
||||
const data = await resp.json()
|
||||
// Strip the comment key and populate SYSTEM.TRAIT_DESCRIPTIONS in-place
|
||||
delete data["_comment"]
|
||||
Object.assign(SYSTEM.TRAIT_DESCRIPTIONS, data)
|
||||
} catch (err) {
|
||||
console.warn("Adventures with Emmy | Failed to load trait-descriptions.json", err)
|
||||
}
|
||||
|
||||
globalThis.adventuresWithEmmy = game.system
|
||||
game.system.CONST = SYSTEM
|
||||
|
||||
@@ -83,6 +94,10 @@ Hooks.once("init", function () {
|
||||
|
||||
// Handlebars helpers
|
||||
Handlebars.registerHelper("abs", (value) => Math.abs(value ?? 0))
|
||||
Handlebars.registerHelper("traitTooltip", (traitName) => {
|
||||
const key = (traitName ?? "").toLowerCase()
|
||||
return SYSTEM.TRAIT_DESCRIPTIONS[key] ?? ""
|
||||
})
|
||||
})
|
||||
|
||||
Hooks.once("ready", function () {
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class AwEItemSheet extends HandlebarsApplicationMixin(foundry.app
|
||||
classes: ["awemmy", "item"],
|
||||
position: {
|
||||
width: 600,
|
||||
height: 480
|
||||
height: 540
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true
|
||||
|
||||
@@ -55,6 +55,13 @@ export const ASCII = `
|
||||
|___/
|
||||
`
|
||||
|
||||
/**
|
||||
* Tooltip descriptions for known traits — loaded at runtime from
|
||||
* module/config/trait-descriptions.json. Populated during the "init" hook;
|
||||
* starts as an empty object so the helper never throws before load.
|
||||
*/
|
||||
export let TRAIT_DESCRIPTIONS = {}
|
||||
|
||||
/** Default trait list extracted from the core rulebook. Open-ended: custom traits are always allowed. */
|
||||
export const TRAITS = [
|
||||
// Action traits
|
||||
@@ -83,6 +90,7 @@ export const SYSTEM = {
|
||||
ABILITY_COST,
|
||||
ABILITY_TYPE,
|
||||
OUTCOME_LABELS,
|
||||
TRAIT_DESCRIPTIONS,
|
||||
TRAITS,
|
||||
ASCII
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"_comment": "Tooltip descriptions for known traits. Keys are lowercase trait names. Replace placeholder values with actual rules text.",
|
||||
|
||||
"attack": "This ability or action counts as an attack.",
|
||||
"discovered": "Placeholder — fill in trait description.",
|
||||
"flow": "Placeholder — fill in trait description.",
|
||||
"hypothesis": "Placeholder — fill in trait description.",
|
||||
"intensive": "This ability requires significant effort or concentration.",
|
||||
"kit": "This ability or action requires the use of a kit.",
|
||||
"linguistic": "This ability involves language or communication.",
|
||||
"manipulate": "This ability requires physical manipulation with your hands.",
|
||||
"review": "Placeholder — fill in trait description.",
|
||||
"traversal": "This ability involves movement or repositioning.",
|
||||
"velocity": "Placeholder — fill in trait description.",
|
||||
|
||||
"acid": "Deals acid damage.",
|
||||
"bludgeoning": "Deals bludgeoning (blunt impact) damage.",
|
||||
"cold": "Deals cold damage.",
|
||||
"electricity": "Deals electricity damage.",
|
||||
"fire": "Deals fire damage.",
|
||||
"force": "Deals force damage.",
|
||||
"mental": "Deals mental damage.",
|
||||
"piercing": "Deals piercing damage.",
|
||||
"poison": "Deals poison damage.",
|
||||
"slashing": "Deals slashing damage.",
|
||||
"sonic": "Deals sonic damage.",
|
||||
|
||||
"electromagnetic": "Placeholder — fill in trait description.",
|
||||
"geometry": "Placeholder — fill in trait description.",
|
||||
"gravity": "Placeholder — fill in trait description.",
|
||||
"numerical": "Placeholder — fill in trait description.",
|
||||
"paradox": "Placeholder — fill in trait description.",
|
||||
"probability": "Placeholder — fill in trait description.",
|
||||
|
||||
"animal": "Affects or involves animals.",
|
||||
"archetype": "Granted by or related to a character archetype.",
|
||||
"aura": "This ability projects an aura around the user.",
|
||||
"auditory": "This ability involves sound and can be perceived by hearing.",
|
||||
"awarded": "Placeholder — fill in trait description.",
|
||||
"axiom": "Placeholder — fill in trait description.",
|
||||
"design": "Placeholder — fill in trait description.",
|
||||
"extradimensional": "Placeholder — fill in trait description.",
|
||||
"fabricate": "Placeholder — fill in trait description.",
|
||||
"gremlin": "Placeholder — fill in trait description.",
|
||||
"interdisciplinary":"Placeholder — fill in trait description.",
|
||||
"large": "This ability or creature is large-sized.",
|
||||
"mishap": "This ability can trigger a mishap on certain outcomes.",
|
||||
"number": "Placeholder — fill in trait description.",
|
||||
"plant": "Affects or involves plant life.",
|
||||
"prototype": "Placeholder — fill in trait description.",
|
||||
"singular": "This ability can only be used once per encounter or period.",
|
||||
"small": "This ability or creature is small-sized.",
|
||||
"teleportation": "This ability involves teleportation.",
|
||||
|
||||
"biologist": "Requires or relates to the Biologist field.",
|
||||
"chemist": "Requires or relates to the Chemist field.",
|
||||
"engineer": "Requires or relates to the Engineer field.",
|
||||
"mathematician": "Requires or relates to the Mathematician field.",
|
||||
"physicist": "Requires or relates to the Physicist field."
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
{{#if traits.length}}
|
||||
<div class="ability-use-traits">
|
||||
{{#each traits}}<span class="ability-trait-tag">{{this}}</span>{{/each}}
|
||||
{{#each traits}}<span class="ability-trait-tag" data-tooltip="{{traitTooltip this}}">{{this}}</span>{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<label>{{localize "AWEMMY.Ability.Traits"}}</label>
|
||||
<div class="tags-list">
|
||||
{{#each system.traits}}
|
||||
<span class="tag">{{this}} <a data-action="removeTrait" data-index="{{@index}}">×</a></span>
|
||||
<span class="tag" data-tooltip="{{traitTooltip this}}">{{this}} <a data-action="removeTrait" data-index="{{@index}}">×</a></span>
|
||||
{{/each}}
|
||||
<input type="text" class="new-tag" data-action="addTrait"
|
||||
list="awemmy-trait-suggestions"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<label>{{localize "AWEMMY.Specialization.Traits"}}</label>
|
||||
<div class="tags-list">
|
||||
{{#each system.traits}}
|
||||
<span class="tag">{{this}} <a data-action="removeTrait" data-index="{{@index}}">×</a></span>
|
||||
<span class="tag" data-tooltip="{{traitTooltip this}}">{{this}} <a data-action="removeTrait" data-index="{{@index}}">×</a></span>
|
||||
{{/each}}
|
||||
<input type="text" class="new-tag" data-action="addTrait"
|
||||
list="awemmy-trait-suggestions"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<label>{{localize "AWEMMY.Ability.Traits"}}</label>
|
||||
<div class="tags-list">
|
||||
{{#each system.traits}}
|
||||
<span class="tag">{{this}} <a data-action="removeTrait" data-index="{{@index}}">×</a></span>
|
||||
<span class="tag" data-tooltip="{{traitTooltip this}}">{{this}} <a data-action="removeTrait" data-index="{{@index}}">×</a></span>
|
||||
{{/each}}
|
||||
<input type="text" class="new-tag" data-action="addTrait"
|
||||
list="awemmy-trait-suggestions"
|
||||
|
||||
Reference in New Issue
Block a user