Add tooltip for all items

This commit is contained in:
2026-04-29 16:33:51 +02:00
parent b19ba64a39
commit c2811c9eb9
5 changed files with 90 additions and 59 deletions
+7
View File
@@ -98,6 +98,13 @@ Hooks.once("init", async function () {
const key = (traitName ?? "").toLowerCase() const key = (traitName ?? "").toLowerCase()
return SYSTEM.TRAIT_DESCRIPTIONS[key] ?? "" return SYSTEM.TRAIT_DESCRIPTIONS[key] ?? ""
}) })
/** Strip HTML tags and truncate item description for use as a data-tooltip value. */
Handlebars.registerHelper("itemTooltip", (item) => {
const raw = item?.system?.description ?? ""
if (!raw) return ""
const plain = raw.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim()
return plain.length > 250 ? plain.slice(0, 247) + "…" : plain
})
}) })
Hooks.once("ready", function () { Hooks.once("ready", function () {
+75 -51
View File
@@ -1,60 +1,84 @@
{ {
"_comment": "Tooltip descriptions for known traits. Keys are lowercase trait names. Replace placeholder values with actual rules text.", "_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.", "attack": "This action requires a check in an attempt to harm or restrain another creature. If you attempt a second attack action on your turn, the required check takes a -5 penalty. If you attempt a third attack action, the check takes a -10 penalty, as do any further attacks. This multiple attack penalty resets to zero at the end of your turn, and does not apply when it is not your turn.",
"discovered": "Placeholder — fill in trait description.", "discovered": "This trait indicates that you can only add this action to your Repertoire by making an appropriate discovery in an adventure.",
"flow": "Placeholder — fill in trait description.", "flow": "This action requires you to have, and possibly to spend, at least 1 Flow Point. If an action allows you to alter its effects if you have or spend Flow Points, the action gains the flow trait when you make this alteration.",
"hypothesis": "Placeholder — fill in trait description.", "hypothesis": "This action requires you to state a hypothesis.",
"intensive": "This ability requires significant effort or concentration.", "intensive": "This trait indicates that the action requires significant concentration and effort from your hero, with the benefit of allowing you to carry out multiple actions for a reduced number of Δs. You can use a maximum of 1 intensive action per round.",
"kit": "This ability or action requires the use of a kit.", "kit": "This action requires the use of your kit. You draw and stow any equipment from your kit as part of this action.",
"linguistic": "This ability involves language or communication.", "linguistic": "This type of action requires another creature to be able to understand your language (whether spoken or through sign) to be effective.",
"manipulate": "This ability requires physical manipulation with your hands.", "manipulate": "This ability requires physical manipulation with your hands, so you cant use this action if all your hands are occupied..",
"review": "Placeholder — fill in trait description.", "review": "An action that has this trait can be used during the Review phase without spending Δs. You can usually only take 1 review action during Review.",
"traversal": "This ability involves movement or repositioning.", "traversal": "An ability with the traversal trait includes one or more Stride actions and allows you to adapt them for other forms of movement. You can substitute a Climb or Swim action in place of any Stride actions. Any adjustments to the Stride, such as gaining a bonus or penalty to the distance moved, still apply to the substituted action.",
"velocity": "Placeholder — fill in trait description.", "velocity": "This action causes you to move relative to your surroundings.",
"acid": "This creature or effect involves chemical corrosion.",
"bludgeoning": "This effect deals bludgeoning (blunt impact) damage.",
"cold": "This creature or effect involves extremely low temperature.",
"electricity": "This creature or effect involves an application of high electric current.",
"fire": "This creature or effect involves extremely high temperature.",
"force": "This creature or effect involves a direct application of a fundamental force of the universe.",
"mental": "This creature or effect involves intense thought A mental effect no effect on an object or a mindless creature.",
"piercing": "This effect deals piercing (stabs or punctures) damage.",
"poison": "This creature or effect involves a physical debilitation of physiology.",
"slashing": "This effect deals slashing (cutting) damage.",
"sonic": "This effect or creature involves intense vibrations, though not necessarily audible.",
"acid": "Deals acid damage.", "electromagnetic": "This creature or effect involves electromagnetic fields.",
"bludgeoning": "Deals bludgeoning (blunt impact) damage.", "geometry": "Abilities with this trait manipulate your surroundings, like creating difficult terrain or setting up walls. Unless stated otherwise, two instances of the same geometry effect cannot overlap the same space.",
"cold": "Deals cold damage.", "gravity": "This creature or effect involves gravitational fields.",
"electricity": "Deals electricity damage.", "numerical": "Abilities with this trait manipulate the quantitative reality underpinning the target. Some apply untyped damage, which bypasses nearly all resistances and weaknesses.",
"fire": "Deals fire damage.", "paradox": "Abilities with this trait present the target with a self-contradictory manifestation of unreality.",
"force": "Deals force damage.", "axiom": "Mathematicians use abilities with the axiom trait to shape the fundamental nature of reality.",
"mental": "Deals mental damage.", "probability": "Abilities with this trait alter the way checks are made, such as turning an offensive check you make against a targets DC into a defensive check the target makes against your DC.",
"piercing": "Deals piercing damage.",
"poison": "Deals poison damage.",
"slashing": "Deals slashing damage.",
"sonic": "Deals sonic damage.",
"electromagnetic": "Placeholder — fill in trait description.", "animal": "Animals are organisms that are exclusively biological, are able to move, can reproduce sexually.",
"geometry": "Placeholder — fill in trait description.", "archetype": "Granted by or related to an archetype.",
"gravity": "Placeholder — fill in trait description.", "aura": "This ability projects an aura around the user. Measure the listed distance from each edge of the user's square.",
"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.", "auditory": "This ability involves sound and can be perceived by hearing.",
"awarded": "Placeholder — fill in trait description.", "awarded": "This item can only be obtained via an award from the GM.",
"axiom": "Placeholder — fill in trait description.", "design": "When you describe a design, you express to your GM the problem you want to solve and how the design solves it. This process is open-ended and results in you effecting some change in the encounter. Your GM responds to your design with one of the following outcomes: solve, partially solved, or unsolved. Your GM might determine that your design requires additional time to enact. If so, you can spend additional Δs to enact your design before resolving the outcome. You usually only enact each design once, but you can refine a design on subsequent actions.",
"design": "Placeholder — fill in trait description.", "extradimensional": "This effect involves movement through a higher dimension.",
"extradimensional": "Placeholder — fill in trait description.", "fabricate": "Actions with the fabricate trait always list at least one specialization. For engineers of those specializations, they do not require materials from the environment to perform the action. It is assumed that the engineer has the materials within the kit granted by their specialization.",
"fabricate": "Placeholder — fill in trait description.", "fabricate (computer)": "Actions with the fabricate trait always list at least one specialization. For engineers of those specializations, they do not require materials from the environment to perform the action. It is assumed that the engineer has the materials within the kit granted by their specialization.",
"gremlin": "Placeholder — fill in trait description.", "fabricate (electrical)": "Actions with the fabricate trait always list at least one specialization. For engineers of those specializations, they do not require materials from the environment to perform the action. It is assumed that the engineer has the materials within the kit granted by their specialization.",
"interdisciplinary":"Placeholder — fill in trait description.", "fabricate (mechanical)": "Actions with the fabricate trait always list at least one specialization. For engineers of those specializations, they do not require materials from the environment to perform the action. It is assumed that the engineer has the materials within the kit granted by their specialization.",
"large": "This ability or creature is large-sized.", "gremlin": "Gremlins are small in stature, but they exert a powerful command over the most fundamental forces of nature. Intensely self-driven and passionate, they use these forces to further their ends. Gremlins live in small communities beneath the worlds surface, and typically those with more altruistic motivations stay behind to care for the problems left by the more selfish gremlins who journey to the surface.",
"mishap": "This ability can trigger a mishap on certain outcomes.", "interdisciplinary":"An interdisciplinary archetype is a special type of archetype that allows you to take abilities from another field.",
"number": "Placeholder — fill in trait description.", "large": "This creature occupies a 2 meter by 2 meter square on a map and has a reach of 2 meters.",
"plant": "Affects or involves plant life.", "medium": "This creature occupies a 1 meter by 1 meter square on a map and has a reach of 1 meters.",
"prototype": "Placeholder — fill in trait description.", "small": "This creature occupies a 1 meter by 1 meter square on a map, has a reach of 1 meter and is shorter than a medium creature.",
"singular": "This ability can only be used once per encounter or period.", "huge": "This creature occupies a 3 meter by 3 meter square on a map and has a reach of 3 meters.",
"small": "This ability or creature is small-sized.", "gargantuan": "This creature occupies a 4 meter by 4 meter square on a map and has a reach of 4 meters.",
"tiny": "This creature occupies so little space that they can share a square with a larger creature, or up to 3 additional tiny creatures. It has a reach of 0 meters.",
"mishap": "This ability affects how you roll your dice, usually requiring you to roll twice and take the lower result.",
"edge": "This ability affects how you roll your dice, usually requiring you to roll twice and take the higher result.",
"number": "This is a misprint of the numerical trait. If you see it, please let us know!",
"plant": "Plants.",
"prototype": "An engineering specialization gives you an action with the prototype trait. When you prototype, you gain a client that you interact with in subsequent actions. You yourself could be the client, but a client must be willing to receive your help. The creature you designate as your client retains that designation until you prototype again. You may prototype with the same client again to start a new design. Flow Points help you take on more clients. Prototype actions are written with outcomes for a combat encounter, when you design in response to an immediate danger. Prototyping generates a good deal of noise, so if you try to use a prototype action before a combat begins, it usually alerts any hostile creatures. Outside of combat, you can more generally describe devices you build to assist your allies without using a specific prototype action.",
"singular": "A hero can possess no more than one of this item at a time.",
"teleportation": "This ability involves teleportation.", "teleportation": "This ability involves teleportation.",
"biologist": "Requires or relates to the Biologist field.", "blast": "A blast is a hero's primary offensive ability. A blast usually requries you to make a key attribute check against the target's Agility DC. Your blast deals additional damage if the target is within your reach (which usually means they are adjacent to you) and if you have any number of Flow Points.",
"chemist": "Requires or relates to the Chemist field.", "dedication": "Each archetype starts with a dedication ability that represents your hero investing in this aspect of their identity. Many dedications specify a set of prerequisites, such as a level, attribute modifier, or ability you need. These prerequisites are not intended to set up a barrier for your hero, but they communicate what your hero needs in order to get the most out of this archetype from the perspective of game mechanics.",
"engineer": "Requires or relates to the Engineer field.", "apocryptic": "These creatures seem to violate the usual workings of the natural world, like shadow creatures, eldritch beings, aberrations, and cryptids. These are usually living creatures, and some are biological.",
"mathematician": "Requires or relates to the Mathematician field.", "constructed": "Constructed creatures are artifically made, including mechanical automatons, computerized intelligences, robots, and amalgamations.",
"physicist": "Requires or relates to the Physicist field." "dragon": "Dragons are imperious beings that use their amassed wealth to advance knowledge and development of topics of their particular interest. After centuries spent gazing into the layers of reality, a dragon begins to adopt the features of their chosen topic.",
"elemental": "Elementals both embody and command natural processes at a grand scale. They are living creatures, though not exclusively biological.",
"fey": "Fey are living creatures that embody nature in its wildest form. While biological, their existence extends beyond their physical forms and resonates with particular aspects of nature around them.",
"fungus": "Fungi.",
"humanoid": "Bipedal entities capable of human-like communication.",
"microscopic": "Microscopic organisms.",
"primordial": "These non-biological entities embody and uphold the fundamental principles of the universe.",
"reanimated": "These are biological systems that have been revived, such as zombies or biological systems or organs.",
"swarm": "This creature is composed of a host of miniscule organisms. Swarms usually have resistance to physical damage but weakness to area effects.",
"biologist": "Requires or relates to the biologist field.",
"chemist": "Requires or relates to the chemist field.",
"computer technician": "Requires or relates to the computer technician 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."
} }
+4 -4
View File
@@ -16,7 +16,7 @@
<fieldset class="items-list-fieldset"> <fieldset class="items-list-fieldset">
<legend>{{localize "AWEMMY.Item.Field"}}</legend> <legend>{{localize "AWEMMY.Item.Field"}}</legend>
{{#each fields}} {{#each fields}}
<div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true"> <div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true" data-tooltip="{{itemTooltip this}}">
<img src="{{img}}" class="item-img" alt="{{name}}" /> <img src="{{img}}" class="item-img" alt="{{name}}" />
<span class="item-name">{{name}}</span> <span class="item-name">{{name}}</span>
<span class="item-key-attr"> <span class="item-key-attr">
@@ -42,7 +42,7 @@
<fieldset class="items-list-fieldset"> <fieldset class="items-list-fieldset">
<legend>{{localize "AWEMMY.Item.Specialization"}}</legend> <legend>{{localize "AWEMMY.Item.Specialization"}}</legend>
{{#each specializations}} {{#each specializations}}
<div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true"> <div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true" data-tooltip="{{itemTooltip this}}">
<img src="{{img}}" class="item-img" alt="{{name}}" /> <img src="{{img}}" class="item-img" alt="{{name}}" />
<span class="item-name">{{name}}</span> <span class="item-name">{{name}}</span>
{{#if system.fieldName}} {{#if system.fieldName}}
@@ -69,7 +69,7 @@
<fieldset class="items-list-fieldset"> <fieldset class="items-list-fieldset">
<legend>{{localize "AWEMMY.Item.Archetype"}}</legend> <legend>{{localize "AWEMMY.Item.Archetype"}}</legend>
{{#each archetypes}} {{#each archetypes}}
<div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true"> <div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true" data-tooltip="{{itemTooltip this}}">
<img src="{{img}}" class="item-img" alt="{{name}}" /> <img src="{{img}}" class="item-img" alt="{{name}}" />
<span class="item-name">{{name}}</span> <span class="item-name">{{name}}</span>
<div class="item-controls"> <div class="item-controls">
@@ -85,7 +85,7 @@
<fieldset class="items-list-fieldset"> <fieldset class="items-list-fieldset">
<legend>{{localize "AWEMMY.Item.Background"}}</legend> <legend>{{localize "AWEMMY.Item.Background"}}</legend>
{{#each backgrounds}} {{#each backgrounds}}
<div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true"> <div class="item-row" data-item-id="{{id}}" data-item-uuid="{{uuid}}" data-drag="true" data-tooltip="{{itemTooltip this}}">
<img src="{{img}}" class="item-img" alt="{{name}}" /> <img src="{{img}}" class="item-img" alt="{{name}}" />
<span class="item-name">{{name}}</span> <span class="item-name">{{name}}</span>
<div class="item-controls"> <div class="item-controls">
+3 -3
View File
@@ -5,7 +5,7 @@
<legend>{{localize "AWEMMY.Item.Kit"}}</legend> <legend>{{localize "AWEMMY.Item.Kit"}}</legend>
<div class="item-list"> <div class="item-list">
{{#each kits as |item|}} {{#each kits as |item|}}
<div class="item-row" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"> <div class="item-row" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{itemTooltip item}}">
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" /> <img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
<div class="item-name">{{item.name}}</div> <div class="item-name">{{item.name}}</div>
<div class="item-controls"> <div class="item-controls">
@@ -30,7 +30,7 @@
<legend>{{localize "AWEMMY.Item.Weapon"}}</legend> <legend>{{localize "AWEMMY.Item.Weapon"}}</legend>
<div class="item-list"> <div class="item-list">
{{#each weapons as |item|}} {{#each weapons as |item|}}
<div class="item-row" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"> <div class="item-row" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{itemTooltip item}}">
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" /> <img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
<div class="item-name">{{item.name}}</div> <div class="item-name">{{item.name}}</div>
<div class="item-damage">{{item.system.damageFormula}} ({{item.system.damageType}})</div> <div class="item-damage">{{item.system.damageFormula}} ({{item.system.damageType}})</div>
@@ -58,7 +58,7 @@
<legend>{{localize "AWEMMY.Item.Equipment"}}</legend> <legend>{{localize "AWEMMY.Item.Equipment"}}</legend>
<div class="item-list"> <div class="item-list">
{{#each equipments as |item|}} {{#each equipments as |item|}}
<div class="item-row" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"> <div class="item-row" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{itemTooltip item}}">
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" /> <img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
<div class="item-name">{{item.name}}</div> <div class="item-name">{{item.name}}</div>
<div class="item-qty">x{{item.system.quantity}}</div> <div class="item-qty">x{{item.system.quantity}}</div>
+1 -1
View File
@@ -51,7 +51,7 @@
<legend>{{localize "AWEMMY.Item.Ability"}}</legend> <legend>{{localize "AWEMMY.Item.Ability"}}</legend>
<div class="item-list"> <div class="item-list">
{{#each abilities as |item|}} {{#each abilities as |item|}}
<div class="item-row {{#if item.usedToday}}ability-used{{/if}}" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"> <div class="item-row {{#if item.usedToday}}ability-used{{/if}}" data-drag="true" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{itemTooltip item}}">
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" /> <img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
<div class="item-name">{{item.name}}</div> <div class="item-name">{{item.name}}</div>
<div class="item-cost">{{item.costLabel}}</div> <div class="item-cost">{{item.costLabel}}</div>