Merge branch 'Master' of https://github.com/CDeenen/MaterialDeck into Master
This commit is contained in:
40
DEVGUIDE.md
Normal file
40
DEVGUIDE.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
# Dev Guide
|
||||||
|
|
||||||
|
In addition to this repo, you will also need to check out the [MaterialDeck_SD github repo](https://github.com/CDeenen/MaterialDeck_SD).
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
## Streamdeck
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|
## Module Deployment
|
||||||
|
If you make changes to files in this project, you'll need to copy the changed files to your Foundry install folder, probably found here: `C:\Users\$USER\AppData\Local\FoundryVTT\Data\modules\MaterialDeck`.
|
||||||
|
|
||||||
|
If you change the `MaterialDeck_SD` code (for example, `propertyinspector\js\common.js`), you will need to copy that file to the Elgato streamdeck plugins directory, probably found here: `C:\Users\$USER\AppData\Roaming\Elgato\StreamDeck\Plugins\com.cdeenen.materialdeck.sdPlugin`.
|
||||||
@@ -57,7 +57,7 @@ let WSconnected = false;
|
|||||||
async function analyzeWSmessage(msg){
|
async function analyzeWSmessage(msg){
|
||||||
if (enableModule == false) return;
|
if (enableModule == false) return;
|
||||||
const data = JSON.parse(msg);
|
const data = JSON.parse(msg);
|
||||||
//console.log("Received",data);
|
// console.log("Received",data);
|
||||||
|
|
||||||
if (data.type == "connected" && data.data == "SD"){
|
if (data.type == "connected" && data.data == "SD"){
|
||||||
const msg = {
|
const msg = {
|
||||||
@@ -390,7 +390,7 @@ Hooks.on('updateToken',(scene,token)=>{
|
|||||||
if (macroControl != undefined) macroControl.updateAll();
|
if (macroControl != undefined) macroControl.updateAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on('updateActor',(scene,actor)=>{
|
Hooks.on('updateActor',(actor)=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
let children = canvas.tokens.children[0].children;
|
let children = canvas.tokens.children[0].children;
|
||||||
for (let i=0; i<children.length; i++){
|
for (let i=0; i<children.length; i++){
|
||||||
|
|||||||
@@ -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>Foundry VTT:</b> Tested on 0.7.9 - 0.8.5<br>
|
||||||
<b>Module Incompatibilities:</b> None known.<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
|
## 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.
|
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.
|
||||||
|
|
||||||
@@ -79,6 +82,7 @@ Special thanks to Asmodeus#7588 who made this module possible by generously dona
|
|||||||
<br>
|
<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.
|
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
|
## 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>
|
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:
|
I consider this module abandoned if all of the below cases apply:
|
||||||
|
|||||||
60
lang/ja.json
60
lang/ja.json
@@ -13,13 +13,13 @@
|
|||||||
"MaterialDeck.Sett.MacroConfig": "マクロ設定",
|
"MaterialDeck.Sett.MacroConfig": "マクロ設定",
|
||||||
"MaterialDeck.Sett.SoundboardConfig": "サウンド設定",
|
"MaterialDeck.Sett.SoundboardConfig": "サウンド設定",
|
||||||
"MaterialDeck.Sett.ServerAddr": "Material Server アドレス",
|
"MaterialDeck.Sett.ServerAddr": "Material Server アドレス",
|
||||||
"MaterialDeck.Sett.ServerAddrHint": "MaterialServerのIPアドレスとポート。デフォルト値は99%の人に有効ですが、何をしているのかがわかっている場合にのみ変更してください。[ip_address]:[port]の形式に従う必要があります。例:「localhost:3001」または「192.168.1.1:4000」。",
|
"MaterialDeck.Sett.ServerAddrHint": "Material ServerのIPアドレスとポート。デフォルト値は99%の人に有効ですが、何をしているのかがわかっている場合にのみ変更してください。[ip_address]:[port]の形式に従う必要があります。例:「localhost:3001」または「192.168.1.1:4000」。",
|
||||||
"MaterialDeck.Sett.ImageBuffer": "画像キャッシュサイズ",
|
"MaterialDeck.Sett.ImageBuffer": "画像キャッシュサイズ",
|
||||||
"MaterialDeck.Sett.ImageBufferHint": "画像キャッシュに保存する画像のデータ量を設定します。画像キャッシュは、ストリームデッキに送信されたすべての画像をローカルに保存します。これにより更新速度は向上しますが、メモリ使用量は増加します。",
|
"MaterialDeck.Sett.ImageBufferHint": "画像キャッシュに保存する画像のデータ量を設定します。画像キャッシュは、ストリームデッキに送信されたすべての画像をローカルに保存します。これにより更新速度は向上しますが、メモリ使用量は増加します。",
|
||||||
"MaterialDeck.Sett.ImageBrightness": "画像の明るさ",
|
"MaterialDeck.Sett.ImageBrightness": "画像の明るさ",
|
||||||
"MaterialDeck.Sett.ImageBrightnessHint": "デフォルトの画像の明るさを設定します。画像キャッシュサイズが0より大きい場合、更新を実行してください。",
|
"MaterialDeck.Sett.ImageBrightnessHint": "デフォルトの画像の明るさを設定します。画像キャッシュサイズが0より大きい場合、更新を実行してください。",
|
||||||
"MaterialDeck.Sett.NrOfConnMessages": "Number of Connection Warnings",
|
"MaterialDeck.Sett.NrOfConnMessages": "接続警告回数",
|
||||||
"MaterialDeck.Sett.NrOfConnMessagesHint": "Sets the number of times a connection warning is displayed if Material Deck cannot connect to Material Server. If set to 0, it will give not be limited.",
|
"MaterialDeck.Sett.NrOfConnMessagesHint": "Material DeckがMaterial Serverに接続できない場合に表示される接続警告回数を設定します。0に設定すると、無制限となります。",
|
||||||
|
|
||||||
"MaterialDeck.PL.Unrestricted": "無制限",
|
"MaterialDeck.PL.Unrestricted": "無制限",
|
||||||
"MaterialDeck.PL.OneTrackPlaylist": "プレイリストごとに1つのトラック",
|
"MaterialDeck.PL.OneTrackPlaylist": "プレイリストごとに1つのトラック",
|
||||||
@@ -49,24 +49,24 @@
|
|||||||
"MaterialDeck.Name": "名前",
|
"MaterialDeck.Name": "名前",
|
||||||
"MaterialDeck.None": "無し",
|
"MaterialDeck.None": "無し",
|
||||||
"MaterialDeck.Save": "セーブ",
|
"MaterialDeck.Save": "セーブ",
|
||||||
"MaterialDeck.ClearAll": "Clear All",
|
"MaterialDeck.ClearAll": "すべて クリア",
|
||||||
"MaterialDeck.ClearAll_Content": "This will clear all the data. This cannot be undone, are you sure you want to proceed?",
|
"MaterialDeck.ClearAll_Content": "すべてのデータがクリアされます。この操作は取り消すことができません、続行しますか?",
|
||||||
"MaterialDeck.ClearPage": "Clear Page",
|
"MaterialDeck.ClearPage": "ページ クリア",
|
||||||
"MaterialDeck.ClearPage_Content": "This will clear all the data on this page. This cannot be undone, are you sure you want to proceed?",
|
"MaterialDeck.ClearPage_Content": "このページのすべてのデータがクリアされます。この操作は取り消すことができません、続行しますか?",
|
||||||
"MaterialDeck.Continue": "Continue",
|
"MaterialDeck.Continue": "継続",
|
||||||
"MaterialDeck.Cancel": "Cancel",
|
"MaterialDeck.Cancel": "キャンセル",
|
||||||
"MaterialDeck.Import": "Import",
|
"MaterialDeck.Import": "インポート",
|
||||||
"MaterialDeck.Export": "Export",
|
"MaterialDeck.Export": "エクスポート",
|
||||||
"MaterialDeck.Filename": "Filename",
|
"MaterialDeck.Filename": "ファイル名",
|
||||||
|
|
||||||
"MaterialDeck.ExportDialog.Title": "Export",
|
"MaterialDeck.ExportDialog.Title": "エクスポート",
|
||||||
"MaterialDeck.ExportDialog.SoundboardContent": "Export the soundboard data. Please note that only the metadata is exported, so you will have to make sure the audio files are in the same relative location when you import them.",
|
"MaterialDeck.ExportDialog.SoundboardContent": "SouseBoardデータをエクスポートします。メタデータのみがエクスポートされるので、インポートするときにオーディオファイルが相対的に同じ場所にあることを確認する必要があります。",
|
||||||
"MaterialDeck.ExportDialog.MacroboardContent": "Export the macro board data. Please note that only the metadata is exported, so you will have to make sure the same macros are available when you import them.",
|
"MaterialDeck.ExportDialog.MacroboardContent": "MacroBoardデータをエクスポートします。メタデータのみがエクスポートされるため、インポートしたときに同じマクロが使用可能であることを確認する必要があります。",
|
||||||
|
|
||||||
"MaterialDeck.ImportDialog.Title": "Import",
|
"MaterialDeck.ImportDialog.Title": "インポート",
|
||||||
"MaterialDeck.ImportDialog.SoundboardContent": "Select a file to import. Please note that only the metadata is imported, so you will have to make sure the audio files are in the same relative location as when you exported them.",
|
"MaterialDeck.ImportDialog.SoundboardContent": "インポートするファイルを選択してください。メタデータのみがインポートされるので、オーディオファイルがそれらをエクスポートしたときと同じ相対的な場所にあることを確認する必要があります。",
|
||||||
"MaterialDeck.ImportDialog.MacroboardContent": "Import the macro board data. ",
|
"MaterialDeck.ImportDialog.MacroboardContent": "MacroBoardデータをインポートします。 ",
|
||||||
"MaterialDeck.ImportDialog.Warning": "This will overwrite your current settings, and cannot be undone.",
|
"MaterialDeck.ImportDialog.Warning": "現在の設定が上書きされ、元に戻すことはできません。",
|
||||||
|
|
||||||
"MaterialDeck.FxMaster.Colorize": "色付け",
|
"MaterialDeck.FxMaster.Colorize": "色付け",
|
||||||
"MaterialDeck.FxMaster.Clear": "すべてクリア",
|
"MaterialDeck.FxMaster.Clear": "すべてクリア",
|
||||||
@@ -190,20 +190,20 @@
|
|||||||
"MaterialDeck.AboutTime.Fourth": "4",
|
"MaterialDeck.AboutTime.Fourth": "4",
|
||||||
"MaterialDeck.AboutTime.Of": "/",
|
"MaterialDeck.AboutTime.Of": "/",
|
||||||
|
|
||||||
"MaterialDeck.DownloadUtility.Title": "Download Utility",
|
"MaterialDeck.DownloadUtility.Title": "ダウンロード・ユーティリティ",
|
||||||
"MaterialDeck.DownloadUtility.Plugin": "Plugin & Material Server",
|
"MaterialDeck.DownloadUtility.Plugin": "プラグイン&Material Server",
|
||||||
"MaterialDeck.DownloadUtility.Minimum": "Minimum",
|
"MaterialDeck.DownloadUtility.Minimum": "最小",
|
||||||
"MaterialDeck.DownloadUtility.Current": "Current",
|
"MaterialDeck.DownloadUtility.Current": "現在",
|
||||||
"MaterialDeck.DownloadUtility.Latest": "Latest",
|
"MaterialDeck.DownloadUtility.Latest": "最新",
|
||||||
"MaterialDeck.DownloadUtility.OS": "OS",
|
"MaterialDeck.DownloadUtility.OS": "OS",
|
||||||
"MaterialDeck.DownloadUtility.Download": "Download",
|
"MaterialDeck.DownloadUtility.Download": "ダウンロード",
|
||||||
"MaterialDeck.DownloadUtility.SDplugin": "SD Plugin",
|
"MaterialDeck.DownloadUtility.SDplugin": "SDプラグイン",
|
||||||
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
||||||
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
||||||
"MaterialDeck.DownloadUtility.Macos": "MacOS",
|
"MaterialDeck.DownloadUtility.Macos": "MacOS",
|
||||||
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
||||||
"MaterialDeck.DownloadUtility.Source": "Source",
|
"MaterialDeck.DownloadUtility.Source": "ソース",
|
||||||
"MaterialDeck.DownloadUtility.Profiles": "Profiles",
|
"MaterialDeck.DownloadUtility.Profiles": "プロファイル",
|
||||||
"MaterialDeck.DownloadUtility.Name": "Name",
|
"MaterialDeck.DownloadUtility.Name": "名前",
|
||||||
"MaterialDeck.DownloadUtility.Refresh": "Refresh"
|
"MaterialDeck.DownloadUtility.Refresh": "更新"
|
||||||
}
|
}
|
||||||
@@ -130,4 +130,8 @@ export class demonlord{
|
|||||||
getSpellUses(token,level,item) {
|
getSpellUses(token,level,item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rollItem(item) {
|
||||||
|
return item.roll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -195,4 +195,8 @@ export class dnd35e{
|
|||||||
maximum: item.maxCharges
|
maximum: item.maxCharges
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rollItem(item) {
|
||||||
|
return item.roll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -198,4 +198,8 @@ export class dnd5e{
|
|||||||
maximum: token.actor.data.data.spells?.[`spell${level}`].max
|
maximum: token.actor.data.data.spells?.[`spell${level}`].max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rollItem(item) {
|
||||||
|
return item.roll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -192,4 +192,8 @@ export class pf2e{
|
|||||||
maximum: spellbook.data.data.slots?.[`slot${level}`].max
|
maximum: spellbook.data.data.slots?.[`slot${level}`].max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rollItem(item) {
|
||||||
|
return item.roll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ import {dnd5e} from "./dnd5e.js"
|
|||||||
import {dnd35e} from "./dnd35e.js"
|
import {dnd35e} from "./dnd35e.js"
|
||||||
import {pf2e} from "./pf2e.js"
|
import {pf2e} from "./pf2e.js"
|
||||||
import {demonlord} from "./demonlord.js";
|
import {demonlord} from "./demonlord.js";
|
||||||
|
import {wfrp4e} from "./wfrp4e.js"
|
||||||
import {compatibleCore} from "../misc.js";
|
import {compatibleCore} from "../misc.js";
|
||||||
|
|
||||||
export class TokenHelper{
|
export class TokenHelper{
|
||||||
@@ -14,6 +15,7 @@ export class TokenHelper{
|
|||||||
if (game.system.id == 'D35E' || game.system.id == 'pf1') this.system = new dnd35e();
|
if (game.system.id == 'D35E' || game.system.id == 'pf1') this.system = new dnd35e();
|
||||||
else if (game.system.id == 'pf2e') this.system = new pf2e();
|
else if (game.system.id == 'pf2e') this.system = new pf2e();
|
||||||
else if (game.system.id == 'demonlord') this.system = new demonlord();
|
else if (game.system.id == 'demonlord') this.system = new demonlord();
|
||||||
|
else if (game.system.id == 'wfrp4e') this.system = new wfrp4e();
|
||||||
else this.system = new dnd5e(); //default to dnd5e
|
else this.system = new dnd5e(); //default to dnd5e
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +186,41 @@ export class TokenHelper{
|
|||||||
return this.system.getProficiency(token);
|
return this.system.getProficiency(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* WFRP 4E */
|
||||||
|
getFate(token) {
|
||||||
|
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
|
* Conditions
|
||||||
*/
|
*/
|
||||||
@@ -238,4 +275,8 @@ export class TokenHelper{
|
|||||||
getSpellUses(token,level,item) {
|
getSpellUses(token,level,item) {
|
||||||
return this.system.getSpellUses(token,level,item);
|
return this.system.getSpellUses(token,level,item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rollItem(item) {
|
||||||
|
return this.system.rollItem(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
172
src/systems/wfrp4e.js
Normal file
172
src/systems/wfrp4e.js
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
import {compatibleCore} from "../misc.js";
|
||||||
|
|
||||||
|
export class wfrp4e {
|
||||||
|
constructor(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getFate(token) {
|
||||||
|
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 {
|
||||||
|
value: wounds.value,
|
||||||
|
max: wounds.max
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
if (characteristicName == undefined ) characteristicName = `AG`;
|
||||||
|
const characteristic = token.actor.data.data.characteristics[characteristicName.toLowerCase()]
|
||||||
|
const val = characteristic.value;
|
||||||
|
return (val >= 0) ? `+${val}` : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
getFeatures(token,featureType) {
|
||||||
|
if (featureType == undefined) featureType = 'any';
|
||||||
|
const allItems = token.actor.items;
|
||||||
|
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}`};
|
||||||
|
}
|
||||||
|
|
||||||
|
getHP(token) {
|
||||||
|
return this.getWounds(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
rollItem(item) {
|
||||||
|
return game.wfrp4e.utility.rollItemMacro(item.name, item.type, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
getSpeed(token) {
|
||||||
|
return token.actor.data.data.details.move.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async toggleCondition(token,condition) {
|
||||||
|
if (condition == undefined) condition = 'removeAll';
|
||||||
|
if (condition == 'removeAll'){
|
||||||
|
for( let effect of token.actor.effects)
|
||||||
|
await effect.delete();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const effect = CONFIG.statusEffects.find(e => e.id === condition);
|
||||||
|
await token.toggleEffect(effect);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
roll(token,roll,options,ability,skill,save) {
|
||||||
|
//console.log("roll(", token, roll, options, ability, skill, save, ")");
|
||||||
|
if (ability == undefined) ability = 'ag';
|
||||||
|
return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
getItems(token,itemType) {
|
||||||
|
if (itemType == undefined) itemType = 'any';
|
||||||
|
const allItems = token.actor.items;
|
||||||
|
if (itemType == 'any') return allItems.filter(i => i.type == 'weapon' ||
|
||||||
|
i.type == 'ammunition' ||
|
||||||
|
i.type == 'armour' ||
|
||||||
|
i.type == 'trapping');
|
||||||
|
else {
|
||||||
|
return allItems.filter(i => i.type == itemType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getItemUses(item) {
|
||||||
|
console.log("getItemUses(" , item , ")")
|
||||||
|
if ( item.type == 'ammunition') {
|
||||||
|
return {available: item.data.data.quantity.value};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
getShieldHP(token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getInitiative(token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleInitiative(token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getConditionIcon(condition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getConditionActive(token,condition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTempHP(token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
25
src/token.js
25
src/token.js
@@ -94,7 +94,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats == 'HP') {
|
if (stats == 'HP' || stats == 'Wounds') {
|
||||||
const hp = tokenHelper.getHP(token);
|
const hp = tokenHelper.getHP(token);
|
||||||
txt += hp.value + "/" + hp.max;
|
txt += hp.value + "/" + hp.max;
|
||||||
|
|
||||||
@@ -105,6 +105,18 @@ export class TokenControl{
|
|||||||
heart: "#FF0000"
|
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') {
|
else if (stats == 'HPbox') {
|
||||||
const hp = tokenHelper.getHP(token);
|
const hp = tokenHelper.getHP(token);
|
||||||
@@ -135,6 +147,13 @@ export class TokenControl{
|
|||||||
else if (stats == 'Save') txt += tokenHelper.getAbilitySave(token, settings.save);
|
else if (stats == 'Save') txt += tokenHelper.getAbilitySave(token, settings.save);
|
||||||
else if (stats == 'Skill') txt += tokenHelper.getSkill(token, settings.skill);
|
else if (stats == 'Skill') txt += tokenHelper.getSkill(token, settings.skill);
|
||||||
else if (stats == 'Prof') txt += tokenHelper.getProficiency(token);
|
else if (stats == 'Prof') txt += tokenHelper.getProficiency(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
|
if (settings.onClick == 'visibility') { //toggle visibility
|
||||||
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) {
|
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) {
|
||||||
@@ -739,7 +758,9 @@ export class TokenControl{
|
|||||||
items = this.sortItems(items);
|
items = this.sortItems(items);
|
||||||
|
|
||||||
const item = items[itemNr];
|
const item = items[itemNr];
|
||||||
if (item != undefined) item.roll();
|
if (item != undefined) {
|
||||||
|
tokenHelper.rollItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user