TrevorSStone / golol

RTMPS client for league of legends built in go
MIT License
5 stars 0 forks source link

question #2

Open joandrsn opened 10 years ago

joandrsn commented 10 years ago

Looks like a very nice client. I wad wondering if you could show how a main method would look. I've seached the web for lol clients that are fast and so far from what I've heard, go should Be a very good choice. I'm completly new to golang so an example of usage would Be great.

TrevorSStone commented 10 years ago

Something like this would get summoner data by name. You will need to replace the ClientVersion variable in the golol.go file to be the current one. You can find this by opening the league client and, at the login screen, it will be the numbers in the top right.

package main

import (
    "fmt"
    "os"

    "github.com/TrevorSStone/golol"
)

var (
    username = "yourusername"
    password = "yourpassword"
)

func main() {
    leagueconn, err := golol.New("NA", username, password)
    if err != nil {
        fmt.Println(err.Error())
        os.Exit(1)
    }
    leagueconn.GetSummonerByName("ManticoreX")
}

This will connect the client, do the handshake, and then request the summoner name data. This is now completely deprecated and should be done with my goriot library instead. Goriot will go through their web API instead of a custom implementation of the client. If you are trying to build a full client replacement, then you're in the right place. There is still a ton of work that would need to be done, but it is technically possible. Go's strong point isn't UI applications though, but you could build a browser based client, or use https://github.com/andlabs/ui/ to try and build a native client. As I said though, it will be a ton of work without a lot of payoff. I initially built this to be used for simple querying of the client for data. Once the official API was released all work on this client stopped. If you do find a cool use for this, or have any more questions, please let me know.

bobbyjayblack commented 9 years ago

Hi, I updated the version to the current version, 4.16.14_09_11_18_16, and made a new go program with the above example, and changed the username and password. Region is NA still. I receive the following error when trying to execute the application, any solution would be appreciated. I also receive a similiar error after modifying golol_test.go and trying go test .

Login1 Data Not Acceptable map[data:{map[headers:{map[] } faultDetail: time ToLive:0 faultCode:Server.Processing messageId:5543C8A2-5E0A-9B63-F297-A5CB23517 112 rootCause: body: correlationId:loginService faultString:No destina tion with id 'null' is registered with any service. clientId:5543C893-B809-FD1E- 64B1-D7FDB7949594 destination: timestamp:1.41147925587e+12 extendedData:<ni l>] flex.messaging.messages.ErrorMessage} 1:0 version:0 result:_error invokeId:2 serviceCall:]

I am actually trying to make an alternative lolclient, I have most the communication already in C#, just want to transition to golang for speed.

TrevorSStone commented 9 years ago

I just tried to see if I could get it running, but ran into the same and similar errors to the one you posted. Something must have changed on their end in the way they handle the first login request. I am unsure if the issue is in the message being sent from golol, or if it is parsing the returned message incorrectly. The error is occurring on line 239 of the rtmpsclient.go file once it has received a message back.

I assume that they have become stricter with the body of the message being sent to login. If you have a currently working amf message that is logging in OK, it shouldn't be too difficult to fix, but Riot has now officially said that they do not want to support 3rd party clients in any way (API access or otherwise)

If you continue down this path good luck and I would be happy to try and answer any questions. If you have a working C# implementation I would keep on that path. The speed gains wouldn't be worth the headaches in my opinion.