Coder Social home page Coder Social logo

Comments (6)

akrigline avatar akrigline commented on July 17, 2024

I suspect this is "intentional" in that the core roller's flow isn't conducive to how I'm merging the cards together.

I use the timestamp to determine if chat cards relate to each other, for lack of a better mechanism. This works pretty well with MRE and fast-forwarded rolls, as well as for several of my modules that add chat cards in response to item usage hooks (from more-hooks).

I'm not interested in adding any data to the cards created, nor maintaining any state in this modules' code, so the options are fairly limited for that collapse mechanism.

But I'm definitely interested in any ideas for how to remedy this shortcoming.

from foundryvtt-compact-roll-card-5e.

kaelad02 avatar kaelad02 commented on July 17, 2024

That must be what this check is for then?

if (chatMessage.data.timestamp - previousChatMessage.data.timestamp > 300) {
  return;
}

Too bad it only works for fast-forwarded rolls then. Kind of limits the audience. Bummer

from foundryvtt-compact-roll-card-5e.

akrigline avatar akrigline commented on July 17, 2024

True, but I'm not overly concerned about a limited audience :)

This whole module is unlisted still.

from foundryvtt-compact-roll-card-5e.

kaelad02 avatar kaelad02 commented on July 17, 2024

The rolls are adding a flag to the chat message that contains the item ID: flags.dnd5e.roll.itemId. The catch is, as far as I can tell, the original item chat card does not put the item ID in the chat message's data. It's there in the HTML (e.g. the data-item-id="yAKKtMnSmrFDMCQz" attribute on the main div) but not somewhere like a flag on the actual ChatMessageData.

Was thinking you could use that to detect instead of time proximity, but I'm not sure how to get the data-item-id from the previousChatMessage.

from foundryvtt-compact-roll-card-5e.

krbz999 avatar krbz999 commented on July 17, 2024

Reading the string position of "data-item-id" will do it. Same way Warp Gate's warpgate.dnd5e.rollItem() gets the spell level of a casting, for reference.

from foundryvtt-compact-roll-card-5e.

akrigline avatar akrigline commented on July 17, 2024

That's an interesting idea.

I don't love the idea that two longsword usages back to back will collapse upwards though.

Could add in something to check that it's the main item card, and if so never collapse those up.

from foundryvtt-compact-roll-card-5e.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.