added support for fate and wounds.
This commit is contained in:
37
DEVGUIDE.md
Normal file
37
DEVGUIDE.md
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
# Dev Guide
|
||||
|
||||
|
||||
## Module Development
|
||||
|
||||
### Make a new system.js file
|
||||
|
||||
In the [src/systems](src/systems) directory, create a new system file by copying and pasting a similar system to it; for example, `cp demonlord.js wfrp4.js`
|
||||
You then need to go through all the functions in there and make sure that the correct data is set.
|
||||
|
||||
### Update TokenHelper
|
||||
In [src/systems/TokenHelper.js](src/systems/TokenHelper.js), you need to add an `import {}` for your new system.
|
||||
|
||||
In the same file, in the setSystem() function, you need to wire in your system to the if/else block.
|
||||
|
||||
## Debugging
|
||||
|
||||
It's possible to debug on the Stream Deck, so you can do `console.log`. Just follow the instructions [from elgato here](https://developer.elgato.com/documentation/stream-deck/sdk/create-your-own-plugin/). After editing the code for the plugin, you need to either refresh by refreshing the debug window, or by deselecting the current button, and selecting it again.
|
||||
|
||||
##
|
||||
|
||||
For getStats, getRolls you cannot change value
|
||||
|
||||
For the others, it depends on the system. For example:
|
||||
in 5e, to get the appraise skill modifier, you do token.actor.data.data.skills?.[skill].total where 'skill' is 'apr'. So in the plugin, you have to set the value to 'apr'.
|
||||
|
||||
## Streamdeck
|
||||
|
||||
On the SD side: The plugin in windows is located at AppData/Roaming/Elgato/StreamDeck/Plugins/com.cdeenen.materialdeck.sdPlugin
|
||||
In propertyinspector/js/common.js starting at line 1274 there's various functions that are used to get the relevant options to show up in the SD plugin. Each array element has a value and a name, you should keep the value the same, but the name can be whatever you like. I think you'll be able to figure out how to add stuff for wfrp by looking at the others.
|
||||
|
||||
To enable logging on the streamdeck, [follow these instructions](https://developer.elgato.com/documentation/stream-deck/sdk/create-your-own-plugin/) from Elgato.
|
||||
|
||||
|
||||
## Module Deployment
|
||||
Copy the new system.js and tokenHelper.js
|
||||
@@ -69,6 +69,9 @@ Module manifest: https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/m
|
||||
<b>Foundry VTT:</b> Tested on 0.7.9 - 0.8.5<br>
|
||||
<b>Module Incompatibilities:</b> None known.<br>
|
||||
|
||||
## Developer Guide
|
||||
See the [developer guide](./DEVGUIDE.md) for a guide on how to add new systems to `MaterialDeck`.
|
||||
|
||||
## Feedback
|
||||
If you have any suggestions or bugs to report, feel free to create an issue, contact me on Discord (Cris#6864), or send me an email: cdeenen@outlook.com.
|
||||
|
||||
|
||||
@@ -186,6 +186,12 @@ export class TokenHelper{
|
||||
return this.system.getProficiency(token);
|
||||
}
|
||||
|
||||
/* WFRP 4E */
|
||||
getFate(token) {
|
||||
return this.system.getFate(token)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Conditions
|
||||
*/
|
||||
|
||||
@@ -5,12 +5,21 @@ export class wfrp4e {
|
||||
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
getFate(token) {
|
||||
return token.actor.data.data.status.fate.value
|
||||
}
|
||||
|
||||
getWounds(token) {
|
||||
const wounds = token.actor.data.data.status.wounds
|
||||
return {
|
||||
value: wounds.value,
|
||||
max: wounds.max
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
return this.getWounds(token);
|
||||
}
|
||||
|
||||
getTempHP(token) {
|
||||
|
||||
@@ -94,7 +94,7 @@ export class TokenControl{
|
||||
}
|
||||
}
|
||||
|
||||
if (stats == 'HP') {
|
||||
if (stats == 'HP' || stats == 'Wounds') {
|
||||
const hp = tokenHelper.getHP(token);
|
||||
txt += hp.value + "/" + hp.max;
|
||||
|
||||
@@ -135,6 +135,8 @@ export class TokenControl{
|
||||
else if (stats == 'Save') txt += tokenHelper.getAbilitySave(token, settings.save);
|
||||
else if (stats == 'Skill') txt += tokenHelper.getSkill(token, settings.skill);
|
||||
else if (stats == 'Prof') txt += tokenHelper.getProficiency(token);
|
||||
else if (stats == 'Fate') txt += tokenHelper.getFate(token)
|
||||
|
||||
|
||||
if (settings.onClick == 'visibility') { //toggle visibility
|
||||
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) {
|
||||
|
||||
Reference in New Issue
Block a user