cstby / foundryvtt-world-currency-5e

This FoundryVTT module allows you to use your world's homebrew currencies in D&D 5th Edition.
GNU General Public License v3.0
1 stars 9 forks source link

Compatability with older Tidy Sheets versions #32

Open KyaWither opened 7 months ago

KyaWither commented 7 months ago

Hey, so I opening this new issue as requested.

So for as much context as possible, I am running my Foundry game on v11 Patch 13 Build 315 and using the system D&D 5e v2.4.1 60

I tried testing as many version combinations as possible between Tidy Sheets and World Currency to see if maybe there was some combo that worked. Unfortunately, I couldn't find anything.

The latest Tidy Sheets version that I can use is 1.4.0 because 2.0.0 and above is set for 5e v3.0. I can technically use World Currency up to any version since I don't think it breaks anything on any version of 5e. So lets assume I'm using the latest World Currency and Tidy Sheets v1.4.0

Thank you all again for trying to help figure this out for those of trying to stay back frorm v3.0 for now <3

KyaWither commented 7 months ago

@cstby I hope this is what you wanted me to do! And sorry for saying lets assume. Let me correct that by saying I am using the latest World Currency 5e version and Tidy Sheets 5e v1.4.0

cstby commented 7 months ago

Thanks for opening a new issue and providing all this information. Heads up, I might not be able to look into this for a few days. In the mean time, can you provide the steps to reproduce the bug?

This info should be enough:

Our first step to solving the problem is reproducing the same bug on our local setup, so we'll want to make sure we are following the same steps that you are.

KyaWither commented 7 months ago

In my Configure Game Settings for World Currency, there is only two things that are checked off: Hide Electrum and Remove Currency Converter from Character Sheets. All the, 'How many BLANK in Raw GP?' are empty. Everything else is just the default.

When I mess with the names of the currency or their abbreviation, Tidy shows the changes perfectly fine. The 'hide' setting is the main thing I'm trying to get to work. Checking that on and off does nothing. When checking the default sheets, the 'hide' setting does work. It just isn't reflected on Tidy 5e Sheets.

Let me know anything else you need. Thanks

kmuld commented 7 months ago

This is probably caused by Svelte being compiled. An earlier PR I put in fixed this for the current version of Tidy, but it will break again if any other version of Tidy is used.

kgar commented 7 months ago

One idea: I could create a hook with a convenient data structure for making adjustments to the data to be rendered. A Tidy-only hook would be a safe, out-of-the-way approach to controlling what gets rendered on Tidy sheets. I could release such a thing to Tidy V1 (dnd5e 2.4.x) and V2 (dnd5e 3.0.x) tracks. Deciding on an appropriate data structure is the tricky part, since it needs to be generally usable for a long time.

KyaWither commented 6 months ago

Let me know if you need anything else from me or if you have any updates! thanks again

kgar commented 6 months ago

@KyaWither and anyone else who is having Tidy sheet issues with this module, while we await next steps, I made a quick World Script to try to help get you by for now.

If you are comfortable with setting up a world script (whether with your world.json or in a module like World Scripter), here is the script:

Hooks.on("tidy5e-sheet.renderActorSheet", (app, element, data) => {
  let denominations = {
    cpAltRemove: "cp",
    spAltRemove: "sp",
    epAltRemove: "ep",
    gpAltRemove: "gp",
    ppAltRemove: "pp",
  };

  for (let [setting, denomination] of Object.entries(denominations)) {
    try {
      const currencyToHide = element.querySelector(
        `.currency .currency-item.${denomination}`
      );
      const display = game.settings.get("world-currency-5e", setting)
        ? "none"
        : "";
      currencyToHide && (currencyToHide.style.display = display);
    } catch (e) {
      console.error(
        `Hiding denomination ${denomination} failed due to an error.`,
        e
      );
    }
  }

  const converter = element.querySelector(".currency .convert");
  const display = game.settings.get("world-currency-5e", "RemoveConverter")
    ? "none"
    : "";
  converter && (converter.style.display = display);
});
KyaWither commented 6 months ago

Hey! I think this script might be messing up my default sheets. I was having an issue where everytime I load into the game or just reload the page, my default sheets setting would reset to default instead of Tidy. I did some messing around with Find The Culprit! and found that even with just Tidy on and Tidy only, that the issue still persisted. (I can't do it without Tidy because I need to see if the setting reset even with Tidy as an option)

If everything is off and the only thing since then that I added was this in the World Script module, I think something here is making it so my default sheets keep resetting and I have to manually click Tidy every session. Let me know if you have an adjusted version of this to stop that or something else that can help. Thank you.

kgar commented 6 months ago

Do any errors show up in the console?