#Steps are:

1 messages ยท Page 1 of 1 (latest)

fallen glacier
#

thanks, I reproduced and fixed. please test again ๐Ÿ™‚

heavy meteor
#

ok standby

#

did you push it to main?

#

it still shows 47min ago

#

Ok just went as i was watching

fallen glacier
#

oops, forgot to click OK to accept the override. done now

heavy meteor
#

alright! Looks like its doing the opposite a little now lol. It very briefly jumps up to add the purchased amount to the adjustment then goes to the coreect value.
In this example
start at 100 purchase brawn for 20 gives 80
Add 20 xp breifly goes to 120 then back to the correct value of 100

fallen glacier
#

yes, that is expected

#

not amazing, but expected

plush maple
#

if you want, you can see how i did it.

adjustment to the actor-sheet-ffg.js _spendXp function -

    const spentId = foundry.utils.randomID();
    const effects = {
      name: `purchased-${spentId}`,
      changes: [
        {
          key: boughtPath,
          mode: CONST.ACTIVE_EFFECT_MODES.ADD,
          value: boughtValue,
        }
      ],
    };

    // Brawn increases Soak
    if (boughtPath === "system.characteristics.Brawn.value") {
      effects.changes.push({
        key: "system.stats.soak.value",
        mode: CONST.ACTIVE_EFFECT_MODES.ADD,
        value: 1,
      });
    }
    await this.object.createEmbeddedDocuments("ActiveEffect", [effects]);
    return spentId;
  }

