Ejemplo n.º 1
0
        private PowerDiff GetPowerDifference(Lane lane)
        {
            PowerDiff powerDiff = new PowerDiff();

            powerDiff.Direction = PowerDiff.Orientation.None;

            int allyCount  = 0;
            int enemyCount = 0;

            foreach (KeyValuePair <Obj_AI_Minion, MinionStruct> minion in minions)
            {
                if (minion.Key != null && minion.Key.IsValid && minion.Value.Lane == lane && minion.Value.Active)
                {
                    if (ObjectManager.Player.Team == minion.Key.Team)
                    {
                        allyCount++;
                        powerDiff.Ally += minion.Value.Power + (minion.Value.Power * GetTurretBonus(minion));
                    }
                    else
                    {
                        enemyCount++;
                        powerDiff.Enemy += minion.Value.Power + (minion.Value.Power * GetTurretBonus(minion));
                    }
                }
            }

            if (allyCount > 0 && enemyCount > 0)
            {
                int teamDiff = allyCount - enemyCount;
                if (teamDiff > 4)
                {
                    powerDiff.Ally     += 2;
                    powerDiff.Direction = PowerDiff.Orientation.Ally;
                }
                else if (teamDiff < -4)
                {
                    powerDiff.Enemy    += 2;
                    powerDiff.Direction = PowerDiff.Orientation.Enemy;
                }
            }
            else if (enemyCount == 0 && allyCount > 7)
            {
                powerDiff.Ally     += 2;
                powerDiff.Direction = PowerDiff.Orientation.Ally;
            }
            else if (allyCount == 0 && enemyCount > 7)
            {
                powerDiff.Enemy    += 2;
                powerDiff.Direction = PowerDiff.Orientation.Enemy;
            }

            return(powerDiff);
        }
Ejemplo n.º 2
0
        private void Drawing_OnDraw(EventArgs args)
        {
            PowerDiff toplane = GetPowerDifference(Lane.Top);
            PowerDiff midlane = GetPowerDifference(Lane.Mid);
            PowerDiff botlane = GetPowerDifference(Lane.Bot);

            double top = toplane.Ally * 100 / (toplane.Ally + toplane.Enemy);
            double mid = midlane.Ally * 100 / (midlane.Ally + midlane.Enemy);
            double bot = botlane.Ally * 100 / (botlane.Ally + botlane.Enemy);

            Drawing.DrawText(250, 100, System.Drawing.Color.Gold, "Top: " + (int)top + " mid: " + (int)mid + " bot: " + (int)bot);
        }
