stirante / lol-client-java-api

Simple library which provides access to internal League of Legends Client API.
GNU General Public License v3.0
67 stars 14 forks source link

Client or Code issue regarding runes not updating? #22

Closed SimronJ closed 4 years ago

SimronJ commented 4 years ago

Okay, so when I try to put the runes to the league client it doesn't show the rune I put it when I open up the page. Like I can clearly see that the rune page that I want to change is clearly changing because you can see the name of the page changed and the runes changes BUT when I open the page it shows as the previous one.

I'm not sure if there is a refresh function for runes or not.

code: `List conPerkIds = Arrays.asList(8010, 9111, 9103, 8299, 8275, 8210, 5005, 5008, 5002); List lethalPerkIds = Arrays.asList(8008, 9111, 9103, 8299, 8275, 8210, 5005, 5008, 5002); List fleetPerkIds = Arrays.asList(8021, 9111, 9104, 8299, 8446, 8444, 5005, 5008, 5002); List grapsPerkIds = Arrays.asList(8437, 8446, 8444, 8453, 9111, 9104, 5005, 5008, 5002);

    // Initialize API
            ClientApi api = new ClientApi();
            api.addClientConnectionListener(new ClientConnectionListener()
            {
                @Override
                public void onClientConnected()
                {
                    try
                    {
                        runePages = api.executeGet("/lol-perks/v1/pages", LolPerksPerkPageResource[].class);
                        for (int i = 0; i < runePages.length; i++)
                        {
                            if (runePages[i].isEditable)
                            {
                                getandsetchamps.comboxUpdate(runePages[i].name);
                            }
                        }

                        LolPerksPerkPageResource modifiedRune = runePages[getRunePage];

                        if(typeOfRune.equalsIgnoreCase("Lethal Tempo Runes"))
                        {
                            modifiedRune.name = "Trynd Lethal: SimGUI";
                            modifiedRune.primaryStyleId = 8000;
                            modifiedRune.selectedPerkIds = lethalPerkIds;
                            modifiedRune.subStyleId = 8200;
                        }
                        if(typeOfRune.equalsIgnoreCase("Fleet Footwork Runes"))
                        {
                            modifiedRune.name = "Trynd Fleet: SimGUI";
                            modifiedRune.primaryStyleId = 8000;
                            modifiedRune.selectedPerkIds = fleetPerkIds;
                            modifiedRune.subStyleId = 8400;
                        }
                        if(typeOfRune.equalsIgnoreCase("Conqueror Runes"))
                        {
                            modifiedRune.name = "Trynd Conqueror: SimGUI";
                            modifiedRune.primaryStyleId = 8000;
                            modifiedRune.selectedPerkIds = conPerkIds;
                            modifiedRune.subStyleId = 8200;
                        }
                        if(typeOfRune.equalsIgnoreCase("Grasp Runes"))
                        {
                            modifiedRune.name = "Trynd Grasp: SimGUI";
                            modifiedRune.primaryStyleId = 8400;
                            modifiedRune.selectedPerkIds = grapsPerkIds;
                            modifiedRune.subStyleId = 8000;
                        }

                        api.executePut("/lol-perks/v1/pages/" + runePages[getRunePage].id, modifiedRune);
                        System.out.println("Set the Rune!");

                        runePages = api.executeGet("/lol-perks/v1/pages", LolPerksPerkPageResource[].class);
                        getandsetchamps.deleteComboxItem();
                        for (int i = 0; i < runePages.length; i++)
                        {
                            if (runePages[i].isEditable)
                            {
                                getandsetchamps.comboxUpdate(runePages[i].name);
                            }
                        }
                    } catch (IOException e)
                    {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onClientDisconnected()
                {
                    System.out.println("Client disconnected");
                }
            });
            // close socket when user enters something into console
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            try
            {
                reader.readLine();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
            api.stop();`
issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.75. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

SimronJ commented 4 years ago

you can see from this gif I captured: https://i.imgur.com/d13hYo3.gif

stirante commented 4 years ago

I encountered the same bug when developing my other project. The problem is with LCU. Solution was to remove page to update and add it again.

SimronJ commented 4 years ago

Yeah, I was thinking of doing that.

Also, wanted to ask does this LCU API compatible with Mac OS If I wanted to share this program with someone who has Mac or Linux-based OS.

stirante commented 4 years ago

I recently added support for unix based OS, but couldn't really check whether it's working. Please let me know whether it works or not if you try it.

SimronJ commented 4 years ago

Hey, I'm having a problem updating the runes. Like I can only able to deleted the runes but not be able to create a new runes.

`api.executeDelete("/lol-perks/v1/pages"); System.out.println(" Deleted!");

api.executePost("/lol-perks/v1/pages", runePages); System.out.println("Posted!");

api.executePut("/lol-perks/v1/pages/" + runePages[getRunePage].id, modifiedRune); System.out.println(runePages[getRunePage].name + " Updated!");`

stirante commented 4 years ago

Use only post with complete page you want to add. Don't use put afterwards.

It's definitely working. since I use it in my project. (there might be slight changes in API, because I use snapshot version of the library) https://github.com/stirante/RuneChanger/blob/master/src/main/java/com/stirante/runechanger/client/Runes.java#L64

SimronJ commented 4 years ago

Got it, Thank you!