RuneBook icon indicating copy to clipboard operation
RuneBook copied to clipboard

[Feature] ItemSetExporter

Open dawidmachon opened this issue 4 years ago • 34 comments

Hi, I would ask if anyone know name of endpoint for lolalytics for item sets or item orders:

Example for runes, but i need for items. https://axe.lolalytics.com/mega/?ep=rune&p=d&v=1&patch=11.20&cid=1&lane=middle&tier=platinum_plus&queue=450&region=all%60; It would be awesome have item sets export option.

dawidmachon avatar Oct 18 '21 00:10 dawidmachon

Hey ! Thanks for the suggestion. Unfortunately I personally think this is out of scope for this project, but I'm going to leave the issue open for now to see if more people have an opinion on this.

Soundofdarkness avatar Oct 25 '21 11:10 Soundofdarkness

I wouldn't mind if RuneBook managed item lists too in addition to runes, since nothing out there I know of does that...

spstarr avatar Oct 28 '21 17:10 spstarr

I think runes + Items for these runes = amaizing app for me for ARAMS ;P Because I will basicali login to game, and play. nothing more to open.

If @Soundofdarkness you have such API endpoint, I maybe can in free time make PR for you for sketch for it to work.

dawidmachon avatar Nov 03 '21 16:11 dawidmachon

Well, most websites have an unofficial endpoint for it, but it needs to be reverse-engineered most of the time (or just extracted from the page itself). The problem will just be that we need a completely new UI if we would want item sets too I think.

Soundofdarkness avatar Nov 21 '21 18:11 Soundofdarkness

There I come into place :D So far I managed to implement Item sets for blitzgg as they give the info for the Item sets right away and I also wrote a fancy UI for that, although it just lists the items by name for now. Anyways as soon as I'm happy with the UI I'll open a PR, also this APP works flawlessly on linux. I'm planning to look into the other sites but no promises, I also want to get the auto import into the game working but that will take a while.

89Q12 avatar Dec 01 '21 19:12 89Q12

Sounds awesome, thank you ! I hope that I have enough time to release it fairly quickly when the PR arrives, and depending on how much time I have I might look into adding more exporters for the list data too. And well, since it seems that so far everyone who voiced an opinion wants item sets, I guess its now in the scope of the project.

Soundofdarkness avatar Dec 02 '21 00:12 Soundofdarkness

I will certainly test!

spstarr avatar Dec 02 '21 08:12 spstarr

Please do not forgot about items for ARAMS ;)

dawidmachon avatar Dec 02 '21 11:12 dawidmachon

Please do not forgot about items for ARAMS ;)

Already done :)

Sounds awesome, thank you ! I hope that I have enough time to release it fairly quickly when the PR arrives, and depending on how much time I have I might look into adding more exporters for the list data too. And well, since it seems that so far everyone who voiced an opinion wants item sets, I guess its now in the scope of the project.

Yeah, I'm trying to follower the code style as close as possible. Anyways the item sets should be in this structure(in my opinion)

itemSet: {
        start_items: Array<int>, //Support item etc 
        core_items: Array<int>, //Mythic etc
        big_items: Array<int>, //Aka late game items
}

This object is included in the current page object.

My biggest hurtle right now is the exporting to the league client as I don't really understand what data I actually need to give the client but I'll figure it out :D When I get this done I can probably also add all other sites that have item sets available.

The ui currently looks like this: image

89Q12 avatar Dec 02 '21 15:12 89Q12

My biggest hurtle right now is the exporting to the league client as I don't really understand what data I actually need to give the client but I'll figure it out :D When I get this done I can probably also add all other sites that have item sets available.

@11Tuvork28 let me help you: path: C:\Riot Games\League of Legends\Config\Champions\

Champions.zip image

example for Zyra:

