예제 #1
0
        private void Drawing_OnDraw(EventArgs args)
        {
            DrawRecallBars();

            //var testTime = HelperUtils.TickCount;

            //for (int j = 0; j < 10;j++ )

            foreach (var hero in HeroManager.AllHeroes)
            {
                if (hero.IsMe ||
                    !hero.IsHPBarRendered ||
                    (hero.IsAlly && !menu.Item("TrackAllyCooldown").GetValue <bool>()) ||
                    (hero.IsEnemy && !menu.Item("TrackEnemyCooldown").GetValue <bool>())
                    )
                {
                    continue;
                }

                var startX = hero.HPBarPosition.X - 13;
                var startY = hero.HPBarPosition.Y +
                             (hero.IsAlly ? allyOffsetY : enemyOffsetY);

                foreach (var slot in summonerSpellSlots)
                {
                    var spell         = hero.Spellbook.GetSpell(slot);
                    var time          = spell.CooldownExpires - Game.Time;
                    var totalCooldown = spell.Cooldown;

                    SpellTrackerInfo spellInfo;
                    if (spellCooldowns[hero.NetworkId].TryGetValue(spell.Name.ToLower(), out spellInfo))
                    {
                        time          = (spellInfo.cooldownExpires - HelperUtils.TickCount) / 1000;
                        totalCooldown = spellInfo.totalCooldown > 0 ? spellInfo.totalCooldown : totalCooldown;
                    }

                    var percent = (time > 0 && Math.Abs(totalCooldown) > float.Epsilon)
                            ? 1f - (time / totalCooldown)
                            : 1f;

                    var spellState = hero.Spellbook.CanUseSpell(slot);

                    if (menu.Item("TrackerShowTextCooldown").GetValue <bool>() && percent != 1f)
                    {
                        if (Tracker.useSummonerIcons)
                        {
                            TextUtils.DrawText(startX - 20, startY,
                                               Color.White, HelperUtils.FormatSpellTime(time * 1000));
                        }
                        else
                        {
                            TextUtils.DrawText(startX - 25, startY - 3,
                                               Color.White, HelperUtils.FormatSpellTime(time * 1000));
                        }
                    }

                    if (Tracker.useSummonerIcons)
                    {
                        startY += 12;
                        continue;
                    }

                    if (percent != 1f)
                    {
                        Drawing.DrawLine(new Vector2(startX, startY), new Vector2(startX + 20, startY), 12, Color.Black);
                        Drawing.DrawLine(new Vector2(startX + 1, startY + 1), new Vector2(startX + 19, startY + 1), 10, Color.Gray);
                    }
                    else
                    {
                        Drawing.DrawLine(new Vector2(startX, startY), new Vector2(startX + 20, startY), 12, Color.Green);
                    }



                    if (spellState != SpellState.NotLearned)
                    {
                        var color = Color.Orange;


                        if (slot == SpellSlot.Summoner1)
                        {
                            color = SummonerData.heroS1Color[hero.NetworkId];
                        }
                        else
                        {
                            color = SummonerData.heroS2Color[hero.NetworkId];
                        }

                        Drawing.DrawLine(new Vector2(startX + 1, startY + 1),
                                         new Vector2(startX + 1 + 18 * percent, startY + 1),
                                         10, color);
                    }

                    startY += 12;
                }

                startX += 23;
                startY -= 6;

                Drawing.DrawLine(new Vector2(startX - 2, startY - 1), new Vector2(startX + 105, startY - 1), 8, Color.Black);

                foreach (var slot in spellSlots)
                {
                    var spell         = hero.Spellbook.GetSpell(slot);
                    var time          = spell.CooldownExpires - Game.Time;
                    var totalCooldown = spell.Cooldown;

                    SpellTrackerInfo spellInfo;
                    if (spellCooldowns[hero.NetworkId].TryGetValue(spell.Name.ToLower(), out spellInfo))
                    {
                        time          = (spellInfo.cooldownExpires - HelperUtils.TickCount) / 1000;
                        totalCooldown = spellInfo.totalCooldown > 0 ? spellInfo.totalCooldown : totalCooldown;
                    }

                    var percent = (time > 0 && Math.Abs(totalCooldown) > float.Epsilon)
                            ? 1f - (time / totalCooldown)
                            : 1f;

                    var spellState = hero.Spellbook.CanUseSpell(slot);

                    if (percent != 1f)
                    {
                        Drawing.DrawLine(new Vector2(startX, startY), new Vector2(startX + 20, startY), 5, Color.Gray);
                    }

                    if (spellState != SpellState.NotLearned)
                    {
                        var color = Color.Yellow;

                        if (percent == 1f)
                        {
                            color = Color.Green;
                        }

                        /*if (spellState == SpellState.NoMana)
                         * {
                         *  color = Color.Blue;
                         * }
                         *
                         * if (spellState == SpellState.Disabled)
                         * {
                         *  color = Color.Black;
                         * }*/

                        if (time > 0 && time < 2)
                        {
                            color = Color.Orange;
                        }

                        if (menu.Item("TrackNoMana").GetValue <bool>() &&
                            spell.ManaCost > hero.Mana)
                        {
                            color = Color.Pink;
                        }

                        if (menu.Item("TrackerShowTextCooldown").GetValue <bool>() && percent != 1f)
                        {
                            TextUtils.DrawText(startX, startY + 5,
                                               Color.White, HelperUtils.FormatSpellTime(time * 1000));
                        }

                        Drawing.DrawLine(new Vector2(startX, startY), new Vector2(startX + 20 * percent, startY), 5, color);
                    }

                    startX = startX + 27;
                }
            }

            //Console.WriteLine("Time spent: " + (HelperUtils.TickCount - testTime));
        }