Skip to content

Commit

Permalink
Move Iconizer functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed Sep 13, 2023
1 parent 68e3a06 commit 0f1ecac
Show file tree
Hide file tree
Showing 9 changed files with 479 additions and 472 deletions.
8 changes: 4 additions & 4 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { checkCobalt } from "./lib/Secrets.js";
// import { base64Check } from "./lib/base64Check.js";
import { getFeats } from "./muncher/feats/feats.js";
import { loadMacroFile, generateItemMacroFlag, createMacro, executeDDBMacro, MACROS } from "./effects/macros.js";
import { iconPath, generateIcon } from "./lib/Iconizer.js";
import Iconizer from "./lib/Iconizer.js";
import { loadSRDRules, importCacheLoad } from "./lib/DDBTemplateStrings.js";
import { getNPCImage } from "./muncher/importMonster.js";
import PatreonHelper from "./lib/PatreonHelper.js";
Expand Down Expand Up @@ -143,9 +143,9 @@ export function registerApi() {
updateDDBCharacter,
updateWorldMonsters,

getIconPath: iconPath,
iconPath,
generateIcon,
getIconPath: Iconizer.iconPath,
iconPath: Iconizer.iconPath,
generateIcon: Iconizer.generateIcon,

loadSRDRules,
importCacheLoad,
Expand Down
25 changes: 9 additions & 16 deletions src/apps/DDBCharacterManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@ import {
addMagicItemSpells,
getCompendiumItems,
getSRDCompendiumItems,
copySRDIcons,
getDDBEquipmentIcons,
getDDBSpellSchoolIcons,
getDDBGenericItemIcons,
addItemEffectIcons,
retainExistingIcons,
getIndividualOverrideItems,
preFetchDDBIconImages,
} from "../muncher/import.js";
import { addItemsDAESRD } from "../muncher/dae.js";
import { copyInbuiltIcons } from "../lib/Iconizer.js";
import Iconizer from "../lib/Iconizer.js";
import { updateDDBCharacter } from "../updater/character.js";
import { generateCharacterExtras } from "../parser/DDBExtras.js";
import DICTIONARY from "../dictionary.js";
Expand Down Expand Up @@ -682,7 +675,7 @@ export default class DDBCharacterManager extends FormApplication {
const daeMidiInstalled = game.modules.get("midi-srd")?.active;
const daeInstalled = game.modules.get("dae")?.active;

await preFetchDDBIconImages();
await Iconizer.preFetchDDBIconImages();

// if we still have items to add, add them
if (items.length > 0) {
Expand All @@ -691,27 +684,27 @@ export default class DDBCharacterManager extends FormApplication {

if (ddbItemIcons) {
this.showCurrentTask("Fetching DDB Inventory Images");
items = await getDDBEquipmentIcons(items, true);
items = await Iconizer.getDDBEquipmentIcons(items, true);
}

if (useInbuiltIcons) {
this.showCurrentTask("Adding SRD Icons");
items = await copyInbuiltIcons(items);
items = await Iconizer.copyInbuiltIcons(items);
}

if (useSRDCompendiumIcons && !useSRDCompendiumItems) {
this.showCurrentTask("Adding SRD Icons");
items = await copySRDIcons(items);
items = await Iconizer.copySRDIcons(items);
}

if (ddbSpellIcons) {
this.showCurrentTask("Fetching DDB Spell School Images");
items = await getDDBSpellSchoolIcons(items, true);
items = await Iconizer.getDDBSpellSchoolIcons(items, true);
}

if (ddbGenericItemIcons) {
this.showCurrentTask("Fetching DDB Generic Item Images");
items = await getDDBGenericItemIcons(items, true);
items = await Iconizer.getDDBGenericItemIcons(items, true);
}

if (this.settings.activeEffectCopy) {
Expand All @@ -725,10 +718,10 @@ export default class DDBCharacterManager extends FormApplication {
}

if (daeInstalled && (this.settings.addItemEffects || this.settings.addCharacterEffects)) {
items = await addItemEffectIcons(items);
items = await Iconizer.addItemEffectIcons(items);
}

items = await retainExistingIcons(items);
items = await Iconizer.retainExistingIcons(items);
}

items = items.map((item) => {
Expand Down
Loading

0 comments on commit 0f1ecac

Please sign in to comment.