{
    "title": "[lolalytics-ARAM] Highest Win, 11.20 (G+)",
    "type": "custom",
    "associatedMaps": [
        12
    ],
    "associatedChampions": [
        143
    ],
    "map": "any",
    "mode": "any",
    "preferredItemSlots": [],
    "sortrank": 1,
    "startedFrom": "blank",
    "blocks": [
        {
            "type": "Starting items, win rate 53.39%",
            "items": [
                {
                    "id": "3802",
                    "count": 1
                },
                {
                    "id": "2003",
                    "count": 1
                },
                {
                    "id": "2003",
                    "count": 1
                }
            ]
        },
        {
            "type": "Core items, win rate 57.48%",
            "items": [
                {
                    "id": "6653",
                    "count": 1
                },
                {
                    "id": "4637",
                    "count": 1
                },
                {
                    "id": "3020",
                    "count": 1
                }
            ]
        },
        {
            "type": "Item 4",
            "items": [
                {
                    "id": "3116",
                    "count": 1
                },
                {
                    "id": "3135",
                    "count": 1
                }
            ]
        },
        {
            "type": "Item 5",
            "items": [
                {
                    "id": "3135",
                    "count": 1
                },
                {
                    "id": "3116",
                    "count": 1
                },
                {
                    "id": "3165",
                    "count": 1
                }
            ]
        },
        {
            "type": "Item 6",
            "items": [
                {
                    "id": "3165",
                    "count": 1
                },
                {
                    "id": "3089",
                    "count": 1
                },
                {
                    "id": "3135",
                    "count": 1
                }
            ]
        }
    ]
}

You can also probably use and generate more examples here: ItemSetBuilder But my examples above are not from there, so you can compare them and choose better structure for your needs.

dawidmachon avatar Dec 02 '21 15:12 dawidmachon

hell yeah thank you!!! Exactly what I need :) But I don't know what I do wrong but the client doesn't like the data I give it:

curl -X POST "https://127.0.0.1:42397/lol-item-sets/v1/item-sets/summonerId/sets" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"title\": \"[lolalytics-ARAM] Highest Win, 11.20 (G+)\", \"type\": \"custom\", \"associatedMaps\": [ 12 ], \"associatedChampions\": [ 143 ], \"map\": \"any\", \"mode\": \"any\", \"preferredItemSlots\": [], \"sortrank\": 1, \"startedFrom\": \"blank\", \"blocks\": [ { \"type\": \"Starting items, win rate 53.39%\", \"items\": [ { \"id\": \"3802\", \"count\": 1 }, { \"id\": \"2003\", \"count\": 1 }, { \"id\": \"2003\", \"count\": 1 } ] }, { \"type\": \"Core items, win rate 57.48%\", \"items\": [ { \"id\": \"6653\", \"count\": 1 }, { \"id\": \"4637\", \"count\": 1 }, { \"id\": \"3020\", \"count\": 1 } ] }, { \"type\": \"Item 4\", \"items\": [ { \"id\": \"3116\", \"count\": 1 }, { \"id\": \"3135\", \"count\": 1 } ] }, { \"type\": \"Item 5\", \"items\": [ { \"id\": \"3135\", \"count\": 1 }, { \"id\": \"3116\", \"count\": 1 }, { \"id\": \"3165\", \"count\": 1 } ] }, { \"type\": \"Item 6\", \"items\": [ { \"id\": \"3165\", \"count\": 1 }, { \"id\": \"3089\", \"count\": 1 }, { \"id\": \"3135\", \"count\": 1 } ] } ]}"

The response from the client is Error: Request failed with status code 400 with no additional content. Anyways I guess I will just write it to the file location instead of using the api :(

89Q12 avatar Dec 02 '21 16:12 89Q12

hell yeah thank you!!! Exactly what I need :) But I don't know what I do wrong but the client doesn't like the data I give it:

curl -X POST "https://127.0.0.1:42397/lol-item-sets/v1/item-sets/summonerId/sets" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"title\": \"[lolalytics-ARAM] Highest Win, 11.20 (G+)\", \"type\": \"custom\", \"associatedMaps\": [ 12 ], \"associatedChampions\": [ 143 ], \"map\": \"any\", \"mode\": \"any\", \"preferredItemSlots\": [], \"sortrank\": 1, \"startedFrom\": \"blank\", \"blocks\": [ { \"type\": \"Starting items, win rate 53.39%\", \"items\": [ { \"id\": \"3802\", \"count\": 1 }, { \"id\": \"2003\", \"count\": 1 }, { \"id\": \"2003\", \"count\": 1 } ] }, { \"type\": \"Core items, win rate 57.48%\", \"items\": [ { \"id\": \"6653\", \"count\": 1 }, { \"id\": \"4637\", \"count\": 1 }, { \"id\": \"3020\", \"count\": 1 } ] }, { \"type\": \"Item 4\", \"items\": [ { \"id\": \"3116\", \"count\": 1 }, { \"id\": \"3135\", \"count\": 1 } ] }, { \"type\": \"Item 5\", \"items\": [ { \"id\": \"3135\", \"count\": 1 }, { \"id\": \"3116\", \"count\": 1 }, { \"id\": \"3165\", \"count\": 1 } ] }, { \"type\": \"Item 6\", \"items\": [ { \"id\": \"3165\", \"count\": 1 }, { \"id\": \"3089\", \"count\": 1 }, { \"id\": \"3135\", \"count\": 1 } ] } ]}"

The response from the client is Error: Request failed with status code 400 with no additional content. Anyways I guess I will just write it to the file location instead of using the api :(

Maybe its dumb question but do you provide summonerId as parameter? image

dawidmachon avatar Dec 02 '21 16:12 dawidmachon

I did, I put it back in there to mask my id, maybe its just the fact that I'm running the game on linux through wine or so I don't really know.

89Q12 avatar Dec 02 '21 16:12 89Q12

Check JSON syntax?

spstarr avatar Dec 02 '21 16:12 spstarr

@11Tuvork28 please go check:

{\"title\":\"[lolalytics-ARAM] Highest Win, 11.20 (G+)\",\"type\":\"custom\",\"associatedMaps\":[12],\"associatedChampions\":[143],\"map\":\"any\",\"mode\":\"any\",\"preferredItemSlots\":[],\"sortrank\":1,\"startedFrom\":\"blank\",\"blocks\":[{\"type\":\"Starting items, win rate 53.39%\",\"items\":[{\"id\":\"3802\",\"count\":1},{\"id\":\"2003\",\"count\":1},{\"id\":\"2003\",\"count\":1}]},{\"type\":\"Core items, win rate 57.48%\",\"items\":[{\"id\":\"6653\",\"count\":1},{\"id\":\"4637\",\"count\":1},{\"id\":\"3020\",\"count\":1}]},{\"type\":\"Item 4\",\"items\":[{\"id\":\"3116\",\"count\":1},{\"id\":\"3135\",\"count\":1}]},{\"type\":\"Item 5\",\"items\":[{\"id\":\"3135\",\"count\":1},{\"id\":\"3116\",\"count\":1},{\"id\":\"3165\",\"count\":1}]},{\"type\":\"Item 6\",\"items\":[{\"id\":\"3165\",\"count\":1},{\"id\":\"3089\",\"count\":1},{\"id\":\"3135\",\"count\":1}]}]}

or for safe go with orginal file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

curl -X POST -H "Content-Type: application/json" -d @../data/cats.json http://localhost:8080/mSfvMwNAfj

dawidmachon avatar Dec 02 '21 18:12 dawidmachon

Format when removing escapes and all via https://jsonformatter.org/json-parser { "title": "[lolalytics-ARAM] Highest Win, 11.20 (G+)", "type": "custom", "associatedMaps": [ 12 ], "associatedChampions": [ 143 ], "map": "any", "mode": "any", "preferredItemSlots": [], "sortrank": 1, "startedFrom": "blank", "blocks": [ { "type": "Starting items, win rate 53.39%", "items": [ { "id": "3802", "count": 1 }, { "id": "2003", "count": 1 }, { "id": "2003", "count": 1 } ] }, { "type": "Core items, win rate 57.48%", "items": [ { "id": "6653", "count": 1 }, { "id": "4637", "count": 1 }, { "id": "3020", "count": 1 } ] }, { "type": "Item 4", "items": [ { "id": "3116", "count": 1 }, { "id": "3135", "count": 1 } ] }, { "type": "Item 5", "items": [ { "id": "3135", "count": 1 }, { "id": "3116", "count": 1 }, { "id": "3165", "count": 1 } ] }, { "type": "Item 6", "items": [ { "id": "3165", "count": 1 }, { "id": "3089", "count": 1 }, { "id": "3135", "count": 1 } ] } ] }

spstarr avatar Dec 02 '21 19:12 spstarr

Just to quickly chime in about the structure of the item sets: For me @11Tuvork28's idea sounds like a good way to me. But yeah, don't worry too much about the code style, either, as that's quite a mix of different ways already.

Soundofdarkness avatar Dec 02 '21 22:12 Soundofdarkness

Okay, thanks for the feedback/help! For now I have decided to just place the json file in the directory for the selected champion as this seems the fastest way for me to finish the exporter. I also added translations for English and German for the new UI elements I added. I will probably open the PR tomorrow as I don't have enough time today.

89Q12 avatar Dec 03 '21 15:12 89Q12

Sounds good, thank you !

Soundofdarkness avatar Dec 03 '21 21:12 Soundofdarkness

So for anyone who wants to test the new feature, clone my fork. Let me know if you have any thoughts or if you find bugs and what do you all think about the icon for the button?

89Q12 avatar Dec 09 '21 15:12 89Q12

hmm, doesn't seem to work for me, with Wine and League, it finds client, but Its not importing any Items only Runes import.

spstarr avatar Dec 14 '21 16:12 spstarr

Could you please check if the file was created? In ~/Games/league-of-legends/drive_c/Riot\ Games/League\ of\ Legends/Config/Champions/{ChampName}/Recommended/{ChampName}_{role}.json The client doesn't show the item set under the tab but it does pick the item sets up while in game so that can be confusing, as far as I know blitzgg has the same behaviour.

89Q12 avatar Dec 14 '21 16:12 89Q12

Yes, I see ~/Games/league-of-legends/drive_c/Riot Games/League of Legends/Config/Champions/Veigar/Recommended/Veigar_MID.json. I see so it will pick it up in game, going to try it now :)

spstarr avatar Dec 14 '21 16:12 spstarr

hmm now its not even letting me upload Runes in ARAM just grayed out option but is detecting new random champ + runes :/

spstarr avatar Dec 14 '21 16:12 spstarr

ummm possibly restart RuneBook real quick, but it should be unrelated as I didn't touch the existing code :/ EDIT: Did the item set show up?

89Q12 avatar Dec 14 '21 16:12 89Q12

I will try again after, I'm not sure why RuneBook just stopped allowing importing altogether...

spstarr avatar Dec 14 '21 18:12 spstarr

Strange, I'm gonna look into it either today or tomorrow but for me it is working just fine

89Q12 avatar Dec 14 '21 18:12 89Q12

Going to check that tomorrow too, maybe riot bugged something in the client. (or just changed something and I haven't seen it)

Soundofdarkness avatar Dec 14 '21 23:12 Soundofdarkness

I'm unable to reproduce the issue, I'm sure it was just a random bug. But if it persist, could you provide the output from the console in the developer tools ?

89Q12 avatar Dec 15 '21 14:12 89Q12

Aight, I'm probably going to already merge #101 and then just wait a few more days if we get anyone to reproduce the issue, and if not I'm going to release it.

Soundofdarkness avatar Dec 19 '21 17:12 Soundofdarkness