-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ortegamarcel/develop
Updated Project Structure
- Loading branch information
Showing
13 changed files
with
345 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.detectIndentation": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
# Token Action HUD TheWitcherTRPG | ||
Token Action HUD is a repositionable HUD of actions for a selected token. | ||
|
||
<!-- TODO: Include gif of actions hud --> | ||
|
||
# Features | ||
- Make rolls directly from the HUD instead of opening your character sheet. | ||
- Use items from the HUD or right-click an item to open its sheet. | ||
- Move the HUD and choose to expand the menus up or down. | ||
- Unlock the HUD to customise categories and subcategories per user, and actions per actor. | ||
- Add your own macros and Journal Entry and Roll Table compendiums. | ||
|
||
# Installation | ||
|
||
<!-- ## Method 1 | ||
1. On Foundry VTT's **Configuration and Setup** screen, go to **Add-on Modules** | ||
2. Click **Install Module** | ||
3. Search for **Token Action HUD D&D 5e** | ||
4. Click **Install** next to the module listing --> | ||
|
||
## Method 1 | ||
1. On Foundry VTT's **Configuration and Setup** screen, go to **Add-on Modules** | ||
2. Click **Install Module** | ||
3. In the Manifest URL field, paste: `https://github.com/ortegamarcel/fvtt-token-action-hud-TheWitcherTRPG/releases/latest/download/module.json` | ||
4. Click **Install** next to the pasted Manifest URL | ||
|
||
## Required Modules | ||
|
||
**IMPORTANT** - Token Action HUD D&D 5e requires the [Token Action HUD D&D Core](https://foundryvtt.com/packages/token-action-hud-core) module to be installed. | ||
|
||
## Recommended Modules | ||
Token Action HUD uses either the [Color Picker](https://foundryvtt.com/packages/color-picker), [libThemer](https://foundryvtt.com/packages/lib-themer) or [VTTColorSettings](https://foundryvtt.com/packages/colorsettings) library modules for its color picker settings. Only one is required. | ||
|
||
# Support | ||
|
||
For questions, feature requests or bug reports, please open an issue [here](https://github.com/Larkinabout/fvtt-token-action-hud-core/issues). | ||
|
||
Pull requests are welcome. Please include a reason for the request or create an issue before starting one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"TAH_WITCHER": { | ||
"combat": "Kampf" | ||
"combat": "Kampf", | ||
"weapons": "Waffen", | ||
"magic": "Magie" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"TAH_WITCHER": { | ||
"combat": "Combat" | ||
} | ||
"TAH_WITCHER": { | ||
"combat": "Combat", | ||
"weapons": "Weapons", | ||
"magic": "Magic" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { ACTION_TYPE, GROUP } from "./constants.js"; | ||
import { Utils } from "./utils.js"; | ||
|
||
export let ActionHandler = null; | ||
|
||
Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { | ||
ActionHandler = class ActionHandler extends coreModule.api.ActionHandler { | ||
|
||
/** @override */ | ||
async buildSystemActions(subcategoryIds) { | ||
// We don't support MULTIPLE tokens being selected at the same time. | ||
//this.actors = (!this.actor) ? this._getActors() : [this.actor] | ||
//this.tokens = (!this.token) ? this._getTokens() : [this.token] | ||
//this.actorType = this.actor?.type | ||
|
||
const token = this.token; | ||
const actor = this.actor; | ||
if (!token || !actor) { | ||
return; | ||
} | ||
|
||
this._getCombat(actor, token.id, { id: GROUP.weapons.id, type: 'system' }); | ||
|
||
|
||
//if (settings.get("showHudTitle")) result.hudTitle = token.name; | ||
} | ||
|
||
_getCombat(actor, tokenId, parent) { | ||
// just one long list of actions for the combat category | ||
const actions = actor.items | ||
.filter(item => item.type === 'weapon' && item.system.equiped) | ||
.map(item => ({ | ||
id: item.id, | ||
name: item.name, | ||
encodedValue: [ACTION_TYPE.attack, actor.id, tokenId, item.id].join(this.delimiter), | ||
img: Utils.getImage(item) | ||
})); | ||
console.log('actions :>> ', actions); | ||
this.addActions(actions, parent); | ||
} | ||
|
||
// createList(parent, actor, tokenId, itemtype, checksort, sorting, label, selectedfunc=undefined) { | ||
// // create one sublist | ||
// const actions = actor.items.filter( item => item.type === itemtype && | ||
// (!checksort || item.system.settings.general.sorting === sorting) && | ||
// (!actor.system.settings.general.hideArchive || !item.system.archived)) | ||
// .map(item => { | ||
// return { | ||
// id: item.id, | ||
// name: item.name, | ||
// encodedValue: [itemtype, actor.id, tokenId, item.id].join(this.delimiter), | ||
// cssClass: item.system.archived ? 'disabled' : selectedfunc ? (selectedfunc(item) ? 'toggle active' : 'toggle') : '', | ||
// img: Utils.getImage(item) | ||
// } | ||
// }) | ||
// if (actions.length) { | ||
// const subcat = { id: sorting, name: Utils.i18n(label), type: 'system-derived'}; | ||
// this.addGroup(subcat, parent); | ||
// this.addActions(actions, subcat); | ||
// } | ||
// } | ||
|
||
// _getSkills(actor, tokenId, parent) { | ||
// // up to four groups of skills | ||
// const table = { | ||
// Skill: actor.system.settings.skills.labelCategory1 || 'CYPHERSYSTEM.Skills', | ||
// SkillTwo: actor.system.settings.skills.labelCategory2 || 'CYPHERSYSTEM.SkillCategoryTwo', | ||
// SkillThree: actor.system.settings.skills.labelCategory3 || 'CYPHERSYSTEM.SkillCategoryThree', | ||
// SkillFour: actor.system.settings.skills.labelCategory4 || 'CYPHERSYSTEM.SkillCategoryFour', | ||
// } | ||
// for (const [ sorting, label ] of Object.entries(table)) { | ||
// this.createList(parent, actor, tokenId, ACTION_SKILL, true, sorting, label) | ||
// } | ||
// } | ||
|
||
// _getAbilities(actor, tokenId, parent) { | ||
// // up to four groups of abilities | ||
// const table = { | ||
// Ability: actor.system.settings.abilities.labelCategory1 || 'CYPHERSYSTEM.Abilities', | ||
// AbilityTwo: actor.system.settings.abilities.labelCategory2 || 'CYPHERSYSTEM.AbilityCategoryTwo', | ||
// AbilityThree: actor.system.settings.abilities.labelCategory3 || 'CYPHERSYSTEM.AbilityCategoryThree', | ||
// AbilityFour: actor.system.settings.abilities.labelCategory4 || 'CYPHERSYSTEM.AbilityCategoryFour', | ||
// Spell: 'CYPHERSYSTEM.Spells' | ||
// } | ||
// for (const [ sorting, label ] of Object.entries(table)) { | ||
// this.createList(parent, actor, tokenId, ACTION_ABILITY, true, sorting, label); | ||
// } | ||
// } | ||
|
||
// _getTags(actor, tokenId, parent) { | ||
// // current recursion is from actor.getFlag("cyphersystem", "recursion"), but the stored string is @<lowercasenanme> | ||
// const recursion = actor.getFlag("cyphersystem", "recursion")?.slice(1); // strip leading '@' | ||
// const recursionname = actor.items.find(item => item.name.toLowerCase() === recursion)?.name; | ||
// this.createList(parent, actor, tokenId, ACTION_RECURSION, false, 'recursion', 'CYPHERSYSTEM.Recursions', | ||
// (item) => item.name == recursionname ); | ||
// this.createList(parent, actor, tokenId, ACTION_TAG, false, 'tag', 'CYPHERSYSTEM.Tags', | ||
// (item) => item.system.active ); | ||
// } | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Module-based constants | ||
*/ | ||
export const MODULE = { | ||
ID: 'fvtt-token-action-hud-TheWitcherTRPG' | ||
}; | ||
|
||
/** | ||
* Core module | ||
*/ | ||
export const CORE_MODULE = { | ||
ID: 'token-action-hud-core' | ||
}; | ||
|
||
/** | ||
* Core module version required by the system module | ||
*/ | ||
export const REQUIRED_CORE_MODULE_VERSION = '1.4'; | ||
|
||
/** | ||
* Action type | ||
*/ | ||
export const ACTION_TYPE = { | ||
attack: 'attack' | ||
}; | ||
|
||
export const GROUP = { | ||
weapons: { id: 'weapons', name: 'TAH_WITCHER.weapons', type: 'system' } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { GROUP } from './constants.js' | ||
|
||
/** | ||
* Default categories and groups | ||
*/ | ||
export let DEFAULTS = null; | ||
|
||
Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { | ||
const groups = GROUP | ||
Object.values(groups).forEach(group => { | ||
group.name = coreModule.api.Utils.i18n(group.name) | ||
group.listName = `Group: ${coreModule.api.Utils.i18n(group.name)}` | ||
}) | ||
const groupsArray = Object.values(groups) | ||
DEFAULTS = { | ||
layout: [ | ||
{ | ||
nestId: 'combat', | ||
id: 'combat', | ||
name: coreModule.api.Utils.i18n('TAH_WITCHER.combat'), | ||
groups: [ | ||
{ ...groups.weapons, nestId: 'combat_weapons' } | ||
] | ||
}, | ||
{ | ||
nestId: 'skills', | ||
id: 'skills', | ||
name: coreModule.api.Utils.i18n('WITCHER.Monster.SkillTab'), | ||
groups: [ | ||
] | ||
}, | ||
{ | ||
nestId: 'magic', | ||
id: 'magic', | ||
name: coreModule.api.Utils.i18n('TAH_WITCHER.magic'), | ||
groups: [ | ||
] | ||
} | ||
], | ||
groups: groupsArray | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { SystemManager } from './system-manager.js' | ||
import { MODULE, REQUIRED_CORE_MODULE_VERSION } from './constants.js' | ||
|
||
Hooks.on('tokenActionHudCoreApiReady', async () => { | ||
const module = game.modules.get(MODULE.ID) | ||
module.api = { | ||
requiredCoreModuleVersion: REQUIRED_CORE_MODULE_VERSION, | ||
SystemManager | ||
} | ||
Hooks.call('tokenActionHudSystemReady', module) | ||
}); |
Oops, something went wrong.