Soundofdarkness / RuneBook

📖 Arcane Rune Pages manager for League of Legends 📜
MIT License
103 stars 22 forks source link

[Feature] ItemSetExporter #97

Open dawidmachon opened 2 years ago

dawidmachon commented 2 years ago

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.

Soundofdarkness commented 2 years ago

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.

spstarr commented 2 years ago

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

dawidmachon commented 2 years ago

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.

Soundofdarkness commented 2 years ago

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.

89Q12 commented 2 years ago

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.

Soundofdarkness commented 2 years ago

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.

spstarr commented 2 years ago

I will certainly test!

dawidmachon commented 2 years ago

Please do not forgot about items for ARAMS ;)

89Q12 commented 2 years ago

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

dawidmachon commented 2 years ago

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.

89Q12 commented 2 years ago

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 :(

dawidmachon commented 2 years ago

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

89Q12 commented 2 years ago

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.

spstarr commented 2 years ago

Check JSON syntax?

dawidmachon commented 2 years ago

@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
spstarr commented 2 years ago

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 } ] } ] }

Soundofdarkness commented 2 years ago

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.

89Q12 commented 2 years ago

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.

Soundofdarkness commented 2 years ago

Sounds good, thank you !

89Q12 commented 2 years ago

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?

spstarr commented 2 years ago

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

89Q12 commented 2 years ago

Could you please check if the file was created? In ~/Games/league-of-legends/drivec/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.

spstarr commented 2 years ago

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 commented 2 years ago

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

89Q12 commented 2 years ago

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?

spstarr commented 2 years ago

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

89Q12 commented 2 years ago

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

Soundofdarkness commented 2 years ago

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

89Q12 commented 2 years ago

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 ?

Soundofdarkness commented 2 years ago

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.

89Q12 commented 2 years ago

I noticed one thing I could have done better :P, because it should delete the other item sets as I noticed I don't always check that I selected the right item set in game as lol somewhat ignores the map the item set is for :|

Soundofdarkness commented 2 years ago

Ah don't worry, I don't think I've ever written something where I haven't found anything that could have been written differently later. Do you want to just change it or should I try to when I'm able to ?

89Q12 commented 2 years ago

Well I can do it I saw a mistake I made so I wanna fix that anyways xD Also I'm working on bringing this project to Typescript and adding some tests so that releases can be automated via CI

Soundofdarkness commented 2 years ago

Sure okay, going to take a look tomorrow and then merge it ^^ And if you want to do that, it certainly sounds like a nice idea, but I'm not sure if we can properly test the project since most of it is depending on riot's api not breaking in some way. The main possible thing would be testing if the website exporters still work I think. The typescript part sounds nice if you can (and want to) figure it out, every time I tried getting electron to work in a tidy way with typescript it broke in some way, usually connected to either building or just webpack making no sense to me. And well, CI sounds certainly nice, but please for all these things: Only do them if you actually have fun working on them, as from personal experience setting all these things up wasn't exactly fun most of the time. (And as is probably quite visible on my time to respond, I probably wont be able to help much with the limited time I have for open source projects )