jeandeaual / tts-deckconverter

Generate card decks for Tabletop Simulator.
MIT License
38 stars 5 forks source link

[WIP] plugins/pkm: update api from v1 to v2 #31

Open kyle-discher opened 3 years ago

kyle-discher commented 3 years ago

This is a simple update from v1 -> v2.

Regressions: Text was renamed to Rules, but was not implemented in the go-sdk-v2 PokemonCard object. I commented it out for now, assuming a future implementation in the go-sdk-v2.

Question: The Attack struct was removed in the v2 sdk. On line 64 of plugins/pkm/util_test.go I tried replacing this with struct and with pokemontcgsdk.PokemonCard.Attack. What would be the best way to change this test/access the Attack struct?

jeandeaual commented 2 years ago

@kyle-discher Thanks for the contribution, and sorry I didn't get back earlier!

Regressions: Text was renamed to Rules, but was not implemented in the go-sdk-v2 PokemonCard object. I commented it out for now, assuming a future implementation in the go-sdk-v2.

Ideally we should create an issue or PR upstream to add the feature, but for now that's fine.

Question: The Attack struct was removed in the v2 sdk. On line 64 of plugins/pkm/util_test.go I tried replacing this with struct and with pokemontcgsdk.PokemonCard.Attack. What would be the best way to change this test/access the Attack struct?

It's a bit confusing, but according to https://github.com/PokemonTCG/pokemon-tcg-sdk-go-v2/blob/9293c9ff8ca182e35917089ed59271fafb7fedb5/pkg/card.go#L25, you should be able to do:

Attacks: []struct {
    Name string
    Cost []string
    ConvertedEnergyCost int
    Damage string
    Text string
}{
    {
        Name:  "Test",
        Cost: []string{"Psychic", "Colorless"},
        Damage: "50",
        Text: "Test",
    },
    {
        Name: "Test",
        Cost: []string{"Colorless"},
    },
}
jeandeaual commented 2 years ago

Regarding the Rules field, github.com/jeandeaual/pokemon-tcg-sdk-go-v2 can be used for now instead of github.com/PokemonTCG/pokemon-tcg-sdk-go-v2 until https://github.com/PokemonTCG/pokemon-tcg-sdk-go-v2/pull/1 gets merged.

@kyle-discher Do you still want to work on this? I can finish your implementation if you'd prefer.