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

[4.1] Bug: Actors and Containers - _onDropStackConsumables only stacks Potions of Healing (specifically, Compendium.dnd5e.items.Item.ytlsBjYsZ7OBSEBs) #4685

Closed
kgar opened this issue Nov 10, 2024 · 1 comment
Assignees
Labels
bug Functionality which is not working as intended
Milestone

Comments

@kgar
Copy link
Contributor

kgar commented Nov 10, 2024

On actors and containers, when you drop a consumable item onto the sheet, it no longer stacks, unless it is the item with source UUID "Compendium.dnd5e.items.Item.ytlsBjYsZ7OBSEBs", i.e. a Potion of Healing.

const similarItem = this.actor.sourcedItems.get("Compendium.dnd5e.items.Item.ytlsBjYsZ7OBSEBs", { legacy: false })

The code in question:

  _onDropStackConsumables(itemData, { container=null }={}) {
    const droppedSourceId = itemData._stats?.compendiumSource ?? itemData.flags.core?.sourceId;
    if ( itemData.type !== "consumable" || !droppedSourceId ) return null;
                                                                              // 👇 That's a potion of healing from the SRD
    const similarItem = this.actor.sourcedItems.get("Compendium.dnd5e.items.Item.ytlsBjYsZ7OBSEBs", { legacy: false })
      ?.filter(i => (i.system.container === container) && (i.name === itemData.name))?.first();
    if ( !similarItem ) return null;
    return similarItem.update({
      "system.quantity": similarItem.system.quantity + Math.max(itemData.system.quantity, 1)
    });
  }
@krbz999
Copy link
Contributor

krbz999 commented Nov 10, 2024

4.1.1 will remove system.quantity entirely and introduce the potionOfHealing item type, the only type able to stack.

@arbron arbron self-assigned this Nov 11, 2024
@arbron arbron added the bug Functionality which is not working as intended label Nov 11, 2024
@arbron arbron modified the milestones: D&D5E 4.1.0, D&D5E 4.1.1 Nov 11, 2024
@arbron arbron closed this as completed in 33b0822 Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality which is not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants