mkscho63 / sta

This is an unofficial system for Foundry VTT using Modiphius's Star Trek Adventures 2d20 RPG. This system attempts to replicate the feeling of playing through an episode of the epic SciFi that is Star Trek. I am in no way associated with Modiphius.
MIT License
32 stars 33 forks source link

Print item _id strings as data-item-id html attributes when "rolling" items, especially weapons #67

Closed hiddenkrypt closed 1 year ago

hiddenkrypt commented 2 years ago

The Maestro Module allows users to set up sound effects to be played when configured items are rolled. This unfortunately relies on seeing the item's _id value as an html attribute in a chat message under data-item-id. The STA system does not print these values, so we can't have phasers going pew pew when we roll damage dice.

Describe the solution you'd like include data-item-id="<item's id>" as an html attribute in the html generated and sent to chat when rolling an item.

Describe alternatives you've considered Maestro ties it's sounds to specific items, so it really needs some way to know that the item has been activated. STA could implement sound effects itself but that's likely to be a lot more work.

Additional context This can relate to issue #36 , in that it would be easy to implement at the same time. There appears to be some unused code in place in roll.js to implement that feature request that would allow dice rolls to be done through the rollGenericItem() method in actor.js. One method of executing this feature could be to set that up (resolving #36) and make sure to pass the item id values to genericItemTemplate() and set the data-item-id attribute in that template.

Also, I've already done this and it seems to work really well, so once I get things cleaned up a bit I'll be putting in a merge request, and hopefully you like the way I did it.

mkscho63 commented 1 year ago

One question here, what should the data-item-id value be for attribute rolls? Those are related to a characer, so should the be tied to the speaker's id?