Skip to content

Commit

Permalink
Merge pull request #2015 from diogotr7/feature/lol-dragons
Browse files Browse the repository at this point in the history
Small fixes and improvements to the lol profile
  • Loading branch information
diogotr7 authored May 17, 2020
2 parents 995028c + c600843 commit 08dab3f
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using JsonSubTypes;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -165,13 +168,77 @@ public class _AllPlayer
public string team { get; set; }
}

[JsonConverter(typeof(JsonSubtypes), "EventName")]
[JsonSubtypes.KnownSubType(typeof(_BaronKillEvent), "BaronKill")]
[JsonSubtypes.KnownSubType(typeof(_HeraldKillEvent), "HeraldKill")]
[JsonSubtypes.KnownSubType(typeof(_DragonKillEvent), "DragonKill")]
[JsonSubtypes.KnownSubType(typeof(_ChampionKillEvent), "ChampionKill")]
[JsonSubtypes.KnownSubType(typeof(_MultikillEvent), "Multikill")]
[JsonSubtypes.KnownSubType(typeof(_AceEvent), "Ace")]
[JsonSubtypes.KnownSubType(typeof(_InhibKillEvent), "InhibKilled")]
[JsonSubtypes.KnownSubType(typeof(_TurretKillEvent), "TurretKilled")]
public class _Event
{
public int EventID { get; set; }
public string EventName { get; set; }
public float EventTime { get; set; }
}

public class _BaronKillEvent : _Event
{
public bool Stolen { get; set; }
public string KillerName { get; set; }
public string[] Assisters { get; set; }
}

public class _HeraldKillEvent : _Event
{
public bool Stolen { get; set; }
public string KillerName { get; set; }
public string[] Assisters { get; set; }
}

public class _DragonKillEvent : _Event
{
public string DragonType { get; set; }
public bool Stolen { get; set; }
public string KillerName { get; set; }
public string[] Assisters { get; set; }
}

public class _ChampionKillEvent : _Event
{
public string KillerName { get; set; }
public string VictimName { get; set; }
public string[] Assisters { get; set; }
}

public class _MultikillEvent : _Event
{
public string KillerName { get; set; }
public int KillStreak { get; set; }
}

public class _AceEvent : _Event
{
public string Acer { get; set; }
public string AcingTeam { get; set; }
}

public class _InhibKillEvent : _Event
{
public string KillerName { get; set; }
public string InhibKilled { get; set; }
public string[] Assisters { get; set; }
}

public class _TurretKillEvent : _Event
{
public string KillerName { get; set; }
public string TurretKilled { get; set; }
public string[] Assisters { get; set; }
}

public class _EventList
{
public IList<_Event> Events { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AbilityNode : Node<AbilityNode>
{
public bool Learned => Level != 0;
public int Level;
public string Name;
public string Name = "";

//TODO: there might be additional useful info to add here such as cooldown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public SlotNode(_Item item)

public enum ItemID
{
Unknown = -1,
None = 0,
BootsofSpeed = 1001,
FaerieCharm = 1004,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,54 @@ namespace Aurora.Profiles.LeagueOfLegends.GSI.Nodes
{
public class MatchNode : Node<MatchNode>
{
public string GameMode;
public MapTerrain MapTerrain;

//public GameMode GameMode;
//TODO: Find the rest of the enum values. meanwhile i'll leave this as a string
public string GameMode = "";

public float GameTime;

public bool InGame;

public int InfernalDragonsKilled;

public int OceanDragonsKilled;

public int MountainDragonsKilled;

public int CloudDragonsKilled;

public int EarthDragonsKilled;

public int ElderDragonsKilled;

public int DragonsKilled;

public int TurretsKilled;

public int InhibsKilled;

public int BaronsKilled;

public int HeraldsKilled;
}

public enum MapTerrain
{
Unknown,
Default,
Infernal,
Cloud,
Mountain,
Ocean
}

//TODO: Find the rest of these
public enum GameMode
{
Unknown = -1,
None = 0,
PracticeTool
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace Aurora.Profiles.LeagueOfLegends.GSI.Nodes
{
public enum Champion
{
Undefined = -1,
Unknown = -1,
None = 0,
Aatrox,
Ahri,
Akali,
Expand Down Expand Up @@ -163,14 +164,16 @@ public enum Champion

public enum Team
{
Undefined = -1,
Unknown = -1,
None = 0,
Order,
Chaos
}

public enum SummonerSpell
{
Undefined = -1,
Unknown = -1,
None = 0,
Cleanse,//210
Exhaust,//210
Flash,//300
Expand All @@ -187,7 +190,8 @@ public enum SummonerSpell

public enum Position
{
Undefined,
Unknown = -1,
None = 0,
Top,
Jungle,
Middle,
Expand All @@ -201,12 +205,12 @@ public class PlayerNode : Node<PlayerNode>
public StatsNode ChampionStats = new StatsNode();
public AbilitiesNode Abilities = new AbilitiesNode();
public InventoryNode Items = new InventoryNode();
public SummonerSpell SpellD = SummonerSpell.Undefined;
public SummonerSpell SpellF = SummonerSpell.Undefined;
public Champion Champion = Champion.Undefined;
public Team Team = Team.Undefined;
public Position Position = Position.Undefined;
public string SummonerName;
public SummonerSpell SpellD = SummonerSpell.None;
public SummonerSpell SpellF = SummonerSpell.None;
public Champion Champion = Champion.None;
public Team Team = Team.None;
public Position Position = Position.None;
public string SummonerName = "";
public int Level;
public float Gold;
public bool IsDead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace Aurora.Profiles.LeagueOfLegends.GSI.Nodes
{
public enum ResourceType
{
Undefined = -1,
Unknown = -1,
None = 0,
Mana,
Energy,
None,
Shield,
Battlefury,
Dragonfury,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ public override void UpdateTick()

if (allGameData == null)
{
s.Match.InGame = false;
_game_state = new GameState_LoL();
return;
}

try
{
#region Match
s.Match.InGame = true;
//s.Match.GameMode = EnumUtils.TryParseOr(allGameData.gameData.gameMode, true, GameMode.Unknown);
s.Match.GameMode = allGameData.gameData.gameMode;
s.Match.GameTime = allGameData.gameData.gameTime;
#endregion
Expand Down Expand Up @@ -111,7 +112,7 @@ public override void UpdateTick()
s.Player.ChampionStats.PhysicalLethality = ap.championStats.physicalLethality;
s.Player.ChampionStats.ResourceMax = ap.championStats.resourceMax;
s.Player.ChampionStats.ResourceRegenRate = ap.championStats.resourceRegenRate;
s.Player.ChampionStats.ResourceType = EnumUtils.TryParseOr(ap.championStats.resourceType, true, ResourceType.Undefined);
s.Player.ChampionStats.ResourceType = EnumUtils.TryParseOr(ap.championStats.resourceType, true, ResourceType.Unknown);
s.Player.ChampionStats.ResourceCurrent = ap.championStats.resourceValue;
s.Player.ChampionStats.SpellVamp = ap.championStats.spellVamp;
s.Player.ChampionStats.Tenacity = ap.championStats.tenacity;
Expand All @@ -128,11 +129,11 @@ public override void UpdateTick()
return;
//if we can't find it, skip

s.Player.Champion = EnumUtils.TryParseOr(p.championName.Replace(" ", "").Replace("'", "").Replace(".", ""), true, Champion.Undefined);
s.Player.SpellD = EnumUtils.TryParseOr(p.summonerSpells.summonerSpellOne.displayName, true, SummonerSpell.Undefined);
s.Player.SpellF = EnumUtils.TryParseOr(p.summonerSpells.summonerSpellTwo.displayName, true, SummonerSpell.Undefined);
s.Player.Team = EnumUtils.TryParseOr(p.team, true, Team.Undefined);
s.Player.Position = EnumUtils.TryParseOr(p.position, true, Position.Undefined);
s.Player.Champion = EnumUtils.TryParseOr(p.championName.Replace(" ", "").Replace("'", "").Replace(".", ""), true, Champion.None);
s.Player.SpellD = EnumUtils.TryParseOr(p.summonerSpells.summonerSpellOne.displayName, true, SummonerSpell.Unknown);
s.Player.SpellF = EnumUtils.TryParseOr(p.summonerSpells.summonerSpellTwo.displayName, true, SummonerSpell.Unknown);
s.Player.Team = EnumUtils.TryParseOr(p.team, true, Team.Unknown);
s.Player.Position = EnumUtils.TryParseOr(p.position, true, Position.Unknown);

s.Player.IsDead = p.isDead;
s.Player.RespawnTimer = p.respawnTimer;
Expand All @@ -144,10 +145,20 @@ public override void UpdateTick()
#endregion

#region Events
s.Match.BaronsKilled = allGameData.events.Events.Count(ev => ev.EventName.Contains("BaronKill"));
s.Match.HeraldsKilled = allGameData.events.Events.Count(ev => ev.EventName.Contains("HeraldKill"));
s.Match.DragonsKilled = allGameData.events.Events.Count(ev => ev.EventName.Contains("DragonKill"));
s.Match.TurretsKilled = allGameData.events.Events.Count(ev => ev.EventName.Contains("TurretKilled"));
var drags = allGameData.events.Events.OfType<_DragonKillEvent>();

s.Match.InfernalDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "fire");
s.Match.EarthDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "earth");
s.Match.OceanDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "water");
s.Match.CloudDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "air");
s.Match.ElderDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "elder");

s.Match.BaronsKilled = allGameData.events.Events.Count(ev => ev is _BaronKillEvent);
s.Match.HeraldsKilled = allGameData.events.Events.Count(ev => ev is _HeraldKillEvent);
s.Match.DragonsKilled = allGameData.events.Events.Count(ev => ev is _DragonKillEvent);
s.Match.TurretsKilled = allGameData.events.Events.Count(ev => ev is _TurretKillEvent);
s.Match.InhibsKilled = allGameData.events.Events.Count(ev => ev is _InhibKillEvent);
s.Match.MapTerrain = EnumUtils.TryParseOr(allGameData.gameData.mapTerrain, true, MapTerrain.Unknown);
#endregion

#region Items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void UserControl_Loaded(object sender, RoutedEventArgs e)

private void SetSettings()
{
this.championPicker.SelectedItem = Champion.Undefined;
this.championPicker.SelectedItem = Champion.None;
}

private void championPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class DefaultChampionColors
/// <returns></returns>
public static Dictionary<Champion, Color> GetDictionary() => new Dictionary<Champion, Color>()
{
[Champion.Undefined] = Color.FromArgb(120, 120, 120),
[Champion.None] = Color.FromArgb(120, 120, 120),
[Champion.Aatrox] = Color.FromArgb(237, 83, 79),
[Champion.Ahri] = Color.FromArgb(61, 76, 178),
[Champion.Akali] = Color.FromArgb(10, 115, 38),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public class LoLBackgroundLayerHandler : LayerHandler<LoLBackgroundLayerHandlerP
{

private readonly EffectLayer layer = new EffectLayer();
private Champion lastChampion = Champion.Undefined;
private Champion lastChampion = Champion.None;
private Color lastColor = Color.Transparent;
private int lastWidth;
private int lastHeight;

public override EffectLayer Render(IGameState gamestate)
{
var currentChampion = (gamestate as GSI.GameState_LoL)?.Player.Champion ?? Champion.Undefined;
var currentChampion = (gamestate as GSI.GameState_LoL)?.Player.Champion ?? Champion.None;
var currentColor = Properties.ChampionColors[currentChampion];
//if the player changes champion
//or if the color is adjusted in the UI
Expand Down
5 changes: 4 additions & 1 deletion Project-Aurora/Project-Aurora/Project-Aurora.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -2608,6 +2608,9 @@
<PackageReference Include="IronPython">
<Version>2.7.8.1</Version>
</PackageReference>
<PackageReference Include="JsonSubTypes">
<Version>1.7.0</Version>
</PackageReference>
<PackageReference Include="MouseKeyHook">
<Version>5.6.0</Version>
</PackageReference>
Expand Down

0 comments on commit 08dab3f

Please sign in to comment.