From fc1f2e6af43c968b16c3c2523d5ce7114e2df133 Mon Sep 17 00:00:00 2001 From: L33T Date: Fri, 7 Oct 2016 19:08:43 +0300 Subject: [PATCH 01/11] v2 --- .gitignore | 51 +- .gitmodules | 3 + Alerter.cs | 131 - AntiGapcloser.cs | 237 - App.config | 6 + BetterWebClient.cs | 124 - Config.cs | 180 - CustomEvents.cs | 326 - Damage.cs | 7775 ----------------- Dash.cs | 176 - GamePacket.cs | 573 -- Geometry.cs | 1713 ---- LeagueSharp.Common.csproj | 212 - LeagueSharp.Common.csproj.DotSettings | 4 - LeagueSharp.Common.ruleset | 75 + LeagueSharp.Common.sln | 24 +- LeagueSharp.Common.sln.DotSettings | 2 + Key.snk => LeagueSharp.Common.snk | Bin MEC.cs | 455 - MinionManager.cs | 418 - Packet.cs | 5224 ----------- Prediction.cs | 1623 ---- Properties/AssemblyInfo.cs | 65 - Render.cs | 2371 ----- Shared.cs | 65 - Utility.cs | 1238 --- external/SharpDX.Menu | 1 + packages.config | 4 + source/AntiGapcloser/ActiveGapcloser.cs | 48 + source/AntiGapcloser/AntiGapcloser.cs | 129 + source/AntiGapcloser/AntiGapcloserAdapter.cs | 79 + source/AntiGapcloser/Gapcloser.cs | 55 + .../GapcloserData/GapcloserAatroxQ.cs | 28 + .../GapcloserData/GapcloserAkaliR.cs | 28 + .../GapcloserData/GapcloserAlistarW.cs | 28 + .../GapcloserData/GapcloserCorkiW.cs | 28 + .../GapcloserData/GapcloserDianaR.cs | 28 + .../GapcloserData/GapcloserEkkoE.cs | 28 + .../GapcloserData/GapcloserEliseE.cs | 28 + .../GapcloserData/GapcloserFioraQ.cs | 28 + .../GapcloserData/GapcloserFizzQ.cs | 28 + .../GapcloserData/GapcloserGnarE.cs | 28 + .../GapcloserData/GapcloserGragasE.cs | 28 + .../GapcloserData/GapcloserGravesE.cs | 28 + .../GapcloserData/GapcloserHecarimR.cs | 28 + .../GapcloserData/GapcloserIllaoiW.cs | 28 + .../GapcloserData/GapcloserIreliaQ.cs | 28 + .../GapcloserData/GapcloserJarvanIVQ.cs | 28 + .../GapcloserData/GapcloserJaxQ.cs | 28 + .../GapcloserData/GapcloserJayceQ.cs | 28 + .../GapcloserData/GapcloserKassadinR.cs | 28 + .../GapcloserData/GapcloserKhazixE.cs | 28 + .../GapcloserData/GapcloserLeBlancR.cs | 28 + .../GapcloserData/GapcloserLeeSinQ.cs | 28 + .../GapcloserData/GapcloserLeonaE.cs | 28 + .../GapcloserData/GapcloserLucianE.cs | 28 + .../GapcloserData/GapcloserMalphiteR.cs | 28 + .../GapcloserData/GapcloserMasterYiQ.cs | 28 + .../GapcloserData/GapcloserMonkeyKingE.cs | 28 + .../GapcloserData/GapcloserPantheonR.cs | 28 + .../GapcloserData/GapcloserPoppyE.cs | 28 + .../GapcloserData/GapcloserRenektonE.cs | 28 + .../GapcloserData/GapcloserRivenE.cs | 28 + .../GapcloserData/GapcloserSejuaniQ.cs | 28 + .../GapcloserData/GapcloserShenE.cs | 28 + .../GapcloserData/GapcloserShyvanaR.cs | 28 + .../GapcloserData/GapcloserTalonE.cs | 28 + .../GapcloserData/GapcloserTristanaW.cs | 28 + .../GapcloserData/GapcloserTryndamereE.cs | 28 + .../GapcloserData/GapcloserViQ.cs | 28 + .../GapcloserData/GapcloserXinZhaoE.cs | 28 + .../GapcloserData/GapcloserYasuoE.cs | 28 + .../GapcloserData/GapcloserZacE.cs | 28 + .../GapcloserData/GapcloserZedR.cs | 28 + .../AntiGapcloser/GapcloserData/IGapcloser.cs | 36 + .../GapcloserData/IGapcloserMetadata.cs | 21 + source/AntiGapcloser/GapcloserType.cs | 22 + source/Damage/Damage.cs | 187 + source/Damage/DamageExtensions.cs | 237 + source/Damage/DamageItems.cs | 255 + .../Damage/DamageItems/DamageBamisCinder.cs | 40 + .../DamageItems/DamageBilgewaterCutlass.cs | 39 + source/Damage/DamageItems/DamageBotRK.cs | 52 + source/Damage/DamageItems/DamageDuskblade.cs | 48 + source/Damage/DamageItems/DamageHexgun.cs | 39 + source/Damage/DamageItems/DamageHextechGLP.cs | 41 + .../DamageItems/DamageHextechProtobelt.cs | 41 + .../DamageItems/DamageIcebornGauntlet.cs | 39 + source/Damage/DamageItems/DamageItem.cs | 38 + .../Damage/DamageItems/DamageKircheisShard.cs | 39 + .../DamageItems/DamageLiandrysTorment.cs | 46 + source/Damage/DamageItems/DamageLichBane.cs | 39 + .../DamageItems/DamageLordVanDammsPillager.cs | 39 + source/Damage/DamageItems/DamageMuramana.cs | 39 + .../DamageItems/DamageRapidFirecannon.cs | 46 + .../Damage/DamageItems/DamageRavenousHydra.cs | 51 + source/Damage/DamageItems/DamageRecurveBow.cs | 39 + .../DamageItems/DamageRunaansHurricane.cs | 39 + .../Damage/DamageItems/DamageSerratedDirk.cs | 39 + source/Damage/DamageItems/DamageSheen.cs | 39 + .../Damage/DamageItems/DamageStatikkShiv.cs | 51 + .../Damage/DamageItems/DamageSunfireCape.cs | 40 + source/Damage/DamageItems/DamageTiamat.cs | 51 + .../Damage/DamageItems/DamageTitanicHydra.cs | 46 + .../Damage/DamageItems/DamageTrinityForce.cs | 39 + source/Damage/DamageItems/DamageWitsEnd.cs | 39 + source/Damage/DamageItems/IDamageItem.cs | 77 + .../Damage/DamageItems/IDamageItemMetadata.cs | 21 + source/Damage/DamageItems/ItemDamageType.cs | 30 + source/Damage/DamageSpell.cs | 84 + source/Damage/DamageSpells.cs | 130 + source/Damage/DamageSummonerSpells.cs | 60 + source/Damage/DamageType.cs | 37 + source/Damage/IDamageSpell.cs | 41 + source/Damage/Spells/Aatrox/DamageAatroxE.cs | 39 + source/Damage/Spells/Aatrox/DamageAatroxQ.cs | 39 + source/Damage/Spells/Aatrox/DamageAatroxR.cs | 39 + source/Damage/Spells/Aatrox/DamageAatroxW.cs | 39 + source/Damage/Spells/Ahri/DamageAhriE.cs | 39 + source/Damage/Spells/Ahri/DamageAhriQ.cs | 39 + source/Damage/Spells/Ahri/DamageAhriQ1.cs | 40 + source/Damage/Spells/Ahri/DamageAhriR.cs | 39 + source/Damage/Spells/Ahri/DamageAhriW.cs | 39 + source/Damage/Spells/Ahri/DamageAhriW1.cs | 40 + source/Damage/Spells/Akali/DamageAkaliE.cs | 39 + source/Damage/Spells/Akali/DamageAkaliQ.cs | 39 + source/Damage/Spells/Akali/DamageAkaliQ1.cs | 40 + source/Damage/Spells/Akali/DamageAkaliR.cs | 39 + .../Damage/Spells/Alistar/DamageAlistarQ.cs | 39 + .../Damage/Spells/Alistar/DamageAlistarW.cs | 39 + source/Damage/Spells/Amumu/DamageAmumuE.cs | 39 + source/Damage/Spells/Amumu/DamageAmumuQ.cs | 39 + source/Damage/Spells/Amumu/DamageAmumuR.cs | 39 + source/Damage/Spells/Amumu/DamageAmumuW.cs | 39 + source/Damage/Spells/Anivia/DamageAniviaE.cs | 39 + source/Damage/Spells/Anivia/DamageAniviaQ.cs | 39 + source/Damage/Spells/Anivia/DamageAniviaQ1.cs | 40 + source/Damage/Spells/Anivia/DamageAniviaR.cs | 39 + source/Damage/Spells/Annie/DamageAnnieQ.cs | 39 + source/Damage/Spells/Annie/DamageAnnieR.cs | 39 + source/Damage/Spells/Annie/DamageAnnieW.cs | 39 + source/Damage/Spells/Ashe/DamageAsheR.cs | 39 + source/Damage/Spells/Ashe/DamageAsheR1.cs | 40 + source/Damage/Spells/Ashe/DamageAsheW.cs | 39 + source/Damage/Spells/Azir/DamageAzirE.cs | 39 + source/Damage/Spells/Azir/DamageAzirQ.cs | 39 + source/Damage/Spells/Azir/DamageAzirR.cs | 39 + source/Damage/Spells/Azir/DamageAzirW.cs | 39 + source/Damage/Spells/Bard/DamageBardQ.cs | 39 + .../Spells/Blitzcrank/DamageBlitzcrankE.cs | 39 + .../Spells/Blitzcrank/DamageBlitzcrankQ.cs | 39 + .../Spells/Blitzcrank/DamageBlitzcrankR.cs | 39 + source/Damage/Spells/Brand/DamageBrandE.cs | 39 + source/Damage/Spells/Brand/DamageBrandQ.cs | 39 + source/Damage/Spells/Brand/DamageBrandR.cs | 39 + source/Damage/Spells/Brand/DamageBrandW.cs | 39 + source/Damage/Spells/Braum/DamageBraumQ.cs | 39 + source/Damage/Spells/Braum/DamageBraumR.cs | 39 + .../Damage/Spells/Caitlyn/DamageCaitlynE.cs | 39 + .../Damage/Spells/Caitlyn/DamageCaitlynQ.cs | 39 + .../Damage/Spells/Caitlyn/DamageCaitlynR.cs | 39 + .../Spells/Cassiopeia/DamageCassiopeiaE.cs | 39 + .../Spells/Cassiopeia/DamageCassiopeiaQ.cs | 39 + .../Spells/Cassiopeia/DamageCassiopeiaR.cs | 39 + .../Spells/Cassiopeia/DamageCassiopeiaW.cs | 39 + .../Damage/Spells/ChoGath/DamageChoGathE.cs | 39 + .../Damage/Spells/ChoGath/DamageChoGathQ.cs | 39 + .../Damage/Spells/ChoGath/DamageChoGathR.cs | 39 + .../Damage/Spells/ChoGath/DamageChoGathW.cs | 39 + source/Damage/Spells/Corki/DamageCorkiE.cs | 39 + source/Damage/Spells/Corki/DamageCorkiQ.cs | 39 + source/Damage/Spells/Corki/DamageCorkiR.cs | 39 + source/Damage/Spells/Corki/DamageCorkiR1.cs | 40 + source/Damage/Spells/Corki/DamageCorkiW.cs | 39 + source/Damage/Spells/Corki/DamageCorkiW1.cs | 40 + source/Damage/Spells/Darius/DamageDariusQ.cs | 39 + source/Damage/Spells/Darius/DamageDariusR.cs | 39 + source/Damage/Spells/Darius/DamageDariusW.cs | 39 + source/Damage/Spells/Diana/DamageDianaQ.cs | 39 + source/Damage/Spells/Diana/DamageDianaR.cs | 39 + source/Damage/Spells/Diana/DamageDianaW.cs | 39 + .../Damage/Spells/DrMundo/DamageDrMundoQ.cs | 51 + source/Damage/Spells/Draven/DamageDravenE.cs | 39 + source/Damage/Spells/Draven/DamageDravenQ.cs | 39 + source/Damage/Spells/Draven/DamageDravenR.cs | 39 + source/Damage/Spells/Ekko/DamageEkkoE.cs | 39 + source/Damage/Spells/Ekko/DamageEkkoQ.cs | 39 + source/Damage/Spells/Ekko/DamageEkkoQ1.cs | 40 + source/Damage/Spells/Ekko/DamageEkkoW.cs | 39 + source/Damage/Spells/Elise/DamageEliseQ.cs | 39 + source/Damage/Spells/Elise/DamageEliseQ1.cs | 40 + source/Damage/Spells/Elise/DamageEliseW.cs | 39 + .../Damage/Spells/Evelynn/DamageEvelynnE.cs | 39 + .../Damage/Spells/Evelynn/DamageEvelynnQ.cs | 39 + .../Damage/Spells/Evelynn/DamageEvelynnR.cs | 39 + .../Spells/ExportDamageMetadataAttribute.cs | 54 + source/Damage/Spells/Ezreal/DamageEzrealE.cs | 39 + source/Damage/Spells/Ezreal/DamageEzrealQ.cs | 39 + source/Damage/Spells/Ezreal/DamageEzrealR.cs | 39 + source/Damage/Spells/Ezreal/DamageEzrealW.cs | 39 + .../Fiddlesticks/DamageFiddlesticksE.cs | 39 + .../Fiddlesticks/DamageFiddlesticksR.cs | 39 + .../Fiddlesticks/DamageFiddlesticksW.cs | 39 + source/Damage/Spells/Fiora/DamageFioraQ.cs | 39 + source/Damage/Spells/Fiora/DamageFioraW.cs | 39 + source/Damage/Spells/Fizz/DamageFizzE.cs | 39 + source/Damage/Spells/Fizz/DamageFizzQ.cs | 39 + source/Damage/Spells/Fizz/DamageFizzR.cs | 39 + source/Damage/Spells/Fizz/DamageFizzW.cs | 39 + source/Damage/Spells/Galio/DamageGalioE.cs | 39 + source/Damage/Spells/Galio/DamageGalioQ.cs | 39 + source/Damage/Spells/Galio/DamageGalioR.cs | 39 + .../Spells/GangPlank/DamageGangPlankQ.cs | 39 + .../Spells/GangPlank/DamageGangPlankR.cs | 39 + source/Damage/Spells/Garen/DamageGarenE.cs | 39 + source/Damage/Spells/Garen/DamageGarenQ.cs | 39 + source/Damage/Spells/Garen/DamageGarenR.cs | 39 + source/Damage/Spells/Gnar/DamageGnarE.cs | 39 + source/Damage/Spells/Gnar/DamageGnarE1.cs | 40 + source/Damage/Spells/Gnar/DamageGnarQ.cs | 39 + source/Damage/Spells/Gnar/DamageGnarQ1.cs | 40 + source/Damage/Spells/Gnar/DamageGnarR.cs | 39 + source/Damage/Spells/Gnar/DamageGnarW.cs | 39 + source/Damage/Spells/Gnar/DamageGnarW1.cs | 40 + source/Damage/Spells/Gragas/DamageGragasE.cs | 39 + source/Damage/Spells/Gragas/DamageGragasQ.cs | 39 + source/Damage/Spells/Gragas/DamageGragasR.cs | 39 + source/Damage/Spells/Gragas/DamageGragasW.cs | 39 + source/Damage/Spells/Graves/DamageGravesQ.cs | 39 + source/Damage/Spells/Graves/DamageGravesQ1.cs | 40 + source/Damage/Spells/Graves/DamageGravesR.cs | 39 + source/Damage/Spells/Graves/DamageGravesW.cs | 39 + .../Damage/Spells/Hecarim/DamageHecarimE.cs | 39 + .../Damage/Spells/Hecarim/DamageHecarimQ.cs | 39 + .../Damage/Spells/Hecarim/DamageHecarimR.cs | 39 + .../Damage/Spells/Hecarim/DamageHecarimW.cs | 39 + .../Heimerdinger/DamageHeimerdingerE.cs | 39 + .../Heimerdinger/DamageHeimerdingerE1.cs | 40 + .../Heimerdinger/DamageHeimerdingerW.cs | 39 + .../Heimerdinger/DamageHeimerdingerW1.cs | 40 + source/Damage/Spells/IDamageSpellMetadata.cs | 31 + source/Damage/Spells/Irelia/DamageIreliaE.cs | 39 + source/Damage/Spells/Irelia/DamageIreliaQ.cs | 39 + source/Damage/Spells/Irelia/DamageIreliaR.cs | 39 + source/Damage/Spells/Irelia/DamageIreliaW.cs | 39 + source/Damage/Spells/Janna/DamageJannaQ.cs | 39 + source/Damage/Spells/Janna/DamageJannaW.cs | 39 + .../Damage/Spells/JarvanIV/DamageJarvanIVE.cs | 39 + .../Damage/Spells/JarvanIV/DamageJarvanIVQ.cs | 39 + .../Damage/Spells/JarvanIV/DamageJarvanIVR.cs | 39 + source/Damage/Spells/Jax/DamageJaxE.cs | 39 + source/Damage/Spells/Jax/DamageJaxQ.cs | 39 + source/Damage/Spells/Jax/DamageJaxR.cs | 39 + source/Damage/Spells/Jax/DamageJaxW.cs | 39 + source/Damage/Spells/Jayce/DamageJayceE.cs | 39 + source/Damage/Spells/Jayce/DamageJayceQ.cs | 39 + source/Damage/Spells/Jayce/DamageJayceQ1.cs | 40 + source/Damage/Spells/Jayce/DamageJayceW.cs | 39 + source/Damage/Spells/Jhin/DamageJhinE.cs | 39 + source/Damage/Spells/Jhin/DamageJhinQ.cs | 39 + source/Damage/Spells/Jhin/DamageJhinR.cs | 39 + source/Damage/Spells/Jhin/DamageJhinR1.cs | 40 + source/Damage/Spells/Jhin/DamageJhinW.cs | 39 + source/Damage/Spells/Jinx/DamageJinxE.cs | 39 + source/Damage/Spells/Jinx/DamageJinxQ.cs | 39 + source/Damage/Spells/Jinx/DamageJinxR.cs | 39 + source/Damage/Spells/Jinx/DamageJinxR1.cs | 40 + source/Damage/Spells/Jinx/DamageJinxW.cs | 39 + .../Damage/Spells/Kalista/DamageKalistaE.cs | 50 + .../Damage/Spells/Kalista/DamageKalistaQ.cs | 39 + .../Damage/Spells/Kalista/DamageKalistaW.cs | 39 + source/Damage/Spells/Karma/DamageKarmaQ.cs | 39 + source/Damage/Spells/Karma/DamageKarmaQ1.cs | 40 + source/Damage/Spells/Karma/DamageKarmaW.cs | 39 + source/Damage/Spells/Karma/DamageKarmaW1.cs | 40 + .../Damage/Spells/Karthus/DamageKarthusE.cs | 39 + .../Damage/Spells/Karthus/DamageKarthusQ.cs | 39 + .../Damage/Spells/Karthus/DamageKarthusQ1.cs | 40 + .../Damage/Spells/Karthus/DamageKarthusR.cs | 39 + .../Damage/Spells/Kassadin/DamageKassadinE.cs | 39 + .../Damage/Spells/Kassadin/DamageKassadinQ.cs | 39 + .../Damage/Spells/Kassadin/DamageKassadinR.cs | 39 + .../Spells/Kassadin/DamageKassadinR1.cs | 40 + .../Damage/Spells/Kassadin/DamageKassadinW.cs | 39 + .../Spells/Kassadin/DamageKassadinW1.cs | 40 + .../Damage/Spells/Katarina/DamageKatarinaE.cs | 39 + .../Damage/Spells/Katarina/DamageKatarinaQ.cs | 39 + .../Spells/Katarina/DamageKatarinaQ1.cs | 40 + .../Damage/Spells/Katarina/DamageKatarinaR.cs | 39 + .../Spells/Katarina/DamageKatarinaR1.cs | 40 + .../Damage/Spells/Katarina/DamageKatarinaW.cs | 39 + source/Damage/Spells/Kayle/DamageKayleE.cs | 39 + source/Damage/Spells/Kayle/DamageKayleQ.cs | 39 + source/Damage/Spells/Kennen/DamageKennenE.cs | 39 + source/Damage/Spells/Kennen/DamageKennenQ.cs | 39 + source/Damage/Spells/Kennen/DamageKennenR.cs | 39 + source/Damage/Spells/Kennen/DamageKennenW.cs | 39 + source/Damage/Spells/Kennen/DamageKennenW1.cs | 40 + source/Damage/Spells/KhaZix/DamageKhaZixE.cs | 39 + source/Damage/Spells/KhaZix/DamageKhaZixQ.cs | 39 + source/Damage/Spells/KhaZix/DamageKhaZixQ1.cs | 40 + source/Damage/Spells/KhaZix/DamageKhaZixQ2.cs | 40 + source/Damage/Spells/KhaZix/DamageKhaZixQ3.cs | 40 + source/Damage/Spells/KhaZix/DamageKhaZixW.cs | 39 + .../Damage/Spells/Kindred/DamageKindredE.cs | 39 + .../Damage/Spells/Kindred/DamageKindredQ.cs | 39 + .../Damage/Spells/Kindred/DamageKindredW.cs | 39 + source/Damage/Spells/KogMaw/DamageKogMawE.cs | 39 + source/Damage/Spells/KogMaw/DamageKogMawQ.cs | 39 + source/Damage/Spells/KogMaw/DamageKogMawR.cs | 39 + source/Damage/Spells/KogMaw/DamageKogMawW.cs | 46 + .../Damage/Spells/LeBlanc/DamageLeBlancE.cs | 39 + .../Damage/Spells/LeBlanc/DamageLeBlancQ.cs | 39 + .../Damage/Spells/LeBlanc/DamageLeBlancQ1.cs | 40 + .../Damage/Spells/LeBlanc/DamageLeBlancW.cs | 39 + source/Damage/Spells/LeeSin/DamageLeeSinE.cs | 39 + source/Damage/Spells/LeeSin/DamageLeeSinQ.cs | 39 + source/Damage/Spells/LeeSin/DamageLeeSinQ1.cs | 40 + source/Damage/Spells/LeeSin/DamageLeeSinR.cs | 39 + source/Damage/Spells/Leona/DamageLeonaE.cs | 39 + source/Damage/Spells/Leona/DamageLeonaQ.cs | 39 + source/Damage/Spells/Leona/DamageLeonaR.cs | 39 + source/Damage/Spells/Leona/DamageLeonaW.cs | 39 + .../Spells/Lissandra/DamageLissandraE.cs | 39 + .../Spells/Lissandra/DamageLissandraQ.cs | 39 + .../Spells/Lissandra/DamageLissandraR.cs | 39 + .../Spells/Lissandra/DamageLissandraW.cs | 39 + source/Damage/Spells/Lucian/DamageLucianQ.cs | 39 + source/Damage/Spells/Lucian/DamageLucianR.cs | 39 + source/Damage/Spells/Lucian/DamageLucianW.cs | 39 + source/Damage/Spells/Lulu/DamageLuluE.cs | 39 + source/Damage/Spells/Lulu/DamageLuluQ.cs | 39 + source/Damage/Spells/Lux/DamageLuxE.cs | 39 + source/Damage/Spells/Lux/DamageLuxQ.cs | 39 + source/Damage/Spells/Lux/DamageLuxR.cs | 39 + .../Damage/Spells/Malphite/DamageMalphiteE.cs | 39 + .../Damage/Spells/Malphite/DamageMalphiteQ.cs | 39 + .../Damage/Spells/Malphite/DamageMalphiteR.cs | 39 + .../Damage/Spells/Malphite/DamageMalphiteW.cs | 39 + .../Damage/Spells/Malzahar/DamageMalzaharE.cs | 39 + .../Damage/Spells/Malzahar/DamageMalzaharQ.cs | 39 + .../Damage/Spells/Malzahar/DamageMalzaharR.cs | 39 + .../Damage/Spells/Malzahar/DamageMalzaharW.cs | 39 + source/Damage/Spells/Maokai/DamageMaokaiE.cs | 39 + source/Damage/Spells/Maokai/DamageMaokaiE1.cs | 40 + source/Damage/Spells/Maokai/DamageMaokaiQ.cs | 39 + source/Damage/Spells/Maokai/DamageMaokaiR.cs | 39 + source/Damage/Spells/Maokai/DamageMaokaiW.cs | 39 + .../Damage/Spells/MasterYi/DamageMasterYiE.cs | 39 + .../Damage/Spells/MasterYi/DamageMasterYiQ.cs | 39 + .../Spells/MissFortune/DamageMissFortuneE.cs | 39 + .../Spells/MissFortune/DamageMissFortuneQ.cs | 39 + .../Spells/MissFortune/DamageMissFortuneQ1.cs | 40 + .../Spells/MissFortune/DamageMissFortuneR.cs | 39 + .../Spells/MissFortune/DamageMissFortuneW.cs | 39 + .../Spells/MonkeyKing/DamageMonkeyKingE.cs | 39 + .../Spells/MonkeyKing/DamageMonkeyKingQ.cs | 39 + .../Spells/MonkeyKing/DamageMonkeyKingR.cs | 39 + .../Spells/MonkeyKing/DamageMonkeyKingW.cs | 39 + .../Spells/Mordekaiser/DamageMordekaiserE.cs | 39 + .../Spells/Mordekaiser/DamageMordekaiserQ.cs | 39 + .../Spells/Mordekaiser/DamageMordekaiserR.cs | 39 + .../Spells/Mordekaiser/DamageMordekaiserW.cs | 39 + .../Damage/Spells/Morgana/DamageMorganaQ.cs | 39 + .../Damage/Spells/Morgana/DamageMorganaR.cs | 39 + .../Damage/Spells/Morgana/DamageMorganaW.cs | 39 + source/Damage/Spells/Nami/DamageNamiE.cs | 39 + source/Damage/Spells/Nami/DamageNamiQ.cs | 39 + source/Damage/Spells/Nami/DamageNamiR.cs | 39 + source/Damage/Spells/Nami/DamageNamiW.cs | 39 + source/Damage/Spells/Nasus/DamageNasusE.cs | 39 + source/Damage/Spells/Nasus/DamageNasusE1.cs | 40 + source/Damage/Spells/Nasus/DamageNasusQ.cs | 40 + source/Damage/Spells/Nasus/DamageNasusR.cs | 39 + .../Damage/Spells/Nautilus/DamageNautilusE.cs | 39 + .../Damage/Spells/Nautilus/DamageNautilusQ.cs | 39 + .../Damage/Spells/Nautilus/DamageNautilusR.cs | 39 + .../Spells/Nautilus/DamageNautilusR1.cs | 40 + .../Damage/Spells/Nautilus/DamageNautilusW.cs | 39 + .../Damage/Spells/Nidalee/DamageNidaleeE1.cs | 40 + .../Damage/Spells/Nidalee/DamageNidaleeQ.cs | 39 + .../Damage/Spells/Nidalee/DamageNidaleeQ1.cs | 45 + .../Damage/Spells/Nidalee/DamageNidaleeW.cs | 39 + .../Damage/Spells/Nidalee/DamageNidaleeW1.cs | 40 + .../Damage/Spells/Nocturne/DamageNocturneE.cs | 39 + .../Damage/Spells/Nocturne/DamageNocturneQ.cs | 39 + .../Damage/Spells/Nocturne/DamageNocturneR.cs | 39 + source/Damage/Spells/Nunu/DamageNunuE.cs | 39 + source/Damage/Spells/Nunu/DamageNunuQ.cs | 39 + source/Damage/Spells/Nunu/DamageNunuR.cs | 39 + source/Damage/Spells/Olaf/DamageOlafE.cs | 39 + source/Damage/Spells/Olaf/DamageOlafQ.cs | 39 + .../Damage/Spells/Orianna/DamageOriannaE.cs | 39 + .../Damage/Spells/Orianna/DamageOriannaQ.cs | 39 + .../Damage/Spells/Orianna/DamageOriannaR.cs | 39 + .../Damage/Spells/Orianna/DamageOriannaW.cs | 39 + .../Damage/Spells/Pantheon/DamagePantheonE.cs | 39 + .../Damage/Spells/Pantheon/DamagePantheonQ.cs | 39 + .../Damage/Spells/Pantheon/DamagePantheonR.cs | 39 + .../Spells/Pantheon/DamagePantheonR1.cs | 40 + .../Damage/Spells/Pantheon/DamagePantheonW.cs | 39 + source/Damage/Spells/Poppy/DamagePoppyE.cs | 39 + source/Damage/Spells/Poppy/DamagePoppyE1.cs | 40 + source/Damage/Spells/Poppy/DamagePoppyQ.cs | 39 + source/Damage/Spells/Poppy/DamagePoppyQ1.cs | 40 + source/Damage/Spells/Poppy/DamagePoppyR.cs | 39 + source/Damage/Spells/Poppy/DamagePoppyW.cs | 39 + source/Damage/Spells/Quinn/DamageQuinnE.cs | 39 + source/Damage/Spells/Quinn/DamageQuinnQ.cs | 43 + source/Damage/Spells/Quinn/DamageQuinnR.cs | 39 + source/Damage/Spells/Rammus/DamageRammusQ.cs | 39 + source/Damage/Spells/Rammus/DamageRammusR.cs | 39 + source/Damage/Spells/Rammus/DamageRammusW.cs | 39 + .../Damage/Spells/Renekton/DamageRenektonE.cs | 39 + .../Damage/Spells/Renekton/DamageRenektonQ.cs | 39 + .../Spells/Renekton/DamageRenektonQ1.cs | 40 + .../Damage/Spells/Renekton/DamageRenektonR.cs | 39 + .../Damage/Spells/Renekton/DamageRenektonW.cs | 39 + .../Spells/Renekton/DamageRenektonW1.cs | 40 + source/Damage/Spells/Rengar/DamageRengarE.cs | 39 + source/Damage/Spells/Rengar/DamageRengarQ.cs | 39 + source/Damage/Spells/Rengar/DamageRengarW.cs | 39 + source/Damage/Spells/Riven/DamageRivenQ.cs | 39 + source/Damage/Spells/Riven/DamageRivenR.cs | 39 + source/Damage/Spells/Riven/DamageRivenW.cs | 39 + source/Damage/Spells/Rumble/DamageRumbleE.cs | 39 + source/Damage/Spells/Rumble/DamageRumbleE1.cs | 40 + source/Damage/Spells/Rumble/DamageRumbleQ.cs | 39 + source/Damage/Spells/Rumble/DamageRumbleQ1.cs | 40 + source/Damage/Spells/Rumble/DamageRumbleR.cs | 39 + source/Damage/Spells/Rumble/DamageRumbleR1.cs | 40 + source/Damage/Spells/Ryze/DamageRyzeE.cs | 39 + source/Damage/Spells/Ryze/DamageRyzeQ.cs | 51 + source/Damage/Spells/Ryze/DamageRyzeW.cs | 39 + .../Damage/Spells/Sejuani/DamageSejuaniE.cs | 39 + .../Damage/Spells/Sejuani/DamageSejuaniQ.cs | 39 + .../Damage/Spells/Sejuani/DamageSejuaniR.cs | 39 + .../Damage/Spells/Sejuani/DamageSejuaniW.cs | 39 + .../Damage/Spells/Sejuani/DamageSejuaniW1.cs | 40 + source/Damage/Spells/Shaco/DamageShacoE.cs | 39 + source/Damage/Spells/Shaco/DamageShacoQ.cs | 39 + source/Damage/Spells/Shaco/DamageShacoR.cs | 39 + source/Damage/Spells/Shaco/DamageShacoW.cs | 39 + source/Damage/Spells/Shen/DamageShenE.cs | 39 + source/Damage/Spells/Shen/DamageShenQ.cs | 49 + source/Damage/Spells/Shen/DamageShenQ1.cs | 50 + .../Damage/Spells/Shyvana/DamageShyvanaE.cs | 39 + .../Damage/Spells/Shyvana/DamageShyvanaQ.cs | 39 + .../Damage/Spells/Shyvana/DamageShyvanaR.cs | 39 + .../Damage/Spells/Shyvana/DamageShyvanaW.cs | 39 + source/Damage/Spells/Singed/DamageSingedE.cs | 39 + source/Damage/Spells/Singed/DamageSingedQ.cs | 39 + source/Damage/Spells/Sion/DamageSionE.cs | 39 + source/Damage/Spells/Sion/DamageSionE1.cs | 40 + source/Damage/Spells/Sion/DamageSionQ.cs | 39 + source/Damage/Spells/Sion/DamageSionQ1.cs | 40 + source/Damage/Spells/Sion/DamageSionR.cs | 39 + source/Damage/Spells/Sion/DamageSionR1.cs | 40 + source/Damage/Spells/Sion/DamageSionW.cs | 39 + source/Damage/Spells/Sivir/DamageSivirQ.cs | 39 + source/Damage/Spells/Sivir/DamageSivirW.cs | 39 + .../Damage/Spells/Skarner/DamageSkarnerE.cs | 39 + .../Damage/Spells/Skarner/DamageSkarnerQ.cs | 39 + .../Damage/Spells/Skarner/DamageSkarnerR.cs | 39 + source/Damage/Spells/Sona/DamageSonaQ.cs | 39 + source/Damage/Spells/Sona/DamageSonaR.cs | 39 + source/Damage/Spells/Soraka/DamageSorakaE.cs | 39 + source/Damage/Spells/Soraka/DamageSorakaQ.cs | 39 + source/Damage/Spells/Swain/DamageSwainE.cs | 39 + source/Damage/Spells/Swain/DamageSwainQ.cs | 39 + source/Damage/Spells/Swain/DamageSwainR.cs | 39 + source/Damage/Spells/Swain/DamageSwainW.cs | 39 + source/Damage/Spells/Syndra/DamageSyndraE.cs | 39 + source/Damage/Spells/Syndra/DamageSyndraQ.cs | 39 + source/Damage/Spells/Syndra/DamageSyndraR.cs | 39 + source/Damage/Spells/Syndra/DamageSyndraR1.cs | 40 + source/Damage/Spells/Syndra/DamageSyndraW.cs | 39 + .../Spells/TahmKench/DamageTahmKenchQ.cs | 39 + .../Spells/TahmKench/DamageTahmKenchW.cs | 39 + .../Spells/TahmKench/DamageTahmKenchW1.cs | 40 + source/Damage/Spells/Talon/DamageTalonQ.cs | 39 + source/Damage/Spells/Talon/DamageTalonR.cs | 39 + source/Damage/Spells/Talon/DamageTalonW.cs | 39 + source/Damage/Spells/Taric/DamageTaricE.cs | 39 + source/Damage/Spells/Taric/DamageTaricR.cs | 39 + source/Damage/Spells/Taric/DamageTaricW.cs | 39 + source/Damage/Spells/Teemo/DamageTeemoE.cs | 39 + source/Damage/Spells/Teemo/DamageTeemoE1.cs | 40 + source/Damage/Spells/Teemo/DamageTeemoQ.cs | 39 + source/Damage/Spells/Teemo/DamageTeemoR.cs | 39 + source/Damage/Spells/Thresh/DamageThreshE.cs | 39 + source/Damage/Spells/Thresh/DamageThreshQ.cs | 39 + source/Damage/Spells/Thresh/DamageThreshR.cs | 39 + .../Damage/Spells/Tristana/DamageTristanaE.cs | 39 + .../Damage/Spells/Tristana/DamageTristanaR.cs | 39 + .../Damage/Spells/Tristana/DamageTristanaW.cs | 39 + .../Damage/Spells/Trundle/DamageTrundleQ.cs | 39 + .../Damage/Spells/Trundle/DamageTrundleR.cs | 39 + .../Spells/Tryndamere/DamageTryndamereE.cs | 39 + .../Spells/TwistedFate/DamageTwistedFateE.cs | 39 + .../Spells/TwistedFate/DamageTwistedFateQ.cs | 39 + .../Spells/TwistedFate/DamageTwistedFateW.cs | 39 + .../Spells/TwistedFate/DamageTwistedFateW1.cs | 40 + .../Spells/TwistedFate/DamageTwistedFateW2.cs | 40 + source/Damage/Spells/Twitch/DamageTwitchE.cs | 40 + source/Damage/Spells/Twitch/DamageTwitchE1.cs | 40 + source/Damage/Spells/Udyr/DamageUdyrQ.cs | 39 + source/Damage/Spells/Udyr/DamageUdyrR.cs | 39 + source/Damage/Spells/Urgot/DamageUrgotE.cs | 39 + source/Damage/Spells/Urgot/DamageUrgotQ.cs | 39 + source/Damage/Spells/Varus/DamageVarusE.cs | 39 + source/Damage/Spells/Varus/DamageVarusQ.cs | 39 + source/Damage/Spells/Varus/DamageVarusQ1.cs | 40 + source/Damage/Spells/Varus/DamageVarusR.cs | 39 + source/Damage/Spells/Varus/DamageVarusW.cs | 39 + source/Damage/Spells/Varus/DamageVarusW1.cs | 40 + source/Damage/Spells/Vayne/DamageVayneE.cs | 39 + source/Damage/Spells/Vayne/DamageVayneQ.cs | 39 + source/Damage/Spells/Vayne/DamageVayneW.cs | 42 + source/Damage/Spells/Veigar/DamageVeigarQ.cs | 39 + source/Damage/Spells/Veigar/DamageVeigarR.cs | 40 + source/Damage/Spells/Veigar/DamageVeigarW.cs | 39 + source/Damage/Spells/Velkoz/DamageVelkozE.cs | 39 + source/Damage/Spells/Velkoz/DamageVelkozQ.cs | 39 + source/Damage/Spells/Velkoz/DamageVelkozR.cs | 44 + source/Damage/Spells/Velkoz/DamageVelkozW.cs | 39 + source/Damage/Spells/Vi/DamageViE.cs | 39 + source/Damage/Spells/Vi/DamageViQ.cs | 39 + source/Damage/Spells/Vi/DamageViR.cs | 39 + source/Damage/Spells/Vi/DamageViW.cs | 39 + source/Damage/Spells/Viktor/DamageViktorE.cs | 39 + source/Damage/Spells/Viktor/DamageViktorE1.cs | 40 + source/Damage/Spells/Viktor/DamageViktorQ.cs | 39 + source/Damage/Spells/Viktor/DamageViktorR.cs | 39 + source/Damage/Spells/Viktor/DamageViktorR1.cs | 40 + .../Damage/Spells/Vladimir/DamageVladimirE.cs | 39 + .../Damage/Spells/Vladimir/DamageVladimirQ.cs | 39 + .../Damage/Spells/Vladimir/DamageVladimirR.cs | 39 + .../Damage/Spells/Vladimir/DamageVladimirW.cs | 39 + .../Damage/Spells/Volibear/DamageVolibearE.cs | 39 + .../Damage/Spells/Volibear/DamageVolibearQ.cs | 39 + .../Damage/Spells/Volibear/DamageVolibearR.cs | 39 + .../Damage/Spells/Volibear/DamageVolibearW.cs | 39 + .../Damage/Spells/Warwick/DamageWarwickQ.cs | 43 + .../Damage/Spells/Warwick/DamageWarwickR.cs | 39 + source/Damage/Spells/Xerath/DamageXerathE.cs | 39 + source/Damage/Spells/Xerath/DamageXerathQ.cs | 39 + source/Damage/Spells/Xerath/DamageXerathR.cs | 39 + source/Damage/Spells/Xerath/DamageXerathW.cs | 39 + .../Damage/Spells/XinZhao/DamageXinZhaoE.cs | 39 + .../Damage/Spells/XinZhao/DamageXinZhaoQ.cs | 39 + .../Damage/Spells/XinZhao/DamageXinZhaoR.cs | 39 + source/Damage/Spells/Yasuo/DamageYasuoE.cs | 39 + source/Damage/Spells/Yasuo/DamageYasuoQ.cs | 39 + source/Damage/Spells/Yasuo/DamageYasuoR.cs | 39 + source/Damage/Spells/Yorick/DamageYorickE.cs | 39 + source/Damage/Spells/Yorick/DamageYorickQ.cs | 39 + source/Damage/Spells/Yorick/DamageYorickW.cs | 39 + source/Damage/Spells/Zac/DamageZacE.cs | 39 + source/Damage/Spells/Zac/DamageZacQ.cs | 39 + source/Damage/Spells/Zac/DamageZacR.cs | 39 + source/Damage/Spells/Zac/DamageZacW.cs | 39 + source/Damage/Spells/Zed/DamageZedE.cs | 39 + source/Damage/Spells/Zed/DamageZedQ.cs | 39 + source/Damage/Spells/Zed/DamageZedR.cs | 39 + source/Damage/Spells/Ziggs/DamageZiggsE.cs | 39 + source/Damage/Spells/Ziggs/DamageZiggsQ.cs | 39 + source/Damage/Spells/Ziggs/DamageZiggsR.cs | 39 + source/Damage/Spells/Ziggs/DamageZiggsW.cs | 39 + source/Damage/Spells/Zilean/DamageZileanQ.cs | 39 + source/Damage/Spells/Zyra/DamageZyraE.cs | 39 + source/Damage/Spells/Zyra/DamageZyraQ.cs | 39 + source/Damage/Spells/Zyra/DamageZyraR.cs | 39 + source/Damage/SummonerSpell.cs | 32 + .../Damage/SummonerSpells/ISummonerSpell.cs | 32 + .../SummonerSpells/ISummonerSpellMetadata.cs | 21 + .../SummonerSpells/SummonerSpellIgnite.cs | 26 + .../SummonerSpells/SummonerSpellSmite.cs | 51 + source/Dash/Dash.cs | 133 + source/Dash/DashAdapter.cs | 29 + source/Dash/DashExtensions.cs | 38 + source/Dash/DashItem.cs | 71 + source/Events/GameEvents.cs | 22 + source/Events/OnDash.cs | 57 + source/Events/OnGameEnd.cs | 54 + source/Events/OnGameLoad.cs | 95 + source/Events/OnLevelUp.cs | 103 + source/Events/OnLevelUpSpell.cs | 102 + source/Events/UnitEvents.cs | 33 + source/Geometry/Arc.cs | 139 + source/Geometry/Circle.cs | 118 + source/Geometry/ConvexHull.cs | 502 ++ source/Geometry/Geometry.cs | 613 ++ source/Geometry/IntersectionResult.cs | 53 + source/Geometry/Line.cs | 115 + source/Geometry/MecCircle.cs | 53 + source/Geometry/MinMaxCornersInfo.cs | 71 + source/Geometry/Polygon.cs | 156 + source/Geometry/ProjectionInfo.cs | 62 + source/Geometry/Rectangle.cs | 122 + source/Geometry/Ring.cs | 136 + source/Geometry/Sector.cs | 172 + source/LeagueSharp.Common.csproj | 808 ++ source/LeagueSharp.Common.csproj.DotSettings | 148 + source/Library.cs | 122 + source/Minion/FarmLocation.cs | 53 + source/Minion/JungleType.cs | 32 + source/Minion/LaneType.cs | 27 + source/Minion/MinionInfo.cs | 143 + source/Minion/MinionManager.cs | 61 + source/Minion/MinionManagerAdapter.cs | 469 + source/Minion/MinionOrderTypes.cs | 27 + source/Minion/MinionTeam.cs | 46 + source/Minion/MinionTypes.cs | 32 + source/Native/BetterWebClient.cs | 141 + source/Native/Config.cs | 137 + source/Native/Shared.cs | 80 + AutoLevel.cs => source/Old/AutoLevel.cs | 0 .../Old/CustomizableAntiGapcloser.cs | 0 {Data => source/Old/Data}/ItemData.cs | 0 {Data => source/Old/Data}/MasteryData.cs | 0 {Data => source/Old/Data}/SpellDatabase.cs | 0 FakeClicks.cs => source/Old/FakeClicks.cs | 0 Hacks.cs => source/Old/Hacks.cs | 0 .../Old/HealthPrediction.cs | 0 HeroManager.cs => source/Old/HeroManager.cs | 0 Interrupter.cs => source/Old/Interrupter.cs | 0 Interrupter2.cs => source/Old/Interrupter2.cs | 0 Items.cs => source/Old/Items.cs | 0 .../Old/LastCastedSpell.cs | 0 MapPositions.cs => source/Old/MapPositions.cs | 0 {Menu => source/Old/Menu}/CPSlider.cs | 0 {Menu => source/Old/Menu}/Circle.cs | 0 {Menu => source/Old/Menu}/ColorPicker.cs | 0 {Menu => source/Old/Menu}/CommonMenu.cs | 0 {Menu => source/Old/Menu}/HSLColor.cs | 0 {Menu => source/Old/Menu}/KeyBind.cs | 0 {Menu => source/Old/Menu}/KeyBindType.cs | 0 {Menu => source/Old/Menu}/KeybindSetStage.cs | 0 {Menu => source/Old/Menu}/Menu.cs | 0 {Menu => source/Old/Menu}/MenuDrawHelper.cs | 0 {Menu => source/Old/Menu}/MenuGlobals.cs | 0 {Menu => source/Old/Menu}/MenuItem.cs | 0 {Menu => source/Old/Menu}/MenuSettings.cs | 0 {Menu => source/Old/Menu}/MenuValueType.cs | 0 .../Old/Menu}/OnValueChangeEventArgs.cs | 0 {Menu => source/Old/Menu}/SavedSettings.cs | 0 {Menu => source/Old/Menu}/Slider.cs | 0 {Menu => source/Old/Menu}/StringList.cs | 0 MenuWrapper.cs => source/Old/MenuWrapper.cs | 0 .../Old/MultiLanguage.cs | 0 .../Old/Notifications.cs | 0 .../Old/Notifications}/INotification.cs | 0 .../Old/Notifications}/Notification.cs | 0 .../Old/ObjectHandler.cs | 0 Orbwalking.cs => source/Old/Orbwalking.cs | 0 PermaShow.cs => source/Old/PermaShow.cs | 0 Spell.cs => source/Old/Spell.cs | 0 .../Old/TargetSelector.cs | 0 source/Packets/GamePacket.cs | 613 ++ source/Prediction/CollisionableObjects.cs | 37 + source/Prediction/HitChance.cs | 57 + source/Prediction/Old/AoePrediction.cs | 423 + source/Prediction/Old/Collision.cs | 200 + source/Prediction/Old/Prediction.cs | 465 + source/Prediction/PathTracker.cs | 179 + source/Prediction/PredictionInput.cs | 122 + source/Prediction/PredictionOutput.cs | 96 + source/Prediction/SkillshotType.cs | 27 + source/Prediction/StoredPath.cs | 51 + source/Properties/AssemblyInfo.cs | 23 + .../Properties}/Resources.Designer.cs | 47 +- source/Properties/Resources.resx | 136 + source/Render/Alerter.cs | 107 + source/Render/Circle.cs | 210 + source/Render/CircleEffect.cs | 243 + source/Render/FontExtension.cs | 80 + source/Render/Line.cs | 192 + source/Render/Rectangle.cs | 173 + source/Render/Render.cs | 178 + source/Render/RenderObject.cs | 186 + source/Render/Sprite.cs | 488 ++ source/Render/Text.cs | 464 + {Resources => source/Resources}/CPForm.png | Bin .../Resources/ChineseJson.json | 136 +- source/Resources/CircleEffect.fx | 53 + .../Resources}/SliderActive.png | Bin .../Resources}/SliderDisabled.png | Bin source/Utility/DelayAction.cs | 136 + source/Utility/HpBarDamageIndicator.cs | 142 + source/Utility/Map.cs | 65 + source/Utility/MapAdapter.cs | 68 + source/Utility/Maps/IMap.cs | 43 + source/Utility/Maps/IMapMetadata.cs | 21 + source/Utility/Maps/MapCrystalScar.cs | 53 + source/Utility/Maps/MapHowlingAbyss.cs | 53 + source/Utility/Maps/MapSummonersRift.cs | 53 + source/Utility/Maps/MapTwistedTreeline.cs | 53 + source/Utility/Maps/MapUnknown.cs | 49 + source/Utility/MiniCache.cs | 64 + source/Utility/Utility.cs | 1205 +++ source/Utility/Vector2Time.cs | 47 + source/Utility/Version.cs | 79 + source/Utility/WaypointTracker.cs | 37 + {Utils => source/Utils}/Cursor.cs | 8 +- .../Utils}/EnumerableExtensions.cs | 82 +- {Utils => source/Utils}/KeyboardEvents.cs | 6 +- {Utils => source/Utils}/Keys.cs | 6 +- {Utils => source/Utils}/MouseEvents.cs | 6 +- {Utils => source/Utils}/NativeMethods.cs | 6 +- {Utils => source/Utils}/Utils.cs | 132 +- {Utils => source/Utils}/VirtualMouse.cs | 53 +- {Utils => source/Utils}/WeightedRandom.cs | 10 +- {Utils => source/Utils}/WindowsMessages.cs | 6 +- {Menu => source/Utils}/WndEventComposition.cs | 24 +- source/packages.config | 4 + 716 files changed, 34695 insertions(+), 23293 deletions(-) create mode 100644 .gitmodules delete mode 100644 Alerter.cs delete mode 100644 AntiGapcloser.cs create mode 100644 App.config delete mode 100644 BetterWebClient.cs delete mode 100644 Config.cs delete mode 100644 CustomEvents.cs delete mode 100644 Damage.cs delete mode 100644 Dash.cs delete mode 100644 GamePacket.cs delete mode 100644 Geometry.cs delete mode 100644 LeagueSharp.Common.csproj delete mode 100644 LeagueSharp.Common.csproj.DotSettings create mode 100644 LeagueSharp.Common.ruleset create mode 100644 LeagueSharp.Common.sln.DotSettings rename Key.snk => LeagueSharp.Common.snk (100%) delete mode 100644 MEC.cs delete mode 100644 MinionManager.cs delete mode 100644 Packet.cs delete mode 100644 Prediction.cs delete mode 100644 Properties/AssemblyInfo.cs delete mode 100644 Render.cs delete mode 100644 Shared.cs delete mode 100644 Utility.cs create mode 160000 external/SharpDX.Menu create mode 100644 packages.config create mode 100644 source/AntiGapcloser/ActiveGapcloser.cs create mode 100644 source/AntiGapcloser/AntiGapcloser.cs create mode 100644 source/AntiGapcloser/AntiGapcloserAdapter.cs create mode 100644 source/AntiGapcloser/Gapcloser.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserAatroxQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserAkaliR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserAlistarW.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserCorkiW.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserDianaR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserEkkoE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserEliseE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserFioraQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserFizzQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserGnarE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserGragasE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserGravesE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserHecarimR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserIllaoiW.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserIreliaQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserJarvanIVQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserJaxQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserJayceQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserKassadinR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserKhazixE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserLeBlancR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserLeeSinQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserLeonaE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserLucianE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserMalphiteR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserMasterYiQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserMonkeyKingE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserPantheonR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserPoppyE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserRenektonE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserRivenE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserSejuaniQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserShenE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserShyvanaR.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserTalonE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserTristanaW.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserTryndamereE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserViQ.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserXinZhaoE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserYasuoE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserZacE.cs create mode 100644 source/AntiGapcloser/GapcloserData/GapcloserZedR.cs create mode 100644 source/AntiGapcloser/GapcloserData/IGapcloser.cs create mode 100644 source/AntiGapcloser/GapcloserData/IGapcloserMetadata.cs create mode 100644 source/AntiGapcloser/GapcloserType.cs create mode 100644 source/Damage/Damage.cs create mode 100644 source/Damage/DamageExtensions.cs create mode 100644 source/Damage/DamageItems.cs create mode 100644 source/Damage/DamageItems/DamageBamisCinder.cs create mode 100644 source/Damage/DamageItems/DamageBilgewaterCutlass.cs create mode 100644 source/Damage/DamageItems/DamageBotRK.cs create mode 100644 source/Damage/DamageItems/DamageDuskblade.cs create mode 100644 source/Damage/DamageItems/DamageHexgun.cs create mode 100644 source/Damage/DamageItems/DamageHextechGLP.cs create mode 100644 source/Damage/DamageItems/DamageHextechProtobelt.cs create mode 100644 source/Damage/DamageItems/DamageIcebornGauntlet.cs create mode 100644 source/Damage/DamageItems/DamageItem.cs create mode 100644 source/Damage/DamageItems/DamageKircheisShard.cs create mode 100644 source/Damage/DamageItems/DamageLiandrysTorment.cs create mode 100644 source/Damage/DamageItems/DamageLichBane.cs create mode 100644 source/Damage/DamageItems/DamageLordVanDammsPillager.cs create mode 100644 source/Damage/DamageItems/DamageMuramana.cs create mode 100644 source/Damage/DamageItems/DamageRapidFirecannon.cs create mode 100644 source/Damage/DamageItems/DamageRavenousHydra.cs create mode 100644 source/Damage/DamageItems/DamageRecurveBow.cs create mode 100644 source/Damage/DamageItems/DamageRunaansHurricane.cs create mode 100644 source/Damage/DamageItems/DamageSerratedDirk.cs create mode 100644 source/Damage/DamageItems/DamageSheen.cs create mode 100644 source/Damage/DamageItems/DamageStatikkShiv.cs create mode 100644 source/Damage/DamageItems/DamageSunfireCape.cs create mode 100644 source/Damage/DamageItems/DamageTiamat.cs create mode 100644 source/Damage/DamageItems/DamageTitanicHydra.cs create mode 100644 source/Damage/DamageItems/DamageTrinityForce.cs create mode 100644 source/Damage/DamageItems/DamageWitsEnd.cs create mode 100644 source/Damage/DamageItems/IDamageItem.cs create mode 100644 source/Damage/DamageItems/IDamageItemMetadata.cs create mode 100644 source/Damage/DamageItems/ItemDamageType.cs create mode 100644 source/Damage/DamageSpell.cs create mode 100644 source/Damage/DamageSpells.cs create mode 100644 source/Damage/DamageSummonerSpells.cs create mode 100644 source/Damage/DamageType.cs create mode 100644 source/Damage/IDamageSpell.cs create mode 100644 source/Damage/Spells/Aatrox/DamageAatroxE.cs create mode 100644 source/Damage/Spells/Aatrox/DamageAatroxQ.cs create mode 100644 source/Damage/Spells/Aatrox/DamageAatroxR.cs create mode 100644 source/Damage/Spells/Aatrox/DamageAatroxW.cs create mode 100644 source/Damage/Spells/Ahri/DamageAhriE.cs create mode 100644 source/Damage/Spells/Ahri/DamageAhriQ.cs create mode 100644 source/Damage/Spells/Ahri/DamageAhriQ1.cs create mode 100644 source/Damage/Spells/Ahri/DamageAhriR.cs create mode 100644 source/Damage/Spells/Ahri/DamageAhriW.cs create mode 100644 source/Damage/Spells/Ahri/DamageAhriW1.cs create mode 100644 source/Damage/Spells/Akali/DamageAkaliE.cs create mode 100644 source/Damage/Spells/Akali/DamageAkaliQ.cs create mode 100644 source/Damage/Spells/Akali/DamageAkaliQ1.cs create mode 100644 source/Damage/Spells/Akali/DamageAkaliR.cs create mode 100644 source/Damage/Spells/Alistar/DamageAlistarQ.cs create mode 100644 source/Damage/Spells/Alistar/DamageAlistarW.cs create mode 100644 source/Damage/Spells/Amumu/DamageAmumuE.cs create mode 100644 source/Damage/Spells/Amumu/DamageAmumuQ.cs create mode 100644 source/Damage/Spells/Amumu/DamageAmumuR.cs create mode 100644 source/Damage/Spells/Amumu/DamageAmumuW.cs create mode 100644 source/Damage/Spells/Anivia/DamageAniviaE.cs create mode 100644 source/Damage/Spells/Anivia/DamageAniviaQ.cs create mode 100644 source/Damage/Spells/Anivia/DamageAniviaQ1.cs create mode 100644 source/Damage/Spells/Anivia/DamageAniviaR.cs create mode 100644 source/Damage/Spells/Annie/DamageAnnieQ.cs create mode 100644 source/Damage/Spells/Annie/DamageAnnieR.cs create mode 100644 source/Damage/Spells/Annie/DamageAnnieW.cs create mode 100644 source/Damage/Spells/Ashe/DamageAsheR.cs create mode 100644 source/Damage/Spells/Ashe/DamageAsheR1.cs create mode 100644 source/Damage/Spells/Ashe/DamageAsheW.cs create mode 100644 source/Damage/Spells/Azir/DamageAzirE.cs create mode 100644 source/Damage/Spells/Azir/DamageAzirQ.cs create mode 100644 source/Damage/Spells/Azir/DamageAzirR.cs create mode 100644 source/Damage/Spells/Azir/DamageAzirW.cs create mode 100644 source/Damage/Spells/Bard/DamageBardQ.cs create mode 100644 source/Damage/Spells/Blitzcrank/DamageBlitzcrankE.cs create mode 100644 source/Damage/Spells/Blitzcrank/DamageBlitzcrankQ.cs create mode 100644 source/Damage/Spells/Blitzcrank/DamageBlitzcrankR.cs create mode 100644 source/Damage/Spells/Brand/DamageBrandE.cs create mode 100644 source/Damage/Spells/Brand/DamageBrandQ.cs create mode 100644 source/Damage/Spells/Brand/DamageBrandR.cs create mode 100644 source/Damage/Spells/Brand/DamageBrandW.cs create mode 100644 source/Damage/Spells/Braum/DamageBraumQ.cs create mode 100644 source/Damage/Spells/Braum/DamageBraumR.cs create mode 100644 source/Damage/Spells/Caitlyn/DamageCaitlynE.cs create mode 100644 source/Damage/Spells/Caitlyn/DamageCaitlynQ.cs create mode 100644 source/Damage/Spells/Caitlyn/DamageCaitlynR.cs create mode 100644 source/Damage/Spells/Cassiopeia/DamageCassiopeiaE.cs create mode 100644 source/Damage/Spells/Cassiopeia/DamageCassiopeiaQ.cs create mode 100644 source/Damage/Spells/Cassiopeia/DamageCassiopeiaR.cs create mode 100644 source/Damage/Spells/Cassiopeia/DamageCassiopeiaW.cs create mode 100644 source/Damage/Spells/ChoGath/DamageChoGathE.cs create mode 100644 source/Damage/Spells/ChoGath/DamageChoGathQ.cs create mode 100644 source/Damage/Spells/ChoGath/DamageChoGathR.cs create mode 100644 source/Damage/Spells/ChoGath/DamageChoGathW.cs create mode 100644 source/Damage/Spells/Corki/DamageCorkiE.cs create mode 100644 source/Damage/Spells/Corki/DamageCorkiQ.cs create mode 100644 source/Damage/Spells/Corki/DamageCorkiR.cs create mode 100644 source/Damage/Spells/Corki/DamageCorkiR1.cs create mode 100644 source/Damage/Spells/Corki/DamageCorkiW.cs create mode 100644 source/Damage/Spells/Corki/DamageCorkiW1.cs create mode 100644 source/Damage/Spells/Darius/DamageDariusQ.cs create mode 100644 source/Damage/Spells/Darius/DamageDariusR.cs create mode 100644 source/Damage/Spells/Darius/DamageDariusW.cs create mode 100644 source/Damage/Spells/Diana/DamageDianaQ.cs create mode 100644 source/Damage/Spells/Diana/DamageDianaR.cs create mode 100644 source/Damage/Spells/Diana/DamageDianaW.cs create mode 100644 source/Damage/Spells/DrMundo/DamageDrMundoQ.cs create mode 100644 source/Damage/Spells/Draven/DamageDravenE.cs create mode 100644 source/Damage/Spells/Draven/DamageDravenQ.cs create mode 100644 source/Damage/Spells/Draven/DamageDravenR.cs create mode 100644 source/Damage/Spells/Ekko/DamageEkkoE.cs create mode 100644 source/Damage/Spells/Ekko/DamageEkkoQ.cs create mode 100644 source/Damage/Spells/Ekko/DamageEkkoQ1.cs create mode 100644 source/Damage/Spells/Ekko/DamageEkkoW.cs create mode 100644 source/Damage/Spells/Elise/DamageEliseQ.cs create mode 100644 source/Damage/Spells/Elise/DamageEliseQ1.cs create mode 100644 source/Damage/Spells/Elise/DamageEliseW.cs create mode 100644 source/Damage/Spells/Evelynn/DamageEvelynnE.cs create mode 100644 source/Damage/Spells/Evelynn/DamageEvelynnQ.cs create mode 100644 source/Damage/Spells/Evelynn/DamageEvelynnR.cs create mode 100644 source/Damage/Spells/ExportDamageMetadataAttribute.cs create mode 100644 source/Damage/Spells/Ezreal/DamageEzrealE.cs create mode 100644 source/Damage/Spells/Ezreal/DamageEzrealQ.cs create mode 100644 source/Damage/Spells/Ezreal/DamageEzrealR.cs create mode 100644 source/Damage/Spells/Ezreal/DamageEzrealW.cs create mode 100644 source/Damage/Spells/Fiddlesticks/DamageFiddlesticksE.cs create mode 100644 source/Damage/Spells/Fiddlesticks/DamageFiddlesticksR.cs create mode 100644 source/Damage/Spells/Fiddlesticks/DamageFiddlesticksW.cs create mode 100644 source/Damage/Spells/Fiora/DamageFioraQ.cs create mode 100644 source/Damage/Spells/Fiora/DamageFioraW.cs create mode 100644 source/Damage/Spells/Fizz/DamageFizzE.cs create mode 100644 source/Damage/Spells/Fizz/DamageFizzQ.cs create mode 100644 source/Damage/Spells/Fizz/DamageFizzR.cs create mode 100644 source/Damage/Spells/Fizz/DamageFizzW.cs create mode 100644 source/Damage/Spells/Galio/DamageGalioE.cs create mode 100644 source/Damage/Spells/Galio/DamageGalioQ.cs create mode 100644 source/Damage/Spells/Galio/DamageGalioR.cs create mode 100644 source/Damage/Spells/GangPlank/DamageGangPlankQ.cs create mode 100644 source/Damage/Spells/GangPlank/DamageGangPlankR.cs create mode 100644 source/Damage/Spells/Garen/DamageGarenE.cs create mode 100644 source/Damage/Spells/Garen/DamageGarenQ.cs create mode 100644 source/Damage/Spells/Garen/DamageGarenR.cs create mode 100644 source/Damage/Spells/Gnar/DamageGnarE.cs create mode 100644 source/Damage/Spells/Gnar/DamageGnarE1.cs create mode 100644 source/Damage/Spells/Gnar/DamageGnarQ.cs create mode 100644 source/Damage/Spells/Gnar/DamageGnarQ1.cs create mode 100644 source/Damage/Spells/Gnar/DamageGnarR.cs create mode 100644 source/Damage/Spells/Gnar/DamageGnarW.cs create mode 100644 source/Damage/Spells/Gnar/DamageGnarW1.cs create mode 100644 source/Damage/Spells/Gragas/DamageGragasE.cs create mode 100644 source/Damage/Spells/Gragas/DamageGragasQ.cs create mode 100644 source/Damage/Spells/Gragas/DamageGragasR.cs create mode 100644 source/Damage/Spells/Gragas/DamageGragasW.cs create mode 100644 source/Damage/Spells/Graves/DamageGravesQ.cs create mode 100644 source/Damage/Spells/Graves/DamageGravesQ1.cs create mode 100644 source/Damage/Spells/Graves/DamageGravesR.cs create mode 100644 source/Damage/Spells/Graves/DamageGravesW.cs create mode 100644 source/Damage/Spells/Hecarim/DamageHecarimE.cs create mode 100644 source/Damage/Spells/Hecarim/DamageHecarimQ.cs create mode 100644 source/Damage/Spells/Hecarim/DamageHecarimR.cs create mode 100644 source/Damage/Spells/Hecarim/DamageHecarimW.cs create mode 100644 source/Damage/Spells/Heimerdinger/DamageHeimerdingerE.cs create mode 100644 source/Damage/Spells/Heimerdinger/DamageHeimerdingerE1.cs create mode 100644 source/Damage/Spells/Heimerdinger/DamageHeimerdingerW.cs create mode 100644 source/Damage/Spells/Heimerdinger/DamageHeimerdingerW1.cs create mode 100644 source/Damage/Spells/IDamageSpellMetadata.cs create mode 100644 source/Damage/Spells/Irelia/DamageIreliaE.cs create mode 100644 source/Damage/Spells/Irelia/DamageIreliaQ.cs create mode 100644 source/Damage/Spells/Irelia/DamageIreliaR.cs create mode 100644 source/Damage/Spells/Irelia/DamageIreliaW.cs create mode 100644 source/Damage/Spells/Janna/DamageJannaQ.cs create mode 100644 source/Damage/Spells/Janna/DamageJannaW.cs create mode 100644 source/Damage/Spells/JarvanIV/DamageJarvanIVE.cs create mode 100644 source/Damage/Spells/JarvanIV/DamageJarvanIVQ.cs create mode 100644 source/Damage/Spells/JarvanIV/DamageJarvanIVR.cs create mode 100644 source/Damage/Spells/Jax/DamageJaxE.cs create mode 100644 source/Damage/Spells/Jax/DamageJaxQ.cs create mode 100644 source/Damage/Spells/Jax/DamageJaxR.cs create mode 100644 source/Damage/Spells/Jax/DamageJaxW.cs create mode 100644 source/Damage/Spells/Jayce/DamageJayceE.cs create mode 100644 source/Damage/Spells/Jayce/DamageJayceQ.cs create mode 100644 source/Damage/Spells/Jayce/DamageJayceQ1.cs create mode 100644 source/Damage/Spells/Jayce/DamageJayceW.cs create mode 100644 source/Damage/Spells/Jhin/DamageJhinE.cs create mode 100644 source/Damage/Spells/Jhin/DamageJhinQ.cs create mode 100644 source/Damage/Spells/Jhin/DamageJhinR.cs create mode 100644 source/Damage/Spells/Jhin/DamageJhinR1.cs create mode 100644 source/Damage/Spells/Jhin/DamageJhinW.cs create mode 100644 source/Damage/Spells/Jinx/DamageJinxE.cs create mode 100644 source/Damage/Spells/Jinx/DamageJinxQ.cs create mode 100644 source/Damage/Spells/Jinx/DamageJinxR.cs create mode 100644 source/Damage/Spells/Jinx/DamageJinxR1.cs create mode 100644 source/Damage/Spells/Jinx/DamageJinxW.cs create mode 100644 source/Damage/Spells/Kalista/DamageKalistaE.cs create mode 100644 source/Damage/Spells/Kalista/DamageKalistaQ.cs create mode 100644 source/Damage/Spells/Kalista/DamageKalistaW.cs create mode 100644 source/Damage/Spells/Karma/DamageKarmaQ.cs create mode 100644 source/Damage/Spells/Karma/DamageKarmaQ1.cs create mode 100644 source/Damage/Spells/Karma/DamageKarmaW.cs create mode 100644 source/Damage/Spells/Karma/DamageKarmaW1.cs create mode 100644 source/Damage/Spells/Karthus/DamageKarthusE.cs create mode 100644 source/Damage/Spells/Karthus/DamageKarthusQ.cs create mode 100644 source/Damage/Spells/Karthus/DamageKarthusQ1.cs create mode 100644 source/Damage/Spells/Karthus/DamageKarthusR.cs create mode 100644 source/Damage/Spells/Kassadin/DamageKassadinE.cs create mode 100644 source/Damage/Spells/Kassadin/DamageKassadinQ.cs create mode 100644 source/Damage/Spells/Kassadin/DamageKassadinR.cs create mode 100644 source/Damage/Spells/Kassadin/DamageKassadinR1.cs create mode 100644 source/Damage/Spells/Kassadin/DamageKassadinW.cs create mode 100644 source/Damage/Spells/Kassadin/DamageKassadinW1.cs create mode 100644 source/Damage/Spells/Katarina/DamageKatarinaE.cs create mode 100644 source/Damage/Spells/Katarina/DamageKatarinaQ.cs create mode 100644 source/Damage/Spells/Katarina/DamageKatarinaQ1.cs create mode 100644 source/Damage/Spells/Katarina/DamageKatarinaR.cs create mode 100644 source/Damage/Spells/Katarina/DamageKatarinaR1.cs create mode 100644 source/Damage/Spells/Katarina/DamageKatarinaW.cs create mode 100644 source/Damage/Spells/Kayle/DamageKayleE.cs create mode 100644 source/Damage/Spells/Kayle/DamageKayleQ.cs create mode 100644 source/Damage/Spells/Kennen/DamageKennenE.cs create mode 100644 source/Damage/Spells/Kennen/DamageKennenQ.cs create mode 100644 source/Damage/Spells/Kennen/DamageKennenR.cs create mode 100644 source/Damage/Spells/Kennen/DamageKennenW.cs create mode 100644 source/Damage/Spells/Kennen/DamageKennenW1.cs create mode 100644 source/Damage/Spells/KhaZix/DamageKhaZixE.cs create mode 100644 source/Damage/Spells/KhaZix/DamageKhaZixQ.cs create mode 100644 source/Damage/Spells/KhaZix/DamageKhaZixQ1.cs create mode 100644 source/Damage/Spells/KhaZix/DamageKhaZixQ2.cs create mode 100644 source/Damage/Spells/KhaZix/DamageKhaZixQ3.cs create mode 100644 source/Damage/Spells/KhaZix/DamageKhaZixW.cs create mode 100644 source/Damage/Spells/Kindred/DamageKindredE.cs create mode 100644 source/Damage/Spells/Kindred/DamageKindredQ.cs create mode 100644 source/Damage/Spells/Kindred/DamageKindredW.cs create mode 100644 source/Damage/Spells/KogMaw/DamageKogMawE.cs create mode 100644 source/Damage/Spells/KogMaw/DamageKogMawQ.cs create mode 100644 source/Damage/Spells/KogMaw/DamageKogMawR.cs create mode 100644 source/Damage/Spells/KogMaw/DamageKogMawW.cs create mode 100644 source/Damage/Spells/LeBlanc/DamageLeBlancE.cs create mode 100644 source/Damage/Spells/LeBlanc/DamageLeBlancQ.cs create mode 100644 source/Damage/Spells/LeBlanc/DamageLeBlancQ1.cs create mode 100644 source/Damage/Spells/LeBlanc/DamageLeBlancW.cs create mode 100644 source/Damage/Spells/LeeSin/DamageLeeSinE.cs create mode 100644 source/Damage/Spells/LeeSin/DamageLeeSinQ.cs create mode 100644 source/Damage/Spells/LeeSin/DamageLeeSinQ1.cs create mode 100644 source/Damage/Spells/LeeSin/DamageLeeSinR.cs create mode 100644 source/Damage/Spells/Leona/DamageLeonaE.cs create mode 100644 source/Damage/Spells/Leona/DamageLeonaQ.cs create mode 100644 source/Damage/Spells/Leona/DamageLeonaR.cs create mode 100644 source/Damage/Spells/Leona/DamageLeonaW.cs create mode 100644 source/Damage/Spells/Lissandra/DamageLissandraE.cs create mode 100644 source/Damage/Spells/Lissandra/DamageLissandraQ.cs create mode 100644 source/Damage/Spells/Lissandra/DamageLissandraR.cs create mode 100644 source/Damage/Spells/Lissandra/DamageLissandraW.cs create mode 100644 source/Damage/Spells/Lucian/DamageLucianQ.cs create mode 100644 source/Damage/Spells/Lucian/DamageLucianR.cs create mode 100644 source/Damage/Spells/Lucian/DamageLucianW.cs create mode 100644 source/Damage/Spells/Lulu/DamageLuluE.cs create mode 100644 source/Damage/Spells/Lulu/DamageLuluQ.cs create mode 100644 source/Damage/Spells/Lux/DamageLuxE.cs create mode 100644 source/Damage/Spells/Lux/DamageLuxQ.cs create mode 100644 source/Damage/Spells/Lux/DamageLuxR.cs create mode 100644 source/Damage/Spells/Malphite/DamageMalphiteE.cs create mode 100644 source/Damage/Spells/Malphite/DamageMalphiteQ.cs create mode 100644 source/Damage/Spells/Malphite/DamageMalphiteR.cs create mode 100644 source/Damage/Spells/Malphite/DamageMalphiteW.cs create mode 100644 source/Damage/Spells/Malzahar/DamageMalzaharE.cs create mode 100644 source/Damage/Spells/Malzahar/DamageMalzaharQ.cs create mode 100644 source/Damage/Spells/Malzahar/DamageMalzaharR.cs create mode 100644 source/Damage/Spells/Malzahar/DamageMalzaharW.cs create mode 100644 source/Damage/Spells/Maokai/DamageMaokaiE.cs create mode 100644 source/Damage/Spells/Maokai/DamageMaokaiE1.cs create mode 100644 source/Damage/Spells/Maokai/DamageMaokaiQ.cs create mode 100644 source/Damage/Spells/Maokai/DamageMaokaiR.cs create mode 100644 source/Damage/Spells/Maokai/DamageMaokaiW.cs create mode 100644 source/Damage/Spells/MasterYi/DamageMasterYiE.cs create mode 100644 source/Damage/Spells/MasterYi/DamageMasterYiQ.cs create mode 100644 source/Damage/Spells/MissFortune/DamageMissFortuneE.cs create mode 100644 source/Damage/Spells/MissFortune/DamageMissFortuneQ.cs create mode 100644 source/Damage/Spells/MissFortune/DamageMissFortuneQ1.cs create mode 100644 source/Damage/Spells/MissFortune/DamageMissFortuneR.cs create mode 100644 source/Damage/Spells/MissFortune/DamageMissFortuneW.cs create mode 100644 source/Damage/Spells/MonkeyKing/DamageMonkeyKingE.cs create mode 100644 source/Damage/Spells/MonkeyKing/DamageMonkeyKingQ.cs create mode 100644 source/Damage/Spells/MonkeyKing/DamageMonkeyKingR.cs create mode 100644 source/Damage/Spells/MonkeyKing/DamageMonkeyKingW.cs create mode 100644 source/Damage/Spells/Mordekaiser/DamageMordekaiserE.cs create mode 100644 source/Damage/Spells/Mordekaiser/DamageMordekaiserQ.cs create mode 100644 source/Damage/Spells/Mordekaiser/DamageMordekaiserR.cs create mode 100644 source/Damage/Spells/Mordekaiser/DamageMordekaiserW.cs create mode 100644 source/Damage/Spells/Morgana/DamageMorganaQ.cs create mode 100644 source/Damage/Spells/Morgana/DamageMorganaR.cs create mode 100644 source/Damage/Spells/Morgana/DamageMorganaW.cs create mode 100644 source/Damage/Spells/Nami/DamageNamiE.cs create mode 100644 source/Damage/Spells/Nami/DamageNamiQ.cs create mode 100644 source/Damage/Spells/Nami/DamageNamiR.cs create mode 100644 source/Damage/Spells/Nami/DamageNamiW.cs create mode 100644 source/Damage/Spells/Nasus/DamageNasusE.cs create mode 100644 source/Damage/Spells/Nasus/DamageNasusE1.cs create mode 100644 source/Damage/Spells/Nasus/DamageNasusQ.cs create mode 100644 source/Damage/Spells/Nasus/DamageNasusR.cs create mode 100644 source/Damage/Spells/Nautilus/DamageNautilusE.cs create mode 100644 source/Damage/Spells/Nautilus/DamageNautilusQ.cs create mode 100644 source/Damage/Spells/Nautilus/DamageNautilusR.cs create mode 100644 source/Damage/Spells/Nautilus/DamageNautilusR1.cs create mode 100644 source/Damage/Spells/Nautilus/DamageNautilusW.cs create mode 100644 source/Damage/Spells/Nidalee/DamageNidaleeE1.cs create mode 100644 source/Damage/Spells/Nidalee/DamageNidaleeQ.cs create mode 100644 source/Damage/Spells/Nidalee/DamageNidaleeQ1.cs create mode 100644 source/Damage/Spells/Nidalee/DamageNidaleeW.cs create mode 100644 source/Damage/Spells/Nidalee/DamageNidaleeW1.cs create mode 100644 source/Damage/Spells/Nocturne/DamageNocturneE.cs create mode 100644 source/Damage/Spells/Nocturne/DamageNocturneQ.cs create mode 100644 source/Damage/Spells/Nocturne/DamageNocturneR.cs create mode 100644 source/Damage/Spells/Nunu/DamageNunuE.cs create mode 100644 source/Damage/Spells/Nunu/DamageNunuQ.cs create mode 100644 source/Damage/Spells/Nunu/DamageNunuR.cs create mode 100644 source/Damage/Spells/Olaf/DamageOlafE.cs create mode 100644 source/Damage/Spells/Olaf/DamageOlafQ.cs create mode 100644 source/Damage/Spells/Orianna/DamageOriannaE.cs create mode 100644 source/Damage/Spells/Orianna/DamageOriannaQ.cs create mode 100644 source/Damage/Spells/Orianna/DamageOriannaR.cs create mode 100644 source/Damage/Spells/Orianna/DamageOriannaW.cs create mode 100644 source/Damage/Spells/Pantheon/DamagePantheonE.cs create mode 100644 source/Damage/Spells/Pantheon/DamagePantheonQ.cs create mode 100644 source/Damage/Spells/Pantheon/DamagePantheonR.cs create mode 100644 source/Damage/Spells/Pantheon/DamagePantheonR1.cs create mode 100644 source/Damage/Spells/Pantheon/DamagePantheonW.cs create mode 100644 source/Damage/Spells/Poppy/DamagePoppyE.cs create mode 100644 source/Damage/Spells/Poppy/DamagePoppyE1.cs create mode 100644 source/Damage/Spells/Poppy/DamagePoppyQ.cs create mode 100644 source/Damage/Spells/Poppy/DamagePoppyQ1.cs create mode 100644 source/Damage/Spells/Poppy/DamagePoppyR.cs create mode 100644 source/Damage/Spells/Poppy/DamagePoppyW.cs create mode 100644 source/Damage/Spells/Quinn/DamageQuinnE.cs create mode 100644 source/Damage/Spells/Quinn/DamageQuinnQ.cs create mode 100644 source/Damage/Spells/Quinn/DamageQuinnR.cs create mode 100644 source/Damage/Spells/Rammus/DamageRammusQ.cs create mode 100644 source/Damage/Spells/Rammus/DamageRammusR.cs create mode 100644 source/Damage/Spells/Rammus/DamageRammusW.cs create mode 100644 source/Damage/Spells/Renekton/DamageRenektonE.cs create mode 100644 source/Damage/Spells/Renekton/DamageRenektonQ.cs create mode 100644 source/Damage/Spells/Renekton/DamageRenektonQ1.cs create mode 100644 source/Damage/Spells/Renekton/DamageRenektonR.cs create mode 100644 source/Damage/Spells/Renekton/DamageRenektonW.cs create mode 100644 source/Damage/Spells/Renekton/DamageRenektonW1.cs create mode 100644 source/Damage/Spells/Rengar/DamageRengarE.cs create mode 100644 source/Damage/Spells/Rengar/DamageRengarQ.cs create mode 100644 source/Damage/Spells/Rengar/DamageRengarW.cs create mode 100644 source/Damage/Spells/Riven/DamageRivenQ.cs create mode 100644 source/Damage/Spells/Riven/DamageRivenR.cs create mode 100644 source/Damage/Spells/Riven/DamageRivenW.cs create mode 100644 source/Damage/Spells/Rumble/DamageRumbleE.cs create mode 100644 source/Damage/Spells/Rumble/DamageRumbleE1.cs create mode 100644 source/Damage/Spells/Rumble/DamageRumbleQ.cs create mode 100644 source/Damage/Spells/Rumble/DamageRumbleQ1.cs create mode 100644 source/Damage/Spells/Rumble/DamageRumbleR.cs create mode 100644 source/Damage/Spells/Rumble/DamageRumbleR1.cs create mode 100644 source/Damage/Spells/Ryze/DamageRyzeE.cs create mode 100644 source/Damage/Spells/Ryze/DamageRyzeQ.cs create mode 100644 source/Damage/Spells/Ryze/DamageRyzeW.cs create mode 100644 source/Damage/Spells/Sejuani/DamageSejuaniE.cs create mode 100644 source/Damage/Spells/Sejuani/DamageSejuaniQ.cs create mode 100644 source/Damage/Spells/Sejuani/DamageSejuaniR.cs create mode 100644 source/Damage/Spells/Sejuani/DamageSejuaniW.cs create mode 100644 source/Damage/Spells/Sejuani/DamageSejuaniW1.cs create mode 100644 source/Damage/Spells/Shaco/DamageShacoE.cs create mode 100644 source/Damage/Spells/Shaco/DamageShacoQ.cs create mode 100644 source/Damage/Spells/Shaco/DamageShacoR.cs create mode 100644 source/Damage/Spells/Shaco/DamageShacoW.cs create mode 100644 source/Damage/Spells/Shen/DamageShenE.cs create mode 100644 source/Damage/Spells/Shen/DamageShenQ.cs create mode 100644 source/Damage/Spells/Shen/DamageShenQ1.cs create mode 100644 source/Damage/Spells/Shyvana/DamageShyvanaE.cs create mode 100644 source/Damage/Spells/Shyvana/DamageShyvanaQ.cs create mode 100644 source/Damage/Spells/Shyvana/DamageShyvanaR.cs create mode 100644 source/Damage/Spells/Shyvana/DamageShyvanaW.cs create mode 100644 source/Damage/Spells/Singed/DamageSingedE.cs create mode 100644 source/Damage/Spells/Singed/DamageSingedQ.cs create mode 100644 source/Damage/Spells/Sion/DamageSionE.cs create mode 100644 source/Damage/Spells/Sion/DamageSionE1.cs create mode 100644 source/Damage/Spells/Sion/DamageSionQ.cs create mode 100644 source/Damage/Spells/Sion/DamageSionQ1.cs create mode 100644 source/Damage/Spells/Sion/DamageSionR.cs create mode 100644 source/Damage/Spells/Sion/DamageSionR1.cs create mode 100644 source/Damage/Spells/Sion/DamageSionW.cs create mode 100644 source/Damage/Spells/Sivir/DamageSivirQ.cs create mode 100644 source/Damage/Spells/Sivir/DamageSivirW.cs create mode 100644 source/Damage/Spells/Skarner/DamageSkarnerE.cs create mode 100644 source/Damage/Spells/Skarner/DamageSkarnerQ.cs create mode 100644 source/Damage/Spells/Skarner/DamageSkarnerR.cs create mode 100644 source/Damage/Spells/Sona/DamageSonaQ.cs create mode 100644 source/Damage/Spells/Sona/DamageSonaR.cs create mode 100644 source/Damage/Spells/Soraka/DamageSorakaE.cs create mode 100644 source/Damage/Spells/Soraka/DamageSorakaQ.cs create mode 100644 source/Damage/Spells/Swain/DamageSwainE.cs create mode 100644 source/Damage/Spells/Swain/DamageSwainQ.cs create mode 100644 source/Damage/Spells/Swain/DamageSwainR.cs create mode 100644 source/Damage/Spells/Swain/DamageSwainW.cs create mode 100644 source/Damage/Spells/Syndra/DamageSyndraE.cs create mode 100644 source/Damage/Spells/Syndra/DamageSyndraQ.cs create mode 100644 source/Damage/Spells/Syndra/DamageSyndraR.cs create mode 100644 source/Damage/Spells/Syndra/DamageSyndraR1.cs create mode 100644 source/Damage/Spells/Syndra/DamageSyndraW.cs create mode 100644 source/Damage/Spells/TahmKench/DamageTahmKenchQ.cs create mode 100644 source/Damage/Spells/TahmKench/DamageTahmKenchW.cs create mode 100644 source/Damage/Spells/TahmKench/DamageTahmKenchW1.cs create mode 100644 source/Damage/Spells/Talon/DamageTalonQ.cs create mode 100644 source/Damage/Spells/Talon/DamageTalonR.cs create mode 100644 source/Damage/Spells/Talon/DamageTalonW.cs create mode 100644 source/Damage/Spells/Taric/DamageTaricE.cs create mode 100644 source/Damage/Spells/Taric/DamageTaricR.cs create mode 100644 source/Damage/Spells/Taric/DamageTaricW.cs create mode 100644 source/Damage/Spells/Teemo/DamageTeemoE.cs create mode 100644 source/Damage/Spells/Teemo/DamageTeemoE1.cs create mode 100644 source/Damage/Spells/Teemo/DamageTeemoQ.cs create mode 100644 source/Damage/Spells/Teemo/DamageTeemoR.cs create mode 100644 source/Damage/Spells/Thresh/DamageThreshE.cs create mode 100644 source/Damage/Spells/Thresh/DamageThreshQ.cs create mode 100644 source/Damage/Spells/Thresh/DamageThreshR.cs create mode 100644 source/Damage/Spells/Tristana/DamageTristanaE.cs create mode 100644 source/Damage/Spells/Tristana/DamageTristanaR.cs create mode 100644 source/Damage/Spells/Tristana/DamageTristanaW.cs create mode 100644 source/Damage/Spells/Trundle/DamageTrundleQ.cs create mode 100644 source/Damage/Spells/Trundle/DamageTrundleR.cs create mode 100644 source/Damage/Spells/Tryndamere/DamageTryndamereE.cs create mode 100644 source/Damage/Spells/TwistedFate/DamageTwistedFateE.cs create mode 100644 source/Damage/Spells/TwistedFate/DamageTwistedFateQ.cs create mode 100644 source/Damage/Spells/TwistedFate/DamageTwistedFateW.cs create mode 100644 source/Damage/Spells/TwistedFate/DamageTwistedFateW1.cs create mode 100644 source/Damage/Spells/TwistedFate/DamageTwistedFateW2.cs create mode 100644 source/Damage/Spells/Twitch/DamageTwitchE.cs create mode 100644 source/Damage/Spells/Twitch/DamageTwitchE1.cs create mode 100644 source/Damage/Spells/Udyr/DamageUdyrQ.cs create mode 100644 source/Damage/Spells/Udyr/DamageUdyrR.cs create mode 100644 source/Damage/Spells/Urgot/DamageUrgotE.cs create mode 100644 source/Damage/Spells/Urgot/DamageUrgotQ.cs create mode 100644 source/Damage/Spells/Varus/DamageVarusE.cs create mode 100644 source/Damage/Spells/Varus/DamageVarusQ.cs create mode 100644 source/Damage/Spells/Varus/DamageVarusQ1.cs create mode 100644 source/Damage/Spells/Varus/DamageVarusR.cs create mode 100644 source/Damage/Spells/Varus/DamageVarusW.cs create mode 100644 source/Damage/Spells/Varus/DamageVarusW1.cs create mode 100644 source/Damage/Spells/Vayne/DamageVayneE.cs create mode 100644 source/Damage/Spells/Vayne/DamageVayneQ.cs create mode 100644 source/Damage/Spells/Vayne/DamageVayneW.cs create mode 100644 source/Damage/Spells/Veigar/DamageVeigarQ.cs create mode 100644 source/Damage/Spells/Veigar/DamageVeigarR.cs create mode 100644 source/Damage/Spells/Veigar/DamageVeigarW.cs create mode 100644 source/Damage/Spells/Velkoz/DamageVelkozE.cs create mode 100644 source/Damage/Spells/Velkoz/DamageVelkozQ.cs create mode 100644 source/Damage/Spells/Velkoz/DamageVelkozR.cs create mode 100644 source/Damage/Spells/Velkoz/DamageVelkozW.cs create mode 100644 source/Damage/Spells/Vi/DamageViE.cs create mode 100644 source/Damage/Spells/Vi/DamageViQ.cs create mode 100644 source/Damage/Spells/Vi/DamageViR.cs create mode 100644 source/Damage/Spells/Vi/DamageViW.cs create mode 100644 source/Damage/Spells/Viktor/DamageViktorE.cs create mode 100644 source/Damage/Spells/Viktor/DamageViktorE1.cs create mode 100644 source/Damage/Spells/Viktor/DamageViktorQ.cs create mode 100644 source/Damage/Spells/Viktor/DamageViktorR.cs create mode 100644 source/Damage/Spells/Viktor/DamageViktorR1.cs create mode 100644 source/Damage/Spells/Vladimir/DamageVladimirE.cs create mode 100644 source/Damage/Spells/Vladimir/DamageVladimirQ.cs create mode 100644 source/Damage/Spells/Vladimir/DamageVladimirR.cs create mode 100644 source/Damage/Spells/Vladimir/DamageVladimirW.cs create mode 100644 source/Damage/Spells/Volibear/DamageVolibearE.cs create mode 100644 source/Damage/Spells/Volibear/DamageVolibearQ.cs create mode 100644 source/Damage/Spells/Volibear/DamageVolibearR.cs create mode 100644 source/Damage/Spells/Volibear/DamageVolibearW.cs create mode 100644 source/Damage/Spells/Warwick/DamageWarwickQ.cs create mode 100644 source/Damage/Spells/Warwick/DamageWarwickR.cs create mode 100644 source/Damage/Spells/Xerath/DamageXerathE.cs create mode 100644 source/Damage/Spells/Xerath/DamageXerathQ.cs create mode 100644 source/Damage/Spells/Xerath/DamageXerathR.cs create mode 100644 source/Damage/Spells/Xerath/DamageXerathW.cs create mode 100644 source/Damage/Spells/XinZhao/DamageXinZhaoE.cs create mode 100644 source/Damage/Spells/XinZhao/DamageXinZhaoQ.cs create mode 100644 source/Damage/Spells/XinZhao/DamageXinZhaoR.cs create mode 100644 source/Damage/Spells/Yasuo/DamageYasuoE.cs create mode 100644 source/Damage/Spells/Yasuo/DamageYasuoQ.cs create mode 100644 source/Damage/Spells/Yasuo/DamageYasuoR.cs create mode 100644 source/Damage/Spells/Yorick/DamageYorickE.cs create mode 100644 source/Damage/Spells/Yorick/DamageYorickQ.cs create mode 100644 source/Damage/Spells/Yorick/DamageYorickW.cs create mode 100644 source/Damage/Spells/Zac/DamageZacE.cs create mode 100644 source/Damage/Spells/Zac/DamageZacQ.cs create mode 100644 source/Damage/Spells/Zac/DamageZacR.cs create mode 100644 source/Damage/Spells/Zac/DamageZacW.cs create mode 100644 source/Damage/Spells/Zed/DamageZedE.cs create mode 100644 source/Damage/Spells/Zed/DamageZedQ.cs create mode 100644 source/Damage/Spells/Zed/DamageZedR.cs create mode 100644 source/Damage/Spells/Ziggs/DamageZiggsE.cs create mode 100644 source/Damage/Spells/Ziggs/DamageZiggsQ.cs create mode 100644 source/Damage/Spells/Ziggs/DamageZiggsR.cs create mode 100644 source/Damage/Spells/Ziggs/DamageZiggsW.cs create mode 100644 source/Damage/Spells/Zilean/DamageZileanQ.cs create mode 100644 source/Damage/Spells/Zyra/DamageZyraE.cs create mode 100644 source/Damage/Spells/Zyra/DamageZyraQ.cs create mode 100644 source/Damage/Spells/Zyra/DamageZyraR.cs create mode 100644 source/Damage/SummonerSpell.cs create mode 100644 source/Damage/SummonerSpells/ISummonerSpell.cs create mode 100644 source/Damage/SummonerSpells/ISummonerSpellMetadata.cs create mode 100644 source/Damage/SummonerSpells/SummonerSpellIgnite.cs create mode 100644 source/Damage/SummonerSpells/SummonerSpellSmite.cs create mode 100644 source/Dash/Dash.cs create mode 100644 source/Dash/DashAdapter.cs create mode 100644 source/Dash/DashExtensions.cs create mode 100644 source/Dash/DashItem.cs create mode 100644 source/Events/GameEvents.cs create mode 100644 source/Events/OnDash.cs create mode 100644 source/Events/OnGameEnd.cs create mode 100644 source/Events/OnGameLoad.cs create mode 100644 source/Events/OnLevelUp.cs create mode 100644 source/Events/OnLevelUpSpell.cs create mode 100644 source/Events/UnitEvents.cs create mode 100644 source/Geometry/Arc.cs create mode 100644 source/Geometry/Circle.cs create mode 100644 source/Geometry/ConvexHull.cs create mode 100644 source/Geometry/Geometry.cs create mode 100644 source/Geometry/IntersectionResult.cs create mode 100644 source/Geometry/Line.cs create mode 100644 source/Geometry/MecCircle.cs create mode 100644 source/Geometry/MinMaxCornersInfo.cs create mode 100644 source/Geometry/Polygon.cs create mode 100644 source/Geometry/ProjectionInfo.cs create mode 100644 source/Geometry/Rectangle.cs create mode 100644 source/Geometry/Ring.cs create mode 100644 source/Geometry/Sector.cs create mode 100644 source/LeagueSharp.Common.csproj create mode 100644 source/LeagueSharp.Common.csproj.DotSettings create mode 100644 source/Library.cs create mode 100644 source/Minion/FarmLocation.cs create mode 100644 source/Minion/JungleType.cs create mode 100644 source/Minion/LaneType.cs create mode 100644 source/Minion/MinionInfo.cs create mode 100644 source/Minion/MinionManager.cs create mode 100644 source/Minion/MinionManagerAdapter.cs create mode 100644 source/Minion/MinionOrderTypes.cs create mode 100644 source/Minion/MinionTeam.cs create mode 100644 source/Minion/MinionTypes.cs create mode 100644 source/Native/BetterWebClient.cs create mode 100644 source/Native/Config.cs create mode 100644 source/Native/Shared.cs rename AutoLevel.cs => source/Old/AutoLevel.cs (100%) rename CustomizableAntiGapcloser.cs => source/Old/CustomizableAntiGapcloser.cs (100%) rename {Data => source/Old/Data}/ItemData.cs (100%) rename {Data => source/Old/Data}/MasteryData.cs (100%) rename {Data => source/Old/Data}/SpellDatabase.cs (100%) rename FakeClicks.cs => source/Old/FakeClicks.cs (100%) rename Hacks.cs => source/Old/Hacks.cs (100%) rename HealthPrediction.cs => source/Old/HealthPrediction.cs (100%) rename HeroManager.cs => source/Old/HeroManager.cs (100%) rename Interrupter.cs => source/Old/Interrupter.cs (100%) rename Interrupter2.cs => source/Old/Interrupter2.cs (100%) rename Items.cs => source/Old/Items.cs (100%) rename LastCastedSpell.cs => source/Old/LastCastedSpell.cs (100%) rename MapPositions.cs => source/Old/MapPositions.cs (100%) rename {Menu => source/Old/Menu}/CPSlider.cs (100%) rename {Menu => source/Old/Menu}/Circle.cs (100%) rename {Menu => source/Old/Menu}/ColorPicker.cs (100%) rename {Menu => source/Old/Menu}/CommonMenu.cs (100%) rename {Menu => source/Old/Menu}/HSLColor.cs (100%) rename {Menu => source/Old/Menu}/KeyBind.cs (100%) rename {Menu => source/Old/Menu}/KeyBindType.cs (100%) rename {Menu => source/Old/Menu}/KeybindSetStage.cs (100%) rename {Menu => source/Old/Menu}/Menu.cs (100%) rename {Menu => source/Old/Menu}/MenuDrawHelper.cs (100%) rename {Menu => source/Old/Menu}/MenuGlobals.cs (100%) rename {Menu => source/Old/Menu}/MenuItem.cs (100%) rename {Menu => source/Old/Menu}/MenuSettings.cs (100%) rename {Menu => source/Old/Menu}/MenuValueType.cs (100%) rename {Menu => source/Old/Menu}/OnValueChangeEventArgs.cs (100%) rename {Menu => source/Old/Menu}/SavedSettings.cs (100%) rename {Menu => source/Old/Menu}/Slider.cs (100%) rename {Menu => source/Old/Menu}/StringList.cs (100%) rename MenuWrapper.cs => source/Old/MenuWrapper.cs (100%) rename MultiLanguage.cs => source/Old/MultiLanguage.cs (100%) rename Notifications.cs => source/Old/Notifications.cs (100%) rename {Notifications => source/Old/Notifications}/INotification.cs (100%) rename {Notifications => source/Old/Notifications}/Notification.cs (100%) rename ObjectHandler.cs => source/Old/ObjectHandler.cs (100%) rename Orbwalking.cs => source/Old/Orbwalking.cs (100%) rename PermaShow.cs => source/Old/PermaShow.cs (100%) rename Spell.cs => source/Old/Spell.cs (100%) rename TargetSelector.cs => source/Old/TargetSelector.cs (100%) create mode 100644 source/Packets/GamePacket.cs create mode 100644 source/Prediction/CollisionableObjects.cs create mode 100644 source/Prediction/HitChance.cs create mode 100644 source/Prediction/Old/AoePrediction.cs create mode 100644 source/Prediction/Old/Collision.cs create mode 100644 source/Prediction/Old/Prediction.cs create mode 100644 source/Prediction/PathTracker.cs create mode 100644 source/Prediction/PredictionInput.cs create mode 100644 source/Prediction/PredictionOutput.cs create mode 100644 source/Prediction/SkillshotType.cs create mode 100644 source/Prediction/StoredPath.cs create mode 100644 source/Properties/AssemblyInfo.cs rename {Properties => source/Properties}/Resources.Designer.cs (67%) create mode 100644 source/Properties/Resources.resx create mode 100644 source/Render/Alerter.cs create mode 100644 source/Render/Circle.cs create mode 100644 source/Render/CircleEffect.cs create mode 100644 source/Render/FontExtension.cs create mode 100644 source/Render/Line.cs create mode 100644 source/Render/Rectangle.cs create mode 100644 source/Render/Render.cs create mode 100644 source/Render/RenderObject.cs create mode 100644 source/Render/Sprite.cs create mode 100644 source/Render/Text.cs rename {Resources => source/Resources}/CPForm.png (100%) rename Properties/Resources.resx => source/Resources/ChineseJson.json (99%) create mode 100644 source/Resources/CircleEffect.fx rename {Resources => source/Resources}/SliderActive.png (100%) rename {Resources => source/Resources}/SliderDisabled.png (100%) create mode 100644 source/Utility/DelayAction.cs create mode 100644 source/Utility/HpBarDamageIndicator.cs create mode 100644 source/Utility/Map.cs create mode 100644 source/Utility/MapAdapter.cs create mode 100644 source/Utility/Maps/IMap.cs create mode 100644 source/Utility/Maps/IMapMetadata.cs create mode 100644 source/Utility/Maps/MapCrystalScar.cs create mode 100644 source/Utility/Maps/MapHowlingAbyss.cs create mode 100644 source/Utility/Maps/MapSummonersRift.cs create mode 100644 source/Utility/Maps/MapTwistedTreeline.cs create mode 100644 source/Utility/Maps/MapUnknown.cs create mode 100644 source/Utility/MiniCache.cs create mode 100644 source/Utility/Utility.cs create mode 100644 source/Utility/Vector2Time.cs create mode 100644 source/Utility/Version.cs create mode 100644 source/Utility/WaypointTracker.cs rename {Utils => source/Utils}/Cursor.cs (86%) rename {Utils => source/Utils}/EnumerableExtensions.cs (58%) rename {Utils => source/Utils}/KeyboardEvents.cs (78%) rename {Utils => source/Utils}/Keys.cs (99%) rename {Utils => source/Utils}/MouseEvents.cs (68%) rename {Utils => source/Utils}/NativeMethods.cs (95%) rename {Utils => source/Utils}/Utils.cs (76%) rename {Utils => source/Utils}/VirtualMouse.cs (77%) rename {Utils => source/Utils}/WeightedRandom.cs (85%) rename {Utils => source/Utils}/WindowsMessages.cs (99%) rename {Menu => source/Utils}/WndEventComposition.cs (90%) create mode 100644 source/packages.config 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..88fa4027 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ 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/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..d95f1dc1 --- /dev/null +++ b/LeagueSharp.Common.ruleset @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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/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/Packet.cs b/Packet.cs deleted file mode 100644 index f67290fe..00000000 --- a/Packet.cs +++ /dev/null @@ -1,5224 +0,0 @@ -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! - /// - [Obsolete("Jodus wears dirty socks", false)] - public static class Packet - { - #region Constructors and Destructors - - /// - /// Initializes static members of the class. - /// - static Packet() - { - Console.WriteLine( - @"LeagueSharp.Common.Packet will be removed soon, use LeagueSharp.Network.Packets instead"); - } - - #endregion - - #region Enums - - /// - /// The states of actions. - /// - public enum ActionStates - { - /// - /// The begin recall state - /// - BeginRecall = 111207118, - - /// - /// The finish recall state - /// - FinishRecall = 97690254, - } - - /// - /// The type of attack. - /// - public enum AttackTypePacket - { - /// - /// Circular skillshots. - /// - Circular = 0, - - /// - /// Cone and Skillshot spells - /// - ConeSkillShot = 1, - - /// - /// Targeted spells and AAs - /// - TargetedAA = 2, - } - - /// - /// The type of damage. - /// - public enum DamageTypePacket - { - /// - /// Magical Damage (AP) - /// - Magical = 4, - - /// - /// A Critical Attack - /// - CriticalAttack = 11, - - /// - /// Physical Damage (AD) - /// - Physical = 12, - - /// - /// True Damage - /// - True = 36, - } - - /// - /// Types of emotes. - /// - public enum Emotes - { - /// - /// Dance - /// - Dance = 0x00, - - /// - /// Joke - /// - Joke = 0x03, - - /// - /// Taunt - /// - Taunt = 0x01, - - /// - /// Laugh - /// - Laugh = 0x02, - } - - /// - /// Type of floating text on a hero. - /// - public enum FloatTextPacket - { - /// - /// Invulnerable - /// - Invulnerable, - - /// - /// Special - /// - Special, - - /// - /// Heal - /// - Heal, - - /// - /// Mana heal - /// - ManaHeal, - - /// - /// Mana Damage - /// - ManaDmg, - - /// - /// Dodge - /// - Dodge, - - /// - /// Critical - /// - Critical, - - /// - /// Experience - /// - Experience, - - /// - /// Gold - /// - Gold, - - /// - /// Level - /// - Level, - - /// - /// Disable - /// - Disable, - - /// - /// Quest Received - /// - QuestRecv, - - /// - /// Quest Done - /// - QuestDone, - - /// - /// Score - /// - Score, - - /// - /// Physical Damage - /// - PhysDmg, - - /// - /// Magic Damage - /// - MagicDmg, - - /// - /// True Damage - /// - TrueDmg, - - /// - /// Enemy Physical Damage - /// - EnemyPhysDmg, - - /// - /// Enemy Magic Damage - /// - EnemyMagicDmg, - - /// - /// Enemy True Damage - /// - EnemyTrueDmg, - - /// - /// Enemy Critical - /// - EnemyCritical, - - /// - /// Countdown - /// - Countdown, - - /// - /// Legacy - /// - Legacy, - - /// - /// Legacy critical - /// - LegacyCritical, - - /// - /// Debug - /// - Debug - } - - /// - /// 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 - /// - Unknown100 = 0x00, - - /// - /// The unknown101 - /// - Unknown101 = 0x01, - - /// - /// The unknown102 - /// - Unknown102 = 0x02, - - /// - /// The unknown115 - /// - Unknown115 = 0x15, - - /// - /// The unknown116 - /// - Unknown116 = 0x16, - - /// - /// The unknown124 - /// - Unknown124 = 0x24, - - /// - /// The unknown11 a - /// - Unknown11A = 0x1A, - - /// - /// The unknown11 e (Currently Empty) - /// - Unknown11E = 0x1E, - - /* These others could be packets with a handler */ - - /// - /// The unknown104. Somehow related to spell slots. - /// - Unknown104 = 0x04, - - /// - /// The unknown118. (Sion Ult) - /// - Unknown118 = 0x08, - - /// - /// The unknown120 - /// - Unknown120 = 0x20, // confirmed in game - - /// - /// 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. - /// - InitSpell = 0x07, - - /// - /// The unknown10 c. - /// - Unknown10C = 0x0C, //this packet is like 0x127 - - /// - /// The unknown122 - /// - Unknown122 = 0x22, - - /// - /// 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 - - /// - /// The NPC death packet - /// - NPCDeath = 0x26, //confirmed in ida, struct from intwars/ida - - /// - /// The unknown129. Related to spells. - /// - Unknown129 = 0x29, //related to spells (kalista ally unit), add? - - /// - /// 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 - /// - 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 - /// - Unknown12E = 0x2E, //confirmed in ida - - /// - /// The unknown12 f - /// - Unknown12F = 0x2F, //FE 05 00 00 40 2F 01 00 - - /// - /// The add buff packet. - /// - AddBuff = 0x09, // buff added by towers in new SR - - /// - /// The undo token packet - /// - UndoToken = 0x0B, - - /// - /// The object creation packet. Used for Azir's ult. - /// - ObjectCreation = 0x0D, // azir ult - - /// - /// The surrender state packet - /// - SurrenderState = 0x0E, - - /// - /// The on attack packet. - /// - OnAttack = 0x0F, - - /// - /// The death timer packet. - /// - DeathTimer = 0x17, - - /// - /// The change item packet. (EX: Health Potion to Biscuit) - /// - ChangeItem = 0x1C, //like hpp=>biscuit - - /// - /// The action state packet. Triggers on recall. - /// - ActionState = 0x21, // ?? triggers on recall - - /// - /// The undo confirmation packet. - /// - UndoConfirm = 0x27, - - /// - /// The lock camera packet for Sion's Ult. - /// - LockCamera = 0x2B, // Sion Ult - - /// - /// An unkown packet. - /// - Unknown = 0xFF, // Default, not real packet - } - - /// - /// The type of ping. - /// - public enum PingType - { - /// - /// A normal ping. - /// - Normal = 0, - - /// - /// A fallback ping. - /// - Fallback = 5, - - /// - /// An enemy missing ping. - /// - EnemyMissing = 3, - - /// - /// A danagr ping. - /// - Danger = 2, - - /// - /// An on my way ping. - /// - OnMyWay = 4, - - /// - /// An assist me ping. - /// - AssistMe = 6, - } - - #endregion - - /// - /// Contains packets that are sent from the client (the game) to the server. - /// - public static class C2S - { - /// - /// Packet sent when buying items. - /// - public static class BuyItem - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0xC6; - - #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(); - packet.Position = 2; - result.NetworkId = packet.ReadInteger(); - result.ItemId = 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); - result.WriteInteger(packetStruct.ItemId); - return result; - } - - #endregion - - /// - /// Reprents the packet sent when an item is bought. - /// - public struct Struct - { - #region Fields - - /// - /// The item identifier - /// - public int ItemId; - - /// - /// The network identifier - /// - public int NetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The item identifier. - /// The network identifier. - public Struct(int itemId, int networkId = -1) - { - this.ItemId = itemId; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - - #endregion - } - } - - /// - /// Sent by client on center/lock camera. - /// - public static class Camera - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x64; - - #endregion - } - - /// - /// Packet sent when casting spells. - /// - public static class Cast - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0xDE; - - #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(); - 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; - } - - /// - /// 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); - 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; - } - - #endregion - - #region Methods - - /// - /// Gets the spell byte. - /// - /// The spell. - /// System.Byte. - private static byte GetSpellByte(SpellSlot spell) - { - 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 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 - /// - public SpellSlot Slot; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - /// - /// The spell flag - /// - public byte SpellFlag; - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The end X position of where the spell is going to. - /// - public float ToX; - - /// - /// To end Y position of where the spell is going to. - /// - public float ToY; - - #endregion - - #region Constructors and Destructors - - /// - /// 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. - /// 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, - byte spellFlag = 0xFF) - { - 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; - } - - #endregion - } - } - - /// - /// Packet sent when casting charged spells second cast. - /// - public static class ChargedCast - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x03; - - #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(); - packet.Position = 2; - result.SourceNetworkId = packet.ReadInteger(); - result.Slot = (SpellSlot)packet.ReadByte(); - result.ToX = packet.ReadFloat(); - result.ToY = packet.ReadFloat(); - result.ToZ = packet.ReadFloat(); - return result; - } - - /// - /// Encodes the specified packet structure. - /// - /// 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; - } - - #endregion - - /// - /// Represents a charged cast packet. - /// - public struct Struct - { - #region Fields - - /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - /// - /// The X position of where the spell is going to. - /// - public float ToX; - - /// - /// The Y position of where the spell is going to. - /// - public float ToY; - - /// - /// The Z position of where the spell is going to. - /// - public float ToZ; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// 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.SourceNetworkId = (sourceNetworkId == -1) - ? ObjectManager.Player.NetworkId - : sourceNetworkId; - this.Slot = slot; - this.ToX = toX; - this.ToY = toY; - this.ToZ = toZ; - } - - #endregion - } - } - - /// - /// Packet sent when sending emotes. - /// - public static class Emote - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x14; - - #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(); - 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); - return result; - } - - #endregion - - /// - /// Represents the packet sent when you cast an emote. - /// - public struct Struct - { - #region Fields - - /// - /// The emote identifier - /// - public byte EmoteId; - - /// - /// The network identifier - /// - public int NetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The emote identifier. - /// The network identifier. - public Struct(byte emoteId, int networkId = -1) - { - this.EmoteId = emoteId; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - - #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 - } - - /// - /// Packet sent frequently as heartbeat to servers. - /// Related to 0x29 (Recv) - /// - public static class HeartBeat - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x4C; - - #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 { RecvTime = packet.ReadFloat(1), AckTime = packet.ReadFloat(5) }; - return result; - } - - #endregion - - /// - /// Represents a heart beat packet. - /// - public struct Struct - { - #region Fields - - /// - /// The ack time - /// - public float AckTime; - - /// - /// The recv time - /// - public float RecvTime; - - #endregion - } - } - - /// - /// Packet sent when interacting with Thresh Lantern and Dominion capturing. - /// - public static class InteractObject - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x86; - - #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(); - packet.Position = 1; - result.SourceNetworkId = packet.ReadInteger(); - result.ObjectNetworkId = 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.WriteInteger(packetStruct.SourceNetworkId); - result.WriteInteger(packetStruct.ObjectNetworkId); - return result; - } - - #endregion - - /// - /// Represents the packet sent when you interact with an object. - /// - public struct Struct - { - #region Fields - - /// - /// The object network identifier - /// - public int ObjectNetworkId; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The network identifier. - /// The object network identifier. - public Struct(int networkId, int objectNetworkId) - { - this.SourceNetworkId = networkId; - this.ObjectNetworkId = objectNetworkId; - } - - #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 - } - - /// - /// Packet sent when leveling up a spell. - /// - public static class LevelUpSpell - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0xEC; - - #endregion - - #region Public Methods and Operators - - /// - /// Decodes the specified data. - /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - var packet = new GamePacket(data) { Position = 2 }; - var result = new Struct(); - - 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); - return result; - } - - #endregion - - /// - /// Represents a level up packet. - /// - public struct Struct - { - #region Fields - - /// - /// true if the level up was to evolve a spell. - /// - public bool Evolution; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The slot - /// - public SpellSlot Slot; - - #endregion - - #region Constructors and Destructors - - /// - /// 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) - { - this.NetworkId = (networkId == -1) ? ObjectManager.Player.NetworkId : networkId; - this.Slot = slot; - this.Evolution = evolve; - } - - #endregion - } - } - - /// - /// Packet sent when issuing GameObjectOrder's. - /// - public static class Move - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x13; - - #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(); - 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); - return result; - } - - #endregion - - /// - /// Represents a move packet. - /// - 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 - /// - public float X; - - /// - /// The y position - /// - public float Y; - - #endregion - - #region Constructors and Destructors - - /// - /// 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) - { - 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; - } - - #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 - } - - /// - /// Ping Packet. Sent by the client when pings are sent. - /// - public static class Ping - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x1D; - - #endregion - - #region Public Methods and Operators - - /// - /// 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); - return result; - } - - #endregion - - /// - /// Repreents a ping packet. - /// - public struct Struct - { - #region Fields - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The ping type - /// - public PingType Type; - - /// - /// The x position - /// - public float X; - - /// - /// The y position - /// - public float Y; - - #endregion - - #region Constructors and Destructors - - /// - /// 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) - { - this.X = x; - this.Y = y; - this.TargetNetworkId = targetNetworkId; - this.Type = type; - } - - #endregion - } - } - - /// - /// Sent by client on refund. - /// - public static class Refund - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x54; - - #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(); - 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); - return result; - } - - #endregion - - /// - /// Represents the packet sent when refunding an item. - /// - public struct Struct - { - #region Fields - - /// - /// The network identifier - /// - public int NetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The network identifier. - public Struct(int networkId = -1) - { - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - - #endregion - } - } - - /// - /// 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 - } - - /// - /// Packet sent when selling items. - /// - public static class SellItem - { - #region Static Fields - - /// - /// The channel - /// - 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 - - /// - /// 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); - return result; - } - - #endregion - - /// - /// Packet sent on selling an item. - /// - 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 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; - } - - /// - /// Initializes a new instance of the struct. - /// - /// 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 - } - } - - /// - /// Packet sent when left clicking a target. - /// - public static class SetTarget - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x04; - - #endregion - - #region Public Methods and Operators - - /// - /// 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); - return result; - } - - #endregion - - /// - /// Represents the packet sent when left clicking a target. - /// - public struct Struct - { - #region Fields - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - #endregion - } - } - - /// - /// 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 - } - - /// - /// Packet sent when swapping items. - /// - public static class SwapItem - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x55; - - #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(); - 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. - /// - public struct Struct - { - #region Fields - - /// - /// From slot byte - /// - public byte FromSlotByte; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// To slot byte - /// - 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) - { - this.FromSlotByte = fromSlotByte; - this.ToSlotByte = toSlotByte; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - - #endregion - } - } - - /// - /// Packet sent to acknowledge the received update packet. - /// - public static class UpdateConfirm - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xA8; - - #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 { SequenceId = packet.ReadInteger(5) }; - return result; - } - - #endregion - - /// - /// Represents the packet sent to acknowledge the received update packet - /// - public struct Struct - { - #region Fields - - /// - /// The sequence identifier - /// - public int SequenceId; - - #endregion - } - } - - /// - /// Sent by client to confirm receiving waypoints. - /// - 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 - /// - public static byte Header = 0x36; - - #endregion - } - - /// - /// Sent by client on zoom level change or move camera. - /// - public static class Zoom - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xDC; - - #endregion - } - } - - /// - /// Contains packet that are sent from the server to the client (the game). - /// - public static class S2C - { - /// - /// Received by the server when Camera or Zoom is sent. - /// - public static class Camera - { - #region Static Fields - - //94 00 00 00 00 00 27 - //last byte is probably times camera packet has been sent - /// - /// The header - /// - public static byte Header = 0x94; - - #endregion - } - - /// - /// Received when a unit casts a spell. - /// - public static class CastAns - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xB5; - - #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.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)); - - return result; - } - - /// - /// 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 spell is casted. - /// - 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 - /// - public int MissileNetworkId; - - /// - /// 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 - /// - public SpellSlot SpellSlot; - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The target unit - /// - public Obj_AI_Base TargetUnit; - - /// - /// To position - /// - public Vector2 ToPosition; - - /// - /// If this value is greater than 0, the spell cast is visible. - /// - public float Visible; // >0 visible - - #endregion - } - } - - /// - /// Gets received when a unit dashes. - /// - public static class Dash - { - #region Static Fields - - /// - /// 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; - } - - /// - /// 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 - } - } - - /// - /// 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. - /// - /// The data. - /// Struct. - 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); - return result; - } - - #endregion - - /// - /// Represents the packet received when a jungle camp is empty. - /// - public struct Struct - { - #region Fields - - /// - /// The camp identifier - /// - public int CampId; - - /// - /// The empty type - /// - public byte EmptyType; - - /// - /// The unit network identifier - /// - public int UnitNetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// 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) - { - this.UnitNetworkId = unitNetworkId; - this.CampId = campId; - this.EmptyType = emptyType; - } - - #endregion - } - } - - /// - /// Gets received when a unit enters FOW. - /// - public static class GainVision - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xFC; - - #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(2); - return result; - } - - /// - /// 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 - - /// - /// Represents the packet received when the team gains vision of a unit. - /// - public struct Struct - { - #region Fields - - /// - /// The unit network identifier - /// - public int UnitNetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The unit network identifier. - public Struct(int unitNetworkId = 0) - { - this.UnitNetworkId = unitNetworkId; - } - - #endregion - } - } - - /// - /// Gets received when the game ends. - /// - public static class GameEnd - { - #region Static Fields - - /// - /// 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; - } - - /// - /// 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; - } - - #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; - } - - #endregion - } - } - - /// - /// 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. - /// - /// 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); - return result; - } - - #endregion - - /// - /// Represents the packet received when the team loses vision of an unit. - /// - public struct Struct - { - #region Fields - - /// - /// The unit network identifier - /// - public int UnitNetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The unit network identifier. - public Struct(int unitNetworkId = 0) - { - this.UnitNetworkId = unitNetworkId; - } - - #endregion - } - } - - /// - /// RPing Packet. Received when ally team players send a SPing packet. - /// - public static class Ping - { - #region Static Fields - - /// - /// The channel - /// - public static PacketChannel Channel = PacketChannel.C2S; - - /// - /// The flags - /// - public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; - - /// - /// The header - /// - public static byte Header = 0x60; - - #endregion - - #region Public Methods and Operators - - /// - /// 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); - } - - /// - /// 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. - /// - public struct Struct - { - #region Fields - - /// - /// true if the ping is silent, meaning that the ping produces no sound. - /// - public bool Silent; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The ping type - /// - public PingType Type; - - /// - /// The x position - /// - public float X; - - /// - /// The y position - /// - public float Y; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// 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; - } - - #endregion - } - } - - /// - /// Gets received when an unit uses an emote. - /// - public static class PlayEmote - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xAA; - - #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.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); - return result; - } - - #endregion - - /// - /// Represents the packet received when a unit uses an emote. - /// - public struct Struct - { - #region Fields - - /// - /// The emote identifier - /// - public byte EmoteId; - - /// - /// The network identifier - /// - public int NetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The emote identifier. - /// The network identifier. - public Struct(byte emoteId, int networkId = -1) - { - this.EmoteId = emoteId; - this.NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; - } - - #endregion - } - } - - /// - /// Received by the server when refund is sent. - /// - public static class RefundConfirm - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x49; - - #endregion - } - - /// - /// Refund token contains refund amount, when leaving base or casting spell/item it's set to 0. - /// - public static class RefundToken - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xE9; - - #endregion - - #region Public Methods and Operators - - /// - /// Decodes the specified data. - /// - /// The data. - /// Struct. - public static Struct Decoded(byte[] data) - { - return new Struct { RefundCount = data[6] }; - } - - /// - /// 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; - } - - #endregion - - /// - /// Represents the packet received when refunding an item. - /// - public struct Struct - { - #region Fields - - /// - /// The refund count - /// - public int RefundCount; - - #endregion - } - } - - /// - /// Gets received when a unit starts, aborts or finishes a teleport (such as recall, teleport, twisted fate ulti, shen - /// ulti,...) - /// - public static class Teleport - { - #region Constants - - /// - /// The error gap in ticks. - /// - private const int ErrorGap = 100; //in ticks - - #endregion - - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x44; - - /// - /// The recall data by network identifier - /// - private static readonly IDictionary RecallDataByNetworkId = - new Dictionary(); - - /// - /// The type by string - /// - private static readonly IDictionary TypeByString = - new Dictionary - { - { "Recall", new RecallTeleport() }, { "Teleport", new TeleportTeleport() }, - { "Gate", new TwistedFateTeleport() }, { "Shen", new ShenTeleport() }, - }; - - #endregion - - #region Enums - - /// - /// The status of the teleport. - /// - public enum Status - { - /// - /// The teleport has been started. - /// - Start, - - /// - /// The teleport has been aborted. - /// - Abort, - - /// - /// The teleport has finished. - /// - Finish, - - /// - /// The status of the teleport is unknown. - /// - Unknown - } - - /// - /// The type of teleport. - /// - public enum Type - { - /// - /// 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. - /// - TwistedFate, - - /// - /// The unit is teleporting to a unit with Shen's Ultimate. - /// - Shen, - - /// - /// The type of teleportation is unknown. - /// - Unknown - } - - #endregion - - #region Interfaces - - /// - /// An interface for different types of teleports to get durations and type of teleport. - /// - 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 - - /// - /// Decodes the specified sender. - /// - /// The sender. - /// The instance containing the event data. - /// Struct. - public static Struct Decoded(GameObject sender, GameObjectTeleportEventArgs args) // - { - 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)) - { - if (TypeByString.ContainsKey(args.RecallType)) - { - 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; - } - } - 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. - /// - /// 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 teleports. - /// - public struct Struct - { - #region Fields - - /// - /// The duration - /// - public int Duration; - - /// - /// The start - /// - public int Start; - - /// - /// The status - /// - public Status Status; - - /// - /// The type - /// - public Type Type; - - /// - /// The unit network identifier - /// - public int UnitNetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// 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) - { - this.UnitNetworkId = unitNetworkId; - this.Status = status; - this.Type = type; - this.Duration = duration; - this.Start = start; - } - - #endregion - } - - /// - /// Contains data about the teleport. - /// - internal struct TeleportData - { - #region Public Properties - - /// - /// Gets or sets the duration. - /// - /// The duration. - public int Duration { get; set; } - - /// - /// Gets or sets the start. - /// - /// The start. - public int Start { get; set; } - - /// - /// Gets or sets the type. - /// - /// The type. - public Type Type { get; set; } - - #endregion - } - - /// - /// A recall teleport. - /// - internal class RecallTeleport : ITeleport - { - #region Public Properties - - /// - /// Gets the type. - /// - /// The type. - public Type Type - { - get - { - return Type.Recall; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the duration. - /// - /// The instance containing the event data. - /// System.Int32. - public int GetDuration(GameObjectTeleportEventArgs args) - { - return Utility.GetRecallTime(args.RecallName); - } - - #endregion - } - - /// - /// A Shen's Ultimate teleport. - /// - internal class ShenTeleport : ITeleport - { - #region Public Properties - - /// - /// Gets the type. - /// - /// The type. - public Type Type - { - get - { - return Type.Shen; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the duration. - /// - /// The instance containing the event data. - /// System.Int32. - public int GetDuration(GameObjectTeleportEventArgs args) - { - return 3000; - } - - #endregion - } - - /// - /// A teleport summoner spell teleport. - /// - internal class TeleportTeleport : ITeleport - { - #region Public Properties - - /// - /// Gets the type. - /// - /// The type. - public Type Type - { - get - { - return Type.Teleport; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the duration. - /// - /// The instance containing the event data. - /// System.Int32. - public int GetDuration(GameObjectTeleportEventArgs args) - { - return 3500; - } - - #endregion - } - - /// - /// A Twisted Fate's Ultimate Teleport. - /// - internal class TwistedFateTeleport : ITeleport - { - #region Public Properties - - /// - /// Gets the type. - /// - /// The type. - public Type Type - { - get - { - return Type.TwistedFate; - } - } - - #endregion - - #region Public Methods and Operators - - /// - /// Gets the duration. - /// - /// The instance containing the event data. - /// System.Int32. - public int GetDuration(GameObjectTeleportEventArgs args) - { - return 1500; - } - - #endregion - } - } - - /// - /// Gets received when a tower starts targeting a unit - /// - public static class TowerAggro - { - #region Static Fields - - /// - /// The aggro list - /// - public static readonly Dictionary AggroList = new Dictionary(); - - /// - /// The header - /// - public static byte Header = 0x6A; - - #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.TurretNetworkId = packet.ReadInteger(1); - result.TargetNetworkId = packet.ReadInteger(); - - if (result.TurretNetworkId != 0) - { - AggroList[result.TurretNetworkId] = result.TargetNetworkId; - } - - return result; - } - - /// - /// 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; - } - - #endregion - - /// - /// Represents the packet received when a tower focuses a target. - /// - public struct Struct - { - #region Fields - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The turret network identifier - /// - public int TurretNetworkId; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// The turret network identifier. - /// The target network identifier. - public Struct(int turretNetworkId, int targetNetworkId) - { - this.TurretNetworkId = turretNetworkId; - this.TargetNetworkId = targetNetworkId; - } - - #endregion - } - } - - /// - /// Gets received when the model changes. - /// - public static class UpdateModel - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x1A; - - #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.NetworkId = packet.ReadInteger(2); - result.Id = packet.ReadInteger(); - result.BOk = packet.ReadByte() == 0x01; - result.SkinId = 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.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); - } - } - - return result; - } - - #endregion - - /// - /// Represents the packet received when the model of a unit is updated. - /// - public struct Struct - { - #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 - /// - public int SkinId; - - #endregion - - #region Constructors and Destructors - - /// - /// 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; - } - - #endregion - - /// - /// Represents the packet received when a unit's gold is changed. - /// - public struct Struct - { - #region Fields - - /// - /// The gold - /// - public float Gold; - - /// - /// The receiving network identifier - /// - public int ReceivingNetworkId; - - /// - /// The receiving unit - /// - public Obj_AI_Base ReceivingUnit; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - /// - /// The source unit - /// - public Obj_AI_Base SourceUnit; - - #endregion - } - } - - /// - /// Packet received on buying item. - /// - public class BuyItemAns - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x6F; - - #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.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(); - - 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. - /// - public struct Struct - { - #region Fields - - /// - /// The charges of the item. - /// - public int Charge; - - /// - /// The inventory slot - /// - public byte InventorySlot; - - /// - /// The item - /// - public Items.Item Item; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The replace item - /// - 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 - - #region Constructors and Destructors - - /// - /// 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) - { - 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); - } - - #endregion - } - } - - /// - /// Packet received on spell slot changing. - /// - public class ChangeSpellSlot - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x17; - - #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.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; - } - - /// - /// 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. - /// - public struct Struct - { - #region Fields - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The spell string - /// - public string SpellString; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - /// - /// An unknown byte. Possibly the previous slot. - /// - public byte UnknownByte; // from slot? - - /// - /// An unknown byte2 - /// - public byte UnknownByte2; - - #endregion - } - } - - /// - /// Packet received when a unit deals damage. - /// - public class Damage - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x23; - - #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(); - - 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 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.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. - /// - public struct Struct - { - #region Fields - - /// - /// The damage amount - /// - public float DamageAmount; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The target network identifier copy - /// - public int TargetNetworkIdCopy; - - /// - /// The type - /// - public DamageTypePacket Type; - - /// - /// Unknown short value. - /// - public short Unknown; - - #endregion - - #region Constructors and Destructors - - /// - /// 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) - { - this.DamageAmount = damageAmount; - this.SourceNetworkId = sourceNetworkId; - this.TargetNetworkId = targetNetworkId; - this.TargetNetworkIdCopy = targetNetworkIdCopy; - this.Type = type; - this.Unknown = unknown; - } - - #endregion - } - } - - /// - /// Packet received for a debug message. - /// - public class DebugMessage - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xF7; - - #endregion - - #region Public Methods and Operators - - /// - /// Encodes the specified debug string. - /// - /// The debug string. - /// GamePacket. - public static GamePacket Encoded(String debugString) - { - var packet = new GamePacket(Header); - - packet.WriteByte(0, 8); - packet.WriteString(debugString); - packet.WriteByte(0); - return packet; - } - - #endregion - } - - /// - /// Packet received to print floating text. - /// - public class FloatText - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x19; - - #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.NetworkId = packet.ReadInteger(1); - result.Type = (FloatTextPacket)packet.ReadByte(); - //result.Text = packet.ReadString(); - - return result; - } - - /// - /// Encodes the specified packet structure. - /// - /// The packet structure. - /// GamePacket. - public static GamePacket Encoded(Struct packetStruct) - { - 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); - - return packet; - } - - #endregion - - /// - /// Represents the packet received when text is to be placed on a unit. - /// - public struct Struct - { - #region Fields - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The text - /// - public string Text; - - /// - /// The type - /// - public FloatTextPacket Type; - - #endregion - - #region Constructors and Destructors - - /// - /// Initializes a new instance of the struct. - /// - /// 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; - } - - #endregion - } - } - - /// - /// Packet received on gaining buff. - /// - public class GainBuff - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xB7; - - #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.NetworkId = packet.ReadInteger(1); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - - result.BuffSlot = packet.ReadByte(); - result.Type = (BuffType)packet.ReadByte(); - result.Stack = packet.ReadByte(); - result.Visible = packet.ReadByte() > 0; - result.BuffId = packet.ReadInteger(); - - result.TargetNetworkId = packet.ReadInteger(); - result.Target = ObjectManager.GetUnitByNetworkId(result.TargetNetworkId); - - packet.Position += 4; - - result.Duration = packet.ReadFloat(); - - result.SourceNetworkId = packet.ReadInteger(); - result.Source = ObjectManager.GetUnitByNetworkId(result.SourceNetworkId); - - return result; - } - - #endregion - - /// - /// Represents the packet received when a unit gains a buff. - /// - public struct Struct - { - #region Fields - - /// - /// The buff identifier - /// - public int BuffId; - - /// - /// The buff slot - /// - public byte BuffSlot; - - /// - /// The duration of the buff - /// - public float Duration; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The source - /// - public Obj_AI_Base Source; - - /// - /// The source network identifier - /// - public int SourceNetworkId; - - /// - /// The buff stacks - /// - public int Stack; - - /// - /// The target - /// - public Obj_AI_Base Target; - - /// - /// The target network identifier - /// - public int TargetNetworkId; - - /// - /// The buff type - /// - public BuffType Type; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - /// - /// true if the buff is visible. - /// - public bool Visible; - - #endregion - } - } - - /// - /// Packet received to highlight a unit. - /// - public class HighlightUnit - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x59; - - #endregion - - #region Public Methods and Operators - - /// - /// Encodes the specified network identifier. - /// - /// The network identifier. - /// GamePacket. - public static GamePacket Encoded(int networkId) - { - var packet = new GamePacket(Header); - - packet.WriteInteger(0); - packet.WriteInteger(networkId); - - return packet; - } - - #endregion - } - - /// - /// Received on hero level up. - /// - public class LevelUp - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xCB; - - #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.NetworkId = packet.ReadInteger(2); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - result.Level = packet.ReadByte(); - result.PointsLeft = packet.ReadByte(); - - return result; - } - - #endregion - - /// - /// Represents the packet received when a unit levels up. - /// - public struct Struct - { - #region Fields - - /// - /// The new level - /// - public int Level; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The amount points left to level up other spells. - /// - public int PointsLeft; - - /// - /// The unit - /// - public Obj_AI_Hero Unit; - - #endregion - } - } - - /// - /// Received on hero level up spell. - /// - public class LevelUpSpell - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xA9; - - #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.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 when a unit levels up a spell. - /// - public struct Struct - { - #region Fields - - /// - /// The new level - /// - public int Level; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The amount points left to level up other spells. - /// - public int PointsLeft; - - /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The unit - /// - public Obj_AI_Hero Unit; - - #endregion - } - } - - /// - /// Packet received on losing buff. - /// - public class LoseBuff - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x7B; - - #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.NetworkId = packet.ReadInteger(1); - result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - - result.BuffSlot = packet.ReadByte(); - result.BuffId = packet.ReadInteger(); - result.Duration = packet.ReadFloat(); - - return result; - } - - #endregion - - /// - /// Represents the packet received when a unit loses a buff. - /// - public struct Struct - { - #region Fields - - /// - /// The buff identifier - /// - public int BuffId; - - /// - /// The buff slot - /// - public byte BuffSlot; - - /// - /// The duration of the buff - /// - public float Duration; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - #endregion - } - } - - /// - /// Packet received on player disconnect. - /// - public class PlayerDisconnect - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xFE; - - #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(); - - packet.Position = 6; - result.NetworkId = packet.ReadInteger(); - result.Player = ObjectManager.GetUnitByNetworkId(result.NetworkId); - - return result; - } - - #endregion - - /// - /// Represents the packet received when a player disconnects from the game. - /// - public struct Struct - { - #region Fields - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The player - /// - public Obj_AI_Hero Player; - - #endregion - } - } - - /// - /// Packet received when a player presses the "Reconnect" Button. - /// - public class PlayerReconnect - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x0; - - #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(); - - packet.Position = 4; - result.ClientId = packet.ReadInteger(); - result.Player = ObjectManager.Get().ElementAt(result.ClientId); - - return result; - } - - #endregion - - /// - /// Represents the packet received when a player reconects to the game. - /// - public struct Struct - { - #region Fields - - /// - /// The client identifier - /// - public int ClientId; - - /// - /// The player - /// - public Obj_AI_Hero Player; - - #endregion - } - } - - /// - /// Packet received when a player reconnected. - /// - public class PlayerReconnected - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xF; - - #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(); - - packet.Position = 5; - result.ClientId = packet.ReadInteger(); - result.Player = ObjectManager.Get().ElementAt(result.ClientId); - - return result; - } - - #endregion - - /// - /// Represents the packet received when a player reconnectes to the game. - /// - public struct Struct - { - #region Fields - - /// - /// The client identifier - /// - public int ClientId; - - /// - /// The player - /// - 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 - - #region Public Methods and Operators - - /// - /// Encodes the specified network identifier. - /// - /// The network identifier. - /// GamePacket. - public static GamePacket Encoded(int networkId) - { - var packet = new GamePacket(Header); - - packet.WriteInteger(0); - packet.WriteInteger(networkId); - - return packet; - } - - #endregion - } - - /// - /// Packet received on selling item. - /// - public class SellItemAns - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xD3; - - #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.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 unit sells an item. - /// - public struct Struct - { - #region Fields - - /// - /// The inventory slot - /// - public byte InventorySlot; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The spell slot - /// - public SpellSlot SpellSlot; - - /// - /// The stack - /// - public int Stack; - - /// - /// The unit - /// - public Obj_AI_Hero Unit; - - /// - /// An unknown byte - /// - public byte UnknownByte; - - #endregion - } - } - - /// - /// A packet that sets cooldown of a spell/item. - /// - public class SetCooldown - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x85; - - #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.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; - } - - /// - /// 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. - /// - public struct Struct - { - #region Fields - - /// - /// The current cooldown - /// - public float CurrentCooldown; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The slot - /// - public SpellSlot Slot; - - /// - /// The total cooldown - /// - public float TotalCooldown; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - #endregion - - #region Constructors and Destructors - - /// - /// 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) - { - this.NetworkId = networkId; - this.Unit = ObjectManager.GetUnitByNetworkId(this.NetworkId); - this.Slot = slot; - this.TotalCooldown = totalCd; - this.CurrentCooldown = currentCd; - } - - #endregion - } - } - - /// - /// One packet that starts cooldown (mostly for items). - /// - public class StartItemCooldown - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x9F; - - #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.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 to start the cooldown of an item. - /// - public struct Struct - { - #region Fields - - /// - /// The inventory slot - /// - public byte InventorySlot; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The spell slot - /// - public SpellSlot SpellSlot; - - /// - /// The unit - /// - public Obj_AI_Base Unit; - - #endregion - } - } - - /// - /// Received when someone casts a surrender vote. - /// - public class Surrender - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xC9; - - #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 - { - 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. - /// - public struct Struct - { - #region Fields - - /// - /// The maximum votes - /// - public int MaxVotes; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The amount of no votes - /// - public int NoVotes; - - /// - /// The team that is surrendering - /// - public GameObjectTeam Team; - - /// - /// The amount of yes votes - /// - public int YesVotes; - - #endregion - } - } - - /// - /// Received when surrender voting is over. - /// - public class SurrenderResult - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0xA5; - - #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 - { - 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. - /// - public struct Struct - { - #region Fields - - /// - /// The amount of no votes - /// - public int NoVotes; - - /// - /// The team that is surrendering. - /// - public GameObjectTeam Team; - - /// - /// true if the request to surrender was denied because it was too early in the game. - /// - public bool TooEarly; - - /// - /// The amount of yes votes - /// - public int YesVotes; - - #endregion - } - } - - /// - /// Packet received on swapping item. - /// - public class SwapItemAns - { - #region Static Fields - - /// - /// The header - /// - public static byte Header = 0x09; - - #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.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 unit swaps an item. - /// - public struct Struct - { - #region Fields - - /// - /// The previous inventory slot - /// - public byte FromInventorySlot; - - /// - /// The previous spell slot - /// - public SpellSlot FromSpellSlot; - - /// - /// The network identifier - /// - public int NetworkId; - - /// - /// The new inventory slot - /// - public byte ToInventorySlot; - - /// - /// The new spell slot - /// - public SpellSlot ToSpellSlot; - - /// - /// The unit - /// - public Obj_AI_Hero Unit; - - #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/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..c7f52938 --- /dev/null +++ b/external/SharpDX.Menu @@ -0,0 +1 @@ +Subproject commit c7f52938d6b779a663707c3573db93437de7bf09 diff --git a/packages.config b/packages.config new file mode 100644 index 00000000..719f545c --- /dev/null +++ b/packages.config @@ -0,0 +1,4 @@ + + + + \ 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..f6f2fa3d --- /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 => Library.Instance?.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..3c7ceb38 --- /dev/null +++ b/source/Damage/Damage.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.Composition; + using System.Linq; + + /// + /// 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) + { + return 0d; + } + + /// + /// 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 double CalculateMagicDamage(Obj_AI_Base source, Obj_AI_Base target, double amount) + { + return 0d; + } + + private double CalculatePhysicalDamage(Obj_AI_Base source, Obj_AI_Base target, double amount) + { + return 0; + } + + #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..005c3075 --- /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 => Library.Instance?.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/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/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..e079d8ab --- /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() => Library.Instance?.Dash?.Activate(); + + /// + /// Shuts the system down. + /// + public static void Shutdown() => Library.Instance?.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..e001e9ac --- /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) => Library.Instance?.Dash?.GetDashInfo(unit); + + /// + /// Determines if the unit is dashing. + /// + /// + /// The unit. + /// + /// + /// The . + /// + public static bool IsDashing(this Obj_AI_Base unit) => Library.Instance?.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..e2e35f4a --- /dev/null +++ b/source/Events/GameEvents.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.ComponentModel.Composition; + + /// + /// Provides custom defined events. + /// + public static partial class CustomEvents + { + /// + /// The game events. + /// + [Export(typeof(Game))] + public partial class Game + { + } + } +} \ 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..092b21df --- /dev/null +++ b/source/Events/OnGameLoad.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + 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. + /// + 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(); + + private ILog Log { get; } = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #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/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj new file mode 100644 index 00000000..c96de8a2 --- /dev/null +++ b/source/LeagueSharp.Common.csproj @@ -0,0 +1,808 @@ + + + + + Debug + AnyCPU + {BFB66E60-98AB-4178-AB3D-7B9C3EBEC2F7} + Library + Properties + LeagueSharp.Common + LeagueSharp.Common + v4.5.2 + 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 + True + + + Z:\References\LeagueSharp.dll + + + Z:\References\LeagueSharp.Data.dll + + + Z:\System\LeagueSharp.Sandbox.dll + + + Z:\Core\log4net.dll + + + Z:\Core\PlaySharp.Toolkit.dll + + + Z:\References\SharpDX.dll + + + Z:\References\SharpDX.Direct3D9.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..747e006e --- /dev/null +++ b/source/LeagueSharp.Common.csproj.DotSettings @@ -0,0 +1,148 @@ + + 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..6a5a6f35 --- /dev/null +++ b/source/Library.cs @@ -0,0 +1,122 @@ +// +// 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 PlaySharp.Toolkit.AppDomain.Loader; + using PlaySharp.Toolkit.EventAggregator; + + /// + /// Library entry point for external service loading. + /// + public class Library : ILibrary + { + #region Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + [PermissionSet(SecurityAction.Assert, Unrestricted = true)] + public Library() + { + Instance = this; + + 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; + } + + #endregion + + #region Public Properties + + /// + /// Gets the library instance. + /// + public static Library Instance { get; private set; } + + /// + /// Gets the anti gapcloser. + /// + [Import(typeof(AntiGapcloser))] + public AntiGapcloser AntiGapcloser { get; private set; } + + /// + /// Gets the damage calculation system. + /// + [Import(typeof(Damage))] + public Damage Damage { get; private set; } + + /// + /// Gets the dash system. + /// + [Import(typeof(Dash))] + public Dash Dash { get; private set; } + + /// + /// Gets the event aggregator. + /// + [Import(typeof(IEventAggregator))] + public IEventAggregator EventAggregator { get; private set; } + + /// + /// Gets the game custom events. + /// + [Import(typeof(CustomEvents.Game))] + public CustomEvents.Game GameEvents { get; private set; } + + /// + /// Gets the map. + /// + [Import(typeof(Utility.Map))] + public Utility.Map Map { get; private set; } + + /// + /// Gets the minion manager. + /// + [Import(typeof(MinionManager))] + public MinionManager MinionManager { get; private set; } + + /// + /// Gets the unit custom events. + /// + [Import(typeof(CustomEvents.Unit))] + public CustomEvents.Unit UnitEvents { get; private set; } + + #endregion + + #region Public Methods and Operators + + /// + public void Configure(CompositionContainer container) + { + this.EventAggregator.Subscribe(this.GameEvents); + this.EventAggregator.Subscribe(this.UnitEvents); + this.Damage.SortSpells(); + } + + /// + public void Unload() + { + Render.Terminate(); + Render.Circle.Dispose(this, EventArgs.Empty); + } + + #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..9ba06a12 --- /dev/null +++ b/source/Minion/MinionInfo.cs @@ -0,0 +1,143 @@ +// +// 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"); + + var isJungleMob = false; + if (SmallNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex))) + { + this.JungleType = JungleType.Small; + isJungleMob = true; + } + else if (LargeNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex))) + { + this.JungleType = JungleType.Large; + isJungleMob = true; + } + else if (LegendaryNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex))) + { + this.JungleType = JungleType.Legendary; + isJungleMob = true; + } + + this.IsJungleMob = isJungleMob; + 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) + { + 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"]); + this.Wave = Convert.ToInt32(regex.Groups["Wave"]); + this.Index = Convert.ToInt32(regex.Groups["Index"]); + } + } + + #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 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..3e61afb7 --- /dev/null +++ b/source/Minion/MinionManager.cs @@ -0,0 +1,61 @@ +// +// 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; + } + + #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.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); + } + } + + #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..9cedec7a --- /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 => Library.Instance?.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/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 100% rename from Data/SpellDatabase.cs rename to source/Old/Data/SpellDatabase.cs diff --git a/FakeClicks.cs b/source/Old/FakeClicks.cs similarity index 100% rename from FakeClicks.cs rename to source/Old/FakeClicks.cs diff --git a/Hacks.cs b/source/Old/Hacks.cs similarity index 100% rename from Hacks.cs rename to source/Old/Hacks.cs diff --git a/HealthPrediction.cs b/source/Old/HealthPrediction.cs similarity index 100% rename from HealthPrediction.cs rename to source/Old/HealthPrediction.cs diff --git a/HeroManager.cs b/source/Old/HeroManager.cs similarity index 100% rename from HeroManager.cs rename to source/Old/HeroManager.cs 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/Menu/CPSlider.cs b/source/Old/Menu/CPSlider.cs similarity index 100% rename from Menu/CPSlider.cs rename to source/Old/Menu/CPSlider.cs diff --git a/Menu/Circle.cs b/source/Old/Menu/Circle.cs similarity index 100% rename from Menu/Circle.cs rename to source/Old/Menu/Circle.cs diff --git a/Menu/ColorPicker.cs b/source/Old/Menu/ColorPicker.cs similarity index 100% rename from Menu/ColorPicker.cs rename to source/Old/Menu/ColorPicker.cs diff --git a/Menu/CommonMenu.cs b/source/Old/Menu/CommonMenu.cs similarity index 100% rename from Menu/CommonMenu.cs rename to source/Old/Menu/CommonMenu.cs diff --git a/Menu/HSLColor.cs b/source/Old/Menu/HSLColor.cs similarity index 100% rename from Menu/HSLColor.cs rename to source/Old/Menu/HSLColor.cs diff --git a/Menu/KeyBind.cs b/source/Old/Menu/KeyBind.cs similarity index 100% rename from Menu/KeyBind.cs rename to source/Old/Menu/KeyBind.cs diff --git a/Menu/KeyBindType.cs b/source/Old/Menu/KeyBindType.cs similarity index 100% rename from Menu/KeyBindType.cs rename to source/Old/Menu/KeyBindType.cs diff --git a/Menu/KeybindSetStage.cs b/source/Old/Menu/KeybindSetStage.cs similarity index 100% rename from Menu/KeybindSetStage.cs rename to source/Old/Menu/KeybindSetStage.cs diff --git a/Menu/Menu.cs b/source/Old/Menu/Menu.cs similarity index 100% rename from Menu/Menu.cs rename to source/Old/Menu/Menu.cs diff --git a/Menu/MenuDrawHelper.cs b/source/Old/Menu/MenuDrawHelper.cs similarity index 100% rename from Menu/MenuDrawHelper.cs rename to source/Old/Menu/MenuDrawHelper.cs diff --git a/Menu/MenuGlobals.cs b/source/Old/Menu/MenuGlobals.cs similarity index 100% rename from Menu/MenuGlobals.cs rename to source/Old/Menu/MenuGlobals.cs diff --git a/Menu/MenuItem.cs b/source/Old/Menu/MenuItem.cs similarity index 100% rename from Menu/MenuItem.cs rename to source/Old/Menu/MenuItem.cs diff --git a/Menu/MenuSettings.cs b/source/Old/Menu/MenuSettings.cs similarity index 100% rename from Menu/MenuSettings.cs rename to source/Old/Menu/MenuSettings.cs diff --git a/Menu/MenuValueType.cs b/source/Old/Menu/MenuValueType.cs similarity index 100% rename from Menu/MenuValueType.cs rename to source/Old/Menu/MenuValueType.cs diff --git a/Menu/OnValueChangeEventArgs.cs b/source/Old/Menu/OnValueChangeEventArgs.cs similarity index 100% rename from Menu/OnValueChangeEventArgs.cs rename to source/Old/Menu/OnValueChangeEventArgs.cs diff --git a/Menu/SavedSettings.cs b/source/Old/Menu/SavedSettings.cs similarity index 100% rename from Menu/SavedSettings.cs rename to source/Old/Menu/SavedSettings.cs diff --git a/Menu/Slider.cs b/source/Old/Menu/Slider.cs similarity index 100% rename from Menu/Slider.cs rename to source/Old/Menu/Slider.cs diff --git a/Menu/StringList.cs b/source/Old/Menu/StringList.cs similarity index 100% rename from Menu/StringList.cs rename to source/Old/Menu/StringList.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/MultiLanguage.cs b/source/Old/MultiLanguage.cs similarity index 100% rename from MultiLanguage.cs rename to source/Old/MultiLanguage.cs diff --git a/Notifications.cs b/source/Old/Notifications.cs similarity index 100% rename from Notifications.cs rename to source/Old/Notifications.cs 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 100% rename from Notifications/Notification.cs rename to source/Old/Notifications/Notification.cs 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 100% rename from Orbwalking.cs rename to source/Old/Orbwalking.cs diff --git a/PermaShow.cs b/source/Old/PermaShow.cs similarity index 100% rename from PermaShow.cs rename to source/Old/PermaShow.cs diff --git a/Spell.cs b/source/Old/Spell.cs similarity index 100% rename from Spell.cs rename to source/Old/Spell.cs diff --git a/TargetSelector.cs b/source/Old/TargetSelector.cs similarity index 100% rename from TargetSelector.cs rename to source/Old/TargetSelector.cs 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..9bccb3db --- /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, + AoeTargetsHitCountBackingField = 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, + AoeTargetsHitCountBackingField = 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, + AoeTargetsHitCountBackingField = 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..17ae0183 --- /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..e1456d64 --- /dev/null +++ b/source/Prediction/Old/Prediction.cs @@ -0,0 +1,465 @@ +// +// 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); + } + + /// + /// 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 + } +} \ 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..40b8bd4c --- /dev/null +++ b/source/Prediction/PredictionOutput.cs @@ -0,0 +1,96 @@ +// +// 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 + + internal 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 the area of effect targets hit count. + /// + public int AoeTargetsHitCount => Math.Max(this.AoeTargetsHitCountBackingField, this.AoeTargetsHit.Count); + + /// + /// 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..a9e390b6 --- /dev/null +++ b/source/Properties/AssemblyInfo.cs @@ -0,0 +1,23 @@ +// +// 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: SecurityRules(SecurityRuleSet.Level1)] \ No newline at end of file diff --git a/Properties/Resources.Designer.cs b/source/Properties/Resources.Designer.cs similarity index 67% rename from Properties/Resources.Designer.cs rename to source/Properties/Resources.Designer.cs index ca33fcd3..3f372d65 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,39 +59,24 @@ internal Resources() { resourceCulture = value; } } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] ChineseJson { + get { + object obj = ResourceManager.GetObject("ChineseJson", resourceCulture); + return ((byte[])(obj)); + } + } + /// - /// 查詢類似 { - /// "\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&... 的當地語系化字串。 + /// Looks up a localized resource of type System.Byte[]. /// - internal static string ChineseJson { + internal static byte[] CircleEffect { get { - return ResourceManager.GetString("ChineseJson", resourceCulture); + object obj = ResourceManager.GetObject("CircleEffect", resourceCulture); + return ((byte[])(obj)); } } diff --git a/source/Properties/Resources.resx b/source/Properties/Resources.resx new file mode 100644 index 00000000..9f55bc02 --- /dev/null +++ b/source/Properties/Resources.resx @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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\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 + + + ..\Resources\ChineseJson.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ 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..5e084091 --- /dev/null +++ b/source/Render/RenderObject.cs @@ -0,0 +1,186 @@ +// +// 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 += args => this.OnPreReset(); + Drawing.OnPostReset += args => this.OnPostReset(); + AppDomain.CurrentDomain.DomainUnload += (sender, args) => this.OnPreReset(); + } + + /// + /// 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; + } + + this.IsDisposed = true; + } + + #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..66a55d1d --- /dev/null +++ b/source/Render/Sprite.cs @@ -0,0 +1,488 @@ +// +// 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; } + + /// + /// 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); + this.DeviceSprite.Transform = nMatrix; + this.DeviceSprite.Draw(this.Texture, this.Color, this.SpriteCrop); + this.DeviceSprite.Transform = matrix; + + this.DeviceSprite.End(); + } + catch (Exception e) + { + this.Reset(); + this.Log.Error("Unable to draw sprite.", e); + } + } + + /// + public override void OnPostReset() => this.DeviceSprite.OnResetDevice(); + + /// + public override void OnPreReset() => this.DeviceSprite.OnLostDevice(); + + /// + /// 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(); + } + } + + 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/Resources/CPForm.png b/source/Resources/CPForm.png similarity index 100% rename from Resources/CPForm.png rename to source/Resources/CPForm.png 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/Resources/SliderActive.png b/source/Resources/SliderActive.png similarity index 100% rename from Resources/SliderActive.png rename to source/Resources/SliderActive.png diff --git a/Resources/SliderDisabled.png b/source/Resources/SliderDisabled.png similarity index 100% rename from Resources/SliderDisabled.png rename to source/Resources/SliderDisabled.png 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..db4cf59c --- /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() => Library.Instance?.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..ca4d37b0 --- /dev/null +++ b/source/Utility/Utility.cs @@ -0,0 +1,1205 @@ +// +// 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 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..2c5088fa 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,7 +237,7 @@ public static string KeyToText(uint vKey) /*F1-F12*/ if (vKey >= 112 && vKey <= 123) { - return ("F" + (vKey - 111)); + return "F" + (vKey - 111); } switch (vKey) @@ -300,6 +286,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 +321,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..9eb644ac --- /dev/null +++ b/source/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From eef5aabf6835a9a1edbd0ffb4a39b84f4eb04fa8 Mon Sep 17 00:00:00 2001 From: L33T Date: Wed, 19 Oct 2016 07:52:05 +0300 Subject: [PATCH 02/11] + menu update, library update(mef) --- LeagueSharp.Common.ruleset | 2 + external/SharpDX.Menu | 2 +- source/AntiGapcloser/AntiGapcloserAdapter.cs | 2 +- source/Damage/DamageExtensions.cs | 2 +- source/Dash/DashAdapter.cs | 4 +- source/Dash/DashExtensions.cs | 4 +- source/Events/GameEvents.cs | 42 +- source/Events/OnGameLoad.cs | 6 - source/Instances.cs | 68 + source/LeagueSharp.Common.csproj | 72 +- source/LeagueSharp.Common.csproj.DotSettings | 9 + source/Library.cs | 135 +- .../{Old/Menu => Menu/Components}/Circle.cs | 62 +- source/Menu/Components/KeyBind.cs | 96 + .../Menu => Menu/Components}/KeyBindType.cs | 6 +- source/Menu/Components/KeybindSetStage.cs | 27 + .../{Old/Menu => Menu/Components}/Slider.cs | 46 +- source/Menu/Components/SliderBool.cs | 101 + source/Menu/Components/StringList.cs | 81 + source/Menu/Configuration/DataAggregator.cs | 70 + .../Menu/Configuration/DrawingViewFactory.cs | 18 + source/Menu/Configuration/MenuController.cs | 64 + source/Menu/Configuration/MenuManager.cs | 70 + source/Menu/Core/Menu.cs | 285 + source/Menu/Core/MenuAdapater.cs | 43 + source/Menu/Core/MenuItem.cs | 356 ++ .../{Old/Menu => Menu/Core}/MenuSettings.cs | 56 - source/Menu/Items/CPSlider.cs | 91 + .../{Old/Menu => Menu/Items}/ColorPicker.cs | 0 source/{Old/Menu => Menu/Items}/HSLColor.cs | 0 source/{Old => }/Menu/MenuGlobals.cs | 0 .../{Old => }/Menu/OnValueChangeEventArgs.cs | 9 + source/Menu/View/BoolView.cs | 207 + source/Menu/View/CircleView.cs | 416 ++ source/Menu/View/ComponentView.cs | 133 + source/Menu/View/DxColorView.cs | 370 ++ source/Menu/View/IViewAttributes.cs | 33 + source/Menu/View/KeybindView.cs | 304 ++ source/Menu/View/MenuView.cs | 134 + source/Menu/View/SharedView.cs | 240 + source/Menu/View/SliderBoolView.cs | 233 + source/Menu/View/SliderView.cs | 207 + source/Menu/View/StringListView.cs | 148 + source/Menu/View/SystemColorView.cs | 367 ++ source/Menu/View/ViewAttributes.cs | 46 + source/Minion/MinionInfo.cs | 45 +- source/Minion/MinionManager.cs | 14 +- source/Minion/MinionManagerAdapter.cs | 2 +- source/Native/HeroManager.cs | 100 + source/Native/MultiLanguage.cs | 98 + source/Native/MultiLanguageAdapter.cs | 75 + source/Old/FakeClicks.cs | 3 +- source/Old/Hacks.cs | 99 +- source/Old/HeroManager.cs | 77 - source/Old/Menu/CPSlider.cs | 224 - source/Old/Menu/CommonMenu.cs | 49 - source/Old/Menu/KeyBind.cs | 73 - source/Old/Menu/KeybindSetStage.cs | 11 - source/Old/Menu/Menu.cs | 854 --- source/Old/Menu/MenuDrawHelper.cs | 438 -- source/Old/Menu/MenuItem.cs | 1218 ----- source/Old/Menu/MenuValueType.cs | 48 - source/Old/Menu/SavedSettings.cs | 95 - source/Old/Menu/StringList.cs | 61 - source/Old/MultiLanguage.cs | 81 - source/Old/Orbwalking.cs | 4 +- source/Old/Packet.cs | 4706 +++++++++++++++++ source/Old/PermaShow.cs | 663 --- source/Old/TargetSelector.cs | 158 +- source/Prediction/Old/AoePrediction.cs | 6 +- source/Prediction/Old/Prediction.cs | 19 +- source/Prediction/PredictionOutput.cs | 17 +- source/Properties/AssemblyInfo.cs | 1 + source/Properties/Resources.Designer.cs | 24 +- source/Properties/Resources.resx | 12 +- source/Render/RenderObject.cs | 25 +- source/Render/Sprite.cs | 28 +- source/Resources/CPForm.png | Bin 74517 -> 0 bytes source/Resources/SliderActive.png | Bin 2635 -> 0 bytes source/Resources/SliderDisabled.png | Bin 2599 -> 0 bytes source/Resources/spectrum_chart.jpg | Bin 0 -> 16502 bytes source/Utility/MapAdapter.cs | 2 +- source/Utils/Utils.cs | 2 + 83 files changed, 9684 insertions(+), 4315 deletions(-) create mode 100644 source/Instances.cs rename source/{Old/Menu => Menu/Components}/Circle.cs (53%) create mode 100644 source/Menu/Components/KeyBind.cs rename source/{Old/Menu => Menu/Components}/KeyBindType.cs (68%) create mode 100644 source/Menu/Components/KeybindSetStage.cs rename source/{Old/Menu => Menu/Components}/Slider.cs (66%) create mode 100644 source/Menu/Components/SliderBool.cs create mode 100644 source/Menu/Components/StringList.cs create mode 100644 source/Menu/Configuration/DataAggregator.cs create mode 100644 source/Menu/Configuration/DrawingViewFactory.cs create mode 100644 source/Menu/Configuration/MenuController.cs create mode 100644 source/Menu/Configuration/MenuManager.cs create mode 100644 source/Menu/Core/Menu.cs create mode 100644 source/Menu/Core/MenuAdapater.cs create mode 100644 source/Menu/Core/MenuItem.cs rename source/{Old/Menu => Menu/Core}/MenuSettings.cs (53%) create mode 100644 source/Menu/Items/CPSlider.cs rename source/{Old/Menu => Menu/Items}/ColorPicker.cs (100%) rename source/{Old/Menu => Menu/Items}/HSLColor.cs (100%) rename source/{Old => }/Menu/MenuGlobals.cs (100%) rename source/{Old => }/Menu/OnValueChangeEventArgs.cs (91%) create mode 100644 source/Menu/View/BoolView.cs create mode 100644 source/Menu/View/CircleView.cs create mode 100644 source/Menu/View/ComponentView.cs create mode 100644 source/Menu/View/DxColorView.cs create mode 100644 source/Menu/View/IViewAttributes.cs create mode 100644 source/Menu/View/KeybindView.cs create mode 100644 source/Menu/View/MenuView.cs create mode 100644 source/Menu/View/SharedView.cs create mode 100644 source/Menu/View/SliderBoolView.cs create mode 100644 source/Menu/View/SliderView.cs create mode 100644 source/Menu/View/StringListView.cs create mode 100644 source/Menu/View/SystemColorView.cs create mode 100644 source/Menu/View/ViewAttributes.cs create mode 100644 source/Native/HeroManager.cs create mode 100644 source/Native/MultiLanguage.cs create mode 100644 source/Native/MultiLanguageAdapter.cs delete mode 100644 source/Old/HeroManager.cs delete mode 100644 source/Old/Menu/CPSlider.cs delete mode 100644 source/Old/Menu/CommonMenu.cs delete mode 100644 source/Old/Menu/KeyBind.cs delete mode 100644 source/Old/Menu/KeybindSetStage.cs delete mode 100644 source/Old/Menu/Menu.cs delete mode 100644 source/Old/Menu/MenuDrawHelper.cs delete mode 100644 source/Old/Menu/MenuItem.cs delete mode 100644 source/Old/Menu/MenuValueType.cs delete mode 100644 source/Old/Menu/SavedSettings.cs delete mode 100644 source/Old/Menu/StringList.cs delete mode 100644 source/Old/MultiLanguage.cs create mode 100644 source/Old/Packet.cs delete mode 100644 source/Old/PermaShow.cs delete mode 100644 source/Resources/CPForm.png delete mode 100644 source/Resources/SliderActive.png delete mode 100644 source/Resources/SliderDisabled.png create mode 100644 source/Resources/spectrum_chart.jpg diff --git a/LeagueSharp.Common.ruleset b/LeagueSharp.Common.ruleset index d95f1dc1..fcd58862 100644 --- a/LeagueSharp.Common.ruleset +++ b/LeagueSharp.Common.ruleset @@ -71,5 +71,7 @@ + + \ No newline at end of file diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu index c7f52938..ae9cf0b9 160000 --- a/external/SharpDX.Menu +++ b/external/SharpDX.Menu @@ -1 +1 @@ -Subproject commit c7f52938d6b779a663707c3573db93437de7bf09 +Subproject commit ae9cf0b9758552f4a4128217e83ba4edf048f28b diff --git a/source/AntiGapcloser/AntiGapcloserAdapter.cs b/source/AntiGapcloser/AntiGapcloserAdapter.cs index f6f2fa3d..8e30ecf5 100644 --- a/source/AntiGapcloser/AntiGapcloserAdapter.cs +++ b/source/AntiGapcloser/AntiGapcloserAdapter.cs @@ -51,7 +51,7 @@ public partial class AntiGapcloser #region Properties - private static AntiGapcloser Instance => Library.Instance?.AntiGapcloser; + private static AntiGapcloser Instance => Instances.AntiGapcloser; #endregion diff --git a/source/Damage/DamageExtensions.cs b/source/Damage/DamageExtensions.cs index 005c3075..76b2a222 100644 --- a/source/Damage/DamageExtensions.cs +++ b/source/Damage/DamageExtensions.cs @@ -17,7 +17,7 @@ public static class DamageExtensions { #region Properties - private static Damage Instance => Library.Instance?.Damage; + private static Damage Instance => Instances.Damage; #endregion diff --git a/source/Dash/DashAdapter.cs b/source/Dash/DashAdapter.cs index e079d8ab..88307497 100644 --- a/source/Dash/DashAdapter.cs +++ b/source/Dash/DashAdapter.cs @@ -17,12 +17,12 @@ public partial class Dash /// /// Initalizes the system. /// - public static void Initalize() => Library.Instance?.Dash?.Activate(); + public static void Initalize() => Instances.Dash?.Activate(); /// /// Shuts the system down. /// - public static void Shutdown() => Library.Instance?.Dash?.Deactivate(); + public static void Shutdown() => Instances.Dash?.Deactivate(); #endregion } diff --git a/source/Dash/DashExtensions.cs b/source/Dash/DashExtensions.cs index e001e9ac..1b781114 100644 --- a/source/Dash/DashExtensions.cs +++ b/source/Dash/DashExtensions.cs @@ -20,7 +20,7 @@ public static class DashExtensions /// /// The . /// - public static Dash.DashItem GetDashInfo(this Obj_AI_Base unit) => Library.Instance?.Dash?.GetDashInfo(unit); + public static Dash.DashItem GetDashInfo(this Obj_AI_Base unit) => Instances.Dash?.GetDashInfo(unit); /// /// Determines if the unit is dashing. @@ -31,7 +31,7 @@ public static class DashExtensions /// /// The . /// - public static bool IsDashing(this Obj_AI_Base unit) => Library.Instance?.Dash?.IsDashing(unit) ?? false; + public static bool IsDashing(this Obj_AI_Base unit) => Instances.Dash?.IsDashing(unit) ?? false; #endregion } diff --git a/source/Events/GameEvents.cs b/source/Events/GameEvents.cs index e2e35f4a..1bc2075c 100644 --- a/source/Events/GameEvents.cs +++ b/source/Events/GameEvents.cs @@ -5,6 +5,13 @@ 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. @@ -15,8 +22,41 @@ public static partial class CustomEvents /// The game events. /// [Export(typeof(Game))] - public partial class 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/OnGameLoad.cs b/source/Events/OnGameLoad.cs index 092b21df..b11c8950 100644 --- a/source/Events/OnGameLoad.cs +++ b/source/Events/OnGameLoad.cs @@ -7,13 +7,9 @@ namespace LeagueSharp.Common using System; using System.Collections.Generic; using System.Linq; - using System.Reflection; - - using log4net; using PlaySharp.Toolkit.AppDomain.Messages; using PlaySharp.Toolkit.EventAggregator; - using PlaySharp.Toolkit.Logging; /// /// Provides custom defined events. @@ -56,8 +52,6 @@ public partial class Game : IHandle private List InvocationList { get; } = new List(); - private ILog Log { get; } = AssemblyLogs.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - #endregion #region Public Methods and Operators 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 index c96de8a2..4a816b2e 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -77,10 +77,14 @@ Z:\References\SharpDX.Direct3D9.dll + + Z:\References\SharpDX.Menu.dll + + @@ -659,7 +663,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -673,6 +711,7 @@ Component + @@ -682,38 +721,20 @@ - + - - - - - - - - - - - - - - - - - - - + - + @@ -793,16 +814,9 @@ - - - - - - - - + \ No newline at end of file diff --git a/source/LeagueSharp.Common.csproj.DotSettings b/source/LeagueSharp.Common.csproj.DotSettings index 747e006e..402fcefa 100644 --- a/source/LeagueSharp.Common.csproj.DotSettings +++ b/source/LeagueSharp.Common.csproj.DotSettings @@ -132,6 +132,15 @@ True True True + True + True + True + True + True + True + True + True + True True True True diff --git a/source/Library.cs b/source/Library.cs index 6a5a6f35..92f52815 100644 --- a/source/Library.cs +++ b/source/Library.cs @@ -7,16 +7,18 @@ namespace LeagueSharp.Common using System; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; + using System.Diagnostics; using System.Globalization; using System.Security.Permissions; using System.Text; using System.Threading; + using LeagueSharp.Common.Configuration; + using PlaySharp.Toolkit.AppDomain.Loader; - using PlaySharp.Toolkit.EventAggregator; /// - /// Library entry point for external service loading. + /// The library manager. /// public class Library : ILibrary { @@ -25,96 +27,87 @@ public class Library : ILibrary /// /// Initializes a new instance of the class. /// - [PermissionSet(SecurityAction.Assert, Unrestricted = true)] public Library() { - Instance = this; - - 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; + Instances.Library = this; } #endregion - #region Public Properties - - /// - /// Gets the library instance. - /// - public static Library Instance { get; private set; } + #region Public Methods and Operators - /// - /// Gets the anti gapcloser. - /// - [Import(typeof(AntiGapcloser))] - public AntiGapcloser AntiGapcloser { get; private set; } + /// + public void Configure(CompositionContainer container) + { + ExpandConsole(); + CreateInstances(container); + } - /// - /// Gets the damage calculation system. - /// - [Import(typeof(Damage))] - public Damage Damage { get; private set; } + /// + public void Unload() + { + } - /// - /// Gets the dash system. - /// - [Import(typeof(Dash))] - public Dash Dash { get; private set; } + #endregion - /// - /// Gets the event aggregator. - /// - [Import(typeof(IEventAggregator))] - public IEventAggregator EventAggregator { get; private set; } + #region Methods /// - /// Gets the game custom events. + /// Creates static instances to support old API. /// - [Import(typeof(CustomEvents.Game))] - public CustomEvents.Game GameEvents { get; private set; } + /// + /// 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()); + } /// - /// Gets the map. + /// Expands the console on debug, requires permissions. /// - [Import(typeof(Utility.Map))] - public Utility.Map Map { get; private set; } + [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; - /// - /// Gets the minion manager. - /// - [Import(typeof(MinionManager))] - public MinionManager MinionManager { get; private set; } + Console.OutputEncoding = Encoding.Default; + Console.WindowWidth = (int)(Console.LargestWindowWidth / 1.5); + Console.BufferWidth = (int)(Console.LargestWindowWidth / 1.5); + Console.WindowHeight = Console.LargestWindowHeight / 2; + } /// - /// Gets the unit custom events. + /// Composes exported value macro. /// - [Import(typeof(CustomEvents.Unit))] - public CustomEvents.Unit UnitEvents { get; private set; } - - #endregion - - #region Public Methods and Operators - - /// - public void Configure(CompositionContainer container) - { - this.EventAggregator.Subscribe(this.GameEvents); - this.EventAggregator.Subscribe(this.UnitEvents); - this.Damage.SortSpells(); - } - - /// - public void Unload() + /// + /// The value type. + /// + /// + /// The container. + /// + /// + /// The value. + /// + /// + /// The value composed. + /// + private static T Export(CompositionContainer container, T value) { - Render.Terminate(); - Render.Circle.Dispose(this, EventArgs.Empty); + container.SatisfyImportsOnce(value); + container.ComposeExportedValue(value); + return value; } #endregion diff --git a/source/Old/Menu/Circle.cs b/source/Menu/Components/Circle.cs similarity index 53% rename from source/Old/Menu/Circle.cs rename to source/Menu/Components/Circle.cs index e095e73f..e203c2ea 100644 --- a/source/Old/Menu/Circle.cs +++ b/source/Menu/Components/Circle.cs @@ -1,37 +1,22 @@ -namespace LeagueSharp.Common +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common { - using System; using System.Drawing; + using System.Runtime.Serialization; /// /// The circle color spectrum (picker), with the toggle feature. /// - [Serializable] - public struct Circle + [DataContract] + public class 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. + /// Initializes a new instance of the class. /// /// /// Indicates whether the circle is active. @@ -49,6 +34,35 @@ public Circle(bool active, Color color, float radius = 100) 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 } } \ 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..9db464ab --- /dev/null +++ b/source/Menu/Components/KeyBind.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System.Runtime.Serialization; + + /// + /// The menu keybind. + /// + [DataContract] + public class KeyBind + { + #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 + } +} \ No newline at end of file diff --git a/source/Old/Menu/KeyBindType.cs b/source/Menu/Components/KeyBindType.cs similarity index 68% rename from source/Old/Menu/KeyBindType.cs rename to source/Menu/Components/KeyBindType.cs index 029f2faf..cb2c7fb4 100644 --- a/source/Old/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/source/Old/Menu/Slider.cs b/source/Menu/Components/Slider.cs similarity index 66% rename from source/Old/Menu/Slider.cs rename to source/Menu/Components/Slider.cs index 44bb84e1..95e509ea 100644 --- a/source/Old/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..67c13612 --- /dev/null +++ b/source/Menu/Components/StringList.cs @@ -0,0 +1,81 @@ +// +// 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 struct StringList : IUpdateableValue + { + #region Fields + + /// + /// The selected index. + /// + [DataMember] + public int SelectedIndex; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes a new instance of the struct.c + /// + /// + /// 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 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..1d4fd362 --- /dev/null +++ b/source/Menu/Configuration/MenuController.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Configuration +{ + using System.ComponentModel.Composition; + + using SharpDX; + using SharpDX.Menu; + + /// + /// The menu controller. + /// + [Export(typeof(IMenuController))] + public class MenuController : IMenuController + { + #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; private set; } = true; + + /// + 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..c5a6d8dc --- /dev/null +++ b/source/Menu/Configuration/MenuManager.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common.Configuration +{ + 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 Constructors and Destructors + + /// + /// Initializes a new instance of the class. + /// + public MenuManager() + { + /* + TargetSelector.Initialize(); + Prediction.Initialize(); + Hacks.Initialize(); + FakeClicks.Initialize();*/ + } + + #endregion + + #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 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); + } + + #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..089a25f4 --- /dev/null +++ b/source/Menu/Core/Menu.cs @@ -0,0 +1,285 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Collections.Generic; + using System.Drawing; + using System.Linq; + + 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) + { + 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..159c5076 --- /dev/null +++ b/source/Menu/Core/MenuItem.cs @@ -0,0 +1,356 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + using System.Drawing; + + using SharpDX; + using SharpDX.Menu; + + using Color = SharpDX.Color; + + /// + /// The menu item. + /// + public class MenuItem + { + #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. + /// + [Obsolete] + public ColorBGRA FontColor { get; set; } + + /// + /// Gets or sets the font style. + /// + [Obsolete] + public FontStyle FontStyle { get; set; } + + /// + /// Gets or sets the menu font size. + /// + [Obsolete] + public int MenuFontSize { get; set; } + + /// + /// Gets or sets the name. + /// + public string Name + { + get + { + return this.MenuItemReference.Name; + } + + set + { + // TODO: Log? + } + } + + /// + /// Gets or sets the parent. + /// + public Menu Parent { get; set; } + + /// + /// Gets or sets a value indicating whether to show the item. + /// + [Obsolete] + public bool ShowItem { get; set; } + + /// + /// 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 a value indicating whether the value was set. + /// + public bool ValueSet { get; private 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. + /// + [Obsolete] + public MenuItem DontSave() + { + 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. + /// + [Obsolete] + public bool IsActive() + { + return false; + } + + /// + /// Sets the font style. + /// + /// + /// The font style. + /// + /// + /// The font color. + /// + /// + /// The item instance. + /// + [Obsolete] + public MenuItem SetFontStyle(FontStyle fontStyle = FontStyle.Regular, Color? fontColor = null) + { + return this; + } + + /// + /// Sets the menu item to be shared. + /// + /// + /// The item instance. + /// + [Obsolete] + public MenuItem SetShared() + { + return this; + } + + /// + /// Sets the menu item tag. + /// + /// + /// The tag. + /// + /// + /// The item instance. + /// + [Obsolete("Use Tag Property.")] + 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 (!this.ValueSet) + { + this.ValueSet = true; + this.MenuItemReference = ComponentFactory.CreateItem(this.Name, this.DisplayName, newValue); + return this; + } + + var oldObject = this.MenuItemReference as IMenuItem; + var oldValue = oldObject != null ? oldObject.Value : default(T); + + this.MenuItemReference = new MenuItem(this.Name, this.DisplayName, newValue); + this.ValueChanged?.Invoke(this, new OnValueChangeEventArgs(oldValue, newValue) { MenuItemReference = this }); + + return this; + } + + /// + /// Shows the item. + /// + /// + /// Indicates whether to show the item. + /// + /// + /// The item instance. + /// + [Obsolete] + public MenuItem Show(bool showItem = true) + { + 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 + } +} \ No newline at end of file diff --git a/source/Old/Menu/MenuSettings.cs b/source/Menu/Core/MenuSettings.cs similarity index 53% rename from source/Old/Menu/MenuSettings.cs rename to source/Menu/Core/MenuSettings.cs index 1318c636..1b28f3ec 100644 --- a/source/Old/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/Old/Menu/ColorPicker.cs b/source/Menu/Items/ColorPicker.cs similarity index 100% rename from source/Old/Menu/ColorPicker.cs rename to source/Menu/Items/ColorPicker.cs diff --git a/source/Old/Menu/HSLColor.cs b/source/Menu/Items/HSLColor.cs similarity index 100% rename from source/Old/Menu/HSLColor.cs rename to source/Menu/Items/HSLColor.cs diff --git a/source/Old/Menu/MenuGlobals.cs b/source/Menu/MenuGlobals.cs similarity index 100% rename from source/Old/Menu/MenuGlobals.cs rename to source/Menu/MenuGlobals.cs diff --git a/source/Old/Menu/OnValueChangeEventArgs.cs b/source/Menu/OnValueChangeEventArgs.cs similarity index 91% rename from source/Old/Menu/OnValueChangeEventArgs.cs rename to source/Menu/OnValueChangeEventArgs.cs index 5f270035..4650a62e 100644 --- a/source/Old/Menu/OnValueChangeEventArgs.cs +++ b/source/Menu/OnValueChangeEventArgs.cs @@ -50,6 +50,15 @@ public OnValueChangeEventArgs(object oldValue, object newValue) #endregion + #region Properties + + /// + /// Gets or sets the menu item reference. + /// + internal MenuItem MenuItemReference { get; set; } + + #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..3579b0d4 --- /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) + { + 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) + { + 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, 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..49ff0e32 --- /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) + { + 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) + { + 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..acc34146 --- /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) + { + 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..6cd4a715 --- /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) + { + 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) + { + 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..d23b1a55 --- /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) + { + 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..7678940d --- /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) + { + 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..20ae5e18 --- /dev/null +++ b/source/Menu/View/SharedView.cs @@ -0,0 +1,240 @@ +// +// 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 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..70f833cb --- /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) + { + 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) + { + 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..8c355dfc --- /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) + { + 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) + { + 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..9e0ce096 --- /dev/null +++ b/source/Menu/View/StringListView.cs @@ -0,0 +1,148 @@ +// +// 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 StringListView : View + { + #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() + { + 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 StringListView(component); + } + + /// + public override void OnAttributeChange() + { + this.CreateContext(); + } + + /// + public override void OnDraw() + { + if (this.Component == null) + { + return; + } + + this.Sprites[this.Component.Value.SelectedIndex].Position = this.Component.Position; + this.Sprites[this.Component.Value.SelectedIndex].OnEndScene(); + } + + /// + public override void OnUpdate() + { + } + + /// + public override void OnWindowProc(uint message, uint wParam, long lParam) + { + } + + #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 viewAttributes = new ViewAttributes(this); + + for (var i = 0; i < this.Component.Value.Items.Length; ++i) + { + var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 1); + using (var graphics = Graphics.FromImage(bitmap)) + { + var boxSize = (height / 2) + 5; + var title = $"{this.Component.DisplayName}: {this.Component.Value.Items[i]}"; + var color = Color.FromArgb(255, 20, 90, 175); + + SharedView.CreateBackgroundView(graphics, 0, 0, width, height); + SharedView.CreateTitle(graphics, boxSize, 0, width - boxSize, height, title, viewAttributes); + SharedView.CreateBox(graphics, 5, 5, height / 2, height - 10, color, "<"); + SharedView.CreateBox(graphics, width - boxSize, 5, height / 2, height - 10, color, ">"); + } + + this.Sprites[i] = new Render.Sprite(bitmap, default(Vector2)); + } + } + + #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..9a610101 --- /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) + { + 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) + { + 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/MinionInfo.cs b/source/Minion/MinionInfo.cs index 9ba06a12..053ab002 100644 --- a/source/Minion/MinionInfo.cs +++ b/source/Minion/MinionInfo.cs @@ -46,31 +46,27 @@ public MinionInfo(Obj_AI_Minion minion) this.IsMinion = minion.Name.Contains("Minion"); this.IsWard = minion.Name.Contains("Ward"); - - var isJungleMob = false; - if (SmallNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex))) - { - this.JungleType = JungleType.Small; - isJungleMob = true; - } - else if (LargeNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex))) - { - this.JungleType = JungleType.Large; - isJungleMob = true; - } - else if (LegendaryNameRegex.Any(regex => Regex.IsMatch(minion.Name, regex))) - { - this.JungleType = JungleType.Legendary; - isJungleMob = true; - } - - this.IsJungleMob = isJungleMob; + 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) @@ -78,9 +74,9 @@ public MinionInfo(Obj_AI_Minion minion) return; } - this.Lane = (LaneType)Convert.ToInt32(regex.Groups["Lane"]); - this.Wave = Convert.ToInt32(regex.Groups["Wave"]); - this.Index = Convert.ToInt32(regex.Groups["Index"]); + 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); } } @@ -133,6 +129,11 @@ public MinionInfo(Obj_AI_Minion minion) /// public LaneType Lane { get; } + /// + /// Gets the minion level. + /// + public int Level { get; } + /// /// Gets the wave. /// diff --git a/source/Minion/MinionManager.cs b/source/Minion/MinionManager.cs index 3e61afb7..34616535 100644 --- a/source/Minion/MinionManager.cs +++ b/source/Minion/MinionManager.cs @@ -23,6 +23,7 @@ public MinionManager() { GameObject.OnCreate += this.OnCreate; GameObject.OnDelete += this.OnDelete; + CustomEvents.Game.OnGameLoad += this.OnLoad; } #endregion @@ -41,7 +42,7 @@ public MinionManager() private void OnCreate(GameObject sender, EventArgs args) { var minion = sender as Obj_AI_Minion; - if (minion != null) + if (minion != null && !this.MinionInfos.ContainsKey(minion.NetworkId)) { this.MinionInfos.Add(minion.NetworkId, new MinionInfo(minion)); } @@ -56,6 +57,17 @@ private void OnDelete(GameObject sender, EventArgs args) } } + 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 index 9cedec7a..ac03b0cc 100644 --- a/source/Minion/MinionManagerAdapter.cs +++ b/source/Minion/MinionManagerAdapter.cs @@ -26,7 +26,7 @@ public partial class MinionManager /// /// Gets the instance. /// - public static MinionManager Instance => Library.Instance?.MinionManager; + public static MinionManager Instance => Instances.MinionManager; #endregion diff --git a/source/Native/HeroManager.cs b/source/Native/HeroManager.cs new file mode 100644 index 00000000..f7d1cd08 --- /dev/null +++ b/source/Native/HeroManager.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) LeagueSharp. All rights reserved. +// + +namespace LeagueSharp.Common +{ + using System; + 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() + { + CustomEvents.Game.OnGameLoad += this.OnGameLoad; + } + + #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; private set; } + + /// + /// Gets all of the ally heroes. + /// + public List Ally { get; private set; } + + /// + /// Gets all of the enemies. + /// + public List Enemy { get; private set; } + + /// + /// Gets the local player + /// + public Obj_AI_Hero LocalPlayer { get; private set; } + + #endregion + + #region Methods + + private void OnGameLoad(EventArgs eventArgs) + { + 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 + } +} \ 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/Old/FakeClicks.cs b/source/Old/FakeClicks.cs index eb252b50..2f5c11cf 100644 --- a/source/Old/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/source/Old/Hacks.cs b/source/Old/Hacks.cs index 00ac65c1..4d5d8185 100644 --- a/source/Old/Hacks.cs +++ b/source/Old/Hacks.cs @@ -25,6 +25,10 @@ internal class Hacks private static MenuItem MenuTowerRange; + #endregion + + #region Public Properties + public static bool AntiAFK { get @@ -106,57 +110,54 @@ public static void Shutdown() #region Methods - /// - /// Initializes this instance. - /// - internal static void Initialize() + internal static void Initialize(Menu commonMenu) { - 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.AddSubMenu(menu); + + Game.OnWndProc += args => { - 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; - } - }; + 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; + } }; } diff --git a/source/Old/HeroManager.cs b/source/Old/HeroManager.cs deleted file mode 100644 index de7e22d5..00000000 --- a/source/Old/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/source/Old/Menu/CPSlider.cs b/source/Old/Menu/CPSlider.cs deleted file mode 100644 index c8bacf78..00000000 --- a/source/Old/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/source/Old/Menu/CommonMenu.cs b/source/Old/Menu/CommonMenu.cs deleted file mode 100644 index 694912b4..00000000 --- a/source/Old/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/source/Old/Menu/KeyBind.cs b/source/Old/Menu/KeyBind.cs deleted file mode 100644 index 657c8fb5..00000000 --- a/source/Old/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/source/Old/Menu/KeybindSetStage.cs b/source/Old/Menu/KeybindSetStage.cs deleted file mode 100644 index fe1be363..00000000 --- a/source/Old/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/source/Old/Menu/Menu.cs b/source/Old/Menu/Menu.cs deleted file mode 100644 index 4b63f416..00000000 --- a/source/Old/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/source/Old/Menu/MenuDrawHelper.cs b/source/Old/Menu/MenuDrawHelper.cs deleted file mode 100644 index 905150b9..00000000 --- a/source/Old/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/source/Old/Menu/MenuItem.cs b/source/Old/Menu/MenuItem.cs deleted file mode 100644 index ae5f9071..00000000 --- a/source/Old/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/source/Old/Menu/MenuValueType.cs b/source/Old/Menu/MenuValueType.cs deleted file mode 100644 index 6cfd7488..00000000 --- a/source/Old/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/source/Old/Menu/SavedSettings.cs b/source/Old/Menu/SavedSettings.cs deleted file mode 100644 index 3caf4382..00000000 --- a/source/Old/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/source/Old/Menu/StringList.cs b/source/Old/Menu/StringList.cs deleted file mode 100644 index 53c36732..00000000 --- a/source/Old/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/source/Old/MultiLanguage.cs b/source/Old/MultiLanguage.cs deleted file mode 100644 index d34ea71d..00000000 --- a/source/Old/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/source/Old/Orbwalking.cs b/source/Old/Orbwalking.cs index 36367755..be76b9aa 100644 --- a/source/Old/Orbwalking.cs +++ b/source/Old/Orbwalking.cs @@ -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()) { diff --git a/source/Old/Packet.cs b/source/Old/Packet.cs new file mode 100644 index 00000000..3e1009a0 --- /dev/null +++ b/source/Old/Packet.cs @@ -0,0 +1,4706 @@ +#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 +{ + + /// + /// Helps in decoding packets. This is not currently updated past 4.21! + /// + [Obsolete("Jodus wears dirty socks", false)] + public static class Packet + { + /// + /// Initializes static members of the class. + /// + static Packet() + { + Console.WriteLine(@"LeagueSharp.Common.Packet will be removed soon, use LeagueSharp.Network.Packets instead"); + } + + /// + /// The states of actions. + /// + public enum ActionStates + { + /// + /// The begin recall state + /// + BeginRecall = 111207118, + + /// + /// The finish recall state + /// + FinishRecall = 97690254, + } + + /// + /// The type of attack. + /// + public enum AttackTypePacket + { + /// + /// Circular skillshots. + /// + Circular = 0, + + /// + /// Cone and Skillshot spells + /// + ConeSkillShot = 1, + + /// + /// Targeted spells and AAs + /// + TargetedAA = 2, + } + + /// + /// The type of damage. + /// + public enum DamageTypePacket + { + /// + /// Magical Damage (AP) + /// + Magical = 4, + + /// + /// A Critical Attack + /// + CriticalAttack = 11, + + /// + /// Physical Damage (AD) + /// + Physical = 12, + + /// + /// True Damage + /// + True = 36, + } + + /// + /// Types of emotes. + /// + public enum Emotes + { + /// + /// Dance + /// + Dance = 0x00, + + /// + /// Joke + /// + Joke = 0x03, + + /// + /// Taunt + /// + Taunt = 0x01, + + /// + /// Laugh + /// + Laugh = 0x02, + } + + /// + /// Type of floating text on a hero. + /// + public enum FloatTextPacket + { + /// + /// Invulnerable + /// + Invulnerable, + + /// + /// Special + /// + Special, + + /// + /// Heal + /// + Heal, + + /// + /// Mana heal + /// + ManaHeal, + + /// + /// Mana Damage + /// + ManaDmg, + + /// + /// Dodge + /// + Dodge, + + /// + /// Critical + /// + Critical, + + /// + /// Experience + /// + Experience, + + /// + /// Gold + /// + Gold, + + /// + /// Level + /// + Level, + + /// + /// Disable + /// + Disable, + + /// + /// Quest Received + /// + QuestRecv, + + /// + /// Quest Done + /// + QuestDone, + + /// + /// Score + /// + Score, + + /// + /// Physical Damage + /// + PhysDmg, + + /// + /// Magic Damage + /// + MagicDmg, + + /// + /// True Damage + /// + TrueDmg, + + /// + /// Enemy Physical Damage + /// + EnemyPhysDmg, + + /// + /// Enemy Magic Damage + /// + EnemyMagicDmg, + + /// + /// Enemy True Damage + /// + EnemyTrueDmg, + + /// + /// Enemy Critical + /// + EnemyCritical, + + /// + /// Countdown + /// + Countdown, + + /// + /// Legacy + /// + Legacy, + + /// + /// Legacy critical + /// + LegacyCritical, + + /// + /// Debug + /// + Debug + } + + /// + /// 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 + /// + Unknown100 = 0x00, + + /// + /// The unknown101 + /// + Unknown101 = 0x01, + + /// + /// The unknown102 + /// + Unknown102 = 0x02, + + /// + /// The unknown115 + /// + Unknown115 = 0x15, + + /// + /// The unknown116 + /// + Unknown116 = 0x16, + + /// + /// The unknown124 + /// + Unknown124 = 0x24, + + /// + /// The unknown11 a + /// + Unknown11A = 0x1A, + + /// + /// The unknown11 e (Currently Empty) + /// + Unknown11E = 0x1E, + + /* These others could be packets with a handler */ + /// + /// The unknown104. Somehow related to spell slots. + /// + Unknown104 = 0x04, + + /// + /// The unknown118. (Sion Ult) + /// + Unknown118 = 0x08, + + /// + /// The unknown120 + /// + Unknown120 = 0x20, // confirmed in game + + /// + /// 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. + /// + InitSpell = 0x07, + + /// + /// The unknown10 c. + /// + Unknown10C = 0x0C, //this packet is like 0x127 + + /// + /// The unknown122 + /// + Unknown122 = 0x22, + + /// + /// 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 + + /// + /// The NPC death packet + /// + NPCDeath = 0x26, //confirmed in ida, struct from intwars/ida + /// + /// The unknown129. Related to spells. + /// + Unknown129 = 0x29, //related to spells (kalista ally unit), add? + /// + /// 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 + /// + 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 + /// + Unknown12E = 0x2E, //confirmed in ida + + /// + /// The unknown12 f + /// + Unknown12F = 0x2F, //FE 05 00 00 40 2F 01 00 + + /// + /// The add buff packet. + /// + AddBuff = 0x09, // buff added by towers in new SR + + /// + /// The undo token packet + /// + UndoToken = 0x0B, + + /// + /// The object creation packet. Used for Azir's ult. + /// + ObjectCreation = 0x0D, // azir ult + + /// + /// The surrender state packet + /// + SurrenderState = 0x0E, + + /// + /// The on attack packet. + /// + OnAttack = 0x0F, + + /// + /// The death timer packet. + /// + DeathTimer = 0x17, + + /// + /// The change item packet. (EX: Health Potion to Biscuit) + /// + ChangeItem = 0x1C, //like hpp=>biscuit + + /// + /// The action state packet. Triggers on recall. + /// + ActionState = 0x21, // ?? triggers on recall + + /// + /// The undo confirmation packet. + /// + UndoConfirm = 0x27, + + /// + /// The lock camera packet for Sion's Ult. + /// + LockCamera = 0x2B, // Sion Ult + + /// + /// An unkown packet. + /// + Unknown = 0xFF, // Default, not real packet + } + + /// + /// The type of ping. + /// + public enum PingType + { + /// + /// A normal ping. + /// + Normal = 0, + + /// + /// A fallback ping. + /// + Fallback = 5, + + /// + /// An enemy missing ping. + /// + EnemyMissing = 3, + + /// + /// A danagr ping. + /// + Danger = 2, + + /// + /// An on my way ping. + /// + OnMyWay = 4, + + /// + /// An assist me ping. + /// + AssistMe = 6, + } + + /// + /// Contains packets that are sent from the client (the game) to the server. + /// + public static class C2S + { + #region Ping - 4.21 + + /// + /// Ping Packet. Sent by the client when pings are sent. + /// + public static class Ping + { + /// + /// The header + /// + public static byte Header = 0x1D; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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); + return result; + } + + /// + /// 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()); + } + + /// + /// Repreents a ping packet. + /// + public struct Struct + { + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The ping type + /// + public PingType Type; + + /// + /// The x position + /// + public float X; + + /// + /// The y position + /// + public float Y; + + /// + /// 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) + { + X = x; + Y = y; + TargetNetworkId = targetNetworkId; + Type = type; + } + } + } + + #endregion + + #region LevelUpSpell - 4.21 + + /// + /// Packet sent when leveling up a spell. + /// + public static class LevelUpSpell + { + /// + /// The header + /// + public static byte Header = 0xEC; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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); + return result; + } + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data) { Position = 2 }; + var result = new Struct(); + + 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. + /// + /// 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); + return result; + } + + /// + /// 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.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; + } + + /// + /// Represents a move packet. + /// + public struct Struct + { + /// + /// 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 + /// + public float X; + + /// + /// The y position + /// + public float Y; + + /// + /// 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) + { + 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 + + #region Cast - 4.21 + + /// + /// Packet sent when casting spells. + /// + public static class Cast + { + /// + /// The header + /// + public static byte Header = 0xDE; + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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); + 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. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data); + 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; + } + + /// + /// Gets the spell byte. + /// + /// The spell. + /// System.Byte. + private static byte GetSpellByte(SpellSlot spell) + { + 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; + } + } + + /// + /// Represents a spell cast packet. + /// + public struct Struct + { + /// + /// 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 + /// + public SpellSlot Slot; + + /// + /// The source network identifier + /// + public int SourceNetworkId; + + /// + /// The spell flag + /// + public byte SpellFlag; + + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The end X position of where the spell is going to. + /// + public float ToX; + + /// + /// To end Y position of where the spell is going to. + /// + public float ToY; + + /// + /// 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. + /// 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, + byte spellFlag = 0xFF) + { + SourceNetworkId = (sourceNetworkId == -1) ? ObjectManager.Player.NetworkId : sourceNetworkId; + Slot = slot; + FromX = fromX; + FromY = fromY; + ToX = toX; + ToY = toY; + TargetNetworkId = targetNetworkId; + SpellFlag = spellFlag; + } + } + } + + #endregion + + #region ChargedCast - 4.21 + + /// + /// Packet sent when casting charged spells second cast. + /// + public static class ChargedCast + { + /// + /// The header + /// + public static byte Header = 0x03; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// Encodes the specified packet structure. + /// + /// 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. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data); + var result = new Struct(); + packet.Position = 2; + result.SourceNetworkId = packet.ReadInteger(); + result.Slot = (SpellSlot) packet.ReadByte(); + result.ToX = packet.ReadFloat(); + result.ToY = packet.ReadFloat(); + result.ToZ = packet.ReadFloat(); + return result; + } + + /// + /// Represents a charged cast packet. + /// + public struct Struct + { + /// + /// The slot + /// + public SpellSlot Slot; + + /// + /// The source network identifier + /// + public int SourceNetworkId; + + /// + /// The X position of where the spell is going to. + /// + public float ToX; + + /// + /// The Y position of where the spell is going to. + /// + public float ToY; + + /// + /// The Z position of where the spell is going to. + /// + public float ToZ; + + + /// + /// Initializes a new instance of the struct. + /// + /// 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) + { + SourceNetworkId = (sourceNetworkId == -1) ? ObjectManager.Player.NetworkId : sourceNetworkId; + Slot = slot; + ToX = toX; + ToY = toY; + ToZ = toZ; + } + } + } + + #endregion + + #region BuyItem - 4.21 + + /// + /// Packet sent when buying items. + /// + public static class BuyItem + { + /// + /// The header + /// + public static byte Header = 0xC6; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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. + /// + /// 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; + } + + /// + /// Reprents the packet sent when an item is bought. + /// + public struct Struct + { + /// + /// The item identifier + /// + public int ItemId; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// 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 selling items. + /// + public static class SellItem + { + /// + /// The header + /// + public static byte Header = 0x72; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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); + return result; + } + + /// + /// 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); + } + + /// + /// Packet sent on selling an item. + /// + public struct Struct + { + /// + /// The inventory slot + /// + public byte InventorySlot; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The spell slot + /// + public SpellSlot SpellSlot; + + /// + /// 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; + } + + + /// + /// Initializes a new instance of the struct. + /// + /// The slot. + /// The network identifier. + public Struct(SpellSlot slot, int networkId = -1) + { + SpellSlot = slot; + InventorySlot = (byte) ((byte) SpellSlot - (byte) SpellSlot.Item1); + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + } + } + } + + #endregion + + #region SwapItem - 4.21 + + /// + /// Packet sent when swapping items. + /// + public static class SwapItem + { + /// + /// The header + /// + public static byte Header = 0x55; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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; + } + + /// + /// 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(); + result.FromSlotByte = packet.ReadByte(); + result.ToSlotByte = packet.ReadByte(); + return result; + } + + /// + /// Represents the packet sent when you swap an item in your inventory. + /// + public struct Struct + { + /// + /// From slot byte + /// + public byte FromSlotByte; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// To slot byte + /// + public byte ToSlotByte; + + /// + /// 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) + { + FromSlotByte = fromSlotByte; + ToSlotByte = toSlotByte; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + } + } + } + + #endregion + + #region Emote - 4.21 + + /// + /// Packet sent when sending emotes. + /// + public static class Emote + { + /// + /// The header + /// + public static byte Header = 0x14; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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. + /// + /// 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.EmoteId = packet.ReadByte(); + return result; + } + + /// + /// Represents the packet sent when you cast an emote. + /// + public struct Struct + { + /// + /// The emote identifier + /// + public byte EmoteId; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The emote identifier. + /// The network identifier. + public Struct(byte emoteId, int networkId = -1) + { + EmoteId = emoteId; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + } + } + } + + #endregion + + #region InteractObject - 4.21 + + /// + /// Packet sent when interacting with Thresh Lantern and Dominion capturing. + /// + public static class InteractObject + { + /// + /// The header + /// + public static byte Header = 0x86; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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; + } + + /// + /// 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; + } + + /// + /// Represents the packet sent when you interact with an object. + /// + public struct Struct + { + /// + /// The object network identifier + /// + public int ObjectNetworkId; + /// + /// The source network identifier + /// + public int SourceNetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The network identifier. + /// The object network identifier. + public Struct(int networkId, int objectNetworkId) + { + SourceNetworkId = networkId; + ObjectNetworkId = objectNetworkId; + } + } + } + + #endregion + + #region SetTarget - 4.21 + + /// + /// Packet sent when left clicking a target. + /// + public static class SetTarget + { + /// + /// The header + /// + public static byte Header = 0x04; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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); + return result; + } + + /// + /// Represents the packet sent when left clicking a target. + /// + public struct Struct + { + /// + /// The network identifier + /// + public int NetworkId; + /// + /// The unit + /// + public Obj_AI_Base Unit; + } + } + + #endregion + + #region HeartBeat - 4.21 + + /// + /// Packet sent frequently as heartbeat to servers. + /// Related to 0x29 (Recv) + /// + public static class HeartBeat + { + /// + /// The header + /// + public static byte Header = 0x4C; + + /// + /// 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) }; + return result; + } + + /// + /// Represents a heart beat packet. + /// + public struct Struct + { + /// + /// The ack time + /// + public float AckTime; + /// + /// The recv time + /// + public float RecvTime; + } + } + + #endregion + + #region UpdateConfirm + + /// + /// Packet sent to acknowledge the received update packet. + /// + public static class UpdateConfirm + { + /// + /// The header + /// + public static byte Header = 0xA8; + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + var packet = new GamePacket(data); + var result = new Struct { SequenceId = packet.ReadInteger(5) }; + return result; + } + + /// + /// Represents the packet sent to acknowledge the received update packet + /// + public struct Struct + { + /// + /// The sequence identifier + /// + public int SequenceId; + } + } + + #endregion + + #region Refund - 4.21 + + /// + /// Sent by client on refund. + /// + public static class Refund + { + /// + /// The header + /// + public static byte Header = 0x54; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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); + return result; + } + + /// + /// 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; + } + + /// + /// Represents the packet sent when refunding an item. + /// + public struct Struct + { + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The network identifier. + public Struct(int networkId = -1) + { + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + } + } + } + + #endregion + + #region ScoreScreen - 4.21 (NO STRUCT) + + /// + /// Sent by client on opening score screen. + /// + public static class ScoreScreen + { + /// + /// The header + /// + public static byte Header = 0x15; + } + + #endregion + + #region Camera - 4.21 (NO STRUCT) + + /// + /// Sent by client on center/lock camera. + /// + public static class Camera + { + /// + /// The header + /// + public static byte Header = 0x64; + } + + #endregion + + #region Zoom - 4.21 (NO STRUCT) + + /// + /// Sent by client on zoom level change or move camera. + /// + public static class Zoom + { + /// + /// The header + /// + public static byte Header = 0xDC; + } + + #endregion + + #region LeaveGame - 4.21 (NO STRUCT) + + /// + /// Sent by client on exiting the game. + /// + public static class LeaveGame + { + //75 00 00 00 00 00 5A + /// + /// The header + /// + public static byte Header = 0x75; + } + + #endregion + + #region Surrender - 4.21 (NO STRUCT) + + /// + /// Sent by client on surrendering. + /// + public static class Surrender + { + //A2 00 00 00 00 00 AB + /// + /// The header + /// + public static byte Header = 0xA2; + } + + #endregion + + #region EndGame - 4.21 (NO STRUCT) + + /// + /// Sent by client when the game is over. + /// + public static class EndGame + { + //1E 00 00 00 00 00 + /// + /// The header + /// + public static byte Header = 0x1E; + } + + #endregion + + #region WaypointConfirm 4.21 (NO STRUCT) + + /// + /// Sent by client to confirm receiving waypoints. + /// + public static class WaypointConfirm + { + //36 00 00 00 00 00 83 7F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + /// + /// The header + /// + public static byte Header = 0x36; + } + + #endregion + + #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 + /// + /// The header + /// + public static byte Header = 0x00; + } + + #endregion + + + #region Resume 4.21 (NO STRUCT) + + /// + /// 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; + } + + #endregion + } + + /// + /// Contains packet that are sent from the server to the client (the game). + /// + public static class S2C + { + #region Ping - 4.21 + + /// + /// RPing Packet. Received when ally team players send a SPing packet. + /// + public static class Ping + { + /// + /// The header + /// + public static byte Header = 0x60; + + /// + /// The channel + /// + public static PacketChannel Channel = PacketChannel.C2S; + + /// + /// The flags + /// + public static PacketProtocolFlags Flags = PacketProtocolFlags.Reliable; + + /// + /// 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; + } + + /// + /// 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 an ally sends a ping. + /// + public struct Struct + { + /// + /// true if the ping is silent, meaning that the ping produces no sound. + /// + public bool Silent; + + /// + /// The source network identifier + /// + public int SourceNetworkId; + + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The ping type + /// + public PingType Type; + + /// + /// The x position + /// + public float X; + + /// + /// The y position + /// + public float Y; + + /// + /// Initializes a new instance of the struct. + /// + /// 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 enters FOW. + /// + public static class GainVision + { + /// + /// The header + /// + public static byte Header = 0xFC; + + /// + /// 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; + } + + /// + /// 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; + } + + /// + /// Represents the packet received when the team gains vision of a unit. + /// + public struct Struct + { + /// + /// The unit network identifier + /// + public int UnitNetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The unit network identifier. + public Struct(int unitNetworkId = 0) + { + UnitNetworkId = unitNetworkId; + } + } + } + + #endregion + + #region LoseVision - 4.21 + + /// + /// Gets received when a unit leaves FOW. + /// + public static class LoseVision + { + /// + /// The header + /// + public static byte Header = 0xCD; + + + /// + /// 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); + return result; + } + + /// + /// 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 loses vision of an unit. + /// + public struct Struct + { + /// + /// The unit network identifier + /// + public int UnitNetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The unit network identifier. + public Struct(int unitNetworkId = 0) + { + UnitNetworkId = unitNetworkId; + } + } + } + + #endregion + + #region EmptyJungleCamp - 4.21 partially + /// + /// Gets received when gaining vision of an empty jungle camp. Partially implemented. + /// + public static class EmptyJungleCamp + { + /// + /// The header + /// + public static byte Header = 0x93; + + /// + /// 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); + return result; + } + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + 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; + } + + /// + /// Represents the packet received when a jungle camp is empty. + /// + public struct Struct + { + /// + /// The camp identifier + /// + public int CampId; + + /// + /// The empty type + /// + public byte EmptyType; + + /// + /// The unit network identifier + /// + public int UnitNetworkId; + + /// + /// 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) + { + UnitNetworkId = unitNetworkId; + CampId = campId; + EmptyType = emptyType; + } + } + } + + #endregion + + #region CastAns + + /// + /// Received when a unit casts a spell. + /// + public static class CastAns + { + /// + /// The header + /// + public static byte Header = 0xB5; + + /// + /// 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. + /// + /// 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); + + + 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)); + + return result; + } + + /// + /// Represents the packet received when a spell is casted. + /// + public struct Struct + { + /// + /// 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 + /// + public int MissileNetworkId; + + /// + /// 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 + /// + public SpellSlot SpellSlot; + + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The target unit + /// + public Obj_AI_Base TargetUnit; + + /// + /// To position + /// + public Vector2 ToPosition; + + /// + /// 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 a unit dashes. + /// + public static class Dash + { + /// + /// The header + /// + public static byte Header = 0xD7; + + /// + /// 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. + /// + /// 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; + } + + /// + /// Represents the packet received when a unit dashes. + /// + public struct Struct + { + /// + /// The speed + /// + public float Speed; + /// + /// The unit network identifier + /// + public int UnitNetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The unit network identifier. + /// The speed. + public Struct(int unitNetworkId = 0, float speed = 0) + { + UnitNetworkId = unitNetworkId; + Speed = speed; + } + } + } + + #endregion + + #region GameEnd - 4.21 + + /// + /// Gets received when the game ends. + /// + public static class GameEnd + { + /// + /// The header + /// + public static byte Header = 0xED; + + /// + /// 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. + /// + /// 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; + } + + /// + /// Represents the packet received when the game ends. + /// + public struct Struct + { + /// + /// The winner + /// + public byte Winner; + + /// + /// Initializes a new instance of the struct. + /// + /// The winner. + public Struct(byte winner = 1) + { + Winner = winner; + } + } + } + + #endregion + + #region TowerAggro + + /// + /// Gets received when a tower starts targeting a unit + /// + public static class TowerAggro + { + /// + /// The header + /// + public static byte Header = 0x6A; + + /// + /// The aggro list + /// + public static readonly Dictionary AggroList = new Dictionary(); + + /// + /// 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; + } + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + 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; + } + + return result; + } + + /// + /// Represents the packet received when a tower focuses a target. + /// + public struct Struct + { + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The turret network identifier + /// + public int TurretNetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The turret network identifier. + /// The target network identifier. + public Struct(int turretNetworkId, int targetNetworkId) + { + TurretNetworkId = turretNetworkId; + TargetNetworkId = targetNetworkId; + } + } + } + + #endregion + + #region UpdateModel + + /// + /// Gets received when the model changes. + /// + public static class UpdateModel + { + /// + /// The header + /// + public static byte Header = 0x1A; + + /// + /// 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); + } + } + + return result; + } + + /// + /// 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.Id = packet.ReadInteger(); + result.BOk = packet.ReadByte() == 0x01; + result.SkinId = packet.ReadInteger(); + + return result; + } + + /// + /// Represents the packet received when the model of a unit is updated. + /// + public struct Struct + { + /// + /// 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 + /// + public int SkinId; + + /// + /// 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) + { + NetworkId = networkId; + Id = id != -1 ? id : NetworkId & ~0x40000000; + BOk = bOk; + SkinId = skinId; + ModelName = modelName; + } + } + } + + #endregion + + #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 + { + /// + /// The teleport has been started. + /// + Start, + + /// + /// The teleport has been aborted. + /// + Abort, + + /// + /// The teleport has finished. + /// + Finish, + + /// + /// The status of the teleport is unknown. + /// + Unknown + } + + /// + /// The type of teleport. + /// + public enum Type + { + /// + /// 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. + /// + TwistedFate, + + /// + /// The unit is teleporting to a unit with Shen's Ultimate. + /// + Shen, + + /// + /// The type of teleportation is unknown. + /// + Unknown + } + + /// + /// An interface for different types of teleports to get durations and type of teleport. + /// + internal interface ITeleport + { + /// + /// Gets the type. + /// + /// The type. + Type Type { get; } + + /// + /// Gets the duration. + /// + /// The instance containing the event data. + /// System.Int32. + int GetDuration(GameObjectTeleportEventArgs packetData); + } + + /// + /// A recall teleport. + /// + internal class RecallTeleport : ITeleport + { + /// + /// Gets the type. + /// + /// The type. + public Type Type + { + get { return Type.Recall; } + } + + /// + /// Gets the duration. + /// + /// The instance containing the event data. + /// System.Int32. + public int GetDuration(GameObjectTeleportEventArgs args) + { + return Utility.GetRecallTime(args.RecallName); + } + } + + /// + /// A teleport summoner spell teleport. + /// + internal class TeleportTeleport : ITeleport + { + /// + /// Gets the type. + /// + /// The type. + public Type Type + { + get { return Type.Teleport; } + } + + /// + /// Gets the duration. + /// + /// The instance containing the event data. + /// System.Int32. + public int GetDuration(GameObjectTeleportEventArgs args) + { + return 3500; + } + } + + /// + /// A Twisted Fate's Ultimate Teleport. + /// + internal class TwistedFateTeleport : ITeleport + { + /// + /// Gets the type. + /// + /// The type. + public Type Type + { + get { return Type.TwistedFate; } + } + + /// + /// Gets the duration. + /// + /// The instance containing the event data. + /// System.Int32. + public int GetDuration(GameObjectTeleportEventArgs args) + { + return 1500; + } + } + + /// + /// A Shen's Ultimate teleport. + /// + internal class ShenTeleport : ITeleport + { + /// + /// Gets the type. + /// + /// The type. + public Type Type + { + get { return Type.Shen; } + } + + /// + /// Gets the duration. + /// + /// The instance containing the event data. + /// System.Int32. + public int GetDuration(GameObjectTeleportEventArgs args) + { + return 3000; + } + } + + + /// + /// The header + /// + public static byte Header = 0x44; + + /// + /// The error gap in ticks. + /// + private const int ErrorGap = 100; //in ticks + + /// + /// The type by string + /// + private static readonly IDictionary TypeByString = new Dictionary + { + {"Recall", new RecallTeleport()}, + {"Teleport", new TeleportTeleport()}, + {"Gate", new TwistedFateTeleport()}, + {"Shen", new ShenTeleport()}, + }; + + /// + /// The recall data by network identifier + /// + private static readonly IDictionary RecallDataByNetworkId = + new Dictionary(); + + /// + /// 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 sender. + /// + /// The sender. + /// The instance containing the event data. + /// Struct. + public static Struct Decoded(GameObject sender, GameObjectTeleportEventArgs args) // + { + 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)) + { + if (TypeByString.ContainsKey(args.RecallType)) + { + ITeleport teleportMethod = TypeByString[args.RecallType]; + + int duration = teleportMethod.GetDuration(args); + Type type = teleportMethod.Type; + int 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; + } + } + 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; + } + + /// + /// Contains data about the teleport. + /// + internal struct TeleportData + { + /// + /// Gets or sets the type. + /// + /// The type. + public Type Type { get; set; } + + /// + /// Gets or sets the start. + /// + /// The start. + public int Start { get; set; } + + /// + /// Gets or sets the duration. + /// + /// The duration. + public int Duration { get; set; } + + } + + /// + /// Represents the packet received when a unit teleports. + /// + public struct Struct + { + /// + /// The duration + /// + public int Duration; + + /// + /// The status + /// + public Status Status; + + /// + /// The type + /// + public Type Type; + + /// + /// The start + /// + public int Start; + + /// + /// The unit network identifier + /// + public int UnitNetworkId; + + /// + /// 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 + + /// + /// Gets received when an unit uses an emote. + /// + public static class PlayEmote + { + /// + /// The header + /// + public static byte Header = 0xAA; + + /// + /// 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. + /// + /// The data. + /// Struct. + 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; + } + + /// + /// Represents the packet received when a unit uses an emote. + /// + public struct Struct + { + /// + /// The emote identifier + /// + public byte EmoteId; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// Initializes a new instance of the struct. + /// + /// The emote identifier. + /// The network identifier. + public Struct(byte emoteId, int networkId = -1) + { + EmoteId = emoteId; + NetworkId = networkId == -1 ? ObjectManager.Player.NetworkId : networkId; + } + } + } + + #endregion + + #region Damage - 4.21 partially + + /// + /// Packet received when a unit deals damage. + /// + public class Damage + { + /// + /// The header + /// + public static byte Header = 0x23; + + /// + /// 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.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; + } + + /// + /// 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.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; + } + + /// + /// Represents the packet received when unit deals damage. + /// + public struct Struct + { + /// + /// The damage amount + /// + public float DamageAmount; + + /// + /// The source network identifier + /// + public int SourceNetworkId; + + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The target network identifier copy + /// + public int TargetNetworkIdCopy; + + /// + /// The type + /// + public DamageTypePacket Type; + + /// + /// Unknown short value. + /// + public short Unknown; + + /// + /// 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 to print floating text. + /// + public class FloatText + { + /// + /// The header + /// + public static byte Header = 0x19; + + /// + /// Encodes the specified packet structure. + /// + /// The packet structure. + /// GamePacket. + public static GamePacket Encoded(Struct packetStruct) + { + 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); + + return packet; + } + + /// + /// 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(1); + result.Type = (FloatTextPacket) packet.ReadByte(); + //result.Text = packet.ReadString(); + + return result; + } + + + /// + /// Represents the packet received when text is to be placed on a unit. + /// + public struct Struct + { + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The text + /// + public string Text; + + /// + /// The type + /// + public FloatTextPacket Type; + + /// + /// Initializes a new instance of the struct. + /// + /// The text. + /// The type. + /// The network identifier. + public Struct(string text, FloatTextPacket type, int networkId = 0) + { + NetworkId = networkId == 0 ? ObjectManager.Player.NetworkId : networkId; + Text = text; + Type = type; + } + } + } + + #endregion + + #region DebugMessage + + /// + /// Packet received for a debug message. + /// + public class DebugMessage + { + /// + /// The header + /// + public static byte Header = 0xF7; + + /// + /// Encodes the specified debug string. + /// + /// The debug string. + /// GamePacket. + public static GamePacket Encoded(String debugString) + { + var packet = new GamePacket(Header); + + packet.WriteByte(0, 8); + packet.WriteString(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); + + packet.WriteInteger(0); + packet.WriteInteger(networkId); + + return packet; + } + } + + #endregion + + #region RemoveHighlightUnit + + /// + /// Packet received to remove a unit's highlight. + /// + public class RemoveHighlightUnit + { + /// + /// The header + /// + public static byte Header = 0xB4; + + /// + /// Encodes the specified network identifier. + /// + /// The network identifier. + /// GamePacket. + public static GamePacket Encoded(int networkId) + { + var packet = new GamePacket(Header); + + packet.WriteInteger(0); + packet.WriteInteger(networkId); + + return packet; + } + } + + #endregion + + #region PlayerDisconnect - 4.21 + + /// + /// Packet received on player disconnect. + /// + public class PlayerDisconnect + { + /// + /// The header + /// + public static byte Header = 0xFE; + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + 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); + + return result; + } + + /// + /// Represents the packet received when a player disconnects from the game. + /// + public struct Struct + { + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The player + /// + public Obj_AI_Hero Player; + } + } + + #endregion + + #region PlayerReconnect + + /// + /// Packet received when a player presses the "Reconnect" Button. + /// + public class PlayerReconnect + { + /// + /// The header + /// + public static byte Header = 0x0; + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + 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); + + return result; + } + + /// + /// Represents the packet received when a player reconects to the game. + /// + public struct Struct + { + /// + /// The client identifier + /// + public int ClientId; + + /// + /// The player + /// + 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(); + + + 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 + { + /// + /// The client identifier + /// + public int ClientId; + + /// + /// The player + /// + public Obj_AI_Hero Player; + } + } + + #endregion + + #region GainBuff + + /// + /// Packet received on gaining buff. + /// + public class GainBuff + { + /// + /// The header + /// + public static byte Header = 0xB7; + + /// + /// 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(1); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + + result.BuffSlot = packet.ReadByte(); + result.Type = (BuffType) packet.ReadByte(); + result.Stack = packet.ReadByte(); + result.Visible = packet.ReadByte() > 0; + result.BuffId = packet.ReadInteger(); + + result.TargetNetworkId = packet.ReadInteger(); + result.Target = ObjectManager.GetUnitByNetworkId(result.TargetNetworkId); + + packet.Position += 4; + + result.Duration = packet.ReadFloat(); + + result.SourceNetworkId = packet.ReadInteger(); + result.Source = ObjectManager.GetUnitByNetworkId(result.SourceNetworkId); + + return result; + } + + /// + /// Represents the packet received when a unit gains a buff. + /// + public struct Struct + { + /// + /// The buff identifier + /// + public int BuffId; + + /// + /// The buff slot + /// + public byte BuffSlot; + + /// + /// The duration of the buff + /// + public float Duration; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The source + /// + public Obj_AI_Base Source; + + /// + /// The source network identifier + /// + public int SourceNetworkId; + + /// + /// The buff stacks + /// + public int Stack; + + /// + /// The target + /// + public Obj_AI_Base Target; + + /// + /// The target network identifier + /// + public int TargetNetworkId; + + /// + /// The buff type + /// + public BuffType Type; + + /// + /// The unit + /// + public Obj_AI_Base Unit; + + /// + /// true if the buff is visible. + /// + public bool Visible; + } + } + + #endregion + + #region LoseBuff + + /// + /// Packet received on losing buff. + /// + public class LoseBuff + { + /// + /// The header + /// + public static byte Header = 0x7B; + + /// + /// 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(1); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + + result.BuffSlot = packet.ReadByte(); + result.BuffId = packet.ReadInteger(); + result.Duration = packet.ReadFloat(); + + return result; + } + + /// + /// Represents the packet received when a unit loses a buff. + /// + public struct Struct + { + /// + /// The buff identifier + /// + public int BuffId; + + /// + /// The buff slot + /// + public byte BuffSlot; + + /// + /// The duration of the buff + /// + public float Duration; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The unit + /// + public Obj_AI_Base Unit; + } + } + + #endregion + + #region SetCooldown + + /// + /// A packet that sets cooldown of a spell/item. + /// + public class SetCooldown + { + /// + /// The header + /// + public static byte Header = 0x85; + + /// + /// 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(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; + } + + /// + /// 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 to set the cooldown of a spell/item. + /// + public struct Struct + { + /// + /// The current cooldown + /// + public float CurrentCooldown; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The slot + /// + public SpellSlot Slot; + + /// + /// The total cooldown + /// + public float TotalCooldown; + + /// + /// The unit + /// + public Obj_AI_Base Unit; + + /// + /// 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 + + /// + /// One packet that starts cooldown (mostly for items). + /// + public class StartItemCooldown + { + /// + /// The header + /// + public static byte Header = 0x9F; + + /// + /// 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(1); + result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.InventorySlot = packet.ReadByte(); + result.SpellSlot = (SpellSlot) (result.InventorySlot + (byte) SpellSlot.Item1); + return result; + } + + + /// + /// Represents the packet received to start the cooldown of an item. + /// + public struct Struct + { + /// + /// The inventory slot + /// + public byte InventorySlot; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The spell slot + /// + public SpellSlot SpellSlot; + + /// + /// The unit + /// + public Obj_AI_Base Unit; + } + } + + #endregion + + #region BuyItemAns + + /// + /// Packet received on buying item. + /// + public class BuyItemAns + { + /// + /// The header + /// + public static byte Header = 0x6F; + + /// + /// 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; + } + + /// + /// 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(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(); + + return result; + } + + /// + /// Represents the packet received when a unit buys an item. + /// + public struct Struct + { + /// + /// The charges of the item. + /// + public int Charge; + + /// + /// The inventory slot + /// + public byte InventorySlot; + + /// + /// The item + /// + public Items.Item Item; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The replace item + /// + public byte ReplaceItem; + + /// + /// The spell slot + /// + public SpellSlot SpellSlot; + + /// + /// The stacks of the item. + /// + public int Stack; + + /// + /// The unit + /// + public Obj_AI_Hero Unit; + + /// + /// 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 selling item. + /// + public class SellItemAns + { + /// + /// The header + /// + public static byte Header = 0xD3; + + /// + /// 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.InventorySlot = packet.ReadByte(); + result.SpellSlot = (SpellSlot) (result.InventorySlot + (byte) SpellSlot.Item1); + result.Stack = packet.ReadByte(); + result.UnknownByte = packet.ReadByte(); + return result; + } + + /// + /// Represents the packet received when a unit sells an item. + /// + public struct Struct + { + /// + /// The inventory slot + /// + public byte InventorySlot; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The spell slot + /// + public SpellSlot SpellSlot; + + /// + /// The stack + /// + public int Stack; + + /// + /// The unit + /// + public Obj_AI_Hero Unit; + + /// + /// An unknown byte + /// + public byte UnknownByte; + } + } + + #endregion + + #region SwapItemAns - 4.21 + + /// + /// Packet received on swapping item. + /// + public class SwapItemAns + { + /// + /// The header + /// + public static byte Header = 0x09; + + /// + /// 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; + } + + /// + /// Represents the packet received when a unit swaps an item. + /// + public struct Struct + { + /// + /// The previous inventory slot + /// + public byte FromInventorySlot; + + /// + /// The previous spell slot + /// + public SpellSlot FromSpellSlot; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// 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 on spell slot changing. + /// + public class ChangeSpellSlot + { + /// + /// The header + /// + public static byte Header = 0x17; + + /// + /// 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(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; + } + + /// + /// 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 spell slot is changed. + /// + public struct Struct + { + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The slot + /// + public SpellSlot Slot; + + /// + /// The spell string + /// + public string SpellString; + + /// + /// The unit + /// + public Obj_AI_Base Unit; + + /// + /// An unknown byte. Possibly the previous slot. + /// + public byte UnknownByte; // from slot? + + /// + /// An unknown byte2 + /// + public byte UnknownByte2; + } + } + + #endregion + + #region AddGold + + /// + /// Packet received on gold change. + /// + public class AddGold + { + /// + /// The header + /// + public static byte Header = 0x22; + + /// + /// 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; + } + + /// + /// Represents the packet received when a unit's gold is changed. + /// + public struct Struct + { + /// + /// The gold + /// + public float Gold; + + /// + /// The receiving network identifier + /// + public int ReceivingNetworkId; + + /// + /// The receiving unit + /// + public Obj_AI_Base ReceivingUnit; + + /// + /// The source network identifier + /// + public int SourceNetworkId; + + /// + /// The source unit + /// + public Obj_AI_Base SourceUnit; + } + } + + #endregion + + #region LevelUp - 4.21 + + /// + /// Received on hero level up. + /// + public class LevelUp + { + /// + /// The header + /// + public static byte Header = 0xCB; + + /// + /// 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.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.Level = packet.ReadByte(); + result.PointsLeft = packet.ReadByte(); + + return result; + } + + /// + /// Represents the packet received when a unit levels up. + /// + public struct Struct + { + /// + /// The new level + /// + public int Level; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The amount points left to level up other spells. + /// + public int PointsLeft; + + /// + /// The unit + /// + public Obj_AI_Hero Unit; + } + } + + #endregion + + #region LevelUpSpell - 4.2.1 + + /// + /// Received on hero level up spell. + /// + public class LevelUpSpell + { + /// + /// The header + /// + public static byte Header = 0xA9; + + /// + /// 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.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); + result.Slot = (SpellSlot) packet.ReadByte(); + result.PointsLeft = packet.ReadByte(); + result.Level = packet.ReadByte(); + return result; + } + + /// + /// Represents the packet received when a unit levels up a spell. + /// + public struct Struct + { + /// + /// The new level + /// + public int Level; + + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The amount points left to level up other spells. + /// + public int PointsLeft; + + /// + /// The unit + /// + public Obj_AI_Hero Unit; + + /// + /// The slot + /// + public SpellSlot Slot; + } + } + + #endregion + + #region Surrender + + /// + /// Received when someone casts a surrender vote. + /// + public class Surrender + { + /// + /// The header + /// + public static byte Header = 0xC9; + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + 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) + }; + + //byte unknown = packet.ReadByte(5); //Not sure what this is + + return result; + } + + /// + /// Represents the packet received a player votes on a surrender. + /// + public struct Struct + { + /// + /// The network identifier + /// + public int NetworkId; + + /// + /// The amount of yes votes + /// + public int YesVotes; + + /// + /// The amount of no votes + /// + public int NoVotes; + + /// + /// The maximum votes + /// + public int MaxVotes; + + /// + /// The team that is surrendering + /// + public GameObjectTeam Team; + } + } + + #endregion + + #region SurrenderResult + + /// + /// Received when surrender voting is over. + /// + public class SurrenderResult + { + /// + /// The header + /// + public static byte Header = 0xA5; + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + 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) + }; + + return result; + } + + /// + /// Represents the packet received when a team finishes their decision on a surrender. + /// + public struct Struct + { + /// + /// true if the request to surrender was denied because it was too early in the game. + /// + public bool TooEarly; + + /// + /// The amount of yes votes + /// + public int YesVotes; + + /// + /// The amount of no votes + /// + public int NoVotes; + + /// + /// The team that is surrendering. + /// + public GameObjectTeam Team; + } + } + + #endregion + + #region RefundToken - 4.21 + + /// + /// Refund token contains refund amount, when leaving base or casting spell/item it's set to 0. + /// + public static class RefundToken + { + /// + /// The header + /// + public static byte Header = 0xE9; + + /// + /// Decodes the specified data. + /// + /// The data. + /// Struct. + public static Struct Decoded(byte[] data) + { + return new Struct { RefundCount = data[6] }; + } + + /// + /// 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 refunding an item. + /// + public struct Struct + { + /// + /// The refund count + /// + public int RefundCount; + } + } + + #endregion + + #region Camera - 4.21 (NO STRUCT) + + /// + /// 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; + } + + #endregion + + #region RefundConfirm - 4.21 (NO STRUCT) + + /// + /// Received by the server when refund is sent. + /// + public static class RefundConfirm + { + /// + /// The header + /// + public static byte Header = 0x49; + } + + #endregion + } + } +} diff --git a/source/Old/PermaShow.cs b/source/Old/PermaShow.cs deleted file mode 100644 index e4e5a283..00000000 --- a/source/Old/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/source/Old/TargetSelector.cs b/source/Old/TargetSelector.cs index 644763b4..ab0b50a5 100644 --- a/source/Old/TargetSelector.cs +++ b/source/Old/TargetSelector.cs @@ -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/Prediction/Old/AoePrediction.cs b/source/Prediction/Old/AoePrediction.cs index 9bccb3db..f56c7c59 100644 --- a/source/Prediction/Old/AoePrediction.cs +++ b/source/Prediction/Old/AoePrediction.cs @@ -106,7 +106,7 @@ public static PredictionOutput GetPrediction(PredictionInput input) CastPosition = mecCircle.Center.To3D(), UnitPosition = mainTargetPrediction.UnitPosition, Hitchance = mainTargetPrediction.Hitchance, Input = input, - AoeTargetsHitCountBackingField = posibleTargets.Count + AoeTargetsHitCount = posibleTargets.Count }; } @@ -203,7 +203,7 @@ public static PredictionOutput GetPrediction(PredictionInput input) return new PredictionOutput { Hitchance = mainTargetPrediction.Hitchance, - AoeTargetsHitCountBackingField = bestCandidateHits, + AoeTargetsHitCount = bestCandidateHits, UnitPosition = mainTargetPrediction.UnitPosition, CastPosition = bestCandidate.To3D(), Input = input }; @@ -335,7 +335,7 @@ public static PredictionOutput GetPrediction(PredictionInput input) return new PredictionOutput { Hitchance = mainTargetPrediction.Hitchance, - AoeTargetsHitCountBackingField = bestCandidateHits, + AoeTargetsHitCount = bestCandidateHits, UnitPosition = mainTargetPrediction.UnitPosition, CastPosition = ((p1 + p2) * 0.5f).To3D(), Input = input }; diff --git a/source/Prediction/Old/Prediction.cs b/source/Prediction/Old/Prediction.cs index e1456d64..510d61ec 100644 --- a/source/Prediction/Old/Prediction.cs +++ b/source/Prediction/Old/Prediction.cs @@ -91,18 +91,12 @@ public static PredictionOutput GetPrediction(PredictionInput input) return GetPrediction(input, true, true); } - /// - /// Initializes this instance. - /// - public static void Initialize() + public static void Initialize(Menu menu) { - 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); - }; + _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() @@ -365,7 +359,8 @@ internal static PredictionOutput GetPrediction(PredictionInput input, bool ft, b } else { - input.Range = input.Range * CommonMenu.Instance.Item("PredMaxRange").GetValue().Value / 100f; + input.Range = input.Range * Instances.MenuManager.Menu.Item("PredMaxRange").GetValue().Value + / 100f; } } diff --git a/source/Prediction/PredictionOutput.cs b/source/Prediction/PredictionOutput.cs index 40b8bd4c..098f3fa9 100644 --- a/source/Prediction/PredictionOutput.cs +++ b/source/Prediction/PredictionOutput.cs @@ -16,7 +16,7 @@ public class PredictionOutput { #region Fields - internal int AoeTargetsHitCountBackingField; + private int aoeTargetsHitCountBackingField; private Vector3 castPositionBackingField; @@ -32,9 +32,20 @@ public class PredictionOutput public List AoeTargetsHit { get; set; } = new List(); /// - /// Gets the area of effect targets hit count. + /// Gets or sets the area of effect targets hit count. /// - public int AoeTargetsHitCount => Math.Max(this.AoeTargetsHitCountBackingField, this.AoeTargetsHit.Count); + public int AoeTargetsHitCount + { + get + { + return Math.Max(this.aoeTargetsHitCountBackingField, this.AoeTargetsHit.Count); + } + + set + { + this.aoeTargetsHitCountBackingField = value; + } + } /// /// Gets or sets the cast position. diff --git a/source/Properties/AssemblyInfo.cs b/source/Properties/AssemblyInfo.cs index a9e390b6..e54f8874 100644 --- a/source/Properties/AssemblyInfo.cs +++ b/source/Properties/AssemblyInfo.cs @@ -20,4 +20,5 @@ [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/source/Properties/Resources.Designer.cs b/source/Properties/Resources.Designer.cs index 3f372d65..312ae909 100644 --- a/source/Properties/Resources.Designer.cs +++ b/source/Properties/Resources.Designer.cs @@ -83,29 +83,9 @@ internal static byte[] CircleEffect { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap CPActiveSlider { + internal static System.Drawing.Bitmap spectrum_chart { get { - object obj = ResourceManager.GetObject("CPActiveSlider", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CPForm { - get { - object obj = ResourceManager.GetObject("CPForm", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CPInactiveSlider { - 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 index 9f55bc02..8034a442 100644 --- a/source/Properties/Resources.resx +++ b/source/Properties/Resources.resx @@ -121,16 +121,10 @@ ..\Resources\CircleEffect.fx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\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 - ..\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/RenderObject.cs b/source/Render/RenderObject.cs index 5e084091..cb069833 100644 --- a/source/Render/RenderObject.cs +++ b/source/Render/RenderObject.cs @@ -159,9 +159,9 @@ public virtual void OnPreReset() /// internal void SubscribeToResetEvents() { - Drawing.OnPreReset += args => this.OnPreReset(); - Drawing.OnPostReset += args => this.OnPostReset(); - AppDomain.CurrentDomain.DomainUnload += (sender, args) => this.OnPreReset(); + /*Drawing.OnPreReset += this.DrawingOnOnPreReset; + Drawing.OnPostReset += this.DrawingOnOnPostReset; + AppDomain.CurrentDomain.DomainUnload += this.CurrentDomainOnDomainUnload;*/ } /// @@ -177,9 +177,28 @@ protected virtual void Dispose(bool disposing) 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 } } diff --git a/source/Render/Sprite.cs b/source/Render/Sprite.cs index 66a55d1d..d6e47413 100644 --- a/source/Render/Sprite.cs +++ b/source/Render/Sprite.cs @@ -158,7 +158,7 @@ private Sprite() /// /// Gets or sets a value indicating whether the sprite is visible. /// - public bool IsVisible { get; set; } + public bool IsVisible { get; set; } = true; /// /// Gets or sets the position. @@ -327,10 +327,30 @@ public override void OnEndScene() } /// - public override void OnPostReset() => this.DeviceSprite.OnResetDevice(); + public override void OnPostReset() + { + try + { + this.DeviceSprite?.OnResetDevice(); + } + catch (Exception) + { + // ignored + } + } /// - public override void OnPreReset() => this.DeviceSprite.OnLostDevice(); + public override void OnPreReset() + { + try + { + this.DeviceSprite?.OnLostDevice(); + } + catch (Exception) + { + // ignored + } + } /// /// Resets the sprite. @@ -417,6 +437,8 @@ protected override void Dispose(bool disposing) { this.OriginalTexture.Dispose(); } + + this.Bitmap = null; } private static Bitmap SaturateBitmap(Image original, float saturation) diff --git a/source/Resources/CPForm.png b/source/Resources/CPForm.png deleted file mode 100644 index eb148ad540c061cb3af93b2b638d74537b4f4d4b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 74517 zcmV)wK$O3UP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z009_4NklG%rI1(g| zC{f3VGnCC?Gq&1YjqR@O%#PWZNurHucSmDutCci5b}6GMQA3RmQY1lA1aA-kaW&2c z(05mLSJk`nhzNK8?H}$DnfdPbs=CqLC~tdR@5qb{_i+E6-{1Eq_uqH_2N0f0sjV?ZGUkBGq<00j|3 z2vEp^0D+oU=sV5`b+hRHmV7W)K2i04<5t8WFHz7o0*Y8L354 zqAD6e3B;kNH3h8}L=C963~I-EJEMpVQ+JtN9J8XuIk+$ZZ~g`mV3snydUU@WRrtVUd{Fww9#P&8PE(cyizX`W4UyON)dCV!(+*qoP0z0TGA@5ilYk ziV>UkF9AUiV{q1>7&HiCYLo)Ph-ezb?qH%4)DTofF(?5M)EXm31VY3ZqX8p`B}NaV z^A@#6O~i`B7(>*E#bAQNSOcnr7*SQcji?9~K+|lauh3W_qNqj+TYxn*KB5{Zox!N6 zh=Qq!1V9iY2oQn+v4{v7BO!WF2kOumP*p-yLu+|ba5+$vJwH8+tppl@0B7hP@B%&A< zqy>zoXB=CSG%6{I60ZTT0c%~_^GK3sfJ7mNK#UExNS`0PBjONhL_ow6CCMv^krIPL zhzgA7S~2fV^K2%TN2wT!M7AeiHHzYG2%f2A_hT->WRT&7=dV7{}8cOKx#s$ z(HIddq62Us)`Nm-1W^iCqH6JNnzu0yQwUyLq$x49h}p%)K-3X|0wJOrNlzgiTNFY} zGTm5%cKd?3O+*NN{Tu%)0WzJj96?dAcn#j9Dz2p zOmT=Yl(9iY(p&pvsA5M14NBX+m_l#%F1KK5@U&)8Vs!HfWj%$VM}Z_ z2|7ax&%hg6TO+oiXa>{*(oTu4K&t^|W2u4=XfcHY8);)hD}siKDi~tbqGEB=5us>t z)pcC+03r~~7VUTgWj7th!Xd7JsFXyUE7E?89z-ZY5;Cnu)JH0{cvI6zL|d1PGdvch zkTM-eNlH&+67uRJqL!9Oqk+OWEQa9IfpIo~Rn$6yrbD9Y0mX(Q8+ITFK15>h1O>z< z;cWy6L{SVDYYonoSW_Sx3G5MCgT?`^-(yw>Trt2F9+gOl7F4LLrEnH7h#Ew|*pSar z=!G2$b<<$1!AMeq##v%87?XY%H4tMuI|eXfD6AvIkcAW=iZzxH6%8JV28@CcjFTih zqF`(?zLM}##5lw{qHl>&)0vKu7z1J?8xe}L7N-_fz?x(*0?s6BImUGMQ4niE$imzt z;i-yIP)$lXM4#^66kr@N1ZMRN1e_^QH3W@>;86o*QQ$Pq*I0vdMN+p}IfW3CE#0=v z>M4U!g*8b~re_K`D4a{rLzBW(tq3YuiHLgCH;5~!Rj@WO*-VK?U78gB5rv;;?XV^I|7_4*n zwxw-b($h_bTrv#O{0H3yGSx^)DuGlp!F@j^|-Rab`DaWmo){(rn4W~7K1RX z25Ao)gSD0r1KxX**K20({%>;tMy}9gmrXDVHwX^P$c4dw*Qs z_r2eHb2rQ`-1qQ9yysiq!$z^mZ~nn=v%U2^0|P2Tl!|B|29Gh8qAc(}fCh}VXkGvf zngo`K3)%#7H_$qVM-W{&RH~S4Rfq`D zE75x(&=3)^=|H$-p;=7_R8@%@Q8ifOlGUS%N;(8ZfEX385hDg?EZ#%{9*IgslKo<& zx09ucAhqS54~Xv9R1$=+p9MXVv&vP$SY=icH{Vi=;77@L095QyRl zg-0|AC2NwU?4!pygNRMugG8!!K&2((A_%mt5(yY9pawOb5L>KNAZ6$7C*hX84UuHZ z$Gk6$C{AKB7o*~9#fW2lQz!~yHiKE);zPih5zdt~ZH>nCxgu%5XjEbhSZ8q7VY0$d zl2>EJG6@rAF*0!L2!bs^{RHEi>?uVw1T;phsj^alV3L4!#-dUtc>rJ{NJNZei!@*) zCjU)sZ|H=e#0Z15`)H*|o<(elp-p>BN;C-GLs3{TEv*JxO+wOW0AHaPa5FFg4HmFT z2`X4C_+SZQvDSko#VBgA&QZDwjefxC~i)8<3cd&uqer;A{zMKs?q)B0`9P zCL{ySv~5-@As;ItYMQ&VC8CBH0TVDL5JLcCD4e4WE#5~8XTVAyu^<*i1s@_J4pkxg zkUiXF06XWf#$Zh{GQ6(|F?pDh4QeIrjSxH%l2Q;S1og>7Hx@Ak)*8m+F|&F`Rg^fY z?0_VN4uZJk-NpbK4XOr>9#<&NIy7dl#t1PhB8SZiDIG>n^0bo3SFnyK28|J8k|^$8 zpM-ukC@hGY%eUmVj+D`Jzumm`TPV9=z4#NkXbDm4b8ZD`aGO!Dx{ z?A>eL*P#t4@Q!czIfmzL7?J5T#BDHZQq1e1iRA$wFIDFJmzED7S1uO2k-;u|nZ2&bs6YA~-BY zz*=QkD3yd{g&IL)U^bmmw@IkQ5HZGLjl~p7Q6z6lB-z47I>U$*)-wSlVzi)DNd^fD zQPOMkUX{+M5(vb!FI3ZEH%iDx8InU!ND5P`A(BI?V$oq&(B@A_BfmO3=9!q7@8E#CE9)jY$D$Qe4JH#26YK(ga~^cY>IT z_05aSnwXTWQEuJ5g>{a?IcAe7Vgzd(RaH?G1=b428hl7f$Q2GtnLMO0LnPosLx?j} zYeY;A$)zydz(8S>oG{iT`I3!GBesuNMHBGS<}jb&+vEiovC3ygup+4Uv;m?f1!as$ z&qpK9b%!d4^_<0)lD+&iFCz|YjcT3mF(!SN&!}|gHEXY4o@B)?y&Tjm>(agwb>K@_ zls751n=@5eR*4dQ3YAK}o~oeY5oz-NQY6c6=$wX_l&}caT8wpF1}w`pMesSio8>Et zNZZTOeyH@}bP*vElaZiBevkBuF=WR_g6SiyDRi3BB*}G%sI@p}Fx~57N|&V9#bk^T ziN;}#V63AmDli7`10VYE@9^jT{Ga9Z_YS!J{01-RjA^;`gHALOwm!$jX!*j29_J5! z`?q=PBlmLo;zb(Y5)`Z}5s3uf<{Oj+&8}GM@_|bs8=E!0Tfmp@xx&iI5Dg7BHazuI&Fe2e$mLZ{!b-r9yeKu2!hs?b z&QTVYC^3abF%$+?2afgCio%fvqGwjO%w`QfY6`)`v@g^Ot%+chM`uhDtT80v)(Ht` zvP`m;kQGkUWM@mZY(r3Tv?zH+CaD_jw4`+LhS&u}k`M@ykfRDla(*Q$F(jkKBnu9c z^Gm9Lv4|!kBl}CqgYywE^AJ}yM597ow*)U)_y&s7QWO^NQ+QAzdp0S|X>zd4hZZrB zsw`<5rHzJ`i|ouiYa17EEBCN74h#n+Z5w#%>8Btnqv43MELjWDa#T? zX`41H?TE=Cn$G%)i{5LuvAV>6PVB3uFhnPdoO68$#0C1ucxS-{@kA3bIe5~C0`kM` z_c&m54u;VDS&JK9GB^nlj4Lv5A$h@RBQI`HP$Dr{G=K(=6=7p_lcMlM*-e0?E=jG5 zQPW#}##&+s_#lLkY*Xp>ihz}r|HT@7Y*7{3c9js6wrvR^d69-DJ0b~GWNd*-jV)?Q zS1=q@3&p-b>Ras(;V=^A|;Oo|T^6@XSUe#<2OPbjb&3fsW z-h3J-1+Ls=Z*PaeV1@Oy4U9322191EDdWiw)u3cJGT>`oxPFrmT9BA>^>LS~f{lwC ztPZZAAyBtU-9TN>n9gSSwxMY~yS||HA*Wg(sK@vfj8(vgUKFr0#ae8IRxz%&a&wZoTNC@nTs)jgN(H_wP$a4hnPe4*4WOm%*J>E(#)ex z^HAtqc1Z6rs%rL#4Av%3Erghjnt)P+tYNf)>xS1nY^hWUh`!Gg8 zi>!b{PJdZMcCqF<))osRvjDWQ%v~I-` zePlA*C1?O~U`nhlvEnIQ_Qp+e3hH`H)71GK61^MQKmxf!+-YFQnyOId8OzFKhc;u;&n6|QWqVhTso*6iLIGplQA zACthe1K2Z^<$z(eN#RQDisPXNA0mXnbk=b7>Lxx+5uI{z1iL%icqu7NLN}-IXnHnQ z4YsgI5Y)uvJxWp@QK1e2qEDWjrf}rOTESm>|0Ddr{(qlMhKT`N7*vFZ?j7-Uk8bd9 zf8$yH^B;SJ|M{Oho)EI6aH`FpVUnbq1M4zs&LoTi|KSh4p3gkK%O}6EoxBi}yb7#M z%2K;@lJ?*S6r!3Ge$0wYP#(B{jrV-ZJ^X`z@dQ@DnY6QFzSe*F=N{#M`_*T7>bdbk zJ_ka+W(p4`BP?dHQBhj#FsWo`(-|=lTnV0tN6~1rSD%cA@Rpk*Q z2}{sKLemg*NE*{07mAf$bD+HUbuuV)jcxQ*^1zN{JYJXz_H|jkJaZ zV5G#@6v62X{Z1Cg99=>LQG=mKN;}TIS*1zOQ5w`%3|0oLmN8z}2FCR0n(G#Kj`R6_)%ZELIrTUbI+2BTGqYL%vG5o@rvU}sWu zbLR%@D?=`f3MS(wojC(LtWn!P2J0<$?@2bq;i6lmTzMOp-}HU#4Zg@&{w>pH3Pg%h zvCd-_CGW84OqO9%gk*Jria%w2fljkixAeuSdIwy5O0LNx$zx8eJ$NE40ET__iWo zinPIdpm!4btq;VI!d=D|RIa7WK$)e`sl=s?Eh1=8f)6Q>^6&#A*49?>zM-j0rnQHMqU}uF#6*dQO z-w0L<`u%QgQcQ1u!vJlkyybxbqcXBS>=d73vKL^C=@nMmNEy79K@Y0%z$Msv5uUCz z!{C$gW~|9&CE5ce<`Efk$ZKxm217{td?l4Sy?z}oR?2oM^xG?H zj|=FcA(|1{#u}`oJY^5k2mxOuU{*7OW+sG?_HL^w!|7v4C0iLFF`EQdRz{S=g5BAS zX)BB;+ll*{g!6p%55@F|R%(8wXQ7~>Ee&RWEnecq-lgl7dY4N4?L zr40!MJaQWtsrr|ul#W6SDaE82{p>waYofM9$vIG?*jQowDj~MX5ivP-CM$?bfXZgp zGMhFGtYuI-%0bC!w1SwxWUnDmG8zg+F{5oK3GWfgJw+Q6|=Dz!IErlnT&+3F`ljMp!m%M}0IqG^B2wZvH6|5O>?fOl&w`cg64zYEH(aK;chTbJ!Otz|1 z(%1G0^_U^V(L}_M6^6&;T#Q&Ds>9kMCG4%knSe7fD>{fVe4kr46bgurs;AtZA7w zhPH-6EY{iHN{hi0ng(lNZB#LE11jeTMN5!K-2`^_W{f8dvqteTfl-Vz6ecDxK$}8y ztu(Z15H0a;hPWK^F`7ev7Qy3eu3hyxEFBYK*cBy%@&X&1muWRp*Pd%PTb{eV#p;@H z<AiamAO4LOa!nNcz@L2sZ~WR#u!i6NcTe)s55B;A|MVMpp=`JKC{ig{zqTrYrf?&Z~NwZSi7*ohkx~1KJi=6 z_Ne0+lqNKU7W~XIoknJ}NbnI2Lh!<@QR*m2F`)I}r=H-a3V(O;IQ-D+5+b z%djda28Lip6sHr zU|1G87ncE2VlXZv)}tnwg=COjs>5?wnl=Gpprxfrh-{nFChAh|QzVy4G+8kkj4N9k?{))>*`3J(S?>uakFoTDra zF|_RMP4PYhM~DcXax_2+OWV}c<6Z8(vdP5@n>>4C#xu`9L(_Q5YK3Aj#1T?`P*>!e zVZ^@6*VzQ3(U9sG6PnOqNPvK#8I(hc>lsk@=9uH|rblV1SRxQ(ij4~v?{j!1-+K&!fZ(bDZ47wd5OSTP#u{gpwbcQu zs~0E=gP$~P-Q1(qHYKmkfMHb;e89H}0Tx2Q0IO9=k-t=w?RG{pHcV$QolfylD2pM( zQGtp@)uS2^n>LdpQWgb8F-(SsSSo9BnE-uVkVphPWl>TT1&wcT#!^T^ACBvqX`?hz zK|O=YFdD3Zt}>g=c>K$|eA#Yu>Ea5PFAcbQ^&aZ!guR^!gOQ~PGj_(;X(e#w(mk}} z3D>r7a%E#BeZJ;rEl@baU{Elq9D|`{W8HG;;(+zlfNeY-s8OYFMJEX_D?^~qu=-tJGXXt;xjwkb9ICmc*9%o;dQTn zgkSropP(8zzWq;r18W;kaPJ!)=GT7aW2nNre(39Y*B`T#gUf7gS{{Di!)P4w^MCsf zx$@8^@BWc*X7Bp%fW40=KlLO}fA(oEUaT+|O0b6E@IC;3K*T3UozUxnXE1&rH zk74b7yy1<{@~-!NGr#w59%J|BjBo#uZ{nN3YX;RreAl120vLY%Xa9iL-M7MbzyI6$ z;6MKZ_HOL)_V0X@Z~xvmCFHTY$}j!>51}z~-_=o{^YLvYc!zHSVH%juJd>%%*Ad?e zp;4waL^D9_kegdG+A@KTX0wR(hJiS4HhavP31w*5-Fbo8Y=+f_sz?ae(O|%!8sJ;y z#?8pB?L8Xrv2MWX-~z4~B%eOC_)uf4G8_t5E?Jx#C9;gPy2Lci;|p!6G9WXxfR$kfzik?tOBD7N*gFw41;Qg*{oqUYiXMrYYWsE z%A!PEiT4eYCNODcm~q3##wJ(q*`%%;_9j!NlPT>ifT=KcKv@_D)?mctv`!{E(3t9J zV@!s-b$FkFUfENcg*K&SVolRDJsRB@gL74iNJ%Q|@Y5Mh>oFlkyHr|4LI%gA^KG-2 zZA^*B6JzpTySmtf(@1FPlus={p_DdzwbDn%Y*8>MhXnOB?SvaIj%n&Cue*1|BM&~v z&d!WmH}@!A#b9+v)6~>;og;EEnYOfE8LgH%GBBo@DP>s^sX;4{dY;y^LJSF%7D7lR zPxY9Uvcg`vz+^gORHk~>t!F>O+N$H3?ICK{a8iI9)!caMgRr-aaV z_ck028CD~9c4usFZ|59V!^+B#l~u>EDsa{@o6XqU*-Z-375ES+oMSW`B86ppvd8LZ z$m<@upJqDabB{m6^{pA@V946~Ix&*!_C#_$;v5+eiK$T9d)hYih|>1?6BZWpQ&+vU8EbRahq&o4ml%CXYK6347|Mp$(o3 z8*4O;XEvJ>#bR9Ya%Z8TX-o>g7%+B9RSp=eluTP?TsJrdG*i#sWSbBSMX|=^E2~Ur zdtAS<&Gi>v!ZD!)VR&^k<)@ZEBwX!t;!`A7Hd%fEh17@hq`v6585I_Jk+A@TF^rpYiNxpWsd3 zbdk`EQQcv6%`n-%&hwvt3dHft|KL~982F~|dyt}RC@KiPX0*Bv?D3vI_2z!xzW9{q zg(q)v?TIf@kH-)tmr|wLQ=+CYe-ntl#YE3QlvW~S&%znSIKz0>5ZadEu%d2ZHuJC4{fv2AQ0@Jp^Il*d+5n=P<6}(rjzj%|atsUC9K{Z%mZJ3aiO&e(2Erugu zIIOT%7z_$ZYw&eL+m16>Dk+gRcDYzhzz`!i>ljpy$#@2soO>6l)s%%8;_G@QtTwTG~cwy)YP749fvQmB!D|IS>!K=qFA+qsYp@Fc^0mM3k~f_8wuIbOor#4gsC zQkcX{RJS$JC!k(}B|{9UPQ3LEMUhHdRz?;hhP}NBMjY0-^d4(_oJNPrj|8Inq)at? z;FjL;=uplHd7pAqWjUf8z+^h(@z2e;c&Xr?dpEdnX~;9rKFM_A7z|c$&M}!xQ$4LK znbb8t)~v6tv%WH9HjDT+eOAbb>WD>YdnMTc7uAC+EUj-KY9^*g-t6q=Cm8SEqPp+^ zEs86xrLD(Y7&N?Yb(3HG@Lmrd=&a}tsiq3fS;{iOXm8xwW^WuRtf8z7!-1hHl-1z? zV=OznWA=7uh!i<-8!5|@sw#;w(C$rm-K9;|FK+PMwHrM7)D~sA&V}_MkdStPh|vs@ z?-g_cxK3wNs!F(e^)hYSG9K@x4K}GW!;ZtbA|t*sWLXSN+u+;C#fzJ)uO<|P$bfQ? zLayVnp~=q>iN1FO=~SS zgA|OmtgV!+uMJZ@Sxlk5y{!ptuR5NHDtX786pd?_~-I-9=fwHia7cLW`a&z}4&)s~M`z~+r z@Ix25Z=>MF=Wj670ZrTT?DcKF_Dyf*-pd#H^dEkbz1=-Vt5qslu|lJfA)eLBFwll} zucZ!_a%j@M?!v^%5=ct=%4Vh5sDLl>!ZTa6K6w^}6F&Gezsf^zU*`iq{S1HV|L`^Z z-T(IE2@-D%)(97_7{2|7A7F2L4^V#izj~05|JpO$`=-lmZSSB_xp4I+&wuGAYnN_v z>xDgRb&Jan4*2)~a*Kx^9kH_UG*5m08NQ8zryqZT-CHe&NZ}F@!rP`_Vz3c-`inPs z+k39?!qcDP+A}ZU8{w0`^CaK?{*ovSPknBiKl9%_!skD-1$>cT{D)8Q9sl7K?tioJ zd%yH$zV(MI{>A_EabA47PAFUvzTtZ>5-EA|3tQO;RthsW9yF#Pfp1eOlg5`&7*8WjEZH9K@zA3WaOIw>eDbqj#D_>x7&J~whiOiF4dr9{o;tSEU+fkQii5wXS~a-u4!}GMM}nXz@V<4FbP5l(9{#E zwN=)JBc6Z$#Z-)LVKUieZFL=u3F%sv1)`RrbBrpeeV}f}5J;4944Bjn5|wEPRBlF9 zI*Ljt3UHM{+Jaf#G8yk;ixO8=42lARVb*#kbwfQdRF$P12(EMt%S0QvH=eLN4b<%{ zrDFp4vCp}~vX4l0wc^^t-eiv0mz0WWy{BpFL`R1rg&}&6i5@G4vJ4DY16S8BGN`WL zeJ<%TF`=ZRWoLVgb0wx2R8`cC4_>TH@EOjpejZfQ-JjZ zT0%=QNSrWST_bwKwOcoNVfP02J#d99_dUY&<_@=RZc!8iMxzz#X~VSjU@bnT$im9N zQ95NjYiPZpC=$tr5g^W$q|ZjPv&rzW*0ACXZBzI8#|PGw-?{k=#e;9e8pRPDl`C;3 z;M<7CA~AZXNgkt0hRiygSi~sf@s!zYhGG~E2CR+-SQjaa$e?nBM!31XP1ClBafGN? zfz{E7qBOL=A!y6S<|c*#pLy&{OzXgf&8viH&@iDWEJiYKV=fj?^s$z(9iSN+QTH3ZwB{ahlS4ki0ZbPJLJ$sGNHa_RhYzpI2 zv%XqTxB)ij3S#U+6rB<`46702*$l85fE2lM&s7>fWqW6b!X?V6w(*1rt+u&V)h3XE zF}QM_swfglcv>T(%yfbhsD=fD;R;tSuHYl=>`mC)+XGXvxpA2`Y;x`9^W5Co=FvC2 zj)xw21KTe=&$aDcR7QN_laKS(N8iM^eb2l2(C_^Y+dEUPuHHivG@<>h;DVtZ2dKf- z5!r)1$siUnJ=gAHX{-XH)fPT`lOOxB*Ck%E#`A}NxW)F38IS*Jjh_at|IYI~_2eu8 zuyWY;#cR)UrBvSk16Kg}z~6a_U;oW*{$lO;GvEI@!1IY;zQ(`!+2{C)zw`h%K0oHS zf8jcR{y(~p|J_eM3_kL&f9eT-|ARaH=pUW&-`45fx7ytNq-hKZ%&wsw*pZ(3J_%Hv{ z2l;m|dj924eVIS|!}o%TOl$asUw(nD&&@Cw0#80Q!x)>(YJ{@L^jxXP7atNz*L!6; z_KfR5kmM!Kyi$9iZUeJcna&!<%^q+4hOcFHW0g;Q^f7$fu@;qFx#u2k?bUqo$y-du zEo-Zn7z|ga>nYQEi{YT);>C3ar6c%;>3GU)R--X{Ay~?CmEmgIi%snlv4jWl3G`tz z{hYG}VoPpr?XbRff&1>ipBHazVbFxYY+6R6ipgY5la-N(#TEsl$}k)hs8?pQz^v|S z=myk2FpD)+34?*fIi<7?D^OX34Fg&qs3*GwV;Brdsz@Qv4s7eM^ zQYM<|1>2ojO0Q&U!@;NmF>GyZf%hne5E`r%hARWEURY)5DvY(b!V(DyAk=y;t*x>* zNu@H*rTSiH1aTpSVKvDXF@fQz1TA^;i?_J7+VHw711?;=!1m5|;&&dcVA`7TbO#k- zGHn@(;tI!bpv<=S5LwM^UujOQPu{h4l55yw20jKb4kVYKXkciS$~j^v(IO!4|Ixp^ zwe{jhHoo)CHQGA<;lH`g<$JI4{Pk;4CWytcpyW+fw_A?VXzK?VD890A~$#6DX@SCeyvd z<7&t-5?a`+qf)6QY*pUHr;b<%L zEI~2G%rC2nFVTCP7z&%H>U_ckA{rQ!sQ^6~p|Oq-lv$%p>qzS(l^vy;JzAVm%Bo;c zB+yg{xfWEDr-a0W+!RY;Qg~!MX^EQHaMsq=lGnepO;uIIkUXdmBo#oHA%~O`inptC ziZRkO39XlyHKYeFHFb@1!s_}4#b|}l2DZ1y)Kkx3IHE3<>25>2JLZAct?<@2Z?apD zdG6XC5-P^yF^|0I9^UcxxAO51e~Kr+^eh`|D{QU`7e|gkQQ)kyQbb0@oLJao@3139 z?zt{Adywzu79(wd)+fcMNGhC4ybmTwk~yJ2a{G zbY@GbicI@vO}c(zg#YY^9_A0fxXo`rc8kU*@^2p!3Ac7+`l>jazE>5zPb3X77w>nh zI<_MjSYT3-tl*usSVP)lnSaxoj$9(40jJZN@uW_4hX$HPnAFhZMgX%(12*#ZZ+sgK z%11u-7?3!WS5_)6T)c;;o_vufpWj1zdhkjBlI7N|SSI z9T7oMSX`NmWkW|Spu`s1*3m&%ohk(8T?iQpj`k7h-q z+2A#I2bxnzjX#Q1QlDqA0UjodGhg zFKH`^0#lIDpQ$F%TERz?n=zzvkVMX)NM`v;;nKWUaj8tsChya_g32nky)6FiaSMSv_MoOkR6CopE7voz?XLRVBDeA$UUVna-5iOqsT6{R=rVAsqyfR77m7XG-4q{_%gR)XKE?QRCFQr2Fre>&#wy3NIs1EUM z$|a;aCK&Goc7o!Z!P+f+m|~2hEM3nCXk3Z2mbxQ3*R=UM+N4xJWph}==A?I#kzoyu z_o+x3$>G;zr4~iv@5GoKs!P;l##97TB-WS!vq_+CQoS8m3R_}rgL9UmaJje@f)BJ! zNa);LmSUVu=vSSG$E`7}u2-2gBN27Ceo9#tjK`BCJd2W*!GLm5Ku*rbsEjAGB($;+ zPTZC*v*Ku9-&+j^7=)WQZ_(bo!N&R~t7}6BgTQoJ6Q{~bIU;TjdHVVb+?vdI$2%V6 zO>bJ|nP;BF7KW$4Jf_+G0&n};2Wgvz>(5`Ks@Azx3q@2$r9e?J4JNHkrX*7_naH@y zC??Nc`t>)cM%s{3i;3hmDLWr%12jI-sEH8@43&W*5f-Kcu8NPDuB|J!7Ra^zOJoj4 z=JZ}a;XYQmXqe0=2lSo`D$y_&QuU(v24{-7UX=k)y(#M0^{V-@rj#ZCsN{zHy}vIE@Y znB`}r4jgA^XZVZvUSpgEb8mjv1L$<)Lz)!}oDxR=R%_KPM1EXjpFD++ z4#jQsBR`u&E0dn#%Xi8;)73X}y1`H5k|x=)L-QVs0A} z&}3scoSW7^vC4XKZZHrxPCiqg{^o(K=S>%MTG7#?XadW_XS(55H=R z$?|SC!$+6j|7ajC%oeqerk|cPP$Da(PTBeTcX5%^&=7A?h^uIbw=!oPrc5~YR{ zJq~WvP%*-ykPeRcz2|r4z4+qtwf(nG(SK6@eefTuf_v%|Jqmb%p(eiPdjQ_@4H%#t7o18ha#D%r^aEGk z&9f(;U?BYb5YsS4vb?$4mrbFgv#3Xsp2l&0o~W)_-|mgIw?YXIYfs2rNj?+i z2R@7|D=lvZrX&TOi<*KKTP))Do{nl}s|*}>vIwQ3Lp@kJFC4AUqfb1;I_FEHYKJ|LoE|k^U8vC8vf#`n|}ZzV#=ylj$0%c~P4~Bd@C8GGb}heCYexnVa;x zu~c$QA;B-{m~4^3kF`C?vFGZm%0zO?o3=iS^idKJG^f1x6S!%c`-FNd7}=tfzrtvF zvifuoT-a%Z(KPR%zatdO(?;2O^H!?j0o6hXF6so?c41`rz>Sv9JO@Ler#qYOzph@X z6$WN6w~TxG{lgMB!cNBZ?Lq0p2BB1Zq#yK*%WZQ2-p$_8-O9O*It~96F8YsGC#*E= zPweFJM4G@P6e{+9y6FV{>az1%a!u{+`JIK>zt0f*Y|S^8h`{s7ktGJ|>T4NAgWDlm zHDB|_?I;SX85ZUhKVeI2!nv|Tt>4%%O5F4`x6#6o)Esk+ez3Q#DV+XEscc9V{3l2w zq{{3n8*7ke6{7H+tK3@Hdf%^Orj%tNz~>_wPbkT+NK{#Mnjvi92!*C{A}xw``q)M% z>uif%u$`q(dlZswjsk`V>(HBdv-v^^FXeX(#7Pt?Ak%_QpUv%vXbg--QTJjA5g?bhP?>TPeEzr?TDH0HRgrjahMM24{Vz^-Cvlhx>fy0i5xY4*F_&!~4Yl{n8v0sGvtW|Ol)X8G(UE%qSbo>aK$H;95q>^H0jk5Sr%O7I| zqVMcKJZ5@)n8lGwNGivZ*6lOb7)N`@!!#e5wAbtyM=ZRswKmxLbCasCt*&*Q&>7wAGzOl#o1-x)OK`+LDdE}TY)n*EKK=P29VwEbVn zv4XO&vz8Mt29Ua$$LA(9Rnn65RT-mJ7@{Iux^{cx2Xi=fSeKF z25!CI>5a|rvCLJ1K^gvnpHGZrWNmB8{0PM|<@Klni>Ys91Xh%m+H~zT#;NdVDy9p! z!yTKOKe>N8{VUM6_E}1(Sw-seqSMb0|Gbz6gxUy&r+mlXyX=ln8y%sW`hK5v&1;XC z%{~}H7Xv;ts+mnh_oXYB3f1fA8>#?XTWWen90dz2Sm_!24u4Z>W@|Yw_`;77Ge!kN z!3YUirhF{57&3CCR)RNaR^zr-5oYOs2?84RrGk8ng=L;ekEXb_XEzl-A5Y$itNche zKI_1?iB>!})ZVdGqz6Z&MK>a7TYL3y`bPf5U(_HFEX$*3(>p0fqM;uXY#%}jgwE+nnFuF0BQB-Yq_09PkXy54#FV7ioyftK(}eaC>a?_$=`) z>Ig)Q;x4INa;Ky+4~6O>g^fg@3r0D;LoCD+@%oXC0_Z6?>5qzCo*!41d(W?x^{@KE zbZ%)nd}QqRsgMwTBs$G~ZjMJ$;>XVe1G#s3Q6IHOIn8@V_d*JpoL3^2p82>3kS4c`TOf&>#Wx>9;wMBQh&cIo z-qsyGu#^?j#Wsef!p9ZgBg{WT)q-Y`PMc(%l662PFkjEWa8O_Qm=7F zt(uPi^0QexFu92ZS~hE?5s{onRuZGBBlmtWilH#1Ps?}ipY5n+%R$@X-nx|(KgJl^ zmCxfX-n52RrBN%raH_xY&~}VqQ-O`y{Ub3 zMktiSY*UUK96zeiNAe16m&h*Q#w%T9OI36!O{UZRmM!|GXsl*rZP;X%rO+O2oL4<8 zFMENltLJ!16*LCSBdN@CT_;x>9rxRp^UqG?HcixGrJGlrzD*};}TIjdloZg$du zoe#qIVsOFrz?6uZ*W}bajMX?~FzuQ!dJ|tBsim5lBeQm{f7FF?cuYc89d6=&}~A)GZQ{lAQK-IJYUaUjUQBK- z`gWIKKpH=^86kCz!ww-8CFulWcaUtrh@q=8*vN{Lzyh2d%MC2r%3Yx))c=Lf4H)%( z9uRfOZk74EMv>gzW41XjCp|s8$3fB`h3R;47~!ZJs|e0pNL}>N+c6tHT9oZV}K#Y4Zc3 z{%UmyK44JK)d)&?lpz)PxSSqH;BY%#l1kf$EPNJmp(_>Si)ZFB_;bh0iXAwHuAE6ZcP0IL z2t-oB4D(T^R4G#fa%$+>XB&}U9ky_NFaA^x{)rRjlAc#O) zLPnc7R>=zk+Uty3J=2i|k;I?QHGd=NyjU3}T5C&>fBo`R3#GbOKW7EKf#6qm>)Qkr zuu1pWXMG$-O>2od?;YIYUbOD}Ha2hj&MYY$<3VL-`(G@v5A+#n$Rox}YGF$U8FF=5K+Ix$TxP~o!kGDc4vMH+r;tkoGwQGaPrQaf9XDwSd)2Fp$Oqz zrD8(N{`kqQshG~}sSdnkj8a?bExZbDwJ5Z!%(T3-m1oTV^mUZfp?X|6XaoJ$=+f~cnI@Rfc`-`?8WE)dfpXA?hAK@9_jbSbawDH`UfqP~q zYp#@MS#n<@1LqGO)F9I%u(-2ONA70Iv* zn6?$(Pr#C#AltkqJneGI4?1;=-ANulBNNuGYix{5O-?yr@z>G|J4;sMK?pUF!Wf-g z`g{41nV_WGDw2PVT=0Asg4HEAl|pZ&?;uqWx<}jtb=Ey zjRI~-Dp0(e23GLZW3qkA6ByA{mm)IE6I0`ey&t@}z4lMj10L@*ryIm5w~Ti>_AXoh zcT;VVeBdETP1hr>OE9Q--5(~}Dud5+9|HvJ&}oFBS}+jAka6((SpTgkA&>Vpb8*+D z*`)9phCkgpMeVctl7N~xh`c}He%|O40?zP^fL_kWf(Sn11V#oUmJtM$-%+!t(MKk} zJC~pT?`1J=dy6XXVw<+#YYBc)*d9qAppV#f;fAaiKtj-^DC^1~C)}gWU(W3VW zcZE|7yv@?vmWMxxS=i%|!aCS|;iCV4Ked+A*8Y=#teEG*pE*Dlg4;C79-ShCS@n}f zqvZpZB$RpKtFI5@6l8fp-9zD^V*QWbl5kPR83!ZM)-?t@&z7RGivr1pSpwLT5Y~1< z`9SF4@B!X}88^$nwWuXCfRR8fudUmO440jZc9#T*Lub4LBLvLP-mHpq(XM^ICCOV5 zH}a40czWX9Nx)LPZ+F}Mwgj;HD*Zp9-_z|chQ}OM4~och$6#zRXjOcTA5`DYRWZ(T zk^ZZ=#Lp|lnTHP0x5xRe2lXlp!Bu3dm@pLa3_lBGV$IU*tK>uvdqJ}-XX}?5euFt? zJcrIKV#L9U?&P7TF&4%0MMT-IfqKIK!}{DB*Lug4q^5oP>^k8L}=T1 zk6rxEf7QmA+u)gm;i0A&6=XnoPy1GFb#B#fw~jriK-Qnyzbe>m=_nFJgMNJV z8P;_`*}ZI(bW}deRu`a0O6oNmz;+*)mvyqM8XkDd`J;R(OTb1qeCTV{pm3ZUrY3%L zqvA$pTCElhg{wYxb722w!~@65EumTY!gyyMrV<+GJ%gd;iOnW;npImP^R)~X-l|6q zaCUd8^%!AHf<%(&csxKoK(+#+yK?6^FctnJ&ubpn;;UNoy>i2R5F zb4D=RvR(anLAQ4Sh#c&%(i*Gwmcxhz&Ekd13owvboPG#mtew#z7_<%Nh@JnsxLSil zjJ~0H^o|+)Q7Ldm^le@QriY7b4QofK&A*o8Qy{*&{(~qXphh;S)Zs_R48ITO_Jg6; z6G)bZGumvWEP3$f0F3Ua3yVmU>5`~3uBMi`z1C&lX!_EjdoCc;dS{IjA=l;?Wd7S! z|Ke)3*O4~L3u!cYsZ6_s-@jTz`{y-3fOQZcrR0U%w9eNT>KEJ!`bKL((-{~ob(W{H zVuRwfMh%`ZTz~)X-Y=DbOu9WXeC2EMdbBEj`<(A9wWwJ+*NmBSA6|E+o=RCVk0)HtkA{K@13gaG{j}1F z#e>8d^F8w575YxSmIix{iaTh)vsrA{?hk=;O6q(>_GRkPiyAdGX2|cc3(qo?we}OK+*G`JIC+5-{3>&=Q^}{pQOmnf{sWL~A5w78l#qus;&iCM`1I$S4`+1@T zx<24A4%?{Wli`BJA+>SvZhvl@MQ*p>UubK72r{YVG)I}Ap66?>)hA;1eB}LYkcMI( z^S-H!zgY$;9a-H^s|dbG?i}2kpF3=){CY>ekA+cfS6*OV;u_a!0QmYihjK@{=M`D} zb={*XK_^prXnnnX&{L2ha!Kd4BEugxXe(3C`*}!BYoM$SYH5?SGR4W`TjhbFvqbFZ zxIeUDr=;T3l67%W(o8nDb>ua6r!`pdk*! zk)B`Ihu}AC=_xfehmc^PlH&1wWMU`m|F&Uv*`7159?FUOL0#kxX(qZbK-|ZR+Ud`> z`?1kBC+BU$*BR-T%rL3o9_kD{`U=i)GqAh~QCh+2CxQm9U(8Ass+gl|6oFI_?O*Ju z&LY$kL~i8mKW$4i|5ik?*1v%1Km?)#h7$A&<>UEQ;=N@!Ji}{@!-~NoQzIuu*m0F! zUt&t8Gw>3IVXR7jGcW7T>OTij`usF~eJ{7z4JN_)6VOb%T%<5taKe8>HhfLsMmS!y ztCG~6FrLBr^Aty$)7iPMxjFI8-c306J2E29dhZ)bIJ`pjZZ-i+ z9?d$tCQlEPI**2f(t5|x8gDX_VE>Ra;WWkO#sn7wBYj+p{jT5xrpJwfSKWA*jbCtv zknn%{cXT02fERqE+j~W2}CZ>^&pbVfHTwB5%gT zu&uv`k$%MTyKlH%Lk?3 z8J=N7L*85i3C6>ExiAtNmoUrKr)V$OZSav)v*YwFi<5d;&Kl=|xkvr^gRGsJ>u-gn z&RnLc7X`Wa{?Om8HpkF7nhRTP-`f8kcILAk)Cc6s-_9zX@k;z@U04{?@E!-=TMY$1 z-{#W$JvHt2*9PP1)|ix#T-9}XgyFzX8wGve>;`t?~?(Bu23Dsr~zZAp+hb= zi&sD)Q}D(XyusA@^o?=w&9Ht~-RNdDM-a#+xTa@92#UPb-{k`QrTcU1X-_hiO)38c zx(7U6l32bPzb`X{e!W|m1pL^hvmd>(2$ZfB$& zO?##?ByZhd$HCA&Bgie@8^=u_t}E!y)i42KQt+L{3qZNK<*EG&rV6`wgdA~=@n{!Ex2NnV2zkn(Gs@;n5)WJ*#=Mvbu5 zJ=~?+ag6Gs+YR_(^!s*NKYkS@nRA+jg%v7IXVqa7Q`V@do z?_o1+_Ss_=PaMa&wA66Ft=;GC}*&qb) zpGB8!*$Ce2%0~ez$t9>qjX()mr?9|{tZFQ>GX@*gc!x? z1*Pw#IQtSqKKLk$um^BQ>M!#)nj9Z$+z=Ra5*RzNj)`rd|F$Cc!l1$rsAiqD?_i?9Jt-a{cRH;WpD z-|t5{I#FwWSF^JtAozp2@6KqM?|u>x@Pt!5qrm?Db^pt!Ae&l~&c6r9RNEXYmH1!b zCUL@7;Gg~9Xbuo^QP(0ETBSUHPrbO0eY{d2KY`+m!w~tSs4lZ_cSMReJo>vRmWNin z4!qMG1@|24?Q+z*WxDh(^E-~2B^hMh^^4{5^ zd}1v(`W&zLG2TOOsfEv6AD*UX8Kcs=4nNjjsCa%?1kcIo&ez{>ZME;}BD0-c_cblW zYn&fl!JR%&yAZ!wlnT+JLG}`16fzA(FCqQ5^&&Ff6nH;ssxCvXVkC< zBUuUz-+3|0qJ--~%EAcRi_yKlE;yTY2Dp>&j_)p5bJ! zVfTAk>Is{KbMN+o$f{&%rM|T8V zzI%Kw6F~D%dM427@m%gISP~X((a-_h+fX6$i(WkEdpYwAh2`%Q&PIjJLWnhGmIRC8?wak-+Vfgx+|j# zC9bNzSw;@dY3Vvz^BeEjjBzoPfQ6XuJ>#j}Qb<0RJ*MKgO zOfC1utTw@^k}2-7JQ{d-L|K55AnN)mYX{!$w|ZRy|p)w&?w2i7U(t@^uwpCaoTCq|I)8U97?^^4Mj+T zrqtRrG=_1+=D)GVL>H0#6cYVYoo9%iA~_}SR{H7{WatJhPXKo}{kms^7MuG0AQKaU zx7&|0C@f`XSzJsulf_6`Mvy_Ia~DS)L1nt;M~2decoBwp&mZL6a8f7ylZ|_aI0d+T#@^(HC zD5;}hIeaPJiZFlb!Vd&9*uQHwA#7}CXO4k49-87`2Ist`6tz61HME52##9)U&D-eIbQqK zfE`U{L0!+NLpGzi(HL;3-K!pgFDTZy$S+yP>#M}pz2`iRepQitrH zQ}E6%rhY4Xl2Fq!$*_BEd8wTllOLMppL=lzWYpfdWj_H+@Ii{TU31{T{OPkPs|iUG zrpyV@h;B{d*7@2qWHOL0_ucVbHYsxb>S6AZensU}dG+iwYk$HA;2L8y51SrOyr3Wi zEB^0sUxZ0e^`?hf5y<+rb#x!PwY8Y4)+$-CMvwuDodnFk)d`*S|GW-Ia)o zx82hYRiBf!%D8(yb=Z^L)Ln$7_nu9c&qQ=`VkmlafYLwnBcRK3w6f%PBuunsZ#{9A zzC!RuUaIG)Nh9uf67g$Xz6r5yys}So)@A845q6}5LzPkMx6H6LGw>i0+>_zeGq$+@ zSE9*Qc{1hAiF*%nvS9CT5{TzPxFV^p*&TBaQB+=O^9wt<wLDE6r0QbSLrIeth)f;BIQvoz+SR9GffN! zVb9T84vni)bv=rAIjQB6{l+!z=5bXcfZT@^etp38Z40ieT9sd_ZhV-zH`VXFO?edr2&LoW|JH| zT%D2s`S%pgQpI>~!;9Q$G+(@8_p)xydnL8|TJ(Dfbf-7n_L1EPL|O&-h08K;f72f@ z_eRYK7GT_;*A5>C(+t&hcv(OQ?EE_)&p~Lwr+;0#Fl1d!N}pzE53vK4YxHBk?cP+q zs`0aSd~e%3ybtPsz3S0y$lpryk=6N|oh{2VXAQ{{ic{&cH|cHXoFfkR?G;>H-pnio zQ($$yI02#Wdxqd^5pH1!Q|BcLa$_UXarX6^N^pbT7F)d1>4pHFp*4ZebOR@)Q| zY7>Mt30QY@OnCc1mI(T3;4i{_4Y$*#u6cX(6zBRmP<99KT1F0>6E6rPHE7CM1byc- z*=vOW_jHlOTTQ!9C_GWGI3@8dJqOwo7SXE)aQfrms|KUo`wfg@4~(> z)0%3ceNnxV&kumP^;V%|#nbWlKF!ScoaU^UCiF^LR~BvpAKG-G*&DvFh&*&%&KHa7 z-KwwGTX9WT`gFJ@$Ur)GvA6SKHj{7l99*aV`I>R(ei34D6`m<&d;Ad*Dq&m~dyt$T z>Q?a6#hUNG1z#=bmd9EA20w!`D6{K~>-q)@N(!&i#6LJi+q!284qrge=|X;rF@=46 zg~efQOs{Q%F7q3X>#<;jA74A*s(!i%ex7#g-zkjK)*|S(^F0gLoU{#0NP_iofjA^@ z!;FHiLtvoh8e`<2tIOMBL3c0b8=a$6unw#{WvpauZK|i1o`IIvV+cuA4Y!{D4qeaV zxTA4!in*{j^L%2A<9NzRx)>R2SL$|l>Nke6n|Eq5YWXy|er5f`TsFTSj-OEFAHd?( z@fS0p=yo#t(6#Y>4$gHA;ROd%3qblbt^@!K^(cUqLJjG7l*z^7#>;3iiT2Cb0vG9M0aDm_j=c>V;UEW;7u||+H04$#L@{H`a?c{Qj zMfqK>Uy#&fq@u9~li-T&}oW4Pg=s%qp-`1niQ!?u5TqWcpC+ARsFfmYN%xWv^5OXo1wS8O0*s}<7<*6(==6XIy(nMZNs zhOEf2=&F8fJJE=E+(GtX;cAAyG19MxqsAQF+S^?`HBF32FZ{2XU@G65d@5-qvLy9uh!_d^&nc?xL-p8OfU)z zj(+Pb`IiW;Ft8*Up<$H3j>{XFMV-U zChhZ4?n&BcOe}wk-6NjBa>72xXWr>U`r%L|oEq^VnFf7~# zpB_Gzqb-l{oWY<^wF)J!m|Kt9mw-|!_sImTDZuL>zVeT8o<}ab>sLboy@bXK!vW&u z?k10Y20_j$u7(!pU)p^oF2MK3f#{lrwtBa%E>yY@6H_WUP7hT#4 zojXS9)4(?Fv`r8OD{~6=Zhe$0R>~T3_$!ZDzq#->ymiLykjpcjqjAR+d_qLP>fXEP z+zWs)Cj~ziPdq%dK1VKrvbG*oD1pOkBvn;k)NEcLHhVl+T^A1iYO^gD<=*2%3jr)q z(pu>!Q{q7GmCeI$p`MstIStz_NCA`~AG&Yx26{RD%GSLnzcnp=^=QDjw$|2qSD@)q zrlO4z34{dS!DM;nr@NRCg_ZRvrHHF-ut|>y8hjR|)-(74#kxM*lvw&swV1`dm$asK<$M0{J|}JuWgmb0zx#ZU^RoRmf`w_y8Rviks4!R z^e?%v$v+rXlNieBKFE1Y?*W1TJK0s%>f;cnw$JTAD5lTF?z+O^nU}nW5Hdn?Ms*@a zN6w-Du$JTRTZ@*W8O;L7vz8bT{{Ax1C_l2Jyykm;a4!=Vz*FSLTk=?*lY7j9f2?uU z0`<|a64w)aqgN`s5kbu(ic z%J)`twt$UEa88yDtiEDl0|9`4d~0R#ciIh>=n3o7E#oo@v30JGF-(!)pw|Vko9a67 zN&-0Wg4N0Rwgt8#Pg3>4cPGLy3hk}t4-8IYnTptE=M=`fU@;~2)}fKdMUGOEQPexH z*n7`DPaC4G`4e!Z!?(lsUax`7?(SL9;jc~te#spj7>kRbnz-YU4*uV{rz2PH2J3Xq(y?)GHX#C)9D|b1A9{Gwfi^iLgL@Ezoiir zrJOu)0Qtn`1adt(FUPu!^l)H9rjMksK`Pb9M|8I1{ljJ@FVZ|V5|)kR(yZK{KaW)O zCUM@Gs-h6Y^1$7cwA1(Cm%!GBF;}bmzmO$P)05yPf46*#^W$2=bhF^<`wwy(S7Iej z2=$TalL=MS=|vqG5z}X%*|fY)R?l>6*n@|Tu~dm>7Tk+8 z#5Z4ze$6i7Ex8242`nYu%UuQ!lN>Cjjh0#pSF+vT3k4~pS9H&WU!ejS%*;GUTdGX2 z)%u1@$1i3(8XazCfKF0^;%NtwI zeh|hkJsYjwnQ0%?j6zgnQef-2c@I4;=C-0MU74@!q3T##1 z4V{DB4p0ySe2aYiYN?jF+~1V6d2;gZ;b$xK7F%jroVQv`NCgg!GZ0PNZXY|CvW;~g z`K^IWkINLK65B6xFWxT;|MV-Vo?(%0cZaxti8jZ{nw4XA3~_ni?c~<18QmtdOW$lH z5{fPE(Oxn$FY#VG$(FlHK0@6}@|e1XUZh-lkjDN(#>KoIFh{c)b=i0*wo~N(Sj_F; z$*ZG}Z2;Km-64JQu16Stt2i}zJCi<_do7O1&n@WA$Oh)8*#k|z%($LN*qm3@f$>D_ z4zNE2|HARAP+gSYtmMq2_$_sw_xy2nkLT*?cL>I$+RGQBliwzCCBBPg6eb?)W&UFu zKr)bIYjy0&Lv=rPS?y=8o4-#pYuvfos5G?9G^v9I7Oq`0Q?Yh)vff4H7uj@5x%qjt zYgD2FT_tS34w*gLKdSE}i2r=#><(91lx|64k4*Uy{ekcs8U){Uez2~D51EA@|<)RoqzIVk-(O0{{%_It@~5oNgq#?UnV3StRB@^>mgQAIV{oJ<>?Sb%?9TC z$QA{yhv*y?Y?TuNO3H$$jr_xD3$|4;w7zk-+6VdB6<984_Y zx5#iAdu6@JH-*nGhqvLfT=Kl?ZR~x^#SdBoc^b)d2xXKS@9GN@R8-BXQKOiqEDJCf zW#QvE3sap5-K%YUGy7B`j0Sxf?+ugEW!_kWlyT=)N##^}=w&0PKW|iL*$<1-e`E~p zts+)g1MOFRMd;%-qF7E`#KhwUcKW?{=nU2zADmQ`@V?% z`&&<73qU&RYo<>gk;5~s)sn~FRDTz1dmX*?rMfr2BqXiq66@iBQGYc(_>KGiPJM`}xs%3306(vt zDLEX+{OZ73WLW#!&Dg#jJ08SQ;0U zj((EB6PIMsIsu#Hd%#5WNB(78%iwFy;Q@Uj%jdL?2tn=o;jNDY_iTkhQ-pPkOFs?7 z4W3RYvU(n@T_rKC1pS(RSdcfz9(mvsT6Dy{#kbbToE?`&kXwe*(h1IXH~EmzSKiqQhI6$gLK^=9gv^y54x9* zf-O?KW%GKnrD0BqPcL>sOU4}=V366BK6J$*`Mpqga6=p(>%)st-t}{1XPF+XqeTh5 zEH2enjc4={veFIaj}ni6NJIY-d_+53v-)+5P~;r4*Sug>sY3~Z4T3Y@qkI0?@K}D= z#MEu$XkW9!^6G3gG+pbT&m6IcqLTsIZBUD)k0=md&5+N|Q}NGQ%GMD_RcKMe$#;OY zsj6DMhEL+;7j-``sZS+Rn(CdIQNu%-*&`3d`6}ZldmpVh@9MZ9=H~FX$jG{GC&0-2o7_6 znCLjMgAr$hY~&5!qBb;y4;NqhrrjrsMq#-K3Di<{)2iNt63DCk+@iv0%KSkX@F zT}jk=L!Ilr??B$Usjx_$YtC#P3HoLy!4qCUNbsM<+v!CP!>MiT&JhhxHxktQF}6|P zNld>JfQ7y=v;IiV(jx0*vB2Fv@sTurOp4WyMj%Pqs%#fN9lR__%WBkek-YF1fdJ!M zI~l_L^ia9aSAI&F*QpKTU<@)HH0oBOZM*e7{b0z8{*JVb&4Y#HtQ(jvY>y$m>td&S=eRUm02r1Z&`1f4bqG z2Ath~n$H!*#W9a&e#;X|bBVFgIWi^yl-sojR<*@xxeSXZ7svA zc`{HU=QP)D977KoB}F*EKCP=6!RnO9DO#y78`gI(s{Hz;{!y z0o+~D?JN@>7O||$sviJd|KOTe92Oo<6z1`;bePXP%~WkKlmKS;;5%M-dI=u95_|i_ z#esaU><++r*BDq&Ij1|p-4w%+KWcZDBwX_IHC^~|Lp0_u;Sq+{`1jbz3YTfAZkdJj zaC%qV&<~LV|1Fk17_;H_&obZa1XivU=Su8N$%J*XmZvRK{UZbY`fsdyNVQ#3d8~dM zQeUQBMW+Q`;~!0Y|IF#e+2ofW?dm&g#vlYw)##w7s9GR=i1lDlrTOfSYus}WZu0yTJk8q)n^{|!X3R4w?VF`8GTcPo{l zggG}?L9Dt0Foh+t*GEAVATi-3Iw?;@#Gt2)Kq>GNQGqEk6fS&nG?)9@ucMHt*K}|o zVh>0H$xh=I3tu?SZTkD*J)w&QKquo^o;a11m1@^%I^EGvOjsd7uXy51P;K1e$#s9= zLMGu_i?`=q-*eU?J3Q9C=GXqhpvPgG@I{6jmqu>j2Mf?%Ht~;FlD}p7Iy<^5mG7VY z8xtpPrqMfSKzds}sreM1Y&1>pXh6daVjC?}6MWqI0Cea}jXoz25bqEGm6H+G`an%Q zuaz^OVTLdvl;6f*nj-^c-pa>S_Q&0;6+a4#4)|Rb`(#cRM@6Z5v_$%yx|!V0MA4Xo z5q+_$X%nL4%nl1ztN|JnXP>bQym_%_U*UOmyV+W>D@^Y88SQNH&?CEwMDY#1M4 zT@*Kl7+-0^3j5@$Jy~4VpoQqj|ru$FjN_XiRXxFE2q=)GOoCHX&I+tT;+`e^|M{ccS8=w0Bs(Xrk9` z{)`1ih0qb9tP;sG;`hjm@pR#p<)A^C+iqGA5$1Ht)?wMPgMF5$mE5^Q#56_C)L3t( zr%6X5uPR|0A}a)~7K_J=w*g)@NlJHB-<*}*q zAg5oLZH~i`i`buJ50eRqg!|ToY#M_Dq)Q_*E_VhmLfHv95;8BW_d8F7{} z64j%k26~F}ib&pkC-(dUE2n#k11%;uU|~O(&Ha0YnCr|`35HtZ+TBElQ_6{)c4q4N z==iA|F^|o6^IC!2Ni$G}bYB@f*2Ex}vqb&nWH((&BXRM^7kHQIFPs^yBq?d81N=`X z!WeJyc4L$Z-Z-)#L5OVb3ssZ8-+KE~R=W|}d1kKElr^1B*KkkMMJGKVPw$5H?L?=6 zVxKGsRUbG8^f{aG(ORX^Z7|Pw_yR6{>?`v+H}1&AF8_2)=9)D_jNDZC!`sAecs4;w zd>TxlbAg+Ae-FF=4c&k;#Q0tvJ@b{cJNtIJjV&xi#yK%y)>e*hadiuBAF6=?h{Q9$qB;odeHfK3z z3pqtO#Sy+Uc#+dR_hUT8I~{>LADrnd?}{(O!ZC04mOXV@;;eo71fhJDM^BHRza9zJ zKHF!=xof3f$?LswVZDP040>Q=HUQ4ji+BI|>qy#D^fSZp61lelwHOst1%FiY*^Yo( z$UuT4#Cn$BfkSeKcVg%XU*~-59ohJtE)OYZe)pXi@ysi*n0{LPx}ysxw>R~da@9_= z)#TjomOHX=ddk^L50L8ey04^03Hq8>iYLul?&SQl1~%5cmX@jnHWH(2LT1YT!sRoc zpk@9;L2#Poq%pZil^$(n%sW=h+ZuH(gpMoJ*RRC#9Z{$F6}J`-c#1C-!@-?cIDKU- z+&)>qSf?njfE9}zRj2rsQYVKg%|pCdeVN-wo$-TS<-Lv0IDffA^IzVH##&%-VN`&I3Z>Dj+DE*Hg~_Uo*-DChVxM>5*nW<2qB z7fxc&uAoP~-JTTol}Ir)C;$){Q9qxZsDvf>T-%jKV*5% zyJBa>^qga>aem~f-a+AcaD{q{I4;icE3XmtxEX#GDD1_+_8lp^*VN>?YxsTC$iS6X zUCq=#zaK_s}zWn&O+Iq}UnhI*)RCj_Ph8r_`}$*>Y!@o;kI@ zb5@0^C)l7TESz@q*Bng9?*D|dx=nIS%uG+|`pKDJcH67Qx%P^lV`u3Zch>$-IJg?x z$8_j=#AW`-R|+QkrMI_U$zI|9?`{_nEV4)(eY`XN>RT`==XxmD*q@seeBNX@fpwA| zGrjw$F>$NvNfb03-iz%h>12+O@p^|&%SoM(j`0-Z9X^c5b<5gM^lN%Cb)Js9FY&@1 z=PB-MwRlG)*l8Msn3Fxl^R$RMk9TrUdAz4N!kkEmd*J@*MusRf}d9U46$1Y9(N6%dK3ClV$@MvvL7 zy6i0;@DxuYoz4phJj>6=c#0ZB8P+ti?qu!CLWbV@w zLZKTM*6oWwFb%~|&l~i<_@yUb4YtDz$)lMk4UDm8?ma1h8pQ)97L){x*2LCeI(BcJ z+ZQLSx?*BDC}`vq9^q*O;Av&Y8G7l)6GY2t1mIbO?rDFPeHq4suh3I0)Onf=ANKPx zkln-HD(Cp9vvmGFrr+{u&4;u6tS1C9PGd-&UR|EXNRd-T3=VQi9brgy9dPn?6BXoD z8bNz)`Gv^8C zqUf@-X$}xm(74>|Qaj86&4E~x5rxY4q+!8ohxus(kEUK}S}Ptg6%grEc80E0qJ_SF zC^aK>7kAwmPkNN-JONic=<4r3bMACiu7yUwRw(~AdSEC^{G>BP3if0GhAu_FC+@33vki`+!Vk~ zRj~UAwyClK0;;LE+gqCNyrPQiHdwzeYTJ{tDVYd;TdlnG}owg;+b+=V^s7BPb$H2$mF<0cC(K zfVi93D7B8NF;eIDafKf6XtlDOcAwT+W7Gc**_olIeN?L~>zvk9%L-8GD(eCqH2_ys zh7}RU8o=DK0B}u5X@%E_!jPglM2`k|51J!TLq1^<;52Zx<-cp%K%5vp#Js-X#=*M> zSFEZJcKk&{YTC4!d;FpxCNMD}9(=t?k~f?=cluNJ-+Q5}h+8+7_;>){SyqS%MC@F1 zK@x#AftoRdBP1Guun%S>h$_UlmDw6@U_6;L^K($BXD9resPA2--JOW@vc(YL+Y~C% zU4+vDAa$$BLS54Ax`Nil-%Qmn(VX)!&$4Pt-Vc4J+kA9cZPdCMNz)iq6bzmf%0&&o z<4{t?4qY{obD27<;(gp22b$xRm2uyJZAl}wR(l2Bbu z`2eQ42+5gOIo8)cZQ_!BS`i_@rN4`F8)%_ciZ&QIeR>0%EQkuGxa_4?XIg78Q#`2E zHq8`MYa7ssciXQ|?tUd}Ia(EMDw+(>F@6yXQgIbqh(JUegy?z0?UNI|eDN1Wl6zHT zPgN6UPEMaaWmnxo%GX`h(CJaOv9CW;?P;Hzjb+_uAw&B^9gwDFJrVY$}7PjaNf)w4nj4i`Op{@mFp-uSW2 zlV_d|U>g9$S}+@kSV%H~s?4>a#d|$f)iG=+#HD0#$%$`#8>tYRMo}mT-X@irWdF2u z3za@0_i6K=hx}fAtxX712m63$&J?MIHB!s#^8i#aViIV9DTWvyt#W^!bulMX4E-+< z7ALCc0>iujRlOgwS=vp6ECX57_EzLm7uQbzlrp=Ha(~Tv$FDYlOhzCkfFoG1fr$Au zgPysued@t79RI3_{RkU#SG=(qnVn0MFZhRle>}DmVFEqu@sHw1JmL}hkVjpwf<68G z*@q}y_ejOHpHW;1;4OfvDiM*kxD|J<+xFv8Jm|hCjWUS=nA2xZjjPz=nRBO!*$_q1 z)q{=Ao8rwA-<_gi#R9}20_0;tQiPgb2gU4eae-YWO57SBcT7 z=+h#V?_v@xX?qpjr?e)EeSPzU#@JXxU=0LYc;@XC-C5IXLu zc$h9t5?C68*nndKm?0oAh(Oq86MX|Se(r&={In z8crTQzGUsGfu*~z7u?R)egWuVfB(_RRbO}=u6ooXh%7{j64nt}0C5ycLV(&xkX(UD z9D@KFo|+gLj|K!jp<=fbI=_vd4YUWN!8FeXqkE_W9Mg+T;Ld@zLp$RL3Y=#rt;LTl>0i4W3!I^{y87FN)w z(rjZU`D?Uh?$Zi-9YQ!);XW-gMeW80m+d~CRft_#;f^mY~5Sc3#`n6Dett1Mi1j)F*OGYjmP5%EQ!T=0V zR7mU_WQhwVU2ww)8`;|tFxYg4nJBCZR4ha#i~ksGY}Sq|tvWLq?O?LMw-8GN0ObfQ zdr&eUwIDJeju43zUnSf<6%(U9&ZfMPX7UtMO`I~tkWLwktfB^C9U5puJ;?dcK$}?| z&?V4Dmk3-OVOP=Ix_ zJNHf(3p*Ks02p5|o0wd&5XxJP>C`^c6?n5G^;a18Ev%;G#&o)9DiT+nj)Dlr`+GD4JUQX$Bw*b-uqV9JnQKMj%Y zA-4M>BC2b3Qfg$1ZPdDJazPa^P3356lJ;k5?&7H9`N$Mgs z`W$6y0a4nyrBIY!p;_#wtFmU@S$L9QGTwt-AlkH!fs*eE#LQqJPkak?pR$`esDUid zX6k1q3%9A?Pe@PJ&LHZ)byhAT8rn@_Q6Y1fU2nt@B% zgVsbT37QMFbjd-l1E}cJo>q!f&AvmB3QgXxLMmk0g;lcA8u1sp;_3pds=?F(Vc-6Hcl9(gMM85u)Fp~L z)E6GEs%TUAS4y)LfG|{(b<__>hAL8%%e1#GuMo9f$&7&Abr`re%!nLwO|<=6IJ zwfi*0r#Q_3=dl{v6k|&sOVgjzoWRwsi5jX++NK7Uqb%!!vznU>htyNj1%cB55WR3I zc1~DRrK32C*%;KD>+}I}sb)2J6$cYhrNm&r^_YC&8Y_s>^99x75383WH{7&(By5%nWB46MjF?U8y2hMBwajUhmk2&jbCdoVn_DX*N*$ z3ZiVvJn6_3Ls6WEA%@yv%K<4wWz-{)dx8`Uf>5Dz)C#XIF&&C>wZX%19rf|A+a=;V zlc+221|=9{z)TDx%9vl!JSf#m_^PhxtIAWHHq^D+c3+mr3Q5hNN~Rd733~Tb)c{w; z6uW4PWmpsqOtFiq=vy(Ol__?yEc#ZAKshBNcb8Hc7q9E-s3W+FJ4cbV9L@0`@M2R1 zGecDo5%PdikbqU8EhY+a9?DB~Op$6VozTuVXwVPslBw2Z(Im38!y|NQ>O?`W7h20N z^leSTHW0Wfrr4#0RMYFBL#b;pj9J60OAD#4s5PyXFs9fCaBU-OHoY>|K?EUk!8Se+ zP7XLrUgv!8a7yN*JpR>Rtcr;NBJ0pM0IaoX$v2;2r38`|ny-1ccq%Hx3hAUFlB-WM zz9UoY)1lQx2{tpukWX5KO|&J1)T{`uxYWa#;<8p;7#ig38$&r` zhzG0-wN+W_;a3ZV9wxIP6?&`|myNw8rwj??vXz(+DI`C54{WiPmWp!SX9&Vv`>oO? zMxbtYNWk{0dFZ-a&#u8W^E^Jah^$#o*!CCclZ65or~oT3neWelZdDK3K%MGiFmH8pcFO(%}*q?@cbf~Q!!eFYIV(4FS51>)|ee>e2 z3xGxevYx{5rVjHm@36wkyy={adC?U&T{{UrQQGg#peXYLrjo=*Njx9%@gJbOLfw8y z&k-Xc*ItCkfWc_*Cs`;w=_zMjnYZj*aak2+wf(2A%-gaWJ+uks<}z>dit(O7TXWz- zuH0De!ogJ_I~aDTvlTIqqfeJ_hLAf3B;$&uTPt7! z!4SY?0k&bA*2j1&nm3j`#{B`{s5!ol6cLd$P!4My^RGv6mFf{6|Eez`Aa-YfV98r& zMI;Os3qk_0@j*A#GI`~!_)4aT11gr$LU<0``fX*3dcb06&43GFit8Y}>zU#~0>>q$ zsOl?f_~VjevAceD%khk??n(eeJ`jM#$I6g`l~dwQAfL7#a z{!DsY*o(RJ7|U}CE&(`QGH@%wyje&sHuQr8u2?U{Srf!*)cCP)Zk-7H@wE;{h$Dm% zG*94_kW&UK9!jPM!Ud*SxNO~|ca>VyQI^yY9_sNc<{eHwQ|$6h^D4p)_jf6IGB0pE zA8=j5jTWf^By$aa4y+eaf&oTsu~CkA6?qVC?WybXIApwu+E>G&9{*ZjIo3=dP}bE^ z1H7l?D`M1a%EEqS?rEcRRD^YxbdcYx%p{vnwW0^$0@zE{Ez|>WA-|z44YkF4=Q|v0(+QeCCB1Lzm7$WLvfgKny>L#WrSWTXyc4LamL@hL>XR+1R z2WYdeXRgxB=zU;_TRBo{fo4{M9IM5pUJUDsPT3~0&AtbN@qq5%6?aTVpI zh+OZ~WU7n&~s(nYHn}_0 zZ5^I2?p^yi1sf+-ic_RFLS1$GWBr%i5%WzivdzfHgP z1yn;_>?(!0EYzsMCJ0a7Z!tiYLa~eAKzZ*(6+nC(I<1&BYFD;<$kf77AOD(P=?pMP z!IYjobcmX(>MdMV5S+7bY8HUhVn}O%GHejgAU4G z7T`kq~+VOfyr|aIG*mZ~Utf8Op)hErwbq9-E#xVinhd)X3?j{H zo)XfI8S5-~k7n&pJ>ug(C~L*HxBv^gnusib8X(~SnqQZW!DVSh)R7U)qXb)+qt+-t zt>I3Kh^&xSM%?L+CbhbV^-zaKL%*#miZuOkUEJi;M`2Y%=4K@s!ma1A$Fycib-PCc zT^hiADH$!6Llpw5AW^8OKh{`A1YD;L()i`7M=MWpdN%bqAZn?XAc6$}I)YIHk|6|w z$Wq?rSrkyFurv4~kw}^16v+{I#klO~(-vP>n_%nHZbyrN)*zyOl;dAF zKLok5rmBhW6lDMgBJVo|n4k#|n+Vie%DY@XO4Hz+ian`y5~_>b@8I>DAv_wc3JBeb z@-_+K27A3ggs6ef^Z^($Z1%L6tQhRko<8Y3D9f>8jwyCDLVB?v zYM_{AiXnN43vU=SpCQ((zeO`-=K*c@HO>C3K-#$WAi899koE+?9>Ft3JonD*aWCrL`qd9H2)eWgFPB$!h zKLohCrwG|J+K5Kh8jci73MI+EVTGkrwBxky54{t2Mo2tYw zX}4)|GO6{_Negb>fuc*|e%~bz+Rqw0 zEX>}3s~YLlfvmS$Rg3v7w6;DvU8$+F4(ySRn^q>GGcV2Yu20OqyRy9j4SNOglnKnopZ$CM281l$}lzbPf7&#oC=&Yr_k zGWx1+6S~@}18s-_B$N$gr981?0-hexir{)!$G?_*yzrZkI%OfJ)F{hWk`~H2%fK4; z<8pigp`oNTk*CWn0v;0dQJs>}Wc@Fz%v)e`p)QFfB5=*1OnBPzKbOT4i*{dFmy9{_ z?(}37j0mNn=9JeiKESFeisq??&{3-WsYiVL2fGA|xxA4OLq)+*7$~4=O~_0aA@BI%I@s1MP8J)%iqQm|}}#Pn@jeaWIDH?v z*9l>5$C{Qbv;v?|gf-Jx24Zc?PFwF-wzR89CW`|g1!)>#PE98z2c!uLLW>U9nVPoD z-SnzCY~z1mSSf@^RltT^1Zv`}$wrZ)t~(p4R-Y*rTSo;n1n+HS6<=>)icQwN_9&7< zL>0ICoTky|Y~iQw#-k5#Xi;XbV%6K!vzy!-p0SwF8gt%C~90<<-IzyM%Mi(*?3l zG4c!x$r}y(b49b-bc`w)-)K4^oLv&DtST}5fhjVpbD`zOda?= zl`UfCN~TzfKCO~CeP`Ls5%stRFYK=Vi7KX8CMGL+0MjrTS|k~siOrOG zYm)2BI8*F!G*%~?`moSKk5J1sMM6O9`%JM(_}1hpw&CA5@u>%`1=DuDyU<2zwa>I8 z*7IK6vbnUtK>TXc)OdCCTeOr{Oq33!jLsSo#nQWddZ>=C0I@^JsyY!|`9lGLMHH%% zpVtuD58hSV+syZ&4BMJKbnO2W(n&q^5!!|y3d>@DNehl9pgfSyiMMu8f{bpOE)bb6 zuGB95M8cMv&he>TR+|QxVpLM+St>FSl=)x;Q3tuNI9z#pT{F`T+xXYcK+&lP1@A?P z(!$}koW6CDxta&K4*1Svq_pwwP~yDk-HXqA6B53hqY7N1l+`vEoG)364Z7;>hd+A z`g)#W&oad>pMWI+w?OpiJQdYL5B#QJS~g;sW4&}M2)+n#T}EGQ9R&!xO|PKtkJ*bL z%D(Jg01;efbnTPNq07n8PO~h>RB^e}!33y4h#<;90+0%rln|-cB$4mqWug|EsNsU9 zEmUw`X{A_rWB2qiOBgDx2)G55SYN;u10@$6YTt+_0?KLM6RQh73W`N!yT>Mh9<)Y(HgKruiTYc zB(*1w_DbFocOrSV#aB`n1(BMInIuY%tuB?6fh( zRrEurxtQWA_|KXG7XZmYAr^od!mAxD`V`^7rA$!;AkK?2Xi8sJq#L!U@0|P8m({5g zT8F-afu!X+K?){c+N0YGd0a_g!9yADMIU+bnu7X_}Z{7;2YR?gp2I;f)4l#!vv z%7;h0pW<;r@MSN-{C5ICK94ub-6{%(&+?a+$zvZuBksdWOtGjm$-mc4J9KA`4YH@M z%$qFe#0n8xZDnAolSrrDHeEfN?9gPmFG^iyebfQR0BnAg9jYD{K}>7x15{kz!locV zL=X=L&D+s8Wy}OYQSlXu_h*HqTCDxK<$8$x(dM`M5>+88Y_=;B1@fIm>gR`o)WCZL zi?@jiGuYZ;p!S~CeV7v(;ALoPIvfttysIq~xZ*K}uXvgjOOVy}tDqU%LYwfnhpwVc zH(!rEPHI~sFIQNRN*6V&8t+Rb5GxWp!Rgbdt3OCJ7v`LP9M#J2nUu#aP42o1-5NPx z<*bs9qN=UOV#vSihaTFAG4#{hfNSE+S`A!CGY$&)s;0h9AvBx2q1I)NnuduM!d(9M zJpB^eR$J5ALK|@TL9C_`<7xjlZEuLP90ws3?mThQw6pn;c@INdM;+GjuiKTVg^)W@ zkkm>eAfloL3ExJl!M0Xa-;lVt+3K6ZXqU6XdC5ZY*5K6ubPp59&d+OpyTRHl@P1vol-|z)L3pcF=H` zogO$IW%u4u9{*~Llxljyu1t8I)!!;g6oslcg^#W3nBFFx`fB#jAhD`?p9{jH4f_(j z?M#uD1YBD%j-axyqBbbQMIukT4y}bL_FWqybWMaYMLi(kYBpouW!Ud^KB%%&69AXc z8sT-cD%u?F@gET8s^G$j0xJ-y7l1_U4&Iq6drTESXSxW+%$Z`7Ca4aKo8N5j@OzaD zwNLwh&;l1c; zQ)E#`wIkLNQ_LVt4O#*q2NuY28NgWpdyUv1fg?4o`R%BT{~#5j3ZRJvsVk{xh#(-i zb{IsBr&2Q)Q{il)B2TgD_qKDUF0#DNFxPt0Q&q>KP91b{sS=u5O!tD|RG}?s4&dt8 zielD%+Q1a02Jd-fJvAuAI-m0tJk-Li+vcO|QY*q>P+yZq8{Vlt;nohm37TuQrI7%t z1ZA5IfL1Md^Y6L>z~|9onkgMJt)ShQ;-MS=8glc}n)8g2oyK&bsp&4EAfYyO&`*IT zdtYTonq)m@Wjg{@L|;yj?n9>lS6E-Wa+=>XL@3q$+4O6)1kkAZ{ScLaC80(QaA+$? zefcC1U@TQx9+HMNx=&EX0r^i`U8jVq(38W>8E4JmW2Ly%OEgo2DaR84Q3`%$39B}` zRkH3Fluu^nKCKFhqW}RouRQPYUZ}TE18w$@AyJFGr`AxMHUYS(nHr$=w1rmJ87Yeb z*J2-pa^`tZYciDDj#%eYjPuq$Z5nOJt=Z99i%AAbs8i#!8Q6Ngias0_p zO9qY_a`3T?SBLW?2$)KQrSnT^jhV9@6oz zn=!&nrSpSSenjxpF%NZDn8wMNJ$)=O#T9R~)|IF8Gr(n8h1E=P9YE7&;IJmZtvzb% z1)A18cvg*SMF)!o8``!RhKG?PQA-B}LUnZW@wKe^V9x_JFW{vB6Zz`k>a0m(2D51t z1)4WwE4yYw{~PjJ8@1E0_qE~ed0wLyW)k{-tJDuVEvsS&U4g1$Ga3L+gAp=gg|t0- zhu7LL?fQP3voqwidZyR~sA;gffs1Gp(@7+{o)TLgn<1yqC0^S&lIB>y?^Oc6aR%8;RlF-7eeye@eZEljaZug(ixednXj zOtCMsBBYQ{I8*F07k#g`yZ|^@P%LYs2PTd}Za7M3YFe=!j?WaAxdN3f6c&~RmH|=% z!63?uT)1MTR%~49g8i`rwM>6hKk6g6Nz`T(wIQRGZ9{Y`z5j$rz-N=-P8>k;UZ z(O9+kxJ$;8=YukDXPUFih7pNsmS&-VuFNJHnG!K*|iC3%1qQ!0+lsw&4G-9xpbKK_+ptXitzrXn!R zh`{Xn)2S<&Uu+2#CUUi0(Wb6IOCLThZ7{SOe(K(;``ATWM>SWmX{%_{B)1wyy-&C^b*5JFu2 zUMSz0N6dFEOs)06>6~-Y)ru$r8<4Bm1#9YnScqb*N3#uU3cRn$BAgEa0=eej2SO92 zqtH5RmvkEAF;843OH5NS6e^nOHUNl>jNE215riCD45<^W1xr(>TcLMp2RJWd49%w2 z_OfnGP38Nt+pFKB1`DCj97gJ($!hB3H4)FgbJ3}RiPF5r$Kp#Z#JCE%WBIGCY_4e* zbneox=)ed_c<*_K&|y1MqmJwD_)KxBvtb20(Etn!A_XG>LBS01T`$^c8xgrG0HRZW z(;(N|B$n1_ka?O6H{7e;_)+gohEYqRsfHqjZY){=D6|Xe5N00Qgt%)tw+7(mX~i5G z>Y^3PIYiZktI{ruy9;nt##EuF;#A@PRUaynwybMPRpa60NX_FvzE*9XkOG!WNx-QJ zB2};K{3cOoWAv%|-cgx9Rx6kyFUf=t5yAmXvCc)-*O_9QsH$g*%K$D!2nR65W%S5x zGn8t8Yb%%DN4&1KEH@2iid~JAz8J_XQ&glZk=9gDl}#5uVkrsJh8rKJWUK&lEwVlk z2<)Uv+N4e)Rss%qx%v*OG0B&mgB~ETo4kJ1vs0^0U^g>G4dgz31E<}ATZUJuuHR-0 zQ(Oj0q2`1J|D`SowD#5Jj96d%_<(exF8vSI`)bZUuIR*he5kl&jaVpgNXY7bM;Y7m zbjcWkH08(mE*j}UeO5oQ&HdG8)KcIoN@L_XP)MB8J@4{HIg=r4?-M8u0LU^=BruPkY zXhMH`fwE;Y#3pnCWjgf?T2;Z>8m34~UTQQKYC4B9>~povhVSas+XoSB)AcLqNM&Tq zGDSMpiA%jKDIyC@Kv0dK#2`{cfXh=fP%sE01Zg|>2l+(cn&{Im5~^!PbyuOS%aiF8 z@P0EaivTlE@_q;47LnIm%_;)`=gtcmfY{tlxA$hfP{-FQFsH)mBQVH^4*Hs> zu8O_}OdYM=_HS5Y$Jb#2j*gLA_z4S<73duS?;$lU>|^igk}n^;Ku#Hw8YmQz zQW}az5D+F--9cm1)*=E(K;+w(wiN{Ly8|qtlXt3%$F*N3I8QU0}_DhC*1E9+wN}LLmA)w>5qD?9X z{nf>LvA(C~;NbA^$2t)-0g|!yM^_zx@Rcos1 zS5H+Wp^&}ZmvpL;HOq(v>@tLUCPVeW^&${MIj~My9COO zaG|59LdRRPn)1d6z=_onI8>{u$E!zZ{0Dh4n@k}xySm;YiiqIy64lc_Vgs=jOPmvyEXAb;BI_GO(Zw%PBs7X4B{YqJzunBu&0ei7j2WQxl=Qw(!V zgse6!5wxatl|K_5K#n4{3YYv6kwbT;*15dkvHNtjCX2cQ#0WYDu{%#x6)+~1Qy;ZYE70gt&sqW=LFX7o4VX0NpSK}d z#hF9O>^3vSuC1c9!v+Z}4OmXe&{CK212E6SZeufVdVF=p-6$|I zKr90Q35Z4zL}1rc(c~LO60`)LA`4grmlt`c+1{s*D^SC=-9|mw@FByj7H`$5{r!O^ z-K>attcSjVtLwL1^OCLrweb3VoL<|E=5>@1#5rTkX$Q=eedP40W*| zj;}fAf&d5sM$>K?0s>t0sfgq=KrPW}M0utC^gq+d`ytA)zELhx;8ti0WJizrumru>JSTIdQBA16)W7Q#g}=G`3OO+<5HXY z>!#Hf$|Tz?ggS3S4xBc1@9x7IoKuar2`n6`g5U~;l+($NmE!W}LIHt-*qMpql%i%; z^QpB$Hsw90IL&<0*)nh1kv{clg4M`(w1_8J(!#Hj>p+$Jlu&=VNj*GOoA8|iE(El> zC_o3`l4_fQYPiv|Pz!ZZRF`>MD~j=73XTsD9Fz7%B~ic?u|r-**a9nw?h;*t=aMmp1sdG~oAu+o<7VLzgnu z2-Ws>!A0OG5VS79wP~`N-vhC2Rho+cS94DtI*Tr~P_@?V!Jp@^vtq<2$?_;eIOr50FA{A{Y zKuT%5^D4*hj<5cKR-~PwvVXYbef3S&2$a`Ht^AObdZ{n*mbz0b&J;tW zRh94y@u7rBsX(UK)H`pUjom>#$SBd3&=TU(1^#R?0hFD}X36 zg&3%+J)0)&2e`fp+PHR4hwe&k@i(*x?zUTL0o$Fzp$K4#+IVO8te655=9$)?L94bd=0{{yVtPvyx zkPt8?z@VA)koY3tT&{iEMH4ic`=Qb&Q08>Gz3m=C`0-b}&~7_;ZTr+E1J~u&WdYZ~ z6nT!NHV;hdPaEqTKFT1?#es95uGoCyH~zkkq6tz08@ z{Z^Zn)W2r`JLXQu<3Hw#vkWTA_lkQniep#yt>J@Ghrf~!&?&}>g%$u^)UDRRuhqr~ z`dWl-oiS$ReU~Hx>S+-K0@p>JFB7=w_Y1v}m$}rsC`d(B3+Is4raf*3tzB)JO=+4= zMe8b}NRO~CIA(|kfH{#f5q-N+5cxz|-!g-s7){2AjA<1MBq*QS*VR7No+MUCm9iQc zBnWev&MV`)c4#QO@!D#i)@h4*!*(?sxHiyM0bCVRM0=UtMU`XM)C>t?<0130hy|hb zz@_K@#loU%5NR`IN*A~4kvR3FIo~_J`m{vKN-9b>O&XBO2x*3yo=vFViZx8J=---G zV$D;bERZR-$??AO6uUFUHs)9bY^XBiFyKNIBFzEZB6*5azt58=+J`cnk11AtI&}oD zZM4(otqjddwOR0QA{?#R_$*ko-@>R1gusZX>0Y0JLpS_Elzt z(5*m73sVfS{^zy$sN%6Hm?;9wt7xO$5NHCeX+HV_t^-qCHfn83vY9Eisnk9|)Amj1 z-9u|YLkJE1vyOV6-f^DdYA(w_Bm^7907tM;fCN$I4)tu2jR7|_RLnA;d{rByT{5bo zQ0v^MeIBC($Q)X-LJX1bQfVV}smapUnPQ+~43X>01`h2^v8{GE^(?6BV5nz`eJjK! zmMAs5HM45-(+)jQv8!#|co`L9*PR_6#ql4gWyTDM>!L`+NXyu8+7W~Nc>^=Kn``zV zWinIC$KrKO>e^DGLYqD49MYu#i9%K*g0Mksj`78`BI$a2g zK^(zasg(|{e_}=3(s@Dv+hR#jYmSEpRieIgdI$@sdarG$RsC}7q3Zf+GzV~PBM)SX zP3`B~zPjpjsN?#ea9gWuH_EQ-p&pufR$JGK>UICtmeEo_x_AY==;*PeqdxwF!(0Iu zE8`=wBbXSmC=38$1859xni5h#Da(0E^A&5EV&9Chi;Qn!ihZ)jkmeulXNnZ?3G+N< zMN@({;56XYRRGt*6hm=e=2FujrdaiwVDUhk;;5^En|TV=1ChE~>3f=+YSGaeAj?C6n`VmC-bJwOW9OagIw%TG znGUOs766VAS}r0@oYK^&O+h?3GQ??a%%_&^;3%kwHD-kqvT^pBl6*>fI>6@vw*mwjfs|h9+`wwD!We+z!tkG#5Nhy zW{hjMKj|X6LWb5XvS^OK3Kjbc0vF20mjPS{BT74>*2K};gi#%0&0gfT)kYnG3t4Sc z!%3G>qpyp>L5<(8f%Ee~y^i|$*NwEtOt47;RfQqWQY#`+fSJJr5Lp<8V~!P*$5bo; zP~$$G+LKBR6TE1dw-CvtVM=fjF+qX%%!;ix&eI1&)Q$kp2^!|OZ%*K*h-2`_pl8&y zQsvFF+O+4@Hq8=gEm#M&i2LcB(?iD;kNEi4O)D}fQ~>g6iL3-tfT0T2#1*pvVQ;eM zY5p|zFL+$i;%v$618n&Z?tJyiFkKPCxn{F-m zRb3;m<9Vo)xZ37xqJ?H+XX^^Ws~-7-vj|nvJUmfcFcPW;A}i)L4JsK|EnPZQ zu@-hV?`2a8vk%|?V;UFRS6iV$c4eq<+Qi6@?hpSHJH)kM zznnsSmK1e?&&YRLGWUkC0``dgT|_R@FY8(5`hqp;zZlad+s!4Nz=j6`D-l&o(s31` zYNndyEP_;@E29*hfGtO~uR)y>E=>D|oHk$oJTo-S4POr;Iv=wv+l5)cyQp(icCmDR z+*u<=))UQ%aw2tR5G0{#a{OY@7QhYFgR>R3$sBoX1w!g+D&#bREJ zJ^tj4)}FKpgmNF-h^v;Q64dhna&6ZQ1IgmV*p9_<(GQJEG#BN`y7ZX4W;pZ7{P=br z*2PvCyuRdsLGgkoU5p zdWsGF>%G(hV6}IQpbPRK8#e1U)j4_v?=D=K5a-t5Kyxw-n+6&utYI2zTlQ>r?DUaO z$#3BEeQpj}temr`GT*a`y{q#6pJ&gi|4<{C3sepIDgO8cZS!k-U2|^iH3vhLbd8{% zKGd7}B$#CwH{2-y+ww5(Bkt7-MN4^Gbqnm9q+=M9m;H6PKEB7y7lY55f7rL|MGR|! zMTSj#e~#YAOu-0dxTH?bu7fLIhs(z;RTZz$GCq_mux1%M zCu0#RYv|DtS1%Q}aKo&jY z<8Cca_x)K^k9upKIsnI^IsU*?Vvad8%1kFILX*LlNi*YF32QZYWtN>LU3pYJ{>TDe?Y;A)Jb_ep=91GNw(BKb;|DLQ*O z)9B6~ zq%d=H+<^rZBZ{i5@4|*}Lphvg93uzwL)2`u4PuHgT9>Lx%+p6%QH^wYWP$3@M_QMN z{q7`oG;(M<4xeB#D(eWf6WlNsIwEiNxqKRawzda&Hiu+Q>7srZnWgy5E(%iVh{KlS z`he1D5Q%`m`B~+Ep=Z8~y`T4QGXLV^^=AT4b z`vjBpI3i3&J@7gDTV|jR&Fl|oEybvkv!b;-i&{VQjj|!yvPiN8vZpZ=EdL=@iY<`4 z7QU3IHnv0fs{!~WegGz1(mLfIqY1cGrH*k;d8p=ZUjozHTtPw`QD_nM{{kobfU+^l3T4wbtwj(zi-x)q$Y<6zDzPL^R23$=ggsx|G zv1kWrVNeCL=;Agp`i-%>^Fn-RZoEpB=UXZp&$q-R1MDL`oVoWMvn+D$ zfN-=EUBwY!es~cxRu6Wi@CXfJcrjqA{2j!evs%>0*y`oq=3=<6C$(YiNhu-fn*$>k z6_*+Qvvp%GU9O-0cHV?p`-IWkL+}d+!)rJynEDYTZCP4>|k3 z*hR!v8X%{SzLIv*g3bAkv?XUTc4Uz}jD$$C*0}?{Jby-o&$T?T*})|xW|l=V3PDbo;RDDKgyAtLAal;8e!A?rss+tIG8WaD3cP&H!E?>! zlEp^F1n*r;=bGkaVrppVS2d@qqUqT!%0B??R%+2uuK#tZO}*W~*`AGM7x-g_WVZ^g z4NeRIB#M+sI!ckB$fXLG?8W3)spQss1eLd2b(5+O%AngghJ9fmNn{jPYfAd!S_dQ4 z%NzOQyRq&tX=T`zz>JsSS+Hca;V8EId#Ca^ut{&8thggDs0L6MWzzr_jyyh0Ws0My z2X+M99!b@3Eu&+4mfk0t#x4F1C&$5;DUf0y0Exk<$m8sT|3i z>L7JJo3_N?v(^8ytNEr+)6m>|*-Ow?OVoY=9O|N)EPmzX9LPrM{z1ygCjT!rvM!!l zGV4c8_Kv{-_~kPjBX4EU&Az*;QbA|0(e%s(nG6w}KsEEJji5d_wC`0et2&V{ za*l5m#Iy*!SP6t1@(MH1w2`oKc!VFNYweBaYC6lC2YbUESF8wsTP1o)Dr>Cn0n;-F z%`N{Io=4W0Qv*&7Ye31d;wa3ubX!?wSp&t*8mB25BLu5)#&VCK9R4-@tZvf^)Es>a zL)w_~lzi`VI35rTC_lLUp7xJFdP(=BMZfZ081wg|)ug>(XR}!Q;-#a_|A56FPD&ev z_0~W69Fg*~En@hHErigHyS#K4e~H+&*;mFfS|kA#tHrUG2Mo6Eg5$NxsovGcbksD+ z4JlL8$jE4a*J+REn2y`ZtFqJ5DJrXGI0h5u@=5aWal&>MSDDq;OU6p-bd`hK;{KtJ z&z%S7GcQyf9P$3EQeh_C@@5;xv-tQGs9q6L2+?*h&~=`G`1^Z1@E6&1>?e|@boVj2 zd6(<9g3>ZpM?EMOV!jX%eoqY1%Xjhgu3Y{(cITcp9NH)cw8re!#+BhCrv2dNt)_D# z5th`om@{_CklIuK`$}|%rRcqy*8E#$(G2bO@dIxYJ}FI~Le;*XS_aZ0fAblL^HC$p z2lC4T+$(hX02;jf*!HZxQ~UzXPE8If3P^PRf#2AlCpyD)7lYyu`KiZ4ei;Cb>f&a^ zKVbKiioHa(s%jIKKw`e|n6iLyn+E>)uImUHS6L9~VNi!wR4d8l{xH#5{KoQ!eGW;# z!mITo*4M#$#k=AGjrp7NX!+{nBHcS*9qUQlR`MDDjx%(_POBDBe$qmicWnU%{y0$@!(@lfzS0-?wIG(_}Hs(#mH~ULpGip{y1Ugh}1Y|ZO9Xhd(14M|A6zu=Y zKIcu(DmmRpKG%{e#ih+W$q1kiOIn=jho+NQEf|~ad696{#`5>Bo%Bea$FC1%=v}eRohk8_zuA^2+VSkgcRRuua46B zZ@+b;`ob>ZwWyv>(d~ZcdFu~;eehfujR?9v0j5Tb{-PQ%3~k8mkhD%taFu{&uyc=q587OyU(I=u4cnAbkqV*RY;vVh z17??fvMxPTt23IoeEup%Nfye1?;bv~0c1z$%-+xu2n`j3Ukei+3=#!Lg!^ zTW6|#O8OJqxNK2X5!xz&-l&$H{0(^CA=jW^>l0rYX0gXwBfmkGgC>pYf89T0Y;_Bm{e<8=wZbT;D%~pum(bvIHYB;7Bwu zE*kWZF=04jly?$eh19QAnaj%KeYdEJ?8m9UCb4T7sJUHA1r|%}u9lG5;>@^vNoUVN zUW65RZ)0p@N)#r%FIZPvmd_l`UID+V?n}-gwTA;o^g*zD2SaxQ%U+wexbSgsH~s+^ z#@ydht*~T{8^4W|3cf_bOhEFWm~cf4^QC^7;cG1dL_A%6#FA}XhnnVVAgRosl?cQ# zJ*qP@XRa|amr^099`QT@BJ4EZm{#?0S~a}LyQilCC_s*CB-p#I$-RP^&$;)2tb(Ky zBKG!;v08KZsZu(P|L>pOD7~R@wn&J9M*hewXFoDwxV{v!w?;*k7%7?L+Yd)d!p3Q? z57~RqN%K+&pBT~zzmI0sGYT8m@g7sJR1#vo>yIQtfDgwV=wA7Xh4$y>ZVvRNzS5fw zx1kl{rZGfs#okJ|m(3d&Swf?&)Q^BG=xDlF8h#x%4Uso{I^m~)s<*0N4woQ~#W68N zgsqdQ(>>BQa$!-)@aS-{u&(evduc?Aae|!hvLkue#x`^69{IN(+~$xsYA8Z7Xx`bm zLo+nEd|u`k1l-JPRA)mV%YE1itP>$+swY2onkj_yi~jfw!fB{E#$%Y^@Q2}aD6%dp ze)D?O@a6cy$^0%iia$qWky(HihrJ0g!1;fKNne~#DaxeGSrAfc zIeyGV64U~Fk7$XF1G78ftfMN4sRy6Jvk^F#9XBCqhJ~%h+&Sz8o>J367#!M|VX@aIpkh*JY+U=)?l zA8AhDYLxIMjTRR$izFHgDqJvOuZ4O2Q980XTp^b%Y~>ljS(BA+P}B?Gm$&^ezIp^(0`dr7q(3!u7W zZCsEhh>4T>dK|QTCi^1bZXzsDcxg zRj&rBnOe*m>zhG2-9rRbM^W^ddg?Bw5%sz9M=D<<2Qh>SEFhOt z>wJ!U%|a?1GcSY5zISv98r^6(NpWWy>5IN9hHW(UR)F6d&oB)EfS7{OI;%y-%+D=1 z!-K!7XUM^pE!h`yD2wkji^a7CGfi{Z|I9+kn-I6Y7RcQiFLv77VU0)YHO=L$$ns@| z8Oust-0K;3gtycippFALb1O1E49PoIDtK%znlz1e%EEwgrr~e7B!TZw5#iJ^e3&}T zDLoO0Pp^e5r%ER+2h%rMKkmNk;8WHKp`4fDV`Wl6g|js8CsK#f?KOt21GqL#7zT13 z&iw|m(J$KB6m{0`UVDR`hZkkvt+qPrzMl%UR-^wtCZI*ZerhZzyCy_;3%VAhs-|Y> zSN|>#zMfFmKxm2pBg(0;p^v(@Nbg5={??M#5B$eM?4TgOhLvKKQ}EB8weT3;$<|G+7kB-VpU--TMAZ^H}^_&sx@ z)luF@@b~XFMO{5;LpNHl5rHhg9*cXVn81a9gn`w-$T~9ZQ#l&k6vf#I=dE*4?R+%^WIDb zb5(>7fjrg+lx+%R`dDYPvT0U&TYix5N^EvY#tyTIbM94jfcA^|j7%{$PS}xIwGLBM z!gSi_y0MQ}ceY5*3BS780;M4&tXZTB2Ap$)5a}QDl6=bZ@$$^pui8BoRl`unhu{Jp z*wiMxI3`q@gKQqQiL8WHe2CIVrbiyLM$iMza=R_* zKQgMR8^cYOU8%#N5}KGDy1dg1nop!=x1SEcZWp559&`ho{>jL!1=nn; zYFYH8Fh_r=^v54rQBXtDs@06+9x17vIdQ%T*VKT~w%AMw zbF`|@wOcT)IahgW$2s@U2P-W(DAkmvspcrvx(AaRl*L@oZb>+K-BLZOWjcB!MT|yG zfxw#_`u#^Of@SiJ(F1(`kgv1%F>@|o**|!6;uYmMSbMjzRa#8+Cd`3A{hYqnPekL&7#d*sBtS_TL{K}gg30& zGJvA{X7U&G8<-#&L|O%1u8T=B?^|lb=`I`uH0msKgHWV}%u; zDo}BYgbVn|v}aLQM9;qCZXxq@aN_|~H~aalA-wJCkJ2h+8MghJj{45Ah!vi7-&+hm zua;;fSJKSR(GRw4!-WlWykl+t6u%!%lgT~wu^}Vpfzh+dj=QOb>M>;%b0X`#vNb8( z+$PWEqp{w{@U>*@RHrEft9rc2F7l+koIL3DBg8A)U*Wo&yoXB@wgW|QbO2!fsfB}v$_Zg-HWl3?GL1n0s;;a#eu7y1I zJab1|SzQG5-@oQoouLi|OuR;KP}F=)zBArNEhpu$tB)l5S_{oqjL#^+Hl$`f;x{&7p8 zTC{flu4-3?W%H^!+;+Dq0sv2!3u!NYzi9nz37(V1m)3^1i_)X3<)Lzd|BhA?J6Ly^ ze0m6E;j9xKnVswG6xP4am_rFpML7LbD*_#AL)Z(0^jfJc4oPM-V4x?Y8cx10ihXS1 zm^whgUY9Z?a-&$Q_$5;}q-n_QwytM*EIvK~`cf30{qH06I1Mk4@giDyBXCKW@jr!~ zGEH(QH3Qw3>);nX0;~9#hZ2;W(fh~yR%TX);q(Gj0k457JaU~w z$d$}jpUdiFbM61t;C^2eeA1|QSkAuz6l&WaDs)*UvA-#%i#ENVRj%;&BqSE``TfpQ z+V#AKQ%S&Fg+jtvw%>cekF=i;Gk964?w9aKWt!s;x@4)o!&TJ9jU_`e+7=M+2DUwk zQ}Y5!!MVMd#89m4lIqTdFMDvoGLmFSSnx|qSMl~7omh?hN>%%oIQ_BO+wrcgoF!D< z)W8j^T`i=~BJF-Zg&Ygvy1fLW1dCQxb@L8d?c`QrujOT%T_%l}$f&V|=T z(JIon{sk7tX&|w7GGW{PeSphzbQ)_|6)6;f>x%_>@HE`sekor-tX4=tE*Zba5)Z?& zFN?zo+OyGbS{Lc!U$4PvWtD!3a;=TZwu6M!` z6i-CH!s3$11;-1;KW(J%SP9x0yoKZ>gNzx5MYc#WWN@0mkW>!c&~&7dzs)9T+wdp$ z@$sp)$GtvXoFOU|O=6B-x{B2gR(TJ%={W&APs9p}7pLrgcwt~&%s--O2y!zo-K2`Y z{4p7VeKA58_8>`i{j6a)EJ}}2U7`_rnd-u-gY!}KKW&s1QW_a*R448Mw|)hvMV`J) z^r5 z^HOtAhCvh~Cc74+Eh5DoBW|}(_ZugW74rW%>YJSE9sI%`lw0G@yx{2SUvg*Cvd15K zyvIK}vBm^1Wl#UNj`7d#+bVJB&;)aPd?;#i4Z#F8uEp+gA0M+!r6e?BF3P)^BmSyM zZ4=RAc(dzF*a`DG{So#wU|3h|5S#DNv4UX$V`J`>&Vt!j4vzPs}+$y}6< z3#0;ON_g{-Q0ZTQ8X+}9+=wM~T2Y;xMiYa?ls+iXE^HJ~`e3i4qn{flTZ{>ZD~2nk zY?T&15y+K-UN%bWM-JR#2HemrF~MeXTr4(PWtGl+8Y4RLS8NLTmfH>^DD|Ekul^!P z69{?i?u(xRi-5Om8vUP&7HS(FQP_1v(-^ke)+7}1f==-Zp>M=Jc-YTRI}x|2nUKNk zV((=mj|)}14 z;eFt3B5K=kXFTh@HOUhRB*N)EVEOOYo!rvXvXp!rRo*yT5aW@dWKGk8CCXBzdEBDX zZ$Dgu4cwx8^x<9 zdHs3M^)}vZvgdYZw($AgS^Fd9Y5c8m88&|s;;go!*~p`MuGc8r+=5xol*P79Hx3wP zk`k76i{^m96_!#hsXeFq35%0_3Hiqa>^*&S^QEB(jSjup>0o%ilA*R4qeYyB7YUrO zGPcf2q(`jZ986wipsyK6%}LTO>^9c8!0$q!h^J2(nJvj1hG!U1~7h z?zE9}sWgE_F2?l$PA6)`q;a^2%l&EL)B5K6!iAMSe zFI8?$+Aq#`{QNe}1eeyAJGxu@`g~u;s%9lZ|DG3OnnEEEtFk+gBoXKiYX#NI~c4=jWv4x$*UJn|!{tr2G6!yWp(^$jj}1M%Jj;3t@p_ zX=QEDPgJ~R*Hq+S;;eFt1c{%$9z`YwTEWT%!b7NaIDj10lFuVrn5S|zX7*7!yI2vq z{=~Tw+ntot+*IqlS9-m9t*}n068)aN~2^C_rh>OQdWS@nfUx z{jhSv&E4YUsEqEIw9dB@bx^a16((T##R_x3g@L`&7G)5oO-E8no+if6QD4bqCg zv~p{jnI{7r8o8FjOq2n+)Z9)aPLhDLj&=-6%>G@)K8yj%E`)@JT}PqvGZyb}6OAL~ zYq0Xe@1@2|(=InZf5*V-;gqidMowrYMEn|u?jVG!2;(VcOA=YZCN2Pd>aHg6f6k+0 zq9R7{XqE!MXyq;&MJ<77a1T$M)nnlDfxuDU=_~pl3Edb`!Vy82^KiO;OESC{ z+0be*>7w!82&9b(KYi*GM2MG`n@d6iX_Wkk#@@&xO{dYl z3<`+?G-8(~PR2}!KC>HVE#%xfrd8o>^)mT?@Aj@GNo?3XLFmcYE(xb)km2Nnnq}4~ zU~+zRuOeU+_?&Mr@c+;KBd}ceuH{T@crzob-iU{nYsO89RIPwV!_IJCDAcqKaijX* z`-1q;(|{;T%UNerzwh9ydFaj}jmCP{ajYJ>4M9c+!e-$O>HMfC8G7)+ri2Zv zMX{=QIv31(FA)6RTjPi*)=IWr(@ss0?bdOYc{%#t;5);D&9!N5d+9*@0H7L?^(ea} zYzF~Q9`i9sq6*D@Ot7OBK`E}MM=Vdw6ZLjI^tB0D-!pdo;~!+pC2vkp)fg2L+Nl@< zEbymp=&0Df9keqr=aZezuLkSQ*=Wn(Vl9-hNvU=(avo z?=ydd=aDXpEQ!2%HT}vI6M}imo#CDJ?C*u3wl-31E&&5riA^_!{kAg z2GttelJ6D#sC2B7EK#@7k7%&_`teeg{ddJDhGia3v|9fY3#*WR0klOKv7pG_sR%%Ob@M`ol@)W=e;vmP%{;Nzp2PK^HPM_GbH zTgcJx(iqyXc*py%aF!LmUcTUGrOdMtm{KM#tjQ7Eh>4)yKGkfGaH(9!OTEFjPVbWU zd=oV!w7ssFjbC>GpS9VmvdpudU%zl5FDdV@g(dDi;wei6l%a9K85QgiA!F=mz~B>d zH7GW=c2D_Nnz0F8#_NF6#)s@J(|T$rTZ`Ey1H+B~Y(&G$uRAKW|B(p?s&!7G??ut37qG%=jyq-& zb=k<&4IcWsY5X39=23Bgllw}8T-MLW+{@d9vzgCB9K(dRs#~R054h}q&Zr@uv*_w^ zeXJ}PD^TNH@De3?cQtviDcn`B+~d(qM{ZrnyXZ zN--oQ09)=d{SM9Q4K6sQ;q5Rmsa;4pOG*LP9#QEuw-J9y!WYqOQWclSJe4-apz-zs zB(m=!n-s@pMsHb`gP4+Wtb_$%N@AJu!iu1#6gd9yE2pkcPWNZo&JA3c{$U?4Ns^jL z*GrR=cd>2HhHYMjIzlI$iIW_YlSBsB!U^Y%I_NY$xI`Rc3sEJKDFNWqG9aS&FYG{% z5ZH|wj2>g;!4S(uWc_fc@Ci8K4K;X#PG+s-(8!K6J1COVmMr!u47zBo-FLqRK)@C0 ziefhHmmL7KeW8fFv@t1<_=`0v)0>Z-4oqPUGR>a@YO-C=szf=8^J(kqhmhO%i2hYc zY;A1(rjiQGAM~UpbIo?vn3x9Eqp~o47)P!w8T!k>Lvw!x&{mkb|K z=V||=k`AnF)2sChg8WJ5Nvyum@WyD094G3eB8v{a<+wu=0mIB9b@?#I;toGIEM4-Y zV+&bEF`vzjak!r`X@n<1#WxLUR}W8|M&(k9T* z;qryN;wd0IvBlBFWSOZTUpmovD+y1^R#%bIxl7rz%KR#?LR46?`PSbbOi5_u?_$zY zgiQLC68{yZ{Qd9R&pMrkR=-JRnHvvP^mh|Wq&0vsPGph>0A|Na2!4&EXg{Bx1c~ov zpukNE=sPMIr>=R7yS*=QVc(T1HMgMu84$CL9|0Gdhz~q6a35{);{a^_#XcRhXWNLk3i3)>BSeH#K%R&>5#;9O8_Ymh$(xx)F zW0>d%a=@`qsWus|B$#J`IS{R7G<$6WX(>=f^Ou&^+rnogqmr8({MI=KO>f9FYs0_b zzsAVi*0uMa8s8YuSDeb^RFT~V^W!UEMi`vvYaS0ObJ2OYkgEMy4`KE7Wl+~`%>HqA zsF)WhpD%q75u0MhLt*k{=pjzU`T^V)6u;m+EHuArRVI!Ixd&^Uk0&n= zi)B_GLir<5``(CrOV89j%2H2y>KR$DP$){?#GCKtya#6&BeSv1 z69F6n6@D)R<@=C8Lo)n{q(8$uqnD+d-?R2TvPoV0ArT5e#1|I1g+J3-Xh=g#7K71+ zw=qAOIT$0C&JRBkpaV1xV$jM@~SG4j+XIdLIDS;Mh@C-0d0f#6haiyT~Ogj02L#U9OkK3i0@XbiFOA zAQ)E6WWm7354NRI>TJ3tszjqlPLO`Oat0{`;K;SSjzUj_3Z#ffApBbXB7@AWSY+YZ z5N+PbwIx`66e2^vJj5g3`0+d!5!aC>62G;c8_p@OZg;rImM9Dl%_jgdIrSL=7bN5ml`M!pmidE!W{=yNNlkF`vK-1XjR zgt4Cp@HJ)3Vv;u3>ILhX6XtFUq#3-L2ksUbQ=tO(W5zx%$zOpfMuh_IIZSO|(2r3} zS;%dc6LLrC6!VHS{+ihxAhLYJWNy#0ne5WUNYW~lvN;OuNSeO+_b7|JLufXzal1ZA zVM)gzN$}HT;DM@Au&uxwUm+^skXi0D9?RPOOldEeO*Z*@ur#7;to7lqAhY#ERL~j| z#ygG$nKCaNd_p46-(nXiRk624H#ghu;TIp)y%0&)Lr%&#=511-9Vw5&_zE9wubIJ!wJ0AovDe z#DoY#6(+)EMjhTlCeh0#v7I#iq89w3x)!*&F4)n7;)qiEY>XQw=%MlV$LMt^1p_`N zW+d2lPTzZj#^wg~Q-lg4c(5LkR>vvDaxdBUS3ZB-XA(qt)a1=VWQ1ms1uFo)jxs@G zNxKB-6v!E2@h$?2@dw`t*WXg^DLaF%pb^6Joe_@~BxS*-fczepUr>4s8A1x}f7wGk z&BArYUMDR5IDxHTjY3Rq3N2j__dqozJ`nC;HtX0j*JkdfW3oZtBvy&b;$ z&DLgiJJH3pBpANlLlKvXUK=CuklZ0_`96&B)TEs%mw=|DJJQPbO)`rGfM1bQWA!)Q zex(7IjRyoxSvc?=uQi$>p+d?SIUR^ckh`%uX+Y7bP&ldy$iCkEd3?5_(Q)MLlpqXY zfDXuqYC%G_no9zq-XPn)Obp=d{c}G#((wEkny8e?vHLIEbHYyP9oS|uPDF97qY+W# zSgvJxIb6_!1EY9-<&MxVspB%l3YsgjZ<@w8c9}?hc3g;QO_r|f0 z=y0-da^uzY^-tgSzQp}sZAPKu^GVYz5m_sC_RdeP^Fq zh=CR`3~Y{{-MQsU{EXg~b^(=Ku)*$@A11VjCKnN*(G9N;4I@KTFBdbOuh71iFHRJ6 z3pOq*M*USd0bI+6%_?D|!6Q`9(^NM4r)Ot7&aQ!ECeO!uwh_lLju5WiYr{T5LqkK- zjD~>u8c__l&8y?ZC*F{4tiG_spgr2CX51~k&}+Smr4ex=fz2SEg6C7)F82z&EE^v}!W69qzlkjf1l{|@R5^~B2 zNohsJ43b1}Y21)9^D|E{e~*qAc{9Gi{Zk&R%KH$clv`DP!Y{U~9M5w7lS3kEHhaj` zcFP|LPt-d^Es7*^?G>NK)DldD|GEwWSy)o@Udpw>UiOvRuRRNg8N~xxhi}*7XDhyQ zQpZl;;i-Ou4IeP1A>W=QxZ8(DB(n&jqBa5KxKxoBIz0tT!xY!LvzkOK*HzrPfUPf2 zm=Ht8Pil?*KoOjb5jK8ER{jp1j=sATB|jfIO5?H73b6kInTv-3Q5niCOBBU?N;!{? z=c>@eqDnG&6fUdW??z&I1;x#yYd_gx_kmZ!-aB*_h%blZRQ<%_e+`^4@q+GV1uQ*| zKV&UQ_Pp8JTlQ=}yt>^A?LKedgu9j<4q2`tNxU4j4Q2^Kt+z56K87aDW$!SC6rH4t zm|YS-_ET7JC_l#>c~mY{ou*4#)gCn57*}oO=ex&PuK}V_o$0cipQJh?%IK0MzC$if z7FSU8xD<3B*>993%9#9^Uo6qkz8DzASel6WFp^h;d{U@E1Ad~zZh~Vtq8K5y|5?-B3`Z~`07msRKm`Ew z9_9AJ4D-%j+Pe4I{O*RR5^j5Md+st^?}=j2;HFKyHGmW1CL|dbkFWXlZg3=s#^knh z(cIAyqwhYq@5^HEO)DVmzgI!u!!!3Rrk@k^=B@1D-iU)XzhMS79I5sYF-igz35&n8bd=TH2-&#Qgw=#2Q80n6?x z35>~(7WZPCS7LXm68HGs2Ye0iebXdr@pETaP{K9H@=5|9!QGAfc^A0lNvmPWpCs&I^l)&9zW)$YLfa<`kn5`0h zBTC#_E;A;Es=!s&#<{SjFE+!YbWJ2eJ28i^Cwja091k>4+paw*4G)`r_|%I zB$8=9t~PDoB{lzwKV9kdA*j6^kX`->J(n_b^hs`i_0G&`gaabC`%$W2#rSy91qPX*jrTGrC3%yOD2AE=3u)=?Wkd?S5aNbax@| z65Z1ti(jESgpHaN=j(R1#~gQi%heHtz+E88NYo^3U3c1J!604Ij|=?rM0q1UBYD}} z5Q0_kS7kGyz`e?2^iVS zRp@ZyhL_fhfU-JKT&nRXeWsNw{z>&zj6fEaR5X{JVE@gLR#qH7okLS=)0g$f^P$I= z!$9iW^;lwRG%UU^kGYa^oQD}47`SRmTCh!)toZU_wy zr|*4R4RNgRKz;pd`l9r7cR&{#g*>F<}V@Pi`5U?bb3rK%O&eq3F1 zIal%WdQmFzP)#Byh-|;v#+lp*o$xG(oD8{X_Io}t#fcg^zDx{-ljhPYwroRhY%ha1 zZztis#2~yx|1ry=jk+9*zo)hmWPOj{+qOw3gKR>ubC+$v@>^UH3CZj2;85r

3c+uvhENOpe`PXM?P zr|2@7;-liEs82*U@izVI&YR2i$zaNtN2*t@f`{5yiK70{fNMvDaV#`EHnPw5!t%_e znpcJI9@H_|1Hz&%tJH$=L_|c&>`XLKkxBXs8w_nPWZ|O}3MX~VeQvlqyD>1RS62Fm z&Cq%paW>Q%eBT` z*T{Qb$8Y(UN%Vgk(eUHOtw{{p|Ln2O^_k-7+O!Yn{4w`-yKUoP)o&(K0$tC3F7S+3@U+LcD|YUW1NSfA zZI0K!9GCxPV1DO;o3a1xknMkevR;16?7>tEm`R1u&2?RoYc;;C%{_2cjDdq+2qMW` z{P6y_9JSYfYL|zhFNb%796^{9g%XK4aHkTd7+imayAV0xVvkXRRN`epihxK%= zJ>`s&=>y(>X`)U;fDTbH3%Gu(PJ&iBcC&LaFDa!;VWEV&u%P)!8sPHsHA2ke=pKT| zrL%M7cz>d)uf~1VcIHn$>*h4{Os5!e=@&b6Jjl8jo=cNOfnyb4rEz zI5kmVe18-1N56>>DYwajgqhz0wjc?=iTZAdKOz-AKrZx`)&-BmUofEm^`;^8t^3#Z z1C7LCj_2`_OQrKi)4R}f#f#UC)Ggc1`$fMgcs0$@dmFkf@wz{9`NsF-(?)(o=xf3) zEyG9&V9QjhB99o(cFxzz{{20kBpV>s^{%r4wi)u<^>WTO}AAZkbt=7)kss|Ez0ReFhaxKqQo{LDF&~WVmB#6n0`{H zHhu-?I#0w}Vl}nyfTD)Xt;z6k8P~rJC6Y}~gbIGOt-TIUT#HKmm{xJf8myuc!2csL zv^}eP5|#S>(y|iw$@ySeY&v^u=i90y)TNCLAFoH(*Y97^Vsotxes8!9VJ)q!4Cec8 z2wj=ftFJSNhrWo0Y`qBqB!)iiUbc^jVGFE#;lq&`7ckQ&*j)<8J>Kc*>DK1cYAA*d zjMd~4=;Z9Y4UZ-)wfdq*ifV&rXY2(RpBN=|+^^^LcHtS?UHs-9mgwC8&hUu%4HuyQ z#Pl^_&Epr_|D0W*?|!`fYC^<)gu>U%*VlL0W761G^~ZnfB8-6b6tXOKo%fQxE=X9i z&gh(jvhEtublNJ_%7QyYYN}Dx znGu^T&MMM(T9Wd0zsX`AZ@6lT&mt~#?AE^aAReBcr>;G(Y8p`oMnm`QR9VY}%LKEP zsli#w3}t%9VyaBo3kf$!Ojm|$DBDYxibcN27y989e-I~Om0)j=w4c(;A~|x zd_$pVdtJkgbMYVKIUSH)sZUZ)xHJO`N&R%3rya~)L=q+F{9xEkn41S6Z;d*S9Fb9A zZSo72Szyr;rNhmp)TzlTgmCkwgleRNwPEnr<{jD6+QzVi|KCLm&!VNiKbCiEj1t)3 zEfGp-zx&r0Wzo~*#ogS3N5rT6&}R{kSf?F%{OuMKX%9-BgsxcRk>`@g94 zgVkGc^^+I~CF)W6wI#vrFP$fs8@IhU$tYm!Tclgh7YM7{!`jEEyN| zy|?Cpfn=t)Dw|=ZL9@9RPlsYSruWurgE%j-#M|(iNWkp@!g{d=zYQAkgQ-1hAEcm! z5%>I-_4`L#KN&Hx)aAdP7)Ho_u(6ZauCTM>*Z}*l$*}uzGJvRe->?@Y zG5FNd{TEx?)@{i7t=q%@1z8`a;PmOzcV2t#wRpxeo`E~=xWh%i0=Rtn@{Gm)lRx>B zxbemtvw#2kum3vU^{#i#jGKt?!WX^}=g*(VPyh5!3Qe;Z{_b(`%uM z{gfijtSx=^w2QEgRkayoGwiEMv1=OiQ#=#QEkq)MSaFfOiqh*v7iN{axv1=lf5XhJ zhR5`Hr`h@Rcg<62q_}^l&nUC+QB)cZ+4@kIno{@7Rffilr-6{U+{C9es0tX2m;@0l zHY3F(G8kKd5Mh)?Ui(0V4R!%SF}wIR^=?iV{NnP}tXIAlCcwtPrRzNTsZYm$|CRrY z-~Ea2!K1(CJMp5|{|3J3315xd{^lKs3HZ>v-hnei!e`(9X599f{}ZQApN1jeZ{PI} zoQ?^%zWq1x`A`3!ICuIqE?>L=0&pS*-u{N4#@9Xl8MyKL{uTb=*L)-X^7r0~vytO6 zu>m&N9a=;n!~}4nPTu;s3ajGI@yO*{j@Y?W4FS>CCRB#l*cfADGeW#Wh^#`b!Y1Ne zzxxUF(msabn4@kDabjx|bZHOvz6*eeE5IU}VMR5DAuDA;ai9F;C-IN}(LVxlQkS>XFh!kKKQ{80sy}8>%S2@J3IJ^m)`^!gSY;{ zAK->3Jqg>}+xVIP_#g4IpL#{s@xB=C!CKB2rkRo`S}LZICiy`C-rm6G`LlqDus^nl z4S{w?ps`CWNfK8Iz*<1Wl`S%!(l-rgRD!(pWmsuB#U zig&!@9r)5O{Zf4Y_kTZr^hbYm=5KGk^;Uf6cYbGiLlNN#Pj~`uyzxdn>simjul&ld zl!Isr*UrvPNe}_Rt6udg{PHjV@>InqxANZk&UfN_zxR9byyrd-H{X0SUir#b;;B!4 zD!%N?z6?)%;uG;(zx7*4k_3PJ$A66HKKHpuk_0b!!3zKY?|=XMal;Ka;7|VKPw?z# zKN}za_{TFrmtyc^KlWqzu^;*)!gD+ikez zmRs<|CqA)+I6hbIe@6cR9B-WOcT}W4iyc|>2{dqt~%Gjm_Wp-$<)rAR)uTSGTqofLH1yo$4 zsxG-#@)VwF#hx)bAJJM=9O?bDXN1*d<))RX3%GHcxX65~41sCoRp&CTdcNZKrs+xm zGJ~#3$&#Y>Y&jP^dDRe|@(L7V4pj1e;EqWOiWM#u1KBew)K0J+GbS4mwn@Qpgp0cq z42>eP3bKNY2pIUFxFIWsoJWkivkZl(XO$rA32;Ic5r7AM$&+#2!u*T!f}*o9(;6tOYbKDCW|@88F%ErX3nfXNs#0TP{Hq6w@_U<8oM zySRMk{n*-!k(@b=9mCkz+Q9zK4q~V)d_aUqeF#}ybt3lb8^F)~{Oj>cZ~8_2;qU!7 zeB-x2Et9I>{mf_LdCz?=9{4un0CYiu`)0^IehdksVc=ofOjq9(!9zXB{KajDa*$^aw`W&N| zy!55G{`%|jl9#*$U-*Szh#&cpA1N!v!X{0X$J^feHazvIPsQ_}|9sqk|NVID@4U5C z9t!~8@|*t!&w0*s@TE`qQvBTOUI%L}-t(UK;Kmzo#9epYh5zs${sUAMpZ)A-p{n@u zFaL5p?y-+8Syf8F|NS5T6JGhsS0I^8+~NF`g_GGWI-8{Wpa(q&FMQz(vAesAn{IkJ zlEmhfTzvY)OJDj@{K${|2ww4uSKtSJ;0N%8Cp-ba_G`a}TW`I!q)5aHZo26v+;r1T zrJ#tLKXNl}{_uzK^rt<&P#nDQm^76rPdP(yk^GdgEG`P{X+vWwVxy?urqAs1Q~=4# zIu)OzR3HJRgZsLod(#R@OJ$-k6FpljafL#mgHrx#@%xHZmDJ^;u^0B5DW7RWp!`fl zcBVeqOQEp7>{=G=r6`wfLos-PQEn%Z7Xrv_94$rLrX}Q3#wBUdj@dx`>{d5 z=`VN;e&~O>wQ}p*{|M%nUxAZP_2)DmQS%cWL` zxHyMIVL;G`YHLesl0cz&>mU9he(;B1j2HdD3vuDr+Z-9$-NiruKVF1Sf95mzn|Hq( z@BW|v6Fa-R_*Xynqd0lu1g^gNYFu~yb$G-hAL)*{uD%LC_~IAiM_>9~%q*Z@N?9$f|{78EhS>T}B-J5MI!(`+Unj3Cy<9h8#y2VjT*gNQMi z5aKw-Xf(q9IKfzUFpLK$~vwx4%6D{jR(2!VACu`|-gKe!zS7)R#SSkx5T~+SBl3KmM=qRYi=}-R-Jp0+t1_1opul_1-y6NQr0S|i6gK@(RHvj-`{MH-sfe-wRuiNPa z?$e&;Qbn%3>MC6G;A?Q(ZMS8WUWyThrLf;ZYJq0eXv7PzVx^vf^qwx`uQp4PXUbFG zMI}ohPhFOr75|l~+&<(rCn zrYSJRF`!(cs#ui4CbqCPBuf_+AE}JOnAMj8%aiwu(Yn)Ru!_o;%6WxpB&+1roP2#G z&yc4Al5?7#RV}GXElQV+6h4=kvPAW~zGj|tT6ANlWe(NnZ7M4)Stt{bIQ#tK_%bGY zBb+otv)ed-_5>#5J&Z5xxhTYslM!!4IC*j#B8t7e5%zWzr(y#cY+!rqG%jEdgUJY6k-!*(?SU%=mn4Ej z1qlg8NN{dr6LRhh_Ac+jP6UJP0nCtLwi66ChS=KL!f1C7b~M3wcLxz{W(3b{4~d}O zV1MIpzXfmnt+zNMkr^;981rrK{2!U|L6WXB$vgo+{_kInAOH8S&I-4@@vXm|8@fKI z^Gm+*>x(6A+_Bo|NT8O&f0mlG+7<|OO_%k7XUso!bEe7M z@X@5sU05izT*$>GpTkvk2AJ2E%>_A8Ihj9Q9Jz~-%0;o;s|}a=6=|soi;J|+-J(=1 zYgWNS)11YbQdFY8Y;IcGj9bt4(zTf@>fBvQSxsQc!`Rcc%vsT}YImoUxn3!7wpcL< zMTLb@HKp=-YVOiyUm$%te;=5RLN2H5XSuGKk&%0IQg@sc!6Zqr6*C_GkO$%Zix&X` zqVX8lpFDvxdl!)0atj_hU_9mw;}H)z>*PQ(29ZE$ga<$DN?i4j^Vr+D47q=T@!l9> z5^SE>07x<39b^CEKFAV=9AoFcU1w~QtE5y8mrpxF5FYlMABMgAcHI7=uLFF_(ZEDF z`^LXQa@Xy+=Lf&e^IBiHLlZDFHvh@faQ-J=2j1Goy>I?S-22+^gGuLP=w>jAB1D4- zYz+4IN3d4G8!_V3F}BW~L>v!r-#t6nzyC7qeuB}6K(vKDo8aD^3%Hz2@SsO-;OrGA z@JIJuiC_M>!RYec7@jG-9O#~a8C;izeVLaZ$iH#VWag2Na<^wpp zlVJPQ71+TpCc7g%_7NxWli&4~_^hEUl#}-_?e8Hr3_DIR8IKSRVhjeZ zYR7mycIPQ$cWCSAsIwZFe1(m?c0*xv05b^?&Z=Qhr|)TyDETrjIM zT=K%qSq5&&MVDI#sm7-=3k+y>O@;ZAY`*fU*=cZq6kFmHi_;g+01GAb$_gRQD!N9rj{?j*Lkc_eQ#48+fF##J9aB1Y` zH+nbl6ORK%f^%YV?jN6X^K#MvkuR8 zmoD#PZ+{FHi&%%aGTy|gvm1!x7;-k3}viG?sBiXv=ASHe8#O4$8-X26^hu5|>Uv6giC3qA|X3iu(IpdAA6NO;+}j*&wkNRuvJuI;Zj0 zrjvnUVPSz&8yIeE!%i&3D&i=@DLDoIEHm;Z=4nUKE1txOFI|A(Kg~Z$^vha#N{VpEJ%=K8iL5oG`yTPB#LaLQio_; z>DY?k71C0qV9|y}mRv0*K|#eDp_!U+E~Y}qoV*rlr9>+9#whjBqH;V-f#Fp$3k_`< zrBhzQ=|BxClu;{`T~ilvRvB$bS|4;ldB>2vn+f?MIW#jzRbxyQBU8cUs8T8mhpFc+ zvrTO(E|qyBit~*r;h&#DmkqU2f0Bw4c*W1oeVJt?P;s=HmpxON38G0$(J>JcDg+Kq z8H~lcruEzy(CU-HnG?gD=~GtVEwV9F_aj>gDiCizDYpp84&??FO8uz26UA26GSnC)gsXy z=Xvm9qQt<~2?J1q$(XRWI|g)|Ap+ zlxeE36ST$M29pcpM5+i~roHBQ#ierWyIa+;c>jXv))b9X%An!}IDPGpGH9DlIt+Kvol#3K5p6MV&MDVlYGA%`)w) zN7KhoR0xRh?#lG?XqZwF;y8VS?jNgzoTM3rvkfCR0YydVK`LDfJ!S%r!5MqR(MKTT~&^Z3s0X4 zj2Vx|?nuDINRmmRaDD1#)9h?e(U2126#y}^E-RT4VDhs<^@+%-n?EZYU8?xgq7>D2 zgW#$?Qv7?PWxO)nT(3VZe6TYDBr}?-r+~7*FII*sJzrtEvw)h&VEfz|TygpYE?u~Q zhK=gI%(_%15E78?XDcf6 zS^!gL|GucZ*g`o$&MGB|wZ0t@6^uk=DLdi~o%HP55W^TkY&hS0X&=nAMV=BEW7k-i zEQACk09gWIA8OJTb|zbEmI$C2NiqZ^#)Hl{AwEF@+GITRLFaMe{>zx`C%~s~%X>T) zyh1S%hJ}e5yH+lU3haQ2&O0ryi)pf>B{@7Dt(?1IvjZ@lEeuYDa&WC4At)jrA*@6o z6&Q83RiTPaqU=b+7}vDf!lmeJP6SsBhls8`kKu3wGTH~}2xc_FfKP%*kc=muL;(@8 z#egFij&SBA<3U$!T)s0CO&ZwSf^)`FtW1 z>_xUw3@D(fwl=9XR{RbsyN=QcQPN8BQ1ZIUl;%e6hT~%Y#i_{Ga*PI*OlU0)rp6r7 z!dXW7#3m2$pjmE8ic(O8mggO-jhY-|cJj~GfdMlj@H)_j7%^o;5rfL;&8}IMow$EIEOcH<%601H(&tN=> zu)i-Lj*;*fN)~xZZ2~ESl(W`y7*T#sSWL}G_Xr7;lNn1c5AO5-vl~;{@;)0r8MAu!_-SANTF;V}GJxa~Y3)$XPu6 zp;thC{o4o%14Wc1BWw^L#E1uk8@}iv*x65<1!sn^gOeCX=P*eG}1Fm8%zS4%bQrh^Li;c+F z%S;0xiuB(n8Z#BFeH4mm7wc5k2#8_;ijVYDDs*|EV*f}K0)ujmm!6fe4`3li-etSk znm7e>Vyllg2?%xGHaoRBI3Q*^nz34_&SFGp--1 z86ss}D74^@Cz@(L#>Kz_Z8(H(#!CC@kUqy%h2<=Exe!f@BT&{HOkI97laB)Q7^!4u zm{P!()xyBKj_I!Vx;r9J&eOX{^EPT(Jb`#JNxsQ1vh#5%wl`8jIRuQnF`j$E$TN`Q zWwem8GHaGO)(z_#3oAoNVA;AF_sWRv075`wEC>-;*!N&{K}HH!8(0cOwiODsl5JxK zxqu`!t$UKPllHQKrR9^U8CQK4c*wawXv%S(#VU~ZL}>-(EUHN5LL<7mG!gN&W3|xm zodDtTb5r8`pQvCW2@)unBN!zNX#^`VMtlaRw{F9et~R*p)CNR=`*toMrqj6h?mH1( zzULw^+{2~4Qy3Tqn+Ru4Mt<2EjA3zc7-M_uB)~D$5|YHVA2BA?@R~&#Q9;qE@2$wh znZk>RU0Ao|(WTZVzB{yJfdOLO-^NkwPeT0XN!rpRKc7h(f~L)d5m^uqpc*5Q1gbVK z6wZLr7z}r?YvD?Dkq9D%FN5T&rz?PnjXMOklIQiMy&)Yfb;c5rYbsi*^C(a zyV{>{-K||9OWH?q0?-H|280uCXYoFO34qwQKbjyhE_Y{O8Ac5fBd}(I$a+j@0J1TF zF~AcLhEUyv#eF`%%wyy&R|*ioN?J%Ws1}4=sw~kSX~cn|f7YPL&o`~8YwT+{iykhu zrP1={E`FnMRblL6xRmA|iK3z_3IMHgA5ERnQn~$9t|*Zy$^0x;$}M=ZqU{9LDCv@ul;W(R@yLv^Y^JUai+96fXz~v*tplTezfrYXF2b(>+0|p z&i1{mBt^l%L{_p=;exuzg*;=DB(Qek`fv^gh}b~YVmKIJNF&_#$=mV4`|rlZ3zwXG z8mDpBy?0|Wq5C2=1HJF^i2m#&_aibU4-WJeniXJw{CBVum&aj6vj&ai*9EC$(QPUU ziXv|^Nv14>TpN}&JUh)(Qw7H339KlLvhOVJ76qHgZ6ZxFHxcOsWZZXI>sT8blQjz_ zjzEz?L@}%|#>p6>iE~jH1H!-+w~Z!HVk8hG$rv#iSFwLGhC+}CLBJS9#-&M!WCfnp z7uqKGASGd$B(6BJVV4GxaDss=lJCOp4Z{*3FkodcVy6Rn50n6GPq>B1y8w-$h@ldB zp(NOg1PKGNFb0XUV1;5RC4S>ZfEfYU2V@f>n^0WRX;=0A-E@|#<(3JTX-1|;0bAGN%dDL~fur&= z3K>?wjxjdduuyEt4k8eCc?+>vs7?wMVDjFn&LAltc__5Ti=Z=S?bFqW!dN$g4B0F& zMyHyEru*HyW#PS4S-;le5k#Snr!mH5O{lLLEQv+sSO3k{n`Y2-G z*qyTb7$z&2L71vqLkuEQDzuU2%ZjgoTr8B4HUJkKLZ*U+R`sCEkzKl)gj5&q@hY_5?)@_euSf22N!q0z{yc?Q2YY_Kym8e z5Fvwu2%hQO!{u_psMvL#(bD64NQRTZj^-}DnS22ry9f-;mW=gZvQj}U-ZdMsK&I8^7~DvX`q=i!E2*HU6MI1OI?nsCOLVzGaC>KOnq6mc$AwUoU!OH5`W6#9n@hm;l)7$h` zUHiwukq46m?8NY-QhicYeZP9|)%U*tD@h2!|I5@HePHqEaWVCgJ87K1$m@Unlk`7@ z9lPxmVtO1^Pu;L*@{Qd5=`VaqRH_pIWXc6T_LVQ+P!6Q)&DkT5epTp($x#>OV~R*UL^189bh79}XEimIs8w`(|dmV7=>yW1gSTUZ&J`fi=4p7@dUA9Hr+ zsoN33h{jHhv}q8AAwm-L2OUQ324)yC3PuPiArc{5wHm|WfFugY7$&>5ZMvNfW6l`& z-2b3>&kFMKhd(9Crp6{F$|N(zx!?JDy%X-A qNjj4ul}h2dF1x!s z^!i-}0}m&wGg&dOPMXUZSI6rOpMe|T2QkDc>~w}|F^_KQ#FE7H)EsN87kTdKUrH*# zPE76RtUNxxzkr)feBZ|pLJT9tp}7jAWE!T!Ua?4^>-1~~NhH|) zJr38mvC=6P=Zc(<2kbNkBuRoF1n5SJPNzvWo7;!^zK<-+cq0!*R#0V?ay3t`WDx^< zPL|yh3mlxRqH7wucICV3dm~!yIpVk8f+XR?cW3#>iyOpoNa)KX0m!mU5GMPd{^r&u zQ4}F7GK#9;dp^3Z0}xpj@{vV8G(ShRkjJsosIr18E0paV^1(wWx7-4$6y;Ky+fS4M zFiaD}OjE2>*;-%Q_iW|N8R_V4w~JD#gr;c-A}6aoc-Dhpx+LXkj~kQEtOmXQ^OP$bAgAQXkQojwvEA&?{x2-cU*OYch- zTx;U(W8X|ez5e|y2ok(N5F`q!?@_i@1_?Ahu+$8Oub{aQ`T>z2kwgg<+aVO7bvi6g z=0Hkr;f=GqL{Y+UI3)BV#tKD_9zU_~ z*;t_nfF^W$1D7a@=yg40)xa=Qm}{50?1gkUwoo*cRQif$RHB&5);7jy0Ki{g++c0B zLrPT<0)$BD_4YV4zqk(zgdk&CC@BR=mf73u(Aw%S>}XWS$1u#8iQTifj!mqpq>L+t z*ciCrjj(ej?ViWl=7`QPr0f{zx{ju*Wb=8#DA}_m&uUQ6dWr}BqYWPMfTe5eb~~grzL=g9{!Bj z+uNg5Dj~}evXrn>Ym>=nWHWh)V*nEQ?K5y@d0$yMX^ZMumV#~J#|f5|MF_#Kp8Tow zj-5K~WO4g__WC^v7iWV1Hj$fL2_V108FRZ+?1$B3g4!!U@Vh<0~CsaRm5Qb9K~ z;wUCb5=zA)!{LA@AOErRo?Xn!(h~DWj<9+85}Kxw&ZLnPneClA#ZraYgNN`(LoC~- zzP*jC>C8?|QY?(oYPaw_kGX>f>GyiqfZnxSJ^PEFOKX?bDU_$sQZ_>9?9^JAhQY+t zG^(nS$vX&DraV1K5)1l67ti;JV~N?hd0KmYp7`PSrRx@{_dW2C7@wFzQ4}^e))B-^ z%^XBg6kJonS0wBpp}SRQuiIy4Y8=zdP_Nf{?&+tb_uVp`y6=85F*$*qbr8Ty2T}-N zt`jrf9#lx0|SP`iEBgC>V_lhA2#=CwDe zuU?Qoa2GQ^GlQxsG>Zn8rY$5*BQA~+WDGXfH<>?qE2YWG&1soz=ZYvDnAZj((KXUm zhB%4|gYf3Se)fa!Nv@wT(Um!QIb<4`9C%dSh%qz6#aCYC!b^XXZVC)wd1(oG7%|s~ zDUJg2+Z`MsbMEwM{`{NYN*}lx{CB(e!H2}LJMQA5bB|{ugpX8svrN tpOs#F`DNtpkijd1X1002ovPDHLkV1g>8+a&-1 diff --git a/source/Resources/SliderDisabled.png b/source/Resources/SliderDisabled.png deleted file mode 100644 index 80d435ea017b67bd7a102a95700b235ced756353..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2599 zcmV+?3fT3DP)KLZ*U+R`sCEkzKl)gj5&q@hY_5?)@_euSf22N!q0z{yc?Q2YY_Kym8e z5Fvwu2%hQO!{u_psMvL#(bD64NQRTZj^-}DnS22ry9f-;mW=gZvQj}U-ZdMsK&I8^7~DvX`q=iLxp z+ZSl1stOfSRjHy#sPBF1KhVbtsa2oaN}x)8q@qwj6+%!*nh=sWB=IG_jmLAwGjry4 zuDcJWF(?fX2;DE|<*fbfwbovH{g#kY^8Z@e?HbG-dst4-&vI?y5)1FVE526P;Un`D zs%3;wZriilvUv3SPs(Ds!ggZ|-}iXp>8It_0z3J$XXMn~hgk8qSXa6%3|1MIOrCk} zd3i@+4?X(0oGwmqcDT&as7`y>K~0!kUcQK(N^S3C-lb;w(ASVByL&6h$yz*~il5k9hZ=uZY`%{rKm~vohqPd1{cqs;f=rjReWw3?>+H|JoW7J(lAU~ zj)Si07^=?5?csYKDLX~g$Wt~8C_JkT@^fKFk39%7 z#M#;;p<9GrhzLT0c9%}GNe~3!1w?_5+wVXW5eFf@=VK>L8k;K&2OTD-Cpq@5@5o!e zAWuB?Ls_a;sc)=PE>-Dv+c?bz>ualw`XgFfTd2Cm$a4`wq1D`^nw|gOIh%j*m^^gvz0}t?nApFcez(iU^%X|GkBlXuA0U8ysYD`Y;f)3i zM+5rZ_{L`WOqx=;Og5im$LWwMRxwSBKfmxBaRXMYj>~)IW+@blgkgvTHa9o$20c2X zm{d}wR5dB;3I#)kx|GKm0!R*#_7BU)<`T-_kJy0Oa>3Kz8` zOYMM%@2>%%>pF!(0mpGzUS9chQD6Dsw8&U0DN|yZ0xzAy9YH1@QJN_d8yXS;s)AzZ zD5efkgt@qmnb2rNlDE!nV5dxqd6O^(G?S%kD{L%X6*s*gssJHk3|+^vZQ@v>N{MD_ z2-`xGPf}37(P5bg1WEcblu^^HP z>3B$~s1cev?X5ncgit~>^a+EI*pG=r38gFyJ(42ku38pd0jCEj3L*}foH-(Ig3TX4 zE=NH?BtcaT60yetdqk*d40b$ZDuFaKD5i-njbn$BxT%HjC$Z2qDpR9X}kP5;GGz#7%|Hih(*=ff59rHjI5N1r{4* zh?r+cLK?h$wgG_K>*MxA#>yp*-hcmIofS(ZU^mJAk%uA#8-0PL3ijC@0zc-XGkv1f z4bU}0B)S)YA5zgJ4_E=!aKKBiwmHAtL)UavRiFsLj_Yz@div8XCYem)$04z&({+37 zw1zla5qDQLa;YAN<&b`(jubFdO;Ugk)Y1Ygp>n$A@!o2{D1=8mk zU|XA895{3UfKnk(7)JCuUHnjTem!KOC`qOupVAq45oHPDFm)JKsg){76r*pJ6*D%x(Qxp3r9em$o^58+-cIQ)|Tk6K| z{^+N&JYFM;eWa9Jy|lov*JW&9jY_qG8;nSrDZ(gV@xo;ag#zVr`Nq-PEr*w1dQp5~ zk^0EV@5%DMeW?g1#{9@PR|*O&gyWUzH5J5wWVWT3-PHvvaeQN`*T! zGNmmWO(?8;d!td{dnl?(%W3V_nQ7e_*q?s?Tj6;D2a^@b1C>l5F#0}KB|)iN;@tbE zx%l2Y;*P)oPXFtDvY6a6wx5cbBCnVnojAl>ufNH=Z~jAkm)0|4M?>Ez{p`)#K^0R zky5P;C6Oh~XF`Yjecf&~7_bmgD$Z4>rz)Ag5v{&0BV$LKz3--blLuq6n3nSu+7x8l z6olIDF)x@CnL48_1fsRMqqR-8G`VVT&zURb-8epQ4xjR?`J%lu-$9#)cI@()O$1xZ zTL>yHi&H+-dE=L(A1pB9_DGLPiyAg()80z zKOM5}A25E##OL-@?alS~xW(E;6wT>V`Ol$cphiwLMyz*6kaUJ(wCpe$PJjya7UZ_A z_m~&ou`%`zC2EPmo$C#AnsmaeH&Q9JQ7Ls|RuX?*phE11jcr!^B%ee*{2e)-nx}BL z=gsAU3_Ga|dnwJu#~JBEWZ$1WVaLVI(7&B??{--ork8Pf4rX$6A-8Ja_1?ho&>WoX z(8Z$^`Vryz$%2qGQ9ScNg480<`q^Vq+-C|gkom$l6c3uiO*EMek|6rUZ^#`a!)cr# z8w5sXCE|+DZrv@By8BF4beK}<=0QP*w=TPjF0;=q%{69)y}PAO6~&qr5iVt={d&3* z#^tn8Tsa1}?VX87IwP>X9*~Rg7iuPZKJYKu-wO|CglPSvlhWL?NY4a>~pDL^((b`PhMwQghaw}dLW79}sFi@sY> z)l!s`>D~2`lX=q0m^0hfPDknU^vS_jH}hQnhIt^nJ)7JxsmhDm9qKF+%dGUAT}3rX z3(DeB?3OCVsiq`ch@Z-*q#i?`TO? z)F12SM&D8P+burUAu|!Ut*_p|q70phBg-t8&tN}v%}(@_7&8{l*||pDH0CLy_gz?Q zD>ieaAfuYw&Y8w$_9eS2L#|5G9jz+TY0u;O>?1x7$zio|5#xqFM~+*CES#MY`t%$b z#g!#3nd<(uImM;h*bk)%W&C~|KiG94+p13a1XQU|)$)5-?Damg0;Ni_*K}@$sxq@) z>2bJT%q+PMpV8#)T4Bt(q`}UIYU^KwY$kou>x6yMKeJanq|WlFVsX(gp0%a1Tg^B3 z=owjlEg~VRIXY&%*RpPMr$|F>d}`_u4g8MZ^O!s>;^YPS(%gt`2kt!=yXekm+Yk13 zCxvGw?l1ck1oG|pqh~i92FAA@8jE~4Os!DW_bW?&WSCi=SK2nGoYN9pG|s+vIXmEXUV@r~ zV^hMOsVaB!VS~rl9Bzg3QBK&fo{5H8Dr2hX1`$; zMXG+CsnueS6D&&?XEZOww=3-Ts%3TMv|1{n&YVZ}ib~tR|8KM3$BZ*l=tg!X|6wX2 z$LTeknDgW$<=-0hnS&2)-p9qpomz_o=@&1D=&>J@)d?50s<^tvsC_Z2w^ZycQs$wI z*)^(vP+|i=!_>@E!xerZ%=u~*Cwf8DgyvxKfm0={-~0pLmcRG(vVG~vPIa2SvfoG4 z!l5iQqb}_{tXEXg-k^E$Xshtvdlwll`bV1;_Me*Qb>as{(M9Mf{rnaA4`aP7w;UW~ zhKdv_Gq z$5b;x@fK(KJdF%}>DTuvS<0r#LNlsKez`dwt`d{}NAE`~3){czNb`*9vlOCKavW9W zsA#X(k>0!1Ek#HAQ@=h-ZM&Cx0LcRqYTUNb2T?M^LQ_5&CBB_`i<7LG-T_I%jjU^>eV%IdovUaGWB*uhEeX>eQSES>xO9QB~gtys8TAmuF2|B8LQ0%SmS?){E zGMSq8^r~O{#-5bTYPa+9gO>l`<_>SJi!X*PEkPzdqNMzTGn@9n)ZJ6B`pMGez~kZk z<|)zelVZ*Wi|2(&{+^Q#yDwxZKw`Y7zV||mA~(}x(&6I^KC)L89`_!8G|nHHHm=2f zp7r>MS-jhhef(A_d$Lh)#V}Ro;V6cMS@*2O6#3K9dwm0Cv!Xq7(<~B_nxn5sL>$91 zojpcNcX*eb-7u`jbSkJ3r3D!TK!vG^Q?GaTN+%Xiy$ooS*PY8LO+Me2o|*XisN#4h zpZj>{QDw>L(!*V#%d52QN0sHL4;s8)zPk(5pis_&I#h_03dTl6uU<1;FUSz<5pS}t zS|OdQSQd*H%*HAD8NFBCv?sl)C2TVF0gdn(dv;@LF+H)7OLVNbzKUSJir_d4Z4wI& z(P->6XI~g+-#)hJTI#k9r)RRm@)jN)suHAhn)9(09|>1eV$G~~x78bgT^VA2x@hS0 z6#a}gCq&vZBQ#K8WR)JBg%p-aRu5B3nIumX=B8^9;?u8>IV)v5wI(@7h8FRax1yLZE0Pbarkxw1Uo z$Ec@?uh=|Ah<|9$-a0CRw1SJYqCAU9SGc0oRuPdrWdFRphF@10dz(&BD4JX>1J7s+ zFSA!TeG8A_)a%PAyWu@>t0QbhQy&?Z$*Q=`s`43~+574JrItC>f|hipeAs<`n`>mo z<Wu(+x6nj_2QYG3g^TQy@_KdF1o#~HxN13vpS#e<^oscosg7p@nD(o z8zWSScwI57rcXjs!Og|}#9H5+*V>ua&s=b1jVXoee-Tf0B&Lib<^j7z8IgCh zChWD!CoI}mWG=O#t=-pIB0ftxO-GP86|2>*u@9-5@?$)1zV5-GOSY6eEjwmk$7vH# zX4?kjaa*@l6?#?`wec0T@v^mXv(-Bm%kY%6@su=yT3OQclGUfOSfZ+=sl24Af}^dB zqs`$(TizX)PObKN2}iW1$hY-tZSl0CYi*|dV@@x`YGdCI*JSZC=r%^s`ZzavFL*mQ zo-Ei~qs|abb_;*oz@?8>ll#@>Wt%GsjB2Cxp>J|qxVpR~_>Ag6o!MJ8dCT}i= zlm8BWH!FwQ|EpvFbN+9;>C%}r82#TMN53u&6yH^gU)6R~*610{zYSMiD_I>Y=KnLs zWVUHK$f7Cp|H1+#cE5=IL%ocGcWLm80p=KjN>X%{Fvq zu8an2{VxXel%<{Cc^dfW|F)KFH?{4_rEFQOj8~e>R6YD(jRYhT&&IStS+>x(d>hDJ zu?)H^|B+GUsM8=@2=#zMq24Fe0-KdXGy0VVf7yW@8o2e;BO|jTLCL8Ar7OOoqROP< z;mm&uw5JgNEu<;>`uc|7zyXCY0rN2(1qNu!OyOpO0UA`v1|*di4-Zc&DrSHn0Q^tc zD+D-RiJCe*162AZ6%CFi%b!qIV^c>lU6n0V-|rN|6!7oi71h5w6@uwp6%Ulse<13p ze-#xC237i1u3`YU>}WcuQvxfy5*alFIx8=@!SNrpPz!g(ryiwK_?Jy?1_%Q}QAdM{ z|FIO9=e;WnmfG{9e|B}3-^5+$o9t`l7psb{CP%W|G*WU2( z3Q$q;8~0MHluIhTOKVr^KRk2vt2(GMX-fSI`-_Uagz;QjvdVI;Gjj%|9I9BpMrj1> zRjzZX(-jeFZI^)w9?n)hT>f7mKmyJ6%5}if0mV%^W`CG0f1IiM{2xe)SPBpV2+$h^ zY0&R%8wF~8zf!5|36ujhIRlh9pf?JmUom@Rx&({~mJ+O(h5k8$GzmdW(g5UKQatqpKtq3XUv~9rUD*o!_&e@u8G$U+a&9+eqNa{oeZOF{-wUJL4OJ#9U#d=9 z-~G4T2OvZ*iH?GEF3zq_n=)6-kFR1`;Gb9qE89?Ya0UjR=lnMs#r@ZF&Z}G>0a=#{ zp8I6ZHnkl}v|jQ3FdaRa1q<3G^3McKKXtY(xsHKY`780g>FD?6PeIxsTU<>GXg_Vb zgqmZJ!H-KNnpy$J760hzzc5#^b`U9IRgM8we<0-`tuhd!((2!Gl~>WwNr*9sn3#p` zUS?JB-bfB@?QI&rS&Q$toh_4Aa~bc?3r#LdtzLW6@2i9J7}(9EJhnFa6BuruS5z9H znqO$=NUMMUv@&=qmq5a5)?(If^lhU*FVms4(&Vx`NjrzlKjqUq80;L8zU9&4@ol|7 zhJi;*bjA@3_1c?qn0}!KJQMgjA|2t;V)oJq3Ga=bc5X7gB=^en%0&55S!84sRTL#p z%200%1$VD=<3iQ@O9IhMEtJPXSvX_+ptk=KEbN}$O6foe03t-MD291!N9=C7LxCDs zVgeaeC%;#h07Xltives@J%vXs)z~W4C?Q+3A+>haWT>y`UfDat$?t)TCTFPWrfDas z6;Dgs)fvB>HMWf~hTpo!V(iFgTlVgu7)_i?p5e^*>Z(9TU>E)z_9V@{%uy7yW|%;@ z=W&t9IY7Q_064%p{qd}Gyx~9Stk)IvEedKa^#?-ZPzvmr>2MO5XFq@P+jZO6HWgGO zt0SujMvCAK6GttFikXKECRGMN>`6j>VC~j$8c!Nms>hgdY@f9dfJRWgH0-OZ{#GSc zT7Lztyi>V<)<1g-Ih@9C$gj(lYAuvLVkbgv8$o3ieQMzPb2d%O;o)q>OqJ-_t?J58 zj7C?a$-`3iynr-)n73w_*Ki1sdbOJKp;ElzuB|#j=o3#Kh$j~gljex=;!IBIMAkgZ5*Jv)GT=j7Dd7eQ@NMw zxTC94GPQ?FHx-Qw&V7gfN`e9i$TcEHH`n~hMT@eCs3$f zwYjtx=&KHX*p4#CW%p$q{Ju~JUUA2w!~e(Gw~ecgVN`(lT>!F`^I#Bp^#2oi|J=}^ z6O&*N2{By-9y%)UK2_gA71zsh=Z<#UZ^?}W0Z<4*5#X2X%6atO{L%XtR|RZZu=9;5 zI`@7C3kw5Yc7?)` z>#%rM%~A^s!z;j}nO9XN$Dp7hYSgZFnD;kojiN}{4S7<5!&X(iM`inmdtR;nmlSm% z0PdjxfaMA@{qSsmGNh$_Pl^9Noqzf4XCV={}IJ!+q~!^ zdd7XZwE(|JyQ2m|lZQO|ErB4A1YowpEslJB8}3arB`EK!1S^XY21HfoJYJC)4ZDrF z^ynd5k6Fvxi!S14^;esjxflTEh?F`?KmN31DKUEVcpf-DDpImbO@{pfS@vk-`e&*? z)>llcSBb^~&&=9Bz2%y;jq+07+BosETM0$3b(S+R6ud@Ak6A;W%b?gwKkXm8<(jp5 zT4>-Xh6?!NX%ojgC4oGTn&zuNf_%km)MEC^kSiHP#t2-9QS$Bf8|aE(MyPlH(;x7qG!%RagiF-#}4Yu@*ZB z+twwQ#ZsAnyu8YnBJ{KO#t3I^cOQ?2ZFT_MWdbq zRu`303?~hE-2oH7Ax|368>#}*i81Vw1}w*(7b=-Jo4ErQ+d>uL40jOCv4vMR54v|W zN-Jh6rkXe6|2naN06$ndVmY9zxjJyMRKT z2tm-8i0;<>eS*N2L(j-%)cZOf;eA=`?d|OB?Y!;xS-@bH%fa9=1M{CRQ_vv9L`;Ir z_pIE75Z~k#t^yYT3bCDPz3ZnwM-Bpc@7wJW9m4AtyQ%!+%FvO0x zPbfABg3;~dMis`4O$8?q1X-oWE#?n|-Od<{K&cGsvhXl(BP!^H?1W;iH!=HrfYypc zSLARixa7z%FF^dIcdA{u%nu{hRDD7TH8={p=l}}n0Um&<64vcd>R#Fd4Egp~_f!i4 zFd%5T`xf}>EhYpg0_qSI94Z%;kzt$huP&F|V0=2z-TDXuQKZ8ldP<-WL9GN-hpB#h z%cVJFj8c31t#cz#45X^M?*7mO3`U4AM(FAd97qoX24JRE;`Ehd`MI{{tCMPaiC=J~ zFt+8b9nx8?>+ZWrSc8MH3LyrpZ@JX(y*bACnM=KfCsF^O0PV+$+FDm=BC$ z9nm9=^;%sgSva|bOQV3XKc7q80A&$Z?|GnYs1ULCbh$J0Z$rWV)Bw=HMtl0qN^}cSt#u~h}K#;l_T?b?VP87!emO$YU(tL>( zKywRb2r1z*b*@<$jaaZ+QwM~}FOI^1S&3E^iK0;|f|e2idAS5MZJp$*#yP*51>&j8 z=IoN!-joFH?L=YB*O0ghU(r_q*aLLAHOobL>13DiSTzE-1{Fo4t&=tck+)&SQwjwp z@J@aqrS7rjZNa?xr8cDoEcII_Qv#H*?2o@ww(_r zP*`0<-UwAUBioW1@;ubYdIM#STqAlrsSyrFZMD)k}#NC1oZM+Ck^W>1QN)wTJC1B;N&*9D&8N0k6J-6fleYA%#=>DEIC`aUbEn&6)_ikNuisjFK{2+s;~Aa@dHIQo~(8fK`?fI%0q4y`(9u5WuEY5 zzycH+;Q~>(k=9{Kgvuy$HVXg)pWQ--kTo7J_)0n>CxmP-1+A%DLSQhj2xBx<#okKL@PTJc5T&W*p& zV&Ne4Qgwij+GhN`K|i;48PDKmJ_4i~T%}zQzM4A2&h4(W;6re!L8`Ha@UY0&XGv{D zD1RV8QQ|7nbo z&i@jLN&$dZWPfedYW0#>@GVg^Gp-x+Ye3v5( zSFE%fAIH&f7Alb%c*SO13zAHZ=5Lc~6;Bd6AHGmPcZlA6s_;p^LqXtT>K^7igZ(Ml} z0ro&`YRjLy_(4)!8NH-%?!@^#ebVJBf6=_01)g%_x*Sg~>%Y1kIe!PkB-&hGqXrx~ zHvv^T-eM- z?+ne?#?VW8qskS{P6Z|xMT_rKH#%jfgDWUUW+y!3yjQmB-e?gw?}wVvM-`HL1GPF-aH>aX26{oNyRjKNf8o0 zPgm~+3H$@Ga;mUph6}~>L=?e1&D(#Zhu!c;e;f7q{%YravwKnL*L2Nr(HLW2UXE3qw9z@p-{Yw;lrEf_{&JJPX1b&QMwr;9wAj4qsH#YD%s97H}2GJLc#Hz`qwnF z_)A-?)@tFs*J!y%ZkCB)@>YqK%agL8fAM5b^`dw97Ls(0g1)nmmr9(wl%V8Wp`knD z{f8lM9Yd`~)iLtQ6_arlyzV8L50R2kh3q_EE7)$SlQM%rUKF+qKBeQNy#={;E!1*@ zu=nu;g{3s9bM_`hU#6GXh#7X6B!&5Xc|O~Z2N9dz;{w+=?}~(uKZQt!KyX+>aJnNo z!3iD4%FQ3+w~oHt{7U%uQ5k~%&pkKl)*TH(M9eHG#B@*L-*;3*ceY+^z04cd(4^~m z*AU7k*SPZU=MSW&%PQz?QzWlXw{s6M2F7{)d1jwjl{MA#-itX&TqVq6rXf0XT$byP z!n@r~W`&raoXO8h77J=B5~~~G3Ud%VrCFCGptc;P(X<{%!+o4hRvT&e-uyN!MAX!|uTF*W*(0_Rk9Wov#P?6*_qBzMJG7{_MPPu2pLf(*pvo2^zEnlH4Z$Rcor%_QJCQ4D?iM+Qe_o z{vmp3zWpCg`ufC(Em|MEORkGt4Bwi4ZWc=WE3K*Ii%_gvu3y1fYj#Og+=zuFW|Skz zEZZyTwe_HtnJ)43u`OGBPg@^nXJ_y(A*TQ5seo-YMeAdToH}|Q?v%C&XSd=IGCjKSXO=K2hpA(&$?#N6e zUF;PLS#x9{#99`{9Bqe5G*ptb+I_i@E!w~L=`fk`bcjMR1$73q?S$eSje1k>X4D4B zuY%^}FkGfctJtTZZ_e#L4-30kuRx9rYQ)!xel9=Tef{nc>Xi)YW$2Zk{qsvX;AhOl zOoI1>6yz@*4fRfjXh$NsGHu>RCS~|D`0NYR6ub>5drEX)iHPa((?gsAM%KrOL)AeN z`|y$xU{gnT7suO`}V6U<4z^RU#{9VTi@X?+gJx z85uc(QFLRO_#F$AG!e@?FKfAGs#U2l5C~i(Rmf z^VR%1ylES!K0sQb>*kBlcaMwCubWFt_qq;nc;MR@SDh;79Wiouy;W7dQGH-~Sa}vL z{>5<2H%@h^`s3s@TIuhtmY?r0$QyZ;Cc|u{IXdDPLZR{VGaU;s>Fa<&4u|$%cRSSxAC^!83IokEvE0ZhbfL ztCE$RSXq?VA^u`2^L{OYM>j7n*dRWd&vNG15kw!u6?f_eq3#LK&s(`Qv`1)q7%r>r zzVY}vU(pu7Vq^SxZoOQFz4Th%#y>3*L+Kq8k~aO)Ki)cpPJJ8sE67KhjT`d<^CP4+b0Yo}UuH0cuzV^-I}#strv z;as;>BzfTrX2Btn)VGOX60%Rcz;YTl4^JLKp)xtt8QGWLS#lCV(9zM+Fwy_ZU1-G2 zLRJby_uLT$YoTA6UVocJUU?Skr2&zp%lLPy&I!#wko+|8T>m&AH;5+3$x`%W!EgFe{!bfTq3#+YX;d)}Cm2T-14a+U^H?Nd`B+_(k{w=Vas$ z#5s@UDPvg(yA0ro74v%l?^w&x8Civ_Jq_q$S!7bM3 zkGE1ed69RT8*frG!-lM)ig@Q(4|rm_H87Re*(gKG5$xgGnDB5b%zXn=q?8}&%OoW) z>Fd_kH7g`?-4BG|1m>8+lty83*yh5bG=x^A5wH4xAr1?qX~r=WiUZ@AVAoloGLaY7 z=EMhLkFUu@iOQ=%)w(W7qHurLl2Y!gLCu2UTKHDvPBHFE2p2`Z9)mYEZCHc&&tGx` z;$og~pm#43NLU-qy}kdoIU3*P3Emy(oar?=+ryCpoI-{Y=wM3tf`HtT7Ua@+jTzFg{)TuYP!0mT>z5IJYH668A$yhjvbo``K)nIQYtjOD)# zOo-XcPt+)55^0*pDhR0!@)l9?OK$j)p&xrp0-q66?7+4Bg^XTf$98 zxPg?$S=xU8g-0 zXmnZ0#FGN9!Tbnwe4OFJPb?aKdq?k)7a2SB{lDW73wwU}Qk=hT7I_^8S-*lErR{4` z2lcj{@Qj~Gq#d%Gb-{0EkdEK#4X)J=f(3M)IVmP?6jxm%Ii+x+kZ()1FKLF+N65~t zTYJ-K%HEI@Hj}!i9L+}_u7IVWfnbV&0bm%vcIWOH+ZEm@zLHIjd#;U&-EZT67WE zm=wSNA$qS`HS5?mWw#%?0sThlL~B^!684RxmFq>QWvC_3M3pEvZDgwdMev(WXc42j zJv~QS;z81iTAx)v-S(b-;;S%C1*S5lX1sM=rsiwM5?=WdQg3srhck(aay^4$qq0+sm0NCN(S9Xs2kx@^dPmAgOl*oxAMDV4 zs;)$WXYNEcUhHKM4#S$z**)f;)%G#-HUmweLFm`oB6)C`ig~VON$Yw^+2S8`L}pjp z9$B0Pw`UF2nkTNmMBGfVS+?kVYB)YHWIR4l^gHGURD1nez8Gh8$HTZXd|f)X?vtR z(@UoBN~tz4E1&l7>a8)b^tmu?R`5*vFvP1L>-QJ_mL+rFHF(gmG4YGZVV-z|S){+f z_l(@G?DPGzH9XJzqj~G0Ds|7@v z_w{Mz1XxQvrnFyuStN(;eqb+bMZ&XbDr6AFp!_)5HoD~}d2MeS<@5INI-=zuW!HHD zcekpn-^xA1C)%#3tXsc`q2ey5^w)RhYn;2R2?Xb8x%Pa!PZ_Ad+udJKl{ag5)u`cz zC){|`0&_VRG09OY9PVB4HCZC7+Lv8{eB<+(a~)~6*=hSQ+h3AfzetyUk<^Bbs$o)?IgoeB72BYVLdUAfl_$_Nk&Lbap!D)t1bO&u4Sr0CvPvMNb zs=4%tmcdEs9u5B07UAZ*DG1{5+XQJZqpWfNd*)bFaZeu1uEY{(%Rap|5+ZY~W@y zKclU3ApRjVdMSY7&3pim*Q9Xw?q(@IPYI4|;H_^~8z;Ic`%NrJmZAjfk`E`+o`;4f zu%kos{#u!8`)6|tT?1dl_WM4ZaOBFy*zV6CdfXXo+Pp)p=({nO*LtG<6Wm2~WCba^ z$fj+Y+1zgJjDPFFlOayqscGOMq`_!CvGIZGkP+i;3!PJ(AH(6Tp;|pzQDekiy@4kI zlp$3J9oUI@&xw(kP1JL|cG}i}$mJlceyqaH50=UNi_r%$z5?7s!h|-W*>Nnp8d8cz z;>^0q#)%1q;SWrU9%PF~<6ai~3%{6O}#u{7rKTIg1xWg>6#|>4zKzufu+mkJ* zwoX7C$|fYfOrnm#vVf5jGDZ6!@Ub+b&5mipwEd~0rMM`iZ1-Q9)j1d#`><67tA55> z%ys|ueLCnjPLO6$SlxJmAtU-l_vsmjCvQ=nGF|kFa{C$Y@Nv-Bdjl<&$Ke8JmgC4r zPsC1KgL_5VPo zj}e7_r_lFvi9tOyMCEz=hM%}M=E}%_kK-UoPk6pZUD!(=vBI3K0_X_9r4EFAh1(O>f&5iv0PIhtDjBbLt|H!Ys@ z6IPgfQu6|l0?DA;Q|8f$W~UMI+8=PX&1z_|v4w_(EV<`YH5+$C5~A1x8Wh$)QT>kF z`iy*KRl_(aOe_`Z;TuTdIc4~0w^`5j7x_xbhQJx+N=bV)n;(VcxU#7b9>VndyZ1an zVLrl_$u{{4-mpFx*`_>#wL5-YZ6FO!GFYSM)tCkQAsKT<9+_&>$dBnGPKex! zyP2?BUe4;xAUx99_cHz$a&aroCe}8-2xPCGxW{pRc02p_?)~?sdaY-*zRZ#4mXpqOH#}#JKfeF{xR_a_rm5Gf;Vaf$<%>w z1!WPKE0RQTq|KF{=^sBY)+6LglmEr)wuYJAmzo%DS z5}B2odPM%+|ImdYS3NN=DR{6sXLC8`&_&Un_k|p*4#jNd%w%mM`=@-|FU|s@hr(mCQ*M8Jjiel< zokTK_7%~?6F%~Xg?=|!1ULB2p5_;E+4Zqt0`c*up`ztM$(|2|?Jp!JA)4^;nn_!Rq zlpC7|!VbuN7uA9zYfq)e1A8{wJ-c?Yakdx+urDmP-62oI9(=!N_$gbOzqK)?9XJbCkjE6=Xk zU1<*~-P-*$p-(JMPKgh+d-~?y9*XyohRO`QpUAH%Vt;ePpWI8%my;)BS9N95#kjuL zsg5mrNO%}-Trbf+*Z;##Bj_2wzrOOB1li^R)(z$6%Cub@8&kY_iuFe2x?_G4&gR6I zSuyjLmQCydJRkLN5z3l2@wfVi5pA@{R@DAtRn2mDCW#yvHfxVL_h3-g5?LSM2U zFjXOz&J0tsR=$Gmt&xN|QN-i!eodKkoRW*mex@+#+*_kJ)_0#?C(wL2=uyk+B1C&V zV%m?8LrPl%uHoTKycB%^N7Da>`AE?BE4jsQWr&lLWexYOX%oIP7g9kCLolYAXJQ(HZ2z&{ixf7am+r{1&fgyr+wC~8Tt9a8e$sI?Q!|Rot z10ze9r9zGG+R|u;!qywnYdz~b&_>uK;Fl7^LW*Nd*A(TR}!jGY2~B*?M@C%5Oj zGZ8|Pq!FTr9ONwOq@+kwmTL*MWs;jd>aS#vmwhi%UK`B}2@IXw5;jiqIFYtf^`RfO z==ZT06xKMDX+2RMIx$b#_wI;0=!lP(%`!y(aGX0G$QAC0iNl+>=s8W73#t`Y?YmdMm3ZWCp>b%WkNCpA4uY7`{`p%U3^?4I_u9UL zA1P@$X{ZE?QBG8()IE2a!RE^NtfA;y7wD$D&Y;^-k4ziC;9SL*)yKB9{sGT?l+Ea7 zrn;bCN!g$~iu3s0rUer2mZ3@rA1~e9lpK|pwfk8^p3}aaTNm6h&&)Ykom}BQ2qB?Y z=?mo7pDYvzVbbLxA2WQ-$9@;;lo?!uv1$JpBBLrLwV-izJ$f9Nru^qoQKjHxl4B z(etE80%@&&qmVh4nq}SY^dV9yN!wiE#atG@Gx^Oku3tDM$@;JB7gbz1H(t2XbGHbt zn#KfW;%1eya=?2*Z9N zWkQ9d2WmKwvPpBAnl**eWOz7fbIX>ht^?I1cU`DXDF&+L*fLJZJ>t4p0?uQC5qCu{ z2!j)2&$B%bolZH&2gblpAzn8HBe2ZQqmaDAa!{A`h~Q(>^B7lz1_C_@^uEznnMOo> z;dN!Sz9Y~X*Pg}r^>zP>LInFDt9H)`#|Tn}ls&AMSvD#v`boepj~Wb@zhsUpOSxMq zRhc{wVai6)voye<+(wT5)@`BfL_9l-5t%cOOt4C6uJFrM%!8&k!Aq4NCmwL!MDEK* zn4MBR+U*Q|_Bh_i+SA&}D}#3KJ)$GQ3OUJIPD)C;YD9X#F%kvtz(aw=s7StW0wg&D z>=(tGBZ@actcIHwiZw5}2q+(<50g=7J=NZ5VryZ%y*BWJj@q4Eh#aY)Q4_rbUCQu~ zeYP$5QFvHj*Sah)dLp+Ru$rgpa{E-~pt%P#?rC zn@mz71@f9kiuF$AX7C6=if`q_*ISeSIhyV~`tf;GujQFI1)-OC_IZNK)3V`~Z9iQ8 zv<%V_Wl{T*MUPE~McV_}XEnoVoVF2+@^iaVBoeH>YQkEZn~J2Qk*|5OqyyuDKJF9^zant5<#)(Gwe3bRBWf@tl$XD5wg3~j`18f>qmd+p? zZPl$^pG{l2dqEo|gd-O4XF)}W$F}1I`y$(7xq*ba&n2Hr9vQu@9{L} zL?t1mNeiycJ=eTrv#hK^CWCK9cq>oHYsMq|&E0n8_1kxr@Uj_0!d`IZJ|hs;JjXuU z3&MGRRv(Np_)B#6kd)+R8mwOYK--u0djBnzV6-0RMd$80t6J4=4_aEVS{b}>8>FyW zIL1O*PSQIbn|r(Z1FeoDx|>Hthc}jYmG;)%V?r;n#|2G^ zi|4uah)ut!vtYw>=G9%RkUtQQp#3z@fg@{y(w^XW?S71bL_@VFT6sE{)w9g3pJSOt z)i6oaSTBE^DA2}w`*~JuEiCE=Z{n|7OK&H(A2v~5X^Ux#sT#C_gMou2zv4PKQCL)4 Z+G3)mhnfwtX-e%kq1-t>E90N}{|5jOOV9uS literal 0 HcmV?d00001 diff --git a/source/Utility/MapAdapter.cs b/source/Utility/MapAdapter.cs index db4cf59c..43d2956e 100644 --- a/source/Utility/MapAdapter.cs +++ b/source/Utility/MapAdapter.cs @@ -60,7 +60,7 @@ public enum MapType /// /// The . /// - public static IMap GetMap() => Library.Instance?.Map?.GetCurrentMap(); + public static IMap GetMap() => Instances.Map?.GetCurrentMap(); #endregion } diff --git a/source/Utils/Utils.cs b/source/Utils/Utils.cs index 2c5088fa..f40d438d 100644 --- a/source/Utils/Utils.cs +++ b/source/Utils/Utils.cs @@ -242,6 +242,8 @@ public static string KeyToText(uint vKey) switch (vKey) { + case 0: + return "None"; case 9: return "Tab"; case 16: From 55150f8dd909c81d334d94aad97645bc36346321 Mon Sep 17 00:00:00 2001 From: L33T Date: Wed, 19 Oct 2016 07:57:20 +0300 Subject: [PATCH 03/11] + submodule update, colorpicker obsolete. --- external/SharpDX.Menu | 2 +- source/Menu/Items/ColorPicker.cs | 360 +------------------------------ 2 files changed, 8 insertions(+), 354 deletions(-) diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu index ae9cf0b9..455efc67 160000 --- a/external/SharpDX.Menu +++ b/external/SharpDX.Menu @@ -1 +1 @@ -Subproject commit ae9cf0b9758552f4a4128217e83ba4edf048f28b +Subproject commit 455efc679e3d2cdbfcd64b40e631a225ae729b63 diff --git a/source/Menu/Items/ColorPicker.cs b/source/Menu/Items/ColorPicker.cs index fca9001b..334e13fb 100644 --- a/source/Menu/Items/ColorPicker.cs +++ b/source/Menu/Items/ColorPicker.cs @@ -1,16 +1,12 @@ namespace LeagueSharp.Common { + using System; using System.Drawing; - using LeagueSharp.Common.Properties; - - using SharpDX; - - using Color = System.Drawing.Color; - ///

/// The color picker. /// + [Obsolete] public static class ColorPicker { #region Static Fields @@ -70,91 +66,6 @@ public static class ColorPicker ///
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 @@ -174,91 +85,27 @@ static ColorPicker() /// /// The color picker X-axis. /// - public static int ColorPickerX - { - get - { - return X + 18; - } - } + public static int ColorPickerX => 0; /// /// The color picker Y-axis. /// - public static int ColorPickerY - { - get - { - return Y + 61; - } - } + public static int ColorPickerY => 0; /// /// 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; - } - } + public static bool Visible { get; set; } /// /// 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; - } - } + public static int X { get; set; } /// /// 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; - } - } + public static int Y { get; set; } #endregion @@ -272,10 +119,6 @@ public static int Y /// public static void FireEvent(Color color) { - if (OnChangeColor != null) - { - OnChangeColor(color); - } } /// @@ -289,195 +132,6 @@ public static void FireEvent(Color 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 From 0e66de3cf31153b988adbc8a56a4e39f940ea2db Mon Sep 17 00:00:00 2001 From: L33T Date: Wed, 19 Oct 2016 21:42:14 +0300 Subject: [PATCH 04/11] + render object / sprite fixes, menu item adjustments, damage passive system addition. --- LeagueSharp.Common.ruleset | 3 + external/SharpDX.Menu | 2 +- source/Damage/Damage.cs | 491 +++++++++++++++++- source/Damage/DamagePassive.cs | 38 ++ source/Damage/Passives/DamageAatroxPassive.cs | 32 ++ source/Damage/Passives/DamageAkaliPassive.cs | 38 ++ source/Damage/Passives/DamageAkaliPassive1.cs | 32 ++ .../Damage/Passives/DamageAlistarPassive.cs | 37 ++ source/Damage/Passives/DamageAshePassive.cs | 35 ++ source/Damage/Passives/DamageAshePassive1.cs | 32 ++ source/Damage/Passives/DamageBardPassive.cs | 40 ++ .../Passives/DamageBlitzcrankPassive.cs | 32 ++ source/Damage/Passives/DamageBraumPassive.cs | 32 ++ .../Damage/Passives/DamageCaitlynPassive.cs | 37 ++ .../Damage/Passives/DamageChoGathPassive.cs | 32 ++ source/Damage/Passives/DamageDariusPassive.cs | 38 ++ .../Damage/Passives/DamageDariusPassive1.cs | 32 ++ source/Damage/Passives/DamageDianaPassive.cs | 39 ++ .../Damage/Passives/DamageDrMundoPassive.cs | 32 ++ source/Damage/Passives/DamageEkkoPassive.cs | 37 ++ source/Damage/Passives/DamageEkkoPassive1.cs | 45 ++ source/Damage/Passives/DamageFizzPassive.cs | 32 ++ source/Damage/Passives/DamageFizzPassive1.cs | 32 ++ source/Damage/Passives/DamageGarenPassive.cs | 32 ++ source/Damage/Passives/DamageGnarPassive.cs | 32 ++ source/Damage/Passives/DamageGragasPassive.cs | 32 ++ source/Damage/Passives/DamageGravesPassive.cs | 36 ++ .../Damage/Passives/DamageHecarimPassive.cs | 32 ++ source/Damage/Passives/DamageIllaoiPassive.cs | 32 ++ source/Damage/Passives/DamageIreliaPassive.cs | 32 ++ .../Damage/Passives/DamageJarvanIVPassive.cs | 33 ++ source/Damage/Passives/DamageJaxPassive.cs | 32 ++ source/Damage/Passives/DamageJaycePassive.cs | 32 ++ source/Damage/Passives/DamageJaycePassive1.cs | 32 ++ source/Damage/Passives/DamageJhinPassive.cs | 40 ++ source/Damage/Passives/DamageJhinPassive1.cs | 43 ++ source/Damage/Passives/DamageJinxPassive.cs | 37 ++ .../Damage/Passives/DamageKalistaPassive.cs | 32 ++ .../Damage/Passives/DamageKassadinPassive.cs | 32 ++ .../Damage/Passives/DamageKatarinaPassive.cs | 32 ++ source/Damage/Passives/DamageKaylePassive.cs | 32 ++ source/Damage/Passives/DamageKennenPassive.cs | 32 ++ source/Damage/Passives/DamageKogMawPassive.cs | 32 ++ source/Damage/Passives/DamageLeonaPassive.cs | 32 ++ source/Damage/Passives/DamageLucianPassive.cs | 38 ++ source/Damage/Passives/DamageLuxPassive.cs | 35 ++ .../Damage/Passives/DamageMalphitePassive.cs | 32 ++ .../Damage/Passives/DamageMasterYiPassive.cs | 35 ++ .../Passives/DamageMonkeyKingPassive.cs | 32 ++ .../Passives/DamageMordekaiserPassive.cs | 33 ++ source/Damage/Passives/DamageNasusPassive.cs | 32 ++ .../Damage/Passives/DamageNautilusPassive.cs | 32 ++ .../Damage/Passives/DamageNautilusPassive1.cs | 32 ++ .../Damage/Passives/DamageNidaleePassive.cs | 32 ++ .../Damage/Passives/DamageNocturnePassive.cs | 32 ++ source/Damage/Passives/DamageNunuPassive.cs | 32 ++ .../Damage/Passives/DamageOriannaPassive.cs | 39 ++ source/Damage/Passives/DamagePoppyPassive.cs | 32 ++ source/Damage/Passives/DamageQuinnPassive.cs | 32 ++ source/Damage/Passives/DamageRekSaiPassive.cs | 32 ++ .../Damage/Passives/DamageRenektonPassive.cs | 32 ++ source/Damage/Passives/DamageRengarPassive.cs | 32 ++ .../Damage/Passives/DamageRengarPassive1.cs | 32 ++ source/Damage/Passives/DamageRivenPassive.cs | 46 ++ source/Damage/Passives/DamageRumblePassive.cs | 35 ++ .../Damage/Passives/DamageSejuaniPassive.cs | 32 ++ source/Damage/Passives/DamageShacoPassive.cs | 33 ++ source/Damage/Passives/DamageShacoPassive1.cs | 35 ++ source/Damage/Passives/DamageShacoPassive2.cs | 37 ++ source/Damage/Passives/DamageShenPassive.cs | 43 ++ .../Damage/Passives/DamageShyvanaPassive.cs | 32 ++ .../Damage/Passives/DamageShyvanaPassive1.cs | 32 ++ source/Damage/Passives/DamageSionPassive.cs | 36 ++ .../Damage/Passives/DamageSkarnerPassive.cs | 32 ++ source/Damage/Passives/DamageSonaPassive.cs | 39 ++ source/Damage/Passives/DamageSonaPassive1.cs | 39 ++ .../Damage/Passives/DamageTahmKenchPassive.cs | 32 ++ source/Damage/Passives/DamageTalonPassive.cs | 32 ++ source/Damage/Passives/DamageTaricPassive.cs | 32 ++ source/Damage/Passives/DamageTeemoPassive.cs | 37 ++ source/Damage/Passives/DamageThreshPassive.cs | 33 ++ .../Damage/Passives/DamageTristanaPassive.cs | 32 ++ .../Damage/Passives/DamageTrundlePassive.cs | 32 ++ .../Passives/DamageTwistedFatePassive.cs | 37 ++ .../Passives/DamageTwistedFatePassive1.cs | 37 ++ .../Passives/DamageTwistedFatePassive2.cs | 37 ++ .../Passives/DamageTwistedFatePassive3.cs | 32 ++ source/Damage/Passives/DamageUdyrPassive.cs | 32 ++ source/Damage/Passives/DamageVarusPassive.cs | 32 ++ source/Damage/Passives/DamageVaynePassive.cs | 32 ++ source/Damage/Passives/DamageVaynePassive1.cs | 32 ++ source/Damage/Passives/DamageViPassive.cs | 32 ++ source/Damage/Passives/DamageViPassive1.cs | 32 ++ source/Damage/Passives/DamageViktorPassive.cs | 39 ++ .../Damage/Passives/DamageVolibearPassive.cs | 32 ++ .../Damage/Passives/DamageVolibearPassive1.cs | 32 ++ .../Damage/Passives/DamageWarwickPassive.cs | 35 ++ .../Damage/Passives/DamageXinZhaoPassive.cs | 32 ++ source/Damage/Passives/DamageYasuoPassive.cs | 36 ++ source/Damage/Passives/DamageYorickPassive.cs | 44 ++ source/Damage/Passives/DamageZedPassive.cs | 35 ++ source/Damage/Passives/DamageZiggsPassive.cs | 39 ++ .../Passives/Global/DamageBraumMarkPassive.cs | 35 ++ .../Global/DamageKalistaMarkPassive.cs | 32 ++ .../Passives/Global/DamageLeonaMarkPassive.cs | 39 ++ .../Passives/Global/DamageNamiMarkPassive.cs | 37 ++ source/Damage/Passives/IPassiveDamage.cs | 44 ++ .../Damage/Passives/IPassiveDamageMetadata.cs | 21 + source/LeagueSharp.Common.csproj | 134 ++++- source/LeagueSharp.Common.csproj.DotSettings | 2 + source/Menu/Core/MenuItem.cs | 70 ++- source/Menu/Items/HSLColor.cs | 8 +- source/Old/Data/SpellDatabase.cs | 8 +- source/Old/HealthPrediction.cs | 12 +- source/Old/Notifications.cs | 6 +- source/Old/Notifications/Notification.cs | 8 +- source/Old/Orbwalking.cs | 68 +-- source/Old/Packet.cs | 2 +- source/Old/PermaShow.cs | 35 ++ source/Old/Spell.cs | 46 +- source/Old/TargetSelector.cs | 8 +- source/Prediction/Old/AoePrediction.cs | 10 +- source/Prediction/Old/Collision.cs | 16 +- source/Prediction/Old/Prediction.cs | 42 +- source/Render/RenderObject.cs | 8 +- source/Render/Sprite.cs | 6 +- source/Utility/Utility.cs | 16 + 127 files changed, 4462 insertions(+), 140 deletions(-) create mode 100644 source/Damage/DamagePassive.cs create mode 100644 source/Damage/Passives/DamageAatroxPassive.cs create mode 100644 source/Damage/Passives/DamageAkaliPassive.cs create mode 100644 source/Damage/Passives/DamageAkaliPassive1.cs create mode 100644 source/Damage/Passives/DamageAlistarPassive.cs create mode 100644 source/Damage/Passives/DamageAshePassive.cs create mode 100644 source/Damage/Passives/DamageAshePassive1.cs create mode 100644 source/Damage/Passives/DamageBardPassive.cs create mode 100644 source/Damage/Passives/DamageBlitzcrankPassive.cs create mode 100644 source/Damage/Passives/DamageBraumPassive.cs create mode 100644 source/Damage/Passives/DamageCaitlynPassive.cs create mode 100644 source/Damage/Passives/DamageChoGathPassive.cs create mode 100644 source/Damage/Passives/DamageDariusPassive.cs create mode 100644 source/Damage/Passives/DamageDariusPassive1.cs create mode 100644 source/Damage/Passives/DamageDianaPassive.cs create mode 100644 source/Damage/Passives/DamageDrMundoPassive.cs create mode 100644 source/Damage/Passives/DamageEkkoPassive.cs create mode 100644 source/Damage/Passives/DamageEkkoPassive1.cs create mode 100644 source/Damage/Passives/DamageFizzPassive.cs create mode 100644 source/Damage/Passives/DamageFizzPassive1.cs create mode 100644 source/Damage/Passives/DamageGarenPassive.cs create mode 100644 source/Damage/Passives/DamageGnarPassive.cs create mode 100644 source/Damage/Passives/DamageGragasPassive.cs create mode 100644 source/Damage/Passives/DamageGravesPassive.cs create mode 100644 source/Damage/Passives/DamageHecarimPassive.cs create mode 100644 source/Damage/Passives/DamageIllaoiPassive.cs create mode 100644 source/Damage/Passives/DamageIreliaPassive.cs create mode 100644 source/Damage/Passives/DamageJarvanIVPassive.cs create mode 100644 source/Damage/Passives/DamageJaxPassive.cs create mode 100644 source/Damage/Passives/DamageJaycePassive.cs create mode 100644 source/Damage/Passives/DamageJaycePassive1.cs create mode 100644 source/Damage/Passives/DamageJhinPassive.cs create mode 100644 source/Damage/Passives/DamageJhinPassive1.cs create mode 100644 source/Damage/Passives/DamageJinxPassive.cs create mode 100644 source/Damage/Passives/DamageKalistaPassive.cs create mode 100644 source/Damage/Passives/DamageKassadinPassive.cs create mode 100644 source/Damage/Passives/DamageKatarinaPassive.cs create mode 100644 source/Damage/Passives/DamageKaylePassive.cs create mode 100644 source/Damage/Passives/DamageKennenPassive.cs create mode 100644 source/Damage/Passives/DamageKogMawPassive.cs create mode 100644 source/Damage/Passives/DamageLeonaPassive.cs create mode 100644 source/Damage/Passives/DamageLucianPassive.cs create mode 100644 source/Damage/Passives/DamageLuxPassive.cs create mode 100644 source/Damage/Passives/DamageMalphitePassive.cs create mode 100644 source/Damage/Passives/DamageMasterYiPassive.cs create mode 100644 source/Damage/Passives/DamageMonkeyKingPassive.cs create mode 100644 source/Damage/Passives/DamageMordekaiserPassive.cs create mode 100644 source/Damage/Passives/DamageNasusPassive.cs create mode 100644 source/Damage/Passives/DamageNautilusPassive.cs create mode 100644 source/Damage/Passives/DamageNautilusPassive1.cs create mode 100644 source/Damage/Passives/DamageNidaleePassive.cs create mode 100644 source/Damage/Passives/DamageNocturnePassive.cs create mode 100644 source/Damage/Passives/DamageNunuPassive.cs create mode 100644 source/Damage/Passives/DamageOriannaPassive.cs create mode 100644 source/Damage/Passives/DamagePoppyPassive.cs create mode 100644 source/Damage/Passives/DamageQuinnPassive.cs create mode 100644 source/Damage/Passives/DamageRekSaiPassive.cs create mode 100644 source/Damage/Passives/DamageRenektonPassive.cs create mode 100644 source/Damage/Passives/DamageRengarPassive.cs create mode 100644 source/Damage/Passives/DamageRengarPassive1.cs create mode 100644 source/Damage/Passives/DamageRivenPassive.cs create mode 100644 source/Damage/Passives/DamageRumblePassive.cs create mode 100644 source/Damage/Passives/DamageSejuaniPassive.cs create mode 100644 source/Damage/Passives/DamageShacoPassive.cs create mode 100644 source/Damage/Passives/DamageShacoPassive1.cs create mode 100644 source/Damage/Passives/DamageShacoPassive2.cs create mode 100644 source/Damage/Passives/DamageShenPassive.cs create mode 100644 source/Damage/Passives/DamageShyvanaPassive.cs create mode 100644 source/Damage/Passives/DamageShyvanaPassive1.cs create mode 100644 source/Damage/Passives/DamageSionPassive.cs create mode 100644 source/Damage/Passives/DamageSkarnerPassive.cs create mode 100644 source/Damage/Passives/DamageSonaPassive.cs create mode 100644 source/Damage/Passives/DamageSonaPassive1.cs create mode 100644 source/Damage/Passives/DamageTahmKenchPassive.cs create mode 100644 source/Damage/Passives/DamageTalonPassive.cs create mode 100644 source/Damage/Passives/DamageTaricPassive.cs create mode 100644 source/Damage/Passives/DamageTeemoPassive.cs create mode 100644 source/Damage/Passives/DamageThreshPassive.cs create mode 100644 source/Damage/Passives/DamageTristanaPassive.cs create mode 100644 source/Damage/Passives/DamageTrundlePassive.cs create mode 100644 source/Damage/Passives/DamageTwistedFatePassive.cs create mode 100644 source/Damage/Passives/DamageTwistedFatePassive1.cs create mode 100644 source/Damage/Passives/DamageTwistedFatePassive2.cs create mode 100644 source/Damage/Passives/DamageTwistedFatePassive3.cs create mode 100644 source/Damage/Passives/DamageUdyrPassive.cs create mode 100644 source/Damage/Passives/DamageVarusPassive.cs create mode 100644 source/Damage/Passives/DamageVaynePassive.cs create mode 100644 source/Damage/Passives/DamageVaynePassive1.cs create mode 100644 source/Damage/Passives/DamageViPassive.cs create mode 100644 source/Damage/Passives/DamageViPassive1.cs create mode 100644 source/Damage/Passives/DamageViktorPassive.cs create mode 100644 source/Damage/Passives/DamageVolibearPassive.cs create mode 100644 source/Damage/Passives/DamageVolibearPassive1.cs create mode 100644 source/Damage/Passives/DamageWarwickPassive.cs create mode 100644 source/Damage/Passives/DamageXinZhaoPassive.cs create mode 100644 source/Damage/Passives/DamageYasuoPassive.cs create mode 100644 source/Damage/Passives/DamageYorickPassive.cs create mode 100644 source/Damage/Passives/DamageZedPassive.cs create mode 100644 source/Damage/Passives/DamageZiggsPassive.cs create mode 100644 source/Damage/Passives/Global/DamageBraumMarkPassive.cs create mode 100644 source/Damage/Passives/Global/DamageKalistaMarkPassive.cs create mode 100644 source/Damage/Passives/Global/DamageLeonaMarkPassive.cs create mode 100644 source/Damage/Passives/Global/DamageNamiMarkPassive.cs create mode 100644 source/Damage/Passives/IPassiveDamage.cs create mode 100644 source/Damage/Passives/IPassiveDamageMetadata.cs create mode 100644 source/Old/PermaShow.cs diff --git a/LeagueSharp.Common.ruleset b/LeagueSharp.Common.ruleset index fcd58862..2544c1f9 100644 --- a/LeagueSharp.Common.ruleset +++ b/LeagueSharp.Common.ruleset @@ -73,5 +73,8 @@ + + + \ No newline at end of file diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu index 455efc67..21646bc3 160000 --- a/external/SharpDX.Menu +++ b/external/SharpDX.Menu @@ -1 +1 @@ -Subproject commit 455efc679e3d2cdbfcd64b40e631a225ae729b63 +Subproject commit 21646bc3c31a081037df5f47fb602d2de700738b diff --git a/source/Damage/Damage.cs b/source/Damage/Damage.cs index 3c7ceb38..1999ea99 100644 --- a/source/Damage/Damage.cs +++ b/source/Damage/Damage.cs @@ -9,6 +9,8 @@ namespace LeagueSharp.Common using System.ComponentModel.Composition; using System.Linq; + using LeagueSharp.Common.Data; + /// /// Damage calculations and data. /// @@ -69,7 +71,107 @@ public double CalculateDamage(Obj_AI_Base source, Obj_AI_Base target, DamageType /// public double GetAutoAttackDamage(Obj_AI_Base source, Obj_AI_Base target, bool includePassive = false) { - return 0d; + 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)); } /// @@ -172,14 +274,397 @@ public bool IsKillable(Obj_AI_Hero source, Obj_AI_Base target, IEnumerable 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) { - return 0d; + 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) { - return 0; + 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 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/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/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj index 4a816b2e..907adc86 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -50,35 +50,35 @@ - Z:\References\clipper_library.dll + C:\Program Files (x86)\CIu4hcORW\References\clipper_library.dll - - Z:\Core\JetBrains.Annotations.dll + + C:\Program Files (x86)\CIu4hcORW\References\JetBrains.Annotations.dll True - Z:\References\LeagueSharp.dll + C:\Program Files (x86)\CIu4hcORW\References\LeagueSharp.dll - Z:\References\LeagueSharp.Data.dll + C:\Program Files (x86)\CIu4hcORW\References\LeagueSharp.Data.dll - Z:\System\LeagueSharp.Sandbox.dll + C:\Program Files (x86)\CIu4hcORW\System\LeagueSharp.Sandbox.dll - - Z:\Core\log4net.dll + + C:\Program Files (x86)\CIu4hcORW\Core\log4net.dll - Z:\Core\PlaySharp.Toolkit.dll + C:\Program Files (x86)\CIu4hcORW\Core\PlaySharp.Toolkit.dll - Z:\References\SharpDX.dll + C:\Program Files (x86)\CIu4hcORW\References\SharpDX.dll - Z:\References\SharpDX.Direct3D9.dll + C:\Program Files (x86)\CIu4hcORW\References\SharpDX.Direct3D9.dll - Z:\References\SharpDX.Menu.dll + C:\Program Files (x86)\CIu4hcORW\References\SharpDX.Menu.dll @@ -141,6 +141,7 @@ + @@ -175,6 +176,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -735,6 +840,7 @@ + @@ -812,9 +918,7 @@ - - - + diff --git a/source/LeagueSharp.Common.csproj.DotSettings b/source/LeagueSharp.Common.csproj.DotSettings index 402fcefa..c6ea5dac 100644 --- a/source/LeagueSharp.Common.csproj.DotSettings +++ b/source/LeagueSharp.Common.csproj.DotSettings @@ -2,6 +2,8 @@ True True True + True + True True True True diff --git a/source/Menu/Core/MenuItem.cs b/source/Menu/Core/MenuItem.cs index 159c5076..6a90ac6f 100644 --- a/source/Menu/Core/MenuItem.cs +++ b/source/Menu/Core/MenuItem.cs @@ -17,6 +17,12 @@ namespace LeagueSharp.Common /// public class MenuItem { + #region Fields + + private bool showItem; + + #endregion + #region Constructors and Destructors /// @@ -73,13 +79,11 @@ public string DisplayName /// /// Gets or sets the font color. /// - [Obsolete] public ColorBGRA FontColor { get; set; } /// /// Gets or sets the font style. /// - [Obsolete] public FontStyle FontStyle { get; set; } /// @@ -112,8 +116,18 @@ public string Name /// /// Gets or sets a value indicating whether to show the item. /// - [Obsolete] - public bool ShowItem { get; set; } + public bool ShowItem + { + get + { + return this.showItem; + } + + set + { + this.Show(value); + } + } /// /// Gets or sets the tag. @@ -162,9 +176,9 @@ public string Name /// /// The item instance. /// - [Obsolete] public MenuItem DontSave() { + this.MenuItemReference.IsSaveable = false; return this; } @@ -188,9 +202,29 @@ public T GetValue() /// /// Value indicating whether the item is active. /// - [Obsolete] 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; } @@ -206,9 +240,24 @@ public bool IsActive() /// /// The item instance. /// - [Obsolete] 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; } @@ -291,15 +340,16 @@ public MenuItem SetValue(T newValue) /// /// Shows the item. /// - /// + /// /// Indicates whether to show the item. /// /// /// The item instance. /// - [Obsolete] - public MenuItem Show(bool showItem = true) + public MenuItem Show(bool flag = true) { + this.MenuItemReference.IsVisible = flag; + this.showItem = flag; return this; } diff --git a/source/Menu/Items/HSLColor.cs b/source/Menu/Items/HSLColor.cs index 4b6b2512..aaeb92a7 100644 --- a/source/Menu/Items/HSLColor.cs +++ b/source/Menu/Items/HSLColor.cs @@ -169,11 +169,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 +287,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/source/Old/Data/SpellDatabase.cs b/source/Old/Data/SpellDatabase.cs index 17d14c4c..861d1d0b 100644 --- a/source/Old/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/source/Old/HealthPrediction.cs b/source/Old/HealthPrediction.cs index 6d07e9f0..c702537e 100644 --- a/source/Old/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/source/Old/Notifications.cs b/source/Old/Notifications.cs index ce728730..406e2268 100644 --- a/source/Old/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/source/Old/Notifications/Notification.cs b/source/Old/Notifications/Notification.cs index de3ef803..84cf94c1 100644 --- a/source/Old/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/source/Old/Orbwalking.cs b/source/Old/Orbwalking.cs index be76b9aa..e89f683c 100644 --- a/source/Old/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; @@ -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/source/Old/Packet.cs b/source/Old/Packet.cs index 3e1009a0..7f527a65 100644 --- a/source/Old/Packet.cs +++ b/source/Old/Packet.cs @@ -4227,7 +4227,7 @@ public static Struct Decoded(byte[] data) result.NetworkId = packet.ReadInteger(1); result.Unit = ObjectManager.GetUnitByNetworkId(result.NetworkId); - result.Slot = (SpellSlot) (packet.ReadByte()); + result.Slot = (SpellSlot)packet.ReadByte(); result.UnknownByte = packet.ReadByte(); // 0, 1C, 48 result.UnknownByte2 = packet.ReadByte(); //usually 2 result.SpellString = packet.ReadString(11); 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/source/Old/Spell.cs b/source/Old/Spell.cs index 2e4275f3..78b539bb 100644 --- a/source/Old/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 + this.Collision = spellData.CollisionObjects != null && spellData.CollisionObjects.Any( - obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions)); + 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 + this.Collision = spellData.CollisionObjects != null && spellData.CollisionObjects.Any( - obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions)); + 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/source/Old/TargetSelector.cs b/source/Old/TargetSelector.cs index ab0b50a5..714af13d 100644 --- a/source/Old/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; } } @@ -267,8 +267,8 @@ 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)) + (1 + hero.Buffs.Where(b => StackNames.Contains(b.Name.ToLower())).Sum(t => t.Count))); } diff --git a/source/Prediction/Old/AoePrediction.cs b/source/Prediction/Old/AoePrediction.cs index f56c7c59..eb632535 100644 --- a/source/Prediction/Old/AoePrediction.cs +++ b/source/Prediction/Old/AoePrediction.cs @@ -48,7 +48,7 @@ internal static List GetPossibleTargets(PredictionInput input) HeroManager.Enemies.FindAll( h => h.NetworkId != originalUnit.NetworkId - && h.IsValidTarget((input.Range + 200 + input.RealRadius), true, input.RangeCheckFrom))) + && h.IsValidTarget(input.Range + 200 + input.RealRadius, true, input.RangeCheckFrom))) { input.Unit = enemy; var prediction = Prediction.GetPrediction(input, false, false); @@ -275,7 +275,7 @@ public static PredictionOutput GetPrediction(PredictionInput input) var targetCandidates = GetCandidates( input.From.To2D(), target.Position, - (input.Radius), + input.Radius, input.Range); candidates.AddRange(targetCandidates); } @@ -291,7 +291,7 @@ public static PredictionOutput GetPrediction(PredictionInput input) GetHits( input.From.To2D(), candidate, - (input.Radius + input.Unit.BoundingRadius / 3 - 10), + 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(); @@ -371,8 +371,8 @@ internal static Vector2[] GetCandidates(Vector2 from, Vector2 to, float radius, var c1 = intersections[0]; var c2 = intersections[1]; - c1 = from + range * (to - c1).Normalized(); - c2 = from + range * (to - c2).Normalized(); + c1 = from + (range * (to - c1).Normalized()); + c2 = from + (range * (to - c2).Normalized()); return new[] { c1, c2 }; } diff --git a/source/Prediction/Old/Collision.cs b/source/Prediction/Old/Collision.cs index 17ae0183..4f1f02f6 100644 --- a/source/Prediction/Old/Collision.cs +++ b/source/Prediction/Old/Collision.cs @@ -70,7 +70,7 @@ public static List GetCollision(List positions, Prediction 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)) + <= Math.Pow(input.Radius + 15 + minion.BoundingRadius, 2)) { result.Add(minion); } @@ -89,7 +89,7 @@ public static List GetCollision(List positions, Prediction 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)) + <= Math.Pow(input.Radius + 50 + hero.BoundingRadius, 2)) { result.Add(hero); } @@ -107,7 +107,7 @@ public static List GetCollision(List positions, Prediction 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)) + <= Math.Pow(input.Radius + 50 + hero.BoundingRadius, 2)) { result.Add(hero); } @@ -151,18 +151,18 @@ public static List GetCollision(List positions, Prediction break; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); - var wallWidth = (300 + 50 * Convert.ToInt32(level)); + 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; + 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; + + (((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); diff --git a/source/Prediction/Old/Prediction.cs b/source/Prediction/Old/Prediction.cs index 510d61ec..cdd5c704 100644 --- a/source/Prediction/Old/Prediction.cs +++ b/source/Prediction/Old/Prediction.cs @@ -138,9 +138,9 @@ internal static PredictionOutput GetDashingPrediction(PredictionInput input) //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; + 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) + <= (input.Unit.Distance(endP) / dashData.Speed) + (input.RealRadius / input.Unit.MoveSpeed)) { return new PredictionOutput { @@ -167,9 +167,9 @@ internal static PredictionOutput GetDashingPrediction(PredictionInput input) /// PredictionOutput. internal static PredictionOutput GetImmobilePrediction(PredictionInput input, double remainingImmobileT) { - var timeToReachTargetPosition = input.Delay + input.Unit.Distance(input.From) / input.Speed; + var timeToReachTargetPosition = input.Delay + (input.Unit.Distance(input.From) / input.Speed); - if (timeToReachTargetPosition <= remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed) + if (timeToReachTargetPosition <= remainingImmobileT + (input.RealRadius / input.Unit.MoveSpeed)) { return new PredictionOutput { @@ -209,10 +209,10 @@ internal static PredictionOutput GetPositionOnPath(PredictionInput input, List= input.Delay * speed - input.RealRadius + if (pLength >= (input.Delay * speed) - input.RealRadius && Math.Abs(input.Speed - float.MaxValue) < float.Epsilon) { - var tDistance = input.Delay * speed - input.RealRadius; + var tDistance = (input.Delay * speed) - input.RealRadius; for (var i = 0; i < path.Count - 1; i++) { @@ -224,12 +224,12 @@ internal static PredictionOutput GetPositionOnPath(PredictionInput input, List= input.Delay * speed - input.RealRadius + if (pLength >= (input.Delay * speed) - input.RealRadius && Math.Abs(input.Speed - float.MaxValue) > float.Epsilon) { - var d = input.Delay * speed - input.RealRadius; + 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) @@ -266,15 +266,19 @@ internal static PredictionOutput GetPositionOnPath(PredictionInput input, List= tT && t <= tT + tB) { - if (pos.Distance(b, true) < 20) break; - var p = pos + input.RealRadius * direction; + if (pos.Distance(b, true) < 20) + { + break; + } + + var p = pos + (input.RealRadius * direction); if (input.Type == SkillshotType.SkillshotLine && false) { @@ -329,7 +333,7 @@ internal static PredictionOutput GetPrediction(PredictionInput input, bool ft, b if (ft) { //Increase the delay due to the latency and server tick: - input.Delay += Game.Ping / 2000f + 0.06f; + input.Delay += (Game.Ping / 2000f) + 0.06f; if (input.Aoe) { @@ -375,7 +379,7 @@ internal static PredictionOutput GetPrediction(PredictionInput input, bool ft, b { if (result.Hitchance >= HitChance.High && input.RangeCheckFrom.Distance(input.Unit.Position, true) - > Math.Pow(input.Range + input.RealRadius * 3 / 4, 2)) + > Math.Pow(input.Range + (input.RealRadius * 3 / 4), 2)) { result.Hitchance = HitChance.Medium; } @@ -391,8 +395,8 @@ internal static PredictionOutput GetPrediction(PredictionInput input, bool ft, b if (result.Hitchance != HitChance.OutOfRange) { result.CastPosition = input.RangeCheckFrom - + input.Range - * (result.UnitPosition - input.RangeCheckFrom).To2D().Normalized().To3D(); + + (input.Range + * (result.UnitPosition - input.RangeCheckFrom).To2D().Normalized().To3D()); } else { @@ -452,7 +456,7 @@ internal static double UnitIsImmobileUntil(Obj_AI_Base unit) && (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); + return result - Game.Time; } #endregion diff --git a/source/Render/RenderObject.cs b/source/Render/RenderObject.cs index cb069833..4a123585 100644 --- a/source/Render/RenderObject.cs +++ b/source/Render/RenderObject.cs @@ -159,9 +159,9 @@ public virtual void OnPreReset() /// internal void SubscribeToResetEvents() { - /*Drawing.OnPreReset += this.DrawingOnOnPreReset; + Drawing.OnPreReset += this.DrawingOnOnPreReset; Drawing.OnPostReset += this.DrawingOnOnPostReset; - AppDomain.CurrentDomain.DomainUnload += this.CurrentDomainOnDomainUnload;*/ + AppDomain.CurrentDomain.DomainUnload += this.CurrentDomainOnDomainUnload; } /// @@ -177,9 +177,9 @@ protected virtual void Dispose(bool disposing) return; } - /*Drawing.OnPreReset -= this.DrawingOnOnPreReset; + Drawing.OnPreReset -= this.DrawingOnOnPreReset; Drawing.OnPostReset -= this.DrawingOnOnPostReset; - AppDomain.CurrentDomain.DomainUnload -= this.CurrentDomainOnDomainUnload;*/ + AppDomain.CurrentDomain.DomainUnload -= this.CurrentDomainOnDomainUnload; this.IsDisposed = true; } diff --git a/source/Render/Sprite.cs b/source/Render/Sprite.cs index d6e47413..02f759d8 100644 --- a/source/Render/Sprite.cs +++ b/source/Render/Sprite.cs @@ -313,8 +313,12 @@ public override void OnEndScene() 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); + this.DeviceSprite.Draw(this.Texture, this.Color, this.SpriteCrop, rotation); this.DeviceSprite.Transform = matrix; this.DeviceSprite.End(); diff --git a/source/Utility/Utility.cs b/source/Utility/Utility.cs index ca4d37b0..e044e43c 100644 --- a/source/Utility/Utility.cs +++ b/source/Utility/Utility.cs @@ -775,6 +775,22 @@ public static bool IsFacing(this Obj_AI_Base source, Obj_AI_Base target) < 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. /// From 8502f76553c0f9f7ba6c089ee3496865376381eb Mon Sep 17 00:00:00 2001 From: L33T Date: Wed, 19 Oct 2016 21:44:14 +0300 Subject: [PATCH 05/11] + submodule update to latest menu. --- external/SharpDX.Menu | 2 +- source/LeagueSharp.Common.csproj | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu index 21646bc3..e1f0dcc1 160000 --- a/external/SharpDX.Menu +++ b/external/SharpDX.Menu @@ -1 +1 @@ -Subproject commit 21646bc3c31a081037df5f47fb602d2de700738b +Subproject commit e1f0dcc1ef57e0187d298e1055e982e3efb5858e diff --git a/source/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj index 907adc86..ed1c4aad 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -50,35 +50,35 @@ - C:\Program Files (x86)\CIu4hcORW\References\clipper_library.dll + Z:\References\clipper_library.dll - C:\Program Files (x86)\CIu4hcORW\References\JetBrains.Annotations.dll + Z:\References\JetBrains.Annotations.dll True - C:\Program Files (x86)\CIu4hcORW\References\LeagueSharp.dll + Z:\References\LeagueSharp.dll - C:\Program Files (x86)\CIu4hcORW\References\LeagueSharp.Data.dll + Z:\References\LeagueSharp.Data.dll - C:\Program Files (x86)\CIu4hcORW\System\LeagueSharp.Sandbox.dll + Z:\System\LeagueSharp.Sandbox.dll - C:\Program Files (x86)\CIu4hcORW\Core\log4net.dll + Z:\Core\log4net.dll - C:\Program Files (x86)\CIu4hcORW\Core\PlaySharp.Toolkit.dll + Z:\Core\PlaySharp.Toolkit.dll - C:\Program Files (x86)\CIu4hcORW\References\SharpDX.dll + Z:\References\SharpDX.dll - C:\Program Files (x86)\CIu4hcORW\References\SharpDX.Direct3D9.dll + Z:\References\SharpDX.Direct3D9.dll - C:\Program Files (x86)\CIu4hcORW\References\SharpDX.Menu.dll + Z:\References\SharpDX.Menu.dll From cd1b6a7f1d1cbd1042abd2d3c9eb779d0dd42490 Mon Sep 17 00:00:00 2001 From: L33T Date: Wed, 19 Oct 2016 23:54:15 +0300 Subject: [PATCH 06/11] + fixing improper loading of menu items, adding value change event trigger to the wrapper to support old API, create damages properly. --- external/SharpDX.Menu | 2 +- source/LeagueSharp.Common.csproj | 2 +- source/Library.cs | 6 +++++- source/Menu/Components/Circle.cs | 15 ++++++++++++- source/Menu/Components/KeyBind.cs | 15 ++++++++++++- source/Menu/Configuration/MenuManager.cs | 27 ++++++++++-------------- source/Menu/Core/MenuItem.cs | 23 ++++++++++++++++++++ source/Old/Hacks.cs | 4 ++++ source/Old/Spell.cs | 10 ++++----- 9 files changed, 78 insertions(+), 26 deletions(-) diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu index e1f0dcc1..c45384b6 160000 --- a/external/SharpDX.Menu +++ b/external/SharpDX.Menu @@ -1 +1 @@ -Subproject commit e1f0dcc1ef57e0187d298e1055e982e3efb5858e +Subproject commit c45384b621d02e1ffd912333d1d1460e60f0dc73 diff --git a/source/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj index ed1c4aad..87306bb8 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -9,7 +9,7 @@ Properties LeagueSharp.Common LeagueSharp.Common - v4.5.2 + v4.5 512 true diff --git a/source/Library.cs b/source/Library.cs index 92f52815..88b050d6 100644 --- a/source/Library.cs +++ b/source/Library.cs @@ -7,7 +7,6 @@ namespace LeagueSharp.Common using System; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; - using System.Diagnostics; using System.Globalization; using System.Security.Permissions; using System.Text; @@ -41,11 +40,16 @@ public void Configure(CompositionContainer container) { ExpandConsole(); CreateInstances(container); + + Instances.Damage.SortSpells(); } /// public void Unload() { + Instances.MenuManager.SaveAll(); + Render.Terminate(); + Render.Circle.Dispose(this, EventArgs.Empty); } #endregion diff --git a/source/Menu/Components/Circle.cs b/source/Menu/Components/Circle.cs index e203c2ea..c4be4415 100644 --- a/source/Menu/Components/Circle.cs +++ b/source/Menu/Components/Circle.cs @@ -7,11 +7,13 @@ 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 + public class Circle : IUpdateableValue { #region Constructors and Destructors @@ -64,5 +66,16 @@ public Circle() 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 index 9db464ab..9280c593 100644 --- a/source/Menu/Components/KeyBind.cs +++ b/source/Menu/Components/KeyBind.cs @@ -6,11 +6,13 @@ namespace LeagueSharp.Common { using System.Runtime.Serialization; + using SharpDX.Menu; + /// /// The menu keybind. /// [DataContract] - public class KeyBind + public class KeyBind : IUpdateableValue { #region Constructors and Destructors @@ -92,5 +94,16 @@ public KeyBind() 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/source/Menu/Configuration/MenuManager.cs b/source/Menu/Configuration/MenuManager.cs index c5a6d8dc..ccc8b2b0 100644 --- a/source/Menu/Configuration/MenuManager.cs +++ b/source/Menu/Configuration/MenuManager.cs @@ -15,22 +15,6 @@ namespace LeagueSharp.Common.Configuration /// public class MenuManager : IPartImportsSatisfiedNotification { - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - public MenuManager() - { - /* - TargetSelector.Initialize(); - Prediction.Initialize(); - Hacks.Initialize(); - FakeClicks.Initialize();*/ - } - - #endregion - #region Public Properties /// @@ -65,6 +49,17 @@ public void OnImportsSatisfied() Hacks.Initialize(this.Menu); } + /// + /// Saves all existing menus. + /// + public void SaveAll() + { + foreach (var menu in this.MenuFactory.MenuCollection.Values) + { + menu.SaveComponents(); + } + } + #endregion } } \ No newline at end of file diff --git a/source/Menu/Core/MenuItem.cs b/source/Menu/Core/MenuItem.cs index 6a90ac6f..abf3323e 100644 --- a/source/Menu/Core/MenuItem.cs +++ b/source/Menu/Core/MenuItem.cs @@ -5,6 +5,7 @@ namespace LeagueSharp.Common { using System; + using System.ComponentModel; using System.Drawing; using SharpDX; @@ -325,13 +326,20 @@ public MenuItem SetValue(T newValue) { this.ValueSet = true; this.MenuItemReference = ComponentFactory.CreateItem(this.Name, this.DisplayName, newValue); + this.MenuItemReference.PropertyChanged += this.OnPropertyChanged; return this; } var oldObject = this.MenuItemReference as IMenuItem; var oldValue = oldObject != null ? oldObject.Value : default(T); + if (this.MenuItemReference != null) + { + this.MenuItemReference.PropertyChanged -= this.OnPropertyChanged; + } + this.MenuItemReference = new MenuItem(this.Name, this.DisplayName, newValue); + this.MenuItemReference.PropertyChanged += this.OnPropertyChanged; this.ValueChanged?.Invoke(this, new OnValueChangeEventArgs(oldValue, newValue) { MenuItemReference = this }); return this; @@ -402,5 +410,20 @@ public bool TypeOf() } #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.GetValueObject()) + { MenuItemReference = this }); + } + } + + #endregion } } \ No newline at end of file diff --git a/source/Old/Hacks.cs b/source/Old/Hacks.cs index 4d5d8185..5fc563dd 100644 --- a/source/Old/Hacks.cs +++ b/source/Old/Hacks.cs @@ -1,5 +1,7 @@ namespace LeagueSharp.Common { + using System; + /// /// Adds hacks to the menu. /// @@ -159,6 +161,8 @@ internal static void Initialize(Menu commonMenu) LeagueSharp.Hacks.DisableDrawings = true; } }; + + Console.WriteLine(AntiAFK); } #endregion diff --git a/source/Old/Spell.cs b/source/Old/Spell.cs index 78b539bb..4445f1c8 100644 --- a/source/Old/Spell.cs +++ b/source/Old/Spell.cs @@ -128,8 +128,8 @@ public Spell(SpellSlot slot, bool useSpellDbValues) ? 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); + && spellData.CollisionObjects.Any( + obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions); this.Speed = spellData.MissileSpeed; this.IsChargedSpell = true; this.Type = SpellDatabase.GetSkillshotTypeFromSpellType(spellData.SpellType); @@ -144,8 +144,8 @@ public Spell(SpellSlot slot, bool useSpellDbValues) ? 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); + && spellData.CollisionObjects.Any( + obj => obj == LeagueSharp.Data.Enumerations.CollisionableObjects.Minions); this.Speed = spellData.MissileSpeed; this.IsSkillshot = true; this.Type = SpellDatabase.GetSkillshotTypeFromSpellType(spellData.SpellType); @@ -413,7 +413,7 @@ public float Range + Math.Min( this.ChargedMaxRange - this.ChargedMinRange, ((Utils.TickCount - this._chargedCastedT) * (this.ChargedMaxRange - this.ChargedMinRange) - / this.ChargeDuration) - 150); + / this.ChargeDuration) - 150); } return this.ChargedMaxRange; From 02ff164ddda30f83954ce10f135e2ff3921f5521 Mon Sep 17 00:00:00 2001 From: L33T Date: Thu, 20 Oct 2016 15:35:50 +0300 Subject: [PATCH 07/11] + new string list view, view fixes, package retarget. --- App.config | 14 ++- source/LeagueSharp.Common.csproj | 11 +- source/Menu/Components/StringList.cs | 20 ++-- source/Menu/View/BoolView.cs | 6 +- source/Menu/View/CircleView.cs | 4 +- source/Menu/View/ComponentView.cs | 2 +- source/Menu/View/DxColorView.cs | 6 +- source/Menu/View/KeybindView.cs | 2 +- source/Menu/View/MenuView.cs | 4 +- source/Menu/View/SharedView.cs | 32 ++++++ source/Menu/View/SliderBoolView.cs | 4 +- source/Menu/View/SliderView.cs | 4 +- source/Menu/View/StringListView.cs | 149 ++++++++++++++++++++++----- source/Menu/View/SystemColorView.cs | 4 +- source/packages.config | 5 +- 15 files changed, 204 insertions(+), 63 deletions(-) diff --git a/App.config b/App.config index 88fa4027..eb3a5db3 100644 --- a/App.config +++ b/App.config @@ -1,6 +1,18 @@ - + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj index 87306bb8..4f272bcf 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -53,7 +53,7 @@ Z:\References\clipper_library.dll - Z:\References\JetBrains.Annotations.dll + ..\packages\JetBrains.Annotations.10.2.1\lib\net\JetBrains.Annotations.dll True @@ -66,7 +66,12 @@ Z:\System\LeagueSharp.Sandbox.dll - Z:\Core\log4net.dll + ..\packages\log4net.2.0.5\lib\net45-full\log4net.dll + True + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + True Z:\Core\PlaySharp.Toolkit.dll @@ -901,7 +906,6 @@ - @@ -915,6 +919,7 @@ + diff --git a/source/Menu/Components/StringList.cs b/source/Menu/Components/StringList.cs index 67c13612..c71c9d68 100644 --- a/source/Menu/Components/StringList.cs +++ b/source/Menu/Components/StringList.cs @@ -13,22 +13,12 @@ namespace LeagueSharp.Common /// The string list component container. /// [DataContract] - public struct StringList : IUpdateableValue + public class StringList : IUpdateableValue { - #region Fields - - /// - /// The selected index. - /// - [DataMember] - public int SelectedIndex; - - #endregion - #region Constructors and Destructors /// - /// Initializes a new instance of the struct.c + /// Initializes a new instance of the class. /// /// /// The items. @@ -51,6 +41,12 @@ public StringList(string[] items, int defaultIndex = 0) /// public string[] Items { get; } + /// + /// Gets or sets the selected index. + /// + [DataMember] + public int SelectedIndex { get; set; } + /// /// Gets the selected value. /// diff --git a/source/Menu/View/BoolView.cs b/source/Menu/View/BoolView.cs index 3579b0d4..6bb1bf16 100644 --- a/source/Menu/View/BoolView.cs +++ b/source/Menu/View/BoolView.cs @@ -92,7 +92,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } @@ -123,7 +123,7 @@ public override void OnUpdate() /// public override void OnWindowProc(uint message, uint wParam, long lParam) { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } @@ -190,7 +190,7 @@ private void CreateContext() using (var graphics = Graphics.FromImage(bitmap)) { SharedView.CreateBackgroundView(graphics, 0, 0, width, height); - SharedView.CreateTitle(graphics, 0, 0, width, height, title, viewAttributes); + SharedView.CreateTitle(graphics, 0, 0, width - height - 5, height, title, viewAttributes); } if (this.sprite == null) diff --git a/source/Menu/View/CircleView.cs b/source/Menu/View/CircleView.cs index 49ff0e32..46ae4706 100644 --- a/source/Menu/View/CircleView.cs +++ b/source/Menu/View/CircleView.cs @@ -121,7 +121,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } @@ -164,7 +164,7 @@ public override void OnUpdate() /// public override void OnWindowProc(uint message, uint wParam, long lParam) { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/Menu/View/ComponentView.cs b/source/Menu/View/ComponentView.cs index acc34146..df393cf1 100644 --- a/source/Menu/View/ComponentView.cs +++ b/source/Menu/View/ComponentView.cs @@ -82,7 +82,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/Menu/View/DxColorView.cs b/source/Menu/View/DxColorView.cs index 6cd4a715..5ef148d2 100644 --- a/source/Menu/View/DxColorView.cs +++ b/source/Menu/View/DxColorView.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) LeagueSharp. All rights reserved. // @@ -117,7 +117,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } @@ -147,7 +147,7 @@ public override void OnUpdate() /// public override void OnWindowProc(uint message, uint wParam, long lParam) { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/Menu/View/KeybindView.cs b/source/Menu/View/KeybindView.cs index d23b1a55..fc2f602c 100644 --- a/source/Menu/View/KeybindView.cs +++ b/source/Menu/View/KeybindView.cs @@ -96,7 +96,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/Menu/View/MenuView.cs b/source/Menu/View/MenuView.cs index 7678940d..d2ec4198 100644 --- a/source/Menu/View/MenuView.cs +++ b/source/Menu/View/MenuView.cs @@ -51,7 +51,7 @@ internal MenuView() /// ~MenuView() { - this.sprite.Bitmap?.Dispose(); + this.sprite?.Bitmap?.Dispose(); } #endregion @@ -82,7 +82,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/Menu/View/SharedView.cs b/source/Menu/View/SharedView.cs index 20ae5e18..baa95b2a 100644 --- a/source/Menu/View/SharedView.cs +++ b/source/Menu/View/SharedView.cs @@ -49,6 +49,38 @@ public static void CreateBackgroundView(Graphics graphics, float x, float y, flo } } + /// + /// 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. /// diff --git a/source/Menu/View/SliderBoolView.cs b/source/Menu/View/SliderBoolView.cs index 70f833cb..2c5a8d17 100644 --- a/source/Menu/View/SliderBoolView.cs +++ b/source/Menu/View/SliderBoolView.cs @@ -94,7 +94,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } @@ -121,7 +121,7 @@ public override void OnUpdate() /// public override void OnWindowProc(uint message, uint wParam, long lParam) { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/Menu/View/SliderView.cs b/source/Menu/View/SliderView.cs index 8c355dfc..908a9333 100644 --- a/source/Menu/View/SliderView.cs +++ b/source/Menu/View/SliderView.cs @@ -92,7 +92,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } @@ -119,7 +119,7 @@ public override void OnUpdate() /// public override void OnWindowProc(uint message, uint wParam, long lParam) { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/Menu/View/StringListView.cs b/source/Menu/View/StringListView.cs index 9e0ce096..cfc417cd 100644 --- a/source/Menu/View/StringListView.cs +++ b/source/Menu/View/StringListView.cs @@ -5,7 +5,6 @@ namespace LeagueSharp.Common.View { using System; - using System.Collections.Generic; using System.ComponentModel.Composition; using System.Drawing; @@ -21,6 +20,16 @@ namespace LeagueSharp.Common.View [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 /// @@ -48,10 +57,7 @@ internal StringListView() /// ~StringListView() { - foreach (var sprite in this.Sprites.Values) - { - sprite?.Bitmap?.Dispose(); - } + this.sprite?.Bitmap?.Dispose(); } #endregion @@ -67,7 +73,9 @@ internal StringListView() #region Properties - private IDictionary Sprites { get; } = new Dictionary(); + private float BorderWidth { get; set; } + + private float TitleWidth { get; set; } #endregion @@ -88,13 +96,19 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } - this.Sprites[this.Component.Value.SelectedIndex].Position = this.Component.Position; - this.Sprites[this.Component.Value.SelectedIndex].OnEndScene(); + if (this.updateContext) + { + this.CreateContext(); + this.updateContext = false; + } + + this.sprite.Position = this.Component.Position; + this.sprite.OnEndScene(); } /// @@ -105,6 +119,44 @@ 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.updateContext = true; + } + } + + break; + } } #endregion @@ -113,34 +165,75 @@ public override void OnWindowProc(uint message, uint wParam, long lParam) 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 viewAttributes = new ViewAttributes(this); - for (var i = 0; i < this.Component.Value.Items.Length; ++i) + 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)) { - var bitmap = new Bitmap((int)Math.Round(width) + 1, (int)Math.Round(height) + 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) { - var boxSize = (height / 2) + 5; - var title = $"{this.Component.DisplayName}: {this.Component.Value.Items[i]}"; - var color = Color.FromArgb(255, 20, 90, 175); - - SharedView.CreateBackgroundView(graphics, 0, 0, width, height); - SharedView.CreateTitle(graphics, boxSize, 0, width - boxSize, height, title, viewAttributes); - SharedView.CreateBox(graphics, 5, 5, height / 2, height - 10, color, "<"); - SharedView.CreateBox(graphics, width - boxSize, 5, height / 2, height - 10, color, ">"); + 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); + } } + } - this.Sprites[i] = new Render.Sprite(bitmap, default(Vector2)); + if (this.sprite == null) + { + this.sprite = new Render.Sprite(bitmap, default(Vector2)); + return; } + + this.sprite.UpdateTextureBitmap(bitmap); } #endregion diff --git a/source/Menu/View/SystemColorView.cs b/source/Menu/View/SystemColorView.cs index 9a610101..9a4f500b 100644 --- a/source/Menu/View/SystemColorView.cs +++ b/source/Menu/View/SystemColorView.cs @@ -117,7 +117,7 @@ public override void OnAttributeChange() /// public override void OnDraw() { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } @@ -147,7 +147,7 @@ public override void OnUpdate() /// public override void OnWindowProc(uint message, uint wParam, long lParam) { - if (this.Component == null) + if (this.Component == null || !this.Component.IsVisible) { return; } diff --git a/source/packages.config b/source/packages.config index 9eb644ac..286a744c 100644 --- a/source/packages.config +++ b/source/packages.config @@ -1,4 +1,7 @@  - + + + + \ No newline at end of file From ca4054498913221ec8ebe6e12b8243df8285cfb2 Mon Sep 17 00:00:00 2001 From: L33T Date: Sat, 22 Oct 2016 14:49:07 +0300 Subject: [PATCH 08/11] + nuget reallocation, submodule update, hacks menu fixes. --- external/SharpDX.Menu | 2 +- nuget.config | 6 ++ packages.config | 4 - source/LeagueSharp.Common.csproj | 14 +-- source/Native/Hacks.cs | 151 +++++++++++++++++++++++++++ source/Old/Hacks.cs | 170 ------------------------------- 6 files changed, 165 insertions(+), 182 deletions(-) create mode 100644 nuget.config delete mode 100644 packages.config create mode 100644 source/Native/Hacks.cs delete mode 100644 source/Old/Hacks.cs diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu index c45384b6..f04eac31 160000 --- a/external/SharpDX.Menu +++ b/external/SharpDX.Menu @@ -1 +1 @@ -Subproject commit c45384b621d02e1ffd912333d1d1460e60f0dc73 +Subproject commit f04eac313f64087d2bc504ca0f227e9fc01a87f6 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/packages.config b/packages.config deleted file mode 100644 index 719f545c..00000000 --- a/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/source/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj index 4f272bcf..8fbb7ada 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -53,7 +53,7 @@ Z:\References\clipper_library.dll - ..\packages\JetBrains.Annotations.10.2.1\lib\net\JetBrains.Annotations.dll + packages\JetBrains.Annotations.10.2.1\lib\net\JetBrains.Annotations.dll True @@ -66,11 +66,11 @@ Z:\System\LeagueSharp.Sandbox.dll - ..\packages\log4net.2.0.5\lib\net45-full\log4net.dll + packages\log4net.2.0.5\lib\net45-full\log4net.dll True - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True @@ -821,6 +821,7 @@ Component + @@ -829,7 +830,6 @@ - @@ -908,9 +908,9 @@ - - - + + + diff --git a/source/Native/Hacks.cs b/source/Native/Hacks.cs new file mode 100644 index 00000000..286936e1 --- /dev/null +++ b/source/Native/Hacks.cs @@ -0,0 +1,151 @@ +// +// 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 + { + 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 + { + 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 + { + 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 + { + LeagueSharp.Hacks.TowerRanges = value; + } + } + + #endregion + + #region Properties + + 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(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); + } + + #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; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/source/Old/Hacks.cs b/source/Old/Hacks.cs deleted file mode 100644 index 5fc563dd..00000000 --- a/source/Old/Hacks.cs +++ /dev/null @@ -1,170 +0,0 @@ -namespace LeagueSharp.Common -{ - using System; - - /// - /// 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; - - #endregion - - #region Public Properties - - 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 - - internal static void Initialize(Menu commonMenu) - { - 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.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; - } - }; - - Console.WriteLine(AntiAFK); - } - - #endregion - } -} \ No newline at end of file From f67ed8f6164ad5f91e1b632968d61405217ff54e Mon Sep 17 00:00:00 2001 From: L33T Date: Sat, 22 Oct 2016 21:24:54 +0300 Subject: [PATCH 09/11] + hero manager fixes, string list hides after value selection, fixing critical bug with applying new value to an item, wrapping support for hacks. --- external/SharpDX.Menu | 2 +- source/LeagueSharp.Common.csproj | 4 +- source/Menu/Configuration/MenuController.cs | 21 ++++++- source/Menu/Core/MenuItem.cs | 61 ++++++++++----------- source/Menu/OnValueChangeEventArgs.cs | 5 -- source/Menu/View/StringListView.cs | 1 + source/Native/Hacks.cs | 20 +++++-- source/Native/HeroManager.cs | 26 +++------ source/packages.config | 2 +- 9 files changed, 77 insertions(+), 65 deletions(-) diff --git a/external/SharpDX.Menu b/external/SharpDX.Menu index f04eac31..0c667ef1 160000 --- a/external/SharpDX.Menu +++ b/external/SharpDX.Menu @@ -1 +1 @@ -Subproject commit f04eac313f64087d2bc504ca0f227e9fc01a87f6 +Subproject commit 0c667ef1721ca7c374c8fa58690e16990466dce8 diff --git a/source/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj index 8fbb7ada..a0d44fa0 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -69,8 +69,8 @@ packages\log4net.2.0.5\lib\net45-full\log4net.dll True - - packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True diff --git a/source/Menu/Configuration/MenuController.cs b/source/Menu/Configuration/MenuController.cs index 1d4fd362..a54f50b1 100644 --- a/source/Menu/Configuration/MenuController.cs +++ b/source/Menu/Configuration/MenuController.cs @@ -9,12 +9,20 @@ namespace LeagueSharp.Common.Configuration 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 /// @@ -36,7 +44,18 @@ public MenuController() public float ComponentWidth { get; } = 180; /// - public bool IsVisible { get; private set; } = true; + public bool IsVisible + { + get + { + return this.isVisible && !Hacks.DisableDrawings; + } + + private set + { + this.isVisible = value; + } + } /// public Vector2 Position { get; } = new Vector2(10, 10); diff --git a/source/Menu/Core/MenuItem.cs b/source/Menu/Core/MenuItem.cs index abf3323e..e82980bd 100644 --- a/source/Menu/Core/MenuItem.cs +++ b/source/Menu/Core/MenuItem.cs @@ -94,20 +94,9 @@ public string DisplayName public int MenuFontSize { get; set; } /// - /// Gets or sets the name. + /// Gets the name. /// - public string Name - { - get - { - return this.MenuItemReference.Name; - } - - set - { - // TODO: Log? - } - } + public string Name => this.MenuItemReference.Name; /// /// Gets or sets the parent. @@ -154,9 +143,10 @@ public bool ShowItem public int TooltipDuration => 0; /// - /// Gets a value indicating whether the value was set. + /// Gets or sets a value indicating whether the value was set. /// - public bool ValueSet { get; private set; } + [Obsolete] + public bool ValueSet { get; set; } #endregion @@ -268,9 +258,9 @@ public MenuItem SetFontStyle(FontStyle fontStyle = FontStyle.Regular, Color? fon /// /// The item instance. /// - [Obsolete] public MenuItem SetShared() { + this.MenuItemReference.IsShared = true; return this; } @@ -283,7 +273,6 @@ public MenuItem SetShared() /// /// The item instance. /// - [Obsolete("Use Tag Property.")] public MenuItem SetTag(int tag = 0) { this.Tag = tag; @@ -322,25 +311,32 @@ public MenuItem SetTooltip(string tooltip, Color? tooltipColor = null) /// public MenuItem SetValue(T newValue) { - if (!this.ValueSet) + if (newValue.GetType() == this.MenuItemReference.ValueType) { - this.ValueSet = true; - this.MenuItemReference = ComponentFactory.CreateItem(this.Name, this.DisplayName, newValue); - this.MenuItemReference.PropertyChanged += this.OnPropertyChanged; - return this; + 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); - var oldObject = this.MenuItemReference as IMenuItem; - var oldValue = oldObject != null ? oldObject.Value : default(T); + newItem.IsShared = oldItem.IsShared; + newItem.IsSaveable = oldItem.IsSaveable; + this.MenuItemReference = newItem; - if (this.MenuItemReference != null) - { - this.MenuItemReference.PropertyChanged -= this.OnPropertyChanged; - } + oldItem.PropertyChanged -= this.OnPropertyChanged; + newItem.PropertyChanged += this.OnPropertyChanged; - this.MenuItemReference = new MenuItem(this.Name, this.DisplayName, newValue); - this.MenuItemReference.PropertyChanged += this.OnPropertyChanged; - this.ValueChanged?.Invoke(this, new OnValueChangeEventArgs(oldValue, newValue) { MenuItemReference = this }); + if (oldItem.Parent != null) + { + oldItem.Parent[oldItem.Name] = newItem; + } + + this.ValueChanged?.Invoke(this, new OnValueChangeEventArgs(null, newValue)); + } return this; } @@ -419,8 +415,7 @@ private void OnPropertyChanged(object sender, PropertyChangedEventArgs propertyC { this.ValueChanged?.Invoke( this, - new OnValueChangeEventArgs(null, this.MenuItemReference.GetValueObject()) - { MenuItemReference = this }); + new OnValueChangeEventArgs(null, this.MenuItemReference.GetValue())); } } diff --git a/source/Menu/OnValueChangeEventArgs.cs b/source/Menu/OnValueChangeEventArgs.cs index 4650a62e..c2a7c0ef 100644 --- a/source/Menu/OnValueChangeEventArgs.cs +++ b/source/Menu/OnValueChangeEventArgs.cs @@ -52,11 +52,6 @@ public OnValueChangeEventArgs(object oldValue, object newValue) #region Properties - /// - /// Gets or sets the menu item reference. - /// - internal MenuItem MenuItemReference { get; set; } - #endregion #region Public Methods and Operators diff --git a/source/Menu/View/StringListView.cs b/source/Menu/View/StringListView.cs index cfc417cd..cc697c7e 100644 --- a/source/Menu/View/StringListView.cs +++ b/source/Menu/View/StringListView.cs @@ -151,6 +151,7 @@ public override void OnWindowProc(uint message, uint wParam, long lParam) height * this.Component.Value.Items.Length)) { this.Component.Value.SelectedIndex = (int)((cursor.Y - this.Component.Position.Y) / height); + this.isPicking = false; this.updateContext = true; } } diff --git a/source/Native/Hacks.cs b/source/Native/Hacks.cs index 286936e1..69e7399f 100644 --- a/source/Native/Hacks.cs +++ b/source/Native/Hacks.cs @@ -25,7 +25,10 @@ public static bool AntiAfk set { - LeagueSharp.Hacks.AntiAFK = value; + if (AntiAfk != value) + { + LeagueSharp.Hacks.AntiAFK = value; + } } } @@ -41,7 +44,10 @@ public static bool DisableDrawings set { - LeagueSharp.Hacks.DisableDrawings = value; + if (DisableDrawings != value) + { + LeagueSharp.Hacks.DisableDrawings = value; + } } } @@ -57,7 +63,10 @@ public static bool DisableSay set { - LeagueSharp.Hacks.DisableSay = value; + if (DisableSay != value) + { + LeagueSharp.Hacks.DisableSay = value; + } } } @@ -73,7 +82,10 @@ public static bool TowerRanges set { - LeagueSharp.Hacks.TowerRanges = value; + if (TowerRanges != value) + { + LeagueSharp.Hacks.TowerRanges = value; + } } } diff --git a/source/Native/HeroManager.cs b/source/Native/HeroManager.cs index f7d1cd08..9b12c58b 100644 --- a/source/Native/HeroManager.cs +++ b/source/Native/HeroManager.cs @@ -4,7 +4,6 @@ namespace LeagueSharp.Common { - using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; @@ -22,7 +21,10 @@ public class HeroManager /// public HeroManager() { - CustomEvents.Game.OnGameLoad += this.OnGameLoad; + 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 @@ -66,34 +68,22 @@ public HeroManager() /// /// Gets all of the heroes. /// - public List All { get; private set; } + public List All { get; } /// /// Gets all of the ally heroes. /// - public List Ally { get; private set; } + public List Ally { get; } /// /// Gets all of the enemies. /// - public List Enemy { get; private set; } + public List Enemy { get; } /// /// Gets the local player /// - public Obj_AI_Hero LocalPlayer { get; private set; } - - #endregion - - #region Methods - - private void OnGameLoad(EventArgs eventArgs) - { - 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); - } + public Obj_AI_Hero LocalPlayer { get; } #endregion } diff --git a/source/packages.config b/source/packages.config index 286a744c..e578b38d 100644 --- a/source/packages.config +++ b/source/packages.config @@ -2,6 +2,6 @@ - + \ No newline at end of file From a482babd72df790d259acc4cdb2b49ef34b313dd Mon Sep 17 00:00:00 2001 From: L33T Date: Mon, 24 Oct 2016 18:23:08 +0300 Subject: [PATCH 10/11] + nuget update, using core files provided by platform, enable using menu on disable drawings. --- source/LeagueSharp.Common.csproj | 11 ++++------- source/Library.cs | 7 +++++++ source/Menu/Items/HSLColor.cs | 1 + source/Menu/OnValueChangeEventArgs.cs | 6 +++++- source/Native/Hacks.cs | 20 +++++++++++++++++++- source/packages.config | 3 --- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/source/LeagueSharp.Common.csproj b/source/LeagueSharp.Common.csproj index a0d44fa0..2564c8e8 100644 --- a/source/LeagueSharp.Common.csproj +++ b/source/LeagueSharp.Common.csproj @@ -53,8 +53,7 @@ Z:\References\clipper_library.dll - packages\JetBrains.Annotations.10.2.1\lib\net\JetBrains.Annotations.dll - True + Z:\Core\JetBrains.Annotations.dll Z:\References\LeagueSharp.dll @@ -66,12 +65,10 @@ Z:\System\LeagueSharp.Sandbox.dll - packages\log4net.2.0.5\lib\net45-full\log4net.dll - True + Z:\Core\log4net.dll - - packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - True + + Z:\Core\Newtonsoft.Json.dll Z:\Core\PlaySharp.Toolkit.dll diff --git a/source/Library.cs b/source/Library.cs index 88b050d6..7d0d4578 100644 --- a/source/Library.cs +++ b/source/Library.cs @@ -41,6 +41,7 @@ public void Configure(CompositionContainer container) ExpandConsole(); CreateInstances(container); + AppDomain.CurrentDomain.ProcessExit += OnProcessExit; Instances.Damage.SortSpells(); } @@ -114,6 +115,12 @@ private static T Export(CompositionContainer container, T 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/Items/HSLColor.cs b/source/Menu/Items/HSLColor.cs index aaeb92a7..fdf535ed 100644 --- a/source/Menu/Items/HSLColor.cs +++ b/source/Menu/Items/HSLColor.cs @@ -6,6 +6,7 @@ /// /// The HSL Color class. /// + [Obsolete] public class HSLColor { #region Constants diff --git a/source/Menu/OnValueChangeEventArgs.cs b/source/Menu/OnValueChangeEventArgs.cs index c2a7c0ef..542078de 100644 --- a/source/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; diff --git a/source/Native/Hacks.cs b/source/Native/Hacks.cs index 69e7399f..da3fc89b 100644 --- a/source/Native/Hacks.cs +++ b/source/Native/Hacks.cs @@ -93,6 +93,8 @@ public static bool TowerRanges #region Properties + private static MenuItem DisableDrawing { get; set; } + private static Menu Menu { get; set; } #endregion @@ -115,11 +117,13 @@ public static void Initialize(Menu menu) Menu = new Menu("Hacks", "Hacks"); Menu.AddItem(CreateHackItem("antiafk", "Anti-AFK")); - Menu.AddItem(CreateHackItem("disable_drawing", "Disable Drawing")); + 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 @@ -158,6 +162,20 @@ private static void OnValueChanged(object sender, OnValueChangeEventArgs onValue } } + 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/packages.config b/source/packages.config index e578b38d..86d59ae2 100644 --- a/source/packages.config +++ b/source/packages.config @@ -1,7 +1,4 @@  - - - \ No newline at end of file From 83ca193c4d4123a222fc12e9641de596fc68e020 Mon Sep 17 00:00:00 2001 From: L33T Date: Tue, 25 Oct 2016 00:22:26 +0300 Subject: [PATCH 11/11] + fix major bug regarding menu creation, where too early menu causes an assembly to completely fail. --- source/Menu/Configuration/MenuManager.cs | 32 ++++++++++++++++++++++++ source/Menu/Core/Menu.cs | 11 +++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/source/Menu/Configuration/MenuManager.cs b/source/Menu/Configuration/MenuManager.cs index ccc8b2b0..b099b4e8 100644 --- a/source/Menu/Configuration/MenuManager.cs +++ b/source/Menu/Configuration/MenuManager.cs @@ -4,6 +4,7 @@ namespace LeagueSharp.Common.Configuration { + using System.Collections.Generic; using System.ComponentModel.Composition; using SharpDX.Menu; @@ -35,6 +36,12 @@ public class MenuManager : IPartImportsSatisfiedNotification #endregion + #region Properties + + private static IList SatisfyMenuCollection { get; } = new List(); + + #endregion + #region Public Methods and Operators /// @@ -47,6 +54,13 @@ public void OnImportsSatisfied() 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(); } /// @@ -61,5 +75,23 @@ public void SaveAll() } #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 index 089a25f4..0364eeae 100644 --- a/source/Menu/Core/Menu.cs +++ b/source/Menu/Core/Menu.cs @@ -9,6 +9,8 @@ namespace LeagueSharp.Common using System.Drawing; using System.Linq; + using LeagueSharp.Common.Configuration; + using SharpDX.Menu; using Color = SharpDX.Color; @@ -38,7 +40,14 @@ public Menu(string displayName, string name, bool isRootMenu = false) this.MenuReference = ComponentFactory.CreateMenu(name, displayName); if (isRootMenu) { - Instances.MenuManager.MenuFactory?.Add(this.MenuReference); + if (Instances.MenuManager == null) + { + MenuManager.SatisfyMenu(this); + } + else + { + Instances.MenuManager.MenuFactory?.Add(this.MenuReference); + } } this.IsRootMenu = isRootMenu;