Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_item_card_from_id doesn't support consumables #598

Closed
mrcomac opened this issue Jun 21, 2023 · 8 comments
Closed

create_item_card_from_id doesn't support consumables #598

mrcomac opened this issue Jun 21, 2023 · 8 comments

Comments

@mrcomac
Copy link
Contributor

mrcomac commented Jun 21, 2023

I'm calling the function create_attribute_card_from_id using as arguments:

  • token.id
  • actor.id
  • "vigor"

better rolls version is 3.30

The card in the chat is correct however the console shows an error.

the error from console is

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'name')
    at create_skill_card (skill_card.js:44:30)
    at Object.create_skill_card_from_id (skill_card.js:74:12)
    at br2_rollhandler (roll-handlers.js:73:29)

function definition

/**
 * Creates an attribute card from a token or actor id
 *
 * @param {string} token_id A token id, if it can be solved it will be used
 *  before actor
 * @param {string} actor_id An actor id, it could be set as fallback or
 *  if you keep token empty as the only way to find the actor
 * @param {string} name: Name of the attribute to roll, like 'vigor'
 * @return {Promise} a promise fot the ChatMessage object
 */
function create_attribute_card_from_id(token_id, actor_id, name){
    console.log("NAME", name);
        const actor = get_actor_from_ids(token_id, actor_id);
    return create_attribute_card(actor, name,
        game.settings.get('betterrolls-swade2', 'collapse-modifiers'));
}

@mrcomac
Copy link
Contributor Author

mrcomac commented Jun 21, 2023

also create_item_card_from_id is not working for consumable items

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'additional')
at create_item_card (item_card.js:71:48)
at Object.create_item_card_from_id (item_card.js:130:12)

@javierriveracastro
Copy link
Owner

javierriveracastro commented Jun 22, 2023

Please, post each issue as it's own issue.

Now, first issue, are you sure that you are calling create_attribute_card_from_id, the error is happening in create_skill_card_from_id that expects an skill not a string.

The second one is probably a bug, I need to take a look at how consumables work.

@mrcomac
Copy link
Contributor Author

mrcomac commented Jun 23, 2023

Sorry @javierriveracastro ,

I'm editing this to reflect only the issue with the consumable items.

@mrcomac mrcomac changed the title create_attribute_card_from_id displays the attribute card on the chat but shows an error in console create_item_card_from_id doesn't support consumables Jun 23, 2023
@javierriveracastro
Copy link
Owner

I'm not sure about what to do with consumables. I have asked on Discord for feedback. Right now I think that showing the system card is probably the best option, but I'm not sure. Maybe someone wants to run macros or add actions to consumables as system support seems quite barebone.

@valdier1
Copy link

I think it would be nice for consumables in the sense of a fantasy setting, like "Potion of Giant Strength" that allows you to gain a bonus to a die type for x rounds. Something akin to that?

@grendel111111
Copy link

I think it would be nice for consumables in the sense of a fantasy setting, like "Potion of Giant Strength" that allows you to gain a bonus to a die type for x rounds. Something akin to that?

If there are no dice rolls in taking the potion then I'm not sure if it needs to [or even can] go through BR2.

@mrcomac
Copy link
Contributor Author

mrcomac commented Jun 27, 2023

I'll suggest a card with a button to consume the item. The issue that I have is when I click on the consumable the card shows a roll button. I would like to have the card with the description of the item and the consume button.

@javierriveracastro
Copy link
Owner

At the end consumables show the system card. It has the description (collapsed) and a use and reload button.

It is an inconsistency (like running and some other cards), but it is also very resilient to changes in core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants