示例#1
0
        protected void Loop()
        {
            var _timer         = new DateTime();
            var _InteractTimer = new DateTime();
            var castTele       = false;
            var tryCount       = 0;

            while (true)
            {
                Thread.Sleep(50);

                if (!game.InGame)
                {
                    continue;
                }

                try
                {
                    if (TPath.Count == 0)
                    {
                        if (doInteract && interactId != 0 && _InteractTimer.MSecToNow() >= 200)
                        {
                            using (var gameSuspender = new GameSuspender(game))
                            {
                                doInteract = false;
                                if (game.GameReady() && !game.IsDead())
                                {
                                    game.Interact(interactId, (UnitType)interactType);
                                }
                                interactId = 0;
                            }
                        }
                        continue;
                    }

                    var End = TPath[TPath.Count - 1];

                    // TODO: check skill for ping

                    if (castTele)
                    {
                        castTele = false;

                        _timer = DateTime.Now;
                        // TODO: check charges

                        using (var gameSuspender = new GameSuspender(game))
                        {
                            if (!game.GameReady() || game.IsDead() || game.IsInTown() || !game.TeleportTo((ushort)TPath[0].X, (ushort)TPath[0].Y))
                            {
                                TPath.Clear();
                                Logger.AutoTele.Log(game, LogType.Warning, "Failed to cast teleport.");
                                continue;
                            }
                        }
                    }

                    if (_timer.MSecToNow() > 500)
                    {
                        if (tryCount >= 5)
                        {
                            Logger.AutoTele.Log(game, LogType.Warning, "Failed to teleport after {0} tries.", tryCount);
                            TPath.Clear();
                            tryCount   = 0;
                            doInteract = false;
                            castTele   = false;
                            continue;
                        }
                        else
                        {
                            ++tryCount;
                            castTele = true;
                        }
                    }

                    if (TeleportPath.CalculateDistance(game.CurrentX, game.CurrentY, TPath[0].X, TPath[0].Y) <= 5)
                    {
                        TPath.RemoveAt(0);
                        castTele = true;
                        tryCount = 0;
                    }

                    if (doInteract)
                    {
                        if (TeleportPath.CalculateDistance(game.CurrentX, game.CurrentY, End.X, End.Y) <= 5)
                        {
                            doInteract     = false;
                            _InteractTimer = DateTime.Now;
                            using (var gameSuspender = new GameSuspender(game))
                            {
                                if (!game.GameReady() || game.IsDead())
                                {
                                    interactId = 0;
                                }
                                else
                                {
                                    interactId = game.MapHandler.GetUnitByXY((uint)End.X, (uint)End.Y, interactRoom);
                                }
                            }
                            TPath.Clear();
                            continue;
                        }
                    }
                }
                catch
                {
                    ///
                }
            }
        }
