Exemple #1
0
        protected bool TelePick(ushort x, ushort y)
        {
            using (var suspender = new GameSuspender(game))
            {
                if (!game.InGame || !game.GameReady())
                {
                    throw new Exception("Out of game");
                }

                if (game.IsDead())
                {
                    Disable(PickitDisableReason.Died);
                    throw new Exception("Player is dead");
                }

                if (game.IsInTown())
                {
                    return(false);
                }

                game.RefreshUnitPosition();

                if (Math.Sqrt(Math.Pow((double)game.CurrentX - x, 2) + Math.Pow((double)game.CurrentY - y, 2)) >= telePickupRadius)
                {
                    return(false);
                }

                if (!game.TeleportTo(x, y))
                {
                    return(false);
                }

                teleHistory.Add(new Point(game.CurrentX, game.CurrentY));
            }

            return(true);
        }
Exemple #2
0
        public bool Update()
        {
            var player = game.GetPlayerUnit();

            if (player == 0)
            {
                return(false);
            }

            if (!game.GameReady())
            {
                return(false);
            }

            Name = game.GetPlayerName();

            foreach (var stat in CollectableStats)
            {
                stats[stat] = game.GetUnitStat(player, stat);
            }

            return(true);
        }
Exemple #3
0
        public void RevealAct()
        {
            UnitAny unit;

            if (!game.InGame || !game.GameReady() || !game.GetPlayerUnit(out unit))
            {
                Logger.MapHack.Log(game, LogType.Warning, "Failed to reveal act.");
                return;
            }

            if (revealedActs.Contains(unit.dwAct))
            {
                Logger.MapHack.Log(game, LogType.None, "Act {0} is already revealed.", unit.dwAct + 1);
                return;
            }

            if (unit.pAct == 0)
            {
                Logger.MapHack.Log(game, LogType.Warning, "Failed to reveal act {0}.", unit.dwAct + 1);
                return;
            }

            var pAct = LoadAct(unit);

            if (pAct == 0)
            {
                Logger.MapHack.Log(game, LogType.Warning, "Failed to reveal act.");
                return;
            }

            var act = game.Debugger.Read <Act>(pAct);

            if (act.pMisc == 0)
            {
                Logger.MapHack.Log(game, LogType.Warning, "Failed to reveal act.");
                return;
            }

            var actMisc = game.Debugger.Read <ActMisc>(act.pMisc);

            if (actMisc.pLevelFirst == 0)
            {
                Logger.MapHack.Log(game, LogType.Warning, "Failed to reveal act.");
                return;
            }

            for (var i = m_ActLevels[unit.dwAct]; i < m_ActLevels[unit.dwAct + 1]; ++i)
            {
                if (!revealedLevels.Contains(i))
                {
                    _RevealLevel(i, false);
                }
            }

            UnloadAct(pAct, unit);

            //PrintGameString("Revealed act", D2Color.Red);

            revealedActs.Add(unit.dwAct);

            Logger.MapHack.Log(game, LogType.None, "Revealed act {0}.", unit.dwAct + 1);
        }