Skip to content

Commit

Permalink
Version 1.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pipe01 committed Dec 13, 2019
1 parent 5b228e5 commit e32c7b1
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 580 deletions.
2 changes: 1 addition & 1 deletion LCU.NET
15 changes: 13 additions & 2 deletions Legendary Rune Maker/Data/Providers/UGGProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Legendary_Rune_Maker.Data.Providers
internal class UGGProvider : Provider
{
public override string Name => "U.GG";
public override Options ProviderOptions => Options.RunePages | Options.ItemSets | Options.SkillOrder;
public override Options ProviderOptions => Options.RunePages | Options.ItemSets | Options.SkillOrder | Options.Counters;

private const int OverviewWorld = 12;
private const int OverviewPlatPlus = 10;
Expand Down Expand Up @@ -52,7 +52,7 @@ private async Task<string> GetLolUGGVersion()
return _LolUGGVersion;
}

private IDictionary<int, JObject> ChampionData = new Dictionary<int, JObject>();
private readonly IDictionary<int, JObject> ChampionData = new Dictionary<int, JObject>();
protected async Task<JObject> GetChampionData(int championId)
{
if (!ChampionData.TryGetValue(championId, out var data))
Expand Down Expand Up @@ -161,5 +161,16 @@ public async Task<IEnumerable<PositionData>> GetDeepRoles(int championId)
.OrderByDescending(o => o.Value[0][0][0])
.Select(o => new PositionData(IdToPosition[int.Parse(o.Name)], o.Value[0][0][0].ToObject<float>() / totalGames));
}

public override async Task<Champion[]> GetCountersFor(int championId, Position position, int maxCount = 5)
{
var json = JObject.Parse(await WebCache.String($"https://stats2.u.gg/lol/{UGGApiVersion}/matchups/{await GetLolUGGVersion()}/ranked_solo_5x5/{championId}/{UGGOverviewVersion}.json"));

var ret = await Task.WhenAll(json["1"]["1"][IdToPosition.Invert()[position].ToString()][0]
.Take(maxCount)
.Select(o => Riot.GetChampionAsync(o[0].Value<int>())).ToArray());

return ret;
}
}
}
4 changes: 2 additions & 2 deletions Legendary Rune Maker/Game/Actuator.Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task PickChampion(Position pos, LolChampSelectChampSelectAction myA
LogTo.Debug("possiblePicks: {0}", string.Join(", ", picks.Values.ToArray()));

//Get the first valid one
int preferredPick = possiblePicks.FirstOrDefault(pickable.championIds.Contains);
int preferredPick = possiblePicks.FirstOrDefault(pickable.Contains);
LogTo.Debug("Preferred champ: {0}", preferredPick);

if (preferredPick == 0)
Expand Down Expand Up @@ -83,7 +83,7 @@ public async Task BanChampion(Position pos, LolChampSelectChampSelectAction myAc
possibleBans.Add(bans[Position.Fill]);
LogTo.Debug("possibleBans: {0}", string.Join(", ", possibleBans));

int preferredBan = possibleBans.FirstOrDefault(bannable.championIds.Contains);
int preferredBan = possibleBans.FirstOrDefault(bannable.Contains);
var banName = preferredBan > 0 ? Riot.GetChampion(preferredBan).Name : "None";
LogTo.Debug("Preferred ban: {0}", banName);

Expand Down
4 changes: 3 additions & 1 deletion Legendary Rune Maker/Overlay/Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ public readonly struct Enemy
public Champion[] GoodPicks { get; }
public Champion[] BadPicks { get; }
public string Position { get; }
public bool IsOpponent { get; }

public Enemy(Champion champion, Champion[] goodPicks, Champion[] badPicks, string position)
public Enemy(Champion champion, Champion[] goodPicks, Champion[] badPicks, string position, bool isOpponent)
{
this.Champion = champion;
this.GoodPicks = goodPicks;
this.BadPicks = badPicks;
this.Position = position;
this.IsOpponent = isOpponent;
}
}
}
2 changes: 1 addition & 1 deletion Legendary Rune Maker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]

[assembly: AssemblyVersion("1.3.4")]
[assembly: AssemblyVersion("1.3.5")]
[assembly: AssemblyFileVersion("1.0.0.0")]

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")]
Expand Down
15 changes: 12 additions & 3 deletions Legendary Rune Maker/Windows/OverlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,20 @@ await Dispatcher.Invoke(async () =>
this.Visibility = Visibility.Visible;
}

