diff --git a/.gitignore b/.gitignore index b06e864a..3a2238d6 100644 --- a/.gitignore +++ b/.gitignore @@ -15,15 +15,17 @@ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ -x64/ -x86/ -build/ +[Xx]64/ +[Xx]86/ +[Bb]uild/ bld/ [Bb]in/ [Oo]bj/ # Visual Studio 2015 cache/options directory .vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ # MSTest test Results [Tt]est[Rr]esult*/ @@ -74,14 +76,17 @@ _Chutzpah* ipch/ *.aps *.ncb +*.opendb *.opensdf *.sdf *.cachefile +*.VC.db # Visual Studio profiler *.psess *.vsp *.vspx +*.sap # TFS 2012 Local Workspace $tf/ @@ -106,6 +111,7 @@ _TeamCity* # NCrunch _NCrunch_* .*crunch*.local.xml +nCrunchTemp_* # MightyMoose *.mm.* @@ -133,11 +139,11 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -## TODO: Comment the next line if you want to checkin your -## web deploy settings but do note that will include unencrypted -## passwords -#*.pubxml +# TODO: Un-comment the next line if you do not want to checkin +# your web deploy settings because they may include unencrypted +# passwords +#*.pubxml *.publishproj # NuGet Packages @@ -148,13 +154,24 @@ publish/ !**/packages/build/ # Uncomment if necessary however generally it will be regenerated when needed #!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets -# Windows Azure Build Output +# Microsoft Azure Build Output csx/ *.build.csdef +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Microsoft Azure ApplicationInsights config file +ApplicationInsights.config + # Windows Store app package directory AppPackages/ +BundleArtifacts/ # Visual Studio cache files # files ending in .cache can be ignored @@ -197,6 +214,9 @@ UpgradeLog*.htm # Microsoft Fakes FakesAssemblies/ +# GhostDoc plugin setting file +*.GhostDoc.xml + # Node.js Tools for Visual Studio .ntvs_analysis.dat @@ -206,7 +226,20 @@ FakesAssemblies/ # Visual Studio 6 workspace options file *.opt +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + # LightSwitch generated files GeneratedArtifacts/ -_Pvt_Extensions/ ModelManifest.xml + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..66b5d062 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/SharpDX.Menu"] + path = external/SharpDX.Menu + url = https://github.com/L33T/SharpDX.Menu diff --git a/Alerter.cs b/Alerter.cs deleted file mode 100644 index 37841cb0..00000000 --- a/Alerter.cs +++ /dev/null @@ -1,131 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - - using SharpDX; - - /// - /// Shows text for an amount of time. - /// - public class Alerter : Render.Text - { - #region Fields - - private readonly float _duration; - - private readonly float _endTime; - - private readonly float _startTime; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The x. - /// The y. - /// The text. - /// The size. - /// The color. - /// Name of the face. - /// The duration. - public Alerter( - int x, - int y, - string text, - int size, - ColorBGRA color, - string faceName = "Calibri", - float duration = 1f) - : base(x, y, text, size, color, faceName) - { - this._duration = duration; - this._startTime = Utils.TickCount; - this._endTime = this._startTime + this._duration; - - Game.OnUpdate += this.Game_OnGameUpdate; - } - - #endregion - - #region Public Properties - - /// - /// Gets the duration. - /// - /// - /// The duration. - /// - public float Duration - { - get - { - return this._duration; - } - } - - /// - /// Gets the end time. - /// - /// - /// The end time. - /// - public float EndTime - { - get - { - return this._endTime; - } - } - - /// - /// Gets the start time. - /// - /// - /// The start time. - /// - public float StartTime - { - get - { - return this._startTime; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Removes this instance. - /// - public void Remove() - { - this.Visible = false; - this.Dispose(); - } - - #endregion - - #region Methods - - /// - /// Fired when the game updates. - /// - /// The instance containing the event data. - private void Game_OnGameUpdate(EventArgs args) - { - if (!(Utils.TickCount > this.EndTime)) - { - return; - } - - this.Visible = false; - this.Dispose(); - } - - #endregion - } -} \ No newline at end of file diff --git a/AntiGapcloser.cs b/AntiGapcloser.cs deleted file mode 100644 index af8d8262..00000000 --- a/AntiGapcloser.cs +++ /dev/null @@ -1,237 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using System.Linq; - - using LeagueSharp.Data.DataTypes; - - using SharpDX; - - /// - /// The delegate for the event. - /// - /// The gapcloser. - public delegate void OnGapcloseH(ActiveGapcloser gapcloser); - - /// - /// The type of gapcloser. - /// - public enum GapcloserType - { - /// - /// The gapcloser used a skillshot ability. - /// - [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", - Justification = "Reviewed. Suppression is OK here.")] - Skillshot, - - /// - /// The gapcloser used a targeted ability. - /// - Targeted - } - - /// - /// Represents a gapcloser. - /// - public struct Gapcloser - { - #region Fields - - /// - /// The champion name - /// - public string ChampionName; - - /// - /// The skill type - /// - public GapcloserType SkillType; - - /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The spell name - /// - public string SpellName; - - #endregion - } - - /// - /// Represents an active gapcloser. - /// - public struct ActiveGapcloser - { - #region Fields - - /// - /// The end - /// - public Vector3 End; - - /// - /// The sender - /// - public Obj_AI_Hero Sender; - - /// - /// The skill type - /// - public GapcloserType SkillType; - - /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The start - /// - public Vector3 Start; - - /// - /// The tick count - /// - public int TickCount; - - #endregion - } - - /// - /// Provides events and information about gapclosers. - /// - public static class AntiGapcloser - { - #region Static Fields - - /// - /// The active gapclosers - /// - public static List ActiveGapclosers = new List(); - - /// - /// The gapcloser spells - /// - public static List Spells; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static AntiGapcloser() - { - 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(); - - Initialize(); - } - - #endregion - - #region Public Events - - /// - /// Occurs on an incoming enemy gapcloser. - /// - public static event OnGapcloseH OnEnemyGapcloser; - - #endregion - - #region Public Methods and Operators - - public static void Initialize() - { - Game.OnUpdate += Game_OnGameUpdate; - Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast; - } - - public static void Shutdown() - { - Game.OnUpdate -= Game_OnGameUpdate; - Obj_AI_Base.OnProcessSpellCast -= Obj_AI_Base_OnProcessSpellCast; - } - - #endregion - - #region Methods - - /// - /// Fired when the game updates. - /// - /// The instance containing the event data. - private static void Game_OnGameUpdate(EventArgs args) - { - ActiveGapclosers.RemoveAll(entry => Utils.TickCount > entry.TickCount + 900); - if (OnEnemyGapcloser == null) - { - return; - } - - foreach (var gapcloser in - ActiveGapclosers.Where(gapcloser => gapcloser.Sender.IsValidTarget()) - .Where( - gapcloser => - gapcloser.SkillType == GapcloserType.Targeted - || (gapcloser.SkillType == GapcloserType.Skillshot - && ObjectManager.Player.Distance(gapcloser.Sender, true) < 250000))) // 500 * 500 - { - OnEnemyGapcloser(gapcloser); - } - } - - /// - /// Fired when the game processes a spell cast. - /// - /// The sender. - /// The instance containing the event data. - private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) - { - if (!SpellIsGapcloser(args)) - { - return; - } - - ActiveGapclosers.Add( - new ActiveGapcloser - { - Start = args.Start, End = args.End, Sender = (Obj_AI_Hero)sender, TickCount = Utils.TickCount, - SkillType = - (args.Target != null && args.Target.IsMe) ? GapcloserType.Targeted : GapcloserType.Skillshot, - Slot = ((Obj_AI_Hero)sender).GetSpellSlot(args.SData.Name) - }); - } - - /// - /// Checks if a spell is a gapcloser. - /// - /// The instance containing the event data. - /// - private static bool SpellIsGapcloser(GameObjectProcessSpellCastEventArgs args) - { - return Spells.Any(spell => spell.SpellName == args.SData.Name.ToLower()); - } - - #endregion - } -} \ No newline at end of file diff --git a/App.config b/App.config new file mode 100644 index 00000000..eb3a5db3 --- /dev/null +++ b/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BetterWebClient.cs b/BetterWebClient.cs deleted file mode 100644 index 774a3e9f..00000000 --- a/BetterWebClient.cs +++ /dev/null @@ -1,124 +0,0 @@ -//Taken from http://keestalkstech.com/2014/03/a-slightly-better-webclient-class/ - -namespace LeagueSharp.Common -{ - using System; - using System.Net; - - public class BetterWebClient : WebClient - { - #region Fields - - private WebRequest _request; - - #endregion - - #region Constructors and Destructors - - public BetterWebClient(CookieContainer cookies, bool autoRedirect = true) - { - this.CookieContainer = cookies ?? new CookieContainer(); - this.AutoRedirect = autoRedirect; - } - - #endregion - - #region Public Properties - - //Gets or sets whether to automatically follow a redirect - public bool AutoRedirect { get; set; } - - //Gets or sets the cookie container, contains all the - //cookies for all the requests - public CookieContainer CookieContainer { get; set; } - - //Gets last cookie header - public string Cookies - { - get - { - return this.GetHeaderValue("Set-Cookie"); - } - } - - public string Kappa - { - get - { - return "version5"; - } - } - - //Get last location header - public string Location - { - get - { - return this.GetHeaderValue("Location"); - } - } - - //Get last status code - public HttpStatusCode StatusCode - { - get - { - var result = HttpStatusCode.BadRequest; - - if (this._request != null) - { - var response = this.GetWebResponse(this._request) as HttpWebResponse; - - if (response != null) - { - result = response.StatusCode; - } - } - - return result; - } - } - - #endregion - - #region Public Methods and Operators - - public string GetHeaderValue(string headerName) - { - string result = null; - - if (this._request != null) - { - var response = this.GetWebResponse(this._request) as HttpWebResponse; - if (response != null) - { - result = response.Headers[headerName]; - } - } - - return result; - } - - #endregion - - #region Methods - - protected override WebRequest GetWebRequest(Uri address) - { - this._request = base.GetWebRequest(address); - - var httpRequest = this._request as HttpWebRequest; - - if (httpRequest != null) - { - httpRequest.AllowAutoRedirect = this.AutoRedirect; - httpRequest.CookieContainer = this.CookieContainer; - httpRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; - } - - return this._request; - } - - #endregion - } -} \ No newline at end of file diff --git a/Config.cs b/Config.cs deleted file mode 100644 index 973ce60c..00000000 --- a/Config.cs +++ /dev/null @@ -1,180 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Globalization; - using System.IO; - using System.Security.Permissions; - using System.Threading; - - using LeagueSharp.Sandbox; - - /// - /// Gets information about the L# system. - /// - public static class Config - { - #region Static Fields - - /// - /// The app data directory - /// - private static string _appDataDirectory; - - /// - /// The league sharp directory - /// - private static string _leagueSharpDirectory; - - /// - /// The selected language - /// - private static string _selectedLanguage; - - /// - /// The show menu hotkey - /// - private static byte _showMenuHotkey; - - /// - /// The show menu toggle hotkey - /// - private static byte _showMenuToggleHotkey; - - #endregion - - #region Constructors and Destructors - - [PermissionSet(SecurityAction.Assert, Unrestricted = true)] - static Config() - { - CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; - CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; - Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; - } - - #endregion - - #region Public Properties - - /// - /// Gets the application data directory. - /// - /// - /// The application data directory. - /// - public static string AppDataDirectory - { - get - { - if (_appDataDirectory == null) - { - _appDataDirectory = - Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), - "LS" + Environment.UserName.GetHashCode().ToString("X")); - } - - return _appDataDirectory; - } - } - - /// - /// Gets the selected language. - /// - /// - /// The selected language. - /// - public static string SelectedLanguage - { - get - { - if (_selectedLanguage == null) - { - try - { - _selectedLanguage = SandboxConfig.SelectedLanguage; - if (_selectedLanguage == "Traditional-Chinese") - { - _selectedLanguage = "Chinese"; - } - - if (_selectedLanguage.StartsWith("zh")) - { - _selectedLanguage = "Chinese"; - } - } - catch (Exception) - { - _selectedLanguage = ""; - Console.WriteLine(@"Could not get the menu language"); - } - } - - return _selectedLanguage; - } - } - - /// - /// Gets the show menu press key. - /// - /// - /// The show menu press key. - /// - public static byte ShowMenuPressKey - { - get - { - if (_showMenuHotkey == 0) - { - try - { - _showMenuHotkey = (byte)SandboxConfig.MenuKey; - _showMenuHotkey = _showMenuHotkey == 0 ? (byte)16 : _showMenuHotkey; - _showMenuHotkey = Utils.FixVirtualKey(_showMenuHotkey); - Console.WriteLine(@"Menu press key set to {0}", _showMenuHotkey); - } - catch - { - _showMenuHotkey = 16; - Console.WriteLine(@"Could not get the menu press key"); - } - } - - return _showMenuHotkey; - } - } - - /// - /// Gets the show menu toggle key. - /// - /// - /// The show menu toggle key. - /// - public static byte ShowMenuToggleKey - { - get - { - if (_showMenuToggleHotkey == 0) - { - try - { - _showMenuToggleHotkey = (byte)SandboxConfig.MenuToggleKey; - _showMenuToggleHotkey = _showMenuToggleHotkey == 0 ? (byte)120 : _showMenuToggleHotkey; - _showMenuToggleHotkey = Utils.FixVirtualKey(_showMenuToggleHotkey); - Console.WriteLine(@"Menu toggle key set to {0}", _showMenuToggleHotkey); - } - catch - { - _showMenuToggleHotkey = 120; - Console.WriteLine(@"Could not get the menu toggle key"); - } - } - - return _showMenuToggleHotkey; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/CustomEvents.cs b/CustomEvents.cs deleted file mode 100644 index e5d8e6b5..00000000 --- a/CustomEvents.cs +++ /dev/null @@ -1,326 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - /// - /// Provides custom events. - /// - public static class CustomEvents - { - /// - /// Provides custom events regarding the game. - /// - public class Game - { - #region Static Fields - - /// - /// The nexus list - /// - private static readonly List NexusList = new List(); - - /// - /// The notified subscribers - /// - private static readonly List NotifiedSubscribers = new List(); - - /// - /// The end game called - /// - private static bool _endGameCalled; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static Game() - { - Utility.DelayAction.Add(0, Initialize); - } - - #endregion - - #region Delegates - - /// - /// The delegate for - /// - /// The instance containing the event data. - public delegate void OnGameEnded(EventArgs args); - - /// - /// The delegate for - /// - /// The instance containing the event data. - public delegate void OnGameLoaded(EventArgs args); - - #endregion - - #region Public Events - - /// - /// Occurs when the game ends. This is meant as a better replacement to . - /// - public static event OnGameEnded OnGameEnd; - - /// - /// Occurs when the game loads. This will be fired if the game is already loaded. - /// - public static event OnGameLoaded OnGameLoad; - - #endregion - - #region Public Methods and Operators - - /// - /// Initializes this instance. - /// - public static void Initialize() - { - foreach (var hq in ObjectManager.Get().Where(hq => hq.IsValid)) - { - NexusList.Add(hq); - } - - if (LeagueSharp.Game.Mode == GameMode.Running) - { - //Otherwise the .ctor didn't return yet and no callback will occur - Utility.DelayAction.Add(500, () => { Game_OnGameStart(new EventArgs()); }); - } - else - { - LeagueSharp.Game.OnStart += Game_OnGameStart; - } - } - - #endregion - - #region Methods - - /// - /// Fired when the game is started. - /// - /// The instance containing the event data. - private static void Game_OnGameStart(EventArgs args) - { - LeagueSharp.Game.OnUpdate += Game_OnGameUpdate; - - if (OnGameLoad != null) - { - foreach ( - var subscriber in OnGameLoad.GetInvocationList().Where(s => !NotifiedSubscribers.Contains(s))) - { - NotifiedSubscribers.Add(subscriber); - try - { - subscriber.DynamicInvoke(new EventArgs()); - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - } - } - - /// - /// Fired when the game updates. - /// - /// The instance containing the event data. - private static void Game_OnGameUpdate(EventArgs args) - { - if (OnGameLoad != null) - { - foreach ( - var subscriber in OnGameLoad.GetInvocationList().Where(s => !NotifiedSubscribers.Contains(s))) - { - NotifiedSubscribers.Add(subscriber); - try - { - subscriber.DynamicInvoke(new EventArgs()); - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - } - - if (NexusList.Count == 0 || _endGameCalled) - { - return; - } - - foreach (var nexus in NexusList) - { - if (nexus != null && nexus.IsValid && nexus.Health <= 0) - { - if (OnGameEnd != null) - { - OnGameEnd(new EventArgs()); - _endGameCalled = true; // Don't spam the event. - } - } - } - } - - #endregion - } - - /// - /// Provides custom events regarding units. - /// - public class Unit - { - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static Unit() - { - LeagueSharp.Game.OnProcessPacket += PacketHandler; - - //Initializes ondash class: - ObjectManager.Player.IsDashing(); - } - - #endregion - - #region Delegates - - /// - /// The delegate for - /// - /// The sender. - /// The arguments. - public delegate void OnDashed(Obj_AI_Base sender, Dash.DashItem args); - - /// - /// The delegate for - /// - /// The sender. - /// The instance containing the event data. - public delegate void OnLeveledUp(Obj_AI_Base sender, OnLevelUpEventArgs args); - - /// - /// The delegate for - /// - /// The sender. - /// The instance containing the event data. - public delegate void OnLeveledUpSpell(Obj_AI_Base sender, OnLevelUpSpellEventArgs args); - - #endregion - - #region Public Events - - /// - /// Occurs when a unit dashes. - /// - public static event OnDashed OnDash; - - /// - /// Occurs when a unit levels up. - /// - public static event OnLeveledUp OnLevelUp; - - /// - /// Occurs when the player levels up a spell. - /// - public static event OnLeveledUpSpell OnLevelUpSpell; - - #endregion - - #region Public Methods and Operators - - /// - /// Triggers the on dash. - /// - /// The sender. - /// The arguments. - public static void TriggerOnDash(Obj_AI_Base sender, Dash.DashItem args) - { - var dashHandler = OnDash; - if (dashHandler != null) - { - dashHandler(sender, args); - } - } - - #endregion - - #region Methods - - /// - /// Handles packets. - /// - /// The instance containing the event data. - private static void PacketHandler(GamePacketEventArgs args) - { - } - - #endregion - - /// - /// The event arguments for the event. - /// - public class OnLevelUpEventArgs : EventArgs - { - #region Fields - - /// - /// The new level - /// - public int NewLevel; - - /// - /// The remaining points - /// - public int RemainingPoints; - - #endregion - } - - /// - /// The event arguments for the event. - /// - public class OnLevelUpSpellEventArgs : EventArgs - { - #region Fields - - /// - /// The remainingpoints - /// - public int Remainingpoints; - - /// - /// The spell identifier - /// - public int SpellId; - - /// - /// The spell level - /// - public int SpellLevel; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - internal OnLevelUpSpellEventArgs() - { - } - - #endregion - } - } - } -} \ No newline at end of file diff --git a/Damage.cs b/Damage.cs deleted file mode 100644 index 0e249b7b..00000000 --- a/Damage.cs +++ /dev/null @@ -1,7775 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LeagueSharp.Common.Data; - - /// - /// Gets the damage done to a target. - /// - /// The source. - /// The target. - /// The level. - /// - public delegate double SpellDamageDelegate(Obj_AI_Base source, Obj_AI_Base target, int level); - - /// - /// Represents a spell that deals damage. - /// - public class DamageSpell - { - #region Fields - - /// - /// The calculated damage - /// - public double CalculatedDamage; - - /// - /// The damage delegate - /// - public SpellDamageDelegate Damage; - - /// - /// The damage type - /// - public Damage.DamageType DamageType; - - /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The stage - /// - public int Stage; - - #endregion - } - - /// - /// Calculates damage to units. - /// - public static class Damage - { - #region Static Fields - - /// - /// The spells - /// - public static Dictionary> Spells = - new Dictionary>(StringComparer.OrdinalIgnoreCase); - - /// - /// The attack passives - /// - private static readonly List AttackPassives = new List(); - - #endregion - - #region Constructors and Destructors - - //attack passives are handled in the orbwalker, it will be changed in the future :^) - - /// - /// Initializes static members of the class. - /// - static Damage() - { - //Add the passive damages - PassiveDamage p; - - #region PassiveDamages - - #region Aatrox - - p = new PassiveDamage - { - ChampionName = "Aatrox", - IsActive = - (source, target) => (source.HasBuff("AatroxWPower") && source.HasBuff("AatroxWONHPowerBuff")), - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.W)), - }; - AttackPassives.Add(p); - - #endregion - - #region Akali - - p = new PassiveDamage - { - ChampionName = "Akali", IsActive = (source, target) => true, - GetDamage = - (source, target) => - (float) - source.CalcDamage( - target, - DamageType.Magical, - (0.06 + Math.Abs(source.TotalMagicalDamage / 100) * 0.16667) * source.TotalAttackDamage) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Akali", IsActive = (source, target) => target.HasBuff("AkaliMota"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q, 1) - }; - - AttackPassives.Add(p); - - #endregion - - #region Alistar - - p = new PassiveDamage - { - ChampionName = "Alistar", IsActive = (source, target) => (source.HasBuff("alistartrample")), - GetDamage = - (source, target) => - (float) - source.CalcDamage( - target, - DamageType.Magical, - 6d + source.Level + 0.1d * source.TotalMagicalDamage), - }; - AttackPassives.Add(p); - - #endregion - - #region Ashe - - p = new PassiveDamage - { - ChampionName = "Ashe", IsActive = (source, target) => target.HasBuff("ashepassiveslow"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - source.TotalAttackDamage * (0.1 + (source.Crit * (1 + source.CritDamageMultiplier)))) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Ashe", IsActive = (source, target) => source.HasBuff("asheqattack"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Bard - - p = new PassiveDamage - { - ChampionName = "Bard", - IsActive = (source, target) => source.GetBuffCount("bardpspiritammocount") > 0, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - new[] { 30, 55, 80, 110, 140, 175, 210, 245, 280, 315, 345, 375, 400, 425, 445, 465 }[ - Math.Min(source.GetBuffCount("bardpdisplaychimecount") / 10, 15)] - + (source.GetBuffCount("bardpdisplaychimecount") > 150 - ? Math.Truncate((source.GetBuffCount("bardpdisplaychimecount") - 150) / 5d) * 20 - : 0) + 0.3 * source.TotalMagicalDamage) - }; - - AttackPassives.Add(p); - - #endregion - - #region Blatzcrink - - p = new PassiveDamage - { - ChampionName = "Blitzcrank", IsActive = (source, target) => source.HasBuff("PowerFist"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E) - }; - - AttackPassives.Add(p); - - #endregion - - #region Braum - - p = new PassiveDamage - { - ChampionName = "Braum", IsActive = (source, target) => source.HasBuff("braummarkstunreduction"), - GetDamage = - (source, target) => source.CalcDamage(target, DamageType.Magical, 6.4 + (1.6 * source.Level)) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = string.Empty, IsActive = (source, target) => target.GetBuffCount("braummark") == 3, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - 32 + (8 * ((Obj_AI_Hero)target.GetBuff("braummark").Caster).Level)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Caitlyn - - p = new PassiveDamage - { - ChampionName = "Caitlyn", IsActive = (source, target) => (source.HasBuff("caitlynheadshot")), - GetDamage = - (source, target) => - ((float) - source.CalcDamage( - target, - DamageType.Physical, - 1.5d * (source.BaseAttackDamage + source.FlatPhysicalDamageMod))), - }; - - AttackPassives.Add(p); - - #endregion - - #region ChoGath - - p = new PassiveDamage - { - ChampionName = "ChoGath", IsActive = (source, target) => source.HasBuff("VorpalSpikes"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E) - }; - - AttackPassives.Add(p); - - #endregion - - #region Darius - - p = new PassiveDamage - { - ChampionName = "Darius", IsActive = (source, target) => true, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - ((9 + source.Level + (source.FlatPhysicalDamageMod * 0.3)) - * Math.Min(target.GetBuffCount("dariushemo") + 1, 5)) - * (target.Type == GameObjectType.obj_AI_Minion ? 0.25 : 1)) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Darius", IsActive = (source, target) => source.HasBuff("DariusNoxianTacticsONH"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region Dianna - - p = new PassiveDamage - { - ChampionName = "Diana", IsActive = (source, target) => source.HasBuff("dianaarcready"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - 15 - + ((source.Level < 6 - ? 5 - : (source.Level < 11 - ? 10 - : (source.Level < 14 ? 15 : (source.Level < 16 ? 20 : 25)))) * source.Level) - + (source.TotalMagicalDamage * 0.8)) - }; - - #endregion - - #region DrMundo - - p = new PassiveDamage - { - ChampionName = "DrMundo", IsActive = (source, target) => source.HasBuff("Masochism"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E) - }; - - AttackPassives.Add(p); - - #endregion - - #region Draven - - p = new PassiveDamage - { - ChampionName = "Draven", IsActive = (source, target) => (source.HasBuff("DravenSpinning")), - GetDamage = - (source, target) => - ((float) - source.CalcDamage( - target, - DamageType.Physical, - 0.45d * (source.BaseAttackDamage + source.FlatPhysicalDamageMod))), - }; - - AttackPassives.Add(p); - - #endregion - - #region Ekko - - p = new PassiveDamage - { - ChampionName = "Ekko", IsActive = (source, target) => (target.GetBuffCount("EkkoStacks") == 2), - GetDamage = - (source, target) => - (float) - source.CalcDamage( - target, - DamageType.Magical, - 10 + (source.Level * 10) + (source.TotalMagicalDamage * 0.8)), - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Ekko", IsActive = (source, target) => (target.HealthPercent < 30), - GetDamage = (source, target) => - { - var dmg = - (float) - source.CalcDamage( - target, - DamageType.Magical, - (target.MaxHealth - target.Health) - * (5 + Math.Floor(source.TotalMagicalDamage / 100) * 2.2f) / 100); - if (!(target is Obj_AI_Hero) && dmg > 150f) dmg = 150f; - return dmg; - } - }; - AttackPassives.Add(p); - - #endregion - - #region Fizz - - p = new PassiveDamage - { - ChampionName = "Fizz", IsActive = (source, target) => source.GetSpell(SpellSlot.W).Level > 0, - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) / 6 - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Fizz", IsActive = (source, target) => source.HasBuff("FizzSeastonePassive"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - /* - #region Gangplank - - p = new PassiveDamage - { - ChampionName = "Gangplank", - IsActive = (source, target) => source.HasBuff("gangplankpassiveattack"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.True, - 20 + (10 * source.Level) + source.FlatPhysicalDamageMod) - }; - - AttackPassives.Add(p); - - #endregion -*/ - - #region Garen - - p = new PassiveDamage - { - ChampionName = "Garen", IsActive = (source, target) => source.HasBuff("GarenQ"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Gnar - - p = new PassiveDamage - { - ChampionName = "Gnar", IsActive = (source, target) => (target.GetBuffCount("gnarwproc") == 2), - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.W)), - }; - AttackPassives.Add(p); - - #endregion - - #region Gragas - - p = new PassiveDamage - { - ChampionName = "Gragas", IsActive = (source, target) => source.HasBuff("gragaswattackbuff"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region Graves - - p = new PassiveDamage - { - ChampionName = "Graves", IsActive = (source, target) => true, - GetDamage = - (source, target) => - (float) - (((72 + 3 * source.Level) / 100f) - * source.CalcDamage(target, DamageType.Physical, source.TotalAttackDamage) - - source.CalcDamage(target, DamageType.Physical, source.TotalAttackDamage)), - }; - AttackPassives.Add(p); - - #endregion - - #region Hecarim - - p = new PassiveDamage - { - ChampionName = "Hecarim", IsActive = (source, target) => source.HasBuff("hecarimrampspeed"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E) - }; - - AttackPassives.Add(p); - - #endregion - - #region Illaoi - - p = new PassiveDamage - { - ChampionName = "Illaoi", IsActive = (source, target) => source.HasBuff("IllaoiW"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region Irelia - - p = new PassiveDamage - { - ChampionName = "Irelia", IsActive = (source, target) => source.HasBuff("ireliahitenstylecharged"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region JarvanIV - - p = new PassiveDamage - { - ChampionName = "JarvanIV", - IsActive = (source, target) => !target.HasBuff("jarvanivmartialcadencecheck"), - GetDamage = - (source, target) => - source.CalcDamage(target, DamageType.Physical, Math.Min(target.Health * 0.1, 400)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Jax - - p = new PassiveDamage - { - ChampionName = "Jax", IsActive = (source, target) => source.HasBuff("JaxEmpowerTwo"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region Jayce - - p = new PassiveDamage - { - ChampionName = "Jayce", - IsActive = - (source, target) => - Math.Abs(source.Crit - 1) < float.Epsilon && !source.HasBuff("jaycehypercharge"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - source.GetCritMultiplier() * source.TotalAttackDamage) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Jayce", IsActive = (source, target) => source.HasBuff("jaycehypercharge"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W, 1) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Jayce", IsActive = (source, target) => source.HasBuff("jaycepassivemeleeattack"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.R) - }; - - AttackPassives.Add(p); - - #endregion - - #region Jhin - - p = new PassiveDamage - { - ChampionName = "Jhin", IsActive = (source, target) => (source.HasBuff("jhinpassiveattackbuff")), - GetDamage = - (source, target) => - ((float) - source.CalcDamage( - target, - DamageType.Physical, - source.TotalAttackDamage * 0.5f - + (target.MaxHealth - target.Health) - * new float[] { 0.15f, 0.20f, 0.25f }[Math.Min(2, (source.Level - 1) / 5)])), - }; - AttackPassives.Add(p); - - p = new PassiveDamage() - { - ChampionName = "Jhin", IsActive = (source, target) => Math.Abs(source.Crit - 1) < float.Epsilon, - GetDamage = - (source, target) => - (float) - source.CalcDamage( - target, - DamageType.Physical, - (Items.HasItem((int)ItemId.Infinity_Edge, source) ? 0.875 : 0.5) - * (source.TotalAttackDamage - * (1 - + (new[] { 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 40 }[ - source.Level - 1] + (Math.Floor(source.Crit * 100 / 10) * 4) - + (Math.Floor((source.AttackSpeedMod - 1) * 100 / 10) * 2.5)) / 100))) - }; - - AttackPassives.Add(p); - - #endregion - - #region Jinx - - p = new PassiveDamage - { - ChampionName = "Jinx", IsActive = (source, target) => (source.HasBuff("JinxQ")), - GetDamage = - (source, target) => - ((float) - source.CalcDamage( - target, - DamageType.Physical, - 0.1d * (source.BaseAttackDamage + source.FlatPhysicalDamageMod))), - }; - AttackPassives.Add(p); - - #endregion - - #region Kalista - - p = new PassiveDamage - { - ChampionName = "Kalista", - IsActive = (source, target) => target.HasBuff("kalistacoopstrikemarkally"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = string.Empty, - IsActive = - (source, target) => - target.HasBuff("kalistacoopstrikemarkbuff") && source.HasBuff("kalistacoopstrikeally"), - GetDamage = - (source, target) => - ((Obj_AI_Hero)target.GetBuff("kalistacoopstrikemarkbuff").Caster).GetSpellDamage( - target, - SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region Kassadin - - p = new PassiveDamage - { - ChampionName = "Kassadin", IsActive = (source, target) => source.GetSpell(SpellSlot.W).Level > 0, - GetDamage = - (source, target) => - source.GetSpellDamage(target, SpellSlot.W, source.HasBuff("NetherBlade") ? 1 : 0) - }; - - #endregion - - #region Katarina - - p = new PassiveDamage - { - ChampionName = "Katarina", IsActive = (source, target) => (target.HasBuff("katarinaqmark")), - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.Q, 1)), - }; - AttackPassives.Add(p); - - #endregion - - #region Kayle - - p = new PassiveDamage - { - ChampionName = "Kayle", IsActive = (source, target) => source.GetSpell(SpellSlot.E).Level > 0, - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E) - }; - - AttackPassives.Add(p); - - #endregion - - #region Kennen - - p = new PassiveDamage - { - ChampionName = "Kennen", IsActive = (source, target) => source.HasBuff("kennendoublestrikelive"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region KhaZix - - p = new PassiveDamage - { - ChampionName = "KhaZix", - IsActive = - (source, target) => - source.HasBuff("khazixpdamage") && target.Type == GameObjectType.obj_AI_Hero, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - 10 - + ((source.Level < 6 ? 5 : (source.Level < 11 ? 10 : (source.Level < 14 ? 15 : 20))) - * source.Level) + (0.5 * source.TotalMagicalDamage)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Kindred - - p = new PassiveDamage - { - ChampionName = "Kindred", - IsActive = - (source, target) => - source.HasBuff("KindredLegendPassive") - && source.GetBuffCount("kindredmarkofthekindredstackcounter") > 0, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - Math.Min( - (0.125 * source.GetBuffCount("kindredmarkofthekindredstackcounter")) * target.Health, - target is Obj_AI_Minion - ? 75 + (10 * source.GetBuffCount("kindredmarkofthekindredstackcounter")) - : target.MaxHealth)) - }; - - AttackPassives.Add(p); - - #endregion - - #region KogMaw - - p = new PassiveDamage - { - ChampionName = "KogMaw", IsActive = (source, target) => (source.HasBuff("KogMawBioArcaneBarrage")), - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.W)), - }; - AttackPassives.Add(p); - - #endregion - - #region Leona - - p = new PassiveDamage - { - ChampionName = string.Empty, - IsActive = - (source, target) => - target.HasBuff("leonasunlight") - && target.GetBuff("leonasunlight").Caster.NetworkId != source.NetworkId, - GetDamage = (source, target) => - { - var lvl = ((Obj_AI_Hero)target.GetBuff("leonasunlight").Caster).Level - 1; - if ((lvl / 2) % 1 > 0) - { - lvl -= 1; - } - return source.CalcDamage(target, DamageType.Magical, 20 + (15 * lvl / 2)); - } - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Leona", IsActive = (source, target) => source.HasBuff("LeonaShieldOfDaybreak"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Lucian - - p = new PassiveDamage - { - ChampionName = "Lucian", IsActive = (source, target) => source.HasBuff("lucianpassivebuff"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - ((target.Type == GameObjectType.obj_AI_Minion - ? 1 - : (source.Level < 6 - ? 0.3 - : (source.Level < 11 ? 0.4 : (source.Level < 16 ? 0.5 : 0.6)))) - * source.TotalAttackDamage) * source.GetCritMultiplier(true)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Lux - - p = new PassiveDamage - { - ChampionName = "Lux", IsActive = (source, target) => target.HasBuff("LuxIlluminatingFraulein"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - 10 + (8 * source.Level) + (0.2 * source.TotalMagicalDamage)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Malphite - - p = new PassiveDamage - { - ChampionName = "Malphite", IsActive = (source, target) => source.HasBuff("malphitecleave"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region MasterYi - - p = new PassiveDamage - { - ChampionName = "MasterYi", IsActive = (source, target) => source.HasBuff("doublestrike"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - (0.5 * source.TotalAttackDamage) * source.GetCritMultiplier(true)) - }; - - AttackPassives.Add(p); - - #endregion - - #region MonkeyKing - - p = new PassiveDamage - { - ChampionName = "MonkeyKing", - IsActive = (source, target) => source.HasBuff("MonkeyKingDoubleAttack"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Mordekaiser - - p = new PassiveDamage - { - ChampionName = "Mordekaiser", - IsActive = (source, target) => source.Buffs.Any(x => x.Name.Contains("mordekaisermaceofspades")), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Nami - - p = new PassiveDamage - { - ChampionName = string.Empty, IsActive = (source, target) => source.HasBuff("NamiE"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - new[] { 25, 40, 55, 70, 85 }[ - ((Obj_AI_Hero)source.GetBuff("NamiE").Caster).Spellbook.GetSpell(SpellSlot.E).Level - - 1] + (0.2 * ((Obj_AI_Hero)source.GetBuff("NamiE").Caster).TotalMagicalDamage)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Nasus - - p = new PassiveDamage - { - ChampionName = "Nasus", IsActive = (source, target) => (source.HasBuff("NasusQ")), - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.Q)), - }; - AttackPassives.Add(p); - - #endregion - - #region Nautilus - - p = new PassiveDamage - { - ChampionName = "Nautilus", IsActive = (source, target) => !target.HasBuff("nautiluspassivecheck"), - GetDamage = - (source, target) => source.CalcDamage(target, DamageType.Magical, 2 + (6 * source.Level)) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Nautilus", - IsActive = (source, target) => source.HasBuff("nautiluspiercinggazeshield"), - GetDamage = - (source, target) => - source.GetSpellDamage(target, SpellSlot.W) - / (target.Type == GameObjectType.obj_AI_Hero ? 1 : 2) - }; - - AttackPassives.Add(p); - - #endregion - - #region Nidalee - - p = new PassiveDamage - { - ChampionName = "Nidalee", IsActive = (source, target) => source.HasBuff("Takedown"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q, 1) - }; - - AttackPassives.Add(p); - - #endregion - - #region Noctune - - p = new PassiveDamage - { - ChampionName = "Nocturne", IsActive = (source, target) => source.HasBuff("nocturneumbrablades"), - GetDamage = - (source, target) => - source.CalcDamage(target, DamageType.Physical, 0.2 * source.TotalAttackDamage) - }; - - AttackPassives.Add(p); - - #endregion - - #region Nunu - - p = new PassiveDamage - { - ChampionName = "Nunu", IsActive = (source, target) => source.HasBuff("nunuqbufflizard"), - GetDamage = - (source, target) => source.CalcDamage(target, DamageType.Magical, 0.01 * source.MaxHealth) - }; - - AttackPassives.Add(p); - - #endregion - - #region Orianna - - p = new PassiveDamage - { - ChampionName = "Orianna", IsActive = (source, target) => (source.HasBuff("orianaspellsword")), - GetDamage = - (source, target) => - (float) - source.CalcDamage( - target, - DamageType.Magical, - (float)0.15 * source.TotalMagicalDamage - + new float[] { 10, 10, 10, 18, 18, 18, 26, 26, 26, 34, 34, 34, 42, 42, 42, 50, 50, 50 }[ - source.Level - 1]), - }; - AttackPassives.Add(p); - - #endregion - - #region Pantheon - - p = new PassiveDamage - { - ChampionName = "Pantheon", - IsActive = - (source, target) => - (target.HealthPercent < 15 && source.Spellbook.GetSpell(SpellSlot.E).Level > 0) - || Math.Abs(source.Crit - 1) < float.Epsilon, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - source.GetCritMultiplier() * source.TotalAttackDamage) - }; - - AttackPassives.Add(p); - - #endregion - - #region Poppy - - p = new PassiveDamage - { - ChampionName = "Poppy", IsActive = (source, target) => source.HasBuff("PoppyPassiveBuff"), - GetDamage = - (source, target) => source.CalcDamage(target, DamageType.Physical, 10 + (10 * source.Level)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Quinn - - p = new PassiveDamage - { - ChampionName = "Quinn", IsActive = (source, target) => (target.HasBuff("quinnw")), - GetDamage = - (source, target) => - ((float)source.CalcDamage(target, DamageType.Physical, 0.5d * source.TotalAttackDamage)), - }; - AttackPassives.Add(p); - - #endregion - - #region RekSai - - p = new PassiveDamage - { - ChampionName = "RekSai", IsActive = (source, target) => source.HasBuff("RekSaiq"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Renekton - - p = new PassiveDamage - { - ChampionName = "Renekton", IsActive = (source, target) => source.HasBuff("RenektonPreExecute"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Rengar - - p = new PassiveDamage - { - ChampionName = "Rengar", IsActive = (source, target) => source.HasBuff("rengarqbase"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Rengar", IsActive = (source, target) => source.HasBuff("rengarqemp"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q, 1) - }; - - AttackPassives.Add(p); - - #endregion - - #region Riven - - p = new PassiveDamage - { - ChampionName = "Riven", - IsActive = (source, target) => source.GetBuffCount("rivenpassiveaaboost") > 0, - GetDamage = - (source, target) => - ((float) - source.CalcDamage( - target, - DamageType.Physical, - (source.Level < 3 - ? 0.25 - : (source.Level < 6 - ? 0.29167 - : (source.Level < 9 - ? 0.3333 - : (source.Level < 12 - ? 0.375 - : (source.Level < 15 - ? 0.4167 - : (source.Level < 18 ? 0.4583 : 0.5)))))) - * source.TotalAttackDamage)), - }; - - AttackPassives.Add(p); - - #endregion - - #region Rumble - - p = new PassiveDamage - { - ChampionName = "Rumble", IsActive = (source, target) => source.HasBuff("rumbleoverheat"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - 0 + (5 * source.Level) + (0.3 * source.TotalMagicalDamage)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Sejuani - - p = new PassiveDamage - { - ChampionName = "Sejuani", - IsActive = (source, target) => source.HasBuff("sejuaninorthernwindsenrage"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region Shaco - - p = new PassiveDamage - { - ChampionName = "Shaco", - IsActive = - (source, target) => Math.Abs(source.Crit - 1) < float.Epsilon && !source.HasBuff("Deceive"), - GetDamage = (source, target) => source.GetCritMultiplier() * source.TotalAttackDamage - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Shaco", - IsActive = (source, target) => source.IsFacing(target) && !source.IsFacing(target), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - (source.TotalAttackDamage * 0.2) * source.GetCritMultiplier(true)) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Shaco", IsActive = (source, target) => source.HasBuff("Deceive"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - (source.GetCritMultiplier() - + new[] { -0.6, -0.4, -0.2, 0, 0.2 }[source.Spellbook.GetSpell(SpellSlot.Q).Level - 1]) - * source.TotalAttackDamage) - }; - - AttackPassives.Add(p); - - #endregion - - #region Shen - - p = new PassiveDamage - { - ChampionName = "Shen", IsActive = (source, target) => source.HasBuff("shenqbuff"), - GetDamage = (source, target) => - { - double dmg = 0; - if (source.HasBuff("shenqbuffweak")) - { - dmg = source.GetSpellDamage(target, SpellSlot.Q); - } - if (source.HasBuff("shenqbuffstrong")) - { - dmg = source.GetSpellDamage(target, SpellSlot.Q, 1); - } - return dmg; - } - }; - - AttackPassives.Add(p); - - #endregion - - #region Shyvana - - p = new PassiveDamage - { - ChampionName = "Shyvana", IsActive = (source, target) => source.HasBuff("ShyvanaDoubleAttack"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Shyvana", - IsActive = - (source, target) => - source.HasBuff("ShyvanaImmolationAura") || source.HasBuff("shyvanaimmolatedragon"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) / 4 - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Shyvana", IsActive = (source, target) => target.HasBuff("ShyvanaFireballMissile"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E, 1) - }; - - AttackPassives.Add(p); - - #endregion - - #region Sion - - p = new PassiveDamage - { - ChampionName = "Sion", IsActive = (source, target) => source.HasBuff("sionpassivezombie"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - Math.Min( - 0.1 * target.MaxHealth, - target.Type == GameObjectType.obj_AI_Minion ? 75 : target.MaxHealth)) - }; - - AttackPassives.Add(p); - - #endregion - - #region Skarner - - p = new PassiveDamage - { - ChampionName = "Skarner", IsActive = (source, target) => target.HasBuff("skarnerpassivebuff"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E, 1) - }; - - AttackPassives.Add(p); - - #endregion - - #region Sona - - p = new PassiveDamage - { - ChampionName = "Sona", IsActive = (source, target) => source.HasBuff("SonaPassiveReady"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - (6 - + ((source.Level < 4 - ? 7 - : (source.Level < 6 ? 8 : (source.Level < 7 ? 9 : (source.Level < 15 ? 10 : 15)))) - * source.Level)) + (0.2 * target.TotalMagicalDamage)) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Sona", IsActive = (source, target) => source.HasBuff("SonaQProcAttacker"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - new[] { 20, 30, 40, 50, 60 }[ - ((Obj_AI_Hero)source.GetBuff("SonaQProcAttacker").Caster).Spellbook.GetSpell( - SpellSlot.Q).Level - 1] - + (0.2 * ((Obj_AI_Hero)source.GetBuff("SonaQProcAttacker").Caster).TotalMagicalDamage) - + new[] { 0, 10, 20, 30 }[ - ((Obj_AI_Hero)source.GetBuff("SonaQProcAttacker").Caster).Spellbook.GetSpell( - SpellSlot.R).Level]) - }; - - AttackPassives.Add(p); - - #endregion - - #region TahmKench - - p = new PassiveDamage - { - ChampionName = "TahmKench", IsActive = (source, target) => source.GetSpell(SpellSlot.R).Level > 0, - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.R) - }; - - AttackPassives.Add(p); - - #endregion - - #region Talon - - p = new PassiveDamage - { - ChampionName = "Talon", - IsActive = - (source, target) => - target.HasBuffOfType(BuffType.Slow) || target.HasBuffOfType(BuffType.Stun) - || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Suppression), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - (source.TotalAttackDamage * 0.1) * source.GetCritMultiplier(true)) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Talon", IsActive = (source, target) => source.HasBuff("talonnoxiandiplomacybuff"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Taric - - p = new PassiveDamage - { - ChampionName = "Taric", IsActive = (source, target) => source.HasBuff("taricgemcraftbuff"), - GetDamage = (source, target) => source.CalcDamage(target, DamageType.Magical, source.Armor * 0.2) - }; - - AttackPassives.Add(p); - - #endregion - - #region Teemo - - p = new PassiveDamage - { - ChampionName = "Teemo", IsActive = (source, target) => (source.HasBuff("ToxicShot")), - GetDamage = - (source, target) => - ((float) - source.CalcDamage( - target, - DamageType.Magical, - source.Spellbook.GetSpell(SpellSlot.E).Level * 10 + source.TotalMagicalDamage * 0.3)), - }; - AttackPassives.Add(p); - - #endregion - - #region Thresh - - p = new PassiveDamage - { - ChampionName = "Thresh", - IsActive = (source, target) => source.Buffs.Any(x => x.Name.Contains("threshqpassive")), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E, 1) - }; - - AttackPassives.Add(p); - - #endregion - - #region Tristana - - p = new PassiveDamage - { - ChampionName = "Tristana", - IsActive = (source, target) => target.GetBuffCount("tristanaecharge") == 3, - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.E) - }; - - AttackPassives.Add(p); - - #endregion - - #region Trundle - - p = new PassiveDamage - { - ChampionName = "Trundle", IsActive = (source, target) => source.HasBuff("TrundleTrollSmash"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region TwistedFate - - p = new PassiveDamage - { - ChampionName = "TwistedFate", IsActive = (source, target) => (source.HasBuff("bluecardpreattack")), - GetDamage = - (source, target) => - (float)source.GetSpellDamage(target, SpellSlot.W) - - (float) - source.CalcDamage( - target, - DamageType.Physical, - (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) - 10f, - }; - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "TwistedFate", IsActive = (source, target) => (source.HasBuff("redcardpreattack")), - GetDamage = - (source, target) => - (float)source.GetSpellDamage(target, SpellSlot.W, 2) - - (float) - source.CalcDamage( - target, - DamageType.Physical, - (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) - 10f, - }; - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "TwistedFate", IsActive = (source, target) => (source.HasBuff("goldcardpreattack")), - GetDamage = - (source, target) => - (float)source.GetSpellDamage(target, SpellSlot.W, 3) - - (float) - source.CalcDamage( - target, - DamageType.Physical, - (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) - 10f, - }; - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "TwistedFate", - IsActive = (source, target) => (source.HasBuff("cardmasterstackparticle")), - GetDamage = (source, target) => (float)source.GetSpellDamage(target, SpellSlot.E), - }; - AttackPassives.Add(p); - - #endregion - - #region Twitch - - /* - p = new PassiveDamage - { - ChampionName = "Twitch", - IsActive = (source, target) => true, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.True, - (source.Level < 5 - ? 12 - : (source.Level < 9 ? 18 : (source.Level < 13 ? 24 : (source.Level < 17 ? 30 : 36)))) - * Math.Min(target.GetBuffCount("twitchdeadlyvenom") + 1, 6) - / (target.Type == GameObjectType.obj_AI_Minion ? 1 : 6d)) - }; - - AttackPassives.Add(p); - */ - - #endregion - - #region Udyr - - p = new PassiveDamage - { - ChampionName = "Udyr", IsActive = (source, target) => source.HasBuff("UdyrTigerStance"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #region Varus - - p = new PassiveDamage - { - ChampionName = "Varus", IsActive = (source, target) => (source.HasBuff("VarusW")), - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.W)), - }; - AttackPassives.Add(p); - - #endregion - - #region Vayne - - p = new PassiveDamage - { - ChampionName = "Vayne", IsActive = (source, target) => (source.HasBuff("vaynetumblebonus")), - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.Q)), - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Vayne", - IsActive = (source, target) => source.GetBuffCount("vaynesilvereddebuff") == 2, - GetDamage = (source, target) => ((float)source.GetSpellDamage(target, SpellSlot.W)), - }; - - AttackPassives.Add(p); - - #endregion - - #region Vi - - p = new PassiveDamage - { - ChampionName = "Vi", IsActive = (source, target) => target.GetBuffCount("viwproc") == 2, - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Vi", IsActive = (source, target) => source.HasBuff("ViE"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.W) - }; - - AttackPassives.Add(p); - - #endregion - - #region Viktor - - p = new PassiveDamage - { - ChampionName = "Viktor", - IsActive = (source, target) => (source.HasBuff("viktorpowertransferreturn")), - GetDamage = - (source, target) => - (float) - source.CalcDamage( - target, - DamageType.Magical, - (float)0.5d * source.TotalMagicalDamage - + new float[] - { 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 110, 130, 150, 170, 190, 210 }[ - source.Level - 1]), - }; - AttackPassives.Add(p); - - #endregion - - #region Volibear - - p = new PassiveDamage - { - ChampionName = "Volibear", IsActive = (source, target) => source.HasBuff("VolibearQ"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - p = new PassiveDamage - { - ChampionName = "Volibear", IsActive = (source, target) => source.HasBuff("volibearrapllicator"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.R) - }; - - AttackPassives.Add(p); - - #endregion - - #region Warwick - - p = new PassiveDamage - { - ChampionName = "Warwick", IsActive = (source, target) => true, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - 2.5 + (source.Level < 10 ? 0.5 : 1) * source.Level) - }; - - AttackPassives.Add(p); - - #endregion - - #region Yasuo - - p = new PassiveDamage - { - ChampionName = "Yasuo", IsActive = (source, target) => Math.Abs(source.Crit - 1) < float.Epsilon, - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - (Items.HasItem((int)ItemId.Infinity_Edge, source) ? 1.25 : 0.8) * source.TotalAttackDamage) - }; - - AttackPassives.Add(p); - - #endregion - - #region Yorick - - p = new PassiveDamage - { - ChampionName = "Yorick", IsActive = (source, target) => source.HasBuff("YorickUnholySymbiosis"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Physical, - (0.05 - * MinionManager.GetMinions(float.MaxValue) - .Count( - g => - g.Team == source.Team - && (g.Name.Equals("Clyde") || g.Name.Equals("Inky") || g.Name.Equals("Blinky") - || (g.HasBuff("yorickunholysymbiosis") - && g.GetBuff("yorickunholysymbiosis").Caster.NetworkId - == source.NetworkId)))) * source.TotalAttackDamage) - }; - - AttackPassives.Add(p); - - #endregion - - #region Zed - - p = new PassiveDamage - { - ChampionName = "Zed", - IsActive = (source, target) => target.HealthPercent < 50 && !target.HasBuff("ZedPassiveCD"), - GetDamage = - (source, target) => - source.CalcDamage( - target, - DamageType.Magical, - (source.Level < 7 ? 0.06 : (source.Level < 17 ? 0.08 : 0.1)) * target.MaxHealth) - }; - - AttackPassives.Add(p); - - #endregion - - #region Ziggs - - p = new PassiveDamage - { - ChampionName = "Ziggs", IsActive = (source, target) => (source.HasBuff("ziggsshortfuse")), - GetDamage = - (source, target) => - (float) - source.CalcDamage( - target, - DamageType.Magical, - (float)0.3d * source.TotalMagicalDamage - + new float[] - { 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, 136, 148, 160 }[ - source.Level - 1]), - }; - - AttackPassives.Add(p); - - #endregion - - #region XinZhao - - p = new PassiveDamage - { - ChampionName = "XinZhao", IsActive = (source, target) => source.HasBuff("XenZhaoComboTarget"), - GetDamage = (source, target) => source.GetSpellDamage(target, SpellSlot.Q) - }; - - AttackPassives.Add(p); - - #endregion - - #endregion - - //Synced on -[dte]- 18:53 with patch 4.16 data. - - #region Spells - - Spells.Add( - "Aatrox", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.6 * source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 95, 130, 165, 200 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 110, 145, 180, 215 }[level] - + 0.6 * source.TotalMagicalDamage - + 0.6 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 300, 400 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Ahri", - new List - { - //Normal Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 65, 90, 115, 140 }[level] - + 0.35 * source.TotalMagicalDamage - }, - //Q Return - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.True, - Damage = - (source, target, level) => - new double[] { 40, 65, 90, 115, 140 }[level] - + 0.35 * source.TotalMagicalDamage - }, - //W => First FF to target - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 65, 90, 115, 140 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //W => Additional FF to already FF target - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 12, 19.5, 27, 34.5, 42 }[level] - + 0.12 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 95, 130, 165, 200 }[level] - + 0.50 * source.TotalMagicalDamage - }, - //R, per dash - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150 }[level] - + 0.3 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Akali", - new List - { - //Q Initial - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 35, 55, 75, 95, 115 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //Q Detonation - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 45, 70, 95, 120, 145 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 55, 80, 105, 130 }[level] - + 0.4 * source.TotalMagicalDamage - + 0.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 175, 250 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Alistar", - new List - { - //Q Initial - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 55, 110, 165, 220, 275 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Amumu", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 130, 180, 230, 280 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //W - per second - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 8, 12, 16, 20, 24 }[level] - + (new[] { 0.01, 0.015, 0.02, 0.025, 0.03 }[level] - + 0.01 * source.TotalMagicalDamage / 100) * target.MaxHealth - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 100, 125, 150, 175 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.8 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Anivia", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 85, 110, 135, 160 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //Q - max - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] * 2 - + 1 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 55, 85, 115, 145, 175 }[level] - + 0.5 * source.TotalMagicalDamage) - * (target.HasBuff("chilled") ? 2 : 1) - }, - //R - per second - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160 }[level] - + 0.25 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Annie", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 115, 150, 185, 220 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.85 * source.TotalMagicalDamage - }, - //R - total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 275, 400 }[level] - + new double[] { 10, 15, 20 }[level] /* Aura */ - + new double[] { 50, 75, 100 }[level] /* Tibbers ʕ•͡ᴥ•ʔ */ - + (0.65 + 0.1 + 0.15) * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Ashe", - new List - { - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 35, 50, 65, 80 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 250, 425, 600 }[level] - + 1 * source.TotalMagicalDamage - }, - //R - Min - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 250, 425, 600 }[level] - + 1 * source.TotalMagicalDamage) / 2 - }, - }); - - Spells.Add( - "Azir", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 65, 85, 105, 125, 145 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //W - Soldier auto attacks - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 55, 60, 75, 80, 90 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 225, 300 }[level] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Blitzcrank", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 135, 190, 245, 300 }[level] - + 1 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 250, 375, 500 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Bard", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - + 0.65 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Brand", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 110, 140, 170, 200 }[level] - + 0.55 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 120, 165, 210, 255 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 90, 110, 130, 150 }[level] - + 0.35 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 200, 300 }[level] - + 0.25 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Braum", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.025 * source.MaxHealth - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Caitlyn", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 70, 110, 150, 190 }[level] - + new double[] { 1.3, 1.4, 1.5, 1.6, 1.7 }[level] - * (source.TotalAttackDamage) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 250, 475, 700 }[level] - + 2 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Cassiopeia", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 120, 165, 210, 255 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 20, 35, 50, 65, 80 }[level] - + 0.15 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (48 + 4 * ((Obj_AI_Hero)source).Level) - + 0.1 * source.TotalMagicalDamage - + (target.HasBuffOfType(BuffType.Poison) - ? new double[] { 10, 40, 70, 100, 130 }[level] - + 0.35 * source.TotalMagicalDamage - : 0) - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "ChoGath", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 135, 190, 245, 305 }[level] - + 1 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 125, 175, 225, 275 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 20, 35, 50, 65, 80 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.True, - Damage = - (source, target, level) => - new double[] { 300, 475, 650 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Corki", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 150, 205, 250 }[level] - + 0.5 * source.TotalMagicalDamage - + 0.5 * source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.4 * source.TotalMagicalDamage - }, - - //W - Burn - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, Stage = 1, - Damage = - (source, target, level) => - new double[] { 30, 45, 60, 75, 90 }[level] - + (1.5 * source.FlatPhysicalDamageMod) - + 0.2 * source.TotalMagicalDamage - }, - - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 32, 44, 56, 68 }[level] - + 0.4 * source.FlatPhysicalDamageMod - }, - //R - Normal missile - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 130, 160 }[level] - + 0.3 * source.TotalMagicalDamage - + new double[] { 20, 50, 80 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - Big missile - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 195, 240 }[level] - + 0.45 * source.TotalMagicalDamage - + new double[] { 30, 75, 120 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - }); - - Spells.Add( - "Darius", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new[] { 40, 70, 100, 130, 160 }[level] - + (new[] { 0.5, 1.1, 1.2, 1.3, 1.4 }[level] - * source.TotalAttackDamage) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - source.TotalAttackDamage + (0.4 * source.TotalAttackDamage) - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.True, - Damage = - (source, target, level) => - new double[] { 100, 200, 300 }[level] - + 0.75 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Diana", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 95, 130, 165, 200 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 22, 34, 46, 58, 70 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //R - total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 160, 220 }[level] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "DrMundo", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = (source, target, level) => - { - if (target is Obj_AI_Minion) - { - return - Math.Min( - new double[] { 300, 350, 400, 450, 500 }[level], - Math.Max( - new double[] { 80, 130, 180, 230, 280 }[level], - new double[] { 15, 17.5, 20, 22.5, 25 }[level] - / 100 * target.Health)); - } - return Math.Max( - new double[] { 80, 130, 180, 230, 280 }[level], - new double[] { 15, 17.5, 20, 22.5, 25 }[level] / 100 - * target.Health); - } - }, - //W - per second - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 35, 50, 65, 80, 95 }[level] - + 0.2 * source.TotalMagicalDamage - } - }); - - Spells.Add( - "Draven", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 45, 55, 65, 75, 85 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 105, 140, 175, 210 }[level] - + 0.5 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 175, 275, 375 }[level] - + 1.1 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Ekko", - new List - { - // Q - Outgoing - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 75, 90, 105, 120 }[level] - + 0.1 * source.TotalMagicalDamage - }, - // Q - Incoming - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 85, 110, 135, 160 }[level] - + 0.6 * source.TotalMagicalDamage - }, - // W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 195, 240, 285, 330 }[level] - + 0.8 * source.TotalMagicalDamage - }, - // E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 80, 110, 140, 170 }[level] - + 0.2 * source.TotalMagicalDamage - }, - // R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 350, 500 }[level] - + 1.3 * source.TotalMagicalDamage - } - }); - - Spells.Add( - "Elise", - new List - { - //Q - Human - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 75, 110, 145, 180 }[level] - + (0.08 + 0.03 / 100 * source.TotalMagicalDamage) * target.Health - }, - //Q - Spider - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] - + (0.08 + 0.03 / 100 * source.TotalMagicalDamage) - * (target.MaxHealth - target.Health) - }, - //W - Human - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 125, 175, 225, 275 }[level] - + 0.8 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Evelynn", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 50, 60, 70, 80 }[level] - + new double[] { 35, 40, 45, 50, 55 }[level] / 100 - * source.TotalMagicalDamage - + new double[] { 50, 55, 60, 65, 70 }[level] / 100 - * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 1 * source.TotalMagicalDamage + 1 * source.FlatPhysicalDamageMod - }, - //R - total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new[] { 0.15, 0.20, 0.25 }[level] - + 0.01 / 100 * source.TotalMagicalDamage) * target.Health - }, - }); - - Spells.Add( - "Ezreal", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 35, 55, 75, 95, 115 }[level] - + 0.4 * source.TotalMagicalDamage - + 1.1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 125, 175, 225, 275 }[level] - + 0.75 * source.TotalMagicalDamage - + 0.5 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 350, 500, 650 }[level] - + 0.9 * source.TotalMagicalDamage + 1 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Fiddlesticks", - new List - { - //W - Per second - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.45 * source.TotalMagicalDamage - }, - //E - Per bounce - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 65, 85, 105, 125, 145 }[level] - + 0.45 * source.TotalMagicalDamage - }, - //R - Per second - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 125, 225, 325 }[level] - + 0.45 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Fiora", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 65, 75, 85, 95, 105 }[level] - + new[] { 0.95, 1, 1.05, 1.1, 1.15 }[level] - * source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 90, 130, 170, 210, 250 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Fizz", - new List - { - //Q - AA excluded. - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 10, 25, 40, 55, 70 }[level] - + 0.35 * source.TotalMagicalDamage - }, - //W - Per attack - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 10, 15, 20, 25, 30 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 120, 170, 220, 270 }[level] - + 0.75 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 325, 450 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Galio", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 135, 190, 245, 300 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //R - max - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 360, 540, 720 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "GangPlank", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 45, 70, 95, 120 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - per cannonball - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 70, 90 }[level] + 0.1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Garen", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 55, 80, 105, 130 }[level] - + 1.4 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 45, 70, 95, 120 }[level] - + new double[] { 70, 80, 90, 100, 110 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - Max damage - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 175, 350, 525 }[level] - + new[] { 28.57, 33.33, 40 }[level] / 100 - * (target.MaxHealth - target.Health) - }, - }); - - Spells.Add( - "Gnar", - new List - { - //Q - mini - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 5, 35, 65, 95, 125 }[level] - + 1.15 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //Q - big - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 5, 45, 85, 125, 165 }[level] - + 1.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - mini - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 15, 25, 35, 45, 55 }[level] - + 1 * source.TotalMagicalDamage - + new double[] { 6, 8, 10, 12, 14 }[level] / 100 * target.MaxHealth - }, - //W - big - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 25, 45, 65, 85, 105 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - mini - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 60, 100, 140, 180 }[level] - + source.MaxHealth * 0.06 - }, - //E - big - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 60, 100, 140, 180 }[level] - + source.MaxHealth * 0.06 - }, - //R - Max damage - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 200, 300, 400 }[level] - + 0.5 * source.TotalMagicalDamage - + 0.2 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Gragas", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 20, 50, 80, 110, 140 }[level] - + 8 / 100f * target.MaxHealth + 0.3 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 130, 180, 230, 280 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 300, 400 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Graves", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 55, 70, 85, 100, 115 }[level] - + 0.75 * source.FlatPhysicalDamageMod - }, - //Q - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - + new double[] { 0.4, 0.6, 0.8, 1, 1.2 }[level] - * source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 110, 160, 210, 260 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - Max damage - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 250, 400, 550 }[level] - + 1.5 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Hecarim", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 95, 130, 165, 200 }[level] - + 0.6 * source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 20, 30, 40, 50, 60 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 40, 75, 110, 145, 180 }[level] - + 0.5 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Heimerdinger", - new List - { - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.45 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 135, 180, 225 }[ - source.Spellbook.GetSpell(SpellSlot.R).Level - 1] - + 0.45 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 200, 250 }[ - source.Spellbook.GetSpell(SpellSlot.R).Level - 1] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Irelia", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 50, 80, 110, 140 }[level] - + 1.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.True, - Damage = - (source, target, level) => - new double[] { 15, 30, 45, 60, 75 }[level] - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //R - per blade - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160 }[level] - + 0.5 * source.TotalMagicalDamage - + 0.6 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Janna", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 85, 110, 135, 160 }[level] - + 0.35 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 115, 170, 225, 280 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "JarvanIV", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 1.2 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 200, 325, 450 }[level] - + 1.5 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Jax", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 1 * source.FlatPhysicalDamageMod + 0.6 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 75, 110, 145, 180 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 75, 100, 125, 150 }[level] - + 0.5 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 160, 220 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Jayce", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 120, 170, 220, 270, 320 }[level] - + 1.2 * source.FlatPhysicalDamageMod - }, - //Q - Melee - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 70, 110, 150, 190, 230 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - //W - per second - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new[] { 25, 40, 55, 70, 85, 100 }[level] - + 0.25 * source.TotalMagicalDamage - }, - - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new[] { 8, 10.4, 12.8, 15.2, 17.6, 20 }[level] / 100) - * target.MaxHealth + 1 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Jhin", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 75, 100, 125, 150 }[level] - + new double[] { 0.3, 0.35, 0.4, 0.45, 0.5 }[level] - * source.FlatPhysicalDamageMod + 0.6 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 85, 120, 155, 190 }[level] - + 0.7 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 20, 80, 140, 200, 260 }[level] - + 1.20 * source.FlatPhysicalDamageMod - + 1 * source.TotalMagicalDamage - }, - //R - Normal Shot - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 125, 200 }[level] - + 0.25 * source.FlatPhysicalDamageMod - * (1 + (100 - target.HealthPercent) * 1.02) - }, - //R - Final Shot - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 125, 200 }[level] - + 0.25 * source.FlatPhysicalDamageMod - * (1 + (100 - target.HealthPercent) * 1.02) * 2 - + 0.01 * source.FlatCritDamageMod - }, - }); - - Spells.Add( - "Jinx", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = (source, target, level) => 0.1 * source.TotalAttackDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 10, 60, 110, 160, 210 }[level] - + 1.4 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 135, 190, 245, 300 }[level] - + 1 * source.TotalMagicalDamage - }, - //R - Min - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 25, 35, 45 }[level] - + new double[] { 25, 30, 35 }[level] / 100 - * (target.MaxHealth - target.Health) - + 0.1 * source.FlatPhysicalDamageMod - }, - //R - Max - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 250, 350, 450 }[level] - + new double[] { 25, 30, 35 }[level] / 100 - * (target.MaxHealth - target.Health) - + 1 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Karma", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //Q - mantra - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - + new double[] { 25, 75, 125, 175 }[ - source.Spellbook.GetSpell(SpellSlot.R).Level - 1] - + 0.9 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 110, 160, 210, 260 }[level] - + 0.9 * source.TotalMagicalDamage - }, - //W - mantra - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 110, 160, 210, 260 }[level] - + 0.9 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Karthus", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 40, 60, 80, 100, 120 }[level] - + 0.3 * source.TotalMagicalDamage) * 2 - }, - //Q - Multi-target - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 60, 80, 100, 120 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 30, 50, 70, 90, 110 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 250, 400, 550 }[level] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Kassadin", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 95, 120, 145, 170 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 65, 90, 115, 140 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //W - pasive - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = (source, target, level) => 20 + 0.1 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 105, 130, 155, 180 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //R - Base - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 100, 120 }[level] + 0.02 * source.MaxMana - }, - //R - Per Stack - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 50, 60 }[level] + 0.01 * source.MaxMana - }, - }); - - Spells.Add( - "Katarina", - new List - { - //Q - dagger - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 85, 110, 135, 160 }[level] - + 0.45 * source.TotalMagicalDamage - }, - //Q - mark - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 15, 30, 45, 60, 75 }[level] - + 0.15 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 75, 110, 145, 180 }[level] - + 0.6 * source.FlatPhysicalDamageMod - + 0.25 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 70, 100, 130, 160 }[level] - + 0.25 * source.TotalMagicalDamage - }, - //R - per dagger - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 350, 550, 750 }[level] - + 3.75 * source.FlatPhysicalDamageMod - + 2.5 * source.TotalMagicalDamage) / 10 - }, - //R - max - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 350, 550, 750 }[level] - + 3.75 * source.FlatPhysicalDamageMod - + 2.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Kayle", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 110, 160, 210, 260 }[level] - + 1 * source.FlatPhysicalDamageMod + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - source.HasBuff("judicatorrighteousfury") - ? new double[] { 20, 30, 40, 50, 60 }[level] - + 0.30 * source.TotalMagicalDamage - : new double[] { 10, 15, 20, 25, 30 }[level] - + 0.15 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Kennen", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 115, 155, 195, 235 }[level] - + 0.75 * source.TotalMagicalDamage - }, - //W - Passive - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 50, 60, 70, 80 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - Active - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 65, 95, 125, 155, 185 }[level] - + 0.55 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 85, 125, 165, 205, 245 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 145, 210 }[level] - + 0.4 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "KhaZix", - new List - { - //Q - Normal target - UnEvolved - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 95, 120, 145, 170 }[level] - + 1.2 * source.FlatPhysicalDamageMod - }, - //Q - Isolated target - UnEvolved - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new[] { 91, 123.5, 156, 188.5, 221 }[level] - + 1.56 * source.FlatPhysicalDamageMod - }, - //Q - Normal target - Evolved - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 2, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 95, 120, 145, 170 }[level] - + 2.24 * source.FlatPhysicalDamageMod - + 10 * ((Obj_AI_Hero)source).Level - }, - //Q - Isolated target - Evolved - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 3, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new[] { 91, 123.5, 156, 188.5, 221 }[level] - + 2.6 * source.FlatPhysicalDamageMod - + 10 * ((Obj_AI_Hero)source).Level - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 80, 110, 140, 170, 200 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 65, 100, 135, 170, 205 }[level] - + 0.2 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "KogMaw", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 130, 180, 230, 280 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = (source, target, level) => - { - var dmg = (0.02 - + (Math.Truncate(source.TotalMagicalDamage / 100) - * 0.75)) * target.MaxHealth; - - if (target is Obj_AI_Minion && dmg > 100) - { - dmg = 100; - } - - return dmg; - } - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 110, 160, 210, 260 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 70, 110, 150 }[level] - + 0.65 * source.FlatPhysicalDamageMod - + 0.25 * source.TotalMagicalDamage) - * (target.HealthPercent < 25 - ? 3 - : (target.HealthPercent < 50 ? 2 : 1)) - }, - }); - - Spells.Add( - "Kalista", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 10, 70, 130, 190, 250 }[level] - + source.BaseAttackDamage + source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 12, 14, 16, 18, 20 }[level] / 100) - * target.MaxHealth - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = (source, target, level) => - { - var count = target.GetBuffCount("kalistaexpungemarker"); - if (count > 0) - { - return (new double[] { 20, 30, 40, 50, 60 }[level] - + 0.6 - * (source.BaseAttackDamage - + source.FlatPhysicalDamageMod)) + - // Base damage of E - ((count - 1) - * (new double[] { 10, 14, 19, 25, 32 }[level] - + // Base damage per spear - new double[] { 0.2, 0.225, 0.25, 0.275, 0.3 }[ - level] - * (source.BaseAttackDamage - + source.FlatPhysicalDamageMod))); - // Damage multiplier per spear - } - return 0; - } - }, - }); - - Spells.Add( - "Kindred", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + (source.BaseAttackDamage + source.FlatPhysicalDamageMod) * 0.2f - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 25, 30, 35, 40, 45 }[level] - + (source.BaseAttackDamage + source.FlatPhysicalDamageMod) * 0.4f - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 80, 110, 140, 170, 200 }[level] - + (source.BaseAttackDamage + source.FlatPhysicalDamageMod) * 0.2f - + target.MaxHealth * 0.05f - }, - }); - - Spells.Add( - "LeBlanc", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 55, 80, 105, 130, 155 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //Q . explosion - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 55, 80, 105, 130, 155 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 85, 125, 165, 205, 245 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 65, 90, 115, 140 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "LeeSin", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 80, 110, 140, 170 }[level] - + 0.9 * source.FlatPhysicalDamageMod - }, - //Q - 2nd - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 80, 110, 140, 170 }[level] - + 0.9 * source.FlatPhysicalDamageMod - + 0.08 * (target.MaxHealth - target.Health) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 95, 130, 165, 200 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 200, 400, 600 }[level] - + 2 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Leona", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 30, 55, 80, 105, 130 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 175, 250 }[level] - + 0.8 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Lissandra", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 100, 130, 160, 190 }[level] - + 0.65 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Lucian", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 80, 110, 140, 170, 200 }[level] - + new double[] { 60, 75, 90, 105, 120 }[level] / 100 - * source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] - + 0.9 * source.TotalMagicalDamage - }, - //R - per shot - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 40, 50, 60 }[level] + 0.1 * source.TotalMagicalDamage - + 0.25 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Lulu", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 110, 140, 170, 200 }[level] - + 0.4 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Lux", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 100, 150, 200, 250 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 300, 400, 500 }[level] - + 0.75 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Malphite", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 120, 170, 220, 270 }[level] - + 0.6 * source.TotalMagicalDamage - }, - - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 38, 46, 54, 62 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] + 0.3 * source.Armor - + 0.2 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 300, 400 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Malzahar", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 4, 4.5, 5, 5.5, 6 }[level] / 100 - + 0.01 / 100 * source.TotalMagicalDamage) * target.MaxHealth - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 115, 150, 185, 220 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //R - new DamageSpell - //1.5% of the target’s maximum health per 100 ability power, per second - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - 2.5 - * (new double[] { 6, 8, 10 }[level] / 100 - + 0.015 * source.TotalMagicalDamage / 100) * target.MaxHealth - }, - }); - - Spells.Add( - "Maokai", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 9, 10, 11, 12, 13 }[level] / 100 - + 0.03 / 100 * source.TotalMagicalDamage) * target.MaxHealth - }, - //E - impact - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 60, 80, 100, 120 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - explosion - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 150, 200 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "MasterYi", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 25, 60, 95, 130, 165 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + 0.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.True, - Damage = - (source, target, level) => - new[] { 10, 12.5, 15, 17.5, 20 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + new double[] { 10, 15, 20, 25, 30 }[level] - }, - }); - - Spells.Add( - "MissFortune", - new List - { - //Q - First target - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 35, 50, 65, 80 }[level] - + 0.35 * source.TotalMagicalDamage - + 0.85 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //Q - Second target - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 40, 70, 100, 130, 160 }[level] - + 0.5 * source.TotalMagicalDamage - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - 0.06 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 115, 150, 185, 220 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //R - per wave - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - 0.75 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + 0.2 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "MonkeyKing", - new List //AKA wukong - { - //Q - bonus - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 60, 90, 120, 150 }[level] - + 0.1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] + 0.8 * source.FlatPhysicalDamageMod - }, - //R - per second - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 110, 200 }[level] - + 1.1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - }); - - Spells.Add( - "Mordekaiser", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 110, 140, 170, 200 }[level] - + 1 * source.FlatPhysicalDamageMod + 0.4 * source.TotalMagicalDamage - }, - //W - per second - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 24, 38, 52, 66, 80 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 24, 29, 34 }[level] / 100 - + 0.04 / 100 * source.TotalMagicalDamage) * target.MaxHealth - }, - }); - - Spells.Add( - "Morgana", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 135, 190, 245, 300 }[level] - + 0.9 * source.TotalMagicalDamage - }, - //W - per tick - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 8, 16, 24, 32, 40 }[level] - + 0.11 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 225, 300 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Nami", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 130, 185, 240, 295 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 25, 40, 55, 70, 85 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Nasus", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (from buff in ObjectManager.Player.Buffs - where buff.Name == "nasusqstacks" - select buff.Count).FirstOrDefault() - + new double[] { 30, 50, 70, 90, 110 }[level] - }, - //E - Initial - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 55, 95, 135, 175, 215 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - per second - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 11, 19, 27, 35, 43 }[level] - + 0.12 * source.TotalMagicalDamage - }, - //R - per second - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 3, 4, 5 }[level] / 100 - + 0.01 / 100 * source.TotalMagicalDamage) * target.MaxHealth - }, - }); - - Spells.Add( - "Nautilus", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.75 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 30, 40, 50, 60, 70 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //R - main target - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 325, 450 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //R - missile - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 125, 175, 225 }[level] - + 0.4 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Nidalee", - new List - { - //Q - human - min * 3 = max - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 77.5, 95, 112.5, 130 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //Q - cat - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = (source, target, level) => - { - var dmg = - (new double[] { 4, 20, 50, 90 }[ - source.Spellbook.GetSpell(SpellSlot.R).Level - 1] - + 0.36 * source.TotalMagicalDamage - + 0.75 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) - * ((target.MaxHealth - target.Health) / target.MaxHealth - * 1.5 + 1); - dmg *= target.HasBuff("nidaleepassivehunted") ? 1.33 : 1.0; - return dmg; - } - }, - //W - human - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 80, 120, 160, 200 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //W - cat - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 110, 160, 210 }[ - source.Spellbook.GetSpell(SpellSlot.R).Level - 1] - + 0.3 * source.TotalMagicalDamage - }, - //E - cat - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 130, 190, 250 }[ - source.Spellbook.GetSpell(SpellSlot.R).Level - 1] - + 0.45 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Nocturne", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.75 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 260 }[level] - + 1 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 1.2 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Nunu", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.True, - Damage = - (source, target, level) => - new double[] { 400, 550, 700, 850, 1000 }[level] - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 85, 130, 175, 225, 275 }[level] - + 1 * source.TotalMagicalDamage - }, - //R - Max Damage - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 625, 875, 1125 }[level] - + 2.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Olaf", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.True, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.4 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - }); - - Spells.Add( - "Orianna", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 225, 300 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Pantheon", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 65, 105, 145, 185, 225 }[level] - + 1.4 * source.FlatPhysicalDamageMod) - * ((target.Health / target.MaxHealth < 0.15) ? 2 : 1) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 75, 100, 125, 150 }[level] - + 1 * source.TotalMagicalDamage - }, - //E - per strike - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 13, 23, 33, 43, 53 }[level] - + 0.6 * source.FlatPhysicalDamageMod) - * ((target is Obj_AI_Hero) ? 2 : 1) - }, - //R - max - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 400, 700, 1000 }[level] - + 1 * source.TotalMagicalDamage - }, - //R - min - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 400, 700, 1000 }[level] - + 1 * source.TotalMagicalDamage) * 0.5 - }, - }); - - Spells.Add( - "Poppy", - new List - { - //Q - single hit - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 35, 55, 75, 95, 115 }[level] - + 0.80 * source.FlatPhysicalDamageMod + 0.07 * target.MaxHealth - }, - //Q - both hits - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 70, 110, 150, 190, 230 }[level] - + 1.6 * source.FlatPhysicalDamageMod + 0.14 * target.MaxHealth) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //E - without colliding - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 70, 90, 110, 130 }[level] - + 0.5 * source.FlatPhysicalDamageMod - }, - //E - with colliding - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 100, 140, 180, 220, 260 }[level] - + 1 * source.FlatPhysicalDamageMod) - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 200, 300, 400 }[level] - + 0.9 * source.FlatPhysicalDamageMod) - }, - }); - - Spells.Add( - "Quinn", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = (source, target, level) => - { - var damage = (new double[] { 20, 45, 70, 95, 120 }[level] - + (new double[] { 0.8, 0.9, 1.0, 1.1, 1.2 }[level] - * source.TotalAttackDamage) - + 0.35 * source.TotalMagicalDamage); - damage += damage * ((100 - target.HealthPercent) / 100); - return damage; - } - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 40, 70, 100, 130, 160 }[level] - + 0.2 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = (source, target, level) => source.TotalAttackDamage - }, - }); - - Spells.Add( - "Rammus", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 150, 200, 250, 300 }[level] - + 1 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 15, 25, 35, 45, 55 }[level] + 0.1 * source.Armor - }, - //R - per second - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 65, 130, 195 }[level] - + 0.3 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Renekton", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.8 * source.FlatPhysicalDamageMod - }, - //Q - empowered - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 60, 90, 120, 150, 180 }[level] - + 0.8 * source.FlatPhysicalDamageMod) * 1.5 - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 10, 30, 50, 70, 90 }[level] - + 1.5 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - empowered - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 10, 30, 50, 70, 90 }[level] - + 1.5 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) - * 1.5 - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 60, 90, 120, 150 }[level] - + 0.9 * source.FlatPhysicalDamageMod - }, - //E - empowered - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 30, 60, 90, 120, 150 }[level] - + 0.9 * source.FlatPhysicalDamageMod) * 1.5 - }, - //R - per second - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 30, 60, 120 }[level] - + 0.1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Rengar", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 60, 90, 120, 150 }[level] - + new double[] { 0, 5, 10, 15, 20 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //Q - Extra - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 60, 90, 120, 150 }[level] - + (new double[] { 100, 105, 110, 115, 120 }[level] / 100 - 1) - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 80, 110, 140, 170 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 100, 150, 200, 250 }[level] - + 0.7 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Riven", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 10, 30, 50, 70, 90 }[level] - + ((source.BaseAttackDamage + source.FlatPhysicalDamageMod) / 100) - * new double[] { 40, 45, 50, 55, 60 }[level] - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 80, 110, 140, 170 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 80, 120, 160 }[level] - + 0.6 * source.FlatPhysicalDamageMod) - * ((target.MaxHealth - target.Health) / target.MaxHealth * 2.67 + 1) - }, - }); - - Spells.Add( - "Rumble", - new List - { - //Q - total damage - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 135, 195, 255, 315 }[level] - + 1 * source.TotalMagicalDamage - }, - //Q - Danger Zone total damage - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new[] { 112.5, 202.5, 292.5, 382.5, 472.5 }[level] - + 1.5 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 45, 70, 95, 120, 145 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - Danger Zone - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new[] { 67.5, 105, 142.5, 180, 217.5 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - per second - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 130, 185, 240 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //R - Total - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 650, 925, 1200 }[level] - + 1.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Ryze", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 60, 85, 110, 135, 160, 185 }[level] - + 0.45 * source.TotalMagicalDamage - + 0.03 - * (source.MaxMana - 392.4 - 52 * (source as Obj_AI_Hero).Level)) - * (1 - + (target.HasBuff("RyzeE") - ? new double[] { 40, 55, 70, 85, 100 }[ - ObjectManager.Player.Spellbook.GetSpell(SpellSlot.E) - .Level - 1] / 100 - : 0)) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 100, 120, 140, 160 }[level] - + 0.2 * source.TotalMagicalDamage - + 0.01 - * (source.MaxMana - 392.4 - 52 * (source as Obj_AI_Hero).Level) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 75, 100, 125, 150 }[level] - + 0.3 * source.TotalMagicalDamage - + 0.02 - * (source.MaxMana - 392.4 - 52 * (source as Obj_AI_Hero).Level) - }, - }); - - Spells.Add( - "Sejuani", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - }, - - //W - AA damage - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new[] { 4, 4.5, 5, 5.5, 6 }[level] / 100 * target.MaxHealth - }, - //W - Aoe per second - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new[] { 10, 17.5, 25, 32.5, 40 }[level] - + (new double[] { 4, 6, 8, 10, 12 }[level] / 100) * source.MaxHealth - + 0.15 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.8 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Shaco", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 140, 160, 180, 200, 220 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - per attack - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 35, 50, 65, 80, 95 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 90, 130, 170, 210 }[level] - + 1 * source.FlatPhysicalDamageMod + 1 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 300, 450, 600 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Shen", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = (source, target, level) => - { - var dmg = (new double[] { 3, 3.5, 4, 4.5, 5 }[level] - + 0.015 * source.TotalMagicalDamage) - * target.MaxHealth / 100; - if (target is Obj_AI_Hero) - { - return dmg; - } - return - Math.Min( - new double[] { 30, 50, 70, 90, 110 }[level] + dmg, - new double[] { 75, 100, 125, 150, 175 }[level]); - } - }, - //Q - Enhanced - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Magical, - Damage = (source, target, level) => - { - var dmg = (new double[] { 5, 5.5, 6, 6.6, 7 }[level] - + 0.02 * source.TotalMagicalDamage) - * target.MaxHealth / 100; - if (target is Obj_AI_Hero) - { - return dmg; - } - return - Math.Min( - new double[] { 30, 50, 70, 90, 110 }[level] + dmg, - new double[] { 75, 100, 125, 150, 175 }[level]); - } - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 85, 120, 155, 190 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Shyvana", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 80, 85, 90, 95, 100 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - per second - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 20, 35, 50, 65, 80 }[level] - + 0.2 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 100, 140, 180, 220 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 175, 300, 425 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Singed", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 22, 34, 46, 58, 70 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 65, 80, 95, 110 }[level] - + 0.75 * source.TotalMagicalDamage - + new double[] { 4, 5.5, 7, 8.5, 10 }[level] / 100 - * target.MaxHealth - }, - }); - - Spells.Add( - "Sion", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 40, 60, 80, 100 }[level] - + 0.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //Q - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 120, 180, 240, 300 }[level] - + 1.8 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 65, 90, 115, 140 }[level] - + 0.4 * source.TotalMagicalDamage - + new double[] { 10, 11, 12, 13, 14 }[level] / 100 - * target.MaxHealth - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 105, 140, 175, 210 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 70, 105, 140, 175, 210 }[level] - + 0.4 * source.TotalMagicalDamage) * 1.5 - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 150, 300, 450 }[level] - + 0.4 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 150, 300, 450 }[level] - + 0.4 * source.FlatPhysicalDamageMod) * 2 - }, - }); - - Spells.Add( - "Sivir", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 25, 45, 65, 85, 105 }[level] - + new double[] { 70, 80, 90, 100, 110 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + 0.5 * source.TotalMagicalDamage - }, - //W - bounce - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 65, 70, 75, 80 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - }); - - Spells.Add( - "Skarner", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 30, 40, 50, 60 }[level] - + 0.4 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 75, 110, 145, 180 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //R - total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 20, 60, 100 }[level] - + 0.5 * source.TotalMagicalDamage) - + (0.60 * source.TotalAttackDamage) - }, - }); - - Spells.Add( - "Sona", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 70, 100, 130, 160 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Soraka", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.35 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.4 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Swain", - new List - { - //Q - per second - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 25, 40, 55, 70, 85 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 80, 110, 140, 170 }[level] - + 1 * source.TotalMagicalDamage - }, - //R - per draven - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 50, 70, 90 }[level] + 0.2 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Syndra", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 50, 95, 140, 185, 230 }[level] - + 0.75 * source.TotalMagicalDamage) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 115, 160, 205, 250 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //R - min damage - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 270, 405, 540 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - per sphere - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 90, 135, 180 }[level] - + 0.2 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Talon", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 60, 90, 120, 150 }[level] - + 0.3 * source.FlatPhysicalDamageMod - + ((target is Obj_AI_Hero) - ? (new double[] { 10, 20, 30, 40, 50 }[level] - + 1 * source.FlatPhysicalDamageMod) - : 0) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 55, 80, 105, 130 }[level] - + 0.6 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 120, 170, 220 }[level] - + 0.75 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Taric", - new List - { - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 80, 120, 160, 200 }[level] + 0.2 * source.Armor - }, - //E - min damage - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 70, 100, 130, 160 }[level] - + 0.2 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "TahmKench", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 130, 180, 230, 280 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //W - Devour - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - target is Obj_AI_Minion - ? new double[] { 400, 450, 500, 550, 600 }[level] - : (new double[] { 0.20, 0.23, 0.26, 0.29, 0.32 }[level] - + 0.02 * source.TotalMagicalDamage / 100) * target.MaxHealth - }, - //W - Regugitate - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 150, 200, 250, 300 }[level] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Teemo", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - + 0.8 * source.TotalMagicalDamage - }, - //E - total - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 34, 68, 102, 136, 170 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //E - onhit - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 10, 20, 30, 40, 50 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //R - total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 325, 450 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Thresh", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //E - Active - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 65, 95, 125, 155, 185 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 250, 400, 550 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Tristana", - new List - { - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 110, 160, 210, 260 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //E - base damage - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 70, 80, 90, 100 }[level] - + new double[] { 0.5, 0.65, 0.8, 0.95, 1.10 }[level] - * source.FlatPhysicalDamageMod + 0.5 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 300, 400, 500 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Trundle", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 40, 60, 80, 100 }[level] - + new[] { 0, 0.5, 0.1, 0.15, 0.2 }[level] - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - Total - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new double[] { 20, 24, 28 }[level] / 100 - + 0.02 * source.TotalMagicalDamage / 100) * target.MaxHealth - }, - }); - - Spells.Add( - "Tryndamere", - new List - { - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 70, 100, 130, 160, 190 }[level] - + 1.2 * source.FlatPhysicalDamageMod + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "TwistedFate", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.65 * source.TotalMagicalDamage - }, - //W - Blue - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 60, 80, 100, 120 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + 0.5 * source.TotalMagicalDamage - }, - //W - Red - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 30, 45, 60, 75, 90 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + 0.5 * source.TotalMagicalDamage - }, - //W - Yellow - new DamageSpell - { - Slot = SpellSlot.W, Stage = 2, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new[] { 15, 22.5, 30, 37.5, 45 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + 0.5 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 55, 80, 105, 130, 155 }[level] - + 0.5 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Twitch", - new List - { - //E - current stacks - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (from buff in target.Buffs - where buff.DisplayName.ToLower() == "twitchdeadlyvenom" - select buff.Count).FirstOrDefault() - * (new double[] { 15, 20, 25, 30, 35 }[level] - + 0.2 * source.TotalMagicalDamage - + 0.25 * source.FlatPhysicalDamageMod) - + new double[] { 20, 35, 50, 65, 80 }[level] - }, - //E - per stack - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 15, 20, 25, 30, 35 }[level] - + 0.2 * source.TotalMagicalDamage - + 0.25 * source.FlatPhysicalDamageMod - + new double[] { 20, 35, 50, 65, 80 }[level] - }, - }); - - Spells.Add( - "Udyr", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 80, 130, 180, 230 }[level] - + (new double[] { 120, 130, 140, 150, 160 }[level] / 100) - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //R - per wave - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 10, 20, 30, 40, 50 }[level] - + 0.25 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Urgot", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 10, 40, 70, 100, 130 }[level] - + 0.85 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 75, 130, 185, 240, 295 }[level] - + 0.6 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Varus", - new List - { - //Q - min - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 10, 47, 83, 120, 157 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //Q - max - new DamageSpell - { - Slot = SpellSlot.Q, Stage = 1, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 15, 70, 125, 180, 235 }[level] - + +1.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - on hit - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 10, 14, 18, 22, 26 }[level] - + 0.25 * source.TotalMagicalDamage - }, - //W - per stack - new DamageSpell - { - Slot = SpellSlot.W, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - (new[] { 2, 2.75, 3.5, 4.25, 5 }[level] / 100 - + 0.02 * source.TotalMagicalDamage / 100) * target.MaxHealth - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 65, 100, 135, 170, 205 }[level] - + 0.6 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 175, 250 }[level] - + 1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Vayne", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 35, 40, 45, 50 }[level] / 100 - * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.True, - Damage = - (source, target, level) => - Math.Max( - new double[] { 40, 60, 80, 100, 120 }[level], - (new double[] { 6, 7.5, 9, 10.5, 12 }[level] / 100) - * target.MaxHealth) - }, - - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 45, 80, 115, 150, 185 }[level] - + 0.5 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Veigar", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 125, 170, 215, 260 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 120, 170, 220, 270, 320 }[level] - + 1 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => new double[] { 175, 250, 325 }[level] - // TODO: figure out how fast it scales, 175-350/250-500/325-650 (based on target’s missing health) - + 0.8 * target.TotalMagicalDamage - + 0.75 * source.TotalMagicalDamage - //0.75 - 1.5 ability power (based on target’s missing health) - }, - }); - - Spells.Add( - "Velkoz", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //W - Max - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 30, 50, 70, 90, 110 }[level] - + new double[] { 45, 75, 105, 135, 165 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 100, 130, 160, 190 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //R - max - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.True, - Damage = - (source, target, level) => - target.HasBuff("velkozresearchedstack") - ? new double[] { 500, 725, 950 }[level] - + 1 * source.TotalMagicalDamage - : source.CalcDamage( - target, - DamageType.Magical, - new double[] { 500, 725, 950 }[level] - + 1 * source.TotalMagicalDamage) - }, - }); - - Spells.Add( - "Vi", - new List - { - //Q - min - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 50, 75, 100, 125, 150 }[level] - + 0.8 * source.FlatPhysicalDamageMod - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new[] { 4, 5.5, 7, 8.5, 10 }[level] / 100 - + 0.01 * source.FlatPhysicalDamageMod / 35) * target.MaxHealth - }, - //E - extra - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 5, 20, 35, 50, 65 }[level] - + 1.15 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - + 0.7 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 150, 300, 450 }[level] - + 1.4 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Viktor", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 80, 100, 120, 140 }[level] - + 0.4 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 90, 170, 250, 330, 410 }[level] - + 1.2 * source.TotalMagicalDamage - }, - //R - summon damage - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 100, 175, 250 }[level] - + 0.50 * source.TotalMagicalDamage - }, - //R - per bolt - new DamageSpell - { - Slot = SpellSlot.R, Stage = 1, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.6 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Vladimir", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 90, 105, 120, 135 }[level] - + 0.55 * source.TotalMagicalDamage - }, - //W - max - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 135, 190, 245, 300 }[level] - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 80, 100, 120, 140 }[level] - + 0.45 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Volibear", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 60, 90, 120, 150 }[level] - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - (new double[] { 60, 110, 160, 210, 260 }[level]) - * ((target.MaxHealth - target.Health) / target.MaxHealth + 1) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 105, 150, 195, 240 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - per bolt - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 115, 155 }[level] - + 0.3 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Warwick", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - Math.Max( - new double[] { 75, 125, 175, 225, 275 }[level], - new double[] { 8, 10, 12, 14, 16 }[level] / 100 - * target.MaxHealth) + 1 * source.TotalMagicalDamage - }, - //R - max - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 150, 250, 350 }[level] - + 2 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Xerath", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 120, 160, 200, 240 }[level] - + 0.75 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 110, 140, 170, 200 }[level] - + 0.45 * source.TotalMagicalDamage - }, - //R - per charge - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 200, 230, 260 }[level] - + 0.43 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "XinZhao", - new List - { - //Q - per attack - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 15, 30, 45, 60, 75 }[level] - + 0.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 75, 175, 275 }[level] - + 1 * source.FlatPhysicalDamageMod + 0.15 * target.Health - }, - }); - - Spells.Add( - "Yasuo", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 20, 40, 60, 80, 100 }[level] - + 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //E - min - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 90, 110, 130, 150 }[level] - + 0.6 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 200, 300, 400 }[level] - + 1.5 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Yorick", - new List - { - //Q - extra - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 30, 60, 90, 120, 150 }[level] - + 1.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 95, 130, 165, 200 }[level] - + 1 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 55, 85, 115, 145, 175 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - }); - - Spells.Add( - "Zac", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 110, 150, 190, 230 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 55, 70, 85, 100 }[level] - + (new double[] { 4, 5, 6, 7, 8 }[level] / 100 - + 0.02 * source.TotalMagicalDamage / 100) * target.MaxHealth - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 80, 130, 180, 230, 280 }[level] - + 0.7 * source.TotalMagicalDamage - }, - //R - per bounce - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 140, 210, 280 }[level] - + 0.4 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Zed", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 75, 115, 155, 195, 235 }[level] - + 1 * source.FlatPhysicalDamageMod - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.8 * source.FlatPhysicalDamageMod - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Physical, - Damage = - (source, target, level) => - 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod) - }, - }); - - Spells.Add( - "Ziggs", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 75, 120, 165, 210, 255 }[level] - + 0.65 * source.TotalMagicalDamage - }, - //W - new DamageSpell - { - Slot = SpellSlot.W, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 70, 105, 140, 175, 210 }[level] - + 0.35 * source.TotalMagicalDamage - }, - //E - per mine - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 40, 65, 90, 115, 140 }[level] - + 0.3 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 300, 450, 600 }[level] - + 1.1 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Zilean", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 90, 145, 200, 260, 320 }[level] - + 0.9 * source.TotalMagicalDamage - }, - }); - - Spells.Add( - "Zyra", - new List - { - //Q - new DamageSpell - { - Slot = SpellSlot.Q, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 90, 120, 150, 180 }[level] - + 0.55 * source.TotalMagicalDamage - }, - //E - new DamageSpell - { - Slot = SpellSlot.E, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 60, 95, 130, 165, 200 }[level] - + 0.5 * source.TotalMagicalDamage - }, - //R - new DamageSpell - { - Slot = SpellSlot.R, DamageType = DamageType.Magical, - Damage = - (source, target, level) => - new double[] { 180, 265, 350 }[level] - + 0.7 * source.TotalMagicalDamage - }, - }); - - #endregion - } - - #endregion - - #region Enums - - /// - /// Represents items that deal damage. - /// - public enum DamageItems - { - /// - /// The hexgun - /// - Hexgun, - - /// - /// The Dfg - /// - Dfg, - - /// - /// The botrk - /// - Botrk, - - /// - /// The bilgewater - /// - Bilgewater, - - /// - /// The tiamat - /// - Tiamat, - - /// - /// The hydra - /// - Hydra, - - /// - /// The black fire torch - /// - BlackFireTorch, - - /// - /// The oding veils - /// - OdingVeils, - - /// - /// The frost queen claim - /// - FrostQueenClaim, - - /// - /// The liandrys torment - /// - LiandrysTorment, - } - - /// - /// The type of damage. - /// - public enum DamageType - { - /// - /// Physical damage. (AD) - /// - Physical, - - /// - /// Magical damage. (AP) - /// - Magical, - - /// - /// True damage - /// - True - } - - /// - /// Represnets summoner spells that deal damage. - /// - public enum SummonerSpell - { - /// - /// The ignite spell. - /// - Ignite, - - /// - /// The smite spell. - /// - Smite, - } - - #endregion - - #region Public Methods and Operators - - /// - /// Calculates the damage. - /// - /// The source. - /// The target. - /// Type of the damage. - /// The amount. - /// - public static double CalcDamage( - this Obj_AI_Base source, - Obj_AI_Base target, - DamageType damageType, - double amount) - { - var damage = 0d; - switch (damageType) - { - case DamageType.Magical: - damage = CalcMagicDamage(source, target, amount); - break; - case DamageType.Physical: - damage = CalcPhysicalDamage(source, target, amount); - break; - case DamageType.True: - damage = amount; - break; - } - - return Math.Max(damage, 0d); - } - - /// - /// Gets the automatic attack damage. - /// - /// The source. - /// The target. - /// if set to true [include passive]. - /// - public static double GetAutoAttackDamage( - this Obj_AI_Base source, - Obj_AI_Base target, - bool includePassive = false) - { - double result = source.TotalAttackDamage; - var k = 1d; - if (source.CharData.BaseSkinName == "Kalista") - { - k = 0.9d; - } - if (source.CharData.BaseSkinName == "Kled" && - ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "KledRiderQ") - { - k = 0.8d; - } - - if (!includePassive) - { - return CalcPhysicalDamage(source, target, result * k); - } - - var reduction = 0d; - - var hero = source as Obj_AI_Hero; - if (hero != null) - { - // Spoils of War - var minionTarget = target as Obj_AI_Minion; - if (hero.IsMelee() && minionTarget != null && minionTarget.IsEnemy - && minionTarget.Team != GameObjectTeam.Neutral - && hero.Buffs.Any(buff => buff.Name == "talentreaperdisplay" && buff.Count > 0)) - { - if ( - HeroManager.AllHeroes.Any( - h => - h.NetworkId != source.NetworkId && h.Team == source.Team - && h.Distance(minionTarget.Position) < 1100)) - { - var value = 0; - - if (Items.HasItem(3302, hero)) - { - value = 200; // Relic Shield - } - else if (Items.HasItem(3097, hero)) - { - value = 240; // Targon's Brace - } - else if (Items.HasItem(3401, hero)) - { - value = 400; // Face of the Mountain - } - - return value + hero.TotalAttackDamage; - } - } - - //Champions passive damages: - result += - AttackPassives.Where( - p => (p.ChampionName == "" || p.ChampionName == hero.ChampionName) && p.IsActive(hero, target)) - .Sum(passive => passive.GetDamage(hero, target)); - - // BotRK - if (Items.HasItem(3153, hero)) - { - var d = 0.06 * target.Health; - if (target is Obj_AI_Minion) - { - d = Math.Min(d, 60); - } - - result += d; - } - } - - var targetHero = target as Obj_AI_Hero; - if (targetHero != null) - { - // Ninja tabi - if (Items.HasItem(3047, targetHero)) - { - k *= 0.9d; - } - - // Nimble Fighter - if (targetHero.ChampionName == "Fizz") - { - var f = new int[] { 4, 6, 8, 10, 12, 14 }; - reduction += f[(targetHero.Level - 1) / 3]; - } - } - - //TODO: need to check if there are items or spells in game that reduce magical dmg % or by amount - if (hero != null && hero.ChampionName == "Corki") - { - return CalcMixedDamage(source, target, (result - reduction) * k, result * k); - } - - return CalcPhysicalDamage(source, target, (result - reduction) * k + PassiveFlatMod(source, target)); - } - - /// - /// Calculates the combo damage of the given spell combo on the given target. - /// - /// The source object - /// The target object - /// SpellType array containing the combo spells - /// Returns the calculated combo damage - public static double GetComboDamage( - this Obj_AI_Hero source, - Obj_AI_Base target, - IEnumerable spellCombo) - { - return source.GetComboDamage(target, spellCombo.Select(spell => Tuple.Create(spell, 0)).ToArray()); - } - - /// - /// Calculates the combo damage of the given spell combo on the given target respecting the stage type of each spell - /// - /// The source object - /// The target object - /// SpellType/StageType tuple containing the combo spells - /// Returns the calculated combo damage - public static double GetComboDamage( - this Obj_AI_Hero source, - Obj_AI_Base target, - IEnumerable> spellCombo) - { - return spellCombo.Sum(spell => source.GetSpellDamage(target, spell.Item1, spell.Item2)); - } - - /// - /// Gets the damage spell. - /// - /// The source. - /// The target. - /// Name of the spell. - /// - public static DamageSpell GetDamageSpell(this Obj_AI_Base source, Obj_AI_Base target, string spellName) - { - if (Orbwalking.IsAutoAttack(spellName)) - { - return new DamageSpell - { - DamageType = DamageType.Physical, - CalculatedDamage = GetAutoAttackDamage(source, target, true), - }; - } - - var hero = source as Obj_AI_Hero; - if (hero != null) - { - return (from spell in hero.Spellbook.Spells - where String.Equals(spell.Name, spellName, StringComparison.InvariantCultureIgnoreCase) - select GetDamageSpell(hero, target, spell.Slot)).FirstOrDefault(); - } - - return null; - } - - /// - /// Gets the damage spell. - /// - /// The source. - /// The target. - /// The slot. - /// The stage. - /// - public static DamageSpell GetDamageSpell( - this Obj_AI_Hero source, - Obj_AI_Base target, - SpellSlot slot, - int stage = 0) - { - if (Spells.ContainsKey(source.ChampionName)) - { - var spell = Spells[source.ChampionName].FirstOrDefault(s => s.Slot == slot && stage == s.Stage) - ?? Spells[source.ChampionName].FirstOrDefault(s => s.Slot == slot); - - if (spell == null) - { - return null; - } - - var rawDamage = spell.Damage( - source, - target, - Math.Max(0, Math.Min(source.Spellbook.GetSpell(slot).Level - 1, 5))); - spell.CalculatedDamage = CalcDamage(source, target, spell.DamageType, rawDamage); - return spell; - } - - //Spell not found. - return null; - } - - /// - /// Gets the item damage. - /// - /// The source. - /// The target. - /// The item. - /// - public static double GetItemDamage(this Obj_AI_Hero source, Obj_AI_Base target, DamageItems item) - { - switch (item) - { - case DamageItems.Bilgewater: - return source.CalcDamage(target, DamageType.Magical, 100); - case DamageItems.BlackFireTorch: - return source.CalcDamage(target, DamageType.Magical, target.MaxHealth * 0.2); - case DamageItems.Botrk: - return source.CalcDamage(target, DamageType.Physical, target.MaxHealth * 0.1); - case DamageItems.FrostQueenClaim: - return source.CalcDamage(target, DamageType.Magical, 50 + 5 * source.Level); - case DamageItems.Hexgun: - return source.CalcDamage(target, DamageType.Magical, 150 + 0.4 * source.TotalMagicalDamage); - case DamageItems.Hydra: - return source.CalcDamage( - target, - DamageType.Physical, - source.BaseAttackDamage + source.FlatPhysicalDamageMod); - case DamageItems.OdingVeils: - return source.CalcDamage(target, DamageType.Magical, 200); - case DamageItems.Tiamat: - return source.CalcDamage( - target, - DamageType.Physical, - source.BaseAttackDamage + source.FlatPhysicalDamageMod); - case DamageItems.LiandrysTorment: - var d = target.Health * .2f * 3f; - return (target.CanMove || target.HasBuff("slow")) ? d : d * 2; - } - return 1d; - } - - /// - /// Gets the spell damage. - /// - /// The source. - /// The target. - /// Name of the spell. - /// - public static double GetSpellDamage(this Obj_AI_Base source, Obj_AI_Base target, string spellName) - { - var spell = GetDamageSpell(source, target, spellName); - return spell != null ? spell.CalculatedDamage : 0d; - } - - /// - /// Gets the spell damage. - /// - /// The source. - /// The target. - /// The slot. - /// The stage. - /// - public static double GetSpellDamage(this Obj_AI_Hero source, Obj_AI_Base target, SpellSlot slot, int stage = 0) - { - var spell = GetDamageSpell(source, target, slot, stage); - return spell != null ? spell.CalculatedDamage : 0d; - } - - /// - /// Gets the summoner spell damage. - /// - /// The source. - /// The target. - /// The summoner spell. - /// - public static double GetSummonerSpellDamage( - this Obj_AI_Hero source, - Obj_AI_Base target, - SummonerSpell summonerSpell) - { - if (summonerSpell == SummonerSpell.Ignite) - { - return 50 + 20 * source.Level - (target.HPRegenRate / 5 * 3); - } - - if (summonerSpell == SummonerSpell.Smite) - { - if (target is Obj_AI_Hero) - { - var chillingSmite = - source.Spellbook.Spells.FirstOrDefault(h => h.Name.Equals("s5_summonersmiteplayerganker")); - var challengingSmite = - source.Spellbook.Spells.FirstOrDefault(h => h.Name.Equals("s5_summonersmiteduel")); - - if (chillingSmite != null) - { - return 20 + 8 * source.Level; - } - - if (challengingSmite != null) - - { - return 54 + 6 * source.Level; - } - } - - return - new double[] - { 390, 410, 430, 450, 480, 510, 540, 570, 600, 640, 680, 720, 760, 800, 850, 900, 950, 1000 }[ - source.Level - 1]; - } - - return 0d; - } - - /// - /// Calculates the combo damage of the given spell combo on the given target and returns if that damage would kill the - /// target. - /// - /// The source object - /// The target object - /// SpellType array containing the combo spells - /// true if target is killable, false if not. - public static bool IsKillable( - this Obj_AI_Hero source, - Obj_AI_Base target, - IEnumerable> spellCombo) - { - return GetComboDamage(source, target, spellCombo) > target.Health; - } - - #endregion - - #region Methods - - /// - /// Calculates the magic damage. - /// - /// The source. - /// The target. - /// The amount. - /// - private static double CalcMagicDamage(Obj_AI_Base source, Obj_AI_Base target, double amount) - { - var magicResist = target.SpellBlock; - - // Penetration can't reduce magic resist below 0. - double value; - - if (magicResist < 0) - { - value = 2 - 100 / (100 - magicResist); - } - else if ((magicResist * source.PercentMagicPenetrationMod) - source.FlatMagicPenetrationMod < 0) - { - value = 1; - } - else - { - value = 100 / (100 + (magicResist * source.PercentMagicPenetrationMod) - source.FlatMagicPenetrationMod); - } - - var damage = DamageReductionMod( - source, - target, - PassivePercentMod(source, target, value) * amount, - DamageType.Magical); - - return damage; - } - - /// - /// Calculates the mixed damage. - /// - /// The source. - /// The target. - /// The amount of physical damage after modifiers. - /// The amount of magical damage after modifiers. - /// % magic dmg - /// % physical dmg - /// % trueDmg dmg - /// - private static double CalcMixedDamage( - Obj_AI_Base source, - Obj_AI_Base target, - double amountPhysical, - double amountMagic, - int magic = 50, - int physical = 50, - int trueDmg = 0) - { - return CalcMagicDamage(source, target, (amountMagic * magic) / 100) - + CalcPhysicalDamage(source, target, (amountPhysical * physical) / 100) - + PassiveFlatMod(source, target) + (amountMagic * trueDmg) / 100; - } - - /// - /// Calculates the physical damage. - /// - /// The source. - /// The target. - /// The amount. - /// - private static double CalcPhysicalDamage(Obj_AI_Base source, Obj_AI_Base target, double amount) - { - double armorPenetrationPercent = source.PercentArmorPenetrationMod; - double armorPenetrationFlat = source.FlatArmorPenetrationMod; - double bonusArmorPenetrationMod = source.PercentBonusArmorPenetrationMod; - - // Minions return wrong percent values. - if (source is Obj_AI_Minion) - { - armorPenetrationFlat = 0d; - armorPenetrationPercent = 1d; - bonusArmorPenetrationMod = 1d; - } - - // Turrets too. - if (source is Obj_AI_Turret) - { - armorPenetrationFlat = 0d; - armorPenetrationPercent = 1d; - bonusArmorPenetrationMod = 1d; - } - - if (source is Obj_AI_Turret) - { - if (target is Obj_AI_Minion) - { - amount *= 1.25; - if (target.CharData.BaseSkinName.EndsWith("MinionSiege")) - { - amount *= 0.7; - } - - return amount; - } - } - - // Penetration can't reduce armor below 0. - var armor = target.Armor; - var bonusArmor = target.Armor - target.CharData.Armor; - - double value; - if (armor < 0) - { - value = 2 - 100 / (100 - armor); - } - else if ((armor * armorPenetrationPercent) - (bonusArmor * (1 - bonusArmorPenetrationMod)) - - armorPenetrationFlat < 0) - { - value = 1; - } - else - { - value = 100 - / (100 + (armor * armorPenetrationPercent) - (bonusArmor * (1 - bonusArmorPenetrationMod)) - - armorPenetrationFlat); - } - - var damage = DamageReductionMod( - source, - target, - PassivePercentMod(source, target, value) * amount, - DamageType.Physical); - - // Take into account the percent passives, flat passives and damage reduction. - return damage; - } - - /// - /// Gets the damage reduction modifier. - /// - /// The source. - /// The target. - /// The amount. - /// Type of the damage. - /// - private static double DamageReductionMod( - Obj_AI_Base source, - Obj_AI_Base target, - double amount, - DamageType damageType) - { - if (source is Obj_AI_Hero) - { - // Exhaust: - // + Exhausts target enemy champion, reducing their Movement Speed and Attack Speed by 30%, their Armor and Magic Resist by 10, and their damage dealt by 40% for 2.5 seconds. - if (source.HasBuff("Exhaust")) - { - amount *= 0.6d; - } - - // Lament - // + Phantom Dancer reduces all damage dealt to attacker (if he's attack you) by 12% - if (source.HasBuff("itemphantomdancerdebuff")) - { - var caster = source.GetBuff("itemphantomdancerdebuff").Caster; - if (caster.NetworkId == target.NetworkId) - { - amount *= 0.88d; - } - } - } - - var targetHero = target as Obj_AI_Hero; - if (targetHero != null) - { - //Damage Reduction Masteries - - //DAMAGE REDUCTION 2 %, increasing to 8 % when near at least one allied champion - //IN THIS TOGETHER 8 % of the damage that the nearest allied champion would take is dealt to you instead.This can't bring you below 15% health. - var BondofStones = targetHero.GetMastery(MasteryData.Resolve.BondofStones); - if (BondofStones != null && BondofStones.IsActive()) - { - var closebyenemies = - HeroManager.Enemies.Any(x => x.NetworkId != target.NetworkId && x.Distance(target) <= 500); - //500 is not the real value - if (closebyenemies) - { - amount *= 0.92d; - } - else - { - amount *= 0.98d; - } - } - - // Items: - - // Doran's Shield - // + Blocks 8 damage from single target attacks and spells from champions. - if (Items.HasItem(1054, targetHero)) - { - amount -= 8; - } - - // Passives: - - // Unbreakable Will - // + Alistar removes all crowd control effects from himself, then gains additional attack damage and takes 70% reduced physical and magic damage for 7 seconds. - if (target.HasBuff("Ferocious Howl")) - { - amount *= 0.3d; - } - - // Tantrum - // + Amumu takes reduced physical damage from basic attacks and abilities. - if (target.HasBuff("Tantrum") && damageType == DamageType.Physical) - { - amount -= new[] { 2, 4, 6, 8, 10 }[target.Spellbook.GetSpell(SpellSlot.E).Level - 1]; - } - - // Unbreakable - // + Grants Braum 30% / 32.5% / 35% / 37.5% / 40% damage reduction from oncoming sources (excluding true damage and towers) for 3 / 3.25 / 3.5 / 3.75 / 4 seconds. - // + The damage reduction is increased to 100% for the first source of champion damage that would be reduced. - if (target.HasBuff("BraumShieldRaise")) - { - amount -= amount - * new[] { 0.3d, 0.325d, 0.35d, 0.375d, 0.4d }[ - target.Spellbook.GetSpell(SpellSlot.E).Level - 1]; - } - - // Idol of Durand - // + Galio becomes a statue and channels for 2 seconds, Taunt icon taunting nearby foes and reducing incoming physical and magic damage by 50%. - if (target.HasBuff("GalioIdolOfDurand")) - { - amount *= 0.5d; - } - - // Courage - // + Garen gains a defensive shield for a few seconds, reducing incoming damage by 30% and granting 30% crowd control reduction for the duration. - if (target.HasBuff("GarenW")) - { - amount *= 0.7d; - } - - // Drunken Rage - // + Gragas takes a long swig from his barrel, disabling his ability to cast or attack for 1 second and then receives 10% / 12% / 14% / 16% / 18% reduced damage for 3 seconds. - if (target.HasBuff("GragasWSelf")) - { - amount -= amount - * new[] { 0.1d, 0.12d, 0.14d, 0.16d, 0.18d }[ - target.Spellbook.GetSpell(SpellSlot.W).Level - 1]; - } - - // Void Stone - // + Kassadin reduces all magic damage taken by 15%. - if (target.HasBuff("VoidStone") && damageType == DamageType.Magical) - { - amount *= 0.85d; - } - - // Shunpo - // + Katarina teleports to target unit and gains 15% damage reduction for 1.5 seconds. If the target is an enemy, the target takes magic damage. - if (target.HasBuff("KatarinaEReduction")) - { - amount *= 0.85d; - } - - // Vengeful Maelstrom - // + Maokai creates a magical vortex around himself, protecting him and allied champions by reducing damage from non-turret sources by 20% for a maximum of 10 seconds. - if (target.HasBuff("MaokaiDrainDefense") && !(source is Obj_AI_Turret)) - { - amount *= 0.8d; - } - - // Meditate - // + Master Yi channels for up to 4 seconds, restoring health each second. This healing is increased by 1% for every 1% of his missing health. Meditate also resets the autoattack timer. - // + While channeling, Master Yi reduces incoming damage (halved against turrets). - if (target.HasBuff("Meditate")) - { - amount -= amount - * new[] { 0.5d, 0.55d, 0.6d, 0.65d, 0.7d }[ - target.Spellbook.GetSpell(SpellSlot.W).Level - 1] / (source is Obj_AI_Turret ? 2 : 1); - } - - // Shadow Dash - // + Shen reduces all physical damage by 50% from taunted enemies. - if (target.HasBuff("Shen Shadow Dash") && source.HasBuff("Taunt") && damageType == DamageType.Physical) - { - amount *= 0.5d; - } - } - return amount; - } - - private static float GetCritMultiplier(this Obj_AI_Hero hero, bool checkCrit = false) - { - var crit = Items.HasItem((int)ItemId.Infinity_Edge, hero) ? 1.5f : 1; - return !checkCrit ? crit : (Math.Abs(hero.Crit - 1) < float.Epsilon ? 1 + crit : 1); - } - - /// - /// Gets the passive flat modifier. - /// - /// The source. - /// The target. - /// - private static double PassiveFlatMod(Obj_AI_Base source, Obj_AI_Base target) - { - var value = 0d; - var hero = source as Obj_AI_Hero; - var targetHero = target as Obj_AI_Hero; - // Offensive masteries: - - //Fervor of Battle: STACKTIVATE Your basic attacks and spells give you stacks of Fervor for 5 seconds, stacking 10 times. Each stack of Fervor adds 1-8 bonus physical damage to your basic attacks against champions, based on your level. - if (targetHero != null && hero != null) - { - var Fervor = hero.GetMastery(MasteryData.Ferocity.FervorofBattle); - if (Fervor != null && Fervor.IsActive()) - { - value += (0.9 + hero.Level * 0.42) * hero.GetBuffCount("MasteryOnHitDamageStacker"); - } - } - - // Defensive masteries: - - //Tough Skin DIRT OFF YOUR SHOULDERS You take 2 less damage from champion and monster basic attacks - if (targetHero != null && (source is Obj_AI_Hero || source is Obj_AI_Minion)) - { - var Toughskin = targetHero.GetMastery(MasteryData.Resolve.ToughSkin); - if (Toughskin != null && Toughskin.IsActive()) - { - value -= 2; - } - } - - return value; - } - - /// - /// Gets the passive percent modifier. - /// - /// The source. - /// The target. - /// The amount. - /// - private static double PassivePercentMod(Obj_AI_Base source, Obj_AI_Base target, double amount) - { - var SiegeMinionList = new List { "Red_Minion_MechCannon", "Blue_Minion_MechCannon" }; - var NormalMinionList = new List - { - "Red_Minion_Wizard", "Blue_Minion_Wizard", "Red_Minion_Basic", - "Blue_Minion_Basic" - }; - - //Minions and towers passives: - if (source is Obj_AI_Turret) - { - //Siege minions receive 70% damage from turrets - if (SiegeMinionList.Contains(target.CharData.BaseSkinName)) - { - amount *= 0.7d; - } - - //Normal minions take 114% more damage from towers. - else if (NormalMinionList.Contains(target.CharData.BaseSkinName)) - { - amount *= 1.14285714285714d; - } - } - - // Masteries: - var hero = source as Obj_AI_Hero; - var targetHero = target as Obj_AI_Hero; - if (hero != null) - { - // Offensive masteries: - - //INCREASED DAMAGE FROM ABILITIES 0.4/0.8/1.2/1.6/2% - /* - Mastery sorcery = hero.GetMastery(Ferocity.Sorcery); - if (sorcery != null && sorcery.IsActive()) - { - amount *= 1 + ((new double[] { 0.4, 0.8, 1.2, 1.6, 2.0 }[sorcery.Points]) / 100); - } /* - - //MELEE Deal an additional 3 % damage, but receive an additional 1.5 % damage - //RANGED Deal an additional 2 % damage, but receive an additional 2 % damage - Mastery DoubleEdgedSword = hero.GetMastery(Ferocity.DoubleEdgedSword); - if (DoubleEdgedSword != null && DoubleEdgedSword.IsActive()) - { - amount *= hero.IsMelee() ? 1.03 : 1.02; - } - - /* Bounty Hunter: TAKING NAMES You gain a permanent 1 % damage increase for each unique enemy champion you kill - Mastery BountyHunter = hero.GetMastery(Ferocity.BountyHunter); - if (BountyHunter != null && BountyHunter.IsActive()) - { - //We need a hero.UniqueChampionsKilled or both the sender and the target for ChampionKilled OnNotify Event - // amount += amount * Math.Min(hero.ChampionsKilled, 5); - } */ - - //Opressor: KICK 'EM WHEN THEY'RE DOWN You deal 2.5% increased damage to targets with impaired movement (slows, stuns, taunts, etc) - var Opressor = hero.GetMastery(MasteryData.Ferocity.Oppresor); - if (targetHero != null && Opressor != null && Opressor.IsActive() && targetHero.IsMovementImpaired()) - { - amount *= 1.025; - } - - //Merciless DAMAGE AMPLIFICATION 1 / 2 / 3 / 4 / 5 % increased damage to champions below 40 % health - if (targetHero != null) - { - var Merciless = hero.GetMastery(MasteryData.Cunning.Merciless); - if (Merciless != null && Merciless.IsActive() && targetHero.HealthPercent < 40) - { - amount *= 1 + Merciless.Points / 100f; - } - } - - //Thunderlord's Decree: RIDE THE LIGHTNING Your 3rd ability or basic attack on an enemy champion shocks them, dealing 10 - 180(+0.2 bonus attack damage)(+0.1 ability power) magic damage in an area around them - if (false) - // Need a good way to check if it is 3rd attack (Use OnProcessSpell/SpellBook.OnCast if have to) - { - var Thunder = hero.GetMastery(MasteryData.Cunning.ThunderlordsDecree); - if (Thunder != null && Thunder.IsActive()) - { - // amount += 10 * hero.Level + (0.2 * hero.FlatPhysicalDamageMod) + (0.1 * hero.TotalMagicalDamage); - } - } - } - - if (targetHero != null) - { - // Defensive masteries: - - // Double edge sword: - //MELEE Deal an additional 3 % damage, but receive an additional 1.5 % damage - //RANGED Deal an additional 2 % damage, but receive an additional 2 % damage - var des = targetHero.GetMastery(MasteryData.Ferocity.DoubleEdgedSword); - if (des != null && des.IsActive()) - { - amount *= targetHero.IsMelee() ? 1.015d : 1.02d; - } - } - - return amount; - } - - #endregion - - /// - /// Represents a damage spell that only occurs with a passive. - /// - internal class PassiveDamage - { - #region Fields - - /// - /// The champion name - /// - public string ChampionName = ""; - - /// - /// The get damage delegate. - /// - public GetDamageD GetDamage; - - /// - /// The is active delegate. - /// - public IsActiveD IsActive; - - #endregion - - #region Delegates - - /// - /// Gets the damage dealts to the unit. - /// - /// The source. - /// The target. - /// - public delegate double GetDamageD(Obj_AI_Hero source, Obj_AI_Base target); - - /// - /// Gets whether this instance is active. - /// - /// The source. - /// The target. - /// - public delegate bool IsActiveD(Obj_AI_Hero source, Obj_AI_Base target); - - #endregion - } - } -} \ No newline at end of file diff --git a/Dash.cs b/Dash.cs deleted file mode 100644 index 966becbd..00000000 --- a/Dash.cs +++ /dev/null @@ -1,176 +0,0 @@ -namespace LeagueSharp.Common -{ - using System.Collections.Generic; - using System.Linq; - - using SharpDX; - - /// - /// Gets information about dashes, and provides events. - /// - public static class Dash - { - #region Static Fields - - /// - /// The detected dashes - /// - private static readonly Dictionary DetectedDashes = new Dictionary(); - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static Dash() - { - Initialize(); - } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the dash information. - /// - /// The unit. - /// - public static DashItem GetDashInfo(this Obj_AI_Base unit) - { - return DetectedDashes.ContainsKey(unit.NetworkId) ? DetectedDashes[unit.NetworkId] : new DashItem(); - } - - public static void Initialize() - { - Obj_AI_Base.OnNewPath += ObjAiHeroOnOnNewPath; - } - - /// - /// Determines whether this instance is dashing. - /// - /// The unit. - /// - public static bool IsDashing(this Obj_AI_Base unit) - { - if (DetectedDashes.ContainsKey(unit.NetworkId) && unit.Path.Length != 0) - { - return DetectedDashes[unit.NetworkId].EndTick != 0; - } - return false; - } - - public static void Shutdown() - { - Obj_AI_Base.OnNewPath -= ObjAiHeroOnOnNewPath; - } - - #endregion - - #region Methods - - /// - /// Fired when a unit changes paths. - /// - /// The sender. - /// The instance containing the event data. - private static void ObjAiHeroOnOnNewPath(Obj_AI_Base sender, GameObjectNewPathEventArgs args) - { - if (sender.IsValid()) - { - if (!DetectedDashes.ContainsKey(sender.NetworkId)) - { - DetectedDashes.Add(sender.NetworkId, new DashItem()); - } - - if (args.IsDash) - { - var path = new List { sender.ServerPosition.To2D() }; - path.AddRange(args.Path.ToList().To2D()); - - DetectedDashes[sender.NetworkId].StartTick = Utils.TickCount; - DetectedDashes[sender.NetworkId].Speed = args.Speed; - DetectedDashes[sender.NetworkId].StartPos = sender.ServerPosition.To2D(); - DetectedDashes[sender.NetworkId].Unit = sender; - DetectedDashes[sender.NetworkId].Path = path; - DetectedDashes[sender.NetworkId].EndPos = DetectedDashes[sender.NetworkId].Path.Last(); - DetectedDashes[sender.NetworkId].EndTick = DetectedDashes[sender.NetworkId].StartTick - + (int) - (1000 - * (DetectedDashes[sender.NetworkId].EndPos.Distance( - DetectedDashes[sender.NetworkId].StartPos) - / DetectedDashes[sender.NetworkId].Speed)); - DetectedDashes[sender.NetworkId].Duration = DetectedDashes[sender.NetworkId].EndTick - - DetectedDashes[sender.NetworkId].StartTick; - - CustomEvents.Unit.TriggerOnDash( - DetectedDashes[sender.NetworkId].Unit, - DetectedDashes[sender.NetworkId]); - } - else - { - DetectedDashes[sender.NetworkId].EndTick = 0; - } - } - } - - #endregion - - /// - /// Represents a dash. - /// - public class DashItem - { - #region Fields - - /// - /// The duration - /// - public int Duration; - - /// - /// The end position - /// - public Vector2 EndPos; - - /// - /// The end tick - /// - public int EndTick; - - /// - /// true if the dash was a blink, else false - /// - public bool IsBlink; - - /// - /// The path - /// - public List Path; - - /// - /// The speed - /// - public float Speed; - - /// - /// The start position - /// - public Vector2 StartPos; - - /// - /// The start tick - /// - public int StartTick; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - #endregion - } - } -} \ No newline at end of file diff --git a/GamePacket.cs b/GamePacket.cs deleted file mode 100644 index 76af9cc3..00000000 --- a/GamePacket.cs +++ /dev/null @@ -1,573 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.IO; - using System.Linq; - using System.Text; - - using SharpDX; - - /// - /// This class makes easier to handle packets. - /// - public class GamePacket - { - #region Fields - - /// - /// The channel - /// - public PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The _header - /// - private readonly byte _header; - - /// - /// The binary reader. - /// - private readonly BinaryReader Br; - - /// - /// The binary writer - /// - private readonly BinaryWriter Bw; - - /// - /// The memory stream. - /// - private readonly MemoryStream Ms; - - /// - /// The raw packet - /// - private readonly byte[] rawPacket; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The data. - public GamePacket(byte[] data) - { - this.Block = false; - this.Ms = new MemoryStream(data); - this.Br = new BinaryReader(this.Ms); - this.Bw = new BinaryWriter(this.Ms); - - this.Br.BaseStream.Position = 0; - this.Bw.BaseStream.Position = 0; - this.rawPacket = data; - this._header = data[0]; - } - - /// - /// Initializes a new instance of the class. - /// - /// The instance containing the event data. - public GamePacket(GamePacketEventArgs args) - { - this.Block = false; - this.Ms = new MemoryStream(args.PacketData); - this.Br = new BinaryReader(this.Ms); - this.Bw = new BinaryWriter(this.Ms); - - this.Br.BaseStream.Position = 0; - this.Bw.BaseStream.Position = 0; - this.rawPacket = args.PacketData; - this._header = args.PacketData[0]; - this.Channel = args.Channel; - this.Flags = args.ProtocolFlag; - } - - /// - /// Initializes a new instance of the class. - /// - /// The header. - /// The channel. - /// The flags. - public GamePacket( - byte header, - PacketChannel channel = PacketChannel.C2S, - PacketProtocolFlags flags = PacketProtocolFlags.Reliable) - { - this.Block = false; - this.Ms = new MemoryStream(); - this.Br = new BinaryReader(this.Ms); - this.Bw = new BinaryWriter(this.Ms); - - this.Br.BaseStream.Position = 0; - this.Bw.BaseStream.Position = 0; - this.WriteByte(header); - this._header = header; - this.Channel = channel; - this.Flags = flags; - } - - #endregion - - #region Public Properties - - /// - /// Gets or sets a value indicating whether this is block. - /// - /// - /// true if block; otherwise, false. - /// - public bool Block { get; set; } - - /// - /// Gets the header. - /// - /// - /// The header. - /// - public byte Header - { - get - { - return this.ReadByte(0); - } //Better in case header changes, but also resets position. - } - - /// - /// Gets or sets the position. - /// - /// - /// The position. - /// - public long Position - { - get - { - return this.Br.BaseStream.Position; - } - set - { - if (value >= 0L) - { - this.Br.BaseStream.Position = value; - } - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Dumps the packet. - /// - /// if set to true writes additional information. - /// - public string Dump(bool additionalInfo = false) - { - var s = string.Concat(this.Ms.ToArray().Select(b => b.ToString("X2") + " ")); - if (additionalInfo) - { - s = "Channel: " + this.Channel + " Flags: " + this.Flags + " Data: " + s; - } - return s; - } - - /// - /// Gets the raw packet. - /// - /// - public byte[] GetRawPacket() - { - return this.Ms.ToArray(); - } - - /// - /// Receives the packet. - /// - /// The channel. - public void Process(PacketChannel channel = PacketChannel.S2C) - { - return; //Blocked for now 4.21 - if (!this.Block) - { - Game.ProcessPacket(this.Ms.ToArray(), channel); - } - } - - /// - /// Reads a byte from the packet and increases the position by 1. - /// - /// The position. - /// - public byte ReadByte(long position = -1) - { - this.Position = position; - return this.Br.ReadBytes(1)[0]; - } - - /// - /// Reads and returns a float. - /// - /// The position. - /// - public float ReadFloat(long position = -1) - { - this.Position = position; - return BitConverter.ToSingle(this.Br.ReadBytes(4), 0); - } - - /// - /// Reads and returns an integer. - /// - /// The position. - /// - public int ReadInteger(long position = -1) - { - this.Position = position; - return BitConverter.ToInt32(this.Br.ReadBytes(4), 0); - } - - /// - /// Reads and returns a double byte. - /// - /// The position. - /// - public short ReadShort(long position = -1) - { - this.Position = position; - return BitConverter.ToInt16(this.Br.ReadBytes(2), 0); - } - - /// - /// Reads and returns a string. - /// - /// The position. - /// - public string ReadString(long position = -1) - { - this.Position = position; - var sb = new StringBuilder(); - - for (var i = this.Position; i < this.Size(); i++) - { - var num = this.ReadByte(); - - if (num == 0) - { - return sb.ToString(); - } - sb.Append(Convert.ToChar(num)); - } - - return sb.ToString(); - } - - /// - /// Saves the packet dump to a file - /// - /// The file path. - public void SaveToFile(string filePath) - { - var w = File.AppendText(filePath); - - w.WriteLine(this.Dump(true)); - w.Close(); - } - - /// - /// Searches for the byte. - /// - /// The number. - /// - public int[] SearchByte(byte num) - { - //return rawPacket.IndexOf(new byte[num]).ToArray(); - return this.rawPacket.IndexOf(BitConverter.GetBytes(num)).ToArray(); - } - - /// - /// Searches for the float. - /// - /// The number. - /// - public int[] SearchFloat(float num) - { - return this.rawPacket.IndexOf(BitConverter.GetBytes(num)).ToArray(); - } - - /// - /// Searches for the game tile. - /// - /// The position. - /// - public int[][] SearchGameTile(Vector2 position) - { - var tile = NavMesh.WorldToGrid(position.X, position.Y); - var cell = NavMesh.GetCell((short)tile.X, (short)tile.Y); - - var x = this.SearchShort(cell.GridX); - var y = this.SearchShort(cell.GridY); - - return new[] { x, y }; - } - - /// - /// Searches for the game tile. - /// - /// The position. - /// - public int[][] SearchGameTile(Vector3 position) - { - return this.SearchGameTile(position.To2D()); - } - - /// - /// Searches for the game tile. - /// - /// The object. - /// - public int[][] SearchGameTile(GameObject obj) - { - return this.SearchGameTile(obj.Position.To2D()); - } - - /// - /// Searches for the hexadecimal string. - /// - /// The hexadecimal string. - /// - public int[] SearchHexString(string hex) - { - hex = hex.Replace(" ", string.Empty); - - if ((hex.Length % 2) != 0) - { - hex = "0" + hex; - } - - return - this.rawPacket.IndexOf( - Enumerable.Range(0, hex.Length) - .Where(x => x % 2 == 0) - .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) - .ToArray()).ToArray(); - } - - /// - /// Searches for the integer. - /// - /// The number. - /// - public int[] SearchInteger(int num) - { - return this.rawPacket.IndexOf(BitConverter.GetBytes(num)).ToArray(); - } - - /// - /// Searches for the object. - /// - /// The object. - /// - public int[] SearchObject(GameObject obj) - { - if (obj == null || !obj.IsValid || obj.NetworkId == 0) - { - return null; - } - - return this.SearchInteger(obj.NetworkId); - } - - /// - /// Searches forthe object. - /// - /// The network identifier. - /// - public int[] SearchObject(int networkId) - { - return networkId == 0 ? null : this.SearchInteger(networkId); - } - - /// - /// Searches for the position. - /// - /// The position. - /// - public int[][] SearchPosition(Vector2 position) - { - var x = this.SearchFloat(position.X); - var y = this.SearchFloat(position.Y); - - if (x == null || y == null) - { - return null; - } - - return new[] { x, y }; - } - - /// - /// Searches for the position. - /// - /// The position. - /// - public int[][] SearchPosition(Vector3 position) - { - return this.SearchPosition(position.To2D()); - } - - /// - /// Searches for the position. - /// - /// The unit. - /// - public int[][] SearchPosition(GameObject unit) - { - return this.SearchPosition(unit.Position.To2D()); - } - - /// - /// Searches for the position. - /// - /// The unit. - /// - public int[][] SearchPosition(Obj_AI_Base unit) - { - var pos = this.SearchPosition(unit.Position.To2D()); - var pos2 = this.SearchPosition(unit.ServerPosition.To2D()); - - if (pos == null) - { - return pos2; - } - - return pos2 == null ? pos : null; - } - - /// - /// Searches for the short. - /// - /// The number. - /// - public int[] SearchShort(short num) - { - return this.rawPacket.IndexOf(BitConverter.GetBytes(num)).ToArray(); - } - - /// - /// Searches for the string. - /// - /// The string. - /// - public int[] SearchString(string str) - { - return this.rawPacket.IndexOf(Utils.GetBytes(str)).ToArray(); - } - - /// - /// Sends the packet - /// - /// The channel. - /// The flags. - public void Send( - PacketChannel channel = PacketChannel.C2S, - PacketProtocolFlags flags = PacketProtocolFlags.Reliable) - { - return; //Blocked for now 4.21 - if (!this.Block) - { - Game.SendPacket( - this.Ms.ToArray(), - this.Channel == PacketChannel.C2S ? channel : this.Channel, - this.Flags == PacketProtocolFlags.Reliable ? flags : this.Flags); - } - } - - /// - /// Returns the packet size. - /// - /// - public long Size() - { - return this.Br.BaseStream.Length; - } - - /// - /// Writes a byte. - /// - /// The byte. - /// Specifies how many times to write the packet. - public void WriteByte(byte b, int repeat = 1) - { - for (var i = 0; i < repeat; i++) - { - this.Bw.Write(b); - } - } - - /// - /// Writes a float. - /// - /// The float. - public void WriteFloat(float f) - { - this.Bw.Write(f); - } - - /// - /// Writes the hex string as bytes to the packet. - /// - /// The hexadecimal string. - public void WriteHexString(string hex) - { - hex = hex.Replace(" ", string.Empty); - - if ((hex.Length % 2) != 0) - { - hex = "0" + hex; - } - - this.Bw.Write( - Enumerable.Range(0, hex.Length) - .Where(x => x % 2 == 0) - .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) - .ToArray()); - } - - /// - /// Writes an integer. - /// - /// The integer. - public void WriteInteger(int i) - { - this.Bw.Write(i); - } - - /// - /// Writes a short. - /// - /// The short. - public void WriteShort(short s) - { - this.Bw.Write(s); - } - - /// - /// Writes the string. - /// - /// The string. - public void WriteString(string str) - { - this.Bw.Write(Encoding.UTF8.GetBytes(str)); - } - - #endregion - } -} \ No newline at end of file diff --git a/Geometry.cs b/Geometry.cs deleted file mode 100644 index 7d42253b..00000000 --- a/Geometry.cs +++ /dev/null @@ -1,1713 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using ClipperLib; - - using SharpDX; - - using Color = System.Drawing.Color; - - /// - /// Provides methods regarding geometry math. - /// - public static class Geometry - { - #region Public Methods and Operators - - /// - /// Returns the angle with the vector p2 in degrees; - /// - /// The first point. - /// The second point. - /// - public static float AngleBetween(this Vector2 p1, Vector2 p2) - { - var theta = p1.Polar() - p2.Polar(); - if (theta < 0) - { - theta = theta + 360; - } - if (theta > 180) - { - theta = 360 - theta; - } - return theta; - } - - /// - /// Returns a Vector2 at center of the polygone. - /// - /// The polygon. - /// - public static Vector2 CenterOfPolygone(this Polygon p) - { - var cX = 0f; - var cY = 0f; - var pc = p.Points.Count; - foreach (var point in p.Points) - { - cX += point.X; - cY += point.Y; - } - return new Vector2(cX / pc, cY / pc); - } - - /// - /// Returns the two intersection points between two circles. - /// - /// The center1. - /// The center2. - /// The radius1. - /// The radius2. - /// - public static Vector2[] CircleCircleIntersection(Vector2 center1, Vector2 center2, float radius1, float radius2) - { - var D = center1.Distance(center2); - //The Circles dont intersect: - if (D > radius1 + radius2 || (D <= Math.Abs(radius1 - radius2))) - { - return new Vector2[] { }; - } - - var A = (radius1 * radius1 - radius2 * radius2 + D * D) / (2 * D); - var H = (float)Math.Sqrt(radius1 * radius1 - A * A); - var Direction = (center2 - center1).Normalized(); - var PA = center1 + A * Direction; - var S1 = PA + H * Direction.Perpendicular(); - var S2 = PA - H * Direction.Perpendicular(); - return new[] { S1, S2 }; - } - - /// - /// Clips the polygons. - /// - /// The polygons. - /// - public static List> ClipPolygons(List polygons) - { - var subj = new List>(polygons.Count); - var clip = new List>(polygons.Count); - foreach (var polygon in polygons) - { - subj.Add(polygon.ToClipperPath()); - clip.Add(polygon.ToClipperPath()); - } - var solution = new List>(); - var c = new Clipper(); - c.AddPaths(subj, PolyType.ptSubject, true); - c.AddPaths(clip, PolyType.ptClip, true); - c.Execute(ClipType.ctUnion, solution, PolyFillType.pftPositive, PolyFillType.pftEvenOdd); - return solution; - } - - /// - /// Checks if the two floats are close to each other. - /// - /// a. - /// The b. - /// The epsilon. - /// - public static bool Close(float a, float b, float eps) - { - if (Math.Abs(eps) < float.Epsilon) - { - eps = (float)1e-9; - } - return Math.Abs(a - b) <= eps; - } - - /// - /// Returns the closest vector from a list. - /// - /// The v. - /// The v list. - /// - public static Vector2 Closest(this Vector2 v, List vList) - { - var result = new Vector2(); - var dist = float.MaxValue; - - foreach (var vector in vList) - { - var distance = Vector2.DistanceSquared(v, vector); - if (distance < dist) - { - dist = distance; - result = vector; - } - } - - return result; - } - - /// - /// Returns the cross product Z value. - /// - /// The self. - /// The other. - /// - public static float CrossProduct(this Vector2 self, Vector2 other) - { - return other.Y * self.X - other.X * self.Y; - } - - /// - /// Converts degrees to radians. - /// - /// The angle. - /// - public static float DegreeToRadian(double angle) - { - return (float)(Math.PI * angle / 180.0); - } - - //Obj_AI_Base class extended methods: - /// - /// Calculates the 2D distance to the unit. - /// - /// Another unit. - /// if set to true [squared]. - /// - public static float Distance(Obj_AI_Base anotherUnit, bool squared = false) - { - return ObjectManager.Player.Distance(anotherUnit, squared); - } - - /// - /// Calculates the 2D distance to the unit. - /// - /// The unit. - /// Another unit. - /// if set to true [squared]. - /// - public static float Distance(this Obj_AI_Base unit, Obj_AI_Base anotherUnit, bool squared = false) - { - return unit.ServerPosition.To2D().Distance(anotherUnit.ServerPosition.To2D(), squared); - } - - /// - /// Calculates the 2D distance to the unit. - /// - /// The unit. - /// Another unit. - /// if set to true [squared]. - /// - public static float Distance(this Obj_AI_Base unit, AttackableUnit anotherUnit, bool squared = false) - { - return unit.ServerPosition.To2D().Distance(anotherUnit.Position.To2D(), squared); - } - - /// - /// Calculates the 2D distance to the point. - /// - /// The unit. - /// The point. - /// if set to true [squared]. - /// - public static float Distance(this Obj_AI_Base unit, Vector3 point, bool squared = false) - { - return unit.ServerPosition.To2D().Distance(point.To2D(), squared); - } - - /// - /// Calculates the 2D distance to the point. - /// - /// The unit. - /// The point. - /// if set to true [squared]. - /// - public static float Distance(this Obj_AI_Base unit, Vector2 point, bool squared = false) - { - return unit.ServerPosition.To2D().Distance(point, squared); - } - - /// - /// Returns the 2D distance (XY plane) between two vector. - /// - /// The v. - /// The other. - /// if set to true [squared]. - /// - public static float Distance(this Vector3 v, Vector3 other, bool squared = false) - { - return v.To2D().Distance(other, squared); - } - - /// - /// Calculates the distance to the Vector2. - /// - /// The v. - /// To. - /// if set to true gets the distance squared. - /// - public static float Distance(this Vector2 v, Vector2 to, bool squared = false) - { - return squared ? Vector2.DistanceSquared(v, to) : Vector2.Distance(v, to); - } - - /// - /// Calculates the distance to the Vector3. - /// - /// The v. - /// To. - /// if set to true gets the distance squared. - /// - public static float Distance(this Vector2 v, Vector3 to, bool squared = false) - { - return v.Distance(to.To2D(), squared); - } - - /// - /// Calculates the distance to the unit. - /// - /// The v. - /// To. - /// if set to true gets the distance squared. - /// - public static float Distance(this Vector2 v, Obj_AI_Base to, bool squared = false) - { - return v.Distance(to.ServerPosition.To2D(), squared); - } - - /// - /// Returns the distance to the line segment. - /// - /// The point. - /// The segment start. - /// The segment end. - /// if set to true [only if on segment]. - /// if set to true [squared]. - /// - public static float Distance( - this Vector2 point, - Vector2 segmentStart, - Vector2 segmentEnd, - bool onlyIfOnSegment = false, - bool squared = false) - { - var objects = point.ProjectOn(segmentStart, segmentEnd); - - if (objects.IsOnSegment || onlyIfOnSegment == false) - { - return squared - ? Vector2.DistanceSquared(objects.SegmentPoint, point) - : Vector2.Distance(objects.SegmentPoint, point); - } - return float.MaxValue; - } - - /// - /// Calculates the 3D distance to the unit. - /// - /// The unit. - /// Another unit. - /// if set to true [squared]. - /// - public static float Distance3D(this Obj_AI_Base unit, Obj_AI_Base anotherUnit, bool squared = false) - { - return squared - ? Vector3.DistanceSquared(unit.Position, anotherUnit.Position) - : Vector3.Distance(unit.Position, anotherUnit.Position); - } - - /// - /// Extends the vector. - /// - /// The vector. - /// The vector to extend to - /// The distance to extend. - /// - public static Vector2 Extend(this Vector2 v, Vector2 to, float distance) - { - return v + distance * (to - v).Normalized(); - } - - /// - /// Extends the specified vector. - /// - /// The vector. - /// The vector to extend to. - /// The distance. - /// - public static Vector3 Extend(this Vector3 v, Vector3 to, float distance) - { - return v + distance * (to - v).Normalized(); - } - - //From: http://social.msdn.microsoft.com/Forums/vstudio/en-US/e5993847-c7a9-46ec-8edc-bfb86bd689e3/help-on-line-segment-intersection-algorithm - /// - /// Intersects two line segments. - /// - /// The line segment1 start. - /// The line segment1 end. - /// The line segment2 start. - /// The line segment2 end. - /// - public static IntersectionResult Intersection( - this Vector2 lineSegment1Start, - Vector2 lineSegment1End, - Vector2 lineSegment2Start, - Vector2 lineSegment2End) - { - double deltaACy = lineSegment1Start.Y - lineSegment2Start.Y; - double deltaDCx = lineSegment2End.X - lineSegment2Start.X; - double deltaACx = lineSegment1Start.X - lineSegment2Start.X; - double deltaDCy = lineSegment2End.Y - lineSegment2Start.Y; - double deltaBAx = lineSegment1End.X - lineSegment1Start.X; - double deltaBAy = lineSegment1End.Y - lineSegment1Start.Y; - - var denominator = deltaBAx * deltaDCy - deltaBAy * deltaDCx; - var numerator = deltaACy * deltaDCx - deltaACx * deltaDCy; - - if (Math.Abs(denominator) < float.Epsilon) - { - if (Math.Abs(numerator) < float.Epsilon) - { - // collinear. Potentially infinite intersection points. - // Check and return one of them. - if (lineSegment1Start.X >= lineSegment2Start.X && lineSegment1Start.X <= lineSegment2End.X) - { - return new IntersectionResult(true, lineSegment1Start); - } - if (lineSegment2Start.X >= lineSegment1Start.X && lineSegment2Start.X <= lineSegment1End.X) - { - return new IntersectionResult(true, lineSegment2Start); - } - return new IntersectionResult(); - } - // parallel - return new IntersectionResult(); - } - - var r = numerator / denominator; - if (r < 0 || r > 1) - { - return new IntersectionResult(); - } - - var s = (deltaACy * deltaBAx - deltaACx * deltaBAy) / denominator; - if (s < 0 || s > 1) - { - return new IntersectionResult(); - } - - return new IntersectionResult( - true, - new Vector2((float)(lineSegment1Start.X + r * deltaBAx), (float)(lineSegment1Start.Y + r * deltaBAy))); - } - - //Vector2 class extended methods: - - /// - /// Returns true if the vector is valid. - /// - /// The vector. - /// - public static bool IsValid(this Vector2 v) - { - return v != Vector2.Zero; - } - - /// - /// Determines whether this instance is valid. - /// - /// The vector. - /// - public static bool IsValid(this Vector3 v) - { - return v != Vector3.Zero; - } - - /// - /// Joins all the polygones in the list in one polygone if they interect. - /// - /// The polygon list. - /// - public static List JoinPolygons(this List sList) - { - var p = ClipPolygons(sList); - var tList = new List>(); - - var c = new Clipper(); - c.AddPaths(p, PolyType.ptClip, true); - c.Execute(ClipType.ctUnion, tList, PolyFillType.pftNonZero, PolyFillType.pftNonZero); - - return ToPolygons(tList); - } - - /// - /// Joins all the polygones. - /// ClipType: http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Types/ClipType.htm - /// PolyFillType: http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Types/PolyFillType.htm - /// - /// The s list. - /// Type of the c. - /// Type of the p. - /// The p f type1. - /// The p f type2. - /// - public static List JoinPolygons( - this List sList, - ClipType cType, - PolyType pType = PolyType.ptClip, - PolyFillType pFType1 = PolyFillType.pftNonZero, - PolyFillType pFType2 = PolyFillType.pftNonZero) - { - var p = ClipPolygons(sList); - var tList = new List>(); - - var c = new Clipper(); - c.AddPaths(p, pType, true); - c.Execute(cType, tList, pFType1, pFType2); - - return ToPolygons(tList); - } - - /// - /// Moves the polygone to the set position. It dosent rotate the polygone. - /// - /// The polygon. - /// The move to. - /// - public static Polygon MovePolygone(this Polygon polygon, Vector2 moveTo) - { - var p = new Polygon(); - - p.Add(moveTo); - - var count = polygon.Points.Count; - - var startPoint = polygon.Points[0]; - - for (var i = 1; i < count; i++) - { - var polygonePoint = polygon.Points[i]; - - p.Add( - new Vector2( - moveTo.X + (polygonePoint.X - startPoint.X), - moveTo.Y + (polygonePoint.Y - startPoint.Y))); - } - return p; - } - - /// - /// Returns the vector normalized. - /// - /// The vector. - /// - public static Vector2 Normalized(this Vector2 v) - { - v.Normalize(); - return v; - } - - /// - /// Normalizes the specified vector. - /// - /// The vector. - /// - public static Vector3 Normalized(this Vector3 v) - { - v.Normalize(); - return v; - } - - /// - /// Returns the total distance of a path. - /// - /// The path. - /// - public static float PathLength(this List path) - { - var distance = 0f; - for (var i = 0; i < path.Count - 1; i++) - { - distance += path[i].Distance(path[i + 1]); - } - return distance; - } - - /// - /// Returns the perpendicular vector. - /// - /// The v. - /// - public static Vector2 Perpendicular(this Vector2 v) - { - return new Vector2(-v.Y, v.X); - } - - /// - /// Returns the second perpendicular vector. - /// - /// The vector. - /// - public static Vector2 Perpendicular2(this Vector2 v) - { - return new Vector2(v.Y, -v.X); - } - - /// - /// Returns the polar for vector angle (in Degrees). - /// - /// The vector. - /// - public static float Polar(this Vector2 v1) - { - if (Close(v1.X, 0, 0)) - { - if (v1.Y > 0) - { - return 90; - } - return v1.Y < 0 ? 270 : 0; - } - - var theta = RadianToDegree(Math.Atan((v1.Y) / v1.X)); - if (v1.X < 0) - { - theta = theta + 180; - } - if (theta < 0) - { - theta = theta + 360; - } - return theta; - } - - /// - /// Returns the position where the vector will be after t(time) with s(speed) and delay. - /// - /// The self. - /// The time. - /// The speed. - /// The delay. - /// - public static Vector2 PositionAfter(this List self, int t, int s, int delay = 0) - { - var distance = Math.Max(0, t - delay) * s / 1000; - for (var i = 0; i <= self.Count - 2; i++) - { - var from = self[i]; - var to = self[i + 1]; - var d = (int)to.Distance(from); - if (d > distance) - { - return from + distance * (to - from).Normalized(); - } - distance -= d; - } - return self[self.Count - 1]; - } - - /// - /// Returns the projection of the Vector2 on the segment. - /// - /// The point. - /// The segment start. - /// The segment end. - /// - public static ProjectionInfo ProjectOn(this Vector2 point, Vector2 segmentStart, Vector2 segmentEnd) - { - var cx = point.X; - var cy = point.Y; - var ax = segmentStart.X; - var ay = segmentStart.Y; - var bx = segmentEnd.X; - var by = segmentEnd.Y; - var rL = ((cx - ax) * (bx - ax) + (cy - ay) * (by - ay)) - / ((float)Math.Pow(bx - ax, 2) + (float)Math.Pow(by - ay, 2)); - var pointLine = new Vector2(ax + rL * (bx - ax), ay + rL * (by - ay)); - float rS; - if (rL < 0) - { - rS = 0; - } - else if (rL > 1) - { - rS = 1; - } - else - { - rS = rL; - } - - var isOnSegment = rS.CompareTo(rL) == 0; - var pointSegment = isOnSegment ? pointLine : new Vector2(ax + rS * (bx - ax), ay + rS * (@by - ay)); - return new ProjectionInfo(isOnSegment, pointSegment, pointLine); - } - - /// - /// Converts radians to degrees. - /// - /// The angle. - /// - public static float RadianToDegree(double angle) - { - return (float)(angle * (180.0 / Math.PI)); - } - - /// - /// Rotates the vector around the set position. - /// Angle is in radians. - /// - /// The rotated. - /// The around. - /// The angle. - /// - public static Vector2 RotateAroundPoint(this Vector2 rotated, Vector2 around, float angle) - { - var sin = Math.Sin(angle); - var cos = Math.Cos(angle); - - var x = cos * (rotated.X - around.X) - sin * (rotated.Y - around.Y) + around.X; - var y = sin * (rotated.X - around.X) + cos * (rotated.Y - around.Y) + around.Y; - - return new Vector2((float)x, (float)y); - } - - /// - /// Rotates the vector a set angle (angle in radians). - /// - /// The vector. - /// The angle. - /// - public static Vector2 Rotated(this Vector2 v, float angle) - { - var c = Math.Cos(angle); - var s = Math.Sin(angle); - - return new Vector2((float)(v.X * c - v.Y * s), (float)(v.Y * c + v.X * s)); - } - - /// - /// Rotates the polygon around the set position. - /// Angle is in radians. - /// - /// The polygon. - /// The around. - /// The angle. - /// - public static Polygon RotatePolygon(this Polygon polygon, Vector2 around, float angle) - { - var p = new Polygon(); - - foreach (var polygonePoint in polygon.Points.Select(poinit => RotateAroundPoint(poinit, around, angle))) - { - p.Add(polygonePoint); - } - return p; - } - - /// - /// Rotates the polygon around to the set direction. - /// - /// The polygon. - /// The around. - /// The direction. - /// - public static Polygon RotatePolygon(this Polygon polygon, Vector2 around, Vector2 direction) - { - var deltaX = around.X - direction.X; - var deltaY = around.Y - direction.Y; - var angle = (float)Math.Atan2(deltaY, deltaX); - return RotatePolygon(polygon, around, angle - DegreeToRadian(90)); - } - - /// - /// Sets the z. - /// - /// The v. - /// The value. - /// - public static Vector3 SetZ(this Vector3 v, float? value = null) - { - if (value == null) - { - v.Z = Game.CursorPos.Z; - } - else - { - v.Z = (float)value; - } - return v; - } - - /// - /// Shortens the specified vector. - /// - /// The vector. - /// The vector to shorten from. - /// The distance. - /// - public static Vector2 Shorten(this Vector2 v, Vector2 to, float distance) - { - return v - distance * (to - v).Normalized(); - } - - /// - /// Shortens the specified vector. - /// - /// The vector. - /// The vector to shorten from. - /// The distance. - /// - public static Vector3 Shorten(this Vector3 v, Vector3 to, float distance) - { - return v - distance * (to - v).Normalized(); - } - - /// - /// Switches the Y and Z. - /// - /// The vector. - /// - public static Vector3 SwitchYZ(this Vector3 v) - { - return new Vector3(v.X, v.Z, v.Y); - } - - //Vector3 class extended methods: - - /// - /// Converts a Vector3 to Vector2 - /// - /// The v. - /// - public static Vector2 To2D(this Vector3 v) - { - return new Vector2(v.X, v.Y); - } - - /// - /// Converts a 3D path to 2D - /// - /// The path. - /// - public static List To2D(this List path) - { - return path.Select(point => point.To2D()).ToList(); - } - - /// - /// Converts the Vector2 to Vector3. (Z = Player.ServerPosition.Z) - /// - /// The vector. - /// - public static Vector3 To3D(this Vector2 v) - { - return new Vector3(v.X, v.Y, ObjectManager.Player.ServerPosition.Z); - } - - /// - /// Converts the Vector2 to Vector3. (Z = NavMesh.GetHeightForPosition) - /// - /// The vector. - /// - public static Vector3 To3D2(this Vector2 v) - { - return new Vector3(v.X, v.Y, NavMesh.GetHeightForPosition(v.X, v.Y)); - } - - /// - /// Converts a list of to a polygon. - /// - /// The int points. - /// - public static Polygon ToPolygon(this List v) - { - var polygon = new Polygon(); - foreach (var point in v) - { - polygon.Add(new Vector2(point.X, point.Y)); - } - return polygon; - } - - /// - /// Converts a list of list points to a polygon. - /// - /// The v. - /// - public static List ToPolygons(this List> v) - { - return v.Select(path => path.ToPolygon()).ToList(); - } - - /// - /// Gets the vectors movement collision. - /// - /// The start point1. - /// The end point1. - /// The v1. - /// The start point2. - /// The v2. - /// The delay. - /// - public static Object[] VectorMovementCollision( - Vector2 startPoint1, - Vector2 endPoint1, - float v1, - Vector2 startPoint2, - float v2, - float delay = 0f) - { - float sP1x = startPoint1.X, - sP1y = startPoint1.Y, - eP1x = endPoint1.X, - eP1y = endPoint1.Y, - sP2x = startPoint2.X, - sP2y = startPoint2.Y; - - float d = eP1x - sP1x, e = eP1y - sP1y; - float dist = (float)Math.Sqrt(d * d + e * e), t1 = float.NaN; - float S = Math.Abs(dist) > float.Epsilon ? v1 * d / dist : 0, - K = (Math.Abs(dist) > float.Epsilon) ? v1 * e / dist : 0f; - - float r = sP2x - sP1x, j = sP2y - sP1y; - var c = r * r + j * j; - - if (dist > 0f) - { - if (Math.Abs(v1 - float.MaxValue) < float.Epsilon) - { - var t = dist / v1; - t1 = v2 * t >= 0f ? t : float.NaN; - } - else if (Math.Abs(v2 - float.MaxValue) < float.Epsilon) - { - t1 = 0f; - } - else - { - float a = S * S + K * K - v2 * v2, b = -r * S - j * K; - - if (Math.Abs(a) < float.Epsilon) - { - if (Math.Abs(b) < float.Epsilon) - { - t1 = (Math.Abs(c) < float.Epsilon) ? 0f : float.NaN; - } - else - { - var t = -c / (2 * b); - t1 = (v2 * t >= 0f) ? t : float.NaN; - } - } - else - { - var sqr = b * b - a * c; - if (sqr >= 0) - { - var nom = (float)Math.Sqrt(sqr); - var t = (-nom - b) / a; - t1 = v2 * t >= 0f ? t : float.NaN; - t = (nom - b) / a; - var t2 = (v2 * t >= 0f) ? t : float.NaN; - - if (!float.IsNaN(t2) && !float.IsNaN(t1)) - { - if (t1 >= delay && t2 >= delay) - { - t1 = Math.Min(t1, t2); - } - else if (t2 >= delay) - { - t1 = t2; - } - } - } - } - } - } - else if (Math.Abs(dist) < float.Epsilon) - { - t1 = 0f; - } - - return new Object[] { t1, (!float.IsNaN(t1)) ? new Vector2(sP1x + S * t1, sP1y + K * t1) : new Vector2() }; - } - - #endregion - - /// - /// Represents an intersection result. - /// - public struct IntersectionResult - { - #region Fields - - /// - /// If they intersect. - /// - public bool Intersects; - - /// - /// The point - /// - public Vector2 Point; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// if set to true, they insersect. - /// The point. - public IntersectionResult(bool Intersects = false, Vector2 Point = new Vector2()) - { - this.Intersects = Intersects; - this.Point = Point; - } - - #endregion - } - - /// - /// Represents the projection information. - /// - public struct ProjectionInfo - { - #region Fields - - /// - /// The is on segment - /// - public bool IsOnSegment; - - /// - /// The line point - /// - public Vector2 LinePoint; - - /// - /// The segment point - /// - public Vector2 SegmentPoint; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// if set to true [is on segment]. - /// The segment point. - /// The line point. - public ProjectionInfo(bool isOnSegment, Vector2 segmentPoint, Vector2 linePoint) - { - this.IsOnSegment = isOnSegment; - this.SegmentPoint = segmentPoint; - this.LinePoint = linePoint; - } - - #endregion - } - - /// - /// Represents a polygon. - /// - public class Polygon - { - #region Fields - - /// - /// The points - /// - public List Points = new List(); - - #endregion - - #region Public Methods and Operators - - /// - /// Adds the specified point. - /// - /// The point. - public void Add(Vector2 point) - { - this.Points.Add(point); - } - - /// - /// Adds the specified point. - /// - /// The point. - public void Add(Vector3 point) - { - this.Points.Add(point.To2D()); - } - - /// - /// Adds the specified polygon. - /// - /// The polygon. - public void Add(Polygon polygon) - { - foreach (var point in polygon.Points) - { - this.Points.Add(point); - } - } - - /// - /// Draws the polygon. - /// - /// The color. - /// The width. - public virtual void Draw(Color color, int width = 1) - { - for (var i = 0; i <= this.Points.Count - 1; i++) - { - var nextIndex = (this.Points.Count - 1 == i) ? 0 : (i + 1); - var from = Drawing.WorldToScreen(this.Points[i].To3D()); - var to = Drawing.WorldToScreen(this.Points[nextIndex].To3D()); - Drawing.DrawLine(from[0], from[1], to[0], to[1], width, color); - } - } - - /// - /// Determines whether the specified point is inside. - /// - /// The point. - /// - public bool IsInside(Vector2 point) - { - return !this.IsOutside(point); - } - - /// - /// Determines whether the specified point is inside. - /// - /// The point. - /// - public bool IsInside(Vector3 point) - { - return !this.IsOutside(point.To2D()); - } - - /// - /// Determines whether the specified point is inside. - /// - /// The point. - /// - public bool IsInside(GameObject point) - { - return !this.IsOutside(point.Position.To2D()); - } - - /// - /// Determines whether the specified point is outside. - /// - /// The point. - /// - public bool IsOutside(Vector2 point) - { - var p = new IntPoint(point.X, point.Y); - return Clipper.PointInPolygon(p, this.ToClipperPath()) != 1; - } - - /// - /// Converts this instance to a clipper path. - /// - /// - public List ToClipperPath() - { - var result = new List(this.Points.Count); - result.AddRange(this.Points.Select(point => new IntPoint(point.X, point.Y))); - return result; - } - - #endregion - - /// - /// Represnets an arc polygon. - /// - public class Arc : Polygon - { - #region Fields - - /// - /// The angle - /// - public float Angle; - - /// - /// The end position - /// - public Vector2 EndPos; - - /// - /// The radius - /// - public float Radius; - - /// - /// The start position - /// - public Vector2 StartPos; - - /// - /// The quality - /// - private readonly int _quality; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The start. - /// The direction. - /// The angle. - /// The radius. - /// The quality. - public Arc(Vector3 start, Vector3 direction, float angle, float radius, int quality = 20) - : this(start.To2D(), direction.To2D(), angle, radius, quality) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The start. - /// The direction. - /// The angle. - /// The radius. - /// The quality. - public Arc(Vector2 start, Vector2 direction, float angle, float radius, int quality = 20) - { - this.StartPos = start; - this.EndPos = (direction - start).Normalized(); - this.Angle = angle; - this.Radius = radius; - this._quality = quality; - this.UpdatePolygon(); - } - - #endregion - - #region Public Methods and Operators - - /// - /// Updates the polygon. - /// - /// The offset. - public void UpdatePolygon(int offset = 0) - { - this.Points.Clear(); - var outRadius = (this.Radius + offset) / (float)Math.Cos(2 * Math.PI / this._quality); - var side1 = this.EndPos.Rotated(-this.Angle * 0.5f); - for (var i = 0; i <= this._quality; i++) - { - var cDirection = side1.Rotated(i * this.Angle / this._quality).Normalized(); - this.Points.Add( - new Vector2( - this.StartPos.X + outRadius * cDirection.X, - this.StartPos.Y + outRadius * cDirection.Y)); - } - } - - #endregion - } - - /// - /// Represents a circle polygon. - /// - public class Circle : Polygon - { - #region Fields - - /// - /// The center - /// - public Vector2 Center; - - /// - /// The radius - /// - public float Radius; - - /// - /// The quality - /// - private readonly int _quality; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The center. - /// The radius. - /// The quality. - public Circle(Vector3 center, float radius, int quality = 20) - : this(center.To2D(), radius, quality) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The center. - /// The radius. - /// The quality. - public Circle(Vector2 center, float radius, int quality = 20) - { - this.Center = center; - this.Radius = radius; - this._quality = quality; - this.UpdatePolygon(); - } - - #endregion - - #region Public Methods and Operators - - /// - /// Updates the polygon. - /// - /// The offset. - /// Width of the override. - public void UpdatePolygon(int offset = 0, float overrideWidth = -1) - { - this.Points.Clear(); - var outRadius = (overrideWidth > 0 - ? overrideWidth - : (offset + this.Radius) / (float)Math.Cos(2 * Math.PI / this._quality)); - for (var i = 1; i <= this._quality; i++) - { - var angle = i * 2 * Math.PI / this._quality; - var point = new Vector2( - this.Center.X + outRadius * (float)Math.Cos(angle), - this.Center.Y + outRadius * (float)Math.Sin(angle)); - this.Points.Add(point); - } - } - - #endregion - } - - /// - /// Represents a line polygon. - /// - public class Line : Polygon - { - #region Fields - - /// - /// The line end - /// - public Vector2 LineEnd; - - /// - /// The line start - /// - public Vector2 LineStart; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The start. - /// The end. - /// The length. - public Line(Vector3 start, Vector3 end, float length = -1) - : this(start.To2D(), end.To2D(), length) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The start. - /// The end. - /// The length. - public Line(Vector2 start, Vector2 end, float length = -1) - { - this.LineStart = start; - this.LineEnd = end; - if (length > 0) - { - this.Length = length; - } - this.UpdatePolygon(); - } - - #endregion - - #region Public Properties - - /// - /// Gets or sets the length. - /// - /// - /// The length. - /// - public float Length - { - get - { - return this.LineStart.Distance(this.LineEnd); - } - set - { - this.LineEnd = (this.LineEnd - this.LineStart).Normalized() * value + this.LineStart; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Updates the polygon. - /// - public void UpdatePolygon() - { - this.Points.Clear(); - this.Points.Add(this.LineStart); - this.Points.Add(this.LineEnd); - } - - #endregion - } - - /// - /// Represents a rectangle polygon. - /// - public class Rectangle : Polygon - { - #region Fields - - /// - /// The end - /// - public Vector2 End; - - /// - /// The start - /// - public Vector2 Start; - - /// - /// The width - /// - public float Width; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The start. - /// The end. - /// The width. - public Rectangle(Vector3 start, Vector3 end, float width) - : this(start.To2D(), end.To2D(), width) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The start. - /// The end. - /// The width. - public Rectangle(Vector2 start, Vector2 end, float width) - { - this.Start = start; - this.End = end; - this.Width = width; - this.UpdatePolygon(); - } - - #endregion - - #region Public Properties - - /// - /// Gets the direction. - /// - /// - /// The direction. - /// - public Vector2 Direction - { - get - { - return (this.End - this.Start).Normalized(); - } - } - - /// - /// Gets the perpendicular. - /// - /// - /// The perpendicular. - /// - public Vector2 Perpendicular - { - get - { - return this.Direction.Perpendicular(); - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Updates the polygon. - /// - /// The offset. - /// Width of the override. - public void UpdatePolygon(int offset = 0, float overrideWidth = -1) - { - this.Points.Clear(); - this.Points.Add( - this.Start + (overrideWidth > 0 ? overrideWidth : this.Width + offset) * this.Perpendicular - - offset * this.Direction); - this.Points.Add( - this.Start - (overrideWidth > 0 ? overrideWidth : this.Width + offset) * this.Perpendicular - - offset * this.Direction); - this.Points.Add( - this.End - (overrideWidth > 0 ? overrideWidth : this.Width + offset) * this.Perpendicular - + offset * this.Direction); - this.Points.Add( - this.End + (overrideWidth > 0 ? overrideWidth : this.Width + offset) * this.Perpendicular - + offset * this.Direction); - } - - #endregion - } - - /// - /// Represents a ring polygon. - /// - public class Ring : Polygon - { - #region Fields - - /// - /// The center - /// - public Vector2 Center; - - /// - /// The inner radius - /// - public float InnerRadius; - - /// - /// The outer radius - /// - public float OuterRadius; - - /// - /// The quality - /// - private readonly int _quality; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The center. - /// The inner radius. - /// The outer radius. - /// The quality. - public Ring(Vector3 center, float innerRadius, float outerRadius, int quality = 20) - : this(center.To2D(), innerRadius, outerRadius, quality) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The center. - /// The inner radius. - /// The outer radius. - /// The quality. - public Ring(Vector2 center, float innerRadius, float outerRadius, int quality = 20) - { - this.Center = center; - this.InnerRadius = innerRadius; - this.OuterRadius = outerRadius; - this._quality = quality; - this.UpdatePolygon(); - } - - #endregion - - #region Public Methods and Operators - - /// - /// Updates the polygon. - /// - /// The offset. - public void UpdatePolygon(int offset = 0) - { - this.Points.Clear(); - var outRadius = (offset + this.InnerRadius + this.OuterRadius) - / (float)Math.Cos(2 * Math.PI / this._quality); - var innerRadius = this.InnerRadius - this.OuterRadius - offset; - for (var i = 0; i <= this._quality; i++) - { - var angle = i * 2 * Math.PI / this._quality; - var point = new Vector2( - this.Center.X - outRadius * (float)Math.Cos(angle), - this.Center.Y - outRadius * (float)Math.Sin(angle)); - this.Points.Add(point); - } - for (var i = 0; i <= this._quality; i++) - { - var angle = i * 2 * Math.PI / this._quality; - var point = new Vector2( - this.Center.X + innerRadius * (float)Math.Cos(angle), - this.Center.Y - innerRadius * (float)Math.Sin(angle)); - this.Points.Add(point); - } - } - - #endregion - } - - /// - /// Represnets a sector polygon. - /// - public class Sector : Polygon - { - #region Fields - - /// - /// The angle - /// - public float Angle; - - /// - /// The center - /// - public Vector2 Center; - - /// - /// The direction - /// - public Vector2 Direction; - - /// - /// The radius - /// - public float Radius; - - /// - /// The quality - /// - private readonly int _quality; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The center. - /// The direction. - /// The angle. - /// The radius. - /// The quality. - public Sector(Vector3 center, Vector3 direction, float angle, float radius, int quality = 20) - : this(center.To2D(), direction.To2D(), angle, radius, quality) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The center. - /// The direction. - /// The angle. - /// The radius. - /// The quality. - public Sector(Vector2 center, Vector2 direction, float angle, float radius, int quality = 20) - { - this.Center = center; - this.Direction = (direction - center).Normalized(); - this.Angle = angle; - this.Radius = radius; - this._quality = quality; - this.UpdatePolygon(); - } - - #endregion - - #region Public Methods and Operators - - /// - /// Rotates Line by angle/radian - /// - /// - /// - /// - /// True for radian values, false for degree - /// - public Vector2 RotateLineFromPoint(Vector2 point1, Vector2 point2, float value, bool radian = true) - { - var angle = !radian ? value * Math.PI / 180 : value; - var line = Vector2.Subtract(point2, point1); - - var newline = new Vector2 - { - X = (float)(line.X * Math.Cos(angle) - line.Y * Math.Sin(angle)), - Y = (float)(line.X * Math.Sin(angle) + line.Y * Math.Cos(angle)) - }; - - return Vector2.Add(newline, point1); - } - - /// - /// Updates the polygon. - /// - /// The offset. - public void UpdatePolygon(int offset = 0) - { - this.Points.Clear(); - var outRadius = (this.Radius + offset) / (float)Math.Cos(2 * Math.PI / this._quality); - this.Points.Add(this.Center); - var side1 = this.Direction.Rotated(-this.Angle * 0.5f); - for (var i = 0; i <= this._quality; i++) - { - var cDirection = side1.Rotated(i * this.Angle / this._quality).Normalized(); - this.Points.Add( - new Vector2( - this.Center.X + outRadius * cDirection.X, - this.Center.Y + outRadius * cDirection.Y)); - } - } - - #endregion - } - } - } -} \ No newline at end of file diff --git a/Hacks.cs b/Hacks.cs deleted file mode 100644 index 00ac65c1..00000000 --- a/Hacks.cs +++ /dev/null @@ -1,165 +0,0 @@ -namespace LeagueSharp.Common -{ - /// - /// Adds hacks to the menu. - /// - internal class Hacks - { - #region Constants - - private const int WM_KEYDOWN = 0x100; - - private const int WM_KEYUP = 0x101; - - #endregion - - #region Static Fields - - private static Menu menu; - - private static MenuItem MenuAntiAfk; - - private static MenuItem MenuDisableDrawings; - - private static MenuItem MenuDisableSay; - - private static MenuItem MenuTowerRange; - - public static bool AntiAFK - { - get - { - return LeagueSharp.Hacks.AntiAFK; - } - set - { - if (value == LeagueSharp.Hacks.AntiAFK) - { - return; - } - - LeagueSharp.Hacks.AntiAFK = value; - } - } - - public static bool DisableDrawings - { - get - { - return LeagueSharp.Hacks.DisableDrawings; - } - set - { - if (value == LeagueSharp.Hacks.DisableDrawings) - { - return; - } - - LeagueSharp.Hacks.DisableDrawings = value; - } - } - - public static bool DisableSay - { - get - { - return LeagueSharp.Hacks.DisableSay; - } - set - { - if (value == LeagueSharp.Hacks.DisableSay) - { - return; - } - - LeagueSharp.Hacks.DisableSay = value; - } - } - - public static bool TowerRanges - { - get - { - return LeagueSharp.Hacks.TowerRanges; - } - set - { - if (value == LeagueSharp.Hacks.TowerRanges) - { - return; - } - - LeagueSharp.Hacks.TowerRanges = value; - } - } - - #endregion - - #region Public Methods and Operators - - public static void Shutdown() - { - Menu.Remove(menu); - } - - #endregion - - #region Methods - - /// - /// Initializes this instance. - /// - internal static void Initialize() - { - CustomEvents.Game.OnGameLoad += eventArgs => - { - menu = new Menu("Hacks", "Hacks"); - - MenuAntiAfk = menu.AddItem(new MenuItem("AfkHack", "Anti-AFK").SetValue(false)); - MenuAntiAfk.ValueChanged += (sender, args) => AntiAFK = args.GetNewValue(); - - MenuDisableDrawings = menu.AddItem(new MenuItem("DrawingHack", "Disable Drawing").SetValue(false)); - MenuDisableDrawings.ValueChanged += (sender, args) => DisableDrawings = args.GetNewValue(); - MenuDisableDrawings.SetValue(DisableDrawings); - - MenuDisableSay = menu.AddItem(new MenuItem("SayHack", "Disable L# Send Chat").SetValue(false).SetTooltip("Block Game.Say from Assemblies")); - MenuDisableSay.ValueChanged += (sender, args) => DisableSay = args.GetNewValue(); - - MenuTowerRange = menu.AddItem(new MenuItem("TowerHack", "Show Tower Ranges").SetValue(false)); - MenuTowerRange.ValueChanged += (sender, args) => TowerRanges = args.GetNewValue(); - - AntiAFK = MenuAntiAfk.GetValue(); - DisableDrawings = MenuDisableDrawings.GetValue(); - DisableSay = MenuDisableSay.GetValue(); - TowerRanges = MenuTowerRange.GetValue(); - - CommonMenu.Instance.AddSubMenu(menu); - - Game.OnWndProc += args => - { - if (!MenuDisableDrawings.GetValue()) - { - return; - } - - if ((int)args.WParam != Config.ShowMenuPressKey) - { - return; - } - - if (args.Msg == WM_KEYDOWN) - { - LeagueSharp.Hacks.DisableDrawings = false; - } - - if (args.Msg == WM_KEYUP) - { - LeagueSharp.Hacks.DisableDrawings = true; - } - }; - }; - } - - #endregion - } -} \ No newline at end of file diff --git a/HeroManager.cs b/HeroManager.cs deleted file mode 100644 index de7e22d5..00000000 --- a/HeroManager.cs +++ /dev/null @@ -1,77 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - /// - /// Provides cached heroes. - /// - public class HeroManager - { - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static HeroManager() - { - if (Game.Mode == GameMode.Running) - { - Game_OnStart(new EventArgs()); - } - Game.OnStart += Game_OnStart; - } - - #endregion - - #region Public Properties - - /// - /// Gets all heroes. - /// - /// - /// All heroes. - /// - public static List AllHeroes { get; private set; } - - /// - /// Gets the allies. - /// - /// - /// The allies. - /// - public static List Allies { get; private set; } - - /// - /// Gets the enemies. - /// - /// - /// The enemies. - /// - public static List Enemies { get; private set; } - - /// - /// Gets the Local Player - /// - public static Obj_AI_Hero Player { get; private set; } - - #endregion - - #region Methods - - /// - /// Fired when the game starts. - /// - /// The instance containing the event data. - static void Game_OnStart(EventArgs args) - { - AllHeroes = ObjectManager.Get().ToList(); - Allies = AllHeroes.FindAll(o => o.IsAlly); - Enemies = AllHeroes.FindAll(o => o.IsEnemy); - Player = AllHeroes.Find(x => x.IsMe); - } - - #endregion - } -} \ No newline at end of file diff --git a/LeagueSharp.Common.csproj b/LeagueSharp.Common.csproj deleted file mode 100644 index 0e845451..00000000 --- a/LeagueSharp.Common.csproj +++ /dev/null @@ -1,212 +0,0 @@ - - - - - Release - AnyCPU - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA} - Library - Properties - LeagueSharp.Common - LeagueSharp.Common - v4.5 - 512 - - x86 - bin\Release - - - - true - full - false - bin\Release - DEBUG;TRACE - prompt - 4 - x86 - - - pdbonly - true - bin\Release - TRACE - prompt - 4 - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - true - - - Key.snk - - - - ..\..\..\..\..\Program Files (x86)\O46HgaACH\References\clipper_library.dll - - - ..\..\..\..\..\Program Files (x86)\O46HgaACH\References\LeagueSharp.dll - - - ..\..\..\..\..\Program Files (x86)\O46HgaACH\References\LeagueSharp.Data.dll - - - ..\..\..\..\..\Program Files (x86)\O46HgaACH\System\LeagueSharp.Sandbox.dll - - - ..\..\..\..\..\Program Files (x86)\O46HgaACH\References\SharpDX.dll - - - ..\..\..\..\..\Program Files (x86)\O46HgaACH\References\SharpDX.Direct3D9.dll - - - - - - - - - - - - - - - - - - - Component - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - - - - - - - - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LeagueSharp.Common.csproj.DotSettings b/LeagueSharp.Common.csproj.DotSettings deleted file mode 100644 index c5674628..00000000 --- a/LeagueSharp.Common.csproj.DotSettings +++ /dev/null @@ -1,4 +0,0 @@ - - True - True - True \ No newline at end of file diff --git a/LeagueSharp.Common.ruleset b/LeagueSharp.Common.ruleset new file mode 100644 index 00000000..2544c1f9 --- /dev/null +++ b/LeagueSharp.Common.ruleset @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LeagueSharp.Common.sln b/LeagueSharp.Common.sln index 5c646956..9fe3d371 100644 --- a/LeagueSharp.Common.sln +++ b/LeagueSharp.Common.sln @@ -1,32 +1,20 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeagueSharp.Common", "LeagueSharp.Common.csproj", "{21D7E4EF-319E-4AD4-A59C-45AF22072DCA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeagueSharp.Common", "source\LeagueSharp.Common.csproj", "{BFB66E60-98AB-4178-AB3D-7B9C3EBEC2F7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Debug|x64.ActiveCfg = Debug|x64 - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Debug|x64.Build.0 = Debug|x64 - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Debug|x86.ActiveCfg = Debug|x86 - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Debug|x86.Build.0 = Debug|x86 - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Release|Any CPU.Build.0 = Release|Any CPU - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Release|x64.ActiveCfg = Release|x64 - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Release|x64.Build.0 = Release|x64 - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Release|x86.ActiveCfg = Release|x86 - {21D7E4EF-319E-4AD4-A59C-45AF22072DCA}.Release|x86.Build.0 = Release|x86 + {BFB66E60-98AB-4178-AB3D-7B9C3EBEC2F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BFB66E60-98AB-4178-AB3D-7B9C3EBEC2F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BFB66E60-98AB-4178-AB3D-7B9C3EBEC2F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BFB66E60-98AB-4178-AB3D-7B9C3EBEC2F7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/LeagueSharp.Common.sln.DotSettings b/LeagueSharp.Common.sln.DotSettings new file mode 100644 index 00000000..ce292d08 --- /dev/null +++ b/LeagueSharp.Common.sln.DotSettings @@ -0,0 +1,2 @@ + + IVQ \ No newline at end of file diff --git a/Key.snk b/LeagueSharp.Common.snk similarity index 100% rename from Key.snk rename to LeagueSharp.Common.snk diff --git a/MEC.cs b/MEC.cs deleted file mode 100644 index 1b7e51f9..00000000 --- a/MEC.cs +++ /dev/null @@ -1,455 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using SharpDX; - - /// - /// Provides method to calculate the minimum enclosing circle. - /// - public static class MEC - { - #region Static Fields - - /// - /// The minimum maximum box - /// - public static RectangleF g_MinMaxBox; - - // For debugging. - - /// - /// The minimum maximum corners - /// - public static Vector2[] g_MinMaxCorners; - - /// - /// The non culled points - /// - public static Vector2[] g_NonCulledPoints; - - #endregion - - #region Public Methods and Operators - - /// - /// Finds the minimal bounding circle. - /// - /// The points. - /// The center. - /// The radius. - public static void FindMinimalBoundingCircle(List points, out Vector2 center, out float radius) - { - // Find the convex hull. - var hull = MakeConvexHull(points); - - // The best solution so far. - var best_center = points[0]; - var best_radius2 = float.MaxValue; - - // Look at pairs of hull points. - for (var i = 0; i < hull.Count - 1; i++) - { - for (var j = i + 1; j < hull.Count; j++) - { - // Find the circle through these two points. - var test_center = new Vector2((hull[i].X + hull[j].X) / 2f, (hull[i].Y + hull[j].Y) / 2f); - var dx = test_center.X - hull[i].X; - var dy = test_center.Y - hull[i].Y; - var test_radius2 = dx * dx + dy * dy; - - // See if this circle would be an improvement. - if (test_radius2 < best_radius2) - { - // See if this circle encloses all of the points. - if (CircleEnclosesPoints(test_center, test_radius2, points, i, j, -1)) - { - // Save this solution. - best_center = test_center; - best_radius2 = test_radius2; - } - } - } // for i - } // for j - - // Look at triples of hull points. - for (var i = 0; i < hull.Count - 2; i++) - { - for (var j = i + 1; j < hull.Count - 1; j++) - { - for (var k = j + 1; k < hull.Count; k++) - { - // Find the circle through these three points. - Vector2 test_center; - float test_radius2; - FindCircle(hull[i], hull[j], hull[k], out test_center, out test_radius2); - - // See if this circle would be an improvement. - if (test_radius2 < best_radius2) - { - // See if this circle encloses all of the points. - if (CircleEnclosesPoints(test_center, test_radius2, points, i, j, k)) - { - // Save this solution. - best_center = test_center; - best_radius2 = test_radius2; - } - } - } // for k - } // for i - } // for j - - center = best_center; - if (best_radius2 == float.MaxValue) - { - radius = 0; - } - else - { - radius = (float)Math.Sqrt(best_radius2); - } - } - - /// - /// Returns the mininimum enclosing circle from a list of points. - /// - /// The points. - /// MecCircle. - public static MecCircle GetMec(List points) - { - var center = new Vector2(); - float radius; - - var ConvexHull = MakeConvexHull(points); - FindMinimalBoundingCircle(ConvexHull, out center, out radius); - return new MecCircle(center, radius); - } - - /// - /// Makes the convex hull. - /// - /// The points. - /// Points that make up a polygon's convex hull.. - public static List MakeConvexHull(List points) - { - // Cull. - points = HullCull(points); - - // Find the remaining point with the smallest Y value. - // if (there's a tie, take the one with the smaller X value. - Vector2[] best_pt = { points[0] }; - foreach ( - var pt in points.Where(pt => (pt.Y < best_pt[0].Y) || ((pt.Y == best_pt[0].Y) && (pt.X < best_pt[0].X))) - ) - { - best_pt[0] = pt; - } - - // Move this point to the convex hull. - var hull = new List { best_pt[0] }; - points.Remove(best_pt[0]); - - // Start wrapping up the other points. - float sweep_angle = 0; - for (;;) - { - // If all of the points are on the hull, we're done. - if (points.Count == 0) - { - break; - } - - // Find the point with smallest AngleValue - // from the last point. - var X = hull[hull.Count - 1].X; - var Y = hull[hull.Count - 1].Y; - best_pt[0] = points[0]; - float best_angle = 3600; - - // Search the rest of the points. - foreach (var pt in points) - { - var test_angle = AngleValue(X, Y, pt.X, pt.Y); - if ((test_angle >= sweep_angle) && (best_angle > test_angle)) - { - best_angle = test_angle; - best_pt[0] = pt; - } - } - - // See if the first point is better. - // If so, we are done. - var first_angle = AngleValue(X, Y, hull[0].X, hull[0].Y); - if ((first_angle >= sweep_angle) && (best_angle >= first_angle)) - { - // The first point is better. We're done. - break; - } - - // Add the best point to the convex hull. - hull.Add(best_pt[0]); - points.Remove(best_pt[0]); - - sweep_angle = best_angle; - } - - return hull; - } - - #endregion - - #region Methods - - /// - /// Return a number that gives the ordering of angles - /// WRST horizontal from the point(x1, y1) to(x2, y2). - /// In other words, AngleValue(x1, y1, x2, y2) is not - /// the angle, but if: - /// Angle(x1, y1, x2, y2) > Angle(x1, y1, x2, y2) - /// then - /// AngleValue(x1, y1, x2, y2) > AngleValue(x1, y1, x2, y2) - /// this angle is greater than the angle for another set - /// of points,) this number for - /// This function is dy / (dy + dx). - /// - /// The x1. - /// The y1. - /// The x2. - /// The y2. - /// A number that gives the ordering of angles - private static float AngleValue(float x1, float y1, float x2, float y2) - { - float t; - - var dx = x2 - x1; - var ax = Math.Abs(dx); - var dy = y2 - y1; - var ay = Math.Abs(dy); - if (ax + ay == 0) - { - // if (the two points are the same, return 360. - t = 360f / 9f; - } - else - { - t = dy / (ax + ay); - } - if (dx < 0) - { - t = 2 - t; - } - else if (dy < 0) - { - t = 4 + t; - } - return t * 90; - } - - /// - /// Encloses the points in a circle. - /// - /// The center. - /// The radius2. - /// The points. - /// The skip1. - /// The skip2. - /// The skip3. - /// true if the indicated circle encloses all of the points, false otherwise. - private static bool CircleEnclosesPoints( - Vector2 center, - float radius2, - List points, - int skip1, - int skip2, - int skip3) - { - return (from point in points.Where((t, i) => (i != skip1) && (i != skip2) && (i != skip3)) - let dx = center.X - point.X - let dy = center.Y - point.Y - select dx * dx + dy * dy).All(test_radius2 => !(test_radius2 > radius2)); - } - - /// - /// Finds the circle through the three points. - /// - /// a. - /// The b. - /// The c. - /// The center. - /// The radius2. - private static void FindCircle(Vector2 a, Vector2 b, Vector2 c, out Vector2 center, out float radius2) - { - // Get the perpendicular bisector of (x1, y1) and (x2, y2). - var x1 = (b.X + a.X) / 2; - var y1 = (b.Y + a.Y) / 2; - var dy1 = b.X - a.X; - var dx1 = -(b.Y - a.Y); - - // Get the perpendicular bisector of (x2, y2) and (x3, y3). - var x2 = (c.X + b.X) / 2; - var y2 = (c.Y + b.Y) / 2; - var dy2 = c.X - b.X; - var dx2 = -(c.Y - b.Y); - - // See where the lines intersect. - var cx = (y1 * dx1 * dx2 + x2 * dx1 * dy2 - x1 * dy1 * dx2 - y2 * dx1 * dx2) / (dx1 * dy2 - dy1 * dx2); - var cy = (cx - x1) * dy1 / dx1 + y1; - center = new Vector2(cx, cy); - - var dx = cx - a.X; - var dy = cy - a.Y; - radius2 = dx * dx + dy * dy; - } - - // Find a box that fits inside the MinMax quadrilateral. - /// - /// Gets the minimum maximum box. - /// - /// The points. - /// RectangleF. - private static RectangleF GetMinMaxBox(List points) - { - // Find the MinMax quadrilateral. - Vector2 ul = new Vector2(0, 0), ur = ul, ll = ul, lr = ul; - GetMinMaxCorners(points, ref ul, ref ur, ref ll, ref lr); - - // Get the coordinates of a box that lies inside this quadrilateral. - var xmin = ul.X; - var ymin = ul.Y; - - var xmax = ur.X; - if (ymin < ur.Y) - { - ymin = ur.Y; - } - - if (xmax > lr.X) - { - xmax = lr.X; - } - var ymax = lr.Y; - - if (xmin < ll.X) - { - xmin = ll.X; - } - if (ymax > ll.Y) - { - ymax = ll.Y; - } - - var result = new RectangleF(xmin, ymin, xmax - xmin, ymax - ymin); - g_MinMaxBox = result; // For debugging. - return result; - } - - // Find the points nearest the upper left, upper right, - // lower left, and lower right corners. - /// - /// Gets the minimum maximum corners. - /// - /// The points. - /// The ul. - /// The ur. - /// The ll. - /// The lr. - private static void GetMinMaxCorners( - List points, - ref Vector2 ul, - ref Vector2 ur, - ref Vector2 ll, - ref Vector2 lr) - { - // Start with the first point as the solution. - ul = points[0]; - ur = ul; - ll = ul; - lr = ul; - - // Search the other points. - foreach (var pt in points) - { - if (-pt.X - pt.Y > -ul.X - ul.Y) - { - ul = pt; - } - if (pt.X - pt.Y > ur.X - ur.Y) - { - ur = pt; - } - if (-pt.X + pt.Y > -ll.X + ll.Y) - { - ll = pt; - } - if (pt.X + pt.Y > lr.X + lr.Y) - { - lr = pt; - } - } - - g_MinMaxCorners = new[] { ul, ur, lr, ll }; // For debugging. - } - - /// - /// Culls points out of the convex hull that lie inside the trapezoid defined by the vertices with smallest and largest - /// X and Y coordinates. - /// - /// The points. - /// Points that are not culled. - private static List HullCull(List points) - { - // Find a culling box. - var culling_box = GetMinMaxBox(points); - - // Cull the points. - var results = - points.Where( - pt => - pt.X <= culling_box.Left || pt.X >= culling_box.Right || pt.Y <= culling_box.Top - || pt.Y >= culling_box.Bottom).ToList(); - - g_NonCulledPoints = new Vector2[results.Count]; // For debugging. - results.CopyTo(g_NonCulledPoints); // For debugging. - return results; - } - - #endregion - - /// - /// Represetns a MecCircle - /// - public struct MecCircle - { - #region Fields - - /// - /// The center - /// - public Vector2 Center; - - /// - /// The radius - /// - public float Radius; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The center. - /// The radius. - public MecCircle(Vector2 center, float radius) - { - this.Center = center; - this.Radius = radius; - } - - #endregion - } - } -} \ No newline at end of file diff --git a/Menu/CPSlider.cs b/Menu/CPSlider.cs deleted file mode 100644 index c8bacf78..00000000 --- a/Menu/CPSlider.cs +++ /dev/null @@ -1,224 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - - using LeagueSharp.Common.Properties; - - using SharpDX; - - /// - /// The color picker slider. - /// - public class CPSlider - { - #region Fields - - /// - /// The height. - /// - public int Height; - - /// - /// Indicates whether the slider is moving. - /// - public bool Moving; - - /// - /// The active sprite. - /// - internal Render.Sprite ActiveSprite; - - /// - /// The inactive sprite. - /// - internal Render.Sprite InactiveSprite; - - /// - /// The X-axis position. - /// - private readonly int xPos; - - /// - /// The Y-axis position. - /// - private readonly int yPos; - - /// - /// Indicates whether the slider is visible. - /// - private bool isVisible = true; - - /// - /// The percent. - /// - private float percent; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// - /// The X. - /// - /// - /// The Y. - /// - /// - /// The Height. - /// - /// - /// The Percent. - /// - public CPSlider(int x, int y, int height, float percent = 1) - { - this.xPos = x; - this.yPos = y; - this.Height = height - Resources.CPActiveSlider.Height; - this.percent = percent; - - this.ActiveSprite = new Render.Sprite(Resources.CPActiveSlider, new Vector2(this.X, this.Y)); - this.InactiveSprite = new Render.Sprite(Resources.CPInactiveSlider, new Vector2(this.X, this.Y)); - - this.ActiveSprite.Add(2); - this.InactiveSprite.Add(2); - } - - #endregion - - #region Public Properties - - /// - /// Gets or sets the percent. - /// - public float Percent - { - get - { - return this.percent; - } - - set - { - this.percent = Math.Max(0, Math.Min(1, value)); - } - } - - /// - /// Gets or sets a value indicating whether the slider is visible. - /// - public bool Visible - { - get - { - return this.isVisible; - } - - set - { - this.ActiveSprite.Visible = this.InactiveSprite.Visible = this.isVisible = value; - } - } - - /// - /// Gets or sets the width. - /// - public int Width - { - get - { - return Resources.CPActiveSlider.Width; - } - } - - /// - /// Gets or sets the X. - /// - public int X - { - get - { - return this.xPos + ColorPicker.X; - } - - set - { - this.ActiveSprite.X = this.InactiveSprite.X = value; - } - } - - /// - /// Gets or sets the Y. - /// - public int Y - { - get - { - return this.yPos + ColorPicker.Y; - } - - set - { - this.ActiveSprite.Y = this.InactiveSprite.Y = value + (int)(this.percent * this.Height); - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// The windows event process message event. - /// - /// - /// The arguments. - /// - public void OnWndProc(WndEventComposition args) - { - switch (args.Msg) - { - case WindowsMessages.WM_LBUTTONDOWN: - if (Utils.IsUnderRectangle( - Utils.GetCursorPos(), - this.X, - this.Y, - this.Width, - this.Height + Resources.CPActiveSlider.Height)) - { - this.ActiveSprite.Visible = this.Moving = true; - this.InactiveSprite.Visible = false; - this.UpdatePercent(); - } - break; - case WindowsMessages.WM_MOUSEMOVE: - if (this.Moving) - { - this.UpdatePercent(); - } - break; - case WindowsMessages.WM_LBUTTONUP: - this.ActiveSprite.Visible = this.Moving = false; - this.InactiveSprite.Visible = true; - break; - } - } - - #endregion - - #region Methods - - /// - /// Updates the percent. - /// - private void UpdatePercent() - { - this.Percent = (Utils.GetCursorPos().Y - (Resources.CPActiveSlider.Height / 2f) - this.Y) / this.Height; - ColorPicker.UpdateColor(); - this.ActiveSprite.Y = this.InactiveSprite.Y = this.Y + (int)(this.percent * this.Height); - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/Circle.cs b/Menu/Circle.cs deleted file mode 100644 index e095e73f..00000000 --- a/Menu/Circle.cs +++ /dev/null @@ -1,54 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Drawing; - - /// - /// The circle color spectrum (picker), with the toggle feature. - /// - [Serializable] - public struct Circle - { - #region Fields - - /// - /// Indicates whether the circle is enabled. - /// - public bool Active; - - /// - /// The color. - /// - public Color Color; - - /// - /// The radius. - /// - public float Radius; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// - /// Indicates whether the circle is active. - /// - /// - /// The color. - /// - /// - /// The radius. - /// - public Circle(bool active, Color color, float radius = 100) - { - this.Active = active; - this.Color = color; - this.Radius = radius; - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/ColorPicker.cs b/Menu/ColorPicker.cs deleted file mode 100644 index fca9001b..00000000 --- a/Menu/ColorPicker.cs +++ /dev/null @@ -1,485 +0,0 @@ -namespace LeagueSharp.Common -{ - using System.Drawing; - - using LeagueSharp.Common.Properties; - - using SharpDX; - - using Color = System.Drawing.Color; - - /// - /// The color picker. - /// - public static class ColorPicker - { - #region Static Fields - - /// - /// The color picker height. - /// - public static readonly int ColorPickerH = 221; - - /// - /// The color picker width. - /// - public static readonly int ColorPickerW = 234; - - /// - /// The alpha slider. - /// - public static CPSlider AlphaSlider; - - /// - /// The background sprite. - /// - public static Render.Sprite BackgroundSprite; - - /// - /// The luminity bitmap. - /// - public static Bitmap LuminityBitmap; - - /// - /// The luminity sprite. - /// - public static Render.Sprite LuminitySprite; - - /// - /// The luminosity slider. - /// - public static CPSlider LuminositySlider; - - /// - /// The change color event. - /// - public static OnSelectColor OnChangeColor; - - /// - /// The opacity bitmap. - /// - public static Bitmap OpacityBitmap; - - /// - /// The opacity sprite. - /// - public static Render.Sprite OpacitySprite; - - /// - /// The preview rectangle. - /// - public static Render.Rectangle PreviewRectangle; - - /// - /// The last bitmap update(s). - /// - private static readonly int[] LastBitmapUpdate = new int[2]; - - /// - /// The initial color. - /// - private static Color initialColor; - - /// - /// Indicates whether the color picker is moving. - /// - private static bool isMoving; - - /// - /// Indicates whether the color is being selected. - /// - private static bool isSelecting; - - /// - /// Indicates whether the color picker is visible. - /// - private static bool isVisible; - - /// - /// The previous position. - /// - private static Vector2 previousPos; - - /// - /// The HSL color. - /// - private static HSLColor sColor = new HSLColor(255, 255, 255); - - /// - /// The Hue value. - /// - private static double sHue; - - /// - /// The saturation value. - /// - private static double sSaturation; - - /// - /// The X-axis position. - /// - private static int xPos = 100; - - /// - /// The Y-axis position. - /// - private static int yPos = 100; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a static instance of the class. - /// - static ColorPicker() - { - LuminityBitmap = new Bitmap(9, 238); - OpacityBitmap = new Bitmap(9, 238); - - UpdateLuminosityBitmap(Color.White, true); - UpdateOpacityBitmap(Color.White, true); - - BackgroundSprite = (Render.Sprite)new Render.Sprite(Resources.CPForm, new Vector2(X, Y)).Add(1); - - LuminitySprite = (Render.Sprite)new Render.Sprite(LuminityBitmap, new Vector2(X + 285, Y + 40)).Add(0); - OpacitySprite = (Render.Sprite)new Render.Sprite(OpacityBitmap, new Vector2(X + 349, Y + 40)).Add(0); - - PreviewRectangle = - (Render.Rectangle) - new Render.Rectangle(X + 375, Y + 44, 54, 80, new ColorBGRA(255, 255, 255, 255)).Add(0); - - LuminositySlider = new CPSlider(285 - Resources.CPActiveSlider.Width / 3, 35, 248); - AlphaSlider = new CPSlider(350 - Resources.CPActiveSlider.Width / 3, 35, 248); - - Game.OnWndProc += args => OnWndProc(new WndEventComposition(args)); - } - - #endregion - - #region Delegates - - /// - /// The on select color delegate. - /// - /// - /// The color. - /// - public delegate void OnSelectColor(Color color); - - #endregion - - #region Public Properties - - /// - /// The color picker X-axis. - /// - public static int ColorPickerX - { - get - { - return X + 18; - } - } - - /// - /// The color picker Y-axis. - /// - public static int ColorPickerY - { - get - { - return Y + 61; - } - } - - /// - /// Gets or sets a value indicating whether the color picker is visible. - /// - public static bool Visible - { - get - { - return isVisible; - } - - set - { - LuminitySprite.Visible = - OpacitySprite.Visible = - BackgroundSprite.Visible = - LuminositySlider.Visible = AlphaSlider.Visible = PreviewRectangle.Visible = isVisible = value; - } - } - - /// - /// Gets or sets the X-axis position. - /// - public static int X - { - get - { - return xPos; - } - - set - { - var oldX = xPos; - - xPos = value; - BackgroundSprite.X += value - oldX; - LuminitySprite.X += value - oldX; - OpacitySprite.X += value - oldX; - PreviewRectangle.X += value - oldX; - LuminositySlider.X += value - oldX; - AlphaSlider.X += value - oldX; - } - } - - /// - /// Gets or sets the Y-axis position. - /// - public static int Y - { - get - { - return yPos; - } - - set - { - var oldY = yPos; - - yPos = value; - BackgroundSprite.Y += value - oldY; - LuminitySprite.Y += value - oldY; - OpacitySprite.Y += value - oldY; - PreviewRectangle.Y += value - oldY; - LuminositySlider.Y += value - oldY; - AlphaSlider.Y += value - oldY; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Fires the change color event. - /// - /// - /// The color. - /// - public static void FireEvent(Color color) - { - if (OnChangeColor != null) - { - OnChangeColor(color); - } - } - - /// - /// Loads the color picker. - /// - /// - /// The select color delegate. - /// - /// - /// The color. - /// - public static void Load(OnSelectColor onSelectColor, Color color) - { - OnChangeColor = onSelectColor; - sColor = color; - sHue = ((HSLColor)color).Hue; - sSaturation = ((HSLColor)color).Saturation; - - LuminositySlider.Percent = (float)sColor.Luminosity / 100f; - AlphaSlider.Percent = color.A / 255f; - X = (Drawing.Width - BackgroundSprite.Width) / 2; - Y = (Drawing.Height - BackgroundSprite.Height) / 2; - - Visible = true; - UpdateLuminosityBitmap(color); - UpdateOpacityBitmap(color); - initialColor = color; - } - - #endregion - - #region Methods - - /// - /// Closes the color picker. - /// - private static void Close() - { - isSelecting = - isMoving = - AlphaSlider.Moving = - LuminositySlider.Moving = AlphaSlider.Visible = LuminositySlider.Visible = Visible = false; - } - - /// - /// The windows process event messages. - /// - /// - /// The event args. - /// - private static void OnWndProc(WndEventComposition args) - { - if (!isVisible) - { - return; - } - - LuminositySlider.OnWndProc(args); - AlphaSlider.OnWndProc(args); - - var pos = Utils.GetCursorPos(); - - if (args.Msg == WindowsMessages.WM_LBUTTONDOWN) - { - isMoving = Utils.IsUnderRectangle(pos, X, Y, BackgroundSprite.Width, 25); - - // Apply Button - if (Utils.IsUnderRectangle(pos, X + 290, Y + 297, 74, 12)) - { - Close(); - return; - } - - // Cancel Button - if (Utils.IsUnderRectangle(pos, X + 370, Y + 296, 73, 14)) - { - FireEvent(initialColor); - Close(); - return; - } - - if (Utils.IsUnderRectangle(pos, ColorPickerX, ColorPickerY, ColorPickerW, ColorPickerH)) - { - isSelecting = true; - UpdateColor(); - } - } - else if (args.Msg == WindowsMessages.WM_LBUTTONUP) - { - isMoving = isSelecting = false; - } - else if (args.Msg == WindowsMessages.WM_MOUSEMOVE) - { - if (isSelecting) - { - if (Utils.IsUnderRectangle(pos, ColorPickerX, ColorPickerY, ColorPickerW, ColorPickerH)) - { - UpdateColor(); - } - } - - if (isMoving) - { - X += (int)(pos.X - previousPos.X); - Y += (int)(pos.Y - previousPos.Y); - } - - previousPos = pos; - } - } - - /// - /// Updates the color picker color. - /// - internal static void UpdateColor() - { - if (isSelecting) - { - var pos = Utils.GetCursorPos(); - var color = BackgroundSprite.Bitmap.GetPixel((int)pos.X - X, (int)pos.Y - Y); - sHue = ((HSLColor)color).Hue; - sSaturation = ((HSLColor)color).Saturation; - UpdateLuminosityBitmap(color); - } - - sColor.Hue = sHue; - sColor.Saturation = sSaturation; - sColor.Luminosity = (LuminositySlider.Percent * 100d); - var r = Color.FromArgb(((int)(AlphaSlider.Percent * 255)), sColor); - PreviewRectangle.Color = new ColorBGRA(r.R, r.G, r.B, r.A); - UpdateOpacityBitmap(r); - FireEvent(r); - } - - /// - /// Updates the luminosity bitmap. - /// - /// - /// The color. - /// - /// - /// Indicates whether to force update. - /// - private static void UpdateLuminosityBitmap(HSLColor color, bool force = false) - { - if (Utils.TickCount - LastBitmapUpdate[0] < 100 && !force) - { - return; - } - - LastBitmapUpdate[0] = Utils.TickCount; - color.Luminosity = 0d; - - for (var y = 0; y < LuminityBitmap.Height; y++) - { - for (var x = 0; x < LuminityBitmap.Width; x++) - { - LuminityBitmap.SetPixel(x, y, color); - } - - color.Luminosity += 100d / LuminityBitmap.Height; - } - - if (LuminitySprite != null) - { - LuminitySprite.UpdateTextureBitmap(LuminityBitmap); - } - } - - /// - /// Updates the opacity bitmap. - /// - /// - /// The color. - /// - /// - /// Indicates whether to force update. - /// - private static void UpdateOpacityBitmap(HSLColor color, bool force = false) - { - if (Utils.TickCount - LastBitmapUpdate[1] < 100 && !force) - { - return; - } - - LastBitmapUpdate[1] = Utils.TickCount; - color.Luminosity = 0d; - - for (var y = 0; y < OpacityBitmap.Height; y++) - { - for (var x = 0; x < OpacityBitmap.Width; x++) - { - OpacityBitmap.SetPixel(x, y, color); - } - - color.Luminosity += 40d / LuminityBitmap.Height; - } - - if (OpacitySprite != null) - { - OpacitySprite.UpdateTextureBitmap(OpacityBitmap); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/CommonMenu.cs b/Menu/CommonMenu.cs deleted file mode 100644 index 694912b4..00000000 --- a/Menu/CommonMenu.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace LeagueSharp.Common -{ - /// - /// The LeagueSharp.Common official menu. - /// - internal class CommonMenu - { - #region Static Fields - - /// - /// The menu instance. - /// - internal static Menu Instance = new Menu("LeagueSharp.Common", "LeagueSharp.Common", true); - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a static instance of the class. - /// - static CommonMenu() - { - Initialize(); - } - - public static void Initialize() - { - TargetSelector.Initialize(); - Prediction.Initialize(); - Hacks.Initialize(); - FakeClicks.Initialize(); - - Instance.AddToMainMenu(); - } - - public static void Shutdown() - { - TargetSelector.Shutdown(); - Prediction.Shutdown(); - Hacks.Shutdown(); - FakeClicks.Shutdown(); - - Menu.Remove(Instance); - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/KeyBind.cs b/Menu/KeyBind.cs deleted file mode 100644 index 657c8fb5..00000000 --- a/Menu/KeyBind.cs +++ /dev/null @@ -1,73 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - - /// - /// The menu keybind. - /// - [Serializable] - public struct KeyBind - { - #region Fields - - /// - /// Indicates whether the keybind is active. - /// - public bool Active; - - /// - /// The key. - /// - public uint Key; - - /// - /// The key bind type. - /// - public KeyBindType Type; - - /// - /// The key. - /// - public uint SecondaryKey; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// - /// The key. - /// - /// - /// The type. - /// - /// - /// The default value. - /// - public KeyBind(uint key, KeyBindType type, bool defaultValue = false) - { - this.Key = key; - this.SecondaryKey = 0; - this.Type = type; - this.Active = defaultValue; - } - - /// - /// Initializes a new instance of the struct. - /// - /// The key. - /// The secondary key. - /// The type. - /// The default value. - public KeyBind(uint key, uint secondaryKey, KeyBindType type, bool defaultValue = false) - { - this.Key = key; - this.SecondaryKey = secondaryKey; - this.Type = type; - this.Active = defaultValue; - } - #endregion - } -} \ No newline at end of file diff --git a/Menu/KeybindSetStage.cs b/Menu/KeybindSetStage.cs deleted file mode 100644 index fe1be363..00000000 --- a/Menu/KeybindSetStage.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace LeagueSharp.Common -{ - enum KeybindSetStage - { - Keybind1, - - Keybind2, - - NotSetting - } -} \ No newline at end of file diff --git a/Menu/Menu.cs b/Menu/Menu.cs deleted file mode 100644 index 4b63f416..00000000 --- a/Menu/Menu.cs +++ /dev/null @@ -1,854 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Drawing; - using System.Linq; - using System.Reflection; - - using SharpDX; - using SharpDX.Direct3D9; - - using Color = SharpDX.Color; - using Rectangle = SharpDX.Rectangle; - - /// - /// The menu. - /// - public class Menu - { - #region Static Fields - - /// - /// The menu settings, root menu alias. - /// - public static readonly Menu Root = new Menu("Menu Settings", "Menu Settings"); - - /// - /// The root menus. - /// - public static Dictionary RootMenus = new Dictionary(); - - /// - /// If the menu should be compact - /// - internal static bool IsCompact - { - get { return Root.Item("Menu.Compact").GetValue(); } - } - - #endregion - - #region Fields - - /// - /// The menu children. - /// - public List Children = new List(); - - /// - /// The color. - /// - public Color Color; - - /// - /// The menu display name. - /// - public string DisplayName; - - /// - /// Indicates whether the menu has a root attribute. - /// - public bool IsRootMenu; - - /// - /// The menu submenus. - /// - public List Items = new List(); - - /// - /// The menu name. - /// - public string Name; - - /// - /// The menu parent. - /// - public Menu Parent; - - /// - /// The menu font style. - /// - public FontStyle Style; - - /// - /// The cached menu count. - /// - private int cachedMenuCount = 2; - - /// - /// The cached menu count tick. - /// - private int cachedMenuCountT; - - /// - /// Indicates whether the menu is visible. - /// - private bool isVisible; - - /// - /// The unqiue id. - /// - private string uniqueId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a static instance of the class. - /// - static Menu() - { - Root.AddItem(new MenuItem("BackgroundAlpha", "Background Opacity")).SetValue(new Slider(165, 55, 255)); - Root.AddItem( - new MenuItem("FontName", "Font Name:").SetValue( - new StringList(new[] { "Tahoma", "Calibri", "Segoe UI" }, 1))); - Root.AddItem(new MenuItem("FontSize", "Font Size:").SetValue(new Slider(15, 12, 20))); - Root.AddItem( - new MenuItem("FontQuality", "Font Quality").SetValue( - new StringList( - Enum.GetValues(typeof(FontQuality)).Cast().Select(v => v.ToString()).ToArray(), - 5))); - - Root.AddItem( - new MenuItem("LeagueSharp.Common.TooltipDuration", "Tooltip Notification Duration").SetValue( - new Slider(1500, 0, 5000))); - Root.AddItem( - new MenuItem("Menu.Compact", "Compact Menu").SetValue(false)); - - Root.AddItem( - new MenuItem("FontInfo", "Press F5 after your change").SetFontStyle(FontStyle.Bold, Color.Yellow)); - - CommonMenu.Instance.AddSubMenu(Root); - } - - /// - /// Initializes a new instance of the class. - /// - /// - /// The display name. - /// - /// - /// The name. - /// - /// - /// Indicates whether the menu has root attribute. - /// - public Menu(string displayName, string name, bool isRootMenu = false) - { - this.DisplayName = MenuGlobals.Function001(displayName); - this.Name = name; - this.IsRootMenu = isRootMenu; - this.Style = FontStyle.Regular; - this.Color = Color.White; - - if (isRootMenu) - { - CustomEvents.Game.OnGameEnd += delegate { this.SaveAll(); }; - Game.OnEnd += delegate { this.SaveAll(); }; - AppDomain.CurrentDomain.DomainUnload += delegate { this.SaveAll(); }; - AppDomain.CurrentDomain.ProcessExit += delegate { this.SaveAll(); }; - - var rootName = Assembly.GetCallingAssembly().GetName().Name + "." + name; - - if (RootMenus.ContainsKey(rootName)) - { - throw new ArgumentException(@"Root Menu [" + rootName + @"] with the same name exists", "name"); - } - - RootMenus.Add(rootName, this); - } - } - - /// - /// Finalizes an instance of the class. - /// - ~Menu() - { - if (RootMenus.ContainsKey(this.Name)) - { - RootMenus.Remove(this.Name); - } - } - - #endregion - - #region Properties - - /// - /// Gets the width of the children menu. - /// - internal int ChildrenMenuWidth - { - get - { - return - this.Items.Select(item => item.NeededWidth) - .Concat(new[] { this.Children.Select(item => item.NeededWidth).Concat(new[] { 0 }).Max() }) - .Max(); - } - } - - /// - /// Gets the height. - /// - internal int Height - { - get - { - return MenuSettings.MenuItemHeight; - } - } - - /// - /// Gets the menu count. - /// - internal int MenuCount - { - get - { - if (Utils.TickCount - this.cachedMenuCountT < 500) - { - return this.cachedMenuCount; - } - - var globalMenuList = MenuGlobals.MenuState; - var i = 0; - var result = 0; - - foreach (var item in globalMenuList) - { - if (item == this.uniqueId) - { - result = i; - break; - } - - i++; - } - - this.cachedMenuCount = result; - this.cachedMenuCountT = Utils.TickCount; - - return result; - } - } - - /// - /// Gets the base position. - /// - internal Vector2 MyBasePosition - { - get - { - if (IsCompact || this.IsRootMenu || this.Parent == null) - { - return MenuSettings.BasePosition + this.MenuCount * new Vector2(0, MenuSettings.MenuItemHeight); - } - - - return this.Parent.MyBasePosition; - } - } - - /// - /// Gets the needed width. - /// - internal int NeededWidth - { - get - { - return MenuDrawHelper.Font.MeasureText(MultiLanguage._(this.DisplayName)).Width + 25; - } - } - - /// - /// Gets the position. - /// - internal Vector2 Position - { - get - { - return new Vector2(0, this.MyBasePosition.Y) - + new Vector2( - (this.Parent != null) - ? this.Parent.Position.X + this.Parent.Width - : (int)this.MyBasePosition.X, 0) - + this.YLevel * new Vector2(0, MenuSettings.MenuItemHeight); - } - } - - /// - /// Gets or sets a value indicating whether the menu is visible. - /// - internal bool Visible - { - get - { - if (!MenuSettings.DrawMenu) - { - return false; - } - return this.IsRootMenu || this.isVisible; - } - set - { - this.isVisible = value; - - //Hide all the children - if (!this.isVisible) - { - foreach (var schild in this.Children.ToArray()) - { - schild.Visible = false; - } - - foreach (var sitem in this.Items.ToArray()) - { - sitem.Visible = false; - } - } - } - } - - /// - /// Gets the width. - /// - internal int Width - { - get - { - return this.Parent != null ? this.Parent.ChildrenMenuWidth : MenuSettings.MenuItemWidth; - } - } - - /// - /// Gets the X level. - /// - internal int XLevel - { - get - { - var result = 0; - var m = this; - - while (m.Parent != null) - { - m = m.Parent; - result++; - } - - return result; - } - } - - /// - /// Gets the Y level. - /// - internal int YLevel - { - get - { - if (this.IsRootMenu || this.Parent == null) - { - return 0; - } - - return (IsCompact ? 0 : this.Parent.YLevel) + this.Parent.Children.TakeWhile(test => test.Name != this.Name).Count(); - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the menu. - /// - /// - /// The assembly name. - /// - /// - /// The menu name. - /// - /// - /// The . - /// - public static Menu GetMenu(string assemblyname, string menuname) - { - return RootMenus.ToArray().FirstOrDefault(x => x.Key == assemblyname + "." + menuname).Value; - } - - /// - /// Gets the value globally. - /// - /// - /// The assembly name. - /// - /// - /// The menu name. - /// - /// - /// The item name. - /// - /// - /// The submenu. - /// - /// - /// The . - /// - public static MenuItem GetValueGlobally( - string assemblyname, - string menuname, - string itemname, - string submenu = null) - { - var menu = RootMenus.FirstOrDefault(x => x.Key == assemblyname + "." + menuname).Value; - - if (submenu != null) - { - menu = menu.SubMenu(submenu); - } - - return menu.Item(itemname); - } - - /// - /// Sends the message. - /// - /// - /// The key. - /// - /// - /// The message. - /// - public static void SendMessage(uint key, WindowsMessages message, WndEventComposition args) - { - foreach (var menu in RootMenus) - { - menu.Value.OnReceiveMessage(message, Utils.GetCursorPos(), key, args); - } - } - - /// - /// Adds an item to the menu. - /// - /// - /// The item. - /// - /// - /// The item instance. - /// - public MenuItem AddItem(MenuItem item) - { - item.Parent = this; - this.Items.Add(item); - - return item; - } - - /// - /// Adds a submenu to the menu. - /// - /// - /// The submenu. - /// - /// - /// The menu instance. - /// - public Menu AddSubMenu(Menu subMenu) - { - subMenu.Parent = this; - this.Children.Add(subMenu); - - return subMenu; - } - - /// - /// Adds the menu to the main menu. - /// - public void AddToMainMenu() - { - this.InitMenuState(Assembly.GetCallingAssembly().GetName().Name); - - AppDomain.CurrentDomain.DomainUnload += (sender, args) => this.UnloadMenuState(); - Drawing.OnEndScene += this.OnDraw; - Game.OnWndProc += args => this.OnWndProc(new WndEventComposition(args)); - } - - /// - /// Gets the menu's item by name. - /// - /// - /// The name. - /// - /// - /// Indicates whether the item is champion unique. - /// - /// - /// The . - /// - public MenuItem Item(string name, bool championUnique = false) - { - if (championUnique) - { - name = ObjectManager.Player.ChampionName + name; - } - - //Search in our own items - foreach (var item in this.Items.ToArray().Where(item => item.Name == name)) - { - return item; - } - - //Search in submenus - return - (from subMenu in this.Children.ToArray() where subMenu.Item(name) != null select subMenu.Item(name)) - .FirstOrDefault(); - } - - /// - /// Sets the font style. - /// - /// - /// The font style. - /// - /// - /// Color of the font. - /// - /// - /// The . - /// - public Menu SetFontStyle(FontStyle fontStyle = FontStyle.Regular, Color? fontColor = null) - { - this.Style = fontStyle; - this.Color = fontColor ?? Color.White; - - return this; - } - - /// - /// Gets the menu's submenu by name. - /// - /// - /// The name. - /// - /// - /// The . - /// - public Menu SubMenu(string name) - { - return this.Children.ToArray().FirstOrDefault(sm => sm.Name == name) ?? this.AddSubMenu(new Menu(name, name)); - } - - #endregion - - #region Methods - - /// - /// Determines whether the specified position is inside the menu. - /// - /// - /// The position. - /// - /// - /// The . - /// - internal bool IsInside(Vector2 position) - { - return Utils.IsUnderRectangle(position, this.Position.X, this.Position.Y, this.Width, this.Height); - } - - /// - /// The drawing event. - /// - /// - /// The event args. - /// - internal void OnDraw(EventArgs args) - { - if (!this.Visible) - { - return; - } - - var childs = this.Children.ToArray(); - var items = this.Items.ToArray(); - - Drawing.Direct3DDevice.SetRenderState(RenderState.AlphaBlendEnable, true); - MenuDrawHelper.DrawBox( - this.Position, - this.Width, - this.Height, - (childs.Length > 0 && childs[0].Visible || items.Length > 0 && items[0].Visible) - ? MenuSettings.ActiveBackgroundColor - : MenuSettings.BackgroundColor, - 1, - System.Drawing.Color.Black); - - var style = this.Style; - style &= ~FontStyle.Strikeout; - style &= ~FontStyle.Underline; - - var font = MenuDrawHelper.GetFont(style); - - font.DrawText( - null, - MultiLanguage._(this.DisplayName), - new Rectangle((int)this.Position.X + 5, (int)this.Position.Y, this.Width, this.Height), - FontDrawFlags.VerticalCenter, - this.Color); - font.DrawText( - null, - ">", - new Rectangle((int)this.Position.X - 5, (int)this.Position.Y, this.Width, this.Height), - FontDrawFlags.Right | FontDrawFlags.VerticalCenter, - this.Color); - - var textWidth = font.MeasureText(null, MultiLanguage._(this.DisplayName)); - if ((this.Style & FontStyle.Strikeout) != 0) - { - Drawing.DrawLine( - this.Position.X + 5, - this.Position.Y + (MenuSettings.MenuItemHeight / 2f), - this.Position.X + 5 + textWidth.Width, - this.Position.Y + (MenuSettings.MenuItemHeight / 2f), - 1f, - System.Drawing.Color.FromArgb(this.Color.A, this.Color.R, this.Color.G, this.Color.B)); - } - - if ((this.Style & FontStyle.Underline) != 0) - { - Drawing.DrawLine( - this.Position.X + 5, - this.Position.Y + (MenuSettings.MenuItemHeight / 1.5f), - this.Position.X + 5 + textWidth.Width, - this.Position.Y + (MenuSettings.MenuItemHeight / 1.5f), - 1f, - System.Drawing.Color.FromArgb(this.Color.A, this.Color.R, this.Color.G, this.Color.B)); - } - - //Draw the menu submenus - foreach (var child in childs.ToArray().Where(child => child.Visible)) - { - child.OnDraw(args); - } - - //Draw the items - for (var i = items.Length - 1; i >= 0; i--) - { - var item = items[i]; - if (item.Visible) - { - item.OnDraw(); - } - } - } - - /// - /// Called when the game receives a window message. - /// - /// - /// The message. - /// - /// - /// The cursor position. - /// - /// - /// The key. - /// - internal void OnReceiveMessage(WindowsMessages message, Vector2 cursorPos, uint key, WndEventComposition args) - { - //Spread the message to the menu's children recursively - foreach (var child in this.Children.ToArray()) - { - child.OnReceiveMessage(message, cursorPos, key, args); - } - - foreach (var item in this.Items.ToArray()) - { - item.OnReceiveMessage(message, cursorPos, key, args); - } - - //Handle the left clicks on the menus to hide or show the submenus. - if (message != WindowsMessages.WM_LBUTTONDOWN) - { - return; - } - - if (this.IsRootMenu && this.Visible) - { - if (cursorPos.X - MenuSettings.BasePosition.X < MenuSettings.MenuItemWidth) - { - var n = (int)(cursorPos.Y - MenuSettings.BasePosition.Y) / MenuSettings.MenuItemHeight; - if (this.MenuCount != n) - { - foreach (var schild in this.Children.ToArray()) - { - schild.Visible = false; - } - - foreach (var sitem in this.Items.ToArray()) - { - sitem.Visible = false; - } - } - } - } - - if (!this.Visible) - { - return; - } - - if (!this.IsInside(cursorPos)) - { - return; - } - - if (!this.IsRootMenu && this.Parent != null) - { - //Close all the submenus in the level - foreach (var child in this.Parent.Children.ToArray().Where(child => child.Name != this.Name)) - { - foreach (var schild in child.Children.ToArray()) - { - schild.Visible = false; - } - - foreach (var sitem in child.Items.ToArray()) - { - sitem.Visible = false; - } - } - } - - //Hide or Show the submenus. - foreach (var child in this.Children.ToArray()) - { - child.Visible = !child.Visible; - } - - //Hide or Show the items. - foreach (var item in this.Items.ToArray()) - { - item.Visible = !item.Visible; - } - } - - /// - /// Fired when the game receives a window event. - /// - /// - /// The windows event process message args. - /// - internal void OnWndProc(WndEventComposition args) - { - this.OnReceiveMessage(args.Msg, Utils.GetCursorPos(), args.WParam, args); - } - - /// - /// Save all in a recurisve method. - /// - /// - /// The collection. - /// - internal void RecursiveSaveAll(ref Dictionary> dics) - { - foreach (var child in this.Children.ToArray()) - { - child.RecursiveSaveAll(ref dics); - } - - foreach (var item in this.Items.ToArray()) - { - item.SaveToFile(ref dics); - } - } - - /// - /// Save all data. - /// - internal void SaveAll() - { - var dic = new Dictionary>(); - this.RecursiveSaveAll(ref dic); - - foreach (var dictionary in dic) - { - var dicToSave = SavedSettings.Load(dictionary.Key) ?? new Dictionary(); - - foreach (var entry in dictionary.Value) - { - dicToSave[entry.Key] = entry.Value; - } - - SavedSettings.Save(dictionary.Key, dicToSave); - } - } - - /// - /// Initialize menu state. - /// - /// - /// The assembly name. - /// - private void InitMenuState(string assemblyName) - { - this.uniqueId = assemblyName + "." + this.Name; - - var globalMenuList = MenuGlobals.MenuState ?? new List(); - - while (globalMenuList.Contains(this.uniqueId)) - { - this.uniqueId += "."; - } - - globalMenuList.Add(this.uniqueId); - - MenuGlobals.MenuState = globalMenuList; - } - - /// - /// Unload the menu state. - /// - private void UnloadMenuState() - { - MenuGlobals.MenuState.Remove(this.uniqueId); - } - - public void RemoveMenu(Menu menu) - { - foreach (var child in this.Children.ToArray()) - { - if (child == menu) - { - this.Children.Remove(menu); - } - - child.RemoveMenu(menu); - } - } - - public static void Remove(Menu menu) - { - foreach (var rootMenu in RootMenus.Values) - { - rootMenu.RemoveMenu(menu); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/MenuDrawHelper.cs b/Menu/MenuDrawHelper.cs deleted file mode 100644 index 905150b9..00000000 --- a/Menu/MenuDrawHelper.cs +++ /dev/null @@ -1,438 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Drawing; - - using SharpDX; - using SharpDX.Direct3D9; - - using Color = System.Drawing.Color; - using Font = SharpDX.Direct3D9.Font; - using Rectangle = SharpDX.Rectangle; - - /// - /// The menu draw helper. - /// - internal static class MenuDrawHelper - { - #region Static Fields - - /// - /// The font. - /// - internal static Font Font; - - /// - /// The bold font. - /// - internal static Font FontBold; - - /// - /// The italic font. - /// - internal static Font FontItalic; - - /// - /// The bold and italic font. - /// - internal static Font FontBoldItalic; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a static instance of the class. - /// - static MenuDrawHelper() - { - var device = Drawing.Direct3DDevice; - var faceName = Menu.Root.Item("FontName").GetValue().SelectedValue; - var height = Menu.Root.Item("FontSize").GetValue().Value; - var outputPercision = FontPrecision.Default; - var quality = - (FontQuality) - Enum.Parse( - typeof(FontQuality), - Menu.Root.Item("FontQuality").GetValue().SelectedValue, - true); - - Font = new Font( - device, - new FontDescription - { FaceName = faceName, Height = height, OutputPrecision = outputPercision, Quality = quality }); - - FontBold = new Font( - device, - new FontDescription - { - FaceName = faceName, Height = height, OutputPrecision = outputPercision, Weight = FontWeight.Bold, - Quality = quality - }); - - FontItalic = new Font( - device, - new FontDescription - { - FaceName = faceName, Height = height, OutputPrecision = outputPercision, Italic = true, - Quality = quality - }); - - FontBoldItalic = new Font( - device, - new FontDescription - { - FaceName = faceName, Height = height, OutputPrecision = outputPercision, Weight = FontWeight.Bold, - Italic = true, Quality = quality - }); - - Drawing.OnPreReset += OnPreReset; - Drawing.OnPostReset += OnPostReset; - AppDomain.CurrentDomain.DomainUnload += OnDomainUnload; - } - - #endregion - - internal static Font GetFont(FontStyle fontStyle) - { - switch (fontStyle) - { - case FontStyle.Bold: - return FontBold; - case FontStyle.Italic: - return FontItalic; - case FontStyle.Bold | FontStyle.Italic: - return FontBoldItalic; - default: - return Font; - } - } - - #region Methods - - /// - /// Draws an arrow. - /// - /// - /// The string. - /// - /// - /// The position. - /// - /// - /// The item. - /// - /// - /// The color. - /// - internal static void DrawArrow(string s, Vector2 position, MenuItem item, Color color) - { - DrawBox(position, item.Height, item.Height, Color.FromArgb(0, 37, 53), 1, color); - Font.DrawText( - null, - s, - new Rectangle((int)(position.X), (int)item.Position.Y, item.Height, item.Height), - FontDrawFlags.VerticalCenter | FontDrawFlags.Center, - new ColorBGRA(255, 255, 255, 255)); - } - - /// - /// Draws a box. - /// - /// - /// The position. - /// - /// - /// The width. - /// - /// - /// The height. - /// - /// - /// The color. - /// - /// - /// The border width. - /// - /// - /// The border color. - /// - internal static void DrawBox( - Vector2 position, - int width, - int height, - Color color, - int borderwidth, - Color borderColor) - { - Drawing.DrawLine(position.X, position.Y, position.X + width, position.Y, height, color); - - if (borderwidth > 0) - { - Drawing.DrawLine(position.X, position.Y, position.X + width, position.Y, borderwidth, borderColor); - Drawing.DrawLine( - position.X, - position.Y + height, - position.X + width, - position.Y + height, - borderwidth, - borderColor); - Drawing.DrawLine(position.X, position.Y, position.X, position.Y + height, borderwidth, borderColor); - Drawing.DrawLine( - position.X + width, - position.Y, - position.X + width, - position.Y + height, - borderwidth, - borderColor); - } - } - - /// - /// Draws the on and off box. - /// - /// - /// Indicates whether the value is on. - /// - /// - /// The position. - /// - /// - /// The item. - /// - internal static void DrawOnOff(bool on, Vector2 position, MenuItem item) - { - DrawBox( - position, - item.Height, - item.Height, - on ? Color.FromArgb(1, 169, 234) : Color.FromArgb(37, 37, 37), - 1, - Color.Black); - var s = on ? "ON" : "OFF"; - Font.DrawText( - null, - s, - new Rectangle( - (int)(item.Position.X + item.Width - item.Height), - (int)item.Position.Y, - item.Height, - item.Height), - FontDrawFlags.VerticalCenter | FontDrawFlags.Center, - new ColorBGRA(255, 255, 255, 255)); - } - - /// - /// Draws a slider. - /// - /// - /// The position. - /// - /// - /// The item. - /// - /// - /// The width. - /// - /// - /// Indicates whether to draw informative text. - /// - internal static void DrawSlider(Vector2 position, MenuItem item, int width = -1, bool drawText = true) - { - var val = item.GetValue(); - DrawSlider(position, item, val.MinValue, val.MaxValue, val.Value, width, drawText); - } - - /// - /// Draws a slider. - /// - /// - /// The position. - /// - /// - /// The item. - /// - /// - /// The minimum value. - /// - /// - /// The maximum value. - /// - /// - /// The value. - /// - /// - /// The width. - /// - /// - /// Indicates whether to draw informative text. - /// - internal static void DrawSlider( - Vector2 position, - MenuItem item, - int min, - int max, - int value, - int width, - bool drawText) - { - width = (width > 0 ? width : item.Width); - var percentage = 100 * (value - min) / (max - min); - var x = position.X + 3 + (percentage * (width - 3)) / 100f; - var x2D = 3 + (percentage * (width - 3)) / 100; - Drawing.DrawLine(x, position.Y + 2, x, position.Y + item.Height, 2, Color.FromArgb(0, 74, 103)); - DrawBox( - new Vector2(position.X, position.Y), - x2D - 2, - item.Height, - Color.FromArgb(0, 37, 53), - 0, - Color.Black); - - if (drawText) - { - Font.DrawText( - null, - value.ToString(), - new Rectangle((int)position.X - 5, (int)position.Y, item.Width, item.Height), - FontDrawFlags.VerticalCenter | FontDrawFlags.Right, - new ColorBGRA(255, 255, 255, 255)); - } - } - - /// - /// Draws the tooltip button. - /// - /// - /// The position. - /// - /// - /// The item. - /// - internal static void DrawToolTipButton(Vector2 position, MenuItem item) - { - if (item.ValueType == MenuValueType.StringList) - { - return; - } - - const string S = "[?]"; - var x = (int)item.Position.X + item.Width - item.Height - Font.MeasureText(S).Width - 7; - - Font.DrawText( - null, - S, - new Rectangle(x, (int)item.Position.Y, item.Width, item.Height), - FontDrawFlags.VerticalCenter, - new ColorBGRA(255, 255, 255, 255)); - } - - /// - /// Draws the tooltip text. - /// - /// - /// The position. - /// - /// - /// The item. - /// - /// - /// The text color. - /// - internal static void DrawToolTipText(Vector2 position, MenuItem item, SharpDX.Color? textColor = null) - { - if (item.ValueType == MenuValueType.StringList) - { - return; - } - - DrawBox( - new Vector2(position.X + item.Height - 28, position.Y + 1), - Font.MeasureText(item.Tooltip).Width + 8, - item.Height, - MenuSettings.BackgroundColor, - 1, - Color.Black); - - var s = item.Tooltip; - Font.DrawText( - null, - s, - new Rectangle( - (int)(item.Position.X + item.Width - 33 + item.Height + 8), - (int)item.Position.Y - 3, - Font.MeasureText(item.Tooltip).Width + 8, - item.Height + 8), - FontDrawFlags.VerticalCenter, - textColor ?? SharpDX.Color.White); - } - - /// - /// The domain unload event. - /// - /// - /// The sender. - /// - /// - /// The event args. - /// - private static void OnDomainUnload(object sender, EventArgs eventArgs) - { - if (Font != null) - { - Font.OnLostDevice(); - Font.Dispose(); - Font = null; - } - - if (FontBold != null) - { - FontBold.OnLostDevice(); - FontBold.Dispose(); - FontBold = null; - } - - if (FontBoldItalic != null) - { - FontBoldItalic.OnLostDevice(); - FontBoldItalic.Dispose(); - FontBoldItalic = null; - } - - if (FontItalic != null) - { - FontItalic.OnLostDevice(); - FontItalic.Dispose(); - FontItalic = null; - } - } - - /// - /// The post reset event. - /// - /// The event args. - private static void OnPostReset(EventArgs args) - { - Font.OnResetDevice(); - FontBold.OnResetDevice(); - FontBoldItalic.OnResetDevice(); - FontItalic.OnResetDevice(); - } - - /// - /// The pre reset event. - /// - /// - /// The event args. - /// - private static void OnPreReset(EventArgs args) - { - Font.OnLostDevice(); - FontBold.OnLostDevice(); - FontItalic.OnLostDevice(); - FontBoldItalic.OnLostDevice(); - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/MenuItem.cs b/Menu/MenuItem.cs deleted file mode 100644 index ae5f9071..00000000 --- a/Menu/MenuItem.cs +++ /dev/null @@ -1,1218 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Drawing; - using System.Linq; - using System.Reflection; - - using SharpDX; - using SharpDX.Direct3D9; - - using Color = SharpDX.Color; - using Rectangle = SharpDX.Rectangle; - - /// - /// The menu item. - /// - public class MenuItem - { - #region Fields - - /// - /// The display name. - /// - public string DisplayName; - - /// - /// The font color. - /// - public ColorBGRA FontColor; - - /// - /// The font style. - /// - public FontStyle FontStyle; - - /// - /// The menu font size. - /// - public int MenuFontSize; - - /// - /// The name. - /// - public string Name; - - /// - /// The parent. - /// - public Menu Parent; - - /// - /// Indicates whether to show the item/ - /// - public bool ShowItem; - - /// - /// The tag. - /// - public int Tag; - - /// - /// The tooltip. - /// - public string Tooltip; - - /// - /// The tooltip color. - /// - public Color TooltipColor; - - /// - /// Indicates whether the value was set. - /// - public bool ValueSet; - - /// - /// Indicates whether the menu item is drawing the tooltip. - /// - internal bool DrawingTooltip; - - /// - /// Indicates whether the menu item is being interacted with. - /// - internal bool Interacting; - - /// - /// The stage of the KeybindSetting - /// - internal KeybindSetStage KeybindSettingStage = KeybindSetStage.NotSetting; - - /// - /// The value type. - /// - internal MenuValueType ValueType; - - /// - /// The configuration name. - /// - private readonly string configName; - - /// - /// Indicates whether the menu item won't save. - /// - private bool dontSave; - - /// - /// Indicates whether the menu item is shared. - /// - private bool isShared; - - /// - /// Indicates whether the menu item is visible. - /// - private bool isVisible; - - /// - /// The serialized data. - /// - private byte[] serialized; - - /// - /// The value. - /// - private object value; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// - /// The name. - /// - /// - /// The display name. - /// - /// - /// Indicates whether the menu item is champion unique. - /// - public MenuItem(string name, string displayName, bool championUnique = false) - { - if (championUnique) - { - name = ObjectManager.Player.ChampionName + name; - } - - this.Name = name; - this.DisplayName = MenuGlobals.Function001(displayName); - this.FontStyle = FontStyle.Regular; - this.FontColor = Color.White; - this.ShowItem = true; - this.Tag = 0; - this.configName = Assembly.GetCallingAssembly().GetName().Name - + Assembly.GetCallingAssembly().GetType().GUID; - } - - #endregion - - #region Public Events - - /// - /// The value changed event. - /// - public event EventHandler ValueChanged; - - #endregion - - #region Public Properties - - /// - /// Gets the tooltip duration. - /// - public int TooltipDuration - { - get - { - return CommonMenu.Instance.Item("LeagueSharp.Common.TooltipDuration").GetValue().Value; - } - } - - #endregion - - #region Properties - - /// - /// Gets the height. - /// - internal int Height - { - get - { - return MenuSettings.MenuItemHeight; - } - } - - /// - /// Gets the item base position. - /// - internal Vector2 MyBasePosition - { - get - { - if (Menu.IsCompact || this.Parent == null) - { - return MenuSettings.BasePosition; - } - - return this.Parent.MyBasePosition; - } - } - - /// - /// Gets the needed width. - /// - internal int NeededWidth - { - get - { - return MenuDrawHelper.Font.MeasureText(MultiLanguage._(this.DisplayName)).Width + this.Height * 2 + 10 - + ((this.ValueType == MenuValueType.StringList) - ? this.GetValue() - .SList.Select(v => MenuDrawHelper.Font.MeasureText(v).Width + 25) - .Concat(new[] { 0 }) - .Max() - : (this.ValueType == MenuValueType.KeyBind) - ? this.GetValue().SecondaryKey == 0 - ? MenuDrawHelper.Font.MeasureText( - " [" + Utils.KeyToText(this.GetValue().Key) + "]").Width - : MenuDrawHelper.Font.MeasureText( - " [" + Utils.KeyToText(this.GetValue().Key) + "]").Width - + MenuDrawHelper.Font.MeasureText( - " [" + Utils.KeyToText(this.GetValue().SecondaryKey) + "]") - .Width - + MenuDrawHelper.Font.MeasureText( - " [" + Utils.KeyToText(this.GetValue().Key) + "]").Width / 4 - : 0); - } - } - - /// - /// Gets the position. - /// - internal Vector2 Position - { - get - { - var xOffset = 0; - - if (this.Parent != null) - { - xOffset = (int)(this.Parent.Position.X + this.Parent.Width); - } - - return new Vector2(0, this.MyBasePosition.Y) + new Vector2(xOffset, 0) - + this.YLevel * new Vector2(0, MenuSettings.MenuItemHeight); - } - } - - /// - /// Gets the save file name. - /// - internal string SaveFileName - { - get - { - return this.isShared ? "SharedConfig" : this.configName; - } - } - - /// - /// Gets the save key. - /// - internal string SaveKey - { - get - { - return Utils.Md5Hash("v3" + this.DisplayName + this.Name); - } - } - - /// - /// Gets or sets a value indicating whether the item is visible. - /// - internal bool Visible - { - get - { - return MenuSettings.DrawMenu && this.isVisible && this.ShowItem; - } - - set - { - this.isVisible = value; - } - } - - /// - /// Gets the width. - /// - internal int Width - { - get - { - return this.Parent != null ? this.Parent.ChildrenMenuWidth : MenuSettings.MenuItemWidth; - } - } - - /// - /// Gets the Y level. - /// - internal int YLevel - { - get - { - if (this.Parent == null) - { - return 0; - } - - return (Menu.IsCompact ? 0 : this.Parent.YLevel) + this.Parent.Children.Count - + this.Parent.Items.TakeWhile(test => test.Name != this.Name).Count(c => c.ShowItem); - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Sets the menu item to not save. - /// - /// - /// The item instance. - /// - public MenuItem DontSave() - { - this.dontSave = true; - return this; - } - - /// - /// Gets the item value. - /// - /// - /// The item type. - /// - /// - /// The value. - /// - public T GetValue() - { - return (T)this.value; - } - - /// - /// Gets a value indicating whether the item is active. - /// - /// - /// Value indicating whether the item is active. - /// - public bool IsActive() - { - switch (this.ValueType) - { - case MenuValueType.Boolean: - return this.GetValue(); - case MenuValueType.Circle: - return this.GetValue().Active; - case MenuValueType.KeyBind: - return this.GetValue().Active; - default: - return false; - } - } - - /// - /// Sets the font style. - /// - /// - /// The font style. - /// - /// - /// The font color. - /// - /// - /// The item instance. - /// - public MenuItem SetFontStyle(FontStyle fontStyle = FontStyle.Regular, Color? fontColor = null) - { - this.FontStyle = fontStyle; - this.FontColor = fontColor ?? Color.White; - - return this; - } - - /// - /// Sets the menu item to be shared. - /// - /// - /// The item instance. - /// - public MenuItem SetShared() - { - this.isShared = true; - - return this; - } - - /// - /// Sets the menu item tag. - /// - /// - /// The tag. - /// - /// - /// The item instance. - /// - public MenuItem SetTag(int tag = 0) - { - this.Tag = tag; - - return this; - } - - /// - /// Sets the tooltip. - /// - /// - /// The tooltip string. - /// - /// - /// The tooltip color. - /// - /// - /// The menu instance. - /// - public MenuItem SetTooltip(string tooltip, Color? tooltipColor = null) - { - this.Tooltip = tooltip; - this.TooltipColor = tooltipColor ?? Color.White; - - return this; - } - - /// - /// Sets the value. - /// - /// - /// The value type. - /// - /// - /// The new value. - /// - /// - /// The item instance. - /// - public MenuItem SetValue(T newValue) - { - this.ValueType = MenuValueType.None; - if (newValue.GetType().ToString().Contains("Boolean")) - { - this.ValueType = MenuValueType.Boolean; - } - else if (newValue.GetType().ToString().Contains("Slider")) - { - this.ValueType = MenuValueType.Slider; - } - else if (newValue.GetType().ToString().Contains("KeyBind")) - { - this.ValueType = MenuValueType.KeyBind; - } - else if (newValue.GetType().ToString().Contains("Int")) - { - this.ValueType = MenuValueType.Integer; - } - else if (newValue.GetType().ToString().Contains("Circle")) - { - this.ValueType = MenuValueType.Circle; - } - else if (newValue.GetType().ToString().Contains("StringList")) - { - this.ValueType = MenuValueType.StringList; - } - else if (newValue.GetType().ToString().Contains("Color")) - { - this.ValueType = MenuValueType.Color; - } - else - { - Console.WriteLine(@"CommonLibMenu: Data type not supported"); - } - - var readBytes = SavedSettings.GetSavedData(this.SaveFileName, this.SaveKey); - var v = newValue; - - try - { - if (!this.ValueSet && readBytes != null) - { - switch (this.ValueType) - { - case MenuValueType.KeyBind: - var savedKeyValue = (KeyBind)(object)Utils.Deserialize(readBytes); - if (savedKeyValue.Type == KeyBindType.Press) - { - savedKeyValue.Active = false; - } - - newValue = (T)(object)savedKeyValue; - break; - case MenuValueType.Circle: - var savedCircleValue = (Circle)(object)Utils.Deserialize(readBytes); - var newCircleValue = (Circle)(object)newValue; - savedCircleValue.Radius = newCircleValue.Radius; - newValue = (T)(object)savedCircleValue; - break; - case MenuValueType.Slider: - var savedSliderValue = (Slider)(object)Utils.Deserialize(readBytes); - var newSliderValue = (Slider)(object)newValue; - if (savedSliderValue.MinValue == newSliderValue.MinValue - && savedSliderValue.MaxValue == newSliderValue.MaxValue) - { - newValue = (T)(object)savedSliderValue; - } - - break; - case MenuValueType.StringList: - var savedListValue = (StringList)(object)Utils.Deserialize(readBytes); - var newListValue = (StringList)(object)newValue; - if (savedListValue.SList.SequenceEqual(newListValue.SList)) - { - newValue = (T)(object)savedListValue; - } - - break; - default: - newValue = Utils.Deserialize(readBytes); - break; - } - } - } - catch (Exception e) - { - newValue = v; - Console.WriteLine(e); - } - - OnValueChangeEventArgs valueChangedEvent = null; - - if (this.ValueSet) - { - var handler = this.ValueChanged; - if (handler != null) - { - valueChangedEvent = new OnValueChangeEventArgs(this.value, newValue); - handler(this, valueChangedEvent); - } - } - - if (valueChangedEvent != null) - { - if (valueChangedEvent.Process) - { - this.value = newValue; - } - } - else - { - this.value = newValue; - } - - this.ValueSet = true; - this.serialized = Utils.Serialize(this.value); - return this; - } - - /// - /// Shows the item. - /// - /// - /// Indicates whether to show the item. - /// - /// - /// The item instance. - /// - public MenuItem Show(bool showItem = true) - { - this.ShowItem = showItem; - - return this; - } - - /// - /// Show the tooltip. - /// - /// - public void ShowTooltip(bool hide = false) - { - if (!string.IsNullOrEmpty(this.Tooltip)) - { - this.DrawingTooltip = !hide; - } - } - - /// - /// Shows the tooltip notification. - /// - public void ShowTooltipNotification() - { - if (!string.IsNullOrEmpty(this.Tooltip)) - { - var notif = new Notification(this.Tooltip).SetTextColor(System.Drawing.Color.White); - Notifications.AddNotification(notif); - Utility.DelayAction.Add(this.TooltipDuration, () => notif.Dispose()); - } - } - - /// - /// Gets the item value, safely. - /// - /// - /// The item type. - /// - /// - /// The value. - /// - public T TryGetValue() - { - return this.value is T ? (T)this.value : default(T); - } - - /// - /// Gets a value indicating if the value is of item type. - /// - /// - /// The item type. - /// - /// - /// The indicating whether the value is of type. - /// - public bool TypeOf() - { - return this.value is T; - } - - #endregion - - #region Methods - - /// - /// Indicates whether the position is inside the menu item. - /// - /// - /// The position. - /// - /// - /// The . - /// - internal bool IsInside(Vector2 position) - { - return Utils.IsUnderRectangle( - position, - this.Position.X, - this.Position.Y, - !string.IsNullOrEmpty(this.Tooltip) ? this.Width + this.Height : this.Width, - this.Height); - } - - /// - /// On draw event. - /// - internal void OnDraw() - { - var s = MultiLanguage._(this.DisplayName); - - MenuDrawHelper.DrawBox( - this.Position, - this.Width, - this.Height, - MenuSettings.BackgroundColor, - 1, - System.Drawing.Color.Black); - - if (this.DrawingTooltip) - { - MenuDrawHelper.DrawToolTipText( - new Vector2(this.Position.X + this.Width, this.Position.Y), - this, - this.TooltipColor); - } - - var style = this.FontStyle; - style &= ~FontStyle.Strikeout; - style &= ~FontStyle.Underline; - - var font = MenuDrawHelper.GetFont(style); - - switch (this.ValueType) - { - case MenuValueType.Boolean: - MenuDrawHelper.DrawOnOff( - this.GetValue(), - new Vector2(this.Position.X + this.Width - this.Height, this.Position.Y), - this); - break; - - case MenuValueType.Slider: - MenuDrawHelper.DrawSlider(this.Position, this); - break; - - case MenuValueType.KeyBind: - var val = this.GetValue(); - - if (this.Interacting) - { - s = MultiLanguage._("Press new key(s)"); - } - - if (val.Key != 0) - { - var x = !string.IsNullOrEmpty(this.Tooltip) - ? (int)this.Position.X + this.Width - this.Height - - font.MeasureText("[" + Utils.KeyToText(val.Key) + "]").Width - 35 - : (int)this.Position.X + this.Width - this.Height - - font.MeasureText("[" + Utils.KeyToText(val.Key) + "]").Width - 10; - - font.DrawText( - null, - "[" + Utils.KeyToText(val.Key) + "]", - new Rectangle(x, (int)this.Position.Y, this.Width, this.Height), - FontDrawFlags.VerticalCenter, - new ColorBGRA(1, 169, 234, 255)); - } - - if (val.SecondaryKey != 0) - { - var x_secondary = !string.IsNullOrEmpty(this.Tooltip) - ? (int)this.Position.X + this.Width - this.Height - - font.MeasureText("[" + Utils.KeyToText(val.Key) + "]").Width - - font.MeasureText("[" + Utils.KeyToText(val.Key) + "]").Width / 4 - - font.MeasureText("[" + Utils.KeyToText(val.SecondaryKey) + "]").Width - - 35 - : (int)this.Position.X + this.Width - this.Height - - font.MeasureText("[" + Utils.KeyToText(val.Key) + "]").Width - - font.MeasureText("[" + Utils.KeyToText(val.Key) + "]").Width / 4 - - font.MeasureText("[" + Utils.KeyToText(val.SecondaryKey) + "]").Width - - 10; - - font.DrawText( - null, - "[" + Utils.KeyToText(val.SecondaryKey) + "]", - new Rectangle(x_secondary, (int)this.Position.Y, this.Width, this.Height), - FontDrawFlags.VerticalCenter, - new ColorBGRA(1, 169, 234, 255)); - } - - MenuDrawHelper.DrawOnOff( - val.Active, - new Vector2(this.Position.X + this.Width - this.Height, this.Position.Y), - this); - - break; - - case MenuValueType.Integer: - var intVal = this.GetValue(); - MenuDrawHelper.Font.DrawText( - null, - intVal.ToString(), - new Rectangle((int)this.Position.X + 5, (int)this.Position.Y, this.Width, this.Height), - FontDrawFlags.VerticalCenter | FontDrawFlags.Right, - new ColorBGRA(255, 255, 255, 255)); - break; - - case MenuValueType.Color: - var colorVal = this.GetValue(); - MenuDrawHelper.DrawBox( - this.Position + new Vector2(this.Width - this.Height, 0), - this.Height, - this.Height, - colorVal, - 1, - System.Drawing.Color.Black); - break; - - case MenuValueType.Circle: - var circleVal = this.GetValue(); - MenuDrawHelper.DrawBox( - this.Position + new Vector2(this.Width - this.Height * 2, 0), - this.Height, - this.Height, - circleVal.Color, - 1, - System.Drawing.Color.Black); - MenuDrawHelper.DrawOnOff( - circleVal.Active, - new Vector2(this.Position.X + this.Width - this.Height, this.Position.Y), - this); - break; - - case MenuValueType.StringList: - var slVal = this.GetValue(); - - var t = slVal.SList[slVal.SelectedIndex]; - - MenuDrawHelper.DrawArrow( - "<<", - this.Position + new Vector2(this.Width - this.Height * 2, 0), - this, - System.Drawing.Color.Black); - MenuDrawHelper.DrawArrow( - ">>", - this.Position + new Vector2(this.Width - this.Height, 0), - this, - System.Drawing.Color.Black); - - MenuDrawHelper.Font.DrawText( - null, - MultiLanguage._(t), - new Rectangle( - (int)this.Position.X - 5 - 2 * this.Height, - (int)this.Position.Y, - this.Width, - this.Height), - FontDrawFlags.VerticalCenter | FontDrawFlags.Right, - new ColorBGRA(255, 255, 255, 255)); - break; - } - - if (!string.IsNullOrEmpty(this.Tooltip)) - { - MenuDrawHelper.DrawToolTipButton(new Vector2(this.Position.X + this.Width, this.Position.Y), this); - } - - font.DrawText( - null, - s, - new Rectangle((int)this.Position.X + 5, (int)this.Position.Y, this.Width, this.Height), - FontDrawFlags.VerticalCenter, - this.FontColor); - - var textWidth = font.MeasureText(null, MultiLanguage._(this.DisplayName)); - if ((this.FontStyle & FontStyle.Strikeout) != 0) - { - Drawing.DrawLine( - this.Position.X + 5, - this.Position.Y + (MenuSettings.MenuItemHeight / 2f), - this.Position.X + 5 + textWidth.Width, - this.Position.Y + (MenuSettings.MenuItemHeight / 2f), - 1f, - System.Drawing.Color.FromArgb( - this.FontColor.A, - this.FontColor.R, - this.FontColor.G, - this.FontColor.B)); - } - - if ((this.FontStyle & FontStyle.Underline) != 0) - { - Drawing.DrawLine( - this.Position.X + 5, - this.Position.Y + (MenuSettings.MenuItemHeight / 1.5f), - this.Position.X + 5 + textWidth.Width, - this.Position.Y + (MenuSettings.MenuItemHeight / 1.5f), - 1f, - System.Drawing.Color.FromArgb( - this.FontColor.A, - this.FontColor.R, - this.FontColor.G, - this.FontColor.B)); - } - } - - /// - /// Called when the game receives a window message. - /// - /// - /// The message. - /// - /// - /// The cursor position. - /// - /// - /// The key. - /// - /// - /// The windows arguments. - /// - internal void OnReceiveMessage( - WindowsMessages message, - Vector2 cursorPos, - uint key, - WndEventComposition wndArgs) - { - if (message == WindowsMessages.WM_MOUSEMOVE) - { - if (this.Visible && this.IsInside(cursorPos)) - { - if (cursorPos.X > this.Position.X + this.Width - 67 - && cursorPos.X < this.Position.X + this.Width - 67 + this.Height + 8) - { - this.ShowTooltip(); - } - } - else - { - this.ShowTooltip(true); - } - } - - switch (this.ValueType) - { - case MenuValueType.Boolean: - if (message != WindowsMessages.WM_LBUTTONDOWN) - { - return; - } - - if (!this.Visible) - { - return; - } - - if (!this.IsInside(cursorPos)) - { - return; - } - - if (cursorPos.X > this.Position.X + this.Width) - { - break; - } - - if (cursorPos.X > this.Position.X + this.Width - this.Height) - { - this.SetValue(!this.GetValue()); - } - - break; - case MenuValueType.Slider: - if (!this.Visible) - { - this.Interacting = false; - return; - } - - if (message == WindowsMessages.WM_MOUSEMOVE && this.Interacting - || message == WindowsMessages.WM_LBUTTONDOWN && !this.Interacting && this.IsInside(cursorPos)) - { - var val = this.GetValue(); - var t = val.MinValue - + ((cursorPos.X - this.Position.X) * (val.MaxValue - val.MinValue)) / this.Width; - val.Value = (int)t; - this.SetValue(val); - } - - if (message != WindowsMessages.WM_LBUTTONDOWN && message != WindowsMessages.WM_LBUTTONUP) - { - return; - } - - if (!this.IsInside(cursorPos) && message == WindowsMessages.WM_LBUTTONDOWN) - { - return; - } - - this.Interacting = message == WindowsMessages.WM_LBUTTONDOWN; - break; - case MenuValueType.Color: - if (message != WindowsMessages.WM_LBUTTONDOWN) - { - return; - } - - if (!this.Visible) - { - return; - } - - if (!this.IsInside(cursorPos)) - { - return; - } - - if (cursorPos.X > this.Position.X + this.Width) - { - break; - } - - if (cursorPos.X > this.Position.X + this.Width - this.Height) - { - var c = this.GetValue(); - ColorPicker.Load(delegate(System.Drawing.Color args) { this.SetValue(args); }, c); - } - - break; - case MenuValueType.Circle: - if (message != WindowsMessages.WM_LBUTTONDOWN) - { - return; - } - - if (!this.Visible) - { - return; - } - - if (!this.IsInside(cursorPos)) - { - return; - } - - if (cursorPos.X > this.Position.X + this.Width) - { - break; - } - - if (cursorPos.X - this.Position.X > this.Width - this.Height) - { - var val = this.GetValue(); - val.Active = !val.Active; - this.SetValue(val); - } - else if (cursorPos.X - this.Position.X > this.Width - 2 * this.Height) - { - var c = this.GetValue(); - ColorPicker.Load( - delegate(System.Drawing.Color args) - { - var val = this.GetValue(); - val.Color = args; - this.SetValue(val); - }, - c.Color); - } - - break; - case MenuValueType.KeyBind: - if (!MenuGUI.IsChatOpen && !MenuGUI.IsShopOpen) - { - switch (message) - { - case WindowsMessages.WM_KEYDOWN: - var val = this.GetValue(); - if (key == val.Key || key == val.SecondaryKey) - { - if (val.Type == KeyBindType.Press) - { - if (!val.Active) - { - val.Active = true; - this.SetValue(val); - } - } - } - break; - case WindowsMessages.WM_KEYUP: - - var val2 = this.GetValue(); - if (key == val2.Key || key == val2.SecondaryKey) - { - if (val2.Type == KeyBindType.Press) - { - val2.Active = false; - this.SetValue(val2); - } - else - { - val2.Active = !val2.Active; - this.SetValue(val2); - } - } - break; - } - } - - if (key == 8 && message == WindowsMessages.WM_KEYUP && this.Interacting) - { - var val = this.GetValue(); - val.Key = 0; - val.SecondaryKey = 0; - this.SetValue(val); - this.Interacting = false; - this.KeybindSettingStage = KeybindSetStage.NotSetting; - } - - if (message == WindowsMessages.WM_KEYUP && this.Interacting - && this.KeybindSettingStage != KeybindSetStage.NotSetting) - { - if (this.KeybindSettingStage == KeybindSetStage.Keybind1) - { - var val = this.GetValue(); - val.Key = key; - this.SetValue(val); - this.KeybindSettingStage = KeybindSetStage.Keybind2; - } - else if (this.KeybindSettingStage == KeybindSetStage.Keybind2) - { - var val = this.GetValue(); - val.SecondaryKey = key; - this.SetValue(val); - this.Interacting = false; - this.KeybindSettingStage = KeybindSetStage.NotSetting; - } - } - - if (message == WindowsMessages.WM_KEYUP && this.Interacting - && this.KeybindSettingStage == KeybindSetStage.NotSetting) - { - var val = this.GetValue(); - val.Key = key; - val.SecondaryKey = 0; - this.SetValue(val); - this.Interacting = false; - } - - if (!this.Visible) - { - return; - } - - if (message != WindowsMessages.WM_LBUTTONDOWN && wndArgs.Msg != WindowsMessages.WM_RBUTTONDOWN) - { - return; - } - - if (!this.IsInside(cursorPos)) - { - return; - } - - if (cursorPos.X > this.Position.X + this.Width) - { - break; - } - - if (cursorPos.X > this.Position.X + this.Width - this.Height) - { - var val = this.GetValue(); - val.Active = !val.Active; - this.SetValue(val); - } - else - { - if (wndArgs.Msg == WindowsMessages.WM_RBUTTONDOWN) - { - this.KeybindSettingStage = KeybindSetStage.Keybind1; - } - //this.Stage = KeybindSetStage.NotSetting; - this.Interacting = !this.Interacting; - } - - break; - case MenuValueType.StringList: - if (!this.Visible) - { - return; - } - - if (message != WindowsMessages.WM_LBUTTONDOWN) - { - return; - } - - if (!this.IsInside(cursorPos)) - { - return; - } - - if (cursorPos.X > this.Position.X + this.Width) - { - break; - } - - var slVal = this.GetValue(); - if (cursorPos.X > this.Position.X + this.Width - this.Height) - { - slVal.SelectedIndex = slVal.SelectedIndex == slVal.SList.Length - 1 - ? 0 - : (slVal.SelectedIndex + 1); - this.SetValue(slVal); - } - else if (cursorPos.X > this.Position.X + this.Width - 2 * this.Height) - { - slVal.SelectedIndex = slVal.SelectedIndex == 0 - ? slVal.SList.Length - 1 - : (slVal.SelectedIndex - 1); - this.SetValue(slVal); - } - - break; - } - } - - /// - /// Save to file. - /// - /// - /// Data collection. - /// - internal void SaveToFile(ref Dictionary> dics) - { - if (!this.dontSave) - { - if (!dics.ContainsKey(this.SaveFileName)) - { - dics[this.SaveFileName] = new Dictionary(); - } - - dics[this.SaveFileName][this.SaveKey] = this.serialized; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/MenuValueType.cs b/Menu/MenuValueType.cs deleted file mode 100644 index 6cfd7488..00000000 --- a/Menu/MenuValueType.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace LeagueSharp.Common -{ - /// - /// The menu value type. - /// - internal enum MenuValueType - { - /// - /// No type. - /// - None, - - /// - /// The boolean type. - /// - Boolean, - - /// - /// The slider type. - /// - Slider, - - /// - /// The keybind type. - /// - KeyBind, - - /// - /// The integer type. - /// - Integer, - - /// - /// The color type. - /// - Color, - - /// - /// The circle type. - /// - Circle, - - /// - /// The string list type. - /// - StringList - } -} \ No newline at end of file diff --git a/Menu/SavedSettings.cs b/Menu/SavedSettings.cs deleted file mode 100644 index 3caf4382..00000000 --- a/Menu/SavedSettings.cs +++ /dev/null @@ -1,95 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.IO; - - /// - /// The menu settings manager (serialization, saving, etc.) - /// - [Serializable] - internal static class SavedSettings - { - #region Static Fields - - /// - /// The loaded files collection. - /// - public static Dictionary> LoadedFiles = - new Dictionary>(); - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the saved data. - /// - /// - /// The name. - /// - /// - /// The key. - /// - /// - /// The collection of the data. - /// - public static byte[] GetSavedData(string name, string key) - { - var dic = LoadedFiles.ContainsKey(name) ? LoadedFiles[name] : Load(name); - return dic == null ? null : dic.ContainsKey(key) ? dic[key] : null; - } - - /// - /// Loads the specific entry. - /// - /// - /// The name of the entry. - /// - /// - /// The collection of the entry contents. - /// - public static Dictionary Load(string name) - { - try - { - var fileName = Path.Combine(MenuSettings.MenuConfigPath, name + ".bin"); - if (File.Exists(fileName)) - { - return Utils.Deserialize>(File.ReadAllBytes(fileName)); - } - } - catch (Exception e) - { - Console.WriteLine(e); - } - - return null; - } - - /// - /// Saves the specificed entry. - /// - /// - /// The name of the entry. - /// - /// - /// The entires. - /// - public static void Save(string name, Dictionary entires) - { - try - { - Directory.CreateDirectory(MenuSettings.MenuConfigPath); - File.WriteAllBytes(Path.Combine(MenuSettings.MenuConfigPath, name + ".bin"), Utils.Serialize(entires)); - } - catch (Exception e) - { - Console.WriteLine(e); - throw; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Menu/StringList.cs b/Menu/StringList.cs deleted file mode 100644 index 53c36732..00000000 --- a/Menu/StringList.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - - /// - /// The menu string list. - /// - [Serializable] - public struct StringList - { - #region Fields - - /// - /// The selected index. - /// - public int SelectedIndex; - - /// - /// The string list. - /// - public string[] SList; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// - /// The string list. - /// - /// - /// The default index. - /// - public StringList(string[] stringList, int defaultIndex = 0) - { - this.SList = stringList; - this.SelectedIndex = defaultIndex; - } - - #endregion - - #region Public Properties - - /// - /// Gets the selected value. - /// - public string SelectedValue - { - get - { - return (this.SelectedIndex >= 0 && this.SelectedIndex < this.SList.Length) - ? this.SList[this.SelectedIndex] - : string.Empty; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/MinionManager.cs b/MinionManager.cs deleted file mode 100644 index f7bdfebd..00000000 --- a/MinionManager.cs +++ /dev/null @@ -1,418 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using SharpDX; - - /// - /// An enum representing the order the minions should be listed. - /// - public enum MinionOrderTypes - { - /// - /// No order. - /// - None, - - /// - /// Ordered by the current health of the minion. (Least to greatest) - /// - Health, - - /// - /// Ordered by the maximum health of the minions. (Greatest to least) - /// - MaxHealth - } - - /// - /// The team of the minion. - /// - public enum MinionTeam - { - /// - /// The minion is not on either team. - /// - Neutral, - - /// - /// The minions is an ally - /// - Ally, - - /// - /// The minions is an enemy - /// - Enemy, - - /// - /// The minion is not an ally - /// - NotAlly, - - /// - /// The minions is not an ally for the enemy - /// - NotAllyForEnemy, - - /// - /// Any minion. - /// - All - } - - /// - /// The type of minion. - /// - public enum MinionTypes - { - /// - /// Ranged minions. - /// - Ranged, - - /// - /// Melee minions. - /// - Melee, - - /// - /// Any minion - /// - All, - - /// - /// Any wards. (TODO) - /// - [Obsolete("Wards have not been implemented yet in the minion manager.")] - Wards - } - - /// - /// Manages minions. - /// - public static class MinionManager - { - #region Public Methods and Operators - - /// - /// Returns the point where, when casted, the circular spell with hit the maximum amount of minions. - /// - /// The minion positions. - /// The width. - /// The range. - /// The use mec maximum. - /// FarmLocation. - public static FarmLocation GetBestCircularFarmLocation( - List minionPositions, - float width, - float range, - int useMECMax = 9) - { - var result = new Vector2(); - var minionCount = 0; - var startPos = ObjectManager.Player.ServerPosition.To2D(); - - range = range * range; - - if (minionPositions.Count == 0) - { - return new FarmLocation(result, minionCount); - } - - /* Use MEC to get the best positions only when there are less than 9 positions because it causes lag with more. */ - if (minionPositions.Count <= useMECMax) - { - var subGroups = GetCombinations(minionPositions); - foreach (var subGroup in subGroups) - { - if (subGroup.Count > 0) - { - var circle = MEC.GetMec(subGroup); - - if (circle.Radius <= width && circle.Center.Distance(startPos, true) <= range) - { - minionCount = subGroup.Count; - return new FarmLocation(circle.Center, minionCount); - } - } - } - } - else - { - foreach (var pos in minionPositions) - { - if (pos.Distance(startPos, true) <= range) - { - var count = minionPositions.Count(pos2 => pos.Distance(pos2, true) <= width * width); - - if (count >= minionCount) - { - result = pos; - minionCount = count; - } - } - } - } - - return new FarmLocation(result, minionCount); - } - - /// - /// Returns the point where, when casted, the linear spell with hit the maximum amount of minions. - /// - /// The minion positions. - /// The width. - /// The range. - /// FarmLocation. - public static FarmLocation GetBestLineFarmLocation(List minionPositions, float width, float range) - { - var result = new Vector2(); - var minionCount = 0; - var startPos = ObjectManager.Player.ServerPosition.To2D(); - - var posiblePositions = new List(); - posiblePositions.AddRange(minionPositions); - - var max = minionPositions.Count; - for (var i = 0; i < max; i++) - { - for (var j = 0; j < max; j++) - { - if (minionPositions[j] != minionPositions[i]) - { - posiblePositions.Add((minionPositions[j] + minionPositions[i]) / 2); - } - } - } - - foreach (var pos in posiblePositions) - { - if (pos.Distance(startPos, true) <= range * range) - { - var endPos = startPos + range * (pos - startPos).Normalized(); - - var count = - minionPositions.Count(pos2 => pos2.Distance(startPos, endPos, true, true) <= width * width); - - if (count >= minionCount) - { - result = endPos; - minionCount = count; - } - } - } - - return new FarmLocation(result, minionCount); - } - - /// - /// Gets minions based on range, type, team and then orders them. - /// - /// The point to get the minions from. - /// The range. - /// The type. - /// The team. - /// The order. - /// List<Obj_AI_Base>. - public static List GetMinions( - Vector3 from, - float range, - MinionTypes type = MinionTypes.All, - MinionTeam team = MinionTeam.Enemy, - MinionOrderTypes order = MinionOrderTypes.Health) - { - var result = (from minion in ObjectManager.Get() - where minion.IsValidTarget(range, false, @from) - let minionTeam = minion.Team - where - team == MinionTeam.Neutral && minionTeam == GameObjectTeam.Neutral - || team == MinionTeam.Ally - && minionTeam - == (ObjectManager.Player.Team == GameObjectTeam.Chaos - ? GameObjectTeam.Chaos - : GameObjectTeam.Order) - || team == MinionTeam.Enemy - && minionTeam - == (ObjectManager.Player.Team == GameObjectTeam.Chaos - ? GameObjectTeam.Order - : GameObjectTeam.Chaos) - || team == MinionTeam.NotAlly && minionTeam != ObjectManager.Player.Team - || team == MinionTeam.NotAllyForEnemy - && (minionTeam == ObjectManager.Player.Team || minionTeam == GameObjectTeam.Neutral) - || team == MinionTeam.All - where - minion.IsMelee() && type == MinionTypes.Melee - || !minion.IsMelee() && type == MinionTypes.Ranged || type == MinionTypes.All - where - IsMinion(minion) - || minionTeam == GameObjectTeam.Neutral && minion.MaxHealth > 5 && minion.IsHPBarRendered - select minion).Cast().ToList(); - - switch (order) - { - case MinionOrderTypes.Health: - result = result.OrderBy(o => o.Health).ToList(); - break; - case MinionOrderTypes.MaxHealth: - result = result.OrderByDescending(o => o.MaxHealth).ToList(); - break; - } - - return result; - } - - /// - /// Gets the minions. - /// - /// The range. - /// The type. - /// The team. - /// The order. - /// List<Obj_AI_Base>. - public static List GetMinions( - float range, - MinionTypes type = MinionTypes.All, - MinionTeam team = MinionTeam.Enemy, - MinionOrderTypes order = MinionOrderTypes.Health) - { - return GetMinions(ObjectManager.Player.ServerPosition, range, type, team, order); - } - - /// - /// Gets the minions predicted positions. - /// - /// The minions. - /// The delay. - /// The width. - /// The speed. - /// From. - /// The range. - /// if set to true, checks for collision. - /// The skillshot type. - /// The position to check the range from. - /// List<Vector2>. - public static List GetMinionsPredictedPositions( - List minions, - float delay, - float width, - float speed, - Vector3 from, - float range, - bool collision, - SkillshotType stype, - Vector3 rangeCheckFrom = new Vector3()) - { - from = from.To2D().IsValid() ? from : ObjectManager.Player.ServerPosition; - - return (from minion in minions - select - Prediction.GetPrediction( - new PredictionInput - { - Unit = minion, Delay = delay, Radius = width, Speed = speed, From = @from, - Range = range, Collision = collision, Type = stype, RangeCheckFrom = rangeCheckFrom - }) - into pos - where pos.Hitchance >= HitChance.High - select pos.UnitPosition.To2D()).ToList(); - } - - /// - /// Determines whether the specified object is a minion. - /// - /// The minion. - /// if set to true [include wards]. - /// true if the specified minion is minion; otherwise, false. - public static bool IsMinion(Obj_AI_Minion minion, bool includeWards = false) - { - return minion.Name.Contains("Minion") || includeWards && IsWard(minion); - } - - /// - /// Determines whether the specified base skin name is ward. - /// - /// Name of the base skin. Should be lowercase. - /// true if the specified base skin name is ward; otherwise, false. - [Obsolete("Use IsWard(Obj_AI_Minion)")] - public static bool IsWard(string baseSkinName) - { - return baseSkinName.Contains("ward"); - } - - /// - /// Determines whether the specified minion is a valid attackable ward. - /// - /// The minion you want to check for - /// true if the given minion is a valid attackable ward, otherwise returns false. - public static bool IsWard(Obj_AI_Minion minion) - { - return minion.Name.Contains("Ward") && minion.IsHPBarRendered; - } - - #endregion - - #region Methods - - /* - from: https://stackoverflow.com/questions/10515449/generate-all-combinations-for-a-list-of-strings :^) - */ - - /// - /// Returns all the subgroup combinations that can be made from a group - /// - /// All values. - /// List<List<Vector2>>. - private static List> GetCombinations(List allValues) - { - var collection = new List>(); - for (var counter = 0; counter < (1 << allValues.Count); ++counter) - { - var combination = allValues.Where((t, i) => (counter & (1 << i)) == 0).ToList(); - - collection.Add(combination); - } - return collection; - } - - #endregion - - /// - /// A struct that represents the best position to cast a skillshot to hit the best number of minions, as well as the - /// number of minions hit. - /// - public struct FarmLocation - { - #region Fields - - /// - /// The minions hit - /// - public int MinionsHit; - - /// - /// The position - /// - public Vector2 Position; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The position. - /// The minions hit. - public FarmLocation(Vector2 position, int minionsHit) - { - this.Position = position; - this.MinionsHit = minionsHit; - } - - #endregion - } - } -} \ No newline at end of file diff --git a/MultiLanguage.cs b/MultiLanguage.cs deleted file mode 100644 index d34ea71d..00000000 --- a/MultiLanguage.cs +++ /dev/null @@ -1,81 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Resources; - using System.Web.Script.Serialization; - - using LeagueSharp.Common.Properties; - - /// - /// Provides multi-lingual strings. - /// - public static class MultiLanguage - { - #region Static Fields - - /// - /// The translations - /// - private static Dictionary Translations = new Dictionary(); - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static MultiLanguage() - { - LoadLanguage(Config.SelectedLanguage); - } - - #endregion - - #region Public Methods and Operators - - /// - /// Translates the text into the loaded language. - /// - /// The text to translate. - /// System.String. - public static string _(string textToTranslate) - { - var textToTranslateToLower = textToTranslate.ToLower(); - return Translations.ContainsKey(textToTranslateToLower) - ? Translations[textToTranslateToLower] - : textToTranslate; - } - - /// - /// Loads the language. - /// - /// Name of the language. - /// true if the operation succeeded, false otherwise false. - public static bool LoadLanguage(string languageName) - { - try - { - var languageStrings = - new ResourceManager("LeagueSharp.Common.Properties.Resources", typeof(Resources).Assembly).GetString - (languageName + "Json"); - - if (String.IsNullOrEmpty(languageStrings)) - { - return false; - } - - Translations = new JavaScriptSerializer().Deserialize>(languageStrings); - return true; - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - return false; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/PermaShow.cs b/PermaShow.cs deleted file mode 100644 index e4e5a283..00000000 --- a/PermaShow.cs +++ /dev/null @@ -1,663 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using SharpDX; - using SharpDX.Direct3D9; - - /// - /// The PermaShow class allows you to add important items to permashow easily. - /// - public static class PermaShow - { - #region Static Fields - - /// - /// The default perma show width - /// - private static readonly float DefaultPermaShowWidth = 170f; - - /// - /// The default small box width - /// - private static readonly float DefaultSmallBoxWidth = 45f; - - /// - /// List of items for PermaShow - /// - private static readonly List PermaShowItems = new List(); - - /// - /// The x factor - /// - private static readonly float XFactor = Drawing.Width / 1366f; - - /// - /// The y factor - /// - private static readonly float YFactor = Drawing.Height / 768f; - - /// - /// The line for the box. - /// - private static Line BoxLine; - - /// - /// The box position - /// - private static Vector2 BoxPosition; - - /// - /// The default position - /// - private static Vector2 DefaultPosition = new Vector2( - Drawing.Width - (0.79f * Drawing.Width), - Drawing.Height - (0.98f * Drawing.Height)); - - /// - /// The dragging - /// - private static bool Dragging; - - /// - /// The menu to save position and bool for moving the menu - /// - private static Menu placetosave; - - /// - /// The sprite - /// - private static Sprite sprite; - - /// - /// true if this instance has subscribed to the L# events. - /// - private static bool subbed; - - /// - /// The font for text. - /// - private static Font Text; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static PermaShow() - { - CreateMenu(); - BoxPosition = GetPosition(); - PrepareDrawing(); - } - - #endregion - - #region Enums - - /// - /// Represents a direction. - /// - private enum Direction - { - /// - /// The X direction. (Horizontal) - /// - X, - - /// - /// The Y direction. (Vertical) - /// - Y - } - - #endregion - - #region Properties - - /// - /// Gets the width of the perma show. - /// - /// The width of the perma show. - private static float PermaShowWidth - { - get - { - return ScaleValue(placetosave.Item("bwidth").GetValue().Value, Direction.X); - } - } - - /// - /// Gets the width of the small box. - /// - /// The width of the small box. - private static float SmallBoxWidth - { - get - { - return ScaleValue(placetosave.Item("swidth").GetValue().Value, Direction.X); - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Adds a menuitem to PermaShow, can be used without any arguements or with if you want to customize. The bool can be - /// set to false to remove the item from permashow. - /// When removing, you can simply set the bool parameter to false and everything else can be null. The default color is - /// White. - /// - /// The item. - /// if set to true the instance will be enabled. - /// The customdisplayname. - /// The color. - public static void Permashow( - this MenuItem item, - bool enabled = true, - string customdisplayname = null, - Color? col = null) - { - if (!IsEnabled()) - { - return; - } - if (enabled && PermaShowItems.All(x => x.Item != item)) - { - if (!PermaShowItems.Any()) - { - Sub(); - } - var dispName = customdisplayname ?? item.DisplayName; - Color? color = col ?? new ColorBGRA(255, 255, 255, 255); - PermaShowItems.Add( - new PermaShowItem - { DisplayName = dispName, Item = item, ItemType = item.ValueType, Color = (Color)color }); - } - - else if (!enabled) - { - var itemtoremove = PermaShowItems.FirstOrDefault(x => x.Item == item); - if (itemtoremove != null) - { - PermaShowItems.Remove(itemtoremove); - if (!PermaShowItems.Any()) - { - Unsub(); - } - } - } - } - - #endregion - - #region Methods - - /// - /// Create the menu - /// - private static void CreateMenu() - { - placetosave = new Menu("PermaShow", "Permashow"); - var enablepermashow = new MenuItem("enablepermashow", "Enable PermaShow").SetValue(true); - placetosave.AddItem(enablepermashow); - var xvalue = new MenuItem("X", "X").SetValue(new Slider((int)DefaultPosition.X, 0, Drawing.Width)); - var yvalue = new MenuItem("Y", "Y").SetValue(new Slider((int)DefaultPosition.Y, 0, Drawing.Height)); - xvalue.ShowItem = false; - yvalue.ShowItem = false; - placetosave.AddItem(xvalue); - placetosave.AddItem(yvalue); - - var bigwidth = new MenuItem("bwidth", "Width").SetValue(new Slider((int)DefaultPermaShowWidth, 100, 400)); - var smallwidth = - new MenuItem("swidth", "Indicator Width").SetValue(new Slider((int)DefaultSmallBoxWidth, 30, 90)); - - var moveable = new MenuItem("moveable", "Moveable").SetValue(true); - - placetosave.AddItem(moveable); - placetosave.AddItem(bigwidth); - placetosave.AddItem(smallwidth); - - var def = new MenuItem("defaults", "Default").SetValue(false); - def.ValueChanged += (sender, args) => - { - if (args.GetNewValue()) - { - bigwidth.SetValue(new Slider((int)DefaultPermaShowWidth, 100, 400)); - smallwidth.SetValue(new Slider((int)DefaultSmallBoxWidth, 30, 90)); - } - }; - - placetosave.AddItem(def); - - CommonMenu.Instance.AddSubMenu(placetosave); - - enablepermashow.ValueChanged += (sender, args) => - { - if (args.GetNewValue() && !subbed) - { - Sub(); - } - else if (!args.GetNewValue()) - { - Unsub(); - } - }; - } - - /// - /// Fired when the AppDomain is unloaded. - /// - /// The sender. - /// The instance containing the event data. - private static void CurrentDomainOnDomainUnload(object sender, EventArgs eventArgs) - { - BoxLine.OnLostDevice(); - Text.OnLostDevice(); - sprite.OnLostDevice(); - sprite.Dispose(); - Text.Dispose(); - BoxLine.Dispose(); - } - - /// - /// Draws a colored box to indicate booleans true or false with green and red respectively - /// - /// The position. - /// if set to true [ison]. - private static void DrawBox(Vector2 pos, bool ison) - { - BoxLine.Width = SmallBoxWidth; - - BoxLine.Begin(); - - var positions = new[] - { - new Vector2(pos.X, pos.Y), - new Vector2(pos.X, pos.Y + (Text.Description.Height * 1.2f)) - }; - - var col = ison ? Color.DarkGreen : Color.DarkRed; - col.A = 150; - BoxLine.Draw(positions, col); - - BoxLine.End(); - } - - /// - /// Fired when everything has been drawn. - /// - /// The instance containing the event data. - /// [PermaShow] - MenuItem not supported - private static void Drawing_OnEndScene(EventArgs args) - { - if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) - { - return; - } - - if (!placetosave.Item("enablepermashow").GetValue()) - { - Unsub(); - return; - } - - PermaArea(); - - var halfwidth = 0.96f * (PermaShowWidth / 2); - - var baseposition = new Vector2(BoxPosition.X - halfwidth, BoxPosition.Y); - - var boxx = BoxPosition.X + (PermaShowWidth / 2) - (SmallBoxWidth / 2); - - foreach (var permaitem in PermaShowItems) - { - var index = PermaShowItems.IndexOf(permaitem); - var boxpos = new Vector2(boxx, baseposition.Y + (Text.Description.Height * 1.2f * index)); - var endpos = new Vector2( - BoxPosition.X + (PermaShowWidth / 2), - baseposition.Y + (Text.Description.Height * 1.2f * index)); - var itempos = new Vector2(baseposition.X, baseposition.Y + (Text.Description.Height * 1.2f * index)); - - var textpos = (int)(endpos.X - (SmallBoxWidth / 1.2f)); - - switch (permaitem.Item.ValueType) - { - case MenuValueType.Boolean: - DrawBox(boxpos, permaitem.Item.GetValue()); - Text.DrawText( - null, - permaitem.DisplayName + ":", - (int)itempos.X, - (int)itempos.Y, - permaitem.Color); - Text.DrawText( - null, - permaitem.Item.GetValue().ToString(), - textpos, - (int)itempos.Y, - permaitem.Color); - break; - case MenuValueType.Slider: - Text.DrawText( - null, - permaitem.DisplayName + ":", - (int)itempos.X, - (int)itempos.Y, - permaitem.Color); - Text.DrawText( - null, - permaitem.Item.GetValue().Value.ToString(), - textpos, - (int)itempos.Y, - permaitem.Color); - break; - case MenuValueType.KeyBind: - DrawBox(boxpos, permaitem.Item.GetValue().Active); - Text.DrawText( - null, - permaitem.DisplayName + " [" + Utils.KeyToText(permaitem.Item.GetValue().Key) - + "] :", - (int)itempos.X, - (int)itempos.Y, - permaitem.Color); - - Text.DrawText( - null, - permaitem.Item.GetValue().Active.ToString(), - textpos, - (int)(boxpos.Y), - permaitem.Color); - break; - case MenuValueType.StringList: - Text.DrawText( - null, - permaitem.DisplayName + ":", - (int)itempos.X, - (int)itempos.Y, - permaitem.Color); - var dimen = Text.MeasureText(sprite, permaitem.Item.GetValue().SelectedValue); - Text.DrawText( - null, - permaitem.Item.GetValue().SelectedValue, - (int)(textpos + dimen.Width < endpos.X ? textpos : endpos.X - dimen.Width), - (int)itempos.Y, - permaitem.Color); - break; - case MenuValueType.Integer: - Text.DrawText( - null, - permaitem.DisplayName + ":", - (int)itempos.X, - (int)itempos.Y, - permaitem.Color); - Text.DrawText( - null, - permaitem.Item.GetValue().ToString(), - textpos, - (int)itempos.Y, - permaitem.Color); - break; - case MenuValueType.None: - break; - default: - throw new Exception("[PermaShow] - MenuItem not supported"); - } - } - } - - /// - /// Fired after the DirectX device has been reset. - /// - /// The instance containing the event data. - private static void DrawingOnOnPostReset(EventArgs args) - { - sprite.OnResetDevice(); - Text.OnResetDevice(); - BoxLine.OnResetDevice(); - } - - /// - /// Fired before the DirectX device has been reset. - /// - /// The instance containing the event data. - private static void DrawingOnPreReset(EventArgs args) - { - sprite.OnLostDevice(); - Text.OnLostDevice(); - BoxLine.OnLostDevice(); - } - - /// - /// Return current positions from file - /// - /// Vector2. - private static Vector2 GetPosition() - { - return new Vector2( - placetosave.Item("X").GetValue().Value, - placetosave.Item("Y").GetValue().Value); - } - - /// - /// Determines whether this instance is enabled. - /// - /// true if this instance is enabled; otherwise, false. - private static bool IsEnabled() - { - return placetosave.Item("enablepermashow").GetValue(); - } - - /// - /// Gets if the mouse of over the perma show. - /// - /// true if the mouse of over the perma show, false otherwise. - private static bool MouseOverArea() - { - var pos = Utils.GetCursorPos(); - return ((pos.X >= BoxPosition.X - (PermaShowWidth / 2f)) && pos.X <= (BoxPosition.X + (PermaShowWidth / 2f)) - && pos.Y >= BoxPosition.Y - && pos.Y <= (BoxPosition.Y + PermaShowItems.Count * (Text.Description.Height * 1.2f))); - } - - /// - /// Fired when the window receives a message. - /// - /// The instance containing the event data. - private static void OnWndProc(WndEventArgs args) - { - if (MenuSettings.DrawMenu || !placetosave.Item("moveable").GetValue()) - { - Dragging = false; - return; - } - - if (Dragging) - { - BoxPosition = Utils.GetCursorPos(); - } - - if (MouseOverArea() && args.Msg == (uint)WindowsMessages.WM_LBUTTONDOWN) - { - if (!Dragging) - { - Dragging = true; - } - } - else if (Dragging && args.Msg == (uint)WindowsMessages.WM_LBUTTONUP) - { - Dragging = false; - BoxPosition = Utils.GetCursorPos(); - SavePosition(); - } - } - - /// - /// Draw area where text will be drawn - /// - private static void PermaArea() - { - BoxLine.Width = PermaShowWidth; - - BoxLine.Begin(); - - var pos = BoxPosition; - - var positions = new[] - { - new Vector2(pos.X, pos.Y), - new Vector2(pos.X, pos.Y + PermaShowItems.Count * (Text.Description.Height * 1.2f)) - }; - - var col = Color.Black; - - BoxLine.Draw(positions, new ColorBGRA(col.B, col.G, col.R, 0.4f)); - - BoxLine.End(); - } - - /// - /// Initialize the Drawing tools - /// - private static void PrepareDrawing() - { - string FontName; - int FontHeight; - FontQuality Quality; - try - { - FontName = CommonMenu.Instance.Item("FontName").GetValue().SelectedValue; - FontHeight = CommonMenu.Instance.Item("FontSize").GetValue().Value; - Quality = - (FontQuality) - Enum.Parse( - typeof(FontQuality), - CommonMenu.Instance.Item("FontQuality").GetValue().SelectedValue); - } - - catch (Exception e) - { - Console.WriteLine("Common Menu not initialized yet. Resorting to Default Settings " + e); - FontName = "Tahoma"; - FontHeight = 13; - Quality = FontQuality.Default; - } - - try - { - Text = new Font( - Drawing.Direct3DDevice, - new FontDescription - { - FaceName = FontName, Height = FontHeight, OutputPrecision = FontPrecision.Default, - Quality = Quality, - }); - - sprite = new Sprite(Drawing.Direct3DDevice); - BoxLine = new Line(Drawing.Direct3DDevice) { Width = 1 }; - } - catch (DllNotFoundException ex) - { - if (ex.Message.Contains("d3dx9_43")) - { - var msg = - "Drawings won't work because DirectX (June 2010) is not installed, install https://www.microsoft.com/en-us/download/details.aspx?id=8109 to fix this problem."; - Console.WriteLine(msg); - Game.PrintChat(msg); - } - } - } - - /// - /// Saves the current position - /// - private static void SavePosition() - { - placetosave.Item("X").ValueSet = true; - placetosave.Item("Y").ValueSet = true; - placetosave.Item("X").SetValue(new Slider((int)BoxPosition.X, 0, Drawing.Width)); - placetosave.Item("Y").SetValue(new Slider((int)BoxPosition.Y, 0, Drawing.Height)); - } - - /// - /// Scales the value. - /// - /// The value. - /// The direction. - /// System.Single. - private static float ScaleValue(float value, Direction direction) - { - var returnvalue = direction == Direction.X ? value * XFactor : value * YFactor; - return returnvalue; - } - - /// - /// Subscribes this instance to L# events. - /// - private static void Sub() - { - subbed = true; - Drawing.OnPreReset += DrawingOnPreReset; - Drawing.OnPostReset += DrawingOnOnPostReset; - Drawing.OnDraw += Drawing_OnEndScene; - AppDomain.CurrentDomain.DomainUnload += CurrentDomainOnDomainUnload; - AppDomain.CurrentDomain.ProcessExit += CurrentDomainOnDomainUnload; - Game.OnWndProc += OnWndProc; - } - - /// - /// Unsubscribes this instance to L# events. - /// - private static void Unsub() - { - subbed = false; - Drawing.OnPreReset -= DrawingOnPreReset; - Drawing.OnPostReset -= DrawingOnOnPostReset; - Drawing.OnDraw -= Drawing_OnEndScene; - AppDomain.CurrentDomain.DomainUnload -= CurrentDomainOnDomainUnload; - AppDomain.CurrentDomain.ProcessExit -= CurrentDomainOnDomainUnload; - Game.OnWndProc -= OnWndProc; - } - - #endregion - - /// - /// Class PermaShowItem. - /// - internal class PermaShowItem - { - #region Properties - - /// - /// Gets or sets the color. - /// - /// The color. - internal Color Color { get; set; } - - /// - /// Gets or sets the display name. - /// - /// The display name. - internal string DisplayName { get; set; } - - /// - /// Gets or sets the item. - /// - /// The item. - internal MenuItem Item { get; set; } - - /// - /// Gets or sets the type of the item. - /// - /// The type of the item. - internal MenuValueType ItemType { get; set; } - - #endregion - } - } -} \ No newline at end of file diff --git a/Prediction.cs b/Prediction.cs deleted file mode 100644 index e90a733b..00000000 --- a/Prediction.cs +++ /dev/null @@ -1,1623 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text.RegularExpressions; - - using SharpDX; - - /// - /// Represents the chance of hitting an enemy. - /// - public enum HitChance - { - /// - /// The target is immobile. - /// - Immobile = 8, - - /// - /// The unit is dashing. - /// - Dashing = 7, - - /// - /// Very high probability of hitting the target. - /// - VeryHigh = 6, - - /// - /// High probability of hitting the target. - /// - High = 5, - - /// - /// Medium probability of hitting the target. - /// - Medium = 4, - - /// - /// Low probability of hitting the target. - /// - Low = 3, - - /// - /// Impossible to hit the target. - /// - Impossible = 2, - - /// - /// The target is out of range. - /// - OutOfRange = 1, - - /// - /// The target is blocked by other units. - /// - Collision = 0 - } - - /// - /// The type of skillshot. - /// - public enum SkillshotType - { - /// - /// The skillshot is linear. - /// - SkillshotLine, - - /// - /// The skillshot is circular. - /// - SkillshotCircle, - - /// - /// The skillshot is conical. - /// - SkillshotCone - } - - /// - /// Objects that cause collision to the spell. - /// - public enum CollisionableObjects - { - /// - /// Minions. - /// - Minions, - - /// - /// Enemy heroes. - /// - Heroes, - - /// - /// Yasuo's Wind Wall (W) - /// - YasuoWall, - - /// - /// Walls. - /// - Walls, - - /// - /// Ally heroes. - /// - Allies - } - - /// - /// Contains information necessary to calculate the prediction. - /// - public class PredictionInput - { - #region Fields - - /// - /// If set to true the prediction will hit as many enemy heroes as posible. - /// - public bool Aoe = false; - - /// - /// true if the spell collides with units. - /// - public bool Collision = false; - - /// - /// Array that contains the unit types that the skillshot can collide with. - /// - public CollisionableObjects[] CollisionObjects = - { - CollisionableObjects.Minions, CollisionableObjects.YasuoWall - }; - - /// - /// The skillshot delay in seconds. - /// - public float Delay; - - /// - /// The skillshot width's radius or the angle in case of the cone skillshots. - /// - public float Radius = 1f; - - /// - /// The skillshot range in units. - /// - public float Range = float.MaxValue; - - /// - /// The skillshot speed in units per second. - /// - public float Speed = float.MaxValue; - - /// - /// The skillshot type. - /// - public SkillshotType Type = SkillshotType.SkillshotLine; - - /// - /// The unit that the prediction will made for. - /// - public Obj_AI_Base Unit = ObjectManager.Player; - - /// - /// Set to true to increase the prediction radius by the unit bounding radius. - /// - public bool UseBoundingRadius = true; - - /// - /// The position that the skillshot will be launched from. - /// - private Vector3 _from; - - /// - /// The position to check the range from. - /// - private Vector3 _rangeCheckFrom; - - #endregion - - #region Public Properties - - /// - /// The position from where the skillshot missile gets fired. - /// - /// From. - public Vector3 From - { - get - { - return this._from.To2D().IsValid() ? this._from : ObjectManager.Player.ServerPosition; - } - set - { - this._from = value; - } - } - - /// - /// The position from where the range is checked. - /// - /// The range check from. - public Vector3 RangeCheckFrom - { - get - { - return this._rangeCheckFrom.To2D().IsValid() - ? this._rangeCheckFrom - : (this.From.To2D().IsValid() ? this.From : ObjectManager.Player.ServerPosition); - } - set - { - this._rangeCheckFrom = value; - } - } - - #endregion - - #region Properties - - /// - /// Gets the real radius. - /// - /// The real radius. - internal float RealRadius - { - get - { - return this.UseBoundingRadius ? this.Radius + this.Unit.BoundingRadius : this.Radius; - } - } - - #endregion - } - - /// - /// The output after calculating the prediction. - /// - public class PredictionOutput - { - #region Fields - - /// - /// The list of the targets that the spell will hit (only if aoe was enabled). - /// - public List AoeTargetsHit = new List(); - - /// - /// The list of the units that the skillshot will collide with. - /// - public List CollisionObjects = new List(); - - /// - /// Returns the hitchance. - /// - public HitChance Hitchance = HitChance.Impossible; - - /// - /// The AoE target hit. - /// - internal int _aoeTargetsHitCount; - - /// - /// The input - /// - internal PredictionInput Input; - - /// - /// The calculated cast position - /// - private Vector3 _castPosition; - - /// - /// The predicted unit position - /// - private Vector3 _unitPosition; - - #endregion - - #region Public Properties - - /// - /// The number of targets the skillshot will hit (only if aoe was enabled). - /// - /// The aoe targets hit count. - public int AoeTargetsHitCount - { - get - { - return Math.Max(this._aoeTargetsHitCount, this.AoeTargetsHit.Count); - } - } - - /// - /// The position where the skillshot should be casted to increase the accuracy. - /// - /// The cast position. - public Vector3 CastPosition - { - get - { - return this._castPosition.IsValid() && this._castPosition.To2D().IsValid() - ? this._castPosition.SetZ() - : this.Input.Unit.ServerPosition; - } - set - { - this._castPosition = value; - } - } - - /// - /// The position where the unit is going to be when the skillshot reaches his position. - /// - /// The unit position. - public Vector3 UnitPosition - { - get - { - return this._unitPosition.To2D().IsValid() ? this._unitPosition.SetZ() : this.Input.Unit.ServerPosition; - } - set - { - this._unitPosition = value; - } - } - - #endregion - } - - /// - /// Class used for calculating the position of the given unit after a delay. - /// - public static class Prediction - { - #region Static Fields - - private static Menu _menu; - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the prediction. - /// - /// The unit. - /// The delay. - /// PredictionOutput. - public static PredictionOutput GetPrediction(Obj_AI_Base unit, float delay) - { - return GetPrediction(new PredictionInput { Unit = unit, Delay = delay }); - } - - /// - /// Gets the prediction. - /// - /// The unit. - /// The delay. - /// The radius. - /// PredictionOutput. - public static PredictionOutput GetPrediction(Obj_AI_Base unit, float delay, float radius) - { - return GetPrediction(new PredictionInput { Unit = unit, Delay = delay, Radius = radius }); - } - - /// - /// Gets the prediction. - /// - /// The unit. - /// The delay. - /// The radius. - /// The speed. - /// PredictionOutput. - public static PredictionOutput GetPrediction(Obj_AI_Base unit, float delay, float radius, float speed) - { - return GetPrediction(new PredictionInput { Unit = unit, Delay = delay, Radius = radius, Speed = speed }); - } - - /// - /// Gets the prediction. - /// - /// The unit. - /// The delay. - /// The radius. - /// The speed. - /// The collisionable objects. - /// PredictionOutput. - public static PredictionOutput GetPrediction( - Obj_AI_Base unit, - float delay, - float radius, - float speed, - CollisionableObjects[] collisionable) - { - return - GetPrediction( - new PredictionInput - { Unit = unit, Delay = delay, Radius = radius, Speed = speed, CollisionObjects = collisionable }); - } - - /// - /// Gets the prediction. - /// - /// The input. - /// PredictionOutput. - public static PredictionOutput GetPrediction(PredictionInput input) - { - return GetPrediction(input, true, true); - } - - /// - /// Initializes this instance. - /// - public static void Initialize() - { - CustomEvents.Game.OnGameLoad += eventArgs => - { - _menu = new Menu("Prediction", "Prediction"); - var slider = new MenuItem("PredMaxRange", "Max Range %").SetValue(new Slider(100, 70, 100)); - _menu.AddItem(slider); - CommonMenu.Instance.AddSubMenu(_menu); - }; - } - - public static void Shutdown() - { - Menu.Remove(_menu); - } - - #endregion - - #region Methods - - /// - /// Gets the dashing prediction. - /// - /// The input. - /// PredictionOutput. - internal static PredictionOutput GetDashingPrediction(PredictionInput input) - { - var dashData = input.Unit.GetDashInfo(); - var result = new PredictionOutput { Input = input }; - - //Normal dashes. - if (!dashData.IsBlink) - { - //Mid air: - var endP = dashData.Path.Last(); - var dashPred = GetPositionOnPath( - input, - new List { input.Unit.ServerPosition.To2D(), endP }, - dashData.Speed); - if (dashPred.Hitchance >= HitChance.High - && dashPred.UnitPosition.To2D().Distance(input.Unit.Position.To2D(), endP, true) < 200) - { - dashPred.CastPosition = dashPred.UnitPosition; - dashPred.Hitchance = HitChance.Dashing; - return dashPred; - } - - //At the end of the dash: - if (dashData.Path.PathLength() > 200) - { - var timeToPoint = input.Delay / 2f + input.From.To2D().Distance(endP) / input.Speed - 0.25f; - if (timeToPoint - <= input.Unit.Distance(endP) / dashData.Speed + input.RealRadius / input.Unit.MoveSpeed) - { - return new PredictionOutput - { - CastPosition = endP.To3D(), UnitPosition = endP.To3D(), - Hitchance = HitChance.Dashing - }; - } - } - - result.CastPosition = dashData.Path.Last().To3D(); - result.UnitPosition = result.CastPosition; - - //Figure out where the unit is going. - } - - return result; - } - - /// - /// Gets the immobile prediction. - /// - /// The input. - /// The remaining immobile t. - /// PredictionOutput. - internal static PredictionOutput GetImmobilePrediction(PredictionInput input, double remainingImmobileT) - { - var timeToReachTargetPosition = input.Delay + input.Unit.Distance(input.From) / input.Speed; - - if (timeToReachTargetPosition <= remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed) - { - return new PredictionOutput - { - CastPosition = input.Unit.ServerPosition, UnitPosition = input.Unit.Position, - Hitchance = HitChance.Immobile - }; - } - - return new PredictionOutput - { - Input = input, CastPosition = input.Unit.ServerPosition, - UnitPosition = input.Unit.ServerPosition, Hitchance = HitChance.High - /*timeToReachTargetPosition - remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed < 0.4d ? HitChance.High : HitChance.Medium*/ - }; - } - - /// - /// Gets the position on path. - /// - /// The input. - /// The path. - /// The speed. - /// PredictionOutput. - internal static PredictionOutput GetPositionOnPath(PredictionInput input, List path, float speed = -1) - { - speed = (Math.Abs(speed - (-1)) < float.Epsilon) ? input.Unit.MoveSpeed : speed; - - if (path.Count <= 1) - { - return new PredictionOutput - { - Input = input, UnitPosition = input.Unit.ServerPosition, - CastPosition = input.Unit.ServerPosition, Hitchance = HitChance.VeryHigh - }; - } - - var pLength = path.PathLength(); - - //Skillshots with only a delay - if (pLength >= input.Delay * speed - input.RealRadius - && Math.Abs(input.Speed - float.MaxValue) < float.Epsilon) - { - var tDistance = input.Delay * speed - input.RealRadius; - - for (var i = 0; i < path.Count - 1; i++) - { - var a = path[i]; - var b = path[i + 1]; - var d = a.Distance(b); - - if (d >= tDistance) - { - var direction = (b - a).Normalized(); - - var cp = a + direction * tDistance; - var p = a - + direction - * ((i == path.Count - 2) - ? Math.Min(tDistance + input.RealRadius, d) - : (tDistance + input.RealRadius)); - - return new PredictionOutput - { - Input = input, CastPosition = cp.To3D(), UnitPosition = p.To3D(), - Hitchance = - PathTracker.GetCurrentPath(input.Unit).Time < 0.1d - ? HitChance.VeryHigh - : HitChance.High - }; - } - - tDistance -= d; - } - } - - //Skillshot with a delay and speed. - if (pLength >= input.Delay * speed - input.RealRadius - && Math.Abs(input.Speed - float.MaxValue) > float.Epsilon) - { - var d = input.Delay * speed - input.RealRadius; - if (input.Type == SkillshotType.SkillshotLine || input.Type == SkillshotType.SkillshotCone) - { - if (input.From.Distance(input.Unit.ServerPosition, true) < 200 * 200) - { - d = input.Delay * speed; - } - } - - path = path.CutPath(d); - var tT = 0f; - for (var i = 0; i < path.Count - 1; i++) - { - var a = path[i]; - var b = path[i + 1]; - var tB = a.Distance(b) / speed; - var direction = (b - a).Normalized(); - a = a - speed * tT * direction; - var sol = Geometry.VectorMovementCollision(a, b, speed, input.From.To2D(), input.Speed, tT); - var t = (float)sol[0]; - var pos = (Vector2)sol[1]; - - if (pos.IsValid() && t >= tT && t <= tT + tB) - { - if (pos.Distance(b, true) < 20) break; - var p = pos + input.RealRadius * direction; - - if (input.Type == SkillshotType.SkillshotLine && false) - { - var alpha = (input.From.To2D() - p).AngleBetween(a - b); - if (alpha > 30 && alpha < 180 - 30) - { - var beta = (float)Math.Asin(input.RealRadius / p.Distance(input.From)); - var cp1 = input.From.To2D() + (p - input.From.To2D()).Rotated(beta); - var cp2 = input.From.To2D() + (p - input.From.To2D()).Rotated(-beta); - - pos = cp1.Distance(pos, true) < cp2.Distance(pos, true) ? cp1 : cp2; - } - } - - return new PredictionOutput - { - Input = input, CastPosition = pos.To3D(), UnitPosition = p.To3D(), - Hitchance = - PathTracker.GetCurrentPath(input.Unit).Time < 0.1d - ? HitChance.VeryHigh - : HitChance.High - }; - } - tT += tB; - } - } - - var position = path.Last(); - return new PredictionOutput - { - Input = input, CastPosition = position.To3D(), UnitPosition = position.To3D(), - Hitchance = HitChance.Medium - }; - } - - /// - /// Gets the prediction. - /// - /// The input. - /// if set to true, will add extra delay to the spell.. - /// if set to true, checks collision. - /// PredictionOutput. - internal static PredictionOutput GetPrediction(PredictionInput input, bool ft, bool checkCollision) - { - PredictionOutput result = null; - - if (!input.Unit.IsValidTarget(float.MaxValue, false)) - { - return new PredictionOutput(); - } - - if (ft) - { - //Increase the delay due to the latency and server tick: - input.Delay += Game.Ping / 2000f + 0.06f; - - if (input.Aoe) - { - return AoePrediction.GetPrediction(input); - } - } - - //Target too far away. - if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon - && input.Unit.Distance(input.RangeCheckFrom, true) > Math.Pow(input.Range * 1.5, 2)) - { - return new PredictionOutput { Input = input }; - } - - //Unit is dashing. - if (input.Unit.IsDashing()) - { - result = GetDashingPrediction(input); - } - else - { - //Unit is immobile. - var remainingImmobileT = UnitIsImmobileUntil(input.Unit); - if (remainingImmobileT >= 0d) - { - result = GetImmobilePrediction(input, remainingImmobileT); - } - else - { - input.Range = input.Range * CommonMenu.Instance.Item("PredMaxRange").GetValue().Value / 100f; - } - } - - //Normal prediction - if (result == null) - { - result = GetStandardPrediction(input); - } - - //Check if the unit position is in range - if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon) - { - if (result.Hitchance >= HitChance.High - && input.RangeCheckFrom.Distance(input.Unit.Position, true) - > Math.Pow(input.Range + input.RealRadius * 3 / 4, 2)) - { - result.Hitchance = HitChance.Medium; - } - - if (input.RangeCheckFrom.Distance(result.UnitPosition, true) - > Math.Pow(input.Range + (input.Type == SkillshotType.SkillshotCircle ? input.RealRadius : 0), 2)) - { - result.Hitchance = HitChance.OutOfRange; - } - - if (input.RangeCheckFrom.Distance(result.CastPosition, true) > Math.Pow(input.Range, 2)) - { - if (result.Hitchance != HitChance.OutOfRange) - { - result.CastPosition = input.RangeCheckFrom - + input.Range - * (result.UnitPosition - input.RangeCheckFrom).To2D().Normalized().To3D(); - } - else - { - result.Hitchance = HitChance.OutOfRange; - } - } - } - - //Check for collision - if (checkCollision && input.Collision) - { - var positions = new List { result.UnitPosition, result.CastPosition, input.Unit.Position }; - var originalUnit = input.Unit; - result.CollisionObjects = Collision.GetCollision(positions, input); - result.CollisionObjects.RemoveAll(x => x.NetworkId == originalUnit.NetworkId); - result.Hitchance = result.CollisionObjects.Count > 0 ? HitChance.Collision : result.Hitchance; - } - - return result; - } - - /// - /// Gets the standard prediction. - /// - /// The input. - /// PredictionOutput. - internal static PredictionOutput GetStandardPrediction(PredictionInput input) - { - var speed = input.Unit.MoveSpeed; - - if (input.Unit.Distance(input.From, true) < 200 * 200) - { - //input.Delay /= 2; - speed /= 1.5f; - } - - var result = GetPositionOnPath(input, input.Unit.GetWaypoints(), speed); - - if (result.Hitchance >= HitChance.High && input.Unit is Obj_AI_Hero) - { - } - - return result; - } - - /// - /// Gets the time the unit is immobile untill. - /// - /// The unit. - /// System.Double. - internal static double UnitIsImmobileUntil(Obj_AI_Base unit) - { - var result = - unit.Buffs.Where( - buff => - buff.IsActive && Game.Time <= buff.EndTime - && (buff.Type == BuffType.Charm || buff.Type == BuffType.Knockup || buff.Type == BuffType.Stun - || buff.Type == BuffType.Suppression || buff.Type == BuffType.Snare)) - .Aggregate(0d, (current, buff) => Math.Max(current, buff.EndTime)); - return (result - Game.Time); - } - - #endregion - } - - /// - /// Calculates area of effect prediction. - /// - internal static class AoePrediction - { - #region Public Methods and Operators - - /// - /// Gets the prediction. - /// - /// The input. - /// PredictionOutput. - public static PredictionOutput GetPrediction(PredictionInput input) - { - switch (input.Type) - { - case SkillshotType.SkillshotCircle: - return Circle.GetPrediction(input); - case SkillshotType.SkillshotCone: - return Cone.GetPrediction(input); - case SkillshotType.SkillshotLine: - return Line.GetPrediction(input); - } - return new PredictionOutput(); - } - - #endregion - - #region Methods - - /// - /// Gets the possible targets. - /// - /// The input. - /// List<PossibleTarget>. - internal static List GetPossibleTargets(PredictionInput input) - { - var result = new List(); - var originalUnit = input.Unit; - foreach (var enemy in - HeroManager.Enemies.FindAll( - h => - h.NetworkId != originalUnit.NetworkId - && h.IsValidTarget((input.Range + 200 + input.RealRadius), true, input.RangeCheckFrom))) - { - input.Unit = enemy; - var prediction = Prediction.GetPrediction(input, false, false); - if (prediction.Hitchance >= HitChance.High) - { - result.Add(new PossibleTarget { Position = prediction.UnitPosition.To2D(), Unit = enemy }); - } - } - return result; - } - - #endregion - - /// - /// Represents a circular skillshot. - /// - public static class Circle - { - #region Public Methods and Operators - - /// - /// Gets the prediction. - /// - /// The input. - /// PredictionOutput. - public static PredictionOutput GetPrediction(PredictionInput input) - { - var mainTargetPrediction = Prediction.GetPrediction(input, false, true); - var posibleTargets = new List - { - new PossibleTarget - { - Position = mainTargetPrediction.UnitPosition.To2D(), - Unit = input.Unit - } - }; - - if (mainTargetPrediction.Hitchance >= HitChance.Medium) - { - //Add the posible targets in range: - posibleTargets.AddRange(GetPossibleTargets(input)); - } - - while (posibleTargets.Count > 1) - { - var mecCircle = MEC.GetMec(posibleTargets.Select(h => h.Position).ToList()); - - if (mecCircle.Radius <= input.RealRadius - 10 - && Vector2.DistanceSquared(mecCircle.Center, input.RangeCheckFrom.To2D()) - < input.Range * input.Range) - { - return new PredictionOutput - { - AoeTargetsHit = posibleTargets.Select(h => (Obj_AI_Hero)h.Unit).ToList(), - CastPosition = mecCircle.Center.To3D(), - UnitPosition = mainTargetPrediction.UnitPosition, - Hitchance = mainTargetPrediction.Hitchance, Input = input, - _aoeTargetsHitCount = posibleTargets.Count - }; - } - - float maxdist = -1; - var maxdistindex = 1; - for (var i = 1; i < posibleTargets.Count; i++) - { - var distance = Vector2.DistanceSquared(posibleTargets[i].Position, posibleTargets[0].Position); - if (distance > maxdist || maxdist.CompareTo(-1) == 0) - { - maxdistindex = i; - maxdist = distance; - } - } - posibleTargets.RemoveAt(maxdistindex); - } - - return mainTargetPrediction; - } - - #endregion - } - - /// - /// Represents a conical skillshot. - /// - public static class Cone - { - #region Public Methods and Operators - - /// - /// Gets the prediction. - /// - /// The input. - /// PredictionOutput. - public static PredictionOutput GetPrediction(PredictionInput input) - { - var mainTargetPrediction = Prediction.GetPrediction(input, false, true); - var posibleTargets = new List - { - new PossibleTarget - { - Position = mainTargetPrediction.UnitPosition.To2D(), - Unit = input.Unit - } - }; - - if (mainTargetPrediction.Hitchance >= HitChance.Medium) - { - //Add the posible targets in range: - posibleTargets.AddRange(GetPossibleTargets(input)); - } - - if (posibleTargets.Count > 1) - { - var candidates = new List(); - - foreach (var target in posibleTargets) - { - target.Position = target.Position - input.From.To2D(); - } - - for (var i = 0; i < posibleTargets.Count; i++) - { - for (var j = 0; j < posibleTargets.Count; j++) - { - if (i != j) - { - var p = (posibleTargets[i].Position + posibleTargets[j].Position) * 0.5f; - if (!candidates.Contains(p)) - { - candidates.Add(p); - } - } - } - } - - var bestCandidateHits = -1; - var bestCandidate = new Vector2(); - var positionsList = posibleTargets.Select(t => t.Position).ToList(); - - foreach (var candidate in candidates) - { - var hits = GetHits(candidate, input.Range, input.Radius, positionsList); - if (hits > bestCandidateHits) - { - bestCandidate = candidate; - bestCandidateHits = hits; - } - } - - if (bestCandidateHits > 1 && input.From.To2D().Distance(bestCandidate, true) > 50 * 50) - { - return new PredictionOutput - { - Hitchance = mainTargetPrediction.Hitchance, _aoeTargetsHitCount = bestCandidateHits, - UnitPosition = mainTargetPrediction.UnitPosition, - CastPosition = bestCandidate.To3D(), Input = input - }; - } - } - return mainTargetPrediction; - } - - #endregion - - #region Methods - - /// - /// Gets the hits. - /// - /// The end. - /// The range. - /// The angle. - /// The points. - /// System.Int32. - internal static int GetHits(Vector2 end, double range, float angle, List points) - { - return (from point in points - let edge1 = end.Rotated(-angle / 2) - let edge2 = edge1.Rotated(angle) - where - point.Distance(new Vector2(), true) < range * range && edge1.CrossProduct(point) > 0 - && point.CrossProduct(edge2) > 0 - select point).Count(); - } - - #endregion - } - - /// - /// Represents a linear skillshot. - /// - public static class Line - { - #region Public Methods and Operators - - /// - /// Gets the prediction. - /// - /// The input. - /// PredictionOutput. - public static PredictionOutput GetPrediction(PredictionInput input) - { - var mainTargetPrediction = Prediction.GetPrediction(input, false, true); - var posibleTargets = new List - { - new PossibleTarget - { - Position = mainTargetPrediction.UnitPosition.To2D(), - Unit = input.Unit - } - }; - if (mainTargetPrediction.Hitchance >= HitChance.Medium) - { - //Add the posible targets in range: - posibleTargets.AddRange(GetPossibleTargets(input)); - } - - if (posibleTargets.Count > 1) - { - var candidates = new List(); - foreach (var target in posibleTargets) - { - var targetCandidates = GetCandidates( - input.From.To2D(), - target.Position, - (input.Radius), - input.Range); - candidates.AddRange(targetCandidates); - } - - var bestCandidateHits = -1; - var bestCandidate = new Vector2(); - var bestCandidateHitPoints = new List(); - var positionsList = posibleTargets.Select(t => t.Position).ToList(); - - foreach (var candidate in candidates) - { - if ( - GetHits( - input.From.To2D(), - candidate, - (input.Radius + input.Unit.BoundingRadius / 3 - 10), - new List { posibleTargets[0].Position }).Count() == 1) - { - var hits = GetHits(input.From.To2D(), candidate, input.Radius, positionsList).ToList(); - var hitsCount = hits.Count; - if (hitsCount >= bestCandidateHits) - { - bestCandidateHits = hitsCount; - bestCandidate = candidate; - bestCandidateHitPoints = hits.ToList(); - } - } - } - - if (bestCandidateHits > 1) - { - float maxDistance = -1; - Vector2 p1 = new Vector2(), p2 = new Vector2(); - - //Center the position - for (var i = 0; i < bestCandidateHitPoints.Count; i++) - { - for (var j = 0; j < bestCandidateHitPoints.Count; j++) - { - var startP = input.From.To2D(); - var endP = bestCandidate; - var proj1 = positionsList[i].ProjectOn(startP, endP); - var proj2 = positionsList[j].ProjectOn(startP, endP); - var dist = Vector2.DistanceSquared(bestCandidateHitPoints[i], proj1.LinePoint) - + Vector2.DistanceSquared(bestCandidateHitPoints[j], proj2.LinePoint); - if (dist >= maxDistance - && (proj1.LinePoint - positionsList[i]).AngleBetween( - proj2.LinePoint - positionsList[j]) > 90) - { - maxDistance = dist; - p1 = positionsList[i]; - p2 = positionsList[j]; - } - } - } - - return new PredictionOutput - { - Hitchance = mainTargetPrediction.Hitchance, _aoeTargetsHitCount = bestCandidateHits, - UnitPosition = mainTargetPrediction.UnitPosition, - CastPosition = ((p1 + p2) * 0.5f).To3D(), Input = input - }; - } - } - - return mainTargetPrediction; - } - - #endregion - - #region Methods - - /// - /// Gets the candidates. - /// - /// From. - /// To. - /// The radius. - /// The range. - /// Vector2[]. - internal static Vector2[] GetCandidates(Vector2 from, Vector2 to, float radius, float range) - { - var middlePoint = (from + to) / 2; - var intersections = Geometry.CircleCircleIntersection( - from, - middlePoint, - radius, - from.Distance(middlePoint)); - - if (intersections.Length > 1) - { - var c1 = intersections[0]; - var c2 = intersections[1]; - - c1 = from + range * (to - c1).Normalized(); - c2 = from + range * (to - c2).Normalized(); - - return new[] { c1, c2 }; - } - - return new Vector2[] { }; - } - - /// - /// Gets the hits. - /// - /// The start. - /// The end. - /// The radius. - /// The points. - /// IEnumerable<Vector2>. - internal static IEnumerable GetHits( - Vector2 start, - Vector2 end, - double radius, - List points) - { - return points.Where(p => p.Distance(start, end, true, true) <= radius * radius); - } - - #endregion - } - - /// - /// Represents a possible target. - /// - internal class PossibleTarget - { - #region Fields - - /// - /// The position - /// - public Vector2 Position; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - #endregion - } - } - - /// - /// Class that helps in calculating collision. - /// - public static class Collision - { - #region Static Fields - - /// - /// The tick yasuo casted wind wall. - /// - private static int _wallCastT; - - /// - /// The yasuo wind wall casted position. - /// - private static Vector2 _yasuoWallCastedPos; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static Collision() - { - Obj_AI_Base.OnProcessSpellCast += Obj_AI_Hero_OnProcessSpellCast; - } - - #endregion - - #region Public Methods and Operators - - /// - /// Returns the list of the units that the skillshot will hit before reaching the set positions. - /// - /// The positions. - /// The input. - /// List<Obj_AI_Base>. - public static List GetCollision(List positions, PredictionInput input) - { - var result = new List(); - - foreach (var position in positions) - { - foreach (var objectType in input.CollisionObjects) - { - switch (objectType) - { - case CollisionableObjects.Minions: - foreach (var minion in - ObjectManager.Get() - .Where( - minion => - minion.IsValidTarget( - Math.Min(input.Range + input.Radius + 100, 2000), - true, - input.RangeCheckFrom))) - { - input.Unit = minion; - var minionPrediction = Prediction.GetPrediction(input, false, false); - if (minionPrediction.UnitPosition.To2D() - .Distance(input.From.To2D(), position.To2D(), true, true) - <= Math.Pow((input.Radius + 15 + minion.BoundingRadius), 2)) - { - result.Add(minion); - } - } - break; - case CollisionableObjects.Heroes: - foreach (var hero in - HeroManager.Enemies.FindAll( - hero => - hero.IsValidTarget( - Math.Min(input.Range + input.Radius + 100, 2000), - true, - input.RangeCheckFrom))) - { - input.Unit = hero; - var prediction = Prediction.GetPrediction(input, false, false); - if (prediction.UnitPosition.To2D() - .Distance(input.From.To2D(), position.To2D(), true, true) - <= Math.Pow((input.Radius + 50 + hero.BoundingRadius), 2)) - { - result.Add(hero); - } - } - break; - - case CollisionableObjects.Allies: - foreach (var hero in - HeroManager.Allies.FindAll( - hero => - Vector3.Distance(ObjectManager.Player.ServerPosition, hero.ServerPosition) - <= Math.Min(input.Range + input.Radius + 100, 2000))) - { - input.Unit = hero; - var prediction = Prediction.GetPrediction(input, false, false); - if (prediction.UnitPosition.To2D() - .Distance(input.From.To2D(), position.To2D(), true, true) - <= Math.Pow((input.Radius + 50 + hero.BoundingRadius), 2)) - { - result.Add(hero); - } - } - break; - - case CollisionableObjects.Walls: - var step = position.Distance(input.From) / 20; - for (var i = 0; i < 20; i++) - { - var p = input.From.To2D().Extend(position.To2D(), step * i); - if (NavMesh.GetCollisionFlags(p.X, p.Y).HasFlag(CollisionFlags.Wall)) - { - result.Add(ObjectManager.Player); - } - } - break; - - case CollisionableObjects.YasuoWall: - - if (Utils.TickCount - _wallCastT > 4000) - { - break; - } - - GameObject wall = null; - foreach (var gameObject in - ObjectManager.Get() - .Where( - gameObject => - gameObject.IsValid - && Regex.IsMatch( - gameObject.Name, - "_w_windwall_enemy_0.\\.troy", - RegexOptions.IgnoreCase))) - { - wall = gameObject; - } - if (wall == null) - { - break; - } - var level = wall.Name.Substring(wall.Name.Length - 6, 1); - var wallWidth = (300 + 50 * Convert.ToInt32(level)); - - var wallDirection = - (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular(); - var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection; - var wallEnd = wallStart - wallWidth * wallDirection; - - if (wallStart.Intersection(wallEnd, position.To2D(), input.From.To2D()).Intersects) - { - var t = Utils.TickCount - + (wallStart.Intersection(wallEnd, position.To2D(), input.From.To2D()) - .Point.Distance(input.From) / input.Speed + input.Delay) * 1000; - if (t < _wallCastT + 4000) - { - result.Add(ObjectManager.Player); - } - } - - break; - } - } - } - - return result.Distinct().ToList(); - } - - #endregion - - #region Methods - - /// - /// Fired when the game processes a spell cast. - /// - /// The sender. - /// The instance containing the event data. - private static void Obj_AI_Hero_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) - { - if (sender.IsValid && sender.Team != ObjectManager.Player.Team && args.SData.Name == "YasuoWMovingWall") - { - _wallCastT = Utils.TickCount; - _yasuoWallCastedPos = sender.ServerPosition.To2D(); - } - } - - #endregion - } - - /// - /// Represents the path of a unit. - /// - internal class StoredPath - { - #region Fields - - /// - /// The path - /// - public List Path; - - /// - /// The tick - /// - public int Tick; - - #endregion - - #region Public Properties - - /// - /// Gets the end point. - /// - /// The end point. - public Vector2 EndPoint - { - get - { - return this.Path.LastOrDefault(); - } - } - - /// - /// Gets the start point. - /// - /// The start point. - public Vector2 StartPoint - { - get - { - return this.Path.FirstOrDefault(); - } - } - - /// - /// Gets the time. - /// - /// The time. - public double Time - { - get - { - return (Utils.TickCount - this.Tick) / 1000d; - } - } - - /// - /// Gets the waypoint count. - /// - /// The waypoint count. - public int WaypointCount - { - get - { - return this.Path.Count; - } - } - - #endregion - } - - /// - /// Tracks the path of units. - /// - internal static class PathTracker - { - #region Constants - - /// - /// The maximum time - /// - private const double MaxTime = 1.5d; - - #endregion - - #region Static Fields - - /// - /// The stored paths - /// - private static readonly Dictionary> StoredPaths = new Dictionary>(); - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static PathTracker() - { - Obj_AI_Base.OnNewPath += Obj_AI_Hero_OnNewPath; - } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the current path. - /// - /// The unit. - /// StoredPath. - public static StoredPath GetCurrentPath(Obj_AI_Base unit) - { - return StoredPaths.ContainsKey(unit.NetworkId) - ? StoredPaths[unit.NetworkId].LastOrDefault() - : new StoredPath(); - } - - /// - /// Gets the mean speed. - /// - /// The unit. - /// The maximum t. - /// System.Double. - public static double GetMeanSpeed(Obj_AI_Base unit, double maxT) - { - var paths = GetStoredPaths(unit, MaxTime); - var distance = 0d; - if (paths.Count > 0) - { - //Assume that the unit was moving for the first path: - distance += (maxT - paths[0].Time) * unit.MoveSpeed; - - for (var i = 0; i < paths.Count - 1; i++) - { - var currentPath = paths[i]; - var nextPath = paths[i + 1]; - - if (currentPath.WaypointCount > 0) - { - distance += Math.Min( - (currentPath.Time - nextPath.Time) * unit.MoveSpeed, - currentPath.Path.PathLength()); - } - } - - //Take into account the last path: - var lastPath = paths.Last(); - if (lastPath.WaypointCount > 0) - { - distance += Math.Min(lastPath.Time * unit.MoveSpeed, lastPath.Path.PathLength()); - } - } - else - { - return unit.MoveSpeed; - } - - return distance / maxT; - } - - /// - /// Gets the stored paths. - /// - /// The unit. - /// The maximum t. - /// List<StoredPath>. - public static List GetStoredPaths(Obj_AI_Base unit, double maxT) - { - return StoredPaths.ContainsKey(unit.NetworkId) - ? StoredPaths[unit.NetworkId].Where(p => p.Time < maxT).ToList() - : new List(); - } - - /// - /// Gets the tendency. - /// - /// The unit. - /// Vector3. - public static Vector3 GetTendency(Obj_AI_Base unit) - { - var paths = GetStoredPaths(unit, MaxTime); - var result = new Vector2(); - - foreach (var path in paths) - { - var k = 1; //(MaxTime - path.Time); - result = result + k * (path.EndPoint - unit.ServerPosition.To2D() /*path.StartPoint*/).Normalized(); - } - - result /= paths.Count; - - return result.To3D(); - } - - #endregion - - #region Methods - - /// - /// Fired when a unit changes it's path. - /// - /// The sender. - /// The instance containing the event data. - private static void Obj_AI_Hero_OnNewPath(Obj_AI_Base sender, GameObjectNewPathEventArgs args) - { - if (!(sender is Obj_AI_Hero)) - { - return; - } - - if (!StoredPaths.ContainsKey(sender.NetworkId)) - { - StoredPaths.Add(sender.NetworkId, new List()); - } - - var newPath = new StoredPath { Tick = Utils.TickCount, Path = args.Path.ToList().To2D() }; - StoredPaths[sender.NetworkId].Add(newPath); - - if (StoredPaths[sender.NetworkId].Count > 50) - { - StoredPaths[sender.NetworkId].RemoveRange(0, 40); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index 58c6bfe4..00000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -#region LICENSE - -// Copyright 2014 - 2014 LeagueSharp -// AssemblyInfo.cs is part of LeagueSharp.Common. -// -// LeagueSharp.Common is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// LeagueSharp.Common is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with LeagueSharp.Common. If not, see . - -#endregion - -#region - -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; - -#endregion - -// Allgemeine Informationen über eine Assembly werden über die folgenden -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die mit einer Assembly verknüpft sind. - -[assembly: AssemblyTitle("LeagueSharp.Common")] -[assembly: AssemblyDescription("LeagueSharp.Common")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("LeagueSharp")] -[assembly: AssemblyProduct("LeagueSharp.Common")] -[assembly: AssemblyCopyright("Copyright © LeagueSharp 2015")] -[assembly: AssemblyTrademark("LeagueSharp")] -[assembly: AssemblyCulture("")] - -// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar -// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von -// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. - -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird - -[assembly: Guid("e6f3b6a3-5cd7-442a-98e3-bde65c1dcd25")] - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern -// übernehmen, indem Sie "*" eingeben: -// [assembly: AssemblyVersion("1.0.*")] - -[assembly: AssemblyVersion("1.0.0.52")] -[assembly: AssemblyFileVersion("1.0.0.52")] -[assembly: NeutralResourcesLanguage("en")] \ No newline at end of file diff --git a/Render.cs b/Render.cs deleted file mode 100644 index 73e241e5..00000000 --- a/Render.cs +++ /dev/null @@ -1,2371 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Drawing; - using System.Drawing.Imaging; - using System.IO; - using System.Linq; - using System.Threading; - - using SharpDX; - using SharpDX.Direct3D9; - - using Color = System.Drawing.Color; - using Font = SharpDX.Direct3D9.Font; - using Rectangle = SharpDX.Rectangle; - - /// - /// The render class allows you to draw stuff using SharpDX easier. - /// - public static class Render - { - #region Static Fields - - /// - /// The render objects - /// - private static readonly List RenderObjects = new List(); - - /// - /// The render objects lock - /// - private static readonly object RenderObjectsLock = new object(); - - /// - /// true if the thread should be canceled. - /// - private static bool _cancelThread; - - /// - /// The visible render objects. - /// - private static List _renderVisibleObjects = new List(); - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static Render() - { - Drawing.OnEndScene += Drawing_OnEndScene; - Drawing.OnDraw += Drawing_OnDraw; - var thread = new Thread(PrepareObjects); - thread.SetApartmentState(ApartmentState.STA); - thread.Start(); - } - - #endregion - - #region Public Properties - - /// - /// Gets the device. - /// - /// The device. - public static Device Device - { - get - { - return Drawing.Direct3DDevice; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Adds the specified layer. - /// - /// The render object. - /// The layer. - /// RenderObject. - public static RenderObject Add(this RenderObject renderObject, float layer = float.MaxValue) - { - renderObject.Layer = !layer.Equals(float.MaxValue) ? layer : renderObject.Layer; - lock (RenderObjectsLock) - { - RenderObjects.Add(renderObject); - } - return renderObject; - } - - /// - /// Determines if the point is on the screen. - /// - /// The point. - /// true if the point is on the screen, false otherwise. - public static bool OnScreen(Vector2 point) - { - return point.X > 0 && point.Y > 0 && point.X < Drawing.Width && point.Y < Drawing.Height; - } - - /// - /// Removes the specified render object. - /// - /// The render object. - public static void Remove(this RenderObject renderObject) - { - lock (RenderObjectsLock) - { - RenderObjects.Remove(renderObject); - } - } - - #endregion - - #region Methods - - /// - /// Fired when the game is drawn. - /// - /// The instance containing the event data. - private static void Drawing_OnDraw(EventArgs args) - { - if (Device == null || Device.IsDisposed) - { - return; - } - - foreach (var renderObject in _renderVisibleObjects) - { - renderObject.OnDraw(); - } - } - - /// - /// Fired when the scene ends, and everything has been rendered. - /// - /// The instance containing the event data. - private static void Drawing_OnEndScene(EventArgs args) - { - if (Device == null || Device.IsDisposed) - { - return; - } - - Device.SetRenderState(RenderState.AlphaBlendEnable, true); - - foreach (var renderObject in _renderVisibleObjects) - { - renderObject.OnEndScene(); - } - } - - /// - /// Prepares the objects. - /// - private static void PrepareObjects() - { - while (!_cancelThread) - { - try - { - Thread.Sleep(1); - lock (RenderObjectsLock) - { - _renderVisibleObjects = - RenderObjects.Where(obj => obj.Visible && obj.HasValidLayer()) - .OrderBy(obj => obj.Layer) - .ToList(); - } - } - catch (ThreadAbortException) - { - // ignored - } - catch (Exception e) - { - Console.WriteLine(@"Cannot prepare RenderObjects for drawing. Ex:" + e); - } - } - } - - #endregion - - /// - /// Draws circles. - /// - public class Circle : RenderObject - { - #region Static Fields - - /// - /// The sprite effect - /// - private static Effect _effect; - - /// - /// true if this instanced initialized. - /// - private static bool _initialized; - - /// - /// The offset - /// - private static Vector3 _offset = new Vector3(0, 0, 0); - - /// - /// The technique - /// - private static EffectHandle _technique; - - /// - /// The vertex declaration - /// - private static VertexDeclaration _vertexDeclaration; - - /// - /// The vertex elements - /// - private static VertexElement[] _vertexElements; - - /// - /// The vertices - /// - private static VertexBuffer _vertices; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The unit. - /// The radius. - /// The color. - /// The width. - /// if set to true [z deep]. - public Circle(GameObject unit, float radius, Color color, int width = 1, bool zDeep = false) - { - this.Color = color; - this.Unit = unit; - this.Radius = radius; - this.Width = width; - this.ZDeep = zDeep; - this.SubscribeToResetEvents(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The unit. - /// The offset. - /// The radius. - /// The color. - /// The width. - /// if set to true [z deep]. - public Circle(GameObject unit, Vector3 offset, float radius, Color color, int width = 1, bool zDeep = false) - { - this.Color = color; - this.Unit = unit; - this.Radius = radius; - this.Width = width; - this.ZDeep = zDeep; - this.Offset = offset; - this.SubscribeToResetEvents(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The position. - /// The offset. - /// The radius. - /// The color. - /// The width. - /// if set to true [z deep]. - public Circle( - Vector3 position, - Vector3 offset, - float radius, - Color color, - int width = 1, - bool zDeep = false) - { - this.Color = color; - this.Position = position; - this.Radius = radius; - this.Width = width; - this.ZDeep = zDeep; - this.Offset = offset; - this.SubscribeToResetEvents(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The position. - /// The radius. - /// The color. - /// The width. - /// if set to true [z deep]. - public Circle(Vector3 position, float radius, Color color, int width = 1, bool zDeep = false) - { - this.Color = color; - this.Position = position; - this.Radius = radius; - this.Width = width; - this.ZDeep = zDeep; - this.SubscribeToResetEvents(); - } - - #endregion - - #region Public Properties - - /// - /// Gets or sets the color. - /// - /// The color. - public Color Color { get; set; } - - /// - /// Gets or sets the offset. - /// - /// The offset. - public Vector3 Offset - { - get - { - return _offset; - } - set - { - _offset = value; - } - } - - /// - /// Gets or sets the position. - /// - /// The position. - public Vector3 Position { get; set; } - - /// - /// Gets or sets the radius. - /// - /// The radius. - public float Radius { get; set; } - - /// - /// Gets or sets the unit. - /// - /// The unit. - public GameObject Unit { get; set; } - - /// - /// Gets or sets the width. - /// - /// The width. - public int Width { get; set; } - - /// - /// Gets or sets a value indicating whether to enable depth buffering. - /// - /// true if depth buffering enabled; otherwise, false. - public bool ZDeep { get; set; } - - #endregion - - #region Public Methods and Operators - - /// - /// Creates the vertexes. - /// - public static void CreateVertexes() - { - const float x = 6000f; - _vertices = new VertexBuffer( - Device, - Utilities.SizeOf() * 2 * 6, - Usage.WriteOnly, - VertexFormat.None, - Pool.Managed); - - _vertices.Lock(0, 0, LockFlags.None).WriteRange( - new[] - { - //T1 - new Vector4(-x, 0f, -x, 1.0f), new Vector4(), new Vector4(-x, 0f, x, 1.0f), new Vector4(), - new Vector4(x, 0f, -x, 1.0f), new Vector4(), - - //T2 - new Vector4(-x, 0f, x, 1.0f), new Vector4(), new Vector4(x, 0f, x, 1.0f), new Vector4(), - new Vector4(x, 0f, -x, 1.0f), new Vector4() - }); - _vertices.Unlock(); - - _vertexElements = new[] - { - new VertexElement( - 0, - 0, - DeclarationType.Float4, - DeclarationMethod.Default, - DeclarationUsage.Position, - 0), - new VertexElement( - 0, - 16, - DeclarationType.Float4, - DeclarationMethod.Default, - DeclarationUsage.Color, - 0), - VertexElement.VertexDeclarationEnd - }; - - _vertexDeclaration = new VertexDeclaration(Device, _vertexElements); - - #region Effect - - try - { - /* - _effect = Effect.FromString(Device, @" - struct VS_S - { - float4 Position : POSITION; - float4 Color : COLOR0; - float4 Position3D : TEXCOORD0; - }; - - float4x4 ProjectionMatrix; - float4 CircleColor; - float Radius; - float Border; - bool zEnabled; - VS_S VS( VS_S input ) - { - VS_S output = (VS_S)0; - - output.Position = mul(input.Position, ProjectionMatrix); - output.Color = input.Color; - output.Position3D = input.Position; - return output; - } - - float4 PS( VS_S input ) : COLOR - { - VS_S output = (VS_S)0; - output = input; - - float4 v = output.Position3D; - float distance = Radius - sqrt(v.x * v.x + v.z*v.z); // Distance to the circle arc. - - output.Color.x = CircleColor.x; - output.Color.y = CircleColor.y; - output.Color.z = CircleColor.z; - - if(distance < Border && distance > -Border) - { - output.Color.w = (CircleColor.w - CircleColor.w * abs(distance * 1.75 / Border)); - } - else - { - output.Color.w = 0; - } - - if(Border < 1 && distance >= 0) - { - output.Color.w = CircleColor.w; - } - - return output.Color; - } - - technique Main { - pass P0 { - ZEnable = zEnabled; - AlphaBlendEnable = TRUE; - DestBlend = INVSRCALPHA; - SrcBlend = SRCALPHA; - VertexShader = compile vs_2_0 VS(); - PixelShader = compile ps_2_0 PS(); - } - }", ShaderFlags.None); - */ - var compiledEffect = new byte[] - { - 0x01, 0x09, 0xFF, 0xFE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x50, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x61, - 0x74, 0x72, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, - 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x52, 0x61, 0x64, 0x69, - 0x75, 0x73, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x7A, 0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x0F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x50, 0x30, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x4D, 0x61, 0x69, 0x6E, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, - 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0C, 0x01, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0xEC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x01, 0x00, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x5C, 0x01, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, - 0x7C, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xA0, 0x01, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, - 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x01, 0x00, 0x00, - 0xD4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x04, 0x00, 0x00, - 0x00, 0x02, 0xFF, 0xFF, 0xFE, 0xFF, 0x38, 0x00, 0x43, 0x54, 0x41, 0x42, - 0x1C, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xFF, - 0x03, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0xA3, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x8C, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x00, 0xAB, - 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x69, 0x72, 0x63, - 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, 0x01, 0x00, 0x03, 0x00, - 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0x70, 0x73, 0x5F, 0x32, 0x5F, - 0x30, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, - 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, - 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, 0x31, - 0x31, 0x31, 0x00, 0xAB, 0xFE, 0xFF, 0x7C, 0x00, 0x50, 0x52, 0x45, 0x53, - 0x01, 0x02, 0x58, 0x46, 0xFE, 0xFF, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, - 0x1C, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x01, 0x02, 0x58, 0x46, - 0x02, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, - 0x88, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, - 0x6C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x78, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x72, 0x64, - 0x65, 0x72, 0x00, 0xAB, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x43, 0x69, 0x72, 0x63, 0x6C, 0x65, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x00, - 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x74, 0x78, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, - 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, - 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, - 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, - 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0xFE, 0xFF, 0x0C, 0x00, - 0x50, 0x52, 0x53, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xFE, 0xFF, 0x1A, 0x00, 0x43, 0x4C, 0x49, 0x54, 0x0C, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xBF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xFE, 0xFF, 0x1F, 0x00, 0x46, 0x58, 0x4C, 0x43, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x30, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0xA0, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0x00, 0x00, - 0x51, 0x00, 0x00, 0x05, 0x06, 0x00, 0x0F, 0xA0, 0x00, 0x00, 0xE0, 0x3F, - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xBF, 0x00, 0x00, 0x00, 0x00, - 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xB0, - 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xAA, 0xB0, - 0x00, 0x00, 0xAA, 0xB0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, - 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0xFF, 0x80, - 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, - 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, - 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x81, - 0x04, 0x00, 0x00, 0xA0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, - 0x00, 0x00, 0x00, 0x81, 0x05, 0x00, 0x00, 0xA1, 0x58, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x55, 0xA0, - 0x06, 0x00, 0xAA, 0xA0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, - 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0xA1, 0x58, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xAA, 0x80, 0x06, 0x00, 0x55, 0xA0, - 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, - 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xA0, 0x58, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0xAA, 0xA0, - 0x06, 0x00, 0x55, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, - 0x06, 0x00, 0x55, 0xA0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, - 0x01, 0x00, 0x00, 0xA0, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0xAA, 0x80, - 0x00, 0x00, 0x00, 0xA0, 0x23, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, - 0x00, 0x00, 0xAA, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x80, - 0x03, 0x00, 0xFF, 0xA0, 0x00, 0x00, 0xAA, 0x81, 0x03, 0x00, 0xFF, 0xA0, - 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, - 0x06, 0x00, 0xFF, 0xA0, 0x00, 0x00, 0xAA, 0x80, 0x58, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, - 0x03, 0x00, 0xFF, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, - 0x02, 0x00, 0xE4, 0xA0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0F, 0x80, - 0x00, 0x00, 0xE4, 0x80, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x4C, 0x01, 0x00, 0x00, 0x00, 0x02, 0xFE, 0xFF, - 0xFE, 0xFF, 0x34, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, - 0x9B, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x00, - 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x94, 0x00, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x44, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6F, 0x6A, - 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x61, 0x74, 0x72, 0x69, 0x78, - 0x00, 0xAB, 0xAB, 0xAB, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x76, 0x73, 0x5F, 0x32, 0x5F, 0x30, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, - 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, - 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, - 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, - 0x35, 0x32, 0x2E, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1F, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0F, 0x90, 0x1F, 0x00, 0x00, 0x02, - 0x0A, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0F, 0x90, 0x09, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x00, 0x00, 0xE4, 0xA0, - 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0xC0, 0x00, 0x00, 0xE4, 0x90, - 0x01, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0xC0, - 0x00, 0x00, 0xE4, 0x90, 0x02, 0x00, 0xE4, 0xA0, 0x09, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x08, 0xC0, 0x00, 0x00, 0xE4, 0x90, 0x03, 0x00, 0xE4, 0xA0, - 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0xD0, 0x01, 0x00, 0xE4, 0x90, - 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x00, 0xE4, 0x90, - 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xE0, 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0x46, 0xFE, 0xFF, 0x25, 0x00, - 0x43, 0x54, 0x41, 0x42, 0x1C, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x58, 0x46, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x20, 0x5C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, - 0x4C, 0x00, 0x00, 0x00, 0x7A, 0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x64, - 0x00, 0xAB, 0xAB, 0xAB, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x74, 0x78, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, - 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, - 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, - 0x72, 0x20, 0x39, 0x2E, 0x32, 0x39, 0x2E, 0x39, 0x35, 0x32, 0x2E, 0x33, - 0x31, 0x31, 0x31, 0x00, 0xFE, 0xFF, 0x02, 0x00, 0x43, 0x4C, 0x49, 0x54, - 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x0C, 0x00, 0x46, 0x58, 0x4C, 0x43, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0x00, 0x00 - }; - _effect = Effect.FromMemory(Device, compiledEffect, ShaderFlags.None); - } - catch (Exception e) - { - Console.WriteLine(e); - return; - } - - #endregion - - _technique = _effect.GetTechnique(0); - - if (!_initialized) - { - _initialized = true; - Drawing.OnPreReset += OnPreReset; - Drawing.OnPreReset += OnPostReset; - AppDomain.CurrentDomain.DomainUnload += Dispose; - } - } - - /// - /// Draws the circle. - /// - /// The position. - /// The radius. - /// The color. - /// The width. - /// if set to true the circle will be drawn with depth buffering. - public static void DrawCircle( - Vector3 position, - float radius, - Color color, - int width = 5, - bool zDeep = false) - { - try - { - if (Device == null || Device.IsDisposed) - { - return; - } - - if (_vertices == null) - { - CreateVertexes(); - } - - if (_vertices == null || _vertices.IsDisposed || _vertexDeclaration.IsDisposed || _effect.IsDisposed - || _technique.IsDisposed) - { - return; - } - - var olddec = Device.VertexDeclaration; - - _effect.Technique = _technique; - - _effect.Begin(); - _effect.BeginPass(0); - _effect.SetValue( - "ProjectionMatrix", - Matrix.Translation(position.SwitchYZ()) * Drawing.View * Drawing.Projection); - _effect.SetValue( - "CircleColor", - new Vector4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f)); - _effect.SetValue("Radius", radius); - _effect.SetValue("Border", 2f + width); - _effect.SetValue("zEnabled", zDeep); - - Device.SetStreamSource(0, _vertices, 0, Utilities.SizeOf() * 2); - Device.VertexDeclaration = _vertexDeclaration; - - Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); - - _effect.EndPass(); - _effect.End(); - - Device.VertexDeclaration = olddec; - } - catch (Exception e) - { - _vertices = null; - Console.WriteLine(@"DrawCircle: " + e); - } - } - - /// - /// Called when the circle is drawn. - /// - public override void OnDraw() - { - try - { - if (this.Unit != null && this.Unit.IsValid) - { - DrawCircle(this.Unit.Position + _offset, this.Radius, this.Color, this.Width, this.ZDeep); - } - else if ((this.Position + _offset).To2D().IsValid()) - { - DrawCircle(this.Position + _offset, this.Radius, this.Color, this.Width, this.ZDeep); - } - } - catch (Exception e) - { - Console.WriteLine(@"Common.Render.Circle.OnEndScene: " + e); - } - } - - #endregion - - #region Methods - - /// - /// Disposes the circle. - /// - /// The sender. - /// The instance containing the event data. - private static void Dispose(object sender, EventArgs e) - { - OnPreReset(EventArgs.Empty); - - if (_effect != null && !_effect.IsDisposed) - { - _effect.Dispose(); - } - - if (_vertices != null && !_vertices.IsDisposed) - { - _vertices.Dispose(); - } - - if (_vertexDeclaration != null && !_vertexDeclaration.IsDisposed) - { - _vertexDeclaration.Dispose(); - } - } - - /// - /// Handles the event. - /// - /// The instance containing the event data. - private static void OnPostReset(EventArgs args) - { - if (_effect != null && !_effect.IsDisposed) - { - _effect.OnResetDevice(); - } - } - - /// - /// Handles the event. - /// - /// The instance containing the event data. - private static void OnPreReset(EventArgs args) - { - if (_effect != null && !_effect.IsDisposed) - { - _effect.OnLostDevice(); - } - } - - #endregion - } - - /// - /// Draws lines. - /// - public class Line : RenderObject - { - #region Fields - - /// - /// The color - /// - public ColorBGRA Color; - - /// - /// The DirectX line - /// - private readonly SharpDX.Direct3D9.Line _line; - - /// - /// The width - /// - private int _width; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The start. - /// The end. - /// The width. - /// The color. - public Line(Vector2 start, Vector2 end, int width, ColorBGRA color) - { - this._line = new SharpDX.Direct3D9.Line(Device); - this.Width = width; - this.Color = color; - this.Start = start; - this.End = end; - Game.OnUpdate += this.GameOnOnUpdate; - this.SubscribeToResetEvents(); - } - - #endregion - - #region Delegates - - /// - /// Delegate to get the position of the line. - /// - /// Vector2. - public delegate Vector2 PositionDelegate(); - - #endregion - - #region Public Properties - - /// - /// Gets or sets the end. - /// - /// The end. - public Vector2 End { get; set; } - - /// - /// Gets or sets the delegate that gets the end position. - /// - /// The end position update. - public PositionDelegate EndPositionUpdate { get; set; } - - /// - /// Gets or sets the start. - /// - /// The start. - public Vector2 Start { get; set; } - - /// - /// Gets or sets the delegate that sets the start position. - /// - /// The start position update. - public PositionDelegate StartPositionUpdate { get; set; } - - /// - /// Gets or sets the width. - /// - /// The width. - public int Width - { - get - { - return this._width; - } - set - { - this._line.Width = value; - this._width = value; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public override void Dispose() - { - this.OnPreReset(); - if (!this._line.IsDisposed) - { - this._line.Dispose(); - } - Game.OnUpdate -= this.GameOnOnUpdate; - } - - /// - /// Called when the scene has ended. - /// - public override void OnEndScene() - { - try - { - if (this._line.IsDisposed) - { - return; - } - - this._line.Begin(); - this._line.Draw(new[] { this.Start, this.End }, this.Color); - this._line.End(); - } - catch (Exception e) - { - Console.WriteLine(@"Common.Render.Line.OnEndScene: " + e); - } - } - - /// - /// Called after the DirectX is reset. - /// - public override void OnPostReset() - { - this._line.OnResetDevice(); - } - - /// - /// Called before the DirectX device is reset. - /// - public override void OnPreReset() - { - this._line.OnLostDevice(); - } - - #endregion - - #region Methods - - /// - /// Games the on on update. - /// - /// The instance containing the event data. - private void GameOnOnUpdate(EventArgs args) - { - if (this.StartPositionUpdate != null) - { - this.Start = this.StartPositionUpdate(); - } - - if (this.EndPositionUpdate != null) - { - this.End = this.EndPositionUpdate(); - } - } - - #endregion - } - - /// - /// Draws a Rectangle. - /// - public class Rectangle : RenderObject - { - #region Fields - - /// - /// The color of the rectangle - /// - public ColorBGRA Color; - - /// - /// The DirectX line - /// - private readonly SharpDX.Direct3D9.Line _line; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The x. - /// The y. - /// The width. - /// The height. - /// The color. - public Rectangle(int x, int y, int width, int height, ColorBGRA color) - { - this.X = x; - this.Y = y; - this.Width = width; - this.Height = height; - this.Color = color; - this._line = new SharpDX.Direct3D9.Line(Device) { Width = height }; - Game.OnUpdate += this.Game_OnUpdate; - this.SubscribeToResetEvents(); - } - - #endregion - - #region Delegates - - /// - /// Delegate to get the position of the rectangle. - /// - /// Vector2. - public delegate Vector2 PositionDelegate(); - - #endregion - - #region Public Properties - - /// - /// Gets or sets the height. - /// - /// The height. - public int Height { get; set; } - - /// - /// Gets or sets the delegate that gets the position. - /// - /// The position update. - public PositionDelegate PositionUpdate { get; set; } - - /// - /// Gets or sets the width. - /// - /// The width. - public int Width { get; set; } - - /// - /// Gets or sets the x. - /// - /// The x. - public int X { get; set; } - - /// - /// Gets or sets the y. - /// - /// The y. - public int Y { get; set; } - - #endregion - - #region Public Methods and Operators - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public override void Dispose() - { - this.OnPreReset(); - if (!this._line.IsDisposed) - { - this._line.Dispose(); - } - Game.OnUpdate -= this.Game_OnUpdate; - } - - /// - /// Called when [end scene]. - /// - public override void OnEndScene() - { - try - { - if (this._line.IsDisposed) - { - return; - } - - this._line.Begin(); - this._line.Draw( - new[] - { - new Vector2(this.X, this.Y + this.Height / 2), - new Vector2(this.X + this.Width, this.Y + this.Height / 2) - }, - this.Color); - this._line.End(); - } - catch (Exception e) - { - Console.WriteLine(@"Common.Render.Rectangle.OnEndScene: " + e); - } - } - - /// - /// Called after the DirectX device is reset. - /// - public override void OnPostReset() - { - this._line.OnResetDevice(); - } - - /// - /// Called before the DirectX device is reset. - /// - public override void OnPreReset() - { - this._line.OnLostDevice(); - } - - #endregion - - #region Methods - - /// - /// Fired when the game is updated. - /// - /// The instance containing the event data. - private void Game_OnUpdate(EventArgs args) - { - if (this.PositionUpdate != null) - { - var pos = this.PositionUpdate(); - this.X = (int)pos.X; - this.Y = (int)pos.Y; - } - } - - #endregion - } - - /// - /// A base class that renders objects. - /// - public class RenderObject : IDisposable - { - #region Fields - - /// - /// The layer - /// - public float Layer = 0.0f; - - /// - /// The visible condition delegate. - /// - public VisibleConditionDelegate VisibleCondition; - - /// - /// true if the render object is visible - /// - private bool _visible = true; - - #endregion - - #region Constructors and Destructors - - ~RenderObject() - { - this.OnPreReset(); - } - - #endregion - - #region Delegates - - /// - /// Delegate that gets if the object is visible. - /// - /// The sender. - /// true if the object is visible, false otherwise. - public delegate bool VisibleConditionDelegate(RenderObject sender); - - #endregion - - #region Public Properties - - /// - /// Gets or sets a value indicating whether this is visible. - /// - /// true if visible; otherwise, false. - public bool Visible - { - get - { - return this.VisibleCondition != null ? this.VisibleCondition(this) : this._visible; - } - set - { - this._visible = value; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public virtual void Dispose() - { - } - - /// - /// Determines whether this instace has a valid layer. - /// - /// true if has a valid layer; otherwise, false. - public bool HasValidLayer() - { - return this.Layer >= -5 && this.Layer <= 5; - } - - /// - /// Called when the render object is drawn. - /// - public virtual void OnDraw() - { - } - - /// - /// Called when the scene has ended.. - /// - public virtual void OnEndScene() - { - } - - /// - /// Called after the DirectX device is reset. - /// - public virtual void OnPostReset() - { - } - - /// - /// Called before the DirectX device is reset. - /// - public virtual void OnPreReset() - { - } - - #endregion - - #region Methods - - internal void SubscribeToResetEvents() - { - Drawing.OnPreReset += delegate { this.OnPreReset(); }; - Drawing.OnPostReset += delegate { this.OnPostReset(); }; - AppDomain.CurrentDomain.DomainUnload += delegate { this.OnPreReset(); }; - } - - #endregion - } - - /// - /// Draws a sprite image. - /// - public class Sprite : RenderObject - { - #region Fields - - /// - /// The DirectX sprite - /// - private readonly SharpDX.Direct3D9.Sprite _sprite = new SharpDX.Direct3D9.Sprite(Device); - - /// - /// The color of the sprite. - /// - private ColorBGRA _color = SharpDX.Color.White; - - /// - /// The crop of the sprite. - /// - private SharpDX.Rectangle? _crop; - - /// - /// true if the sprite is hidden. - /// - private bool _hide; - - /// - /// The original texture - /// - private Texture _originalTexture; - - /// - /// The scale - /// - private Vector2 _scale = new Vector2(1, 1); - - /// - /// The texture - /// - private Texture _texture; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The bitmap. - /// The position. - public Sprite(Bitmap bitmap, Vector2 position) - : this() - { - this.UpdateTextureBitmap(bitmap, position); - } - - /// - /// Initializes a new instance of the class. - /// - /// The texture. - /// The position. - public Sprite(BaseTexture texture, Vector2 position) - : this() - { - this.UpdateTextureBitmap( - (Bitmap)Image.FromStream(BaseTexture.ToStream(texture, ImageFileFormat.Bmp)), - position); - } - - /// - /// Initializes a new instance of the class. - /// - /// The stream. - /// The position. - public Sprite(Stream stream, Vector2 position) - : this() - { - this.UpdateTextureBitmap(new Bitmap(stream), position); - } - - /// - /// Initializes a new instance of the class. - /// - /// The bytes array. - /// The position. - public Sprite(byte[] bytesArray, Vector2 position) - : this() - { - this.UpdateTextureBitmap((Bitmap)Image.FromStream(new MemoryStream(bytesArray)), position); - } - - /// - /// Initializes a new instance of the class. - /// - /// The file location. - /// The position. - public Sprite(string fileLocation, Vector2 position) - : this() - { - if (!File.Exists((fileLocation))) - { - return; - } - - this.UpdateTextureBitmap(new Bitmap(fileLocation), position); - } - - /// - /// Prevents a default instance of the class from being created. - /// - private Sprite() - { - Game.OnUpdate += this.Game_OnUpdate; - this.SubscribeToResetEvents(); - } - - #endregion - - #region Delegates - - /// - /// Delegate for when the sprite is reset. - /// - /// The sprite. - public delegate void OnResetting(Sprite sprite); - - /// - /// Delegate that gets the position of the sprite. - /// - /// Vector2. - public delegate Vector2 PositionDelegate(); - - #endregion - - #region Public Events - - /// - /// Occurs when the sprite is reset. - /// - public event OnResetting OnReset; - - #endregion - - #region Public Properties - - /// - /// Gets or sets the bitmap. - /// - /// The bitmap. - public Bitmap Bitmap { get; set; } - - /// - /// Gets or sets the color. - /// - /// The color. - public ColorBGRA Color - { - set - { - this._color = value; - } - get - { - return this._color; - } - } - - /// - /// Gets the height. - /// - /// The height. - public int Height - { - get - { - return (int)(this.Bitmap.Height * this._scale.Y); - } - } - - /// - /// Gets or sets the position. - /// - /// The position. - public Vector2 Position - { - set - { - this.X = (int)value.X; - this.Y = (int)value.Y; - } - - get - { - return new Vector2(this.X, this.Y); - } - } - - /// - /// Gets or sets the delegate that gets the position. - /// - /// The position update. - public PositionDelegate PositionUpdate { get; set; } - - /// - /// Gets or sets the rotation. - /// - /// The rotation. - public float Rotation { set; get; } - - /// - /// Gets or sets the scale. - /// - /// The scale. - public Vector2 Scale - { - set - { - this._scale = value; - } - get - { - return this._scale; - } - } - - /// - /// Gets the size. - /// - /// The size. - public Vector2 Size - { - get - { - return new Vector2(this.Bitmap.Width, this.Bitmap.Height); - } - } - - /// - /// Gets the width. - /// - /// The width. - public int Width - { - get - { - return (int)(this.Bitmap.Width * this._scale.X); - } - } - - /// - /// Gets or sets the x. - /// - /// The x. - public int X { get; set; } - - /// - /// Gets or sets the y. - /// - /// The y. - public int Y { get; set; } - - #endregion - - #region Public Methods and Operators - - /// - /// Complements this instance. - /// - public void Complement() - { - this.SetSaturation(-1.0f); - } - - /// - /// Crops the sprite. - /// - /// The x. - /// The y. - /// The width. - /// The height. - /// if set to true, crops with the scale. - public void Crop(int x, int y, int w, int h, bool scale = false) - { - this._crop = new SharpDX.Rectangle(x, y, w, h); - - if (scale) - { - this._crop = new SharpDX.Rectangle( - (int)(this._scale.X * x), - (int)(this._scale.Y * y), - (int)(this._scale.X * w), - (int)(this._scale.Y * h)); - } - } - - /// - /// Crops the sprite. - /// - /// The rectangle. - /// if set to true, crops with the scale. - public void Crop(SharpDX.Rectangle rect, bool scale = false) - { - this._crop = rect; - - if (scale) - { - this._crop = new SharpDX.Rectangle( - (int)(this._scale.X * rect.X), - (int)(this._scale.Y * rect.Y), - (int)(this._scale.X * rect.Width), - (int)(this._scale.Y * rect.Height)); - } - } - - /// - /// Disposes this instance. - /// - public override void Dispose() - { - this.OnPreReset(); - Game.OnUpdate -= this.Game_OnUpdate; - if (!this._sprite.IsDisposed) - { - this._sprite.Dispose(); - } - - if (!this._texture.IsDisposed) - { - this._texture.Dispose(); - } - - if (!this._originalTexture.IsDisposed) - { - this._originalTexture.Dispose(); - } - } - - /// - /// Fades this instance. (Saturation is 1/2) - /// - public void Fade() - { - this.SetSaturation(0.5f); - } - - /// - /// Makes the sprite black and white. - /// - public void GrayScale() - { - this.SetSaturation(0.0f); - } - - /// - /// Hides this instance. - /// - public void Hide() - { - this._hide = true; - } - - /// - /// Called when the scene has ended. - /// - public override void OnEndScene() - { - try - { - if (this._sprite.IsDisposed || this._texture.IsDisposed || !this.Position.IsValid() || this._hide) - { - return; - } - - this._sprite.Begin(); - var matrix = this._sprite.Transform; - var nMatrix = (Matrix.Scaling(this.Scale.X, this.Scale.Y, 0)) * Matrix.RotationZ(this.Rotation) - * Matrix.Translation(this.Position.X, this.Position.Y, 0); - this._sprite.Transform = nMatrix; - this._sprite.Draw(this._texture, this._color, this._crop); - this._sprite.Transform = matrix; - this._sprite.End(); - } - catch (Exception e) - { - this.Reset(); - Console.WriteLine(@"Common.Render.Sprite.OnEndScene: " + e); - } - } - - /// - /// Called after the DirectX device is reset. - /// - public override void OnPostReset() - { - this._sprite.OnResetDevice(); - } - - /// - /// Called before the DirectX device is reset.. - /// - public override void OnPreReset() - { - this._sprite.OnLostDevice(); - } - - /// - /// Resets this instance. - /// - public void Reset() - { - this.UpdateTextureBitmap( - (Bitmap)Image.FromStream(BaseTexture.ToStream(this._originalTexture, ImageFileFormat.Bmp))); - - if (this.OnReset != null) - { - this.OnReset(this); - } - } - - /// - /// Sets the saturation. - /// - /// The saturiation. - public void SetSaturation(float saturiation) - { - this.UpdateTextureBitmap(SaturateBitmap(this.Bitmap, saturiation)); - } - - /// - /// Shows this instance. - /// - public void Show() - { - this._hide = false; - } - - /// - /// Updates the texture bitmap. - /// - /// The new bitmap. - /// The position. - public void UpdateTextureBitmap(Bitmap newBitmap, Vector2 position = new Vector2()) - { - if (position.IsValid()) - { - this.Position = position; - } - - if (this.Bitmap != null) - { - this.Bitmap.Dispose(); - } - this.Bitmap = newBitmap; - - this._texture = Texture.FromMemory( - Device, - (byte[])new ImageConverter().ConvertTo(newBitmap, typeof(byte[])), - this.Width, - this.Height, - 0, - Usage.None, - Format.A1, - Pool.Managed, - Filter.Default, - Filter.Default, - 0); - - if (this._originalTexture == null) - { - this._originalTexture = this._texture; - } - } - - #endregion - - #region Methods - - /// - /// Saturates the bitmap. - /// - /// The original image. - /// The saturation. - /// Bitmap. - private static Bitmap SaturateBitmap(Image original, float saturation) - { - const float rWeight = 0.3086f; - const float gWeight = 0.6094f; - const float bWeight = 0.0820f; - - var a = (1.0f - saturation) * rWeight + saturation; - var b = (1.0f - saturation) * rWeight; - var c = (1.0f - saturation) * rWeight; - var d = (1.0f - saturation) * gWeight; - var e = (1.0f - saturation) * gWeight + saturation; - var f = (1.0f - saturation) * gWeight; - var g = (1.0f - saturation) * bWeight; - var h = (1.0f - saturation) * bWeight; - var i = (1.0f - saturation) * bWeight + saturation; - - var newBitmap = new Bitmap(original.Width, original.Height); - var gr = Graphics.FromImage(newBitmap); - - // ColorMatrix elements - float[][] ptsArray = - { - new[] { a, b, c, 0, 0 }, new[] { d, e, f, 0, 0 }, new[] { g, h, i, 0, 0 }, - new float[] { 0, 0, 0, 1, 0 }, new float[] { 0, 0, 0, 0, 1 } - }; - // Create ColorMatrix - var clrMatrix = new ColorMatrix(ptsArray); - // Create ImageAttributes - var imgAttribs = new ImageAttributes(); - // Set color matrix - imgAttribs.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default); - // Draw Image with no effects - gr.DrawImage(original, 0, 0, original.Width, original.Height); - // Draw Image with image attributes - gr.DrawImage( - original, - new System.Drawing.Rectangle(0, 0, original.Width, original.Height), - 0, - 0, - original.Width, - original.Height, - GraphicsUnit.Pixel, - imgAttribs); - gr.Dispose(); - - return newBitmap; - } - - /// - /// Fired when the game is updated. - /// - /// The instance containing the event data. - private void Game_OnUpdate(EventArgs args) - { - if (this.PositionUpdate != null) - { - var pos = this.PositionUpdate(); - this.X = (int)pos.X; - this.Y = (int)pos.Y; - } - } - - #endregion - } - - /// - /// Object used to draw text on the screen. - /// - public class Text : RenderObject - { - #region Fields - - /// - /// true if the text should be centered at the position. - /// - public bool Centered = false; - - /// - /// The offset - /// - public Vector2 Offset; - - /// - /// true if the text should have an outline. - /// - public bool OutLined = false; - - /// - /// The delegate that updates the position of the text. - /// - public PositionDelegate PositionUpdate; - - /// - /// The delegate that updates the text. - /// - public TextDelegate TextUpdate; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - /// - /// The text - /// - private string _text; - - /// - /// The DirectX text font - /// - private Font _textFont; - - /// - /// The x - /// - private int _x; - - /// - /// The calculated x - /// - private int _xCalculated; - - /// - /// The y - /// - private int _y; - - /// - /// The calculated y - /// - private int _yCalculated; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - /// The text. - /// The x. - /// The y. - /// The size. - /// The color. - /// Name of the font. - public Text(string text, int x, int y, int size, ColorBGRA color, string fontName = "Calibri") - : this(text, fontName, size, color) - { - this._x = x; - this._y = y; - } - - /// - /// Initializes a new instance of the class. - /// - /// The text. - /// The position. - /// The size. - /// The color. - /// Name of the font. - public Text(string text, Vector2 position, int size, ColorBGRA color, string fontName = "Calibri") - : this(text, fontName, size, color) - { - this._x = (int)position.X; - this._y = (int)position.Y; - } - - /// - /// Initializes a new instance of the class. - /// - /// The text. - /// The unit. - /// The offset. - /// The size. - /// The color. - /// Name of the font. - public Text( - string text, - Obj_AI_Base unit, - Vector2 offset, - int size, - ColorBGRA color, - string fontName = "Calibri") - : this(text, fontName, size, color) - { - this.Unit = unit; - this.Offset = offset; - - var pos = unit.HPBarPosition + offset; - - this._x = (int)pos.X; - this._y = (int)pos.Y; - } - - /// - /// Initializes a new instance of the class. - /// - /// The x. - /// The y. - /// The text. - /// The size. - /// The color. - /// Name of the font. - public Text(int x, int y, string text, int size, ColorBGRA color, string fontName = "Calibri") - : this(text, fontName, size, color) - { - this._x = x; - this._y = y; - } - - /// - /// Initializes a new instance of the class. - /// - /// The position. - /// The text. - /// The size. - /// The color. - /// Name of the font. - public Text(Vector2 position, string text, int size, ColorBGRA color, string fontName = "Calibri") - : this(text, fontName, size, color) - { - this._x = (int)position.X; - this._y = (int)position.Y; - } - - /// - /// Initializes a new instance of the class. - /// - /// The text. - /// Name of the font. - /// The size. - /// The color. - private Text(string text, string fontName, int size, ColorBGRA color) - { - this._textFont = new Font( - Device, - new FontDescription - { - FaceName = fontName, Height = size, OutputPrecision = FontPrecision.Default, - Quality = FontQuality.Default - }); - this.Color = color; - this.text = text; - Game.OnUpdate += this.Game_OnUpdate; - this.SubscribeToResetEvents(); - } - - #endregion - - #region Delegates - - /// - /// Delegate that gets the position of the text. - /// - /// Vector2. - public delegate Vector2 PositionDelegate(); - - /// - /// Delegate that gets the text. - /// - /// System.String. - public delegate string TextDelegate(); - - #endregion - - #region Public Properties - - /// - /// Gets or sets the color. - /// - /// The color. - public ColorBGRA Color { get; set; } - - /// - /// Gets the height. - /// - /// The height. - public int Height { get; private set; } - - /// - /// Gets or sets the text. - /// - /// The text. - public string text - { - get - { - return this._text; - } - set - { - if (value != this._text && this._textFont != null && !this._textFont.IsDisposed - && !string.IsNullOrEmpty(value)) - { - var size = this._textFont.MeasureText(null, value, 0); - this.Width = size.Width; - this.Height = size.Height; - this._textFont.PreloadText(value); - } - this._text = value; - } - } - - /// - /// Gets or sets the text font description. - /// - /// The text font description. - public FontDescription TextFontDescription - { - get - { - return this._textFont.Description; - } - - set - { - this._textFont.Dispose(); - this._textFont = new Font(Device, value); - } - } - - /// - /// Gets the width. - /// - /// The width. - public int Width { get; private set; } - - /// - /// Gets or sets the x. - /// - /// The x. - public int X - { - get - { - if (this.PositionUpdate != null) - { - return this._xCalculated; - } - return this._x + this.XOffset; - } - set - { - this._x = value; - } - } - - /// - /// Gets or sets the y. - /// - /// The y. - public int Y - { - get - { - if (this.PositionUpdate != null) - { - return this._yCalculated; - } - return this._y + this.YOffset; - } - set - { - this._y = value; - } - } - - #endregion - - #region Properties - - /// - /// Gets the x offset. - /// - /// The x offset. - private int XOffset - { - get - { - return this.Centered ? -this.Width / 2 : 0; - } - } - - /// - /// Gets the y offset. - /// - /// The y offset. - private int YOffset - { - get - { - return this.Centered ? -this.Height / 2 : 0; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Disposes this instance. - /// - public override void Dispose() - { - Game.OnUpdate -= this.Game_OnUpdate; - this.OnPreReset(); - if (!this._textFont.IsDisposed) - { - this._textFont.Dispose(); - } - } - - /// - /// Called when the scene has ended. - /// - public override void OnEndScene() - { - try - { - if (this._textFont.IsDisposed || this.text == "") - { - return; - } - - if (this.Unit != null && this.Unit.IsValid) - { - var pos = this.Unit.HPBarPosition + this.Offset; - this.X = (int)pos.X; - this.Y = (int)pos.Y; - } - - var xP = this.X; - var yP = this.Y; - if (this.OutLined) - { - var outlineColor = new ColorBGRA(0, 0, 0, 255); - this._textFont.DrawText(null, this.text, xP - 1, yP - 1, outlineColor); - this._textFont.DrawText(null, this.text, xP + 1, yP + 1, outlineColor); - this._textFont.DrawText(null, this.text, xP - 1, yP, outlineColor); - this._textFont.DrawText(null, this.text, xP + 1, yP, outlineColor); - } - this._textFont.DrawText(null, this.text, xP, yP, this.Color); - } - catch (Exception e) - { - Console.WriteLine(@"Common.Render.Text.OnEndScene: " + e); - } - } - - /// - /// Called after the DirectX device has been reset. - /// - public override void OnPostReset() - { - this._textFont.OnResetDevice(); - } - - /// - /// Called before the DirectX device is reset. - /// - public override void OnPreReset() - { - this._textFont.OnLostDevice(); - } - - #endregion - - #region Methods - - /// - /// Game_s the on update. - /// - /// The instance containing the event data. - private void Game_OnUpdate(EventArgs args) - { - if (this.Visible) - { - if (this.TextUpdate != null) - { - this.text = this.TextUpdate(); - } - - if (this.PositionUpdate != null && !string.IsNullOrEmpty(this.text)) - { - var pos = this.PositionUpdate(); - this._xCalculated = (int)pos.X + this.XOffset; - this._yCalculated = (int)pos.Y + this.YOffset; - } - } - } - - #endregion - } - } - - /// - /// Provides extensions for fonts. - /// - public static class FontExtension - { - #region Static Fields - - /// - /// The widths - /// - private static readonly Dictionary> Widths = - new Dictionary>(); - - #endregion - - #region Public Methods and Operators - - /// - /// Measures the text. - /// - /// The font. - /// The sprite. - /// The text. - /// Rectangle. - public static Rectangle MeasureText(this Font font, Sprite sprite, string text) - { - Dictionary rectangles; - if (!Widths.TryGetValue(font, out rectangles)) - { - rectangles = new Dictionary(); - Widths[font] = rectangles; - } - - Rectangle rectangle; - if (rectangles.TryGetValue(text, out rectangle)) - { - return rectangle; - } - rectangle = font.MeasureText(sprite, text, 0); - rectangles[text] = rectangle; - return rectangle; - } - - /// - /// Measures the text. - /// - /// The font. - /// The text. - /// Rectangle. - public static Rectangle MeasureText(this Font font, string text) - { - return font.MeasureText(null, text); - } - - #endregion - } -} \ No newline at end of file diff --git a/Resources/CPForm.png b/Resources/CPForm.png deleted file mode 100644 index eb148ad5..00000000 Binary files a/Resources/CPForm.png and /dev/null differ diff --git a/Resources/SliderActive.png b/Resources/SliderActive.png deleted file mode 100644 index 706091bc..00000000 Binary files a/Resources/SliderActive.png and /dev/null differ diff --git a/Resources/SliderDisabled.png b/Resources/SliderDisabled.png deleted file mode 100644 index 80d435ea..00000000 Binary files a/Resources/SliderDisabled.png and /dev/null differ diff --git a/Shared.cs b/Shared.cs deleted file mode 100644 index 713cbbff..00000000 --- a/Shared.cs +++ /dev/null @@ -1,65 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.ServiceModel; - - /// - /// Helps share an instance of a class across assemblies. - /// - public static class Shared - { - #region Public Methods and Operators - - /// - /// Gets the interface. - /// - /// The type of the interface type. - /// InterfaceType. - /// - /// Failed to connect to assembly pipe for Common.Shared communication. The targetted assembly - /// may not be loaded yet. Desired interface: + typeof(InterfaceType).Name - /// - public static InterfaceType GetInterface() where InterfaceType : class - { - try - { - return - new ChannelFactory( - new NetNamedPipeBinding(), - new EndpointAddress("net.pipe://localhost/" + typeof(InterfaceType).Name)).CreateChannel(); - } - catch (Exception e) - { - throw new Exception( - "Failed to connect to assembly pipe for Common.Shared communication. The targetted assembly may not be loaded yet. Desired interface: " - + typeof(InterfaceType).Name, - e); - } - } - - /// - /// Shares the interface. - /// - /// The type of the implementation type. - /// if set to true [open]. - /// ServiceHost. - public static ServiceHost ShareInterface(bool open = true) - { - var host = new ServiceHost(typeof(ImplementationType), new Uri("net.pipe://localhost")); - - host.AddServiceEndpoint( - typeof(ImplementationType).GetInterfaces()[0], - new NetNamedPipeBinding(), - typeof(ImplementationType).GetInterfaces()[0].Name); - - if (open) - { - host.Open(); - } - - return host; - } - - #endregion - } -} \ No newline at end of file diff --git a/Utility.cs b/Utility.cs deleted file mode 100644 index 648c35db..00000000 --- a/Utility.cs +++ /dev/null @@ -1,1238 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using SharpDX; - - using Color = System.Drawing.Color; - - /// - /// Game functions related utilities. - /// - public static class Utility - { - #region Enums - - public enum FountainType - { - OwnFountain, - - EnemyFountain - } - - #endregion - - #region Public Methods and Operators - - /// - /// Returns the unit's ability power - /// - [Obsolete("Use TotalMagicalDamage attribute.", false)] - public static float AbilityPower(this Obj_AI_Base @base) - { - return @base.FlatMagicDamageMod + (@base.PercentMagicDamageMod * @base.FlatMagicDamageMod); - } - - // Use same interface as CountEnemiesInRange - /// - /// Count the allies in range of the Player. - /// - public static int CountAlliesInRange(float range) - { - return HeroManager.Player.CountAlliesInRange(range); - } - - /// - /// Counts the allies in range of the Unit. - /// - public static int CountAlliesInRange(this Obj_AI_Base unit, float range) - { - return unit.ServerPosition.CountAlliesInRange(range, unit); - } - - /// - /// Counts the allies in the range of the Point. - /// - public static int CountAlliesInRange(this Vector3 point, float range, Obj_AI_Base originalunit = null) - { - if (originalunit != null) - { - return - HeroManager.Allies.Count( - x => x.NetworkId != originalunit.NetworkId && x.IsValidTarget(range, false, point)); - } - return HeroManager.Allies.Count(x => x.IsValidTarget(range, false, point)); - } - - /// - /// Counts the enemies in range of Player. - /// - public static int CountEnemiesInRange(float range) - { - return HeroManager.Player.CountEnemiesInRange(range); - } - - /// - /// Counts the enemies in range of Unit. - /// - public static int CountEnemiesInRange(this Obj_AI_Base unit, float range) - { - return unit.ServerPosition.CountEnemiesInRange(range); - } - - /// - /// Counts the enemies in range of point. - /// - public static int CountEnemiesInRange(this Vector3 point, float range) - { - return HeroManager.Enemies.Count(h => h.IsValidTarget(range, true, point)); - } - - [Obsolete("Use CountEnemiesInRange", false)] - public static int CountEnemysInRange(this Obj_AI_Base unit, float range) - { - return unit.ServerPosition.CountEnemiesInRange(range); - } - - [Obsolete("Use CountEnemiesInRange", false)] - public static int CountEnemysInRange(this Vector3 point, float range) - { - return point.CountEnemiesInRange(range); - } - - public static List CutPath(this List path, float distance) - { - var result = new List(); - var Distance = distance; - if (distance < 0) - { - path[0] = path[0] + distance * (path[1] - path[0]).Normalized(); - return path; - } - - for (var i = 0; i < path.Count - 1; i++) - { - var dist = path[i].Distance(path[i + 1]); - if (dist > Distance) - { - result.Add(path[i] + Distance * (path[i + 1] - path[i]).Normalized()); - for (var j = i + 1; j < path.Count; j++) - { - result.Add(path[j]); - } - - break; - } - Distance -= dist; - } - return result.Count > 0 ? result : new List { path.Last() }; - } - - /// - /// Draws a "lag-free" circle - /// - [Obsolete("Use Render.Circle", false)] - public static void DrawCircle( - Vector3 center, - float radius, - Color color, - int thickness = 5, - int quality = 30, - bool onMinimap = false) - { - if (!onMinimap) - { - Render.Circle.DrawCircle(center, radius, color, thickness); - return; - } - - var pointList = new List(); - for (var i = 0; i < quality; i++) - { - var angle = i * Math.PI * 2 / quality; - pointList.Add( - new Vector3( - center.X + radius * (float)Math.Cos(angle), - center.Y + radius * (float)Math.Sin(angle), - center.Z)); - } - - for (var i = 0; i < pointList.Count; i++) - { - var a = pointList[i]; - var b = pointList[i == pointList.Count - 1 ? 0 : i + 1]; - - var aonScreen = Drawing.WorldToMinimap(a); - var bonScreen = Drawing.WorldToMinimap(b); - - Drawing.DrawLine(aonScreen.X, aonScreen.Y, bonScreen.X, bonScreen.Y, thickness, color); - } - } - - public static List GetAlliesInRange(this Obj_AI_Base unit, float range) - { - return GetAlliesInRange(unit.ServerPosition, range, unit); - } - - public static List GetAlliesInRange( - this Vector3 point, - float range, - Obj_AI_Base originalunit = null) - { - if (originalunit != null) - { - return - HeroManager.Allies.FindAll( - x => - x.NetworkId != originalunit.NetworkId && point.Distance(x.ServerPosition, true) <= range * range); - } - return HeroManager.Allies.FindAll(x => point.Distance(x.ServerPosition, true) <= range * range); - } - - public static List GetEnemiesInRange(this Obj_AI_Base unit, float range) - { - return GetEnemiesInRange(unit.ServerPosition, range); - } - - public static List GetEnemiesInRange(this Vector3 point, float range) - { - return HeroManager.Enemies.FindAll(x => point.Distance(x.ServerPosition, true) <= range * range); - } - - public static List GetObjects(this Vector3 position, float range) where T : GameObject, new() - { - return ObjectManager.Get().Where(x => position.Distance(x.Position, true) < range * range).ToList(); - } - - public static List GetObjects(string objectName, float range, Vector3 rangeCheckFrom = new Vector3()) - where T : GameObject, new() - { - if (rangeCheckFrom.Equals(Vector3.Zero)) - { - rangeCheckFrom = HeroManager.Player.ServerPosition; - } - - return ObjectManager.Get().Where(x => rangeCheckFrom.Distance(x.Position, true) < range * range).ToList(); - } - - public static short GetPacketId(this GamePacketEventArgs gamePacketEventArgs) - { - var packetData = gamePacketEventArgs.PacketData; - if (packetData.Length < 2) - { - return 0; - } - return (short)(packetData[0] + packetData[1] * 256); - } - - /// - /// Returns the recall duration - /// - public static int GetRecallTime(Obj_AI_Hero obj) - { - return GetRecallTime(obj.Spellbook.GetSpell(SpellSlot.Recall).Name); - } - - public static int GetRecallTime(string recallName) - { - var duration = 0; - - switch (recallName.ToLower()) - { - case "recall": - duration = 8000; - break; - case "recallimproved": - duration = 7000; - break; - case "odinrecall": - duration = 4500; - break; - case "odinrecallimproved": - duration = 4000; - break; - case "superrecall": - duration = 4000; - break; - case "superrecallimproved": - duration = 4000; - break; - } - return duration; - } - - public static SpellDataInst GetSpell(this Obj_AI_Hero hero, SpellSlot slot) - { - return hero.Spellbook.GetSpell(slot); - } - - /// - /// Will return real time spell cooldown - /// - /// - /// - /// - public static float GetSpellCooldownEx(this Obj_AI_Hero hero, SpellSlot spell) - { - var expire = hero.Spellbook.GetSpell(spell).CooldownExpires; - var cd = (expire - (Game.Time - 1)); - - return cd <= 0 ? 0 : cd; - } - - /// - /// Returns the spell slot with the name. - /// - public static SpellSlot GetSpellSlot(this Obj_AI_Hero unit, string name) - { - foreach (var spell in - unit.Spellbook.Spells.Where( - spell => String.Equals(spell.Name, name, StringComparison.CurrentCultureIgnoreCase))) - { - return spell.Slot; - } - - return SpellSlot.Unknown; - } - - /// - /// Returns the path of the unit appending the ServerPosition at the start, works even if the unit just entered fow. - /// - public static List GetWaypoints(this Obj_AI_Base unit) - { - var result = new List(); - - if (unit.IsVisible) - { - result.Add(unit.ServerPosition.To2D()); - var path = unit.Path; - if (path.Length > 0) - { - var first = path[0].To2D(); - if (first.Distance(result[0], true) > 40) - { - result.Add(first); - } - - for (var i = 1; i < path.Length; i++) - { - result.Add(path[i].To2D()); - } - } - } - else if (WaypointTracker.StoredPaths.ContainsKey(unit.NetworkId)) - { - var path = WaypointTracker.StoredPaths[unit.NetworkId]; - var timePassed = (Utils.TickCount - WaypointTracker.StoredTick[unit.NetworkId]) / 1000f; - if (path.PathLength() >= unit.MoveSpeed * timePassed) - { - result = CutPath(path, (int)(unit.MoveSpeed * timePassed)); - } - } - - return result; - } - - public static List GetWaypointsWithTime(this Obj_AI_Base unit) - { - var wp = unit.GetWaypoints(); - - if (wp.Count < 1) - { - return null; - } - - var result = new List(); - var speed = unit.MoveSpeed; - var lastPoint = wp[0]; - var time = 0f; - - foreach (var point in wp) - { - time += point.Distance(lastPoint) / speed; - result.Add(new Vector2Time(point, time)); - lastPoint = point; - } - - return result; - } - - /// - /// Returns if the unit has the buff and it is active - /// - [Obsolete("Use Obj_AI_Base.HasBuff")] - public static bool HasBuff( - this Obj_AI_Base unit, - string buffName, - bool dontUseDisplayName = false, - bool kappa = true) - { - return - unit.Buffs.Any( - buff => - ((dontUseDisplayName - && String.Equals(buff.Name, buffName, StringComparison.CurrentCultureIgnoreCase)) - || (!dontUseDisplayName - && String.Equals(buff.DisplayName, buffName, StringComparison.CurrentCultureIgnoreCase))) - && buff.IsValidBuff()); - } - - /// - /// Returns if the unit has the specified buff in the indicated amount of time - /// - public static bool HasBuffIn( - this Obj_AI_Base unit, - string displayName, - float tickCount, - bool includePing = true) - { - return - unit.Buffs.Any( - buff => - buff.IsValid && buff.DisplayName == displayName - && buff.EndTime - Game.Time > tickCount - (includePing ? (Game.Ping / 2000f) : 0)); - } - - /// - /// Returns the unit's health percentage (From 0 to 100). - /// - [Obsolete("Use HealthPercent attribute.", false)] - public static float HealthPercentage(this Obj_AI_Base unit) - { - return unit.HealthPercent; - } - - /// - /// Returns true if unit is in fountain range (range in which fountain heals). - /// The second optional parameter allows you to indicate which fountain you want to check against. - /// - public static bool InFountain(this Obj_AI_Base unit, FountainType ftype = FountainType.OwnFountain) - { - float fountainRange = 562500; //750 * 750 - var map = Map.GetMap(); - if (map != null && map.Type == Map.MapType.SummonersRift) - { - fountainRange = 1210000; //1100 * 1100 - } - - var fpos = new Vector3(); - - if (ftype == FountainType.OwnFountain) - { - fpos = unit.Team == HeroManager.Player.Team ? MiniCache.AllyFountain : MiniCache.EnemyFountain; - } - if (ftype == FountainType.EnemyFountain) - { - fpos = unit.Team == HeroManager.Player.Team ? MiniCache.EnemyFountain : MiniCache.AllyFountain; - } - - return unit.IsVisible && unit.Distance(fpos, true) <= fountainRange; - } - - /// - /// Checks a point to see if it is in an ally or enemy fountain - /// - public static bool InFountain(this Vector3 position, FountainType fountain) - { - return position.To2D().InFountain(fountain); - } - - /// - /// Checks a point to see if it is in an ally or enemy fountain - /// - public static bool InFountain(this Vector2 position, FountainType fountain) - { - float fountainRange = 562500; //750 * 750 - var map = Map.GetMap(); - if (map != null && map.Type == Map.MapType.SummonersRift) - { - fountainRange = 1210000; //1100 * 1100 - } - var fpos = fountain == FountainType.OwnFountain ? MiniCache.AllyFountain : MiniCache.EnemyFountain; - return position.Distance(fpos, true) <= fountainRange; - } - - /// - /// Returns true if unit is in shop range (range in which the shopping is allowed). - /// - /// - public static bool InShop(this Obj_AI_Base unit) - { - float fountainRange = 562500; //750 * 750 - var map = Map.GetMap(); - if (map != null && map.Type == Map.MapType.SummonersRift) - { - fountainRange = 1000000; //1000 * 1000 - } - var fpos = unit.Team == HeroManager.Player.Team ? MiniCache.AllyFountain : MiniCache.EnemyFountain; - return unit.IsVisible && unit.Distance(fpos, true) <= fountainRange; - } - - /// - /// Checks if this spell is an autoattack - /// - public static bool IsAutoAttack(this SpellData spellData) - { - return Orbwalking.IsAutoAttack(spellData.Name); - } - - /// - /// Checks if this spell is an autoattack - /// - public static bool IsAutoAttack(this SpellDataInst spellData) - { - return Orbwalking.IsAutoAttack(spellData.Name); - } - - /// - /// Returns if both source and target are Facing Themselves. - /// - public static bool IsBothFacing(Obj_AI_Base source, Obj_AI_Base target) - { - return source.IsFacing(target) && target.IsFacing(source); - } - - /// - /// Checks if CastState is SuccessfullyCasted - /// - public static bool IsCasted(this Spell.CastStates state) - { - return state == Spell.CastStates.SuccessfullyCasted; - } - - /// - /// Checks if the unit is a Hero or Champion - /// - public static bool IsChampion(this Obj_AI_Base unit) - { - var hero = unit as Obj_AI_Hero; - return hero != null && hero.IsValid; - } - - /// - /// Checks if this unit is the same as the given champion name - /// - public static bool IsChampion(this Obj_AI_Base unit, string championName) - { - var hero = unit as Obj_AI_Hero; - return hero != null && hero.IsValid && hero.ChampionName.Equals(championName); - } - - /// - /// Returns if the source is facing the target. - /// - public static bool IsFacing(this Obj_AI_Base source, Obj_AI_Base target) - { - if (source == null || target == null) - { - return false; - } - - const float angle = 90; - return source.Direction.To2D().Perpendicular().AngleBetween((target.Position - source.Position).To2D()) - < angle; - } - - /// - /// Returns if the unit's movement is impaired (Slows, Taunts, Charms, Taunts, Snares, Fear) - /// - public static bool IsMovementImpaired(this Obj_AI_Hero hero) - { - return hero.HasBuffOfType(BuffType.Flee) || hero.HasBuffOfType(BuffType.Charm) - || hero.HasBuffOfType(BuffType.Slow) || hero.HasBuffOfType(BuffType.Snare) - || hero.HasBuffOfType(BuffType.Stun) || hero.HasBuffOfType(BuffType.Taunt); - } - - /// - /// Checks if the unit position is on screen - /// - public static bool IsOnScreen(this Vector3 position) - { - var pos = Drawing.WorldToScreen(position); - return pos.X > 0 && pos.X <= Drawing.Width && pos.Y > 0 && pos.Y <= Drawing.Height; - } - - /// - /// Checks if the unit position is on screen - /// - public static bool IsOnScreen(this Vector2 position) - { - return position.To3D().IsOnScreen(); - } - - /// - /// Returns if the spell is ready to use. - /// - public static bool IsReady(this SpellDataInst spell, int t = 0) - { - return spell != null && spell.Slot != SpellSlot.Unknown && t == 0 - ? spell.State == SpellState.Ready - : (spell.State == SpellState.Ready - || (spell.State == SpellState.Cooldown && (spell.CooldownExpires - Game.Time) <= t / 1000f)); - } - - /// - /// Returns if the spell is ready to use. - /// - public static bool IsReady(this Spell spell, int t = 0) - { - return IsReady(spell.Instance, t); - } - - /// - /// Returns if the spell is ready to use. - /// - public static bool IsReady(this SpellSlot slot, int t = 0) - { - var s = HeroManager.Player.Spellbook.GetSpell(slot); - return s != null && IsReady(s, t); - } - - /// - /// Checks if the unit casting recall - /// - public static bool IsRecalling(this Obj_AI_Hero unit) - { - return unit.Buffs.Any(buff => buff.Name.ToLower().Contains("recall") && buff.Type == BuffType.Aura); - } - - /// - /// Returns if the GameObject is valid - /// - public static bool IsValid(this GameObject obj) where T : GameObject - { - return obj is T && obj.IsValid; - } - - /// - /// Returns true if the buff is active and didn't expire. - /// - public static bool IsValidBuff(this BuffInstance buff) - { - return buff.IsActive && buff.EndTime - Game.Time > 0; - } - - /// - /// Returns if the SpellSlot of the InventorySlot is valid - /// - public static bool IsValidSlot(this InventorySlot slot) - { - return slot != null && slot.SpellSlot != SpellSlot.Unknown; - } - - /// - /// Returns if the target is valid (not dead, targetable, visible...). - /// - public static bool IsValidTarget( - this AttackableUnit unit, - float range = float.MaxValue, - bool checkTeam = true, - Vector3 from = new Vector3()) - { - if (unit == null || !unit.IsValid || !unit.IsVisible || unit.IsDead || !unit.IsTargetable - || unit.IsInvulnerable) - - { - return false; - } - - if (checkTeam && unit.Team == HeroManager.Player.Team) - { - return false; - } - - if (unit.Name == "WardCorpse") - { - return false; - } - - var @base = unit as Obj_AI_Base; - - return !(range < float.MaxValue) - || !(Vector2.DistanceSquared( - (@from.To2D().IsValid() ? @from : HeroManager.Player.ServerPosition).To2D(), - (@base != null ? @base.ServerPosition : unit.Position).To2D()) > range * range); - } - - /// - /// Checks if this position is a wall using NavMesh - /// - public static bool IsWall(this Vector3 position) - { - return NavMesh.GetCollisionFlags(position).HasFlag(CollisionFlags.Wall); - } - - /// - /// Checks if this position is a wall using NavMesh - /// - public static bool IsWall(this Vector2 position) - { - return position.To3D().IsWall(); - } - - /// - /// Levels up a spell - /// - public static void LevelUpSpell(this Spellbook book, SpellSlot slot, bool evolve = false) - { - book.LevelSpell(slot); - } - - /// - /// Returns the unit's mana percentage (From 0 to 100). - /// - [Obsolete("Use ManaPercent attribute.", false)] - public static float ManaPercentage(this Obj_AI_Base unit) - { - return unit.ManaPercent; - } - - public static void ProcessAsPacket(this byte[] packetData, PacketChannel channel = PacketChannel.S2C) - { - Game.ProcessPacket(packetData, channel); - } - - /// - /// Randomizes the position with the supplied min/max - /// - public static Vector3 Randomize(this Vector3 position, int min, int max) - { - var ran = new Random(Utils.TickCount); - return position + new Vector2(ran.Next(min, max), ran.Next(min, max)).To3D(); - } - - /// - /// Randomizes the position with the supplied min/max - /// - public static Vector2 Randomize(this Vector2 position, int min, int max) - { - return position.To3D().Randomize(min, max).To2D(); - } - - public static void SendAsPacket( - this byte[] packetData, - PacketChannel channel = PacketChannel.C2S, - PacketProtocolFlags protocolFlags = PacketProtocolFlags.Reliable) - { - Game.SendPacket(packetData, channel, protocolFlags); - } - - public static NavMeshCell ToNavMeshCell(this Vector3 position) - { - var nav = NavMesh.WorldToGrid(position.X, position.Y); - return NavMesh.GetCell((short)nav.X, (short)nav.Y); - } - - [Obsolete("Use TotalAttackDamage attribute from LeagueSharp.Core", false)] - public static float TotalAttackDamage(this Obj_AI_Hero target) - { - return target.TotalAttackDamage; - } - - [Obsolete("Use TotalMagicalDamage from Leaguesharp.Core.", false)] - public static float TotalMagicalDamage(this Obj_AI_Hero target) - { - return target.TotalMagicalDamage; - } - - /// - /// Return true if unit is under ally turret range. - /// - public static bool UnderAllyTurret(this Obj_AI_Base unit) - { - return UnderAllyTurret(unit.Position); - } - - public static bool UnderAllyTurret(this Vector3 position) - { - return - ObjectManager.Get() - .Any(turret => turret.IsValidTarget(950, false, position) && turret.IsAlly); - } - - /// - /// Returns true if the unit is under tower range. - /// - public static bool UnderTurret(this Obj_AI_Base unit) - { - return UnderTurret(unit.Position, true); - } - - /// - /// Returns true if the unit is under turret range. - /// - public static bool UnderTurret(this Obj_AI_Base unit, bool enemyTurretsOnly) - { - return UnderTurret(unit.Position, enemyTurretsOnly); - } - - public static bool UnderTurret(this Vector3 position, bool enemyTurretsOnly) - { - return - ObjectManager.Get().Any(turret => turret.IsValidTarget(950, enemyTurretsOnly, position)); - } - - #endregion - - public static class DelayAction - { - #region Static Fields - - public static List ActionList = new List(); - - #endregion - - #region Constructors and Destructors - - static DelayAction() - { - Game.OnUpdate += GameOnOnGameUpdate; - } - - #endregion - - #region Delegates - - public delegate void Callback(); - - #endregion - - #region Public Methods and Operators - - public static void Add(int time, Callback func) - { - var action = new Action(time, func); - ActionList.Add(action); - } - - #endregion - - #region Methods - - private static void GameOnOnGameUpdate(EventArgs args) - { - for (var i = ActionList.Count - 1; i >= 0; i--) - { - if (ActionList[i].Time <= Utils.GameTimeTickCount) - { - try - { - if (ActionList[i].CallbackObject != null) - { - ActionList[i].CallbackObject(); - //Will somehow result in calling ALL non-internal marked classes of the called assembly and causes NullReferenceExceptions. - } - } - catch (Exception) - { - // ignored - } - - ActionList.RemoveAt(i); - } - } - } - - #endregion - - public struct Action - { - #region Fields - - public Callback CallbackObject; - - public int Time; - - #endregion - - #region Constructors and Destructors - - public Action(int time, Callback callback) - { - this.Time = time + Utils.GameTimeTickCount; - this.CallbackObject = callback; - } - - #endregion - } - } - - public static class HpBarDamageIndicator - { - #region Constants - - private const int Height = 8; - - private const int Width = 103; - - private const int XOffset = 10; - - private const int YOffset = 20; - - #endregion - - #region Static Fields - - public static Color Color = Color.Lime; - - public static bool Enabled = true; - - private static readonly Render.Text Text = new Render.Text( - 0, - 0, - string.Empty, - 11, - new ColorBGRA(255, 0, 0, 255), - "monospace"); - - private static DamageToUnitDelegate _damageToUnit; - - #endregion - - #region Delegates - - public delegate float DamageToUnitDelegate(Obj_AI_Hero hero); - - #endregion - - #region Public Properties - - public static DamageToUnitDelegate DamageToUnit - { - get - { - return _damageToUnit; - } - - set - { - if (_damageToUnit == null) - { - Drawing.OnDraw += Drawing_OnDraw; - } - _damageToUnit = value; - } - } - - #endregion - - #region Methods - - private static void Drawing_OnDraw(EventArgs args) - { - if (!Enabled || _damageToUnit == null) - { - return; - } - - var width = Drawing.Width; - var height = Drawing.Height; - - foreach (var unit in - HeroManager.Enemies.FindAll(h => h.IsValid && h.IsHPBarRendered)) - { - var barPos = unit.HPBarPosition; - - if (barPos.X < -200 || barPos.X > width + 200) continue; - - if (barPos.Y < -200 || barPos.X > height + 200) continue; - - var damage = _damageToUnit(unit); - var percentHealthAfterDamage = Math.Max(0, unit.Health - damage) / unit.MaxHealth; - var xPos = barPos.X + XOffset + Width * percentHealthAfterDamage; - - //if (damage > unit.Health) - { - Text.X = (int)barPos.X + XOffset; - Text.Y = (int)barPos.Y + YOffset - 13; - Text.text = ((int)(unit.Health - damage)).ToString(); - Text.OnEndScene(); - } - - Drawing.DrawLine(xPos, barPos.Y + YOffset, xPos, barPos.Y + YOffset + Height, 2, Color); - } - } - - #endregion - } - - /// - /// Internal class used to get the waypoints even when the enemy enters the fow of war. - /// - internal static class WaypointTracker - { - #region Static Fields - - public static readonly Dictionary> StoredPaths = new Dictionary>(); - - public static readonly Dictionary StoredTick = new Dictionary(); - - #endregion - } - - public class Map - { - #region Static Fields - - private static readonly IDictionary MapById = new Dictionary - { - { - 8, - new Map - { - Name = "The Crystal Scar", - ShortName = "crystalScar", - Type = MapType.CrystalScar, - Grid = - new Vector2( - 13894f / 2, - 13218f / 2), - StartingLevel = 3 - } - }, - { - 10, - new Map - { - Name = "The Twisted Treeline", - ShortName = "twistedTreeline", - Type = MapType.TwistedTreeline, - Grid = - new Vector2( - 15436f / 2, - 14474f / 2), - StartingLevel = 1 - } - }, - { - 11, - new Map - { - Name = "Summoner's Rift", - ShortName = "summonerRift", - Type = MapType.SummonersRift, - Grid = - new Vector2( - 13982f / 2, - 14446f / 2), - StartingLevel = 1 - } - }, - { - 12, - new Map - { - Name = "Howling Abyss", - ShortName = "howlingAbyss", - Type = MapType.HowlingAbyss, - Grid = - new Vector2( - 13120f / 2, - 12618f / 2), - StartingLevel = 3 - } - } - }; - - #endregion - - #region Enums - - public enum MapType - { - Unknown, - - SummonersRift, - - CrystalScar, - - TwistedTreeline, - - HowlingAbyss - } - - #endregion - - #region Public Properties - - public Vector2 Grid { get; private set; } - - public string Name { get; private set; } - - public string ShortName { get; private set; } - - public int StartingLevel { get; private set; } - - public MapType Type { get; private set; } - - #endregion - - #region Properties - - private static Map _currentMap { get; set; } - - #endregion - - #region Public Methods and Operators - - /// - /// Returns the current map. - /// - public static Map GetMap() - { - if (_currentMap != null) - { - return _currentMap; - } - if (MapById.ContainsKey((int)Game.MapId)) - { - _currentMap = MapById[(int)Game.MapId]; - return _currentMap; - } - - return new Map - { - Name = "Unknown", ShortName = "unknown", Type = MapType.Unknown, Grid = new Vector2(0, 0), - StartingLevel = 1 - }; - } - - #endregion - } - - public class MiniCache - { - #region Static Fields - - private static VectorHolder _allySpawn, _enemySpawn; - - #endregion - - #region Public Properties - - public static Vector3 AllyFountain - { - get - { - if (_allySpawn != null) return _allySpawn.position; - _allySpawn = new VectorHolder(ObjectManager.Get().Find(x => x.IsAlly).Position); - return _allySpawn.position; - } - } - - public static Vector3 EnemyFountain - { - get - { - if (_enemySpawn != null) return _enemySpawn.position; - _enemySpawn = new VectorHolder(ObjectManager.Get().Find(x => x.IsEnemy).Position); - return _enemySpawn.position; - } - } - - #endregion - - private class VectorHolder - { - #region Fields - - public Vector3 position; - - #endregion - - #region Constructors and Destructors - - public VectorHolder(Vector3 position) - { - this.position = position; - } - - #endregion - } - } - } - - public static class Version - { - #region Static Fields - - public static int Build; - - public static int MajorVersion; - - public static int MinorVersion; - - public static int Revision; - - private static readonly int[] VersionArray; - - #endregion - - #region Constructors and Destructors - - static Version() - { - var d = Game.Version.Split('.'); - MajorVersion = Convert.ToInt32(d[0]); - MinorVersion = Convert.ToInt32(d[1]); - Build = Convert.ToInt32(d[2]); - Revision = Convert.ToInt32(d[3]); - - VersionArray = new[] { MajorVersion, MinorVersion, Build, Revision }; - } - - #endregion - - #region Public Methods and Operators - - public static bool IsEqual(string version) - { - var d = version.Split('.'); - for (var i = 0; i <= d.Length; i++) - { - if (d[i] == null || Convert.ToInt32(d[i]) != VersionArray[i]) - { - return false; - } - } - return true; - } - - public static bool IsNewer(string version) - { - var d = version.Split('.'); - return MinorVersion > Convert.ToInt32(d[1]); - } - - public static bool IsOlder(string version) - { - var d = version.Split('.'); - return MinorVersion < Convert.ToInt32(d[1]); - } - - #endregion - } - - public class Vector2Time - { - #region Fields - - public Vector2 Position; - - public float Time; - - #endregion - - #region Constructors and Destructors - - public Vector2Time(Vector2 pos, float time) - { - this.Position = pos; - this.Time = time; - } - - #endregion - } -} \ No newline at end of file diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu new file mode 160000 index 00000000..0c667ef1 --- /dev/null +++ b/external/SharpDX.Menu @@ -0,0 +1 @@ +Subproject commit 0c667ef1721ca7c374c8fa58690e16990466dce8 diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..586db03b --- /dev/null +++ b/nuget.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/source/AntiGapcloser/ActiveGapcloser.cs b/source/AntiGapcloser/ActiveGapcloser.cs new file mode 100644 index 00000000..7d9f5cd8 --- /dev/null +++ b/source/AntiGapcloser/ActiveGapcloser.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// The active gapcloser info. + /// + public struct ActiveGapcloser + { + #region Fields + + /// + /// The gapcloser ending position. + /// + public Vector3 End; + + /// + /// The sender, gapcloser entity object. + /// + public Obj_AI_Hero Sender; + + /// + /// The skill type. + /// + public GapcloserType SkillType; + + /// + /// The spell slot. + /// + public SpellSlot Slot; + + /// + /// The gapcloser starting position. + /// + public Vector3 Start; + + /// + /// The starting tick count. + /// + public int TickCount; + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/AntiGapcloser.cs b/source/AntiGapcloser/AntiGapcloser.cs new file mode 100644 index 00000000..01a8ce23 --- /dev/null +++ b/source/AntiGapcloser/AntiGapcloser.cs @@ -0,0 +1,129 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + using static GapcloserType; + + /// + /// The anti-gapcloser, provides an event about game gapclose. + /// + [Export(typeof(AntiGapcloser))] + public partial class AntiGapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public AntiGapcloser() + { + this.LazySpells = new Lazy[0]; + this.Activate(); + + this.Gapcloser += OnGapcloser; + } + + #endregion + + #region Public Events + + /// + /// The gapcloser event. + /// + public event EventHandler Gapcloser; + + #endregion + + #region Public Properties + + /// + /// Gets the active gapclosers list. + /// + public List ActiveGapclosersList { get; } = new List(); + + /// + /// Gets a value indicating whether the anti gapcloser tracking system is active. + /// + public bool IsActive { get; private set; } + + /// + /// Gets or sets the lazy group of spells. + /// + [ImportMany] + public IEnumerable> LazySpells { get; protected set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Activates the anti gapcloser tracking. + /// + public void Activate() + { + this.IsActive = true; + Game.OnUpdate += this.OnUpdate; + Obj_AI_Base.OnProcessSpellCast += this.OnProcessSpellCast; + } + + /// + /// Deactivates the anti gapcloser tracking. + /// + public void Deactivate() + { + this.IsActive = false; + Game.OnUpdate -= this.OnUpdate; + Obj_AI_Base.OnProcessSpellCast -= this.OnProcessSpellCast; + } + + #endregion + + #region Methods + + private void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) + { + const StringComparison ComparisonType = StringComparison.CurrentCultureIgnoreCase; + if (!this.LazySpells.Any(s => string.Equals(s.Metadata.SpellName, args.SData.Name, ComparisonType))) + { + return; + } + + this.ActiveGapclosersList.Add( + new ActiveGapcloser + { + Start = args.Start, End = args.End, Sender = sender as Obj_AI_Hero, + TickCount = Utils.GameTimeTickCount, + SkillType = (GapcloserType)Convert.ToInt32(args.Target != null && args.Target.IsMe), + Slot = args.Slot + }); + } + + private void OnUpdate(EventArgs args) + { + this.ActiveGapclosersList.RemoveAll(entry => Utils.GameTimeTickCount > entry.TickCount + 900); + if (OnEnemyGapcloser == null) + { + return; + } + + var player = ObjectManager.Player; + foreach (var gapcloser in this.ActiveGapclosersList.Where(g => g.Sender.IsValid)) + { + if (gapcloser.SkillType == Targeted + || (gapcloser.SkillType == Skillshot && player.InRange(gapcloser.Sender, 500, true))) + { + this.Gapcloser?.Invoke(this, gapcloser); + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/AntiGapcloserAdapter.cs b/source/AntiGapcloser/AntiGapcloserAdapter.cs new file mode 100644 index 00000000..8e30ecf5 --- /dev/null +++ b/source/AntiGapcloser/AntiGapcloserAdapter.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Gapcloser delegate. + /// + /// + /// The active gapcloser. + /// + public delegate void OnGapcloseH(ActiveGapcloser gapcloser); + + /// + /// The anti-gapcloser, provides an event about game gapclose. + /// + public partial class AntiGapcloser + { + #region Public Events + + /// + /// Enemy gapcloser event. + /// + public static event OnGapcloseH OnEnemyGapcloser; + + #endregion + + #region Public Properties + + /// + /// Gets the active gapclosers. + /// + public static List ActiveGapclosers => Instance?.ActiveGapclosersList; + + /// + /// Gets a value indicating whether the system is initialized. + /// + public static bool IsInitialized => Instance?.IsActive ?? false; + + /// + /// Gets the registered spells. + /// + public static List Spells => Instance?.LazySpells.Select(s => s.Value as Gapcloser).ToList(); + + #endregion + + #region Properties + + private static AntiGapcloser Instance => Instances.AntiGapcloser; + + #endregion + + #region Public Methods and Operators + + /// + /// Activates the system. + /// + public static void Initialize() => Instance?.Activate(); + + /// + /// Shuts down the system. + /// + public static void Shutdown() => Instance?.Deactivate(); + + #endregion + + #region Methods + + private static void OnGapcloser(object sender, ActiveGapcloser activeGapcloser) + => OnEnemyGapcloser?.Invoke(activeGapcloser); + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/Gapcloser.cs b/source/AntiGapcloser/Gapcloser.cs new file mode 100644 index 00000000..510e426d --- /dev/null +++ b/source/AntiGapcloser/Gapcloser.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The gapcloser. + /// + public class Gapcloser : IGapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The champion name. + /// + /// + /// The skill type. + /// + /// + /// The slot. + /// + /// + /// The spell name. + /// + public Gapcloser(string championName, GapcloserType skillType, SpellSlot slot, string spellName) + { + this.ChampionName = championName; + this.SkillType = skillType; + this.Slot = slot; + this.SpellName = spellName; + } + + #endregion + + #region Public Properties + + /// + public string ChampionName { get; } + + /// + public GapcloserType SkillType { get; } + + /// + public SpellSlot Slot { get; } + + /// + public string SpellName { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserAatroxQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserAatroxQ.cs new file mode 100644 index 00000000..264b747d --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserAatroxQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Aatrox Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "aatroxq")] + public class GapcloserAatroxQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserAatroxQ() + : base("Aatrox", GapcloserType.Skillshot, SpellSlot.Q, "aatroxq") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserAkaliR.cs b/source/AntiGapcloser/GapcloserData/GapcloserAkaliR.cs new file mode 100644 index 00000000..f11486d8 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserAkaliR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Akali R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "akalishadowdance")] + public class GapcloserAkaliR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserAkaliR() + : base("Akali", GapcloserType.Targeted, SpellSlot.R, "akalishadowdance") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserAlistarW.cs b/source/AntiGapcloser/GapcloserData/GapcloserAlistarW.cs new file mode 100644 index 00000000..a7c0560e --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserAlistarW.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Alistar W gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "headbutt")] + public class GapcloserAlistarW : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserAlistarW() + : base("Alistar", GapcloserType.Targeted, SpellSlot.W, "headbutt") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserCorkiW.cs b/source/AntiGapcloser/GapcloserData/GapcloserCorkiW.cs new file mode 100644 index 00000000..70b60595 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserCorkiW.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Corki W gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "carpetbomb")] + public class GapcloserCorkiW : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserCorkiW() + : base("Corki", GapcloserType.Skillshot, SpellSlot.W, "carpetbomb") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserDianaR.cs b/source/AntiGapcloser/GapcloserData/GapcloserDianaR.cs new file mode 100644 index 00000000..af8cd097 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserDianaR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Diana R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "dianateleport")] + public class GapcloserDianaR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserDianaR() + : base("Diana", GapcloserType.Targeted, SpellSlot.R, "dianateleport") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserEkkoE.cs b/source/AntiGapcloser/GapcloserData/GapcloserEkkoE.cs new file mode 100644 index 00000000..664c0343 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserEkkoE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Ekko E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "ekkoeattack")] + public class GapcloserEkkoE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserEkkoE() + : base("Ekko", GapcloserType.Targeted, SpellSlot.E, "ekkoeattack") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserEliseE.cs b/source/AntiGapcloser/GapcloserData/GapcloserEliseE.cs new file mode 100644 index 00000000..eef155f4 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserEliseE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Elise E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "elisespideredescent")] + public class GapcloserEliseE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserEliseE() + : base("Elise", GapcloserType.Targeted, SpellSlot.E, "elisespideredescent") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserFioraQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserFioraQ.cs new file mode 100644 index 00000000..96f79e0c --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserFioraQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Fiora Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "fioraq")] + public class GapcloserFioraQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserFioraQ() + : base("Fiora", GapcloserType.Skillshot, SpellSlot.Q, "fioraq") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserFizzQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserFizzQ.cs new file mode 100644 index 00000000..b4ae7a12 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserFizzQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Fizz Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "fizzpiercingstrike")] + public class GapcloserFizzQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserFizzQ() + : base("Fizz", GapcloserType.Targeted, SpellSlot.Q, "fizzpiercingstrike") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserGnarE.cs b/source/AntiGapcloser/GapcloserData/GapcloserGnarE.cs new file mode 100644 index 00000000..1d93ebc3 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserGnarE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Gnar E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "gnarbige")] + public class GapcloserGnarE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserGnarE() + : base("Gnar", GapcloserType.Skillshot, SpellSlot.E, "gnarbige") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserGragasE.cs b/source/AntiGapcloser/GapcloserData/GapcloserGragasE.cs new file mode 100644 index 00000000..0b80448a --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserGragasE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Gragas E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "gragase")] + public class GapcloserGragasE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserGragasE() + : base("Gragas", GapcloserType.Skillshot, SpellSlot.E, "gragase") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserGravesE.cs b/source/AntiGapcloser/GapcloserData/GapcloserGravesE.cs new file mode 100644 index 00000000..7d696685 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserGravesE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Graves E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "gravesmove")] + public class GapcloserGravesE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserGravesE() + : base("Graves", GapcloserType.Skillshot, SpellSlot.E, "gravesmove") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserHecarimR.cs b/source/AntiGapcloser/GapcloserData/GapcloserHecarimR.cs new file mode 100644 index 00000000..e8fb18b9 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserHecarimR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Hecarim R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "hecarimult")] + public class GapcloserHecarimR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserHecarimR() + : base("Hecarim", GapcloserType.Skillshot, SpellSlot.R, "hecarimult") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserIllaoiW.cs b/source/AntiGapcloser/GapcloserData/GapcloserIllaoiW.cs new file mode 100644 index 00000000..97d74270 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserIllaoiW.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Illaoi W gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "illaoiwattack")] + public class GapcloserIllaoiW : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserIllaoiW() + : base("Illaoi", GapcloserType.Targeted, SpellSlot.W, "illaoiwattack") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserIreliaQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserIreliaQ.cs new file mode 100644 index 00000000..4aacae7b --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserIreliaQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Irelia Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "ireliagatotsu")] + public class GapcloserIreliaQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserIreliaQ() + : base("Irelia", GapcloserType.Targeted, SpellSlot.Q, "ireliagatotsu") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserJarvanIVQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserJarvanIVQ.cs new file mode 100644 index 00000000..97f6faef --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserJarvanIVQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The JarvanIV Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "jarvanivdragonstrike")] + public class GapcloserJarvanIVQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserJarvanIVQ() + : base("JarvanIV", GapcloserType.Skillshot, SpellSlot.Q, "jarvanivdragonstrike") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserJaxQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserJaxQ.cs new file mode 100644 index 00000000..6cb31405 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserJaxQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Jax Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "jaxleapstrike")] + public class GapcloserJaxQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserJaxQ() + : base("Jax", GapcloserType.Targeted, SpellSlot.Q, "jaxleapstrike") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserJayceQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserJayceQ.cs new file mode 100644 index 00000000..f8af7d68 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserJayceQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Jayce Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "jaycetotheskies")] + public class GapcloserJayceQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserJayceQ() + : base("Jayce", GapcloserType.Targeted, SpellSlot.Q, "jaycetotheskies") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserKassadinR.cs b/source/AntiGapcloser/GapcloserData/GapcloserKassadinR.cs new file mode 100644 index 00000000..42bc6cda --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserKassadinR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Kassadin R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "riftwalk")] + public class GapcloserKassadinR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserKassadinR() + : base("Kassadin", GapcloserType.Skillshot, SpellSlot.R, "riftwalk") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserKhazixE.cs b/source/AntiGapcloser/GapcloserData/GapcloserKhazixE.cs new file mode 100644 index 00000000..5b512da2 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserKhazixE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Khazix E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "khazixelong")] + public class GapcloserKhazixE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserKhazixE() + : base("Khazix", GapcloserType.Skillshot, SpellSlot.E, "khazixelong") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserLeBlancR.cs b/source/AntiGapcloser/GapcloserData/GapcloserLeBlancR.cs new file mode 100644 index 00000000..82a612d9 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserLeBlancR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The LeBlanc R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "leblancslidem")] + public class GapcloserLeBlancR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserLeBlancR() + : base("LeBlanc", GapcloserType.Skillshot, SpellSlot.R, "leblancslidem") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserLeeSinQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserLeeSinQ.cs new file mode 100644 index 00000000..9171f9a1 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserLeeSinQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The LeeSin Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "blindmonkqtwo")] + public class GapcloserLeeSinQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserLeeSinQ() + : base("LeeSin", GapcloserType.Targeted, SpellSlot.Q, "blindmonkqtwo") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserLeonaE.cs b/source/AntiGapcloser/GapcloserData/GapcloserLeonaE.cs new file mode 100644 index 00000000..1d6c42c0 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserLeonaE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Leona E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "leonazenithblade")] + public class GapcloserLeonaE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserLeonaE() + : base("Leona", GapcloserType.Skillshot, SpellSlot.E, "leonazenithblade") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserLucianE.cs b/source/AntiGapcloser/GapcloserData/GapcloserLucianE.cs new file mode 100644 index 00000000..8385b069 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserLucianE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Lucian E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "luciane")] + public class GapcloserLucianE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserLucianE() + : base("Lucian", GapcloserType.Skillshot, SpellSlot.E, "luciane") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserMalphiteR.cs b/source/AntiGapcloser/GapcloserData/GapcloserMalphiteR.cs new file mode 100644 index 00000000..da67f615 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserMalphiteR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Malphite R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "ufslash")] + public class GapcloserMalphiteR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserMalphiteR() + : base("Malphite", GapcloserType.Skillshot, SpellSlot.R, "ufslash") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserMasterYiQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserMasterYiQ.cs new file mode 100644 index 00000000..31e12abb --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserMasterYiQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The MasterYi Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "alphastrike")] + public class GapcloserMasterYiQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserMasterYiQ() + : base("MasterYi", GapcloserType.Targeted, SpellSlot.Q, "alphastrike") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserMonkeyKingE.cs b/source/AntiGapcloser/GapcloserData/GapcloserMonkeyKingE.cs new file mode 100644 index 00000000..5de8deac --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserMonkeyKingE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The MonkeyKing E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "monkeykingnimbus")] + public class GapcloserMonkeyKingE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserMonkeyKingE() + : base("MonkeyKing", GapcloserType.Targeted, SpellSlot.E, "monkeykingnimbus") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserPantheonR.cs b/source/AntiGapcloser/GapcloserData/GapcloserPantheonR.cs new file mode 100644 index 00000000..eaa3bf81 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserPantheonR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Pantheon R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "pantheonrfall")] + public class GapcloserPantheonR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserPantheonR() + : base("Pantheon", GapcloserType.Skillshot, SpellSlot.R, "pantheonrfall") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserPoppyE.cs b/source/AntiGapcloser/GapcloserData/GapcloserPoppyE.cs new file mode 100644 index 00000000..39615b33 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserPoppyE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Poppy E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "poppyheroiccharge")] + public class GapcloserPoppyE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserPoppyE() + : base("Poppy", GapcloserType.Targeted, SpellSlot.E, "poppyheroiccharge") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserRenektonE.cs b/source/AntiGapcloser/GapcloserData/GapcloserRenektonE.cs new file mode 100644 index 00000000..8715730f --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserRenektonE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Renekton E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "renektonsliceanddice")] + public class GapcloserRenektonE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserRenektonE() + : base("Renekton", GapcloserType.Skillshot, SpellSlot.E, "renektonsliceanddice") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserRivenE.cs b/source/AntiGapcloser/GapcloserData/GapcloserRivenE.cs new file mode 100644 index 00000000..916b498b --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserRivenE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Riven E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "rivenfeint")] + public class GapcloserRivenE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserRivenE() + : base("Riven", GapcloserType.Skillshot, SpellSlot.E, "rivenfeint") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserSejuaniQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserSejuaniQ.cs new file mode 100644 index 00000000..23f3b006 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserSejuaniQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Sejuani Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "sejuaniarcticassault")] + public class GapcloserSejuaniQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserSejuaniQ() + : base("Sejuani", GapcloserType.Skillshot, SpellSlot.Q, "sejuaniarcticassault") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserShenE.cs b/source/AntiGapcloser/GapcloserData/GapcloserShenE.cs new file mode 100644 index 00000000..16898efb --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserShenE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Shen E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "shene")] + public class GapcloserShenE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserShenE() + : base("Shen", GapcloserType.Skillshot, SpellSlot.E, "shene") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserShyvanaR.cs b/source/AntiGapcloser/GapcloserData/GapcloserShyvanaR.cs new file mode 100644 index 00000000..c9f46887 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserShyvanaR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Shyvana R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "shyvanatransformcast")] + public class GapcloserShyvanaR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserShyvanaR() + : base("Shyvana", GapcloserType.Skillshot, SpellSlot.R, "shyvanatransformcast") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserTalonE.cs b/source/AntiGapcloser/GapcloserData/GapcloserTalonE.cs new file mode 100644 index 00000000..a0c0d0d9 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserTalonE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Talon E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "taloncutthroat")] + public class GapcloserTalonE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserTalonE() + : base("Talon", GapcloserType.Targeted, SpellSlot.E, "taloncutthroat") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserTristanaW.cs b/source/AntiGapcloser/GapcloserData/GapcloserTristanaW.cs new file mode 100644 index 00000000..835ca5a5 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserTristanaW.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Tristana W gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "rocketjump")] + public class GapcloserTristanaW : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserTristanaW() + : base("Tristana", GapcloserType.Skillshot, SpellSlot.W, "rocketjump") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserTryndamereE.cs b/source/AntiGapcloser/GapcloserData/GapcloserTryndamereE.cs new file mode 100644 index 00000000..ec663dea --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserTryndamereE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Tryndamere E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "slashcast")] + public class GapcloserTryndamereE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserTryndamereE() + : base("Tryndamere", GapcloserType.Skillshot, SpellSlot.E, "slashcast") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserViQ.cs b/source/AntiGapcloser/GapcloserData/GapcloserViQ.cs new file mode 100644 index 00000000..5d35c2cb --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserViQ.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Vi Q gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "viq")] + public class GapcloserViQ : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserViQ() + : base("Vi", GapcloserType.Skillshot, SpellSlot.Q, "viq") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserXinZhaoE.cs b/source/AntiGapcloser/GapcloserData/GapcloserXinZhaoE.cs new file mode 100644 index 00000000..56e849a6 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserXinZhaoE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The XinZhao E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "xenzhaosweep")] + public class GapcloserXinZhaoE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserXinZhaoE() + : base("XinZhao", GapcloserType.Targeted, SpellSlot.E, "xenzhaosweep") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserYasuoE.cs b/source/AntiGapcloser/GapcloserData/GapcloserYasuoE.cs new file mode 100644 index 00000000..103785b1 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserYasuoE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Yasuo E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "yasuodashwrapper")] + public class GapcloserYasuoE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserYasuoE() + : base("Yasuo", GapcloserType.Targeted, SpellSlot.E, "yasuodashwrapper") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserZacE.cs b/source/AntiGapcloser/GapcloserData/GapcloserZacE.cs new file mode 100644 index 00000000..ee98a633 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserZacE.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Zac E gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "zace")] + public class GapcloserZacE : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserZacE() + : base("Zac", GapcloserType.Skillshot, SpellSlot.E, "zace") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/GapcloserZedR.cs b/source/AntiGapcloser/GapcloserData/GapcloserZedR.cs new file mode 100644 index 00000000..f2034eb3 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/GapcloserZedR.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The Zed R gapcloser information. + /// + [Export(typeof(IGapcloser))] + [ExportMetadata("SpellName", "zedr")] + public class GapcloserZedR : Gapcloser + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public GapcloserZedR() + : base("Zed", GapcloserType.Targeted, SpellSlot.R, "zedr") + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/IGapcloser.cs b/source/AntiGapcloser/GapcloserData/IGapcloser.cs new file mode 100644 index 00000000..140a25ca --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/IGapcloser.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The gapcloser interface. + /// + public interface IGapcloser + { + #region Public Properties + + /// + /// Gets the champion name. + /// + string ChampionName { get; } + + /// + /// Gets the skill type. + /// + GapcloserType SkillType { get; } + + /// + /// Gets the spell slot. + /// + SpellSlot Slot { get; } + + /// + /// Gets the spell name. + /// + string SpellName { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserData/IGapcloserMetadata.cs b/source/AntiGapcloser/GapcloserData/IGapcloserMetadata.cs new file mode 100644 index 00000000..41ab18e8 --- /dev/null +++ b/source/AntiGapcloser/GapcloserData/IGapcloserMetadata.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The gapcloser metadata. + /// + public interface IGapcloserMetadata + { + #region Public Properties + + /// + /// Gets the spell name. + /// + string SpellName { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/AntiGapcloser/GapcloserType.cs b/source/AntiGapcloser/GapcloserType.cs new file mode 100644 index 00000000..2505915e --- /dev/null +++ b/source/AntiGapcloser/GapcloserType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The gapcloser types. + /// + public enum GapcloserType + { + /// + /// Skillshot. + /// + Skillshot, + + /// + /// Targeted. + /// + Targeted + } +} \ No newline at end of file diff --git a/source/Damage/Damage.cs b/source/Damage/Damage.cs new file mode 100644 index 00000000..1999ea99 --- /dev/null +++ b/source/Damage/Damage.cs @@ -0,0 +1,672 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + using LeagueSharp.Common.Data; + + /// + /// Damage calculations and data. + /// + [Export(typeof(Damage))] + public partial class Damage + { + #region Public Methods and Operators + + /// + /// Calculates the damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The damage type. + /// + /// + /// The amount. + /// + /// + /// The . + /// + public double CalculateDamage(Obj_AI_Base source, Obj_AI_Base target, DamageType damageType, double amount) + { + var damage = amount; + + switch (damageType) + { + case DamageType.Magical: + damage = this.CalculateMagicDamage(source, target, amount); + break; + case DamageType.Physical: + damage = this.CalculatePhysicalDamage(source, target, amount); + break; + } + + return Math.Max(damage, 0d); + } + + /// + /// Gets the auto attack damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// A value indicating whether to include the passive. + /// + /// + /// The . + /// + public double GetAutoAttackDamage(Obj_AI_Base source, Obj_AI_Base target, bool includePassive = false) + { + double result = source.TotalAttackDamage; + var k = 1d; + if (source.CharData.BaseSkinName == "Kalista") + { + k = 0.9d; + } + if (source.CharData.BaseSkinName == "Kled" + && ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Name == "KledRiderQ") + { + k = 0.8d; + } + + if (!includePassive) + { + return this.CalculatePhysicalDamage(source, target, result * k); + } + + var reduction = 0d; + + var hero = source as Obj_AI_Hero; + if (hero != null) + { + // Spoils of War + var minionTarget = target as Obj_AI_Minion; + if (hero.IsMelee() && minionTarget != null && minionTarget.IsEnemy + && minionTarget.Team != GameObjectTeam.Neutral + && hero.Buffs.Any(buff => buff.Name == "talentreaperdisplay" && buff.Count > 0)) + { + if ( + HeroManager.AllHeroes.Any( + h => + h.NetworkId != source.NetworkId && h.Team == source.Team + && h.Distance(minionTarget.Position) < 1100)) + { + var value = 0; + + if (Items.HasItem(3302, hero)) + { + value = 200; // Relic Shield + } + else if (Items.HasItem(3097, hero)) + { + value = 240; // Targon's Brace + } + else if (Items.HasItem(3401, hero)) + { + value = 400; // Face of the Mountain + } + + return value + hero.TotalAttackDamage; + } + } + + // Champions passive damages: + result += (from passiveDamage in this.PassiveLazies + where + passiveDamage.Metadata.ChampionName == string.Empty + || passiveDamage.Metadata.ChampionName == hero.ChampionName + where passiveDamage.Value.IsActive(hero, target) + select passiveDamage.Value.GetDamage(hero, target)).Sum(); + + // BotRK + if (Items.HasItem(3153, hero)) + { + var d = 0.06 * target.Health; + if (target is Obj_AI_Minion) + { + d = Math.Min(d, 60); + } + + result += d; + } + } + + var targetHero = target as Obj_AI_Hero; + if (targetHero != null) + { + // Ninja tabi + if (Items.HasItem(3047, targetHero)) + { + k *= 0.9d; + } + + // Nimble Fighter + if (targetHero.ChampionName == "Fizz") + { + var f = new int[] { 4, 6, 8, 10, 12, 14 }; + reduction += f[(targetHero.Level - 1) / 3]; + } + } + + //TODO: need to check if there are items or spells in game that reduce magical dmg % or by amount + if (hero != null && hero.ChampionName == "Corki") + { + return this.CalculateMixedDamage(source, target, (result - reduction) * k, result * k); + } + + return this.CalculatePhysicalDamage( + source, + target, + (result - reduction) * k + PassiveFlatMod(source, target)); + } + + /// + /// Calculates the combo damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell combo. + /// + /// + /// The . + /// + public double GetComboDamage(Obj_AI_Hero source, Obj_AI_Base target, IEnumerable spellCombo) + => this.GetComboDamage(source, target, spellCombo.Select(s => Tuple.Create(s, 0)).ToArray()); + + /// + /// Calculates the combo damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell combo. + /// + /// + /// The . + /// + public double GetComboDamage( + Obj_AI_Hero source, + Obj_AI_Base target, + IEnumerable> spellCombo) + => spellCombo.Sum(s => this.GetSpellDamage(source, target, s.Item1, s.Item2)); + + /// + /// Calculates the spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell name. + /// + /// + /// The . + /// + public double GetSpellDamage(Obj_AI_Base source, Obj_AI_Base target, string spellName) + => this.GetDamageSpell(source, target, spellName)?.CalculatedDamage ?? 0d; + + /// + /// Calculates the spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The slot. + /// + /// + /// The stage. + /// + /// + /// The . + /// + public double GetSpellDamage(Obj_AI_Hero source, Obj_AI_Base target, SpellSlot slot, int stage = 0) + => this.GetDamageSpell(source, target, slot, stage)?.CalculatedDamage ?? 0d; + + /// + /// Determines if the target is killable by source. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell combo. + /// + /// + /// The . + /// + public bool IsKillable(Obj_AI_Hero source, Obj_AI_Base target, IEnumerable> spellCombo) + => this.GetComboDamage(source, target, spellCombo) >= target.Health; + + #endregion + + #region Methods + + private static double DamageReductionMod( + Obj_AI_Base source, + Obj_AI_Base target, + double amount, + DamageType damageType) + { + if (source is Obj_AI_Hero) + { + // Exhaust: + // + Exhausts target enemy champion, reducing their Movement Speed and Attack Speed by 30%, their Armor and Magic Resist by 10, and their damage dealt by 40% for 2.5 seconds. + if (source.HasBuff("Exhaust")) + { + amount *= 0.6d; + } + + // Lament + // + Phantom Dancer reduces all damage dealt to attacker (if he's attack you) by 12% + if (source.HasBuff("itemphantomdancerdebuff")) + { + var caster = source.GetBuff("itemphantomdancerdebuff").Caster; + if (caster.NetworkId == target.NetworkId) + { + amount *= 0.88d; + } + } + } + + var targetHero = target as Obj_AI_Hero; + if (targetHero != null) + { + //Damage Reduction Masteries + + //DAMAGE REDUCTION 2 %, increasing to 8 % when near at least one allied champion + //IN THIS TOGETHER 8 % of the damage that the nearest allied champion would take is dealt to you instead.This can't bring you below 15% health. + var BondofStones = targetHero.GetMastery(MasteryData.Resolve.BondofStones); + if (BondofStones != null && BondofStones.IsActive()) + { + var closebyenemies = + HeroManager.Enemies.Any(x => x.NetworkId != target.NetworkId && x.Distance(target) <= 500); + //500 is not the real value + if (closebyenemies) + { + amount *= 0.92d; + } + else + { + amount *= 0.98d; + } + } + + // Items: + + // Doran's Shield + // + Blocks 8 damage from single target attacks and spells from champions. + if (Items.HasItem(1054, targetHero)) + { + amount -= 8; + } + + // Passives: + + // Unbreakable Will + // + Alistar removes all crowd control effects from himself, then gains additional attack damage and takes 70% reduced physical and magic damage for 7 seconds. + if (target.HasBuff("Ferocious Howl")) + { + amount *= 0.3d; + } + + // Tantrum + // + Amumu takes reduced physical damage from basic attacks and abilities. + if (target.HasBuff("Tantrum") && damageType == DamageType.Physical) + { + amount -= new[] { 2, 4, 6, 8, 10 }[target.Spellbook.GetSpell(SpellSlot.E).Level - 1]; + } + + // Unbreakable + // + Grants Braum 30% / 32.5% / 35% / 37.5% / 40% damage reduction from oncoming sources (excluding true damage and towers) for 3 / 3.25 / 3.5 / 3.75 / 4 seconds. + // + The damage reduction is increased to 100% for the first source of champion damage that would be reduced. + if (target.HasBuff("BraumShieldRaise")) + { + amount -= amount + * new[] { 0.3d, 0.325d, 0.35d, 0.375d, 0.4d }[ + target.Spellbook.GetSpell(SpellSlot.E).Level - 1]; + } + + // Idol of Durand + // + Galio becomes a statue and channels for 2 seconds, Taunt icon taunting nearby foes and reducing incoming physical and magic damage by 50%. + if (target.HasBuff("GalioIdolOfDurand")) + { + amount *= 0.5d; + } + + // Courage + // + Garen gains a defensive shield for a few seconds, reducing incoming damage by 30% and granting 30% crowd control reduction for the duration. + if (target.HasBuff("GarenW")) + { + amount *= 0.7d; + } + + // Drunken Rage + // + Gragas takes a long swig from his barrel, disabling his ability to cast or attack for 1 second and then receives 10% / 12% / 14% / 16% / 18% reduced damage for 3 seconds. + if (target.HasBuff("GragasWSelf")) + { + amount -= amount + * new[] { 0.1d, 0.12d, 0.14d, 0.16d, 0.18d }[ + target.Spellbook.GetSpell(SpellSlot.W).Level - 1]; + } + + // Void Stone + // + Kassadin reduces all magic damage taken by 15%. + if (target.HasBuff("VoidStone") && damageType == DamageType.Magical) + { + amount *= 0.85d; + } + + // Shunpo + // + Katarina teleports to target unit and gains 15% damage reduction for 1.5 seconds. If the target is an enemy, the target takes magic damage. + if (target.HasBuff("KatarinaEReduction")) + { + amount *= 0.85d; + } + + // Vengeful Maelstrom + // + Maokai creates a magical vortex around himself, protecting him and allied champions by reducing damage from non-turret sources by 20% for a maximum of 10 seconds. + if (target.HasBuff("MaokaiDrainDefense") && !(source is Obj_AI_Turret)) + { + amount *= 0.8d; + } + + // Meditate + // + Master Yi channels for up to 4 seconds, restoring health each second. This healing is increased by 1% for every 1% of his missing health. Meditate also resets the autoattack timer. + // + While channeling, Master Yi reduces incoming damage (halved against turrets). + if (target.HasBuff("Meditate")) + { + amount -= amount + * new[] { 0.5d, 0.55d, 0.6d, 0.65d, 0.7d }[ + target.Spellbook.GetSpell(SpellSlot.W).Level - 1] / (source is Obj_AI_Turret ? 2 : 1); + } + + // Shadow Dash + // + Shen reduces all physical damage by 50% from taunted enemies. + if (target.HasBuff("Shen Shadow Dash") && source.HasBuff("Taunt") && damageType == DamageType.Physical) + { + amount *= 0.5d; + } + } + return amount; + } + + private static double PassiveFlatMod(Obj_AI_Base source, Obj_AI_Base target) + { + var value = 0d; + var hero = source as Obj_AI_Hero; + var targetHero = target as Obj_AI_Hero; + // Offensive masteries: + + //Fervor of Battle: STACKTIVATE Your basic attacks and spells give you stacks of Fervor for 5 seconds, stacking 10 times. Each stack of Fervor adds 1-8 bonus physical damage to your basic attacks against champions, based on your level. + if (targetHero != null && hero != null) + { + var Fervor = hero.GetMastery(MasteryData.Ferocity.FervorofBattle); + if (Fervor != null && Fervor.IsActive()) + { + value += (0.9 + hero.Level * 0.42) * hero.GetBuffCount("MasteryOnHitDamageStacker"); + } + } + + // Defensive masteries: + + //Tough Skin DIRT OFF YOUR SHOULDERS You take 2 less damage from champion and monster basic attacks + if (targetHero != null && (source is Obj_AI_Hero || source is Obj_AI_Minion)) + { + var Toughskin = targetHero.GetMastery(MasteryData.Resolve.ToughSkin); + if (Toughskin != null && Toughskin.IsActive()) + { + value -= 2; + } + } + + return value; + } + + private static double PassivePercentMod(Obj_AI_Base source, Obj_AI_Base target, double amount) + { + var SiegeMinionList = new List { "Red_Minion_MechCannon", "Blue_Minion_MechCannon" }; + var NormalMinionList = new List + { + "Red_Minion_Wizard", "Blue_Minion_Wizard", "Red_Minion_Basic", + "Blue_Minion_Basic" + }; + + //Minions and towers passives: + if (source is Obj_AI_Turret) + { + //Siege minions receive 70% damage from turrets + if (SiegeMinionList.Contains(target.CharData.BaseSkinName)) + { + amount *= 0.7d; + } + + //Normal minions take 114% more damage from towers. + else if (NormalMinionList.Contains(target.CharData.BaseSkinName)) + { + amount *= 1.14285714285714d; + } + } + + // Masteries: + var hero = source as Obj_AI_Hero; + var targetHero = target as Obj_AI_Hero; + if (hero != null) + { + // Offensive masteries: + + //INCREASED DAMAGE FROM ABILITIES 0.4/0.8/1.2/1.6/2% + /* + Mastery sorcery = hero.GetMastery(Ferocity.Sorcery); + if (sorcery != null && sorcery.IsActive()) + { + amount *= 1 + ((new double[] { 0.4, 0.8, 1.2, 1.6, 2.0 }[sorcery.Points]) / 100); + } /* + + //MELEE Deal an additional 3 % damage, but receive an additional 1.5 % damage + //RANGED Deal an additional 2 % damage, but receive an additional 2 % damage + Mastery DoubleEdgedSword = hero.GetMastery(Ferocity.DoubleEdgedSword); + if (DoubleEdgedSword != null && DoubleEdgedSword.IsActive()) + { + amount *= hero.IsMelee() ? 1.03 : 1.02; + } + + /* Bounty Hunter: TAKING NAMES You gain a permanent 1 % damage increase for each unique enemy champion you kill + Mastery BountyHunter = hero.GetMastery(Ferocity.BountyHunter); + if (BountyHunter != null && BountyHunter.IsActive()) + { + //We need a hero.UniqueChampionsKilled or both the sender and the target for ChampionKilled OnNotify Event + // amount += amount * Math.Min(hero.ChampionsKilled, 5); + } */ + + //Opressor: KICK 'EM WHEN THEY'RE DOWN You deal 2.5% increased damage to targets with impaired movement (slows, stuns, taunts, etc) + var Opressor = hero.GetMastery(MasteryData.Ferocity.Oppresor); + if (targetHero != null && Opressor != null && Opressor.IsActive() && targetHero.IsMovementImpaired()) + { + amount *= 1.025; + } + + //Merciless DAMAGE AMPLIFICATION 1 / 2 / 3 / 4 / 5 % increased damage to champions below 40 % health + if (targetHero != null) + { + var Merciless = hero.GetMastery(MasteryData.Cunning.Merciless); + if (Merciless != null && Merciless.IsActive() && targetHero.HealthPercent < 40) + { + amount *= 1 + Merciless.Points / 100f; + } + } + + //Thunderlord's Decree: RIDE THE LIGHTNING Your 3rd ability or basic attack on an enemy champion shocks them, dealing 10 - 180(+0.2 bonus attack damage)(+0.1 ability power) magic damage in an area around them + if (false) + // Need a good way to check if it is 3rd attack (Use OnProcessSpell/SpellBook.OnCast if have to) + { + var Thunder = hero.GetMastery(MasteryData.Cunning.ThunderlordsDecree); + if (Thunder != null && Thunder.IsActive()) + { + // amount += 10 * hero.Level + (0.2 * hero.FlatPhysicalDamageMod) + (0.1 * hero.TotalMagicalDamage); + } + } + } + + if (targetHero != null) + { + // Defensive masteries: + + // Double edge sword: + //MELEE Deal an additional 3 % damage, but receive an additional 1.5 % damage + //RANGED Deal an additional 2 % damage, but receive an additional 2 % damage + var des = targetHero.GetMastery(MasteryData.Ferocity.DoubleEdgedSword); + if (des != null && des.IsActive()) + { + amount *= targetHero.IsMelee() ? 1.015d : 1.02d; + } + } + + return amount; + } + + private double CalculateMagicDamage(Obj_AI_Base source, Obj_AI_Base target, double amount) + { + var magicResist = target.SpellBlock; + + // Penetration can't reduce magic resist below 0. + double value; + + if (magicResist < 0) + { + value = 2 - 100 / (100 - magicResist); + } + else if ((magicResist * source.PercentMagicPenetrationMod) - source.FlatMagicPenetrationMod < 0) + { + value = 1; + } + else + { + value = 100 / (100 + (magicResist * source.PercentMagicPenetrationMod) - source.FlatMagicPenetrationMod); + } + + var damage = DamageReductionMod( + source, + target, + PassivePercentMod(source, target, value) * amount, + DamageType.Magical); + + return damage; + } + + private double CalculateMixedDamage( + Obj_AI_Base source, + Obj_AI_Base target, + double amountPhysical, + double amountMagic, + int magic = 50, + int physical = 50, + int trueDmg = 0) + { + return this.CalculateMagicDamage(source, target, (amountMagic * magic) / 100) + + this.CalculatePhysicalDamage(source, target, (amountPhysical * physical) / 100) + + PassiveFlatMod(source, target) + (amountMagic * trueDmg) / 100; + } + + private double CalculatePhysicalDamage(Obj_AI_Base source, Obj_AI_Base target, double amount) + { + double armorPenetrationPercent = source.PercentArmorPenetrationMod; + double armorPenetrationFlat = source.FlatArmorPenetrationMod; + double bonusArmorPenetrationMod = source.PercentBonusArmorPenetrationMod; + + // Minions return wrong percent values. + if (source is Obj_AI_Minion) + { + armorPenetrationFlat = 0d; + armorPenetrationPercent = 1d; + bonusArmorPenetrationMod = 1d; + } + + // Turrets too. + if (source is Obj_AI_Turret) + { + armorPenetrationFlat = 0d; + armorPenetrationPercent = 1d; + bonusArmorPenetrationMod = 1d; + } + + if (source is Obj_AI_Turret) + { + if (target is Obj_AI_Minion) + { + amount *= 1.25; + if (target.CharData.BaseSkinName.EndsWith("MinionSiege")) + { + amount *= 0.7; + } + + return amount; + } + } + + // Penetration can't reduce armor below 0. + var armor = target.Armor; + var bonusArmor = target.Armor - target.CharData.Armor; + + double value; + if (armor < 0) + { + value = 2 - 100 / (100 - armor); + } + else if ((armor * armorPenetrationPercent) - (bonusArmor * (1 - bonusArmorPenetrationMod)) - armorPenetrationFlat + < 0) + { + value = 1; + } + else + { + value = 100 + / (100 + (armor * armorPenetrationPercent) - (bonusArmor * (1 - bonusArmorPenetrationMod)) + - armorPenetrationFlat); + } + + var damage = DamageReductionMod( + source, + target, + PassivePercentMod(source, target, value) * amount, + DamageType.Physical); + + // Take into account the percent passives, flat passives and damage reduction. + return damage; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageExtensions.cs b/source/Damage/DamageExtensions.cs new file mode 100644 index 00000000..76b2a222 --- /dev/null +++ b/source/Damage/DamageExtensions.cs @@ -0,0 +1,237 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + + using BaseAI = Obj_AI_Base; + using HeroAI = Obj_AI_Hero; + using SpellCombo = System.Collections.Generic.IEnumerable>; + + /// + /// The damage extensions. + /// + public static class DamageExtensions + { + #region Properties + + private static Damage Instance => Instances.Damage; + + #endregion + + #region Public Methods and Operators + + /// + /// Calculates the damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The damage type. + /// + /// + /// The amount. + /// + /// + /// The . + /// + public static double CalcDamage(this BaseAI source, BaseAI target, Damage.DamageType damageType, double amount) + => Instance?.CalculateDamage(source, target, damageType, amount) ?? 0d; + + /// + /// Gets the auto attack damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// A value indicating whether to include the passive. + /// + /// + /// The . + /// + public static double GetAutoAttackDamage(this BaseAI source, BaseAI target, bool includePassive = false) + => Instance?.GetAutoAttackDamage(source, target, includePassive) ?? 0d; + + /// + /// Calculates the combo damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell combo. + /// + /// + /// The . + /// + public static double GetComboDamage(this HeroAI source, BaseAI target, IEnumerable spellCombo) + => Instance?.GetComboDamage(source, target, spellCombo) ?? 0d; + + /// + /// Calculates the combo damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell combo. + /// + /// + /// The . + /// + public static double GetComboDamage(this HeroAI source, BaseAI target, SpellCombo spellCombo) + => Instance?.GetComboDamage(source, target, spellCombo) ?? 0d; + + /// + /// Gets the damage spell. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell name. + /// + /// + /// The + /// + public static DamageSpell GetDamageSpell(this BaseAI source, BaseAI target, string spellName) + => Instance?.GetDamageSpell(source, target, spellName); + + /// + /// Gets the damage spell. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The slot. + /// + /// + /// The stage. + /// + /// + /// The + /// + public static DamageSpell GetDamageSpell(this HeroAI source, BaseAI target, SpellSlot slot, int stage = 0) + => Instance?.GetDamageSpell(source, target, slot, stage); + + /// + /// Calculates the item damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The item. + /// + /// + /// The . + /// + public static double GetItemDamage(this HeroAI source, BaseAI target, Damage.DamageItems item) + => Instance?.GetItemDamage(source, target, item) ?? 0d; + + /// + /// Calculates the spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell name. + /// + /// + /// The . + /// + public static double GetSpellDamage(this BaseAI source, BaseAI target, string spellName) + => Instance?.GetSpellDamage(source, target, spellName) ?? 0d; + + /// + /// Calculates the spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The slot. + /// + /// + /// The stage. + /// + /// + /// The . + /// + public static double GetSpellDamage(this HeroAI source, BaseAI target, SpellSlot slot, int stage = 0) + => Instance?.GetSpellDamage(source, target, slot, stage) ?? 0d; + + /// + /// Calculates the summoner spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The summoner spell. + /// + /// + /// The . + /// + public static double GetSummonerSpellDamage( + this HeroAI source, + BaseAI target, + Damage.SummonerSpell summonerSpell) => Instance?.GetSummonerSpellDamage(source, target, summonerSpell) ?? 0d; + + /// + /// Determines if the target is killable by source. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell combo. + /// + /// + /// The . + /// + public static bool IsKillable(this HeroAI source, BaseAI target, SpellCombo spellCombo) + => Instance?.IsKillable(source, target, spellCombo) ?? false; + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems.cs b/source/Damage/DamageItems.cs new file mode 100644 index 00000000..bf716fc7 --- /dev/null +++ b/source/Damage/DamageItems.cs @@ -0,0 +1,255 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + using JetBrains.Annotations; + + using LeagueSharp.Common.DamageItems; + + /// + /// Damage calculations and data. + /// + public partial class Damage + { + #region Enums + + /// + /// Damaging item types. + /// + public enum DamageItems + { + /// + /// Hextech Gunblade + /// + Hexgun, + + /// + /// Death Fire Grasp + /// + [Obsolete("Removed from the game.")] + Dfg, + + /// + /// Blade of the Ruined King + /// + Botrk, + + /// + /// Bilgewater + /// + Bilgewater, + + /// + /// Tiamat + /// + Tiamat, + + /// + /// Hydra + /// + Hydra, + + /// + /// Black Fire Torch + /// + [Obsolete("Removed from the game.")] + BlackFireTorch, + + /// + /// Oding Veils + /// + [Obsolete("Removed from the game.")] + OdingVeils, + + /// + /// Frost Queen Claims + /// + [Obsolete("Active changed, no longer deals damage.")] + FrostQueenClaim, + + /// + /// Liandrys Torment + /// + LiandrysTorment, + + /// + /// Hextech GLP-2000 + /// + HextechGLP, + + /// + /// Titanic Hydra + /// + TitanicHydra, + + /// + /// Hextech Protobelt-01 + /// + HextechProtobelt, + + /// + /// Wit's End + /// + WitsEnd, + + /// + /// Trinity Force + /// + TrinityForce, + + /// + /// Sunfire Cape + /// + SunfireCape, + + /// + /// Statikk Shiv + /// + StatikkShiv, + + /// + /// Sheen + /// + Sheen, + + /// + /// Serrated Dirk + /// + SerratedDirk, + + /// + /// Runaan's Hurricane + /// + RunaansHurricane, + + /// + /// Recurve Bow + /// + RecurveBow, + + /// + /// Rapid Firecannon + /// + RapidFirecannon, + + /// + /// Muramana + /// + Muramana, + + /// + /// Lord Van Damm's Pillager + /// + LordVanDammsPillager, + + /// + /// Lich Bane + /// + LichBane, + + /// + /// Kirchei's Shard + /// + KircheisShard, + + /// + /// Iceborn Gauntlet + /// + IcebornGauntlet, + + /// + /// Duskblade of Draktharr + /// + Duskblade, + + /// + /// Bami's Cinder + /// + BamisCinder + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the items. + /// + [ImportMany] + public IEnumerable> ItemLazies { get; protected set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Calculates the item damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The item. + /// + /// + /// The raw damage type. + /// + /// + /// The . + /// + public double GetItemDamage( + [NotNull] Obj_AI_Hero source, + [NotNull] Obj_AI_Base target, + DamageItems item, + ItemDamageType type = ItemDamageType.Default) + { + var value = 0d; + var damage = this.GetItemDamage(item); + + if (damage != null) + { + if (type.HasFlag(ItemDamageType.Default)) + { + value += damage.GetDamage(source, target); + } + + if (type.HasFlag(ItemDamageType.Dot)) + { + value += damage.GetDotDamage(source, target); + } + + if (type.HasFlag(ItemDamageType.Passive)) + { + value += damage.GetPassiveDamage(source, target); + } + } + + return value; + } + + /// + /// Retrieves the item damage from the lazy collection. + /// + /// + /// The item. + /// + /// + /// The . + /// + [CanBeNull] + public IDamageItem GetItemDamage(DamageItems item) + => this.ItemLazies.FirstOrDefault(i => i.Metadata.Item == item)?.Value; + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageBamisCinder.cs b/source/Damage/DamageItems/DamageBamisCinder.cs new file mode 100644 index 00000000..a6e456e2 --- /dev/null +++ b/source/Damage/DamageItems/DamageBamisCinder.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Bami's Cinder item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.BamisCinder)] + public class DamageBamisCinder : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBamisCinder() + { + this.ItemId = 3751; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + var value = 5 + (1 * source.Level); + return target is Obj_AI_Minion ? value * 1.5 : value; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageBilgewaterCutlass.cs b/source/Damage/DamageItems/DamageBilgewaterCutlass.cs new file mode 100644 index 00000000..119fbb4d --- /dev/null +++ b/source/Damage/DamageItems/DamageBilgewaterCutlass.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Bilgewater Cutlass item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Bilgewater)] + public class DamageBilgewaterCutlass : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBilgewaterCutlass() + { + this.ItemId = 3144; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return 100; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageBotRK.cs b/source/Damage/DamageItems/DamageBotRK.cs new file mode 100644 index 00000000..4f39a5d5 --- /dev/null +++ b/source/Damage/DamageItems/DamageBotRK.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Blade of the Ruined King item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Botrk)] + public class DamageBotRK : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBotRK() + { + this.ItemId = 3153; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return Math.Max(100, .1 * target.MaxHealth); + } + + /// + public override double GetPassiveDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + var value = Math.Max(10, .06 * target.Health); + if (target is Obj_AI_Minion) + { + return Math.Min(60, value); + } + + return value; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageDuskblade.cs b/source/Damage/DamageItems/DamageDuskblade.cs new file mode 100644 index 00000000..8024f833 --- /dev/null +++ b/source/Damage/DamageItems/DamageDuskblade.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Duskblade of Draktharr item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Duskblade)] + public class DamageDuskblade : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDuskblade() + { + this.ItemId = 3147; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + var item = source.InventoryItems.FirstOrDefault(i => (int)i.Id == this.ItemId); + if (item == null) + { + return 0; + } + + return source.Spellbook.GetSpell(item.SpellSlot)?.IsReady() ?? false + ? 90 + ((target.MaxHealth - target.Health) * .25) + : 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageHexgun.cs b/source/Damage/DamageItems/DamageHexgun.cs new file mode 100644 index 00000000..42750d00 --- /dev/null +++ b/source/Damage/DamageItems/DamageHexgun.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Hextech Gunblade item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Hexgun)] + public class DamageHexgun : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHexgun() + { + this.ItemId = 3146; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return 250 + (.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageHextechGLP.cs b/source/Damage/DamageItems/DamageHextechGLP.cs new file mode 100644 index 00000000..adef49e4 --- /dev/null +++ b/source/Damage/DamageItems/DamageHextechGLP.cs @@ -0,0 +1,41 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Hextech GLP-800 item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.HextechGLP)] + public class DamageHextechGLP : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHextechGLP() + { + this.ItemId = 3030; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + new[] { 100, 106, 112, 118, 124, 130, 136, 141, 147, 153, 159, 165, 171, 176, 182, 188, 194, 200 }[ + source.Level - 1] + (.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageHextechProtobelt.cs b/source/Damage/DamageItems/DamageHextechProtobelt.cs new file mode 100644 index 00000000..d68f083a --- /dev/null +++ b/source/Damage/DamageItems/DamageHextechProtobelt.cs @@ -0,0 +1,41 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Hextech Protobelt-01 item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.HextechProtobelt)] + public class DamageHextechProtobelt : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHextechProtobelt() + { + this.ItemId = 3152; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + new[] { 75, 79, 83, 88, 92, 97, 101, 106, 110, 115, 119, 124, 128, 132, 137, 141, 146, 150 }[ + source.Level - 1] + (.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageIcebornGauntlet.cs b/source/Damage/DamageItems/DamageIcebornGauntlet.cs new file mode 100644 index 00000000..92839e3e --- /dev/null +++ b/source/Damage/DamageItems/DamageIcebornGauntlet.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Iceborn Gauntlet item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.IcebornGauntlet)] + public class DamageIcebornGauntlet : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageIcebornGauntlet() + { + this.ItemId = 3025; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("ItemFrozenFist") ? source.BaseAttackDamage : 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageItem.cs b/source/Damage/DamageItems/DamageItem.cs new file mode 100644 index 00000000..38eaeb09 --- /dev/null +++ b/source/Damage/DamageItems/DamageItem.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + /// + /// The damage item base class. + /// + public class DamageItem : IDamageItem + { + #region Public Properties + + /// + public Damage.DamageType DamageType { get; protected set; } + + /// + public bool IsDot { get; protected set; } + + /// + public int ItemId { get; protected set; } + + #endregion + + #region Public Methods and Operators + + /// + public virtual double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) => 0d; + + /// + public virtual double GetDotDamage(Obj_AI_Hero source, Obj_AI_Base target) => 0d; + + /// + public virtual double GetPassiveDamage(Obj_AI_Hero source, Obj_AI_Base target) => this.GetDamage(source, target); + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageKircheisShard.cs b/source/Damage/DamageItems/DamageKircheisShard.cs new file mode 100644 index 00000000..d0aa3e22 --- /dev/null +++ b/source/Damage/DamageItems/DamageKircheisShard.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Kircheis Shard item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.KircheisShard)] + public class DamageKircheisShard : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKircheisShard() + { + this.ItemId = 2015; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetBuff("ItemStatikShankCharge")?.Count == 100 ? 40 : 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageLiandrysTorment.cs b/source/Damage/DamageItems/DamageLiandrysTorment.cs new file mode 100644 index 00000000..16a17e43 --- /dev/null +++ b/source/Damage/DamageItems/DamageLiandrysTorment.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Liandry's Torment item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.LiandrysTorment)] + public class DamageLiandrysTorment : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLiandrysTorment() + { + this.ItemId = 3151; + this.IsDot = true; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return this.GetDotDamage(source, target) * 3; + } + + /// + public override double GetDotDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return .02 * target.Health; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageLichBane.cs b/source/Damage/DamageItems/DamageLichBane.cs new file mode 100644 index 00000000..1eb6631c --- /dev/null +++ b/source/Damage/DamageItems/DamageLichBane.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Lich Bane item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.LichBane)] + public class DamageLichBane : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLichBane() + { + this.ItemId = 3100; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("LichBane") ? (.75 * source.BaseAttackDamage) + (.5 * source.TotalMagicalDamage) : 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageLordVanDammsPillager.cs b/source/Damage/DamageItems/DamageLordVanDammsPillager.cs new file mode 100644 index 00000000..3522b857 --- /dev/null +++ b/source/Damage/DamageItems/DamageLordVanDammsPillager.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Lord Van Damm's Pillager item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.LordVanDammsPillager)] + public class DamageLordVanDammsPillager : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLordVanDammsPillager() + { + this.ItemId = 3104; + this.DamageType = Damage.DamageType.True; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return 0d; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageMuramana.cs b/source/Damage/DamageItems/DamageMuramana.cs new file mode 100644 index 00000000..be6732c1 --- /dev/null +++ b/source/Damage/DamageItems/DamageMuramana.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Muramana item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Muramana)] + public class DamageMuramana : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMuramana() + { + this.ItemId = 3042; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.Mana > source.MaxMana * .2 ? source.Mana * .06 : 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageRapidFirecannon.cs b/source/Damage/DamageItems/DamageRapidFirecannon.cs new file mode 100644 index 00000000..e75bcc5a --- /dev/null +++ b/source/Damage/DamageItems/DamageRapidFirecannon.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Rapid Firecannon item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.RapidFirecannon)] + public class DamageRapidFirecannon : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRapidFirecannon() + { + this.ItemId = 3094; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + if (source.GetBuff("ItemStatikShankCharge")?.Count == 100) + { + return + new[] { 50, 50, 50, 50, 50, 58, 66, 75, 83, 92, 100, 109, 117, 126, 134, 143, 151, 160 }[ + source.Level - 1]; + } + + return 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageRavenousHydra.cs b/source/Damage/DamageItems/DamageRavenousHydra.cs new file mode 100644 index 00000000..469c22f1 --- /dev/null +++ b/source/Damage/DamageItems/DamageRavenousHydra.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Ravenous Hydra item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Hydra)] + public class DamageRavenousHydra : DamageItem + { + #region Constants + + private const float Range = 400; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRavenousHydra() + { + this.ItemId = 3074; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (target.InRange((Range - 50) / 4) ? .2 : .6) * source.TotalAttackDamage; + } + + /// + public override double GetPassiveDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (target.InRange(Range / 4) ? .6 : 1) * source.TotalAttackDamage; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageRecurveBow.cs b/source/Damage/DamageItems/DamageRecurveBow.cs new file mode 100644 index 00000000..55e0a025 --- /dev/null +++ b/source/Damage/DamageItems/DamageRecurveBow.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Recurve Bow item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.RecurveBow)] + public class DamageRecurveBow : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRecurveBow() + { + this.ItemId = 1043; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return 15; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageRunaansHurricane.cs b/source/Damage/DamageItems/DamageRunaansHurricane.cs new file mode 100644 index 00000000..c46628cc --- /dev/null +++ b/source/Damage/DamageItems/DamageRunaansHurricane.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Runaan's Hurricane item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.RunaansHurricane)] + public class DamageRunaansHurricane : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRunaansHurricane() + { + this.ItemId = 3085; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.TotalAttackDamage * .25; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageSerratedDirk.cs b/source/Damage/DamageItems/DamageSerratedDirk.cs new file mode 100644 index 00000000..b8306081 --- /dev/null +++ b/source/Damage/DamageItems/DamageSerratedDirk.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Serrated Dirk item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.SerratedDirk)] + public class DamageSerratedDirk : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSerratedDirk() + { + this.ItemId = 3134; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return 15; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageSheen.cs b/source/Damage/DamageItems/DamageSheen.cs new file mode 100644 index 00000000..69329745 --- /dev/null +++ b/source/Damage/DamageItems/DamageSheen.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Sheen item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Sheen)] + public class DamageSheen : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSheen() + { + this.ItemId = 3057; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("sheen") ? source.BaseAttackDamage : 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageStatikkShiv.cs b/source/Damage/DamageItems/DamageStatikkShiv.cs new file mode 100644 index 00000000..4c9f1ce2 --- /dev/null +++ b/source/Damage/DamageItems/DamageStatikkShiv.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Statikk Shiv item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.StatikkShiv)] + public class DamageStatikkShiv : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageStatikkShiv() + { + this.ItemId = 3087; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + if (source.GetBuff("ItemStatikShankCharge")?.Count == 100) + { + return + (target is Obj_AI_Minion + ? new double[] { 50, 50, 50, 50, 50, 56, 61, 67, 72, 77, 83, 88, 94, 99, 104, 110, 115, 120 } + : new[] + { + 110, 110, 110, 110, 110, 123.2, 134.2, 147.4, 158.4, 169.4, 182.6, 193.6, 206.8, + 217.8, 228.8, 242, 253, 264 + })[source.Level - 1]; + } + + return 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageSunfireCape.cs b/source/Damage/DamageItems/DamageSunfireCape.cs new file mode 100644 index 00000000..fc14631d --- /dev/null +++ b/source/Damage/DamageItems/DamageSunfireCape.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Sunfire Cape item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.SunfireCape)] + public class DamageSunfireCape : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSunfireCape() + { + this.ItemId = 3068; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + var value = 25 + (1 * source.Level); + return target is Obj_AI_Minion ? value * (37.5 + (1.5 * source.Level)) : value; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageTiamat.cs b/source/Damage/DamageItems/DamageTiamat.cs new file mode 100644 index 00000000..13cf4db5 --- /dev/null +++ b/source/Damage/DamageItems/DamageTiamat.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Tiamat item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.Tiamat)] + public class DamageTiamat : DamageItem + { + #region Constants + + private const float Range = 400; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTiamat() + { + this.ItemId = 3077; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (target.InRange((Range - 50) / 4) ? .2 : .6) * source.TotalAttackDamage; + } + + /// + public override double GetPassiveDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (target.InRange(Range / 4) ? .6 : 1) * source.TotalAttackDamage; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageTitanicHydra.cs b/source/Damage/DamageItems/DamageTitanicHydra.cs new file mode 100644 index 00000000..e3f5f26b --- /dev/null +++ b/source/Damage/DamageItems/DamageTitanicHydra.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Titanic Hydra item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.TitanicHydra)] + public class DamageTitanicHydra : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTitanicHydra() + { + this.ItemId = 3748; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + var value = 5 + (.01 * source.MaxHealth); + + if (source.HasBuff("itemtitanichydracleave")) + { + value = 40 + (.1 * source.MaxHealth); + } + + return value; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageTrinityForce.cs b/source/Damage/DamageItems/DamageTrinityForce.cs new file mode 100644 index 00000000..81894eaa --- /dev/null +++ b/source/Damage/DamageItems/DamageTrinityForce.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Trinity Force item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.TrinityForce)] + public class DamageTrinityForce : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTrinityForce() + { + this.ItemId = 3078; + this.DamageType = Damage.DamageType.Physical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("sheen") ? source.BaseAttackDamage * 2 : 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/DamageWitsEnd.cs b/source/Damage/DamageItems/DamageWitsEnd.cs new file mode 100644 index 00000000..f1cc45b1 --- /dev/null +++ b/source/Damage/DamageItems/DamageWitsEnd.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System.ComponentModel.Composition; + + /// + /// Wit's End item damage. + /// + [Export(typeof(IDamageItem))] + [ExportMetadata("Item", Damage.DamageItems.WitsEnd)] + public class DamageWitsEnd : DamageItem + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageWitsEnd() + { + this.ItemId = 3091; + this.DamageType = Damage.DamageType.Magical; + } + + #endregion + + #region Public Methods and Operators + + /// + public override double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return 40; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/IDamageItem.cs b/source/Damage/DamageItems/IDamageItem.cs new file mode 100644 index 00000000..64d54316 --- /dev/null +++ b/source/Damage/DamageItems/IDamageItem.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + /// + /// The damage item interface. + /// + public interface IDamageItem + { + #region Public Properties + + /// + /// Gets the damage type. + /// + Damage.DamageType DamageType { get; } + + /// + /// Gets a value indicating whether the damage is over time. + /// + bool IsDot { get; } + + /// + /// Gets the item id. + /// + int ItemId { get; } + + #endregion + + #region Public Methods and Operators + + /// + /// Calculates the raw damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The . + /// + double GetDamage(Obj_AI_Hero source, Obj_AI_Base target); + + /// + /// Calculates the single damage over time raw damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The . + /// + double GetDotDamage(Obj_AI_Hero source, Obj_AI_Base target); + + /// + /// Calculates the passive raw damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The . + /// + double GetPassiveDamage(Obj_AI_Hero source, Obj_AI_Base target); + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/IDamageItemMetadata.cs b/source/Damage/DamageItems/IDamageItemMetadata.cs new file mode 100644 index 00000000..f18b5688 --- /dev/null +++ b/source/Damage/DamageItems/IDamageItemMetadata.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + /// + /// The damage item metadata. + /// + public interface IDamageItemMetadata + { + #region Public Properties + + /// + /// Gets the item. + /// + Damage.DamageItems Item { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageItems/ItemDamageType.cs b/source/Damage/DamageItems/ItemDamageType.cs new file mode 100644 index 00000000..0ede01d5 --- /dev/null +++ b/source/Damage/DamageItems/ItemDamageType.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.DamageItems +{ + using System; + + /// + /// The item damage type. + /// + [Flags] + public enum ItemDamageType + { + /// + /// The default type. + /// + Default = 0 << 1, + + /// + /// The damage over time type. + /// + Dot = 1 << 1, + + /// + /// The passive type. + /// + Passive = 2 << 1 + } +} \ No newline at end of file diff --git a/source/Damage/DamagePassive.cs b/source/Damage/DamagePassive.cs new file mode 100644 index 00000000..e6d7230b --- /dev/null +++ b/source/Damage/DamagePassive.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + + using LeagueSharp.Common.Passives; + + /// + /// Damage calculations and data. + /// + public partial class Damage + { + #region Public Properties + + /// + /// Gets or sets the spells. + /// + [ImportMany] + public IEnumerable> PassiveLazies { get; protected set; } + + #endregion + + #region Methods + + internal static float GetCritMultiplier(Obj_AI_Hero hero, bool checkCrit = false) + { + var crit = Items.HasItem((int)ItemId.Infinity_Edge, hero) ? 1.5f : 1; + return !checkCrit ? crit : (Math.Abs(hero.Crit - 1) < float.Epsilon ? 1 + crit : 1); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageSpell.cs b/source/Damage/DamageSpell.cs new file mode 100644 index 00000000..bfc8848e --- /dev/null +++ b/source/Damage/DamageSpell.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Gets the damage done to a target. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The level. + /// + /// + /// The . + /// + public delegate double SpellDamageDelegate(Obj_AI_Base source, Obj_AI_Base target, int level); + + /// + /// Spell damage information. + /// + public class DamageSpell : IDamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSpell() + { + this.Damage = this.GetDamage; + } + + #endregion + + #region Public Properties + + /// + public double CalculatedDamage { get; set; } + + /// + public SpellDamageDelegate Damage { get; set; } + + /// + public Damage.DamageType DamageType { get; set; } + + /// + public SpellSlot Slot { get; set; } + + /// + public int Stage { get; set; } + + #endregion + + #region Methods + + /// + /// Calculates the spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The level. + /// + /// + /// The . + /// + protected virtual double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return 0d; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageSpells.cs b/source/Damage/DamageSpells.cs new file mode 100644 index 00000000..5fa9f0f0 --- /dev/null +++ b/source/Damage/DamageSpells.cs @@ -0,0 +1,130 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + using LeagueSharp.Common.Spells; + + /// + /// Damage calculations and data. + /// + public partial class Damage + { + #region Public Properties + + /// + /// Gets or sets the spells. + /// + [ImportMany] + public IEnumerable> SpellLazies { get; protected set; } + + #endregion + + #region Properties + + private IDictionary>> SpellsDictionary { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Gets the damage spell. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The spell name. + /// + /// + /// The + /// + public DamageSpell GetDamageSpell(Obj_AI_Base source, Obj_AI_Base target, string spellName) + { + return null; + } + + /// + /// Gets the damage spell. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The slot. + /// + /// + /// The stage. + /// + /// + /// The + /// + public DamageSpell GetDamageSpell(Obj_AI_Hero source, Obj_AI_Base target, SpellSlot slot, int stage = 0) + { + IList> value; + if (this.SpellsDictionary.TryGetValue(source.ChampionName, out value)) + { + var spell = value.FirstOrDefault(v => v.Metadata.SpellSlot == slot && v.Metadata.Stage == stage); + if (spell != null) + { + var level = Math.Max(0, Math.Min(source.Spellbook.GetSpell(slot).Level - 1, 5)); + var d = spell.Value.Damage(source, target, level); + + spell.Value.CalculatedDamage = this.CalculateDamage(source, target, spell.Value.DamageType, d); + return spell.Value as DamageSpell; + } + } + + return null; + } + + #endregion + + #region Methods + + /// + /// Sorts the spells lazies into a dictionary for faster functionality. + /// + internal void SortSpells() + { + var dic = new Dictionary>>(); + + var champs = ObjectManager.Get().Select(s => s.ChampionName).ToArray(); + + foreach (var lazy in this.SpellLazies) + { + if (!champs.Any(c => c.Equals(lazy.Metadata.ChampionName, StringComparison.CurrentCultureIgnoreCase))) + { + continue; + } + + IList> value; + if (dic.TryGetValue(lazy.Metadata.ChampionName, out value)) + { + value.Add(lazy); + } + else + { + dic[lazy.Metadata.ChampionName] = new List> { lazy }; + } + } + + this.SpellsDictionary = dic; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageSummonerSpells.cs b/source/Damage/DamageSummonerSpells.cs new file mode 100644 index 00000000..5decb7a6 --- /dev/null +++ b/source/Damage/DamageSummonerSpells.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + using JetBrains.Annotations; + + using LeagueSharp.Common.SummonerSpells; + + /// + /// Damage calculations and data. + /// + public partial class Damage + { + #region Public Properties + + /// + /// Gets or sets the summoner spells. + /// + [ImportMany] + public IEnumerable> SummonerSpellLazies { get; protected set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Calculates the summoner spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The summoner spell. + /// + /// + /// The . + /// + public double GetSummonerSpellDamage( + [NotNull] Obj_AI_Hero source, + [NotNull] Obj_AI_Base target, + SummonerSpell summonerSpell) + { + return (from lazy in this.SummonerSpellLazies + where lazy.Metadata.SummonerSpell == summonerSpell + select lazy.Value.GetDamage(source, target)).FirstOrDefault(); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/DamageType.cs b/source/Damage/DamageType.cs new file mode 100644 index 00000000..1e63384a --- /dev/null +++ b/source/Damage/DamageType.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Damage calculations and data. + /// + public partial class Damage + { + #region Enums + + /// + /// The type of damage. + /// + public enum DamageType + { + /// + /// Physical Damage. + /// + Physical, + + /// + /// Magical Damage. + /// + Magical, + + /// + /// True Damage. + /// + True + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/IDamageSpell.cs b/source/Damage/IDamageSpell.cs new file mode 100644 index 00000000..c09acd33 --- /dev/null +++ b/source/Damage/IDamageSpell.cs @@ -0,0 +1,41 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The damage spell interface. + /// + public interface IDamageSpell + { + #region Public Properties + + /// + /// Gets or sets the calculated damage. + /// + double CalculatedDamage { get; set; } + + /// + /// Gets or sets the damage delegate. + /// + SpellDamageDelegate Damage { get; set; } + + /// + /// Gets or sets the damage type. + /// + Damage.DamageType DamageType { get; set; } + + /// + /// Gets or sets the spell slot. + /// + SpellSlot Slot { get; set; } + + /// + /// Gets or sets the stage. + /// + int Stage { get; set; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageAatroxPassive.cs b/source/Damage/Passives/DamageAatroxPassive.cs new file mode 100644 index 00000000..341e36d5 --- /dev/null +++ b/source/Damage/Passives/DamageAatroxPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Aatrox's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Aatrox")] + public class DamageAatroxPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("AatroxWPower") && source.HasBuff("AatroxWONHPowerBuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageAkaliPassive.cs b/source/Damage/Passives/DamageAkaliPassive.cs new file mode 100644 index 00000000..b7bc70d7 --- /dev/null +++ b/source/Damage/Passives/DamageAkaliPassive.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Akali's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Akali")] + public class DamageAkaliPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + (0.06 + (Math.Abs(source.TotalMagicalDamage / 100) * 0.16667)) * source.TotalAttackDamage); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return true; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageAkaliPassive1.cs b/source/Damage/Passives/DamageAkaliPassive1.cs new file mode 100644 index 00000000..1acbb7ae --- /dev/null +++ b/source/Damage/Passives/DamageAkaliPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Akali's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Akali")] + public class DamageAkaliPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("AkaliMota"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageAlistarPassive.cs b/source/Damage/Passives/DamageAlistarPassive.cs new file mode 100644 index 00000000..2c0e51dc --- /dev/null +++ b/source/Damage/Passives/DamageAlistarPassive.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Alistar's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Alistar")] + public class DamageAlistarPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + 6d + source.Level + (0.1d * source.TotalMagicalDamage)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("alistartrample"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageAshePassive.cs b/source/Damage/Passives/DamageAshePassive.cs new file mode 100644 index 00000000..adb99e8e --- /dev/null +++ b/source/Damage/Passives/DamageAshePassive.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Ashe's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Ashe")] + public class DamageAshePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + source.TotalAttackDamage * (0.1 + (source.Crit * (1 + source.CritDamageMultiplier)))); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("ashepassiveslow"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageAshePassive1.cs b/source/Damage/Passives/DamageAshePassive1.cs new file mode 100644 index 00000000..84567a28 --- /dev/null +++ b/source/Damage/Passives/DamageAshePassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Ashe's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Ashe")] + public class DamageAshePassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("asheqattack"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageBardPassive.cs b/source/Damage/Passives/DamageBardPassive.cs new file mode 100644 index 00000000..f056e1f7 --- /dev/null +++ b/source/Damage/Passives/DamageBardPassive.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Bard's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Bard")] + public class DamageBardPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + new[] { 30, 55, 80, 110, 140, 175, 210, 245, 280, 315, 345, 375, 400, 425, 445, 465 }[ + Math.Min(source.GetBuffCount("bardpdisplaychimecount") / 10, 15)] + + (source.GetBuffCount("bardpdisplaychimecount") > 150 + ? Math.Truncate((source.GetBuffCount("bardpdisplaychimecount") - 150) / 5d) * 20 + : 0) + (0.3 * source.TotalMagicalDamage)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetBuffCount("bardpspiritammocount") > 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageBlitzcrankPassive.cs b/source/Damage/Passives/DamageBlitzcrankPassive.cs new file mode 100644 index 00000000..de2090ef --- /dev/null +++ b/source/Damage/Passives/DamageBlitzcrankPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Blitzcrank's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Blitzcrank")] + public class DamageBlitzcrankPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("PowerFist"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageBraumPassive.cs b/source/Damage/Passives/DamageBraumPassive.cs new file mode 100644 index 00000000..52f0b39b --- /dev/null +++ b/source/Damage/Passives/DamageBraumPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Braum's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Braum")] + public class DamageBraumPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage(target, Damage.DamageType.Magical, 6.4 + (1.6 * source.Level)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("braummarkstunreduction"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageCaitlynPassive.cs b/source/Damage/Passives/DamageCaitlynPassive.cs new file mode 100644 index 00000000..d57eba68 --- /dev/null +++ b/source/Damage/Passives/DamageCaitlynPassive.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Caitlyn's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Caitlyn")] + public class DamageCaitlynPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + 1.5d * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("caitlynheadshot"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageChoGathPassive.cs b/source/Damage/Passives/DamageChoGathPassive.cs new file mode 100644 index 00000000..50730211 --- /dev/null +++ b/source/Damage/Passives/DamageChoGathPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// ChoGath's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "ChoGath")] + public class DamageChoGathPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("VorpalSpikes"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageDariusPassive.cs b/source/Damage/Passives/DamageDariusPassive.cs new file mode 100644 index 00000000..f515fd34 --- /dev/null +++ b/source/Damage/Passives/DamageDariusPassive.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Darius's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Darius")] + public class DamageDariusPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + ((9 + source.Level + (source.FlatPhysicalDamageMod * 0.3)) + * Math.Min(target.GetBuffCount("dariushemo") + 1, 5)) + * (target.Type == GameObjectType.obj_AI_Minion ? 0.25 : 1)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return true; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageDariusPassive1.cs b/source/Damage/Passives/DamageDariusPassive1.cs new file mode 100644 index 00000000..d9578248 --- /dev/null +++ b/source/Damage/Passives/DamageDariusPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Darius's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Darius")] + public class DamageDariusPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("DariusNoxianTacticsONH"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageDianaPassive.cs b/source/Damage/Passives/DamageDianaPassive.cs new file mode 100644 index 00000000..282abed5 --- /dev/null +++ b/source/Damage/Passives/DamageDianaPassive.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Diana's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Diana")] + public class DamageDianaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + 15 + + ((source.Level < 6 + ? 5 + : (source.Level < 11 ? 10 : (source.Level < 14 ? 15 : (source.Level < 16 ? 20 : 25)))) + * source.Level) + (source.TotalMagicalDamage * 0.8)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("dianaarcready"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageDrMundoPassive.cs b/source/Damage/Passives/DamageDrMundoPassive.cs new file mode 100644 index 00000000..1fe731df --- /dev/null +++ b/source/Damage/Passives/DamageDrMundoPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// DrMundo's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "DrMundo")] + public class DamageDrMundoPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("Masochism"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageEkkoPassive.cs b/source/Damage/Passives/DamageEkkoPassive.cs new file mode 100644 index 00000000..291e3da6 --- /dev/null +++ b/source/Damage/Passives/DamageEkkoPassive.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Ekko's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Ekko")] + public class DamageEkkoPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + 10 + (source.Level * 10) + (source.TotalMagicalDamage * 0.8)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.GetBuffCount("EkkoStacks") == 2; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageEkkoPassive1.cs b/source/Damage/Passives/DamageEkkoPassive1.cs new file mode 100644 index 00000000..a751aa4c --- /dev/null +++ b/source/Damage/Passives/DamageEkkoPassive1.cs @@ -0,0 +1,45 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Ekko's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Ekko")] + public class DamageEkkoPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + var dmg = + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + (target.MaxHealth - target.Health) * (5 + (Math.Floor(source.TotalMagicalDamage / 100) * 2.2f)) + / 100); + if (!(target is Obj_AI_Hero) && dmg > 150f) + { + dmg = 150f; + } + + return dmg; + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HealthPercent < 30; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageFizzPassive.cs b/source/Damage/Passives/DamageFizzPassive.cs new file mode 100644 index 00000000..09498b25 --- /dev/null +++ b/source/Damage/Passives/DamageFizzPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Fizz's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Fizz")] + public class DamageFizzPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W) / 6; + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpell(SpellSlot.W).Level > 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageFizzPassive1.cs b/source/Damage/Passives/DamageFizzPassive1.cs new file mode 100644 index 00000000..5069310e --- /dev/null +++ b/source/Damage/Passives/DamageFizzPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Fizz's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Fizz")] + public class DamageFizzPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("FizzSeastonePassive"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageGarenPassive.cs b/source/Damage/Passives/DamageGarenPassive.cs new file mode 100644 index 00000000..33d94a32 --- /dev/null +++ b/source/Damage/Passives/DamageGarenPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Garen's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Garen")] + public class DamageGarenPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("GarenQ"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageGnarPassive.cs b/source/Damage/Passives/DamageGnarPassive.cs new file mode 100644 index 00000000..ecafe931 --- /dev/null +++ b/source/Damage/Passives/DamageGnarPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Gnar's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Gnar")] + public class DamageGnarPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.GetBuffCount("gnarwproc") == 2; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageGragasPassive.cs b/source/Damage/Passives/DamageGragasPassive.cs new file mode 100644 index 00000000..3418ef36 --- /dev/null +++ b/source/Damage/Passives/DamageGragasPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Gragas's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Gragas")] + public class DamageGragasPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("gragaswattackbuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageGravesPassive.cs b/source/Damage/Passives/DamageGravesPassive.cs new file mode 100644 index 00000000..176e288a --- /dev/null +++ b/source/Damage/Passives/DamageGravesPassive.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Graves's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Graves")] + public class DamageGravesPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + ((((72 + (3 * source.Level)) / 100f) + * source.CalcDamage(target, Damage.DamageType.Physical, source.TotalAttackDamage)) + - source.CalcDamage(target, Damage.DamageType.Physical, source.TotalAttackDamage)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return true; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageHecarimPassive.cs b/source/Damage/Passives/DamageHecarimPassive.cs new file mode 100644 index 00000000..4eba21fd --- /dev/null +++ b/source/Damage/Passives/DamageHecarimPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Hecarim's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Hecarim")] + public class DamageHecarimPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("hecarimrampspeed"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageIllaoiPassive.cs b/source/Damage/Passives/DamageIllaoiPassive.cs new file mode 100644 index 00000000..be2ba065 --- /dev/null +++ b/source/Damage/Passives/DamageIllaoiPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Illaoi's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Illaoi")] + public class DamageIllaoiPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("IllaoiW"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageIreliaPassive.cs b/source/Damage/Passives/DamageIreliaPassive.cs new file mode 100644 index 00000000..e034b447 --- /dev/null +++ b/source/Damage/Passives/DamageIreliaPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Irelia's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Irelia")] + public class DamageIreliaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("ireliahitenstylecharged"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageJarvanIVPassive.cs b/source/Damage/Passives/DamageJarvanIVPassive.cs new file mode 100644 index 00000000..eee39f9f --- /dev/null +++ b/source/Damage/Passives/DamageJarvanIVPassive.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// JarvanIV's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "JarvanIV")] + public class DamageJarvanIVPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage(target, Damage.DamageType.Physical, Math.Min(target.Health * 0.1, 400)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return !target.HasBuff("jarvanivmartialcadencecheck"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageJaxPassive.cs b/source/Damage/Passives/DamageJaxPassive.cs new file mode 100644 index 00000000..7204b181 --- /dev/null +++ b/source/Damage/Passives/DamageJaxPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Jax's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Jax")] + public class DamageJaxPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("JaxEmpowerTwo"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageJaycePassive.cs b/source/Damage/Passives/DamageJaycePassive.cs new file mode 100644 index 00000000..3d9e9ddb --- /dev/null +++ b/source/Damage/Passives/DamageJaycePassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Jayce's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Jayce")] + public class DamageJaycePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("jaycehypercharge"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageJaycePassive1.cs b/source/Damage/Passives/DamageJaycePassive1.cs new file mode 100644 index 00000000..deff3695 --- /dev/null +++ b/source/Damage/Passives/DamageJaycePassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Jayce's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Jayce")] + public class DamageJaycePassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.R); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("jaycepassivemeleeattack"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageJhinPassive.cs b/source/Damage/Passives/DamageJhinPassive.cs new file mode 100644 index 00000000..71b36be2 --- /dev/null +++ b/source/Damage/Passives/DamageJhinPassive.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Jhin's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Jhin")] + public class DamageJhinPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + (source.TotalAttackDamage * 0.5f) + + ((target.MaxHealth - target.Health) + * new float[] { 0.15f, 0.20f, 0.25f }[Math.Min(2, (source.Level - 1) / 5)])); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("jhinpassiveattackbuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageJhinPassive1.cs b/source/Damage/Passives/DamageJhinPassive1.cs new file mode 100644 index 00000000..0dd8b087 --- /dev/null +++ b/source/Damage/Passives/DamageJhinPassive1.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Jhin's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Jhin")] + public class DamageJhinPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + (Items.HasItem((int)ItemId.Infinity_Edge, source) ? 0.875 : 0.5) + * (source.TotalAttackDamage + * (1 + + ((new[] { 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 40 }[source.Level - 1 + ] + (Math.Floor(source.Crit * 100 / 10) * 4) + + (Math.Floor((source.AttackSpeedMod - 1) * 100 / 10) * 2.5)) / 100)))); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return Math.Abs(source.Crit - 1) < float.Epsilon; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageJinxPassive.cs b/source/Damage/Passives/DamageJinxPassive.cs new file mode 100644 index 00000000..f5c76618 --- /dev/null +++ b/source/Damage/Passives/DamageJinxPassive.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Jinx's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Jinx")] + public class DamageJinxPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + 0.1d * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("JinxQ"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageKalistaPassive.cs b/source/Damage/Passives/DamageKalistaPassive.cs new file mode 100644 index 00000000..eb39fc9c --- /dev/null +++ b/source/Damage/Passives/DamageKalistaPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Kalista's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Kalista")] + public class DamageKalistaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("kalistacoopstrikemarkally"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageKassadinPassive.cs b/source/Damage/Passives/DamageKassadinPassive.cs new file mode 100644 index 00000000..633b31f8 --- /dev/null +++ b/source/Damage/Passives/DamageKassadinPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Kassadin's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Kassadin")] + public class DamageKassadinPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W, source.HasBuff("NetherBlade") ? 1 : 0); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpell(SpellSlot.W).Level > 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageKatarinaPassive.cs b/source/Damage/Passives/DamageKatarinaPassive.cs new file mode 100644 index 00000000..eb4947d3 --- /dev/null +++ b/source/Damage/Passives/DamageKatarinaPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Katarina's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Katarina")] + public class DamageKatarinaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.Q, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("katarinaqmark"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageKaylePassive.cs b/source/Damage/Passives/DamageKaylePassive.cs new file mode 100644 index 00000000..4fe2b101 --- /dev/null +++ b/source/Damage/Passives/DamageKaylePassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Kayle's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Kayle")] + public class DamageKaylePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpell(SpellSlot.E).Level > 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageKennenPassive.cs b/source/Damage/Passives/DamageKennenPassive.cs new file mode 100644 index 00000000..2d1eb19c --- /dev/null +++ b/source/Damage/Passives/DamageKennenPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Kennen's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Kennen")] + public class DamageKennenPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("kennendoublestrikelive"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageKogMawPassive.cs b/source/Damage/Passives/DamageKogMawPassive.cs new file mode 100644 index 00000000..48c634ff --- /dev/null +++ b/source/Damage/Passives/DamageKogMawPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// KogMaw's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "KogMaw")] + public class DamageKogMawPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("KogMawBioArcaneBarrage"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageLeonaPassive.cs b/source/Damage/Passives/DamageLeonaPassive.cs new file mode 100644 index 00000000..60f32727 --- /dev/null +++ b/source/Damage/Passives/DamageLeonaPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Leona's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Leona")] + public class DamageLeonaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("LeonaShieldOfDaybreak"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageLucianPassive.cs b/source/Damage/Passives/DamageLucianPassive.cs new file mode 100644 index 00000000..926e3938 --- /dev/null +++ b/source/Damage/Passives/DamageLucianPassive.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Lucian's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Lucian")] + public class DamageLucianPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + ((target.Type == GameObjectType.obj_AI_Minion + ? 1 + : (source.Level < 6 ? 0.3 : (source.Level < 11 ? 0.4 : (source.Level < 16 ? 0.5 : 0.6)))) + * source.TotalAttackDamage) * Damage.GetCritMultiplier(source, true)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("lucianpassivebuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageLuxPassive.cs b/source/Damage/Passives/DamageLuxPassive.cs new file mode 100644 index 00000000..dcfd07bf --- /dev/null +++ b/source/Damage/Passives/DamageLuxPassive.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Lux's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Lux")] + public class DamageLuxPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + 10 + (8 * source.Level) + (0.2 * source.TotalMagicalDamage)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("LuxIlluminatingFraulein"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageMalphitePassive.cs b/source/Damage/Passives/DamageMalphitePassive.cs new file mode 100644 index 00000000..2803a101 --- /dev/null +++ b/source/Damage/Passives/DamageMalphitePassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Malphite's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Malphite")] + public class DamageMalphitePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("malphitecleave"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageMasterYiPassive.cs b/source/Damage/Passives/DamageMasterYiPassive.cs new file mode 100644 index 00000000..1a5c2e5e --- /dev/null +++ b/source/Damage/Passives/DamageMasterYiPassive.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// MasterYi's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "MasterYi")] + public class DamageMasterYiPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + (0.5 * source.TotalAttackDamage) * Damage.GetCritMultiplier(source, true)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("doublestrike"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageMonkeyKingPassive.cs b/source/Damage/Passives/DamageMonkeyKingPassive.cs new file mode 100644 index 00000000..f2b1e278 --- /dev/null +++ b/source/Damage/Passives/DamageMonkeyKingPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// MonkeyKing's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "MonkeyKing")] + public class DamageMonkeyKingPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("MonkeyKingDoubleAttack"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageMordekaiserPassive.cs b/source/Damage/Passives/DamageMordekaiserPassive.cs new file mode 100644 index 00000000..656aa3a4 --- /dev/null +++ b/source/Damage/Passives/DamageMordekaiserPassive.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Mordekaiser's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Mordekaiser")] + public class DamageMordekaiserPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.Buffs.Any(x => x.Name.Contains("mordekaisermaceofspades")); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageNasusPassive.cs b/source/Damage/Passives/DamageNasusPassive.cs new file mode 100644 index 00000000..58b5368d --- /dev/null +++ b/source/Damage/Passives/DamageNasusPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Nasus's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Nasus")] + public class DamageNasusPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("NasusQ"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageNautilusPassive.cs b/source/Damage/Passives/DamageNautilusPassive.cs new file mode 100644 index 00000000..b6f49c5c --- /dev/null +++ b/source/Damage/Passives/DamageNautilusPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Nautilus's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Nautilus")] + public class DamageNautilusPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage(target, Damage.DamageType.Magical, 2 + (6 * source.Level)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return !target.HasBuff("nautiluspassivecheck"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageNautilusPassive1.cs b/source/Damage/Passives/DamageNautilusPassive1.cs new file mode 100644 index 00000000..89dd973a --- /dev/null +++ b/source/Damage/Passives/DamageNautilusPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Nautilus's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Nautilus")] + public class DamageNautilusPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W) / (target.Type == GameObjectType.obj_AI_Hero ? 1 : 2); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("nautiluspiercinggazeshield"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageNidaleePassive.cs b/source/Damage/Passives/DamageNidaleePassive.cs new file mode 100644 index 00000000..ec0fc6d7 --- /dev/null +++ b/source/Damage/Passives/DamageNidaleePassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Nidalee's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Nidalee")] + public class DamageNidaleePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("Takedown"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageNocturnePassive.cs b/source/Damage/Passives/DamageNocturnePassive.cs new file mode 100644 index 00000000..b43fdc13 --- /dev/null +++ b/source/Damage/Passives/DamageNocturnePassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Nocturne's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Nocturne")] + public class DamageNocturnePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage(target, Damage.DamageType.Physical, 0.2 * source.TotalAttackDamage); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("nocturneumbrablades"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageNunuPassive.cs b/source/Damage/Passives/DamageNunuPassive.cs new file mode 100644 index 00000000..481395ce --- /dev/null +++ b/source/Damage/Passives/DamageNunuPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Nunu's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Nunu")] + public class DamageNunuPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage(target, Damage.DamageType.Magical, 0.01 * source.MaxHealth); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("nunuqbufflizard"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageOriannaPassive.cs b/source/Damage/Passives/DamageOriannaPassive.cs new file mode 100644 index 00000000..76c49d46 --- /dev/null +++ b/source/Damage/Passives/DamageOriannaPassive.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Orianna's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Orianna")] + public class DamageOriannaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + ((float)0.15 * source.TotalMagicalDamage) + + new float[] { 10, 10, 10, 18, 18, 18, 26, 26, 26, 34, 34, 34, 42, 42, 42, 50, 50, 50 }[ + source.Level - 1]); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("orianaspellsword"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamagePoppyPassive.cs b/source/Damage/Passives/DamagePoppyPassive.cs new file mode 100644 index 00000000..f984a4e7 --- /dev/null +++ b/source/Damage/Passives/DamagePoppyPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Poppy's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Poppy")] + public class DamagePoppyPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage(target, Damage.DamageType.Physical, 10 + (10 * source.Level)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("PoppyPassiveBuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageQuinnPassive.cs b/source/Damage/Passives/DamageQuinnPassive.cs new file mode 100644 index 00000000..45e65fbc --- /dev/null +++ b/source/Damage/Passives/DamageQuinnPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Quinn's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Quinn")] + public class DamageQuinnPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.CalcDamage(target, Damage.DamageType.Physical, 0.5d * source.TotalAttackDamage); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("quinnw"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageRekSaiPassive.cs b/source/Damage/Passives/DamageRekSaiPassive.cs new file mode 100644 index 00000000..f90cf43f --- /dev/null +++ b/source/Damage/Passives/DamageRekSaiPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// RekSai's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "RekSai")] + public class DamageRekSaiPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("RekSaiq"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageRenektonPassive.cs b/source/Damage/Passives/DamageRenektonPassive.cs new file mode 100644 index 00000000..f3d047e0 --- /dev/null +++ b/source/Damage/Passives/DamageRenektonPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Renekton's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Renekton")] + public class DamageRenektonPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("RenektonPreExecute"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageRengarPassive.cs b/source/Damage/Passives/DamageRengarPassive.cs new file mode 100644 index 00000000..de5eac95 --- /dev/null +++ b/source/Damage/Passives/DamageRengarPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Rengar's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Rengar")] + public class DamageRengarPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("rengarqbase"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageRengarPassive1.cs b/source/Damage/Passives/DamageRengarPassive1.cs new file mode 100644 index 00000000..4821ae8f --- /dev/null +++ b/source/Damage/Passives/DamageRengarPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Rengar's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Rengar")] + public class DamageRengarPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("rengarqemp"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageRivenPassive.cs b/source/Damage/Passives/DamageRivenPassive.cs new file mode 100644 index 00000000..f34b58f4 --- /dev/null +++ b/source/Damage/Passives/DamageRivenPassive.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Riven's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Riven")] + public class DamageRivenPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + (source.Level < 3 + ? 0.25 + : (source.Level < 6 + ? 0.29167 + : (source.Level < 9 + ? 0.3333 + : (source.Level < 12 + ? 0.375 + : (source.Level < 15 ? 0.4167 : (source.Level < 18 ? 0.4583 : 0.5)))))) + * source.TotalAttackDamage); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetBuffCount("rivenpassiveaaboost") > 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageRumblePassive.cs b/source/Damage/Passives/DamageRumblePassive.cs new file mode 100644 index 00000000..41db9d6d --- /dev/null +++ b/source/Damage/Passives/DamageRumblePassive.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Rumble's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Rumble")] + public class DamageRumblePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + 0 + (5 * source.Level) + (0.3 * source.TotalMagicalDamage)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("rumbleoverheat"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageSejuaniPassive.cs b/source/Damage/Passives/DamageSejuaniPassive.cs new file mode 100644 index 00000000..44f9fa55 --- /dev/null +++ b/source/Damage/Passives/DamageSejuaniPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Sejuani's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Sejuani")] + public class DamageSejuaniPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("sejuaninorthernwindsenrage"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageShacoPassive.cs b/source/Damage/Passives/DamageShacoPassive.cs new file mode 100644 index 00000000..31c8ac15 --- /dev/null +++ b/source/Damage/Passives/DamageShacoPassive.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Shaco's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Shaco")] + public class DamageShacoPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return Damage.GetCritMultiplier(source) * source.TotalAttackDamage; + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return Math.Abs(source.Crit - 1) < float.Epsilon && !source.HasBuff("Deceive"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageShacoPassive1.cs b/source/Damage/Passives/DamageShacoPassive1.cs new file mode 100644 index 00000000..5a9ea9ac --- /dev/null +++ b/source/Damage/Passives/DamageShacoPassive1.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Shaco's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Shaco")] + public class DamageShacoPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + (source.TotalAttackDamage * 0.2) * Damage.GetCritMultiplier(source, true)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.IsFacing(target) && !source.IsFacing(target); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageShacoPassive2.cs b/source/Damage/Passives/DamageShacoPassive2.cs new file mode 100644 index 00000000..f8ad9d70 --- /dev/null +++ b/source/Damage/Passives/DamageShacoPassive2.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Shaco's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Shaco")] + public class DamageShacoPassive2 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + (Damage.GetCritMultiplier(source) + + new[] { -0.6, -0.4, -0.2, 0, 0.2 }[source.Spellbook.GetSpell(SpellSlot.Q).Level - 1]) + * source.TotalAttackDamage); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("Deceive"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageShenPassive.cs b/source/Damage/Passives/DamageShenPassive.cs new file mode 100644 index 00000000..64b93a00 --- /dev/null +++ b/source/Damage/Passives/DamageShenPassive.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Shen's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Shen")] + public class DamageShenPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + double dmg = 0; + if (source.HasBuff("shenqbuffweak")) + { + dmg = source.GetSpellDamage(target, SpellSlot.Q); + } + + if (source.HasBuff("shenqbuffstrong")) + { + dmg = source.GetSpellDamage(target, SpellSlot.Q, 1); + } + + return dmg; + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("shenqbuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageShyvanaPassive.cs b/source/Damage/Passives/DamageShyvanaPassive.cs new file mode 100644 index 00000000..8f723af4 --- /dev/null +++ b/source/Damage/Passives/DamageShyvanaPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Shyvana's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Shyvana")] + public class DamageShyvanaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("ShyvanaDoubleAttack"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageShyvanaPassive1.cs b/source/Damage/Passives/DamageShyvanaPassive1.cs new file mode 100644 index 00000000..493349b3 --- /dev/null +++ b/source/Damage/Passives/DamageShyvanaPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Shyvana's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Shyvana")] + public class DamageShyvanaPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("ShyvanaFireballMissile"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageSionPassive.cs b/source/Damage/Passives/DamageSionPassive.cs new file mode 100644 index 00000000..56d4dab6 --- /dev/null +++ b/source/Damage/Passives/DamageSionPassive.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Sion's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Sion")] + public class DamageSionPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + Math.Min(0.1 * target.MaxHealth, target.Type == GameObjectType.obj_AI_Minion ? 75 : target.MaxHealth)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("sionpassivezombie"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageSkarnerPassive.cs b/source/Damage/Passives/DamageSkarnerPassive.cs new file mode 100644 index 00000000..f6b41c53 --- /dev/null +++ b/source/Damage/Passives/DamageSkarnerPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Skarner's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Skarner")] + public class DamageSkarnerPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("skarnerpassivebuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageSonaPassive.cs b/source/Damage/Passives/DamageSonaPassive.cs new file mode 100644 index 00000000..f86fd9e1 --- /dev/null +++ b/source/Damage/Passives/DamageSonaPassive.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Sona's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Sona")] + public class DamageSonaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + (6 + + ((source.Level < 4 + ? 7 + : (source.Level < 6 ? 8 : (source.Level < 7 ? 9 : (source.Level < 15 ? 10 : 15)))) + * source.Level)) + (0.2 * target.TotalMagicalDamage)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("SonaPassiveReady"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageSonaPassive1.cs b/source/Damage/Passives/DamageSonaPassive1.cs new file mode 100644 index 00000000..33668814 --- /dev/null +++ b/source/Damage/Passives/DamageSonaPassive1.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Sona's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Sona")] + public class DamageSonaPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + new[] { 20, 30, 40, 50, 60 }[ + ((Obj_AI_Hero)source.GetBuff("SonaQProcAttacker").Caster).Spellbook.GetSpell(SpellSlot.Q).Level - 1] + + (0.2 * ((Obj_AI_Hero)source.GetBuff("SonaQProcAttacker").Caster).TotalMagicalDamage) + + new[] { 0, 10, 20, 30 }[ + ((Obj_AI_Hero)source.GetBuff("SonaQProcAttacker").Caster).Spellbook.GetSpell(SpellSlot.R).Level]); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("SonaQProcAttacker"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTahmKenchPassive.cs b/source/Damage/Passives/DamageTahmKenchPassive.cs new file mode 100644 index 00000000..d4c62e7d --- /dev/null +++ b/source/Damage/Passives/DamageTahmKenchPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// TahmKench's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "TahmKench")] + public class DamageTahmKenchPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.R); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpell(SpellSlot.R).Level > 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTalonPassive.cs b/source/Damage/Passives/DamageTalonPassive.cs new file mode 100644 index 00000000..05c11fb0 --- /dev/null +++ b/source/Damage/Passives/DamageTalonPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Talon's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Talon")] + public class DamageTalonPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("talonnoxiandiplomacybuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTaricPassive.cs b/source/Damage/Passives/DamageTaricPassive.cs new file mode 100644 index 00000000..ee73d042 --- /dev/null +++ b/source/Damage/Passives/DamageTaricPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Taric's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Taric")] + public class DamageTaricPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage(target, Damage.DamageType.Magical, source.Armor * 0.2); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("taricgemcraftbuff"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTeemoPassive.cs b/source/Damage/Passives/DamageTeemoPassive.cs new file mode 100644 index 00000000..288f000a --- /dev/null +++ b/source/Damage/Passives/DamageTeemoPassive.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Teemo's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Teemo")] + public class DamageTeemoPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + (source.Spellbook.GetSpell(SpellSlot.E).Level * 10) + (source.TotalMagicalDamage * 0.3)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("ToxicShot"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageThreshPassive.cs b/source/Damage/Passives/DamageThreshPassive.cs new file mode 100644 index 00000000..675ed98e --- /dev/null +++ b/source/Damage/Passives/DamageThreshPassive.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Thresh's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Thresh")] + public class DamageThreshPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E, 1); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.Buffs.Any(x => x.Name.Contains("threshqpassive")); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTristanaPassive.cs b/source/Damage/Passives/DamageTristanaPassive.cs new file mode 100644 index 00000000..e4ca27b1 --- /dev/null +++ b/source/Damage/Passives/DamageTristanaPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Tristana's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Tristana")] + public class DamageTristanaPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.E); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.GetBuffCount("tristanaecharge") == 3; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTrundlePassive.cs b/source/Damage/Passives/DamageTrundlePassive.cs new file mode 100644 index 00000000..7fbaa699 --- /dev/null +++ b/source/Damage/Passives/DamageTrundlePassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Trundle's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Trundle")] + public class DamageTrundlePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("TrundleTrollSmash"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTwistedFatePassive.cs b/source/Damage/Passives/DamageTwistedFatePassive.cs new file mode 100644 index 00000000..778765c0 --- /dev/null +++ b/source/Damage/Passives/DamageTwistedFatePassive.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// TwistedFate's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "TwistedFate")] + public class DamageTwistedFatePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W) + - (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + source.BaseAttackDamage + source.FlatPhysicalDamageMod) - 10f; + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("bluecardpreattack"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTwistedFatePassive1.cs b/source/Damage/Passives/DamageTwistedFatePassive1.cs new file mode 100644 index 00000000..61932d59 --- /dev/null +++ b/source/Damage/Passives/DamageTwistedFatePassive1.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// TwistedFate's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "TwistedFate")] + public class DamageTwistedFatePassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W, 2) + - (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + source.BaseAttackDamage + source.FlatPhysicalDamageMod) - 10f; + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("redcardpreattack"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTwistedFatePassive2.cs b/source/Damage/Passives/DamageTwistedFatePassive2.cs new file mode 100644 index 00000000..d554a3c0 --- /dev/null +++ b/source/Damage/Passives/DamageTwistedFatePassive2.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// TwistedFate's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "TwistedFate")] + public class DamageTwistedFatePassive2 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W, 3) + - (float) + source.CalcDamage( + target, + Damage.DamageType.Physical, + source.BaseAttackDamage + source.FlatPhysicalDamageMod) - 10f; + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("goldcardpreattack"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageTwistedFatePassive3.cs b/source/Damage/Passives/DamageTwistedFatePassive3.cs new file mode 100644 index 00000000..5ed5b70f --- /dev/null +++ b/source/Damage/Passives/DamageTwistedFatePassive3.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// TwistedFate's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "TwistedFate")] + public class DamageTwistedFatePassive3 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.E); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("cardmasterstackparticle"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageUdyrPassive.cs b/source/Damage/Passives/DamageUdyrPassive.cs new file mode 100644 index 00000000..ff6a0cda --- /dev/null +++ b/source/Damage/Passives/DamageUdyrPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Udyr's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Udyr")] + public class DamageUdyrPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("UdyrTigerStance"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageVarusPassive.cs b/source/Damage/Passives/DamageVarusPassive.cs new file mode 100644 index 00000000..7bb75283 --- /dev/null +++ b/source/Damage/Passives/DamageVarusPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Varus's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Varus")] + public class DamageVarusPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("VarusW"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageVaynePassive.cs b/source/Damage/Passives/DamageVaynePassive.cs new file mode 100644 index 00000000..46ecc051 --- /dev/null +++ b/source/Damage/Passives/DamageVaynePassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Vayne's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Vayne")] + public class DamageVaynePassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("vaynetumblebonus"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageVaynePassive1.cs b/source/Damage/Passives/DamageVaynePassive1.cs new file mode 100644 index 00000000..bfddd3c8 --- /dev/null +++ b/source/Damage/Passives/DamageVaynePassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Vayne's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Vayne")] + public class DamageVaynePassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return (float)source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetBuffCount("vaynesilvereddebuff") == 2; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageViPassive.cs b/source/Damage/Passives/DamageViPassive.cs new file mode 100644 index 00000000..5b7e1eda --- /dev/null +++ b/source/Damage/Passives/DamageViPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Vi's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Vi")] + public class DamageViPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.GetBuffCount("viwproc") == 2; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageViPassive1.cs b/source/Damage/Passives/DamageViPassive1.cs new file mode 100644 index 00000000..5c25832e --- /dev/null +++ b/source/Damage/Passives/DamageViPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Vi's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Vi")] + public class DamageViPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("ViE"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageViktorPassive.cs b/source/Damage/Passives/DamageViktorPassive.cs new file mode 100644 index 00000000..58dac0a4 --- /dev/null +++ b/source/Damage/Passives/DamageViktorPassive.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Viktor's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Viktor")] + public class DamageViktorPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + ((float)0.5d * source.TotalMagicalDamage) + + new float[] { 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 110, 130, 150, 170, 190, 210 }[ + source.Level - 1]); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("viktorpowertransferreturn"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageVolibearPassive.cs b/source/Damage/Passives/DamageVolibearPassive.cs new file mode 100644 index 00000000..d1492a5b --- /dev/null +++ b/source/Damage/Passives/DamageVolibearPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Volibear's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Volibear")] + public class DamageVolibearPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("VolibearQ"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageVolibearPassive1.cs b/source/Damage/Passives/DamageVolibearPassive1.cs new file mode 100644 index 00000000..b29edfcb --- /dev/null +++ b/source/Damage/Passives/DamageVolibearPassive1.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Volibear's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Volibear")] + public class DamageVolibearPassive1 : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.R); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("volibearrapllicator"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageWarwickPassive.cs b/source/Damage/Passives/DamageWarwickPassive.cs new file mode 100644 index 00000000..61c18e60 --- /dev/null +++ b/source/Damage/Passives/DamageWarwickPassive.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Warwick's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Warwick")] + public class DamageWarwickPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + 2.5 + ((source.Level < 10 ? 0.5 : 1) * source.Level)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return true; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageXinZhaoPassive.cs b/source/Damage/Passives/DamageXinZhaoPassive.cs new file mode 100644 index 00000000..5a92420a --- /dev/null +++ b/source/Damage/Passives/DamageXinZhaoPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// XinZhao's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "XinZhao")] + public class DamageXinZhaoPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.GetSpellDamage(target, SpellSlot.Q); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("XenZhaoComboTarget"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageYasuoPassive.cs b/source/Damage/Passives/DamageYasuoPassive.cs new file mode 100644 index 00000000..703bb9f4 --- /dev/null +++ b/source/Damage/Passives/DamageYasuoPassive.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Yasuo's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Yasuo")] + public class DamageYasuoPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + (Items.HasItem((int)ItemId.Infinity_Edge, source) ? 1.25 : 0.8) * source.TotalAttackDamage); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return Math.Abs(source.Crit - 1) < float.Epsilon; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageYorickPassive.cs b/source/Damage/Passives/DamageYorickPassive.cs new file mode 100644 index 00000000..324f70ab --- /dev/null +++ b/source/Damage/Passives/DamageYorickPassive.cs @@ -0,0 +1,44 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Yorick's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Yorick")] + public class DamageYorickPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Physical, + (0.05 + * MinionManager.GetMinions(float.MaxValue) + .Count( + g => + g.Team == source.Team + && (g.Name.Equals("Clyde") || g.Name.Equals("Inky") || g.Name.Equals("Blinky") + || (g.HasBuff("yorickunholysymbiosis") + && g.GetBuff("yorickunholysymbiosis").Caster.NetworkId == source.NetworkId)))) + * source.TotalAttackDamage); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("YorickUnholySymbiosis"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageZedPassive.cs b/source/Damage/Passives/DamageZedPassive.cs new file mode 100644 index 00000000..10ad805e --- /dev/null +++ b/source/Damage/Passives/DamageZedPassive.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Zed's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Zed")] + public class DamageZedPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + (source.Level < 7 ? 0.06 : (source.Level < 17 ? 0.08 : 0.1)) * target.MaxHealth); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HealthPercent < 50 && !target.HasBuff("ZedPassiveCD"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/DamageZiggsPassive.cs b/source/Damage/Passives/DamageZiggsPassive.cs new file mode 100644 index 00000000..607cd42a --- /dev/null +++ b/source/Damage/Passives/DamageZiggsPassive.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Ziggs's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "Ziggs")] + public class DamageZiggsPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return + (float) + source.CalcDamage( + target, + Damage.DamageType.Magical, + ((float)0.3d * source.TotalMagicalDamage) + + new float[] { 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, 136, 148, 160 }[ + source.Level - 1]); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("ziggsshortfuse"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/Global/DamageBraumMarkPassive.cs b/source/Damage/Passives/Global/DamageBraumMarkPassive.cs new file mode 100644 index 00000000..409f4b20 --- /dev/null +++ b/source/Damage/Passives/Global/DamageBraumMarkPassive.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Aatrox's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "")] + public class DamageBraumMarkPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + 32 + (8 * ((Obj_AI_Hero)target.GetBuff("braummark").Caster).Level)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.GetBuffCount("braummark") == 3; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/Global/DamageKalistaMarkPassive.cs b/source/Damage/Passives/Global/DamageKalistaMarkPassive.cs new file mode 100644 index 00000000..49348d09 --- /dev/null +++ b/source/Damage/Passives/Global/DamageKalistaMarkPassive.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Aatrox's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "")] + public class DamageKalistaMarkPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return ((Obj_AI_Hero)target.GetBuff("kalistacoopstrikemarkbuff").Caster).GetSpellDamage(target, SpellSlot.W); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("kalistacoopstrikemarkbuff") && source.HasBuff("kalistacoopstrikeally"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/Global/DamageLeonaMarkPassive.cs b/source/Damage/Passives/Global/DamageLeonaMarkPassive.cs new file mode 100644 index 00000000..43356b05 --- /dev/null +++ b/source/Damage/Passives/Global/DamageLeonaMarkPassive.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Aatrox's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "")] + public class DamageLeonaMarkPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + var lvl = ((Obj_AI_Hero)target.GetBuff("leonasunlight").Caster).Level - 1; + if ((lvl / 2) % 1 > 0) + { + lvl -= 1; + } + + return source.CalcDamage(target, Damage.DamageType.Magical, 20 + (15 * lvl / 2)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return target.HasBuff("leonasunlight") + && target.GetBuff("leonasunlight").Caster.NetworkId != source.NetworkId; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/Global/DamageNamiMarkPassive.cs b/source/Damage/Passives/Global/DamageNamiMarkPassive.cs new file mode 100644 index 00000000..3994b582 --- /dev/null +++ b/source/Damage/Passives/Global/DamageNamiMarkPassive.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + using System.ComponentModel.Composition; + + /// + /// Aatrox's Damage Passive. + /// + [Export(typeof(IPassiveDamage))] + [ExportMetadata("ChampionName", "")] + public class DamageNamiMarkPassive : IPassiveDamage + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.CalcDamage( + target, + Damage.DamageType.Magical, + new[] { 25, 40, 55, 70, 85 }[ + ((Obj_AI_Hero)source.GetBuff("NamiE").Caster).Spellbook.GetSpell(SpellSlot.E).Level - 1] + + (0.2 * ((Obj_AI_Hero)source.GetBuff("NamiE").Caster).TotalMagicalDamage)); + } + + /// + public bool IsActive(Obj_AI_Hero source, Obj_AI_Base target) + { + return source.HasBuff("NamiE"); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/IPassiveDamage.cs b/source/Damage/Passives/IPassiveDamage.cs new file mode 100644 index 00000000..44947745 --- /dev/null +++ b/source/Damage/Passives/IPassiveDamage.cs @@ -0,0 +1,44 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + /// + /// The passive damage interface. + /// + public interface IPassiveDamage + { + #region Public Methods and Operators + + /// + /// Gets the damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// Thee . + /// + double GetDamage(Obj_AI_Hero source, Obj_AI_Base target); + + /// + /// Determines if the passive damage is active. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The . + /// + bool IsActive(Obj_AI_Hero source, Obj_AI_Base target); + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Passives/IPassiveDamageMetadata.cs b/source/Damage/Passives/IPassiveDamageMetadata.cs new file mode 100644 index 00000000..fea981b4 --- /dev/null +++ b/source/Damage/Passives/IPassiveDamageMetadata.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Passives +{ + /// + /// The passive damage metadata. + /// + public interface IPassiveDamageMetadata + { + #region Public Properties + + /// + /// Gets the champion name. + /// + string ChampionName { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Aatrox/DamageAatroxE.cs b/source/Damage/Spells/Aatrox/DamageAatroxE.cs new file mode 100644 index 00000000..a5d4a640 --- /dev/null +++ b/source/Damage/Spells/Aatrox/DamageAatroxE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Aatrox E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Aatrox", SpellSlot.E)] + public class DamageAatroxE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAatroxE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 110, 145, 180, 215 }[level] + (0.6 * source.TotalMagicalDamage) + (0.6 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Aatrox/DamageAatroxQ.cs b/source/Damage/Spells/Aatrox/DamageAatroxQ.cs new file mode 100644 index 00000000..a9010998 --- /dev/null +++ b/source/Damage/Spells/Aatrox/DamageAatroxQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Aatrox Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Aatrox", SpellSlot.Q)] + public class DamageAatroxQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAatroxQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.6 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Aatrox/DamageAatroxR.cs b/source/Damage/Spells/Aatrox/DamageAatroxR.cs new file mode 100644 index 00000000..5ab631af --- /dev/null +++ b/source/Damage/Spells/Aatrox/DamageAatroxR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Aatrox R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Aatrox", SpellSlot.R)] + public class DamageAatroxR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAatroxR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 300, 400 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Aatrox/DamageAatroxW.cs b/source/Damage/Spells/Aatrox/DamageAatroxW.cs new file mode 100644 index 00000000..2e8cbd62 --- /dev/null +++ b/source/Damage/Spells/Aatrox/DamageAatroxW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Aatrox W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Aatrox", SpellSlot.W)] + public class DamageAatroxW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAatroxW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 95, 130, 165, 200 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ahri/DamageAhriE.cs b/source/Damage/Spells/Ahri/DamageAhriE.cs new file mode 100644 index 00000000..097b9f81 --- /dev/null +++ b/source/Damage/Spells/Ahri/DamageAhriE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ahri E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ahri", SpellSlot.E)] + public class DamageAhriE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAhriE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 95, 130, 165, 200 }[level] + (0.50 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ahri/DamageAhriQ.cs b/source/Damage/Spells/Ahri/DamageAhriQ.cs new file mode 100644 index 00000000..3c56bede --- /dev/null +++ b/source/Damage/Spells/Ahri/DamageAhriQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ahri Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ahri", SpellSlot.Q)] + public class DamageAhriQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAhriQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 65, 90, 115, 140 }[level] + (0.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ahri/DamageAhriQ1.cs b/source/Damage/Spells/Ahri/DamageAhriQ1.cs new file mode 100644 index 00000000..b1f58142 --- /dev/null +++ b/source/Damage/Spells/Ahri/DamageAhriQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ahri Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ahri", SpellSlot.Q, 1)] + public class DamageAhriQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAhriQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.True; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 65, 90, 115, 140 }[level] + (0.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ahri/DamageAhriR.cs b/source/Damage/Spells/Ahri/DamageAhriR.cs new file mode 100644 index 00000000..70a3175e --- /dev/null +++ b/source/Damage/Spells/Ahri/DamageAhriR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ahri R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ahri", SpellSlot.R)] + public class DamageAhriR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAhriR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ahri/DamageAhriW.cs b/source/Damage/Spells/Ahri/DamageAhriW.cs new file mode 100644 index 00000000..a1b30dc2 --- /dev/null +++ b/source/Damage/Spells/Ahri/DamageAhriW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ahri W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ahri", SpellSlot.W)] + public class DamageAhriW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAhriW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 65, 90, 115, 140 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ahri/DamageAhriW1.cs b/source/Damage/Spells/Ahri/DamageAhriW1.cs new file mode 100644 index 00000000..ca1356d3 --- /dev/null +++ b/source/Damage/Spells/Ahri/DamageAhriW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ahri W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ahri", SpellSlot.W, 1)] + public class DamageAhriW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAhriW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 12, 19.5, 27, 34.5, 42 }[level] + (0.12 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Akali/DamageAkaliE.cs b/source/Damage/Spells/Akali/DamageAkaliE.cs new file mode 100644 index 00000000..46ef4a79 --- /dev/null +++ b/source/Damage/Spells/Akali/DamageAkaliE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Akali E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Akali", SpellSlot.E)] + public class DamageAkaliE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAkaliE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 55, 80, 105, 130 }[level] + (0.4 * source.TotalMagicalDamage) + (0.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Akali/DamageAkaliQ.cs b/source/Damage/Spells/Akali/DamageAkaliQ.cs new file mode 100644 index 00000000..a1f3fcce --- /dev/null +++ b/source/Damage/Spells/Akali/DamageAkaliQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Akali Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Akali", SpellSlot.Q)] + public class DamageAkaliQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAkaliQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 35, 55, 75, 95, 115 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Akali/DamageAkaliQ1.cs b/source/Damage/Spells/Akali/DamageAkaliQ1.cs new file mode 100644 index 00000000..b62cd991 --- /dev/null +++ b/source/Damage/Spells/Akali/DamageAkaliQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Akali Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Akali", SpellSlot.Q, 1)] + public class DamageAkaliQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAkaliQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 45, 70, 95, 120, 145 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Akali/DamageAkaliR.cs b/source/Damage/Spells/Akali/DamageAkaliR.cs new file mode 100644 index 00000000..80307c24 --- /dev/null +++ b/source/Damage/Spells/Akali/DamageAkaliR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Akali R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Akali", SpellSlot.R)] + public class DamageAkaliR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAkaliR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 175, 250 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Alistar/DamageAlistarQ.cs b/source/Damage/Spells/Alistar/DamageAlistarQ.cs new file mode 100644 index 00000000..48286be4 --- /dev/null +++ b/source/Damage/Spells/Alistar/DamageAlistarQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Alistar Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Alistar", SpellSlot.Q)] + public class DamageAlistarQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAlistarQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Alistar/DamageAlistarW.cs b/source/Damage/Spells/Alistar/DamageAlistarW.cs new file mode 100644 index 00000000..5dc74ec9 --- /dev/null +++ b/source/Damage/Spells/Alistar/DamageAlistarW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Alistar W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Alistar", SpellSlot.W)] + public class DamageAlistarW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAlistarW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 110, 165, 220, 275 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Amumu/DamageAmumuE.cs b/source/Damage/Spells/Amumu/DamageAmumuE.cs new file mode 100644 index 00000000..8361e1e6 --- /dev/null +++ b/source/Damage/Spells/Amumu/DamageAmumuE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Amumu E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Amumu", SpellSlot.E)] + public class DamageAmumuE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAmumuE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 100, 125, 150, 175 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Amumu/DamageAmumuQ.cs b/source/Damage/Spells/Amumu/DamageAmumuQ.cs new file mode 100644 index 00000000..05684179 --- /dev/null +++ b/source/Damage/Spells/Amumu/DamageAmumuQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Amumu Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Amumu", SpellSlot.Q)] + public class DamageAmumuQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAmumuQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 130, 180, 230, 280 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Amumu/DamageAmumuR.cs b/source/Damage/Spells/Amumu/DamageAmumuR.cs new file mode 100644 index 00000000..e2250f1a --- /dev/null +++ b/source/Damage/Spells/Amumu/DamageAmumuR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Amumu R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Amumu", SpellSlot.R)] + public class DamageAmumuR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAmumuR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Amumu/DamageAmumuW.cs b/source/Damage/Spells/Amumu/DamageAmumuW.cs new file mode 100644 index 00000000..a73c1259 --- /dev/null +++ b/source/Damage/Spells/Amumu/DamageAmumuW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Amumu W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Amumu", SpellSlot.W)] + public class DamageAmumuW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAmumuW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 8, 12, 16, 20, 24 }[level] + ((new[] { 0.01, 0.015, 0.02, 0.025, 0.03 }[level] + (0.01 * source.TotalMagicalDamage / 100)) * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Anivia/DamageAniviaE.cs b/source/Damage/Spells/Anivia/DamageAniviaE.cs new file mode 100644 index 00000000..161b6ae4 --- /dev/null +++ b/source/Damage/Spells/Anivia/DamageAniviaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Anivia E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Anivia", SpellSlot.E)] + public class DamageAniviaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAniviaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 55, 85, 115, 145, 175 }[level] + (0.5 * source.TotalMagicalDamage)) * (target.HasBuff("chilled") ? 2 : 1); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Anivia/DamageAniviaQ.cs b/source/Damage/Spells/Anivia/DamageAniviaQ.cs new file mode 100644 index 00000000..505e2cbc --- /dev/null +++ b/source/Damage/Spells/Anivia/DamageAniviaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Anivia Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Anivia", SpellSlot.Q)] + public class DamageAniviaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAniviaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 85, 110, 135, 160 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Anivia/DamageAniviaQ1.cs b/source/Damage/Spells/Anivia/DamageAniviaQ1.cs new file mode 100644 index 00000000..9c2c6cc0 --- /dev/null +++ b/source/Damage/Spells/Anivia/DamageAniviaQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Anivia Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Anivia", SpellSlot.Q, 1)] + public class DamageAniviaQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAniviaQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 60, 90, 120, 150, 180 }[level] * 2) + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Anivia/DamageAniviaR.cs b/source/Damage/Spells/Anivia/DamageAniviaR.cs new file mode 100644 index 00000000..c9d23d6e --- /dev/null +++ b/source/Damage/Spells/Anivia/DamageAniviaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Anivia R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Anivia", SpellSlot.R)] + public class DamageAniviaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAniviaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160 }[level] + (0.25 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Annie/DamageAnnieQ.cs b/source/Damage/Spells/Annie/DamageAnnieQ.cs new file mode 100644 index 00000000..3723cd33 --- /dev/null +++ b/source/Damage/Spells/Annie/DamageAnnieQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Annie Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Annie", SpellSlot.Q)] + public class DamageAnnieQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAnnieQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 115, 150, 185, 220 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Annie/DamageAnnieR.cs b/source/Damage/Spells/Annie/DamageAnnieR.cs new file mode 100644 index 00000000..a7b085f9 --- /dev/null +++ b/source/Damage/Spells/Annie/DamageAnnieR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Annie R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Annie", SpellSlot.R)] + public class DamageAnnieR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAnnieR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 275, 400 }[level] + new double[] { 10, 15, 20 }[level] + new double[] { 50, 75, 100 }[level] + ((0.65 + 0.1 + 0.15) * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Annie/DamageAnnieW.cs b/source/Damage/Spells/Annie/DamageAnnieW.cs new file mode 100644 index 00000000..cb27bc5c --- /dev/null +++ b/source/Damage/Spells/Annie/DamageAnnieW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Annie W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Annie", SpellSlot.W)] + public class DamageAnnieW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAnnieW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.85 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ashe/DamageAsheR.cs b/source/Damage/Spells/Ashe/DamageAsheR.cs new file mode 100644 index 00000000..914380c8 --- /dev/null +++ b/source/Damage/Spells/Ashe/DamageAsheR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ashe R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ashe", SpellSlot.R)] + public class DamageAsheR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAsheR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 250, 425, 600 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ashe/DamageAsheR1.cs b/source/Damage/Spells/Ashe/DamageAsheR1.cs new file mode 100644 index 00000000..6a7505b3 --- /dev/null +++ b/source/Damage/Spells/Ashe/DamageAsheR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ashe R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ashe", SpellSlot.R, 1)] + public class DamageAsheR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAsheR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 250, 425, 600 }[level] + (1 * source.TotalMagicalDamage)) / 2; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ashe/DamageAsheW.cs b/source/Damage/Spells/Ashe/DamageAsheW.cs new file mode 100644 index 00000000..ac2e5fd3 --- /dev/null +++ b/source/Damage/Spells/Ashe/DamageAsheW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ashe W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ashe", SpellSlot.W)] + public class DamageAsheW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAsheW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 35, 50, 65, 80 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Azir/DamageAzirE.cs b/source/Damage/Spells/Azir/DamageAzirE.cs new file mode 100644 index 00000000..18450676 --- /dev/null +++ b/source/Damage/Spells/Azir/DamageAzirE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Azir E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Azir", SpellSlot.E)] + public class DamageAzirE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAzirE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Azir/DamageAzirQ.cs b/source/Damage/Spells/Azir/DamageAzirQ.cs new file mode 100644 index 00000000..e88888d5 --- /dev/null +++ b/source/Damage/Spells/Azir/DamageAzirQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Azir Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Azir", SpellSlot.Q)] + public class DamageAzirQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAzirQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 85, 105, 125, 145 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Azir/DamageAzirR.cs b/source/Damage/Spells/Azir/DamageAzirR.cs new file mode 100644 index 00000000..a1c6a0f6 --- /dev/null +++ b/source/Damage/Spells/Azir/DamageAzirR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Azir R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Azir", SpellSlot.R)] + public class DamageAzirR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAzirR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 225, 300 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Azir/DamageAzirW.cs b/source/Damage/Spells/Azir/DamageAzirW.cs new file mode 100644 index 00000000..6bb7f059 --- /dev/null +++ b/source/Damage/Spells/Azir/DamageAzirW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Azir W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Azir", SpellSlot.W)] + public class DamageAzirW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageAzirW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 60, 75, 80, 90 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Bard/DamageBardQ.cs b/source/Damage/Spells/Bard/DamageBardQ.cs new file mode 100644 index 00000000..39032463 --- /dev/null +++ b/source/Damage/Spells/Bard/DamageBardQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Bard Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Bard", SpellSlot.Q)] + public class DamageBardQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBardQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level] + (0.65 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Blitzcrank/DamageBlitzcrankE.cs b/source/Damage/Spells/Blitzcrank/DamageBlitzcrankE.cs new file mode 100644 index 00000000..4a9c45c2 --- /dev/null +++ b/source/Damage/Spells/Blitzcrank/DamageBlitzcrankE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Blitzcrank E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Blitzcrank", SpellSlot.E)] + public class DamageBlitzcrankE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBlitzcrankE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Blitzcrank/DamageBlitzcrankQ.cs b/source/Damage/Spells/Blitzcrank/DamageBlitzcrankQ.cs new file mode 100644 index 00000000..470e3111 --- /dev/null +++ b/source/Damage/Spells/Blitzcrank/DamageBlitzcrankQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Blitzcrank Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Blitzcrank", SpellSlot.Q)] + public class DamageBlitzcrankQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBlitzcrankQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 135, 190, 245, 300 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Blitzcrank/DamageBlitzcrankR.cs b/source/Damage/Spells/Blitzcrank/DamageBlitzcrankR.cs new file mode 100644 index 00000000..960998a2 --- /dev/null +++ b/source/Damage/Spells/Blitzcrank/DamageBlitzcrankR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Blitzcrank R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Blitzcrank", SpellSlot.R)] + public class DamageBlitzcrankR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBlitzcrankR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 250, 375, 500 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Brand/DamageBrandE.cs b/source/Damage/Spells/Brand/DamageBrandE.cs new file mode 100644 index 00000000..ce75cbf9 --- /dev/null +++ b/source/Damage/Spells/Brand/DamageBrandE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Brand E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Brand", SpellSlot.E)] + public class DamageBrandE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBrandE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 90, 110, 130, 150 }[level] + (0.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Brand/DamageBrandQ.cs b/source/Damage/Spells/Brand/DamageBrandQ.cs new file mode 100644 index 00000000..463e0cd3 --- /dev/null +++ b/source/Damage/Spells/Brand/DamageBrandQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Brand Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Brand", SpellSlot.Q)] + public class DamageBrandQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBrandQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 110, 140, 170, 200 }[level] + (0.55 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Brand/DamageBrandR.cs b/source/Damage/Spells/Brand/DamageBrandR.cs new file mode 100644 index 00000000..1db7e51f --- /dev/null +++ b/source/Damage/Spells/Brand/DamageBrandR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Brand R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Brand", SpellSlot.R)] + public class DamageBrandR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBrandR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 200, 300 }[level] + (0.25 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Brand/DamageBrandW.cs b/source/Damage/Spells/Brand/DamageBrandW.cs new file mode 100644 index 00000000..5693da51 --- /dev/null +++ b/source/Damage/Spells/Brand/DamageBrandW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Brand W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Brand", SpellSlot.W)] + public class DamageBrandW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBrandW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 120, 165, 210, 255 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Braum/DamageBraumQ.cs b/source/Damage/Spells/Braum/DamageBraumQ.cs new file mode 100644 index 00000000..e770ac3f --- /dev/null +++ b/source/Damage/Spells/Braum/DamageBraumQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Braum Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Braum", SpellSlot.Q)] + public class DamageBraumQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBraumQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.025 * source.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Braum/DamageBraumR.cs b/source/Damage/Spells/Braum/DamageBraumR.cs new file mode 100644 index 00000000..89a042bc --- /dev/null +++ b/source/Damage/Spells/Braum/DamageBraumR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Braum R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Braum", SpellSlot.R)] + public class DamageBraumR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageBraumR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Caitlyn/DamageCaitlynE.cs b/source/Damage/Spells/Caitlyn/DamageCaitlynE.cs new file mode 100644 index 00000000..16e7d239 --- /dev/null +++ b/source/Damage/Spells/Caitlyn/DamageCaitlynE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Caitlyn E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Caitlyn", SpellSlot.E)] + public class DamageCaitlynE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCaitlynE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Caitlyn/DamageCaitlynQ.cs b/source/Damage/Spells/Caitlyn/DamageCaitlynQ.cs new file mode 100644 index 00000000..c5e5103d --- /dev/null +++ b/source/Damage/Spells/Caitlyn/DamageCaitlynQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Caitlyn Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Caitlyn", SpellSlot.Q)] + public class DamageCaitlynQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCaitlynQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 70, 110, 150, 190 }[level] + (new[] { 1.3, 1.4, 1.5, 1.6, 1.7 }[level] * source.TotalAttackDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Caitlyn/DamageCaitlynR.cs b/source/Damage/Spells/Caitlyn/DamageCaitlynR.cs new file mode 100644 index 00000000..33631946 --- /dev/null +++ b/source/Damage/Spells/Caitlyn/DamageCaitlynR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Caitlyn R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Caitlyn", SpellSlot.R)] + public class DamageCaitlynR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCaitlynR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 250, 475, 700 }[level] + (2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Cassiopeia/DamageCassiopeiaE.cs b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaE.cs new file mode 100644 index 00000000..2a0c4f9a --- /dev/null +++ b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Cassiopeia E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Cassiopeia", SpellSlot.E)] + public class DamageCassiopeiaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCassiopeiaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (48 + (4 * ((Obj_AI_Hero)source).Level)) + (0.1 * source.TotalMagicalDamage) + (target.HasBuffOfType(BuffType.Poison) ? new double[] { 10, 40, 70, 100, 130 }[level] + (0.35 * source.TotalMagicalDamage) : 0); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Cassiopeia/DamageCassiopeiaQ.cs b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaQ.cs new file mode 100644 index 00000000..baf5e6ea --- /dev/null +++ b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Cassiopeia Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Cassiopeia", SpellSlot.Q)] + public class DamageCassiopeiaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCassiopeiaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 120, 165, 210, 255 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Cassiopeia/DamageCassiopeiaR.cs b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaR.cs new file mode 100644 index 00000000..7b27d223 --- /dev/null +++ b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Cassiopeia R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Cassiopeia", SpellSlot.R)] + public class DamageCassiopeiaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCassiopeiaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Cassiopeia/DamageCassiopeiaW.cs b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaW.cs new file mode 100644 index 00000000..22ca8c9e --- /dev/null +++ b/source/Damage/Spells/Cassiopeia/DamageCassiopeiaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Cassiopeia W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Cassiopeia", SpellSlot.W)] + public class DamageCassiopeiaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCassiopeiaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 35, 50, 65, 80 }[level] + (0.15 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/ChoGath/DamageChoGathE.cs b/source/Damage/Spells/ChoGath/DamageChoGathE.cs new file mode 100644 index 00000000..fcdcc8f7 --- /dev/null +++ b/source/Damage/Spells/ChoGath/DamageChoGathE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, ChoGath E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("ChoGath", SpellSlot.E)] + public class DamageChoGathE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageChoGathE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 35, 50, 65, 80 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/ChoGath/DamageChoGathQ.cs b/source/Damage/Spells/ChoGath/DamageChoGathQ.cs new file mode 100644 index 00000000..cfc57534 --- /dev/null +++ b/source/Damage/Spells/ChoGath/DamageChoGathQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, ChoGath Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("ChoGath", SpellSlot.Q)] + public class DamageChoGathQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageChoGathQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 135, 190, 245, 305 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/ChoGath/DamageChoGathR.cs b/source/Damage/Spells/ChoGath/DamageChoGathR.cs new file mode 100644 index 00000000..b2dc0b59 --- /dev/null +++ b/source/Damage/Spells/ChoGath/DamageChoGathR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, ChoGath R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("ChoGath", SpellSlot.R)] + public class DamageChoGathR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageChoGathR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 300, 475, 650 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/ChoGath/DamageChoGathW.cs b/source/Damage/Spells/ChoGath/DamageChoGathW.cs new file mode 100644 index 00000000..49aa04ff --- /dev/null +++ b/source/Damage/Spells/ChoGath/DamageChoGathW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, ChoGath W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("ChoGath", SpellSlot.W)] + public class DamageChoGathW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageChoGathW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 125, 175, 225, 275 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Corki/DamageCorkiE.cs b/source/Damage/Spells/Corki/DamageCorkiE.cs new file mode 100644 index 00000000..c459957f --- /dev/null +++ b/source/Damage/Spells/Corki/DamageCorkiE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Corki E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Corki", SpellSlot.E)] + public class DamageCorkiE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCorkiE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 32, 44, 56, 68 }[level] + (0.4 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Corki/DamageCorkiQ.cs b/source/Damage/Spells/Corki/DamageCorkiQ.cs new file mode 100644 index 00000000..c37515b4 --- /dev/null +++ b/source/Damage/Spells/Corki/DamageCorkiQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Corki Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Corki", SpellSlot.Q)] + public class DamageCorkiQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCorkiQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 150, 205, 250 }[level] + (0.5 * source.TotalMagicalDamage) + (0.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Corki/DamageCorkiR.cs b/source/Damage/Spells/Corki/DamageCorkiR.cs new file mode 100644 index 00000000..d98ba5e4 --- /dev/null +++ b/source/Damage/Spells/Corki/DamageCorkiR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Corki R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Corki", SpellSlot.R)] + public class DamageCorkiR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCorkiR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 130, 160 }[level] + (0.3 * source.TotalMagicalDamage) + (new double[] { 20, 50, 80 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Corki/DamageCorkiR1.cs b/source/Damage/Spells/Corki/DamageCorkiR1.cs new file mode 100644 index 00000000..d392a64c --- /dev/null +++ b/source/Damage/Spells/Corki/DamageCorkiR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Corki R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Corki", SpellSlot.R, 1)] + public class DamageCorkiR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCorkiR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 195, 240 }[level] + (0.45 * source.TotalMagicalDamage) + (new double[] { 30, 75, 120 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Corki/DamageCorkiW.cs b/source/Damage/Spells/Corki/DamageCorkiW.cs new file mode 100644 index 00000000..ca0a4dec --- /dev/null +++ b/source/Damage/Spells/Corki/DamageCorkiW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Corki W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Corki", SpellSlot.W)] + public class DamageCorkiW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCorkiW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Corki/DamageCorkiW1.cs b/source/Damage/Spells/Corki/DamageCorkiW1.cs new file mode 100644 index 00000000..428b7396 --- /dev/null +++ b/source/Damage/Spells/Corki/DamageCorkiW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Corki W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Corki", SpellSlot.W, 1)] + public class DamageCorkiW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageCorkiW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 45, 60, 75, 90 }[level] + (1.5 * source.FlatPhysicalDamageMod) + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Darius/DamageDariusQ.cs b/source/Damage/Spells/Darius/DamageDariusQ.cs new file mode 100644 index 00000000..a8c66e92 --- /dev/null +++ b/source/Damage/Spells/Darius/DamageDariusQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Darius Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Darius", SpellSlot.Q)] + public class DamageDariusQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDariusQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 40, 70, 100, 130, 160 }[level] + (new[] { 0.5, 1.1, 1.2, 1.3, 1.4 }[level] * source.TotalAttackDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Darius/DamageDariusR.cs b/source/Damage/Spells/Darius/DamageDariusR.cs new file mode 100644 index 00000000..f614ddae --- /dev/null +++ b/source/Damage/Spells/Darius/DamageDariusR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Darius R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Darius", SpellSlot.R)] + public class DamageDariusR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDariusR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 200, 300 }[level] + (0.75 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Darius/DamageDariusW.cs b/source/Damage/Spells/Darius/DamageDariusW.cs new file mode 100644 index 00000000..379f91d5 --- /dev/null +++ b/source/Damage/Spells/Darius/DamageDariusW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Darius W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Darius", SpellSlot.W)] + public class DamageDariusW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDariusW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return source.TotalAttackDamage + (0.4 * source.TotalAttackDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Diana/DamageDianaQ.cs b/source/Damage/Spells/Diana/DamageDianaQ.cs new file mode 100644 index 00000000..bb2da8c4 --- /dev/null +++ b/source/Damage/Spells/Diana/DamageDianaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Diana Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Diana", SpellSlot.Q)] + public class DamageDianaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDianaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 95, 130, 165, 200 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Diana/DamageDianaR.cs b/source/Damage/Spells/Diana/DamageDianaR.cs new file mode 100644 index 00000000..bfb59412 --- /dev/null +++ b/source/Damage/Spells/Diana/DamageDianaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Diana R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Diana", SpellSlot.R)] + public class DamageDianaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDianaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 160, 220 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Diana/DamageDianaW.cs b/source/Damage/Spells/Diana/DamageDianaW.cs new file mode 100644 index 00000000..456f249b --- /dev/null +++ b/source/Damage/Spells/Diana/DamageDianaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Diana W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Diana", SpellSlot.W)] + public class DamageDianaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDianaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 22, 34, 46, 58, 70 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/DrMundo/DamageDrMundoQ.cs b/source/Damage/Spells/DrMundo/DamageDrMundoQ.cs new file mode 100644 index 00000000..754ee7eb --- /dev/null +++ b/source/Damage/Spells/DrMundo/DamageDrMundoQ.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Spell Damage, DrMundo Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("DrMundo", SpellSlot.Q)] + public class DamageDrMundoQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDrMundoQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + if (target is Obj_AI_Minion) + { + return Math.Min( + new double[] { 300, 350, 400, 450, 500 }[level], + Math.Max( + new double[] { 80, 130, 180, 230, 280 }[level], + new[] { 15, 17.5, 20, 22.5, 25 }[level] / 100 * target.Health)); + } + + return Math.Max( + new double[] { 80, 130, 180, 230, 280 }[level], + new[] { 15, 17.5, 20, 22.5, 25 }[level] / 100 * target.Health); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Draven/DamageDravenE.cs b/source/Damage/Spells/Draven/DamageDravenE.cs new file mode 100644 index 00000000..d091624b --- /dev/null +++ b/source/Damage/Spells/Draven/DamageDravenE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Draven E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Draven", SpellSlot.E)] + public class DamageDravenE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDravenE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 105, 140, 175, 210 }[level] + (0.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Draven/DamageDravenQ.cs b/source/Damage/Spells/Draven/DamageDravenQ.cs new file mode 100644 index 00000000..3f598a69 --- /dev/null +++ b/source/Damage/Spells/Draven/DamageDravenQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Draven Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Draven", SpellSlot.Q)] + public class DamageDravenQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDravenQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 45, 55, 65, 75, 85 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Draven/DamageDravenR.cs b/source/Damage/Spells/Draven/DamageDravenR.cs new file mode 100644 index 00000000..669f4370 --- /dev/null +++ b/source/Damage/Spells/Draven/DamageDravenR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Draven R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Draven", SpellSlot.R)] + public class DamageDravenR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageDravenR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 175, 275, 375 }[level] + (1.1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ekko/DamageEkkoE.cs b/source/Damage/Spells/Ekko/DamageEkkoE.cs new file mode 100644 index 00000000..81c42181 --- /dev/null +++ b/source/Damage/Spells/Ekko/DamageEkkoE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ekko E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ekko", SpellSlot.E)] + public class DamageEkkoE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEkkoE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 80, 110, 140, 170 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ekko/DamageEkkoQ.cs b/source/Damage/Spells/Ekko/DamageEkkoQ.cs new file mode 100644 index 00000000..9f8e01af --- /dev/null +++ b/source/Damage/Spells/Ekko/DamageEkkoQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ekko Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ekko", SpellSlot.Q)] + public class DamageEkkoQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEkkoQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 75, 90, 105, 120 }[level] + (0.1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ekko/DamageEkkoQ1.cs b/source/Damage/Spells/Ekko/DamageEkkoQ1.cs new file mode 100644 index 00000000..3b6f9962 --- /dev/null +++ b/source/Damage/Spells/Ekko/DamageEkkoQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ekko Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ekko", SpellSlot.Q, 1)] + public class DamageEkkoQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEkkoQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 85, 110, 135, 160 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ekko/DamageEkkoW.cs b/source/Damage/Spells/Ekko/DamageEkkoW.cs new file mode 100644 index 00000000..9af143c2 --- /dev/null +++ b/source/Damage/Spells/Ekko/DamageEkkoW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ekko W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ekko", SpellSlot.W)] + public class DamageEkkoW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEkkoW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 195, 240, 285, 330 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Elise/DamageEliseQ.cs b/source/Damage/Spells/Elise/DamageEliseQ.cs new file mode 100644 index 00000000..c6e8aa9d --- /dev/null +++ b/source/Damage/Spells/Elise/DamageEliseQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Elise Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Elise", SpellSlot.Q)] + public class DamageEliseQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEliseQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 75, 110, 145, 180 }[level] + ((0.08 + (0.03 / 100 * source.TotalMagicalDamage)) * target.Health); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Elise/DamageEliseQ1.cs b/source/Damage/Spells/Elise/DamageEliseQ1.cs new file mode 100644 index 00000000..a63c54cc --- /dev/null +++ b/source/Damage/Spells/Elise/DamageEliseQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Elise Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Elise", SpellSlot.Q, 1)] + public class DamageEliseQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEliseQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + ((0.08 + (0.03 / 100 * source.TotalMagicalDamage)) * (target.MaxHealth - target.Health)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Elise/DamageEliseW.cs b/source/Damage/Spells/Elise/DamageEliseW.cs new file mode 100644 index 00000000..e6b6aa2b --- /dev/null +++ b/source/Damage/Spells/Elise/DamageEliseW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Elise W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Elise", SpellSlot.W)] + public class DamageEliseW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEliseW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 125, 175, 225, 275 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Evelynn/DamageEvelynnE.cs b/source/Damage/Spells/Evelynn/DamageEvelynnE.cs new file mode 100644 index 00000000..a9227a16 --- /dev/null +++ b/source/Damage/Spells/Evelynn/DamageEvelynnE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Evelynn E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Evelynn", SpellSlot.E)] + public class DamageEvelynnE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEvelynnE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (1 * source.TotalMagicalDamage) + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Evelynn/DamageEvelynnQ.cs b/source/Damage/Spells/Evelynn/DamageEvelynnQ.cs new file mode 100644 index 00000000..cdfb7a81 --- /dev/null +++ b/source/Damage/Spells/Evelynn/DamageEvelynnQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Evelynn Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Evelynn", SpellSlot.Q)] + public class DamageEvelynnQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEvelynnQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 50, 60, 70, 80 }[level] + (new double[] { 35, 40, 45, 50, 55 }[level] / 100 * source.TotalMagicalDamage) + (new double[] { 50, 55, 60, 65, 70 }[level] / 100 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Evelynn/DamageEvelynnR.cs b/source/Damage/Spells/Evelynn/DamageEvelynnR.cs new file mode 100644 index 00000000..39a04a4d --- /dev/null +++ b/source/Damage/Spells/Evelynn/DamageEvelynnR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Evelynn R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Evelynn", SpellSlot.R)] + public class DamageEvelynnR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEvelynnR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new[] { 0.15, 0.20, 0.25 }[level] + (0.01 / 100 * source.TotalMagicalDamage)) * target.Health; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/ExportDamageMetadataAttribute.cs b/source/Damage/Spells/ExportDamageMetadataAttribute.cs new file mode 100644 index 00000000..ba44790a --- /dev/null +++ b/source/Damage/Spells/ExportDamageMetadataAttribute.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Exports the damage metadata. + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + [MetadataAttribute] + public class ExportDamageMetadataAttribute : ExportAttribute, IDamageSpellMetadata + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The champion name. + /// + /// + /// The slot. + /// + /// + /// The stage. + /// + public ExportDamageMetadataAttribute(string championName, SpellSlot slot, int stage = 0) + : base(typeof(IDamageSpellMetadata)) + { + this.ChampionName = championName; + this.SpellSlot = slot; + this.Stage = stage; + } + + #endregion + + #region Public Properties + + /// + public string ChampionName { get; } + + /// + public SpellSlot SpellSlot { get; } + + /// + public int Stage { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ezreal/DamageEzrealE.cs b/source/Damage/Spells/Ezreal/DamageEzrealE.cs new file mode 100644 index 00000000..626852a2 --- /dev/null +++ b/source/Damage/Spells/Ezreal/DamageEzrealE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ezreal E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ezreal", SpellSlot.E)] + public class DamageEzrealE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEzrealE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 125, 175, 225, 275 }[level] + (0.75 * source.TotalMagicalDamage) + (0.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ezreal/DamageEzrealQ.cs b/source/Damage/Spells/Ezreal/DamageEzrealQ.cs new file mode 100644 index 00000000..25595e55 --- /dev/null +++ b/source/Damage/Spells/Ezreal/DamageEzrealQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ezreal Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ezreal", SpellSlot.Q)] + public class DamageEzrealQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEzrealQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 35, 55, 75, 95, 115 }[level] + (0.4 * source.TotalMagicalDamage) + (1.1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ezreal/DamageEzrealR.cs b/source/Damage/Spells/Ezreal/DamageEzrealR.cs new file mode 100644 index 00000000..689245ef --- /dev/null +++ b/source/Damage/Spells/Ezreal/DamageEzrealR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ezreal R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ezreal", SpellSlot.R)] + public class DamageEzrealR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEzrealR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 350, 500, 650 }[level] + (0.9 * source.TotalMagicalDamage) + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ezreal/DamageEzrealW.cs b/source/Damage/Spells/Ezreal/DamageEzrealW.cs new file mode 100644 index 00000000..cf95b1e7 --- /dev/null +++ b/source/Damage/Spells/Ezreal/DamageEzrealW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ezreal W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ezreal", SpellSlot.W)] + public class DamageEzrealW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageEzrealW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksE.cs b/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksE.cs new file mode 100644 index 00000000..1825a911 --- /dev/null +++ b/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fiddlesticks E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fiddlesticks", SpellSlot.E)] + public class DamageFiddlesticksE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFiddlesticksE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 85, 105, 125, 145 }[level] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksR.cs b/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksR.cs new file mode 100644 index 00000000..b8951f07 --- /dev/null +++ b/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fiddlesticks R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fiddlesticks", SpellSlot.R)] + public class DamageFiddlesticksR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFiddlesticksR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 125, 225, 325 }[level] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksW.cs b/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksW.cs new file mode 100644 index 00000000..a8305e45 --- /dev/null +++ b/source/Damage/Spells/Fiddlesticks/DamageFiddlesticksW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fiddlesticks W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fiddlesticks", SpellSlot.W)] + public class DamageFiddlesticksW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFiddlesticksW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fiora/DamageFioraQ.cs b/source/Damage/Spells/Fiora/DamageFioraQ.cs new file mode 100644 index 00000000..61516c85 --- /dev/null +++ b/source/Damage/Spells/Fiora/DamageFioraQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fiora Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fiora", SpellSlot.Q)] + public class DamageFioraQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFioraQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 75, 85, 95, 105 }[level] + (new[] { 0.95, 1, 1.05, 1.1, 1.15 }[level] * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fiora/DamageFioraW.cs b/source/Damage/Spells/Fiora/DamageFioraW.cs new file mode 100644 index 00000000..be10c81d --- /dev/null +++ b/source/Damage/Spells/Fiora/DamageFioraW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fiora W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fiora", SpellSlot.W)] + public class DamageFioraW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFioraW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 90, 130, 170, 210, 250 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fizz/DamageFizzE.cs b/source/Damage/Spells/Fizz/DamageFizzE.cs new file mode 100644 index 00000000..aa3117de --- /dev/null +++ b/source/Damage/Spells/Fizz/DamageFizzE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fizz E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fizz", SpellSlot.E)] + public class DamageFizzE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFizzE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 120, 170, 220, 270 }[level] + (0.75 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fizz/DamageFizzQ.cs b/source/Damage/Spells/Fizz/DamageFizzQ.cs new file mode 100644 index 00000000..af3508fc --- /dev/null +++ b/source/Damage/Spells/Fizz/DamageFizzQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fizz Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fizz", SpellSlot.Q)] + public class DamageFizzQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFizzQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 25, 40, 55, 70 }[level] + (0.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fizz/DamageFizzR.cs b/source/Damage/Spells/Fizz/DamageFizzR.cs new file mode 100644 index 00000000..51a5f95f --- /dev/null +++ b/source/Damage/Spells/Fizz/DamageFizzR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fizz R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fizz", SpellSlot.R)] + public class DamageFizzR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFizzR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 325, 450 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Fizz/DamageFizzW.cs b/source/Damage/Spells/Fizz/DamageFizzW.cs new file mode 100644 index 00000000..9ce2ea92 --- /dev/null +++ b/source/Damage/Spells/Fizz/DamageFizzW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Fizz W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Fizz", SpellSlot.W)] + public class DamageFizzW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageFizzW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 15, 20, 25, 30 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Galio/DamageGalioE.cs b/source/Damage/Spells/Galio/DamageGalioE.cs new file mode 100644 index 00000000..94215efd --- /dev/null +++ b/source/Damage/Spells/Galio/DamageGalioE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Galio E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Galio", SpellSlot.E)] + public class DamageGalioE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGalioE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Galio/DamageGalioQ.cs b/source/Damage/Spells/Galio/DamageGalioQ.cs new file mode 100644 index 00000000..1da15e4e --- /dev/null +++ b/source/Damage/Spells/Galio/DamageGalioQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Galio Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Galio", SpellSlot.Q)] + public class DamageGalioQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGalioQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 135, 190, 245, 300 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Galio/DamageGalioR.cs b/source/Damage/Spells/Galio/DamageGalioR.cs new file mode 100644 index 00000000..cd75bd5d --- /dev/null +++ b/source/Damage/Spells/Galio/DamageGalioR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Galio R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Galio", SpellSlot.R)] + public class DamageGalioR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGalioR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 360, 540, 720 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/GangPlank/DamageGangPlankQ.cs b/source/Damage/Spells/GangPlank/DamageGangPlankQ.cs new file mode 100644 index 00000000..05218794 --- /dev/null +++ b/source/Damage/Spells/GangPlank/DamageGangPlankQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, GangPlank Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("GangPlank", SpellSlot.Q)] + public class DamageGangPlankQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGangPlankQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 45, 70, 95, 120 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/GangPlank/DamageGangPlankR.cs b/source/Damage/Spells/GangPlank/DamageGangPlankR.cs new file mode 100644 index 00000000..f467f96d --- /dev/null +++ b/source/Damage/Spells/GangPlank/DamageGangPlankR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, GangPlank R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("GangPlank", SpellSlot.R)] + public class DamageGangPlankR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGangPlankR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 70, 90 }[level] + (0.1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Garen/DamageGarenE.cs b/source/Damage/Spells/Garen/DamageGarenE.cs new file mode 100644 index 00000000..510bd9fe --- /dev/null +++ b/source/Damage/Spells/Garen/DamageGarenE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Garen E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Garen", SpellSlot.E)] + public class DamageGarenE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGarenE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 45, 70, 95, 120 }[level] + (new double[] { 70, 80, 90, 100, 110 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Garen/DamageGarenQ.cs b/source/Damage/Spells/Garen/DamageGarenQ.cs new file mode 100644 index 00000000..004ff516 --- /dev/null +++ b/source/Damage/Spells/Garen/DamageGarenQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Garen Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Garen", SpellSlot.Q)] + public class DamageGarenQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGarenQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 55, 80, 105, 130 }[level] + (1.4 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Garen/DamageGarenR.cs b/source/Damage/Spells/Garen/DamageGarenR.cs new file mode 100644 index 00000000..e7f9ce39 --- /dev/null +++ b/source/Damage/Spells/Garen/DamageGarenR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Garen R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Garen", SpellSlot.R)] + public class DamageGarenR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGarenR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 175, 350, 525 }[level] + (new[] { 28.57, 33.33, 40 }[level] / 100 * (target.MaxHealth - target.Health)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gnar/DamageGnarE.cs b/source/Damage/Spells/Gnar/DamageGnarE.cs new file mode 100644 index 00000000..f99c5249 --- /dev/null +++ b/source/Damage/Spells/Gnar/DamageGnarE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gnar E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gnar", SpellSlot.E)] + public class DamageGnarE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGnarE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 60, 100, 140, 180 }[level] + (source.MaxHealth * 0.06); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gnar/DamageGnarE1.cs b/source/Damage/Spells/Gnar/DamageGnarE1.cs new file mode 100644 index 00000000..afdc502d --- /dev/null +++ b/source/Damage/Spells/Gnar/DamageGnarE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gnar E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gnar", SpellSlot.E, 1)] + public class DamageGnarE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGnarE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 60, 100, 140, 180 }[level] + (source.MaxHealth * 0.06); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gnar/DamageGnarQ.cs b/source/Damage/Spells/Gnar/DamageGnarQ.cs new file mode 100644 index 00000000..d90eb2d8 --- /dev/null +++ b/source/Damage/Spells/Gnar/DamageGnarQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gnar Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gnar", SpellSlot.Q)] + public class DamageGnarQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGnarQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 5, 35, 65, 95, 125 }[level] + (1.15 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gnar/DamageGnarQ1.cs b/source/Damage/Spells/Gnar/DamageGnarQ1.cs new file mode 100644 index 00000000..4163f15a --- /dev/null +++ b/source/Damage/Spells/Gnar/DamageGnarQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gnar Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gnar", SpellSlot.Q, 1)] + public class DamageGnarQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGnarQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 5, 45, 85, 125, 165 }[level] + (1.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gnar/DamageGnarR.cs b/source/Damage/Spells/Gnar/DamageGnarR.cs new file mode 100644 index 00000000..ad344f26 --- /dev/null +++ b/source/Damage/Spells/Gnar/DamageGnarR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gnar R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gnar", SpellSlot.R)] + public class DamageGnarR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGnarR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 300, 400 }[level] + (0.5 * source.TotalMagicalDamage) + (0.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gnar/DamageGnarW.cs b/source/Damage/Spells/Gnar/DamageGnarW.cs new file mode 100644 index 00000000..7e16a886 --- /dev/null +++ b/source/Damage/Spells/Gnar/DamageGnarW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gnar W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gnar", SpellSlot.W)] + public class DamageGnarW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGnarW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 15, 25, 35, 45, 55 }[level] + (1 * source.TotalMagicalDamage) + (new double[] { 6, 8, 10, 12, 14 }[level] / 100 * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gnar/DamageGnarW1.cs b/source/Damage/Spells/Gnar/DamageGnarW1.cs new file mode 100644 index 00000000..86b4ac0a --- /dev/null +++ b/source/Damage/Spells/Gnar/DamageGnarW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gnar W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gnar", SpellSlot.W, 1)] + public class DamageGnarW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGnarW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 25, 45, 65, 85, 105 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gragas/DamageGragasE.cs b/source/Damage/Spells/Gragas/DamageGragasE.cs new file mode 100644 index 00000000..140ed586 --- /dev/null +++ b/source/Damage/Spells/Gragas/DamageGragasE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gragas E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gragas", SpellSlot.E)] + public class DamageGragasE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGragasE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 130, 180, 230, 280 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gragas/DamageGragasQ.cs b/source/Damage/Spells/Gragas/DamageGragasQ.cs new file mode 100644 index 00000000..b12c3ded --- /dev/null +++ b/source/Damage/Spells/Gragas/DamageGragasQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gragas Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gragas", SpellSlot.Q)] + public class DamageGragasQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGragasQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gragas/DamageGragasR.cs b/source/Damage/Spells/Gragas/DamageGragasR.cs new file mode 100644 index 00000000..40282bae --- /dev/null +++ b/source/Damage/Spells/Gragas/DamageGragasR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gragas R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gragas", SpellSlot.R)] + public class DamageGragasR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGragasR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 300, 400 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Gragas/DamageGragasW.cs b/source/Damage/Spells/Gragas/DamageGragasW.cs new file mode 100644 index 00000000..8573e9ab --- /dev/null +++ b/source/Damage/Spells/Gragas/DamageGragasW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Gragas W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Gragas", SpellSlot.W)] + public class DamageGragasW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGragasW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 50, 80, 110, 140 }[level] + (8 / 100f * target.MaxHealth) + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Graves/DamageGravesQ.cs b/source/Damage/Spells/Graves/DamageGravesQ.cs new file mode 100644 index 00000000..0bde1277 --- /dev/null +++ b/source/Damage/Spells/Graves/DamageGravesQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Graves Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Graves", SpellSlot.Q)] + public class DamageGravesQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGravesQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 70, 85, 100, 115 }[level] + (0.75 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Graves/DamageGravesQ1.cs b/source/Damage/Spells/Graves/DamageGravesQ1.cs new file mode 100644 index 00000000..422ae897 --- /dev/null +++ b/source/Damage/Spells/Graves/DamageGravesQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Graves Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Graves", SpellSlot.Q, 1)] + public class DamageGravesQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGravesQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level] + (new[] { 0.4, 0.6, 0.8, 1, 1.2 }[level] * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Graves/DamageGravesR.cs b/source/Damage/Spells/Graves/DamageGravesR.cs new file mode 100644 index 00000000..24a5dcfe --- /dev/null +++ b/source/Damage/Spells/Graves/DamageGravesR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Graves R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Graves", SpellSlot.R)] + public class DamageGravesR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGravesR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 250, 400, 550 }[level] + (1.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Graves/DamageGravesW.cs b/source/Damage/Spells/Graves/DamageGravesW.cs new file mode 100644 index 00000000..30b9d45e --- /dev/null +++ b/source/Damage/Spells/Graves/DamageGravesW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Graves W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Graves", SpellSlot.W)] + public class DamageGravesW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageGravesW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210, 260 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Hecarim/DamageHecarimE.cs b/source/Damage/Spells/Hecarim/DamageHecarimE.cs new file mode 100644 index 00000000..400eebd1 --- /dev/null +++ b/source/Damage/Spells/Hecarim/DamageHecarimE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Hecarim E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Hecarim", SpellSlot.E)] + public class DamageHecarimE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHecarimE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 75, 110, 145, 180 }[level] + (0.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Hecarim/DamageHecarimQ.cs b/source/Damage/Spells/Hecarim/DamageHecarimQ.cs new file mode 100644 index 00000000..06a1309a --- /dev/null +++ b/source/Damage/Spells/Hecarim/DamageHecarimQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Hecarim Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Hecarim", SpellSlot.Q)] + public class DamageHecarimQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHecarimQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 95, 130, 165, 200 }[level] + (0.6 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Hecarim/DamageHecarimR.cs b/source/Damage/Spells/Hecarim/DamageHecarimR.cs new file mode 100644 index 00000000..da41a915 --- /dev/null +++ b/source/Damage/Spells/Hecarim/DamageHecarimR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Hecarim R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Hecarim", SpellSlot.R)] + public class DamageHecarimR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHecarimR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Hecarim/DamageHecarimW.cs b/source/Damage/Spells/Hecarim/DamageHecarimW.cs new file mode 100644 index 00000000..ec335191 --- /dev/null +++ b/source/Damage/Spells/Hecarim/DamageHecarimW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Hecarim W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Hecarim", SpellSlot.W)] + public class DamageHecarimW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHecarimW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 30, 40, 50, 60 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Heimerdinger/DamageHeimerdingerE.cs b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerE.cs new file mode 100644 index 00000000..20de281f --- /dev/null +++ b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Heimerdinger E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Heimerdinger", SpellSlot.E)] + public class DamageHeimerdingerE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHeimerdingerE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Heimerdinger/DamageHeimerdingerE1.cs b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerE1.cs new file mode 100644 index 00000000..55c8924e --- /dev/null +++ b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Heimerdinger E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Heimerdinger", SpellSlot.E, 1)] + public class DamageHeimerdingerE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHeimerdingerE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 200, 250 }[source.Spellbook.GetSpell(SpellSlot.R).Level - 1] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Heimerdinger/DamageHeimerdingerW.cs b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerW.cs new file mode 100644 index 00000000..954b2c24 --- /dev/null +++ b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Heimerdinger W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Heimerdinger", SpellSlot.W)] + public class DamageHeimerdingerW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHeimerdingerW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Heimerdinger/DamageHeimerdingerW1.cs b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerW1.cs new file mode 100644 index 00000000..fa765427 --- /dev/null +++ b/source/Damage/Spells/Heimerdinger/DamageHeimerdingerW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Heimerdinger W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Heimerdinger", SpellSlot.W, 1)] + public class DamageHeimerdingerW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageHeimerdingerW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 135, 180, 225 }[source.Spellbook.GetSpell(SpellSlot.R).Level - 1] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/IDamageSpellMetadata.cs b/source/Damage/Spells/IDamageSpellMetadata.cs new file mode 100644 index 00000000..44148df6 --- /dev/null +++ b/source/Damage/Spells/IDamageSpellMetadata.cs @@ -0,0 +1,31 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + /// + /// The damage spell metadata interface. + /// + public interface IDamageSpellMetadata + { + #region Public Properties + + /// + /// Gets the champion name. + /// + string ChampionName { get; } + + /// + /// Gets the spell slot. + /// + SpellSlot SpellSlot { get; } + + /// + /// Gets the spell stage. + /// + int Stage { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Irelia/DamageIreliaE.cs b/source/Damage/Spells/Irelia/DamageIreliaE.cs new file mode 100644 index 00000000..8803a941 --- /dev/null +++ b/source/Damage/Spells/Irelia/DamageIreliaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Irelia E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Irelia", SpellSlot.E)] + public class DamageIreliaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageIreliaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Irelia/DamageIreliaQ.cs b/source/Damage/Spells/Irelia/DamageIreliaQ.cs new file mode 100644 index 00000000..5ad35a1d --- /dev/null +++ b/source/Damage/Spells/Irelia/DamageIreliaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Irelia Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Irelia", SpellSlot.Q)] + public class DamageIreliaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageIreliaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 50, 80, 110, 140 }[level] + (1.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Irelia/DamageIreliaR.cs b/source/Damage/Spells/Irelia/DamageIreliaR.cs new file mode 100644 index 00000000..98c2faca --- /dev/null +++ b/source/Damage/Spells/Irelia/DamageIreliaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Irelia R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Irelia", SpellSlot.R)] + public class DamageIreliaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageIreliaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160 }[level] + (0.5 * source.TotalMagicalDamage) + (0.6 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Irelia/DamageIreliaW.cs b/source/Damage/Spells/Irelia/DamageIreliaW.cs new file mode 100644 index 00000000..7df0ef4f --- /dev/null +++ b/source/Damage/Spells/Irelia/DamageIreliaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Irelia W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Irelia", SpellSlot.W)] + public class DamageIreliaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageIreliaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 15, 30, 45, 60, 75 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Janna/DamageJannaQ.cs b/source/Damage/Spells/Janna/DamageJannaQ.cs new file mode 100644 index 00000000..cae65bd7 --- /dev/null +++ b/source/Damage/Spells/Janna/DamageJannaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Janna Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Janna", SpellSlot.Q)] + public class DamageJannaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJannaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 85, 110, 135, 160 }[level] + (0.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Janna/DamageJannaW.cs b/source/Damage/Spells/Janna/DamageJannaW.cs new file mode 100644 index 00000000..5f983df0 --- /dev/null +++ b/source/Damage/Spells/Janna/DamageJannaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Janna W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Janna", SpellSlot.W)] + public class DamageJannaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJannaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 115, 170, 225, 280 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/JarvanIV/DamageJarvanIVE.cs b/source/Damage/Spells/JarvanIV/DamageJarvanIVE.cs new file mode 100644 index 00000000..c2154726 --- /dev/null +++ b/source/Damage/Spells/JarvanIV/DamageJarvanIVE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, JarvanIV E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("JarvanIV", SpellSlot.E)] + public class DamageJarvanIVE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJarvanIVE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/JarvanIV/DamageJarvanIVQ.cs b/source/Damage/Spells/JarvanIV/DamageJarvanIVQ.cs new file mode 100644 index 00000000..cb041042 --- /dev/null +++ b/source/Damage/Spells/JarvanIV/DamageJarvanIVQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, JarvanIV Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("JarvanIV", SpellSlot.Q)] + public class DamageJarvanIVQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJarvanIVQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (1.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/JarvanIV/DamageJarvanIVR.cs b/source/Damage/Spells/JarvanIV/DamageJarvanIVR.cs new file mode 100644 index 00000000..704faaf1 --- /dev/null +++ b/source/Damage/Spells/JarvanIV/DamageJarvanIVR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, JarvanIV R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("JarvanIV", SpellSlot.R)] + public class DamageJarvanIVR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJarvanIVR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 325, 450 }[level] + (1.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jax/DamageJaxE.cs b/source/Damage/Spells/Jax/DamageJaxE.cs new file mode 100644 index 00000000..1eb26077 --- /dev/null +++ b/source/Damage/Spells/Jax/DamageJaxE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jax E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jax", SpellSlot.E)] + public class DamageJaxE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJaxE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 75, 100, 125, 150 }[level] + (0.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jax/DamageJaxQ.cs b/source/Damage/Spells/Jax/DamageJaxQ.cs new file mode 100644 index 00000000..d3f6575d --- /dev/null +++ b/source/Damage/Spells/Jax/DamageJaxQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jax Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jax", SpellSlot.Q)] + public class DamageJaxQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJaxQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (1 * source.FlatPhysicalDamageMod) + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jax/DamageJaxR.cs b/source/Damage/Spells/Jax/DamageJaxR.cs new file mode 100644 index 00000000..c1d951f3 --- /dev/null +++ b/source/Damage/Spells/Jax/DamageJaxR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jax R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jax", SpellSlot.R)] + public class DamageJaxR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJaxR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 160, 220 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jax/DamageJaxW.cs b/source/Damage/Spells/Jax/DamageJaxW.cs new file mode 100644 index 00000000..cb35a5fc --- /dev/null +++ b/source/Damage/Spells/Jax/DamageJaxW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jax W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jax", SpellSlot.W)] + public class DamageJaxW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJaxW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 75, 110, 145, 180 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jayce/DamageJayceE.cs b/source/Damage/Spells/Jayce/DamageJayceE.cs new file mode 100644 index 00000000..a7b51095 --- /dev/null +++ b/source/Damage/Spells/Jayce/DamageJayceE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jayce E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jayce", SpellSlot.E)] + public class DamageJayceE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJayceE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new[] { 8, 10.4, 12.8, 15.2, 17.6, 20 }[level] / 100) * target.MaxHealth) + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jayce/DamageJayceQ.cs b/source/Damage/Spells/Jayce/DamageJayceQ.cs new file mode 100644 index 00000000..5325f624 --- /dev/null +++ b/source/Damage/Spells/Jayce/DamageJayceQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jayce Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jayce", SpellSlot.Q)] + public class DamageJayceQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJayceQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 120, 170, 220, 270, 320 }[level] + (1.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jayce/DamageJayceQ1.cs b/source/Damage/Spells/Jayce/DamageJayceQ1.cs new file mode 100644 index 00000000..5cfa854f --- /dev/null +++ b/source/Damage/Spells/Jayce/DamageJayceQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jayce Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jayce", SpellSlot.Q, 1)] + public class DamageJayceQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJayceQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 70, 110, 150, 190, 230 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jayce/DamageJayceW.cs b/source/Damage/Spells/Jayce/DamageJayceW.cs new file mode 100644 index 00000000..3be48054 --- /dev/null +++ b/source/Damage/Spells/Jayce/DamageJayceW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jayce W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jayce", SpellSlot.W)] + public class DamageJayceW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJayceW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 25, 40, 55, 70, 85, 100 }[level] + (0.25 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jhin/DamageJhinE.cs b/source/Damage/Spells/Jhin/DamageJhinE.cs new file mode 100644 index 00000000..bf641091 --- /dev/null +++ b/source/Damage/Spells/Jhin/DamageJhinE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jhin E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jhin", SpellSlot.E)] + public class DamageJhinE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJhinE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 80, 140, 200, 260 }[level] + (1.20 * source.FlatPhysicalDamageMod) + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jhin/DamageJhinQ.cs b/source/Damage/Spells/Jhin/DamageJhinQ.cs new file mode 100644 index 00000000..074ae03e --- /dev/null +++ b/source/Damage/Spells/Jhin/DamageJhinQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jhin Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jhin", SpellSlot.Q)] + public class DamageJhinQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJhinQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 75, 100, 125, 150 }[level] + (new[] { 0.3, 0.35, 0.4, 0.45, 0.5 }[level] * source.FlatPhysicalDamageMod) + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jhin/DamageJhinR.cs b/source/Damage/Spells/Jhin/DamageJhinR.cs new file mode 100644 index 00000000..2aac831a --- /dev/null +++ b/source/Damage/Spells/Jhin/DamageJhinR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jhin R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jhin", SpellSlot.R)] + public class DamageJhinR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJhinR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 125, 200 }[level] + (0.25 * source.FlatPhysicalDamageMod * (1 + ((100 - target.HealthPercent) * 1.02))); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jhin/DamageJhinR1.cs b/source/Damage/Spells/Jhin/DamageJhinR1.cs new file mode 100644 index 00000000..e025b150 --- /dev/null +++ b/source/Damage/Spells/Jhin/DamageJhinR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jhin R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jhin", SpellSlot.R, 1)] + public class DamageJhinR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJhinR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 125, 200 }[level] + (0.25 * source.FlatPhysicalDamageMod * (1 + ((100 - target.HealthPercent) * 1.02)) * 2) + (0.01 * source.FlatCritDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jhin/DamageJhinW.cs b/source/Damage/Spells/Jhin/DamageJhinW.cs new file mode 100644 index 00000000..8ef0d8d8 --- /dev/null +++ b/source/Damage/Spells/Jhin/DamageJhinW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jhin W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jhin", SpellSlot.W)] + public class DamageJhinW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJhinW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 85, 120, 155, 190 }[level] + (0.7 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jinx/DamageJinxE.cs b/source/Damage/Spells/Jinx/DamageJinxE.cs new file mode 100644 index 00000000..fb5bd5cc --- /dev/null +++ b/source/Damage/Spells/Jinx/DamageJinxE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jinx E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jinx", SpellSlot.E)] + public class DamageJinxE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJinxE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 135, 190, 245, 300 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jinx/DamageJinxQ.cs b/source/Damage/Spells/Jinx/DamageJinxQ.cs new file mode 100644 index 00000000..197b30e9 --- /dev/null +++ b/source/Damage/Spells/Jinx/DamageJinxQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jinx Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jinx", SpellSlot.Q)] + public class DamageJinxQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJinxQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return 0.1 * source.TotalAttackDamage; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jinx/DamageJinxR.cs b/source/Damage/Spells/Jinx/DamageJinxR.cs new file mode 100644 index 00000000..06ef0f1f --- /dev/null +++ b/source/Damage/Spells/Jinx/DamageJinxR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jinx R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jinx", SpellSlot.R)] + public class DamageJinxR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJinxR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 25, 35, 45 }[level] + (new double[] { 25, 30, 35 }[level] / 100 * (target.MaxHealth - target.Health)) + (0.1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jinx/DamageJinxR1.cs b/source/Damage/Spells/Jinx/DamageJinxR1.cs new file mode 100644 index 00000000..a6b7cbd6 --- /dev/null +++ b/source/Damage/Spells/Jinx/DamageJinxR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jinx R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jinx", SpellSlot.R, 1)] + public class DamageJinxR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJinxR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 250, 350, 450 }[level] + (new double[] { 25, 30, 35 }[level] / 100 * (target.MaxHealth - target.Health)) + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Jinx/DamageJinxW.cs b/source/Damage/Spells/Jinx/DamageJinxW.cs new file mode 100644 index 00000000..4af53520 --- /dev/null +++ b/source/Damage/Spells/Jinx/DamageJinxW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Jinx W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Jinx", SpellSlot.W)] + public class DamageJinxW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageJinxW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 60, 110, 160, 210 }[level] + (1.4 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kalista/DamageKalistaE.cs b/source/Damage/Spells/Kalista/DamageKalistaE.cs new file mode 100644 index 00000000..d19125f6 --- /dev/null +++ b/source/Damage/Spells/Kalista/DamageKalistaE.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kalista E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kalista", SpellSlot.E)] + public class DamageKalistaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKalistaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + var count = target.GetBuffCount("kalistaexpungemarker"); + if (count > 0) + { + return (new double[] { 20, 30, 40, 50, 60 }[level] + + (0.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod))) + + ((count - 1) + * (new double[] { 10, 14, 19, 25, 32 }[level] + + (new[] { 0.2, 0.225, 0.25, 0.275, 0.3 }[level] + * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)))); + } + + return 0; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kalista/DamageKalistaQ.cs b/source/Damage/Spells/Kalista/DamageKalistaQ.cs new file mode 100644 index 00000000..afffc9ea --- /dev/null +++ b/source/Damage/Spells/Kalista/DamageKalistaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kalista Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kalista", SpellSlot.Q)] + public class DamageKalistaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKalistaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 70, 130, 190, 250 }[level] + source.BaseAttackDamage + source.FlatPhysicalDamageMod; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kalista/DamageKalistaW.cs b/source/Damage/Spells/Kalista/DamageKalistaW.cs new file mode 100644 index 00000000..f30fd68b --- /dev/null +++ b/source/Damage/Spells/Kalista/DamageKalistaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kalista W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kalista", SpellSlot.W)] + public class DamageKalistaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKalistaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 12, 14, 16, 18, 20 }[level] / 100) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karma/DamageKarmaQ.cs b/source/Damage/Spells/Karma/DamageKarmaQ.cs new file mode 100644 index 00000000..49bdd1cb --- /dev/null +++ b/source/Damage/Spells/Karma/DamageKarmaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karma Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karma", SpellSlot.Q)] + public class DamageKarmaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarmaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karma/DamageKarmaQ1.cs b/source/Damage/Spells/Karma/DamageKarmaQ1.cs new file mode 100644 index 00000000..9b00ae2e --- /dev/null +++ b/source/Damage/Spells/Karma/DamageKarmaQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karma Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karma", SpellSlot.Q, 1)] + public class DamageKarmaQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarmaQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level] + new double[] { 25, 75, 125, 175 }[source.Spellbook.GetSpell(SpellSlot.R).Level - 1] + (0.9 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karma/DamageKarmaW.cs b/source/Damage/Spells/Karma/DamageKarmaW.cs new file mode 100644 index 00000000..67668b78 --- /dev/null +++ b/source/Damage/Spells/Karma/DamageKarmaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karma W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karma", SpellSlot.W)] + public class DamageKarmaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarmaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210, 260 }[level] + (0.9 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karma/DamageKarmaW1.cs b/source/Damage/Spells/Karma/DamageKarmaW1.cs new file mode 100644 index 00000000..8215a562 --- /dev/null +++ b/source/Damage/Spells/Karma/DamageKarmaW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karma W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karma", SpellSlot.W, 1)] + public class DamageKarmaW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarmaW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210, 260 }[level] + (0.9 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karthus/DamageKarthusE.cs b/source/Damage/Spells/Karthus/DamageKarthusE.cs new file mode 100644 index 00000000..98f28b02 --- /dev/null +++ b/source/Damage/Spells/Karthus/DamageKarthusE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karthus E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karthus", SpellSlot.E)] + public class DamageKarthusE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarthusE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 50, 70, 90, 110 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karthus/DamageKarthusQ.cs b/source/Damage/Spells/Karthus/DamageKarthusQ.cs new file mode 100644 index 00000000..fb0624fe --- /dev/null +++ b/source/Damage/Spells/Karthus/DamageKarthusQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karthus Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karthus", SpellSlot.Q)] + public class DamageKarthusQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarthusQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 40, 60, 80, 100, 120 }[level] + (0.3 * source.TotalMagicalDamage)) * 2; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karthus/DamageKarthusQ1.cs b/source/Damage/Spells/Karthus/DamageKarthusQ1.cs new file mode 100644 index 00000000..34b46356 --- /dev/null +++ b/source/Damage/Spells/Karthus/DamageKarthusQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karthus Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karthus", SpellSlot.Q, 1)] + public class DamageKarthusQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarthusQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 60, 80, 100, 120 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Karthus/DamageKarthusR.cs b/source/Damage/Spells/Karthus/DamageKarthusR.cs new file mode 100644 index 00000000..e1879adf --- /dev/null +++ b/source/Damage/Spells/Karthus/DamageKarthusR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Karthus R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Karthus", SpellSlot.R)] + public class DamageKarthusR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKarthusR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 250, 400, 550 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kassadin/DamageKassadinE.cs b/source/Damage/Spells/Kassadin/DamageKassadinE.cs new file mode 100644 index 00000000..ac302b3d --- /dev/null +++ b/source/Damage/Spells/Kassadin/DamageKassadinE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kassadin E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kassadin", SpellSlot.E)] + public class DamageKassadinE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKassadinE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 105, 130, 155, 180 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kassadin/DamageKassadinQ.cs b/source/Damage/Spells/Kassadin/DamageKassadinQ.cs new file mode 100644 index 00000000..36694613 --- /dev/null +++ b/source/Damage/Spells/Kassadin/DamageKassadinQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kassadin Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kassadin", SpellSlot.Q)] + public class DamageKassadinQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKassadinQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 95, 120, 145, 170 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kassadin/DamageKassadinR.cs b/source/Damage/Spells/Kassadin/DamageKassadinR.cs new file mode 100644 index 00000000..96d38baf --- /dev/null +++ b/source/Damage/Spells/Kassadin/DamageKassadinR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kassadin R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kassadin", SpellSlot.R)] + public class DamageKassadinR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKassadinR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 100, 120 }[level] + (0.02 * source.MaxMana); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kassadin/DamageKassadinR1.cs b/source/Damage/Spells/Kassadin/DamageKassadinR1.cs new file mode 100644 index 00000000..ca87af01 --- /dev/null +++ b/source/Damage/Spells/Kassadin/DamageKassadinR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kassadin R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kassadin", SpellSlot.R, 1)] + public class DamageKassadinR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKassadinR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 50, 60 }[level] + (0.01 * source.MaxMana); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kassadin/DamageKassadinW.cs b/source/Damage/Spells/Kassadin/DamageKassadinW.cs new file mode 100644 index 00000000..8f09c7df --- /dev/null +++ b/source/Damage/Spells/Kassadin/DamageKassadinW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kassadin W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kassadin", SpellSlot.W)] + public class DamageKassadinW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKassadinW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 65, 90, 115, 140 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kassadin/DamageKassadinW1.cs b/source/Damage/Spells/Kassadin/DamageKassadinW1.cs new file mode 100644 index 00000000..5624b6ab --- /dev/null +++ b/source/Damage/Spells/Kassadin/DamageKassadinW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kassadin W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kassadin", SpellSlot.W, 1)] + public class DamageKassadinW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKassadinW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return 20 + (0.1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Katarina/DamageKatarinaE.cs b/source/Damage/Spells/Katarina/DamageKatarinaE.cs new file mode 100644 index 00000000..030a5202 --- /dev/null +++ b/source/Damage/Spells/Katarina/DamageKatarinaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Katarina E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Katarina", SpellSlot.E)] + public class DamageKatarinaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKatarinaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 70, 100, 130, 160 }[level] + (0.25 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Katarina/DamageKatarinaQ.cs b/source/Damage/Spells/Katarina/DamageKatarinaQ.cs new file mode 100644 index 00000000..aa150026 --- /dev/null +++ b/source/Damage/Spells/Katarina/DamageKatarinaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Katarina Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Katarina", SpellSlot.Q)] + public class DamageKatarinaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKatarinaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 85, 110, 135, 160 }[level] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Katarina/DamageKatarinaQ1.cs b/source/Damage/Spells/Katarina/DamageKatarinaQ1.cs new file mode 100644 index 00000000..03de16bc --- /dev/null +++ b/source/Damage/Spells/Katarina/DamageKatarinaQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Katarina Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Katarina", SpellSlot.Q, 1)] + public class DamageKatarinaQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKatarinaQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 15, 30, 45, 60, 75 }[level] + (0.15 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Katarina/DamageKatarinaR.cs b/source/Damage/Spells/Katarina/DamageKatarinaR.cs new file mode 100644 index 00000000..ac3b458f --- /dev/null +++ b/source/Damage/Spells/Katarina/DamageKatarinaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Katarina R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Katarina", SpellSlot.R)] + public class DamageKatarinaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKatarinaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 350, 550, 750 }[level] + (3.75 * source.FlatPhysicalDamageMod) + (2.5 * source.TotalMagicalDamage)) / 10; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Katarina/DamageKatarinaR1.cs b/source/Damage/Spells/Katarina/DamageKatarinaR1.cs new file mode 100644 index 00000000..e88e0710 --- /dev/null +++ b/source/Damage/Spells/Katarina/DamageKatarinaR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Katarina R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Katarina", SpellSlot.R, 1)] + public class DamageKatarinaR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKatarinaR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 350, 550, 750 }[level] + (3.75 * source.FlatPhysicalDamageMod) + (2.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Katarina/DamageKatarinaW.cs b/source/Damage/Spells/Katarina/DamageKatarinaW.cs new file mode 100644 index 00000000..af79e467 --- /dev/null +++ b/source/Damage/Spells/Katarina/DamageKatarinaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Katarina W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Katarina", SpellSlot.W)] + public class DamageKatarinaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKatarinaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 75, 110, 145, 180 }[level] + (0.6 * source.FlatPhysicalDamageMod) + (0.25 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kayle/DamageKayleE.cs b/source/Damage/Spells/Kayle/DamageKayleE.cs new file mode 100644 index 00000000..adab147b --- /dev/null +++ b/source/Damage/Spells/Kayle/DamageKayleE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kayle E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kayle", SpellSlot.E)] + public class DamageKayleE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKayleE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return source.HasBuff("judicatorrighteousfury") ? new double[] { 20, 30, 40, 50, 60 }[level] + (0.30 * source.TotalMagicalDamage) : new double[] { 10, 15, 20, 25, 30 }[level] + (0.15 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kayle/DamageKayleQ.cs b/source/Damage/Spells/Kayle/DamageKayleQ.cs new file mode 100644 index 00000000..1b5f4934 --- /dev/null +++ b/source/Damage/Spells/Kayle/DamageKayleQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kayle Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kayle", SpellSlot.Q)] + public class DamageKayleQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKayleQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210, 260 }[level] + (1 * source.FlatPhysicalDamageMod) + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kennen/DamageKennenE.cs b/source/Damage/Spells/Kennen/DamageKennenE.cs new file mode 100644 index 00000000..ded7eb80 --- /dev/null +++ b/source/Damage/Spells/Kennen/DamageKennenE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kennen E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kennen", SpellSlot.E)] + public class DamageKennenE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKennenE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 85, 125, 165, 205, 245 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kennen/DamageKennenQ.cs b/source/Damage/Spells/Kennen/DamageKennenQ.cs new file mode 100644 index 00000000..14d81c4d --- /dev/null +++ b/source/Damage/Spells/Kennen/DamageKennenQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kennen Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kennen", SpellSlot.Q)] + public class DamageKennenQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKennenQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 115, 155, 195, 235 }[level] + (0.75 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kennen/DamageKennenR.cs b/source/Damage/Spells/Kennen/DamageKennenR.cs new file mode 100644 index 00000000..bf77a7f9 --- /dev/null +++ b/source/Damage/Spells/Kennen/DamageKennenR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kennen R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kennen", SpellSlot.R)] + public class DamageKennenR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKennenR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 145, 210 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kennen/DamageKennenW.cs b/source/Damage/Spells/Kennen/DamageKennenW.cs new file mode 100644 index 00000000..fd565eea --- /dev/null +++ b/source/Damage/Spells/Kennen/DamageKennenW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kennen W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kennen", SpellSlot.W)] + public class DamageKennenW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKennenW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 50, 60, 70, 80 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kennen/DamageKennenW1.cs b/source/Damage/Spells/Kennen/DamageKennenW1.cs new file mode 100644 index 00000000..1a3d439c --- /dev/null +++ b/source/Damage/Spells/Kennen/DamageKennenW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kennen W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kennen", SpellSlot.W, 1)] + public class DamageKennenW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKennenW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 95, 125, 155, 185 }[level] + (0.55 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KhaZix/DamageKhaZixE.cs b/source/Damage/Spells/KhaZix/DamageKhaZixE.cs new file mode 100644 index 00000000..b9efdbd5 --- /dev/null +++ b/source/Damage/Spells/KhaZix/DamageKhaZixE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KhaZix E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KhaZix", SpellSlot.E)] + public class DamageKhaZixE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKhaZixE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 100, 135, 170, 205 }[level] + (0.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KhaZix/DamageKhaZixQ.cs b/source/Damage/Spells/KhaZix/DamageKhaZixQ.cs new file mode 100644 index 00000000..2be1fe73 --- /dev/null +++ b/source/Damage/Spells/KhaZix/DamageKhaZixQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KhaZix Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KhaZix", SpellSlot.Q)] + public class DamageKhaZixQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKhaZixQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 95, 120, 145, 170 }[level] + (1.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KhaZix/DamageKhaZixQ1.cs b/source/Damage/Spells/KhaZix/DamageKhaZixQ1.cs new file mode 100644 index 00000000..173617f8 --- /dev/null +++ b/source/Damage/Spells/KhaZix/DamageKhaZixQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KhaZix Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KhaZix", SpellSlot.Q, 1)] + public class DamageKhaZixQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKhaZixQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 91, 123.5, 156, 188.5, 221 }[level] + (1.56 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KhaZix/DamageKhaZixQ2.cs b/source/Damage/Spells/KhaZix/DamageKhaZixQ2.cs new file mode 100644 index 00000000..7af8f8b2 --- /dev/null +++ b/source/Damage/Spells/KhaZix/DamageKhaZixQ2.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KhaZix Q (Stage 2). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KhaZix", SpellSlot.Q, 2)] + public class DamageKhaZixQ2 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKhaZixQ2() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 2; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 95, 120, 145, 170 }[level] + (2.24 * source.FlatPhysicalDamageMod) + (10 * ((Obj_AI_Hero)source).Level); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KhaZix/DamageKhaZixQ3.cs b/source/Damage/Spells/KhaZix/DamageKhaZixQ3.cs new file mode 100644 index 00000000..d565013a --- /dev/null +++ b/source/Damage/Spells/KhaZix/DamageKhaZixQ3.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KhaZix Q (Stage 3). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KhaZix", SpellSlot.Q, 3)] + public class DamageKhaZixQ3 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKhaZixQ3() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 3; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 91, 123.5, 156, 188.5, 221 }[level] + (2.6 * source.FlatPhysicalDamageMod) + (10 * ((Obj_AI_Hero)source).Level); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KhaZix/DamageKhaZixW.cs b/source/Damage/Spells/KhaZix/DamageKhaZixW.cs new file mode 100644 index 00000000..6b083f05 --- /dev/null +++ b/source/Damage/Spells/KhaZix/DamageKhaZixW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KhaZix W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KhaZix", SpellSlot.W)] + public class DamageKhaZixW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKhaZixW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 110, 140, 170, 200 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kindred/DamageKindredE.cs b/source/Damage/Spells/Kindred/DamageKindredE.cs new file mode 100644 index 00000000..df104202 --- /dev/null +++ b/source/Damage/Spells/Kindred/DamageKindredE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kindred E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kindred", SpellSlot.E)] + public class DamageKindredE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKindredE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 110, 140, 170, 200 }[level] + ((source.BaseAttackDamage + source.FlatPhysicalDamageMod) * 0.2f) + (target.MaxHealth * 0.05f); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kindred/DamageKindredQ.cs b/source/Damage/Spells/Kindred/DamageKindredQ.cs new file mode 100644 index 00000000..627a4be3 --- /dev/null +++ b/source/Damage/Spells/Kindred/DamageKindredQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kindred Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kindred", SpellSlot.Q)] + public class DamageKindredQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKindredQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + ((source.BaseAttackDamage + source.FlatPhysicalDamageMod) * 0.2f); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Kindred/DamageKindredW.cs b/source/Damage/Spells/Kindred/DamageKindredW.cs new file mode 100644 index 00000000..fcf67932 --- /dev/null +++ b/source/Damage/Spells/Kindred/DamageKindredW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Kindred W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Kindred", SpellSlot.W)] + public class DamageKindredW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKindredW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 25, 30, 35, 40, 45 }[level] + ((source.BaseAttackDamage + source.FlatPhysicalDamageMod) * 0.4f); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KogMaw/DamageKogMawE.cs b/source/Damage/Spells/KogMaw/DamageKogMawE.cs new file mode 100644 index 00000000..037fac19 --- /dev/null +++ b/source/Damage/Spells/KogMaw/DamageKogMawE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KogMaw E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KogMaw", SpellSlot.E)] + public class DamageKogMawE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKogMawE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210, 260 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KogMaw/DamageKogMawQ.cs b/source/Damage/Spells/KogMaw/DamageKogMawQ.cs new file mode 100644 index 00000000..842a4957 --- /dev/null +++ b/source/Damage/Spells/KogMaw/DamageKogMawQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KogMaw Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KogMaw", SpellSlot.Q)] + public class DamageKogMawQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKogMawQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 130, 180, 230, 280 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KogMaw/DamageKogMawR.cs b/source/Damage/Spells/KogMaw/DamageKogMawR.cs new file mode 100644 index 00000000..00a1484e --- /dev/null +++ b/source/Damage/Spells/KogMaw/DamageKogMawR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KogMaw R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KogMaw", SpellSlot.R)] + public class DamageKogMawR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKogMawR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 70, 110, 150 }[level] + (0.65 * source.FlatPhysicalDamageMod) + (0.25 * source.TotalMagicalDamage)) * (target.HealthPercent < 25 ? 3 : (target.HealthPercent < 50 ? 2 : 1)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/KogMaw/DamageKogMawW.cs b/source/Damage/Spells/KogMaw/DamageKogMawW.cs new file mode 100644 index 00000000..36c1e9ef --- /dev/null +++ b/source/Damage/Spells/KogMaw/DamageKogMawW.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Spell Damage, KogMaw W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("KogMaw", SpellSlot.W)] + public class DamageKogMawW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageKogMawW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + var dmg = (0.02 + (Math.Truncate(source.TotalMagicalDamage / 100) * 0.75)) * target.MaxHealth; + if (target is Obj_AI_Minion && dmg > 100) + { + dmg = 100; + } + + return dmg; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeBlanc/DamageLeBlancE.cs b/source/Damage/Spells/LeBlanc/DamageLeBlancE.cs new file mode 100644 index 00000000..a7a01fcc --- /dev/null +++ b/source/Damage/Spells/LeBlanc/DamageLeBlancE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeBlanc E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeBlanc", SpellSlot.E)] + public class DamageLeBlancE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeBlancE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 65, 90, 115, 140 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeBlanc/DamageLeBlancQ.cs b/source/Damage/Spells/LeBlanc/DamageLeBlancQ.cs new file mode 100644 index 00000000..9210495f --- /dev/null +++ b/source/Damage/Spells/LeBlanc/DamageLeBlancQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeBlanc Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeBlanc", SpellSlot.Q)] + public class DamageLeBlancQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeBlancQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 80, 105, 130, 155 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeBlanc/DamageLeBlancQ1.cs b/source/Damage/Spells/LeBlanc/DamageLeBlancQ1.cs new file mode 100644 index 00000000..4a75136f --- /dev/null +++ b/source/Damage/Spells/LeBlanc/DamageLeBlancQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeBlanc Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeBlanc", SpellSlot.Q, 1)] + public class DamageLeBlancQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeBlancQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 80, 105, 130, 155 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeBlanc/DamageLeBlancW.cs b/source/Damage/Spells/LeBlanc/DamageLeBlancW.cs new file mode 100644 index 00000000..641d859a --- /dev/null +++ b/source/Damage/Spells/LeBlanc/DamageLeBlancW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeBlanc W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeBlanc", SpellSlot.W)] + public class DamageLeBlancW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeBlancW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 85, 125, 165, 205, 245 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeeSin/DamageLeeSinE.cs b/source/Damage/Spells/LeeSin/DamageLeeSinE.cs new file mode 100644 index 00000000..5dd5ad7b --- /dev/null +++ b/source/Damage/Spells/LeeSin/DamageLeeSinE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeeSin E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeeSin", SpellSlot.E)] + public class DamageLeeSinE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeeSinE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 95, 130, 165, 200 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeeSin/DamageLeeSinQ.cs b/source/Damage/Spells/LeeSin/DamageLeeSinQ.cs new file mode 100644 index 00000000..8205336d --- /dev/null +++ b/source/Damage/Spells/LeeSin/DamageLeeSinQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeeSin Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeeSin", SpellSlot.Q)] + public class DamageLeeSinQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeeSinQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 80, 110, 140, 170 }[level] + (0.9 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeeSin/DamageLeeSinQ1.cs b/source/Damage/Spells/LeeSin/DamageLeeSinQ1.cs new file mode 100644 index 00000000..4e15b9e4 --- /dev/null +++ b/source/Damage/Spells/LeeSin/DamageLeeSinQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeeSin Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeeSin", SpellSlot.Q, 1)] + public class DamageLeeSinQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeeSinQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 80, 110, 140, 170 }[level] + (0.9 * source.FlatPhysicalDamageMod) + (0.08 * (target.MaxHealth - target.Health)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/LeeSin/DamageLeeSinR.cs b/source/Damage/Spells/LeeSin/DamageLeeSinR.cs new file mode 100644 index 00000000..8849e33b --- /dev/null +++ b/source/Damage/Spells/LeeSin/DamageLeeSinR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, LeeSin R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("LeeSin", SpellSlot.R)] + public class DamageLeeSinR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeeSinR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 400, 600 }[level] + (2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Leona/DamageLeonaE.cs b/source/Damage/Spells/Leona/DamageLeonaE.cs new file mode 100644 index 00000000..3207e1fc --- /dev/null +++ b/source/Damage/Spells/Leona/DamageLeonaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Leona E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Leona", SpellSlot.E)] + public class DamageLeonaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeonaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Leona/DamageLeonaQ.cs b/source/Damage/Spells/Leona/DamageLeonaQ.cs new file mode 100644 index 00000000..7dfeae21 --- /dev/null +++ b/source/Damage/Spells/Leona/DamageLeonaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Leona Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Leona", SpellSlot.Q)] + public class DamageLeonaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeonaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 55, 80, 105, 130 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Leona/DamageLeonaR.cs b/source/Damage/Spells/Leona/DamageLeonaR.cs new file mode 100644 index 00000000..17be032d --- /dev/null +++ b/source/Damage/Spells/Leona/DamageLeonaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Leona R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Leona", SpellSlot.R)] + public class DamageLeonaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeonaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 175, 250 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Leona/DamageLeonaW.cs b/source/Damage/Spells/Leona/DamageLeonaW.cs new file mode 100644 index 00000000..f3abc168 --- /dev/null +++ b/source/Damage/Spells/Leona/DamageLeonaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Leona W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Leona", SpellSlot.W)] + public class DamageLeonaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLeonaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lissandra/DamageLissandraE.cs b/source/Damage/Spells/Lissandra/DamageLissandraE.cs new file mode 100644 index 00000000..3584a56c --- /dev/null +++ b/source/Damage/Spells/Lissandra/DamageLissandraE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lissandra E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lissandra", SpellSlot.E)] + public class DamageLissandraE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLissandraE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lissandra/DamageLissandraQ.cs b/source/Damage/Spells/Lissandra/DamageLissandraQ.cs new file mode 100644 index 00000000..e6dd8626 --- /dev/null +++ b/source/Damage/Spells/Lissandra/DamageLissandraQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lissandra Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lissandra", SpellSlot.Q)] + public class DamageLissandraQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLissandraQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 100, 130, 160, 190 }[level] + (0.65 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lissandra/DamageLissandraR.cs b/source/Damage/Spells/Lissandra/DamageLissandraR.cs new file mode 100644 index 00000000..9eb69292 --- /dev/null +++ b/source/Damage/Spells/Lissandra/DamageLissandraR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lissandra R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lissandra", SpellSlot.R)] + public class DamageLissandraR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLissandraR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lissandra/DamageLissandraW.cs b/source/Damage/Spells/Lissandra/DamageLissandraW.cs new file mode 100644 index 00000000..20b50af0 --- /dev/null +++ b/source/Damage/Spells/Lissandra/DamageLissandraW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lissandra W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lissandra", SpellSlot.W)] + public class DamageLissandraW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLissandraW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lucian/DamageLucianQ.cs b/source/Damage/Spells/Lucian/DamageLucianQ.cs new file mode 100644 index 00000000..c7da2863 --- /dev/null +++ b/source/Damage/Spells/Lucian/DamageLucianQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lucian Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lucian", SpellSlot.Q)] + public class DamageLucianQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLucianQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 110, 140, 170, 200 }[level] + (new double[] { 60, 75, 90, 105, 120 }[level] / 100 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lucian/DamageLucianR.cs b/source/Damage/Spells/Lucian/DamageLucianR.cs new file mode 100644 index 00000000..3cccaa12 --- /dev/null +++ b/source/Damage/Spells/Lucian/DamageLucianR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lucian R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lucian", SpellSlot.R)] + public class DamageLucianR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLucianR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 50, 60 }[level] + (0.1 * source.TotalMagicalDamage) + (0.25 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lucian/DamageLucianW.cs b/source/Damage/Spells/Lucian/DamageLucianW.cs new file mode 100644 index 00000000..958d292a --- /dev/null +++ b/source/Damage/Spells/Lucian/DamageLucianW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lucian W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lucian", SpellSlot.W)] + public class DamageLucianW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLucianW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + (0.9 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lulu/DamageLuluE.cs b/source/Damage/Spells/Lulu/DamageLuluE.cs new file mode 100644 index 00000000..7d5ade9a --- /dev/null +++ b/source/Damage/Spells/Lulu/DamageLuluE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lulu E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lulu", SpellSlot.E)] + public class DamageLuluE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLuluE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 110, 140, 170, 200 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lulu/DamageLuluQ.cs b/source/Damage/Spells/Lulu/DamageLuluQ.cs new file mode 100644 index 00000000..661643a2 --- /dev/null +++ b/source/Damage/Spells/Lulu/DamageLuluQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lulu Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lulu", SpellSlot.Q)] + public class DamageLuluQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLuluQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lux/DamageLuxE.cs b/source/Damage/Spells/Lux/DamageLuxE.cs new file mode 100644 index 00000000..73ba8ba1 --- /dev/null +++ b/source/Damage/Spells/Lux/DamageLuxE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lux E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lux", SpellSlot.E)] + public class DamageLuxE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLuxE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lux/DamageLuxQ.cs b/source/Damage/Spells/Lux/DamageLuxQ.cs new file mode 100644 index 00000000..2c8a86d5 --- /dev/null +++ b/source/Damage/Spells/Lux/DamageLuxQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lux Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lux", SpellSlot.Q)] + public class DamageLuxQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLuxQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 100, 150, 200, 250 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Lux/DamageLuxR.cs b/source/Damage/Spells/Lux/DamageLuxR.cs new file mode 100644 index 00000000..ebc4f6b2 --- /dev/null +++ b/source/Damage/Spells/Lux/DamageLuxR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Lux R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Lux", SpellSlot.R)] + public class DamageLuxR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageLuxR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 300, 400, 500 }[level] + (0.75 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malphite/DamageMalphiteE.cs b/source/Damage/Spells/Malphite/DamageMalphiteE.cs new file mode 100644 index 00000000..1eac3c0d --- /dev/null +++ b/source/Damage/Spells/Malphite/DamageMalphiteE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malphite E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malphite", SpellSlot.E)] + public class DamageMalphiteE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalphiteE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + (0.3 * source.Armor) + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malphite/DamageMalphiteQ.cs b/source/Damage/Spells/Malphite/DamageMalphiteQ.cs new file mode 100644 index 00000000..c9f274b0 --- /dev/null +++ b/source/Damage/Spells/Malphite/DamageMalphiteQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malphite Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malphite", SpellSlot.Q)] + public class DamageMalphiteQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalphiteQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 120, 170, 220, 270 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malphite/DamageMalphiteR.cs b/source/Damage/Spells/Malphite/DamageMalphiteR.cs new file mode 100644 index 00000000..d65cf61f --- /dev/null +++ b/source/Damage/Spells/Malphite/DamageMalphiteR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malphite R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malphite", SpellSlot.R)] + public class DamageMalphiteR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalphiteR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 300, 400 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malphite/DamageMalphiteW.cs b/source/Damage/Spells/Malphite/DamageMalphiteW.cs new file mode 100644 index 00000000..5a15fd87 --- /dev/null +++ b/source/Damage/Spells/Malphite/DamageMalphiteW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malphite W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malphite", SpellSlot.W)] + public class DamageMalphiteW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalphiteW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 38, 46, 54, 62 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malzahar/DamageMalzaharE.cs b/source/Damage/Spells/Malzahar/DamageMalzaharE.cs new file mode 100644 index 00000000..500afefe --- /dev/null +++ b/source/Damage/Spells/Malzahar/DamageMalzaharE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malzahar E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malzahar", SpellSlot.E)] + public class DamageMalzaharE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalzaharE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 115, 150, 185, 220 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malzahar/DamageMalzaharQ.cs b/source/Damage/Spells/Malzahar/DamageMalzaharQ.cs new file mode 100644 index 00000000..f16e306e --- /dev/null +++ b/source/Damage/Spells/Malzahar/DamageMalzaharQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malzahar Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malzahar", SpellSlot.Q)] + public class DamageMalzaharQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalzaharQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malzahar/DamageMalzaharR.cs b/source/Damage/Spells/Malzahar/DamageMalzaharR.cs new file mode 100644 index 00000000..922d715b --- /dev/null +++ b/source/Damage/Spells/Malzahar/DamageMalzaharR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malzahar R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malzahar", SpellSlot.R)] + public class DamageMalzaharR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalzaharR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return 2.5 * ((new double[] { 6, 8, 10 }[level] / 100) + (0.015 * source.TotalMagicalDamage / 100)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Malzahar/DamageMalzaharW.cs b/source/Damage/Spells/Malzahar/DamageMalzaharW.cs new file mode 100644 index 00000000..03c4aba7 --- /dev/null +++ b/source/Damage/Spells/Malzahar/DamageMalzaharW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Malzahar W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Malzahar", SpellSlot.W)] + public class DamageMalzaharW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMalzaharW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new[] { 4, 4.5, 5, 5.5, 6 }[level] / 100) + (0.01 / 100 * source.TotalMagicalDamage)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Maokai/DamageMaokaiE.cs b/source/Damage/Spells/Maokai/DamageMaokaiE.cs new file mode 100644 index 00000000..b0410d1d --- /dev/null +++ b/source/Damage/Spells/Maokai/DamageMaokaiE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Maokai E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Maokai", SpellSlot.E)] + public class DamageMaokaiE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMaokaiE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 60, 80, 100, 120 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Maokai/DamageMaokaiE1.cs b/source/Damage/Spells/Maokai/DamageMaokaiE1.cs new file mode 100644 index 00000000..6286d666 --- /dev/null +++ b/source/Damage/Spells/Maokai/DamageMaokaiE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Maokai E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Maokai", SpellSlot.E, 1)] + public class DamageMaokaiE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMaokaiE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Maokai/DamageMaokaiQ.cs b/source/Damage/Spells/Maokai/DamageMaokaiQ.cs new file mode 100644 index 00000000..b82c77e6 --- /dev/null +++ b/source/Damage/Spells/Maokai/DamageMaokaiQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Maokai Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Maokai", SpellSlot.Q)] + public class DamageMaokaiQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMaokaiQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Maokai/DamageMaokaiR.cs b/source/Damage/Spells/Maokai/DamageMaokaiR.cs new file mode 100644 index 00000000..9fb21167 --- /dev/null +++ b/source/Damage/Spells/Maokai/DamageMaokaiR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Maokai R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Maokai", SpellSlot.R)] + public class DamageMaokaiR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMaokaiR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 150, 200 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Maokai/DamageMaokaiW.cs b/source/Damage/Spells/Maokai/DamageMaokaiW.cs new file mode 100644 index 00000000..923a6bdf --- /dev/null +++ b/source/Damage/Spells/Maokai/DamageMaokaiW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Maokai W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Maokai", SpellSlot.W)] + public class DamageMaokaiW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMaokaiW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new double[] { 9, 10, 11, 12, 13 }[level] / 100) + (0.03 / 100 * source.TotalMagicalDamage)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MasterYi/DamageMasterYiE.cs b/source/Damage/Spells/MasterYi/DamageMasterYiE.cs new file mode 100644 index 00000000..a9e086e7 --- /dev/null +++ b/source/Damage/Spells/MasterYi/DamageMasterYiE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MasterYi E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MasterYi", SpellSlot.E)] + public class DamageMasterYiE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMasterYiE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new[] { 10, 12.5, 15, 17.5, 20 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + new double[] { 10, 15, 20, 25, 30 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MasterYi/DamageMasterYiQ.cs b/source/Damage/Spells/MasterYi/DamageMasterYiQ.cs new file mode 100644 index 00000000..81b147be --- /dev/null +++ b/source/Damage/Spells/MasterYi/DamageMasterYiQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MasterYi Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MasterYi", SpellSlot.Q)] + public class DamageMasterYiQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMasterYiQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 25, 60, 95, 130, 165 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + (0.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MissFortune/DamageMissFortuneE.cs b/source/Damage/Spells/MissFortune/DamageMissFortuneE.cs new file mode 100644 index 00000000..e5d4138d --- /dev/null +++ b/source/Damage/Spells/MissFortune/DamageMissFortuneE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MissFortune E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MissFortune", SpellSlot.E)] + public class DamageMissFortuneE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMissFortuneE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 115, 150, 185, 220 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MissFortune/DamageMissFortuneQ.cs b/source/Damage/Spells/MissFortune/DamageMissFortuneQ.cs new file mode 100644 index 00000000..09b69168 --- /dev/null +++ b/source/Damage/Spells/MissFortune/DamageMissFortuneQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MissFortune Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MissFortune", SpellSlot.Q)] + public class DamageMissFortuneQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMissFortuneQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 35, 50, 65, 80 }[level] + (0.35 * source.TotalMagicalDamage) + (0.85 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MissFortune/DamageMissFortuneQ1.cs b/source/Damage/Spells/MissFortune/DamageMissFortuneQ1.cs new file mode 100644 index 00000000..8d7c4d0d --- /dev/null +++ b/source/Damage/Spells/MissFortune/DamageMissFortuneQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MissFortune Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MissFortune", SpellSlot.Q, 1)] + public class DamageMissFortuneQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMissFortuneQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 70, 100, 130, 160 }[level] + (0.5 * source.TotalMagicalDamage) + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MissFortune/DamageMissFortuneR.cs b/source/Damage/Spells/MissFortune/DamageMissFortuneR.cs new file mode 100644 index 00000000..a214fa8a --- /dev/null +++ b/source/Damage/Spells/MissFortune/DamageMissFortuneR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MissFortune R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MissFortune", SpellSlot.R)] + public class DamageMissFortuneR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMissFortuneR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (0.75 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MissFortune/DamageMissFortuneW.cs b/source/Damage/Spells/MissFortune/DamageMissFortuneW.cs new file mode 100644 index 00000000..c8674230 --- /dev/null +++ b/source/Damage/Spells/MissFortune/DamageMissFortuneW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MissFortune W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MissFortune", SpellSlot.W)] + public class DamageMissFortuneW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMissFortuneW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return 0.06 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MonkeyKing/DamageMonkeyKingE.cs b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingE.cs new file mode 100644 index 00000000..6376fb71 --- /dev/null +++ b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MonkeyKing E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MonkeyKing", SpellSlot.E)] + public class DamageMonkeyKingE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMonkeyKingE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.8 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MonkeyKing/DamageMonkeyKingQ.cs b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingQ.cs new file mode 100644 index 00000000..3d03fa71 --- /dev/null +++ b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MonkeyKing Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MonkeyKing", SpellSlot.Q)] + public class DamageMonkeyKingQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMonkeyKingQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 60, 90, 120, 150 }[level] + (0.1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MonkeyKing/DamageMonkeyKingR.cs b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingR.cs new file mode 100644 index 00000000..30531bad --- /dev/null +++ b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MonkeyKing R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MonkeyKing", SpellSlot.R)] + public class DamageMonkeyKingR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMonkeyKingR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 110, 200 }[level] + (1.1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/MonkeyKing/DamageMonkeyKingW.cs b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingW.cs new file mode 100644 index 00000000..2bc21373 --- /dev/null +++ b/source/Damage/Spells/MonkeyKing/DamageMonkeyKingW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, MonkeyKing W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("MonkeyKing", SpellSlot.W)] + public class DamageMonkeyKingW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMonkeyKingW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Mordekaiser/DamageMordekaiserE.cs b/source/Damage/Spells/Mordekaiser/DamageMordekaiserE.cs new file mode 100644 index 00000000..61b3bd63 --- /dev/null +++ b/source/Damage/Spells/Mordekaiser/DamageMordekaiserE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Mordekaiser E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Mordekaiser", SpellSlot.E)] + public class DamageMordekaiserE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMordekaiserE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Mordekaiser/DamageMordekaiserQ.cs b/source/Damage/Spells/Mordekaiser/DamageMordekaiserQ.cs new file mode 100644 index 00000000..78183aca --- /dev/null +++ b/source/Damage/Spells/Mordekaiser/DamageMordekaiserQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Mordekaiser Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Mordekaiser", SpellSlot.Q)] + public class DamageMordekaiserQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMordekaiserQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 110, 140, 170, 200 }[level] + (1 * source.FlatPhysicalDamageMod) + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Mordekaiser/DamageMordekaiserR.cs b/source/Damage/Spells/Mordekaiser/DamageMordekaiserR.cs new file mode 100644 index 00000000..912d65e1 --- /dev/null +++ b/source/Damage/Spells/Mordekaiser/DamageMordekaiserR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Mordekaiser R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Mordekaiser", SpellSlot.R)] + public class DamageMordekaiserR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMordekaiserR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new double[] { 24, 29, 34 }[level] / 100) + (0.04 / 100 * source.TotalMagicalDamage)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Mordekaiser/DamageMordekaiserW.cs b/source/Damage/Spells/Mordekaiser/DamageMordekaiserW.cs new file mode 100644 index 00000000..0c7cba09 --- /dev/null +++ b/source/Damage/Spells/Mordekaiser/DamageMordekaiserW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Mordekaiser W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Mordekaiser", SpellSlot.W)] + public class DamageMordekaiserW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMordekaiserW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 24, 38, 52, 66, 80 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Morgana/DamageMorganaQ.cs b/source/Damage/Spells/Morgana/DamageMorganaQ.cs new file mode 100644 index 00000000..2d99521d --- /dev/null +++ b/source/Damage/Spells/Morgana/DamageMorganaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Morgana Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Morgana", SpellSlot.Q)] + public class DamageMorganaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMorganaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 135, 190, 245, 300 }[level] + (0.9 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Morgana/DamageMorganaR.cs b/source/Damage/Spells/Morgana/DamageMorganaR.cs new file mode 100644 index 00000000..29720619 --- /dev/null +++ b/source/Damage/Spells/Morgana/DamageMorganaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Morgana R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Morgana", SpellSlot.R)] + public class DamageMorganaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMorganaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 225, 300 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Morgana/DamageMorganaW.cs b/source/Damage/Spells/Morgana/DamageMorganaW.cs new file mode 100644 index 00000000..e5f13615 --- /dev/null +++ b/source/Damage/Spells/Morgana/DamageMorganaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Morgana W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Morgana", SpellSlot.W)] + public class DamageMorganaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageMorganaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 8, 16, 24, 32, 40 }[level] + (0.11 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nami/DamageNamiE.cs b/source/Damage/Spells/Nami/DamageNamiE.cs new file mode 100644 index 00000000..d453b988 --- /dev/null +++ b/source/Damage/Spells/Nami/DamageNamiE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nami E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nami", SpellSlot.E)] + public class DamageNamiE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNamiE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 25, 40, 55, 70, 85 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nami/DamageNamiQ.cs b/source/Damage/Spells/Nami/DamageNamiQ.cs new file mode 100644 index 00000000..f7b358a1 --- /dev/null +++ b/source/Damage/Spells/Nami/DamageNamiQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nami Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nami", SpellSlot.Q)] + public class DamageNamiQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNamiQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 130, 185, 240, 295 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nami/DamageNamiR.cs b/source/Damage/Spells/Nami/DamageNamiR.cs new file mode 100644 index 00000000..66c4d5d8 --- /dev/null +++ b/source/Damage/Spells/Nami/DamageNamiR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nami R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nami", SpellSlot.R)] + public class DamageNamiR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNamiR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nami/DamageNamiW.cs b/source/Damage/Spells/Nami/DamageNamiW.cs new file mode 100644 index 00000000..c71b645a --- /dev/null +++ b/source/Damage/Spells/Nami/DamageNamiW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nami W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nami", SpellSlot.W)] + public class DamageNamiW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNamiW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nasus/DamageNasusE.cs b/source/Damage/Spells/Nasus/DamageNasusE.cs new file mode 100644 index 00000000..cf89f041 --- /dev/null +++ b/source/Damage/Spells/Nasus/DamageNasusE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nasus E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nasus", SpellSlot.E)] + public class DamageNasusE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNasusE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 95, 135, 175, 215 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nasus/DamageNasusE1.cs b/source/Damage/Spells/Nasus/DamageNasusE1.cs new file mode 100644 index 00000000..b2a55b80 --- /dev/null +++ b/source/Damage/Spells/Nasus/DamageNasusE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nasus E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nasus", SpellSlot.E, 1)] + public class DamageNasusE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNasusE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 11, 19, 27, 35, 43 }[level] + (0.12 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nasus/DamageNasusQ.cs b/source/Damage/Spells/Nasus/DamageNasusQ.cs new file mode 100644 index 00000000..4b086866 --- /dev/null +++ b/source/Damage/Spells/Nasus/DamageNasusQ.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Spell Damage, Nasus Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nasus", SpellSlot.Q)] + public class DamageNasusQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNasusQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (from buff in ObjectManager.Player.Buffs where buff.Name == "nasusqstacks" select buff.Count).FirstOrDefault() + new double[] { 30, 50, 70, 90, 110 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nasus/DamageNasusR.cs b/source/Damage/Spells/Nasus/DamageNasusR.cs new file mode 100644 index 00000000..8922ec70 --- /dev/null +++ b/source/Damage/Spells/Nasus/DamageNasusR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nasus R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nasus", SpellSlot.R)] + public class DamageNasusR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNasusR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new double[] { 3, 4, 5 }[level] / 100) + (0.01 / 100 * source.TotalMagicalDamage)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nautilus/DamageNautilusE.cs b/source/Damage/Spells/Nautilus/DamageNautilusE.cs new file mode 100644 index 00000000..680ae84c --- /dev/null +++ b/source/Damage/Spells/Nautilus/DamageNautilusE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nautilus E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nautilus", SpellSlot.E)] + public class DamageNautilusE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNautilusE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nautilus/DamageNautilusQ.cs b/source/Damage/Spells/Nautilus/DamageNautilusQ.cs new file mode 100644 index 00000000..ecf3974d --- /dev/null +++ b/source/Damage/Spells/Nautilus/DamageNautilusQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nautilus Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nautilus", SpellSlot.Q)] + public class DamageNautilusQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNautilusQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.75 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nautilus/DamageNautilusR.cs b/source/Damage/Spells/Nautilus/DamageNautilusR.cs new file mode 100644 index 00000000..cf24cfe2 --- /dev/null +++ b/source/Damage/Spells/Nautilus/DamageNautilusR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nautilus R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nautilus", SpellSlot.R)] + public class DamageNautilusR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNautilusR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 325, 450 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nautilus/DamageNautilusR1.cs b/source/Damage/Spells/Nautilus/DamageNautilusR1.cs new file mode 100644 index 00000000..7fa8bb2f --- /dev/null +++ b/source/Damage/Spells/Nautilus/DamageNautilusR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nautilus R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nautilus", SpellSlot.R, 1)] + public class DamageNautilusR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNautilusR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 125, 175, 225 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nautilus/DamageNautilusW.cs b/source/Damage/Spells/Nautilus/DamageNautilusW.cs new file mode 100644 index 00000000..3bc94e82 --- /dev/null +++ b/source/Damage/Spells/Nautilus/DamageNautilusW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nautilus W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nautilus", SpellSlot.W)] + public class DamageNautilusW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNautilusW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 40, 50, 60, 70 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nidalee/DamageNidaleeE1.cs b/source/Damage/Spells/Nidalee/DamageNidaleeE1.cs new file mode 100644 index 00000000..e7bd95fd --- /dev/null +++ b/source/Damage/Spells/Nidalee/DamageNidaleeE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nidalee E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nidalee", SpellSlot.E, 1)] + public class DamageNidaleeE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNidaleeE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 130, 190, 250 }[source.Spellbook.GetSpell(SpellSlot.R).Level - 1] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nidalee/DamageNidaleeQ.cs b/source/Damage/Spells/Nidalee/DamageNidaleeQ.cs new file mode 100644 index 00000000..221a4127 --- /dev/null +++ b/source/Damage/Spells/Nidalee/DamageNidaleeQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nidalee Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nidalee", SpellSlot.Q)] + public class DamageNidaleeQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNidaleeQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 60, 77.5, 95, 112.5, 130 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nidalee/DamageNidaleeQ1.cs b/source/Damage/Spells/Nidalee/DamageNidaleeQ1.cs new file mode 100644 index 00000000..b88a5e8d --- /dev/null +++ b/source/Damage/Spells/Nidalee/DamageNidaleeQ1.cs @@ -0,0 +1,45 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nidalee Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nidalee", SpellSlot.Q, 1)] + public class DamageNidaleeQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNidaleeQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + var dmg = (new double[] { 4, 20, 50, 90 }[source.Spellbook.GetSpell(SpellSlot.R).Level - 1] + + (0.36 * source.TotalMagicalDamage) + + (0.75 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod))) + * (((target.MaxHealth - target.Health) / target.MaxHealth * 1.5) + 1); + dmg *= target.HasBuff("nidaleepassivehunted") ? 1.33 : 1.0; + return dmg; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nidalee/DamageNidaleeW.cs b/source/Damage/Spells/Nidalee/DamageNidaleeW.cs new file mode 100644 index 00000000..38f11800 --- /dev/null +++ b/source/Damage/Spells/Nidalee/DamageNidaleeW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nidalee W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nidalee", SpellSlot.W)] + public class DamageNidaleeW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNidaleeW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 80, 120, 160, 200 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nidalee/DamageNidaleeW1.cs b/source/Damage/Spells/Nidalee/DamageNidaleeW1.cs new file mode 100644 index 00000000..566218ab --- /dev/null +++ b/source/Damage/Spells/Nidalee/DamageNidaleeW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nidalee W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nidalee", SpellSlot.W, 1)] + public class DamageNidaleeW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNidaleeW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210 }[source.Spellbook.GetSpell(SpellSlot.R).Level - 1] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nocturne/DamageNocturneE.cs b/source/Damage/Spells/Nocturne/DamageNocturneE.cs new file mode 100644 index 00000000..c0dc8e61 --- /dev/null +++ b/source/Damage/Spells/Nocturne/DamageNocturneE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nocturne E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nocturne", SpellSlot.E)] + public class DamageNocturneE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNocturneE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 260 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nocturne/DamageNocturneQ.cs b/source/Damage/Spells/Nocturne/DamageNocturneQ.cs new file mode 100644 index 00000000..0618ebbe --- /dev/null +++ b/source/Damage/Spells/Nocturne/DamageNocturneQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nocturne Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nocturne", SpellSlot.Q)] + public class DamageNocturneQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNocturneQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.75 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nocturne/DamageNocturneR.cs b/source/Damage/Spells/Nocturne/DamageNocturneR.cs new file mode 100644 index 00000000..e0b818bd --- /dev/null +++ b/source/Damage/Spells/Nocturne/DamageNocturneR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nocturne R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nocturne", SpellSlot.R)] + public class DamageNocturneR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNocturneR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (1.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nunu/DamageNunuE.cs b/source/Damage/Spells/Nunu/DamageNunuE.cs new file mode 100644 index 00000000..d23eda6f --- /dev/null +++ b/source/Damage/Spells/Nunu/DamageNunuE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nunu E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nunu", SpellSlot.E)] + public class DamageNunuE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNunuE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 85, 130, 175, 225, 275 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nunu/DamageNunuQ.cs b/source/Damage/Spells/Nunu/DamageNunuQ.cs new file mode 100644 index 00000000..37abab56 --- /dev/null +++ b/source/Damage/Spells/Nunu/DamageNunuQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nunu Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nunu", SpellSlot.Q)] + public class DamageNunuQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNunuQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 400, 550, 700, 850, 1000 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Nunu/DamageNunuR.cs b/source/Damage/Spells/Nunu/DamageNunuR.cs new file mode 100644 index 00000000..b6934c1a --- /dev/null +++ b/source/Damage/Spells/Nunu/DamageNunuR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Nunu R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Nunu", SpellSlot.R)] + public class DamageNunuR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageNunuR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 625, 875, 1125 }[level] + (2.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Olaf/DamageOlafE.cs b/source/Damage/Spells/Olaf/DamageOlafE.cs new file mode 100644 index 00000000..6391ad3f --- /dev/null +++ b/source/Damage/Spells/Olaf/DamageOlafE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Olaf E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Olaf", SpellSlot.E)] + public class DamageOlafE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageOlafE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.4 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Olaf/DamageOlafQ.cs b/source/Damage/Spells/Olaf/DamageOlafQ.cs new file mode 100644 index 00000000..acfcca9e --- /dev/null +++ b/source/Damage/Spells/Olaf/DamageOlafQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Olaf Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Olaf", SpellSlot.Q)] + public class DamageOlafQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageOlafQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Orianna/DamageOriannaE.cs b/source/Damage/Spells/Orianna/DamageOriannaE.cs new file mode 100644 index 00000000..ba15916f --- /dev/null +++ b/source/Damage/Spells/Orianna/DamageOriannaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Orianna E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Orianna", SpellSlot.E)] + public class DamageOriannaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageOriannaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Orianna/DamageOriannaQ.cs b/source/Damage/Spells/Orianna/DamageOriannaQ.cs new file mode 100644 index 00000000..c74a97ea --- /dev/null +++ b/source/Damage/Spells/Orianna/DamageOriannaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Orianna Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Orianna", SpellSlot.Q)] + public class DamageOriannaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageOriannaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Orianna/DamageOriannaR.cs b/source/Damage/Spells/Orianna/DamageOriannaR.cs new file mode 100644 index 00000000..4971d173 --- /dev/null +++ b/source/Damage/Spells/Orianna/DamageOriannaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Orianna R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Orianna", SpellSlot.R)] + public class DamageOriannaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageOriannaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 225, 300 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Orianna/DamageOriannaW.cs b/source/Damage/Spells/Orianna/DamageOriannaW.cs new file mode 100644 index 00000000..b4b68f12 --- /dev/null +++ b/source/Damage/Spells/Orianna/DamageOriannaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Orianna W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Orianna", SpellSlot.W)] + public class DamageOriannaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageOriannaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Pantheon/DamagePantheonE.cs b/source/Damage/Spells/Pantheon/DamagePantheonE.cs new file mode 100644 index 00000000..383c8333 --- /dev/null +++ b/source/Damage/Spells/Pantheon/DamagePantheonE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Pantheon E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Pantheon", SpellSlot.E)] + public class DamagePantheonE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePantheonE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 13, 23, 33, 43, 53 }[level] + (0.6 * source.FlatPhysicalDamageMod)) * ((target is Obj_AI_Hero) ? 2 : 1); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Pantheon/DamagePantheonQ.cs b/source/Damage/Spells/Pantheon/DamagePantheonQ.cs new file mode 100644 index 00000000..6671c78e --- /dev/null +++ b/source/Damage/Spells/Pantheon/DamagePantheonQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Pantheon Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Pantheon", SpellSlot.Q)] + public class DamagePantheonQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePantheonQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 65, 105, 145, 185, 225 }[level] + (1.4 * source.FlatPhysicalDamageMod)) * ((target.Health / target.MaxHealth < 0.15) ? 2 : 1); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Pantheon/DamagePantheonR.cs b/source/Damage/Spells/Pantheon/DamagePantheonR.cs new file mode 100644 index 00000000..ed188ec1 --- /dev/null +++ b/source/Damage/Spells/Pantheon/DamagePantheonR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Pantheon R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Pantheon", SpellSlot.R)] + public class DamagePantheonR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePantheonR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 400, 700, 1000 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Pantheon/DamagePantheonR1.cs b/source/Damage/Spells/Pantheon/DamagePantheonR1.cs new file mode 100644 index 00000000..7f4fdd89 --- /dev/null +++ b/source/Damage/Spells/Pantheon/DamagePantheonR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Pantheon R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Pantheon", SpellSlot.R, 1)] + public class DamagePantheonR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePantheonR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 400, 700, 1000 }[level] + (1 * source.TotalMagicalDamage)) * 0.5; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Pantheon/DamagePantheonW.cs b/source/Damage/Spells/Pantheon/DamagePantheonW.cs new file mode 100644 index 00000000..21850e1f --- /dev/null +++ b/source/Damage/Spells/Pantheon/DamagePantheonW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Pantheon W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Pantheon", SpellSlot.W)] + public class DamagePantheonW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePantheonW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 75, 100, 125, 150 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Poppy/DamagePoppyE.cs b/source/Damage/Spells/Poppy/DamagePoppyE.cs new file mode 100644 index 00000000..f17a6167 --- /dev/null +++ b/source/Damage/Spells/Poppy/DamagePoppyE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Poppy E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Poppy", SpellSlot.E)] + public class DamagePoppyE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePoppyE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 70, 90, 110, 130 }[level] + (0.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Poppy/DamagePoppyE1.cs b/source/Damage/Spells/Poppy/DamagePoppyE1.cs new file mode 100644 index 00000000..22d743d5 --- /dev/null +++ b/source/Damage/Spells/Poppy/DamagePoppyE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Poppy E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Poppy", SpellSlot.E, 1)] + public class DamagePoppyE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePoppyE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 140, 180, 220, 260 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Poppy/DamagePoppyQ.cs b/source/Damage/Spells/Poppy/DamagePoppyQ.cs new file mode 100644 index 00000000..ffd2878e --- /dev/null +++ b/source/Damage/Spells/Poppy/DamagePoppyQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Poppy Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Poppy", SpellSlot.Q)] + public class DamagePoppyQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePoppyQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 35, 55, 75, 95, 115 }[level] + (0.80 * source.FlatPhysicalDamageMod) + (0.07 * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Poppy/DamagePoppyQ1.cs b/source/Damage/Spells/Poppy/DamagePoppyQ1.cs new file mode 100644 index 00000000..0a8d1554 --- /dev/null +++ b/source/Damage/Spells/Poppy/DamagePoppyQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Poppy Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Poppy", SpellSlot.Q, 1)] + public class DamagePoppyQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePoppyQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (1.6 * source.FlatPhysicalDamageMod) + (0.14 * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Poppy/DamagePoppyR.cs b/source/Damage/Spells/Poppy/DamagePoppyR.cs new file mode 100644 index 00000000..303b4a17 --- /dev/null +++ b/source/Damage/Spells/Poppy/DamagePoppyR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Poppy R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Poppy", SpellSlot.R)] + public class DamagePoppyR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePoppyR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 300, 400 }[level] + (0.9 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Poppy/DamagePoppyW.cs b/source/Damage/Spells/Poppy/DamagePoppyW.cs new file mode 100644 index 00000000..09bd4f52 --- /dev/null +++ b/source/Damage/Spells/Poppy/DamagePoppyW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Poppy W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Poppy", SpellSlot.W)] + public class DamagePoppyW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamagePoppyW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Quinn/DamageQuinnE.cs b/source/Damage/Spells/Quinn/DamageQuinnE.cs new file mode 100644 index 00000000..c6814944 --- /dev/null +++ b/source/Damage/Spells/Quinn/DamageQuinnE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Quinn E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Quinn", SpellSlot.E)] + public class DamageQuinnE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageQuinnE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 70, 100, 130, 160 }[level] + (0.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Quinn/DamageQuinnQ.cs b/source/Damage/Spells/Quinn/DamageQuinnQ.cs new file mode 100644 index 00000000..ab4538fe --- /dev/null +++ b/source/Damage/Spells/Quinn/DamageQuinnQ.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Quinn Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Quinn", SpellSlot.Q)] + public class DamageQuinnQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageQuinnQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + var damage = new double[] { 20, 45, 70, 95, 120 }[level] + + (new[] { 0.8, 0.9, 1.0, 1.1, 1.2 }[level] * source.TotalAttackDamage) + + (0.35 * source.TotalMagicalDamage); + damage += damage * ((100 - target.HealthPercent) / 100); + return damage; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Quinn/DamageQuinnR.cs b/source/Damage/Spells/Quinn/DamageQuinnR.cs new file mode 100644 index 00000000..6ee71740 --- /dev/null +++ b/source/Damage/Spells/Quinn/DamageQuinnR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Quinn R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Quinn", SpellSlot.R)] + public class DamageQuinnR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageQuinnR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return source.TotalAttackDamage; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rammus/DamageRammusQ.cs b/source/Damage/Spells/Rammus/DamageRammusQ.cs new file mode 100644 index 00000000..c00fcf38 --- /dev/null +++ b/source/Damage/Spells/Rammus/DamageRammusQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rammus Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rammus", SpellSlot.Q)] + public class DamageRammusQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRammusQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 150, 200, 250, 300 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rammus/DamageRammusR.cs b/source/Damage/Spells/Rammus/DamageRammusR.cs new file mode 100644 index 00000000..18401616 --- /dev/null +++ b/source/Damage/Spells/Rammus/DamageRammusR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rammus R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rammus", SpellSlot.R)] + public class DamageRammusR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRammusR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 130, 195 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rammus/DamageRammusW.cs b/source/Damage/Spells/Rammus/DamageRammusW.cs new file mode 100644 index 00000000..4831839a --- /dev/null +++ b/source/Damage/Spells/Rammus/DamageRammusW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rammus W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rammus", SpellSlot.W)] + public class DamageRammusW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRammusW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 15, 25, 35, 45, 55 }[level] + (0.1 * source.Armor); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Renekton/DamageRenektonE.cs b/source/Damage/Spells/Renekton/DamageRenektonE.cs new file mode 100644 index 00000000..34971f74 --- /dev/null +++ b/source/Damage/Spells/Renekton/DamageRenektonE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Renekton E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Renekton", SpellSlot.E)] + public class DamageRenektonE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRenektonE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 30, 60, 90, 120, 150 }[level] + (0.9 * source.FlatPhysicalDamageMod)) * 1.5; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Renekton/DamageRenektonQ.cs b/source/Damage/Spells/Renekton/DamageRenektonQ.cs new file mode 100644 index 00000000..5395a39e --- /dev/null +++ b/source/Damage/Spells/Renekton/DamageRenektonQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Renekton Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Renekton", SpellSlot.Q)] + public class DamageRenektonQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRenektonQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.8 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Renekton/DamageRenektonQ1.cs b/source/Damage/Spells/Renekton/DamageRenektonQ1.cs new file mode 100644 index 00000000..7c0a4d86 --- /dev/null +++ b/source/Damage/Spells/Renekton/DamageRenektonQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Renekton Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Renekton", SpellSlot.Q, 1)] + public class DamageRenektonQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRenektonQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 60, 90, 120, 150, 180 }[level] + (0.8 * source.FlatPhysicalDamageMod)) * 1.5; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Renekton/DamageRenektonR.cs b/source/Damage/Spells/Renekton/DamageRenektonR.cs new file mode 100644 index 00000000..924afeee --- /dev/null +++ b/source/Damage/Spells/Renekton/DamageRenektonR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Renekton R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Renekton", SpellSlot.R)] + public class DamageRenektonR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRenektonR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 60, 120 }[level] + (0.1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Renekton/DamageRenektonW.cs b/source/Damage/Spells/Renekton/DamageRenektonW.cs new file mode 100644 index 00000000..ead43950 --- /dev/null +++ b/source/Damage/Spells/Renekton/DamageRenektonW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Renekton W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Renekton", SpellSlot.W)] + public class DamageRenektonW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRenektonW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 30, 50, 70, 90 }[level] + (1.5 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Renekton/DamageRenektonW1.cs b/source/Damage/Spells/Renekton/DamageRenektonW1.cs new file mode 100644 index 00000000..eeaa11dd --- /dev/null +++ b/source/Damage/Spells/Renekton/DamageRenektonW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Renekton W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Renekton", SpellSlot.W, 1)] + public class DamageRenektonW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRenektonW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 10, 30, 50, 70, 90 }[level] + (1.5 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod))) * 1.5; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rengar/DamageRengarE.cs b/source/Damage/Spells/Rengar/DamageRengarE.cs new file mode 100644 index 00000000..f759018c --- /dev/null +++ b/source/Damage/Spells/Rengar/DamageRengarE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rengar E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rengar", SpellSlot.E)] + public class DamageRengarE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRengarE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 100, 150, 200, 250 }[level] + (0.7 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rengar/DamageRengarQ.cs b/source/Damage/Spells/Rengar/DamageRengarQ.cs new file mode 100644 index 00000000..65790676 --- /dev/null +++ b/source/Damage/Spells/Rengar/DamageRengarQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rengar Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rengar", SpellSlot.Q)] + public class DamageRengarQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRengarQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 60, 90, 120, 150 }[level] + (((new double[] { 100, 105, 110, 115, 120 }[level] / 100) - 1) * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rengar/DamageRengarW.cs b/source/Damage/Spells/Rengar/DamageRengarW.cs new file mode 100644 index 00000000..8e26f818 --- /dev/null +++ b/source/Damage/Spells/Rengar/DamageRengarW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rengar W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rengar", SpellSlot.W)] + public class DamageRengarW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRengarW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 80, 110, 140, 170 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Riven/DamageRivenQ.cs b/source/Damage/Spells/Riven/DamageRivenQ.cs new file mode 100644 index 00000000..88287a03 --- /dev/null +++ b/source/Damage/Spells/Riven/DamageRivenQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Riven Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Riven", SpellSlot.Q)] + public class DamageRivenQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRivenQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 30, 50, 70, 90 }[level] + (((source.BaseAttackDamage + source.FlatPhysicalDamageMod) / 100) * new double[] { 40, 45, 50, 55, 60 }[level]); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Riven/DamageRivenR.cs b/source/Damage/Spells/Riven/DamageRivenR.cs new file mode 100644 index 00000000..892c1458 --- /dev/null +++ b/source/Damage/Spells/Riven/DamageRivenR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Riven R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Riven", SpellSlot.R)] + public class DamageRivenR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRivenR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 80, 120, 160 }[level] + (0.6 * source.FlatPhysicalDamageMod)) * (((target.MaxHealth - target.Health) / target.MaxHealth * 2.67) + 1); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Riven/DamageRivenW.cs b/source/Damage/Spells/Riven/DamageRivenW.cs new file mode 100644 index 00000000..bcb64d08 --- /dev/null +++ b/source/Damage/Spells/Riven/DamageRivenW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Riven W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Riven", SpellSlot.W)] + public class DamageRivenW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRivenW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 80, 110, 140, 170 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rumble/DamageRumbleE.cs b/source/Damage/Spells/Rumble/DamageRumbleE.cs new file mode 100644 index 00000000..8e4da0f2 --- /dev/null +++ b/source/Damage/Spells/Rumble/DamageRumbleE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rumble E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rumble", SpellSlot.E)] + public class DamageRumbleE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRumbleE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 45, 70, 95, 120, 145 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rumble/DamageRumbleE1.cs b/source/Damage/Spells/Rumble/DamageRumbleE1.cs new file mode 100644 index 00000000..aab9719e --- /dev/null +++ b/source/Damage/Spells/Rumble/DamageRumbleE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rumble E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rumble", SpellSlot.E, 1)] + public class DamageRumbleE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRumbleE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 67.5, 105, 142.5, 180, 217.5 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rumble/DamageRumbleQ.cs b/source/Damage/Spells/Rumble/DamageRumbleQ.cs new file mode 100644 index 00000000..e50a49ba --- /dev/null +++ b/source/Damage/Spells/Rumble/DamageRumbleQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rumble Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rumble", SpellSlot.Q)] + public class DamageRumbleQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRumbleQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 135, 195, 255, 315 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rumble/DamageRumbleQ1.cs b/source/Damage/Spells/Rumble/DamageRumbleQ1.cs new file mode 100644 index 00000000..ffc4f23e --- /dev/null +++ b/source/Damage/Spells/Rumble/DamageRumbleQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rumble Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rumble", SpellSlot.Q, 1)] + public class DamageRumbleQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRumbleQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 112.5, 202.5, 292.5, 382.5, 472.5 }[level] + (1.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rumble/DamageRumbleR.cs b/source/Damage/Spells/Rumble/DamageRumbleR.cs new file mode 100644 index 00000000..9d0245ca --- /dev/null +++ b/source/Damage/Spells/Rumble/DamageRumbleR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rumble R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rumble", SpellSlot.R)] + public class DamageRumbleR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRumbleR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 130, 185, 240 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Rumble/DamageRumbleR1.cs b/source/Damage/Spells/Rumble/DamageRumbleR1.cs new file mode 100644 index 00000000..7e0decfc --- /dev/null +++ b/source/Damage/Spells/Rumble/DamageRumbleR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Rumble R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Rumble", SpellSlot.R, 1)] + public class DamageRumbleR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRumbleR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 650, 925, 1200 }[level] + (1.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ryze/DamageRyzeE.cs b/source/Damage/Spells/Ryze/DamageRyzeE.cs new file mode 100644 index 00000000..4fe08e18 --- /dev/null +++ b/source/Damage/Spells/Ryze/DamageRyzeE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ryze E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ryze", SpellSlot.E)] + public class DamageRyzeE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRyzeE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 75, 100, 125, 150 }[level] + (0.3 * source.TotalMagicalDamage) + (0.02 * (source.MaxMana - 392.4 - (52 * (source as Obj_AI_Hero).Level))); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ryze/DamageRyzeQ.cs b/source/Damage/Spells/Ryze/DamageRyzeQ.cs new file mode 100644 index 00000000..81af1e76 --- /dev/null +++ b/source/Damage/Spells/Ryze/DamageRyzeQ.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ryze Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ryze", SpellSlot.Q)] + public class DamageRyzeQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRyzeQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + var objAiHero = source as Obj_AI_Hero; + if (objAiHero != null) + { + return (new double[] { 60, 85, 110, 135, 160, 185 }[level] + (0.45 * source.TotalMagicalDamage) + + (0.03 * (source.MaxMana - 392.4 - (52 * objAiHero.Level)))) + * (1 + + (target.HasBuff("RyzeE") + ? new double[] { 40, 55, 70, 85, 100 }[ + ObjectManager.Player.Spellbook.GetSpell(SpellSlot.E).Level - 1] / 100 + : 0)); + } + + return 0d; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ryze/DamageRyzeW.cs b/source/Damage/Spells/Ryze/DamageRyzeW.cs new file mode 100644 index 00000000..0b67bad8 --- /dev/null +++ b/source/Damage/Spells/Ryze/DamageRyzeW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ryze W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ryze", SpellSlot.W)] + public class DamageRyzeW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageRyzeW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 100, 120, 140, 160 }[level] + (0.2 * source.TotalMagicalDamage) + (0.01 * (source.MaxMana - 392.4 - (52 * (source as Obj_AI_Hero).Level))); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sejuani/DamageSejuaniE.cs b/source/Damage/Spells/Sejuani/DamageSejuaniE.cs new file mode 100644 index 00000000..9574beaa --- /dev/null +++ b/source/Damage/Spells/Sejuani/DamageSejuaniE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sejuani E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sejuani", SpellSlot.E)] + public class DamageSejuaniE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSejuaniE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sejuani/DamageSejuaniQ.cs b/source/Damage/Spells/Sejuani/DamageSejuaniQ.cs new file mode 100644 index 00000000..12121917 --- /dev/null +++ b/source/Damage/Spells/Sejuani/DamageSejuaniQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sejuani Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sejuani", SpellSlot.Q)] + public class DamageSejuaniQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSejuaniQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sejuani/DamageSejuaniR.cs b/source/Damage/Spells/Sejuani/DamageSejuaniR.cs new file mode 100644 index 00000000..873b60cb --- /dev/null +++ b/source/Damage/Spells/Sejuani/DamageSejuaniR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sejuani R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sejuani", SpellSlot.R)] + public class DamageSejuaniR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSejuaniR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sejuani/DamageSejuaniW.cs b/source/Damage/Spells/Sejuani/DamageSejuaniW.cs new file mode 100644 index 00000000..32ccf34b --- /dev/null +++ b/source/Damage/Spells/Sejuani/DamageSejuaniW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sejuani W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sejuani", SpellSlot.W)] + public class DamageSejuaniW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSejuaniW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 4, 4.5, 5, 5.5, 6 }[level] / 100 * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sejuani/DamageSejuaniW1.cs b/source/Damage/Spells/Sejuani/DamageSejuaniW1.cs new file mode 100644 index 00000000..8788c16f --- /dev/null +++ b/source/Damage/Spells/Sejuani/DamageSejuaniW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sejuani W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sejuani", SpellSlot.W, 1)] + public class DamageSejuaniW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSejuaniW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 10, 17.5, 25, 32.5, 40 }[level] + ((new double[] { 4, 6, 8, 10, 12 }[level] / 100) * source.MaxHealth) + (0.15 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shaco/DamageShacoE.cs b/source/Damage/Spells/Shaco/DamageShacoE.cs new file mode 100644 index 00000000..8e1ba8b9 --- /dev/null +++ b/source/Damage/Spells/Shaco/DamageShacoE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shaco E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shaco", SpellSlot.E)] + public class DamageShacoE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShacoE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 90, 130, 170, 210 }[level] + (1 * source.FlatPhysicalDamageMod) + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shaco/DamageShacoQ.cs b/source/Damage/Spells/Shaco/DamageShacoQ.cs new file mode 100644 index 00000000..64f7d181 --- /dev/null +++ b/source/Damage/Spells/Shaco/DamageShacoQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shaco Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shaco", SpellSlot.Q)] + public class DamageShacoQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShacoQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 140, 160, 180, 200, 220 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shaco/DamageShacoR.cs b/source/Damage/Spells/Shaco/DamageShacoR.cs new file mode 100644 index 00000000..108f5d4c --- /dev/null +++ b/source/Damage/Spells/Shaco/DamageShacoR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shaco R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shaco", SpellSlot.R)] + public class DamageShacoR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShacoR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 300, 450, 600 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shaco/DamageShacoW.cs b/source/Damage/Spells/Shaco/DamageShacoW.cs new file mode 100644 index 00000000..247f335c --- /dev/null +++ b/source/Damage/Spells/Shaco/DamageShacoW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shaco W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shaco", SpellSlot.W)] + public class DamageShacoW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShacoW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 35, 50, 65, 80, 95 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shen/DamageShenE.cs b/source/Damage/Spells/Shen/DamageShenE.cs new file mode 100644 index 00000000..050319fd --- /dev/null +++ b/source/Damage/Spells/Shen/DamageShenE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shen E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shen", SpellSlot.E)] + public class DamageShenE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShenE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 85, 120, 155, 190 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shen/DamageShenQ.cs b/source/Damage/Spells/Shen/DamageShenQ.cs new file mode 100644 index 00000000..a6e9c5dc --- /dev/null +++ b/source/Damage/Spells/Shen/DamageShenQ.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shen Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shen", SpellSlot.Q)] + public class DamageShenQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShenQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + var dmg = (new[] { 3, 3.5, 4, 4.5, 5 }[level] + (0.015 * source.TotalMagicalDamage)) * target.MaxHealth + / 100; + if (target is Obj_AI_Hero) + { + return dmg; + } + + return Math.Min( + new double[] { 30, 50, 70, 90, 110 }[level] + dmg, + new double[] { 75, 100, 125, 150, 175 }[level]); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shen/DamageShenQ1.cs b/source/Damage/Spells/Shen/DamageShenQ1.cs new file mode 100644 index 00000000..3b2bc82b --- /dev/null +++ b/source/Damage/Spells/Shen/DamageShenQ1.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shen Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shen", SpellSlot.Q, 1)] + public class DamageShenQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShenQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + var dmg = (new[] { 5, 5.5, 6, 6.6, 7 }[level] + (0.02 * source.TotalMagicalDamage)) + * target.MaxHealth / 100; + if (target is Obj_AI_Hero) + { + return dmg; + } + + return Math.Min( + new double[] { 30, 50, 70, 90, 110 }[level] + dmg, + new double[] { 75, 100, 125, 150, 175 }[level]); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shyvana/DamageShyvanaE.cs b/source/Damage/Spells/Shyvana/DamageShyvanaE.cs new file mode 100644 index 00000000..4d79ce16 --- /dev/null +++ b/source/Damage/Spells/Shyvana/DamageShyvanaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shyvana E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shyvana", SpellSlot.E)] + public class DamageShyvanaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShyvanaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 100, 140, 180, 220 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shyvana/DamageShyvanaQ.cs b/source/Damage/Spells/Shyvana/DamageShyvanaQ.cs new file mode 100644 index 00000000..313c8da3 --- /dev/null +++ b/source/Damage/Spells/Shyvana/DamageShyvanaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shyvana Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shyvana", SpellSlot.Q)] + public class DamageShyvanaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShyvanaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 85, 90, 95, 100 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shyvana/DamageShyvanaR.cs b/source/Damage/Spells/Shyvana/DamageShyvanaR.cs new file mode 100644 index 00000000..f4a98961 --- /dev/null +++ b/source/Damage/Spells/Shyvana/DamageShyvanaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shyvana R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shyvana", SpellSlot.R)] + public class DamageShyvanaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShyvanaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 175, 300, 425 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Shyvana/DamageShyvanaW.cs b/source/Damage/Spells/Shyvana/DamageShyvanaW.cs new file mode 100644 index 00000000..cdc3cbc1 --- /dev/null +++ b/source/Damage/Spells/Shyvana/DamageShyvanaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Shyvana W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Shyvana", SpellSlot.W)] + public class DamageShyvanaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageShyvanaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 35, 50, 65, 80 }[level] + (0.2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Singed/DamageSingedE.cs b/source/Damage/Spells/Singed/DamageSingedE.cs new file mode 100644 index 00000000..3770deaa --- /dev/null +++ b/source/Damage/Spells/Singed/DamageSingedE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Singed E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Singed", SpellSlot.E)] + public class DamageSingedE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSingedE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 65, 80, 95, 110 }[level] + (0.75 * source.TotalMagicalDamage) + (new[] { 4, 5.5, 7, 8.5, 10 }[level] / 100 * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Singed/DamageSingedQ.cs b/source/Damage/Spells/Singed/DamageSingedQ.cs new file mode 100644 index 00000000..2382ae3d --- /dev/null +++ b/source/Damage/Spells/Singed/DamageSingedQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Singed Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Singed", SpellSlot.Q)] + public class DamageSingedQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSingedQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 22, 34, 46, 58, 70 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sion/DamageSionE.cs b/source/Damage/Spells/Sion/DamageSionE.cs new file mode 100644 index 00000000..69acffb0 --- /dev/null +++ b/source/Damage/Spells/Sion/DamageSionE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sion E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sion", SpellSlot.E)] + public class DamageSionE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSionE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 105, 140, 175, 210 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sion/DamageSionE1.cs b/source/Damage/Spells/Sion/DamageSionE1.cs new file mode 100644 index 00000000..40a91e45 --- /dev/null +++ b/source/Damage/Spells/Sion/DamageSionE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sion E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sion", SpellSlot.E, 1)] + public class DamageSionE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSionE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 70, 105, 140, 175, 210 }[level] + (0.4 * source.TotalMagicalDamage)) * 1.5; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sion/DamageSionQ.cs b/source/Damage/Spells/Sion/DamageSionQ.cs new file mode 100644 index 00000000..fb774805 --- /dev/null +++ b/source/Damage/Spells/Sion/DamageSionQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sion Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sion", SpellSlot.Q)] + public class DamageSionQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSionQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 40, 60, 80, 100 }[level] + (0.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sion/DamageSionQ1.cs b/source/Damage/Spells/Sion/DamageSionQ1.cs new file mode 100644 index 00000000..8fc02d80 --- /dev/null +++ b/source/Damage/Spells/Sion/DamageSionQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sion Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sion", SpellSlot.Q, 1)] + public class DamageSionQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSionQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 120, 180, 240, 300 }[level] + (1.8 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sion/DamageSionR.cs b/source/Damage/Spells/Sion/DamageSionR.cs new file mode 100644 index 00000000..7cb5ff06 --- /dev/null +++ b/source/Damage/Spells/Sion/DamageSionR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sion R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sion", SpellSlot.R)] + public class DamageSionR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSionR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 300, 450 }[level] + (0.4 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sion/DamageSionR1.cs b/source/Damage/Spells/Sion/DamageSionR1.cs new file mode 100644 index 00000000..5700ea22 --- /dev/null +++ b/source/Damage/Spells/Sion/DamageSionR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sion R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sion", SpellSlot.R, 1)] + public class DamageSionR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSionR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 150, 300, 450 }[level] + (0.4 * source.FlatPhysicalDamageMod)) * 2; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sion/DamageSionW.cs b/source/Damage/Spells/Sion/DamageSionW.cs new file mode 100644 index 00000000..e8dc059a --- /dev/null +++ b/source/Damage/Spells/Sion/DamageSionW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sion W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sion", SpellSlot.W)] + public class DamageSionW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSionW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 65, 90, 115, 140 }[level] + (0.4 * source.TotalMagicalDamage) + (new double[] { 10, 11, 12, 13, 14 }[level] / 100 * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sivir/DamageSivirQ.cs b/source/Damage/Spells/Sivir/DamageSivirQ.cs new file mode 100644 index 00000000..2e2ad5ef --- /dev/null +++ b/source/Damage/Spells/Sivir/DamageSivirQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sivir Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sivir", SpellSlot.Q)] + public class DamageSivirQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSivirQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 25, 45, 65, 85, 105 }[level] + (new double[] { 70, 80, 90, 100, 110 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sivir/DamageSivirW.cs b/source/Damage/Spells/Sivir/DamageSivirW.cs new file mode 100644 index 00000000..31aa067d --- /dev/null +++ b/source/Damage/Spells/Sivir/DamageSivirW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sivir W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sivir", SpellSlot.W)] + public class DamageSivirW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSivirW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 65, 70, 75, 80 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Skarner/DamageSkarnerE.cs b/source/Damage/Spells/Skarner/DamageSkarnerE.cs new file mode 100644 index 00000000..729bc965 --- /dev/null +++ b/source/Damage/Spells/Skarner/DamageSkarnerE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Skarner E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Skarner", SpellSlot.E)] + public class DamageSkarnerE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSkarnerE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 75, 110, 145, 180 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Skarner/DamageSkarnerQ.cs b/source/Damage/Spells/Skarner/DamageSkarnerQ.cs new file mode 100644 index 00000000..0d24a41f --- /dev/null +++ b/source/Damage/Spells/Skarner/DamageSkarnerQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Skarner Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Skarner", SpellSlot.Q)] + public class DamageSkarnerQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSkarnerQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 30, 40, 50, 60 }[level] + (0.4 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Skarner/DamageSkarnerR.cs b/source/Damage/Spells/Skarner/DamageSkarnerR.cs new file mode 100644 index 00000000..bb7cb7be --- /dev/null +++ b/source/Damage/Spells/Skarner/DamageSkarnerR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Skarner R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Skarner", SpellSlot.R)] + public class DamageSkarnerR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSkarnerR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return (new double[] { 20, 60, 100 }[level] + (0.5 * source.TotalMagicalDamage)) + (0.60 * source.TotalAttackDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sona/DamageSonaQ.cs b/source/Damage/Spells/Sona/DamageSonaQ.cs new file mode 100644 index 00000000..428dbbe0 --- /dev/null +++ b/source/Damage/Spells/Sona/DamageSonaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sona Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sona", SpellSlot.Q)] + public class DamageSonaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSonaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 70, 100, 130, 160 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Sona/DamageSonaR.cs b/source/Damage/Spells/Sona/DamageSonaR.cs new file mode 100644 index 00000000..8cab4d27 --- /dev/null +++ b/source/Damage/Spells/Sona/DamageSonaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Sona R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Sona", SpellSlot.R)] + public class DamageSonaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSonaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Soraka/DamageSorakaE.cs b/source/Damage/Spells/Soraka/DamageSorakaE.cs new file mode 100644 index 00000000..67eda34f --- /dev/null +++ b/source/Damage/Spells/Soraka/DamageSorakaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Soraka E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Soraka", SpellSlot.E)] + public class DamageSorakaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSorakaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Soraka/DamageSorakaQ.cs b/source/Damage/Spells/Soraka/DamageSorakaQ.cs new file mode 100644 index 00000000..b560edd7 --- /dev/null +++ b/source/Damage/Spells/Soraka/DamageSorakaQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Soraka Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Soraka", SpellSlot.Q)] + public class DamageSorakaQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSorakaQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Swain/DamageSwainE.cs b/source/Damage/Spells/Swain/DamageSwainE.cs new file mode 100644 index 00000000..d0310a72 --- /dev/null +++ b/source/Damage/Spells/Swain/DamageSwainE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Swain E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Swain", SpellSlot.E)] + public class DamageSwainE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSwainE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 80, 110, 140, 170 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Swain/DamageSwainQ.cs b/source/Damage/Spells/Swain/DamageSwainQ.cs new file mode 100644 index 00000000..99147e7d --- /dev/null +++ b/source/Damage/Spells/Swain/DamageSwainQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Swain Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Swain", SpellSlot.Q)] + public class DamageSwainQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSwainQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 25, 40, 55, 70, 85 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Swain/DamageSwainR.cs b/source/Damage/Spells/Swain/DamageSwainR.cs new file mode 100644 index 00000000..8facec95 --- /dev/null +++ b/source/Damage/Spells/Swain/DamageSwainR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Swain R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Swain", SpellSlot.R)] + public class DamageSwainR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSwainR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 70, 90 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Swain/DamageSwainW.cs b/source/Damage/Spells/Swain/DamageSwainW.cs new file mode 100644 index 00000000..6a852b97 --- /dev/null +++ b/source/Damage/Spells/Swain/DamageSwainW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Swain W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Swain", SpellSlot.W)] + public class DamageSwainW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSwainW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Syndra/DamageSyndraE.cs b/source/Damage/Spells/Syndra/DamageSyndraE.cs new file mode 100644 index 00000000..70810499 --- /dev/null +++ b/source/Damage/Spells/Syndra/DamageSyndraE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Syndra E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Syndra", SpellSlot.E)] + public class DamageSyndraE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSyndraE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 115, 160, 205, 250 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Syndra/DamageSyndraQ.cs b/source/Damage/Spells/Syndra/DamageSyndraQ.cs new file mode 100644 index 00000000..ea4f38fe --- /dev/null +++ b/source/Damage/Spells/Syndra/DamageSyndraQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Syndra Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Syndra", SpellSlot.Q)] + public class DamageSyndraQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSyndraQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 95, 140, 185, 230 }[level] + (0.75 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Syndra/DamageSyndraR.cs b/source/Damage/Spells/Syndra/DamageSyndraR.cs new file mode 100644 index 00000000..615b9af1 --- /dev/null +++ b/source/Damage/Spells/Syndra/DamageSyndraR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Syndra R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Syndra", SpellSlot.R)] + public class DamageSyndraR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSyndraR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 270, 405, 540 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Syndra/DamageSyndraR1.cs b/source/Damage/Spells/Syndra/DamageSyndraR1.cs new file mode 100644 index 00000000..91de8c64 --- /dev/null +++ b/source/Damage/Spells/Syndra/DamageSyndraR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Syndra R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Syndra", SpellSlot.R, 1)] + public class DamageSyndraR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSyndraR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 90, 135, 180 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Syndra/DamageSyndraW.cs b/source/Damage/Spells/Syndra/DamageSyndraW.cs new file mode 100644 index 00000000..c62543a7 --- /dev/null +++ b/source/Damage/Spells/Syndra/DamageSyndraW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Syndra W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Syndra", SpellSlot.W)] + public class DamageSyndraW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageSyndraW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TahmKench/DamageTahmKenchQ.cs b/source/Damage/Spells/TahmKench/DamageTahmKenchQ.cs new file mode 100644 index 00000000..e179cc1d --- /dev/null +++ b/source/Damage/Spells/TahmKench/DamageTahmKenchQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TahmKench Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TahmKench", SpellSlot.Q)] + public class DamageTahmKenchQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTahmKenchQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 130, 180, 230, 280 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TahmKench/DamageTahmKenchW.cs b/source/Damage/Spells/TahmKench/DamageTahmKenchW.cs new file mode 100644 index 00000000..9510f580 --- /dev/null +++ b/source/Damage/Spells/TahmKench/DamageTahmKenchW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TahmKench W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TahmKench", SpellSlot.W)] + public class DamageTahmKenchW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTahmKenchW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return target is Obj_AI_Minion ? new double[] { 400, 450, 500, 550, 600 }[level] : (new[] { 0.20, 0.23, 0.26, 0.29, 0.32 }[level] + (0.02 * source.TotalMagicalDamage / 100)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TahmKench/DamageTahmKenchW1.cs b/source/Damage/Spells/TahmKench/DamageTahmKenchW1.cs new file mode 100644 index 00000000..5db53ed6 --- /dev/null +++ b/source/Damage/Spells/TahmKench/DamageTahmKenchW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TahmKench W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TahmKench", SpellSlot.W, 1)] + public class DamageTahmKenchW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTahmKenchW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 150, 200, 250, 300 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Talon/DamageTalonQ.cs b/source/Damage/Spells/Talon/DamageTalonQ.cs new file mode 100644 index 00000000..2a8730f0 --- /dev/null +++ b/source/Damage/Spells/Talon/DamageTalonQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Talon Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Talon", SpellSlot.Q)] + public class DamageTalonQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTalonQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 60, 90, 120, 150 }[level] + (0.3 * source.FlatPhysicalDamageMod) + ((target is Obj_AI_Hero) ? (new double[] { 10, 20, 30, 40, 50 }[level] + (1 * source.FlatPhysicalDamageMod)) : 0); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Talon/DamageTalonR.cs b/source/Damage/Spells/Talon/DamageTalonR.cs new file mode 100644 index 00000000..3fce3403 --- /dev/null +++ b/source/Damage/Spells/Talon/DamageTalonR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Talon R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Talon", SpellSlot.R)] + public class DamageTalonR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTalonR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 120, 170, 220 }[level] + (0.75 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Talon/DamageTalonW.cs b/source/Damage/Spells/Talon/DamageTalonW.cs new file mode 100644 index 00000000..0671d352 --- /dev/null +++ b/source/Damage/Spells/Talon/DamageTalonW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Talon W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Talon", SpellSlot.W)] + public class DamageTalonW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTalonW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 55, 80, 105, 130 }[level] + (0.6 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Taric/DamageTaricE.cs b/source/Damage/Spells/Taric/DamageTaricE.cs new file mode 100644 index 00000000..4f8dff7c --- /dev/null +++ b/source/Damage/Spells/Taric/DamageTaricE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Taric E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Taric", SpellSlot.E)] + public class DamageTaricE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTaricE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 70, 100, 130, 160 }[level] + (0.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Taric/DamageTaricR.cs b/source/Damage/Spells/Taric/DamageTaricR.cs new file mode 100644 index 00000000..1157fe44 --- /dev/null +++ b/source/Damage/Spells/Taric/DamageTaricR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Taric R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Taric", SpellSlot.R)] + public class DamageTaricR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTaricR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Taric/DamageTaricW.cs b/source/Damage/Spells/Taric/DamageTaricW.cs new file mode 100644 index 00000000..d4d79e0b --- /dev/null +++ b/source/Damage/Spells/Taric/DamageTaricW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Taric W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Taric", SpellSlot.W)] + public class DamageTaricW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTaricW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 80, 120, 160, 200 }[level] + (0.2 * source.Armor); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Teemo/DamageTeemoE.cs b/source/Damage/Spells/Teemo/DamageTeemoE.cs new file mode 100644 index 00000000..1baaf55e --- /dev/null +++ b/source/Damage/Spells/Teemo/DamageTeemoE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Teemo E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Teemo", SpellSlot.E)] + public class DamageTeemoE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTeemoE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 34, 68, 102, 136, 170 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Teemo/DamageTeemoE1.cs b/source/Damage/Spells/Teemo/DamageTeemoE1.cs new file mode 100644 index 00000000..7f515653 --- /dev/null +++ b/source/Damage/Spells/Teemo/DamageTeemoE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Teemo E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Teemo", SpellSlot.E, 1)] + public class DamageTeemoE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTeemoE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 20, 30, 40, 50 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Teemo/DamageTeemoQ.cs b/source/Damage/Spells/Teemo/DamageTeemoQ.cs new file mode 100644 index 00000000..ab2cd850 --- /dev/null +++ b/source/Damage/Spells/Teemo/DamageTeemoQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Teemo Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Teemo", SpellSlot.Q)] + public class DamageTeemoQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTeemoQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level] + (0.8 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Teemo/DamageTeemoR.cs b/source/Damage/Spells/Teemo/DamageTeemoR.cs new file mode 100644 index 00000000..09424552 --- /dev/null +++ b/source/Damage/Spells/Teemo/DamageTeemoR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Teemo R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Teemo", SpellSlot.R)] + public class DamageTeemoR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTeemoR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 325, 450 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Thresh/DamageThreshE.cs b/source/Damage/Spells/Thresh/DamageThreshE.cs new file mode 100644 index 00000000..c84dfcb0 --- /dev/null +++ b/source/Damage/Spells/Thresh/DamageThreshE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Thresh E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Thresh", SpellSlot.E)] + public class DamageThreshE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageThreshE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 95, 125, 155, 185 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Thresh/DamageThreshQ.cs b/source/Damage/Spells/Thresh/DamageThreshQ.cs new file mode 100644 index 00000000..acedf110 --- /dev/null +++ b/source/Damage/Spells/Thresh/DamageThreshQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Thresh Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Thresh", SpellSlot.Q)] + public class DamageThreshQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageThreshQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Thresh/DamageThreshR.cs b/source/Damage/Spells/Thresh/DamageThreshR.cs new file mode 100644 index 00000000..1aab2588 --- /dev/null +++ b/source/Damage/Spells/Thresh/DamageThreshR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Thresh R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Thresh", SpellSlot.R)] + public class DamageThreshR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageThreshR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 250, 400, 550 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Tristana/DamageTristanaE.cs b/source/Damage/Spells/Tristana/DamageTristanaE.cs new file mode 100644 index 00000000..0f0e344f --- /dev/null +++ b/source/Damage/Spells/Tristana/DamageTristanaE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Tristana E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Tristana", SpellSlot.E)] + public class DamageTristanaE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTristanaE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 70, 80, 90, 100 }[level] + (new[] { 0.5, 0.65, 0.8, 0.95, 1.10 }[level] * source.FlatPhysicalDamageMod) + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Tristana/DamageTristanaR.cs b/source/Damage/Spells/Tristana/DamageTristanaR.cs new file mode 100644 index 00000000..a1add84b --- /dev/null +++ b/source/Damage/Spells/Tristana/DamageTristanaR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Tristana R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Tristana", SpellSlot.R)] + public class DamageTristanaR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTristanaR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 300, 400, 500 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Tristana/DamageTristanaW.cs b/source/Damage/Spells/Tristana/DamageTristanaW.cs new file mode 100644 index 00000000..40391b34 --- /dev/null +++ b/source/Damage/Spells/Tristana/DamageTristanaW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Tristana W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Tristana", SpellSlot.W)] + public class DamageTristanaW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTristanaW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210, 260 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Trundle/DamageTrundleQ.cs b/source/Damage/Spells/Trundle/DamageTrundleQ.cs new file mode 100644 index 00000000..5e919fa4 --- /dev/null +++ b/source/Damage/Spells/Trundle/DamageTrundleQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Trundle Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Trundle", SpellSlot.Q)] + public class DamageTrundleQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTrundleQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 40, 60, 80, 100 }[level] + (new[] { 0, 0.5, 0.1, 0.15, 0.2 }[level] * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Trundle/DamageTrundleR.cs b/source/Damage/Spells/Trundle/DamageTrundleR.cs new file mode 100644 index 00000000..3369b57a --- /dev/null +++ b/source/Damage/Spells/Trundle/DamageTrundleR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Trundle R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Trundle", SpellSlot.R)] + public class DamageTrundleR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTrundleR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new double[] { 20, 24, 28 }[level] / 100) + (0.02 * source.TotalMagicalDamage / 100)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Tryndamere/DamageTryndamereE.cs b/source/Damage/Spells/Tryndamere/DamageTryndamereE.cs new file mode 100644 index 00000000..010f16b2 --- /dev/null +++ b/source/Damage/Spells/Tryndamere/DamageTryndamereE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Tryndamere E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Tryndamere", SpellSlot.E)] + public class DamageTryndamereE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTryndamereE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 100, 130, 160, 190 }[level] + (1.2 * source.FlatPhysicalDamageMod) + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TwistedFate/DamageTwistedFateE.cs b/source/Damage/Spells/TwistedFate/DamageTwistedFateE.cs new file mode 100644 index 00000000..82074d92 --- /dev/null +++ b/source/Damage/Spells/TwistedFate/DamageTwistedFateE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TwistedFate E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TwistedFate", SpellSlot.E)] + public class DamageTwistedFateE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTwistedFateE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 80, 105, 130, 155 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TwistedFate/DamageTwistedFateQ.cs b/source/Damage/Spells/TwistedFate/DamageTwistedFateQ.cs new file mode 100644 index 00000000..57e9be61 --- /dev/null +++ b/source/Damage/Spells/TwistedFate/DamageTwistedFateQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TwistedFate Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TwistedFate", SpellSlot.Q)] + public class DamageTwistedFateQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTwistedFateQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.65 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TwistedFate/DamageTwistedFateW.cs b/source/Damage/Spells/TwistedFate/DamageTwistedFateW.cs new file mode 100644 index 00000000..1a316ec2 --- /dev/null +++ b/source/Damage/Spells/TwistedFate/DamageTwistedFateW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TwistedFate W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TwistedFate", SpellSlot.W)] + public class DamageTwistedFateW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTwistedFateW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 60, 80, 100, 120 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TwistedFate/DamageTwistedFateW1.cs b/source/Damage/Spells/TwistedFate/DamageTwistedFateW1.cs new file mode 100644 index 00000000..54101487 --- /dev/null +++ b/source/Damage/Spells/TwistedFate/DamageTwistedFateW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TwistedFate W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TwistedFate", SpellSlot.W, 1)] + public class DamageTwistedFateW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTwistedFateW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 45, 60, 75, 90 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/TwistedFate/DamageTwistedFateW2.cs b/source/Damage/Spells/TwistedFate/DamageTwistedFateW2.cs new file mode 100644 index 00000000..2abdd396 --- /dev/null +++ b/source/Damage/Spells/TwistedFate/DamageTwistedFateW2.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, TwistedFate W (Stage 2). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("TwistedFate", SpellSlot.W, 2)] + public class DamageTwistedFateW2 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTwistedFateW2() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 2; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new[] { 15, 22.5, 30, 37.5, 45 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Twitch/DamageTwitchE.cs b/source/Damage/Spells/Twitch/DamageTwitchE.cs new file mode 100644 index 00000000..de1cc461 --- /dev/null +++ b/source/Damage/Spells/Twitch/DamageTwitchE.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Spell Damage, Twitch E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Twitch", SpellSlot.E)] + public class DamageTwitchE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTwitchE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((from buff in target.Buffs where buff.DisplayName.ToLower() == "twitchdeadlyvenom" select buff.Count).FirstOrDefault() * (new double[] { 15, 20, 25, 30, 35 }[level] + (0.2 * source.TotalMagicalDamage) + (0.25 * source.FlatPhysicalDamageMod))) + new double[] { 20, 35, 50, 65, 80 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Twitch/DamageTwitchE1.cs b/source/Damage/Spells/Twitch/DamageTwitchE1.cs new file mode 100644 index 00000000..ff85fde7 --- /dev/null +++ b/source/Damage/Spells/Twitch/DamageTwitchE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Twitch E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Twitch", SpellSlot.E, 1)] + public class DamageTwitchE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageTwitchE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 15, 20, 25, 30, 35 }[level] + (0.2 * source.TotalMagicalDamage) + (0.25 * source.FlatPhysicalDamageMod) + new double[] { 20, 35, 50, 65, 80 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Udyr/DamageUdyrQ.cs b/source/Damage/Spells/Udyr/DamageUdyrQ.cs new file mode 100644 index 00000000..b815dbaf --- /dev/null +++ b/source/Damage/Spells/Udyr/DamageUdyrQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Udyr Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Udyr", SpellSlot.Q)] + public class DamageUdyrQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageUdyrQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 80, 130, 180, 230 }[level] + ((new double[] { 120, 130, 140, 150, 160 }[level] / 100) * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Udyr/DamageUdyrR.cs b/source/Damage/Spells/Udyr/DamageUdyrR.cs new file mode 100644 index 00000000..69ace623 --- /dev/null +++ b/source/Damage/Spells/Udyr/DamageUdyrR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Udyr R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Udyr", SpellSlot.R)] + public class DamageUdyrR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageUdyrR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 20, 30, 40, 50 }[level] + (0.25 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Urgot/DamageUrgotE.cs b/source/Damage/Spells/Urgot/DamageUrgotE.cs new file mode 100644 index 00000000..6eac5228 --- /dev/null +++ b/source/Damage/Spells/Urgot/DamageUrgotE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Urgot E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Urgot", SpellSlot.E)] + public class DamageUrgotE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageUrgotE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 130, 185, 240, 295 }[level] + (0.6 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Urgot/DamageUrgotQ.cs b/source/Damage/Spells/Urgot/DamageUrgotQ.cs new file mode 100644 index 00000000..ab817c5c --- /dev/null +++ b/source/Damage/Spells/Urgot/DamageUrgotQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Urgot Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Urgot", SpellSlot.Q)] + public class DamageUrgotQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageUrgotQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 40, 70, 100, 130 }[level] + (0.85 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Varus/DamageVarusE.cs b/source/Damage/Spells/Varus/DamageVarusE.cs new file mode 100644 index 00000000..4788deb5 --- /dev/null +++ b/source/Damage/Spells/Varus/DamageVarusE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Varus E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Varus", SpellSlot.E)] + public class DamageVarusE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVarusE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 65, 100, 135, 170, 205 }[level] + (0.6 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Varus/DamageVarusQ.cs b/source/Damage/Spells/Varus/DamageVarusQ.cs new file mode 100644 index 00000000..62f6deea --- /dev/null +++ b/source/Damage/Spells/Varus/DamageVarusQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Varus Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Varus", SpellSlot.Q)] + public class DamageVarusQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVarusQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 47, 83, 120, 157 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Varus/DamageVarusQ1.cs b/source/Damage/Spells/Varus/DamageVarusQ1.cs new file mode 100644 index 00000000..bde11834 --- /dev/null +++ b/source/Damage/Spells/Varus/DamageVarusQ1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Varus Q (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Varus", SpellSlot.Q, 1)] + public class DamageVarusQ1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVarusQ1() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 15, 70, 125, 180, 235 }[level] + (+1.6 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Varus/DamageVarusR.cs b/source/Damage/Spells/Varus/DamageVarusR.cs new file mode 100644 index 00000000..c729be3c --- /dev/null +++ b/source/Damage/Spells/Varus/DamageVarusR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Varus R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Varus", SpellSlot.R)] + public class DamageVarusR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVarusR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 175, 250 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Varus/DamageVarusW.cs b/source/Damage/Spells/Varus/DamageVarusW.cs new file mode 100644 index 00000000..cf932382 --- /dev/null +++ b/source/Damage/Spells/Varus/DamageVarusW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Varus W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Varus", SpellSlot.W)] + public class DamageVarusW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVarusW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 10, 14, 18, 22, 26 }[level] + (0.25 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Varus/DamageVarusW1.cs b/source/Damage/Spells/Varus/DamageVarusW1.cs new file mode 100644 index 00000000..a2490f2e --- /dev/null +++ b/source/Damage/Spells/Varus/DamageVarusW1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Varus W (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Varus", SpellSlot.W, 1)] + public class DamageVarusW1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVarusW1() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new[] { 2, 2.75, 3.5, 4.25, 5 }[level] / 100) + (0.02 * source.TotalMagicalDamage / 100)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vayne/DamageVayneE.cs b/source/Damage/Spells/Vayne/DamageVayneE.cs new file mode 100644 index 00000000..df0874c8 --- /dev/null +++ b/source/Damage/Spells/Vayne/DamageVayneE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vayne E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vayne", SpellSlot.E)] + public class DamageVayneE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVayneE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 45, 80, 115, 150, 185 }[level] + (0.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vayne/DamageVayneQ.cs b/source/Damage/Spells/Vayne/DamageVayneQ.cs new file mode 100644 index 00000000..2552a77d --- /dev/null +++ b/source/Damage/Spells/Vayne/DamageVayneQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vayne Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vayne", SpellSlot.Q)] + public class DamageVayneQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVayneQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 35, 40, 45, 50 }[level] / 100 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vayne/DamageVayneW.cs b/source/Damage/Spells/Vayne/DamageVayneW.cs new file mode 100644 index 00000000..73eea88e --- /dev/null +++ b/source/Damage/Spells/Vayne/DamageVayneW.cs @@ -0,0 +1,42 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vayne W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vayne", SpellSlot.W)] + public class DamageVayneW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVayneW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return Math.Max( + new double[] { 40, 60, 80, 100, 120 }[level], + (new[] { 6, 7.5, 9, 10.5, 12 }[level] / 100) * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Veigar/DamageVeigarQ.cs b/source/Damage/Spells/Veigar/DamageVeigarQ.cs new file mode 100644 index 00000000..13e0d533 --- /dev/null +++ b/source/Damage/Spells/Veigar/DamageVeigarQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Veigar Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Veigar", SpellSlot.Q)] + public class DamageVeigarQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVeigarQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 125, 170, 215, 260 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Veigar/DamageVeigarR.cs b/source/Damage/Spells/Veigar/DamageVeigarR.cs new file mode 100644 index 00000000..85383ab3 --- /dev/null +++ b/source/Damage/Spells/Veigar/DamageVeigarR.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Veigar R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Veigar", SpellSlot.R)] + public class DamageVeigarR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVeigarR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 175, 250, 325 }[level] + (0.8 * target.TotalMagicalDamage) + + (0.75 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Veigar/DamageVeigarW.cs b/source/Damage/Spells/Veigar/DamageVeigarW.cs new file mode 100644 index 00000000..4eb73dd6 --- /dev/null +++ b/source/Damage/Spells/Veigar/DamageVeigarW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Veigar W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Veigar", SpellSlot.W)] + public class DamageVeigarW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVeigarW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 120, 170, 220, 270, 320 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Velkoz/DamageVelkozE.cs b/source/Damage/Spells/Velkoz/DamageVelkozE.cs new file mode 100644 index 00000000..4285ff47 --- /dev/null +++ b/source/Damage/Spells/Velkoz/DamageVelkozE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Velkoz E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Velkoz", SpellSlot.E)] + public class DamageVelkozE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVelkozE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 100, 130, 160, 190 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Velkoz/DamageVelkozQ.cs b/source/Damage/Spells/Velkoz/DamageVelkozQ.cs new file mode 100644 index 00000000..8e0a6b14 --- /dev/null +++ b/source/Damage/Spells/Velkoz/DamageVelkozQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Velkoz Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Velkoz", SpellSlot.Q)] + public class DamageVelkozQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVelkozQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Velkoz/DamageVelkozR.cs b/source/Damage/Spells/Velkoz/DamageVelkozR.cs new file mode 100644 index 00000000..2952000e --- /dev/null +++ b/source/Damage/Spells/Velkoz/DamageVelkozR.cs @@ -0,0 +1,44 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Velkoz R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Velkoz", SpellSlot.R)] + public class DamageVelkozR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVelkozR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.True; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return target.HasBuff("velkozresearchedstack") + ? new double[] { 500, 725, 950 }[level] + (1 * source.TotalMagicalDamage) + : source.CalcDamage( + target, + Common.Damage.DamageType.Magical, + new double[] { 500, 725, 950 }[level] + (1 * source.TotalMagicalDamage)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Velkoz/DamageVelkozW.cs b/source/Damage/Spells/Velkoz/DamageVelkozW.cs new file mode 100644 index 00000000..ef646b56 --- /dev/null +++ b/source/Damage/Spells/Velkoz/DamageVelkozW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Velkoz W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Velkoz", SpellSlot.W)] + public class DamageVelkozW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVelkozW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 50, 70, 90, 110 }[level] + new double[] { 45, 75, 105, 135, 165 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vi/DamageViE.cs b/source/Damage/Spells/Vi/DamageViE.cs new file mode 100644 index 00000000..9d4a4dac --- /dev/null +++ b/source/Damage/Spells/Vi/DamageViE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vi E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vi", SpellSlot.E)] + public class DamageViE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 5, 20, 35, 50, 65 }[level] + (1.15 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)) + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vi/DamageViQ.cs b/source/Damage/Spells/Vi/DamageViQ.cs new file mode 100644 index 00000000..f0e4e20d --- /dev/null +++ b/source/Damage/Spells/Vi/DamageViQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vi Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vi", SpellSlot.Q)] + public class DamageViQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 50, 75, 100, 125, 150 }[level] + (0.8 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vi/DamageViR.cs b/source/Damage/Spells/Vi/DamageViR.cs new file mode 100644 index 00000000..7fc5134e --- /dev/null +++ b/source/Damage/Spells/Vi/DamageViR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vi R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vi", SpellSlot.R)] + public class DamageViR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 300, 450 }[level] + (1.4 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vi/DamageViW.cs b/source/Damage/Spells/Vi/DamageViW.cs new file mode 100644 index 00000000..c8758dbd --- /dev/null +++ b/source/Damage/Spells/Vi/DamageViW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vi W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vi", SpellSlot.W)] + public class DamageViW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return ((new[] { 4, 5.5, 7, 8.5, 10 }[level] / 100) + (0.01 * source.FlatPhysicalDamageMod / 35)) * target.MaxHealth; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Viktor/DamageViktorE.cs b/source/Damage/Spells/Viktor/DamageViktorE.cs new file mode 100644 index 00000000..ca03348b --- /dev/null +++ b/source/Damage/Spells/Viktor/DamageViktorE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Viktor E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Viktor", SpellSlot.E)] + public class DamageViktorE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViktorE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Viktor/DamageViktorE1.cs b/source/Damage/Spells/Viktor/DamageViktorE1.cs new file mode 100644 index 00000000..c50ea0cc --- /dev/null +++ b/source/Damage/Spells/Viktor/DamageViktorE1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Viktor E (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Viktor", SpellSlot.E, 1)] + public class DamageViktorE1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViktorE1() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 90, 170, 250, 330, 410 }[level] + (1.2 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Viktor/DamageViktorQ.cs b/source/Damage/Spells/Viktor/DamageViktorQ.cs new file mode 100644 index 00000000..ab60e57c --- /dev/null +++ b/source/Damage/Spells/Viktor/DamageViktorQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Viktor Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Viktor", SpellSlot.Q)] + public class DamageViktorQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViktorQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 80, 100, 120, 140 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Viktor/DamageViktorR.cs b/source/Damage/Spells/Viktor/DamageViktorR.cs new file mode 100644 index 00000000..01bdc35e --- /dev/null +++ b/source/Damage/Spells/Viktor/DamageViktorR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Viktor R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Viktor", SpellSlot.R)] + public class DamageViktorR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViktorR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 100, 175, 250 }[level] + (0.50 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Viktor/DamageViktorR1.cs b/source/Damage/Spells/Viktor/DamageViktorR1.cs new file mode 100644 index 00000000..1c88401c --- /dev/null +++ b/source/Damage/Spells/Viktor/DamageViktorR1.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Viktor R (Stage 1). + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Viktor", SpellSlot.R, 1)] + public class DamageViktorR1 : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageViktorR1() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + this.Stage = 1; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vladimir/DamageVladimirE.cs b/source/Damage/Spells/Vladimir/DamageVladimirE.cs new file mode 100644 index 00000000..320b2d26 --- /dev/null +++ b/source/Damage/Spells/Vladimir/DamageVladimirE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vladimir E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vladimir", SpellSlot.E)] + public class DamageVladimirE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVladimirE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 80, 100, 120, 140 }[level] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vladimir/DamageVladimirQ.cs b/source/Damage/Spells/Vladimir/DamageVladimirQ.cs new file mode 100644 index 00000000..d970b8ae --- /dev/null +++ b/source/Damage/Spells/Vladimir/DamageVladimirQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vladimir Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vladimir", SpellSlot.Q)] + public class DamageVladimirQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVladimirQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 90, 105, 120, 135 }[level] + (0.55 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vladimir/DamageVladimirR.cs b/source/Damage/Spells/Vladimir/DamageVladimirR.cs new file mode 100644 index 00000000..552f37cb --- /dev/null +++ b/source/Damage/Spells/Vladimir/DamageVladimirR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vladimir R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vladimir", SpellSlot.R)] + public class DamageVladimirR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVladimirR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Vladimir/DamageVladimirW.cs b/source/Damage/Spells/Vladimir/DamageVladimirW.cs new file mode 100644 index 00000000..7bdf090a --- /dev/null +++ b/source/Damage/Spells/Vladimir/DamageVladimirW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Vladimir W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Vladimir", SpellSlot.W)] + public class DamageVladimirW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVladimirW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 135, 190, 245, 300 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Volibear/DamageVolibearE.cs b/source/Damage/Spells/Volibear/DamageVolibearE.cs new file mode 100644 index 00000000..7f9fd50c --- /dev/null +++ b/source/Damage/Spells/Volibear/DamageVolibearE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Volibear E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Volibear", SpellSlot.E)] + public class DamageVolibearE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVolibearE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 105, 150, 195, 240 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Volibear/DamageVolibearQ.cs b/source/Damage/Spells/Volibear/DamageVolibearQ.cs new file mode 100644 index 00000000..e7050c64 --- /dev/null +++ b/source/Damage/Spells/Volibear/DamageVolibearQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Volibear Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Volibear", SpellSlot.Q)] + public class DamageVolibearQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVolibearQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 60, 90, 120, 150 }[level]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Volibear/DamageVolibearR.cs b/source/Damage/Spells/Volibear/DamageVolibearR.cs new file mode 100644 index 00000000..315778c7 --- /dev/null +++ b/source/Damage/Spells/Volibear/DamageVolibearR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Volibear R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Volibear", SpellSlot.R)] + public class DamageVolibearR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVolibearR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 115, 155 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Volibear/DamageVolibearW.cs b/source/Damage/Spells/Volibear/DamageVolibearW.cs new file mode 100644 index 00000000..37189840 --- /dev/null +++ b/source/Damage/Spells/Volibear/DamageVolibearW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Volibear W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Volibear", SpellSlot.W)] + public class DamageVolibearW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageVolibearW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 110, 160, 210, 260 }[level] * (((target.MaxHealth - target.Health) / target.MaxHealth) + 1); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Warwick/DamageWarwickQ.cs b/source/Damage/Spells/Warwick/DamageWarwickQ.cs new file mode 100644 index 00000000..f0403831 --- /dev/null +++ b/source/Damage/Spells/Warwick/DamageWarwickQ.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System; + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Warwick Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Warwick", SpellSlot.Q)] + public class DamageWarwickQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageWarwickQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return Math.Max( + new double[] { 75, 125, 175, 225, 275 }[level], + new double[] { 8, 10, 12, 14, 16 }[level] / 100 * target.MaxHealth) + + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Warwick/DamageWarwickR.cs b/source/Damage/Spells/Warwick/DamageWarwickR.cs new file mode 100644 index 00000000..f3f21362 --- /dev/null +++ b/source/Damage/Spells/Warwick/DamageWarwickR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Warwick R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Warwick", SpellSlot.R)] + public class DamageWarwickR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageWarwickR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 150, 250, 350 }[level] + (2 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Xerath/DamageXerathE.cs b/source/Damage/Spells/Xerath/DamageXerathE.cs new file mode 100644 index 00000000..018193fd --- /dev/null +++ b/source/Damage/Spells/Xerath/DamageXerathE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Xerath E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Xerath", SpellSlot.E)] + public class DamageXerathE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageXerathE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 110, 140, 170, 200 }[level] + (0.45 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Xerath/DamageXerathQ.cs b/source/Damage/Spells/Xerath/DamageXerathQ.cs new file mode 100644 index 00000000..487f286c --- /dev/null +++ b/source/Damage/Spells/Xerath/DamageXerathQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Xerath Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Xerath", SpellSlot.Q)] + public class DamageXerathQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageXerathQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 120, 160, 200, 240 }[level] + (0.75 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Xerath/DamageXerathR.cs b/source/Damage/Spells/Xerath/DamageXerathR.cs new file mode 100644 index 00000000..823aec14 --- /dev/null +++ b/source/Damage/Spells/Xerath/DamageXerathR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Xerath R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Xerath", SpellSlot.R)] + public class DamageXerathR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageXerathR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 230, 260 }[level] + (0.43 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Xerath/DamageXerathW.cs b/source/Damage/Spells/Xerath/DamageXerathW.cs new file mode 100644 index 00000000..7d52980c --- /dev/null +++ b/source/Damage/Spells/Xerath/DamageXerathW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Xerath W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Xerath", SpellSlot.W)] + public class DamageXerathW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageXerathW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/XinZhao/DamageXinZhaoE.cs b/source/Damage/Spells/XinZhao/DamageXinZhaoE.cs new file mode 100644 index 00000000..30734163 --- /dev/null +++ b/source/Damage/Spells/XinZhao/DamageXinZhaoE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, XinZhao E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("XinZhao", SpellSlot.E)] + public class DamageXinZhaoE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageXinZhaoE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/XinZhao/DamageXinZhaoQ.cs b/source/Damage/Spells/XinZhao/DamageXinZhaoQ.cs new file mode 100644 index 00000000..051e00d4 --- /dev/null +++ b/source/Damage/Spells/XinZhao/DamageXinZhaoQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, XinZhao Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("XinZhao", SpellSlot.Q)] + public class DamageXinZhaoQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageXinZhaoQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 15, 30, 45, 60, 75 }[level] + (0.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/XinZhao/DamageXinZhaoR.cs b/source/Damage/Spells/XinZhao/DamageXinZhaoR.cs new file mode 100644 index 00000000..c5106ab6 --- /dev/null +++ b/source/Damage/Spells/XinZhao/DamageXinZhaoR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, XinZhao R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("XinZhao", SpellSlot.R)] + public class DamageXinZhaoR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageXinZhaoR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 175, 275 }[level] + (1 * source.FlatPhysicalDamageMod) + (0.15 * target.Health); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Yasuo/DamageYasuoE.cs b/source/Damage/Spells/Yasuo/DamageYasuoE.cs new file mode 100644 index 00000000..da67e42d --- /dev/null +++ b/source/Damage/Spells/Yasuo/DamageYasuoE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Yasuo E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Yasuo", SpellSlot.E)] + public class DamageYasuoE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageYasuoE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 90, 110, 130, 150 }[level] + (0.6 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Yasuo/DamageYasuoQ.cs b/source/Damage/Spells/Yasuo/DamageYasuoQ.cs new file mode 100644 index 00000000..8dba0012 --- /dev/null +++ b/source/Damage/Spells/Yasuo/DamageYasuoQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Yasuo Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Yasuo", SpellSlot.Q)] + public class DamageYasuoQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageYasuoQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 20, 40, 60, 80, 100 }[level] + (1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Yasuo/DamageYasuoR.cs b/source/Damage/Spells/Yasuo/DamageYasuoR.cs new file mode 100644 index 00000000..2dab47a5 --- /dev/null +++ b/source/Damage/Spells/Yasuo/DamageYasuoR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Yasuo R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Yasuo", SpellSlot.R)] + public class DamageYasuoR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageYasuoR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 200, 300, 400 }[level] + (1.5 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Yorick/DamageYorickE.cs b/source/Damage/Spells/Yorick/DamageYorickE.cs new file mode 100644 index 00000000..896ccf21 --- /dev/null +++ b/source/Damage/Spells/Yorick/DamageYorickE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Yorick E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Yorick", SpellSlot.E)] + public class DamageYorickE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageYorickE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 55, 85, 115, 145, 175 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Yorick/DamageYorickQ.cs b/source/Damage/Spells/Yorick/DamageYorickQ.cs new file mode 100644 index 00000000..64744080 --- /dev/null +++ b/source/Damage/Spells/Yorick/DamageYorickQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Yorick Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Yorick", SpellSlot.Q)] + public class DamageYorickQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageYorickQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 30, 60, 90, 120, 150 }[level] + (1.2 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Yorick/DamageYorickW.cs b/source/Damage/Spells/Yorick/DamageYorickW.cs new file mode 100644 index 00000000..b2cd8552 --- /dev/null +++ b/source/Damage/Spells/Yorick/DamageYorickW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Yorick W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Yorick", SpellSlot.W)] + public class DamageYorickW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageYorickW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 95, 130, 165, 200 }[level] + (1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zac/DamageZacE.cs b/source/Damage/Spells/Zac/DamageZacE.cs new file mode 100644 index 00000000..3244105a --- /dev/null +++ b/source/Damage/Spells/Zac/DamageZacE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zac E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zac", SpellSlot.E)] + public class DamageZacE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZacE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 80, 130, 180, 230, 280 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zac/DamageZacQ.cs b/source/Damage/Spells/Zac/DamageZacQ.cs new file mode 100644 index 00000000..d1e5f015 --- /dev/null +++ b/source/Damage/Spells/Zac/DamageZacQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zac Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zac", SpellSlot.Q)] + public class DamageZacQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZacQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 110, 150, 190, 230 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zac/DamageZacR.cs b/source/Damage/Spells/Zac/DamageZacR.cs new file mode 100644 index 00000000..daabba04 --- /dev/null +++ b/source/Damage/Spells/Zac/DamageZacR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zac R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zac", SpellSlot.R)] + public class DamageZacR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZacR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 140, 210, 280 }[level] + (0.4 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zac/DamageZacW.cs b/source/Damage/Spells/Zac/DamageZacW.cs new file mode 100644 index 00000000..a38c4dbb --- /dev/null +++ b/source/Damage/Spells/Zac/DamageZacW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zac W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zac", SpellSlot.W)] + public class DamageZacW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZacW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 55, 70, 85, 100 }[level] + (((new double[] { 4, 5, 6, 7, 8 }[level] / 100) + (0.02 * source.TotalMagicalDamage / 100)) * target.MaxHealth); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zed/DamageZedE.cs b/source/Damage/Spells/Zed/DamageZedE.cs new file mode 100644 index 00000000..3f926487 --- /dev/null +++ b/source/Damage/Spells/Zed/DamageZedE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zed E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zed", SpellSlot.E)] + public class DamageZedE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZedE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.8 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zed/DamageZedQ.cs b/source/Damage/Spells/Zed/DamageZedQ.cs new file mode 100644 index 00000000..8a9f16e6 --- /dev/null +++ b/source/Damage/Spells/Zed/DamageZedQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zed Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zed", SpellSlot.Q)] + public class DamageZedQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZedQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 115, 155, 195, 235 }[level] + (1 * source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zed/DamageZedR.cs b/source/Damage/Spells/Zed/DamageZedR.cs new file mode 100644 index 00000000..cfd9ecb2 --- /dev/null +++ b/source/Damage/Spells/Zed/DamageZedR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zed R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zed", SpellSlot.R)] + public class DamageZedR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZedR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Physical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return 1 * (source.BaseAttackDamage + source.FlatPhysicalDamageMod); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ziggs/DamageZiggsE.cs b/source/Damage/Spells/Ziggs/DamageZiggsE.cs new file mode 100644 index 00000000..66f2a69f --- /dev/null +++ b/source/Damage/Spells/Ziggs/DamageZiggsE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ziggs E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ziggs", SpellSlot.E)] + public class DamageZiggsE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZiggsE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 40, 65, 90, 115, 140 }[level] + (0.3 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ziggs/DamageZiggsQ.cs b/source/Damage/Spells/Ziggs/DamageZiggsQ.cs new file mode 100644 index 00000000..e5e311d3 --- /dev/null +++ b/source/Damage/Spells/Ziggs/DamageZiggsQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ziggs Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ziggs", SpellSlot.Q)] + public class DamageZiggsQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZiggsQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 75, 120, 165, 210, 255 }[level] + (0.65 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ziggs/DamageZiggsR.cs b/source/Damage/Spells/Ziggs/DamageZiggsR.cs new file mode 100644 index 00000000..8e00ce61 --- /dev/null +++ b/source/Damage/Spells/Ziggs/DamageZiggsR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ziggs R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ziggs", SpellSlot.R)] + public class DamageZiggsR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZiggsR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 300, 450, 600 }[level] + (1.1 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Ziggs/DamageZiggsW.cs b/source/Damage/Spells/Ziggs/DamageZiggsW.cs new file mode 100644 index 00000000..15e098ea --- /dev/null +++ b/source/Damage/Spells/Ziggs/DamageZiggsW.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Ziggs W. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Ziggs", SpellSlot.W)] + public class DamageZiggsW : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZiggsW() + { + this.Slot = SpellSlot.W; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 70, 105, 140, 175, 210 }[level] + (0.35 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zilean/DamageZileanQ.cs b/source/Damage/Spells/Zilean/DamageZileanQ.cs new file mode 100644 index 00000000..d1874e39 --- /dev/null +++ b/source/Damage/Spells/Zilean/DamageZileanQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zilean Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zilean", SpellSlot.Q)] + public class DamageZileanQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZileanQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 90, 145, 200, 260, 320 }[level] + (0.9 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zyra/DamageZyraE.cs b/source/Damage/Spells/Zyra/DamageZyraE.cs new file mode 100644 index 00000000..221dc42e --- /dev/null +++ b/source/Damage/Spells/Zyra/DamageZyraE.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zyra E. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zyra", SpellSlot.E)] + public class DamageZyraE : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZyraE() + { + this.Slot = SpellSlot.E; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 95, 130, 165, 200 }[level] + (0.5 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zyra/DamageZyraQ.cs b/source/Damage/Spells/Zyra/DamageZyraQ.cs new file mode 100644 index 00000000..5d0f2af0 --- /dev/null +++ b/source/Damage/Spells/Zyra/DamageZyraQ.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zyra Q. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zyra", SpellSlot.Q)] + public class DamageZyraQ : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZyraQ() + { + this.Slot = SpellSlot.Q; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 60, 90, 120, 150, 180 }[level] + (0.55 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/Spells/Zyra/DamageZyraR.cs b/source/Damage/Spells/Zyra/DamageZyraR.cs new file mode 100644 index 00000000..5950ae1b --- /dev/null +++ b/source/Damage/Spells/Zyra/DamageZyraR.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Spells +{ + using System.ComponentModel.Composition; + + /// + /// Spell Damage, Zyra R. + /// + [Export(typeof(IDamageSpell))] + [ExportDamageMetadata("Zyra", SpellSlot.R)] + public class DamageZyraR : DamageSpell + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DamageZyraR() + { + this.Slot = SpellSlot.R; + this.DamageType = Common.Damage.DamageType.Magical; + } + + #endregion + + #region Methods + + /// + protected override double GetDamage(Obj_AI_Base source, Obj_AI_Base target, int level) + { + return new double[] { 180, 265, 350 }[level] + (0.7 * source.TotalMagicalDamage); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/SummonerSpell.cs b/source/Damage/SummonerSpell.cs new file mode 100644 index 00000000..9e241866 --- /dev/null +++ b/source/Damage/SummonerSpell.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Damage calculations and data. + /// + public partial class Damage + { + #region Enums + + /// + /// Summoner spells which deal damage. + /// + public enum SummonerSpell + { + /// + /// The ignite spell. + /// + Ignite, + + /// + /// The smite spell. + /// + Smite + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/SummonerSpells/ISummonerSpell.cs b/source/Damage/SummonerSpells/ISummonerSpell.cs new file mode 100644 index 00000000..a1748b92 --- /dev/null +++ b/source/Damage/SummonerSpells/ISummonerSpell.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.SummonerSpells +{ + using JetBrains.Annotations; + + /// + /// The summoner spell interface. + /// + public interface ISummonerSpell + { + #region Public Methods and Operators + + /// + /// Calculates the summoner spell damage. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The . + /// + double GetDamage([NotNull] Obj_AI_Hero source, [NotNull] Obj_AI_Base target); + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/SummonerSpells/ISummonerSpellMetadata.cs b/source/Damage/SummonerSpells/ISummonerSpellMetadata.cs new file mode 100644 index 00000000..091d2d7d --- /dev/null +++ b/source/Damage/SummonerSpells/ISummonerSpellMetadata.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.SummonerSpells +{ + /// + /// The summoner spell metadata interface. + /// + public interface ISummonerSpellMetadata + { + #region Public Properties + + /// + /// Gets the summoner spell type. + /// + Damage.SummonerSpell SummonerSpell { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/SummonerSpells/SummonerSpellIgnite.cs b/source/Damage/SummonerSpells/SummonerSpellIgnite.cs new file mode 100644 index 00000000..65a7e094 --- /dev/null +++ b/source/Damage/SummonerSpells/SummonerSpellIgnite.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.SummonerSpells +{ + using System.ComponentModel.Composition; + + /// + /// The summoner spell: Ignite. + /// + [Export(typeof(ISummonerSpell))] + [ExportMetadata("SummonerSpell", Damage.SummonerSpell.Ignite)] + public class SummonerSpellIgnite : ISummonerSpell + { + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + return 50 + (20 * source.Level) - (target.HPRegenRate / 5 * 3); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Damage/SummonerSpells/SummonerSpellSmite.cs b/source/Damage/SummonerSpells/SummonerSpellSmite.cs new file mode 100644 index 00000000..ffe96b71 --- /dev/null +++ b/source/Damage/SummonerSpells/SummonerSpellSmite.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.SummonerSpells +{ + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// The summoner spell: Smite. + /// + [Export(typeof(ISummonerSpell))] + [ExportMetadata("SummonerSpell", Damage.SummonerSpell.Smite)] + public class SummonerSpellSmite : ISummonerSpell + { + #region Static Fields + + private static readonly double[] DamageArray = + { + 390, 410, 430, 450, 480, 510, 540, 570, 600, 640, 680, 720, 760, + 800, 850, 900, 950, 1000 + }; + + #endregion + + #region Public Methods and Operators + + /// + public double GetDamage(Obj_AI_Hero source, Obj_AI_Base target) + { + if (target is Obj_AI_Hero) + { + var spells = source.Spellbook.Spells; + if (spells.FirstOrDefault(h => h.Name.Equals("s5_summonersmiteplayerganker")) != null) + { + return 20 + (8 * source.Level); + } + + if (spells.FirstOrDefault(h => h.Name.Equals("s5_summonersmiteduel")) != null) + { + return 54 + (6 * source.Level); + } + } + + return DamageArray[source.Level - 1]; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Dash/Dash.cs b/source/Dash/Dash.cs new file mode 100644 index 00000000..e1c74659 --- /dev/null +++ b/source/Dash/Dash.cs @@ -0,0 +1,133 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.Linq; + + using SharpDX; + + /// + /// Game dash information parser. + /// + public partial class Dash + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public Dash() + { + this.Activate(); + } + + #endregion + + #region Properties + + private IDictionary Dashes { get; } = new Dictionary(); + + #endregion + + #region Public Methods and Operators + + /// + /// Activates the system. + /// + public void Activate() + { + Obj_AI_Base.OnNewPath += this.OnNewPath; + } + + /// + /// Deactivates the system. + /// + public void Deactivate() + { + Obj_AI_Base.OnNewPath -= this.OnNewPath; + } + + /// + /// Gets the dash info. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public DashItem GetDashInfo(Obj_AI_Base unit) + { + DashItem value; + return this.Dashes.TryGetValue(unit.NetworkId, out value) ? value : new DashItem(); + } + + /// + /// Determines if the unit is dashing. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public bool IsDashing(Obj_AI_Base unit) + { + DashItem value; + if (this.Dashes.TryGetValue(unit.NetworkId, out value)) + { + return unit.Path.Length != 0 && value.EndTick != 0; + } + + return false; + } + + #endregion + + #region Methods + + private void OnNewPath(Obj_AI_Base sender, GameObjectNewPathEventArgs args) + { + var hero = sender as Obj_AI_Hero; + if (hero == null) + { + return; + } + + var id = hero.NetworkId; + if (!this.Dashes.ContainsKey(id)) + { + this.Dashes[id] = new DashItem(); + } + + if (args.IsDash) + { + var path = new List { sender.ServerPosition.To2D() }; + path.AddRange(args.Path.ToList().To2D()); + + this.Dashes[id].StartTick = Utils.GameTimeTickCount; + this.Dashes[id].Speed = args.Speed; + this.Dashes[id].StartPos = sender.ServerPosition.To2D(); + this.Dashes[id].Unit = sender; + this.Dashes[id].Path = path; + this.Dashes[id].EndPos = path.Last(); + this.Dashes[id].EndTick = this.Dashes[id].StartTick + + (int)(1000 + * (this.Dashes[id].EndPos.Distance(this.Dashes[id].StartPos) + / this.Dashes[id].Speed)); + this.Dashes[id].Duration = this.Dashes[id].EndTick - this.Dashes[id].StartTick; + + CustomEvents.Unit.TriggerOnDash(sender, this.Dashes[id]); + } + else + { + this.Dashes[id].EndTick = 0; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Dash/DashAdapter.cs b/source/Dash/DashAdapter.cs new file mode 100644 index 00000000..88307497 --- /dev/null +++ b/source/Dash/DashAdapter.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// Game dash information parser. + /// + [Export(typeof(Dash))] + public partial class Dash + { + #region Public Methods and Operators + + /// + /// Initalizes the system. + /// + public static void Initalize() => Instances.Dash?.Activate(); + + /// + /// Shuts the system down. + /// + public static void Shutdown() => Instances.Dash?.Deactivate(); + + #endregion + } +} \ No newline at end of file diff --git a/source/Dash/DashExtensions.cs b/source/Dash/DashExtensions.cs new file mode 100644 index 00000000..1b781114 --- /dev/null +++ b/source/Dash/DashExtensions.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Dash extensions. + /// + public static class DashExtensions + { + #region Public Methods and Operators + + /// + /// Gets the dash info. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static Dash.DashItem GetDashInfo(this Obj_AI_Base unit) => Instances.Dash?.GetDashInfo(unit); + + /// + /// Determines if the unit is dashing. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static bool IsDashing(this Obj_AI_Base unit) => Instances.Dash?.IsDashing(unit) ?? false; + + #endregion + } +} \ No newline at end of file diff --git a/source/Dash/DashItem.cs b/source/Dash/DashItem.cs new file mode 100644 index 00000000..2205e88c --- /dev/null +++ b/source/Dash/DashItem.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + + using SharpDX; + + /// + /// Game dash information parser. + /// + public partial class Dash + { + /// + /// The dash item. + /// + public class DashItem + { + #region Public Properties + + /// + /// Gets or sets the duration. + /// + public int Duration { get; set; } + + /// + /// Gets or sets the ending position. + /// + public Vector2 EndPos { get; set; } + + /// + /// Gets or sets the ending tick. + /// + public int EndTick { get; set; } + + /// + /// Gets or sets a value indicating whether the dash is a blink. + /// + public bool IsBlink { get; set; } + + /// + /// Gets or sets the path. + /// + public List Path { get; set; } + + /// + /// Gets or sets the speed. + /// + public float Speed { get; set; } + + /// + /// Gets or sets the starting position. + /// + public Vector2 StartPos { get; set; } + + /// + /// Gets or sets the starting tick. + /// + public int StartTick { get; set; } + + /// + /// Gets or sets the unit. + /// + public Obj_AI_Base Unit { get; set; } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Events/GameEvents.cs b/source/Events/GameEvents.cs new file mode 100644 index 00000000..1bc2075c --- /dev/null +++ b/source/Events/GameEvents.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + using System.Reflection; + + using log4net; + + using PlaySharp.Toolkit.AppDomain.Messages; + using PlaySharp.Toolkit.EventAggregator; + using PlaySharp.Toolkit.Logging; + + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The game events. + /// + [Export(typeof(Game))] + public partial class Game : IPartImportsSatisfiedNotification + { + #region Public Properties + + /// + /// Gets the event aggregator. + /// + [Import(typeof(IEventAggregator), AllowDefault = true)] + public IEventAggregator EventAggregator { get; private set; } + + #endregion + + #region Properties + + private ILog Log { get; } = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #endregion + + #region Public Methods and Operators + + /// + public void OnImportsSatisfied() + { + if (this.EventAggregator == null) + { + this.Log.Fatal("EventAggregator was not imported, using legacy events."); + LeagueSharp.Game.OnUpdate += args => this.Handle(new OnGameUpdate()); + LeagueSharp.Game.OnEnd += args => this.Handle(new OnGameEnd()); + return; + } + + this.EventAggregator.Subscribe(this); + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Events/OnDash.cs b/source/Events/OnDash.cs new file mode 100644 index 00000000..5b257c92 --- /dev/null +++ b/source/Events/OnDash.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The unit events. + /// + public partial class Unit + { + #region Delegates + + /// + /// The dashed delegate. + /// + /// + /// The sender. + /// + /// + /// The args. + /// + public delegate void OnDashed(Obj_AI_Base sender, Dash.DashItem args); + + #endregion + + #region Public Events + + /// + /// The dash event. + /// + public static event OnDashed OnDash; + + #endregion + + #region Public Methods and Operators + + /// + /// Triggers the dash event. + /// + /// + /// The sender. + /// + /// + /// The args. + /// + public static void TriggerOnDash(Obj_AI_Base sender, Dash.DashItem args) => OnDash?.Invoke(sender, args); + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Events/OnGameEnd.cs b/source/Events/OnGameEnd.cs new file mode 100644 index 00000000..5a38e439 --- /dev/null +++ b/source/Events/OnGameEnd.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using PlaySharp.Toolkit.AppDomain.Messages; + using PlaySharp.Toolkit.EventAggregator; + + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The game events. + /// + public partial class Game : IHandle + { + #region Delegates + + /// + /// Game end delegate. + /// + /// + /// The event args. + /// + public delegate void OnGameEnded(EventArgs e); + + #endregion + + #region Public Events + + /// + /// Game end event. + /// + public static event OnGameEnded OnGameEnd; + + #endregion + + #region Public Methods and Operators + + /// + public void Handle(OnGameEnd message) + { + OnGameEnd?.Invoke(EventArgs.Empty); + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Events/OnGameLoad.cs b/source/Events/OnGameLoad.cs new file mode 100644 index 00000000..b11c8950 --- /dev/null +++ b/source/Events/OnGameLoad.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using PlaySharp.Toolkit.AppDomain.Messages; + using PlaySharp.Toolkit.EventAggregator; + + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The game events. + /// + public partial class Game : IHandle + { + #region Fields + + private int lastHandleTick; + + #endregion + + #region Delegates + + /// + /// Game loaded delegate. + /// + /// + /// The event args. + /// + public delegate void OnGameLoaded(EventArgs e); + + #endregion + + #region Public Events + + /// + /// Game load event. + /// + public static event OnGameLoaded OnGameLoad; + + #endregion + + #region Properties + + private List InvocationList { get; } = new List(); + + #endregion + + #region Public Methods and Operators + + /// + public void Handle(OnGameUpdate message) + { + if (Utils.GameTimeTickCount - this.lastHandleTick <= 500) + { + return; + } + + this.lastHandleTick = Utils.GameTimeTickCount; + + if (LeagueSharp.Game.Mode == GameMode.Running && OnGameLoad != null) + { + foreach (var s in OnGameLoad.GetInvocationList().Where(s => !this.InvocationList.Contains(s))) + { + this.InvocationList.Add(s); + try + { + s.DynamicInvoke(EventArgs.Empty); + } + catch (Exception e) + { + this.Log.Fatal("Failed to dynamiclly invoke a loading request.", e); + } + } + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Events/OnLevelUp.cs b/source/Events/OnLevelUp.cs new file mode 100644 index 00000000..6a863dc3 --- /dev/null +++ b/source/Events/OnLevelUp.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The unit events. + /// + public partial class Unit + { + #region Delegates + + /// + /// Leveled up delegate. + /// + /// + /// The sender. + /// + /// + /// The event arguments. + /// + public delegate void OnLeveledUp(Obj_AI_Base sender, OnLevelUpEventArgs args); + + #endregion + + #region Public Events + + /// + /// Level up event. + /// + public static event OnLeveledUp OnLevelUp; + + #endregion + + #region Methods + + private static void InternalOnLevelUp(Obj_AI_Base sender, EventArgs args) + { + var level = (sender as Obj_AI_Hero)?.Level ?? (sender as Obj_AI_Minion)?.MinionLevel ?? 1; + var points = (sender as Obj_AI_Hero)?.SpellTrainingPoints ?? 0; + OnLevelUp?.Invoke(sender, new OnLevelUpEventArgs(level, level - 1, points)); + } + + #endregion + + /// + /// Level up event arguments. + /// + public class OnLevelUpEventArgs : EventArgs + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The new level. + /// + /// + /// The old level. + /// + /// + /// The remaining points. + /// + public OnLevelUpEventArgs(int newLevel, int oldLevel, int remainingPoints) + { + this.NewLevel = newLevel; + this.OldLevel = oldLevel; + this.RemainingPoints = remainingPoints; + } + + #endregion + + #region Public Properties + + /// + /// Gets the new level. + /// + public int NewLevel { get; } + + /// + /// Gets the old level. + /// + public int OldLevel { get; } + + /// + /// Gets the remaining points. + /// + public int RemainingPoints { get; } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Events/OnLevelUpSpell.cs b/source/Events/OnLevelUpSpell.cs new file mode 100644 index 00000000..f043f5c7 --- /dev/null +++ b/source/Events/OnLevelUpSpell.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The unit events. + /// + public partial class Unit + { + #region Delegates + + /// + /// The level up spell delegate. + /// + /// + /// The sender. + /// + /// + /// The args. + /// + public delegate void OnLeveledUpSpell(Obj_AI_Base sender, OnLevelUpSpellEventArgs args); + + #endregion + + #region Public Events + + /// + /// The level up spell event. + /// + public static event OnLeveledUpSpell OnLevelUpSpell; + + #endregion + + /// + /// Level up spell event args. + /// + public class OnLevelUpSpellEventArgs : EventArgs + { + #region Fields + + /// + /// The remaining points. + /// + [Obsolete] + public int Remainingpoints; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The remaining points. + /// + /// + /// The spell id. + /// + /// + /// The spell level. + /// + public OnLevelUpSpellEventArgs(int remainingPoints, int spellId, int spellLevel) + { + this.RemainingPoints = remainingPoints; + this.SpellId = spellId; + this.SpellLevel = spellLevel; + } + + #endregion + + #region Public Properties + + /// + /// Gets the remaining points. + /// + public int RemainingPoints { get; } + + /// + /// Gets the spell id. + /// + public int SpellId { get; } + + /// + /// Gets the spell level. + /// + public int SpellLevel { get; } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Events/UnitEvents.cs b/source/Events/UnitEvents.cs new file mode 100644 index 00000000..dbd67e91 --- /dev/null +++ b/source/Events/UnitEvents.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The unit events. + /// + [Export(typeof(Unit))] + public partial class Unit + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public Unit() + { + Obj_AI_Base.OnLevelUp += InternalOnLevelUp; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Geometry/Arc.cs b/source/Geometry/Arc.cs new file mode 100644 index 00000000..30536b9c --- /dev/null +++ b/source/Geometry/Arc.cs @@ -0,0 +1,139 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// The polygon. + /// + public partial class Polygon + { + /// + /// Arc Polygon. + /// + public class Arc : Polygon + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The start. + /// + /// + /// The direction. + /// + /// + /// The angle. + /// + /// + /// The radius. + /// + /// + /// The quality. + /// + public Arc(Vector3 start, Vector3 direction, float angle, float radius, int quality = 20) + : this(start.To2D(), direction.To2D(), angle, radius, quality) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The start. + /// + /// + /// The direction. + /// + /// + /// The angle. + /// + /// + /// The radius. + /// + /// + /// The quality. + /// + public Arc(Vector2 start, Vector2 direction, float angle, float radius, int quality = 20) + { + this.StartPos = start; + this.EndPos = (direction - start).Normalized(); + this.Angle = angle; + this.Radius = radius; + this.Quality = quality; + this.UpdatePolygon(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the angle. + /// + public float Angle { get; set; } + + /// + /// Gets or sets the ending position. + /// + public Vector2 EndPos { get; set; } + + /// + /// Gets or sets the quality. + /// + public int Quality { get; set; } + + /// + /// Gets or sets the radius. + /// + public float Radius { get; set; } + + /// + /// Gets or sets the starting position. + /// + public Vector2 StartPos { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Updates the polygon. + /// + /// + /// The radius offset. + /// + public void UpdatePolygon(int offset = 0) + { + this.Points.Clear(); + + var radius = (this.Radius + offset) / (float)Math.Cos(2 * Math.PI / this.Quality); + var side = this.EndPos.Rotated(-this.Angle * .5f); + + for (var i = 0; i <= this.Quality; ++i) + { + var direction = side.Rotated(i * this.Angle / this.Quality).Normalized(); + this.Points.Add( + new Vector2( + this.StartPos.X + (radius * direction.X), + this.StartPos.Y + (radius * direction.Y))); + } + } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Geometry/Circle.cs b/source/Geometry/Circle.cs new file mode 100644 index 00000000..9dfeac82 --- /dev/null +++ b/source/Geometry/Circle.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// The polygon. + /// + public partial class Polygon + { + /// + /// Circle Polygon. + /// + public class Circle : Polygon + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The center. + /// + /// + /// The radius. + /// + /// + /// The quality. + /// + public Circle(Vector3 center, float radius, int quality = 20) + : this(center.To2D(), radius, quality) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The center. + /// + /// + /// The radius. + /// + /// + /// The quality. + /// + public Circle(Vector2 center, float radius, int quality = 20) + { + this.Center = center; + this.Radius = radius; + this.Quality = quality; + this.UpdatePolygon(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the center. + /// + public Vector2 Center { get; set; } + + /// + /// Gets or sets the quality. + /// + public int Quality { get; set; } + + /// + /// Gets or sets the radius. + /// + public float Radius { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Updates the polygon. + /// + /// + /// The radius offset. + /// + /// + /// The width to override with. + /// + public void UpdatePolygon(int offset = 0, float overrideWidth = -1) + { + this.Points.Clear(); + var radius = overrideWidth > 0 + ? overrideWidth + : (offset + this.Radius) / (float)Math.Cos(2 * Math.PI / this.Quality); + + for (var i = 1; i <= this.Quality; ++i) + { + var angle = i * 2 * Math.PI / this.Quality; + var point = new Vector2( + this.Center.X + (radius * (float)Math.Cos(angle)), + this.Center.Y + (radius * (float)Math.Sin(angle))); + this.Points.Add(point); + } + } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Geometry/ConvexHull.cs b/source/Geometry/ConvexHull.cs new file mode 100644 index 00000000..b06fd319 --- /dev/null +++ b/source/Geometry/ConvexHull.cs @@ -0,0 +1,502 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using System.Linq; + + using SharpDX; + + /// + /// Provides methods for finding the minimum enclosing circles. + /// +#pragma warning disable SA1300 + public static partial class MEC + { + #region Public Properties + + /// + /// Gets or sets the min max box debug value. + /// + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Compability")] + public static RectangleF g_MinMaxBox { get; set; } + + /// + /// Gets or sets the min max corners debug value. + /// + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Compability")] + public static Vector2[] g_MinMaxCorners { get; set; } + + /// + /// Gets or sets the non culled points debug value. + /// + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Compability")] + public static Vector2[] g_NonCulledPoints { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Finds the minimal bounding circle. + /// + /// + /// The points. + /// + /// + /// The center. + /// + /// + /// The radius. + /// + public static void FindMinimalBoundingCircle(List points, out Vector2 center, out float radius) + { + // Find the convex hull. + var hull = MakeConvexHull(points); + + // The best solution so far. + var bestCenter = points[0]; + var bestRadius2 = float.MaxValue; + + // Look at pairs of hull points. + for (var i = 0; i < hull.Count - 1; i++) + { + for (var j = i + 1; j < hull.Count; j++) + { + // Find the circle through these two points. + var testCenter = new Vector2((hull[i].X + hull[j].X) / 2f, (hull[i].Y + hull[j].Y) / 2f); + var dx = testCenter.X - hull[i].X; + var dy = testCenter.Y - hull[i].Y; + var testRadius2 = (dx * dx) + (dy * dy); + + // See if this circle would be an improvement. + if (testRadius2 < bestRadius2) + { + // See if this circle encloses all of the points. + if (CircleEnclosesPoints(testCenter, testRadius2, points, i, j, -1)) + { + // Save this solution. + bestCenter = testCenter; + bestRadius2 = testRadius2; + } + } + } // for i + } // for j + + // Look at triples of hull points. + for (var i = 0; i < hull.Count - 2; i++) + { + for (var j = i + 1; j < hull.Count - 1; j++) + { + for (var k = j + 1; k < hull.Count; k++) + { + // Find the circle through these three points. + Vector2 testCenter; + float testRadius2; + FindCircle(hull[i], hull[j], hull[k], out testCenter, out testRadius2); + + // See if this circle would be an improvement. + if (testRadius2 < bestRadius2) + { + // See if this circle encloses all of the points. + if (CircleEnclosesPoints(testCenter, testRadius2, points, i, j, k)) + { + // Save this solution. + bestCenter = testCenter; + bestRadius2 = testRadius2; + } + } + } // for k + } // for i + } // for j + + center = bestCenter; + if (Math.Abs(bestRadius2 - float.MaxValue) < float.Epsilon) + { + radius = 0; + } + else + { + radius = (float)Math.Sqrt(bestRadius2); + } + } + + /// + /// Returns the mininimum enclosing circle from a list of points. + /// + /// + /// The points. + /// + /// + /// The . + /// + public static MecCircle GetMec(List points) + { + Vector2 center; + float radius; + + var convexHull = MakeConvexHull(points); + FindMinimalBoundingCircle(convexHull, out center, out radius); + return new MecCircle(center, radius); + } + + /// + /// Makes the convex hull. + /// + /// + /// The points. + /// + /// + /// Points that make up a polygon's convex hull. + /// + public static List MakeConvexHull(List points) + { + // Cull. + points = HullCull(points); + + // Find the remaining point with the smallest Y value. + // if (there's a tie, take the one with the smaller X value. + Vector2[] bestPt = { points[0] }; + foreach (var pt in + points.Where( + pt => + (pt.Y < bestPt[0].Y) + || ((Math.Abs(pt.Y - bestPt[0].Y) < float.Epsilon) && (pt.X < bestPt[0].X)))) + { + bestPt[0] = pt; + } + + // Move this point to the convex hull. + var hull = new List { bestPt[0] }; + points.Remove(bestPt[0]); + + // Start wrapping up the other points. + float sweepAngle = 0; + for (; ;) + { + // If all of the points are on the hull, we're done. + if (points.Count == 0) + { + break; + } + + // Find the point with smallest AngleValue + // from the last point. + var x = hull[hull.Count - 1].X; + var y = hull[hull.Count - 1].Y; + bestPt[0] = points[0]; + float bestAngle = 3600; + + // Search the rest of the points. + foreach (var pt in points) + { + var testAngle = AngleValue(x, y, pt.X, pt.Y); + if ((testAngle >= sweepAngle) && (bestAngle > testAngle)) + { + bestAngle = testAngle; + bestPt[0] = pt; + } + } + + // See if the first point is better. + // If so, we are done. + var firstAngle = AngleValue(x, y, hull[0].X, hull[0].Y); + if ((firstAngle >= sweepAngle) && (bestAngle >= firstAngle)) + { + // The first point is better. We're done. + break; + } + + // Add the best point to the convex hull. + hull.Add(bestPt[0]); + points.Remove(bestPt[0]); + + sweepAngle = bestAngle; + } + + return hull; + } + + #endregion + + #region Methods + + /// + /// Return a number that gives the ordering of angles + /// WRST horizontal from the point (x1, y1) to (x2, y2). + /// In other words, AngleValue(x1, y1, x2, y2) is not + /// the angle, but if: + /// Angle(x1, y1, x2, y2) > Angle(x1, y1, x2, y2) + /// then + /// AngleValue(x1, y1, x2, y2) > AngleValue(x1, y1, x2, y2) + /// this angle is greater than the angle for another set + /// of points,) this number for + /// This function is dy / (dy + dx). + /// + /// + /// First X. + /// + /// + /// First Y. + /// + /// + /// Second X. + /// + /// + /// Second Y. + /// + /// + /// The . + /// + private static float AngleValue(float x1, float y1, float x2, float y2) + { + float t; + + var dx = x2 - x1; + var ax = Math.Abs(dx); + var dy = y2 - y1; + var ay = Math.Abs(dy); + if ((ax + ay).Equals(0)) + { + // if (the two points are the same, return 360. + t = 360f / 9f; + } + else + { + t = dy / (ax + ay); + } + + if (dx < 0) + { + t = 2 - t; + } + else if (dy < 0) + { + t = 4 + t; + } + + return t * 90; + } + + /// + /// Returns whether the indicated circle encloses all of the points. + /// + /// + /// Center of the Circle. + /// + /// + /// Circle Radius. + /// + /// + /// Points List. + /// + /// + /// Skip certain point 1. + /// + /// + /// Skip certain point 2. + /// + /// + /// Skip certain point 3. + /// + /// + /// The . + /// + private static bool CircleEnclosesPoints( + Vector2 center, + float radius2, + IEnumerable points, + int skip1, + int skip2, + int skip3) + { + return (from point in points.Where((t, i) => (i != skip1) && (i != skip2) && (i != skip3)) + let dx = center.X - point.X + let dy = center.Y - point.Y + select (dx * dx) + (dy * dy)).All(testRadius2 => !(testRadius2 > radius2)); + } + + /// + /// Find a circle through three Vector2 points + /// + /// + /// Vector2 point A. + /// + /// + /// Vector2 point B. + /// + /// + /// Vector2 point C. + /// + /// + /// Returned Vector2 Center. + /// + /// + /// Retuned Circle Radius. + /// + private static void FindCircle(Vector2 a, Vector2 b, Vector2 c, out Vector2 center, out float radius2) + { + // Get the perpendicular bisector of (x1, y1) and (x2, y2). + var x1 = (b.X + a.X) / 2; + var y1 = (b.Y + a.Y) / 2; + var dy1 = b.X - a.X; + var dx1 = -(b.Y - a.Y); + + // Get the perpendicular bisector of (x2, y2) and (x3, y3). + var x2 = (c.X + b.X) / 2; + var y2 = (c.Y + b.Y) / 2; + var dy2 = c.X - b.X; + var dx2 = -(c.Y - b.Y); + + // See where the lines intersect. + var cx = ((y1 * dx1 * dx2) + (x2 * dx1 * dy2) - (x1 * dy1 * dx2) - (y2 * dx1 * dx2)) + / ((dx1 * dy2) - (dy1 * dx2)); + var cy = ((cx - x1) * dy1 / dx1) + y1; + center = new Vector2(cx, cy); + + var dx = cx - a.X; + var dy = cy - a.Y; + radius2 = (dx * dx) + (dy * dy); + } + + /// + /// Find a box that fits inside the MinMax quadrilateral. + /// + /// + /// The Points. + /// + /// + /// . + /// + private static RectangleF GetMinMaxBox(IEnumerable points) + { + // Find the MinMax quadrilateral. + Vector2 ul = new Vector2(0, 0), ur = ul, ll = ul, lr = ul; + var minMaxCornersInfo = GetMinMaxCorners(points, ul, ur, ll, lr); + ul = minMaxCornersInfo.UpperLeft; + ur = minMaxCornersInfo.UpperRight; + ll = minMaxCornersInfo.LowerLeft; + lr = minMaxCornersInfo.LowerRight; + + // Get the coordinates of a box that lies inside this quadrilateral. + var xmin = ul.X; + var ymin = ul.Y; + + var xmax = ur.X; + if (ymin < ur.Y) + { + ymin = ur.Y; + } + + if (xmax > lr.X) + { + xmax = lr.X; + } + + var ymax = lr.Y; + + if (xmin < ll.X) + { + xmin = ll.X; + } + + if (ymax > ll.Y) + { + ymax = ll.Y; + } + + var result = new RectangleF(xmin, ymin, xmax - xmin, ymax - ymin); + g_MinMaxBox = result; + return result; + } + + /// + /// Find the points nearest the upper left, upper right, lower left, and lower right corners. + /// + /// + /// The Points. + /// + /// + /// Upper left . + /// + /// + /// Upper right . + /// + /// + /// Lower left . + /// + /// + /// Lower right . + /// + /// + /// The list. + /// + private static MinMaxCornersInfo GetMinMaxCorners( + IEnumerable points, + Vector2 upperLeft, + Vector2 upperRight, + Vector2 lowerLeft, + Vector2 lowerRight) + { + // Search the other points. + foreach (var pt in points) + { + if (-pt.X - pt.Y > -upperLeft.X - upperLeft.Y) + { + upperLeft = pt; + } + + if (pt.X - pt.Y > upperRight.X - upperRight.Y) + { + upperRight = pt; + } + + if (-pt.X + pt.Y > -lowerLeft.X + lowerLeft.Y) + { + lowerLeft = pt; + } + + if (pt.X + pt.Y > lowerRight.X + lowerRight.Y) + { + lowerRight = pt; + } + } + + g_MinMaxCorners = new[] { upperLeft, upperRight, lowerRight, lowerLeft }; + return new MinMaxCornersInfo(upperLeft, upperRight, lowerLeft, lowerRight); + } + + /// + /// Cull points out of the convex hull that lie inside the trapezoid defined by the vertices with smallest and largest + /// X and Y coordinates. Return the points that are not culled. + /// + /// + /// The Points. + /// + /// + /// List of . + /// + private static List HullCull(IReadOnlyList points) + { + // Find a culling box. + var cullingBox = GetMinMaxBox(points); + + var results = + points.Where( + pt => + pt.X <= cullingBox.Left || pt.X >= cullingBox.Right || pt.Y <= cullingBox.Top + || pt.Y >= cullingBox.Bottom).ToList(); + + g_NonCulledPoints = new Vector2[results.Count]; + results.CopyTo(g_NonCulledPoints); + + return results; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Geometry/Geometry.cs b/source/Geometry/Geometry.cs new file mode 100644 index 00000000..159f42a4 --- /dev/null +++ b/source/Geometry/Geometry.cs @@ -0,0 +1,613 @@ +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.Linq; + + using ClipperLib; + + using SharpDX; + + using static System.Math; + + public static partial class Geometry + { + #region Public Methods and Operators + + public static float AngleBetween(this Vector2 p1, Vector2 p2) + { + var theta = p1.Polar() - p2.Polar(); + if (theta < 0) + { + theta = theta + 360; + } + + if (theta > 180) + { + theta = 360 - theta; + } + + return theta; + } + + public static Vector2 CenterOfPolygone(this Polygon p) + { + var cX = 0f; + var cY = 0f; + var pc = p.Points.Count; + foreach (var point in p.Points) + { + cX += point.X; + cY += point.Y; + } + + return new Vector2(cX / pc, cY / pc); + } + + public static Vector2[] CircleCircleIntersection(Vector2 center1, Vector2 center2, float radius1, float radius2) + { + var d = center1.Distance(center2); + + // The Circles don't intersect: + if (d > radius1 + radius2 || (d <= Abs(radius1 - radius2))) + { + return new Vector2[] { }; + } + + var a = ((radius1 * radius1) - (radius2 * radius2) + (d * d)) / (2 * d); + var h = (float)Sqrt((radius1 * radius1) - (a * a)); + var direction = (center2 - center1).Normalized(); + var pa = center1 + (a * direction); + var s1 = pa + (h * direction.Perpendicular()); + var s2 = pa - (h * direction.Perpendicular()); + return new[] { s1, s2 }; + } + + public static List> ClipPolygons(List polygons) + { + var subj = new List>(polygons.Count); + var clip = new List>(polygons.Count); + foreach (var polygon in polygons) + { + subj.Add(polygon.ToClipperPath()); + clip.Add(polygon.ToClipperPath()); + } + + var solution = new List>(); + var c = new Clipper(); + c.AddPaths(subj, PolyType.ptSubject, true); + c.AddPaths(clip, PolyType.ptClip, true); + c.Execute(ClipType.ctUnion, solution, PolyFillType.pftPositive, PolyFillType.pftEvenOdd); + + return solution; + } + + public static bool Close(float a, float b, float eps) + { + if (Abs(eps) < float.Epsilon) + { + eps = (float)1e-9; + } + + return Abs(a - b) <= eps; + } + + public static Vector2 Closest(this Vector2 v, List vList) + { + var result = default(Vector2); + var dist = float.MaxValue; + + foreach (var vector in vList) + { + var distance = Vector2.DistanceSquared(v, vector); + if (distance < dist) + { + dist = distance; + result = vector; + } + } + + return result; + } + + public static float CrossProduct(this Vector2 self, Vector2 other) => (other.Y * self.X) - (other.X * self.Y); + + public static float DegreeToRadian(double angle) => (float)(PI * angle / 180.0); + + /// + /// Calculates the distance between the player and the unit. + /// + /// + /// The unit. + /// + /// + /// A value indicating whether to square the distance. + /// + /// + /// The . + /// + public static float Distance(this GameObject unit, bool squared = false) + => ObjectManager.Player.Distance(unit, squared); + + public static float Distance(this T unit, T1 unit2, bool squared = false) where T : GameObject + where T1 : GameObject + { + return unit?.Position.To2D().Distance(unit2?.Position.To2D() ?? default(Vector2), squared) ?? 0f; + } + + public static float Distance(this Vector3 v, Vector3 other, bool squared = false) + => squared ? Vector3.DistanceSquared(v, other) : Vector3.Distance(v, other); + + public static float Distance(this Vector2 v, Vector2 other, bool squared = false) + => squared ? Vector2.DistanceSquared(v, other) : Vector2.Distance(v, other); + + public static float Distance(this Vector3 v, Vector2 other, bool squared = false) + => squared ? Vector2.DistanceSquared(v.To2D(), other) : Vector2.Distance(v.To2D(), other); + + public static float Distance(this Vector2 v, Vector3 other, bool squared = false) + => squared ? Vector2.DistanceSquared(v, other.To2D()) : Vector2.Distance(v, other.To2D()); + + public static float Distance(this Vector2 v, T to, bool squared = false) where T : GameObject + => v.Distance(to.Position.To2D(), squared); + + public static float Distance(this Vector3 v, T to, bool squared = false) where T : GameObject + => v.Distance(to.Position.To2D(), squared); + + public static float Distance(this T from, Vector2 to, bool squared = false) where T : GameObject + => to.Distance(from.Position.To2D(), squared); + + public static float Distance(this T from, Vector3 to, bool squared = false) where T : GameObject + => to.Distance(from.Position.To2D(), squared); + + public static float Distance( + this Vector2 point, + Vector2 segmentStart, + Vector2 segmentEnd, + bool onlyIfOnSegment = false, + bool squared = false) + { + var objects = point.ProjectOn(segmentStart, segmentEnd); + return objects.IsOnSegment || onlyIfOnSegment == false + ? objects.SegmentPoint.Distance(point, squared) + : float.MaxValue; + } + + public static float Distance3D(this T unit, T1 unit2, bool squared = false) where T : GameObject + where T1 : GameObject + { + return unit?.Position.Distance(unit2?.Position ?? default(Vector3), squared) ?? 0f; + } + + public static Vector2 Extend(this Vector2 v, Vector2 to, float distance) + => v + (distance * (to - v).Normalized()); + + public static Vector3 Extend(this Vector3 v, Vector3 to, float distance) + => v + (distance * (to - v).Normalized()); + + public static Vector3 Extend(this Vector3 v, Vector2 to, float distance) => v.Extend(to.To3D(), distance); + + public static Vector3 Extend(this Vector2 v, Vector3 to, float distance) => v.To3D().Extend(to, distance); + + public static bool InRange(this T unit, T1 unit2, float range, bool squared = false) where T : GameObject + where T1 : + GameObject + { + return unit.Distance(unit2, squared) <= GetRange(range, squared); + } + + public static bool InRange(this GameObject unit, float range, bool squared = false) + => ObjectManager.Player.InRange(unit, range, squared); + + public static bool InRange(this Vector3 v, Vector3 other, float range, bool squared = false) + => v.Distance(other, squared) <= GetRange(range, squared); + + public static bool InRange(this Vector2 v, Vector2 other, float range, bool squared = false) + => v.Distance(other, squared) <= GetRange(range, squared); + + public static bool InRange(this Vector3 v, Vector2 other, float range, bool squared = false) + => v.Distance(other, squared) <= GetRange(range, squared); + + public static bool InRange(this Vector2 v, Vector3 other, float range, bool squared = false) + => v.Distance(other, squared) <= GetRange(range, squared); + + public static bool InRange(this Vector2 v, T to, float range, bool squared = false) where T : GameObject + => v.InRange(to.Position.To2D(), range, squared); + + public static bool InRange(this Vector3 v, T to, float range, bool squared = false) where T : GameObject + => v.InRange(to.Position.To2D(), range, squared); + + public static bool InRange(this T from, Vector2 to, float range, bool squared = false) where T : GameObject + => to.InRange(from.Position.To2D(), range, squared); + + public static bool InRange(this T from, Vector3 to, float range, bool squared = false) where T : GameObject + => to.InRange(from.Position.To2D(), range, squared); + + public static IntersectionResult Intersection( + this Vector2 lineSegment1Start, + Vector2 lineSegment1End, + Vector2 lineSegment2Start, + Vector2 lineSegment2End) + { + double deltaACy = lineSegment1Start.Y - lineSegment2Start.Y; + double deltaDCx = lineSegment2End.X - lineSegment2Start.X; + double deltaACx = lineSegment1Start.X - lineSegment2Start.X; + double deltaDCy = lineSegment2End.Y - lineSegment2Start.Y; + double deltaBAx = lineSegment1End.X - lineSegment1Start.X; + double deltaBAy = lineSegment1End.Y - lineSegment1Start.Y; + + var denominator = (deltaBAx * deltaDCy) - (deltaBAy * deltaDCx); + var numerator = (deltaACy * deltaDCx) - (deltaACx * deltaDCy); + + if (Abs(denominator) < float.Epsilon) + { + if (Abs(numerator) < float.Epsilon) + { + // collinear. Potentially infinite intersection points. + // Check and return one of them. + if (lineSegment1Start.X >= lineSegment2Start.X && lineSegment1Start.X <= lineSegment2End.X) + { + return new IntersectionResult(true, lineSegment1Start); + } + + if (lineSegment2Start.X >= lineSegment1Start.X && lineSegment2Start.X <= lineSegment1End.X) + { + return new IntersectionResult(true, lineSegment2Start); + } + + return default(IntersectionResult); + } + + // parallel + return default(IntersectionResult); + } + + var r = numerator / denominator; + if (r < 0 || r > 1) + { + return default(IntersectionResult); + } + + var s = ((deltaACy * deltaBAx) - (deltaACx * deltaBAy)) / denominator; + if (s < 0 || s > 1) + { + return default(IntersectionResult); + } + + var vector2 = new Vector2( + (float)(lineSegment1Start.X + (r * deltaBAx)), + (float)(lineSegment1Start.Y + (r * deltaBAy))); + return new IntersectionResult(true, vector2); + } + + public static bool IsValid(this Vector2 v) => !v.IsZero; + + public static bool IsValid(this Vector3 v) => !v.IsZero; + + public static List JoinPolygons(this List sList) + { + var p = ClipPolygons(sList); + var tList = new List>(); + + var c = new Clipper(); + c.AddPaths(p, PolyType.ptClip, true); + c.Execute(ClipType.ctUnion, tList, PolyFillType.pftNonZero, PolyFillType.pftNonZero); + + return ToPolygons(tList); + } + + public static List JoinPolygons( + this List sList, + ClipType cType, + PolyType pType = PolyType.ptClip, + PolyFillType pFType1 = PolyFillType.pftNonZero, + PolyFillType pFType2 = PolyFillType.pftNonZero) + { + var p = ClipPolygons(sList); + var tList = new List>(); + + var c = new Clipper(); + c.AddPaths(p, pType, true); + c.Execute(cType, tList, pFType1, pFType2); + + return ToPolygons(tList); + } + + public static Polygon MovePolygone(this Polygon polygon, Vector2 moveTo) + { + var p = new Polygon(); + + p.Add(moveTo); + + var count = polygon.Points.Count; + + var startPoint = polygon.Points[0]; + + for (var i = 1; i < count; i++) + { + var polygonePoint = polygon.Points[i]; + + p.Add( + new Vector2( + moveTo.X + (polygonePoint.X - startPoint.X), + moveTo.Y + (polygonePoint.Y - startPoint.Y))); + } + + return p; + } + + public static Vector2 Normalized(this Vector2 v) + { + v.Normalize(); + return v; + } + + public static Vector3 Normalized(this Vector3 v) + { + v.Normalize(); + return v; + } + + public static float PathLength(this List path) + { + var distance = 0f; + for (var i = 0; i < path.Count - 1; ++i) + { + distance += path[i].Distance(path[i + 1]); + } + + return distance; + } + + public static Vector2 Perpendicular(this Vector2 v) => new Vector2(-v.Y, v.X); + + public static Vector2 Perpendicular2(this Vector2 v) => new Vector2(v.Y, -v.X); + + public static float Polar(this Vector2 v1) + { + if (Close(v1.X, 0, 0)) + { + if (v1.Y > 0) + { + return 90; + } + + return v1.Y < 0 ? 270 : 0; + } + + var theta = RadianToDegree(Atan(v1.Y / v1.X)); + if (v1.X < 0) + { + theta = theta + 180; + } + + if (theta < 0) + { + theta = theta + 360; + } + + return theta; + } + + public static Vector2 PositionAfter(this List self, int t, int s, int delay = 0) + { + var distance = Max(0, t - delay) * s / 1000; + for (var i = 0; i <= self.Count - 2; i++) + { + var from = self[i]; + var to = self[i + 1]; + var d = (int)to.Distance(from); + if (d > distance) + { + return from + (distance * (to - from).Normalized()); + } + + distance -= d; + } + + return self[self.Count - 1]; + } + + public static ProjectionInfo ProjectOn(this Vector2 point, Vector2 segmentStart, Vector2 segmentEnd) + { + var cX = point.X; + var cY = point.Y; + var aX = segmentStart.X; + var aY = segmentStart.Y; + var bX = segmentEnd.X; + var bY = segmentEnd.Y; + + var rL = (((cX - aX) * (bX - aX)) + ((cY - aY) * (bY - aY))) + / ((float)Pow(bX - aX, 2) + (float)Pow(bY - aY, 2)); + var pointLine = new Vector2(aX + (rL * (bX - aX)), aY + (rL * (bY - aY))); + var rS = rL < 0 ? 0 : rL > 1 ? 1 : rL; + var isOnSegment = rS.CompareTo(rL) == 0; + var pointSegment = isOnSegment ? pointLine : new Vector2(aX + (rS * (bX - aX)), aY + (rS * (bY - aY))); + + return new ProjectionInfo(isOnSegment, pointSegment, pointLine); + } + + public static float RadianToDegree(double angle) => (float)(angle * (180.0 / PI)); + + public static Vector2 RotateAroundPoint(this Vector2 rotated, Vector2 around, float angle) + { + var sin = Sin(angle); + var cos = Cos(angle); + + var x = (cos * (rotated.X - around.X)) - (sin * (rotated.Y - around.Y)) + around.X; + var y = (sin * (rotated.X - around.X)) + (cos * (rotated.Y - around.Y)) + around.Y; + + return new Vector2((float)x, (float)y); + } + + public static Vector2 Rotated(this Vector2 v, float angle) + { + var c = Cos(angle); + var s = Sin(angle); + + return new Vector2((float)((v.X * c) - (v.Y * s)), (float)((v.Y * c) + (v.X * s))); + } + + public static Polygon RotatePolygon(this Polygon polygon, Vector2 around, float angle) + { + var p = new Polygon(); + + foreach (var polygonePoint in polygon.Points.Select(poinit => poinit.RotateAroundPoint(around, angle))) + { + p.Add(polygonePoint); + } + + return p; + } + + public static Polygon RotatePolygon(this Polygon polygon, Vector2 around, Vector2 direction) + { + var deltaX = around.X - direction.X; + var deltaY = around.Y - direction.Y; + var angle = (float)Atan2(deltaY, deltaX); + return RotatePolygon(polygon, around, angle - DegreeToRadian(90)); + } + + public static float ServerDistance(this T unit, T1 unit2, bool squared = false) where T : Obj_AI_Base + where T1 : + Obj_AI_Base + { + return unit?.ServerPosition.Distance(unit2?.ServerPosition ?? default(Vector3), squared) ?? 0f; + } + + public static Vector3 SetZ(this Vector3 v, float? value = null) + { + v.Z = value ?? Game.CursorPos.Z; + return v; + } + + public static Vector2 Shorten(this Vector2 v, Vector2 to, float distance) + => v - (distance * (to - v).Normalized()); + + public static Vector3 Shorten(this Vector3 v, Vector3 to, float distance) + => v - (distance * (to - v).Normalized()); + + public static Vector3 Shorten(this Vector3 v, Vector2 to, float distance) => v.Shorten(to.To3D(), distance); + + public static Vector3 Shorten(this Vector2 v, Vector3 to, float distance) => v.To3D().Shorten(to, distance); + + public static Vector3 SwitchYZ(this Vector3 v) => new Vector3(v.X, v.Z, v.Y); + + public static Vector2 To2D(this Vector3 v) => new Vector2(v.X, v.Y); + + public static List To2D(this List path) => path.Select(p => p.To2D()).ToList(); + + public static Vector3 To3D(this Vector2 v) => new Vector3(v.X, v.Y, ObjectManager.Player.ServerPosition.Z); + + public static Vector3 To3D(this Vector2 v, float z) => new Vector3(v.X, v.Y, z); + + public static Vector3 To3D2(this Vector2 v) => new Vector3(v.X, v.Y, NavMesh.GetHeightForPosition(v.X, v.Y)); + + public static Polygon ToPolygon(this List v) + { + var polygon = new Polygon(); + foreach (var point in v) + { + polygon.Add(new Vector2(point.X, point.Y)); + } + + return polygon; + } + + public static List ToPolygons(this List> v) + { + return v.Select(path => path.ToPolygon()).ToList(); + } + + public static object[] VectorMovementCollision( + Vector2 startPoint1, + Vector2 endPoint1, + float v1, + Vector2 startPoint2, + float v2, + float delay = 0f) + { + float sP1X = startPoint1.X, + sP1Y = startPoint1.Y, + eP1X = endPoint1.X, + eP1Y = endPoint1.Y, + sP2X = startPoint2.X, + sP2Y = startPoint2.Y; + + float d = eP1X - sP1X, e = eP1Y - sP1Y; + float dist = (float)Sqrt((d * d) + (e * e)), t1 = float.NaN; + float s = Abs(dist) > float.Epsilon ? v1 * d / dist : 0, + k = (Abs(dist) > float.Epsilon) ? v1 * e / dist : 0f; + + float r = sP2X - sP1X, j = sP2Y - sP1Y; + var c = (r * r) + (j * j); + + if (dist > 0f) + { + if (Abs(v1 - float.MaxValue) < float.Epsilon) + { + var t = dist / v1; + t1 = v2 * t >= 0f ? t : float.NaN; + } + else if (Abs(v2 - float.MaxValue) < float.Epsilon) + { + t1 = 0f; + } + else + { + float a = (s * s) + (k * k) - (v2 * v2), b = (-r * s) - (j * k); + + if (Abs(a) < float.Epsilon) + { + if (Abs(b) < float.Epsilon) + { + t1 = (Abs(c) < float.Epsilon) ? 0f : float.NaN; + } + else + { + var t = -c / (2 * b); + t1 = (v2 * t >= 0f) ? t : float.NaN; + } + } + else + { + var sqr = (b * b) - (a * c); + if (sqr >= 0) + { + var nom = (float)Sqrt(sqr); + var t = (-nom - b) / a; + t1 = v2 * t >= 0f ? t : float.NaN; + t = (nom - b) / a; + var t2 = (v2 * t >= 0f) ? t : float.NaN; + + if (!float.IsNaN(t2) && !float.IsNaN(t1)) + { + if (t1 >= delay && t2 >= delay) + { + t1 = Min(t1, t2); + } + else if (t2 >= delay) + { + t1 = t2; + } + } + } + } + } + } + else if (Abs(dist) < float.Epsilon) + { + t1 = 0f; + } + + return new object[] + { t1, (!float.IsNaN(t1)) ? new Vector2(sP1X + (s * t1), sP1Y + (k * t1)) : default(Vector2) }; + } + + #endregion + + #region Methods + + private static float GetRange(float range, bool squared) => squared ? range * range : range; + + #endregion + } +} \ No newline at end of file diff --git a/source/Geometry/IntersectionResult.cs b/source/Geometry/IntersectionResult.cs new file mode 100644 index 00000000..e512db8a --- /dev/null +++ b/source/Geometry/IntersectionResult.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// Intersection Result. + /// + public struct IntersectionResult + { + #region Fields + + /// + /// A value indicating whether the result intersects. + /// + public bool Intersects; + + /// + /// The point. + /// + public Vector2 Point; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the struct. + /// + /// + /// A value indicating whether the result intersects. + /// + /// + /// The point. + /// + public IntersectionResult(bool intersects = false, Vector2 point = default(Vector2)) + { + this.Intersects = intersects; + this.Point = point; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Geometry/Line.cs b/source/Geometry/Line.cs new file mode 100644 index 00000000..bb6839b5 --- /dev/null +++ b/source/Geometry/Line.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// The polygon. + /// + public partial class Polygon + { + /// + /// Line Arc. + /// + public class Line : Polygon + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The start. + /// + /// + /// The end. + /// + /// + /// The length. + /// + public Line(Vector3 start, Vector3 end, float length = -1) + : this(start.To2D(), end.To2D(), length) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The start. + /// + /// + /// The end. + /// + /// + /// The length. + /// + public Line(Vector2 start, Vector2 end, float length = -1) + { + this.LineStart = start; + this.LineEnd = end; + + if (length > 0) + { + this.Length = length; + } + + this.UpdatePolygon(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the length of the line. + /// + public float Length + { + get + { + return this.LineStart.Distance(this.LineEnd); + } + + set + { + this.LineEnd = ((this.LineEnd - this.LineStart).Normalized() * value) + this.LineStart; + } + } + + /// + /// Gets or sets the line ending. + /// + public Vector2 LineEnd { get; set; } + + /// + /// Gets or sets the line start. + /// + public Vector2 LineStart { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Updates the polygon. + /// + public void UpdatePolygon() + { + this.Points.Clear(); + this.Points.AddRange(new[] { this.LineStart, this.LineEnd }); + } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Geometry/MecCircle.cs b/source/Geometry/MecCircle.cs new file mode 100644 index 00000000..a73e9a2e --- /dev/null +++ b/source/Geometry/MecCircle.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Provides methods for finding the minimum enclosing circles. + /// + public static partial class MEC + { + /// + /// The ConvexHull Circle. + /// + public struct MecCircle + { + #region Fields + + /// + /// The center of the circle. + /// + public Vector2 Center; + + /// + /// The radius of the circle. + /// + public float Radius; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the struct. + /// + /// + /// The center. + /// + /// + /// The radius. + /// + public MecCircle(Vector2 center, float radius) + { + this.Center = center; + this.Radius = radius; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Geometry/MinMaxCornersInfo.cs b/source/Geometry/MinMaxCornersInfo.cs new file mode 100644 index 00000000..d74407fd --- /dev/null +++ b/source/Geometry/MinMaxCornersInfo.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Provides methods for finding the minimum enclosing circles. + /// + public static partial class MEC + { + /// + /// The min max corners info. + /// + public struct MinMaxCornersInfo + { + #region Fields + + /// + /// The lower left component. + /// + public Vector2 LowerLeft; + + /// + /// The lower right component. + /// + public Vector2 LowerRight; + + /// + /// The upper left component. + /// + public Vector2 UpperLeft; + + /// + /// The upper right component. + /// + public Vector2 UpperRight; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the struct. + /// + /// + /// The upper left component. + /// + /// + /// The upper right component. + /// + /// + /// The lower left component. + /// + /// + /// The lower right component. + /// + public MinMaxCornersInfo(Vector2 upperLeft, Vector2 upperRight, Vector2 lowerLeft, Vector2 lowerRight) + { + this.UpperLeft = upperLeft; + this.UpperRight = upperRight; + this.LowerLeft = lowerLeft; + this.LowerRight = lowerRight; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Geometry/Polygon.cs b/source/Geometry/Polygon.cs new file mode 100644 index 00000000..4db93af0 --- /dev/null +++ b/source/Geometry/Polygon.cs @@ -0,0 +1,156 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.Linq; + + using ClipperLib; + + using SharpDX; + + using Color = System.Drawing.Color; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// The polygon. + /// + public partial class Polygon + { + #region Public Properties + + /// + /// Gets the polygon points. + /// + public List Points { get; } = new List(); + + #endregion + + #region Public Methods and Operators + + /// + /// Adds a point. + /// + /// + /// The point. + /// + public void Add(Vector2 point) => this.Points.Add(point); + + /// + /// Adds a point. + /// + /// + /// The point. + /// + public void Add(Vector3 point) => this.Points.Add(point.To2D()); + + /// + /// Adds a point. + /// + /// + /// The game object. + /// + public void Add(GameObject gameObject) => this.Points.Add(gameObject.Position.To2D()); + + /// + /// Adds another polygon points. + /// + /// + /// The polygon. + /// + public void Add(Polygon polygon) + { + foreach (var point in polygon.Points) + { + this.Points.Add(point); + } + } + + /// + /// Draws the polygon. + /// + /// + /// The color. + /// + /// + /// The width. + /// + public virtual void Draw(Color color, int width = 1) + { + for (var i = 0; i <= this.Points.Count - 1; i++) + { + var nextIndex = (this.Points.Count - 1 == i) ? 0 : (i + 1); + var from = Drawing.WorldToScreen(this.Points[i].To3D()); + var to = Drawing.WorldToScreen(this.Points[nextIndex].To3D()); + Drawing.DrawLine(from[0], from[1], to[0], to[1], width, color); + } + } + + /// + /// determines if the point is inside the polygon. + /// + /// + /// The point. + /// + /// + /// The . + /// + public bool IsInside(Vector2 point) => !this.IsOutside(point); + + /// + /// determines if the point is inside the polygon. + /// + /// + /// The point. + /// + /// + /// The . + /// + public bool IsInside(Vector3 point) => !this.IsOutside(point.To2D()); + + /// + /// determines if the point is inside the polygon. + /// + /// + /// The game object. + /// + /// + /// The . + /// + public bool IsInside(GameObject gameObject) => !this.IsOutside(gameObject.Position.To2D()); + + /// + /// determines if the point is outside the polygon. + /// + /// + /// The point. + /// + /// + /// The . + /// + public bool IsOutside(Vector2 point) + => Clipper.PointInPolygon(new IntPoint(point.X, point.Y), this.ToClipperPath()) != 1; + + /// + /// Converts the points into a clipper path. + /// + /// + /// The . + /// + public List ToClipperPath() + { + var result = new List(this.Points.Count); + result.AddRange(this.Points.Select(p => new IntPoint(p.X, p.Y))); + return result; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Geometry/ProjectionInfo.cs b/source/Geometry/ProjectionInfo.cs new file mode 100644 index 00000000..1ce00c82 --- /dev/null +++ b/source/Geometry/ProjectionInfo.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// Intersection Result. + /// + public struct ProjectionInfo + { + #region Fields + + /// + /// A value indicating whether the point is on segment. + /// + public bool IsOnSegment; + + /// + /// The lint point. + /// + public Vector2 LinePoint; + + /// + /// The segment point. + /// + public Vector2 SegmentPoint; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the struct. + /// + /// + /// A value indicating whether the point is on segment. + /// + /// + /// The segment point. + /// + /// + /// The line point. + /// + public ProjectionInfo(bool isOnSegment, Vector2 segmentPoint, Vector2 linePoint) + { + this.IsOnSegment = isOnSegment; + this.SegmentPoint = segmentPoint; + this.LinePoint = linePoint; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Geometry/Rectangle.cs b/source/Geometry/Rectangle.cs new file mode 100644 index 00000000..95e88def --- /dev/null +++ b/source/Geometry/Rectangle.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// The polygon. + /// + public partial class Polygon + { + /// + /// Rectangle Polygon. + /// + public class Rectangle : Polygon + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The starting position. + /// + /// + /// The ending position. + /// + /// + /// The width. + /// + public Rectangle(Vector3 start, Vector3 end, float width) + : this(start.To2D(), end.To2D(), width) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The starting position. + /// + /// + /// The ending position. + /// + /// + /// The width. + /// + public Rectangle(Vector2 start, Vector2 end, float width) + { + this.Start = start; + this.End = end; + this.Width = width; + this.UpdatePolygon(); + } + + #endregion + + #region Public Properties + + /// + /// Gets the direction. + /// + public Vector2 Direction => (this.End - this.Start).Normalized(); + + /// + /// Gets or sets the ending position. + /// + public Vector2 End { get; set; } + + /// + /// Gets the direction perpendicular. + /// + public Vector2 Perpendicular => this.Direction.Perpendicular(); + + /// + /// Gets or sets the starting position. + /// + public Vector2 Start { get; set; } + + /// + /// Gets or sets the width. + /// + public float Width { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Updates the polygon. + /// + /// + /// The width offset. + /// + /// + /// The width to override with. + /// + public void UpdatePolygon(int offset = 0, float overrideWidth = -1) + { + this.Points.Clear(); + + var startF = ((overrideWidth > 0 ? overrideWidth : this.Width + offset) * this.Perpendicular) + - (offset * this.Direction); + var endF = ((overrideWidth > 0 ? overrideWidth : this.Width + offset) * this.Perpendicular) + + (offset * this.Direction); + + this.Points.AddRange( + new[] { this.Start + startF, this.Start - startF, this.End - endF, this.End + endF }); + } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Geometry/Ring.cs b/source/Geometry/Ring.cs new file mode 100644 index 00000000..54debf43 --- /dev/null +++ b/source/Geometry/Ring.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// The polygon. + /// + public partial class Polygon + { + /// + /// Ring Polygon. + /// + public class Ring : Polygon + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The center. + /// + /// + /// The inner radius. + /// + /// + /// The outer radius. + /// + /// + /// The quality. + /// + public Ring(Vector3 center, float innerRadius, float outerRadius, int quality = 20) + : this(center.To2D(), innerRadius, outerRadius, quality) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The center. + /// + /// + /// The inner radius. + /// + /// + /// The outer radius. + /// + /// + /// The quality. + /// + public Ring(Vector2 center, float innerRadius, float outerRadius, int quality = 20) + { + this.Center = center; + this.InnerRadius = innerRadius; + this.OuterRadius = outerRadius; + this.Quality = quality; + this.UpdatePolygon(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the center position. + /// + public Vector2 Center { get; set; } + + /// + /// Gets or sets the inner radius. + /// + public float InnerRadius { get; set; } + + /// + /// Gets or sets the outer radius. + /// + public float OuterRadius { get; set; } + + /// + /// Gets or sets the quality. + /// + public int Quality { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Updates the polygon. + /// + /// + /// The radius offset. + /// + public void UpdatePolygon(int offset = 0) + { + this.Points.Clear(); + + var outRadius = (offset + this.InnerRadius + this.OuterRadius) + / (float)Math.Cos(2 * Math.PI / this.Quality); + var innerRadius = this.InnerRadius - this.OuterRadius - offset; + for (var i = 0; i <= this.Quality; i++) + { + var angle = i * 2 * Math.PI / this.Quality; + var point = new Vector2( + this.Center.X - (outRadius * (float)Math.Cos(angle)), + this.Center.Y - (outRadius * (float)Math.Sin(angle))); + this.Points.Add(point); + } + + for (var i = 0; i <= this.Quality; i++) + { + var angle = i * 2 * Math.PI / this.Quality; + var point = new Vector2( + this.Center.X + (innerRadius * (float)Math.Cos(angle)), + this.Center.Y - (innerRadius * (float)Math.Sin(angle))); + this.Points.Add(point); + } + } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Geometry/Sector.cs b/source/Geometry/Sector.cs new file mode 100644 index 00000000..ffd8fd2d --- /dev/null +++ b/source/Geometry/Sector.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// Geometry class. + /// + public partial class Geometry + { + /// + /// The polygon. + /// + public partial class Polygon + { + /// + /// Sector Polygon. + /// + public class Sector : Polygon + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The center. + /// + /// + /// The direction. + /// + /// + /// The angle. + /// + /// + /// The radius. + /// + /// + /// The quality. + /// + public Sector(Vector3 center, Vector3 direction, float angle, float radius, int quality = 20) + : this(center.To2D(), direction.To2D(), angle, radius, quality) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The center. + /// + /// + /// The direction. + /// + /// + /// The angle. + /// + /// + /// The radius. + /// + /// + /// The quality. + /// + public Sector(Vector2 center, Vector2 direction, float angle, float radius, int quality = 20) + { + this.Center = center; + this.Direction = direction; + this.Angle = angle; + this.Radius = radius; + this.Quality = quality; + this.UpdatePolygon(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the angle. + /// + public float Angle { get; set; } + + /// + /// Gets or sets the center. + /// + public Vector2 Center { get; set; } + + /// + /// Gets or sets the direction. + /// + public Vector2 Direction { get; set; } + + /// + /// Gets or sets the quality. + /// + public int Quality { get; set; } + + /// + /// Gets or sets the radius. + /// + public float Radius { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Rotates the line from the point by a specific degree(or radian). + /// + /// + /// The first point. + /// + /// + /// The second point. + /// + /// + /// The value. + /// + /// + /// A value indicating whether the angle value is in degrees or radians. + /// + /// + /// The . + /// + public Vector2 RotateLineFromPoint(Vector2 point1, Vector2 point2, float value, bool radian = true) + { + var angle = !radian ? value * Math.PI / 180 : value; + var line = Vector2.Subtract(point2, point1); + + var newline = new Vector2 + { + X = (float)((line.X * Math.Cos(angle)) - (line.Y * Math.Sin(angle))), + Y = (float)((line.X * Math.Sin(angle)) + (line.Y * Math.Cos(angle))) + }; + + return Vector2.Add(newline, point1); + } + + /// + /// Updates the polygon. + /// + /// + /// The radius offset. + /// + public void UpdatePolygon(int offset = 0) + { + this.Points.Clear(); + this.Points.Add(this.Center); + + var radius = (this.Radius + offset) / (float)Math.Cos(2 * Math.PI / this.Quality); + var side = this.Direction.Rotated(-this.Angle * 0.5f); + + for (var i = 0; i <= this.Quality; i++) + { + var cDirection = side.Rotated(i * this.Angle / this.Quality).Normalized(); + this.Points.Add( + new Vector2( + this.Center.X + (radius * cDirection.X), + this.Center.Y + (radius * cDirection.Y))); + } + } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Instances.cs b/source/Instances.cs new file mode 100644 index 00000000..c0545497 --- /dev/null +++ b/source/Instances.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using LeagueSharp.Common.Configuration; + + /// + /// Provides system instances in a static manner to support older API usage. + /// + public static class Instances + { + #region Public Properties + + /// + /// Gets the anti gapcloser instance. + /// + public static AntiGapcloser AntiGapcloser { get; internal set; } + + /// + /// Gets the damage instance. + /// + public static Damage Damage { get; internal set; } + + /// + /// Gets the dash instance. + /// + public static Dash Dash { get; internal set; } + + /// + /// Gets the game events instance. + /// + public static CustomEvents.Game GameEvents { get; internal set; } + + /// + /// Gets the hero manager instance. + /// + public static HeroManager HeroManager { get; internal set; } + + /// + /// Gets the library manager. + /// + public static Library Library { get; internal set; } + + /// + /// Gets the map instance. + /// + public static Utility.Map Map { get; internal set; } + + /// + /// Gets the menu manager instance. + /// + public static MenuManager MenuManager { get; internal set; } + + /// + /// Gets the minion manager instance. + /// + public static MinionManager MinionManager { get; internal set; } + + /// + /// Gets the unit events. + /// + public static CustomEvents.Unit UnitEvents { get; internal set; } + + #endregion + } +} \ No newline at end of file diff --git a/source/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj new file mode 100644 index 00000000..2564c8e8 --- /dev/null +++ b/source/LeagueSharp.Common.csproj @@ -0,0 +1,928 @@ + + + + + Debug + AnyCPU + {BFB66E60-98AB-4178-AB3D-7B9C3EBEC2F7} + Library + Properties + LeagueSharp.Common + LeagueSharp.Common + v4.5 + 512 + true + + + x86 + true + full + false + ..\bin\Debug\ + DEBUG;TRACE + prompt + 4 + ..\bin\Debug\LeagueSharp.Common.XML + true + 1024 + 16777216 + ..\LeagueSharp.Common.ruleset + + + x86 + pdbonly + true + ..\bin\Release\ + TRACE + prompt + 4 + true + 1024 + 16777216 + ..\bin\Release\LeagueSharp.Common.XML + ..\LeagueSharp.Common.ruleset + + + true + + + ..\LeagueSharp.Common.snk + + + + Z:\References\clipper_library.dll + + + Z:\Core\JetBrains.Annotations.dll + + + Z:\References\LeagueSharp.dll + + + Z:\References\LeagueSharp.Data.dll + + + Z:\System\LeagueSharp.Sandbox.dll + + + Z:\Core\log4net.dll + + + Z:\Core\Newtonsoft.Json.dll + + + Z:\Core\PlaySharp.Toolkit.dll + + + Z:\References\SharpDX.dll + + + Z:\References\SharpDX.Direct3D9.dll + + + Z:\References\SharpDX.Menu.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/LeagueSharp.Common.csproj.DotSettings b/source/LeagueSharp.Common.csproj.DotSettings new file mode 100644 index 00000000..c6ea5dac --- /dev/null +++ b/source/LeagueSharp.Common.csproj.DotSettings @@ -0,0 +1,159 @@ + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/source/Library.cs b/source/Library.cs new file mode 100644 index 00000000..7d0d4578 --- /dev/null +++ b/source/Library.cs @@ -0,0 +1,126 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.ComponentModel.Composition; + using System.ComponentModel.Composition.Hosting; + using System.Globalization; + using System.Security.Permissions; + using System.Text; + using System.Threading; + + using LeagueSharp.Common.Configuration; + + using PlaySharp.Toolkit.AppDomain.Loader; + + /// + /// The library manager. + /// + public class Library : ILibrary + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public Library() + { + Instances.Library = this; + } + + #endregion + + #region Public Methods and Operators + + /// + public void Configure(CompositionContainer container) + { + ExpandConsole(); + CreateInstances(container); + + AppDomain.CurrentDomain.ProcessExit += OnProcessExit; + Instances.Damage.SortSpells(); + } + + /// + public void Unload() + { + Instances.MenuManager.SaveAll(); + Render.Terminate(); + Render.Circle.Dispose(this, EventArgs.Empty); + } + + #endregion + + #region Methods + + /// + /// Creates static instances to support old API. + /// + /// + /// The composition container. + /// + private static void CreateInstances(CompositionContainer container) + { + Instances.AntiGapcloser = Export(container, new AntiGapcloser()); + Instances.Damage = Export(container, new Damage()); + Instances.Dash = Export(container, new Dash()); + Instances.GameEvents = Export(container, new CustomEvents.Game()); + Instances.HeroManager = Export(container, new HeroManager()); + Instances.Map = Export(container, new Utility.Map()); + Instances.MinionManager = Export(container, new MinionManager()); + Instances.UnitEvents = Export(container, new CustomEvents.Unit()); + Instances.MenuManager = Export(container, new MenuManager()); + } + + /// + /// Expands the console on debug, requires permissions. + /// + [PermissionSet(SecurityAction.Assert, Unrestricted = true)] + private static void ExpandConsole() + { + CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; + CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; + Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; + + Console.OutputEncoding = Encoding.Default; + Console.WindowWidth = (int)(Console.LargestWindowWidth / 1.5); + Console.BufferWidth = (int)(Console.LargestWindowWidth / 1.5); + Console.WindowHeight = Console.LargestWindowHeight / 2; + } + + /// + /// Composes exported value macro. + /// + /// + /// The value type. + /// + /// + /// The container. + /// + /// + /// The value. + /// + /// + /// The value composed. + /// + private static T Export(CompositionContainer container, T value) + { + container.SatisfyImportsOnce(value); + container.ComposeExportedValue(value); + return value; + } + + [PermissionSet(SecurityAction.Assert, Unrestricted = true)] + private static void OnProcessExit(object sender, EventArgs eventArgs) + { + Instances.MenuManager.SaveAll(); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Components/Circle.cs b/source/Menu/Components/Circle.cs new file mode 100644 index 00000000..c4be4415 --- /dev/null +++ b/source/Menu/Components/Circle.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Drawing; + using System.Runtime.Serialization; + + using SharpDX.Menu; + + /// + /// The circle color spectrum (picker), with the toggle feature. + /// + [DataContract] + public class Circle : IUpdateableValue + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// Indicates whether the circle is active. + /// + /// + /// The color. + /// + /// + /// The radius. + /// + public Circle(bool active, Color color, float radius = 100) + { + this.Active = active; + this.Color = color; + this.Radius = radius; + } + + /// + /// Initializes a new instance of the class. + /// + public Circle() + : this(false, default(Color)) + { + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether the circle is enabled. + /// + [DataMember] + public bool Active { get; set; } + + /// + /// Gets or sets the color. + /// + [DataMember] + public Color Color { get; set; } + + /// + /// Gets or sets the radius. + /// + public float Radius { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + public void Update(Circle newValue) + { + this.Active = newValue.Active; + this.Color = newValue.Color; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Components/KeyBind.cs b/source/Menu/Components/KeyBind.cs new file mode 100644 index 00000000..9280c593 --- /dev/null +++ b/source/Menu/Components/KeyBind.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Runtime.Serialization; + + using SharpDX.Menu; + + /// + /// The menu keybind. + /// + [DataContract] + public class KeyBind : IUpdateableValue + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The key. + /// + /// + /// The type. + /// + /// + /// The default value. + /// + public KeyBind(uint key, KeyBindType type, bool defaultValue = false) + { + this.Key = key; + this.SecondaryKey = 0; + this.Type = type; + this.Active = defaultValue; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The key. + /// + /// + /// The secondary key. + /// + /// + /// The type. + /// + /// + /// The default value. + /// + public KeyBind(uint key, uint secondaryKey, KeyBindType type, bool defaultValue = false) + { + this.Key = key; + this.SecondaryKey = secondaryKey; + this.Type = type; + this.Active = defaultValue; + } + + /// + /// Initializes a new instance of the class. + /// + public KeyBind() + : this(0, KeyBindType.Press) + { + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether the keybind is active. + /// + public bool Active { get; set; } + + /// + /// Gets or sets the key. + /// + [DataMember] + public uint Key { get; set; } + + /// + /// Gets or sets the secondary key. + /// + [DataMember] + public uint SecondaryKey { get; set; } + + /// + /// Gets or sets the key bind type. + /// + public KeyBindType Type { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + public void Update(KeyBind newValue) + { + this.Key = newValue.Key; + this.SecondaryKey = newValue.SecondaryKey; + } + + #endregion + } +} \ No newline at end of file diff --git a/Menu/KeyBindType.cs b/source/Menu/Components/KeyBindType.cs similarity index 68% rename from Menu/KeyBindType.cs rename to source/Menu/Components/KeyBindType.cs index 029f2faf..cb2c7fb4 100644 --- a/Menu/KeyBindType.cs +++ b/source/Menu/Components/KeyBindType.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { /// /// The KeyBind enum, representing the type of the keybind. diff --git a/source/Menu/Components/KeybindSetStage.cs b/source/Menu/Components/KeybindSetStage.cs new file mode 100644 index 00000000..227808b9 --- /dev/null +++ b/source/Menu/Components/KeybindSetStage.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The keybind set stage. + /// + internal enum KeybindSetStage + { + /// + /// The first keybind. + /// + Keybind1, + + /// + /// The second keybind. + /// + Keybind2, + + /// + /// Not settings a keybind. + /// + NotSetting + } +} \ No newline at end of file diff --git a/Menu/Slider.cs b/source/Menu/Components/Slider.cs similarity index 66% rename from Menu/Slider.cs rename to source/Menu/Components/Slider.cs index 44bb84e1..95e509ea 100644 --- a/Menu/Slider.cs +++ b/source/Menu/Components/Slider.cs @@ -1,25 +1,22 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; + using System.Runtime.Serialization; + + using SharpDX.Menu; /// /// The menu slider. /// - [Serializable] - public struct Slider + [DataContract] + public class Slider : IUpdateableValue { #region Fields - /// - /// The maximum value. - /// - public int MaxValue; - - /// - /// The minimum value. - /// - public int MinValue; - /// /// The value. /// @@ -30,7 +27,7 @@ public struct Slider #region Constructors and Destructors /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the class. /// /// /// The value. @@ -52,9 +49,20 @@ public Slider(int value = 0, int minValue = 0, int maxValue = 100) #region Public Properties + /// + /// Gets or sets the maximum value. + /// + public int MaxValue { get; set; } + + /// + /// Gets or sets the minimum value. + /// + public int MinValue { get; set; } + /// /// Gets or sets the value. /// + [DataMember] public int Value { get @@ -69,5 +77,15 @@ public int Value } #endregion + + #region Public Methods and Operators + + /// + public void Update(Slider newValue) + { + this.Value = newValue.Value; + } + + #endregion } } \ No newline at end of file diff --git a/source/Menu/Components/SliderBool.cs b/source/Menu/Components/SliderBool.cs new file mode 100644 index 00000000..9512230e --- /dev/null +++ b/source/Menu/Components/SliderBool.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Runtime.Serialization; + + using SharpDX.Menu; + + /// + /// The menu slider. + /// + [DataContract] + public class SliderBool : IUpdateableValue + { + #region Fields + + /// + /// The value. + /// + private int value; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The value. + /// + /// + /// The minimum value. + /// + /// + /// The maximum value. + /// + /// + /// A value indicating whether the slider bool is active or not. + /// + public SliderBool(int value = 0, int minValue = 0, int maxValue = 100, bool active = false) + { + this.value = value; + this.MaxValue = Math.Max(maxValue, minValue); + this.MinValue = Math.Min(maxValue, minValue); + this.IsActive = active; + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether the slider bool is active. + /// + [DataMember] + public bool IsActive { get; set; } + + /// + /// Gets or sets the maximum value. + /// + public int MaxValue { get; set; } + + /// + /// Gets or sets the minimum value. + /// + public int MinValue { get; set; } + + /// + /// Gets or sets the value. + /// + [DataMember] + public int Value + { + get + { + return this.value; + } + + set + { + this.value = Math.Min(Math.Max(value, this.MinValue), this.MaxValue); + } + } + + #endregion + + #region Public Methods and Operators + + /// + public void Update(SliderBool newValue) + { + this.Value = newValue.Value; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Components/StringList.cs b/source/Menu/Components/StringList.cs new file mode 100644 index 00000000..c71c9d68 --- /dev/null +++ b/source/Menu/Components/StringList.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Runtime.Serialization; + + using SharpDX.Menu; + + /// + /// The string list component container. + /// + [DataContract] + public class StringList : IUpdateableValue + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The items. + /// + /// + /// The default index. + /// + public StringList(string[] items, int defaultIndex = 0) + { + this.Items = items; + this.SelectedIndex = defaultIndex; + } + + #endregion + + #region Public Properties + + /// + /// Gets the items. + /// + public string[] Items { get; } + + /// + /// Gets or sets the selected index. + /// + [DataMember] + public int SelectedIndex { get; set; } + + /// + /// Gets the selected value. + /// + public string SelectedValue + => + this.SelectedIndex >= 0 && this.SelectedIndex < this.Items.Length + ? this.Items[this.SelectedIndex] + : string.Empty; + + /// + /// Gets the items. + /// + [Obsolete] + public string[] SList => this.Items; + + #endregion + + #region Public Methods and Operators + + /// + public void Update(StringList newValue) + { + this.SelectedIndex = newValue.SelectedIndex; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Configuration/DataAggregator.cs b/source/Menu/Configuration/DataAggregator.cs new file mode 100644 index 00000000..f68d04d8 --- /dev/null +++ b/source/Menu/Configuration/DataAggregator.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Configuration +{ + using System; + using System.ComponentModel.Composition; + + using log4net; + + using PlaySharp.Toolkit.Logging; + + using SharpDX; + using SharpDX.Direct3D9; + using SharpDX.Menu; + + /// + /// The data aggregator for the menu factory. + /// + [Export(typeof(SharpDX.Menu.DataAggregator))] + public class DataAggregator : SharpDX.Menu.DataAggregator + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public DataAggregator() + { + Game.OnUpdate += args => this.OnExternalEvent(ExternalEventType.Update, null); + Game.OnWndProc += + args => + this.OnExternalEvent( + ExternalEventType.WindowProc, + new object[] { args.Msg, args.WParam, args.LParam }); + Drawing.OnDraw += args => this.OnExternalEvent(ExternalEventType.Draw, null); + } + + #endregion + + #region Public Methods and Operators + + /// + public override Vector2 GetCursorPosition() + { + return Cursor.GetCursorPos(); + } + + /// + public override Device GetDevice() + { + return Drawing.Direct3DDevice; + } + + /// + public override int GetEnvironmentTick() + { + return Utils.GameTimeTickCount; + } + + /// + public override ILog GetLogger(Type service) + { + return AssemblyLogs.GetLogger(service); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Configuration/DrawingViewFactory.cs b/source/Menu/Configuration/DrawingViewFactory.cs new file mode 100644 index 00000000..11c87f2a --- /dev/null +++ b/source/Menu/Configuration/DrawingViewFactory.cs @@ -0,0 +1,18 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Configuration +{ + using System.ComponentModel.Composition; + + using SharpDX.Menu; + + /// + /// The drawing view factory. + /// + [Export(typeof(IDrawingViewFactory))] + public class DrawingViewFactory : SharpDX.Menu.DrawingViewFactory + { + } +} \ No newline at end of file diff --git a/source/Menu/Configuration/MenuController.cs b/source/Menu/Configuration/MenuController.cs new file mode 100644 index 00000000..a54f50b1 --- /dev/null +++ b/source/Menu/Configuration/MenuController.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Configuration +{ + using System.ComponentModel.Composition; + + using SharpDX; + using SharpDX.Menu; + + using Hacks = LeagueSharp.Hacks; + + /// + /// The menu controller. + /// + [Export(typeof(IMenuController))] + public class MenuController : IMenuController + { + #region Fields + + private bool isVisible; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MenuController() + { + Game.OnWndProc += this.OnWndProc; + } + + #endregion + + #region Public Properties + + /// + public float ComponentHeight { get; } = 32; + + /// + public float ComponentWidth { get; } = 180; + + /// + public bool IsVisible + { + get + { + return this.isVisible && !Hacks.DisableDrawings; + } + + private set + { + this.isVisible = value; + } + } + + /// + public Vector2 Position { get; } = new Vector2(10, 10); + + #endregion + + #region Methods + + private void OnWndProc(WndEventArgs args) + { + if ((args.Msg == (uint)WindowsMessages.WM_KEYUP || args.Msg == (uint)WindowsMessages.WM_KEYDOWN) + && args.WParam == Config.ShowMenuPressKey) + { + this.IsVisible = args.Msg == (uint)WindowsMessages.WM_KEYDOWN; + } + + if (args.Msg == (uint)WindowsMessages.WM_KEYUP && args.WParam == Config.ShowMenuToggleKey) + { + this.IsVisible = !this.IsVisible; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Configuration/MenuManager.cs b/source/Menu/Configuration/MenuManager.cs new file mode 100644 index 00000000..b099b4e8 --- /dev/null +++ b/source/Menu/Configuration/MenuManager.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Configuration +{ + using System.Collections.Generic; + using System.ComponentModel.Composition; + + using SharpDX.Menu; + + using Menu = LeagueSharp.Common.Menu; + + /// + /// The menu manager, provides menu configuration for the new menu. + /// + public class MenuManager : IPartImportsSatisfiedNotification + { + #region Public Properties + + /// + /// Gets the menu instance. + /// + public static Menu InstanceMenu => Instances.MenuManager.Menu; + + /// + /// Gets the root menu. + /// + public Menu Menu { get; private set; } + + /// + /// Gets the factory. + /// + [Import(typeof(MenuFactory))] + public MenuFactory MenuFactory { get; private set; } + + #endregion + + #region Properties + + private static IList SatisfyMenuCollection { get; } = new List(); + + #endregion + + #region Public Methods and Operators + + /// + public void OnImportsSatisfied() + { + Instances.MenuManager = this; + + this.Menu = new Menu("LeagueSharp.Common", "LeagueSharp.Common", true); + + TargetSelector.Initialize(this.Menu); + Prediction.Initialize(this.Menu); + Hacks.Initialize(this.Menu); + + foreach (var menu in SatisfyMenuCollection) + { + this.MenuFactory.Add(menu.MenuReference, true); + } + + SatisfyMenuCollection.Clear(); + } + + /// + /// Saves all existing menus. + /// + public void SaveAll() + { + foreach (var menu in this.MenuFactory.MenuCollection.Values) + { + menu.SaveComponents(); + } + } + + #endregion + + #region Methods + + /// + /// Adds the menu for satisfaction once the manager is ready. + /// + /// + /// The menu. + /// + internal static void SatisfyMenu(Menu menu) + { + if (!SatisfyMenuCollection.Contains(menu)) + { + SatisfyMenuCollection.Add(menu); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Core/Menu.cs b/source/Menu/Core/Menu.cs new file mode 100644 index 00000000..0364eeae --- /dev/null +++ b/source/Menu/Core/Menu.cs @@ -0,0 +1,294 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Drawing; + using System.Linq; + + using LeagueSharp.Common.Configuration; + + using SharpDX.Menu; + + using Color = SharpDX.Color; + + /// + /// The menu. + /// +#pragma warning disable 612 + public partial class Menu + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The display name. + /// + /// + /// The name. + /// + /// + /// Indicates whether the menu has root attribute. + /// + public Menu(string displayName, string name, bool isRootMenu = false) + { + this.MenuReference = ComponentFactory.CreateMenu(name, displayName); + if (isRootMenu) + { + if (Instances.MenuManager == null) + { + MenuManager.SatisfyMenu(this); + } + else + { + Instances.MenuManager.MenuFactory?.Add(this.MenuReference); + } + } + + this.IsRootMenu = isRootMenu; + } + + /// + /// Finalizes an instance of the class. + /// + ~Menu() + { + Instances.MenuManager?.MenuFactory?.Remove(this.MenuReference); + this.IsRootMenu = false; + } + + #endregion + + #region Public Properties + + /// + /// Gets the menu children. + /// + public List Children { get; } = new List(); + + /// + /// Gets or sets the color. + /// + [Obsolete] + public Color Color { get; set; } + + /// + /// Gets or sets the menu display name. + /// + public string DisplayName + { + get + { + return this.MenuReference.DisplayName; + } + + set + { + this.MenuReference.DisplayName = value; + } + } + + /// + /// Gets or sets a value indicating whether the menu has a root attribute. + /// + [Obsolete] + public bool IsRootMenu { get; set; } + + /// + /// Gets the menu items. + /// + public List Items { get; } = new List(); + + /// + /// Gets or sets the menu name. + /// + public string Name + { + get + { + return this.MenuReference.Name; + } + + set + { + // TODO: Log? + } + } + + /// + /// Gets or sets the menu parent. + /// + public Menu Parent { get; set; } + + /// + /// Gets or sets the menu font style. + /// + [Obsolete] + public FontStyle Style { get; set; } + + #endregion + + #region Properties + + /// + /// Gets the menu reference. + /// + internal SharpDX.Menu.Menu MenuReference { get; } + + #endregion + + #region Public Methods and Operators + + /// + /// Adds a menu item component to the menu. + /// + /// + /// The menu item component. + /// + /// + /// The . + /// + public MenuItem AddItem(MenuItem item) + { + var itemRef = item.MenuItemReference as MenuComponent; + if (itemRef != null) + { + this.MenuReference.Add(itemRef); + } + + this.Items.Add(item); + item.Parent = this; + return item; + } + + /// + /// Adds a subdirectory menu to the menu. + /// + /// + /// The subdirectory menu. + /// + /// + /// The . + /// + public Menu AddSubMenu(Menu subMenu) + { + var itemRef = subMenu.MenuReference as MenuComponent; + if (itemRef != null) + { + this.MenuReference.Add(itemRef); + } + + this.Children.Add(subMenu); + return subMenu; + } + + /// + /// Adds the menu to the main menu. + /// + [Obsolete] + public void AddToMainMenu() + { + } + + /// + /// Gets the menu's item by name. + /// + /// + /// The name. + /// + /// + /// Indicates whether the item is champion unique. + /// + /// + /// The . + /// + public MenuItem Item(string name, bool championUnique = false) + { + if (championUnique) + { + name = ObjectManager.Player.ChampionName + name; + } + + foreach (var item in this.Items.ToArray().Where(item => item.Name == name)) + { + return item; + } + + return + (from subMenu in this.Children.ToArray() where subMenu.Item(name) != null select subMenu.Item(name)) + .FirstOrDefault(); + } + + /// + /// Removes the subdirectory menu from the menu. + /// + /// + /// The subdirectory menu. + /// + public void RemoveMenu(Menu menu) + { + var itemRef = menu.MenuReference as MenuComponent; + if (itemRef != null) + { + this.MenuReference.Remove(itemRef); + } + + this.Children.Remove(menu); + } + + /// + /// Sets the font style. + /// + /// + /// The font style. + /// + /// + /// Color of the font. + /// + /// + /// The . + /// + public Menu SetFontStyle(FontStyle fontStyle = FontStyle.Regular, Color? fontColor = null) + { + this.Style = fontStyle; + + var view = this.MenuReference.View; + if (view != null) + { + view.SetAttribute(typeof(FontStyle).ToString(), fontStyle); + if (fontColor.HasValue) + { + var color = fontColor.Value; + this.Color = color; + + var brush = new SolidBrush(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)); + view.SetAttribute(typeof(Brush).ToString(), brush); + } + } + + return this; + } + + /// + /// Gets the menu's submenu by name. + /// + /// + /// The name. + /// + /// + /// The . + /// + public Menu SubMenu(string name) + { + return this.Children.ToArray().FirstOrDefault(sm => sm.Name == name) + ?? this.AddSubMenu(new Menu(name, name)); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Core/MenuAdapater.cs b/source/Menu/Core/MenuAdapater.cs new file mode 100644 index 00000000..38879fa5 --- /dev/null +++ b/source/Menu/Core/MenuAdapater.cs @@ -0,0 +1,43 @@ +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + + public partial class Menu + { + #region Static Fields + + public static readonly Menu Root = new Menu("Menu Settings", "Menu Settings"); + + public static Dictionary RootMenus = new Dictionary(); + + #endregion + + #region Public Methods and Operators + + public static Menu GetMenu(string assemblyname, string menuname) + { + return null; + } + + public static MenuItem GetValueGlobally( + string assemblyname, + string menuname, + string itemname, + string submenu = null) + { + return null; + } + + public static void Remove(Menu menu) + { + } + + [Obsolete] + public static void SendMessage(uint key, WindowsMessages message, WndEventComposition args) + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Core/MenuItem.cs b/source/Menu/Core/MenuItem.cs new file mode 100644 index 00000000..e82980bd --- /dev/null +++ b/source/Menu/Core/MenuItem.cs @@ -0,0 +1,424 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.ComponentModel; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + using Color = SharpDX.Color; + + /// + /// The menu item. + /// + public class MenuItem + { + #region Fields + + private bool showItem; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The name. + /// + /// + /// The display name. + /// + /// + /// Indicates whether the menu item is champion unique. + /// + public MenuItem(string name, string displayName, bool championUnique = false) + { + if (championUnique) + { + name = ObjectManager.Player.ChampionName + name; + } + + this.MenuItemReference = ComponentFactory.CreateItem(name, displayName); + } + + #endregion + + #region Public Events + + /// + /// The value changed event. + /// + public event EventHandler ValueChanged; + + #endregion + + #region Public Properties + + /// + /// Gets or sets the display name. + /// + public string DisplayName + { + get + { + return this.MenuItemReference.DisplayName; + } + + set + { + this.MenuItemReference.DisplayName = value; + } + } + + /// + /// Gets or sets the font color. + /// + public ColorBGRA FontColor { get; set; } + + /// + /// Gets or sets the font style. + /// + public FontStyle FontStyle { get; set; } + + /// + /// Gets or sets the menu font size. + /// + [Obsolete] + public int MenuFontSize { get; set; } + + /// + /// Gets the name. + /// + public string Name => this.MenuItemReference.Name; + + /// + /// Gets or sets the parent. + /// + public Menu Parent { get; set; } + + /// + /// Gets or sets a value indicating whether to show the item. + /// + public bool ShowItem + { + get + { + return this.showItem; + } + + set + { + this.Show(value); + } + } + + /// + /// Gets or sets the tag. + /// + public int Tag { get; set; } + + /// + /// Gets or sets the tooltip. + /// + [Obsolete] + public string Tooltip { get; set; } + + /// + /// Gets or sets the tooltip color. + /// + [Obsolete] + public Color TooltipColor { get; set; } + + /// + /// Gets the tooltip duration. + /// + [Obsolete] + public int TooltipDuration => 0; + + /// + /// Gets or sets a value indicating whether the value was set. + /// + [Obsolete] + public bool ValueSet { get; set; } + + #endregion + + #region Properties + + /// + /// Gets the menu item reference. + /// + internal IMenuItem MenuItemReference { get; private set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Sets the menu item to not save. + /// + /// + /// The item instance. + /// + public MenuItem DontSave() + { + this.MenuItemReference.IsSaveable = false; + return this; + } + + /// + /// Gets the item value. + /// + /// + /// The item type. + /// + /// + /// The value. + /// + public T GetValue() + { + return ((IMenuItem)this.MenuItemReference).Value; + } + + /// + /// Gets a value indicating whether the item is active. + /// + /// + /// Value indicating whether the item is active. + /// + public bool IsActive() + { + var type = this.MenuItemReference.ValueType; + if (type == typeof(bool)) + { + return this.GetValue(); + } + + if (type == typeof(Circle)) + { + return this.GetValue().Active; + } + + if (type == typeof(KeyBind)) + { + return this.GetValue().Active; + } + + if (type == typeof(SliderBool)) + { + return this.GetValue().IsActive; + } + + return false; + } + + /// + /// Sets the font style. + /// + /// + /// The font style. + /// + /// + /// The font color. + /// + /// + /// The item instance. + /// + public MenuItem SetFontStyle(FontStyle fontStyle = FontStyle.Regular, Color? fontColor = null) + { + this.FontStyle = fontStyle; + + var view = this.MenuItemReference.View; + if (view != null) + { + view.SetAttribute(typeof(FontStyle).ToString(), fontStyle); + if (fontColor.HasValue) + { + var color = fontColor.Value; + this.FontColor = color; + + var brush = new SolidBrush(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)); + view.SetAttribute(typeof(Brush).ToString(), brush); + } + } + + return this; + } + + /// + /// Sets the menu item to be shared. + /// + /// + /// The item instance. + /// + public MenuItem SetShared() + { + this.MenuItemReference.IsShared = true; + return this; + } + + /// + /// Sets the menu item tag. + /// + /// + /// The tag. + /// + /// + /// The item instance. + /// + public MenuItem SetTag(int tag = 0) + { + this.Tag = tag; + return this; + } + + /// + /// Sets the tooltip. + /// + /// + /// The tooltip string. + /// + /// + /// The tooltip color. + /// + /// + /// The menu instance. + /// + [Obsolete] + public MenuItem SetTooltip(string tooltip, Color? tooltipColor = null) + { + return this; + } + + /// + /// Sets the value. + /// + /// + /// The value type. + /// + /// + /// The new value. + /// + /// + /// The item instance. + /// + public MenuItem SetValue(T newValue) + { + if (newValue.GetType() == this.MenuItemReference.ValueType) + { + var oldValue = this.MenuItemReference.GetValue(); + this.MenuItemReference.SetValue(newValue); + + this.ValueChanged?.Invoke(this, new OnValueChangeEventArgs(oldValue, newValue)); + } + else + { + var oldItem = this.MenuItemReference; + var newItem = ComponentFactory.CreateItem(this.Name, this.DisplayName, newValue); + + newItem.IsShared = oldItem.IsShared; + newItem.IsSaveable = oldItem.IsSaveable; + this.MenuItemReference = newItem; + + oldItem.PropertyChanged -= this.OnPropertyChanged; + newItem.PropertyChanged += this.OnPropertyChanged; + + if (oldItem.Parent != null) + { + oldItem.Parent[oldItem.Name] = newItem; + } + + this.ValueChanged?.Invoke(this, new OnValueChangeEventArgs(null, newValue)); + } + + return this; + } + + /// + /// Shows the item. + /// + /// + /// Indicates whether to show the item. + /// + /// + /// The item instance. + /// + public MenuItem Show(bool flag = true) + { + this.MenuItemReference.IsVisible = flag; + this.showItem = flag; + return this; + } + + /// + /// Shows the tooltip. + /// + /// + /// A value indicating whether to hide or show the tooltip. + /// + [Obsolete] + public void ShowTooltip(bool hide = false) + { + } + + /// + /// Shows the tooltip notification. + /// + [Obsolete] + public void ShowTooltipNotification() + { + } + + /// + /// Gets the item value, safely. + /// + /// + /// The item type. + /// + /// + /// The value. + /// + public T TryGetValue() + { + var item = this.MenuItemReference as IMenuItem; + return item != null ? item.Value : default(T); + } + + /// + /// Gets a value indicating if the value is of item type. + /// + /// + /// The item type. + /// + /// + /// The indicating whether the value is of type. + /// + public bool TypeOf() + { + return this.MenuItemReference is IMenuItem; + } + + #endregion + + #region Methods + + private void OnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) + { + if (propertyChangedEventArgs.PropertyName.Equals("Value", StringComparison.CurrentCultureIgnoreCase)) + { + this.ValueChanged?.Invoke( + this, + new OnValueChangeEventArgs(null, this.MenuItemReference.GetValue())); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Menu/MenuSettings.cs b/source/Menu/Core/MenuSettings.cs similarity index 53% rename from Menu/MenuSettings.cs rename to source/Menu/Core/MenuSettings.cs index 1318c636..1b28f3ec 100644 --- a/Menu/MenuSettings.cs +++ b/source/Menu/Core/MenuSettings.cs @@ -20,24 +20,6 @@ internal static class MenuSettings /// public static Vector2 BasePosition = new Vector2(10, 10); - /// - /// Indicates whether to draw the menu. - /// - private static bool drawMenu; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a static instance of the class. - /// - static MenuSettings() - { - drawMenu = MenuGlobals.DrawMenu; - Game.OnWndProc += args => OnWndProc(new WndEventComposition(args)); - } - #endregion #region Public Properties @@ -89,43 +71,5 @@ public static int MenuItemWidth } #endregion - - #region Properties - - /// - /// Gets or sets the value indicating whether to draw the menu. - /// - internal static bool DrawMenu - { - get - { - return drawMenu; - } - - set - { - MenuGlobals.DrawMenu = drawMenu = value; - } - } - - #endregion - - #region Methods - - private static void OnWndProc(WndEventComposition args) - { - if ((args.Msg == WindowsMessages.WM_KEYUP || args.Msg == WindowsMessages.WM_KEYDOWN) - && args.WParam == Config.ShowMenuPressKey) - { - DrawMenu = args.Msg == WindowsMessages.WM_KEYDOWN; - } - - if (args.Msg == WindowsMessages.WM_KEYUP && args.WParam == Config.ShowMenuToggleKey) - { - DrawMenu = !DrawMenu; - } - } - - #endregion } } \ No newline at end of file diff --git a/source/Menu/Items/CPSlider.cs b/source/Menu/Items/CPSlider.cs new file mode 100644 index 00000000..d4443a1d --- /dev/null +++ b/source/Menu/Items/CPSlider.cs @@ -0,0 +1,91 @@ +namespace LeagueSharp.Common +{ + using System; + + /// + /// The color picker slider. + /// + [Obsolete] + public class CPSlider + { + #region Fields + + /// + /// The height. + /// + public int Height; + + /// + /// Indicates whether the slider is moving. + /// + public bool Moving; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The X. + /// + /// + /// The Y. + /// + /// + /// The Height. + /// + /// + /// The Percent. + /// + public CPSlider(int x, int y, int height, float percent = 1) + { + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the percent. + /// + public float Percent { get; set; } + + /// + /// Gets or sets a value indicating whether the slider is visible. + /// + public bool Visible { get; set; } + + /// + /// Gets or sets the width. + /// + public int Width => 0; + + /// + /// Gets or sets the X. + /// + public int X { get; set; } + + /// + /// Gets or sets the Y. + /// + public int Y { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// The windows event process message event. + /// + /// + /// The arguments. + /// + public void OnWndProc(WndEventComposition args) + { + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/Items/ColorPicker.cs b/source/Menu/Items/ColorPicker.cs new file mode 100644 index 00000000..334e13fb --- /dev/null +++ b/source/Menu/Items/ColorPicker.cs @@ -0,0 +1,139 @@ +namespace LeagueSharp.Common +{ + using System; + using System.Drawing; + + /// + /// The color picker. + /// + [Obsolete] + public static class ColorPicker + { + #region Static Fields + + /// + /// The color picker height. + /// + public static readonly int ColorPickerH = 221; + + /// + /// The color picker width. + /// + public static readonly int ColorPickerW = 234; + + /// + /// The alpha slider. + /// + public static CPSlider AlphaSlider; + + /// + /// The background sprite. + /// + public static Render.Sprite BackgroundSprite; + + /// + /// The luminity bitmap. + /// + public static Bitmap LuminityBitmap; + + /// + /// The luminity sprite. + /// + public static Render.Sprite LuminitySprite; + + /// + /// The luminosity slider. + /// + public static CPSlider LuminositySlider; + + /// + /// The change color event. + /// + public static OnSelectColor OnChangeColor; + + /// + /// The opacity bitmap. + /// + public static Bitmap OpacityBitmap; + + /// + /// The opacity sprite. + /// + public static Render.Sprite OpacitySprite; + + /// + /// The preview rectangle. + /// + public static Render.Rectangle PreviewRectangle; + + #endregion + + #region Delegates + + /// + /// The on select color delegate. + /// + /// + /// The color. + /// + public delegate void OnSelectColor(Color color); + + #endregion + + #region Public Properties + + /// + /// The color picker X-axis. + /// + public static int ColorPickerX => 0; + + /// + /// The color picker Y-axis. + /// + public static int ColorPickerY => 0; + + /// + /// Gets or sets a value indicating whether the color picker is visible. + /// + public static bool Visible { get; set; } + + /// + /// Gets or sets the X-axis position. + /// + public static int X { get; set; } + + /// + /// Gets or sets the Y-axis position. + /// + public static int Y { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Fires the change color event. + /// + /// + /// The color. + /// + public static void FireEvent(Color color) + { + } + + /// + /// Loads the color picker. + /// + /// + /// The select color delegate. + /// + /// + /// The color. + /// + public static void Load(OnSelectColor onSelectColor, Color color) + { + } + + #endregion + } +} \ No newline at end of file diff --git a/Menu/HSLColor.cs b/source/Menu/Items/HSLColor.cs similarity index 97% rename from Menu/HSLColor.cs rename to source/Menu/Items/HSLColor.cs index 4b6b2512..fdf535ed 100644 --- a/Menu/HSLColor.cs +++ b/source/Menu/Items/HSLColor.cs @@ -6,6 +6,7 @@ /// /// The HSL Color class. /// + [Obsolete] public class HSLColor { #region Constants @@ -169,11 +170,11 @@ public static implicit operator Color(HSLColor hslColor) else { var temp2 = GetTemp2(hslColor); - var temp1 = 2.0 * hslColor.luminosity - temp2; + var temp1 = (2.0 * hslColor.luminosity) - temp2; - r = GetColorComponent(temp1, temp2, hslColor.hue + 1.0 / 3.0); + r = GetColorComponent(temp1, temp2, hslColor.hue + (1.0 / 3.0)); g = GetColorComponent(temp1, temp2, hslColor.hue); - b = GetColorComponent(temp1, temp2, hslColor.hue - 1.0 / 3.0); + b = GetColorComponent(temp1, temp2, hslColor.hue - (1.0 / 3.0)); } } @@ -287,7 +288,7 @@ private static double GetColorComponent(double temp1, double temp2, double temp3 temp3 = MoveIntoRange(temp3); return (temp3 < 1.0 / 6.0) - ? temp1 + (temp2 - temp1) * 6.0 * temp3 + ? temp1 + ((temp2 - temp1) * 6.0 * temp3) : (temp3 < 0.5) ? temp2 : (temp3 < 2.0 / 3.0) ? temp1 + ((temp2 - temp1) * ((2.0 / 3.0) - temp3) * 6.0) : temp1; diff --git a/Menu/MenuGlobals.cs b/source/Menu/MenuGlobals.cs similarity index 100% rename from Menu/MenuGlobals.cs rename to source/Menu/MenuGlobals.cs diff --git a/Menu/OnValueChangeEventArgs.cs b/source/Menu/OnValueChangeEventArgs.cs similarity index 90% rename from Menu/OnValueChangeEventArgs.cs rename to source/Menu/OnValueChangeEventArgs.cs index 5f270035..542078de 100644 --- a/Menu/OnValueChangeEventArgs.cs +++ b/source/Menu/OnValueChangeEventArgs.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; @@ -50,6 +54,10 @@ public OnValueChangeEventArgs(object oldValue, object newValue) #endregion + #region Properties + + #endregion + #region Public Methods and Operators /// diff --git a/source/Menu/View/BoolView.cs b/source/Menu/View/BoolView.cs new file mode 100644 index 00000000..6bb1bf16 --- /dev/null +++ b/source/Menu/View/BoolView.cs @@ -0,0 +1,207 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + using Color = System.Drawing.Color; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class BoolView : View + { + #region Fields + + private Render.Sprite sprite; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public BoolView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal BoolView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~BoolView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private static Render.Sprite FalseSprite { get; set; } + + private static Render.Sprite TrueSprite { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + public override IView CreateView(IMenuComponent component) + { + return new BoolView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var position = new Vector2(this.Component.Position.X + width - height, this.Component.Position.Y); + if (this.Component.Value) + { + TrueSprite.Position = position; + TrueSprite.OnEndScene(); + } + else + { + FalseSprite.Position = position; + FalseSprite.OnEndScene(); + } + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var cursor = Cursor.GetCursorPos(); + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + width - height, + this.Component.Position.Y, + height, + height)) + { + this.Component.Value = !this.Component.Value; + } + + break; + } + } + + #endregion + + #region Methods + + private static void CreateGlobalContext(int height) + { + if (FalseSprite == null) + { + var bitmap = new Bitmap(height, height); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBox(graphics, 0, 0, height, height, Color.DarkRed, "OFF"); + } + + FalseSprite = new Render.Sprite(bitmap, default(Vector2)); + } + + if (TrueSprite == null) + { + var bitmap = new Bitmap(height, height); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBox(graphics, 0, 0, height, height, Color.DarkGreen, "ON"); + } + + TrueSprite = new Render.Sprite(bitmap, default(Vector2)); + } + } + + private void CreateContext() + { + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + CreateGlobalContext((int)Math.Round(height)); + + var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - height - 5, height, title, viewAttributes); + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/CircleView.cs b/source/Menu/View/CircleView.cs new file mode 100644 index 00000000..46ae4706 --- /dev/null +++ b/source/Menu/View/CircleView.cs @@ -0,0 +1,416 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + using System.Drawing.Drawing2D; + + using LeagueSharp.Common.Properties; + + using SharpDX; + using SharpDX.Menu; + + using Color = System.Drawing.Color; + using Rectangle = System.Drawing.Rectangle; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class CircleView : View + { + #region Fields + + private Render.Sprite sprite; + + private bool updateContext; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public CircleView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal CircleView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~CircleView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the color picker instance. + /// + public static CircleView ColorPickerInstance { get; set; } + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private static Render.Sprite FalseSprite { get; set; } + + private static Render.Sprite Spectrum { get; set; } + + private static Render.Sprite TrueSprite { get; set; } + + private bool AlphaPickClick { get; set; } + + private bool ColorPickClick { get; set; } + + private bool IsPickingColor { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Closes the color picker. + /// + public void Close() + { + this.IsPickingColor = false; + this.updateContext = true; + this.ColorPickClick = this.AlphaPickClick = false; + } + + /// + public override IView CreateView(IMenuComponent component) + { + return new CircleView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + if (this.updateContext) + { + this.CreateContext(); + this.updateContext = false; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var position = new Vector2(this.Component.Position.X + width - height, this.Component.Position.Y); + if (this.Component.Value.Active) + { + TrueSprite.Position = position; + TrueSprite.OnEndScene(); + } + else + { + FalseSprite.Position = position; + FalseSprite.OnEndScene(); + } + + if (this.IsPickingColor) + { + Spectrum.Position = new Vector2(this.Component.Position.X + width + 5, this.Component.Position.Y + 5); + Spectrum.OnEndScene(); + } + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + var cursor = Cursor.GetCursorPos(); + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + width - (height * 2), + this.Component.Position.Y, + height, + height)) + { + if (!this.IsPickingColor) + { + DxColorView.ColorPickerInstance?.Close(); + SystemColorView.ColorPickerInstance?.Close(); + ColorPickerInstance?.Close(); + ColorPickerInstance = this; + } + + this.IsPickingColor = !this.IsPickingColor; + this.updateContext = true; + } + + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + width - height, + this.Component.Position.Y, + height, + height)) + { + this.Component.Value.Active = !this.Component.Value.Active; + } + + if (this.IsPickingColor) + { + if (this.ColorPickClick || this.AlphaPickClick) + { + break; + } + + if (Utils.IsUnderRectangle( + cursor, + Spectrum.Position.X, + Spectrum.Position.Y, + Spectrum.Width, + Spectrum.Height)) + { + this.ColorPickClick = true; + this.UpdateColorPicker(cursor); + } + else if (Utils.IsUnderRectangle( + cursor, + Spectrum.Position.X, + Spectrum.Position.Y + Spectrum.Height, + Spectrum.Width, + 15)) + { + this.AlphaPickClick = true; + this.UpdateColorPicker(cursor); + } + } + + break; + + case (uint)WindowsMessages.WM_LBUTTONUP: + if (this.IsPickingColor) + { + this.ColorPickClick = this.AlphaPickClick = false; + } + + break; + + case (uint)WindowsMessages.WM_MOUSEMOVE: + if (this.IsPickingColor) + { + this.UpdateColorPicker(cursor); + } + + break; + } + } + + #endregion + + #region Methods + + private static void CreateGlobalContext(int height) + { + if (FalseSprite == null) + { + var bitmap = new Bitmap(height, height); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBox(graphics, 0, 0, height, height, Color.DarkRed, "OFF"); + } + + FalseSprite = new Render.Sprite(bitmap, default(Vector2)); + } + + if (TrueSprite == null) + { + var bitmap = new Bitmap(height, height); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBox(graphics, 0, 0, height, height, Color.DarkGreen, "ON"); + } + + TrueSprite = new Render.Sprite(bitmap, default(Vector2)); + } + + if (Spectrum == null) + { + Spectrum = new Render.Sprite(Resources.spectrum_chart, default(Vector2)) + { Scale = new Vector2(0.5f, 0.5f) }; + } + } + + private static GraphicsPath RoundedRect(Rectangle bounds, int radius) + { + var diameter = radius * 2; + var size = new Size(diameter, diameter); + var arc = new Rectangle(bounds.Location, size); + var path = new GraphicsPath(); + + if (radius == 0) + { + path.AddRectangle(bounds); + return path; + } + + path.AddArc(arc, 180, 90); + arc.X = bounds.Right - diameter; + path.AddArc(arc, 270, 90); + arc.Y = bounds.Bottom - diameter; + path.AddArc(arc, 0, 90); + arc.X = bounds.Left; + path.AddArc(arc, 90, 90); + + path.CloseFigure(); + return path; + } + + private void CreateContext() + { + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + CreateGlobalContext((int)height); + + var bitmap = new Bitmap( + (int)Math.Round(width) + 1 + Spectrum.Width + 25, + (int)Math.Round(height) + 1 + Spectrum.Height + 25); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - (height * 2) - 5, height, title, viewAttributes); + SharedView.CreateBox(graphics, width - (height * 2), 0, height, height, this.Component.Value.Color); + + if (this.IsPickingColor) + { + SharedView.CreateBackgroundView(graphics, width, 0, Spectrum.Width + 8, Spectrum.Height + 25); + using (var pen = new Pen(Color.FromArgb(51, 200, 203, 203))) + { + var startX = (int)width + 5; + var startY = Spectrum.Height + 10; + var alphaWidth = Spectrum.Width; + var alphaHeight = 10; + var alphaValue = this.Component.Value.Color.A; + + var valuePercentage = 100 * alphaValue / 255; + var alphaX = (int)Math.Round(startX + 3 + ((valuePercentage * (alphaWidth - 3)) / 100f)); + + using (var path = RoundedRect(new Rectangle(startX, startY, alphaWidth, alphaHeight), 5)) + { + graphics.FillPath(new SolidBrush(Color.FromArgb(150, 200, 203, 203)), path); + graphics.DrawPath(pen, path); + } + + using (var path = RoundedRect(new Rectangle(startX, startY, alphaX - startX, alphaHeight), 5)) + { + graphics.FillPath(new SolidBrush(Color.FromArgb(150, 12, 125, 141)), path); + graphics.DrawPath(pen, path); + } + + var rect = new Rectangle(alphaX - (34 / 2), startY - 3, 34, alphaHeight + 5); + using (var path = RoundedRect(rect, 5)) + { + graphics.FillPath(new SolidBrush(Color.FromArgb(255, 0, 0, 0)), path); + graphics.DrawPath(pen, path); + } + + SharedView.CreateText( + graphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + alphaValue.ToString(), + new ViewAttributes(null)); + } + } + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + private void UpdateColorPicker(Vector2 cursor) + { + if (this.ColorPickClick) + { + var cursorX = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * cursor.X); + var cursorY = (int)Math.Round(((float)Spectrum.Bitmap.Height / Spectrum.Height) * cursor.Y); + var bitmapX = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * Spectrum.X); + var bitmapY = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * Spectrum.Y); + + var x = Math.Max(0, Math.Min(Spectrum.Bitmap.Width - 1, cursorX - bitmapX)); + var y = Math.Max(0, Math.Min(Spectrum.Bitmap.Height - 1, cursorY - bitmapY)); + + var c = Spectrum.Bitmap.GetPixel(x, y); + this.Component.Value.Color = Color.FromArgb(this.Component.Value.Color.A, c.R, c.G, c.B); + this.updateContext = true; + } + else if (this.AlphaPickClick) + { + var cursorValue = 0 + ((Cursor.GetCursorPos().X - Spectrum.Position.X) * (255 - 0) / Spectrum.Width); + var value = Math.Max(0, Math.Min(255, (int)cursorValue)); + var c = this.Component.Value.Color; + this.Component.Value.Color = Color.FromArgb(value, c.R, c.G, c.B); + this.updateContext = true; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/ComponentView.cs b/source/Menu/View/ComponentView.cs new file mode 100644 index 00000000..df393cf1 --- /dev/null +++ b/source/Menu/View/ComponentView.cs @@ -0,0 +1,133 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(IMenuComponent))] + public class ComponentView : View + { + #region Fields + + private Render.Sprite sprite; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public ComponentView(IMenuComponent component) + { + this.Component = component; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal ComponentView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~ComponentView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets the component. + /// + public IMenuComponent Component { get; } + + #endregion + + #region Public Methods and Operators + + /// + public override IView CreateView(IMenuComponent component) + { + return new ComponentView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + } + + #endregion + + #region Methods + + private void CreateContext() + { + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width, height, title, viewAttributes); + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/DxColorView.cs b/source/Menu/View/DxColorView.cs new file mode 100644 index 00000000..5ef148d2 --- /dev/null +++ b/source/Menu/View/DxColorView.cs @@ -0,0 +1,370 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + using System.Drawing.Drawing2D; + + using LeagueSharp.Common.Properties; + + using SharpDX; + using SharpDX.Menu; + + using Color = SharpDX.Color; + using Rectangle = System.Drawing.Rectangle; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class DxColorView : View + { + #region Fields + + private Render.Sprite sprite; + + private bool updateContext; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public DxColorView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal DxColorView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~DxColorView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the color picker instance. + /// + public static DxColorView ColorPickerInstance { get; set; } + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private static Render.Sprite Spectrum { get; set; } + + private bool AlphaPickClick { get; set; } + + private bool ColorPickClick { get; set; } + + private bool IsPickingColor { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Closes the color picker. + /// + public void Close() + { + this.IsPickingColor = false; + this.updateContext = true; + this.ColorPickClick = this.AlphaPickClick = false; + } + + /// + public override IView CreateView(IMenuComponent component) + { + return new DxColorView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + if (this.updateContext) + { + this.CreateContext(); + this.updateContext = false; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + + if (this.IsPickingColor) + { + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + Spectrum.Position = new Vector2(this.Component.Position.X + width + 5, this.Component.Position.Y + 5); + Spectrum.OnEndScene(); + } + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + var cursor = Cursor.GetCursorPos(); + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + width - height, + this.Component.Position.Y, + height, + height)) + { + if (!this.IsPickingColor) + { + SystemColorView.ColorPickerInstance?.Close(); + CircleView.ColorPickerInstance?.Close(); + ColorPickerInstance?.Close(); + ColorPickerInstance = this; + } + + this.IsPickingColor = !this.IsPickingColor; + this.updateContext = true; + } + + if (this.IsPickingColor) + { + if (this.ColorPickClick || this.AlphaPickClick) + { + break; + } + + if (Utils.IsUnderRectangle( + cursor, + Spectrum.Position.X, + Spectrum.Position.Y, + Spectrum.Width, + Spectrum.Height)) + { + this.ColorPickClick = true; + this.UpdateColorPicker(cursor); + } + else if (Utils.IsUnderRectangle( + cursor, + Spectrum.Position.X, + Spectrum.Position.Y + Spectrum.Height, + Spectrum.Width, + 15)) + { + this.AlphaPickClick = true; + this.UpdateColorPicker(cursor); + } + } + + break; + + case (uint)WindowsMessages.WM_LBUTTONUP: + if (this.IsPickingColor) + { + this.ColorPickClick = this.AlphaPickClick = false; + } + + break; + + case (uint)WindowsMessages.WM_MOUSEMOVE: + if (this.IsPickingColor) + { + this.UpdateColorPicker(cursor); + } + + break; + } + } + + #endregion + + #region Methods + + private static void CreateGlobalContext() + { + if (Spectrum == null) + { + Spectrum = new Render.Sprite(Resources.spectrum_chart, default(Vector2)) + { Scale = new Vector2(0.5f, 0.5f) }; + } + } + + private static GraphicsPath RoundedRect(Rectangle bounds, int radius) + { + var diameter = radius * 2; + var size = new Size(diameter, diameter); + var arc = new Rectangle(bounds.Location, size); + var path = new GraphicsPath(); + + if (radius == 0) + { + path.AddRectangle(bounds); + return path; + } + + path.AddArc(arc, 180, 90); + arc.X = bounds.Right - diameter; + path.AddArc(arc, 270, 90); + arc.Y = bounds.Bottom - diameter; + path.AddArc(arc, 0, 90); + arc.X = bounds.Left; + path.AddArc(arc, 90, 90); + + path.CloseFigure(); + return path; + } + + private void CreateContext() + { + CreateGlobalContext(); + + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + var bitmap = new Bitmap( + (int)Math.Round(width) + 1 + Spectrum.Width + 25, + (int)Math.Round(height) + 1 + Spectrum.Height + 25); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - height - 5, height, title, viewAttributes); + + var c = this.Component.Value; + var color = System.Drawing.Color.FromArgb(c.A, c.R, c.G, c.B); + SharedView.CreateBox(graphics, width - height, 0, height, height, color); + + if (this.IsPickingColor) + { + SharedView.CreateBackgroundView(graphics, width, 0, Spectrum.Width + 8, Spectrum.Height + 25); + using (var pen = new Pen(System.Drawing.Color.FromArgb(51, 200, 203, 203))) + { + var startX = (int)width + 5; + var startY = Spectrum.Height + 10; + var alphaWidth = Spectrum.Width; + var alphaHeight = 10; + var alphaValue = this.Component.Value.A; + + var valuePercentage = 100 * alphaValue / 255; + var alphaX = (int)Math.Round(startX + 3 + ((valuePercentage * (alphaWidth - 3)) / 100f)); + + using (var path = RoundedRect(new Rectangle(startX, startY, alphaWidth, alphaHeight), 5)) + { + graphics.FillPath(new SolidBrush(System.Drawing.Color.FromArgb(150, 200, 203, 203)), path); + graphics.DrawPath(pen, path); + } + + using (var path = RoundedRect(new Rectangle(startX, startY, alphaX - startX, alphaHeight), 5)) + { + graphics.FillPath(new SolidBrush(System.Drawing.Color.FromArgb(150, 12, 125, 141)), path); + graphics.DrawPath(pen, path); + } + + var rect = new Rectangle(alphaX - (34 / 2), startY - 3, 34, alphaHeight + 5); + using (var path = RoundedRect(rect, 5)) + { + graphics.FillPath(new SolidBrush(System.Drawing.Color.FromArgb(255, 0, 0, 0)), path); + graphics.DrawPath(pen, path); + } + + SharedView.CreateText( + graphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + alphaValue.ToString(), + new ViewAttributes(null)); + } + } + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + private void UpdateColorPicker(Vector2 cursor) + { + if (this.ColorPickClick) + { + var cursorX = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * cursor.X); + var cursorY = (int)Math.Round(((float)Spectrum.Bitmap.Height / Spectrum.Height) * cursor.Y); + var bitmapX = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * Spectrum.X); + var bitmapY = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * Spectrum.Y); + + var x = Math.Max(0, Math.Min(Spectrum.Bitmap.Width - 1, cursorX - bitmapX)); + var y = Math.Max(0, Math.Min(Spectrum.Bitmap.Height - 1, cursorY - bitmapY)); + + var c = Spectrum.Bitmap.GetPixel(x, y); + this.Component.Value = new Color(c.R, c.G, c.B, this.Component.Value.A); + this.updateContext = true; + } + else if (this.AlphaPickClick) + { + var cursorValue = 0 + ((Cursor.GetCursorPos().X - Spectrum.Position.X) * (255 - 0) / Spectrum.Width); + var value = Math.Max(0, Math.Min(255, (int)cursorValue)); + var c = this.Component.Value; + this.Component.Value = new Color(c.R, c.G, c.B, value); + this.updateContext = true; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/IViewAttributes.cs b/source/Menu/View/IViewAttributes.cs new file mode 100644 index 00000000..f6b06976 --- /dev/null +++ b/source/Menu/View/IViewAttributes.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System.Drawing; + + /// + /// The view attributes interface. + /// + public interface IViewAttributes + { + #region Public Properties + + /// + /// Gets the font brush. + /// + Brush FontBrush { get; } + + /// + /// Gets the font name. + /// + string FontName { get; } + + /// + /// Gets the font style. + /// + FontStyle FontStyle { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/KeybindView.cs b/source/Menu/View/KeybindView.cs new file mode 100644 index 00000000..fc2f602c --- /dev/null +++ b/source/Menu/View/KeybindView.cs @@ -0,0 +1,304 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + using Color = System.Drawing.Color; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class KeybindView : View + { + #region Fields + + private bool firstKeyMemory; + + private bool secondKeyMemory; + + private Render.Sprite sprite; + + private bool updateView; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public KeybindView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal KeybindView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~KeybindView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private KeybindSetStage Stage { get; set; } = KeybindSetStage.NotSetting; + + #endregion + + #region Public Methods and Operators + + /// + public override IView CreateView(IMenuComponent component) + { + return new KeybindView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + if (this.updateView) + { + this.CreateContext(); + this.updateView = false; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null) + { + return; + } + + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + if (this.Component.IsHovered) + { + switch (this.Stage) + { + case KeybindSetStage.NotSetting: + this.Stage = KeybindSetStage.Keybind1; + + break; + case KeybindSetStage.Keybind1: + this.Stage = KeybindSetStage.Keybind2; + if (this.Component.Value.SecondaryKey == 0) + { + this.Component.Value.SecondaryKey = uint.MaxValue; + } + + break; + case KeybindSetStage.Keybind2: + this.Stage = KeybindSetStage.NotSetting; + if (this.Component.Value.SecondaryKey == uint.MaxValue) + { + this.Component.Value.SecondaryKey = 0; + } + + break; + } + + this.updateView = true; + } + + break; + + case (uint)WindowsMessages.WM_KEYDOWN: + if (MenuGUI.IsChatOpen || MenuGUI.IsScoreboardOpen || MenuGUI.IsShopOpen) + { + break; + } + + switch (this.Stage) + { + case KeybindSetStage.NotSetting: + if (wParam == this.Component.Value.Key || wParam == this.Component.Value.SecondaryKey) + { + this.Component.Value.Active = (this.Component.Value.Type != KeyBindType.Toggle) + || !this.Component.Value.Active; + this.firstKeyMemory = wParam == this.Component.Value.Key; + this.secondKeyMemory = wParam == this.Component.Value.SecondaryKey; + this.updateView = true; + } + + break; + + case KeybindSetStage.Keybind1: + if (wParam == (uint)Keys.Back) + { + if (this.Component.Value.SecondaryKey != 0) + { + this.Component.Value.Key = this.Component.Value.SecondaryKey; + this.Component.Value.SecondaryKey = 0; + } + else + { + this.Component.Value.Key = 0; + } + } + else + { + this.Component.Value.Key = wParam; + } + + this.Stage = KeybindSetStage.NotSetting; + this.updateView = true; + + break; + case KeybindSetStage.Keybind2: + this.Component.Value.SecondaryKey = wParam == (uint)Keys.Back ? 0 : wParam; + this.Stage = KeybindSetStage.NotSetting; + this.updateView = true; + + break; + } + + break; + + case (uint)WindowsMessages.WM_KEYUP: + if (MenuGUI.IsChatOpen || MenuGUI.IsScoreboardOpen || MenuGUI.IsShopOpen) + { + break; + } + + switch (this.Stage) + { + case KeybindSetStage.NotSetting: + if (wParam == this.Component.Value.Key || wParam == this.Component.Value.SecondaryKey) + { + if (this.Component.Value.Type == KeyBindType.Press) + { + this.Component.Value.Active = false; + this.firstKeyMemory = false; + this.secondKeyMemory = false; + this.updateView = true; + } + } + + break; + } + + break; + } + } + + #endregion + + #region Methods + + private void CreateContext() + { + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + var viewAttributesOn = new ViewAttributes(null) { FontBrush = new SolidBrush(Color.Aqua) }; + var viewAttributesOff = new ViewAttributes(null) { FontBrush = new SolidBrush(Color.DarkRed) }; + + var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + + var keyString = this.Stage == KeybindSetStage.Keybind1 + ? "[?]" + : $"[{Utils.KeyToText(this.Component.Value.Key)}]"; + var secondKeyString = this.Stage == KeybindSetStage.Keybind2 + ? "[?]" + : $"[{Utils.KeyToText(this.Component.Value.SecondaryKey)}]"; + var secondKeyValid = this.Component.Value.SecondaryKey != 0; + var keyAttribute = this.firstKeyMemory ? viewAttributesOn : viewAttributesOff; + var secondKeyAttribute = this.secondKeyMemory ? viewAttributesOn : viewAttributesOff; + + float keySize; + float secondKeySize; + float finalSize; + using (var font = new Font("Tahoma", 12, FontStyle.Regular, GraphicsUnit.Pixel)) + { + keySize = graphics.MeasureString(keyString, font).Width; + secondKeySize = secondKeyValid ? graphics.MeasureString(secondKeyString, font).Width : 0; + finalSize = keySize + secondKeySize; + } + + SharedView.CreateTitle(graphics, 0, 0, width - finalSize, height, title, viewAttributes); + SharedView.CreateText(graphics, width - finalSize, 0, keySize, height, keyString, keyAttribute); + if (secondKeyValid) + { + SharedView.CreateText( + graphics, + width - secondKeySize, + 0, + secondKeySize, + height, + secondKeyString, + secondKeyAttribute); + } + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/MenuView.cs b/source/Menu/View/MenuView.cs new file mode 100644 index 00000000..d2ec4198 --- /dev/null +++ b/source/Menu/View/MenuView.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(Menu))] + public class MenuView : View + { + #region Fields + + private Render.Sprite sprite; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public MenuView(IMenuComponent component) + { + this.Component = component as Menu; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal MenuView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~MenuView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets the component. + /// + public Menu Component { get; } + + #endregion + + #region Public Methods and Operators + + /// + public override IView CreateView(IMenuComponent component) + { + return new MenuView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + } + + #endregion + + #region Methods + + private void CreateContext() + { + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - 17, height, title, viewAttributes); + SharedView.CreateText(graphics, width - 17, 0, 17, height, "»", viewAttributes); + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/SharedView.cs b/source/Menu/View/SharedView.cs new file mode 100644 index 00000000..baa95b2a --- /dev/null +++ b/source/Menu/View/SharedView.cs @@ -0,0 +1,272 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System.Drawing; + + /// + /// Shared View, providing common functionality which is usually shared across more than one registry view. + /// + public static class SharedView + { + #region Public Methods and Operators + + /// + /// Creates a background for a view. + /// + /// + /// The graphics. + /// + /// + /// The X. + /// + /// + /// The Y. + /// + /// + /// The width. + /// + /// + /// The height. + /// + public static void CreateBackgroundView(Graphics graphics, float x, float y, float width, float height) + { + // Background + using (var pen = new Pen(Color.FromArgb(150, 0, 0, 0), height)) + { + graphics.DrawLine(pen, x, y + (height / 2f), x + width, y + (height / 2f)); + } + + // Border + using (var pen = new Pen(Color.Black, 1.5f)) + { + graphics.DrawLine(pen, x, y, x + width, y); + graphics.DrawLine(pen, x, y + height, x + width, y + height); + graphics.DrawLine(pen, x, y, x, y + height); + graphics.DrawLine(pen, x + width, y, x + width, y + height); + } + } + + /// + /// Creates a border for a view. + /// + /// + /// The graphics. + /// + /// + /// The X. + /// + /// + /// The Y. + /// + /// + /// The width. + /// + /// + /// The height. + /// + /// + /// The color of the border. + /// + public static void CreateBorder(Graphics graphics, float x, float y, float width, float height, Color color) + { + using (var pen = new Pen(color, 1.5f)) + { + graphics.DrawLine(pen, x, y, x + width, y); + graphics.DrawLine(pen, x, y + height, x + width, y + height); + graphics.DrawLine(pen, x, y, x, y + height); + graphics.DrawLine(pen, x + width, y, x + width, y + height); + } + } + + /// + /// Creates a box for a view. + /// + /// + /// The graphics. + /// + /// + /// The X. + /// + /// + /// The Y. + /// + /// + /// The width. + /// + /// + /// The height. + /// + /// + /// The color. + /// + /// + /// The content. + /// + public static void CreateBox( + Graphics graphics, + float x, + float y, + float width, + float height, + Color color, + string content = null) + { + using (var pen = new Pen(color, height)) + { + graphics.DrawLine(pen, x, y + (height / 2f), x + width, y + (height / 2f)); + } + + if (!string.IsNullOrEmpty(content)) + { + CreateText(graphics, x, y, width, height, content, new ViewAttributes(null)); + } + } + + /// + /// Creates a slider for a view. + /// + /// + /// The graphics. + /// + /// + /// The X. + /// + /// + /// The Y. + /// + /// + /// The width. + /// + /// + /// The height. + /// + /// + /// The value. + /// + /// + /// The min value. + /// + /// + /// The max value. + /// + public static void CreateSlider( + Graphics graphics, + float x, + float y, + float width, + float height, + int value, + int minValue, + int maxValue) + { + width -= 3; + var valuePercentage = 100 * (value - minValue) / (maxValue - minValue); + var indicatorX = x + 3 + ((valuePercentage * (width - 3)) / 100f); + using (var pen = new Pen(Color.CornflowerBlue, 1f)) + { + graphics.DrawLine(pen, indicatorX, y + 2, indicatorX, y + height); + } + + if (value != minValue) + { + var trackBarX = 3 + ((valuePercentage * (width - 3)) / 100f); + CreateBox(graphics, x, y, trackBarX - 2, height, Color.FromArgb(150, 0, 37, 53)); + } + } + + /// + /// Creates a text for a view. + /// + /// + /// The graphics. + /// + /// + /// The X. + /// + /// + /// The Y. + /// + /// + /// The width. + /// + /// + /// The height. + /// + /// + /// The text. + /// + /// + /// The view attributes. + /// + public static void CreateText( + Graphics graphics, + float x, + float y, + float width, + float height, + string text, + IViewAttributes viewAttributes) + { + using (var font = new Font(viewAttributes.FontName, 12, viewAttributes.FontStyle, GraphicsUnit.Pixel)) + { + var rectangle = new RectangleF(x, y, width, height); + var format = new StringFormat + { LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center }; + + graphics.DrawString(text, font, viewAttributes.FontBrush, rectangle, format); + } + } + + /// + /// Creates a title for a view. + /// + /// + /// The graphics. + /// + /// + /// The X. + /// + /// + /// The Y. + /// + /// + /// The width. + /// + /// + /// The height. + /// + /// + /// The title. + /// + /// + /// The view attributes. + /// + public static void CreateTitle( + Graphics graphics, + float x, + float y, + float width, + float height, + string title, + IViewAttributes viewAttributes) + { + using (var font = new Font(viewAttributes.FontName, 12, viewAttributes.FontStyle, GraphicsUnit.Pixel)) + { + var rectangle = new RectangleF(x + 5, y, width - 5, height); + var format = new StringFormat + { + LineAlignment = StringAlignment.Center, + Trimming = StringTrimming.EllipsisCharacter, + FormatFlags = StringFormatFlags.LineLimit + }; + + graphics.DrawString(title, font, viewAttributes.FontBrush, rectangle, format); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/SliderBoolView.cs b/source/Menu/View/SliderBoolView.cs new file mode 100644 index 00000000..2c5a8d17 --- /dev/null +++ b/source/Menu/View/SliderBoolView.cs @@ -0,0 +1,233 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + using Color = System.Drawing.Color; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class SliderBoolView : View + { + #region Fields + + private bool isSettingValue; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public SliderBoolView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal SliderBoolView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~SliderBoolView() + { + foreach (var sprite in this.Sprites.Values) + { + sprite?.Bitmap?.Dispose(); + } + } + + #endregion + + #region Public Properties + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private IDictionary Sprites { get; } = new Dictionary(); + + #endregion + + #region Public Methods and Operators + + /// + public override IView CreateView(IMenuComponent component) + { + return new SliderBoolView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + Render.Sprite value; + if (this.Sprites.TryGetValue(this.Component.Value.Value, out value)) + { + value.Position = this.Component.Position; + value.OnEndScene(); + } + else + { + this.CreateContext(); + this.Sprites[this.Component.Value.Value].Position = this.Component.Position; + this.Sprites[this.Component.Value.Value].OnEndScene(); + } + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + if (!this.isSettingValue) + { + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var cursor = Cursor.GetCursorPos(); + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + width - height, + this.Component.Position.Y, + height, + height)) + { + this.Component.Value.IsActive = !this.Component.Value.IsActive; + break; + } + + this.isSettingValue = this.Component.IsHovered; + if (this.isSettingValue) + { + this.UpdateValue(); + } + } + + break; + case (uint)WindowsMessages.WM_LBUTTONUP: + this.isSettingValue = false; + + break; + case (uint)WindowsMessages.WM_MOUSEMOVE: + + if (this.isSettingValue) + { + this.UpdateValue(); + } + + break; + } + } + + #endregion + + #region Methods + + private void CreateContext() + { + foreach (var sprite in this.Sprites.Values) + { + sprite.Dispose(); + } + + this.Sprites.Clear(); + + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + for (var i = this.Component.Value.Value - 5; i < this.Component.Value.Value + 5; ++i) + { + var value = i.ToString(); + var v = this.Component.Value; + var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + float length; + using (var font = new Font("Tahoma", 12, FontStyle.Regular, GraphicsUnit.Pixel)) + { + length = graphics.MeasureString(value, font).Width + 5; + } + + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - length, height, title, viewAttributes); + + var active = this.Component.Value.IsActive; + var boxColor = active ? Color.DarkGreen : Color.DarkRed; + var boxContent = this.Component.Value.Value.ToString(); + var boxX = width - height; + + SharedView.CreateBox(graphics, boxX, 0, height, height, boxColor, boxContent); + SharedView.CreateSlider(graphics, 0, 0, width - height, height, i, v.MinValue, v.MaxValue); + } + + this.Sprites[i] = new Render.Sprite(bitmap, default(Vector2)); + } + } + + private void UpdateValue() + { + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var min = this.Component.Value.MinValue; + var max = this.Component.Value.MaxValue; + var cursorValue = min + ((Cursor.GetCursorPos().X - this.Component.Position.X) * (max - min) / width); + var value = (int)Math.Round(cursorValue); + if (value != this.Component.Value.Value) + { + this.Component.Value.Value = (int)Math.Round(cursorValue); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/SliderView.cs b/source/Menu/View/SliderView.cs new file mode 100644 index 00000000..908a9333 --- /dev/null +++ b/source/Menu/View/SliderView.cs @@ -0,0 +1,207 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class SliderView : View + { + #region Fields + + private bool isSettingValue; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public SliderView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal SliderView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~SliderView() + { + foreach (var sprite in this.Sprites.Values) + { + sprite?.Bitmap?.Dispose(); + } + } + + #endregion + + #region Public Properties + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private IDictionary Sprites { get; } = new Dictionary(); + + #endregion + + #region Public Methods and Operators + + /// + public override IView CreateView(IMenuComponent component) + { + return new SliderView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + Render.Sprite value; + if (this.Sprites.TryGetValue(this.Component.Value.Value, out value)) + { + value.Position = this.Component.Position; + value.OnEndScene(); + } + else + { + this.CreateContext(); + this.Sprites[this.Component.Value.Value].Position = this.Component.Position; + this.Sprites[this.Component.Value.Value].OnEndScene(); + } + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + if (!this.isSettingValue) + { + this.isSettingValue = this.Component.IsHovered; + if (this.isSettingValue) + { + this.UpdateValue(); + } + } + + break; + case (uint)WindowsMessages.WM_LBUTTONUP: + this.isSettingValue = false; + + break; + case (uint)WindowsMessages.WM_MOUSEMOVE: + + if (this.isSettingValue) + { + this.UpdateValue(); + } + + break; + } + } + + #endregion + + #region Methods + + private void CreateContext() + { + foreach (var sprite in this.Sprites.Values) + { + sprite.Dispose(); + } + + this.Sprites.Clear(); + + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + for (var i = this.Component.Value.Value - 5; i < this.Component.Value.Value + 5; ++i) + { + var value = i.ToString(); + var v = this.Component.Value; + var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + float length; + using (var font = new Font("Tahoma", 12, FontStyle.Regular, GraphicsUnit.Pixel)) + { + length = graphics.MeasureString(value, font).Width + 5; + } + + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - length, height, title, viewAttributes); + SharedView.CreateSlider(graphics, 0, 0, width, height, i, v.MinValue, v.MaxValue); + SharedView.CreateText(graphics, width - length, 0, length, height, value, viewAttributes); + } + + this.Sprites[i] = new Render.Sprite(bitmap, default(Vector2)); + } + } + + private void UpdateValue() + { + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var min = this.Component.Value.MinValue; + var max = this.Component.Value.MaxValue; + var cursorValue = min + ((Cursor.GetCursorPos().X - this.Component.Position.X) * (max - min) / width); + this.Component.Value.Value = (int)Math.Round(cursorValue); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/StringListView.cs b/source/Menu/View/StringListView.cs new file mode 100644 index 00000000..cc697c7e --- /dev/null +++ b/source/Menu/View/StringListView.cs @@ -0,0 +1,242 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + using Color = System.Drawing.Color; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class StringListView : View + { + #region Fields + + private bool isPicking; + + private Render.Sprite sprite; + + private bool updateContext; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public StringListView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal StringListView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~StringListView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private float BorderWidth { get; set; } + + private float TitleWidth { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + public override IView CreateView(IMenuComponent component) + { + return new StringListView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + if (this.updateContext) + { + this.CreateContext(); + this.updateContext = false; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + var cursor = Cursor.GetCursorPos(); + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + this.TitleWidth, + this.Component.Position.Y, + width - this.TitleWidth, + height)) + { + this.isPicking = !this.isPicking; + this.updateContext = true; + } + + if (this.isPicking) + { + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + width, + this.Component.Position.Y, + width, + height * this.Component.Value.Items.Length)) + { + this.Component.Value.SelectedIndex = (int)((cursor.Y - this.Component.Position.Y) / height); + this.isPicking = false; + this.updateContext = true; + } + } + + break; + } + } + + #endregion + + #region Methods + + private void CreateContext() + { + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var viewAttributes = new ViewAttributes(this); + + var title = $"{this.Component.DisplayName}:"; + var value = this.Component.Value.SelectedValue; + + var bitmap = new Bitmap( + (int)Math.Round(width * 2) + 1, + (int)Math.Round(height * this.Component.Value.Items.Length) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + float arrowWidth; + using (var font = new Font("Tahoma", 12, FontStyle.Regular, GraphicsUnit.Pixel)) + { + this.BorderWidth = graphics.MeasureString(value, font).Width; + this.TitleWidth = graphics.MeasureString(title, font).Width + 10; + arrowWidth = graphics.MeasureString("»", font).Width; + } + + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - (this.BorderWidth / 2), height, title, viewAttributes); + SharedView.CreateText( + graphics, + this.TitleWidth, + 0, + width - this.TitleWidth - arrowWidth, + height, + value, + viewAttributes); + SharedView.CreateText(graphics, width - arrowWidth, 0, arrowWidth, height, "»", viewAttributes); + SharedView.CreateBorder( + graphics, + this.TitleWidth, + 0, + width - this.TitleWidth, + height - 1, + Color.DarkGray); + + if (this.isPicking) + { + SharedView.CreateBackgroundView( + graphics, + width + 1, + 0, + width - 1, + height * this.Component.Value.Items.Length); + for (var i = 0; i < this.Component.Value.Items.Length; ++i) + { + SharedView.CreateBorder(graphics, width + 1, height * i, width - 1, height, Color.Black); + SharedView.CreateText( + graphics, + width + 1, + height * i, + width - 1, + height, + this.Component.Value.Items[i], + viewAttributes); + } + } + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/SystemColorView.cs b/source/Menu/View/SystemColorView.cs new file mode 100644 index 00000000..9a4f500b --- /dev/null +++ b/source/Menu/View/SystemColorView.cs @@ -0,0 +1,367 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System; + using System.ComponentModel.Composition; + using System.Drawing; + using System.Drawing.Drawing2D; + + using LeagueSharp.Common.Properties; + + using SharpDX; + using SharpDX.Menu; + + using Color = System.Drawing.Color; + using Rectangle = System.Drawing.Rectangle; + + /// + /// The component view. + /// + [Export(typeof(IView))] + [ExportMetadata("Service", typeof(MenuItem))] + public class SystemColorView : View + { + #region Fields + + private Render.Sprite sprite; + + private bool updateContext; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The component. + /// + public SystemColorView(IMenuComponent component) + { + this.Component = component as MenuItem; + this.CreateContext(); + } + + /// + /// Initializes a new instance of the class. + /// + [ImportingConstructor] + internal SystemColorView() + { + } + + /// + /// Finalizes an instance of the class. + /// + ~SystemColorView() + { + this.sprite?.Bitmap?.Dispose(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the color picker instance. + /// + public static SystemColorView ColorPickerInstance { get; set; } + + /// + /// Gets the component. + /// + public MenuItem Component { get; } + + #endregion + + #region Properties + + private static Render.Sprite Spectrum { get; set; } + + private bool AlphaPickClick { get; set; } + + private bool ColorPickClick { get; set; } + + private bool IsPickingColor { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Closes the color picker. + /// + public void Close() + { + this.IsPickingColor = false; + this.updateContext = true; + this.ColorPickClick = this.AlphaPickClick = false; + } + + /// + public override IView CreateView(IMenuComponent component) + { + return new SystemColorView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + if (this.updateContext) + { + this.CreateContext(); + this.updateContext = false; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); + + if (this.IsPickingColor) + { + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + Spectrum.Position = new Vector2(this.Component.Position.X + width + 5, this.Component.Position.Y + 5); + Spectrum.OnEndScene(); + } + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + if (this.Component == null || !this.Component.IsVisible) + { + return; + } + + var cursor = Cursor.GetCursorPos(); + switch (message) + { + case (uint)WindowsMessages.WM_LBUTTONDOWN: + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + if (Utils.IsUnderRectangle( + cursor, + this.Component.Position.X + width - height, + this.Component.Position.Y, + height, + height)) + { + if (!this.IsPickingColor) + { + DxColorView.ColorPickerInstance?.Close(); + CircleView.ColorPickerInstance?.Close(); + ColorPickerInstance?.Close(); + ColorPickerInstance = this; + } + + this.IsPickingColor = !this.IsPickingColor; + this.updateContext = true; + } + + if (this.IsPickingColor) + { + if (this.ColorPickClick || this.AlphaPickClick) + { + break; + } + + if (Utils.IsUnderRectangle( + cursor, + Spectrum.Position.X, + Spectrum.Position.Y, + Spectrum.Width, + Spectrum.Height)) + { + this.ColorPickClick = true; + this.UpdateColorPicker(cursor); + } + else if (Utils.IsUnderRectangle( + cursor, + Spectrum.Position.X, + Spectrum.Position.Y + Spectrum.Height, + Spectrum.Width, + 15)) + { + this.AlphaPickClick = true; + this.UpdateColorPicker(cursor); + } + } + + break; + + case (uint)WindowsMessages.WM_LBUTTONUP: + if (this.IsPickingColor) + { + this.ColorPickClick = this.AlphaPickClick = false; + } + + break; + + case (uint)WindowsMessages.WM_MOUSEMOVE: + if (this.IsPickingColor) + { + this.UpdateColorPicker(cursor); + } + + break; + } + } + + #endregion + + #region Methods + + private static void CreateGlobalContext() + { + if (Spectrum == null) + { + Spectrum = new Render.Sprite(Resources.spectrum_chart, default(Vector2)) + { Scale = new Vector2(0.5f, 0.5f) }; + } + } + + private static GraphicsPath RoundedRect(Rectangle bounds, int radius) + { + var diameter = radius * 2; + var size = new Size(diameter, diameter); + var arc = new Rectangle(bounds.Location, size); + var path = new GraphicsPath(); + + if (radius == 0) + { + path.AddRectangle(bounds); + return path; + } + + path.AddArc(arc, 180, 90); + arc.X = bounds.Right - diameter; + path.AddArc(arc, 270, 90); + arc.Y = bounds.Bottom - diameter; + path.AddArc(arc, 0, 90); + arc.X = bounds.Left; + path.AddArc(arc, 90, 90); + + path.CloseFigure(); + return path; + } + + private void CreateContext() + { + CreateGlobalContext(); + + var height = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentHeight ?? 32f; + var width = Instances.MenuManager?.MenuFactory?.MenuController?.ComponentWidth ?? 180f; + var title = this.Component.DisplayName; + var viewAttributes = new ViewAttributes(this); + + var bitmap = new Bitmap( + (int)Math.Round(width) + 1 + Spectrum.Width + 25, + (int)Math.Round(height) + 1 + Spectrum.Height + 25); + using (var graphics = Graphics.FromImage(bitmap)) + { + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, 0, 0, width - height - 5, height, title, viewAttributes); + SharedView.CreateBox(graphics, width - height, 0, height, height, this.Component.Value); + + if (this.IsPickingColor) + { + SharedView.CreateBackgroundView(graphics, width, 0, Spectrum.Width + 8, Spectrum.Height + 25); + using (var pen = new Pen(Color.FromArgb(51, 200, 203, 203))) + { + var startX = (int)width + 5; + var startY = Spectrum.Height + 10; + var alphaWidth = Spectrum.Width; + var alphaHeight = 10; + var alphaValue = this.Component.Value.A; + + var valuePercentage = 100 * alphaValue / 255; + var alphaX = (int)Math.Round(startX + 3 + ((valuePercentage * (alphaWidth - 3)) / 100f)); + + using (var path = RoundedRect(new Rectangle(startX, startY, alphaWidth, alphaHeight), 5)) + { + graphics.FillPath(new SolidBrush(Color.FromArgb(150, 200, 203, 203)), path); + graphics.DrawPath(pen, path); + } + + using (var path = RoundedRect(new Rectangle(startX, startY, alphaX - startX, alphaHeight), 5)) + { + graphics.FillPath(new SolidBrush(Color.FromArgb(150, 12, 125, 141)), path); + graphics.DrawPath(pen, path); + } + + var rect = new Rectangle(alphaX - (34 / 2), startY - 3, 34, alphaHeight + 5); + using (var path = RoundedRect(rect, 5)) + { + graphics.FillPath(new SolidBrush(Color.FromArgb(255, 0, 0, 0)), path); + graphics.DrawPath(pen, path); + } + + SharedView.CreateText( + graphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + alphaValue.ToString(), + new ViewAttributes(null)); + } + } + } + + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; + } + + this.sprite.UpdateTextureBitmap(bitmap); + } + + private void UpdateColorPicker(Vector2 cursor) + { + if (this.ColorPickClick) + { + var cursorX = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * cursor.X); + var cursorY = (int)Math.Round(((float)Spectrum.Bitmap.Height / Spectrum.Height) * cursor.Y); + var bitmapX = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * Spectrum.X); + var bitmapY = (int)Math.Round(((float)Spectrum.Bitmap.Width / Spectrum.Width) * Spectrum.Y); + + var x = Math.Max(0, Math.Min(Spectrum.Bitmap.Width - 1, cursorX - bitmapX)); + var y = Math.Max(0, Math.Min(Spectrum.Bitmap.Height - 1, cursorY - bitmapY)); + + var c = Spectrum.Bitmap.GetPixel(x, y); + this.Component.Value = Color.FromArgb(this.Component.Value.A, c.R, c.G, c.B); + this.updateContext = true; + } + else if (this.AlphaPickClick) + { + var cursorValue = 0 + ((Cursor.GetCursorPos().X - Spectrum.Position.X) * (255 - 0) / Spectrum.Width); + var value = Math.Max(0, Math.Min(255, (int)cursorValue)); + var c = this.Component.Value; + this.Component.Value = Color.FromArgb(value, c.R, c.G, c.B); + this.updateContext = true; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Menu/View/ViewAttributes.cs b/source/Menu/View/ViewAttributes.cs new file mode 100644 index 00000000..24ff0ba7 --- /dev/null +++ b/source/Menu/View/ViewAttributes.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.View +{ + using System.Drawing; + + using SharpDX.Menu; + + /// + /// The view attributes localizer. + /// + public class ViewAttributes : IViewAttributes + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The view. + /// + public ViewAttributes(IView view) + { + this.FontStyle = view?.GetAttribute(typeof(FontStyle).ToString()) ?? FontStyle.Regular; + this.FontBrush = view?.GetAttribute(typeof(Brush).ToString()) ?? Brushes.White; + this.FontName = view?.GetAttribute("FontName") ?? "Tahoma"; + } + + #endregion + + #region Public Properties + + /// + public Brush FontBrush { get; set; } + + /// + public string FontName { get; set; } + + /// + public FontStyle FontStyle { get; set; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Minion/FarmLocation.cs b/source/Minion/FarmLocation.cs new file mode 100644 index 00000000..a8218a6e --- /dev/null +++ b/source/Minion/FarmLocation.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Provides a minion AI manager. + /// + public partial class MinionManager + { + /// + /// Farm location. + /// + public struct FarmLocation + { + #region Fields + + /// + /// The Minions Hit at position. + /// + public int MinionsHit; + + /// + /// The position. + /// + public Vector2 Position; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the struct. + /// + /// + /// The position. + /// + /// + /// The hit count. + /// + public FarmLocation(Vector2 position, int hit) + { + this.Position = position; + this.MinionsHit = hit; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Minion/JungleType.cs b/source/Minion/JungleType.cs new file mode 100644 index 00000000..57447722 --- /dev/null +++ b/source/Minion/JungleType.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The jungle mob types. + /// + public enum JungleType + { + /// + /// The unknown type. + /// + Unknown, + + /// + /// The small type. + /// + Small, + + /// + /// The large type. + /// + Large, + + /// + /// The legendary type. + /// + Legendary + } +} \ No newline at end of file diff --git a/source/Minion/LaneType.cs b/source/Minion/LaneType.cs new file mode 100644 index 00000000..406016d0 --- /dev/null +++ b/source/Minion/LaneType.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The lane type. + /// + public enum LaneType + { + /// + /// The bottom lane. + /// + Bottom, + + /// + /// The mid lane. + /// + Mid, + + /// + /// The top lane. + /// + Top + } +} \ No newline at end of file diff --git a/source/Minion/MinionInfo.cs b/source/Minion/MinionInfo.cs new file mode 100644 index 00000000..053ab002 --- /dev/null +++ b/source/Minion/MinionInfo.cs @@ -0,0 +1,144 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Linq; + using System.Text.RegularExpressions; + + /// + /// Provides information about the minion. + /// + public class MinionInfo + { + #region Static Fields + + private static readonly string[] LargeNameRegex = + { + "SRU_Murkwolf[0-9.]{1,}", "SRU_Gromp", "SRU_Blue[0-9.]{1,}", + "SRU_Razorbeak[0-9.]{1,}", "SRU_Red[0-9.]{1,}", + "SRU_Krug[0-9]{1,}" + }; + + private static readonly string[] LegendaryNameRegex = { "SRU_Dragon", "SRU_Baron", "SRU_RiftHerald" }; + + private static readonly string[] SmallNameRegex = { "SRU_[a-zA-Z](.*?)Mini", "Sru_Crab" }; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The minion. + /// + public MinionInfo(Obj_AI_Minion minion) + { + this.Instance = minion; + if (!minion.IsValid || minion.IsDead) + { + return; + } + + this.IsMinion = minion.Name.Contains("Minion"); + this.IsWard = minion.Name.Contains("Ward"); + this.JungleType = SmallNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex)) + ? JungleType.Small + : LargeNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex)) + ? JungleType.Large + : LegendaryNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex)) + ? JungleType.Legendary + : JungleType.Unknown; + this.IsJungleMob = this.JungleType != JungleType.Unknown; + this.IsComponent = !this.IsMinion && !this.IsWard && !this.IsJungleMob; + this.IsJungleBuff = minion.CharData.BaseSkinName.Equals("SRU_Blue") + || minion.CharData.BaseSkinName.Equals("SRU_Red"); + + if (this.IsMinion) + { + this.Level = minion.MinionLevel; + if (this.Level == 0) + { + var levels = ObjectManager.Get().Where(h => h.Team == minion.Team).Select(s => s.Level).ToArray(); + this.Level = levels.Any() ? (int)Math.Round(levels.Average()) : 1; + } + + var regex = + new Regex(@"Minion_T(?\d+)+L(?\d+)+S(?\d+)+N(?\d+)").Match(minion.Name); + if (!regex.Success) + { + return; + } + + this.Lane = (LaneType)Convert.ToInt32(regex.Groups["Lane"].Value); + this.Wave = Convert.ToInt32(regex.Groups["Wave"].Value); + this.Index = Convert.ToInt32(regex.Groups["Index"].Value); + } + } + + #endregion + + #region Public Properties + + /// + /// Gets the index. + /// + public int Index { get; } + + /// + /// Gets the minion instance. + /// + public Obj_AI_Minion Instance { get; } + + /// + /// Gets a value indicating whether the minion is a component. + /// + public bool IsComponent { get; } + + /// + /// Gets a value indicating whether the jungle mob is a buff carrier. + /// + public bool IsJungleBuff { get; } + + /// + /// Gets a value indicating whether the minion is a jungle mob. + /// + public bool IsJungleMob { get; } + + /// + /// Gets a value indicating whether the minion is a minion AI. + /// + public bool IsMinion { get; } + + /// + /// Gets a value indicating whether the minion is a ward. + /// + public bool IsWard { get; } + + /// + /// Gets the jungle type. + /// + public JungleType JungleType { get; } + + /// + /// Gets the lane. + /// + public LaneType Lane { get; } + + /// + /// Gets the minion level. + /// + public int Level { get; } + + /// + /// Gets the wave. + /// + public int Wave { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Minion/MinionManager.cs b/source/Minion/MinionManager.cs new file mode 100644 index 00000000..34616535 --- /dev/null +++ b/source/Minion/MinionManager.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + + /// + /// Provides a minion AI manager. + /// + [Export(typeof(MinionManager))] + public partial class MinionManager + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MinionManager() + { + GameObject.OnCreate += this.OnCreate; + GameObject.OnDelete += this.OnDelete; + CustomEvents.Game.OnGameLoad += this.OnLoad; + } + + #endregion + + #region Public Properties + + /// + /// Gets the minion info collection. + /// + public IDictionary MinionInfos { get; } = new Dictionary(); + + #endregion + + #region Methods + + private void OnCreate(GameObject sender, EventArgs args) + { + var minion = sender as Obj_AI_Minion; + if (minion != null && !this.MinionInfos.ContainsKey(minion.NetworkId)) + { + this.MinionInfos.Add(minion.NetworkId, new MinionInfo(minion)); + } + } + + private void OnDelete(GameObject sender, EventArgs args) + { + var minion = sender as Obj_AI_Minion; + if (minion != null && this.MinionInfos.ContainsKey(minion.NetworkId)) + { + this.MinionInfos.Remove(minion.NetworkId); + } + } + + private void OnLoad(EventArgs eventArgs) + { + foreach (var obj in ObjectManager.Get()) + { + if (!this.MinionInfos.ContainsKey(obj.NetworkId)) + { + this.MinionInfos.Add(obj.NetworkId, new MinionInfo(obj)); + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Minion/MinionManagerAdapter.cs b/source/Minion/MinionManagerAdapter.cs new file mode 100644 index 00000000..ac03b0cc --- /dev/null +++ b/source/Minion/MinionManagerAdapter.cs @@ -0,0 +1,469 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + + using JetBrains.Annotations; + + using log4net; + + using PlaySharp.Toolkit.Logging; + + using SharpDX; + + /// + /// Provides a minion AI manager. + /// + public partial class MinionManager + { + #region Public Properties + + /// + /// Gets the instance. + /// + public static MinionManager Instance => Instances.MinionManager; + + #endregion + + #region Properties + + private static ILog Log { get; } = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #endregion + + #region Public Methods and Operators + + /// + /// Calculates the best position, with the maximum amount of minion hits for a circular farm. + /// + /// + /// The minion positions. + /// + /// + /// The widht. + /// + /// + /// The range. + /// + /// + /// The max convex hull usage. + /// + /// + /// The . + /// + public static FarmLocation GetBestCircularFarmLocation( + List positions, + float width, + float range, + int useConvexHullMax = 9) + { + var result = default(Vector2); + var minionCount = 0; + var startPos = ObjectManager.Player.ServerPosition.To2D(); + + if (positions.Any()) + { + if (positions.Count <= useConvexHullMax) + { + var combinations = GetCombinations(positions); + foreach (var combination in combinations) + { + if (combination.Any()) + { + var circle = MEC.GetMec(combination); + if (circle.Radius <= width && circle.Center.InRange(startPos, range, true)) + { + return new FarmLocation(circle.Center, combination.Count); + } + } + } + } + else + { + foreach (var pos in positions) + { + if (pos.InRange(startPos, range, true)) + { + var count = positions.Count(p => pos.InRange(p, width, true)); + if (count >= minionCount) + { + result = pos; + minionCount = count; + } + } + } + } + } + + return new FarmLocation(result, minionCount); + } + + /// + /// Calculates the best position, with the maximum amount of minion hits for a linear farm. + /// + /// + /// The minion positions. + /// + /// + /// The width. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static FarmLocation GetBestLineFarmLocation(List positions, float width, float range) + { + var result = default(Vector2); + var minionCount = 0; + var startPos = ObjectManager.Player.ServerPosition.To2D(); + + var possiblePositions = new List(); + possiblePositions.AddRange(positions); + + var max = positions.Count; + for (var i = 0; i < max; ++i) + { + for (var j = 0; j < max; ++j) + { + if (positions[j] != positions[i]) + { + possiblePositions.Add((positions[j] + positions[i]) / 2); + } + } + } + + foreach (var pos in possiblePositions) + { + if (pos.InRange(startPos, range, true)) + { + var endPos = startPos + (range * (pos - startPos).Normalized()); + var count = positions.Count(p => p.Distance(startPos, endPos, true, true) <= width * width); + if (count >= minionCount) + { + result = endPos; + minionCount = count; + } + } + } + + return new FarmLocation(result, minionCount); + } + + /// + /// Gets the minion info. + /// + /// + /// The minion. + /// + /// + /// The . + /// + public static MinionInfo GetMinionInfo(Obj_AI_Minion minion) + { + MinionInfo info; + if (Instance != null && Instance.MinionInfos.TryGetValue(minion.NetworkId, out info)) + { + return info; + } + + return null; + } + + /// + /// Allocates a list of minions with the specific request. + /// + /// + /// The from position. + /// + /// + /// The range from the position. + /// + /// + /// The minion type. + /// + /// + /// The minion team. + /// + /// + /// The minion order. + /// + /// + /// The . + /// + [CanBeNull] + public static List GetMinions( + Vector3 from, + float range, + MinionTypes type = MinionTypes.All, + MinionTeam team = MinionTeam.Enemy, + MinionOrderTypes order = MinionOrderTypes.Health) + { + if (Instance == null) + { + Log.Fatal("MinionManager instance is not available."); + return null; + } + + var returnList = new List(); + var allyTeam = ObjectManager.Player.Team; + foreach (var minion in Instance.MinionInfos.Values) + { + if (!minion.Instance.IsValidTarget(range, false, from)) + { + continue; + } + + var mType = minion.Instance.IsMelee; + var mTeam = minion.Instance.Team; + var typePass = false; + var teamPass = false; + + switch (type) + { + case MinionTypes.Melee: + typePass = mType; + break; + case MinionTypes.Ranged: + typePass = !mType; + break; + case MinionTypes.Wards: + typePass = minion.IsWard; + break; + case MinionTypes.All: + typePass = true; + break; + } + + switch (team) + { + case MinionTeam.Ally: + teamPass = mTeam == allyTeam; + break; + case MinionTeam.Enemy: + teamPass = mTeam != allyTeam; + break; + case MinionTeam.Neutral: + teamPass = mTeam == GameObjectTeam.Neutral; + break; + case MinionTeam.All: + teamPass = true; + break; + } + + if (typePass && teamPass) + { + returnList.Add(minion.Instance); + } + } + + switch (order) + { + case MinionOrderTypes.Health: + return returnList.OrderBy(o => o.Health).ToList(); + case MinionOrderTypes.MaxHealth: + return returnList.OrderByDescending(o => o.MaxHealth).ToList(); + case MinionOrderTypes.None: + return returnList; + default: + Log.Warn("Order is not recongized."); + return returnList; + } + } + + /// + /// Allocates a list of minions with the specific request. + /// + /// + /// The range from the position. + /// + /// + /// The minion type. + /// + /// + /// The minion team. + /// + /// + /// The minion order. + /// + /// + /// The . + /// + [CanBeNull] + public static List GetMinions( + float range, + MinionTypes type = MinionTypes.All, + MinionTeam team = MinionTeam.Enemy, + MinionOrderTypes order = MinionOrderTypes.Health) + => GetMinions(ObjectManager.Player.ServerPosition, range, type, team, order); + + /// + /// Gets the minions predicted positions. + /// + /// + /// The minions. + /// + /// + /// The delay. + /// + /// + /// The width. + /// + /// + /// The speed. + /// + /// + /// The from position. + /// + /// + /// The max range from position. + /// + /// + /// A value indciating whether to include collision. + /// + /// + /// The skillshot type. + /// + /// + /// The range check from position. + /// + /// + /// The . + /// + public static List GetMinionsPredictedPositions( + [NotNull] List minions, + float delay, + float width, + float speed, + Vector3 from, + float range, + bool collision, + SkillshotType type, + Vector3 rangeCheckFrom = default(Vector3)) + { + from = !from.IsZero ? from : ObjectManager.Player.ServerPosition; + + return (from minion in minions + select + Prediction.GetPrediction( + new PredictionInput + { + Unit = minion, Delay = delay, Radius = width, Speed = speed, From = @from, + Range = range, Collision = collision, Type = type, RangeCheckFrom = rangeCheckFrom + }) + into pos + where pos.Hitchance >= HitChance.High + select pos.UnitPosition.To2D()).ToList(); + } + + /// + /// Determines if the minion is a jungle mob. + /// + /// + /// The minion. + /// + /// + /// The . + /// + public static bool IsJungleMob(Obj_AI_Minion minion) + { + MinionInfo info; + if (Instance != null && Instance.MinionInfos.TryGetValue(minion.NetworkId, out info)) + { + return info.IsJungleMob; + } + + return false; + } + + /// + /// Determines if the minion is part of minion AI. + /// + /// + /// The minion. + /// + /// + /// A value indicating whether to include wards. + /// + /// + /// The . + /// + public static bool IsMinion(Obj_AI_Minion minion, bool includeWards = false) + { + if (minion == null) + { + return false; + } + + MinionInfo info; + if (Instance != null && Instance.MinionInfos.TryGetValue(minion.NetworkId, out info)) + { + return info.IsMinion || (includeWards && info.IsWard); + } + + return minion.Name.Contains("Minion") || (includeWards && IsWard(minion)); + } + + /// + /// Determines if the minion is a ward by skin name. + /// + /// + /// The base skin name. + /// + /// + /// The . + /// + public static bool IsWard(string baseSkinName) + { + return baseSkinName.Contains("ward"); + } + + /// + /// Determines if the minion is a ward. + /// + /// + /// The minion. + /// + /// + /// The . + /// + public static bool IsWard(Obj_AI_Minion minion) + { + if (minion == null) + { + return false; + } + + MinionInfo info; + if (Instance != null && Instance.MinionInfos.TryGetValue(minion.NetworkId, out info)) + { + return info.IsWard; + } + + return minion.Name.Contains("Ward") && minion.IsHPBarRendered; + } + + #endregion + + #region Methods + + private static IEnumerable> GetCombinations(IReadOnlyCollection values) + { + var collection = new List>(); + for (var index = 0; index < (1 << values.Count); ++index) + { + collection.Add(values.Where((t, i) => (index & (1 << i)) == 0).ToList()); + } + + return collection; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Minion/MinionOrderTypes.cs b/source/Minion/MinionOrderTypes.cs new file mode 100644 index 00000000..7d292489 --- /dev/null +++ b/source/Minion/MinionOrderTypes.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Minion order type. + /// + public enum MinionOrderTypes + { + /// + /// No order. + /// + None, + + /// + /// Order by health. + /// + Health, + + /// + /// Order by max health. + /// + MaxHealth + } +} \ No newline at end of file diff --git a/source/Minion/MinionTeam.cs b/source/Minion/MinionTeam.cs new file mode 100644 index 00000000..edeb628f --- /dev/null +++ b/source/Minion/MinionTeam.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + /// + /// Minion team. + /// + public enum MinionTeam + { + /// + /// Neutral. + /// + Neutral, + + /// + /// Ally. + /// + Ally, + + /// + /// Enemy. + /// + Enemy, + + /// + /// Not Ally. + /// + [Obsolete] + NotAlly, + + /// + /// Not Ally for Enemy. + /// + [Obsolete] + NotAllyForEnemy, + + /// + /// All. + /// + All + } +} \ No newline at end of file diff --git a/source/Minion/MinionTypes.cs b/source/Minion/MinionTypes.cs new file mode 100644 index 00000000..6b541190 --- /dev/null +++ b/source/Minion/MinionTypes.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Minion types. + /// + public enum MinionTypes + { + /// + /// Ranged. + /// + Ranged, + + /// + /// Melee. + /// + Melee, + + /// + /// Wards. + /// + Wards, + + /// + /// All. + /// + All, + } +} \ No newline at end of file diff --git a/source/Native/BetterWebClient.cs b/source/Native/BetterWebClient.cs new file mode 100644 index 00000000..7b2515eb --- /dev/null +++ b/source/Native/BetterWebClient.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Net; + + /// + /// A better web client. + /// + public class BetterWebClient : WebClient + { + #region Fields + + private WebRequest request; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The cookie container. + /// + /// + /// A value indicating whether to auto redirect. + /// + public BetterWebClient(CookieContainer cookieContainer, bool autoRedirect = true) + { + this.CookieContainer = cookieContainer ?? new CookieContainer(); + this.AutoRedirect = autoRedirect; + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether to auto redirect. + /// + public bool AutoRedirect { get; set; } + + /// + /// Gets or sets the cookie container. + /// + public CookieContainer CookieContainer { get; set; } + + /// + /// Gets the cookies. + /// + public string Cookies => this.GetHeaderValue("Set-Cookie"); + + /// + /// Gets the version. + /// + public string Kappa { get; } = "version5"; + + /// + /// Gets the location. + /// + public string Location => this.GetHeaderValue("Location"); + + /// + /// Gets the status code. + /// + public HttpStatusCode StatusCode + { + get + { + var result = HttpStatusCode.BadRequest; + + if (this.request != null) + { + var response = this.GetWebResponse(this.request) as HttpWebResponse; + if (response != null) + { + result = response.StatusCode; + } + } + + return result; + } + } + + #endregion + + #region Public Methods and Operators + + /// + /// Gets the header value. + /// + /// + /// The header. + /// + /// + /// The . + /// + public string GetHeaderValue(string header) + { + string result = null; + + if (this.request != null) + { + var response = this.GetWebResponse(this.request) as HttpWebResponse; + if (response != null) + { + result = response.Headers[header]; + } + } + + return result; + } + + #endregion + + #region Methods + + /// + protected override WebRequest GetWebRequest(Uri address) + { + this.request = base.GetWebRequest(address); + + var httpRequest = this.request as HttpWebRequest; + + if (httpRequest != null) + { + httpRequest.AllowAutoRedirect = this.AutoRedirect; + httpRequest.CookieContainer = this.CookieContainer; + httpRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; + } + + return this.request; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Native/Config.cs b/source/Native/Config.cs new file mode 100644 index 00000000..d7a9c75f --- /dev/null +++ b/source/Native/Config.cs @@ -0,0 +1,137 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.IO; + using System.Reflection; + using LeagueSharp.Sandbox; + using log4net; + using PlaySharp.Toolkit.Logging; + + /// + /// The platform config. + /// + public static class Config + { + #region Static Fields + + private static readonly ILog Log = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private static string appDataDirectory; + + private static string selectedLanguage; + + private static byte showMenuPressKey; + + private static byte showMenuToggleKey; + + #endregion + + #region Public Properties + + /// + /// Gets the app data directory. + /// + public static string AppDataDirectory + => + appDataDirectory + ?? (appDataDirectory = + Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "LS" + Environment.UserName.GetHashCode().ToString("X"))); + + /// + /// Gets the selected language. + /// + public static string SelectedLanguage + { + get + { + if (selectedLanguage == null) + { + try + { + selectedLanguage = SandboxConfig.SelectedLanguage; + if (selectedLanguage == "Traditional-Chinese") + { + selectedLanguage = "Chinese"; + } + + if (selectedLanguage.StartsWith("zh")) + { + selectedLanguage = "Chinese"; + } + } + catch + { + selectedLanguage = string.Empty; + Log.Error("Unable to get the menu language."); + } + } + + return selectedLanguage; + } + } + + /// + /// Gets the show menu press key. + /// + public static byte ShowMenuPressKey + { + get + { + if (showMenuPressKey == 0) + { + try + { + showMenuPressKey = (byte)SandboxConfig.MenuKey; + showMenuPressKey = showMenuPressKey == 0 ? (byte)16 : showMenuPressKey; + showMenuPressKey = Utils.FixVirtualKey(showMenuPressKey); + + Log.Info($"Menu press key set to {showMenuPressKey}"); + } + catch + { + showMenuPressKey = 16; + Log.Error("Unable to get menu press key."); + } + } + + return showMenuPressKey; + } + } + + /// + /// Gets the show menu toggle key. + /// + public static byte ShowMenuToggleKey + { + get + { + if (showMenuToggleKey == 0) + { + try + { + showMenuToggleKey = (byte)SandboxConfig.MenuToggleKey; + showMenuToggleKey = showMenuToggleKey == 0 ? (byte)120 : showMenuToggleKey; + showMenuToggleKey = Utils.FixVirtualKey(showMenuToggleKey); + + Log.Info($"Menu toggle key set to {showMenuToggleKey}"); + } + catch + { + showMenuToggleKey = 120; + Log.Error("Unable to get menu toggle key."); + } + } + + return showMenuToggleKey; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Native/Hacks.cs b/source/Native/Hacks.cs new file mode 100644 index 00000000..da3fc89b --- /dev/null +++ b/source/Native/Hacks.cs @@ -0,0 +1,181 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + /// + /// Core hacks. + /// + internal class Hacks + { + #region Public Properties + + /// + /// Gets or sets a value indicating whether the anti afk hack is enabled. + /// + public static bool AntiAfk + { + get + { + return LeagueSharp.Hacks.AntiAFK; + } + + set + { + if (AntiAfk != value) + { + LeagueSharp.Hacks.AntiAFK = value; + } + } + } + + /// + /// Gets or sets a value indicating whether to disable the drawings. + /// + public static bool DisableDrawings + { + get + { + return LeagueSharp.Hacks.DisableDrawings; + } + + set + { + if (DisableDrawings != value) + { + LeagueSharp.Hacks.DisableDrawings = value; + } + } + } + + /// + /// Gets or sets a value indicating whether the say function is disabled. + /// + public static bool DisableSay + { + get + { + return LeagueSharp.Hacks.DisableSay; + } + + set + { + if (DisableSay != value) + { + LeagueSharp.Hacks.DisableSay = value; + } + } + } + + /// + /// Gets or sets a value indicating whether to show tower ranges. + /// + public static bool TowerRanges + { + get + { + return LeagueSharp.Hacks.TowerRanges; + } + + set + { + if (TowerRanges != value) + { + LeagueSharp.Hacks.TowerRanges = value; + } + } + } + + #endregion + + #region Properties + + private static MenuItem DisableDrawing { get; set; } + + private static Menu Menu { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Initializes the hacks. + /// + /// + /// The common menu. + /// + public static void Initialize(Menu menu) + { + if (menu == null) + { + throw new ArgumentNullException(nameof(menu)); + } + + Menu = new Menu("Hacks", "Hacks"); + + Menu.AddItem(CreateHackItem("antiafk", "Anti-AFK")); + Menu.AddItem(DisableDrawing = CreateHackItem("disable_drawing", "Disable Drawing")); + Menu.AddItem(CreateHackItem("disable_chat", "Disable L# Send Chat")); + Menu.AddItem(CreateHackItem("show_tower_range", "Show Tower Range")); + + menu.AddSubMenu(Menu); + + Game.OnWndProc += OnWndProc; + } + + #endregion + + #region Methods + + private static MenuItem CreateHackItem(string name, string displayName) + { + var item = new MenuItem(name, displayName).SetValue(false); + item.ValueChanged += OnValueChanged; + return item; + } + + private static void OnValueChanged(object sender, OnValueChangeEventArgs onValueChangeEventArgs) + { + var item = sender as MenuItem; + if (item == null) + { + return; + } + + switch (item.Name) + { + case "antiafk": + AntiAfk = onValueChangeEventArgs.GetNewValue(); + break; + case "disable_drawing": + DisableDrawings = onValueChangeEventArgs.GetNewValue(); + break; + case "disable_chat": + DisableSay = onValueChangeEventArgs.GetNewValue(); + break; + case "show_tower_range": + TowerRanges = onValueChangeEventArgs.GetNewValue(); + break; + } + } + + private static void OnWndProc(WndEventArgs args) + { + if (!DisableDrawing?.GetValue() ?? true) + { + return; + } + + if ((args.Msg == (uint)WindowsMessages.WM_KEYUP || args.Msg == (uint)WindowsMessages.WM_KEYDOWN) + && args.WParam == Config.ShowMenuPressKey) + { + DisableDrawings = args.Msg != (uint)WindowsMessages.WM_KEYDOWN; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Native/HeroManager.cs b/source/Native/HeroManager.cs new file mode 100644 index 00000000..9b12c58b --- /dev/null +++ b/source/Native/HeroManager.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// Provides cached heroes. + /// + [Export(typeof(HeroManager))] + public class HeroManager + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public HeroManager() + { + this.All = ObjectManager.Get().ToList(); + this.Ally = this.All.FindAll(o => o.IsAlly); + this.Enemy = this.All.FindAll(o => o.IsEnemy); + this.LocalPlayer = this.All.Find(x => x.IsMe); + } + + #endregion + + #region Public Properties + + /// + /// Gets all heroes. + /// + /// + /// All heroes. + /// + public static List AllHeroes => Instance?.All ?? new List(); + + /// + /// Gets the allies. + /// + /// + /// The allies. + /// + public static List Allies => Instance?.Ally ?? new List(); + + /// + /// Gets the enemies. + /// + /// + /// The enemies. + /// + public static List Enemies => Instance?.Enemy ?? new List(); + + /// + /// Gets the instance. + /// + public static HeroManager Instance => Instances.HeroManager; + + /// + /// Gets the Local Player + /// + public static Obj_AI_Hero Player => Instance.LocalPlayer; + + /// + /// Gets all of the heroes. + /// + public List All { get; } + + /// + /// Gets all of the ally heroes. + /// + public List Ally { get; } + + /// + /// Gets all of the enemies. + /// + public List Enemy { get; } + + /// + /// Gets the local player + /// + public Obj_AI_Hero LocalPlayer { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Native/MultiLanguage.cs b/source/Native/MultiLanguage.cs new file mode 100644 index 00000000..c11cbac4 --- /dev/null +++ b/source/Native/MultiLanguage.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Reflection; + using System.Resources; + using System.Web.Script.Serialization; + + using LeagueSharp.Common.Properties; + + using log4net; + + using PlaySharp.Toolkit.Logging; + + /// + /// Provides multi-lingual strings. + /// + public partial class MultiLanguage + { + #region Constructors and Destructors + + /// + /// Initializes static members of the class. + /// + static MultiLanguage() + { + LoadLanguage(Config.SelectedLanguage); + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The language. + /// + public MultiLanguage(string language) + { + var lang = + new ResourceManager("LeagueSharp.Common.Properties.Resources", typeof(Resources).Assembly).GetString( + language + "Json"); + if (string.IsNullOrEmpty(lang)) + { + return; + } + + try + { + this.LanguageTranslations = new JavaScriptSerializer().Deserialize>(lang); + } + catch (Exception) + { + this.Log.Error($"Unable to load language {language}."); + } + } + + #endregion + + #region Public Properties + + /// + /// Gets a value indicating whether the multi language translation is valid. + /// + public bool IsValid => this.LanguageTranslations != null; + + #endregion + + #region Properties + + private IDictionary LanguageTranslations { get; } + + private ILog Log { get; } = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #endregion + + #region Public Methods and Operators + + /// + /// Translates the text. + /// + /// + /// The text. + /// + /// + /// The translated text, if available. + /// + public string Translate(string text) + { + string value; + return this.LanguageTranslations.TryGetValue(text.ToLower(), out value) ? value : text; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Native/MultiLanguageAdapter.cs b/source/Native/MultiLanguageAdapter.cs new file mode 100644 index 00000000..6ba33739 --- /dev/null +++ b/source/Native/MultiLanguageAdapter.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.Linq; + + using JetBrains.Annotations; + + /// + /// Provides multi language support. + /// + public partial class MultiLanguage + { + #region Properties + + /// + /// Gets the translations. + /// + private static IDictionary Translations { get; } = + new Dictionary(); + + #endregion + + #region Public Methods and Operators + + /// + /// Translates the text into the selected language. + /// + /// + /// The text. + /// + /// + /// The language to translate to, null for default. + /// + /// + /// The . + /// + public static string _(string text, [CanBeNull] string language = null) + { + if (string.IsNullOrEmpty(language)) + { + return Translations.Values.FirstOrDefault()?.Translate(text) ?? text; + } + + MultiLanguage value; + return Translations.TryGetValue(language, out value) ? value.Translate(text) : null; + } + + /// + /// Loads the language. + /// + /// + /// The language name. + /// + /// + /// The . + /// + public static bool LoadLanguage(string languageName) + { + var translation = new MultiLanguage(languageName); + if (translation.IsValid) + { + Translations.Add(languageName, translation); + return true; + } + + return false; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Native/Shared.cs b/source/Native/Shared.cs new file mode 100644 index 00000000..fd14dc1c --- /dev/null +++ b/source/Native/Shared.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.ServiceModel; + + /// + /// The shared utility, assists in sharing a class across assemblies. + /// + public static class Shared + { + #region Public Methods and Operators + + /// + /// Gets the interface. + /// + /// + /// The type of the interface type. + /// + /// + /// The . + /// + /// + /// Failed to connect to assembly pipe for Common.Shared communication. The targetted assembly + /// may not be loaded yet. Desired interface: + typeof(InterfaceType).Name + /// + public static TInterfaceType GetInterface() + where TInterfaceType : class + { + try + { + return + new ChannelFactory( + new NetNamedPipeBinding(), + new EndpointAddress("net.pipe://localhost/" + typeof(TInterfaceType).Name)).CreateChannel(); + } + catch (Exception e) + { + throw new Exception( + "Failed to connect to assembly pipe for Common.Shared communication. The targetted assembly may not be loaded yet. Desired interface: " + + typeof(TInterfaceType).Name, + e); + } + } + + /// + /// Shares the interface. + /// + /// + /// The type of the implementation type. + /// + /// + /// A value indicating whether the interface is open. + /// + /// + /// The . + /// + public static ServiceHost ShareInterface(bool open = true) + { + var host = new ServiceHost(typeof(TImplementationType), new Uri("net.pipe://localhost")); + + host.AddServiceEndpoint( + typeof(TImplementationType).GetInterfaces()[0], + new NetNamedPipeBinding(), + typeof(TImplementationType).GetInterfaces()[0].Name); + + if (open) + { + host.Open(); + } + + return host; + } + + #endregion + } +} \ No newline at end of file diff --git a/AutoLevel.cs b/source/Old/AutoLevel.cs similarity index 100% rename from AutoLevel.cs rename to source/Old/AutoLevel.cs diff --git a/CustomizableAntiGapcloser.cs b/source/Old/CustomizableAntiGapcloser.cs similarity index 100% rename from CustomizableAntiGapcloser.cs rename to source/Old/CustomizableAntiGapcloser.cs diff --git a/Data/ItemData.cs b/source/Old/Data/ItemData.cs similarity index 100% rename from Data/ItemData.cs rename to source/Old/Data/ItemData.cs diff --git a/Data/MasteryData.cs b/source/Old/Data/MasteryData.cs similarity index 100% rename from Data/MasteryData.cs rename to source/Old/Data/MasteryData.cs diff --git a/Data/SpellDatabase.cs b/source/Old/Data/SpellDatabase.cs similarity index 97% rename from Data/SpellDatabase.cs rename to source/Old/Data/SpellDatabase.cs index 17d14c4c..861d1d0b 100644 --- a/Data/SpellDatabase.cs +++ b/source/Old/Data/SpellDatabase.cs @@ -175,8 +175,8 @@ public static Spell MakeSpell(this SpellSlot slot, string championName = "undefi ? spellData.Radius : ((spellData.Width > 0 && spellData.Width < 30000) ? spellData.Width : 30000), Collision = - (spellData.CollisionObjects != null - && spellData.CollisionObjects.Any(obj => obj == CollisionableObjects.Minions)), + spellData.CollisionObjects != null + && spellData.CollisionObjects.Any(obj => obj == CollisionableObjects.Minions), Speed = spellData.MissileSpeed, IsChargedSpell = true, Type = GetSkillshotTypeFromSpellType(spellData.SpellType) }; @@ -192,8 +192,8 @@ public static Spell MakeSpell(this SpellSlot slot, string championName = "undefi ? spellData.Radius : ((spellData.Width > 0 && spellData.Width < 30000) ? spellData.Width : 30000), Collision = - (spellData.CollisionObjects != null - && spellData.CollisionObjects.Any(obj => obj == CollisionableObjects.Minions)), + spellData.CollisionObjects != null + && spellData.CollisionObjects.Any(obj => obj == CollisionableObjects.Minions), Speed = spellData.MissileSpeed, IsSkillshot = true, Type = GetSkillshotTypeFromSpellType(spellData.SpellType) }; diff --git a/FakeClicks.cs b/source/Old/FakeClicks.cs similarity index 98% rename from FakeClicks.cs rename to source/Old/FakeClicks.cs index eb252b50..2f5c11cf 100644 --- a/FakeClicks.cs +++ b/source/Old/FakeClicks.cs @@ -90,7 +90,6 @@ public static bool Enabled /// public static void Initialize() { - CustomEvents.Game.OnGameLoad += Game_OnGameLoad; } public static void Shutdown() @@ -212,7 +211,7 @@ private static void Game_OnGameLoad(EventArgs args) root.AddItem(new MenuItem("Click Mode", "Click Mode")) .SetValue(new StringList(new[] { "Evade, No Cursor Position", "Cursor Position, No Evade" })); - CommonMenu.Instance.AddSubMenu(root); + //TODO: LibraryMenu.InstanceMenu.AddSubMenu(root); player = ObjectManager.Player; diff --git a/HealthPrediction.cs b/source/Old/HealthPrediction.cs similarity index 96% rename from HealthPrediction.cs rename to source/Old/HealthPrediction.cs index 6d07e9f0..c702537e 100644 --- a/HealthPrediction.cs +++ b/source/Old/HealthPrediction.cs @@ -68,8 +68,8 @@ public static float GetHealthPrediction(Obj_AI_Base unit, int time, int delay = && attack.Target.IsValidTarget(float.MaxValue, false) && attack.Target.NetworkId == unit.NetworkId) { var landTime = attack.StartTick + attack.Delay - + 1000 * Math.Max(0, unit.Distance(attack.Source) - attack.Source.BoundingRadius) - / attack.ProjectileSpeed + delay; + + (1000 * Math.Max(0, unit.Distance(attack.Source) - attack.Source.BoundingRadius) + / attack.ProjectileSpeed) + delay; if ( /*Utils.GameTimeTickCount < landTime - delay &&*/ landTime < Utils.GameTimeTickCount + time) { @@ -128,8 +128,8 @@ public static float LaneClearHealthPrediction(Obj_AI_Base unit, int time, int de { if (fromT >= Utils.GameTimeTickCount && (fromT + attack.Delay - + Math.Max(0, unit.Distance(attack.Source) - attack.Source.BoundingRadius) - / attack.ProjectileSpeed < toT)) + + (Math.Max(0, unit.Distance(attack.Source) - attack.Source.BoundingRadius) + / attack.ProjectileSpeed) < toT)) { n++; } @@ -224,9 +224,9 @@ private static void ObjAiBaseOnOnProcessSpellCast(Obj_AI_Base sender, GameObject var attackData = new PredictedDamage( sender, target, - Utils.GameTimeTickCount - Game.Ping / 2, + Utils.GameTimeTickCount - (Game.Ping / 2), sender.AttackCastDelay * 1000, - sender.AttackDelay * 1000 - (sender is Obj_AI_Turret ? 70 : 0), + (sender.AttackDelay * 1000) - (sender is Obj_AI_Turret ? 70 : 0), sender.IsMelee() ? int.MaxValue : (int)args.SData.MissileSpeed, (float)sender.GetAutoAttackDamage(target, true)); ActiveAttacks.Add(sender.NetworkId, attackData); diff --git a/Interrupter.cs b/source/Old/Interrupter.cs similarity index 100% rename from Interrupter.cs rename to source/Old/Interrupter.cs diff --git a/Interrupter2.cs b/source/Old/Interrupter2.cs similarity index 100% rename from Interrupter2.cs rename to source/Old/Interrupter2.cs diff --git a/Items.cs b/source/Old/Items.cs similarity index 100% rename from Items.cs rename to source/Old/Items.cs diff --git a/LastCastedSpell.cs b/source/Old/LastCastedSpell.cs similarity index 100% rename from LastCastedSpell.cs rename to source/Old/LastCastedSpell.cs diff --git a/MapPositions.cs b/source/Old/MapPositions.cs similarity index 100% rename from MapPositions.cs rename to source/Old/MapPositions.cs diff --git a/MenuWrapper.cs b/source/Old/MenuWrapper.cs similarity index 100% rename from MenuWrapper.cs rename to source/Old/MenuWrapper.cs diff --git a/Notifications.cs b/source/Old/Notifications.cs similarity index 98% rename from Notifications.cs rename to source/Old/Notifications.cs index ce728730..406e2268 100644 --- a/Notifications.cs +++ b/source/Old/Notifications.cs @@ -64,7 +64,7 @@ public static Notification AddNotification(string text, int duration = -0x1, boo /// Location public static int GetLocation() { - return 0x55 + 0x1E * NotificationsList.Count; + return 0x55 + (0x1E * NotificationsList.Count); } /// @@ -80,12 +80,12 @@ public static int GetLocation(INotification notification) { if (notification_.Key == guid) { - return 0x55 + 0x1E * i; + return 0x55 + (0x1E * i); } i++; } - return 0x55 + 0x1E * i; + return 0x55 + (0x1E * i); } /// diff --git a/Notifications/INotification.cs b/source/Old/Notifications/INotification.cs similarity index 100% rename from Notifications/INotification.cs rename to source/Old/Notifications/INotification.cs diff --git a/Notifications/Notification.cs b/source/Old/Notifications/Notification.cs similarity index 98% rename from Notifications/Notification.cs rename to source/Old/Notifications/Notification.cs index de3ef803..84cf94c1 100644 --- a/Notifications/Notification.cs +++ b/source/Old/Notifications/Notification.cs @@ -354,8 +354,8 @@ public void OnDraw() this.Font.DrawText( this.sprite, finalText, - rectangle.TopLeft.X + (rectangle.Width - textDimension.Width) / 0x2, - rectangle.TopLeft.Y + (rectangle.Height - textDimension.Height) / 0x2, + rectangle.TopLeft.X + ((rectangle.Width - textDimension.Width) / 0x2), + rectangle.TopLeft.Y + ((rectangle.Height - textDimension.Height) / 0x2), this.TextColor); this.sprite.End(); @@ -574,7 +574,7 @@ public void OnUpdate() var percentT = Math.Min(1, ((float)Utils.GameTimeTickCount - this.moveStartT) / 500); this.position.Y = this.moveStartPosition.Y - + (this.updatePosition.Y - this.moveStartPosition.Y) * percentT; + + ((this.updatePosition.Y - this.moveStartPosition.Y) * percentT); } else { @@ -755,7 +755,7 @@ public bool Show(int newDuration = -0x1) /// Vector2 Array private static Vector2[] GetBorder(float x, float y, float w, float h) { - return new[] { new Vector2(x + w / 0x2, y), new Vector2(x + w / 0x2, y + h) }; + return new[] { new Vector2(x + (w / 0x2), y), new Vector2(x + (w / 0x2), y + h) }; } /// diff --git a/ObjectHandler.cs b/source/Old/ObjectHandler.cs similarity index 100% rename from ObjectHandler.cs rename to source/Old/ObjectHandler.cs diff --git a/Orbwalking.cs b/source/Old/Orbwalking.cs similarity index 96% rename from Orbwalking.cs rename to source/Old/Orbwalking.cs index 36367755..e89f683c 100644 --- a/Orbwalking.cs +++ b/source/Old/Orbwalking.cs @@ -172,7 +172,7 @@ static Orbwalking() t += (int)Math.Min(ObjectManager.Player.Distance(_lastTarget) / 1.5f, 0.6f); } - LastAATick = Utils.GameTimeTickCount - Game.Ping / 2 + t; + LastAATick = Utils.GameTimeTickCount - (Game.Ping / 2) + t; } }; } @@ -301,8 +301,8 @@ public static bool CanAttack() { if (Player.ChampionName == "Graves") { - var attackDelay = 1.0740296828d * 1000 * Player.AttackDelay - 716.2381256175d; - if (Utils.GameTimeTickCount + Game.Ping / 2 + 25 >= LastAATick + attackDelay + var attackDelay = (1.0740296828d * 1000 * Player.AttackDelay) - 716.2381256175d; + if (Utils.GameTimeTickCount + (Game.Ping / 2) + 25 >= LastAATick + attackDelay && Player.HasBuff("GravesBasicAttackAmmo1")) { return true; @@ -324,7 +324,7 @@ public static bool CanAttack() return false; } - return Utils.GameTimeTickCount + Game.Ping / 2 + 25 >= LastAATick + Player.AttackDelay * 1000; + return Utils.GameTimeTickCount + (Game.Ping / 2) + 25 >= LastAATick + (Player.AttackDelay * 1000); } /// @@ -346,8 +346,8 @@ public static bool CanMove(float extraWindup, bool disableMissileCheck = false) } return NoCancelChamps.Contains(_championName) - || (Utils.GameTimeTickCount + Game.Ping / 2 - >= LastAATick + Player.AttackCastDelay * 1000 + extraWindup + localExtraWindup); + || (Utils.GameTimeTickCount + (Game.Ping / 2) + >= LastAATick + (Player.AttackCastDelay * 1000) + extraWindup + localExtraWindup); } /// @@ -759,7 +759,7 @@ private static void OnProcessSpell(Obj_AI_Base unit, GameObjectProcessSpellCastE if (unit.IsMe && (Spell.Target is Obj_AI_Base || Spell.Target is Obj_BarracksDampener || Spell.Target is Obj_HQ)) { - LastAATick = Utils.GameTimeTickCount - Game.Ping / 2; + LastAATick = Utils.GameTimeTickCount - (Game.Ping / 2); _missileLaunched = false; LastMoveCommandT = 0; _autoattackCounter++; @@ -1153,9 +1153,9 @@ public virtual AttackableUnit GetTarget() return barrel; } - var t = (int)(this.Player.AttackCastDelay * 1000) + Game.Ping / 2 - + 1000 * (int)Math.Max(0, this.Player.Distance(barrel) - this.Player.BoundingRadius) - / (int)GetMyProjectileSpeed(); + var t = (int)(this.Player.AttackCastDelay * 1000) + (Game.Ping / 2) + + (1000 * (int)Math.Max(0, this.Player.Distance(barrel) - this.Player.BoundingRadius) + / (int)GetMyProjectileSpeed()); var barrelBuff = barrel.Buffs.FirstOrDefault( @@ -1169,9 +1169,9 @@ public virtual AttackableUnit GetTarget() : (enemyGangPlank.Level >= 7 ? 1f : 2f); var nextHealthDecayTime = Game.Time < barrelBuff.StartTime + healthDecayRate ? barrelBuff.StartTime + healthDecayRate - : barrelBuff.StartTime + healthDecayRate * 2; + : barrelBuff.StartTime + (healthDecayRate * 2); - if (nextHealthDecayTime <= Game.Time + t / 1000f) + if (nextHealthDecayTime <= Game.Time + (t / 1000f)) { return barrel; } @@ -1199,13 +1199,13 @@ public virtual AttackableUnit GetTarget() foreach (var minion in MinionList) { - var t = (int)(this.Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 - + 1000 * (int)Math.Max(0, this.Player.Distance(minion) - this.Player.BoundingRadius) - / (int)GetMyProjectileSpeed(); + var t = (int)(this.Player.AttackCastDelay * 1000) - 100 + (Game.Ping / 2) + + (1000 * (int)Math.Max(0, this.Player.Distance(minion) - this.Player.BoundingRadius) + / (int)GetMyProjectileSpeed()); if (mode == OrbwalkingMode.Freeze) { - t += 200 + Game.Ping / 2; + t += 200 + (Game.Ping / 2); } var predHealth = HealthPrediction.GetHealthPrediction(minion, t, this.FarmDelay); @@ -1346,19 +1346,19 @@ public virtual AttackableUnit GetTarget() turretMinion as Obj_AI_Minion); // from healthprediction (don't blame me :S) var turretLandTick = turretStarTick + (int)(closestTower.AttackCastDelay * 1000) - + 1000 + + (1000 * Math.Max( 0, (int) (turretMinion.Distance(closestTower) - closestTower.BoundingRadius)) - / (int)(closestTower.BasicAttack.MissileSpeed + 70); + / (int)(closestTower.BasicAttack.MissileSpeed + 70)); // calculate the HP before try to balance it for (float i = turretLandTick + 50; - i < turretLandTick + 10 * closestTower.AttackDelay * 1000 + 50; - i = i + closestTower.AttackDelay * 1000) + i < turretLandTick + (10 * closestTower.AttackDelay * 1000) + 50; + i = i + (closestTower.AttackDelay * 1000)) { - var time = (int)i - Utils.GameTimeTickCount + Game.Ping / 2; + var time = (int)i - Utils.GameTimeTickCount + (Game.Ping / 2); var predHP = (int) HealthPrediction.LaneClearHealthPrediction(turretMinion, time > 0 ? time : 0); @@ -1378,31 +1378,31 @@ public virtual AttackableUnit GetTarget() var damage = (int)this.Player.GetAutoAttackDamage(turretMinion, true); var hits = hpLeftBeforeDie / damage; var timeBeforeDie = turretLandTick - + (turretAttackCount + 1) - * (int)(closestTower.AttackDelay * 1000) + + ((turretAttackCount + 1) + * (int)(closestTower.AttackDelay * 1000)) - Utils.GameTimeTickCount; var timeUntilAttackReady = LastAATick + (int)(this.Player.AttackDelay * 1000) - > Utils.GameTimeTickCount + Game.Ping / 2 + 25 + > Utils.GameTimeTickCount + (Game.Ping / 2) + 25 ? LastAATick + (int)(this.Player.AttackDelay * 1000) - - (Utils.GameTimeTickCount + Game.Ping / 2 + 25) + - (Utils.GameTimeTickCount + (Game.Ping / 2) + 25) : 0; var timeToLandAttack = this.Player.IsMelee ? this.Player.AttackCastDelay * 1000 - : this.Player.AttackCastDelay * 1000 - + 1000 + : (this.Player.AttackCastDelay * 1000) + + (1000 * Math.Max( 0, turretMinion.Distance(this.Player) - this.Player.BoundingRadius) - / this.Player.BasicAttack.MissileSpeed; + / this.Player.BasicAttack.MissileSpeed); if (hits >= 1 - && hits * this.Player.AttackDelay * 1000 + timeUntilAttackReady + && (hits * this.Player.AttackDelay * 1000) + timeUntilAttackReady + timeToLandAttack < timeBeforeDie) { farmUnderTurretMinion = turretMinion as Obj_AI_Minion; } else if (hits >= 1 - && hits * this.Player.AttackDelay * 1000 + timeUntilAttackReady + && (hits * this.Player.AttackDelay * 1000) + timeUntilAttackReady + timeToLandAttack > timeBeforeDie) { noneKillableMinion = turretMinion as Obj_AI_Minion; @@ -1652,8 +1652,8 @@ private void DrawingOnOnDraw(EventArgs args) _config.Item("AALineWidth").GetValue().Value, true); } - _config.Item("FocusMinionsOverTurrets") - .Permashow(_config.Item("FocusMinionsOverTurrets").GetValue().Active); + /*_config.Item("FocusMinionsOverTurrets") + .Permashow(_config.Item("FocusMinionsOverTurrets").GetValue().Active);*/ if (_config.Item("LastHitHelper").GetValue()) { @@ -1736,12 +1736,12 @@ private bool ShouldWaitUnderTurret(Obj_AI_Minion noneKillableMinion) && HealthPrediction.LaneClearHealthPrediction( minion, (int) - (this.Player.AttackDelay * 1000 + ((this.Player.AttackDelay * 1000) + (this.Player.IsMelee ? this.Player.AttackCastDelay * 1000 - : this.Player.AttackCastDelay * 1000 - + 1000 * (this.Player.AttackRange + 2 * this.Player.BoundingRadius) - / this.Player.BasicAttack.MissileSpeed)), + : (this.Player.AttackCastDelay * 1000) + + (1000 * (this.Player.AttackRange + (2 * this.Player.BoundingRadius)) + / this.Player.BasicAttack.MissileSpeed))), this.FarmDelay) <= this.Player.GetAutoAttackDamage(minion)); } diff --git a/Packet.cs b/source/Old/Packet.cs similarity index 67% rename from Packet.cs rename to source/Old/Packet.cs index f67290fe..7f527a65 100644 --- a/Packet.cs +++ b/source/Old/Packet.cs @@ -1,638 +1,703 @@ -namespace LeagueSharp.Common +#region LICENSE + +/* + Copyright 2014 - 2014 LeagueSharp + Packet.cs is part of LeagueSharp.Common. + + LeagueSharp.Common is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LeagueSharp.Common is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LeagueSharp.Common. If not, see . +*/ + +/* + Hi there BoL devs - looking for an update again? :^ ) jk their lib works and ours doesnt +*/ + +#endregion + +#region + +using System; +using System.Collections.Generic; +using System.Linq; +using SharpDX; + +#endregion + +namespace LeagueSharp.Common { - using System; - using System.Collections.Generic; - using System.Linq; - - using SharpDX; /// - /// Helps in decoding packets. This is not currently updated past 4.21! + /// Helps in decoding packets. This is not currently updated past 4.21! /// [Obsolete("Jodus wears dirty socks", false)] public static class Packet { - #region Constructors and Destructors - /// - /// Initializes static members of the class. + /// Initializes static members of the class. /// static Packet() { - Console.WriteLine( - @"LeagueSharp.Common.Packet will be removed soon, use LeagueSharp.Network.Packets instead"); + Console.WriteLine(@"LeagueSharp.Common.Packet will be removed soon, use LeagueSharp.Network.Packets instead"); } - #endregion - - #region Enums - /// - /// The states of actions. + /// The states of actions. /// public enum ActionStates { /// - /// The begin recall state + /// The begin recall state /// BeginRecall = 111207118, /// - /// The finish recall state + /// The finish recall state /// FinishRecall = 97690254, } /// - /// The type of attack. + /// The type of attack. /// public enum AttackTypePacket { /// - /// Circular skillshots. + /// Circular skillshots. /// Circular = 0, /// - /// Cone and Skillshot spells + /// Cone and Skillshot spells /// ConeSkillShot = 1, /// - /// Targeted spells and AAs + /// Targeted spells and AAs /// TargetedAA = 2, } /// - /// The type of damage. + /// The type of damage. /// public enum DamageTypePacket { /// - /// Magical Damage (AP) + /// Magical Damage (AP) /// Magical = 4, /// - /// A Critical Attack + /// A Critical Attack /// CriticalAttack = 11, /// - /// Physical Damage (AD) + /// Physical Damage (AD) /// Physical = 12, /// - /// True Damage + /// True Damage /// True = 36, } /// - /// Types of emotes. + /// Types of emotes. /// public enum Emotes { /// - /// Dance + /// Dance /// Dance = 0x00, /// - /// Joke + /// Joke /// Joke = 0x03, /// - /// Taunt + /// Taunt /// Taunt = 0x01, /// - /// Laugh + /// Laugh /// Laugh = 0x02, } /// - /// Type of floating text on a hero. + /// Type of floating text on a hero. /// public enum FloatTextPacket { /// - /// Invulnerable + /// Invulnerable /// Invulnerable, /// - /// Special + /// Special /// Special, /// - /// Heal + /// Heal /// Heal, /// - /// Mana heal + /// Mana heal /// ManaHeal, /// - /// Mana Damage + /// Mana Damage /// ManaDmg, /// - /// Dodge + /// Dodge /// Dodge, /// - /// Critical + /// Critical /// Critical, /// - /// Experience + /// Experience /// Experience, /// - /// Gold + /// Gold /// Gold, /// - /// Level + /// Level /// Level, /// - /// Disable + /// Disable /// Disable, /// - /// Quest Received + /// Quest Received /// QuestRecv, /// - /// Quest Done + /// Quest Done /// QuestDone, /// - /// Score + /// Score /// Score, /// - /// Physical Damage + /// Physical Damage /// PhysDmg, /// - /// Magic Damage + /// Magic Damage /// MagicDmg, /// - /// True Damage + /// True Damage /// TrueDmg, /// - /// Enemy Physical Damage + /// Enemy Physical Damage /// EnemyPhysDmg, /// - /// Enemy Magic Damage + /// Enemy Magic Damage /// EnemyMagicDmg, /// - /// Enemy True Damage + /// Enemy True Damage /// EnemyTrueDmg, /// - /// Enemy Critical + /// Enemy Critical /// EnemyCritical, /// - /// Countdown + /// Countdown /// Countdown, /// - /// Legacy + /// Legacy /// Legacy, /// - /// Legacy critical + /// Legacy critical /// LegacyCritical, /// - /// Debug + /// Debug /// Debug } /// - /// Because riot has run out of headers because they used byte headers, packets have 2 byte headers. This Enum - /// represnets them. + /// Because riot has run out of headers because they used byte headers, packets have 2 byte headers. This Enum represnets them. /// public enum MultiPacketType { /* Confirmed in IDA */ - /// - /// The unknown100 + /// The unknown100 /// Unknown100 = 0x00, /// - /// The unknown101 + /// The unknown101 /// Unknown101 = 0x01, /// - /// The unknown102 + /// The unknown102 /// Unknown102 = 0x02, /// - /// The unknown115 + /// The unknown115 /// Unknown115 = 0x15, /// - /// The unknown116 + /// The unknown116 /// Unknown116 = 0x16, /// - /// The unknown124 + /// The unknown124 /// Unknown124 = 0x24, /// - /// The unknown11 a + /// The unknown11 a /// Unknown11A = 0x1A, /// - /// The unknown11 e (Currently Empty) + /// The unknown11 e (Currently Empty) /// Unknown11E = 0x1E, /* These others could be packets with a handler */ - /// - /// The unknown104. Somehow related to spell slots. + /// The unknown104. Somehow related to spell slots. /// Unknown104 = 0x04, /// - /// The unknown118. (Sion Ult) + /// The unknown118. (Sion Ult) /// - Unknown118 = 0x08, + Unknown118 = 0x08, /// - /// The unknown120 + /// The unknown120 /// Unknown120 = 0x20, // confirmed in game /// - /// The spawn turret packet. + /// The spawn turret packet. /// SpawnTurret = 0x23, // confirmed in ida /* New List: Confirmed in Game */ //FE 19 00 00 40 07 01 00 01 00 00 00 02 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 /// - /// The initialize spell pack. Could also be the stack count for stackables. + /// The initialize spell pack. Could also be the stack count for stackables. /// InitSpell = 0x07, /// - /// The unknown10 c. + /// The unknown10 c. /// Unknown10C = 0x0C, //this packet is like 0x127 /// - /// The unknown122 + /// The unknown122 /// Unknown122 = 0x22, /// - /// The unknown125. (Sion Ult) + /// The unknown125. (Sion Ult) /// Unknown125 = 0x25, // sion ult, other stuff - //FE 05 00 00 40 25 01 03 EC 06 00 00 00 01 <== sion - // FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 - //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 - //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 - //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 - //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 56 05 00 40 FB 16 00 40 - + //FE 05 00 00 40 25 01 03 EC 06 00 00 00 01 <== sion + // FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 + //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 + //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 + //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 FB 16 00 40 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 FB 16 00 40 + //FE 19 00 00 40 25 01 00 00 07 00 00 00 06 56 04 00 40 B2 04 00 40 B2 04 00 40 56 05 00 40 56 05 00 40 FB 16 00 40 + /// - /// The NPC death packet + /// The NPC death packet /// NPCDeath = 0x26, //confirmed in ida, struct from intwars/ida - /// - /// The unknown129. Related to spells. + /// The unknown129. Related to spells. /// Unknown129 = 0x29, //related to spells (kalista ally unit), add? - /// - /// The unknown12A. Related to spells. + /// The unknown12A. Related to spells. /// Unknown12A = 0x2A, //related to spells (kalist ally unit after 0x129), maybe delete? //FE 06 00 00 40 2A 01 3C 00 00 00 /// - /// The unknown12 c + /// The unknown12 c /// Unknown12C = 0x2C, //FE 00 00 00 00 2C 01 81 00 00 00 00 FF FF FF FF //FE 00 00 00 00 2C 01 80 00 00 00 00 FF FF FF FF /// - /// The unknown12 e + /// The unknown12 e /// Unknown12E = 0x2E, //confirmed in ida /// - /// The unknown12 f + /// The unknown12 f /// Unknown12F = 0x2F, //FE 05 00 00 40 2F 01 00 /// - /// The add buff packet. + /// The add buff packet. /// AddBuff = 0x09, // buff added by towers in new SR /// - /// The undo token packet + /// The undo token packet /// UndoToken = 0x0B, /// - /// The object creation packet. Used for Azir's ult. + /// The object creation packet. Used for Azir's ult. /// ObjectCreation = 0x0D, // azir ult /// - /// The surrender state packet + /// The surrender state packet /// SurrenderState = 0x0E, /// - /// The on attack packet. + /// The on attack packet. /// OnAttack = 0x0F, /// - /// The death timer packet. + /// The death timer packet. /// DeathTimer = 0x17, /// - /// The change item packet. (EX: Health Potion to Biscuit) + /// The change item packet. (EX: Health Potion to Biscuit) /// ChangeItem = 0x1C, //like hpp=>biscuit /// - /// The action state packet. Triggers on recall. + /// The action state packet. Triggers on recall. /// ActionState = 0x21, // ?? triggers on recall /// - /// The undo confirmation packet. + /// The undo confirmation packet. /// UndoConfirm = 0x27, /// - /// The lock camera packet for Sion's Ult. + /// The lock camera packet for Sion's Ult. /// LockCamera = 0x2B, // Sion Ult /// - /// An unkown packet. + /// An unkown packet. /// Unknown = 0xFF, // Default, not real packet } /// - /// The type of ping. + /// The type of ping. /// public enum PingType { /// - /// A normal ping. + /// A normal ping. /// Normal = 0, /// - /// A fallback ping. + /// A fallback ping. /// Fallback = 5, /// - /// An enemy missing ping. + /// An enemy missing ping. /// EnemyMissing = 3, /// - /// A danagr ping. + /// A danagr ping. /// Danger = 2, /// - /// An on my way ping. + /// An on my way ping. /// OnMyWay = 4, /// - /// An assist me ping. + /// An assist me ping. /// AssistMe = 6, } - #endregion - /// - /// Contains packets that are sent from the client (the game) to the server. + /// Contains packets that are sent from the client (the game) to the server. /// public static class C2S { + #region Ping - 4.21 + /// - /// Packet sent when buying items. + /// Ping Packet. Sent by the client when pings are sent. /// - public static class BuyItem + public static class Ping { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - /// - /// The flags + /// The header /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + public static byte Header = 0x1D; /// - /// The header + /// The channel /// - public static byte Header = 0xC6; - - #endregion - - #region Public Methods and Operators + public static PacketChannel Channel = PacketChannel.C2S; /// - /// Decodes the specified data. + /// The flags /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); - packet.Position = 2; - result.NetworkId = packet.ReadInteger(); - result.ItemId = packet.ReadInteger(); - return result; - } + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. public static GamePacket Encoded(Struct packetStruct) { var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(0); - result.WriteInteger(packetStruct.NetworkId); - result.WriteInteger(packetStruct.ItemId); + result.WriteByte(1); + result.WriteInteger(0); + result.WriteInteger(packetStruct.TargetNetworkId); + result.WriteFloat(packetStruct.X); + result.WriteFloat(packetStruct.Y); + result.WriteByte((byte) packetStruct.Type); return result; } - #endregion + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data) { Position = 10 }; + return new Struct( + packet.ReadFloat(), packet.ReadFloat(), packet.ReadInteger(), (PingType) packet.ReadByte()); + } /// - /// Reprents the packet sent when an item is bought. + /// Repreents a ping packet. /// public struct Struct { - #region Fields - /// - /// The item identifier + /// The target network identifier /// - public int ItemId; + public int TargetNetworkId; /// - /// The network identifier + /// The ping type /// - public int NetworkId; + public PingType Type; - #endregion + /// + /// The x position + /// + public float X; - #region Constructors and Destructors + /// + /// The y position + /// + public float Y; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// - /// The item identifier. - /// The network identifier. - public Struct(int itemId, int networkId = -1) + /// The x. + /// The y. + /// The target network identifier. + /// The type. + public Struct(float x = 0f, float y = 0f, int targetNetworkId = 0, PingType type = PingType.Normal) { - this.ItemId = itemId; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + X = x; + Y = y; + TargetNetworkId = targetNetworkId; + Type = type; } - - #endregion } } - /// - /// Sent by client on center/lock camera. - /// - public static class Camera - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x64; + #endregion - #endregion - } + #region LevelUpSpell - 4.21 /// - /// Packet sent when casting spells. + /// Packet sent when leveling up a spell. /// - public static class Cast + public static class LevelUpSpell { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0xEC; /// - /// The channel + /// The channel /// public static PacketChannel Channel = PacketChannel.C2S; /// - /// The flags + /// The flags /// public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0xDE; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header, Channel, Flags); + result.WriteByte(0); + result.WriteInteger(packetStruct.NetworkId); + result.WriteInteger(0); + result.WriteByte((byte) packetStruct.Slot); + var bit = packetStruct.Evolution ? (byte) 0x01 : (byte) 0x0; + result.WriteByte(bit); + result.WriteInteger(0); + result.WriteInteger(0); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data); + var packet = new GamePacket(data) { Position = 2 }; var result = new Struct(); - packet.Position = 2; - result.SourceNetworkId = packet.ReadInteger(); - result.FromX = packet.ReadFloat(); - result.FromY = packet.ReadFloat(); - result.ToX = packet.ReadFloat(); - result.ToY = packet.ReadFloat(); - result.Slot = (SpellSlot)packet.ReadByte(); - result.SpellFlag = packet.ReadByte(); - return result; + + result.NetworkId = packet.ReadInteger(); + packet.Position += 4; + result.Slot = (SpellSlot) packet.ReadByte(); + result.Evolution = packet.ReadByte() == 0x01 ? true : false; + + return new Struct(packet.ReadInteger(), (SpellSlot) packet.ReadByte()); + } + + /// + /// Represents a level up packet. + /// + public struct Struct + { + /// + /// true if the level up was to evolve a spell. + /// + public bool Evolution; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The slot + /// + public SpellSlot Slot; + + /// + /// Initializes a new instance of the struct. + /// + /// The network identifier. + /// The slot. + /// if set to true [evolve]. + public Struct(int networkId = -1, SpellSlot slot = SpellSlot.Q, bool evolve = false) + { + NetworkId = (networkId == -1) ? ObjectManager.Player.NetworkId : networkId; + Slot = slot; + Evolution = evolve; + } } + } + + #endregion + + #region Move + + /// + /// Packet sent when issuing GameObjectOrder's. + /// + public static class Move + { + /// + /// The header + /// + public static byte Header = 0x13; /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. @@ -641,179 +706,156 @@ public static GamePacket Encoded(Struct packetStruct) var result = new GamePacket(Header); result.WriteByte(0); result.WriteInteger(packetStruct.SourceNetworkId); - result.WriteFloat(packetStruct.FromX); - result.WriteFloat(packetStruct.FromY); - result.WriteFloat(packetStruct.ToX); - result.WriteFloat(packetStruct.ToY); + + //random data :S + result.WriteInteger(0); + result.WriteInteger(0); + result.WriteInteger(0); + result.WriteInteger(0); + + result.WriteFloat(packetStruct.X); + result.WriteFloat(packetStruct.Y); + result.WriteByte(packetStruct.MoveType); result.WriteInteger(packetStruct.TargetNetworkId); - result.WriteByte((byte)packetStruct.Slot); - result.WriteByte(0); - //packetStruct.SpellFlag == 0xFF ? GetSpellByte(packetStruct.Slot) : packetStruct.SpellFlag return result; } - #endregion - - #region Methods - /// - /// Gets the spell byte. + /// Decodes the specified data. /// - /// The spell. - /// System.Byte. - private static byte GetSpellByte(SpellSlot spell) + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) { - switch (spell) - { - case SpellSlot.Q: - return 0xE8; - case SpellSlot.W: - return 0xE8; - case SpellSlot.E: - return 0xE8; - case SpellSlot.R: - return 0xE8; - case SpellSlot.Item1: - return 0; - case SpellSlot.Item2: - return 0; - case SpellSlot.Item3: - return 0; - case SpellSlot.Item4: - return 0; - case SpellSlot.Item5: - return 0; - case SpellSlot.Item6: - return 0; - case SpellSlot.Trinket: - return 0; - case SpellSlot.Recall: - return 0; - case SpellSlot.Unknown: - return 0; - default: - return 0; - } - } + var packet = new GamePacket(data); + var result = new Struct(); + packet.Position = 2; + result.SourceNetworkId = packet.ReadInteger(); + result.UnitNetworkId = result.SourceNetworkId; + + packet.ReadInteger(); + packet.ReadInteger(); + packet.ReadInteger(); + packet.ReadInteger(); - #endregion + result.X = packet.ReadFloat(); + result.Y = packet.ReadFloat(); + result.MoveType = packet.ReadByte(); + result.TargetNetworkId = packet.ReadInteger(); + return result; + } /// - /// Represents a spell cast packet. + /// Represents a move packet. /// public struct Struct { - #region Fields - - /// - /// The X position of where the spell came from. - /// - public float FromX; - /// - /// The Y position of where the spell came from. + /// The move type /// - public float FromY; + public byte MoveType; /// - /// The slot + /// The source network identifier /// - public SpellSlot Slot; + public int SourceNetworkId; /// - /// The source network identifier + /// The target network identifier /// - public int SourceNetworkId; + public int TargetNetworkId; /// - /// The spell flag + /// The unit network identifier /// - public byte SpellFlag; + public int UnitNetworkId; /// - /// The target network identifier + /// The waypoint count /// - public int TargetNetworkId; + public int WaypointCount; /// - /// The end X position of where the spell is going to. + /// The x position /// - public float ToX; + public float X; /// - /// To end Y position of where the spell is going to. + /// The y position /// - public float ToY; - - #endregion - - #region Constructors and Destructors + public float Y; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// + /// The x. + /// The y. + /// Type of the move. /// The target network identifier. - /// The slot. + /// The unit network identifier. /// The source network identifier. - /// From x. - /// From y. - /// To x. - /// To y. - /// The spell flag. - public Struct( + public Struct(float x = 0f, + float y = 0f, + byte moveType = 2, int targetNetworkId = 0, - SpellSlot slot = SpellSlot.Q, - int sourceNetworkId = -1, - float fromX = 0f, - float fromY = 0f, - float toX = 0f, - float toY = 0f, - byte spellFlag = 0xFF) + int unitNetworkId = -1, + int sourceNetworkId = -1) { - this.SourceNetworkId = (sourceNetworkId == -1) - ? ObjectManager.Player.NetworkId - : sourceNetworkId; - this.Slot = slot; - this.FromX = fromX; - this.FromY = fromY; - this.ToX = toX; - this.ToY = toY; - this.TargetNetworkId = targetNetworkId; - this.SpellFlag = spellFlag; + SourceNetworkId = (sourceNetworkId == -1) ? ObjectManager.Player.NetworkId : sourceNetworkId; + MoveType = moveType; + X = x; + Y = y; + TargetNetworkId = targetNetworkId; + UnitNetworkId = (unitNetworkId == -1) ? ObjectManager.Player.NetworkId : unitNetworkId; + WaypointCount = 1; } - - #endregion } } + #endregion + + #region Cast - 4.21 + /// - /// Packet sent when casting charged spells second cast. + /// Packet sent when casting spells. /// - public static class ChargedCast + public static class Cast { - #region Static Fields - /// - /// The channel + /// The header + /// + public static byte Header = 0xDE; + /// + /// The channel /// public static PacketChannel Channel = PacketChannel.C2S; - /// - /// The flags + /// The flags /// public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0x03; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header); + result.WriteByte(0); + result.WriteInteger(packetStruct.SourceNetworkId); + result.WriteFloat(packetStruct.FromX); + result.WriteFloat(packetStruct.FromY); + result.WriteFloat(packetStruct.ToX); + result.WriteFloat(packetStruct.ToY); + result.WriteInteger(packetStruct.TargetNetworkId); + result.WriteByte((byte)packetStruct.Slot); + result.WriteByte(0); //packetStruct.SpellFlag == 0xFF ? GetSpellByte(packetStruct.Slot) : packetStruct.SpellFlag + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -823,125 +865,176 @@ public static Struct Decoded(byte[] data) var result = new Struct(); packet.Position = 2; result.SourceNetworkId = packet.ReadInteger(); - result.Slot = (SpellSlot)packet.ReadByte(); + result.FromX = packet.ReadFloat(); + result.FromY = packet.ReadFloat(); result.ToX = packet.ReadFloat(); result.ToY = packet.ReadFloat(); - result.ToZ = packet.ReadFloat(); + result.Slot = (SpellSlot)packet.ReadByte(); + result.SpellFlag = packet.ReadByte(); return result; } /// - /// Encodes the specified packet structure. + /// Gets the spell byte. /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) + /// The spell. + /// System.Byte. + private static byte GetSpellByte(SpellSlot spell) { - var result = new GamePacket(Header); - result.WriteByte(1); - result.WriteInteger(packetStruct.SourceNetworkId); - result.WriteByte((byte)packetStruct.Slot); - result.WriteFloat(packetStruct.ToX); - result.WriteFloat(packetStruct.ToY); - result.WriteFloat(packetStruct.ToZ); - result.WriteByte(2); - return result; + switch (spell) + { + case SpellSlot.Q: + return 0xE8; + case SpellSlot.W: + return 0xE8; + case SpellSlot.E: + return 0xE8; + case SpellSlot.R: + return 0xE8; + case SpellSlot.Item1: + return 0; + case SpellSlot.Item2: + return 0; + case SpellSlot.Item3: + return 0; + case SpellSlot.Item4: + return 0; + case SpellSlot.Item5: + return 0; + case SpellSlot.Item6: + return 0; + case SpellSlot.Trinket: + return 0; + case SpellSlot.Recall: + return 0; + case SpellSlot.Unknown: + return 0; + default: + return 0; + } } - #endregion - /// - /// Represents a charged cast packet. + /// Represents a spell cast packet. /// public struct Struct { - #region Fields + /// + /// The X position of where the spell came from. + /// + public float FromX; + + /// + /// The Y position of where the spell came from. + /// + public float FromY; /// - /// The slot + /// The slot /// public SpellSlot Slot; /// - /// The source network identifier + /// The source network identifier /// public int SourceNetworkId; /// - /// The X position of where the spell is going to. + /// The spell flag /// - public float ToX; + public byte SpellFlag; /// - /// The Y position of where the spell is going to. + /// The target network identifier /// - public float ToY; + public int TargetNetworkId; /// - /// The Z position of where the spell is going to. + /// The end X position of where the spell is going to. /// - public float ToZ; - - #endregion + public float ToX; - #region Constructors and Destructors + /// + /// To end Y position of where the spell is going to. + /// + public float ToY; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// + /// The target network identifier. /// The slot. + /// The source network identifier. + /// From x. + /// From y. /// To x. /// To y. - /// To z. - /// The source network identifier. - public Struct( - SpellSlot slot, + /// The spell flag. + public Struct(int targetNetworkId = 0, + SpellSlot slot = SpellSlot.Q, + int sourceNetworkId = -1, + float fromX = 0f, + float fromY = 0f, float toX = 0f, float toY = 0f, - float toZ = 0f, - int sourceNetworkId = -1) + byte spellFlag = 0xFF) { - this.SourceNetworkId = (sourceNetworkId == -1) - ? ObjectManager.Player.NetworkId - : sourceNetworkId; - this.Slot = slot; - this.ToX = toX; - this.ToY = toY; - this.ToZ = toZ; + SourceNetworkId = (sourceNetworkId == -1) ? ObjectManager.Player.NetworkId : sourceNetworkId; + Slot = slot; + FromX = fromX; + FromY = fromY; + ToX = toX; + ToY = toY; + TargetNetworkId = targetNetworkId; + SpellFlag = spellFlag; } - - #endregion } } + #endregion + + #region ChargedCast - 4.21 + /// - /// Packet sent when sending emotes. + /// Packet sent when casting charged spells second cast. /// - public static class Emote + public static class ChargedCast { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x03; /// - /// The channel + /// The channel /// public static PacketChannel Channel = PacketChannel.C2S; /// - /// The flags + /// The flags /// public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0x14; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header); + result.WriteByte(1); + result.WriteInteger(packetStruct.SourceNetworkId); + result.WriteByte((byte) packetStruct.Slot); + result.WriteFloat(packetStruct.ToX); + result.WriteFloat(packetStruct.ToY); + result.WriteFloat(packetStruct.ToZ); + result.WriteByte(2); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -950,365 +1043,379 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); packet.Position = 2; - result.NetworkId = packet.ReadInteger(); - result.EmoteId = packet.ReadByte(); - return result; - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(1); - result.WriteInteger(packetStruct.NetworkId); - result.WriteByte(packetStruct.EmoteId); + result.SourceNetworkId = packet.ReadInteger(); + result.Slot = (SpellSlot) packet.ReadByte(); + result.ToX = packet.ReadFloat(); + result.ToY = packet.ReadFloat(); + result.ToZ = packet.ReadFloat(); return result; } - #endregion - /// - /// Represents the packet sent when you cast an emote. + /// Represents a charged cast packet. /// public struct Struct { - #region Fields + /// + /// The slot + /// + public SpellSlot Slot; /// - /// The emote identifier + /// The source network identifier /// - public byte EmoteId; + public int SourceNetworkId; /// - /// The network identifier + /// The X position of where the spell is going to. /// - public int NetworkId; + public float ToX; + + /// + /// The Y position of where the spell is going to. + /// + public float ToY; - #endregion + /// + /// The Z position of where the spell is going to. + /// + public float ToZ; - #region Constructors and Destructors /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// - /// The emote identifier. - /// The network identifier. - public Struct(byte emoteId, int networkId = -1) + /// The slot. + /// To x. + /// To y. + /// To z. + /// The source network identifier. + public Struct(SpellSlot slot, + float toX = 0f, + float toY = 0f, + float toZ = 0f, + int sourceNetworkId = -1) { - this.EmoteId = emoteId; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + SourceNetworkId = (sourceNetworkId == -1) ? ObjectManager.Player.NetworkId : sourceNetworkId; + Slot = slot; + ToX = toX; + ToY = toY; + ToZ = toZ; } - - #endregion } } - /// - /// Sent by client when the game is over. - /// - public static class EndGame - { - #region Static Fields - - //1E 00 00 00 00 00 - /// - /// The header - /// - public static byte Header = 0x1E; + #endregion - #endregion - } + #region BuyItem - 4.21 /// - /// Packet sent frequently as heartbeat to servers. - /// Related to 0x29 (Recv) + /// Packet sent when buying items. /// - public static class HeartBeat + public static class BuyItem { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0xC6; /// - /// The header + /// The channel /// - public static byte Header = 0x4C; + public static PacketChannel Channel = PacketChannel.C2S; - #endregion + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - #region Public Methods and Operators + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header, Channel, Flags); + result.WriteByte(0); + result.WriteInteger(packetStruct.NetworkId); + result.WriteInteger(packetStruct.ItemId); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { var packet = new GamePacket(data); - var result = new Struct { RecvTime = packet.ReadFloat(1), AckTime = packet.ReadFloat(5) }; + var result = new Struct(); + packet.Position = 2; + result.NetworkId = packet.ReadInteger(); + result.ItemId = packet.ReadInteger(); return result; } - #endregion - /// - /// Represents a heart beat packet. + /// Reprents the packet sent when an item is bought. /// public struct Struct { - #region Fields - /// - /// The ack time + /// The item identifier /// - public float AckTime; + public int ItemId; /// - /// The recv time + /// The network identifier /// - public float RecvTime; + public int NetworkId; - #endregion + /// + /// Initializes a new instance of the struct. + /// + /// The item identifier. + /// The network identifier. + public Struct(int itemId, int networkId = -1) + { + ItemId = itemId; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + } } } + #endregion + + #region SellItem - 4.21 + /// - /// Packet sent when interacting with Thresh Lantern and Dominion capturing. + /// Packet sent when selling items. /// - public static class InteractObject + public static class SellItem { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x72; /// - /// The channel + /// The channel /// public static PacketChannel Channel = PacketChannel.C2S; /// - /// The flags + /// The flags /// public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0x86; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header, Channel, Flags); + result.WriteByte(0); + result.WriteInteger(packetStruct.NetworkId); + result.WriteByte(packetStruct.InventorySlot); + result.WriteByte(1); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data); - var result = new Struct(); - packet.Position = 1; - result.SourceNetworkId = packet.ReadInteger(); - result.ObjectNetworkId = packet.ReadInteger(); - return result; - } + var packet = new GamePacket(data) { Position = 2 }; + var networkId = packet.ReadInteger(); + var slot = packet.ReadByte(); - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteInteger(packetStruct.SourceNetworkId); - result.WriteInteger(packetStruct.ObjectNetworkId); - return result; + return new Struct(slot, networkId); } - #endregion - /// - /// Represents the packet sent when you interact with an object. + /// Packet sent on selling an item. /// public struct Struct { - #region Fields + /// + /// The inventory slot + /// + public byte InventorySlot; /// - /// The object network identifier + /// The network identifier /// - public int ObjectNetworkId; + public int NetworkId; /// - /// The source network identifier + /// The spell slot /// - public int SourceNetworkId; + public SpellSlot SpellSlot; - #endregion + /// + /// Initializes a new instance of the struct. + /// + /// The slot. + /// The network identifier. + public Struct(byte slot, int networkId = -1) + { + InventorySlot = slot; + SpellSlot = (SpellSlot) (InventorySlot + (byte) SpellSlot.Item1); + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + } - #region Constructors and Destructors /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// + /// The slot. /// The network identifier. - /// The object network identifier. - public Struct(int networkId, int objectNetworkId) + public Struct(SpellSlot slot, int networkId = -1) { - this.SourceNetworkId = networkId; - this.ObjectNetworkId = objectNetworkId; + SpellSlot = slot; + InventorySlot = (byte) ((byte) SpellSlot - (byte) SpellSlot.Item1); + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; } - - #endregion } } - /// - /// Sent by client on exiting the game. - /// - public static class LeaveGame - { - #region Static Fields - - //75 00 00 00 00 00 5A - /// - /// The header - /// - public static byte Header = 0x75; + #endregion - #endregion - } + #region SwapItem - 4.21 /// - /// Packet sent when leveling up a spell. + /// Packet sent when swapping items. /// - public static class LevelUpSpell + public static class SwapItem { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x55; /// - /// The channel + /// The channel /// public static PacketChannel Channel = PacketChannel.C2S; /// - /// The flags + /// The flags /// public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0xEC; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header, Channel, Flags); + result.WriteByte(0); + result.WriteInteger(packetStruct.NetworkId); + result.WriteByte(packetStruct.FromSlotByte); + result.WriteByte(packetStruct.ToSlotByte); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data) { Position = 2 }; + var packet = new GamePacket(data); var result = new Struct(); - + packet.Position = 2; result.NetworkId = packet.ReadInteger(); - packet.Position += 4; - result.Slot = (SpellSlot)packet.ReadByte(); - result.Evolution = packet.ReadByte() == 0x01 ? true : false; - - return new Struct(packet.ReadInteger(), (SpellSlot)packet.ReadByte()); - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(0); - result.WriteInteger(packetStruct.NetworkId); - result.WriteInteger(0); - result.WriteByte((byte)packetStruct.Slot); - var bit = packetStruct.Evolution ? (byte)0x01 : (byte)0x0; - result.WriteByte(bit); - result.WriteInteger(0); - result.WriteInteger(0); + result.FromSlotByte = packet.ReadByte(); + result.ToSlotByte = packet.ReadByte(); return result; } - #endregion - /// - /// Represents a level up packet. + /// Represents the packet sent when you swap an item in your inventory. /// public struct Struct { - #region Fields - /// - /// true if the level up was to evolve a spell. + /// From slot byte /// - public bool Evolution; + public byte FromSlotByte; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The slot + /// To slot byte /// - public SpellSlot Slot; - - #endregion - - #region Constructors and Destructors + public byte ToSlotByte; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// + /// From slot byte. + /// To slot byte. /// The network identifier. - /// The slot. - /// if set to true [evolve]. - public Struct(int networkId = -1, SpellSlot slot = SpellSlot.Q, bool evolve = false) + public Struct(byte fromSlotByte, byte toSlotByte, int networkId = -1) { - this.NetworkId = (networkId == -1) ? ObjectManager.Player.NetworkId : networkId; - this.Slot = slot; - this.Evolution = evolve; + FromSlotByte = fromSlotByte; + ToSlotByte = toSlotByte; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; } - - #endregion } } + #endregion + + #region Emote - 4.21 + /// - /// Packet sent when issuing GameObjectOrder's. + /// Packet sent when sending emotes. /// - public static class Move + public static class Emote { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x14; /// - /// The header + /// The channel /// - public static byte Header = 0x13; + public static PacketChannel Channel = PacketChannel.C2S; - #endregion + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - #region Public Methods and Operators + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header, Channel, Flags); + result.WriteByte(1); + result.WriteInteger(packetStruct.NetworkId); + result.WriteByte(packetStruct.EmoteId); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -1317,582 +1424,290 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); packet.Position = 2; - result.SourceNetworkId = packet.ReadInteger(); - result.UnitNetworkId = result.SourceNetworkId; - - packet.ReadInteger(); - packet.ReadInteger(); - packet.ReadInteger(); - packet.ReadInteger(); - - result.X = packet.ReadFloat(); - result.Y = packet.ReadFloat(); - result.MoveType = packet.ReadByte(); - result.TargetNetworkId = packet.ReadInteger(); - return result; - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header); - result.WriteByte(0); - result.WriteInteger(packetStruct.SourceNetworkId); - - //random data :S - result.WriteInteger(0); - result.WriteInteger(0); - result.WriteInteger(0); - result.WriteInteger(0); - - result.WriteFloat(packetStruct.X); - result.WriteFloat(packetStruct.Y); - result.WriteByte(packetStruct.MoveType); - result.WriteInteger(packetStruct.TargetNetworkId); + result.NetworkId = packet.ReadInteger(); + result.EmoteId = packet.ReadByte(); return result; } - #endregion - /// - /// Represents a move packet. + /// Represents the packet sent when you cast an emote. /// public struct Struct { - #region Fields - - /// - /// The move type - /// - public byte MoveType; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The unit network identifier - /// - public int UnitNetworkId; - - /// - /// The waypoint count - /// - public int WaypointCount; - /// - /// The x position + /// The emote identifier /// - public float X; + public byte EmoteId; /// - /// The y position + /// The network identifier /// - public float Y; - - #endregion - - #region Constructors and Destructors + public int NetworkId; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// - /// The x. - /// The y. - /// Type of the move. - /// The target network identifier. - /// The unit network identifier. - /// The source network identifier. - public Struct( - float x = 0f, - float y = 0f, - byte moveType = 2, - int targetNetworkId = 0, - int unitNetworkId = -1, - int sourceNetworkId = -1) + /// The emote identifier. + /// The network identifier. + public Struct(byte emoteId, int networkId = -1) { - this.SourceNetworkId = (sourceNetworkId == -1) - ? ObjectManager.Player.NetworkId - : sourceNetworkId; - this.MoveType = moveType; - this.X = x; - this.Y = y; - this.TargetNetworkId = targetNetworkId; - this.UnitNetworkId = (unitNetworkId == -1) ? ObjectManager.Player.NetworkId : unitNetworkId; - this.WaypointCount = 1; + EmoteId = emoteId; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; } - - #endregion } } - /// - /// Sent by client on pause. - /// - public static class Pause - { - #region Static Fields - - //00 01 00 00 00 00 00 00 00 00 00 00 00 00 90 - /// - /// The header - /// - public static byte Header = 0x00; + #endregion - #endregion - } + #region InteractObject - 4.21 /// - /// Ping Packet. Sent by the client when pings are sent. + /// Packet sent when interacting with Thresh Lantern and Dominion capturing. /// - public static class Ping + public static class InteractObject { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x86; /// - /// The channel + /// The channel /// public static PacketChannel Channel = PacketChannel.C2S; /// - /// The flags + /// The flags /// public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0x1D; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header, Channel, Flags); + result.WriteInteger(packetStruct.SourceNetworkId); + result.WriteInteger(packetStruct.ObjectNetworkId); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data) { Position = 10 }; - return new Struct( - packet.ReadFloat(), - packet.ReadFloat(), - packet.ReadInteger(), - (PingType)packet.ReadByte()); - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(1); - result.WriteInteger(0); - result.WriteInteger(packetStruct.TargetNetworkId); - result.WriteFloat(packetStruct.X); - result.WriteFloat(packetStruct.Y); - result.WriteByte((byte)packetStruct.Type); + var packet = new GamePacket(data); + var result = new Struct(); + packet.Position = 1; + result.SourceNetworkId = packet.ReadInteger(); + result.ObjectNetworkId = packet.ReadInteger(); return result; } - #endregion - /// - /// Repreents a ping packet. + /// Represents the packet sent when you interact with an object. /// public struct Struct { - #region Fields - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The ping type - /// - public PingType Type; - /// - /// The x position + /// The object network identifier /// - public float X; - + public int ObjectNetworkId; /// - /// The y position + /// The source network identifier /// - public float Y; - - #endregion - - #region Constructors and Destructors + public int SourceNetworkId; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// - /// The x. - /// The y. - /// The target network identifier. - /// The type. - public Struct(float x = 0f, float y = 0f, int targetNetworkId = 0, PingType type = PingType.Normal) + /// The network identifier. + /// The object network identifier. + public Struct(int networkId, int objectNetworkId) { - this.X = x; - this.Y = y; - this.TargetNetworkId = targetNetworkId; - this.Type = type; + SourceNetworkId = networkId; + ObjectNetworkId = objectNetworkId; } - - #endregion } } + #endregion + + #region SetTarget - 4.21 + /// - /// Sent by client on refund. + /// Packet sent when left clicking a target. /// - public static class Refund + public static class SetTarget { - #region Static Fields - /// - /// The channel + /// The header /// - public static PacketChannel Channel = PacketChannel.C2S; + public static byte Header = 0x04; /// - /// The flags + /// The channel /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + public static PacketChannel Channel = PacketChannel.C2S; /// - /// The header + /// The flags /// - public static byte Header = 0x54; - - #endregion - - #region Public Methods and Operators + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data); - var result = new Struct(); - packet.Position = 2; - result.NetworkId = packet.ReadInteger(); - return result; - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(0); - result.WriteInteger(packetStruct.NetworkId); + var result = new Struct { NetworkId = new GamePacket(data).ReadInteger(6) }; + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); return result; } - #endregion - /// - /// Represents the packet sent when refunding an item. + /// Represents the packet sent when left clicking a target. /// public struct Struct { - #region Fields - /// - /// The network identifier + /// The network identifier /// public int NetworkId; - - #endregion - - #region Constructors and Destructors - /// - /// Initializes a new instance of the struct. + /// The unit /// - /// The network identifier. - public Struct(int networkId = -1) - { - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - - #endregion + public Obj_AI_Base Unit; } } - /// - /// Sent by client on resume. - /// - public static class Resume - { - #region Static Fields - - //19 00 00 00 00 00 00 00 00 00 90 - /// - /// The header - /// - public static byte Header = 0x19; - - #endregion - } - - /// - /// Sent by client on opening score screen. - /// - public static class ScoreScreen - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x15; + #endregion - #endregion - } + #region HeartBeat - 4.21 /// - /// Packet sent when selling items. + /// Packet sent frequently as heartbeat to servers. + /// Related to 0x29 (Recv) /// - public static class SellItem + public static class HeartBeat { - #region Static Fields - /// - /// The channel + /// The header /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x72; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0x4C; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data) { Position = 2 }; - var networkId = packet.ReadInteger(); - var slot = packet.ReadByte(); - - return new Struct(slot, networkId); - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(0); - result.WriteInteger(packetStruct.NetworkId); - result.WriteByte(packetStruct.InventorySlot); - result.WriteByte(1); + var packet = new GamePacket(data); + var result = new Struct { RecvTime = packet.ReadFloat(1), AckTime = packet.ReadFloat(5) }; return result; } - #endregion - /// - /// Packet sent on selling an item. + /// Represents a heart beat packet. /// public struct Struct { - #region Fields - - /// - /// The inventory slot - /// - public byte InventorySlot; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The spell slot - /// - public SpellSlot SpellSlot; - - #endregion - - #region Constructors and Destructors - /// - /// Initializes a new instance of the struct. + /// The ack time /// - /// The slot. - /// The network identifier. - public Struct(byte slot, int networkId = -1) - { - this.InventorySlot = slot; - this.SpellSlot = (SpellSlot)(this.InventorySlot + (byte)SpellSlot.Item1); - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - + public float AckTime; /// - /// Initializes a new instance of the struct. + /// The recv time /// - /// The slot. - /// The network identifier. - public Struct(SpellSlot slot, int networkId = -1) - { - this.SpellSlot = slot; - this.InventorySlot = (byte)((byte)this.SpellSlot - (byte)SpellSlot.Item1); - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - - #endregion + public float RecvTime; } } + #endregion + + #region UpdateConfirm + /// - /// Packet sent when left clicking a target. + /// Packet sent to acknowledge the received update packet. /// - public static class SetTarget + public static class UpdateConfirm { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - /// - /// The header + /// The header /// - public static byte Header = 0x04; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0xA8; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var result = new Struct { NetworkId = new GamePacket(data).ReadInteger(6) }; - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + var packet = new GamePacket(data); + var result = new Struct { SequenceId = packet.ReadInteger(5) }; return result; } - #endregion - /// - /// Represents the packet sent when left clicking a target. + /// Represents the packet sent to acknowledge the received update packet /// public struct Struct { - #region Fields - - /// - /// The network identifier - /// - public int NetworkId; - /// - /// The unit + /// The sequence identifier /// - public Obj_AI_Base Unit; - - #endregion + public int SequenceId; } } - /// - /// Sent by client on surrendering. - /// - public static class Surrender - { - #region Static Fields - - //A2 00 00 00 00 00 AB - /// - /// The header - /// - public static byte Header = 0xA2; + #endregion - #endregion - } + #region Refund - 4.21 /// - /// Packet sent when swapping items. + /// Sent by client on refund. /// - public static class SwapItem + public static class Refund { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x54; /// - /// The channel + /// The channel /// public static PacketChannel Channel = PacketChannel.C2S; /// - /// The flags + /// The flags /// public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0x55; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header, Channel, Flags); + result.WriteByte(0); + result.WriteInteger(packetStruct.NetworkId); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -1902,465 +1717,333 @@ public static Struct Decoded(byte[] data) var result = new Struct(); packet.Position = 2; result.NetworkId = packet.ReadInteger(); - result.FromSlotByte = packet.ReadByte(); - result.ToSlotByte = packet.ReadByte(); - return result; - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(0); - result.WriteInteger(packetStruct.NetworkId); - result.WriteByte(packetStruct.FromSlotByte); - result.WriteByte(packetStruct.ToSlotByte); return result; } - #endregion - /// - /// Represents the packet sent when you swap an item in your inventory. + /// Represents the packet sent when refunding an item. /// public struct Struct { - #region Fields - - /// - /// From slot byte - /// - public byte FromSlotByte; - /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// To slot byte + /// Initializes a new instance of the struct. /// - public byte ToSlotByte; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// From slot byte. - /// To slot byte. /// The network identifier. - public Struct(byte fromSlotByte, byte toSlotByte, int networkId = -1) + public Struct(int networkId = -1) { - this.FromSlotByte = fromSlotByte; - this.ToSlotByte = toSlotByte; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; } - - #endregion } } + #endregion + + #region ScoreScreen - 4.21 (NO STRUCT) + /// - /// Packet sent to acknowledge the received update packet. + /// Sent by client on opening score screen. /// - public static class UpdateConfirm + public static class ScoreScreen { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xA8; + public static byte Header = 0x15; + } - #endregion + #endregion - #region Public Methods and Operators + #region Camera - 4.21 (NO STRUCT) + /// + /// Sent by client on center/lock camera. + /// + public static class Camera + { /// - /// Decodes the specified data. + /// The header /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct { SequenceId = packet.ReadInteger(5) }; - return result; - } + public static byte Header = 0x64; + } + + #endregion - #endregion + #region Zoom - 4.21 (NO STRUCT) + /// + /// Sent by client on zoom level change or move camera. + /// + public static class Zoom + { /// - /// Represents the packet sent to acknowledge the received update packet + /// The header /// - public struct Struct - { - #region Fields + public static byte Header = 0xDC; + } - /// - /// The sequence identifier - /// - public int SequenceId; + #endregion - #endregion - } - } + #region LeaveGame - 4.21 (NO STRUCT) /// - /// Sent by client to confirm receiving waypoints. + /// Sent by client on exiting the game. /// - public static class WaypointConfirm + public static class LeaveGame { - #region Static Fields - - //36 00 00 00 00 00 83 7F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + //75 00 00 00 00 00 5A /// - /// The header + /// The header /// - public static byte Header = 0x36; - - #endregion + public static byte Header = 0x75; } + #endregion + + #region Surrender - 4.21 (NO STRUCT) + /// - /// Sent by client on zoom level change or move camera. + /// Sent by client on surrendering. /// - public static class Zoom + public static class Surrender { - #region Static Fields - + //A2 00 00 00 00 00 AB /// - /// The header + /// The header /// - public static byte Header = 0xDC; - - #endregion + public static byte Header = 0xA2; } - } - /// - /// Contains packet that are sent from the server to the client (the game). - /// - public static class S2C - { + #endregion + + #region EndGame - 4.21 (NO STRUCT) + /// - /// Received by the server when Camera or Zoom is sent. + /// Sent by client when the game is over. /// - public static class Camera + public static class EndGame { - #region Static Fields - - //94 00 00 00 00 00 27 - //last byte is probably times camera packet has been sent + //1E 00 00 00 00 00 /// - /// The header + /// The header /// - public static byte Header = 0x94; - - #endregion + public static byte Header = 0x1E; } + #endregion + + #region WaypointConfirm 4.21 (NO STRUCT) + /// - /// Received when a unit casts a spell. + /// Sent by client to confirm receiving waypoints. /// - public static class CastAns + public static class WaypointConfirm { - #region Static Fields - + //36 00 00 00 00 00 83 7F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 /// - /// The header + /// The header /// - public static byte Header = 0xB5; + public static byte Header = 0x36; + } - #endregion + #endregion - #region Public Methods and Operators + #region Pause 4.21 (NO STRUCT) + /// + /// Sent by client on pause. + /// + public static class Pause + { + //00 01 00 00 00 00 00 00 00 00 00 00 00 00 90 /// - /// Decodes the specified data. + /// The header /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); - - result.SourceNetworkId = packet.ReadInteger(1); - result.SourceUnit = ObjectManager.GetUnitByNetworkId(result.SourceNetworkId); + public static byte Header = 0x00; + } - result.SpellFlag = packet.ReadShort(10); - result.SpellHash = packet.ReadInteger(); - result.SpellNetworkId = packet.ReadInteger(); + #endregion - packet.ReadByte(); //this always used to be 0, maybe flag now - packet.ReadFloat(); // always 1 - packet.ReadFloat(); // always player nID - packet.ReadFloat(); // always player nID - result.MissileHash = packet.ReadInteger(); - result.MissileNetworkId = packet.ReadInteger(); + #region Resume 4.21 (NO STRUCT) - var p = packet.Position + 8; - result.ToPosition = new Vector2(packet.ReadFloat(), packet.ReadFloat(p)); - packet.Position += 4; + /// + /// Sent by client on resume. + /// + public static class Resume + { + //19 00 00 00 00 00 00 00 00 00 90 + /// + /// The header + /// + public static byte Header = 0x19; + } - var c = packet.ReadByte(65); - if (c > 0) //hopefully c is 1 always - { - result.TargetNetworkId = packet.ReadInteger(); - result.TargetUnit = ObjectManager.GetUnitByNetworkId(result.TargetNetworkId); - packet.ReadByte(); // for 0 - } - result.ChannelTime = packet.ReadFloat(); - result.Delay = packet.ReadFloat(); - result.Visible = packet.ReadFloat(); - result.IsVisible = result.Visible > 0; - result.Cooldown = packet.ReadFloat(); + #endregion + } - packet.ReadInteger(); - packet.ReadByte(); + /// + /// Contains packet that are sent from the server to the client (the game). + /// + public static class S2C + { + #region Ping - 4.21 - result.SpellSlot = (SpellSlot)packet.ReadByte(); - result.SpellFlag2 = packet.ReadByte(); - result.ManaCost = packet.ReadFloat(); + /// + /// RPing Packet. Received when ally team players send a SPing packet. + /// + public static class Ping + { + /// + /// The header + /// + public static byte Header = 0x60; - p = packet.Position + 8; - result.FromPosition = new Vector2(packet.ReadFloat(), packet.ReadFloat(p)); + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; - return result; - } + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. public static GamePacket Encoded(Struct packetStruct) { - //TODO when the packet is fully decoded. - return new GamePacket(Header); + var result = new GamePacket(Header, Channel, Flags); + result.WriteByte(0); + result.WriteInteger(0); + result.WriteInteger(packetStruct.TargetNetworkId); + result.WriteByte((byte)packetStruct.Type); + result.WriteInteger(packetStruct.SourceNetworkId); + result.WriteFloat(packetStruct.X); + result.WriteFloat(packetStruct.Y); + var bit = packetStruct.Silent ? (byte) 0x14 : (byte) 0x1B; + result.WriteByte(bit); + return result; } - #endregion + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data) { Position = 6 }; + var targetNetworkId = packet.ReadInteger(); + var type = packet.ReadByte(); + var sourceNetworkId = packet.ReadInteger(); + var x = packet.ReadFloat(); + var y = packet.ReadFloat(); + var silent = (packet.ReadByte() & 1) != 1; + return new Struct( + x, y, targetNetworkId, sourceNetworkId, + (PingType)type, silent); + } /// - /// Represents the packet received when a spell is casted. + /// Represents the packet received when an ally sends a ping. /// public struct Struct { - #region Fields - - /// - /// The channel time - /// - public float ChannelTime; - - /// - /// The cooldown. Maybe 0. - /// - public float Cooldown; // sometimes 0 - - /// - /// The delay - /// - public float Delay; - - /// - /// From position - /// - public Vector2 FromPosition; - - /// - /// true if the spell cast is visible - /// - public bool IsVisible; - - /// - /// The mana cost - /// - public float ManaCost; - - /// - /// The missile hash - /// - public int MissileHash; - /// - /// The missile network identifier + /// true if the ping is silent, meaning that the ping produces no sound. /// - public int MissileNetworkId; + public bool Silent; /// - /// The source network identifier + /// The source network identifier /// public int SourceNetworkId; /// - /// The source unit - /// - public Obj_AI_Base SourceUnit; - - /// - /// The speed - /// - public float Speed; - - /// - /// The spell flag - /// - public short SpellFlag; - - /// - /// The spell flag2 - /// - public byte SpellFlag2; - - /// - /// The spell hash - /// - public int SpellHash; - - /// - /// The spell network identifier - /// - public int SpellNetworkId; - - /// - /// The spell slot + /// The target network identifier /// - public SpellSlot SpellSlot; + public int TargetNetworkId; /// - /// The target network identifier + /// The ping type /// - public int TargetNetworkId; + public PingType Type; /// - /// The target unit + /// The x position /// - public Obj_AI_Base TargetUnit; + public float X; /// - /// To position + /// The y position /// - public Vector2 ToPosition; + public float Y; /// - /// If this value is greater than 0, the spell cast is visible. + /// Initializes a new instance of the struct. /// - public float Visible; // >0 visible - - #endregion + /// The x. + /// The y. + /// The target network identifier. + /// The source network identifier. + /// The type. + /// if set to true [silent]. + public Struct(float x = 0f, + float y = 0f, + int targetNetworkId = 0, + int sourceNetworkId = 0, + PingType type = PingType.Normal, + bool silent = false) + { + X = x; + Y = y; + TargetNetworkId = targetNetworkId; + SourceNetworkId = sourceNetworkId; + Type = type; + Silent = silent; + } } } + #endregion + + #region GainVision - 4.21 + /// - /// Gets received when a unit dashes. + /// Gets received when a unit enters FOW. /// - public static class Dash + public static class GainVision { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xD7; - - #endregion - - #region Public Methods and Operators - - /// - /// Decodes the specified data. - /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); - - result.UnitNetworkId = packet.ReadInteger(12); - result.Speed = 900; //packet.ReadFloat(); - - return result; - } + public static byte Header = 0xFC; /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. public static GamePacket Encoded(Struct packetStruct) { - //TODO when the packet is fully decoded. - return new GamePacket(Header); - } - - #endregion - - /// - /// Represents the packet received when a unit dashes. - /// - public struct Struct - { - #region Fields - - /// - /// The speed - /// - public float Speed; - - /// - /// The unit network identifier - /// - public int UnitNetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The unit network identifier. - /// The speed. - public Struct(int unitNetworkId = 0, float speed = 0) - { - this.UnitNetworkId = unitNetworkId; - this.Speed = speed; - } - - #endregion + //Not fully encoded + var result = new GamePacket(Header); + result.WriteByte(0); + result.WriteInteger(packetStruct.UnitNetworkId); + result.WriteShort(0); + return result; } - } - - /// - /// Gets received when gaining vision of an empty jungle camp. Partially implemented. - /// - public static class EmptyJungleCamp - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x93; - - #endregion - - #region Public Methods and Operators /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -2368,449 +2051,388 @@ public static Struct Decoded(byte[] data) { var packet = new GamePacket(data); var result = new Struct(); - result.CampId = packet.ReadInteger(6); - result.UnitNetworkId = packet.ReadInteger(); - //No idea where this is now or if it still exists :^) - result.EmptyType = packet.ReadByte(); - return result; - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header); - result.WriteByte(0); - result.WriteInteger(0); - result.WriteInteger(packetStruct.CampId); - result.WriteInteger(packetStruct.UnitNetworkId); - - //No idea where this is now or if it still exists :^) - result.WriteByte(packetStruct.EmptyType); + result.UnitNetworkId = packet.ReadInteger(2); return result; } - #endregion - /// - /// Represents the packet received when a jungle camp is empty. + /// Represents the packet received when the team gains vision of a unit. /// public struct Struct { - #region Fields - - /// - /// The camp identifier - /// - public int CampId; - /// - /// The empty type - /// - public byte EmptyType; - - /// - /// The unit network identifier + /// The unit network identifier /// public int UnitNetworkId; - #endregion - - #region Constructors and Destructors - /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The unit network identifier. - /// The camp identifier. - /// The empty type. - public Struct(int unitNetworkId = 0, int campId = 0, byte emptyType = 0) + public Struct(int unitNetworkId = 0) { - this.UnitNetworkId = unitNetworkId; - this.CampId = campId; - this.EmptyType = emptyType; + UnitNetworkId = unitNetworkId; } - - #endregion } } + #endregion + + #region LoseVision - 4.21 + /// - /// Gets received when a unit enters FOW. + /// Gets received when a unit leaves FOW. /// - public static class GainVision + public static class LoseVision { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xFC; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0xCD; - /// - /// Decodes the specified data. - /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); - result.UnitNetworkId = packet.ReadInteger(2); - return result; - } /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. public static GamePacket Encoded(Struct packetStruct) { - //Not fully encoded var result = new GamePacket(Header); result.WriteByte(0); result.WriteInteger(packetStruct.UnitNetworkId); - result.WriteShort(0); return result; } - #endregion + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data) { Position = 2 }; + return new Struct(packet.ReadInteger()); + } /// - /// Represents the packet received when the team gains vision of a unit. + /// Represents the packet received when the team loses vision of an unit. /// public struct Struct { - #region Fields - /// - /// The unit network identifier + /// The unit network identifier /// public int UnitNetworkId; - #endregion - - #region Constructors and Destructors - /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The unit network identifier. public Struct(int unitNetworkId = 0) { - this.UnitNetworkId = unitNetworkId; + UnitNetworkId = unitNetworkId; } - - #endregion } } + #endregion + + #region EmptyJungleCamp - 4.21 partially /// - /// Gets received when the game ends. + /// Gets received when gaining vision of an empty jungle camp. Partially implemented. /// - public static class GameEnd + public static class EmptyJungleCamp { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xED; - - #endregion - - #region Public Methods and Operators - - /// - /// Decodes the specified data. - /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); - - result.Winner = packet.ReadByte(5); - return result; - } + public static byte Header = 0x93; /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. public static GamePacket Encoded(Struct packetStruct) { var result = new GamePacket(Header); + result.WriteByte(0); result.WriteInteger(0); - result.WriteByte(packetStruct.Winner); - return result; - } - - #endregion - - /// - /// Represents the packet received when the game ends. - /// - public struct Struct - { - #region Fields - - /// - /// The winner - /// - public byte Winner; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The winner. - public Struct(byte winner = 1) - { - this.Winner = winner; - } + result.WriteInteger(packetStruct.CampId); + result.WriteInteger(packetStruct.UnitNetworkId); - #endregion + //No idea where this is now or if it still exists :^) + result.WriteByte(packetStruct.EmptyType); + return result; } - } - - /// - /// Gets received when a unit leaves FOW. - /// - public static class LoseVision - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xCD; - - #endregion - - #region Public Methods and Operators /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data) { Position = 2 }; - return new Struct(packet.ReadInteger()); - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header); - result.WriteByte(0); - result.WriteInteger(packetStruct.UnitNetworkId); + var packet = new GamePacket(data); + var result = new Struct(); + result.CampId = packet.ReadInteger(6); + result.UnitNetworkId = packet.ReadInteger(); + //No idea where this is now or if it still exists :^) + result.EmptyType = packet.ReadByte(); return result; } - #endregion - /// - /// Represents the packet received when the team loses vision of an unit. + /// Represents the packet received when a jungle camp is empty. /// public struct Struct { - #region Fields - /// - /// The unit network identifier + /// The camp identifier /// - public int UnitNetworkId; + public int CampId; - #endregion + /// + /// The empty type + /// + public byte EmptyType; - #region Constructors and Destructors + /// + /// The unit network identifier + /// + public int UnitNetworkId; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The unit network identifier. - public Struct(int unitNetworkId = 0) + /// The camp identifier. + /// The empty type. + public Struct(int unitNetworkId = 0, int campId = 0, byte emptyType = 0) { - this.UnitNetworkId = unitNetworkId; + UnitNetworkId = unitNetworkId; + CampId = campId; + EmptyType = emptyType; } - - #endregion } } + #endregion + + #region CastAns + /// - /// RPing Packet. Received when ally team players send a SPing packet. + /// Received when a unit casts a spell. /// - public static class Ping + public static class CastAns { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - /// - /// The flags + /// The header /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + public static byte Header = 0xB5; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0x60; - - #endregion - - #region Public Methods and Operators + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + //TODO when the packet is fully decoded. + return new GamePacket(Header); + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data) { Position = 6 }; - var targetNetworkId = packet.ReadInteger(); - var type = packet.ReadByte(); - var sourceNetworkId = packet.ReadInteger(); - var x = packet.ReadFloat(); - var y = packet.ReadFloat(); - var silent = (packet.ReadByte() & 1) != 1; - return new Struct(x, y, targetNetworkId, sourceNetworkId, (PingType)type, silent); - } + var packet = new GamePacket(data); + var result = new Struct(); + + result.SourceNetworkId = packet.ReadInteger(1); + result.SourceUnit = ObjectManager.GetUnitByNetworkId(result.SourceNetworkId); + + + result.SpellFlag = packet.ReadShort(10); + result.SpellHash = packet.ReadInteger(); + result.SpellNetworkId = packet.ReadInteger(); + + packet.ReadByte(); //this always used to be 0, maybe flag now + packet.ReadFloat(); // always 1 + packet.ReadFloat(); // always player nID + packet.ReadFloat(); // always player nID + + result.MissileHash = packet.ReadInteger(); + result.MissileNetworkId = packet.ReadInteger(); + + var p = packet.Position + 8; + result.ToPosition = new Vector2(packet.ReadFloat(), packet.ReadFloat(p)); + packet.Position += 4; + + var c = packet.ReadByte(65); + if (c > 0) //hopefully c is 1 always + { + result.TargetNetworkId = packet.ReadInteger(); + result.TargetUnit = ObjectManager.GetUnitByNetworkId(result.TargetNetworkId); + packet.ReadByte(); // for 0 + } + result.ChannelTime = packet.ReadFloat(); + result.Delay = packet.ReadFloat(); + result.Visible = packet.ReadFloat(); + result.IsVisible = result.Visible > 0; + result.Cooldown = packet.ReadFloat(); + + packet.ReadInteger(); + packet.ReadByte(); + + result.SpellSlot = (SpellSlot) packet.ReadByte(); + result.SpellFlag2 = packet.ReadByte(); + result.ManaCost = packet.ReadFloat(); + + p = packet.Position + 8; + result.FromPosition = new Vector2(packet.ReadFloat(), packet.ReadFloat(p)); - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header, Channel, Flags); - result.WriteByte(0); - result.WriteInteger(0); - result.WriteInteger(packetStruct.TargetNetworkId); - result.WriteByte((byte)packetStruct.Type); - result.WriteInteger(packetStruct.SourceNetworkId); - result.WriteFloat(packetStruct.X); - result.WriteFloat(packetStruct.Y); - var bit = packetStruct.Silent ? (byte)0x14 : (byte)0x1B; - result.WriteByte(bit); return result; } - #endregion - /// - /// Represents the packet received when an ally sends a ping. + /// Represents the packet received when a spell is casted. /// public struct Struct { - #region Fields + /// + /// The channel time + /// + public float ChannelTime; /// - /// true if the ping is silent, meaning that the ping produces no sound. + /// The cooldown. Maybe 0. /// - public bool Silent; + public float Cooldown; // sometimes 0 + + /// + /// The delay + /// + public float Delay; + + /// + /// From position + /// + public Vector2 FromPosition; + + /// + /// true if the spell cast is visible + /// + public bool IsVisible; + + /// + /// The mana cost + /// + public float ManaCost; + + /// + /// The missile hash + /// + public int MissileHash; + + /// + /// The missile network identifier + /// + public int MissileNetworkId; /// - /// The source network identifier + /// The source network identifier /// public int SourceNetworkId; /// - /// The target network identifier + /// The source unit /// - public int TargetNetworkId; + public Obj_AI_Base SourceUnit; /// - /// The ping type + /// The speed /// - public PingType Type; + public float Speed; /// - /// The x position + /// The spell flag /// - public float X; + public short SpellFlag; /// - /// The y position + /// The spell flag2 /// - public float Y; + public byte SpellFlag2; - #endregion + /// + /// The spell hash + /// + public int SpellHash; - #region Constructors and Destructors + /// + /// The spell network identifier + /// + public int SpellNetworkId; /// - /// Initializes a new instance of the struct. + /// The spell slot /// - /// The x. - /// The y. - /// The target network identifier. - /// The source network identifier. - /// The type. - /// if set to true [silent]. - public Struct( - float x = 0f, - float y = 0f, - int targetNetworkId = 0, - int sourceNetworkId = 0, - PingType type = PingType.Normal, - bool silent = false) - { - this.X = x; - this.Y = y; - this.TargetNetworkId = targetNetworkId; - this.SourceNetworkId = sourceNetworkId; - this.Type = type; - this.Silent = silent; - } + public SpellSlot SpellSlot; + + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The target unit + /// + public Obj_AI_Base TargetUnit; + + /// + /// To position + /// + public Vector2 ToPosition; - #endregion + /// + /// If this value is greater than 0, the spell cast is visible. + /// + public float Visible; // >0 visible } } + #endregion + + #region Dash - 4.12 only header updated + /// - /// Gets received when an unit uses an emote. + /// Gets received when a unit dashes. /// - public static class PlayEmote + public static class Dash { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xAA; - - #endregion + public static byte Header = 0xD7; - #region Public Methods and Operators + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + //TODO when the packet is fully decoded. + return new GamePacket(Header); + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -2818,889 +2440,684 @@ public static Struct Decoded(byte[] data) { var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(2); - result.EmoteId = packet.ReadByte(); - return result; - } - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header); - result.WriteByte(0); - result.WriteInteger(packetStruct.NetworkId); - result.WriteByte(packetStruct.EmoteId); + result.UnitNetworkId = packet.ReadInteger(12); + result.Speed = 900;//packet.ReadFloat(); + return result; } - #endregion - /// - /// Represents the packet received when a unit uses an emote. + /// Represents the packet received when a unit dashes. /// public struct Struct { - #region Fields - /// - /// The emote identifier + /// The speed /// - public byte EmoteId; - + public float Speed; /// - /// The network identifier + /// The unit network identifier /// - public int NetworkId; - - #endregion - - #region Constructors and Destructors + public int UnitNetworkId; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// - /// The emote identifier. - /// The network identifier. - public Struct(byte emoteId, int networkId = -1) + /// The unit network identifier. + /// The speed. + public Struct(int unitNetworkId = 0, float speed = 0) { - this.EmoteId = emoteId; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + UnitNetworkId = unitNetworkId; + Speed = speed; } - - #endregion } } - /// - /// Received by the server when refund is sent. - /// - public static class RefundConfirm - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x49; + #endregion - #endregion - } + #region GameEnd - 4.21 /// - /// Refund token contains refund amount, when leaving base or casting spell/item it's set to 0. + /// Gets received when the game ends. /// - public static class RefundToken + public static class GameEnd { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xE9; - - #endregion + public static byte Header = 0xED; - #region Public Methods and Operators + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header); + result.WriteInteger(0); + result.WriteByte(packetStruct.Winner); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - return new Struct { RefundCount = data[6] }; - } + var packet = new GamePacket(data); + var result = new Struct(); - /// - /// Encodes the specified undo amount. - /// - /// The undo amount. - /// GamePacket. - public static GamePacket Encoded(int undoAmount) - { - var packet = new GamePacket(Header); - packet.WriteByte(0); - packet.WriteInteger(ObjectManager.Player.NetworkId); - packet.WriteInteger(undoAmount); - return packet; + result.Winner = packet.ReadByte(5); + return result; } - #endregion - /// - /// Represents the packet received when refunding an item. + /// Represents the packet received when the game ends. /// public struct Struct { - #region Fields - /// - /// The refund count + /// The winner /// - public int RefundCount; + public byte Winner; - #endregion + /// + /// Initializes a new instance of the struct. + /// + /// The winner. + public Struct(byte winner = 1) + { + Winner = winner; + } } } + #endregion + + #region TowerAggro + /// - /// Gets received when a unit starts, aborts or finishes a teleport (such as recall, teleport, twisted fate ulti, shen - /// ulti,...) + /// Gets received when a tower starts targeting a unit /// - public static class Teleport + public static class TowerAggro { - #region Constants - /// - /// The error gap in ticks. + /// The header /// - private const int ErrorGap = 100; //in ticks - - #endregion - - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x44; + public static byte Header = 0x6A; /// - /// The recall data by network identifier + /// The aggro list /// - private static readonly IDictionary RecallDataByNetworkId = - new Dictionary(); + public static readonly Dictionary AggroList = new Dictionary(); /// - /// The type by string + /// Encodes the specified packet structure. /// - private static readonly IDictionary TypeByString = - new Dictionary - { - { "Recall", new RecallTeleport() }, { "Teleport", new TeleportTeleport() }, - { "Gate", new TwistedFateTeleport() }, { "Shen", new ShenTeleport() }, - }; - - #endregion - - #region Enums + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header); + result.WriteInteger(packetStruct.TurretNetworkId); + result.WriteInteger(packetStruct.TargetNetworkId); + return result; + } /// - /// The status of the teleport. + /// Decodes the specified data. /// - public enum Status + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) { - /// - /// The teleport has been started. - /// - Start, + var packet = new GamePacket(data); + var result = new Struct(); - /// - /// The teleport has been aborted. - /// - Abort, + result.TurretNetworkId = packet.ReadInteger(1); + result.TargetNetworkId = packet.ReadInteger(); - /// - /// The teleport has finished. - /// - Finish, + if (result.TurretNetworkId != 0) + { + AggroList[result.TurretNetworkId] = result.TargetNetworkId; + } - /// - /// The status of the teleport is unknown. - /// - Unknown + return result; } /// - /// The type of teleport. + /// Represents the packet received when a tower focuses a target. /// - public enum Type + public struct Struct { /// - /// The unit is recalling back to base. - /// - Recall, - - /// - /// The unit is teleporting to another unit with the Teleport summoner spell. - /// - Teleport, - - /// - /// The unit is teleporting to a location with Twisted Fate's Ultimate. + /// The target network identifier /// - TwistedFate, + public int TargetNetworkId; /// - /// The unit is teleporting to a unit with Shen's Ultimate. + /// The turret network identifier /// - Shen, + public int TurretNetworkId; /// - /// The type of teleportation is unknown. + /// Initializes a new instance of the struct. /// - Unknown + /// The turret network identifier. + /// The target network identifier. + public Struct(int turretNetworkId, int targetNetworkId) + { + TurretNetworkId = turretNetworkId; + TargetNetworkId = targetNetworkId; + } } + } - #endregion + #endregion - #region Interfaces + #region UpdateModel + /// + /// Gets received when the model changes. + /// + public static class UpdateModel + { /// - /// An interface for different types of teleports to get durations and type of teleport. + /// The header /// - internal interface ITeleport - { - #region Public Properties - - /// - /// Gets the type. - /// - /// The type. - Type Type { get; } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the duration. - /// - /// The instance containing the event data. - /// System.Int32. - int GetDuration(GameObjectTeleportEventArgs packetData); - - #endregion - } - - #endregion - - #region Public Methods and Operators + public static byte Header = 0x1A; /// - /// Decodes the specified sender. + /// Encodes the specified packet structure. /// - /// The sender. - /// The instance containing the event data. - /// Struct. - public static Struct Decoded(GameObject sender, GameObjectTeleportEventArgs args) // + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) { - var result = new Struct { Status = Status.Unknown, Type = Type.Unknown }; - - if (sender == null || !sender.IsValid || !(sender is Obj_AI_Hero)) - { - return result; - } - - result.UnitNetworkId = sender.NetworkId; - - var hero = sender as Obj_AI_Hero; - - if (!RecallDataByNetworkId.ContainsKey(result.UnitNetworkId)) - { - RecallDataByNetworkId[result.UnitNetworkId] = new TeleportData { Type = Type.Unknown }; - } - - if (!string.IsNullOrEmpty(args.RecallType)) + var result = new GamePacket(Header); + result.WriteByte(0); + result.WriteInteger(packetStruct.NetworkId); + result.WriteInteger(packetStruct.NetworkId & ~0x40000000); + result.WriteByte((byte) (packetStruct.BOk ? 1 : 0)); + result.WriteInteger(packetStruct.SkinId); + for (var i = 0; i < 32; i++) { - if (TypeByString.ContainsKey(args.RecallType)) + if (i < packetStruct.ModelName.Length) { - ITeleport teleportMethod = TypeByString[args.RecallType]; - - var duration = teleportMethod.GetDuration(args); - var type = teleportMethod.Type; - var time = Utils.TickCount; - - RecallDataByNetworkId[result.UnitNetworkId] = new TeleportData - { - Duration = duration, Type = type, - Start = time - }; - - result.Status = Status.Start; - result.Duration = duration; - result.Type = type; - result.Start = time; + result.WriteByte((byte) packetStruct.ModelName[i]); + } + else + { + result.WriteByte(0x00); } } - else - { - var shorter = Utils.TickCount - RecallDataByNetworkId[result.UnitNetworkId].Start - < RecallDataByNetworkId[result.UnitNetworkId].Duration - ErrorGap; - result.Status = shorter ? Status.Abort : Status.Finish; - result.Type = RecallDataByNetworkId[result.UnitNetworkId].Type; - result.Duration = 0; - result.Start = 0; - } + return result; } /// - /// Encodes the specified packet structure. + /// Decodes the specified data. /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) { - //TODO when the packet is fully decoded. - return new GamePacket(Header); - } + var packet = new GamePacket(data); + var result = new Struct(); - #endregion + result.NetworkId = packet.ReadInteger(2); + result.Id = packet.ReadInteger(); + result.BOk = packet.ReadByte() == 0x01; + result.SkinId = packet.ReadInteger(); + + return result; + } /// - /// Represents the packet received when a unit teleports. + /// Represents the packet received when the model of a unit is updated. /// public struct Struct { - #region Fields + /// + /// The b ok + /// + public bool BOk; /// - /// The duration + /// The identifier /// - public int Duration; + public int Id; /// - /// The start + /// The model name /// - public int Start; + public string ModelName; /// - /// The status + /// The network identifier /// - public Status Status; + public int NetworkId; /// - /// The type + /// The skin identifier /// - public Type Type; + public int SkinId; /// - /// The unit network identifier + /// Initializes a new instance of the struct. /// - public int UnitNetworkId; + /// The network identifier. + /// The skin identifier. + /// Name of the model. + /// if set to true [b ok]. + /// The identifier. + public Struct(int networkId, int skinId, string modelName, bool bOk = true, int id = -1) + { + NetworkId = networkId; + Id = id != -1 ? id : NetworkId & ~0x40000000; + BOk = bOk; + SkinId = skinId; + ModelName = modelName; + } + } + } - #endregion + #endregion - #region Constructors and Destructors + #region Teleport - 4.21 + /// + /// Gets received when a unit starts, aborts or finishes a teleport (such as recall, teleport, twisted fate ulti, shen + /// ulti,...) + /// + public static class Teleport + { + /// + /// The status of the teleport. + /// + public enum Status + { /// - /// Initializes a new instance of the struct. + /// The teleport has been started. /// - /// The unit network identifier. - /// The status. - /// The type. - /// The duration. - /// The start. - public Struct(int unitNetworkId, Status status, Type type, int duration, int start = 0) - { - this.UnitNetworkId = unitNetworkId; - this.Status = status; - this.Type = type; - this.Duration = duration; - this.Start = start; - } + Start, + + /// + /// The teleport has been aborted. + /// + Abort, + + /// + /// The teleport has finished. + /// + Finish, - #endregion + /// + /// The status of the teleport is unknown. + /// + Unknown } /// - /// Contains data about the teleport. + /// The type of teleport. /// - internal struct TeleportData + public enum Type { - #region Public Properties + /// + /// The unit is recalling back to base. + /// + Recall, /// - /// Gets or sets the duration. + /// The unit is teleporting to another unit with the Teleport summoner spell. /// - /// The duration. - public int Duration { get; set; } + Teleport, + + /// + /// The unit is teleporting to a location with Twisted Fate's Ultimate. + /// + TwistedFate, + + /// + /// The unit is teleporting to a unit with Shen's Ultimate. + /// + Shen, /// - /// Gets or sets the start. + /// The type of teleportation is unknown. /// - /// The start. - public int Start { get; set; } + Unknown + } + /// + /// An interface for different types of teleports to get durations and type of teleport. + /// + internal interface ITeleport + { /// - /// Gets or sets the type. + /// Gets the type. /// /// The type. - public Type Type { get; set; } + Type Type { get; } - #endregion + /// + /// Gets the duration. + /// + /// The instance containing the event data. + /// System.Int32. + int GetDuration(GameObjectTeleportEventArgs packetData); } /// - /// A recall teleport. + /// A recall teleport. /// internal class RecallTeleport : ITeleport { - #region Public Properties - /// - /// Gets the type. + /// Gets the type. /// /// The type. public Type Type { - get - { - return Type.Recall; - } + get { return Type.Recall; } } - #endregion - - #region Public Methods and Operators - /// - /// Gets the duration. + /// Gets the duration. /// - /// The instance containing the event data. + /// The instance containing the event data. /// System.Int32. public int GetDuration(GameObjectTeleportEventArgs args) { return Utility.GetRecallTime(args.RecallName); } - - #endregion } /// - /// A Shen's Ultimate teleport. + /// A teleport summoner spell teleport. /// - internal class ShenTeleport : ITeleport + internal class TeleportTeleport : ITeleport { - #region Public Properties - /// - /// Gets the type. + /// Gets the type. /// /// The type. public Type Type { - get - { - return Type.Shen; - } + get { return Type.Teleport; } } - #endregion - - #region Public Methods and Operators - /// - /// Gets the duration. + /// Gets the duration. /// - /// The instance containing the event data. + /// The instance containing the event data. /// System.Int32. public int GetDuration(GameObjectTeleportEventArgs args) { - return 3000; + return 3500; } - - #endregion } /// - /// A teleport summoner spell teleport. + /// A Twisted Fate's Ultimate Teleport. /// - internal class TeleportTeleport : ITeleport + internal class TwistedFateTeleport : ITeleport { - #region Public Properties - /// - /// Gets the type. + /// Gets the type. /// /// The type. public Type Type { - get - { - return Type.Teleport; - } + get { return Type.TwistedFate; } } - #endregion - - #region Public Methods and Operators - /// - /// Gets the duration. + /// Gets the duration. /// - /// The instance containing the event data. + /// The instance containing the event data. /// System.Int32. public int GetDuration(GameObjectTeleportEventArgs args) { - return 3500; + return 1500; } - - #endregion } /// - /// A Twisted Fate's Ultimate Teleport. + /// A Shen's Ultimate teleport. /// - internal class TwistedFateTeleport : ITeleport + internal class ShenTeleport : ITeleport { - #region Public Properties - /// - /// Gets the type. + /// Gets the type. /// /// The type. public Type Type { - get - { - return Type.TwistedFate; - } + get { return Type.Shen; } } - #endregion - - #region Public Methods and Operators - /// - /// Gets the duration. + /// Gets the duration. /// - /// The instance containing the event data. + /// The instance containing the event data. /// System.Int32. public int GetDuration(GameObjectTeleportEventArgs args) { - return 1500; + return 3000; } - - #endregion } - } - /// - /// Gets received when a tower starts targeting a unit - /// - public static class TowerAggro - { - #region Static Fields /// - /// The aggro list + /// The header /// - public static readonly Dictionary AggroList = new Dictionary(); + public static byte Header = 0x44; /// - /// The header + /// The error gap in ticks. /// - public static byte Header = 0x6A; - - #endregion - - #region Public Methods and Operators + private const int ErrorGap = 100; //in ticks /// - /// Decodes the specified data. + /// The type by string /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) + private static readonly IDictionary TypeByString = new Dictionary { - var packet = new GamePacket(data); - var result = new Struct(); - - result.TurretNetworkId = packet.ReadInteger(1); - result.TargetNetworkId = packet.ReadInteger(); - - if (result.TurretNetworkId != 0) - { - AggroList[result.TurretNetworkId] = result.TargetNetworkId; - } + {"Recall", new RecallTeleport()}, + {"Teleport", new TeleportTeleport()}, + {"Gate", new TwistedFateTeleport()}, + {"Shen", new ShenTeleport()}, + }; - return result; - } + /// + /// The recall data by network identifier + /// + private static readonly IDictionary RecallDataByNetworkId = + new Dictionary(); /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. public static GamePacket Encoded(Struct packetStruct) { - var result = new GamePacket(Header); - result.WriteInteger(packetStruct.TurretNetworkId); - result.WriteInteger(packetStruct.TargetNetworkId); - return result; + //TODO when the packet is fully decoded. + return new GamePacket(Header); } - #endregion - /// - /// Represents the packet received when a tower focuses a target. + /// Decodes the specified sender. /// - public struct Struct + /// The sender. + /// The instance containing the event data. + /// Struct. + public static Struct Decoded(GameObject sender, GameObjectTeleportEventArgs args) // { - #region Fields - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The turret network identifier - /// - public int TurretNetworkId; - - #endregion - - #region Constructors and Destructors + var result = new Struct + { + Status = Status.Unknown, + Type = Type.Unknown + }; - /// - /// Initializes a new instance of the struct. - /// - /// The turret network identifier. - /// The target network identifier. - public Struct(int turretNetworkId, int targetNetworkId) + if(sender == null || !sender.IsValid || !(sender is Obj_AI_Hero)) { - this.TurretNetworkId = turretNetworkId; - this.TargetNetworkId = targetNetworkId; + return result; } - #endregion - } - } - - /// - /// Gets received when the model changes. - /// - public static class UpdateModel - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x1A; + result.UnitNetworkId = sender.NetworkId; - #endregion + var hero = sender as Obj_AI_Hero; - #region Public Methods and Operators + if (!RecallDataByNetworkId.ContainsKey(result.UnitNetworkId)) + { + RecallDataByNetworkId[result.UnitNetworkId] = new TeleportData {Type = Type.Unknown}; + } - /// - /// Decodes the specified data. - /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); + if (!string.IsNullOrEmpty(args.RecallType)) + { + if (TypeByString.ContainsKey(args.RecallType)) + { + ITeleport teleportMethod = TypeByString[args.RecallType]; - result.NetworkId = packet.ReadInteger(2); - result.Id = packet.ReadInteger(); - result.BOk = packet.ReadByte() == 0x01; - result.SkinId = packet.ReadInteger(); + int duration = teleportMethod.GetDuration(args); + Type type = teleportMethod.Type; + int time = Utils.TickCount; - return result; - } + RecallDataByNetworkId[result.UnitNetworkId] = new TeleportData + { + Duration = duration, + Type = type, + Start = time + }; - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var result = new GamePacket(Header); - result.WriteByte(0); - result.WriteInteger(packetStruct.NetworkId); - result.WriteInteger(packetStruct.NetworkId & ~0x40000000); - result.WriteByte((byte)(packetStruct.BOk ? 1 : 0)); - result.WriteInteger(packetStruct.SkinId); - for (var i = 0; i < 32; i++) - { - if (i < packetStruct.ModelName.Length) - { - result.WriteByte((byte)packetStruct.ModelName[i]); - } - else - { - result.WriteByte(0x00); + result.Status = Status.Start; + result.Duration = duration; + result.Type = type; + result.Start = time; } } - + else + { + bool shorter = Utils.TickCount - RecallDataByNetworkId[result.UnitNetworkId].Start < + RecallDataByNetworkId[result.UnitNetworkId].Duration - ErrorGap; + result.Status = shorter ? Status.Abort : Status.Finish; + result.Type = RecallDataByNetworkId[result.UnitNetworkId].Type; + result.Duration = 0; + result.Start = 0; + } return result; } - #endregion - /// - /// Represents the packet received when the model of a unit is updated. + /// Contains data about the teleport. /// - public struct Struct + internal struct TeleportData { - #region Fields - - /// - /// The b ok - /// - public bool BOk; - - /// - /// The identifier - /// - public int Id; - - /// - /// The model name - /// - public string ModelName; - - /// - /// The network identifier - /// - public int NetworkId; - /// - /// The skin identifier + /// Gets or sets the type. /// - public int SkinId; - - #endregion - - #region Constructors and Destructors + /// The type. + public Type Type { get; set; } /// - /// Initializes a new instance of the struct. - /// - /// The network identifier. - /// The skin identifier. - /// Name of the model. - /// if set to true [b ok]. - /// The identifier. - public Struct(int networkId, int skinId, string modelName, bool bOk = true, int id = -1) - { - this.NetworkId = networkId; - this.Id = id != -1 ? id : this.NetworkId & ~0x40000000; - this.BOk = bOk; - this.SkinId = skinId; - this.ModelName = modelName; - } - - #endregion - } - } - - /// - /// Packet received on gold change. - /// - public class AddGold - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x22; - - #endregion - - #region Public Methods and Operators - - /// - /// Decodes the specified data. - /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); - - result.ReceivingNetworkId = packet.ReadInteger(5); - result.ReceivingUnit = ObjectManager.GetUnitByNetworkId(result.ReceivingNetworkId); - result.SourceNetworkId = packet.ReadInteger(); - result.SourceUnit = ObjectManager.GetUnitByNetworkId(result.SourceNetworkId); - result.Gold = packet.ReadFloat(); - return result; - } - - /// - /// Encodes the specified p structure. - /// - /// The p structure. - /// GamePacket. - public static GamePacket Encoded(Struct pStruct) - { - var packet = new GamePacket(Header); - packet.WriteInteger(pStruct.ReceivingNetworkId); - packet.WriteInteger(pStruct.ReceivingNetworkId); - packet.WriteInteger(pStruct.SourceNetworkId); - packet.WriteFloat(pStruct.Gold); - return packet; - } + /// Gets or sets the start. + /// + /// The start. + public int Start { get; set; } + + /// + /// Gets or sets the duration. + /// + /// The duration. + public int Duration { get; set; } - #endregion + } /// - /// Represents the packet received when a unit's gold is changed. + /// Represents the packet received when a unit teleports. /// public struct Struct { - #region Fields - /// - /// The gold + /// The duration /// - public float Gold; + public int Duration; /// - /// The receiving network identifier + /// The status /// - public int ReceivingNetworkId; + public Status Status; /// - /// The receiving unit + /// The type /// - public Obj_AI_Base ReceivingUnit; + public Type Type; /// - /// The source network identifier + /// The start /// - public int SourceNetworkId; + public int Start; /// - /// The source unit + /// The unit network identifier /// - public Obj_AI_Base SourceUnit; + public int UnitNetworkId; - #endregion + /// + /// Initializes a new instance of the struct. + /// + /// The unit network identifier. + /// The status. + /// The type. + /// The duration. + /// The start. + public Struct(int unitNetworkId, Status status, Type type, int duration, int start = 0) + { + UnitNetworkId = unitNetworkId; + Status = status; + Type = type; + Duration = duration; + Start = start; + } } } + #endregion + + #region PlayEmote - 4.21 + /// - /// Packet received on buying item. + /// Gets received when an unit uses an emote. /// - public class BuyItemAns + public static class PlayEmote { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0x6F; - - #endregion + public static byte Header = 0xAA; - #region Public Methods and Operators + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var result = new GamePacket(Header); + result.WriteByte(0); + result.WriteInteger(packetStruct.NetworkId); + result.WriteByte(packetStruct.EmoteId); + return result; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -3708,140 +3125,76 @@ public static Struct Decoded(byte[] data) { var packet = new GamePacket(data); var result = new Struct(); - - result.NetworkId = packet.ReadInteger(1); - result.Item = new Items.Item(packet.ReadShort(), 0); - packet.Position += 2; - result.InventorySlot = packet.ReadByte(); - result.SpellSlot = (SpellSlot)(result.InventorySlot + (byte)SpellSlot.Item1); - result.Stack = packet.ReadByte(); - result.Charge = packet.ReadByte(); - result.ReplaceItem = packet.ReadByte(); - + result.NetworkId = packet.ReadInteger(2); + result.EmoteId = packet.ReadByte(); return result; } /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct pStruct) - { - var packet = new GamePacket(Header); - packet.WriteInteger(pStruct.NetworkId); - packet.WriteShort((short)pStruct.Item.Id); - packet.WriteByte(0, 2); - packet.WriteByte(pStruct.InventorySlot); - packet.WriteByte((byte)pStruct.Stack); - packet.WriteByte((byte)pStruct.Charge); - packet.WriteByte(pStruct.ReplaceItem); - - return packet; - } - - #endregion - - /// - /// Represents the packet received when a unit buys an item. + /// Represents the packet received when a unit uses an emote. /// public struct Struct { - #region Fields - - /// - /// The charges of the item. - /// - public int Charge; - - /// - /// The inventory slot - /// - public byte InventorySlot; - /// - /// The item + /// The emote identifier /// - public Items.Item Item; + public byte EmoteId; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The replace item - /// - public byte ReplaceItem; - - /// - /// The spell slot - /// - public SpellSlot SpellSlot; - - /// - /// The stacks of the item. + /// Initializes a new instance of the struct. /// - public int Stack; - - /// - /// The unit - /// - public Obj_AI_Hero Unit; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The identifier. - /// The slot. - /// The replace. - /// The stack. - /// The charge. + /// The emote identifier. /// The network identifier. - public Struct( - int id, - byte slot, - byte replace = 0x7B, - int stack = 1, - int charge = 0, - int networkId = -1) + public Struct(byte emoteId, int networkId = -1) { - this.Item = new Items.Item(id, 0); - this.InventorySlot = slot; - this.SpellSlot = (SpellSlot)(this.InventorySlot + (byte)SpellSlot.Item1); - this.ReplaceItem = replace; - this.Stack = stack; - this.Charge = charge; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - this.Unit = ObjectManager.GetUnitByNetworkId(this.NetworkId); + EmoteId = emoteId; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; } - - #endregion } } + #endregion + + #region Damage - 4.21 partially + /// - /// Packet received on spell slot changing. + /// Packet received when a unit deals damage. /// - public class ChangeSpellSlot + public class Damage { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x23; /// - /// The header + /// Encodes the specified packet structure. /// - public static byte Header = 0x17; + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + //23 00 05 00 00 40 05 00 00 40 06 00 00 40 04 F7 33 B4 3F 01 66 + var packet = new GamePacket(Header); + packet.WriteByte(0); + packet.WriteInteger(packetStruct.TargetNetworkId); + packet.WriteByte((byte) packetStruct.Type); + packet.WriteShort(packetStruct.Unknown); // Unknown value + packet.WriteFloat(packetStruct.DamageAmount); + packet.WriteInteger(packetStruct.TargetNetworkIdCopy); + packet.WriteInteger(packetStruct.SourceNetworkId); - #endregion - #region Public Methods and Operators + return packet; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -3850,222 +3203,180 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(1); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - result.Slot = (SpellSlot)(packet.ReadByte()); - result.UnknownByte = packet.ReadByte(); // 0, 1C, 48 - result.UnknownByte2 = packet.ReadByte(); //usually 2 - result.SpellString = packet.ReadString(11); + packet.Position = 2; + result.TargetNetworkId = packet.ReadInteger(); + result.TargetNetworkIdCopy = packet.ReadInteger(); + result.SourceNetworkId = packet.ReadInteger(); + //wrong: + result.Type = (DamageTypePacket) packet.ReadByte(); + result.Unknown = packet.ReadShort(); + result.DamageAmount = packet.ReadFloat(); return result; } /// - /// Encodes the specified p structure. - /// - /// The p structure. - /// GamePacket. - public static GamePacket Encoded(Struct pStruct) - { - var packet = new GamePacket(Header); - packet.WriteInteger(pStruct.NetworkId); - packet.WriteByte((byte)pStruct.Slot); - packet.WriteByte(pStruct.UnknownByte); - packet.WriteByte(2); - packet.WriteByte(0, 3); - packet.WriteString(pStruct.SpellString); - return packet; - } - - #endregion - - /// - /// Represents the packet received when a spell slot is changed. + /// Represents the packet received when unit deals damage. /// public struct Struct { - #region Fields - /// - /// The network identifier + /// The damage amount /// - public int NetworkId; + public float DamageAmount; /// - /// The slot + /// The source network identifier /// - public SpellSlot Slot; + public int SourceNetworkId; /// - /// The spell string + /// The target network identifier /// - public string SpellString; + public int TargetNetworkId; /// - /// The unit + /// The target network identifier copy /// - public Obj_AI_Base Unit; + public int TargetNetworkIdCopy; /// - /// An unknown byte. Possibly the previous slot. + /// The type /// - public byte UnknownByte; // from slot? + public DamageTypePacket Type; /// - /// An unknown byte2 + /// Unknown short value. /// - public byte UnknownByte2; + public short Unknown; - #endregion + /// + /// Initializes a new instance of the struct. + /// + /// The damage amount. + /// The source network identifier. + /// The target network identifier. + /// The target network identifier copy. + /// The type. + /// The unknown. + public Struct(float damageAmount, + int sourceNetworkId, + int targetNetworkId, + int targetNetworkIdCopy, + DamageTypePacket type, + short unknown) + { + DamageAmount = damageAmount; + SourceNetworkId = sourceNetworkId; + TargetNetworkId = targetNetworkId; + TargetNetworkIdCopy = targetNetworkIdCopy; + Type = type; + Unknown = unknown; + } } } + #endregion + + #region FloatText + /// - /// Packet received when a unit deals damage. + /// Packet received to print floating text. /// - public class Damage + public class FloatText { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x23; - - #endregion - - #region Public Methods and Operators - /// - /// Decodes the specified data. + /// The header /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data); - var result = new Struct(); - - packet.Position = 2; - result.TargetNetworkId = packet.ReadInteger(); - result.TargetNetworkIdCopy = packet.ReadInteger(); - result.SourceNetworkId = packet.ReadInteger(); - //wrong: - result.Type = (DamageTypePacket)packet.ReadByte(); - result.Unknown = packet.ReadShort(); - result.DamageAmount = packet.ReadFloat(); - return result; - } + public static byte Header = 0x19; /// - /// Encodes the specified packet structure. + /// Encodes the specified packet structure. /// /// The packet structure. /// GamePacket. public static GamePacket Encoded(Struct packetStruct) { - //23 00 05 00 00 40 05 00 00 40 06 00 00 40 04 F7 33 B4 3F 01 66 var packet = new GamePacket(Header); + + packet.WriteInteger(0); + packet.WriteInteger(packetStruct.NetworkId); + packet.WriteByte((byte) packetStruct.Type); + packet.WriteInteger(packetStruct.NetworkId); + packet.WriteString(packetStruct.Text); packet.WriteByte(0); - packet.WriteInteger(packetStruct.TargetNetworkId); - packet.WriteByte((byte)packetStruct.Type); - packet.WriteShort(packetStruct.Unknown); // Unknown value - packet.WriteFloat(packetStruct.DamageAmount); - packet.WriteInteger(packetStruct.TargetNetworkIdCopy); - packet.WriteInteger(packetStruct.SourceNetworkId); return packet; } - #endregion - /// - /// Represents the packet received when unit deals damage. + /// Decodes the specified data. /// - public struct Struct + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) { - #region Fields - - /// - /// The damage amount - /// - public float DamageAmount; + var packet = new GamePacket(data); + var result = new Struct(); - /// - /// The source network identifier - /// - public int SourceNetworkId; + result.NetworkId = packet.ReadInteger(1); + result.Type = (FloatTextPacket) packet.ReadByte(); + //result.Text = packet.ReadString(); + + return result; + } - /// - /// The target network identifier - /// - public int TargetNetworkId; + /// + /// Represents the packet received when text is to be placed on a unit. + /// + public struct Struct + { /// - /// The target network identifier copy + /// The network identifier /// - public int TargetNetworkIdCopy; + public int NetworkId; /// - /// The type + /// The text /// - public DamageTypePacket Type; + public string Text; /// - /// Unknown short value. + /// The type /// - public short Unknown; - - #endregion - - #region Constructors and Destructors + public FloatTextPacket Type; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// - /// The damage amount. - /// The source network identifier. - /// The target network identifier. - /// The target network identifier copy. + /// The text. /// The type. - /// The unknown. - public Struct( - float damageAmount, - int sourceNetworkId, - int targetNetworkId, - int targetNetworkIdCopy, - DamageTypePacket type, - short unknown) + /// The network identifier. + public Struct(string text, FloatTextPacket type, int networkId = 0) { - this.DamageAmount = damageAmount; - this.SourceNetworkId = sourceNetworkId; - this.TargetNetworkId = targetNetworkId; - this.TargetNetworkIdCopy = targetNetworkIdCopy; - this.Type = type; - this.Unknown = unknown; + NetworkId = networkId == 0 ? ObjectManager.Player.NetworkId : networkId; + Text = text; + Type = type; } - - #endregion } } + #endregion + + #region DebugMessage + /// - /// Packet received for a debug message. + /// Packet received for a debug message. /// public class DebugMessage { - #region Static Fields - /// - /// The header + /// The header /// public static byte Header = 0xF7; - #endregion - - #region Public Methods and Operators - /// - /// Encodes the specified debug string. + /// Encodes the specified debug string. /// /// The debug string. /// GamePacket. @@ -4078,28 +3389,84 @@ public static GamePacket Encoded(String debugString) packet.WriteByte(0); return packet; } + } + + #endregion + + #region HighlightUnit + + /// + /// Packet received to highlight a unit. + /// + public class HighlightUnit + { + /// + /// The header + /// + public static byte Header = 0x59; + + /// + /// Encodes the specified network identifier. + /// + /// The network identifier. + /// GamePacket. + public static GamePacket Encoded(int networkId) + { + var packet = new GamePacket(Header); - #endregion + packet.WriteInteger(0); + packet.WriteInteger(networkId); + + return packet; + } } + #endregion + + #region RemoveHighlightUnit + /// - /// Packet received to print floating text. + /// Packet received to remove a unit's highlight. /// - public class FloatText + public class RemoveHighlightUnit { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0xB4; /// - /// The header + /// Encodes the specified network identifier. /// - public static byte Header = 0x19; + /// The network identifier. + /// GamePacket. + public static GamePacket Encoded(int networkId) + { + var packet = new GamePacket(Header); + + packet.WriteInteger(0); + packet.WriteInteger(networkId); + + return packet; + } + } + + #endregion - #endregion + #region PlayerDisconnect - 4.21 - #region Public Methods and Operators + /// + /// Packet received on player disconnect. + /// + public class PlayerDisconnect + { + /// + /// The header + /// + public static byte Header = 0xFE; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4108,95 +3475,145 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(1); - result.Type = (FloatTextPacket)packet.ReadByte(); - //result.Text = packet.ReadString(); + + packet.Position = 6; + result.NetworkId = packet.ReadInteger(); + result.Player = ObjectManager.GetUnitByNetworkId(result.NetworkId); return result; } /// - /// Encodes the specified packet structure. + /// Represents the packet received when a player disconnects from the game. /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) + public struct Struct { - var packet = new GamePacket(Header); - - packet.WriteInteger(0); - packet.WriteInteger(packetStruct.NetworkId); - packet.WriteByte((byte)packetStruct.Type); - packet.WriteInteger(packetStruct.NetworkId); - packet.WriteString(packetStruct.Text); - packet.WriteByte(0); + /// + /// The network identifier + /// + public int NetworkId; - return packet; + /// + /// The player + /// + public Obj_AI_Hero Player; } + } + + #endregion + + #region PlayerReconnect - #endregion + /// + /// Packet received when a player presses the "Reconnect" Button. + /// + public class PlayerReconnect + { + /// + /// The header + /// + public static byte Header = 0x0; /// - /// Represents the packet received when text is to be placed on a unit. + /// Decodes the specified data. /// - public struct Struct + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) { - #region Fields + var packet = new GamePacket(data); + var result = new Struct(); - /// - /// The network identifier - /// - public int NetworkId; + packet.Position = 4; + result.ClientId = packet.ReadInteger(); + result.Player = ObjectManager.Get().ElementAt(result.ClientId); + + return result; + } + + /// + /// Represents the packet received when a player reconects to the game. + /// + public struct Struct + { /// - /// The text + /// The client identifier /// - public string Text; + public int ClientId; /// - /// The type + /// The player /// - public FloatTextPacket Type; + public Obj_AI_Hero Player; + } + } + + #endregion + + #region PlayerReconnected + + /// + /// Packet received when a player reconnected. + /// + public class PlayerReconnected + { + /// + /// The header + /// + public static byte Header = 0xF; + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data); + var result = new Struct(); - #endregion - #region Constructors and Destructors + packet.Position = 5; + result.ClientId = packet.ReadInteger(); + result.Player = ObjectManager.Get().ElementAt(result.ClientId); + + return result; + } + /// + /// Represents the packet received when a player reconnectes to the game. + /// + public struct Struct + { /// - /// Initializes a new instance of the struct. + /// The client identifier /// - /// The text. - /// The type. - /// The network identifier. - public Struct(string text, FloatTextPacket type, int networkId = 0) - { - this.NetworkId = networkId == 0 ? ObjectManager.Player.NetworkId : networkId; - this.Text = text; - this.Type = type; - } + public int ClientId; - #endregion + /// + /// The player + /// + public Obj_AI_Hero Player; } } + #endregion + + #region GainBuff + /// - /// Packet received on gaining buff. + /// Packet received on gaining buff. /// public class GainBuff { - #region Static Fields - /// - /// The header + /// The header /// public static byte Header = 0xB7; - #endregion - - #region Public Methods and Operators - /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4209,7 +3626,7 @@ public static Struct Decoded(byte[] data) result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); result.BuffSlot = packet.ReadByte(); - result.Type = (BuffType)packet.ReadByte(); + result.Type = (BuffType) packet.ReadByte(); result.Stack = packet.ReadByte(); result.Visible = packet.ReadByte() > 0; result.BuffId = packet.ReadInteger(); @@ -4227,131 +3644,155 @@ public static Struct Decoded(byte[] data) return result; } - #endregion - /// - /// Represents the packet received when a unit gains a buff. + /// Represents the packet received when a unit gains a buff. /// public struct Struct { - #region Fields - /// - /// The buff identifier + /// The buff identifier /// public int BuffId; /// - /// The buff slot + /// The buff slot /// public byte BuffSlot; /// - /// The duration of the buff + /// The duration of the buff /// public float Duration; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The source + /// The source /// public Obj_AI_Base Source; /// - /// The source network identifier + /// The source network identifier /// public int SourceNetworkId; /// - /// The buff stacks + /// The buff stacks /// public int Stack; /// - /// The target + /// The target /// public Obj_AI_Base Target; /// - /// The target network identifier + /// The target network identifier /// public int TargetNetworkId; /// - /// The buff type + /// The buff type /// public BuffType Type; /// - /// The unit + /// The unit /// public Obj_AI_Base Unit; /// - /// true if the buff is visible. + /// true if the buff is visible. /// public bool Visible; - - #endregion } } + #endregion + + #region LoseBuff + /// - /// Packet received to highlight a unit. + /// Packet received on losing buff. /// - public class HighlightUnit + public class LoseBuff { - #region Static Fields + /// + /// The header + /// + public static byte Header = 0x7B; /// - /// The header + /// Decodes the specified data. /// - public static byte Header = 0x59; + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data); + var result = new Struct(); + + result.NetworkId = packet.ReadInteger(1); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - #endregion + result.BuffSlot = packet.ReadByte(); + result.BuffId = packet.ReadInteger(); + result.Duration = packet.ReadFloat(); - #region Public Methods and Operators + return result; + } /// - /// Encodes the specified network identifier. + /// Represents the packet received when a unit loses a buff. /// - /// The network identifier. - /// GamePacket. - public static GamePacket Encoded(int networkId) + public struct Struct { - var packet = new GamePacket(Header); + /// + /// The buff identifier + /// + public int BuffId; - packet.WriteInteger(0); - packet.WriteInteger(networkId); + /// + /// The buff slot + /// + public byte BuffSlot; - return packet; - } + /// + /// The duration of the buff + /// + public float Duration; - #endregion + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The unit + /// + public Obj_AI_Base Unit; + } } + #endregion + + #region SetCooldown + /// - /// Received on hero level up. + /// A packet that sets cooldown of a spell/item. /// - public class LevelUp + public class SetCooldown { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xCB; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0x85; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4360,65 +3801,97 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(2); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - result.Level = packet.ReadByte(); - result.PointsLeft = packet.ReadByte(); + result.NetworkId = packet.ReadInteger(1); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.Slot = (SpellSlot) packet.ReadByte(); + packet.Position += 1; + result.TotalCooldown = packet.ReadFloat(); + result.CurrentCooldown = packet.ReadFloat(); return result; } - #endregion + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + var packet = new GamePacket(Header); + packet.WriteInteger(packetStruct.NetworkId); + packet.WriteByte((byte) packetStruct.Slot); + packet.WriteByte(0xF8); + packet.WriteFloat(packetStruct.TotalCooldown); + packet.WriteFloat(packetStruct.CurrentCooldown); + + return packet; + } /// - /// Represents the packet received when a unit levels up. + /// Represents the packet received to set the cooldown of a spell/item. /// public struct Struct { - #region Fields - /// - /// The new level + /// The current cooldown /// - public int Level; + public float CurrentCooldown; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The amount points left to level up other spells. + /// The slot /// - public int PointsLeft; + public SpellSlot Slot; /// - /// The unit + /// The total cooldown /// - public Obj_AI_Hero Unit; + public float TotalCooldown; + + /// + /// The unit + /// + public Obj_AI_Base Unit; - #endregion + /// + /// Initializes a new instance of the struct. + /// + /// The network identifier. + /// The slot. + /// The total cd. + /// The current cd. + public Struct(int networkId, SpellSlot slot, float totalCd, float currentCd) + { + NetworkId = networkId; + Unit = ObjectManager.GetUnitByNetworkId(NetworkId); + Slot = slot; + TotalCooldown = totalCd; + CurrentCooldown = currentCd; + } } } + #endregion + + #region StartItemCooldown + /// - /// Received on hero level up spell. + /// One packet that starts cooldown (mostly for items). /// - public class LevelUpSpell + public class StartItemCooldown { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xA9; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0x9F; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4427,70 +3900,76 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(2); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - result.Slot = (SpellSlot)packet.ReadByte(); - result.PointsLeft = packet.ReadByte(); - result.Level = packet.ReadByte(); + result.NetworkId = packet.ReadInteger(1); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.InventorySlot = packet.ReadByte(); + result.SpellSlot = (SpellSlot) (result.InventorySlot + (byte) SpellSlot.Item1); return result; } - #endregion /// - /// Represents the packet received when a unit levels up a spell. + /// Represents the packet received to start the cooldown of an item. /// public struct Struct { - #region Fields - /// - /// The new level + /// The inventory slot /// - public int Level; + public byte InventorySlot; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The amount points left to level up other spells. + /// The spell slot /// - public int PointsLeft; - - /// - /// The slot - /// - public SpellSlot Slot; + public SpellSlot SpellSlot; /// - /// The unit + /// The unit /// - public Obj_AI_Hero Unit; - - #endregion + public Obj_AI_Base Unit; } } + #endregion + + #region BuyItemAns + /// - /// Packet received on losing buff. + /// Packet received on buying item. /// - public class LoseBuff + public class BuyItemAns { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0x7B; + public static byte Header = 0x6F; - #endregion + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct pStruct) + { + var packet = new GamePacket(Header); + packet.WriteInteger(pStruct.NetworkId); + packet.WriteShort((short) pStruct.Item.Id); + packet.WriteByte(0, 2); + packet.WriteByte(pStruct.InventorySlot); + packet.WriteByte((byte) pStruct.Stack); + packet.WriteByte((byte) pStruct.Charge); + packet.WriteByte(pStruct.ReplaceItem); - #region Public Methods and Operators + return packet; + } /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4500,71 +3979,106 @@ public static Struct Decoded(byte[] data) var result = new Struct(); result.NetworkId = packet.ReadInteger(1); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - - result.BuffSlot = packet.ReadByte(); - result.BuffId = packet.ReadInteger(); - result.Duration = packet.ReadFloat(); + result.Item = new Items.Item(packet.ReadShort(), 0); + packet.Position += 2; + result.InventorySlot = packet.ReadByte(); + result.SpellSlot = (SpellSlot) (result.InventorySlot + (byte) SpellSlot.Item1); + result.Stack = packet.ReadByte(); + result.Charge = packet.ReadByte(); + result.ReplaceItem = packet.ReadByte(); return result; } - #endregion - /// - /// Represents the packet received when a unit loses a buff. + /// Represents the packet received when a unit buys an item. /// public struct Struct { - #region Fields - /// - /// The buff identifier + /// The charges of the item. /// - public int BuffId; + public int Charge; /// - /// The buff slot + /// The inventory slot /// - public byte BuffSlot; + public byte InventorySlot; /// - /// The duration of the buff + /// The item /// - public float Duration; + public Items.Item Item; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The unit + /// The replace item /// - public Obj_AI_Base Unit; + public byte ReplaceItem; + + /// + /// The spell slot + /// + public SpellSlot SpellSlot; + + /// + /// The stacks of the item. + /// + public int Stack; + + /// + /// The unit + /// + public Obj_AI_Hero Unit; - #endregion + /// + /// Initializes a new instance of the struct. + /// + /// The identifier. + /// The slot. + /// The replace. + /// The stack. + /// The charge. + /// The network identifier. + public Struct(int id, + byte slot, + byte replace = 0x7B, + int stack = 1, + int charge = 0, + int networkId = -1) + { + Item = new Items.Item(id, 0); + InventorySlot = slot; + SpellSlot = (SpellSlot) (InventorySlot + (byte) SpellSlot.Item1); + ReplaceItem = replace; + Stack = stack; + Charge = charge; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + Unit = ObjectManager.GetUnitByNetworkId(NetworkId); + } } } + #endregion + + #region SellItemAns - 4.21 + /// - /// Packet received on player disconnect. + /// Packet received on selling item. /// - public class PlayerDisconnect + public class SellItemAns { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xFE; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0xD3; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4573,54 +4087,67 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - packet.Position = 6; - result.NetworkId = packet.ReadInteger(); - result.Player = ObjectManager.GetUnitByNetworkId(result.NetworkId); - + result.NetworkId = packet.ReadInteger(2); + result.InventorySlot = packet.ReadByte(); + result.SpellSlot = (SpellSlot) (result.InventorySlot + (byte) SpellSlot.Item1); + result.Stack = packet.ReadByte(); + result.UnknownByte = packet.ReadByte(); return result; } - #endregion - /// - /// Represents the packet received when a player disconnects from the game. + /// Represents the packet received when a unit sells an item. /// public struct Struct { - #region Fields + /// + /// The inventory slot + /// + public byte InventorySlot; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The player + /// The spell slot /// - public Obj_AI_Hero Player; + public SpellSlot SpellSlot; + + /// + /// The stack + /// + public int Stack; - #endregion + /// + /// The unit + /// + public Obj_AI_Hero Unit; + + /// + /// An unknown byte + /// + public byte UnknownByte; } } + #endregion + + #region SwapItemAns - 4.21 + /// - /// Packet received when a player presses the "Reconnect" Button. + /// Packet received on swapping item. /// - public class PlayerReconnect + public class SwapItemAns { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0x0; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0x09; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4628,55 +4155,68 @@ public static Struct Decoded(byte[] data) { var packet = new GamePacket(data); var result = new Struct(); - - packet.Position = 4; - result.ClientId = packet.ReadInteger(); - result.Player = ObjectManager.Get().ElementAt(result.ClientId); - + + result.NetworkId = packet.ReadInteger(2); + result.FromInventorySlot = packet.ReadByte(); + result.FromSpellSlot = (SpellSlot) (result.FromInventorySlot + (byte) SpellSlot.Item1); + result.ToInventorySlot = packet.ReadByte(); + result.ToSpellSlot = (SpellSlot) (result.ToInventorySlot + (byte) SpellSlot.Item1); return result; } - #endregion - /// - /// Represents the packet received when a player reconects to the game. + /// Represents the packet received when a unit swaps an item. /// public struct Struct { - #region Fields + /// + /// The previous inventory slot + /// + public byte FromInventorySlot; /// - /// The client identifier + /// The previous spell slot /// - public int ClientId; + public SpellSlot FromSpellSlot; /// - /// The player + /// The network identifier /// - public Obj_AI_Hero Player; + public int NetworkId; - #endregion + /// + /// The new inventory slot + /// + public byte ToInventorySlot; + + /// + /// The new spell slot + /// + public SpellSlot ToSpellSlot; + + /// + /// The unit + /// + public Obj_AI_Hero Unit; } } + #endregion + + #region ChangeSpellSlot - This packet doesnt seem to exits in 4.21 with this struct + /// - /// Packet received when a player reconnected. + /// Packet received on spell slot changing. /// - public class PlayerReconnected + public class ChangeSpellSlot { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xF; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0x17; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4685,88 +4225,85 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - packet.Position = 5; - result.ClientId = packet.ReadInteger(); - result.Player = ObjectManager.Get().ElementAt(result.ClientId); - + result.NetworkId = packet.ReadInteger(1); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.Slot = (SpellSlot)packet.ReadByte(); + result.UnknownByte = packet.ReadByte(); // 0, 1C, 48 + result.UnknownByte2 = packet.ReadByte(); //usually 2 + result.SpellString = packet.ReadString(11); return result; } - #endregion + /// + /// Encodes the specified p structure. + /// + /// The p structure. + /// GamePacket. + public static GamePacket Encoded(Struct pStruct) + { + var packet = new GamePacket(Header); + packet.WriteInteger(pStruct.NetworkId); + packet.WriteByte((byte) pStruct.Slot); + packet.WriteByte(pStruct.UnknownByte); + packet.WriteByte(2); + packet.WriteByte(0, 3); + packet.WriteString(pStruct.SpellString); + return packet; + } /// - /// Represents the packet received when a player reconnectes to the game. + /// Represents the packet received when a spell slot is changed. /// public struct Struct { - #region Fields - /// - /// The client identifier + /// The network identifier /// - public int ClientId; + public int NetworkId; /// - /// The player + /// The slot /// - public Obj_AI_Hero Player; - - #endregion - } - } - - /// - /// Packet received to remove a unit's highlight. - /// - public class RemoveHighlightUnit - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xB4; - - #endregion + public SpellSlot Slot; - #region Public Methods and Operators + /// + /// The spell string + /// + public string SpellString; - /// - /// Encodes the specified network identifier. - /// - /// The network identifier. - /// GamePacket. - public static GamePacket Encoded(int networkId) - { - var packet = new GamePacket(Header); + /// + /// The unit + /// + public Obj_AI_Base Unit; - packet.WriteInteger(0); - packet.WriteInteger(networkId); + /// + /// An unknown byte. Possibly the previous slot. + /// + public byte UnknownByte; // from slot? - return packet; + /// + /// An unknown byte2 + /// + public byte UnknownByte2; } - - #endregion } + #endregion + + #region AddGold + /// - /// Packet received on selling item. + /// Packet received on gold change. /// - public class SellItemAns + public class AddGold { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0xD3; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0x22; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4775,75 +4312,77 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(2); - result.InventorySlot = packet.ReadByte(); - result.SpellSlot = (SpellSlot)(result.InventorySlot + (byte)SpellSlot.Item1); - result.Stack = packet.ReadByte(); - result.UnknownByte = packet.ReadByte(); + result.ReceivingNetworkId = packet.ReadInteger(5); + result.ReceivingUnit = ObjectManager.GetUnitByNetworkId(result.ReceivingNetworkId); + result.SourceNetworkId = packet.ReadInteger(); + result.SourceUnit = ObjectManager.GetUnitByNetworkId(result.SourceNetworkId); + result.Gold = packet.ReadFloat(); return result; } - #endregion + /// + /// Encodes the specified p structure. + /// + /// The p structure. + /// GamePacket. + public static GamePacket Encoded(Struct pStruct) + { + var packet = new GamePacket(Header); + packet.WriteInteger(pStruct.ReceivingNetworkId); + packet.WriteInteger(pStruct.ReceivingNetworkId); + packet.WriteInteger(pStruct.SourceNetworkId); + packet.WriteFloat(pStruct.Gold); + return packet; + } /// - /// Represents the packet received when a unit sells an item. + /// Represents the packet received when a unit's gold is changed. /// public struct Struct { - #region Fields - - /// - /// The inventory slot - /// - public byte InventorySlot; - /// - /// The network identifier + /// The gold /// - public int NetworkId; + public float Gold; /// - /// The spell slot + /// The receiving network identifier /// - public SpellSlot SpellSlot; + public int ReceivingNetworkId; /// - /// The stack + /// The receiving unit /// - public int Stack; + public Obj_AI_Base ReceivingUnit; /// - /// The unit + /// The source network identifier /// - public Obj_AI_Hero Unit; + public int SourceNetworkId; /// - /// An unknown byte + /// The source unit /// - public byte UnknownByte; - - #endregion + public Obj_AI_Base SourceUnit; } } + #endregion + + #region LevelUp - 4.21 + /// - /// A packet that sets cooldown of a spell/item. + /// Received on hero level up. /// - public class SetCooldown + public class LevelUp { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0x85; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0xCB; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4852,109 +4391,57 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(1); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - result.Slot = (SpellSlot)packet.ReadByte(); - packet.Position += 1; - result.TotalCooldown = packet.ReadFloat(); - result.CurrentCooldown = packet.ReadFloat(); + result.NetworkId = packet.ReadInteger(2); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.Level = packet.ReadByte(); + result.PointsLeft = packet.ReadByte(); return result; } /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - var packet = new GamePacket(Header); - packet.WriteInteger(packetStruct.NetworkId); - packet.WriteByte((byte)packetStruct.Slot); - packet.WriteByte(0xF8); - packet.WriteFloat(packetStruct.TotalCooldown); - packet.WriteFloat(packetStruct.CurrentCooldown); - - return packet; - } - - #endregion - - /// - /// Represents the packet received to set the cooldown of a spell/item. + /// Represents the packet received when a unit levels up. /// public struct Struct { - #region Fields - /// - /// The current cooldown + /// The new level /// - public float CurrentCooldown; + public int Level; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The total cooldown - /// - public float TotalCooldown; - - /// - /// The unit + /// The amount points left to level up other spells. /// - public Obj_AI_Base Unit; - - #endregion - - #region Constructors and Destructors + public int PointsLeft; /// - /// Initializes a new instance of the struct. + /// The unit /// - /// The network identifier. - /// The slot. - /// The total cd. - /// The current cd. - public Struct(int networkId, SpellSlot slot, float totalCd, float currentCd) - { - this.NetworkId = networkId; - this.Unit = ObjectManager.GetUnitByNetworkId(this.NetworkId); - this.Slot = slot; - this.TotalCooldown = totalCd; - this.CurrentCooldown = currentCd; - } - - #endregion + public Obj_AI_Hero Unit; } } + #endregion + + #region LevelUpSpell - 4.2.1 + /// - /// One packet that starts cooldown (mostly for items). + /// Received on hero level up spell. /// - public class StartItemCooldown + public class LevelUpSpell { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0x9F; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0xA9; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -4963,64 +4450,62 @@ public static Struct Decoded(byte[] data) var packet = new GamePacket(data); var result = new Struct(); - result.NetworkId = packet.ReadInteger(1); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - result.InventorySlot = packet.ReadByte(); - result.SpellSlot = (SpellSlot)(result.InventorySlot + (byte)SpellSlot.Item1); + result.NetworkId = packet.ReadInteger(2); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.Slot = (SpellSlot) packet.ReadByte(); + result.PointsLeft = packet.ReadByte(); + result.Level = packet.ReadByte(); return result; } - #endregion - /// - /// Represents the packet received to start the cooldown of an item. + /// Represents the packet received when a unit levels up a spell. /// public struct Struct { - #region Fields - /// - /// The inventory slot + /// The new level /// - public byte InventorySlot; + public int Level; /// - /// The network identifier + /// The network identifier /// public int NetworkId; /// - /// The spell slot + /// The amount points left to level up other spells. /// - public SpellSlot SpellSlot; + public int PointsLeft; /// - /// The unit + /// The unit /// - public Obj_AI_Base Unit; + public Obj_AI_Hero Unit; - #endregion + /// + /// The slot + /// + public SpellSlot Slot; } } + #endregion + + #region Surrender + /// - /// Received when someone casts a surrender vote. + /// Received when someone casts a surrender vote. /// public class Surrender { - #region Static Fields - /// - /// The header + /// The header /// public static byte Header = 0xC9; - #endregion - - #region Public Methods and Operators - /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -5028,73 +4513,67 @@ public static Struct Decoded(byte[] data) { var packet = new GamePacket(data); var result = new Struct - { - NetworkId = packet.ReadInteger(6), YesVotes = packet.ReadByte(10), - NoVotes = packet.ReadByte(11), MaxVotes = packet.ReadByte(12), - Team = (GameObjectTeam)packet.ReadByte(13) - }; + { + NetworkId = packet.ReadInteger(6), + YesVotes = packet.ReadByte(10), + NoVotes = packet.ReadByte(11), + MaxVotes = packet.ReadByte(12), + Team = (GameObjectTeam) packet.ReadByte(13) + }; //byte unknown = packet.ReadByte(5); //Not sure what this is return result; } - #endregion - /// - /// Represents the packet received a player votes on a surrender. + /// Represents the packet received a player votes on a surrender. /// public struct Struct { - #region Fields - /// - /// The maximum votes + /// The network identifier /// - public int MaxVotes; + public int NetworkId; /// - /// The network identifier + /// The amount of yes votes /// - public int NetworkId; + public int YesVotes; /// - /// The amount of no votes + /// The amount of no votes /// public int NoVotes; /// - /// The team that is surrendering + /// The maximum votes /// - public GameObjectTeam Team; + public int MaxVotes; /// - /// The amount of yes votes + /// The team that is surrendering /// - public int YesVotes; - - #endregion + public GameObjectTeam Team; } } + #endregion + + #region SurrenderResult + /// - /// Received when surrender voting is over. + /// Received when surrender voting is over. /// public class SurrenderResult { - #region Static Fields - /// - /// The header + /// The header /// public static byte Header = 0xA5; - #endregion - - #region Public Methods and Operators - /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. @@ -5102,123 +4581,126 @@ public static Struct Decoded(byte[] data) { var packet = new GamePacket(data); var result = new Struct - { - TooEarly = Convert.ToBoolean(packet.ReadByte(5)), YesVotes = packet.ReadByte(9), - NoVotes = packet.ReadByte(10), Team = (GameObjectTeam)packet.ReadByte(11) - }; + { + TooEarly = Convert.ToBoolean(packet.ReadByte(5)), + YesVotes = packet.ReadByte(9), + NoVotes = packet.ReadByte(10), + Team = (GameObjectTeam) packet.ReadByte(11) + }; return result; } - #endregion - /// - /// Represents the packet received when a team finishes their decision on a surrender. + /// Represents the packet received when a team finishes their decision on a surrender. /// public struct Struct { - #region Fields - /// - /// The amount of no votes + /// true if the request to surrender was denied because it was too early in the game. /// - public int NoVotes; + public bool TooEarly; /// - /// The team that is surrendering. + /// The amount of yes votes /// - public GameObjectTeam Team; + public int YesVotes; /// - /// true if the request to surrender was denied because it was too early in the game. + /// The amount of no votes /// - public bool TooEarly; + public int NoVotes; /// - /// The amount of yes votes + /// The team that is surrendering. /// - public int YesVotes; - - #endregion + public GameObjectTeam Team; } } + #endregion + + #region RefundToken - 4.21 + /// - /// Packet received on swapping item. + /// Refund token contains refund amount, when leaving base or casting spell/item it's set to 0. /// - public class SwapItemAns + public static class RefundToken { - #region Static Fields - /// - /// The header + /// The header /// - public static byte Header = 0x09; - - #endregion - - #region Public Methods and Operators + public static byte Header = 0xE9; /// - /// Decodes the specified data. + /// Decodes the specified data. /// /// The data. /// Struct. public static Struct Decoded(byte[] data) { - var packet = new GamePacket(data); - var result = new Struct(); - - result.NetworkId = packet.ReadInteger(2); - result.FromInventorySlot = packet.ReadByte(); - result.FromSpellSlot = (SpellSlot)(result.FromInventorySlot + (byte)SpellSlot.Item1); - result.ToInventorySlot = packet.ReadByte(); - result.ToSpellSlot = (SpellSlot)(result.ToInventorySlot + (byte)SpellSlot.Item1); - return result; + return new Struct { RefundCount = data[6] }; } - #endregion + /// + /// Encodes the specified undo amount. + /// + /// The undo amount. + /// GamePacket. + public static GamePacket Encoded(int undoAmount) + { + var packet = new GamePacket(Header); + packet.WriteByte(0); + packet.WriteInteger(ObjectManager.Player.NetworkId); + packet.WriteInteger(undoAmount); + return packet; + } /// - /// Represents the packet received when a unit swaps an item. + /// Represents the packet received when refunding an item. /// public struct Struct { - #region Fields - /// - /// The previous inventory slot + /// The refund count /// - public byte FromInventorySlot; + public int RefundCount; + } + } - /// - /// The previous spell slot - /// - public SpellSlot FromSpellSlot; + #endregion - /// - /// The network identifier - /// - public int NetworkId; + #region Camera - 4.21 (NO STRUCT) - /// - /// The new inventory slot - /// - public byte ToInventorySlot; + /// + /// Received by the server when Camera or Zoom is sent. + /// + public static class Camera + { + //94 00 00 00 00 00 27 + //last byte is probably times camera packet has been sent + /// + /// The header + /// + public static byte Header = 0x94; + } - /// - /// The new spell slot - /// - public SpellSlot ToSpellSlot; + #endregion - /// - /// The unit - /// - public Obj_AI_Hero Unit; + #region RefundConfirm - 4.21 (NO STRUCT) - #endregion - } + /// + /// Received by the server when refund is sent. + /// + public static class RefundConfirm + { + /// + /// The header + /// + public static byte Header = 0x49; } + + #endregion } } -} \ No newline at end of file +} diff --git a/source/Old/PermaShow.cs b/source/Old/PermaShow.cs new file mode 100644 index 00000000..fe0fe856 --- /dev/null +++ b/source/Old/PermaShow.cs @@ -0,0 +1,35 @@ +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// The PermaShow class allows you to add important items to permashow easily. + /// + [Obsolete] + public static class PermaShow + { + #region Public Methods and Operators + + /// + /// Adds a menuitem to PermaShow, can be used without any arguements or with if you want to customize. The bool can be + /// set to false to remove the item from permashow. + /// When removing, you can simply set the bool parameter to false and everything else can be null. The default color is + /// White. + /// + /// The item. + /// if set to true the instance will be enabled. + /// The customdisplayname. + /// The color. + public static void Permashow( + this MenuItem item, + bool enabled = true, + string customdisplayname = null, + Color? col = null) + { + } + + #endregion + } +} \ No newline at end of file diff --git a/Spell.cs b/source/Old/Spell.cs similarity index 97% rename from Spell.cs rename to source/Old/Spell.cs index 2e4275f3..4445f1c8 100644 --- a/Spell.cs +++ b/source/Old/Spell.cs @@ -127,9 +127,9 @@ public Spell(SpellSlot slot, bool useSpellDbValues) this.Width = spellData.Radius > 0 && spellData.Radius < 30000 ? spellData.Radius : ((spellData.Width > 0 && spellData.Width < 30000) ? spellData.Width : 30000); - this.Collision = (spellData.CollisionObjects != null - && spellData.CollisionObjects.Any( - obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions)); + this.Collision = spellData.CollisionObjects != null + && spellData.CollisionObjects.Any( + obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions); this.Speed = spellData.MissileSpeed; this.IsChargedSpell = true; this.Type = SpellDatabase.GetSkillshotTypeFromSpellType(spellData.SpellType); @@ -143,9 +143,9 @@ public Spell(SpellSlot slot, bool useSpellDbValues) this.Width = spellData.Radius > 0 && spellData.Radius < 30000 ? spellData.Radius : ((spellData.Width > 0 && spellData.Width < 30000) ? spellData.Width : 30000); - this.Collision = (spellData.CollisionObjects != null - && spellData.CollisionObjects.Any( - obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions)); + this.Collision = spellData.CollisionObjects != null + && spellData.CollisionObjects.Any( + obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions); this.Speed = spellData.MissileSpeed; this.IsSkillshot = true; this.Type = SpellDatabase.GetSkillshotTypeFromSpellType(spellData.SpellType); @@ -330,7 +330,10 @@ public bool IsCharging { get { - if (!this.Slot.IsReady()) return false; + if (!this.Slot.IsReady()) + { + return false; + } return ObjectManager.Player.HasBuff(this.ChargedBuffName) || Utils.TickCount - this._chargedCastedT < 300 + Game.Ping; @@ -409,8 +412,8 @@ public float Range return this.ChargedMinRange + Math.Min( this.ChargedMaxRange - this.ChargedMinRange, - (Utils.TickCount - this._chargedCastedT) * (this.ChargedMaxRange - this.ChargedMinRange) - / this.ChargeDuration - 150); + ((Utils.TickCount - this._chargedCastedT) * (this.ChargedMaxRange - this.ChargedMinRange) + / this.ChargeDuration) - 150); } return this.ChargedMaxRange; @@ -818,7 +821,7 @@ public float GetDamage(Obj_AI_Base target, int stage = 0) /// System.Single. public float GetHealthPrediction(Obj_AI_Base unit) { - var time = (int)(this.Delay * 1000 + this.From.Distance(unit.ServerPosition) / this.Speed - 100); + var time = (int)((this.Delay * 1000) + (this.From.Distance(unit.ServerPosition) / this.Speed) - 100); return HealthPrediction.GetHealthPrediction(unit, time); } @@ -1325,7 +1328,10 @@ private void Obj_AI_Hero_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProces private void OnCastSpell(Spellbook sender, SpellbookCastSpellEventArgs args) { - if (this.LetSpellcancel) return; + if (this.LetSpellcancel) + { + return; + } args.Process = !this.IsChanneling; } @@ -1358,7 +1364,10 @@ private void OnDelete(GameObject sender, EventArgs args) /// private void OnDoCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { - if (!sender.IsMe) return; + if (!sender.IsMe) + { + return; + } if (this._processName.Contains(args.SData.Name)) { @@ -1373,9 +1382,15 @@ private void OnDoCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs ar /// private void OnOrder(Obj_AI_Base sender, GameObjectIssueOrderEventArgs args) { - if (!sender.IsMe) return; + if (!sender.IsMe) + { + return; + } - if (!this.IsChanneling) return; + if (!this.IsChanneling) + { + return; + } if (args.Order == GameObjectOrder.MoveTo || args.Order == GameObjectOrder.AttackTo || args.Order == GameObjectOrder.AttackUnit || args.Order == GameObjectOrder.AutoAttack) @@ -1390,7 +1405,10 @@ private void OnOrder(Obj_AI_Base sender, GameObjectIssueOrderEventArgs args) /// private void OnWndProc(WndEventArgs args) { - if (!this.CanBeCanceledByUser) return; + if (!this.CanBeCanceledByUser) + { + return; + } if (args.Msg == 517) { @@ -1423,7 +1441,7 @@ private void SpellbookOnCastSpell(Spellbook spellbook, SpellbookCastSpellEventAr return; } - if ((Utils.TickCount - this._chargedReqSentT > 500)) + if (Utils.TickCount - this._chargedReqSentT > 500) { if (this.IsCharging) { diff --git a/TargetSelector.cs b/source/Old/TargetSelector.cs similarity index 76% rename from TargetSelector.cs rename to source/Old/TargetSelector.cs index 644763b4..714af13d 100644 --- a/TargetSelector.cs +++ b/source/Old/TargetSelector.cs @@ -99,9 +99,9 @@ public static Obj_AI_Hero SelectedTarget { get { - return (_configMenu != null && _configMenu.Item("FocusSelected").GetValue() + return _configMenu != null && _configMenu.Item("FocusSelected").GetValue() ? _selectedTargetObjAiHero - : null); + : null; } } @@ -217,9 +217,9 @@ public static Obj_AI_Hero GetTarget( var targets = HeroManager.Enemies.FindAll( hero => - ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) - && IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom) - && (conditions == null || conditions(hero))); + ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) + && IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom) + && (conditions == null || conditions(hero))); switch (Mode) { @@ -236,9 +236,8 @@ public static Obj_AI_Hero GetTarget( return targets.MinOrDefault( hero => - (rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition).Distance( - hero.ServerPosition, - true)); + (rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition) + .Distance(hero.ServerPosition, true)); case TargetingMode.NearMouse: return targets.MinOrDefault(hero => hero.Distance(Game.CursorPos, true)); @@ -247,28 +246,31 @@ public static Obj_AI_Hero GetTarget( return targets.MaxOrDefault( hero => - champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero)); + champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) + * GetPriority(hero)); case TargetingMode.LessAttack: return targets.MaxOrDefault( hero => - champion.CalcDamage(hero, Damage.DamageType.Physical, 100) / (1 + hero.Health) - * GetPriority(hero)); + champion.CalcDamage(hero, Damage.DamageType.Physical, 100) / (1 + hero.Health) + * GetPriority(hero)); case TargetingMode.LessCast: return targets.MaxOrDefault( hero => - champion.CalcDamage(hero, Damage.DamageType.Magical, 100) / (1 + hero.Health) - * GetPriority(hero)); + champion.CalcDamage(hero, Damage.DamageType.Magical, 100) / (1 + hero.Health) + * GetPriority(hero)); case TargetingMode.MostStack: return targets.MaxOrDefault( hero => - champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero) - + (1 + hero.Buffs.Where(b => StackNames.Contains(b.Name.ToLower())).Sum(t => t.Count))); + (champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) + * GetPriority(hero)) + + (1 + + hero.Buffs.Where(b => StackNames.Contains(b.Name.ToLower())).Sum(t => t.Count))); } } catch (Exception e) @@ -301,81 +303,75 @@ public static Obj_AI_Hero GetTargetNoCollision( return null; } - public static void Initialize() + public static void Initialize(Menu menu) { - CustomEvents.Game.OnGameLoad += args => + var config = new Menu("Target Selector", "TargetSelector"); + + _configMenu = config; + + var focusMenu = new Menu("Focus Target Settings", "FocusTargetSettings"); + + focusMenu.AddItem(new MenuItem("FocusSelected", "Focus selected target").SetShared().SetValue(true)); + focusMenu.AddItem( + new MenuItem("SelTColor", "Focus selected target color").SetShared() + .SetValue(new Circle(true, Color.Red))); + focusMenu.AddItem( + new MenuItem("ForceFocusSelected", "Only attack selected target").SetShared().SetValue(false)); + focusMenu.AddItem(new MenuItem("sep", "")); + focusMenu.AddItem( + new MenuItem("ForceFocusSelectedKeys", "Enable only attack selected Keys").SetShared().SetValue(false)); + focusMenu.AddItem(new MenuItem("ForceFocusSelectedK", "Only attack selected Key")) + .SetValue(new KeyBind(32, KeyBindType.Press)); + focusMenu.AddItem(new MenuItem("ForceFocusSelectedK2", "Only attack selected Key 2")) + .SetValue(new KeyBind(32, KeyBindType.Press)); + focusMenu.AddItem(new MenuItem("ResetOnRelease", "Reset selected target upon release")).SetValue(false); + + config.AddSubMenu(focusMenu); + + var autoPriorityItem = + new MenuItem("AutoPriority", "Auto arrange priorities").SetShared() + .SetValue(true) + .SetTooltip("5 = Highest Priority"); + autoPriorityItem.ValueChanged += autoPriorityItem_ValueChanged; + + foreach (var enemy in HeroManager.Enemies) + { + config.AddItem( + new MenuItem("TargetSelector" + enemy.ChampionName + "Priority", enemy.ChampionName).SetShared() + .SetValue( + new Slider( + autoPriorityItem.GetValue() ? GetPriorityFromDb(enemy.ChampionName) : 1, + 5, + 1))); + if (autoPriorityItem.GetValue()) { - var config = new Menu("Target Selector", "TargetSelector"); - - _configMenu = config; - - var focusMenu = new Menu("Focus Target Settings", "FocusTargetSettings"); - - focusMenu.AddItem(new MenuItem("FocusSelected", "Focus selected target").SetShared().SetValue(true)); - focusMenu.AddItem( - new MenuItem("SelTColor", "Focus selected target color").SetShared() - .SetValue(new Circle(true, Color.Red))); - focusMenu.AddItem( - new MenuItem("ForceFocusSelected", "Only attack selected target").SetShared().SetValue(false)); - focusMenu.AddItem(new MenuItem("sep", "")); - focusMenu.AddItem( - new MenuItem("ForceFocusSelectedKeys", "Enable only attack selected Keys").SetShared() - .SetValue(false)); - focusMenu.AddItem(new MenuItem("ForceFocusSelectedK", "Only attack selected Key")) - .SetValue(new KeyBind(32, KeyBindType.Press)); - focusMenu.AddItem(new MenuItem("ForceFocusSelectedK2", "Only attack selected Key 2")) - .SetValue(new KeyBind(32, KeyBindType.Press)); - focusMenu.AddItem(new MenuItem("ResetOnRelease", "Reset selected target upon release")) - .SetValue(false); - - config.AddSubMenu(focusMenu); - - var autoPriorityItem = - new MenuItem("AutoPriority", "Auto arrange priorities").SetShared() - .SetValue(true) - .SetTooltip("5 = Highest Priority"); - autoPriorityItem.ValueChanged += autoPriorityItem_ValueChanged; - - foreach (var enemy in HeroManager.Enemies) - { - config.AddItem( - new MenuItem("TargetSelector" + enemy.ChampionName + "Priority", enemy.ChampionName) - .SetShared() - .SetValue( - new Slider( - autoPriorityItem.GetValue() ? GetPriorityFromDb(enemy.ChampionName) : 1, - 5, - 1))); - if (autoPriorityItem.GetValue()) - { - config.Item("TargetSelector" + enemy.ChampionName + "Priority") - .SetValue( - new Slider( - autoPriorityItem.GetValue() ? GetPriorityFromDb(enemy.ChampionName) : 1, - 5, - 1)); - } - } - config.AddItem(autoPriorityItem); - config.AddItem( - new MenuItem("TargetingMode", "Target Mode").SetShared() - .SetValue(new StringList(Enum.GetNames(typeof(TargetingMode))))); + config.Item("TargetSelector" + enemy.ChampionName + "Priority") + .SetValue( + new Slider( + autoPriorityItem.GetValue() ? GetPriorityFromDb(enemy.ChampionName) : 1, + 5, + 1)); + } + } + config.AddItem(autoPriorityItem); + config.AddItem( + new MenuItem("TargetingMode", "Target Mode").SetShared() + .SetValue(new StringList(Enum.GetNames(typeof(TargetingMode))))); - CommonMenu.Instance.AddSubMenu(config); - Game.OnWndProc += GameOnOnWndProc; + menu.AddSubMenu(config); + Game.OnWndProc += GameOnOnWndProc; - if (!CustomTS) - { - Drawing.OnDraw += DrawingOnOnDraw; - } - }; + if (!CustomTS) + { + Drawing.OnDraw += DrawingOnOnDraw; + } } public static bool IsInvulnerable(Obj_AI_Base target, DamageType damageType, bool ignoreShields = true) { var targetBuffs = new HashSet( - target.Buffs.Select(buff => buff.Name), - StringComparer.OrdinalIgnoreCase); + target.Buffs.Select(buff => buff.Name), + StringComparer.OrdinalIgnoreCase); // Kindred's Lamb's Respite(R) if (targetBuffs.Contains("KindredRNoDeathBuff") && target.HealthPercent <= 10) @@ -502,8 +498,8 @@ private static void DrawingOnOnDraw(EventArgs args) || _configMenu.Item("ForceFocusSelectedK2").GetValue().Active) && _configMenu.Item("ForceFocusSelectedKeys").GetValue(); - _configMenu.Item("ForceFocusSelectedKeys").Permashow(SelectedTarget != null && a); - _configMenu.Item("ForceFocusSelected").Permashow(_configMenu.Item("ForceFocusSelected").GetValue()); + /*_configMenu.Item("ForceFocusSelectedKeys").Permashow(SelectedTarget != null && a); + _configMenu.Item("ForceFocusSelected").Permashow(_configMenu.Item("ForceFocusSelected").GetValue());*/ if (!_configMenu.Item("ResetOnRelease").GetValue()) { diff --git a/source/Packets/GamePacket.cs b/source/Packets/GamePacket.cs new file mode 100644 index 00000000..478cb6b0 --- /dev/null +++ b/source/Packets/GamePacket.cs @@ -0,0 +1,613 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.IO; + using System.Linq; + using System.Text; + + using SharpDX; + + /// + /// Game packet utils, decoding and encoding of game packets. + /// + public class GamePacket + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The data. + /// + public GamePacket(byte[] data) + { + this.Block = false; + + this.MemoryStream = new MemoryStream(data); + this.BinaryReader = new BinaryReader(this.MemoryStream); + this.BinaryWriter = new BinaryWriter(this.MemoryStream); + + this.BinaryReader.BaseStream.Position = 0; + this.BinaryWriter.BaseStream.Position = 0; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The game packet event args. + /// + public GamePacket(GamePacketEventArgs gamePacketEventArgs) + { + this.Block = false; + + this.MemoryStream = new MemoryStream(gamePacketEventArgs.PacketData); + this.BinaryReader = new BinaryReader(this.MemoryStream); + this.BinaryWriter = new BinaryWriter(this.MemoryStream); + + this.BinaryReader.BaseStream.Position = 0; + this.BinaryWriter.BaseStream.Position = 0; + + this.Channel = gamePacketEventArgs.Channel; + this.Flags = gamePacketEventArgs.ProtocolFlag; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The header. + /// + /// + /// The channel. + /// + /// + /// The flags. + /// + public GamePacket( + byte header, + PacketChannel channel = PacketChannel.C2S, + PacketProtocolFlags flags = PacketProtocolFlags.Reliable) + { + this.Block = false; + + this.MemoryStream = new MemoryStream(); + this.BinaryReader = new BinaryReader(this.MemoryStream); + this.BinaryWriter = new BinaryWriter(this.MemoryStream); + + this.BinaryReader.BaseStream.Position = 0; + this.BinaryWriter.BaseStream.Position = 0; + + this.WriteByte(header); + this.Channel = channel; + this.Flags = flags; + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether to block the packet. + /// + public bool Block { get; set; } + + /// + /// Gets or sets the channel. + /// + public PacketChannel Channel { get; set; } = PacketChannel.C2S; + + /// + /// Gets or sets the flags. + /// + public PacketProtocolFlags Flags { get; set; } = PacketProtocolFlags.Reliable; + + /// + /// Gets the header. + /// + public byte Header => this.ReadByte(0); + + /// + /// Gets or sets the position. + /// + public long Position + { + get + { + return this.BinaryReader.BaseStream.Position; + } + + set + { + if (value >= 0L) + { + this.BinaryReader.BaseStream.Position = value; + } + } + } + + #endregion + + #region Properties + + private BinaryReader BinaryReader { get; } + + private BinaryWriter BinaryWriter { get; } + + private MemoryStream MemoryStream { get; } + + #endregion + + #region Public Methods and Operators + + /// + /// Dumps the packet info. + /// + /// + /// A value indicating whether to dump with additional info. + /// + /// + /// The . + /// + public string Dump(bool additionalInfo = false) + { + var s = string.Concat(this.MemoryStream.ToArray().Select(b => b.ToString("X2") + " ")); + if (additionalInfo) + { + s = $"Channel: {this.Channel}, Flags: {this.Flags}, Data: {s}"; + } + + return s; + } + + /// + /// Gets the raw packet. + /// + /// + /// The array. + /// + public byte[] GetRawPacket() => this.MemoryStream.ToArray(); + + /// + /// Processes the packet. + /// + /// + /// The channel. + /// + [Obsolete("Sole purpose for compability, will not actually process the packet.")] + public void Process(PacketChannel channel = PacketChannel.C2S) + { + } + + /// + /// Reads a byte. + /// + /// + /// The position. + /// + /// + /// The . + /// + public byte ReadByte(long position = -1) + { + this.Position = position; + return this.BinaryReader.ReadByte(); + } + + /// + /// Reads a float. + /// + /// + /// The position. + /// + /// + /// The . + /// + public float ReadFloat(long position = -1) + { + this.Position = position; + return BitConverter.ToSingle(this.BinaryReader.ReadBytes(4), 0); + } + + /// + /// Reads an integer. + /// + /// + /// The position. + /// + /// + /// The . + /// + public int ReadInteger(long position = -1) + { + this.Position = position; + return BitConverter.ToInt32(this.BinaryReader.ReadBytes(4), 0); + } + + /// + /// Reads a short. + /// + /// + /// The position. + /// + /// + /// The . + /// + public short ReadShort(long position = -1) + { + this.Position = position; + return BitConverter.ToInt16(this.BinaryReader.ReadBytes(2), 0); + } + + /// + /// Reads a string. + /// + /// + /// The position. + /// + /// + /// The . + /// + public string ReadString(long position = -1) + { + this.Position = position; + var stringBuilder = new StringBuilder(); + + for (var i = this.Position; i < this.Size(); ++i) + { + var num = this.ReadByte(); + if (num == 0) + { + return stringBuilder.ToString(); + } + + stringBuilder.Append(Convert.ToChar(num)); + } + + return stringBuilder.ToString(); + } + + /// + /// Saves the packet information to a file. + /// + /// + /// The file path. + /// + public void SaveToFile(string filePath) + { + using (var file = File.AppendText(filePath)) + { + file.WriteLine(this.Dump(true)); + } + } + + /// + /// Searches for a byte. + /// + /// + /// The number. + /// + /// + /// The array. + /// + public int[] SearchByte(byte num) => this.MemoryStream.ToArray().IndexOf(BitConverter.GetBytes(num)).ToArray(); + + /// + /// Searches for a float. + /// + /// + /// The number. + /// + /// + /// The array. + /// + public int[] SearchFloat(float num) => this.MemoryStream.ToArray().IndexOf(BitConverter.GetBytes(num)).ToArray(); + + /// + /// Searches for a game tile. + /// + /// + /// The position. + /// + /// + /// The 2d array. + /// + public int[][] SearchGameTile(Vector2 position) + { + var tile = NavMesh.WorldToGrid(position.X, position.Y); + var cell = NavMesh.GetCell((short)tile.X, (short)tile.Y); + + var x = this.SearchShort(cell.GridX); + var y = this.SearchShort(cell.GridY); + + return new[] { x, y }; + } + + /// + /// Searches for a game tile. + /// + /// + /// The position. + /// + /// + /// The 2d array. + /// + public int[][] SearchGameTile(Vector3 position) => this.SearchGameTile(position.To2D()); + + /// + /// Searches for a game tile. + /// + /// + /// The game object. + /// + /// + /// The 2d array. + /// + public int[][] SearchGameTile(GameObject obj) => this.SearchGameTile(obj.Position.To2D()); + + /// + /// Searches for a hex string. + /// + /// + /// The hex. + /// + /// + /// The array. + /// + public int[] SearchHexString(string hex) + { + hex = hex.Replace(" ", string.Empty); + + if ((hex.Length % 2) != 0) + { + hex = "0" + hex; + } + + return + this.MemoryStream.ToArray() + .IndexOf( + Enumerable.Range(0, hex.Length) + .Where(x => x % 2 == 0) + .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) + .ToArray()) + .ToArray(); + } + + /// + /// Searches for an integer. + /// + /// + /// The number. + /// + /// + /// The array. + /// + public int[] SearchInteger(int num) => this.MemoryStream.ToArray().IndexOf(BitConverter.GetBytes(num)).ToArray(); + + /// + /// Searches for a game object. + /// + /// + /// The object. + /// + /// + /// The array. + /// + public int[] SearchObject(GameObject obj) + { + if (obj == null || !obj.IsValid || obj.NetworkId == 0) + { + return null; + } + + return this.SearchInteger(obj.NetworkId); + } + + /// + /// Searches for a game object. + /// + /// + /// The network id. + /// + /// + /// The array. + /// + public int[] SearchObject(int networkId) => networkId == 0 ? null : this.SearchInteger(networkId); + + /// + /// Searches for a position. + /// + /// + /// The position. + /// + /// + /// The 2d array. + /// + public int[][] SearchPosition(Vector2 position) + { + var x = this.SearchFloat(position.X); + var y = this.SearchFloat(position.Y); + + if (x == null || y == null) + { + return null; + } + + return new[] { x, y }; + } + + /// + /// Searches for a position. + /// + /// + /// The position. + /// + /// + /// The 2d array. + /// + public int[][] SearchPosition(Vector3 position) => this.SearchPosition(position.To2D()); + + /// + /// Searches for a position. + /// + /// + /// The object. + /// + /// + /// The 2d array. + /// + public int[][] SearchPosition(GameObject obj) => this.SearchPosition(obj.Position.To2D()); + + /// + /// Searches for a position. + /// + /// + /// The unit. + /// + /// + /// The 2d array. + /// + public int[][] SearchPosition(Obj_AI_Base unit) + { + var pos = this.SearchPosition(unit.Position.To2D()); + var pos2 = this.SearchPosition(unit.ServerPosition.To2D()); + + if (pos == null) + { + return pos2; + } + + return pos2 == null ? pos : null; + } + + /// + /// Searches for a short. + /// + /// + /// The number. + /// + /// + /// The array. + /// + public int[] SearchShort(short num) => this.MemoryStream.ToArray().IndexOf(BitConverter.GetBytes(num)).ToArray(); + + /// + /// Searches for a string. + /// + /// + /// The string. + /// + /// + /// The array. + /// + public int[] SearchString(string str) => this.MemoryStream.ToArray().IndexOf(Utils.GetBytes(str)).ToArray(); + + /// + /// Sends the packet. + /// + /// + /// The channel. + /// + /// + /// The flags. + /// + [Obsolete("Sole purpose for compability, will not actually send the packet.")] + public void Send( + PacketChannel channel = PacketChannel.S2C, + PacketProtocolFlags flags = PacketProtocolFlags.Reliable) + { + } + + /// + /// Gets the size of the packet data. + /// + /// + /// The . + /// + public long Size() => this.BinaryReader.BaseStream.Length; + + /// + public override string ToString() + { + return this.Dump(); + } + + /// + /// Writes a byte. + /// + /// + /// The byte. + /// + /// + /// The repeat value (amount). + /// + public void WriteByte(byte b, int repeat = 1) + { + for (var i = 0; i < repeat; i++) + { + this.BinaryWriter.Write(b); + } + } + + /// + /// Writes a float. + /// + /// + /// The float. + /// + public void WriteFloat(float f) => this.BinaryWriter.Write(f); + + /// + /// Writes a hex string. + /// + /// + /// The hex string. + /// + public void WriteHexString(string hex) + { + hex = hex.Replace(" ", string.Empty); + + if ((hex.Length % 2) != 0) + { + hex = "0" + hex; + } + + this.BinaryWriter.Write( + Enumerable.Range(0, hex.Length) + .Where(x => x % 2 == 0) + .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) + .ToArray()); + } + + /// + /// Writes an integer. + /// + /// + /// The integer. + /// + public void WriteInteger(int i) => this.BinaryWriter.Write(i); + + /// + /// Writes a short. + /// + /// + /// The short. + /// + public void WriteShort(short s) => this.BinaryWriter.Write(s); + + /// + /// Writes a string. + /// + /// + /// The string. + /// + public void WriteString(string str) => this.BinaryWriter.Write(Encoding.UTF8.GetBytes(str)); + + #endregion + } +} \ No newline at end of file diff --git a/source/Prediction/CollisionableObjects.cs b/source/Prediction/CollisionableObjects.cs new file mode 100644 index 00000000..466404c9 --- /dev/null +++ b/source/Prediction/CollisionableObjects.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Objects that can cause collision with a spell. + /// + public enum CollisionableObjects + { + /// + /// Minion. + /// + Minions, + + /// + /// Heroes. + /// + Heroes, + + /// + /// Yasuo's Wind Wall. + /// + YasuoWall, + + /// + /// Walls. + /// + Walls, + + /// + /// Allies. + /// + Allies + } +} \ No newline at end of file diff --git a/source/Prediction/HitChance.cs b/source/Prediction/HitChance.cs new file mode 100644 index 00000000..41540f4b --- /dev/null +++ b/source/Prediction/HitChance.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Hit chance enum. + /// + public enum HitChance + { + /// + /// Collision of other units. + /// + Collision, + + /// + /// Unit is out of range. + /// + OutOfRange, + + /// + /// Impossible to hit the unit. + /// + Impossible, + + /// + /// Low probability of hitting the unit. + /// + Low, + + /// + /// Medium probability of hitting the unit. + /// + Medium, + + /// + /// High probability of hitting the unit. + /// + High, + + /// + /// Very high probability of hitting the unit. + /// + VeryHigh, + + /// + /// Unit is dashing. + /// + Dashing, + + /// + /// Unit is immobile. + /// + Immobile + } +} \ No newline at end of file diff --git a/source/Prediction/Old/AoePrediction.cs b/source/Prediction/Old/AoePrediction.cs new file mode 100644 index 00000000..eb632535 --- /dev/null +++ b/source/Prediction/Old/AoePrediction.cs @@ -0,0 +1,423 @@ +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.Linq; + + using SharpDX; + + /// + /// Calculates area of effect prediction. + /// + internal static class AoePrediction + { + #region Public Methods and Operators + + /// + /// Gets the prediction. + /// + /// The input. + /// PredictionOutput. + public static PredictionOutput GetPrediction(PredictionInput input) + { + switch (input.Type) + { + case SkillshotType.SkillshotCircle: + return Circle.GetPrediction(input); + case SkillshotType.SkillshotCone: + return Cone.GetPrediction(input); + case SkillshotType.SkillshotLine: + return Line.GetPrediction(input); + } + return new PredictionOutput(); + } + + #endregion + + #region Methods + + /// + /// Gets the possible targets. + /// + /// The input. + /// List<PossibleTarget>. + internal static List GetPossibleTargets(PredictionInput input) + { + var result = new List(); + var originalUnit = input.Unit; + foreach (var enemy in + HeroManager.Enemies.FindAll( + h => + h.NetworkId != originalUnit.NetworkId + && h.IsValidTarget(input.Range + 200 + input.RealRadius, true, input.RangeCheckFrom))) + { + input.Unit = enemy; + var prediction = Prediction.GetPrediction(input, false, false); + if (prediction.Hitchance >= HitChance.High) + { + result.Add(new PossibleTarget { Position = prediction.UnitPosition.To2D(), Unit = enemy }); + } + } + return result; + } + + #endregion + + /// + /// Represents a circular skillshot. + /// + public static class Circle + { + #region Public Methods and Operators + + /// + /// Gets the prediction. + /// + /// The input. + /// PredictionOutput. + public static PredictionOutput GetPrediction(PredictionInput input) + { + var mainTargetPrediction = Prediction.GetPrediction(input, false, true); + var posibleTargets = new List + { + new PossibleTarget + { + Position = mainTargetPrediction.UnitPosition.To2D(), + Unit = input.Unit + } + }; + + if (mainTargetPrediction.Hitchance >= HitChance.Medium) + { + //Add the posible targets in range: + posibleTargets.AddRange(GetPossibleTargets(input)); + } + + while (posibleTargets.Count > 1) + { + var mecCircle = MEC.GetMec(posibleTargets.Select(h => h.Position).ToList()); + + if (mecCircle.Radius <= input.RealRadius - 10 + && Vector2.DistanceSquared(mecCircle.Center, input.RangeCheckFrom.To2D()) + < input.Range * input.Range) + { + return new PredictionOutput + { + AoeTargetsHit = posibleTargets.Select(h => (Obj_AI_Hero)h.Unit).ToList(), + CastPosition = mecCircle.Center.To3D(), + UnitPosition = mainTargetPrediction.UnitPosition, + Hitchance = mainTargetPrediction.Hitchance, Input = input, + AoeTargetsHitCount = posibleTargets.Count + }; + } + + float maxdist = -1; + var maxdistindex = 1; + for (var i = 1; i < posibleTargets.Count; i++) + { + var distance = Vector2.DistanceSquared(posibleTargets[i].Position, posibleTargets[0].Position); + if (distance > maxdist || maxdist.CompareTo(-1) == 0) + { + maxdistindex = i; + maxdist = distance; + } + } + posibleTargets.RemoveAt(maxdistindex); + } + + return mainTargetPrediction; + } + + #endregion + } + + /// + /// Represents a conical skillshot. + /// + public static class Cone + { + #region Public Methods and Operators + + /// + /// Gets the prediction. + /// + /// The input. + /// PredictionOutput. + public static PredictionOutput GetPrediction(PredictionInput input) + { + var mainTargetPrediction = Prediction.GetPrediction(input, false, true); + var posibleTargets = new List + { + new PossibleTarget + { + Position = mainTargetPrediction.UnitPosition.To2D(), + Unit = input.Unit + } + }; + + if (mainTargetPrediction.Hitchance >= HitChance.Medium) + { + //Add the posible targets in range: + posibleTargets.AddRange(GetPossibleTargets(input)); + } + + if (posibleTargets.Count > 1) + { + var candidates = new List(); + + foreach (var target in posibleTargets) + { + target.Position = target.Position - input.From.To2D(); + } + + for (var i = 0; i < posibleTargets.Count; i++) + { + for (var j = 0; j < posibleTargets.Count; j++) + { + if (i != j) + { + var p = (posibleTargets[i].Position + posibleTargets[j].Position) * 0.5f; + if (!candidates.Contains(p)) + { + candidates.Add(p); + } + } + } + } + + var bestCandidateHits = -1; + var bestCandidate = new Vector2(); + var positionsList = posibleTargets.Select(t => t.Position).ToList(); + + foreach (var candidate in candidates) + { + var hits = GetHits(candidate, input.Range, input.Radius, positionsList); + if (hits > bestCandidateHits) + { + bestCandidate = candidate; + bestCandidateHits = hits; + } + } + + if (bestCandidateHits > 1 && input.From.To2D().Distance(bestCandidate, true) > 50 * 50) + { + return new PredictionOutput + { + Hitchance = mainTargetPrediction.Hitchance, + AoeTargetsHitCount = bestCandidateHits, + UnitPosition = mainTargetPrediction.UnitPosition, + CastPosition = bestCandidate.To3D(), Input = input + }; + } + } + return mainTargetPrediction; + } + + #endregion + + #region Methods + + /// + /// Gets the hits. + /// + /// The end. + /// The range. + /// The angle. + /// The points. + /// System.Int32. + internal static int GetHits(Vector2 end, double range, float angle, List points) + { + return (from point in points + let edge1 = end.Rotated(-angle / 2) + let edge2 = edge1.Rotated(angle) + where + point.Distance(new Vector2(), true) < range * range && edge1.CrossProduct(point) > 0 + && point.CrossProduct(edge2) > 0 + select point).Count(); + } + + #endregion + } + + /// + /// Represents a linear skillshot. + /// + public static class Line + { + #region Public Methods and Operators + + /// + /// Gets the prediction. + /// + /// The input. + /// PredictionOutput. + public static PredictionOutput GetPrediction(PredictionInput input) + { + var mainTargetPrediction = Prediction.GetPrediction(input, false, true); + var posibleTargets = new List + { + new PossibleTarget + { + Position = mainTargetPrediction.UnitPosition.To2D(), + Unit = input.Unit + } + }; + if (mainTargetPrediction.Hitchance >= HitChance.Medium) + { + //Add the posible targets in range: + posibleTargets.AddRange(GetPossibleTargets(input)); + } + + if (posibleTargets.Count > 1) + { + var candidates = new List(); + foreach (var target in posibleTargets) + { + var targetCandidates = GetCandidates( + input.From.To2D(), + target.Position, + input.Radius, + input.Range); + candidates.AddRange(targetCandidates); + } + + var bestCandidateHits = -1; + var bestCandidate = new Vector2(); + var bestCandidateHitPoints = new List(); + var positionsList = posibleTargets.Select(t => t.Position).ToList(); + + foreach (var candidate in candidates) + { + if ( + GetHits( + input.From.To2D(), + candidate, + input.Radius + (input.Unit.BoundingRadius / 3) - 10, + new List { posibleTargets[0].Position }).Count() == 1) + { + var hits = GetHits(input.From.To2D(), candidate, input.Radius, positionsList).ToList(); + var hitsCount = hits.Count; + if (hitsCount >= bestCandidateHits) + { + bestCandidateHits = hitsCount; + bestCandidate = candidate; + bestCandidateHitPoints = hits.ToList(); + } + } + } + + if (bestCandidateHits > 1) + { + float maxDistance = -1; + Vector2 p1 = new Vector2(), p2 = new Vector2(); + + //Center the position + for (var i = 0; i < bestCandidateHitPoints.Count; i++) + { + for (var j = 0; j < bestCandidateHitPoints.Count; j++) + { + var startP = input.From.To2D(); + var endP = bestCandidate; + var proj1 = positionsList[i].ProjectOn(startP, endP); + var proj2 = positionsList[j].ProjectOn(startP, endP); + var dist = Vector2.DistanceSquared(bestCandidateHitPoints[i], proj1.LinePoint) + + Vector2.DistanceSquared(bestCandidateHitPoints[j], proj2.LinePoint); + if (dist >= maxDistance + && (proj1.LinePoint - positionsList[i]).AngleBetween( + proj2.LinePoint - positionsList[j]) > 90) + { + maxDistance = dist; + p1 = positionsList[i]; + p2 = positionsList[j]; + } + } + } + + return new PredictionOutput + { + Hitchance = mainTargetPrediction.Hitchance, + AoeTargetsHitCount = bestCandidateHits, + UnitPosition = mainTargetPrediction.UnitPosition, + CastPosition = ((p1 + p2) * 0.5f).To3D(), Input = input + }; + } + } + + return mainTargetPrediction; + } + + #endregion + + #region Methods + + /// + /// Gets the candidates. + /// + /// From. + /// To. + /// The radius. + /// The range. + /// Vector2[]. + internal static Vector2[] GetCandidates(Vector2 from, Vector2 to, float radius, float range) + { + var middlePoint = (from + to) / 2; + var intersections = Geometry.CircleCircleIntersection( + from, + middlePoint, + radius, + from.Distance(middlePoint)); + + if (intersections.Length > 1) + { + var c1 = intersections[0]; + var c2 = intersections[1]; + + c1 = from + (range * (to - c1).Normalized()); + c2 = from + (range * (to - c2).Normalized()); + + return new[] { c1, c2 }; + } + + return new Vector2[] { }; + } + + /// + /// Gets the hits. + /// + /// The start. + /// The end. + /// The radius. + /// The points. + /// IEnumerable<Vector2>. + internal static IEnumerable GetHits( + Vector2 start, + Vector2 end, + double radius, + List points) + { + return points.Where(p => p.Distance(start, end, true, true) <= radius * radius); + } + + #endregion + } + + /// + /// Represents a possible target. + /// + internal class PossibleTarget + { + #region Fields + + /// + /// The position + /// + public Vector2 Position; + + /// + /// The unit + /// + public Obj_AI_Base Unit; + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Prediction/Old/Collision.cs b/source/Prediction/Old/Collision.cs new file mode 100644 index 00000000..4f1f02f6 --- /dev/null +++ b/source/Prediction/Old/Collision.cs @@ -0,0 +1,200 @@ +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text.RegularExpressions; + + using SharpDX; + + /// + /// Class that helps in calculating collision. + /// + public static class Collision + { + #region Static Fields + + /// + /// The tick yasuo casted wind wall. + /// + private static int _wallCastT; + + /// + /// The yasuo wind wall casted position. + /// + private static Vector2 _yasuoWallCastedPos; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes static members of the class. + /// + static Collision() + { + Obj_AI_Base.OnProcessSpellCast += Obj_AI_Hero_OnProcessSpellCast; + } + + #endregion + + #region Public Methods and Operators + + /// + /// Returns the list of the units that the skillshot will hit before reaching the set positions. + /// + /// The positions. + /// The input. + /// List<Obj_AI_Base>. + public static List GetCollision(List positions, PredictionInput input) + { + var result = new List(); + + foreach (var position in positions) + { + foreach (var objectType in input.CollisionObjects) + { + switch (objectType) + { + case CollisionableObjects.Minions: + foreach (var minion in + ObjectManager.Get() + .Where( + minion => + minion.IsValidTarget( + Math.Min(input.Range + input.Radius + 100, 2000), + true, + input.RangeCheckFrom))) + { + input.Unit = minion; + var minionPrediction = Prediction.GetPrediction(input, false, false); + if (minionPrediction.UnitPosition.To2D() + .Distance(input.From.To2D(), position.To2D(), true, true) + <= Math.Pow(input.Radius + 15 + minion.BoundingRadius, 2)) + { + result.Add(minion); + } + } + break; + case CollisionableObjects.Heroes: + foreach (var hero in + HeroManager.Enemies.FindAll( + hero => + hero.IsValidTarget( + Math.Min(input.Range + input.Radius + 100, 2000), + true, + input.RangeCheckFrom))) + { + input.Unit = hero; + var prediction = Prediction.GetPrediction(input, false, false); + if (prediction.UnitPosition.To2D() + .Distance(input.From.To2D(), position.To2D(), true, true) + <= Math.Pow(input.Radius + 50 + hero.BoundingRadius, 2)) + { + result.Add(hero); + } + } + break; + + case CollisionableObjects.Allies: + foreach (var hero in + HeroManager.Allies.FindAll( + hero => + Vector3.Distance(ObjectManager.Player.ServerPosition, hero.ServerPosition) + <= Math.Min(input.Range + input.Radius + 100, 2000))) + { + input.Unit = hero; + var prediction = Prediction.GetPrediction(input, false, false); + if (prediction.UnitPosition.To2D() + .Distance(input.From.To2D(), position.To2D(), true, true) + <= Math.Pow(input.Radius + 50 + hero.BoundingRadius, 2)) + { + result.Add(hero); + } + } + break; + + case CollisionableObjects.Walls: + var step = position.Distance(input.From) / 20; + for (var i = 0; i < 20; i++) + { + var p = input.From.To2D().Extend(position.To2D(), step * i); + if (NavMesh.GetCollisionFlags(p.X, p.Y).HasFlag(CollisionFlags.Wall)) + { + result.Add(ObjectManager.Player); + } + } + break; + + case CollisionableObjects.YasuoWall: + + if (Utils.TickCount - _wallCastT > 4000) + { + break; + } + + GameObject wall = null; + foreach (var gameObject in + ObjectManager.Get() + .Where( + gameObject => + gameObject.IsValid + && Regex.IsMatch( + gameObject.Name, + "_w_windwall_enemy_0.\\.troy", + RegexOptions.IgnoreCase))) + { + wall = gameObject; + } + if (wall == null) + { + break; + } + var level = wall.Name.Substring(wall.Name.Length - 6, 1); + var wallWidth = 300 + (50 * Convert.ToInt32(level)); + + var wallDirection = + (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular(); + var wallStart = wall.Position.To2D() + (wallWidth / 2f * wallDirection); + var wallEnd = wallStart - (wallWidth * wallDirection); + + if (wallStart.Intersection(wallEnd, position.To2D(), input.From.To2D()).Intersects) + { + var t = Utils.TickCount + + (((wallStart.Intersection(wallEnd, position.To2D(), input.From.To2D()) + .Point.Distance(input.From) / input.Speed) + input.Delay) * 1000); + if (t < _wallCastT + 4000) + { + result.Add(ObjectManager.Player); + } + } + + break; + } + } + } + + return result.Distinct().ToList(); + } + + #endregion + + #region Methods + + /// + /// Fired when the game processes a spell cast. + /// + /// The sender. + /// The instance containing the event data. + private static void Obj_AI_Hero_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) + { + if (sender.IsValid && sender.Team != ObjectManager.Player.Team && args.SData.Name == "YasuoWMovingWall") + { + _wallCastT = Utils.TickCount; + _yasuoWallCastedPos = sender.ServerPosition.To2D(); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Prediction/Old/Prediction.cs b/source/Prediction/Old/Prediction.cs new file mode 100644 index 00000000..cdd5c704 --- /dev/null +++ b/source/Prediction/Old/Prediction.cs @@ -0,0 +1,464 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using SharpDX; + + public static class Prediction + { + #region Static Fields + + private static Menu _menu; + + #endregion + + #region Public Methods and Operators + + /// + /// Gets the prediction. + /// + /// The unit. + /// The delay. + /// PredictionOutput. + public static PredictionOutput GetPrediction(Obj_AI_Base unit, float delay) + { + return GetPrediction(new PredictionInput { Unit = unit, Delay = delay }); + } + + /// + /// Gets the prediction. + /// + /// The unit. + /// The delay. + /// The radius. + /// PredictionOutput. + public static PredictionOutput GetPrediction(Obj_AI_Base unit, float delay, float radius) + { + return GetPrediction(new PredictionInput { Unit = unit, Delay = delay, Radius = radius }); + } + + /// + /// Gets the prediction. + /// + /// The unit. + /// The delay. + /// The radius. + /// The speed. + /// PredictionOutput. + public static PredictionOutput GetPrediction(Obj_AI_Base unit, float delay, float radius, float speed) + { + return GetPrediction(new PredictionInput { Unit = unit, Delay = delay, Radius = radius, Speed = speed }); + } + + /// + /// Gets the prediction. + /// + /// The unit. + /// The delay. + /// The radius. + /// The speed. + /// The collisionable objects. + /// PredictionOutput. + public static PredictionOutput GetPrediction( + Obj_AI_Base unit, + float delay, + float radius, + float speed, + CollisionableObjects[] collisionable) + { + return + GetPrediction( + new PredictionInput + { + Unit = unit, Delay = delay, Radius = radius, Speed = speed, + CollisionObjects = collisionable + }); + } + + /// + /// Gets the prediction. + /// + /// The input. + /// PredictionOutput. + public static PredictionOutput GetPrediction(PredictionInput input) + { + return GetPrediction(input, true, true); + } + + public static void Initialize(Menu menu) + { + _menu = new Menu("Prediction", "Prediction"); + var slider = new MenuItem("PredMaxRange", "Max Range %").SetValue(new Slider(100, 70, 100)); + _menu.AddItem(slider); + menu.AddSubMenu(_menu); + } + + public static void Shutdown() + { + Menu.Remove(_menu); + } + + #endregion + + #region Methods + + /// + /// Gets the dashing prediction. + /// + /// The input. + /// PredictionOutput. + internal static PredictionOutput GetDashingPrediction(PredictionInput input) + { + var dashData = input.Unit.GetDashInfo(); + var result = new PredictionOutput { Input = input }; + + //Normal dashes. + if (!dashData.IsBlink) + { + //Mid air: + var endP = dashData.Path.Last(); + var dashPred = GetPositionOnPath( + input, + new List { input.Unit.ServerPosition.To2D(), endP }, + dashData.Speed); + if (dashPred.Hitchance >= HitChance.High + && dashPred.UnitPosition.To2D().Distance(input.Unit.Position.To2D(), endP, true) < 200) + { + dashPred.CastPosition = dashPred.UnitPosition; + dashPred.Hitchance = HitChance.Dashing; + return dashPred; + } + + //At the end of the dash: + if (dashData.Path.PathLength() > 200) + { + var timeToPoint = (input.Delay / 2f) + (input.From.To2D().Distance(endP) / input.Speed) - 0.25f; + if (timeToPoint + <= (input.Unit.Distance(endP) / dashData.Speed) + (input.RealRadius / input.Unit.MoveSpeed)) + { + return new PredictionOutput + { + CastPosition = endP.To3D(), UnitPosition = endP.To3D(), + Hitchance = HitChance.Dashing + }; + } + } + + result.CastPosition = dashData.Path.Last().To3D(); + result.UnitPosition = result.CastPosition; + + //Figure out where the unit is going. + } + + return result; + } + + /// + /// Gets the immobile prediction. + /// + /// The input. + /// The remaining immobile t. + /// PredictionOutput. + internal static PredictionOutput GetImmobilePrediction(PredictionInput input, double remainingImmobileT) + { + var timeToReachTargetPosition = input.Delay + (input.Unit.Distance(input.From) / input.Speed); + + if (timeToReachTargetPosition <= remainingImmobileT + (input.RealRadius / input.Unit.MoveSpeed)) + { + return new PredictionOutput + { + CastPosition = input.Unit.ServerPosition, UnitPosition = input.Unit.Position, + Hitchance = HitChance.Immobile + }; + } + + return new PredictionOutput + { + Input = input, CastPosition = input.Unit.ServerPosition, + UnitPosition = input.Unit.ServerPosition, Hitchance = HitChance.High + /*timeToReachTargetPosition - remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed < 0.4d ? HitChance.High : HitChance.Medium*/ + }; + } + + /// + /// Gets the position on path. + /// + /// The input. + /// The path. + /// The speed. + /// PredictionOutput. + internal static PredictionOutput GetPositionOnPath(PredictionInput input, List path, float speed = -1) + { + speed = (Math.Abs(speed - (-1)) < float.Epsilon) ? input.Unit.MoveSpeed : speed; + + if (path.Count <= 1) + { + return new PredictionOutput + { + Input = input, UnitPosition = input.Unit.ServerPosition, + CastPosition = input.Unit.ServerPosition, Hitchance = HitChance.VeryHigh + }; + } + + var pLength = path.PathLength(); + + //Skillshots with only a delay + if (pLength >= (input.Delay * speed) - input.RealRadius + && Math.Abs(input.Speed - float.MaxValue) < float.Epsilon) + { + var tDistance = (input.Delay * speed) - input.RealRadius; + + for (var i = 0; i < path.Count - 1; i++) + { + var a = path[i]; + var b = path[i + 1]; + var d = a.Distance(b); + + if (d >= tDistance) + { + var direction = (b - a).Normalized(); + + var cp = a + (direction * tDistance); + var p = a + + (direction + * ((i == path.Count - 2) + ? Math.Min(tDistance + input.RealRadius, d) + : (tDistance + input.RealRadius))); + + return new PredictionOutput + { + Input = input, CastPosition = cp.To3D(), UnitPosition = p.To3D(), + Hitchance = + PathTracker.GetCurrentPath(input.Unit).Time < 0.1d + ? HitChance.VeryHigh + : HitChance.High + }; + } + + tDistance -= d; + } + } + + //Skillshot with a delay and speed. + if (pLength >= (input.Delay * speed) - input.RealRadius + && Math.Abs(input.Speed - float.MaxValue) > float.Epsilon) + { + var d = (input.Delay * speed) - input.RealRadius; + if (input.Type == SkillshotType.SkillshotLine || input.Type == SkillshotType.SkillshotCone) + { + if (input.From.Distance(input.Unit.ServerPosition, true) < 200 * 200) + { + d = input.Delay * speed; + } + } + + path = path.CutPath(d); + var tT = 0f; + for (var i = 0; i < path.Count - 1; i++) + { + var a = path[i]; + var b = path[i + 1]; + var tB = a.Distance(b) / speed; + var direction = (b - a).Normalized(); + a = a - (speed * tT * direction); + var sol = Geometry.VectorMovementCollision(a, b, speed, input.From.To2D(), input.Speed, tT); + var t = (float)sol[0]; + var pos = (Vector2)sol[1]; + + if (pos.IsValid() && t >= tT && t <= tT + tB) + { + if (pos.Distance(b, true) < 20) + { + break; + } + + var p = pos + (input.RealRadius * direction); + + if (input.Type == SkillshotType.SkillshotLine && false) + { + var alpha = (input.From.To2D() - p).AngleBetween(a - b); + if (alpha > 30 && alpha < 180 - 30) + { + var beta = (float)Math.Asin(input.RealRadius / p.Distance(input.From)); + var cp1 = input.From.To2D() + (p - input.From.To2D()).Rotated(beta); + var cp2 = input.From.To2D() + (p - input.From.To2D()).Rotated(-beta); + + pos = cp1.Distance(pos, true) < cp2.Distance(pos, true) ? cp1 : cp2; + } + } + + return new PredictionOutput + { + Input = input, CastPosition = pos.To3D(), UnitPosition = p.To3D(), + Hitchance = + PathTracker.GetCurrentPath(input.Unit).Time < 0.1d + ? HitChance.VeryHigh + : HitChance.High + }; + } + tT += tB; + } + } + + var position = path.Last(); + return new PredictionOutput + { + Input = input, CastPosition = position.To3D(), UnitPosition = position.To3D(), + Hitchance = HitChance.Medium + }; + } + + /// + /// Gets the prediction. + /// + /// The input. + /// if set to true, will add extra delay to the spell.. + /// if set to true, checks collision. + /// PredictionOutput. + internal static PredictionOutput GetPrediction(PredictionInput input, bool ft, bool checkCollision) + { + PredictionOutput result = null; + + if (!input.Unit.IsValidTarget(float.MaxValue, false)) + { + return new PredictionOutput(); + } + + if (ft) + { + //Increase the delay due to the latency and server tick: + input.Delay += (Game.Ping / 2000f) + 0.06f; + + if (input.Aoe) + { + return AoePrediction.GetPrediction(input); + } + } + + //Target too far away. + if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon + && input.Unit.Distance(input.RangeCheckFrom, true) > Math.Pow(input.Range * 1.5, 2)) + { + return new PredictionOutput { Input = input }; + } + + //Unit is dashing. + if (input.Unit.IsDashing()) + { + result = GetDashingPrediction(input); + } + else + { + //Unit is immobile. + var remainingImmobileT = UnitIsImmobileUntil(input.Unit); + if (remainingImmobileT >= 0d) + { + result = GetImmobilePrediction(input, remainingImmobileT); + } + else + { + input.Range = input.Range * Instances.MenuManager.Menu.Item("PredMaxRange").GetValue().Value + / 100f; + } + } + + //Normal prediction + if (result == null) + { + result = GetStandardPrediction(input); + } + + //Check if the unit position is in range + if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon) + { + if (result.Hitchance >= HitChance.High + && input.RangeCheckFrom.Distance(input.Unit.Position, true) + > Math.Pow(input.Range + (input.RealRadius * 3 / 4), 2)) + { + result.Hitchance = HitChance.Medium; + } + + if (input.RangeCheckFrom.Distance(result.UnitPosition, true) + > Math.Pow(input.Range + (input.Type == SkillshotType.SkillshotCircle ? input.RealRadius : 0), 2)) + { + result.Hitchance = HitChance.OutOfRange; + } + + if (input.RangeCheckFrom.Distance(result.CastPosition, true) > Math.Pow(input.Range, 2)) + { + if (result.Hitchance != HitChance.OutOfRange) + { + result.CastPosition = input.RangeCheckFrom + + (input.Range + * (result.UnitPosition - input.RangeCheckFrom).To2D().Normalized().To3D()); + } + else + { + result.Hitchance = HitChance.OutOfRange; + } + } + } + + //Check for collision + if (checkCollision && input.Collision) + { + var positions = new List { result.UnitPosition, result.CastPosition, input.Unit.Position }; + var originalUnit = input.Unit; + result.CollisionObjects = Collision.GetCollision(positions, input); + result.CollisionObjects.RemoveAll(x => x.NetworkId == originalUnit.NetworkId); + result.Hitchance = result.CollisionObjects.Count > 0 ? HitChance.Collision : result.Hitchance; + } + + return result; + } + + /// + /// Gets the standard prediction. + /// + /// The input. + /// PredictionOutput. + internal static PredictionOutput GetStandardPrediction(PredictionInput input) + { + var speed = input.Unit.MoveSpeed; + + if (input.Unit.Distance(input.From, true) < 200 * 200) + { + //input.Delay /= 2; + speed /= 1.5f; + } + + var result = GetPositionOnPath(input, input.Unit.GetWaypoints(), speed); + + if (result.Hitchance >= HitChance.High && input.Unit is Obj_AI_Hero) + { + } + + return result; + } + + /// + /// Gets the time the unit is immobile untill. + /// + /// The unit. + /// System.Double. + internal static double UnitIsImmobileUntil(Obj_AI_Base unit) + { + var result = + unit.Buffs.Where( + buff => + buff.IsActive && Game.Time <= buff.EndTime + && (buff.Type == BuffType.Charm || buff.Type == BuffType.Knockup || buff.Type == BuffType.Stun + || buff.Type == BuffType.Suppression || buff.Type == BuffType.Snare)) + .Aggregate(0d, (current, buff) => Math.Max(current, buff.EndTime)); + return result - Game.Time; + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Prediction/PathTracker.cs b/source/Prediction/PathTracker.cs new file mode 100644 index 00000000..c80dd7a4 --- /dev/null +++ b/source/Prediction/PathTracker.cs @@ -0,0 +1,179 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using SharpDX; + + /// + /// Provides a path tracker for units. + /// + public static class PathTracker + { + #region Constants + + /// + /// Max track time. + /// + public const double MaxTime = 1.5d; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes static members of the class. + /// + static PathTracker() + { + Obj_AI_Base.OnNewPath += OnNewPath; + } + + #endregion + + #region Public Properties + + /// + /// Gets the stored paths. + /// + public static IDictionary> StoredPaths { get; } = new Dictionary>(); + + #endregion + + #region Public Methods and Operators + + /// + /// Gets the current unit path. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static StoredPath GetCurrentPath(Obj_AI_Base unit) + { + List paths; + return StoredPaths.TryGetValue(unit.NetworkId, out paths) ? paths.LastOrDefault() : new StoredPath(); + } + + /// + /// Gets the mean speed of the unit. + /// + /// + /// The unit. + /// + /// + /// The max time. + /// + /// + /// The . + /// + public static double GetMeanSpeed(Obj_AI_Base unit, double maxTime) + { + var paths = GetStoredPaths(unit, MaxTime); + var distance = 0d; + if (paths.Any()) + { + distance += (maxTime - paths[0].Time) * unit.MoveSpeed; + for (var i = 0; i < paths.Count - 1; ++i) + { + var currentPath = paths[i]; + var nextPath = paths[i + 1]; + + if (currentPath.WaypointCount > 0) + { + distance += Math.Min( + (currentPath.Time - nextPath.Time) * unit.MoveSpeed, + currentPath.Path.PathLength()); + } + } + + var lastPath = paths.Last(); + if (lastPath.WaypointCount > 0) + { + distance += Math.Min(lastPath.Time * unit.MoveSpeed, lastPath.Path.PathLength()); + } + } + else + { + return unit.MoveSpeed; + } + + return distance / maxTime; + } + + /// + /// Gets the stored paths of the unit. + /// + /// + /// The unit. + /// + /// + /// The max time. + /// + /// + /// The . + /// + public static List GetStoredPaths(Obj_AI_Base unit, double maxTime) + { + List paths; + return StoredPaths.TryGetValue(unit.NetworkId, out paths) ? paths : new List(); + } + + /// + /// Gets the tendency of the unit. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static Vector3 GetTendency(Obj_AI_Base unit) + { + var paths = GetStoredPaths(unit, MaxTime); + var result = default(Vector2); + + foreach (var path in paths) + { + var k = 1; // (MaxTime - path.Time); TODO + result = result + (k * (path.EndPoint - unit.ServerPosition.To2D()).Normalized()); + } + + return (result / paths.Count).To3D(); + } + + #endregion + + #region Methods + + private static void OnNewPath(Obj_AI_Base sender, GameObjectNewPathEventArgs args) + { + if (!(sender is Obj_AI_Hero)) + { + return; + } + + if (!StoredPaths.ContainsKey(sender.NetworkId)) + { + StoredPaths.Add(sender.NetworkId, new List()); + } + + var path = new StoredPath { Tick = Utils.GameTimeTickCount, Path = args.Path.ToList().To2D() }; + StoredPaths[sender.NetworkId].Add(path); + + if (StoredPaths[sender.NetworkId].Count > 50) + { + StoredPaths[sender.NetworkId].RemoveRange(0, 40); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Prediction/PredictionInput.cs b/source/Prediction/PredictionInput.cs new file mode 100644 index 00000000..db695ca1 --- /dev/null +++ b/source/Prediction/PredictionInput.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Prediction input, contains essential information to calculate a prediction. + /// + public class PredictionInput + { + #region Fields + + private Vector3 fromBackingField; + + private Vector3 rangeCheckFromBackingField; + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether the prediction should consider with area of effect calculations. + /// + public bool Aoe { get; set; } + + /// + /// Gets or sets a value indicating whether the prediction should consider collisions. + /// + public bool Collision { get; set; } + + /// + /// Gets or sets the collision objects that the prediction should consider. + /// + public CollisionableObjects[] CollisionObjects { get; set; } = + { + CollisionableObjects.Minions, + CollisionableObjects.YasuoWall + }; + + /// + /// Gets or sets the delay. + /// + public float Delay { get; set; } + + /// + /// Gets or sets the from position. + /// + public Vector3 From + { + get + { + return this.fromBackingField.To2D().IsZero ? ObjectManager.Player.ServerPosition : this.fromBackingField; + } + + set + { + this.fromBackingField = value; + } + } + + /// + /// Gets or sets the radius. + /// + public float Radius { get; set; } = 1f; + + /// + /// Gets or sets the range. + /// + public float Range { get; set; } = float.MaxValue; + + /// + /// Gets or sets the range check from. + /// + public Vector3 RangeCheckFrom + { + get + { + return this.rangeCheckFromBackingField.To2D().IsZero ? this.From : this.rangeCheckFromBackingField; + } + + set + { + this.rangeCheckFromBackingField = value; + } + } + + /// + /// Gets or sets the speed. + /// + public float Speed { get; set; } = float.MaxValue; + + /// + /// Gets or sets the type. + /// + public SkillshotType Type { get; set; } = SkillshotType.SkillshotLine; + + /// + /// Gets or sets the unit. + /// + public Obj_AI_Base Unit { get; set; } = ObjectManager.Player; + + /// + /// Gets or sets a value indicating whether the bounding radius should be used. + /// + public bool UseBoundingRadius { get; set; } = true; + + #endregion + + #region Properties + + /// + /// Gets the real radius. + /// + internal float RealRadius + => this.UseBoundingRadius ? this.Radius + (this.Unit?.BoundingRadius ?? 0f) : this.Radius; + + #endregion + } +} \ No newline at end of file diff --git a/source/Prediction/PredictionOutput.cs b/source/Prediction/PredictionOutput.cs new file mode 100644 index 00000000..098f3fa9 --- /dev/null +++ b/source/Prediction/PredictionOutput.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + + using SharpDX; + + /// + /// Contains the output information of a prediction calculation. + /// + public class PredictionOutput + { + #region Fields + + private int aoeTargetsHitCountBackingField; + + private Vector3 castPositionBackingField; + + private Vector3 unitPositionBackingField; + + #endregion + + #region Public Properties + + /// + /// Gets or sets the area of effect targets hit collection, if acceptable. + /// + public List AoeTargetsHit { get; set; } = new List(); + + /// + /// Gets or sets the area of effect targets hit count. + /// + public int AoeTargetsHitCount + { + get + { + return Math.Max(this.aoeTargetsHitCountBackingField, this.AoeTargetsHit.Count); + } + + set + { + this.aoeTargetsHitCountBackingField = value; + } + } + + /// + /// Gets or sets the cast position. + /// + public Vector3 CastPosition + { + get + { + return this.castPositionBackingField.To2D().IsValid() + ? this.castPositionBackingField.SetZ() + : this.Input.Unit.ServerPosition; + } + + set + { + this.castPositionBackingField = value; + } + } + + /// + /// Gets or sets the collision objects the skillshot would collide with. + /// + public List CollisionObjects { get; set; } = new List(); + + /// + /// Gets or sets the hitchance. + /// + public HitChance Hitchance { get; set; } = HitChance.Immobile; + + /// + /// Gets or sets the unit position. + /// + public Vector3 UnitPosition + { + get + { + return this.unitPositionBackingField.To2D().IsValid() + ? this.unitPositionBackingField.SetZ() + : this.Input.Unit.ServerPosition; + } + + set + { + this.unitPositionBackingField = value; + } + } + + #endregion + + #region Properties + + /// + /// Gets or sets the input. + /// + internal PredictionInput Input { get; set; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Prediction/SkillshotType.cs b/source/Prediction/SkillshotType.cs new file mode 100644 index 00000000..de9c1a37 --- /dev/null +++ b/source/Prediction/SkillshotType.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// Skillshot type. + /// + public enum SkillshotType + { + /// + /// Line. + /// + SkillshotLine, + + /// + /// Circle. + /// + SkillshotCircle, + + /// + /// Cone. + /// + SkillshotCone + } +} \ No newline at end of file diff --git a/source/Prediction/StoredPath.cs b/source/Prediction/StoredPath.cs new file mode 100644 index 00000000..ad5bea8e --- /dev/null +++ b/source/Prediction/StoredPath.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + using System.Linq; + + using SharpDX; + + /// + /// Stored path information of a unit. + /// + public class StoredPath + { + #region Public Properties + + /// + /// Gets the end point. + /// + public Vector2 EndPoint => this.Path.LastOrDefault(); + + /// + /// Gets or sets the path. + /// + public List Path { get; set; } + + /// + /// Gets the start point. + /// + public Vector2 StartPoint => this.Path.FirstOrDefault(); + + /// + /// Gets or sets the tick. + /// + public int Tick { get; set; } + + /// + /// Gets the time. + /// + public double Time => (Utils.GameTimeTickCount - this.Tick) / 1000d; + + /// + /// Gets the waypoint count. + /// + public int WaypointCount => this.Path.Count; + + #endregion + } +} \ No newline at end of file diff --git a/source/Properties/AssemblyInfo.cs b/source/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..e54f8874 --- /dev/null +++ b/source/Properties/AssemblyInfo.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +using System.Reflection; +using System.Resources; +using System.Runtime.InteropServices; +using System.Security; + +[assembly: AssemblyTitle("LeagueSharp.Common")] +[assembly: AssemblyDescription("LeagueSharp.Common")] +[assembly: AssemblyConfiguration("RELEASE")] +[assembly: AssemblyCompany("LeagueSharp")] +[assembly: AssemblyProduct("LeagueSharp.Common")] +[assembly: AssemblyCopyright("Copyright © LeagueSharp 2016")] +[assembly: AssemblyTrademark("LeagueSharp")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("e6f3b6a3-5cd7-442a-98e3-bde65c1dcd25")] +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")] +[assembly: NeutralResourcesLanguage("en")] +[assembly: AllowPartiallyTrustedCallers] +[assembly: SecurityRules(SecurityRuleSet.Level1)] \ No newline at end of file diff --git a/Properties/Resources.Designer.cs b/source/Properties/Resources.Designer.cs similarity index 54% rename from Properties/Resources.Designer.cs rename to source/Properties/Resources.Designer.cs index ca33fcd3..312ae909 100644 --- a/Properties/Resources.Designer.cs +++ b/source/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -59,68 +59,33 @@ internal Resources() { resourceCulture = value; } } - /// - /// 查詢類似 { - /// "\u003c": "\u003c", - /// "yasuo": "\u72bd\u5bbf", - /// "velkoz": "\u5a01\u5bc7\u8332", - /// "braum": "\u5e03\u90ce\u59c6", - /// "gnar": "\u5436\u5152", - /// "azir": "\u963f\u7948\u723e", - /// "kalista": "\u514b\u9ece\u601d\u59b2", - /// "rekSai": "\u96f7\u73c2\u715e", - /// "bard": "\u5df4\u5fb7", - /// "ekko": "\u827e\u514b", - /// "aatrox": "\u5384\u85a9\u65af", - /// "ahri": "\u963f\u7483", - /// "akali": "\u963f\u5361\u8389", - /// "alistar": "\u4e9e\u6b77\u65af\u5854", - /// "amumu": "\u963f\u59c6\u59c6", - /// "anivia": "\u827e\u59ae\u7dad\u4e9e", - /// "annie": "\u5b89\u59ae", - /// "ashe": "\u827e\u5e0c", - /// "blitzcrank": "\u5e03\u91cc\u8328", - /// "brand": "\u5e03\u862d\u5fb7", - /// "caitlyn": "\u51f1\u7279\u7433", - /// "cassiopeia": "\u5361\u838e\u78a7\u96c5", - /// "chogath": "\u79d1\u52a0\u65af", - /// "corki": "\u5eab\u5947", - /// "darius": "\u9054\u745e\u65af", - /// "diana": "\u9edb\u5b89\u5a1c", - /// "drmundo&... 的當地語系化字串。 - /// - internal static string ChineseJson { - get { - return ResourceManager.GetString("ChineseJson", resourceCulture); - } - } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Byte[]. /// - internal static System.Drawing.Bitmap CPActiveSlider { + internal static byte[] ChineseJson { get { - object obj = ResourceManager.GetObject("CPActiveSlider", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + object obj = ResourceManager.GetObject("ChineseJson", resourceCulture); + return ((byte[])(obj)); } } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Byte[]. /// - internal static System.Drawing.Bitmap CPForm { + internal static byte[] CircleEffect { get { - object obj = ResourceManager.GetObject("CPForm", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + object obj = ResourceManager.GetObject("CircleEffect", resourceCulture); + return ((byte[])(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap CPInactiveSlider { + internal static System.Drawing.Bitmap spectrum_chart { get { - object obj = ResourceManager.GetObject("CPInactiveSlider", resourceCulture); + object obj = ResourceManager.GetObject("spectrum_chart", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } diff --git a/source/Properties/Resources.resx b/source/Properties/Resources.resx new file mode 100644 index 00000000..8034a442 --- /dev/null +++ b/source/Properties/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\CircleEffect.fx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\ChineseJson.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\spectrum_chart.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/source/Render/Alerter.cs b/source/Render/Alerter.cs new file mode 100644 index 00000000..51c989a2 --- /dev/null +++ b/source/Render/Alerter.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// The alerter, shows text for an amount of time. + /// + public class Alerter : Render.Text + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The X-axis of the position. + /// + /// + /// The Y-axis of the position. + /// + /// + /// The text. + /// + /// + /// The size. + /// + /// + /// The color. + /// + /// + /// The face name. + /// + /// + /// The duration. + /// + public Alerter( + int x, + int y, + string text, + int size, + ColorBGRA color, + string faceName = "Calibri", + float duration = 1f) + : base(x, y, text, size, color, faceName) + { + this.Duration = duration; + this.StartTime = Utils.GameTimeTickCount; + this.EndTime = this.StartTime + duration; + + Game.OnUpdate += this.OnUpdate; + } + + #endregion + + #region Public Properties + + /// + /// Gets the duration. + /// + public float Duration { get; } + + /// + /// Gets the ending time. + /// + public float EndTime { get; } + + /// + /// Gets the start time. + /// + public float StartTime { get; } + + #endregion + + #region Public Methods and Operators + + /// + /// Removes the alerter. + /// + public void Remove() + { + this.Visible = false; + this.Dispose(); + } + + #endregion + + #region Methods + + private void OnUpdate(EventArgs args) + { + if (Utils.GameTimeTickCount < this.EndTime) + { + return; + } + + this.Remove(); + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Render/Circle.cs b/source/Render/Circle.cs new file mode 100644 index 00000000..2d8bfede --- /dev/null +++ b/source/Render/Circle.cs @@ -0,0 +1,210 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + using Color = System.Drawing.Color; + + /// + /// The render class. + /// + public static partial class Render + { + /// + /// Circle drawing. + /// + public partial class Circle : RenderObject + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The unit. + /// + /// + /// The radius. + /// + /// + /// The color. + /// + /// + /// The width. + /// + /// + /// A value indicating whether to enable depth. + /// + public Circle(GameObject unit, float radius, Color color, int width = 1, bool zDeep = false) + : this(radius, color, width, zDeep) + { + this.Unit = unit; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The unit. + /// + /// + /// The offset. + /// + /// + /// The radius. + /// + /// + /// The color. + /// + /// + /// The width. + /// + /// + /// A value indicating whether to enable depth. + /// + public Circle(GameObject unit, Vector3 offset, float radius, Color color, int width = 1, bool zDeep = false) + : this(radius, color, width, zDeep) + { + this.Unit = unit; + this.Offset = offset; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The position. + /// + /// + /// The offset. + /// + /// + /// The radius. + /// + /// + /// The color. + /// + /// + /// The width. + /// + /// + /// A value indicating whether to enable depth. + /// + public Circle(Vector3 pos, Vector3 offset, float radius, Color color, int width = 1, bool zDeep = false) + : this(radius, color, width, zDeep) + { + this.Position = pos; + this.Offset = offset; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The position. + /// + /// + /// The radius. + /// + /// + /// The color. + /// + /// + /// The width. + /// + /// + /// A value indicating whether to enable depth. + /// + public Circle(Vector3 pos, float radius, Color color, int width = 1, bool zDeep = false) + : this(radius, color, width, zDeep) + { + this.Position = pos; + } + + private Circle(float radius, Color color, int width, bool zDeep) + { + this.Radius = radius; + this.Color = color; + this.Width = width; + this.ZDeep = zDeep; + this.SubscribeToResetEvents(); + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the color. + /// + public Color Color { get; set; } + + /// + /// Gets or sets the offset. + /// + public Vector3 Offset { get; set; } = default(Vector3); + + /// + /// Gets or sets the position. + /// + public Vector3 Position { get; set; } + + /// + /// Gets or sets the radius. + /// + public float Radius { get; set; } + + /// + /// Gets or sets the unit. + /// + public GameObject Unit { get; set; } + + /// + /// Gets or sets the width. + /// + public int Width { get; set; } + + /// + /// Gets or sets a value indicating whether to enable depth. + /// + public bool ZDeep { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + public override void OnDraw() + { + try + { + var position = default(Vector3); + if (this.Unit?.IsValid ?? false) + { + position = this.Unit.Position + this.Offset; + } + else if (!(this.Position + this.Offset).To2D().IsZero) + { + position = this.Position + this.Offset; + } + + if (!position.IsZero) + { + DrawCircle(position, this.Radius, this.Color, this.Width, this.ZDeep); + } + } + catch (Exception e) + { + this.Log.Error($"Could not draw a circle.", e); + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Render/CircleEffect.cs b/source/Render/CircleEffect.cs new file mode 100644 index 00000000..b5f68f38 --- /dev/null +++ b/source/Render/CircleEffect.cs @@ -0,0 +1,243 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Text; + + using LeagueSharp.Common.Properties; + + using SharpDX; + using SharpDX.Direct3D9; + + using Color = System.Drawing.Color; + + /// + /// The render class. + /// + public static partial class Render + { + /// + /// Circle drawing. + /// + public partial class Circle + { + #region Properties + + private static Effect Effect { get; set; } + + private static bool Initialized { get; set; } + + private static VertexBuffer VertexBuffer { get; set; } + + private static VertexDeclaration VertexDeclaration { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Creates the circle vertices. + /// + public static void CreateVertexes() + { + const Usage Usage = Usage.WriteOnly; + const VertexFormat Format = VertexFormat.None; + const Pool Pool = Pool.Managed; + + var sizeInBytes = Utilities.SizeOf() * 2 * 6; + + VertexBuffer = new VertexBuffer(Device, sizeInBytes, Usage, Format, Pool); + SatisfyBuffer(VertexBuffer.Lock(0, 0, LockFlags.None)); + VertexBuffer.Unlock(); + + var vertexElements = CreateVertexElements(); + VertexDeclaration = new VertexDeclaration(Device, vertexElements); + + try + { + var effect = Encoding.UTF8.GetString(Resources.CircleEffect); + Effect = Effect.FromString(Device, effect, ShaderFlags.None); + } + catch (Exception e) + { + Logger.Fatal("Failed to compile circle effect.", e); + } + + if (!Initialized) + { + Initialized = true; + Drawing.OnPreReset += OnPreReset; + Drawing.OnPostReset += OnPostReset; + } + } + + /// + /// Draws a circle. + /// + /// + /// The position. + /// + /// + /// The radius. + /// + /// + /// The color. + /// + /// + /// The width. + /// + /// + /// A value indicating whether to enable depth. + /// + public static void DrawCircle(Vector3 pos, float radius, Color color, int width = 5, bool zDeep = false) + { + if (Device == null || Device.IsDisposed) + { + return; + } + + if (VertexBuffer == null) + { + CreateVertexes(); + } + + if ((VertexBuffer?.IsDisposed ?? false) || VertexDeclaration.IsDisposed || Effect.IsDisposed) + { + return; + } + + try + { + var vertexDeclaration = Device.VertexDeclaration; + + Effect.Begin(); + Effect.BeginPass(0); + + Effect.SetValue( + "ProjectionMatrix", + Matrix.Translation(pos.SwitchYZ()) * Drawing.View * Drawing.Projection); + Effect.SetValue( + "CircleColor", + new Vector4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f)); + Effect.SetValue("Radius", radius); + Effect.SetValue("Border", 2f + width); + Effect.SetValue("zEnabled", zDeep); + + Device.SetStreamSource(0, VertexBuffer, 0, Utilities.SizeOf() * 2); + Device.VertexDeclaration = VertexDeclaration; + + Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); + + Effect.EndPass(); + Effect.End(); + + Device.VertexDeclaration = vertexDeclaration; + } + catch (Exception e) + { + Dispose(null, EventArgs.Empty); + Logger.Error("Unable to draw circle, flushing resources..", e); + } + } + + #endregion + + #region Methods + + /// + /// Disposes the circle effect unmanaged resources. + /// + /// + /// The sender. + /// + /// + /// The event args. + /// + internal static void Dispose(object sender, EventArgs e) + { + Initialized = false; + OnPreReset(EventArgs.Empty); + + if (Effect != null && !Effect.IsDisposed) + { + Effect.Dispose(); + } + + if (VertexBuffer != null && !VertexBuffer.IsDisposed) + { + VertexBuffer.Dispose(); + } + + if (VertexDeclaration != null && !VertexDeclaration.IsDisposed) + { + VertexDeclaration.Dispose(); + } + } + + private static VertexElement[] CreateVertexElements() + => + new[] + { + new VertexElement( + 0, + 0, + DeclarationType.Float4, + DeclarationMethod.Default, + DeclarationUsage.Position, + 0), + new VertexElement( + 0, + 16, + DeclarationType.Float4, + DeclarationMethod.Default, + DeclarationUsage.Color, + 0), + VertexElement.VertexDeclarationEnd + }; + + private static void OnPostReset(EventArgs args) + { + if (Effect != null && !Effect.IsDisposed) + { + Effect.OnResetDevice(); + } + } + + private static void OnPreReset(EventArgs args) + { + if (Effect != null && !Effect.IsDisposed) + { + Effect.OnLostDevice(); + } + } + + private static void SatisfyBuffer(DataStream dataStream) + { + const float X = 6000f; + var range = new Vector4[12]; + + for (var i = 1; i < range.Length; i += 2) + { + range[i] = Vector4.Zero; + } + + // T1 + range[0] = new Vector4(-X, 0f, -X, 1.0f); + range[2] = new Vector4(-X, 0f, X, 1.0f); + range[4] = new Vector4(X, 0f, -X, 1.0f); + + // T2 + range[6] = new Vector4(-X, 0f, X, 1.0f); + range[8] = new Vector4(X, 0f, X, 1.0f); + range[10] = new Vector4(X, 0f, -X, 1.0f); + + dataStream.WriteRange(range); + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Render/FontExtension.cs b/source/Render/FontExtension.cs new file mode 100644 index 00000000..73bad18e --- /dev/null +++ b/source/Render/FontExtension.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + + using SharpDX; + using SharpDX.Direct3D9; + + /// + /// Font Extensions. + /// + public static class FontExtension + { + #region Static Fields + + /// + /// Collection of saved widths for each font. + /// + private static readonly Dictionary> Widths = + new Dictionary>(); + + #endregion + + #region Public Methods and Operators + + /// + /// Measures the text. + /// + /// + /// The font. + /// + /// + /// The sprite. + /// + /// + /// The text. + /// + /// + /// The . + /// + public static Rectangle MeasureText(this Font font, Sprite sprite, string text) + { + Dictionary rectangles; + if (!Widths.TryGetValue(font, out rectangles)) + { + rectangles = new Dictionary(); + Widths[font] = rectangles; + } + + Rectangle rectangle; + if (rectangles.TryGetValue(text, out rectangle)) + { + return rectangle; + } + + rectangle = font.MeasureText(sprite, text, 0); + rectangles[text] = rectangle; + return rectangle; + } + + /// + /// Measures the text. + /// + /// + /// The font. + /// + /// + /// The text. + /// + /// + /// The . + /// + public static Rectangle MeasureText(this Font font, string text) => font.MeasureText(null, text); + + #endregion + } +} \ No newline at end of file diff --git a/source/Render/Line.cs b/source/Render/Line.cs new file mode 100644 index 00000000..910aa443 --- /dev/null +++ b/source/Render/Line.cs @@ -0,0 +1,192 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// The render class. + /// + public static partial class Render + { + /// + /// Draws a line. + /// + public class Line : RenderObject + { + #region Fields + + private int width; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The start. + /// + /// + /// The end. + /// + /// + /// The width. + /// + /// + /// The color. + /// + public Line(Vector2 start, Vector2 end, int width, ColorBGRA color) + { + this.DeviceLine = new SharpDX.Direct3D9.Line(Device); + + this.Width = width; + this.Color = color; + this.Start = start; + this.End = end; + + Game.OnUpdate += this.OnUpdate; + this.SubscribeToResetEvents(); + } + + #endregion + + #region Delegates + + /// + /// The position update delegate. + /// + /// + /// The . + /// + public delegate Vector2 PositionDelegate(); + + #endregion + + #region Public Properties + + /// + /// Gets or sets the color. + /// + public ColorBGRA Color { get; set; } + + /// + /// Gets or sets the ending position. + /// + public Vector2 End { get; set; } + + /// + /// Gets or sets the end position update. + /// + public PositionDelegate EndPositionUpdate { get; set; } + + /// + /// Gets or sets the starting position. + /// + public Vector2 Start { get; set; } + + /// + /// Gets or sets the start position update. + /// + public PositionDelegate StartPositionUpdate { get; set; } + + /// + /// Gets or sets the line width. + /// + public int Width + { + get + { + return this.width; + } + + set + { + this.DeviceLine.Width = value; + this.width = value; + } + } + + #endregion + + #region Properties + + private SharpDX.Direct3D9.Line DeviceLine { get; } + + #endregion + + #region Public Methods and Operators + + /// + public override void OnEndScene() + { + if (this.DeviceLine == null || this.DeviceLine.IsDisposed) + { + return; + } + + try + { + this.DeviceLine.Begin(); + this.DeviceLine.Draw(new[] { this.Start, this.End }, this.Color); + this.DeviceLine.End(); + } + catch (Exception e) + { + this.Log.Error("Unable to draw line.", e); + } + } + + /// + public override void OnPostReset() + { + base.OnPostReset(); + this.DeviceLine?.OnResetDevice(); + } + + /// + public override void OnPreReset() + { + base.OnPreReset(); + this.DeviceLine?.OnLostDevice(); + } + + #endregion + + #region Methods + + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (!this.DeviceLine.IsDisposed) + { + this.DeviceLine.Dispose(); + } + + Game.OnUpdate -= this.OnUpdate; + } + + private void OnUpdate(EventArgs args) + { + if (this.StartPositionUpdate != null) + { + this.Start = this.StartPositionUpdate(); + } + + if (this.EndPositionUpdate != null) + { + this.End = this.EndPositionUpdate(); + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Render/Rectangle.cs b/source/Render/Rectangle.cs new file mode 100644 index 00000000..f6e00da4 --- /dev/null +++ b/source/Render/Rectangle.cs @@ -0,0 +1,173 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + /// + /// The render class. + /// + public static partial class Render + { + /// + /// Draws a rectangle. + /// + public class Rectangle : RenderObject + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The X-axis of the position. + /// + /// + /// The Y-axis of the position. + /// + /// + /// The width. + /// + /// + /// The height. + /// + /// + /// The color. + /// + public Rectangle(int x, int y, int width, int height, ColorBGRA color) + { + this.DeviceLine = new SharpDX.Direct3D9.Line(Device) { Width = height }; + + this.X = x; + this.Y = y; + this.Width = width; + this.Height = height; + this.Color = color; + + Game.OnUpdate += this.OnUpdate; + this.SubscribeToResetEvents(); + } + + #endregion + + #region Delegates + + /// + /// The position update delegate. + /// + /// + /// The . + /// + public delegate Vector2 PositionDelegate(); + + #endregion + + #region Public Properties + + /// + /// Gets or sets the color. + /// + public ColorBGRA Color { get; set; } + + /// + /// Gets or sets the height. + /// + public int Height { get; set; } + + /// + /// Gets or sets the position update. + /// + public PositionDelegate PositionUpdate { get; set; } + + /// + /// Gets or sets the width. + /// + public int Width { get; set; } + + /// + /// Gets or sets the X-axis of the position. + /// + public int X { get; set; } + + /// + /// Gets or sets the Y-axis of the position. + /// + public int Y { get; set; } + + #endregion + + #region Properties + + private SharpDX.Direct3D9.Line DeviceLine { get; } + + #endregion + + #region Public Methods and Operators + + /// + public override void OnEndScene() + { + if (this.DeviceLine == null || this.DeviceLine.IsDisposed) + { + return; + } + + try + { + this.DeviceLine.Begin(); + this.DeviceLine.Draw( + new[] + { + new Vector2(this.X, this.Y + (this.Height / 2)), + new Vector2(this.X + this.Width, this.Y + (this.Height / 2)) + }, + this.Color); + this.DeviceLine.End(); + } + catch (Exception e) + { + this.Log.Error("Unable to draw a rectangle.", e); + } + } + + /// + public override void OnPostReset() => this.DeviceLine.OnResetDevice(); + + /// + public override void OnPreReset() => this.DeviceLine.OnLostDevice(); + + #endregion + + #region Methods + + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (!this.DeviceLine.IsDisposed) + { + this.DeviceLine.Dispose(); + } + + Game.OnUpdate -= this.OnUpdate; + } + + private void OnUpdate(EventArgs args) + { + if (this.PositionUpdate != null) + { + var pos = this.PositionUpdate(); + this.X = (int)pos.X; + this.Y = (int)pos.Y; + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Render/Render.cs b/source/Render/Render.cs new file mode 100644 index 00000000..288030e1 --- /dev/null +++ b/source/Render/Render.cs @@ -0,0 +1,178 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + using System.Threading; + + using log4net; + + using PlaySharp.Toolkit.Logging; + + using SharpDX; + using SharpDX.Direct3D9; + + /// + /// The render class. + /// + public static partial class Render + { + #region Static Fields + + private static readonly ILog Logger = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private static readonly List RenderObjects = new List(); + + private static readonly object RenderObjectsLock = new object(); + + private static List renderVisibleObjects = new List(); + + private static bool terminateThread; + + #endregion + + #region Constructors and Destructors + + static Render() + { + Drawing.OnEndScene += OnEndScne; + Drawing.OnDraw += OnDraw; + + var thread = new Thread(PrepareObjects); + thread.SetApartmentState(ApartmentState.STA); + thread.Start(); + } + + #endregion + + #region Public Properties + + /// + /// Gets the device. + /// + public static Device Device => Drawing.Direct3DDevice; + + #endregion + + #region Public Methods and Operators + + /// + /// Adds the render object to be drawn by the rendering system. + /// + /// + /// The render object. + /// + /// + /// The layer. + /// + /// + /// The . + /// + public static RenderObject Add(this RenderObject renderObject, float layer = float.MaxValue) + { + renderObject.Layer = !layer.Equals(float.MaxValue) ? layer : renderObject.Layer; + lock (RenderObjectsLock) + { + RenderObjects.Add(renderObject); + } + + return renderObject; + } + + /// + /// Determines if the point is on the screen. + /// + /// + /// The point. + /// + /// + /// The . + /// + public static bool OnScreen(Vector2 point) + => point.X > 0 && point.Y > 0 && point.X < Drawing.Width && point.Y < Drawing.Height; + + /// + /// Removes the render object from the engine. + /// + /// + /// The render object. + /// + public static void Remove(this RenderObject renderObject) + { + lock (RenderObjectsLock) + { + RenderObjects.Remove(renderObject); + } + } + + /// + /// Terminates the preparations thread. + /// + public static void Terminate() => terminateThread = true; + + #endregion + + #region Methods + + private static void OnDraw(EventArgs args) + { + if (Device == null || Device.IsDisposed) + { + return; + } + + foreach (var renderObject in renderVisibleObjects) + { + renderObject.OnDraw(); + } + } + + private static void OnEndScne(EventArgs args) + { + if (Device == null || Device.IsDisposed) + { + return; + } + + Device.SetRenderState(RenderState.AlphaBlendEnable, true); + + foreach (var renderObject in renderVisibleObjects) + { + renderObject.OnEndScene(); + } + } + + private static void PrepareObjects() + { + while (!terminateThread) + { + try + { + Thread.Sleep(1); + lock (RenderObjectsLock) + { + renderVisibleObjects = + RenderObjects.Where(o => o != null && o.Visible && o.HasValidLayer()) + .OrderBy(o => o.Layer) + .ToList(); + } + } + catch (ThreadAbortException) + { + // ignored + } + catch (Exception e) + { + Logger.Error("Render Thread faulted", e); + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Render/RenderObject.cs b/source/Render/RenderObject.cs new file mode 100644 index 00000000..4a123585 --- /dev/null +++ b/source/Render/RenderObject.cs @@ -0,0 +1,205 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Reflection; + + using log4net; + + using PlaySharp.Toolkit.Logging; + + using IDisposable = PlaySharp.Toolkit.AppDomain.IDisposable; + + /// + /// The render class. + /// + public static partial class Render + { + /// + /// The render object. + /// + public class RenderObject : IDisposable + { + #region Fields + + private bool visible = true; + + #endregion + + #region Constructors and Destructors + + /// + /// Finalizes an instance of the class. + /// + ~RenderObject() + { + this.Dispose(false); + } + + #endregion + + #region Delegates + + /// + /// The visible condition delegate. + /// + /// + /// The sender. + /// + /// + /// The . + /// + public delegate bool VisibleConditionDelegate(RenderObject sender); + + #endregion + + #region Public Properties + + /// + /// Gets a value indicating whether the render object was dispoed. + /// + public bool IsDisposed { get; private set; } + + /// + /// Gets or sets the layer. + /// + public float Layer { get; set; } = 0.0f; + + /// + /// Gets or sets a value indicating whether the render object is visible. + /// + public bool Visible + { + get + { + return this.VisibleCondition?.Invoke(this) ?? this.visible; + } + + set + { + this.visible = value; + } + } + + /// + /// Gets or sets the visible condition. + /// + public VisibleConditionDelegate VisibleCondition { get; set; } + + #endregion + + #region Properties + + /// + /// Gets the log. + /// + protected ILog Log { get; } = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #endregion + + #region Public Methods and Operators + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + this.OnPreReset(); + this.Dispose(true); + } + + /// + /// Determines if the render object has a valid layer. + /// + /// + /// The . + /// + public bool HasValidLayer() + { + return this.Layer >= -5 && this.Layer <= 5; + } + + /// + /// The draw event callback. + /// + public virtual void OnDraw() + { + } + + /// + /// The endscene event callback. + /// + public virtual void OnEndScene() + { + } + + /// + /// The post-reset event callback. + /// + public virtual void OnPostReset() + { + } + + /// + /// The pre-reset event callback. + /// + public virtual void OnPreReset() + { + } + + #endregion + + #region Methods + + /// + /// Subscribers to D3D9 reset event. + /// + internal void SubscribeToResetEvents() + { + Drawing.OnPreReset += this.DrawingOnOnPreReset; + Drawing.OnPostReset += this.DrawingOnOnPostReset; + AppDomain.CurrentDomain.DomainUnload += this.CurrentDomainOnDomainUnload; + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + /// + /// A value indicating whether the call is disposing managed resources. + /// + protected virtual void Dispose(bool disposing) + { + if (this.IsDisposed) + { + return; + } + + Drawing.OnPreReset -= this.DrawingOnOnPreReset; + Drawing.OnPostReset -= this.DrawingOnOnPostReset; + AppDomain.CurrentDomain.DomainUnload -= this.CurrentDomainOnDomainUnload; + + this.IsDisposed = true; + } + + private void CurrentDomainOnDomainUnload(object sender, EventArgs eventArgs) + { + this.OnPostReset(); + } + + private void DrawingOnOnPostReset(EventArgs args) + { + this.OnPostReset(); + } + + private void DrawingOnOnPreReset(EventArgs args) + { + this.OnPreReset(); + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Render/Sprite.cs b/source/Render/Sprite.cs new file mode 100644 index 00000000..02f759d8 --- /dev/null +++ b/source/Render/Sprite.cs @@ -0,0 +1,514 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Drawing; + using System.Drawing.Imaging; + using System.IO; + + using SharpDX; + using SharpDX.Direct3D9; + + /// + /// The render class. + /// + public static partial class Render + { + /// + /// Draws a sprite. + /// + public class Sprite : RenderObject + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The bitmap. + /// + /// + /// The position. + /// + public Sprite(Bitmap bitmap, Vector2 position) + : this() + { + this.UpdateTextureBitmap(bitmap, position); + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The texture. + /// + /// + /// The position. + /// + public Sprite(BaseTexture texture, Vector2 position) + : this((Bitmap)Image.FromStream(BaseTexture.ToStream(texture, ImageFileFormat.Bmp)), position) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The stream. + /// + /// + /// The position. + /// + public Sprite(Stream stream, Vector2 position) + : this(new Bitmap(stream), position) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The bytes array. + /// + /// + /// The position. + /// + public Sprite(byte[] bytesArray, Vector2 position) + : this((Bitmap)Image.FromStream(new MemoryStream(bytesArray)), position) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The file location. + /// + /// + /// The position. + /// + public Sprite(string fileLocation, Vector2 position) + : this() + { + if (!File.Exists(fileLocation)) + { + return; + } + + this.UpdateTextureBitmap(new Bitmap(fileLocation), position); + } + + private Sprite() + { + Game.OnUpdate += this.OnUpdate; + this.SubscribeToResetEvents(); + } + + #endregion + + #region Delegates + + /// + /// The reset delegate. + /// + /// + /// The sprite. + /// + public delegate void OnResetting(Sprite sprite); + + /// + /// The position delegate. + /// + /// + /// The . + /// + public delegate Vector2 PositionDelegate(); + + #endregion + + #region Public Events + + /// + /// The reset event. + /// + public event OnResetting OnReset; + + #endregion + + #region Public Properties + + /// + /// Gets or sets the bitmap. + /// + public Bitmap Bitmap { get; set; } + + /// + /// Gets or sets the color. + /// + public ColorBGRA Color { get; set; } = SharpDX.Color.White; + + /// + /// Gets the height. + /// + public int Height => (int)(this.Bitmap.Height * this.Scale.Y); + + /// + /// Gets or sets a value indicating whether the sprite is visible. + /// + public bool IsVisible { get; set; } = true; + + /// + /// Gets or sets the position. + /// + public Vector2 Position + { + get + { + return new Vector2(this.X, this.Y); + } + + set + { + this.X = (int)value.X; + this.Y = (int)value.Y; + } + } + + /// + /// Gets or sets the position update. + /// + public PositionDelegate PositionUpdate { get; set; } + + /// + /// Gets or sets the rotation. + /// + public float Rotation { get; set; } + + /// + /// Gets or sets the scale. + /// + public Vector2 Scale { get; set; } = Vector2.One; + + /// + /// Gets the size. + /// + public Vector2 Size => new Vector2(this.Bitmap.Width, this.Bitmap.Height); + + /// + /// Gets or sets the sprite crop. + /// + public SharpDX.Rectangle? SpriteCrop { get; set; } + + /// + /// Gets or sets the texture. + /// + public Texture Texture { get; set; } + + /// + /// Gets the width. + /// + public int Width => (int)(this.Bitmap.Width * this.Scale.X); + + /// + /// Gets or sets the X-Axis of the position. + /// + public int X { get; set; } + + /// + /// Gets or sets the Y-Axis of the position. + /// + public int Y { get; set; } + + #endregion + + #region Properties + + private SharpDX.Direct3D9.Sprite DeviceSprite { get; } = new SharpDX.Direct3D9.Sprite(Device); + + private Texture OriginalTexture { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Complements the sprite. + /// + public void Complement() => this.SetSaturation(-1.0f); + + /// + /// Crops the sprite. + /// + /// + /// The X-axis of the position. + /// + /// + /// The Y-axis of the position. + /// + /// + /// The width. + /// + /// + /// The height. + /// + /// + /// The scale. + /// + public void Crop(int x, int y, int w, int h, bool scale = false) + => this.Crop(new SharpDX.Rectangle(x, y, w, h), scale); + + /// + /// Crops the sprite. + /// + /// + /// The rectangle. + /// + /// + /// The scale. + /// + public void Crop(SharpDX.Rectangle rect, bool scale = false) + { + this.SpriteCrop = rect; + + if (scale) + { + this.SpriteCrop = new SharpDX.Rectangle( + (int)(this.Scale.X * rect.X), + (int)(this.Scale.Y * rect.Y), + (int)(this.Scale.X * rect.Width), + (int)(this.Scale.Y * rect.Height)); + } + } + + /// + /// Fades the sprite. + /// + public void Fade() => this.SetSaturation(.5f); + + /// + /// Grey scales the sprite. + /// + public void GreyScale() => this.SetSaturation(.0f); + + /// + /// Hides the sprite. + /// + public void Hide() => this.IsVisible = false; + + /// + public override void OnEndScene() + { + if (this.DeviceSprite.IsDisposed || this.Texture.IsDisposed || this.Position.IsZero || !this.IsVisible) + { + return; + } + + try + { + this.DeviceSprite.Begin(); + + var matrix = this.DeviceSprite.Transform; + var nMatrix = Matrix.Scaling(this.Scale.X, this.Scale.Y, 0) * Matrix.RotationZ(this.Rotation) + * Matrix.Translation(this.Position.X, this.Position.Y, 0); + var rotation = Math.Abs(this.Rotation) > float.Epsilon + ? new Vector3(this.Width / 2f, this.Height / 2f, 0) + : (Vector3?)null; + + this.DeviceSprite.Transform = nMatrix; + this.DeviceSprite.Draw(this.Texture, this.Color, this.SpriteCrop, rotation); + this.DeviceSprite.Transform = matrix; + + this.DeviceSprite.End(); + } + catch (Exception e) + { + this.Reset(); + this.Log.Error("Unable to draw sprite.", e); + } + } + + /// + public override void OnPostReset() + { + try + { + this.DeviceSprite?.OnResetDevice(); + } + catch (Exception) + { + // ignored + } + } + + /// + public override void OnPreReset() + { + try + { + this.DeviceSprite?.OnLostDevice(); + } + catch (Exception) + { + // ignored + } + } + + /// + /// Resets the sprite. + /// + public void Reset() + { + this.UpdateTextureBitmap( + (Bitmap)Image.FromStream(BaseTexture.ToStream(this.OriginalTexture, ImageFileFormat.Bmp))); + + this.OnReset?.Invoke(this); + } + + /// + /// Sets the sprite saturation. + /// + /// + /// The saturation level. + /// + public void SetSaturation(float saturation) + => this.UpdateTextureBitmap(SaturateBitmap(this.Bitmap, saturation)); + + /// + /// Shows the sprite. + /// + public void Show() => this.IsVisible = true; + + /// + /// Updates the texture. + /// + /// + /// The bitmap. + /// + /// + /// The position. + /// + public void UpdateTextureBitmap(Bitmap bitmap, Vector2 position = default(Vector2)) + { + if (!position.IsZero) + { + this.Position = position; + } + + this.Bitmap?.Dispose(); + this.Bitmap = bitmap; + + this.Texture = Texture.FromMemory( + Device, + (byte[])new ImageConverter().ConvertTo(bitmap, typeof(byte[])), + this.Width, + this.Height, + 0, + Usage.None, + Format.A1, + Pool.Managed, + Filter.Default, + Filter.Default, + 0); + if (this.OriginalTexture == null) + { + this.OriginalTexture = this.Texture; + } + } + + #endregion + + #region Methods + + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (!this.DeviceSprite.IsDisposed) + { + this.DeviceSprite.Dispose(); + } + + if (!this.Texture.IsDisposed) + { + this.Texture.Dispose(); + } + + if (!this.OriginalTexture.IsDisposed) + { + this.OriginalTexture.Dispose(); + } + + this.Bitmap = null; + } + + private static Bitmap SaturateBitmap(Image original, float saturation) + { + const float RWeight = 0.3086f; + const float GWeight = 0.6094f; + const float BWeight = 0.0820f; + + var a = ((1.0f - saturation) * RWeight) + saturation; + var b = (1.0f - saturation) * RWeight; + var c = (1.0f - saturation) * RWeight; + var d = (1.0f - saturation) * GWeight; + var e = ((1.0f - saturation) * GWeight) + saturation; + var f = (1.0f - saturation) * GWeight; + var g = (1.0f - saturation) * BWeight; + var h = (1.0f - saturation) * BWeight; + var i = ((1.0f - saturation) * BWeight) + saturation; + + var newBitmap = new Bitmap(original.Width, original.Height); + var gr = Graphics.FromImage(newBitmap); + + // ColorMatrix elements + float[][] ptsArray = + { + new[] { a, b, c, 0, 0 }, new[] { d, e, f, 0, 0 }, new[] { g, h, i, 0, 0 }, + new float[] { 0, 0, 0, 1, 0 }, new float[] { 0, 0, 0, 0, 1 } + }; + + // Create ColorMatrix + var clrMatrix = new ColorMatrix(ptsArray); + + // Create ImageAttributes + var imgAttribs = new ImageAttributes(); + + // Set color matrix + imgAttribs.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default); + + // Draw Image with no effects + gr.DrawImage(original, 0, 0, original.Width, original.Height); + + // Draw Image with image attributes + gr.DrawImage( + original, + new System.Drawing.Rectangle(0, 0, original.Width, original.Height), + 0, + 0, + original.Width, + original.Height, + GraphicsUnit.Pixel, + imgAttribs); + gr.Dispose(); + + return newBitmap; + } + + private void OnUpdate(EventArgs args) + { + if (this.PositionUpdate != null) + { + var pos = this.PositionUpdate(); + this.X = (int)pos.X; + this.Y = (int)pos.Y; + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Render/Text.cs b/source/Render/Text.cs new file mode 100644 index 00000000..2c1c4c48 --- /dev/null +++ b/source/Render/Text.cs @@ -0,0 +1,464 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Diagnostics.CodeAnalysis; + + using SharpDX; + using SharpDX.Direct3D9; + + /// + /// The render class. + /// + public static partial class Render + { + /// + /// Text Render Object, used to draw text onto the screen. + /// + public class Text : RenderObject + { + #region Fields + + private string content; + + private int x; + + private int xCalcualted; + + private int y; + + private int yCalculated; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The text. + /// + /// + /// The X-axis. + /// + /// + /// The Y-axis. + /// + /// + /// The size. + /// + /// + /// The color. + /// + /// + /// The font name. + /// + public Text(string text, int x, int y, int size, ColorBGRA color, string fontName = "Calibri") + : this(text, fontName, size, color) + { + this.x = x; + this.y = y; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The text. + /// + /// + /// The position. + /// + /// + /// The size. + /// + /// + /// The color. + /// + /// + /// The font name. + /// + public Text(string text, Vector2 position, int size, ColorBGRA color, string fontName = "Calibri") + : this(text, fontName, size, color) + { + this.x = (int)position.X; + this.y = (int)position.Y; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The text. + /// + /// + /// The unit. + /// + /// + /// The offset. + /// + /// + /// The size. + /// + /// + /// The color. + /// + /// + /// The font name. + /// + public Text( + string text, + Obj_AI_Base unit, + Vector2 offset, + int size, + ColorBGRA color, + string fontName = "Calibri") + : this(text, fontName, size, color) + { + this.Unit = unit; + this.Offset = offset; + + var pos = unit.HPBarPosition + offset; + this.x = (int)pos.X; + this.y = (int)pos.Y; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The X-axis. + /// + /// + /// The Y-axis. + /// + /// + /// The text. + /// + /// + /// The size. + /// + /// + /// The color. + /// + /// + /// The font name. + /// + public Text(int x, int y, string text, int size, ColorBGRA color, string fontName = "Calibri") + : this(text, fontName, size, color) + { + this.x = x; + this.y = y; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The position. + /// + /// + /// The text. + /// + /// + /// The size. + /// + /// + /// The color. + /// + /// + /// The font name. + /// + public Text(Vector2 position, string text, int size, ColorBGRA color, string fontName = "Calibri") + : this(text, fontName, size, color) + { + this.x = (int)position.X; + this.y = (int)position.Y; + } + + private Text(string text, string fontName, int size, ColorBGRA color) + { + const FontPrecision OpDefault = FontPrecision.Default; + const FontQuality QDefault = FontQuality.Default; + + var fontDesc = new FontDescription + { + FaceName = fontName, Height = size, OutputPrecision = OpDefault, + Quality = QDefault + }; + this.Font = new Font(Device, fontDesc); + this.Color = color; + this.Content = text; + + Game.OnUpdate += this.OnUpdate; + this.SubscribeToResetEvents(); + } + + #endregion + + #region Delegates + + /// + /// The position delegate. + /// + /// + /// The . + /// + public delegate Vector2 PositionDelegate(); + + /// + /// The text delegate. + /// + /// + /// The . + /// + public delegate string TextDelegate(); + + #endregion + + #region Public Properties + + /// + /// Gets or sets a value indicating whether the text is centered. + /// + public bool Centered { get; set; } + + /// + /// Gets or sets the color. + /// + public ColorBGRA Color { get; set; } + + /// + /// Gets or sets the content. + /// + public string Content + { + get + { + return this.content; + } + + set + { + if (value != this.content && (!this.Font?.IsDisposed ?? false) && !string.IsNullOrEmpty(value)) + { + var size = this.Font?.MeasureText(null, value, 0) ?? default(SharpDX.Rectangle); + this.Width = size.Width; + this.Height = size.Height; + this.Font?.PreloadText(value); + } + + this.content = value; + } + } + + /// + /// Gets the height. + /// + public int Height { get; private set; } + + /// + /// Gets or sets the offset. + /// + public Vector2 Offset { get; set; } + + /// + /// Gets or sets a value indicating whether the text is outlined. + /// + public bool OutLined { get; set; } + + /// + /// Gets or sets the position update. + /// + public PositionDelegate PositionUpdate { get; set; } + + /// + /// Gets or sets the text. + /// + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Old API Compability.")] + [Obsolete("Use Content property.")] +#pragma warning disable SA1300 // Element must begin with upper-case letter + public string text +#pragma warning restore SA1300 // Element must begin with upper-case letter + { + get + { + return this.Content; + } + + set + { + this.Content = value; + } + } + + /// + /// Gets or sets the text font description. + /// + public FontDescription TextFontDescription + { + get + { + return this.Font.Description; + } + + set + { + this.Font.Dispose(); + this.Font = new Font(Device, value); + } + } + + /// + /// Gets or sets the text update. + /// + public TextDelegate TextUpdate { get; set; } + + /// + /// Gets or sets the unit. + /// + public Obj_AI_Base Unit { get; set; } + + /// + /// Gets the width. + /// + public int Width { get; private set; } + + /// + /// Gets or sets the X-Axis of the postiion. + /// + public int X + { + get + { + return this.PositionUpdate != null ? this.xCalcualted : this.x + this.XOffset; + } + + set + { + this.x = value; + } + } + + /// + /// Gets or sets the Y-Axis of the position. + /// + public int Y + { + get + { + return this.PositionUpdate != null ? this.yCalculated : this.y + this.YOffset; + } + + set + { + this.y = value; + } + } + + #endregion + + #region Properties + + private Font Font { get; set; } + + private int XOffset => this.Centered ? -this.Width / 2 : 0; + + private int YOffset => this.Centered ? -this.Height / 2 : 0; + + #endregion + + #region Public Methods and Operators + + /// + public override void OnEndScene() + { + try + { + if ((this.Font == null || this.Font.IsDisposed) || string.IsNullOrEmpty(this.content)) + { + return; + } + + if (this.Unit != null && this.Unit.IsValid) + { + var pos = this.Unit.HPBarPosition + this.Offset; + this.X = (int)pos.X; + this.Y = (int)pos.Y; + } + + var xP = this.X; + var yP = this.Y; + + if (this.OutLined) + { + var outlineColor = new ColorBGRA(0, 0, 0, 255); + this.Font?.DrawText(null, this.Content, xP - 1, yP - 1, outlineColor); + this.Font?.DrawText(null, this.Content, xP + 1, yP + 1, outlineColor); + this.Font?.DrawText(null, this.Content, xP - 1, yP, outlineColor); + this.Font?.DrawText(null, this.Content, xP + 1, yP, outlineColor); + } + + this.Font?.DrawText(null, this.Content, xP, yP, this.Color); + } + catch (Exception e) + { + this.Log.Error("Render Text Error.", e); + } + } + + /// + public override void OnPostReset() + { + this.Font.OnResetDevice(); + } + + /// + public override void OnPreReset() + { + this.Font.OnLostDevice(); + } + + #endregion + + #region Methods + + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (disposing) + { + this.Font?.Dispose(); + } + + Game.OnUpdate -= this.OnUpdate; + } + + private void OnUpdate(EventArgs args) + { + if (this.Visible) + { + if (this.TextUpdate != null) + { + this.Content = this.TextUpdate(); + } + + if (this.PositionUpdate != null && !string.IsNullOrEmpty(this.Content)) + { + var pos = this.PositionUpdate(); + this.xCalcualted = (int)pos.X + this.XOffset; + this.yCalculated = (int)pos.Y + this.YOffset; + } + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/Properties/Resources.resx b/source/Resources/ChineseJson.json similarity index 99% rename from Properties/Resources.resx rename to source/Resources/ChineseJson.json index db189b79..67c038ca 100644 --- a/Properties/Resources.resx +++ b/source/Resources/ChineseJson.json @@ -1,124 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - { +{ "\u003c": "\u003c", "yasuo": "\u72bd\u5bbf", "velkoz": "\u5a01\u5bc7\u8332", @@ -15548,16 +15428,4 @@ "settings:": "\u8a2d\u5b9a", "settings: ": "\u8a2d\u5b9a", "mute all": "\u5168\u90e8\u975c\u97f3" -} - - - - ..\Resources\SliderActive.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\CPForm.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\SliderDisabled.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - +} \ No newline at end of file diff --git a/source/Resources/CircleEffect.fx b/source/Resources/CircleEffect.fx new file mode 100644 index 00000000..9ef8b0e5 --- /dev/null +++ b/source/Resources/CircleEffect.fx @@ -0,0 +1,53 @@ +struct VS_S { + float4 Position: POSITION; + float4 Color: COLOR0; + float4 Position3D: TEXCOORD0; +}; + +float4x4 ProjectionMatrix; +float4 CircleColor; +float Radius; +float Border; +bool zEnabled; + +VS_S VS(VS_S input) { + VS_S output = (VS_S) 0; + + output.Position = mul(input.Position, ProjectionMatrix); + output.Color = input.Color; + output.Position3D = input.Position; + return output; +} + +float4 PS(VS_S input): COLOR { + VS_S output = (VS_S) 0; + output = input; + float4 v = output.Position3D; + float distance = Radius - sqrt(v.x * v.x + v.z * v.z); // Distance to the circle arc. + + output.Color.x = CircleColor.x; + output.Color.y = CircleColor.y; + output.Color.z = CircleColor.z; + + if (distance < Border && distance > -Border) { + output.Color.w = (CircleColor.w - CircleColor.w * abs(distance * 1.75 / Border)); + } else { + output.Color.w = 0; + } + + if (Border < 1 && distance >= 0) { + output.Color.w = CircleColor.w; + } + return output.Color; +} + +technique Main { + pass P0 { + ZEnable = zEnabled; + AlphaBlendEnable = TRUE; + DestBlend = INVSRCALPHA; + SrcBlend = SRCALPHA; + VertexShader = compile vs_2_0 VS(); + PixelShader = compile ps_2_0 PS(); + } +} \ No newline at end of file diff --git a/source/Resources/spectrum_chart.jpg b/source/Resources/spectrum_chart.jpg new file mode 100644 index 00000000..b2fdae24 Binary files /dev/null and b/source/Resources/spectrum_chart.jpg differ diff --git a/source/Utility/DelayAction.cs b/source/Utility/DelayAction.cs new file mode 100644 index 00000000..4b4cb3a4 --- /dev/null +++ b/source/Utility/DelayAction.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + + /// + /// The utility class. + /// + public partial class Utility + { + /// + /// The delay action class. + /// + public static class DelayAction + { + #region Constructors and Destructors + + /// + /// Initializes static members of the class. + /// + static DelayAction() + { + Game.OnUpdate += GameOnOnGameUpdate; + } + + #endregion + + #region Delegates + + /// + /// The callback. + /// + public delegate void Callback(); + + #endregion + + #region Public Properties + + /// + /// Gets the action list. + /// + public static List ActionList { get; } = new List(); + + #endregion + + #region Public Methods and Operators + + /// + /// Adds a delay action. + /// + /// + /// The time. + /// + /// + /// The function. + /// + public static void Add(int time, Callback func) + { + var action = new Action(time, func); + ActionList.Add(action); + } + + #endregion + + #region Methods + + private static void GameOnOnGameUpdate(EventArgs args) + { + for (var i = ActionList.Count - 1; i >= 0; i--) + { + if (ActionList[i].Time > Utils.GameTimeTickCount) + { + continue; + } + + try + { + // Will somehow result in calling ALL non-internal marked classes of the called assembly and causes NullReferenceExceptions. + ActionList[i].CallbackObject?.Invoke(); + } + catch (Exception) + { + // ignored + } + + ActionList.RemoveAt(i); + } + } + + #endregion + + /// + /// The action. + /// + public struct Action + { + #region Fields + + /// + /// The callback object. + /// + public Callback CallbackObject; + + /// + /// The time to be executed at. + /// + public int Time; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the struct. + /// + /// + /// The time to be executed at. + /// + /// + /// The callback. + /// + public Action(int time, Callback callback) + { + this.Time = time + Utils.GameTimeTickCount; + this.CallbackObject = callback; + } + + #endregion + } + } + } +} \ No newline at end of file diff --git a/source/Utility/HpBarDamageIndicator.cs b/source/Utility/HpBarDamageIndicator.cs new file mode 100644 index 00000000..051bc38d --- /dev/null +++ b/source/Utility/HpBarDamageIndicator.cs @@ -0,0 +1,142 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + + using SharpDX; + + using Color = System.Drawing.Color; + + /// + /// The utility class. + /// + public partial class Utility + { + /// + /// The HP Bar damage indicator. + /// + public static class HpBarDamageIndicator + { + #region Constants + + private const int Height = 8; + + private const int Width = 103; + + private const int XOffset = 10; + + private const int YOffset = 20; + + #endregion + + #region Static Fields + + private static readonly Render.Text Text = new Render.Text( + 0, + 0, + string.Empty, + 11, + new ColorBGRA(255, 0, 0, 255), + "monospace"); + + private static DamageToUnitDelegate damageToUnitBackingField; + + #endregion + + #region Delegates + + /// + /// The damage to unit delegate. + /// + /// + /// The hero. + /// + /// + /// The . + /// + public delegate float DamageToUnitDelegate(Obj_AI_Hero hero); + + #endregion + + #region Public Properties + + /// + /// Gets or sets the color. + /// + public static Color Color { get; set; } = Color.Lime; + + /// + /// Gets or sets the damage to unit delegate. + /// + public static DamageToUnitDelegate DamageToUnit + { + get + { + return damageToUnitBackingField; + } + + set + { + if (damageToUnitBackingField == null) + { + Drawing.OnDraw += Drawing_OnDraw; + } + + damageToUnitBackingField = value; + } + } + + /// + /// Gets or sets a value indicating whether the indicator is enabled. + /// + public static bool Enabled { get; set; } = true; + + #endregion + + #region Methods + + private static void Drawing_OnDraw(EventArgs args) + { + if (!Enabled || damageToUnitBackingField == null) + { + return; + } + + var width = Drawing.Width; + var height = Drawing.Height; + + foreach (var unit in + HeroManager.Enemies.FindAll(h => h.IsValid && h.IsHPBarRendered)) + { + var barPos = unit.HPBarPosition; + + if (barPos.X < -200 || barPos.X > width + 200) + { + continue; + } + + if (barPos.Y < -200 || barPos.X > height + 200) + { + continue; + } + + var damage = damageToUnitBackingField(unit); + var percentHealthAfterDamage = Math.Max(0, unit.Health - damage) / unit.MaxHealth; + var xPos = barPos.X + XOffset + (Width * percentHealthAfterDamage); + + Text.X = (int)barPos.X + XOffset; + Text.Y = (int)barPos.Y + YOffset - 13; + Text.Content = ((int)(unit.Health - damage)).ToString(); + Text.OnEndScene(); + + Drawing.DrawLine(xPos, barPos.Y + YOffset, xPos, barPos.Y + YOffset + Height, 2, Color); + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Utility/Map.cs b/source/Utility/Map.cs new file mode 100644 index 00000000..f0245c43 --- /dev/null +++ b/source/Utility/Map.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// The utility class. + /// + public partial class Utility + { + /// + /// The Map. + /// + public partial class Map + { + #region Public Properties + + /// + /// Gets or sets the map enumerable lazies. + /// + [ImportMany] + public IEnumerable> MapLazies { get; set; } + + #endregion + + #region Properties + + private IMap CurrentMap { get; set; } + + #endregion + + #region Public Methods and Operators + + /// + /// Gets the current map. + /// + /// + /// The . + /// + public IMap GetCurrentMap() + { + if (this.CurrentMap != null) + { + return this.CurrentMap; + } + + var map = this.MapLazies.FirstOrDefault(f => f.Metadata.MapId == (int)Game.MapId); + if (map != null) + { + return this.CurrentMap = map.Value; + } + + return this.CurrentMap = new MapUnknown(); + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Utility/MapAdapter.cs b/source/Utility/MapAdapter.cs new file mode 100644 index 00000000..43d2956e --- /dev/null +++ b/source/Utility/MapAdapter.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// The utility class. + /// + public partial class Utility + { + /// + /// The Map. + /// + [Export(typeof(Map))] + public partial class Map + { + #region Enums + + /// + /// The map type. + /// + public enum MapType + { + /// + /// The unknown type. + /// + Unknown, + + /// + /// Summoner's rift. + /// + SummonersRift, + + /// + /// Crystal Scar. + /// + CrystalScar, + + /// + /// Twisted Treeline. + /// + TwistedTreeline, + + /// + /// Howling Abyss. + /// + HowlingAbyss + } + + #endregion + + #region Public Methods and Operators + + /// + /// Gets the current map. + /// + /// + /// The . + /// + public static IMap GetMap() => Instances.Map?.GetCurrentMap(); + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Utility/Maps/IMap.cs b/source/Utility/Maps/IMap.cs new file mode 100644 index 00000000..1bcf6645 --- /dev/null +++ b/source/Utility/Maps/IMap.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// The map interface. + /// + public interface IMap + { + #region Public Properties + + /// + /// Gets the grid. + /// + Vector2 Grid { get; } + + /// + /// Gets the name. + /// + string Name { get; } + + /// + /// Gets the short name. + /// + string ShortName { get; } + + /// + /// Gets the starting level. + /// + int StartingLevel { get; } + + /// + /// Gets the type. + /// + Utility.Map.MapType Type { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Maps/IMapMetadata.cs b/source/Utility/Maps/IMapMetadata.cs new file mode 100644 index 00000000..fabc5eba --- /dev/null +++ b/source/Utility/Maps/IMapMetadata.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The map metadata interface. + /// + public interface IMapMetadata + { + #region Public Properties + + /// + /// Gets the map id. + /// + int MapId { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Maps/MapCrystalScar.cs b/source/Utility/Maps/MapCrystalScar.cs new file mode 100644 index 00000000..00387112 --- /dev/null +++ b/source/Utility/Maps/MapCrystalScar.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + using SharpDX; + + /// + /// The crystal scar map. + /// + [Export(typeof(IMap))] + [ExportMetadata("MapId", 8)] + public class MapCrystalScar : IMap + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MapCrystalScar() + { + this.Name = "The Crystal Scar"; + this.ShortName = "crystalscar"; + this.Type = Utility.Map.MapType.CrystalScar; + this.Grid = new Vector2(13894f / 2, 13218f / 2); + this.StartingLevel = 3; + } + + #endregion + + #region Public Properties + + /// + public Vector2 Grid { get; } + + /// + public string Name { get; } + + /// + public string ShortName { get; } + + /// + public int StartingLevel { get; } + + /// + public Utility.Map.MapType Type { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Maps/MapHowlingAbyss.cs b/source/Utility/Maps/MapHowlingAbyss.cs new file mode 100644 index 00000000..b676aae9 --- /dev/null +++ b/source/Utility/Maps/MapHowlingAbyss.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + using SharpDX; + + /// + /// The howling abyss map. + /// + [Export(typeof(IMap))] + [ExportMetadata("MapId", 12)] + public class MapHowlingAbyss : IMap + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MapHowlingAbyss() + { + this.Name = "Howling Abyss"; + this.ShortName = "howlingAbyss"; + this.Type = Utility.Map.MapType.HowlingAbyss; + this.Grid = new Vector2(13120f / 2, 12618f / 2); + this.StartingLevel = 3; + } + + #endregion + + #region Public Properties + + /// + public Vector2 Grid { get; } + + /// + public string Name { get; } + + /// + public string ShortName { get; } + + /// + public int StartingLevel { get; } + + /// + public Utility.Map.MapType Type { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Maps/MapSummonersRift.cs b/source/Utility/Maps/MapSummonersRift.cs new file mode 100644 index 00000000..a76cdffe --- /dev/null +++ b/source/Utility/Maps/MapSummonersRift.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + using SharpDX; + + /// + /// The summoners rift map. + /// + [Export(typeof(IMap))] + [ExportMetadata("MapId", 11)] + public class MapSummonersRift : IMap + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MapSummonersRift() + { + this.Name = "Summoner's Rift"; + this.ShortName = "summonerRift"; + this.Type = Utility.Map.MapType.SummonersRift; + this.Grid = new Vector2(13982f / 2, 14446f / 2); + this.StartingLevel = 1; + } + + #endregion + + #region Public Properties + + /// + public Vector2 Grid { get; } + + /// + public string Name { get; } + + /// + public string ShortName { get; } + + /// + public int StartingLevel { get; } + + /// + public Utility.Map.MapType Type { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Maps/MapTwistedTreeline.cs b/source/Utility/Maps/MapTwistedTreeline.cs new file mode 100644 index 00000000..c797e288 --- /dev/null +++ b/source/Utility/Maps/MapTwistedTreeline.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + using SharpDX; + + /// + /// The twisted treeline map. + /// + [Export(typeof(IMap))] + [ExportMetadata("MapId", 10)] + public class MapTwistedTreeline : IMap + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MapTwistedTreeline() + { + this.Name = "The Twisted Treeline"; + this.ShortName = "twistedTreeline"; + this.Type = Utility.Map.MapType.TwistedTreeline; + this.Grid = new Vector2(15436f / 2, 14474f / 2); + this.StartingLevel = 1; + } + + #endregion + + #region Public Properties + + /// + public Vector2 Grid { get; } + + /// + public string Name { get; } + + /// + public string ShortName { get; } + + /// + public int StartingLevel { get; } + + /// + public Utility.Map.MapType Type { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Maps/MapUnknown.cs b/source/Utility/Maps/MapUnknown.cs new file mode 100644 index 00000000..cbe2c4b7 --- /dev/null +++ b/source/Utility/Maps/MapUnknown.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// The unknown map. + /// + public class MapUnknown : IMap + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MapUnknown() + { + this.Name = "Unknown"; + this.ShortName = "unknown"; + this.Type = Utility.Map.MapType.Unknown; + this.Grid = new Vector2(0, 0); + this.StartingLevel = 0; + } + + #endregion + + #region Public Properties + + /// + public Vector2 Grid { get; } + + /// + public string Name { get; } + + /// + public string ShortName { get; } + + /// + public int StartingLevel { get; } + + /// + public Utility.Map.MapType Type { get; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/MiniCache.cs b/source/Utility/MiniCache.cs new file mode 100644 index 00000000..ca38969f --- /dev/null +++ b/source/Utility/MiniCache.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// The utility class. + /// + public partial class Utility + { + /// + /// The mini cache. + /// + public static class MiniCache + { + #region Static Fields + + private static Vector3 allyFountain; + + private static Vector3 enemyFountain; + + #endregion + + #region Public Properties + + /// + /// Gets the ally fountain. + /// + public static Vector3 AllyFountain + { + get + { + if (!allyFountain.IsZero) + { + return allyFountain; + } + + return allyFountain = ObjectManager.Get().Find(o => o.IsAlly).Position; + } + } + + /// + /// Gets the enemy fountain. + /// + public static Vector3 EnemyFountain + { + get + { + if (!enemyFountain.IsZero) + { + return enemyFountain; + } + + return enemyFountain = ObjectManager.Get().Find(o => o.IsEnemy).Position; + } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/source/Utility/Utility.cs b/source/Utility/Utility.cs new file mode 100644 index 00000000..e044e43c --- /dev/null +++ b/source/Utility/Utility.cs @@ -0,0 +1,1221 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using SharpDX; + + using Color = System.Drawing.Color; + + /// + /// The utility class. + /// + public static partial class Utility + { + #region Enums + + /// + /// The fountain type. + /// + public enum FountainType + { + /// + /// Ally Fountain. + /// + OwnFountain, + + /// + /// Enemy Fountain. + /// + EnemyFountain + } + + #endregion + + #region Public Methods and Operators + + /// + /// Gets the unit total magic damage (ablility power). + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static float AbilityPower(this Obj_AI_Base unit) => unit.TotalMagicalDamage; + + /// + /// Counts the allies in range of the player. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static int CountAlliesInRange(float range) => ObjectManager.Player.CountAlliesInRange(range); + + /// + /// Counts the allies in range of the unit. + /// + /// + /// The unit. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static int CountAlliesInRange(this Obj_AI_Base unit, float range) + => unit.ServerPosition.CountAlliesInRange(range, unit); + + /// + /// Counts the allies in range of the point. + /// + /// + /// The point. + /// + /// + /// The range. + /// + /// + /// The original unit. + /// + /// + /// The + /// + public static int CountAlliesInRange(this Vector3 point, float range, Obj_AI_Base originalUnit = null) + => + ObjectManager.Get() + .Count( + o => + (originalUnit == null || o.NetworkId != originalUnit.NetworkId) + && o.IsValidTarget(range, false, point)); + + /// + /// Counts the enemies in range of the player. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static int CountEnemiesInRange(float range) => ObjectManager.Player.CountEnemiesInRange(range); + + /// + /// Counts the enemies in range of the position. + /// + /// + /// The unit. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static int CountEnemiesInRange(this Obj_AI_Base unit, float range) + => unit.ServerPosition.CountEnemiesInRange(range); + + /// + /// Counts the enemies in range of the position. + /// + /// + /// The position. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static int CountEnemiesInRange(this Vector3 position, float range) + => ObjectManager.Get().Count(c => c.IsValidTarget(range, true, position)); + + /// + /// Cuts the path after a certain distance. + /// + /// + /// The path list. + /// + /// + /// The distance to cut after. + /// + /// + /// The . + /// + public static List CutPath(this List path, float distance) + { + var result = new List(); + var d = distance; + if (distance < 0) + { + path[0] = path[0] + (distance * (path[1] - path[0]).Normalized()); + return path; + } + + for (var i = 0; i < path.Count - 1; i++) + { + var dist = path[i].Distance(path[i + 1]); + if (dist > d) + { + result.Add(path[i] + (d * (path[i + 1] - path[i]).Normalized())); + for (var j = i + 1; j < path.Count; j++) + { + result.Add(path[j]); + } + + break; + } + + d -= dist; + } + + return result.Count > 0 ? result : new List { path.Last() }; + } + + /// + /// Draws a circle. + /// + /// + /// The center. + /// + /// + /// The radius. + /// + /// + /// The color. + /// + /// + /// The thickness. + /// + /// + /// The quality. + /// + /// + /// A value indicating whether to draw the circle onto the minimap. + /// + public static void DrawCircle( + Vector3 center, + float radius, + Color color, + int thickness = 5, + int quality = 30, + bool onMinimap = false) + { + if (!onMinimap) + { + Render.Circle.DrawCircle(center, radius, color, thickness); + return; + } + + var pointList = new List(); + for (var i = 0; i < quality; i++) + { + var angle = i * Math.PI * 2 / quality; + pointList.Add( + new Vector3( + center.X + (radius * (float)Math.Cos(angle)), + center.Y + (radius * (float)Math.Sin(angle)), + center.Z)); + } + + for (var i = 0; i < pointList.Count; i++) + { + var a = pointList[i]; + var b = pointList[i == pointList.Count - 1 ? 0 : i + 1]; + + var aonScreen = Drawing.WorldToMinimap(a); + var bonScreen = Drawing.WorldToMinimap(b); + + Drawing.DrawLine(aonScreen.X, aonScreen.Y, bonScreen.X, bonScreen.Y, thickness, color); + } + } + + /// + /// Gets the allies in range of the unit. + /// + /// + /// The unit. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static List GetAlliesInRange(this Obj_AI_Base unit, float range) + => unit.ServerPosition.GetAlliesInRange(range, unit); + + /// + /// Gets the allies in range of the point. + /// + /// + /// The point. + /// + /// + /// The range. + /// + /// + /// The original unit. + /// + /// + /// The . + /// + public static List GetAlliesInRange( + this Vector3 point, + float range, + Obj_AI_Base originalUnit = null) + => + ObjectManager.Get() + .Where( + e => + ((originalUnit == null && ObjectManager.Player.Team == e.Team) + || (originalUnit?.Team == e.Team)) && point.Distance(e.ServerPosition) <= range) + .ToList(); + + /// + /// Gets the enemies in range of the unit. + /// + /// + /// The unit. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static List GetEnemiesInRange(this Obj_AI_Base unit, float range) + => unit.ServerPosition.GetEnemiesInRange(range, unit); + + /// + /// Gets the enemies in range of the point. + /// + /// + /// The point. + /// + /// + /// The range. + /// + /// + /// The original unit. + /// + /// + /// The . + /// + public static List GetEnemiesInRange( + this Vector3 point, + float range, + Obj_AI_Base originalUnit = null) + => + ObjectManager.Get() + .Where( + e => + ((originalUnit == null && ObjectManager.Player.Team != e.Team) + || (originalUnit?.Team != e.Team)) && point.Distance(e.ServerPosition) <= range) + .ToList(); + + /// + /// Gets the objects within the range of the position. + /// + /// + /// The object type. + /// + /// + /// The position. + /// + /// + /// The range. + /// + /// + /// The . + /// + public static List GetObjects(this Vector3 position, float range) + where T : GameObject, new() + => ObjectManager.Get().Where(o => position.Distance(o.Position) < range).ToList(); + + /// + /// Gets the packet id. + /// + /// + /// The game packet event args. + /// + /// + /// The . + /// + public static short GetPacketId(this GamePacketEventArgs gamePacketEventArgs) + { + var packetData = gamePacketEventArgs.PacketData; + return packetData.Length < 2 ? (short)0 : (short)(packetData[0] + (packetData[1] * 256)); + } + + /// + /// Gets the recall time duration. + /// + /// + /// The recall name. + /// + /// + /// The . + /// + public static int GetRecallTime(string recallName) + { + var duration = 0; + + switch (recallName.ToLower()) + { + case "recall": + duration = 8000; + break; + case "recallimproved": + duration = 7000; + break; + case "odinrecall": + duration = 4500; + break; + case "odinrecallimproved": + duration = 4000; + break; + case "superrecall": + duration = 4000; + break; + case "superrecallimproved": + duration = 4000; + break; + } + + return duration; + } + + /// + /// Gets the spell. + /// + /// + /// The hero. + /// + /// + /// The slot. + /// + /// + /// The . + /// + public static SpellDataInst GetSpell(this Obj_AI_Hero hero, SpellSlot slot) => hero.Spellbook.GetSpell(slot); + + /// + /// Calculates the real time spell cooldown. + /// + /// + /// The hero. + /// + /// + /// The spell. + /// + /// + /// The . + /// + public static float GetSpellCooldownEx(this Obj_AI_Hero hero, SpellSlot spell) + { + var expire = hero.Spellbook.GetSpell(spell).CooldownExpires; + var cd = expire - (Game.Time - 1); + + return cd <= 0 ? 0 : cd; + } + + /// + /// Gets the spell slot. + /// + /// + /// The unit. + /// + /// + /// The spell slot name. + /// + /// + /// The . + /// + public static SpellSlot GetSpellSlot(this Obj_AI_Hero unit, string name) + { + foreach (var spell in + unit.Spellbook.Spells.Where(s => s.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))) + { + return spell.Slot; + } + + return SpellSlot.Unknown; + } + + /// + /// Gets the waypoints of the unit. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static List GetWaypoints(this Obj_AI_Base unit) + { + var result = new List(); + + if (unit.IsVisible) + { + result.Add(unit.ServerPosition.To2D()); + var path = unit.Path; + if (path.Length > 0) + { + var first = path[0].To2D(); + if (first.Distance(result[0], true) > 40) + { + result.Add(first); + } + + for (var i = 1; i < path.Length; i++) + { + result.Add(path[i].To2D()); + } + } + } + else if (WaypointTracker.StoredPaths.ContainsKey(unit.NetworkId)) + { + var path = WaypointTracker.StoredPaths[unit.NetworkId]; + var timePassed = (Utils.TickCount - WaypointTracker.StoredTick[unit.NetworkId]) / 1000f; + if (path.PathLength() >= unit.MoveSpeed * timePassed) + { + result = CutPath(path, (int)(unit.MoveSpeed * timePassed)); + } + } + + return result; + } + + /// + /// Gets the waypoints of the unit with time. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static List GetWaypointsWithTime(this Obj_AI_Base unit) + { + var wp = unit.GetWaypoints(); + + if (wp.Count < 1) + { + return null; + } + + var result = new List(); + var speed = unit.MoveSpeed; + var lastPoint = wp[0]; + var time = 0f; + + foreach (var point in wp) + { + time += point.Distance(lastPoint) / speed; + result.Add(new Vector2Time(point, time)); + lastPoint = point; + } + + return result; + } + + /// + /// Determines if the unit has a buff. + /// + /// + /// The unit. + /// + /// + /// The buff name. + /// + /// + /// The bool argument 2, ignored. + /// + /// + /// The bool argument 3, ignored. + /// + /// + /// The . + /// + public static bool HasBuff(this Obj_AI_Base unit, string buffName, bool arg2 = false, bool arg3 = true) + => unit.HasBuff(buffName); + + /// + /// Determines if the buff is valid in advance. + /// + /// + /// The unit. + /// + /// + /// The display name. + /// + /// + /// The tick count. + /// + /// + /// A value indicating whether to include ping. + /// + /// + /// The . + /// + public static bool HasBuffIn( + this Obj_AI_Base unit, + string displayName, + float tickCount, + bool includePing = true) + => + unit.Buffs.Any( + buff => + buff.IsValid && buff.DisplayName == displayName + && buff.EndTime - Game.Time > tickCount - (includePing ? (Game.Ping / 2000f) : 0)); + + /// + /// Gets the health percent of the unit. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static float HealthPercentage(this Obj_AI_Base unit) => unit.HealthPercent; + + /// + /// Determines if the position is in the fountain area. + /// + /// + /// The unit. + /// + /// + /// The fountain type. + /// + /// + /// The . + /// + public static bool InFountain(this Obj_AI_Base unit, FountainType fountainType = FountainType.OwnFountain) + { + float fountainRange = Map.GetMap()?.Type == Map.MapType.SummonersRift ? 1100 : 750; + var pos = fountainType == FountainType.OwnFountain + ? (unit.Team == ObjectManager.Player.Team ? MiniCache.AllyFountain : MiniCache.EnemyFountain) + : (unit.Team == ObjectManager.Player.Team ? MiniCache.EnemyFountain : MiniCache.AllyFountain); + return unit.IsVisible && unit.InRange(pos, fountainRange, true); + } + + /// + /// Determines if the position is in the fountain area. + /// + /// + /// The position. + /// + /// + /// The fountain type. + /// + /// + /// The . + /// + public static bool InFountain(this Vector3 position, FountainType fountainType) + => position.To2D().InFountain(fountainType); + + /// + /// Determines if the position is in the fountain area. + /// + /// + /// The position. + /// + /// + /// The fountain type. + /// + /// + /// The . + /// + public static bool InFountain(this Vector2 position, FountainType fountainType) + => + position.InRange( + fountainType == FountainType.OwnFountain ? MiniCache.AllyFountain : MiniCache.EnemyFountain, + Map.GetMap()?.Type == Map.MapType.SummonersRift ? 1100 : 750, + true); + + /// + /// Determines if the unit is in the shop area. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static bool InShop(this Obj_AI_Base unit) + => + unit.IsVisible + && unit.InRange( + unit.Team == ObjectManager.Player.Team ? MiniCache.AllyFountain : MiniCache.EnemyFountain, + Map.GetMap()?.Type == Map.MapType.SummonersRift ? 1000 : 750, + true); + + /// + /// Determines if the spell is an auto attack. + /// + /// + /// The spell data. + /// + /// + /// The . + /// + public static bool IsAutoAttack(this SpellData spellData) => Orbwalking.IsAutoAttack(spellData.Name); + + /// + /// Determines if the spell is an auto attack. + /// + /// + /// The spell data. + /// + /// + /// The . + /// + public static bool IsAutoAttack(this SpellDataInst spellData) => Orbwalking.IsAutoAttack(spellData.Name); + + /// + /// Determines if both source and target are facing each other. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The . + /// + public static bool IsBothFacing(Obj_AI_Hero source, Obj_AI_Base target) + => source.IsFacing(target) && target.IsFacing(source); + + /// + /// Determines if the spell was casted, by the cast state. + /// + /// + /// The state. + /// + /// + /// The . + /// + public static bool IsCasted(this Spell.CastStates state) => state == Spell.CastStates.SuccessfullyCasted; + + /// + /// Determines if the unit is a champion. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static bool IsChampion(this Obj_AI_Base unit) => IsChampion(unit, null, false); + + /// + /// Determines if the unit is a champion. + /// + /// + /// The unit. + /// + /// + /// The champion name. + /// + /// + /// A value indicating whether the function should name check. + /// + /// + /// The string comparison type. + /// + /// + /// The . + /// + public static bool IsChampion( + this Obj_AI_Base unit, + string championName, + bool nameCheck = true, + StringComparison stringComparison = StringComparison.CurrentCultureIgnoreCase) + { + var hero = unit as Obj_AI_Hero; + return hero != null && hero.IsValid + && (!nameCheck || hero.ChampionName.Equals(championName, stringComparison)); + } + + /// + /// Determines if source is facing the target. + /// + /// + /// The source. + /// + /// + /// The target. + /// + /// + /// The . + /// + public static bool IsFacing(this Obj_AI_Base source, Obj_AI_Base target) + { + if (source == null || target == null) + { + return false; + } + + const float Angle = 90; + return source.Direction.To2D().Perpendicular().AngleBetween((target.Position - source.Position).To2D()) + < Angle; + } + + /// + /// Determines if the hero's movement is imparied. + /// + /// + /// The hero. + /// + /// + /// The . + /// + public static bool IsMovementImpaired(this Obj_AI_Hero hero) + { + return hero.HasBuffOfType(BuffType.Flee) || hero.HasBuffOfType(BuffType.Charm) + || hero.HasBuffOfType(BuffType.Slow) || hero.HasBuffOfType(BuffType.Snare) + || hero.HasBuffOfType(BuffType.Stun) || hero.HasBuffOfType(BuffType.Taunt); + } + + /// + /// Determines if the hero's movement is imparied. + /// + /// + /// The hero. + /// + /// + /// The . + /// + public static bool IsMovementImparied(this Obj_AI_Hero hero) + => + hero.HasBuffOfType(BuffType.Flee) || hero.HasBuffOfType(BuffType.Charm) || hero.HasBuffOfType(BuffType.Slow) + || hero.HasBuffOfType(BuffType.Snare) || hero.HasBuffOfType(BuffType.Stun) + || hero.HasBuffOfType(BuffType.Taunt); + + /// + /// Determines if the position is on the screen. + /// + /// + /// The position. + /// + /// + /// The . + /// + public static bool IsOnScreen(this Vector3 position) + { + var pos = Drawing.WorldToScreen(position); + return pos.X > 0 && pos.X <= Drawing.Width && pos.Y > 0 && pos.Y <= Drawing.Height; + } + + /// + /// Determines if the position is on the screen. + /// + /// + /// The position/ + /// + /// + /// The . + /// + public static bool IsOnScreen(this Vector2 position) => position.To3D().IsOnScreen(); + + /// + /// Determines if the spell is ready. + /// + /// + /// The spell. + /// + /// + /// The time. + /// + /// + /// The . + /// + public static bool IsReady(this SpellDataInst spell, int t = 0) + => + spell?.Slot != SpellSlot.Unknown && t == 0 + ? spell?.State == SpellState.Ready + : spell?.State == SpellState.Ready + || (spell?.State == SpellState.Cooldown && (spell.CooldownExpires - Game.Time) <= t / 1000f); + + /// + /// Determines if the spell is ready. + /// + /// + /// The spell. + /// + /// + /// The time. + /// + /// + /// The . + /// + public static bool IsReady(this Spell spell, int t = 0) => IsReady(spell?.Instance, t); + + /// + /// Determines if the spell is ready. + /// + /// + /// The slot. + /// + /// + /// The time. + /// + /// + /// The . + /// + public static bool IsReady(this SpellSlot slot, int t = 0) + => IsReady(ObjectManager.Player.Spellbook.GetSpell(slot), t); + + /// + /// Determines if the unit is recalling. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static bool IsRecalling(this Obj_AI_Hero unit) + => + unit.Buffs.Any( + buff => + buff.Name.Equals("recall", StringComparison.CurrentCultureIgnoreCase) + && buff.Type == BuffType.Aura); + + /// + /// Determines if the object is valid. + /// + /// + /// The type of the object. + /// + /// + /// The object. + /// + /// + /// The . + /// + public static bool IsValid(this GameObject obj) + where T : GameObject + => (obj?.IsValid ?? false) && obj is T; + + /// + /// Determines if the buff is valid. + /// + /// + /// The buff. + /// + /// + /// The . + /// + public static bool IsValidBuff(this BuffInstance buff) + => buff != null && buff.IsActive && buff.EndTime - Game.Time > 0; + + /// + /// Determines if the SpellSlot of the InventorySlot is valid. + /// + /// + /// The slot. + /// + /// + /// The . + /// + public static bool IsValidSlot(this InventorySlot slot) => slot?.SpellSlot != SpellSlot.Unknown; + + /// + /// Determines if the target is valid. + /// + /// + /// The unit. + /// + /// + /// The range. + /// + /// + /// A value indicating whether to check team (if ally). + /// + /// + /// The from location. + /// + /// + /// The . + /// + public static bool IsValidTarget( + this AttackableUnit unit, + float range = float.MaxValue, + bool checkTeam = true, + Vector3 from = default(Vector3)) + { + if (unit == null || !unit.IsValid || !unit.IsVisible || unit.IsDead || !unit.IsTargetable) + { + return false; + } + + if (unit.IsInvulnerable || (checkTeam && unit.Team == ObjectManager.Player.Team)) + { + return false; + } + + if (unit.Name.Equals("WardCorpse", StringComparison.CurrentCultureIgnoreCase)) + { + return false; + } + + if (range < float.MaxValue) + { + var @base = unit as Obj_AI_Hero; + var value1 = (from.To2D().IsValid() ? from : ObjectManager.Player.ServerPosition).To2D(); + var value2 = (@base?.ServerPosition ?? unit.Position).To2D(); + + return Vector2.DistanceSquared(value1, value2) > range * range; + } + + return true; + } + + /// + /// Determines if the position is a wall. + /// + /// + /// The position. + /// + /// + /// The . + /// + public static bool IsWall(this Vector3 position) + => NavMesh.GetCollisionFlags(position).HasFlag(CollisionFlags.Wall); + + /// + /// Determines if the position is a wall. + /// + /// + /// The position. + /// + /// + /// The . + /// + public static bool IsWall(this Vector2 position) => position.To3D().IsWall(); + + /// + /// Levels up a spell. + /// + /// + /// The spell book. + /// + /// + /// The slot. + /// + /// + /// A value indicating whether to evolve or level up. + /// + public static void LevelUpSpell(this Spellbook book, SpellSlot slot, bool evolve = false) + { + if (evolve) + { + book.LevelSpell(slot); + } + else + { + book.EvolveSpell(slot); + } + } + + /// + /// Gets the mana percent of the unit. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static float ManaPercentage(this Obj_AI_Base unit) => unit.ManaPercent; + + /// + /// Process the packet data as a game packet. + /// + /// + /// The packet data. + /// + /// + /// The packet channel. + /// + public static void ProcessAsPacket(this byte[] packetData, PacketChannel packetChannel = PacketChannel.S2C) + => Game.ProcessPacket(packetData, packetChannel); + + /// + /// Randomizes the given position. + /// + /// + /// The position. + /// + /// + /// The minimum value of randomization. + /// + /// + /// The max value of randomization. + /// + /// + /// The . + /// + public static Vector3 Randomize(this Vector3 position, int min, int max) + { + var ran = new Random(Utils.TickCount); + return position + new Vector2(ran.Next(min, max), ran.Next(min, max)).To3D(); + } + + /// + /// Randomizes the given position. + /// + /// + /// The position. + /// + /// + /// The minimum value of randomization. + /// + /// + /// The max value of randomization. + /// + /// + /// The . + /// + public static Vector2 Randomize(this Vector2 position, int min, int max) + => position.To3D().Randomize(min, max).To2D(); + + /// + /// Send the packet data as a game packet. + /// + /// + /// The packet data. + /// + /// + /// The packet channel. + /// + /// + /// The protocol flags. + /// + public static void SendAsPacket( + this byte[] packetData, + PacketChannel packetChannel = PacketChannel.C2S, + PacketProtocolFlags protocolFlags = PacketProtocolFlags.Reliable) + => Game.SendPacket(packetData, packetChannel, protocolFlags); + + /// + /// Transforms the position into a . + /// + /// + /// The position. + /// + /// + /// The . + /// + public static NavMeshCell ToNavMeshCell(this Vector3 position) + { + var nav = NavMesh.WorldToGrid(position.X, position.Y); + return NavMesh.GetCell((short)nav.X, (short)nav.Y); + } + + /// + /// Gets the total attack damage of the unit. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static float TotalAttackDamage(this Obj_AI_Hero unit) => unit.TotalAttackDamage; + + /// + /// Gets the total magical damage of the unit. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static float TotalMagicalDamage(this Obj_AI_Hero unit) => unit.TotalMagicalDamage; + + /// + /// Deterins if the unit is under an ally turret. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static bool UnderAllyTurret(this GameObject unit) => UnderAllyTurret(unit.Position); + + /// + /// Determines if the position is under an ally turret. + /// + /// + /// The position. + /// + /// + /// The . + /// + public static bool UnderAllyTurret(this Vector3 position) + => + ObjectManager.Get() + .Any(turret => turret.IsValidTarget(950, false, position) && turret.IsAlly); + + /// + /// Determines if the unit is under a turret. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static bool UnderTurret(this GameObject unit) => UnderTurret(unit.Position, true); + + /// + /// Determines if the unit is under a turret. + /// + /// + /// The unit. + /// + /// + /// A value indicating if enemy turrets only. + /// + /// + /// The . + /// + public static bool UnderTurret(this GameObject unit, bool enemyTurretsOnly) + => UnderTurret(unit.Position, enemyTurretsOnly); + + /// + /// Determines if the position is under the turret. + /// + /// + /// The position. + /// + /// + /// A value indicating if enemy turrets only. + /// + /// + /// The . + /// + public static bool UnderTurret(this Vector3 position, bool enemyTurretsOnly) + => ObjectManager.Get().Any(turret => turret.IsValidTarget(950, enemyTurretsOnly, position)); + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Vector2Time.cs b/source/Utility/Vector2Time.cs new file mode 100644 index 00000000..0107c913 --- /dev/null +++ b/source/Utility/Vector2Time.cs @@ -0,0 +1,47 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using SharpDX; + + /// + /// Vector2 time. + /// + public class Vector2Time + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + /// + /// The position. + /// + /// + /// The time. + /// + public Vector2Time(Vector2 position, float time) + { + this.Position = position; + this.Time = time; + } + + #endregion + + #region Public Properties + + /// + /// Gets or sets the position. + /// + public Vector2 Position { get; set; } + + /// + /// Gets or sets the time. + /// + public float Time { get; set; } + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/Version.cs b/source/Utility/Version.cs new file mode 100644 index 00000000..e4b85243 --- /dev/null +++ b/source/Utility/Version.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + /// + /// The game version. + /// + public static class Version + { + #region Public Properties + + /// + /// Gets the build. + /// + public static int Build => GameVersion.Build; + + /// + /// Gets the major version. + /// + public static int MajorVersion => GameVersion.Major; + + /// + /// Gets the minor version. + /// + public static int MinorVersion => GameVersion.Minor; + + /// + /// Gets the revision. + /// + public static int Revision => GameVersion.Revision; + + #endregion + + #region Properties + + private static System.Version GameVersion { get; } = new System.Version(Game.Version); + + #endregion + + #region Public Methods and Operators + + /// + /// determines whether the versions are equal. + /// + /// + /// The verison. + /// + /// + /// The . + /// + public static bool IsEqual(string version) => GameVersion == new System.Version(version); + + /// + /// determines whether the version is newer. + /// + /// + /// The verison. + /// + /// + /// The . + /// + public static bool IsNewer(string version) => GameVersion > new System.Version(version); + + /// + /// determines whether the version is older. + /// + /// + /// The verison. + /// + /// + /// The . + /// + public static bool IsOlder(string version) => GameVersion < new System.Version(version); + + #endregion + } +} \ No newline at end of file diff --git a/source/Utility/WaypointTracker.cs b/source/Utility/WaypointTracker.cs new file mode 100644 index 00000000..a72c19c0 --- /dev/null +++ b/source/Utility/WaypointTracker.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Collections.Generic; + + using SharpDX; + + /// + /// The utility class. + /// + public partial class Utility + { + /// + /// Internal class used to get the waypoints even when the enemy enters the fow of war. + /// TODO + /// + internal static class WaypointTracker + { + #region Static Fields + + /// + /// The stored paths. + /// + public static readonly Dictionary> StoredPaths = new Dictionary>(); + + /// + /// The stored ticks. + /// + public static readonly Dictionary StoredTick = new Dictionary(); + + #endregion + } + } +} \ No newline at end of file diff --git a/Utils/Cursor.cs b/source/Utils/Cursor.cs similarity index 86% rename from Utils/Cursor.cs rename to source/Utils/Cursor.cs index 29b6f3b8..efd53359 100644 --- a/Utils/Cursor.cs +++ b/source/Utils/Cursor.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using SharpDX; @@ -24,7 +28,7 @@ internal class Cursor #region Constructors and Destructors /// - /// Initializes a static instance of the class. + /// Initializes static members of the class. /// static Cursor() { diff --git a/Utils/EnumerableExtensions.cs b/source/Utils/EnumerableExtensions.cs similarity index 58% rename from Utils/EnumerableExtensions.cs rename to source/Utils/EnumerableExtensions.cs index 5e9fc1d5..d55f0432 100644 --- a/Utils/EnumerableExtensions.cs +++ b/source/Utils/EnumerableExtensions.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; using System.Collections.Generic; @@ -24,7 +28,9 @@ public static class EnumerableExtensions /// /// The match. /// - /// + /// + /// The element as TSource. + /// public static TSource Find(this IEnumerable source, Predicate match) { return (source as List ?? source.ToList()).Find(match); @@ -45,31 +51,35 @@ public static TSource Find(this IEnumerable source, Predicate< /// /// The comparing function. /// - /// + /// + /// The element as T. + /// public static T MaxOrDefault(this IEnumerable container, Func valuingFoo) where TR : IComparable { - var enumerator = container.GetEnumerator(); - if (!enumerator.MoveNext()) + using (var enumerator = container.GetEnumerator()) { - return default(T); - } + if (!enumerator.MoveNext()) + { + return default(T); + } - var maxElem = enumerator.Current; - var maxVal = valuingFoo(maxElem); + var maxElem = enumerator.Current; + var maxVal = valuingFoo(maxElem); - while (enumerator.MoveNext()) - { - var currVal = valuingFoo(enumerator.Current); - - if (currVal.CompareTo(maxVal) > 0) + while (enumerator.MoveNext()) { - maxVal = currVal; - maxElem = enumerator.Current; + var currVal = valuingFoo(enumerator.Current); + + if (currVal.CompareTo(maxVal) > 0) + { + maxVal = currVal; + maxElem = enumerator.Current; + } } - } - return maxElem; + return maxElem; + } } /// @@ -87,31 +97,35 @@ public static T MaxOrDefault(this IEnumerable container, Func v /// /// The comparing function. /// - /// + /// + /// The element as T. + /// public static T MinOrDefault(this IEnumerable container, Func valuingFoo) where TR : IComparable { - var enumerator = container.GetEnumerator(); - if (!enumerator.MoveNext()) + using (var enumerator = container.GetEnumerator()) { - return default(T); - } - - var minElem = enumerator.Current; - var minVal = valuingFoo(minElem); + if (!enumerator.MoveNext()) + { + return default(T); + } - while (enumerator.MoveNext()) - { - var currVal = valuingFoo(enumerator.Current); + var minElem = enumerator.Current; + var minVal = valuingFoo(minElem); - if (currVal.CompareTo(minVal) < 0) + while (enumerator.MoveNext()) { - minVal = currVal; - minElem = enumerator.Current; + var currVal = valuingFoo(enumerator.Current); + + if (currVal.CompareTo(minVal) < 0) + { + minVal = currVal; + minElem = enumerator.Current; + } } - } - return minElem; + return minElem; + } } #endregion diff --git a/Utils/KeyboardEvents.cs b/source/Utils/KeyboardEvents.cs similarity index 78% rename from Utils/KeyboardEvents.cs rename to source/Utils/KeyboardEvents.cs index 128f0a39..0d963692 100644 --- a/Utils/KeyboardEvents.cs +++ b/source/Utils/KeyboardEvents.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { /// /// The keyboard events. diff --git a/Utils/Keys.cs b/source/Utils/Keys.cs similarity index 99% rename from Utils/Keys.cs rename to source/Utils/Keys.cs index 64dbe73c..b7a6560f 100644 --- a/Utils/Keys.cs +++ b/source/Utils/Keys.cs @@ -1,3 +1,7 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + namespace LeagueSharp.Common { using System; @@ -980,4 +984,4 @@ public enum Keys /// Alt = 262144, } -} +} \ No newline at end of file diff --git a/Utils/MouseEvents.cs b/source/Utils/MouseEvents.cs similarity index 68% rename from Utils/MouseEvents.cs rename to source/Utils/MouseEvents.cs index 88e19fd3..1f8dc58e 100644 --- a/Utils/MouseEvents.cs +++ b/source/Utils/MouseEvents.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { /// /// The mouse events. diff --git a/Utils/NativeMethods.cs b/source/Utils/NativeMethods.cs similarity index 95% rename from Utils/NativeMethods.cs rename to source/Utils/NativeMethods.cs index d93beca4..fde9a725 100644 --- a/Utils/NativeMethods.cs +++ b/source/Utils/NativeMethods.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; using System.Runtime.InteropServices; diff --git a/Utils/Utils.cs b/source/Utils/Utils.cs similarity index 76% rename from Utils/Utils.cs rename to source/Utils/Utils.cs index bd0b8ec7..f40d438d 100644 --- a/Utils/Utils.cs +++ b/source/Utils/Utils.cs @@ -1,11 +1,13 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; using System.Collections.Generic; - using System.IO; using System.Linq; using System.Reflection; - using System.Runtime.Serialization.Formatters.Binary; using System.Security.Cryptography; using System.Text; @@ -16,43 +18,17 @@ /// public static class Utils { - #region Constants - - /// - /// The enable quick edit mode value. - /// - private const int ENABLE_QUICK_EDIT_MODE = 0x40 | 0x80; - - /// - /// The std input handle. - /// - private const int STD_INPUT_HANDLE = -10; - - #endregion - #region Public Properties /// /// Gets the game time tick count. /// - public static int GameTimeTickCount - { - get - { - return (int)(Game.Time * 1000); - } - } + public static int GameTimeTickCount => (int)(Game.Time * 1000); /// /// Gets the tick count. /// - public static int TickCount - { - get - { - return Environment.TickCount & int.MaxValue; - } - } + public static int TickCount => Environment.TickCount & int.MaxValue; #endregion @@ -65,7 +41,7 @@ public static void ClearConsole() { try { - var windowHeight = Console.WindowHeight; + Console.WriteLine(Console.WindowHeight); Console.Clear(); } catch @@ -79,10 +55,13 @@ public static void ClearConsole() /// public static void EnableConsoleEditMode() { + const int EnableQuickEditMode = 0x40 | 0x80; + const int StdInputHandle = -0xA; + int mode; - var handle = NativeMethods.GetStdHandle(STD_INPUT_HANDLE); + var handle = NativeMethods.GetStdHandle(StdInputHandle); NativeMethods.GetConsoleMode(handle, out mode); - mode |= ENABLE_QUICK_EDIT_MODE; + mode |= EnableQuickEditMode; NativeMethods.SetConsoleMode(handle, mode); } @@ -122,7 +101,7 @@ public static byte FixVirtualKey(byte key) public static string FormatTime(double time) { var t = TimeSpan.FromSeconds(time); - return string.Format("{0:D2}:{1:D2}", t.Minutes, t.Seconds); + return $"{t.Minutes:D2}:{t.Seconds:D2}"; } /// @@ -144,7 +123,9 @@ public static byte[] GetBytes(string str) /// /// Returns the cursor position on the screen. /// - /// + /// + /// The . + /// public static Vector2 GetCursorPos() { return Cursor.GetCursorPos(); @@ -153,10 +134,13 @@ public static Vector2 GetCursorPos() /// /// Returns the directory where the assembly is located. /// + /// + /// The . + /// public static string GetLocation() { var fileLoc = Assembly.GetExecutingAssembly().Location; - return fileLoc.Remove(fileLoc.LastIndexOf("\\", StringComparison.Ordinal)); + return fileLoc?.Remove(fileLoc.LastIndexOf("\\", StringComparison.Ordinal)); } /// @@ -225,10 +209,12 @@ public static IEnumerable IndexOf(this T[] haystack, T[] needle) /// /// The rectangle height. /// - /// + /// + /// A value indicating whether the point is under the rectangle. + /// public static bool IsUnderRectangle(Vector2 point, float x, float y, float width, float height) { - return (point.X > x && point.X < x + width && point.Y > y && point.Y < y + height); + return point.X > x && point.X < x + width && point.Y > y && point.Y < y + height; } /// @@ -251,11 +237,13 @@ public static string KeyToText(uint vKey) /*F1-F12*/ if (vKey >= 112 && vKey <= 123) { - return ("F" + (vKey - 111)); + return "F" + (vKey - 111); } switch (vKey) { + case 0: + return "None"; case 9: return "Tab"; case 16: @@ -300,6 +288,21 @@ public static string Md5Hash(string s) return sb.ToString(); } + /// + /// Generates a next random double. + /// + /// + /// The random instance. + /// + /// + /// The min double number. + /// + /// + /// The max double number. + /// + /// + /// The . + /// public static double NextDouble(this Random rng, double min, double max) { return min + (rng.NextDouble() * (max - min)); @@ -320,56 +323,5 @@ public static string ToHexString(this byte bit) } #endregion - - #region Methods - - /// - /// Deserializes an object. - /// - /// - /// The object type. - /// - /// - /// The array. - /// - /// - /// The object as the given type. - /// - internal static T Deserialize(byte[] arrBytes) - { - using (var memory = new MemoryStream()) - { - memory.Write(arrBytes, 0, arrBytes.Length); - memory.Seek(0, SeekOrigin.Begin); - - return (T)new BinaryFormatter().Deserialize(memory); - } - } - - /// - /// Serializes an object. - /// - /// - /// The object. - /// - /// - /// The array output. - /// - internal static byte[] Serialize(object obj) - { - if (obj == null) - { - return null; - } - - using (var memory = new MemoryStream()) - { - new BinaryFormatter().Serialize(memory, obj); - - return memory.ToArray(); - } - } - - #endregion } } \ No newline at end of file diff --git a/Utils/VirtualMouse.cs b/source/Utils/VirtualMouse.cs similarity index 77% rename from Utils/VirtualMouse.cs rename to source/Utils/VirtualMouse.cs index 1466e3ed..8c545394 100644 --- a/Utils/VirtualMouse.cs +++ b/source/Utils/VirtualMouse.cs @@ -1,54 +1,27 @@ -namespace LeagueSharp.Common -{ - using System; +// +// Copyright (c) LeagueSharp. All rights reserved. +// +namespace LeagueSharp.Common +{ using SharpDX; + /// + /// The virtual mouse. + /// public static class VirtualMouse { - #region Static Fields + #region Public Properties /// - /// The X-axis coord. + /// Gets or sets the X-axis coord. /// - public static int CoordX; + public static int CoordX { get; set; } /// - /// The Y-axis coord. + /// Gets or sets the Y-axis coord. /// - public static int CoordY; - - #endregion - - #region Public Properties - - [Obsolete("Alias and marked to removal, use CoordX.")] - public static int coordX - { - get - { - return CoordX; - } - - set - { - CoordX = value; - } - } - - [Obsolete("Alias and marked to removal, use CoordX.")] - public static int coordY - { - get - { - return CoordY; - } - - set - { - CoordY = value; - } - } + public static int CoordY { get; set; } #endregion diff --git a/Utils/WeightedRandom.cs b/source/Utils/WeightedRandom.cs similarity index 85% rename from Utils/WeightedRandom.cs rename to source/Utils/WeightedRandom.cs index 3b78db48..dd9791bd 100644 --- a/Utils/WeightedRandom.cs +++ b/source/Utils/WeightedRandom.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; using System.Collections.Generic; @@ -14,7 +18,7 @@ public static class WeightedRandom /// /// The random instance. /// - public static Random Random = new Random(Utils.TickCount); + private static readonly Random Random = new Random(Utils.TickCount); #endregion @@ -44,7 +48,7 @@ public static int Next(int min, int max) var v2 = Random.NextDouble(); var randStdNormal = Math.Sqrt(-2.0 * Math.Log(v1)) * Math.Sin(2.0 * Math.PI * v2); - return (int)(mean + stdDev * randStdNormal); + return (int)(mean + (stdDev * randStdNormal)); } /// diff --git a/Utils/WindowsMessages.cs b/source/Utils/WindowsMessages.cs similarity index 99% rename from Utils/WindowsMessages.cs rename to source/Utils/WindowsMessages.cs index 70bbb3f7..39707c83 100644 --- a/Utils/WindowsMessages.cs +++ b/source/Utils/WindowsMessages.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; diff --git a/Menu/WndEventComposition.cs b/source/Utils/WndEventComposition.cs similarity index 90% rename from Menu/WndEventComposition.cs rename to source/Utils/WndEventComposition.cs index ac4cbde2..b664cb75 100644 --- a/Menu/WndEventComposition.cs +++ b/source/Utils/WndEventComposition.cs @@ -1,4 +1,8 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { using System; using System.Security.Permissions; @@ -45,7 +49,7 @@ public struct WndEventComposition #region Constructors and Destructors /// - /// Initializes static members of the struct. + /// Initializes a new instance of the struct. /// /// /// The @@ -101,13 +105,7 @@ public static Keys ModifierKeys /// /// Gets the Windows Event Message LParam. /// - public int LParam - { - get - { - return this.wndEventArgs.LParam; - } - } + public int LParam => this.wndEventArgs.LParam; /// /// Gets or sets a value indicating whether to process the message. @@ -128,13 +126,7 @@ public bool Process /// /// Gets the Windows Event Message WParam. /// - public uint WParam - { - get - { - return this.wndEventArgs.WParam; - } - } + public uint WParam => this.wndEventArgs.WParam; #endregion } diff --git a/source/packages.config b/source/packages.config new file mode 100644 index 00000000..86d59ae2 --- /dev/null +++ b/source/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file