_refundPurchase change

    CONFIG.logger.debug(`refunding ${mode} for ${purchaseId}`);
    const purchasedEffect = this.object.getEmbeddedCollection("ActiveEffect").find(ae => ae.name.includes(purchaseId));
    if (purchasedEffect) {
      const dialog = new Dialog(
        {
          title: game.i18n.localize("SWFFG.Actors.Sheets.Refund.DialogTitle"),
          content: game.i18n.localize("SWFFG.Actors.Sheets.Refund.Text"),
          buttons: {
            done: {
              icon: '<i class="fa-solid fa-check"></i>',
              label: game.i18n.localize("SWFFG.Actors.Sheets.Refund.Confirm"),
              callback: async (that) => {
                await this.object.deleteEmbeddedDocuments("ActiveEffect", [purchasedEffect.id]);
                CONFIG.logger.debug("deleted AE, updating log");
                let logEntries = this.object.getFlag("starwarsffg", "xpLog") || [];
                let cost = 0;
                let description = 'unknown';
                for (const entry of logEntries) {
                  if (entry.id === purchaseId) {
                    cost = entry.xp.cost;
                    description = entry.description;
                    entry.id = undefined;  // denotes that there is no an AE for the purchase
                    let totalAvailable = this.object.system.experience.available + cost;
                    this.object.update({'system.experience.available': totalAvailable});
                  }
                }
                
                const date = new Date().toISOString().slice(0, 10);
                logEntries.unshift({
                  action: 'refunded',
                  id: undefined,
                  xp: {
                    cost: cost,
                    available: this.object.system.experience.available,
                    total: this.object.system.experience.total,
                  },
                  date: date,
                  description: description,
                });
                await this.object.setFlag("starwarsffg", "xpLog", logEntries);
                CONFIG.logger.debug(`completed refund for ${purchaseId}!`);
              },
            },
            cancel: {
              icon: '<i class="fas fa-cancel"></i>',
              label: game.i18n.localize("SWFFG.Actors.Sheets.Refund.Cancel"),
            },
          },
        },
        {
          classes: ["dialog", "starwarsffg"],
        }
      ).render(true);
    } else {
      CONFIG.logger.warn(`Could not locate purchase with ID ${purchaseId}`);
    }
  }```
heavy meteor
#

yeah yyikes it uhh it gets very angry when you spend a bunch of xp to the point where it is now adamant this new charater (a rebuild of an existing one) is at -270xp and will not accept any different truth

#

the adjust xp stops working entirely

#

And the total goes blank

#

uploading a video to show

#

closing and reopening the world does not fix it

plush maple
#

hmm...

#

interesting issue... buying skills is free at the moment

#

well, with my fix anyway

#

lol

#

it seems the XP isn't being updated in skills like it is elsewhere

#

fixed that ๐Ÿ˜„

heavy meteor
#

the log shows it as spending xp normally here it just gets very mad once you start spending xp on specialization perks

#

there is also no refund function for those while there is for the rest

plush maple
#

see if it works ok

heavy meteor
#

Somehow its worse yet also better? trying ona new character sheet

#

ok seems less angry.

#

going to recreate the exact proccess that led to the former sheet breaking with a new one

plush maple
#

alright

heavy meteor
#

ok seems to be working as itnended now

#

one other oddity is i need to open the species and change the value for either wounds or strain before the math that calculates wounds and strain from brawn and willpower actually runs

plush maple
#

yeah, it is an odd thing

#

noticed that myself

heavy meteor
#

the physical training talent also seems to not be adding boost dice to rolls as intended but that could be a different issue alltogether i'll investigate that one

plush maple
#

sounds good, yeah i am still working on a clean way to add Skill Force Boost

heavy meteor
#

if you create a new talent and then add that manually it works fine... wait is it due to the ranked setting?

plush maple
#

is it ranked?

heavy meteor
#

yes it is a ranked talent and my fix was not set as ranked but changing that on the fix didn't change it

plush maple
#

hmm

#

sounds like a lingering active effect still being applied

#

try reloading

heavy meteor
#

This specific physical training talent is comign from the clone race let me see if the specialization version works

#

ok yeah if i add the physical training talent through the specializtion then it works as intended but the one on the clone race doesn't

#

i can bypass this easily but its worth checking in on

#

just created a new version of the perk called Clone physical training stuck that on the species and it works like a charm

plush maple
#

must be the auto-generated....

#

makes me curious about the force powers

heavy meteor
#

yeah i think this issue comes from the import dataset. same way how with some items that add roll mods like the Phase I ARC trooper armor which removes 1 setback from perception. If you just add the armor it doesnt remove the setback until you delete and re-add the modifier to the armor

plush maple
#

yep

#

it seems removing the imported data modifier, at least one of them, for Force Influence fixes the issue

#

you can re-add and all works

#

so something with that initial data load is funky

heavy meteor
#

the initial data hasn't changed since 2020 as far as the files say so its possibly how the import is being read

plush maple
#

interesting... the force power needs to be in edit mode to work

heavy meteor
#

weird

fallen glacier
fallen glacier
plush maple
#

i think i found a break through on the skill force dice boost, if you have your force die pool boosted by talents/active effects, system.stats.forcePool.max is 0

#

when applyActiveEffects is called

#

if i manually edit and grant 3 Force Die, it has a value when the function is called, which is why it works on my test character

#

my thought is after that function is called, the actor's force pool is properly set to 3

#

to fix that... is a bit tricky, since technically it gets updated after the function call, but not in time to apply the force boost. because it sees the force boost active effects, but with no stated value and the check to change the value to be equal to the actor's current pool, which is 0, it just defaults to 0 even if a value is specified in the modifier

#

in theory, i guess you could write another for loop to get all the force talents, boost the actor data, then go through again

#

yep... that seems to work, though i keep coming up with an extra bonus

#

somewhere...can't figure out where that 4th active effect is coming from, PC should just have 3

#

well, as long as i subtract 1, works everytime

#

Influence & Enhance now show Force Die Pool when rolled and displayed on sheet

#

this should also work with items that grant Force Boosts too

#

let me try those

#

yep, works good too

#

here is my new function if you want:

    let totalForcePool = 0;
    for (const effect of this.allApplicableEffects()) {
      for (const change of effect.changes) {
        if (change.key.includes("system.stats.force")) {
          totalForcePool += parseInt(change.value);
        }
      }
    }
    
    totalForcePool -= 1;
    totalForcePool -= Math.max(this.system?.stats?.forcePool?.value, 0);
    
    let totalEditedForceValue = Math.max(this.system?.stats?.forcePool?.max, 0);
    totalForcePool += totalEditedForceValue;
    
    for (const effect of this.allApplicableEffects()) {
      for (const change of effect.changes) {
        if (change.key.includes("system.skills") && change.key.includes(".force")) {
          change.value = Math.max(totalForcePool, 0);
        }
      }
    }
    return super.applyActiveEffects();
  }``` it is in the actor-ffg.js file at the bottom
#

now... if you manually edit and grant force dice... it isn't going to work

#

well, it can, if i add it back to the totalForcePool

#

that should allow the editing process to also add the force dice appropriately

#

now to gather the comitted force dice value

#

yep, works beautifully ๐Ÿ˜„

#

since comitted isn't stored in an active effect, it is updated into the system.stats.forcePool, so i can just pull that

#

the only other way i could see this being done, is to call another function after applyActiveEffects() to basically check the force dice pool and adjust the skills appropriately

#

basically re-renders the sheet again, but that is a design decision i think

heavy meteor
plush maple
#

seems like opening the species triggers something

brave moth
# heavy meteor

Sorry if this question was asked before, but how do you get this interface/theme going for SW FFG?

heavy meteor