Skip to content

Commit

Permalink
Fixed error where actors with only Free actions also received a None …
Browse files Browse the repository at this point in the history
…action
  • Loading branch information
WBHarry committed Aug 27, 2024
1 parent 4eebfd4 commit e88893b
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
28 changes: 26 additions & 2 deletions BestiaryTracking.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "pf2e-bestiary-tracking",
"title": "PF2E Bestiary Tracking",
"description": "A module to track known information about enemies for players in a bestiary.",
"version": "0.8.9.9.5",
"version": "0.8.9.9.6",
"authors": [
{
"name": "HarryBoy"
Expand Down
2 changes: 1 addition & 1 deletion module/bestiary.js
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ export default class PF2EBestiary extends HandlebarsApplicationMixin(Application
if(item.type === 'action'){
item.system.traits.value = item.system.traits.value.map(trait => ({ revealed: false, value: trait }));

if(item.system.actionType.value === 'action' || item.system.actionType.value === 'reaction') hasActions = true;
if(item.system.actionType.value !== 'passive') hasActions = true;
if(item.system.actionType.value === 'passive') hasPassives = true;
}
}
Expand Down
24 changes: 24 additions & 0 deletions scripts/migrationHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ export const handleDataMigration = async () => {
await game.settings.set('pf2e-bestiary-tracking', 'version', version);
}

if(version === '0.8.9.8.2'){
version = '0.8.9.9.6';

await game.settings.set('pf2e-bestiary-tracking', 'version', version);
}

const updatedBestiary = await handleBestiaryMigration(game.settings.get('pf2e-bestiary-tracking', 'bestiary-tracking'));
await game.settings.set('pf2e-bestiary-tracking', 'bestiary-tracking', updatedBestiary);
}
Expand Down Expand Up @@ -771,6 +777,24 @@ export const handleBestiaryMigration = async (bestiary) => {
bestiary.metadata.version = '0.8.9.9';
}

if(bestiary.metadata.version === '0.8.9.9'){
bestiary = await newMigrateBestiary(async (_, monster) => {
const itemKeys = Object.keys(monster.items);
const actionKeys = itemKeys.filter(key => monster.items[key].type === 'action' && monster.items[key].system.actionType.value !== 'passive');
if(actionKeys.length > 1 && actionKeys.find(key => monster.items[key]._id === 'Action-None')){
monster.items = itemKeys.reduce((acc, key) => {
if(monster.items[key]._id !== 'Action-None'){
acc[key] = monster.items[key];
}

return acc;
}, {});
}
}, bestiary);

bestiary.metadata.version = '0.8.9.9.6';
}

return bestiary;
};

Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import BestiaryLabelsMenu from "../module/bestiaryLabelsMenu.js";
import VagueDescriptionsMenu from "../module/vagueDescriptionsMenu.js";
import { newMigrateBestiary } from "./migrationHandler.js";

export const currentVersion = '0.8.9.9.5';
export const currentVersion = '0.8.9.9.6';
export const bestiaryFolder = "pf2e-bestiary-tracking-folder";
export const bestiaryJournalEntry = "pf2e-bestiary-tracking-journal-entry";

Expand Down

0 comments on commit e88893b

Please sign in to comment.