await UpdateTeam(data.theirTeam.Select(o => o.championId).ToArray());
await UpdateTeam(data);
}
});
}

private async Task UpdateTeam(int[] team)
private async Task UpdateTeam(LolChampSelectChampSelectSession data)
{
int[] team = data.theirTeam.Select(o => o.championId).ToArray();

if (PreviousTeam != null && team.SequenceEqual(PreviousTeam))
return;

var myPosition = data.myTeam.Single(o => o.cellId == data.localPlayerCellId).assignedPosition.ToPosition();

var guessedPositions = Guesser.Guess(team.Where(o => o != 0).ToArray());

for (int i = EnemySummoners.Count; i < team.Length; i++)
Expand All @@ -108,11 +112,14 @@ private async Task UpdateTeam(int[] team)

if (theirChamp != 0)
{
var enemyPosition = guessedPositions.Invert()[theirChamp];

EnemySummoners[i] = new Enemy(
await Riot.GetChampionAsync(theirChamp),
await new METAsrcProvider().GetCountersFor(theirChamp, Position.Fill),
null,
guessedPositions.Invert()[theirChamp].ToString().ToUpper());
enemyPosition.ToString().ToUpper(),
enemyPosition == myPosition);
}
}

Expand Down Expand Up @@ -173,6 +180,8 @@ private async void Window_Initialized(object sender, EventArgs e)

await LoL?.Socket.SubscribeAndUpdate<LolChampSelectChampSelectSession>("/lol-champ-select/v1/session", ChampSelectSessionCallback);

var c = await new UGGProvider().GetCountersFor(84, Position.Mid);

//var events = JsonConvert.DeserializeObject<EventData[]>(File.ReadAllText("events.json"));
//Client.Socket.Playback(events, 10);
}
Expand Down
12 changes: 0 additions & 12 deletions LoL Rune Maker.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyIconWpf", "notifyicon
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Legendary Rune Maker Tests", "Legendary Rune Maker Tests\Legendary Rune Maker Tests.csproj", "{5850F2F4-BFD1-4386-89F8-34D6EC8FF03D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp2", "WpfApp2\WpfApp2.csproj", "{0A587E01-B671-449E-9531-5CF672E34B89}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -116,16 +114,6 @@ Global
{5850F2F4-BFD1-4386-89F8-34D6EC8FF03D}.Release 4.6.1|Any CPU.Build.0 = Release|Any CPU
{5850F2F4-BFD1-4386-89F8-34D6EC8FF03D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5850F2F4-BFD1-4386-89F8-34D6EC8FF03D}.Release|Any CPU.Build.0 = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release 4.0|Any CPU.ActiveCfg = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release 4.0|Any CPU.Build.0 = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release 4.5|Any CPU.Build.0 = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release 4.6.1|Any CPU.ActiveCfg = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release 4.6.1|Any CPU.Build.0 = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A587E01-B671-449E-9531-5CF672E34B89}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
9 changes: 0 additions & 9 deletions WpfApp1/App.xaml

This file was deleted.

17 changes: 0 additions & 17 deletions WpfApp1/App.xaml.cs

This file was deleted.

12 changes: 0 additions & 12 deletions WpfApp1/MainWindow.xaml

This file was deleted.

28 changes: 0 additions & 28 deletions WpfApp1/MainWindow.xaml.cs

This file was deleted.

9 changes: 0 additions & 9 deletions WpfApp1/WpfApp1.csproj

This file was deleted.

6 changes: 0 additions & 6 deletions WpfApp2/App.config

This file was deleted.

9 changes: 0 additions & 9 deletions WpfApp2/App.xaml

This file was deleted.

17 changes: 0 additions & 17 deletions WpfApp2/App.xaml.cs

This file was deleted.

12 changes: 0 additions & 12 deletions WpfApp2/MainWindow.xaml

This file was deleted.

28 changes: 0 additions & 28 deletions WpfApp2/MainWindow.xaml.cs

This file was deleted.

55 changes: 0 additions & 55 deletions WpfApp2/Properties/AssemblyInfo.cs

This file was deleted.

Loading

0 comments on commit e32c7b1

Please sign in to comment.