ammuench / node-artifact-api

A node module wrapper for the Valve official Artifact API
MIT License
9 stars 4 forks source link

many changes plus encoder #3

Closed kirkdotcam closed 5 years ago

ammuench commented 5 years ago

Hey @CamKirk--thank you for the PR! I don't have a ton of time to review it right now, but here are a few things I can supply:


Based off the notes from your prior PR, this following dataset should be useful:

{
    "heroes": [
        {
            "id": 4005,
            "turn": 2
        },
        {
            "id": 10014,
            "turn": 1
        },
        {
            "id": 10017,
            "turn": 3
        },
        {
            "id": 10026,
            "turn": 1
        },
        {
            "id": 10047,
            "turn": 1
        }
    ],
    "cards": [
        {
            "id": 3000,
            "count": 2
        },
        {
            "id": 3001,
            "count": 1
        },
        {
            "id": 10091,
            "count": 3
        },
        {
            "id": 10102,
            "count": 3
        },
        {
            "id": 10128,
            "count": 3
        },
        {
            "id": 10165,
            "count": 3
        },
        {
            "id": 10168,
            "count": 3
        },
        {
            "id": 10169,
            "count": 3
        },
        {
            "id": 10185,
            "count": 3
        },
        {
            "id": 10223,
            "count": 1
        },
        {
            "id": 10234,
            "count": 3
        },
        {
            "id": 10260,
            "count": 1
        },
        {
            "id": 10263,
            "count": 1
        },
        {
            "id": 10322,
            "count": 3
        },
        {
            "id": 10354,
            "count": 3
        }
    ],
    "name": "Green/Black Example"
}

That's the JSON'd version of the data consumed by the PHP encoder--at least from my implementation of it here: http://artifact.alexmuen.ch/deck_decoder.php?id=ADCJWkTZX05uwGDCRV4XQGy3QGLmqUBg4GQJgGLGgO7AaABR3JlZW4vQmxhY2sgRXhhbXBsZQ__ Which should be the same as the sample deck they provided in their announcement here: https://playartifact.com/d/ADCJWkTZX05uwGDCRV4XQGy3QGLmqUBg4GQJgGLGgO7AaABR3JlZW4vQmxhY2sgRXhhbXBsZQ__


Please take a moment and restructure the class with the proper import/export syntax instead of the modules.export syntax. Feel free to look at how I setup cards.ts for some guidelines. Also look into setting some internal variables for the class (again, follow cards.ts for a guideline) instead of setting them. I'm happy to help with some basic typescript stuff as well--just ask questions!

ammuench commented 5 years ago

@CamKirk the php branch has been closed and merged back into master, and there is now a working deck decoder there. To continue this PR please adjust your code for conflicts and resubmit it in a new branch

https://github.com/ammuench/node-artifact-api/blob/master/src/modules/decks.ts