-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Include die type (ie: d20) in the RollResult json output #242
Comments
Yeah, this is actually what I was trying to get at by asking this question (#241). This would be super useful! |
Thanks @erik-jenkins! I'll check out your pull request and see if I can leverage that as well if that's alright with you :) I agree, I would love to see both of what we're asking for implemented in the source itself. Good luck with whatever you're working on! |
Just thinking about this, and I'm not sure how feasible it would be, but would it make sense to store the actual Dice object against the Result object, rather than just a string side? |
I just put up PR #252 to try that out, it seems to work pretty well! The one thing I haven't tried yet is to see how serialization of the |
I just started using this library and it's great, but one of the first things I tried to do was get the number of sides for a given die being rolled. I was surprised to find that to be not an easy thing to do. Coming here, I see this open issue, which seems to be exactly what I was looking for, but then see that it's been in limbo for almost a year. Are there any plans to get the pull request pushed through? Alternatively, what's the recommended way of getting the type of die/dice being rolled from a DiceRoll result? |
Bumping this - I wanted to use it with a deterministic 3d dice roller, which requires knowing both the results and the die types |
I'm trying to build a UI for the dice output that shows the matching die image (ie: d4, d20, ect) that corresponds to the die roll. However, the RollResult class structure / output doesn't contain that information, just the results after the roll calculation.
I would love an additional property added to the RollResult class that shows the die type used to generate that roll result. ie:
"rolls": [{
"sides": d20, // or even just 20 <-----
"calculationValue": 4,
"initialValue": 4,
"modifierFlags": "",
"modifiers": [],
"type": "result",
"useInTotal": true,
"value": 4
// ... ect
}]
I've tried trying to customize the RollResult class to capture this, but I am having a hard time... Honestly, TypeScript is well out of my wheelhouse... If anyone has a suggestion so I can implement this on my own, I am all ears!
Thanks in advance. Please let me know if you need more info from me :)
The text was updated successfully, but these errors were encountered: