public static void updateJungleCleaner()
        {
            if (player.IsDead)
            {
                jcState = JungleCleanState.RecallForHeal;
                //Console.WriteLine("RecallForHeal");
                return;
            }

            if (jcState == JungleCleanState.SearchingBestCamp)
            {
                focusedCamp = getBestCampToGo();
                if (focusedCamp != null)
                {
                    if (focusedCamp.priority >= 20)
                    {
                        GamePacket gPacketT;
                        gPacketT = Packet.S2C.Ping.Encoded(new Packet.S2C.Ping.Struct(player.Position[0], player.Position[1], 0, 0, Packet.PingType.Normal));
                        gPacketT.Process();

                        gPacketT = Packet.S2C.Ping.Encoded(new Packet.S2C.Ping.Struct(player.Position[0], player.Position[1], 0, 0, Packet.PingType.Fallback));
                        gPacketT.Process();
                    }

                    Console.WriteLine("New camp found " + focusedCamp);
                    Console.WriteLine("Time to finish camp " + focusedCamp.timeToKill);
                    Console.WriteLine("HP left after camp " + focusedCamp.hpLeftAfterFight);
                    Console.WriteLine("Camp level " + focusedCamp.level);
                    //puss out or kill?
                    if ((focusedCamp.willKillMe || (focusedCamp.priority > 25 && player.Health / player.MaxHealth < 0.85f)))
                    {
                        Console.WriteLine("gona diee");
                        jcState = JungleCleanState.RecallForHeal;
                    }
                    else
                    {
                        jcState = JungleCleanState.RunningToCamp;
                        Console.WriteLine("RunningToCamp");
                    }
                }
                else
                {
                    jcState = JungleCleanState.RecallForHeal;
                    Console.WriteLine("RecallForHeal");
                }
            }

            if (jcState == JungleCleanState.RunningToCamp)
            {
                if (focusedCamp.State != Camp.JungleCampState.Dead && focusedCamp.side != GameObjectTeam.Neutral)
                {
                    jungler.castWhenNear(focusedCamp);
                }
                jungler.checkItems();
                logicRunToCamp();
            }

            if (jcState == JungleCleanState.RunningToCamp && jungler.canMove() && (HypaJungle.player.Position.Distance(focusedCamp.campPosition) < 200 || isCampVisible()))
            {
                jcState = JungleCleanState.WaitingMinions;
                Console.WriteLine("WaitingMinions");
            }

            if (jcState == JungleCleanState.WaitingMinions)
            {
                doWhileIdling();
            }

            if (jcState == JungleCleanState.WaitingMinions && (isCampVisible()))
            {
                jcState = JungleCleanState.AttackingMinions;
                Console.WriteLine("AttackingMinions");
            }

            if (jcState == JungleCleanState.AttackingMinions)
            {
                attackCampMinions();
                if (focusedCamp.inAARangeMinCount() == 0 && !player.IsMelee())
                {
                    player.IssueOrder(GameObjectOrder.MoveTo, focusedCamp.campPosition);
                }
            }

            if (jcState == JungleCleanState.AttackingMinions && isCampFinished())
            {
                if (HypaJungle.Config.Item("autoBuy").GetValue <bool>())
                {
                    jcState = JungleCleanState.GoingToShop;
                    Console.WriteLine("GoingToShop");
                }
                else
                {
                    jcState = JungleCleanState.SearchingBestCamp;
                    Console.WriteLine("SearchingBestCamp");
                }
            }

            if (jcState == JungleCleanState.ThinkAfterFinishCamp)
            {
                jcState = JungleCleanState.SearchingBestCamp;
                Console.WriteLine("SearchingBestCamp");
            }

            if (jcState == JungleCleanState.RecallForHeal)
            {
                if (jungler.recall.IsReady() && !player.IsChanneling && !jungler.inSpwan() && !recalCasted)
                {
                    jungler.recall.Cast();
                    recalCasted = true;
                }

                if (jungler.inSpwan())
                {
                    if (HypaJungle.Config.Item("autoBuy").GetValue <bool>())
                    {
                        jcState = JungleCleanState.GoingToShop;
                    }
                    else
                    {
                        if (jungler.inSpwan() && player.Health > player.MaxHealth * 0.7f &&
                            (!jungler.gotMana || player.Mana > player.MaxMana * 0.7f))
                        {
                            jcState = JungleCleanState.SearchingBestCamp;
                            Console.WriteLine("SearchingBestCamp");
                        }
                    }
                }
            }

            if (jcState == JungleCleanState.GoingToShop)
            {
                if (!HypaJungle.Config.Item("autoBuy").GetValue <bool>())
                {
                    jcState = JungleCleanState.SearchingBestCamp;
                    Console.WriteLine("SearchingBestCamp");
                }

                if (jungler.inSpwan())
                {
                    jungler.getItemPassiveBoostDps();
                    jungler.setupSmite();
                }

                if (jungler.inSpwan() && player.IsChanneling)
                {
                    Vector3 stopRecPos = new Vector3(6, 30, 2);
                    player.IssueOrder(GameObjectOrder.MoveTo, player.Position + stopRecPos);
                }

                if (jungler.nextItem != null && player.GoldCurrent - 12 >= jungler.nextItem.goldReach)
                {
                    if (jungler.recall.IsReady() && !player.IsChanneling && !jungler.inSpwan() && !recalCasted)
                    {
                        jungler.recall.Cast();
                        recalCasted = true;
                    }
                }
                else
                {
                    if (jungler.inSpwan() && player.Health > player.MaxHealth * 0.8f &&
                        (!jungler.gotMana || player.Mana > player.MaxMana * 0.8f) && (jungler.nextItem == null || player.GoldCurrent + 40 <= jungler.nextItem.goldReach))
                    {
                        jcState = JungleCleanState.SearchingBestCamp;
                        Console.WriteLine("SearchingBestCamp");
                    }
                    if (!player.IsChanneling && !jungler.inSpwan())
                    {
                        jcState = JungleCleanState.SearchingBestCamp;
                        Console.WriteLine("SearchingBestCamp");
                    }
                }
            }
            else if (jcState != JungleCleanState.RecallForHeal && jcState != JungleCleanState.GoingToShop)
            {
                recalCasted = false;
            }

            if (jcState == JungleCleanState.GoingToShop && jungler.inSpwan())
            {
                if (jungler.nextItem != null && player.GoldCurrent >= jungler.nextItem.goldReach)
                {
                    jungler.buyItems();
                }
                if (player.Health > player.MaxHealth * 0.75f && player.Mana > player.MaxMana * 0.75f)
                {
                    jcState = JungleCleanState.SearchingBestCamp;
                    Console.WriteLine("SearchingBestCamp");
                }
            }
        }
