pwatson100 / alienrpg

Alien RPG system for Foundry VTT.
GNU General Public License v3.0
38 stars 31 forks source link

DoW/HoD - Story Cards update to Personal Agenda image upon interaction. #204

Closed Stew-rt closed 2 years ago

Stew-rt commented 2 years ago

It's entirely possible this is intentional.

But the Story Card items supplied by this module change their icon to personal-agenda.png upon interacting with them in the new version.

so, either a very minor bug, or me being an idiot.

Stew-rt commented 2 years ago

aha - it looks like you can't update an "agenda" item's image, it always defaults back to personal-agenda.png

Stew-rt commented 2 years ago

So it looks like this happens because in item-sheet.js, the overridden getData() (presumebly this is run every time the item is interacted with) method runs this._prepareAgendaData(item).. which runs this.item.update({ img: 'systems/alienrpg/images/icons/personal-agenda.png'});.

I've toyed around a bit, and using hooks into createItem might be preferred, such as:

Hooks.on("createItem", (itemData) => {
  switch (itemData.type) {
    case 'agenda':
      itemData.update({img: 'systems/alienrpg/images/icons/personal-agenda.png'});
    case 'any other type':
      itemData.update({img: 'systems/alienrpg/images/icons/some-icon.png'});
  }
});

There is another hook called preCreateItem.. but it doesn't like the update method, as the item dousn't yet have an _id

I can probably provide a PR if desired... but wanted to check you didn't hate this first...

Stew-rt commented 2 years ago

.. I've also made images of the backs of the story cards from the pdfs for DoW and HoH.. because i'm a pedant, if they would be accepted into the premium modules, i can provide them..

pwatson100 commented 2 years ago

That is the way it's supposed to work.

Stew-rt commented 2 years ago

Ok, cool. closing this issue then.