Ejemplo n.º 3
0
        private void Game_OnUpdate(EventArgs args)
        {
            if (!IsActive())
            {
                return;
            }

            foreach (KeyValuePair <Obj_AI_Minion, MinionStruct> minion in minions.ToArray())
            {
                if (!minion.Key.IsValid)
                {
                    this.minions.Remove(minion.Key);
                }
            }

            int posX = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionX").GetValue <Slider>().Value;
            int posY = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionY").GetValue <Slider>().Value;

            int i = 0;

            foreach (KeyValuePair <Lane, DrawingsClass> drawing in drawings)
            {
                PowerDiff diff = GetPowerDifference(drawing.Key);
                diff.Ally  = MaxDiff(diff.Ally);
                diff.Enemy = MaxDiff(diff.Enemy);
                float sumDiff = 10 + (float)(diff.Ally - diff.Enemy);

                Render.Rectangle bgRec = (Render.Rectangle)drawing.Value.Drawings[0];
                bgRec.X = posX;
                bgRec.Y = posY + (i * 50);

                Render.Rectangle greenRec = (Render.Rectangle)drawing.Value.Drawings[1];
                greenRec.X     = posX + 1;
                greenRec.Y     = posY + 1 + (i * 50);
                greenRec.Width = (int)(10 * sumDiff);

                Render.Rectangle redRec = (Render.Rectangle)drawing.Value.Drawings[2];
                redRec.X     = (int)(greenRec.X + 10 * sumDiff);
                redRec.Y     = posY + 1 + (i * 50);
                redRec.Width = 200 - (int)(10 * sumDiff);

                Render.Text nameText = (Render.Text)drawing.Value.Drawings[3];
                nameText.X = posX + 100;
                nameText.Y = posY - 10 + (i * 50);

                Render.Text percentText = (Render.Text)drawing.Value.Drawings[4];
                percentText.X    = posX + 100;
                percentText.Y    = posY + 20 + (i * 50);
                percentText.text = "Power " + (100f / 20f * sumDiff).ToString("0.00") + " %";

                Render.Text directionText = (Render.Text)drawing.Value.Drawings[5];
                directionText.Y = posY + 3 + (i * 50);

                i++;
                if (this.IsActive())
                {
                    directionText.Visible = true;
                }
                if (!LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerShowAnimation").GetValue <bool>())
                {
                    drawing.Value.AnimArrowLeft.Stop();
                    drawing.Value.AnimArrowRight.Stop();
                    drawing.Value.CurrentDirection = PowerDiff.Orientation.None;
                    directionText.X = posX + 100;
                }
                if (diff.Direction == PowerDiff.Orientation.None)
                {
                    drawing.Value.CurrentDirection = PowerDiff.Orientation.None;
                    directionText.X       = posX + 100;
                    directionText.Visible = false;
                }
                else if (diff.Direction == PowerDiff.Orientation.Ally)
                {
                    if (drawing.Value.CurrentDirection != PowerDiff.Orientation.Ally)
                    {
                        directionText.X = posX + 100;
                        drawing.Value.AnimArrowRight.Start(new Vector2(directionText.X, directionText.Y));
                    }
                    if (drawing.Value.AnimArrowRight.IsWorking)
                    {
                        directionText.X = (int)drawing.Value.AnimArrowRight.GetCurrentValue().X;
                    }
                    else
                    {
                        directionText.X = posX + 100;
                        drawing.Value.AnimArrowRight.Start(new Vector2(directionText.X, directionText.Y));
                        directionText.X = (int)drawing.Value.AnimArrowRight.GetCurrentValue().X;
                    }
                    drawing.Value.CurrentDirection = PowerDiff.Orientation.Ally;
                    directionText.text             = "→";
                    directionText.Visible          = true;
                }
                else if (diff.Direction == PowerDiff.Orientation.Enemy)
                {
                    if (drawing.Value.CurrentDirection != PowerDiff.Orientation.Enemy)
                    {
                        directionText.X = posX + 110;
                        drawing.Value.AnimArrowLeft.Start(new Vector2(directionText.X, directionText.Y));
                    }
                    if (drawing.Value.AnimArrowLeft.IsWorking)
                    {
                        directionText.X = (int)drawing.Value.AnimArrowLeft.GetCurrentValue().X;
                    }
                    else
                    {
                        directionText.X = posX + 110;
                        drawing.Value.AnimArrowLeft.Start(new Vector2(directionText.X, directionText.Y));
                        directionText.X = (int)drawing.Value.AnimArrowLeft.GetCurrentValue().X;
                    }
                    drawing.Value.CurrentDirection = PowerDiff.Orientation.Enemy;
                    directionText.text             = "←";
                    directionText.Visible          = true;
                }
            }

            if (lowHpHero != null)
            {
                if (LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerShowLowHP").GetValue <bool>())
                {
                    Obj_AI_Hero heroLowHp = heroes.FirstOrDefault(x => x.IsEnemy && x.IsVisible);
                    if (heroLowHp != null)
                    {
                        foreach (Obj_AI_Hero hero in heroes)
                        {
                            if (hero.IsEnemy && hero.IsVisible)
                            {
                                if (heroLowHp.Health > hero.Health)
                                {
                                    heroLowHp = hero;
                                }
                            }
                        }
                        lowHpHero.text    = "Visible low HP: " + heroLowHp.ChampionName + " (" + heroLowHp.Health.ToString("0") + " HP)";
                        lowHpHero.X       = posX + 100;
                        lowHpHero.Y       = posY + 20 + (3 * 50);
                        lowHpHero.Visible = true;
                    }
                    else
                    {
                        lowHpHero.Visible = false;
                    }
                }
                else
                {
                    lowHpHero.Visible = false;
                }
            }
        }