Final bits.
with @solo
This commit is contained in:
12
DEVGUIDE.md
12
DEVGUIDE.md
@@ -22,19 +22,15 @@ It's possible to debug on the Stream Deck, so you can do `console.log`. Just fol
|
||||
When you go to the debugging page, there should be multiple options. With the property inspector open, you should connect to the one with property inspector in its name. If you go to to propertyinspector/js/common.js, near the top there's the debugEn variable. Set it to true, and you should get tons of messages, especially if you change any settings.
|
||||
In the module, in MaterialDeck.js, at line 60, there's //console.log("Received",data);. If you uncomment that, it'll log everything that's send from the SD to the module. Might be helpful for debugging.
|
||||
|
||||
## Verify the below
|
||||
|
||||
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.
|
||||
|
||||
The plugin in Windows is located at (Windows) `AppData/Roaming/Elgato/StreamDeck/Plugins/com.cdeenen.materialdeck.sdPlugin`
|
||||
In `propertyinspector/js/common.js::getStats()` there are 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.
|
||||
|
||||
|
||||
## Property discovery
|
||||
In a Foundry client browser instance, if you go to the dev console, you can browser your tokens via the `canvas.tokens` path, for example `canvas.tokens.children[0].children[0].actor.data`.
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ Special thanks to Asmodeus#7588 who made this module possible by generously dona
|
||||
<br>
|
||||
Please consider supporting me on <a href="https://www.patreon.com/materialfoundry">Patreon</a>, and feel free to join the Material Foundry <a href="https://discord.gg/3hd4G6TkmA">Discord</a> server.
|
||||
|
||||
|
||||
## Abandonment
|
||||
Abandoned modules are a (potential) problem for Foundry, because users and/or other modules might rely on abandoned modules, which might break in future Foundry updates.<br>
|
||||
I consider this module abandoned if all of the below cases apply:
|
||||
|
||||
@@ -191,6 +191,35 @@ export class TokenHelper{
|
||||
return this.system.getFate(token)
|
||||
}
|
||||
|
||||
/* WFRP 4E */
|
||||
getFortune(token) {
|
||||
return this.system.getFortune(token)
|
||||
}
|
||||
|
||||
/* WFRP 4E */
|
||||
getCriticalWounds(token) {
|
||||
return this.system.getCriticalWounds(token)
|
||||
}
|
||||
|
||||
/* WFRP 4E */
|
||||
getCorruption(token) {
|
||||
return this.system.getCorruption(token)
|
||||
}
|
||||
|
||||
/* WFRP 4E */
|
||||
getAdvantage(token) {
|
||||
return this.system.getAdvantage(token)
|
||||
}
|
||||
|
||||
/* WFRP 4E */
|
||||
getResolve(token) {
|
||||
return this.system.getResolve(token)
|
||||
}
|
||||
|
||||
/* WFRP 4E */
|
||||
getResilience(token) {
|
||||
return this.system.getResilience(token)
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditions
|
||||
|
||||
@@ -9,6 +9,11 @@ export class wfrp4e {
|
||||
return token.actor.data.data.status.fate.value
|
||||
}
|
||||
|
||||
getFortune(token) {
|
||||
return token.actor.data.data.status.fortune.value
|
||||
}
|
||||
|
||||
|
||||
getWounds(token) {
|
||||
const wounds = token.actor.data.data.status.wounds
|
||||
return {
|
||||
@@ -18,16 +23,37 @@ export class wfrp4e {
|
||||
|
||||
}
|
||||
|
||||
getCriticalWounds(token) {
|
||||
const criticalWounds = token.actor.data.data.status.criticalWounds
|
||||
return {
|
||||
value: criticalWounds.value,
|
||||
max: criticalWounds.max
|
||||
}
|
||||
}
|
||||
|
||||
getCorruption(token) {
|
||||
return token.actor.data.data.status.corruption.value
|
||||
}
|
||||
|
||||
getAdvantage(token) {
|
||||
return token.actor.data.data.status.advantage.value
|
||||
}
|
||||
|
||||
getResolve(token) {
|
||||
return token.actor.data.data.status.resolve.value
|
||||
}
|
||||
|
||||
getResilience(token) {
|
||||
return token.actor.data.data.status.resilience.value
|
||||
}
|
||||
|
||||
getAbility(token, abilityName) {
|
||||
return this.getCharacteristics(token, abilityName);
|
||||
}
|
||||
|
||||
getCharacteristics(token, characteristicName) {
|
||||
console.log("getCharacteristics(", token, ", ", characteristicName); // TODO: feature-wfrp4 remove
|
||||
if (characteristicName == undefined ) characteristicName = `AG`;
|
||||
const characteristic = token.actor.data.data.characteristics[characteristicName.toLowerCase()]
|
||||
console.log(characteristic);
|
||||
const val = characteristic.value;
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
@@ -35,10 +61,17 @@ export class wfrp4e {
|
||||
getFeatures(token,featureType) {
|
||||
if (featureType == undefined) featureType = 'any';
|
||||
const allItems = token.actor.items;
|
||||
console.log(allItems);
|
||||
if (featureType == 'any') return allItems.filter(i => i.type == 'skill' || i.type == 'talent' || i.type == "career" || i.type == 'trait');
|
||||
return allItems.filter(i => i.type == featureType);
|
||||
}
|
||||
getSpells(token,spellType) {
|
||||
const allItems = token.actor.items;
|
||||
return allItems.filter(i => i.type == 'spell')
|
||||
}
|
||||
|
||||
getSpellUses(token,level,item) {
|
||||
return;
|
||||
}
|
||||
|
||||
getFeatureUses(item) {
|
||||
return {available: `+${item.data.data.total.value}`};
|
||||
@@ -52,61 +85,10 @@ export class wfrp4e {
|
||||
return game.wfrp4e.utility.rollItemMacro(item.name, item.type, false);
|
||||
}
|
||||
|
||||
getTempHP(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getAC(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getShieldHP(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getSpeed(token) {
|
||||
return token.actor.data.data.details.move.value;
|
||||
}
|
||||
|
||||
getInitiative(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
toggleInitiative(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getPassivePerception(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getPassiveInvestigation(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getAbilityModifier(token, ability) {
|
||||
return;
|
||||
}
|
||||
|
||||
getAbilitySave(token, ability) {
|
||||
return;
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
return;
|
||||
}
|
||||
|
||||
getProficiency(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getConditionIcon(condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
getConditionActive(token,condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
async toggleCondition(token,condition) {
|
||||
if (condition == undefined) condition = 'removeAll';
|
||||
@@ -121,34 +103,13 @@ export class wfrp4e {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll
|
||||
*/
|
||||
roll(token,roll,options,ability,skill,save) {
|
||||
console.log("roll(", token, roll, options, ability, skill, save, ")");
|
||||
// if (roll == undefined) roll = 'ability';
|
||||
roll(token,roll,options,ability,skill,save) {
|
||||
//console.log("roll(", token, roll, options, ability, skill, save, ")");
|
||||
if (ability == undefined) ability = 'ag';
|
||||
// if (skill == undefined) skill = 'acr';
|
||||
// if (save == undefined) save = 'str';
|
||||
|
||||
// if (roll == 'ability') token.actor.rollAbilityTest(ability,options);
|
||||
// else if (roll == 'save') token.actor.rollAbilitySave(save,options);
|
||||
// else if (roll == 'skill') token.actor.rollSkill(skill,options);
|
||||
// else if (roll == 'initiative') token.actor.rollInitiative(options);
|
||||
// else if (roll == 'deathSave') token.actor.rollDeathSave(options);
|
||||
return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items
|
||||
|
||||
getItems(token,itemType) {
|
||||
|
||||
if (itemType == undefined) itemType = 'any';
|
||||
const allItems = token.actor.items;
|
||||
console.log("allitems: "+ allItems);
|
||||
if (itemType == 'any') return allItems.filter(i => i.type == itemType);
|
||||
} */
|
||||
|
||||
getItems(token,itemType) {
|
||||
if (itemType == undefined) itemType = 'any';
|
||||
@@ -173,14 +134,39 @@ export class wfrp4e {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
getSpells(token,level) {
|
||||
|
||||
/* this is all cargo-culted in and some of it could be deleted once the interface is resolved
|
||||
to not be the superset of all possible systems
|
||||
*/
|
||||
|
||||
getAC(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getSpellUses(token,level,item) {
|
||||
getShieldHP(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
getInitiative(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
toggleInitiative(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
getConditionIcon(condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
getConditionActive(token,condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
getTempHP(token) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
19
src/token.js
19
src/token.js
@@ -105,6 +105,18 @@ export class TokenControl{
|
||||
heart: "#FF0000"
|
||||
};
|
||||
|
||||
}
|
||||
if (stats == 'CriticalWounds') { /* WFRP4e */
|
||||
const criticalWounds = tokenHelper.getCriticalWounds(token);
|
||||
txt += criticalWounds.value + "/" + criticalWounds.max;
|
||||
|
||||
if (icon == 'stats')
|
||||
uses = {
|
||||
available: criticalWounds.value,
|
||||
maximum: criticalWounds.max,
|
||||
heart: "#FF0000"
|
||||
};
|
||||
|
||||
}
|
||||
else if (stats == 'HPbox') {
|
||||
const hp = tokenHelper.getHP(token);
|
||||
@@ -135,7 +147,12 @@ 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)
|
||||
else if (stats == 'Fate') txt += tokenHelper.getFate(token) /* WFRP4e */
|
||||
else if (stats == 'Fortune') txt += tokenHelper.getFortune(token) /* WFRP4e */
|
||||
else if (stats == 'Corruption') txt += tokenHelper.getCorruption(token) /* WFRP4e */
|
||||
else if (stats == 'Advantage') txt += tokenHelper.getAdvantage(token) /* WFRP4e */
|
||||
else if (stats == 'Resolve') txt += tokenHelper.getResolve(token) /* WFRP4e */
|
||||
else if (stats == 'Resilience') txt += tokenHelper.getResilience(token) /* WFRP4e */
|
||||
|
||||
|
||||
if (settings.onClick == 'visibility') { //toggle visibility
|
||||
|
||||
Reference in New Issue
Block a user