zuelong / save-the-spire

A save editor for the game Slay the Spire
16 stars 13 forks source link

Add filter dropdowns for Cards (type/rarity/color/cost) #24

Closed saltyeyes closed 6 years ago

saltyeyes commented 6 years ago

Updated CardsJSON.js with several relevant attributes for each card (took a bit of digging!) which should help to resolve #20 😄 Added four dropdowns under the search box with filters for Type, Rarity, Color and Cost.

saltyeyes commented 6 years ago

Updated the bottled relic modal, should now only show valid cards or a relevant error message

ntower commented 6 years ago

👍

I thought about filtering the bottled relic modal when i added it, but didn't have the metadata to do so. Incidentally, the game doesn't check the types except when you acquire the relic, so even if you pair it with a card of the wrong type, it will happily put that card into your opening hand.

zuelong commented 6 years ago

Awesome! I'm going to go ahead and merge this. I need to update the height of the scrollbox on the right side of the screen so it isnt off the page, but it looks great.

Awesome work with the CardsJSON as well :)

zuelong commented 6 years ago

So after giving this another round of testing ( in production, because i missed it when I tested it before the merge :D ). The filtering logic seems a little off. However, I'm not rolling anything back because it's late here at the moment and the functionality still works somewhat. Worst case scenario is that it isn't used.

Anyway, the problem appears to be with how the number filter works. Instead of comparing ["1"] includes "1" it's checking for [" 1"] includes "1" in the filterCard method. I can probably squeeze a PR in tomorrow if one of you doesnt get to it first.

Again, awesome work and thanks for the feature :)

zuelong commented 6 years ago

I went ahead and creating a quick fix for tonight so filtering works. This isnt ideal as the "cost" multiselect is now out of order, but at least it fixes filtering. You can see the commit here.

zuelong commented 6 years ago

Finally decided on just trimming the object keys on comparison to preserve order: link