BenFradet / RiotSharp

C# wrapper for the Riot Games API
http://benfradet.github.io/RiotSharp/
MIT License
300 stars 145 forks source link

Get position/role of a current game? #689

Open GithubStalker opened 3 years ago

GithubStalker commented 3 years ago

I'd like to know what's the participant's role. I saw that Match has properties for this. But this is not for a current match.

 List<CurrentGameParticipant> currentMatch = 
                api.Spectator.GetCurrentGameAsync(Region.Euw, summonerObject.Id).Result.Participants;

how could I know the order (TOP, JUNGLE, MID, ADC, SUPPORT) for these participants?

xXLAOKOONXx commented 3 years ago

please take a look here: https://developer.riotgames.com/apis#match-v4/GET_getMatch RiotSharp is on MATCH-V5 since a few days, but there is no documentation from riot to refer yet

GithubStalker commented 3 years ago

Can I get a current match in Riot Sharp using Match's methods?

For example

  long idMatch = api.Spectator.GetCurrentGameAsync(Region.Euw, summonerObject.Id).Result.GameId;
 return api.Match.GetMatchAsync(Region.Euw, idMatch.ToString()).Result.Info.Participants.First().Lane;

This doesn't work for me. I can get the CurrentGame but there's no Lane properties. And the idMatch I got it's not valid

xXLAOKOONXx commented 3 years ago

I assume the spectator api does not give those information. And match api is for completed games only. So it is not possible to recieve the information you want via riot api.

I am not aware whether the order has something to do with theire position. You also could try to assume positions based on the participants and their picks (caitlyn most likely adc, etc.) i think there are some frameworks to do so (not sure if compatible with c#).

If you have further questions in that regard i recommend the official riot third party discord. RiotSharp makes the Riot api available in c#, your problem goes beyond that.