diff --git a/AntiGapcloser.cs b/AntiGapcloser.cs index ca6cff55..3a8476b4 100644 --- a/AntiGapcloser.cs +++ b/AntiGapcloser.cs @@ -32,6 +32,8 @@ namespace LeagueSharp.Common { using System.Diagnostics.CodeAnalysis; + using LeagueSharp.Data.DataTypes; + /// /// The delegate for the event. /// @@ -126,7 +128,7 @@ public static class AntiGapcloser /// /// The gapcloser spells /// - public static List Spells = new List(); + public static List Spells; /// /// The active gapclosers @@ -138,620 +140,20 @@ public static class AntiGapcloser /// static AntiGapcloser() { - #region Aatrox - - Spells.Add( - new Gapcloser - { - ChampionName = "Aatrox", - Slot = SpellSlot.Q, - SpellName = "aatroxq", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Akali - - Spells.Add( - new Gapcloser - { - ChampionName = "Akali", - Slot = SpellSlot.R, - SpellName = "akalishadowdance", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Alistar - - Spells.Add( - new Gapcloser - { - ChampionName = "Alistar", - Slot = SpellSlot.W, - SpellName = "headbutt", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Corki - - Spells.Add( - new Gapcloser - { - ChampionName = "Corki", - Slot = SpellSlot.W, - SpellName = "carpetbomb", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Diana - - Spells.Add( - new Gapcloser - { - ChampionName = "Diana", - Slot = SpellSlot.R, - SpellName = "dianateleport", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Ekko - Spells.Add( - new Gapcloser - { - ChampionName = "Ekko", - Slot = SpellSlot.E, - SpellName = "ekkoe", - SkillType = GapcloserType.Skillshot - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Ekko", - Slot = SpellSlot.E, - SpellName = "ekkoeattack", - SkillType = GapcloserType.Targeted - }); - #endregion - - #region Elise - - Spells.Add( - new Gapcloser - { - ChampionName = "Elise", - Slot = SpellSlot.Q, - SpellName = "elisespiderqcast", - SkillType = GapcloserType.Skillshot - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Elise", - Slot = SpellSlot.E, - SpellName = "elisespideredescent", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Fiora - - Spells.Add( - new Gapcloser - { - ChampionName = "Fiora", - Slot = SpellSlot.Q, - SpellName = "fioraq", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Fizz - - Spells.Add( - new Gapcloser - { - ChampionName = "Fizz", - Slot = SpellSlot.Q, - SpellName = "fizzpiercingstrike", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Gnar - - Spells.Add( - new Gapcloser - { - ChampionName = "Gnar", - Slot = SpellSlot.E, - SpellName = "gnarbige", - SkillType = GapcloserType.Skillshot - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Gnar", - Slot = SpellSlot.E, - SpellName = "gnare", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Gragas - - Spells.Add( - new Gapcloser - { - ChampionName = "Gragas", - Slot = SpellSlot.E, - SpellName = "gragase", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Graves - - Spells.Add( - new Gapcloser - { - ChampionName = "Graves", - Slot = SpellSlot.E, - SpellName = "gravesmove", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Hecarim - - Spells.Add( - new Gapcloser - { - ChampionName = "Hecarim", - Slot = SpellSlot.R, - SpellName = "hecarimult", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Illaoi - Spells.Add( - new Gapcloser - { - ChampionName = "Illaoi", - Slot = SpellSlot.W, - SpellName = "illaoiwattack", - SkillType = GapcloserType.Targeted - }); - #endregion - - - #region Irelia - - Spells.Add( - new Gapcloser - { - ChampionName = "Irelia", - Slot = SpellSlot.Q, - SpellName = "ireliagatotsu", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region JarvanIV - - Spells.Add( - new Gapcloser - { - ChampionName = "JarvanIV", - Slot = SpellSlot.Q, - SpellName = "jarvanivdragonstrike", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Jax - - Spells.Add( - new Gapcloser - { - ChampionName = "Jax", - Slot = SpellSlot.Q, - SpellName = "jaxleapstrike", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Jayce - - Spells.Add( - new Gapcloser - { - ChampionName = "Jayce", - Slot = SpellSlot.Q, - SpellName = "jaycetotheskies", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Kassadin - - Spells.Add( - new Gapcloser - { - ChampionName = "Kassadin", - Slot = SpellSlot.R, - SpellName = "riftwalk", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Khazix - - Spells.Add( - new Gapcloser - { - ChampionName = "Khazix", - Slot = SpellSlot.E, - SpellName = "khazixe", - SkillType = GapcloserType.Skillshot - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Khazix", - Slot = SpellSlot.E, - SpellName = "khazixelong", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Leblanc - - Spells.Add( - new Gapcloser - { - ChampionName = "Leblanc", - Slot = SpellSlot.W, - SpellName = "leblancslide", - SkillType = GapcloserType.Skillshot - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Leblanc", - Slot = SpellSlot.R, - SpellName = "leblancslidem", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region LeeSin - - Spells.Add( - new Gapcloser - { - ChampionName = "LeeSin", - Slot = SpellSlot.Q, - SpellName = "blindmonkqtwo", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Leona - - Spells.Add( - new Gapcloser - { - ChampionName = "Leona", - Slot = SpellSlot.E, - SpellName = "leonazenithblade", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Lucian - - Spells.Add( - new Gapcloser - { - ChampionName = "Lucian", - Slot = SpellSlot.E, - SpellName = "luciane", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Malphite - - Spells.Add( - new Gapcloser - { - ChampionName = "Malphite", - Slot = SpellSlot.R, - SpellName = "ufslash", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region MasterYi - - Spells.Add( - new Gapcloser - { - ChampionName = "MasterYi", - Slot = SpellSlot.Q, - SpellName = "alphastrike", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region MonkeyKing - - Spells.Add( - new Gapcloser - { - ChampionName = "MonkeyKing", - Slot = SpellSlot.E, - SpellName = "monkeykingnimbus", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Pantheon - - Spells.Add( - new Gapcloser - { - ChampionName = "Pantheon", - Slot = SpellSlot.W, - SpellName = "pantheon_leapbash", - SkillType = GapcloserType.Targeted - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Pantheon", - Slot = SpellSlot.R, - SpellName = "pantheonrjump", - SkillType = GapcloserType.Skillshot - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Pantheon", - Slot = SpellSlot.R, - SpellName = "pantheonrfall", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Poppy - - Spells.Add( - new Gapcloser - { - ChampionName = "Poppy", - Slot = SpellSlot.E, - SpellName = "poppyheroiccharge", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Renekton - - Spells.Add( - new Gapcloser - { - ChampionName = "Renekton", - Slot = SpellSlot.E, - SpellName = "renektonsliceanddice", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Riven - - Spells.Add( - new Gapcloser - { - ChampionName = "Riven", - Slot = SpellSlot.Q, - SpellName = "riventricleave", - SkillType = GapcloserType.Skillshot - }); - - Spells.Add( - new Gapcloser - { - ChampionName = "Riven", - Slot = SpellSlot.E, - SpellName = "rivenfeint", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Sejuani - - Spells.Add( - new Gapcloser - { - ChampionName = "Sejuani", - Slot = SpellSlot.Q, - SpellName = "sejuaniarcticassault", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Shen - - Spells.Add( - new Gapcloser - { - ChampionName = "Shen", - Slot = SpellSlot.E, - SpellName = "shenshadowdash", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Shyvana - - Spells.Add( - new Gapcloser - { - ChampionName = "Shyvana", - Slot = SpellSlot.R, - SpellName = "shyvanatransformcast", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Talon - - Spells.Add( - new Gapcloser - { - ChampionName = "Talon", - Slot = SpellSlot.E, - SpellName = "taloncutthroat", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Tristana - - Spells.Add( - new Gapcloser - { - ChampionName = "Tristana", - Slot = SpellSlot.W, - SpellName = "rocketjump", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Tryndamere - - Spells.Add( - new Gapcloser - { - ChampionName = "Tryndamere", - Slot = SpellSlot.E, - SpellName = "slashcast", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Vi - - Spells.Add( - new Gapcloser - { - ChampionName = "Vi", - Slot = SpellSlot.Q, - SpellName = "viq", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region XinZhao - - Spells.Add( - new Gapcloser - { - ChampionName = "XinZhao", - Slot = SpellSlot.E, - SpellName = "xenzhaosweep", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Yasuo - - Spells.Add( - new Gapcloser - { - ChampionName = "Yasuo", - Slot = SpellSlot.E, - SpellName = "yasuodashwrapper", - SkillType = GapcloserType.Targeted - }); - - #endregion - - #region Zac - - Spells.Add( - new Gapcloser - { - ChampionName = "Zac", - Slot = SpellSlot.E, - SpellName = "zace", - SkillType = GapcloserType.Skillshot - }); - - #endregion - - #region Ziggs - - Spells.Add( - new Gapcloser - { - ChampionName = "Ziggs", - Slot = SpellSlot.W, - SpellName = "ziggswtoggle", - SkillType = GapcloserType.Skillshot - }); - - #endregion + Spells = + LeagueSharp.Data.Data.Get() + .SpellsList.Select( + x => + new Gapcloser + { + ChampionName = x.Key, + SkillType = + x.Value.SkillType == LeagueSharp.Data.Enumerations.GapcloserType.Skillshot + ? GapcloserType.Skillshot + : GapcloserType.Targeted, + Slot = x.Value.Slot, SpellName = x.Value.SpellName + }) + .ToList(); Game.OnUpdate += Game_OnGameUpdate; Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast; diff --git a/Interrupter2.cs b/Interrupter2.cs index 35f4e069..96af4294 100644 --- a/Interrupter2.cs +++ b/Interrupter2.cs @@ -30,6 +30,8 @@ You should have received a copy of the GNU General Public License namespace LeagueSharp.Common { + using LeagueSharp.Data.DataTypes; + /// /// Provides information an API regarding interruptable spells. /// @@ -109,36 +111,17 @@ static Interrupter2() /// private static void InitializeSpells() { - #region Spells - - RegisterSpell("Caitlyn", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("FiddleSticks", new InterruptableSpell(SpellSlot.W, DangerLevel.Medium)); - RegisterSpell("FiddleSticks", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Galio", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Janna", new InterruptableSpell(SpellSlot.R, DangerLevel.Low)); - RegisterSpell("Karthus", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Katarina", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Lucian", new InterruptableSpell(SpellSlot.R, DangerLevel.High, false)); - RegisterSpell("Malzahar", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("MasterYi", new InterruptableSpell(SpellSlot.W, DangerLevel.Low)); - RegisterSpell("MissFortune", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Nunu", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Pantheon", new InterruptableSpell(SpellSlot.E, DangerLevel.Low)); - RegisterSpell("Pantheon", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Quinn", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("RekSai", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Sion", new InterruptableSpell(SpellSlot.R, DangerLevel.Low)); - RegisterSpell("Shen", new InterruptableSpell(SpellSlot.R, DangerLevel.Low)); - RegisterSpell("TahmKench", new InterruptableSpell(SpellSlot.R, DangerLevel.Medium)); - RegisterSpell("TwistedFate", new InterruptableSpell(SpellSlot.R, DangerLevel.Medium)); - RegisterSpell("Urgot", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Velkoz", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Warwick", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Xerath", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - RegisterSpell("Varus", new InterruptableSpell(SpellSlot.Q, DangerLevel.Low, false)); - RegisterSpell("Jhin", new InterruptableSpell(SpellSlot.R, DangerLevel.High)); - - #endregion + foreach (var keyValuePair in LeagueSharp.Data.Data.Get().InterruptableSpells) + { + foreach (var spell in keyValuePair.Value) + { + RegisterSpell( + keyValuePair.Key, + new InterruptableSpell( + spell.Slot, + (DangerLevel)Enum.Parse(typeof(DangerLevel), spell.DangerLevel.ToString()))); + } + } } /// diff --git a/LeagueSharp.Common.csproj b/LeagueSharp.Common.csproj index 1dee2283..116961ad 100644 --- a/LeagueSharp.Common.csproj +++ b/LeagueSharp.Common.csproj @@ -77,6 +77,9 @@ C:\Program Files (x86)\LeagueSharp\System\LeagueSharp.dll + + C:\Program Files (x86)\LeagueSharp\System\LeagueSharp.Data.dll + C:\Program Files (x86)\LeagueSharp\System\LeagueSharp.Sandbox.dll diff --git a/TargetSelector.cs b/TargetSelector.cs index b8d26f69..6f1aed26 100644 --- a/TargetSelector.cs +++ b/TargetSelector.cs @@ -32,6 +32,8 @@ You should have received a copy of the GNU General Public License namespace LeagueSharp.Common { + using LeagueSharp.Data.DataTypes; + public class TargetSelector { #region Enum @@ -174,53 +176,9 @@ public static float GetPriority(Obj_AI_Hero hero) private static int GetPriorityFromDb(string championName) { - string[] p1 = - { - "Alistar", "Amumu", "Bard", "Blitzcrank", "Braum", "Cho'Gath", "Dr. Mundo", "Garen", "Gnar", - "Hecarim", "Janna", "Jarvan IV", "Leona", "Lulu", "Malphite", "Nami", "Nasus", "Nautilus", "Nunu", - "Olaf", "Rammus", "Renekton", "Sejuani", "Shen", "Shyvana", "Singed", "Sion", "Skarner", "Sona", - "Taric", "TahmKench", "Thresh", "Volibear", "Warwick", "MonkeyKing", "Yorick", "Zac", "Zyra" - }; - - string[] p2 = - { - "Aatrox", "Darius", "Elise", "Evelynn", "Galio", "Gangplank", "Gragas", "Irelia", "Jax", - "Lee Sin", "Maokai", "Morgana", "Nocturne", "Pantheon", "Poppy", "Rengar", "Rumble", "Ryze", "Swain", - "Trundle", "Tryndamere", "Udyr", "Urgot", "Vi", "XinZhao", "RekSai" - }; - - string[] p3 = - { - "Akali", "Diana", "Ekko", "Fiddlesticks", "Fiora", "Fizz", "Heimerdinger", "Jayce", "Kassadin", - "Kayle", "Kha'Zix", "Lissandra", "Mordekaiser", "Nidalee", "Riven", "Shaco", "Vladimir", "Yasuo", - "Zilean" - }; - - string[] p4 = - { - "Ahri", "Anivia", "Annie", "Ashe", "Azir", "Brand", "Caitlyn", "Cassiopeia", "Corki", "Draven", - "Ezreal", "Graves", "Jinx", "Kalista", "Karma", "Karthus", "Katarina", "Kennen", "KogMaw", "Kindred", - "Leblanc", "Lucian", "Lux", "Malzahar", "MasterYi", "MissFortune", "Orianna", "Quinn", "Sivir", "Syndra", - "Talon", "Teemo", "Tristana", "TwistedFate", "Twitch", "Varus", "Vayne", "Veigar", "Velkoz", "Viktor", - "Xerath", "Zed", "Ziggs", "Jhin", "Soraka" - }; - - if (p1.Contains(championName)) - { - return 1; - } - if (p2.Contains(championName)) - { - return 2; - } - if (p3.Contains(championName)) - { - return 3; - } - return p4.Contains(championName) ? 4 : 1; + return LeagueSharp.Data.Data.Get().GetPriority(championName); } - internal static void Initialize() { CustomEvents.Game.OnGameLoad += args =>