-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
List treasure on Character Viewer #166
Conversation
Thank Zotz ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a mismatch between the component fn params and the render fn params. with-let
is probably your best solution
So that's the suggetsed improvements. Must say, I completely missed the |
I would vote for if we can do it like the book sorts it. |
Welp, as I said, I have absolutely no idea how to do that so somebody else would have to 😋 |
Wait, isn't treasure already sorted in a logical order? |
By default it's sorted in the order that it's added to your character. But we've also got the code for alphabetical sorting |
The treasure is stored in equipment.cljc in book order by default, but that doesn't help us sort a character's treasures. (Well, we could fake it by searching on strings and comparing indices, but that's slow and ugly.) Instead, we should just make the order explicit, so it'll be available for sorting with E.g.: (def treasure
[{:key :cp
:name "Copper Pieces (CP)"}
{:key :sp
:name "Silver Pieces (SP)"}
{:key :ep
:name "Electrum Pieces (EP)"}
{:key :gp
:name "Gold Pieces (GP)"}
... becomes (def treasure
[{:key :cp
:name "Copper Pieces (CP)"
:rank 1}
{:key :sp
:name "Silver Pieces (SP)"
:rank 2}
{:key :ep
:name "Electrum Pieces (EP)"
:rank 3}
{:key :gp
:name "Gold Pieces (GP)"
:rank 4}
... and then if we have a sequence of character treasures with the (sort-by :rank some-character-treasure-vector) I think that, or something similar, should work. |
Ahh, that's quite a good solution, actually. I'm working on something else right now but next time I get fed up with that I'll come back to this PR and add the ordering 😋 |
Another alternative is to place the character's treasure into a sorted map/set with |
…work with rank or the custom treasure : [
I'm going to merge this to get the fixes into the branch. I don't think sorting should hold this up. |
Sorry @datdamnzotz, been real busy with life lately. |
@KingMob we've all been pretty quiet. I assumed that was the case all around |
The Character Viewer shows the character's Money and Gems under a Treasure subheading in the Equipment tab