Skip to content

Commit

Permalink
add pathfinder compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ardittristan committed Nov 8, 2020
1 parent 9c42da5 commit d77c854
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Patch Notes

## Version 1.1.0

* Add Pathfinder 2e compatibility.

## Version 1.0.14

* Push compatible core version.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Check the [Changelog](https://github.com/ardittristan/VTTExternalActorViewer/blo

If it's not in the current list it probably won't work or there won't be a site for it, feel free to make an extension for it! (read more [here](https://github.com/ardittristan/VTTExternalActorViewer/blob/master/CONTRIBUTING.md))

* dnd5e
* pf2e

***

_Does not work when you connect to foundry via http://localhost or via the electron app._
10 changes: 6 additions & 4 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
"name": "externalactor",
"title": "External Actor Viewer",
"description": "Makes you able to see characters from unloaded worlds.",
"version": "1.0.14",
"version": "1.1.0",
"author": "ardittristan#0001",
"esmodules": [
"actorviewer.js"
],
"scripts": [
"modules/dnd5e.js"
"modules/dnd5e.js",
"modules/pf2e.js"
],
"systems": [
"dnd5e"
"dnd5e",
"pf2e"
],
"styles": [
"css/externalactor.css"
Expand All @@ -28,5 +30,5 @@
"manifest": "https://raw.githubusercontent.com/ardittristan/VTTExternalActorViewer/master/module.json",
"download": "https://github.com/ardittristan/VTTExternalActorViewer/releases/latest/download/actorViewer.zip",
"minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.7.5"
"compatibleCoreVersion": "0.7.6"
}
31 changes: 31 additions & 0 deletions modules/pf2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Hooks.on("init", () => {
if (game.system.id === "pf2e") {
Hooks.on("actorViewerGenerate", () => {
const compatMode = game.settings.get("externalactor", "compatMode");
let actors = {};
game.actors.forEach((actor) => {
if (!compatMode) {
if (game.user.isGM) {
actor.setFlag("externalactor", "hasStamina", game.settings.get("pf2e", "staminaVariant") > 0);
actor.setFlag("externalactor", "ignoreCoinBulk", game.settings.get("pf2e", "ignoreCoinBulk"));
actor.setFlag("externalactor", "ignoreContainerOverflow", game.settings.get("pf2e", "ignoreContainerOverflow"));
actor.setFlag("externalactor", "proficiencyUntrainedModifier", game.settings.get("pf2e", "proficiencyUntrainedModifier"));
actor.setFlag("externalactor", "proficiencyVariant", game.settings.get("pf2e", "proficiencyVariant"));
actor.setFlag("externalactor", "proficiencyTrainedModifier", game.settings.get("pf2e", "proficiencyTrainedModifier"));
actor.setFlag("externalactor", "proficiencyExpertModifier", game.settings.get("pf2e", "proficiencyExpertModifier"));
actor.setFlag("externalactor", "proficiencyMasterModifier", game.settings.get("pf2e", "proficiencyMasterModifier"));
actor.setFlag("externalactor", "proficiencyLegendaryModifier", game.settings.get("pf2e", "proficiencyLegendaryModifier"));
}
}

actors[actor.id] = JSON.parse(JSON.stringify(actor.data));
});

ActorViewer.createActorsFile(actors);

game.settings.set("externalactor", "systemSite", "https://ardittristan.github.io/VTTPF2eExternalActorSite/");

return false;
});
}
});

0 comments on commit d77c854

Please sign in to comment.