示例#2
0
        protected void BuildStats()
        {
            if (!game.InGame)
            {
                return;
            }

            using (var suspender = new GameSuspender(game))
            {
                var pUnit = game.GetPlayerUnit();
                if (pUnit == 0 || !game.GameReady())
                {
                    return;
                }

                var log = statsTextBox;
                log.Clear();

                var negresByDiff = new int[] { 0, 40, 100 };

                log.AppendText("Str: {0} + {1} = {2}", Color.Empty, game.GetBaseUnitStat(pUnit, StatType.Strength),
                               game.GetUnitStat(pUnit, StatType.Strength) - game.GetBaseUnitStat(pUnit, StatType.Strength),
                               game.GetUnitStat(pUnit, StatType.Strength));

                log.AppendLine("Dex: {0} + {1} = {2}", Color.Empty, game.GetBaseUnitStat(pUnit, StatType.Dexterity),
                               game.GetUnitStat(pUnit, StatType.Dexterity) - game.GetBaseUnitStat(pUnit, StatType.Dexterity),
                               game.GetUnitStat(pUnit, StatType.Dexterity));

                log.AppendLine("Vit: {0} + {1} = {2}", Color.Empty, game.GetBaseUnitStat(pUnit, StatType.Vitality),
                               game.GetUnitStat(pUnit, StatType.Vitality) - game.GetBaseUnitStat(pUnit, StatType.Vitality),
                               game.GetUnitStat(pUnit, StatType.Vitality));

                log.AppendLine("Eng: {0} + {1} = {2}", Color.Empty, game.GetBaseUnitStat(pUnit, StatType.Energy),
                               game.GetUnitStat(pUnit, StatType.Energy) - game.GetBaseUnitStat(pUnit, StatType.Energy),
                               game.GetUnitStat(pUnit, StatType.Energy));

                log.AppendLine("", Color.Empty);

                log.AppendLine("Fire Resist: ", Color.Red);
                log.AppendText("{0} - {1} = {2} / {3}", Color.Empty,
                               game.GetUnitStat(pUnit, StatType.FireResist),
                               negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.FireResist) - negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.MaxFireResist) + 75);

                log.AppendLine("Cold Resist: ", Color.SkyBlue);
                log.AppendText("{0} - {1} = {2} / {3}", Color.Empty,
                               game.GetUnitStat(pUnit, StatType.ColdResist),
                               negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.ColdResist) - negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.MaxColdResist) + 75);

                log.AppendLine("Lightning Resist: ", Color.Yellow);
                log.AppendText("{0} - {1} = {2} / {3}", Color.Empty,
                               game.GetUnitStat(pUnit, StatType.LightResist),
                               negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.LightResist) - negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.MaxLightningResist) + 75);

                log.AppendLine("Poison Resist: ", Color.LawnGreen);
                log.AppendText("{0} - {1} = {2} / {3}", Color.Empty,
                               game.GetUnitStat(pUnit, StatType.PoisonResist),
                               negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.PoisonResist) - negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.MaxPoisonResist) + 75);

                log.AppendLine("Magic Resist: ", Color.Orange);
                log.AppendText("{0} - {1} = {2} / {3}", Color.Empty,
                               game.GetUnitStat(pUnit, StatType.MagicResist),
                               negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.MagicResist) - negresByDiff[game.GetDifficulty()],
                               game.GetUnitStat(pUnit, StatType.MaxMagicResist) + 75);

                log.AppendLine("Damage Resist: ", Color.SandyBrown);
                log.AppendText("{0}%", Color.Empty,
                               game.GetUnitStat(pUnit, StatType.DamageResist));

                log.AppendLine("", Color.Empty);

                log.AppendLine("Absorbs: ", Color.Empty);
                log.AppendText("{0}", Color.Red, game.GetUnitStat(pUnit, StatType.AbsorbFire));
                log.AppendText("/", Color.Empty);
                log.AppendText("{0}", Color.SkyBlue, game.GetUnitStat(pUnit, StatType.AbsorbCold));
                log.AppendText("/", Color.Empty);
                log.AppendText("{0}", Color.Yellow, game.GetUnitStat(pUnit, StatType.AbsorbLight));
                log.AppendText("/", Color.Empty);
                log.AppendText("{0}", Color.Orange, game.GetUnitStat(pUnit, StatType.AbsorbMagic));

                log.AppendLine("Absorb Pcts: ", Color.Empty);
                log.AppendText("{0}%", Color.Red, game.GetUnitStat(pUnit, StatType.AbsorbFirePercent));
                log.AppendText("/", Color.Empty);
                log.AppendText("{0}%", Color.SkyBlue, game.GetUnitStat(pUnit, StatType.AbsorbColdPercent));
                log.AppendText("/", Color.Empty);
                log.AppendText("{0}%", Color.Yellow, game.GetUnitStat(pUnit, StatType.AbsorbLightingPercent));
                log.AppendText("/", Color.Empty);
                log.AppendText("{0}%", Color.Orange, game.GetUnitStat(pUnit, StatType.AbsorbLightingPercent));

                log.AppendLine("", Color.Empty);

                log.AppendLine("Magic Find: ", Color.SkyBlue);
                log.AppendText("{0}%", Color.Empty, game.GetUnitStat(pUnit, StatType.MagicFind));
                log.AppendLine("Gold Find: ", Color.Yellow);
                log.AppendText("{0}%", Color.Empty, game.GetUnitStat(pUnit, StatType.GoldFind));

                log.AppendLine("", Color.Empty);

                log.AppendLine("Faster Cast Rate: {0}%", Color.Empty, game.GetUnitStat(pUnit, StatType.FasterCastRate));
                log.AppendLine("Faster Hit Recovery: {0}%", Color.Empty, game.GetUnitStat(pUnit, StatType.FasterHitRecovery));
                log.AppendLine("Increased Attack Speed: {0}%", Color.Empty, game.GetUnitStat(pUnit, StatType.FasterAttackRate));
                log.AppendLine("Faster Block Rate: {0}%", Color.Empty, game.GetUnitStat(pUnit, StatType.FasterBlockRate));
                log.AppendLine("Faster Run/Walk: {0}%", Color.Empty, game.GetUnitStat(pUnit, StatType.FasterMoveVelocity));

                log.AppendLine("", Color.Empty);

                log.AppendLine("Crushing Blow: {0}", Color.Empty, game.GetUnitStat(pUnit, StatType.CrushingBlow));
                log.AppendLine("Deadly Strike: {0}", Color.Empty, game.GetUnitStat(pUnit, StatType.DeadlyStrike));
            }
        }