Exemple #2
0
        public static void updateJungleCleaner()
        {
            if (player.IsDead)
            {
                jcState = JungleCleanState.RecallForHeal;
                Console.WriteLine("RecallForHeal");
                return;
            }

            if (jcState == JungleCleanState.SearchingBestCamp)
            {
                focusedCamp = getBestCampToGo();
                if (focusedCamp != null)
                {
                    //puss out or kill?
                    if ((focusedCamp.willKillMe || (focusedCamp.priority > 25 && player.Health / player.MaxHealth < 0.85f)))
                    {
                        Console.WriteLine("gona diee");
                        jcState = JungleCleanState.RecallForHeal;
                    }
                    else
                    {
                        jcState = JungleCleanState.RunningToCamp;
                        Console.WriteLine("RunningToCamp");
                    }
                }
                else
                {
                    jcState = JungleCleanState.RecallForHeal;
                    Console.WriteLine("RecallForHeal");
                }
            }

            if (jcState == JungleCleanState.RunningToCamp)
            {
                if (focusedCamp.State != Camp.JungleCampState.Dead && focusedCamp.side != GameObjectTeam.Neutral)
                {
                    jungler.castWhenNear(focusedCamp);
                }
                jungler.checkItems();
                logicRunToCamp();
            }

            if (jcState == JungleCleanState.RunningToCamp && jungler.canMove() && (HypaJungle.player.Position.Distance(focusedCamp.campPosition) < 200 || isCampVisible()))
            {
                jcState = JungleCleanState.WaitingMinions;
                Console.WriteLine("WaitingMinions");
            }

            if (jcState == JungleCleanState.WaitingMinions)
            {
                doWhileIdling();
            }

            if (jcState == JungleCleanState.WaitingMinions && (isCampVisible()))
            {
                jcState = JungleCleanState.AttackingMinions;
                Console.WriteLine("AttackingMinions");
            }

            if (jcState == JungleCleanState.AttackingMinions)
            {
                attackCampMinions();
            }

            if (jcState == JungleCleanState.AttackingMinions && isCampFinished())
            {
                if (HypaJungle.Config.Item("autoBuy").GetValue <bool>())
                {
                    jcState = JungleCleanState.GoingToShop;
                    Console.WriteLine("GoingToShop");
                }
                else
                {
                    jcState = JungleCleanState.SearchingBestCamp;
                    Console.WriteLine("SearchingBestCamp");
                }
            }

            if (jcState == JungleCleanState.ThinkAfterFinishCamp)
            {
                jcState = JungleCleanState.SearchingBestCamp;
                Console.WriteLine("SearchingBestCamp");
            }

            if (jcState == JungleCleanState.RecallForHeal)
            {
                if (jungler.recall.IsReady() && !player.IsChanneling && !jungler.inSpwan() && !recalCasted)
                {
                    jungler.recall.Cast();
                    recalCasted = true;
                }

                if (jungler.inSpwan())
                {
                    if (HypaJungle.Config.Item("autoBuy").GetValue <bool>())
                    {
                        jcState = JungleCleanState.GoingToShop;
                    }
                    else
                    {
                        if (jungler.inSpwan() && player.Health > player.MaxHealth * 0.7f &&
                            (!jungler.gotMana || player.Mana > player.MaxMana * 0.7f))
                        {
                            jcState = JungleCleanState.SearchingBestCamp;
                            Console.WriteLine("SearchingBestCamp");
                        }
                    }
                }
            }

            if (jcState == JungleCleanState.GoingToShop)
            {
                if (!HypaJungle.Config.Item("autoBuy").GetValue <bool>())
                {
                    jcState = JungleCleanState.SearchingBestCamp;
                    Console.WriteLine("SearchingBestCamp");
                }

                if (jungler.inSpwan())
                {
                    jungler.getItemPassiveBoostDps();
                    jungler.setupSmite();
                }

                if (jungler.inSpwan() && player.IsChanneling)
                {
                    Vector3 stopRecPos = new Vector3(6, 30, 2);
                    player.IssueOrder(GameObjectOrder.MoveTo, player.Position + stopRecPos);
                }

                if (jungler.nextItem != null && player.GoldCurrent >= jungler.nextItem.goldReach && recalCasted)
                {
                    if (jungler.recall.IsReady() && !player.IsChanneling && !jungler.inSpwan() && !recalCasted)
                    {
                        jungler.recall.Cast();
                    }
                }
                else
                {
                    if (jungler.inSpwan() && player.Health > player.MaxHealth * 0.8f &&
                        (!jungler.gotMana || player.Mana > player.MaxMana * 0.8f) && (jungler.nextItem == null))
                    {
                        jcState = JungleCleanState.SearchingBestCamp;
                        Console.WriteLine("SearchingBestCamp");
                    }
                    if (!player.IsChanneling && !jungler.inSpwan())
                    {
                        jcState = JungleCleanState.SearchingBestCamp;
                        Console.WriteLine("SearchingBestCamp");
                    }
                }
            }
            else if (jcState != JungleCleanState.RecallForHeal && jcState != JungleCleanState.GoingToShop)
            {
                recalCasted = false;
            }

            if (jcState == JungleCleanState.GoingToShop && jungler.inSpwan())
            {
                if (jungler.nextItem != null && player.GoldCurrent >= jungler.nextItem.goldReach)
                {
                    jungler.buyItems();
                }
                if (player.Health > player.MaxHealth * 0.75f && player.Mana > player.MaxMana * 0.75f)
                {
                    jcState = JungleCleanState.SearchingBestCamp;
                    Console.WriteLine("SearchingBestCamp");
                }
            }
        }