KnutZuidema / golio

League of Legends, Legends of Runeterra and Valorant API client library for Go
MIT License
72 stars 29 forks source link

add statPerk0~2 field from ParticipantStats model #36

Closed ironpark closed 4 years ago

ironpark commented 4 years ago

statPerk0,statPerk1,statPerk2

statPerk0,statPerk1,statPerk2 dose not define "ParticipantStatsDto" from api document getMatch API

However, the response results include statPerk0, statPerk1, and statPerk2, which are necessary to record the total rune information for each player.

API response example (participants part)

    {
            "participantId": 3,
            "teamId": 100,
            "championId": 240,
            "spell1Id": 12,
            "spell2Id": 4,
            "stats": {
                "participantId": 3,
                "win": false,
                "item0": 3077,
                "item1": 2033,
                "item2": 3044,
                "item3": 1055,
                "item4": 3047,
                "item5": 3067,
                "item6": 3340,
                "kills": 0,
                "deaths": 7,
                "assists": 6,
                "largestKillingSpree": 0,
                "largestMultiKill": 0,
                "killingSprees": 0,
                "longestTimeSpentLiving": 279,
                "doubleKills": 0,
                "tripleKills": 0,
                "quadraKills": 0,
                "pentaKills": 0,
                "unrealKills": 0,
                "totalDamageDealt": 38746,
                "magicDamageDealt": 67,
                "physicalDamageDealt": 38667,
                "trueDamageDealt": 12,
                "largestCriticalStrike": 0,
                "totalDamageDealtToChampions": 7427,
                "magicDamageDealtToChampions": 67,
                "physicalDamageDealtToChampions": 7348,
                "trueDamageDealtToChampions": 12,
                "totalHeal": 840,
                "totalUnitsHealed": 1,
                "damageSelfMitigated": 15012,
                "damageDealtToObjectives": 3697,
                "damageDealtToTurrets": 2531,
                "visionScore": 6,
                "timeCCingOthers": 4,
                "totalDamageTaken": 20944,
                "magicalDamageTaken": 7715,
                "physicalDamageTaken": 12744,
                "trueDamageTaken": 484,
                "goldEarned": 6018,
                "goldSpent": 5925,
                "turretKills": 0,
                "inhibitorKills": 0,
                "totalMinionsKilled": 87,
                "neutralMinionsKilled": 4,
                "neutralMinionsKilledTeamJungle": 1,
                "neutralMinionsKilledEnemyJungle": 0,
                "totalTimeCrowdControlDealt": 33,
                "champLevel": 10,
                "visionWardsBoughtInGame": 0,
                "sightWardsBoughtInGame": 0,
                "wardsPlaced": 2,
                "wardsKilled": 2,
                "firstBloodKill": false,
                "firstBloodAssist": false,
                "firstTowerKill": false,
                "firstTowerAssist": false,
                "firstInhibitorKill": false,
                "firstInhibitorAssist": false,
                "combatPlayerScore": 0,
                "objectivePlayerScore": 0,
                "totalPlayerScore": 0,
                "totalScoreRank": 0,
                "playerScore0": 0,
                "playerScore1": 0,
                "playerScore2": 0,
                "playerScore3": 0,
                "playerScore4": 0,
                "playerScore5": 0,
                "playerScore6": 0,
                "playerScore7": 0,
                "playerScore8": 0,
                "playerScore9": 0,
                "perk0": 8010,
                "perk0Var1": 339,
                "perk0Var2": 0,
                "perk0Var3": 0,
                "perk1": 9111,
                "perk1Var1": 562,
                "perk1Var2": 120,
                "perk1Var3": 0,
                "perk2": 9104,
                "perk2Var1": 0,
                "perk2Var2": 0,
                "perk2Var3": 0,
                "perk3": 8299,
                "perk3Var1": 318,
                "perk3Var2": 0,
                "perk3Var3": 0,
                "perk4": 8446,
                "perk4Var1": 589,
                "perk4Var2": 0,
                "perk4Var3": 0,
                "perk5": 8473,
                "perk5Var1": 951,
                "perk5Var2": 0,
                "perk5Var3": 0,
                "perkPrimaryStyle": 8000,
                "perkSubStyle": 8400,
                "statPerk0": 5005,
                "statPerk1": 5008,
                "statPerk2": 5002
            },

Proposed changes

// ParticipantStats contains stats of a participant in a game
type ParticipantStats struct {
    // ...............
    // Primary rune path
    PerkPrimaryStyle int `json:"perkPrimaryStyle"`
    // Secondary rune path
    PerkSubStyle int `json:"perkSubStyle"`
    // Primary path keystone rune.
    Perk0     int `json:"perk0"`
    Perk0Var1 int `json:"perk0Var1"`
    Perk0Var2 int `json:"perk0Var2"`
    Perk0Var3 int `json:"perk0Var3"`
    // Primary path rune.
    Perk1     int `json:"perk1"`
    Perk1Var1 int `json:"perk1Var1"`
    Perk1Var2 int `json:"perk1Var2"`
    Perk1Var3 int `json:"perk1Var3"`
    // Primary path rune.
    Perk2     int `json:"perk2"`
    Perk2Var1 int `json:"perk2Var1"`
    Perk2Var2 int `json:"perk2Var2"`
    Perk2Var3 int `json:"perk2Var3"`
    // Primary path rune.
    Perk3     int `json:"perk3"`
    Perk3Var1 int `json:"perk3Var1"`
    Perk3Var2 int `json:"perk3Var2"`
    Perk3Var3 int `json:"perk3Var3"`
    // Secondary path rune.
    Perk4     int `json:"perk4"`
    Perk4Var1 int `json:"perk4Var1"`
    Perk4Var2 int `json:"perk4Var2"`
    Perk4Var3 int `json:"perk4Var3"`
    // Secondary path rune.
    Perk5     int `json:"perk5"`
    Perk5Var1 int `json:"perk5Var1"`
    Perk5Var2 int `json:"perk5Var2"`
    Perk5Var3 int `json:"perk5Var3"`
        // ========================================= Hear !! ++
    StatPerk0 int `json:"statPerk0"`
    StatPerk1 int `json:"statPerk1"`
    StatPerk2 int `json:"statPerk2"`
        // =========================================
}

Since English is not my native language, there may be awkward or misleading expressions.

KnutZuidema commented 4 years ago

This is undocumented behavior of the League API then I guess? I'm fine with implementing those attributes here, but I'd like to do it in a way that makes it clear that it's not officially documented and thus might change at any time.

ironpark commented 4 years ago

This is undocumented behavior of the League API then I guess? I'm fine with implementing those attributes here, but I'd like to do it in a way that makes it clear that it's not officially documented and thus might change at any time.

right it is undocumented behavior. In general, if you use a specification that is not defined in the API documentation, it can be changed at any time, and we understand that compatibility is not guaranteed, but given that the issue has been neglected for a long time. this issue seems to have been opened around March 2019

I know how you are going to manage and maintain your project. I respect it and I think it is the right direction. so... for the usecase I need, I will create a separate implementation or proceed through fork.

Thank you,

KnutZuidema commented 4 years ago

I'll gladly accept a pull request, if you wanna push those changes upstream.