private void Game_ProcessSpell(Obj_AI_Base hero, GameObjectProcessSpellCastEventArgs args)
        {
            ConsoleDebug.WriteLine(string.Format("'{0}' casted Spell: {1}", hero.Name, args.SData.Name));
            try
            {
                SpellData spellData;
                if (args.SData.ShouldEvade(hero, out spellData))
                {
                    if (!spellData.UsePackets)
                    {
                        var specialSpellArgs = new SpecialSpellEventArgs();
                        if (OnProcessSpecialSpell != null)
                        {
                            OnProcessSpecialSpell(hero, args, spellData, specialSpellArgs);
                        }

                        if (specialSpellArgs.NoProcess == false && spellData.NoProcess == false)
                        {
                            CreateSpellData(hero, hero.ServerPosition, args.End, spellData, null);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ConsoleDebug.WriteLine(e);
            }
        }
Exemple #2
0
 public static void PrintChat(object data)
 {
     if (!ConfigValue.ShowDebugInfo.GetBool())
     {
         return;
     }
     Chat.Print(data);
     ConsoleDebug.WriteLine(data);
 }
Exemple #3
0
 public static void DrawTopLeft(object data)
 {
     ConsoleDebug.WriteLine(data);
     if (!ConfigValue.ShowDebugInfo.GetBool())
     {
         return;
     }
     textToWrite.Add(data.ToString());
     ConsoleDebug.WriteLine(data);
 }
Exemple #4
0
 public static void CastSpell(EvadeSpellData spellData)
 {
     EvadeSpell.LastSpellEvadeCommand = new EvadeCommand
     {
         Order          = EvadeOrderCommand.CastSpell,
         EvadeSpellData = spellData,
         Timestamp      = EvadeUtils.TickCount,
         IsProcessed    = false
     };
     ConsoleDebug.WriteLine("CastSpell");
     MyHero.Spellbook.CastSpell(spellData.SpellKey, false);
 }
Exemple #5
0
        private void CreateConfigFile()
        {
            if (!Directory.Exists(ConfigDataFolder))
            {
                Directory.CreateDirectory(ConfigDataFolder);
            }
            if (!File.Exists(ConfigDataFile))
            {
                File.Create(ConfigDataFile).Close();
            }

            ConsoleDebug.WriteLine("Creating Config...");
        }
Exemple #6
0
 private void Game_OnGameLoad_Disabled(EventArgs args)
 {
     ConsoleDebug.WriteLineColor("Failed loading Evade...", ConsoleColor.Red);
     ConsoleDebug.WriteLine("   Disabled due to needed core update (as of 5.24), please be patient!");
     Chat.Print("<font color='#ff0000'>Failed loading Evade...</font>");
     Chat.Print("   Disabled due to needed core update (as of 5.24), please be patient!");
     Menu = MainMenu.AddMenu("Evade (Disabled)", "Evade", "Evade (Disabled)");
     Menu.AddGroupLabel("Disabled due to needed core update!");
     Menu.AddLabel("As the latest update has caused issues with getting buffs and sending movement commands\n" +
                   " Evade can not be fixed.\n");
     Menu.AddSeparator();
     Menu.AddLabel("Please be patient for an update and in the mean time use EvadePlus");
 }
Exemple #7
0
 public static void CastSpell(EvadeSpellData spellData, Vector2 movePos)
 {
     EvadeSpell.LastSpellEvadeCommand = new EvadeCommand
     {
         Order          = EvadeOrderCommand.CastSpell,
         TargetPosition = movePos,
         EvadeSpellData = spellData,
         Timestamp      = EvadeUtils.TickCount,
         IsProcessed    = false
     };
     ConsoleDebug.WriteLine("CastSpell: " + movePos);
     MyHero.Spellbook.CastSpell(spellData.SpellKey, movePos.To3D(), false);
 }
Exemple #8
0
 public static void CastSpell(EvadeSpellData spellData, Obj_AI_Base target)
 {
     EvadeSpell.LastSpellEvadeCommand = new EvadeCommand
     {
         Order          = EvadeOrderCommand.CastSpell,
         Target         = target,
         EvadeSpellData = spellData,
         Timestamp      = EvadeUtils.TickCount,
         IsProcessed    = false
     };
     ConsoleDebug.WriteLine("CastSpell: " + target.Name);
     MyHero.Spellbook.CastSpell(spellData.SpellKey, target, false);
 }
Exemple #9
0
 public static void Attack(EvadeSpellData spellData, Obj_AI_Base target)
 {
     EvadeSpell.LastSpellEvadeCommand = new EvadeCommand
     {
         Order          = EvadeOrderCommand.Attack,
         Target         = target,
         EvadeSpellData = spellData,
         Timestamp      = EvadeUtils.TickCount,
         IsProcessed    = false
     };
     ConsoleDebug.WriteLine("Attack: " + target.Name);
     Player.IssueOrder(GameObjectOrder.AttackUnit, target, false);
 }
Exemple #10
0
 public void RemoveConfig()
 {
     if (!Directory.Exists(ConfigDataFolder))
     {
         return;
     }
     if (!File.Exists(ConfigDataFile))
     {
         return;
     }
     ConsoleDebug.WriteLine("Removing Config File.");
     File.Delete(ConfigDataFile);
     Directory.Delete(ConfigDataFolder);
 }
Exemple #11
0
        private void Game_OnCreateObj(GameObject sender, EventArgs args)
        {
            var missile = sender as MissileClient;

            if (missile != null && missile.SpellCaster.IsMe)
            {
                if (_lastSpellCastArgs.Process == true
                    )
                {
                    //Draw.RenderObjects.Add(new Draw.RenderPosition(lastSpellCastServerPos, 1000, System.Drawing.Color.Red, 10));
                    RenderObjects.Add(new RenderCircle(missile.StartPosition.To2D(), 1000, Color.Red, 10));

                    var   distance = _lastSpellCastServerPos.Distance(missile.StartPosition.To2D());
                    float moveTime = 1000 * distance / MyHero.MoveSpeed;
                    ConsoleDebug.WriteLine("Extra Delay: " + moveTime);
                }
            }
        }
Exemple #12
0
        private void Game_OnGameUpdate(EventArgs args)
        {
            try
            {
                CheckHeroInDanger();
                CheckDodgeOnlyDangerous();
                if (IsChanneling && ChannelPosition.Distance(GameData.HeroInfo.ServerPos2D) > 50) //TODO: !GameData.MyHero.IsChannelingImportantSpell()
                {
                    IsChanneling = false;
                    ConsoleDebug.WriteLineColor("Stopped Channeling.", ConsoleColor.Yellow);
                }

                //if (() Properties.Properties.Data["ResetConfig"].Cast<CheckBox>().CurrentValue)
                //{
                //    ResetConfig();
                //    menu["ResetConfig"].Cast<CheckBox>().CurrentValue = false;
                //}

                //if (() Properties.Properties.Data["ResetConfig200"].Cast<CheckBox>().CurrentValue)
                //{
                //    SetPatchConfig();
                //    menu["ResetConfig200"].Cast<CheckBox>().CurrentValue = false;
                //}

                var limitDelay = ConfigValue.TickLimiter.GetInt();
                //Tick limiter
                if (EvadeUtils.TickCount - LastTickCount > limitDelay && EvadeUtils.TickCount > LastStopEvadeTime)
                {
                    DodgeSkillShots(); //walking


                    ContinueLastBlockedCommand();
                    LastTickCount = EvadeUtils.TickCount;
                }

                EvadeSpell.UseEvadeSpell(); //using spells
                RecalculatePath();
            }
            catch (Exception e)
            {
                ConsoleDebug.WriteLine(e);
            }
        }
Exemple #13
0
        public static void MoveTo(Vector2 movePos)
        {
            if (!Situation.ShouldDodge())
            {
                return;
            }

            Evade.LastEvadeCommand = new EvadeCommand
            {
                Order          = EvadeOrderCommand.MoveTo,
                TargetPosition = movePos,
                Timestamp      = EvadeUtils.TickCount,
                IsProcessed    = false
            };

            Evade.LastMoveToPosition  = movePos;
            Evade.LastMoveToServerPos = MyHero.ServerPosition.To2D();
            ConsoleDebug.WriteLine("MoveTo: " + movePos);
            Player.IssueOrder(GameObjectOrder.MoveTo, movePos.To3D(), false);
        }
 private void LoadSpecialSpellPlugins()
 {
     ChampionPlugins.Add(Constants.AllChampions, new AllChampions());
     ConsoleDebug.WriteLine("        Loading Special Spell Plugins...");
     foreach (var hero in EntityManager.Heroes.AllHeroes)
     {
         var championPlugin = Assembly
                              .GetExecutingAssembly()
                              .GetTypes()
                              .FirstOrDefault(t => t.IsClass && t.Name == hero.ChampionName && t.GetInterfaces().Contains(typeof(IChampionPlugin)));
         if (championPlugin != null)
         {
             if (!ChampionPlugins.ContainsKey(hero.ChampionName))
             {
                 var plugin = (IChampionPlugin)NewInstance(championPlugin);
                 ChampionPlugins.Add(hero.ChampionName, plugin);
                 ConsoleDebug.WriteLine("        Loaded Champion Plugin: " + plugin.GetChampionName());
             }
         }
     }
 }
Exemple #15
0
        public bool LoadConfigData()
        {
            ConsoleDebug.WriteLineColor("Please ignore the following errors, as its a EloBuddy issue, and will only happen once per load. (this message will display twice).", ConsoleColor.Green, true);
            if (!Directory.Exists(ConfigDataFolder) || !File.Exists(ConfigDataFile))
            {
                CreateConfigFile();
            }

            FileStream file = File.OpenRead(ConfigDataFile);

            try
            {
                XmlSerializer x    = new XmlSerializer(typeof(SerializableDictionary <ConfigValue, object>));
                var           temp = x.Deserialize(file) as SerializableDictionary <ConfigValue, object>;
                if (temp != null)
                {
                    foreach (var o in temp)
                    {
                        SetValue(o.Key, o.Value);
                    }
                }


                file.Close();
                ConsoleDebug.WriteLineColor("Alright, from now all errors are now an issue!", ConsoleColor.DarkGreen, true);
                return(true);
            }
            catch (Exception ex)
            {
                ConsoleDebug.WriteLineColor("Alright, from now all errors are now an issue!", ConsoleColor.DarkGreen, true);
                ConsoleDebug.WriteLine("Error Loading Config Data File...");
                ConsoleDebug.WriteLine(ex);
            }
            finally
            {
                file.Close();
            }
            return(false);
        }
Exemple #16
0
        private static void GameOnOnGameUpdate(EventArgs args)
        {
            for (var i = ActionList.Count - 1; i >= 0; i--)
            {
                if (ActionList[i].Time <= EvadeUtils.TickCount)
                {
                    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 e)
                    {
                        ConsoleDebug.WriteLine(e);
                    }

                    ActionList.RemoveAt(i);
                }
            }
        }
Exemple #17
0
 public void SaveConfigData()
 {
     try
     {
         if (!Directory.Exists(ConfigDataFolder))
         {
             Directory.CreateDirectory(ConfigDataFolder);
         }
         if (!File.Exists(ConfigDataFile))
         {
             File.WriteAllText(ConfigDataFile, "");
         }
         FileStream file = File.OpenWrite(ConfigDataFile);
         try
         {
             XmlSerializer x = new XmlSerializer(typeof(SerializableDictionary <ConfigValue, object>));
             ConsoleDebug.WriteLine("Saving Config Data...");
             x.Serialize(file, new SerializableDictionary <ConfigValue, object>(Values));
             file.Close();
             ConsoleDebug.WriteLine("     Successful!");
         }
         catch (Exception ex)
         {
             ConsoleDebug.WriteLine("     Error Saving Config Data File...");
             ConsoleDebug.WriteLine(ex);
         }
         finally
         {
             file.Close();
         }
     }
     catch (Exception ex)
     {
         ConsoleDebug.WriteLine("    Error Reading Config File...");
         ConsoleDebug.WriteLine(ex);
     }
 }
Exemple #18
0
        public void SendSignedEmail()
        {
            var message = new MailMessage();



            message.To.Add(new MailAddress("*****@*****.**", "Port25"));



            message.From = new MailAddress(ConfigurationManager.AppSettings["from"]);

            message.Subject = @"test©";
            // message contains white space
//            message.Body = @"abc©
// ©   ©
// ©
//
//
//";

//            message.IsBodyHtml = false;


//            message.Body = @"
//line 1
//
//line 2
//
//line 3";


            message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("text", Encoding.ASCII, "text/plain"));
            message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("html", Encoding.ASCII, "text/html"));



            var privateKey = PrivateKeySigner.Create(ConfigurationManager.AppSettings["privatekey"], SigningAlgorithm.RSASha1);

            var dkim = new DkimSigner(
                privateKey,
                ConfigurationManager.AppSettings["domain"],
                ConfigurationManager.AppSettings["selector"],
                new string[] { "From", "To", "Subject" }
                );



            var debugger = new ConsoleDebug();

            dkim.Debug                = debugger;
            dkim.Encoding             = Encoding.ASCII;
            dkim.BodyCanonicalization = DkimCanonicalizationAlgorithm.Relaxed;



            var signedMessage = dkim.SignMessage(message);


            var text = signedMessage.GetText();

            debugger.WriteLine();
            debugger.WriteContent("dkim", text);



            //    var domainkey = new DomainKeySigner(
            //privateKey,
            //ConfigurationManager.AppSettings["domain"],
            //ConfigurationManager.AppSettings["selector"],
            //new string[] { "From", "To", "Subject" }
            //);

            //signedMessage = domainkey.SignMessage(signedMessage);

            //text = signedMessage.GetText();
            //debugger.WriteContent("domainkey", text);

            new SmtpClient().Send(signedMessage);
        }
Exemple #19
0
		public void SendSignedEmail()
		{
			var message = new MailMessage();


			
			message.To.Add(new MailAddress("*****@*****.**", "Port25"));
			


			message.From = new MailAddress(ConfigurationManager.AppSettings["from"]);

			message.Subject = @"test©";
			// message contains white space 
//            message.Body = @"abc©
// ©   ©
// ©
//
//
//";

//            message.IsBodyHtml = false;


//            message.Body = @"
//line 1
//
//line 2
//
//line 3";


			message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("text", Encoding.ASCII, "text/plain"));
			message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("html", Encoding.ASCII, "text/html"));



			var privateKey = PrivateKeySigner.Create(ConfigurationManager.AppSettings["privatekey"], SigningAlgorithm.RSASha1);

			var dkim = new DkimSigner(
				privateKey,
				ConfigurationManager.AppSettings["domain"],
				ConfigurationManager.AppSettings["selector"],
				new string[] { "From", "To", "Subject" }
				);



			var debugger = new ConsoleDebug();

			dkim.Debug = debugger;
			dkim.Encoding = Encoding.ASCII;
			dkim.BodyCanonicalization = DkimCanonicalizationAlgorithm.Relaxed;



	

			

			var signedMessage = dkim.SignMessage(message);

			
			var text = signedMessage.GetText();
			debugger.WriteLine();
			debugger.WriteContent("dkim", text);



		//    var domainkey = new DomainKeySigner(
		//privateKey,
		//ConfigurationManager.AppSettings["domain"],
		//ConfigurationManager.AppSettings["selector"],
		//new string[] { "From", "To", "Subject" }
		//);

			//signedMessage = domainkey.SignMessage(signedMessage);
			
			//text = signedMessage.GetText();
			//debugger.WriteContent("domainkey", text);

			new SmtpClient().Send(signedMessage);

		}
        public void LoadSpellDictionary()
        {
            LoadSpecialSpellPlugins();
            foreach (var hero in EntityManager.Heroes.AllHeroes)
            {
                try
                {
                    if (hero.IsMe)
                    {
                        foreach (var spell in SpellWindupDatabase.Spells.Where(
                                     s => (s.CharName == hero.ChampionName)))
                        {
                            if (!WindupSpells.ContainsKey(spell.SpellName))
                            {
                                WindupSpells.Add(spell.SpellName, spell);
                            }
                        }
                    }
                    if (hero.Team != MyHero.Team)
                    {
                        ConsoleDebug.WriteLine("        Hero Found: " + hero.ChampionName);
                        foreach (var spell in SpellDatabase.Spells.Where(
                                     s => (s.CharName == hero.ChampionName) || (s.CharName == Constants.AllChampions)))
                        {
                            ConsoleDebug.WriteLine("            Hero Spell Found: " + spell.SpellName);

                            if (!(spell.SpellType == SpellType.Circular ||
                                  spell.SpellType == SpellType.Line ||
                                  spell.SpellType == SpellType.Arc))
                            {
                                continue;
                            }

                            if (spell.CharName == Constants.AllChampions)
                            {
                                SpellSlot slot = hero.GetSpellSlotFromName(spell.SpellName);
                                if (slot == SpellSlot.Unknown)
                                {
                                    ConsoleDebug.WriteLineColor("           {0}: Not Found!", ConsoleColor.Yellow, false, spell.SpellName);
                                    continue;
                                }
                            }

                            if (!OnProcessSpells.ContainsKey(spell.SpellName))
                            {
                                if (spell.MissileName == "")
                                {
                                    spell.MissileName = spell.SpellName;
                                }

                                OnProcessSpells.Add(spell.SpellName, spell);
                                OnMissileSpells.Add(spell.MissileName, spell);

                                if (spell.ExtraSpellNames != null)
                                {
                                    foreach (string spellName in spell.ExtraSpellNames)
                                    {
                                        OnProcessSpells.Add(spellName, spell);
                                    }
                                }

                                if (spell.ExtraMissileNames != null)
                                {
                                    foreach (string spellName in spell.ExtraMissileNames)
                                    {
                                        OnMissileSpells.Add(spellName, spell);
                                    }
                                }

                                LoadSpecialSpell(spell);
                                if (!Config.Properties.Spells.Any(x => x.Key == spell.SpellName))
                                {
                                    string menuName    = spell.CharName + " (" + spell.SpellKey + ") Settings";
                                    var    enableSpell = !spell.DefaultOff;
                                    var    spellConfig = new SpellConfigControl(SpellMenu, menuName, spell, false /*enableSpell*/);
                                    spellConfig.AddToMenu();

                                    Config.Properties.SetSpell(spell.SpellName, spell.GetSpellConfig(spellConfig));
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ConsoleDebug.WriteLine(ex.ToString(), ConsoleColor.Red);
                    throw;
                }
            }
        }
Exemple #21
0
        private void Hero_OnNewPath(Obj_AI_Base hero, GameObjectNewPathEventArgs args)
        {
            if (!Config.Properties.GetBool(ConfigValue.AutoSetPing))
            {
                return;
            }

            if (!hero.IsMe)
            {
                return;
            }

            var path = args.Path;

            if (path.Length > 1 && !args.IsDash)
            {
                var movePos = path.Last().To2D();

                if (_checkPing &&
                    _lastIssueOrderArgs.Process == true &&
                    _lastIssueOrderArgs.Order == GameObjectOrder.MoveTo &&
                    _lastIssueOrderArgs.TargetPosition.To2D().Distance(movePos) < 3 &&
                    MyHero.Path.Count() == 1 &&
                    args.Path.Count() == 2 &&
                    MyHero.IsMoving)
                {
                    //Draw.RenderObjects.Add(new Draw.RenderPosition(myHero.Path.Last().To2D(), 1000));

                    RenderObjects.Add(new RenderLine(args.Path.First().To2D(), args.Path.Last().To2D(), 1000));
                    RenderObjects.Add(new RenderLine(MyHero.Position.To2D(), MyHero.Path.Last().To2D(), 1000));

                    //Draw.RenderObjects.Add(new Draw.RenderCircle(lastMoveToServerPos, 1000, System.Drawing.Color.Red, 10));

                    var   distanceTillEnd = MyHero.Path.Last().To2D().Distance(MyHero.Position.To2D());
                    float moveTimeTillEnd = 1000 * distanceTillEnd / MyHero.MoveSpeed;

                    if (moveTimeTillEnd < 500)
                    {
                        return;
                    }

                    var dir1 = (MyHero.Path.Last().To2D() - MyHero.Position.To2D()).Normalized();
                    var ray1 = new Ray(MyHero.Position.SetZ(0), new Vector3(dir1.X, dir1.Y, 0));

                    var dir2 = (args.Path.First().To2D() - args.Path.Last().To2D()).Normalized();
                    var pos2 = new Vector3(args.Path.First().X, args.Path.First().Y, 0);
                    var ray2 = new Ray(args.Path.First().SetZ(0), new Vector3(dir2.X, dir2.Y, 0));

                    Vector3 intersection3;
                    if (ray2.Intersects(ref ray1, out intersection3))
                    {
                        var intersection = intersection3.To2D();

                        var projection = intersection.ProjectOn(MyHero.Path.Last().To2D(), MyHero.Position.To2D());

                        if (projection.IsOnSegment && dir1.AngleBetween(dir2) > 20 && dir1.AngleBetween(dir2) < 160)
                        {
                            RenderObjects.Add(new RenderCircle(intersection, 1000, Color.Red, 10));

                            var distance = //args.Path.First().To2D().Distance(intersection);
                                           _lastMoveToServerPos.Distance(intersection);
                            float moveTime = 1000 * distance / MyHero.MoveSpeed;

                            //ConsoleDebug.WriteLine("waa: " + distance);

                            if (moveTime < 1000)
                            {
                                if (_numExtraDelayTime > 0)
                                {
                                    _sumExtraDelayTime += moveTime;
                                    _avgExtraDelayTime  = _sumExtraDelayTime / _numExtraDelayTime;

                                    _pingList.Add(moveTime);
                                }
                                _numExtraDelayTime += 1;

                                if (_maxExtraDelayTime == 0)
                                {
                                    _maxExtraDelayTime = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer);
                                }

                                if (_numExtraDelayTime % 100 == 0)
                                {
                                    _pingList.Sort();

                                    var percentile   = ConfigValue.AutoSetPingPercentile.GetInt();
                                    int percentIndex = (int)Math.Floor(_pingList.Count() * (percentile / 100f)) - 1;
                                    _maxExtraDelayTime = Math.Max(_pingList.ElementAt(percentIndex) - Game.Ping, 0);
                                    _maxExtraDelayTime.SetTo(ConfigValue.ExtraPingBuffer);

                                    _pingList.Clear();

                                    ConsoleDebug.WriteLine("Max Extra Delay: " + _maxExtraDelayTime);
                                }

                                ConsoleDebug.WriteLine("Extra Delay: " + Math.Max(moveTime - Game.Ping, 0));
                            }
                        }
                    }
                }

                _checkPing = false;
            }
        }