Ejemplo n.º 1
0
 public void Save()
 {
     if (!changed)
     {
         return;
     }
     lock (this)
     {
         if (continent == null)
         {
             return;
         }
         string filename = "PPather\\NPCInfo\\" + continent + "_" + myFaction + ".txt";
         try
         {
             System.IO.TextWriter s = System.IO.File.CreateText(filename);
             foreach (string name in NPCs.Keys)
             {
                 NPC n = NPCs[name];
                 s.WriteLine(n.ToString());
             }
             s.Close();
         }
         catch (Exception e)
         {
             PPather.WriteLine("!Error:Exception writing NPC data: " + e);
         }
         changed = false;
     }
 }
Ejemplo n.º 2
0
 public void Save()
 {
     lock (this)
     {
         if (!changed)
         {
             return;
         }
         if (toonName == null)
         {
             return;
         }
         string filename = "PPather\\ToonInfo\\" + toonName + ".txt";
         try
         {
             System.IO.TextWriter s = System.IO.File.CreateText(filename);
             foreach (string key in dic.Keys)
             {
                 string val = dic[key];
                 s.WriteLine(key + "|" + val);
             }
             s.Close();
         }
         catch (Exception e)
         {
             PPather.WriteLine("!Error:Exception writing toon state data: " + e);
         }
         changed = false;
     }
 }
Ejemplo n.º 3
0
        /*
         * 1 - location is front
         * 2 - location is right
         * 3 - location is back
         * 4 - location is left
         */
        int GetLocationDirection(GLocation loc)
        {
            int    dir = 0;
            double b   = loc.Bearing;

            if (b > -PI / 4 && b <= PI / 4)              // Front
            {
                dir = 1;
            }
            if (b > -3 * PI / 4 && b <= -PI / 4)             // Left
            {
                dir = 4;
            }
            if (b <= -3 * PI / 4 || b > 3 * PI / 4)             //  Back
            {
                dir = 3;
            }
            if (b > PI / 4 && b <= 3 * PI / 4)             //  Right
            {
                dir = 2;
            }
            if (dir == 0)
            {
                PPather.WriteLine("Odd, no known direction");
            }

            return(dir);
        }
Ejemplo n.º 4
0
        //Coordinate StuckLocation = null;

        public StuckDetecter(PPather pather, int stuckSensitivity, int abortSensitivity)
        {
            this.Me = BoogieCore.Player;
            this.stuckSensitivity = stuckSensitivity;
            this.abortSensitivity = abortSensitivity;
            this.mover            = PPather.mover;
            firstStuckCheck       = true;
        }
Ejemplo n.º 5
0
        //GLocation StuckLocation = null;

        public StuckDetecter(PPather pather, int stuckSensitivity, int abortSensitivity)
        {
            this.Me               = GContext.Main.Me;
            this.Context          = GContext.Main;
            this.stuckSensitivity = stuckSensitivity;
            this.abortSensitivity = abortSensitivity;
            this.mover            = PPather.mover;
            firstStuckCheck       = true;
        }
Ejemplo n.º 6
0
        public MoveResult move(double howClose)
        {
            if (GiveUpIfUnsafe)
            {
                if (!pather.IsItSafeAt(Me.Target, Me.Location))
                {
                    return(MoveResult.Unsafe);
                }
            }
            if (PathTimeout.IsReady)
            {
                MoveAlong = null;
            }
            if (MoveAlong == null)
            {
                Location from = new Location(Me.Location);
                mover.Stop();
                Path path = world.CreatePath(from, target, (float)howClose, PPather.radar);
                PathTimeout.Reset();
                if (path == null || path.Count() == 0)
                {
                    PPather.WriteLine("EasyMover: Can not create path . giving up");
                    mover.MoveRandom();
                    Thread.Sleep(200);
                    mover.Stop();
                    return(MoveResult.CantFindPath);
                }
                else
                {
                    //PPather.WriteLine("Save path to " + pathfile);
                    //path.Save(pathfile);
                    MoveAlong = new MoveAlonger(pather, path);
                }
            }

            if (MoveAlong != null)
            {
                Location from = new Location(Me.Location);

                if (MoveAlong.path.Count() == 0 || from.GetDistanceTo(target) < howClose)
                {
                    //PPather.WriteLine("Move along used up");
                    MoveAlong = null;
                    mover.Stop();
                    return(MoveResult.GotThere);
                }
                else if (!MoveAlong.MoveAlong())
                {
                    MoveAlong = null;                     // got stuck!
                    if (GiveUpIfStuck)
                    {
                        return(MoveResult.Stuck);
                    }
                }
            }
            return(MoveResult.Moving);
        }
Ejemplo n.º 7
0
 public EasyMover(PPather pather, Location target, bool GiveUpIfStuck, bool GiveUpIfUnsafe)
 {
     this.target         = target;
     this.Me             = BoogieCore.Player;
     this.world          = pather.world;
     mover               = PPather.mover;
     this.GiveUpIfStuck  = GiveUpIfStuck;
     this.GiveUpIfUnsafe = GiveUpIfUnsafe;
     this.pather         = pather;
 }
Ejemplo n.º 8
0
 public EasyMover(PPather pather, Location target, bool GiveUpIfStuck, bool GiveUpIfUnsafe)
 {
     this.target = target;
     this.Me = BoogieCore.Player;
     this.world = pather.world;
     mover = PPather.mover;
     this.GiveUpIfStuck = GiveUpIfStuck;
     this.GiveUpIfUnsafe = GiveUpIfUnsafe;
     this.pather = pather;
 }
Ejemplo n.º 9
0
        public static void dumpGObjects(string what)
        {
            lock (dumpGObjects_seenObjects)
            {
                dumpGObjects_seenObjects.Clear();

                form.devTree.Nodes.Clear();
                string check = form.dumpUiFilter.Text.ToLower();

                try
                {
                    MethodInfo mi   = typeof(GObjectList).GetMethod(what);
                    GObject[]  objs = (GObject[])mi.Invoke(null, null);

                    Array.Sort <GObject>(objs,
                                         new Comparison <GObject>(
                                             delegate(GObject o1, GObject o2)
                    {
                        return(o1.Name.CompareTo(o2.Name));
                    })
                                         );

                    foreach (GObject obj in objs)
                    {
                        if (!obj.Name.ToLower().Contains(check))
                        {
                            continue;
                        }

                        // if (obj == GPlayerSelf.Me) continue; // crashing ...

                        PPather.WriteLine("Dumping: " + obj.Name);

                        TreeNode node = dumpObjectRecursive(obj.Name, obj);
                        form.devTree.Nodes.Add(node);
                    }
                }
                catch (Exception e)
                {
                    string s = e.GetType().FullName + "\n" +
                               e.Message + "\n\n";

                    if (e.InnerException != null)
                    {
                        s += e.InnerException.GetType().FullName + "\n" +
                             e.InnerException.Message + "\n\n";
                    }

                    s += e.StackTrace;

                    MessageBox.Show(s);
                }
            }
        }
Ejemplo n.º 10
0
 public MoveAlonger(PPather pather, Path path)
 {
     this.Me    = BoogieCore.Player;
     this.path  = path;
     this.world = pather.world;
     mover      = PPather.mover;
     sd         = new StuckDetecter(pather, 1, 2);
     prev       = null;
     current    = path.GetFirst();
     next       = path.GetSecond();
 }
Ejemplo n.º 11
0
 public MoveAlonger(PPather pather, Path path)
 {
     this.Context = GContext.Main;
     this.Me      = Context.Me;
     this.path    = path;
     this.world   = PPather.world;
     mover        = PPather.mover;
     sd           = new StuckDetecter(pather, 1, 2);
     prev         = null;
     current      = path.GetFirst();
     next         = path.GetSecond();
 }
Ejemplo n.º 12
0
 public EasyMover(PPather pather, Location target, bool GiveUpIfStuck,
                  bool GiveUpIfUnsafe)
 {
     this.target         = target;
     this.Me             = GContext.Main.Me;
     this.Context        = GContext.Main;
     this.world          = PPather.world;
     mover               = PPather.mover;
     this.GiveUpIfStuck  = GiveUpIfStuck;
     this.GiveUpIfUnsafe = GiveUpIfUnsafe;
     this.pather         = pather;
 }
Ejemplo n.º 13
0
        public void Update(GUnit[] units)
        {
            int dt = -updateTimer.TicksLeft;

            foreach (GUnit u in units)
            {
                if (u.Reaction == GReaction.Hostile)
                {
                    if (!u.IsDead && !PPather.IsStupidItem(u))
                    {
                        UnitData ud;
                        if (dic.TryGetValue(u.GUID, out ud))
                        {
                            ud.Update(dt);
                        }
                        else
                        {
                            // new one
                            ud = new UnitData(u);
                            dic.Add(u.GUID, ud);
                        }
                    }
                }
            }

            List <long> rem = new List <long>();

            foreach (UnitData ud in dic.Values)
            {
                if (!ud.unit.IsValid && ud.lastSeen.IsReady)
                {
                    rem.Add(ud.guid);
                }
                else if (ud.unit.IsDead)
                {
                    rem.Add(ud.guid);
                }
            }
            foreach (long guid in rem)
            {
                dic.Remove(guid);
            }
            updateTimer.Reset();
        }
Ejemplo n.º 14
0
        public void Load()
        {
            lock (this)
            {
                if (toonName == null)
                {
                    return;
                }
                dic = new Dictionary <string, string>();

                // Load from file
                PPather.WriteLine("Loading toon data...");
                try
                {
                    string filename        = "PPather\\ToonInfo\\" + toonName + ".txt";
                    System.IO.TextReader s = System.IO.File.OpenText(filename);

                    int    nr = 0;
                    string line;
                    while ((line = s.ReadLine()) != null)
                    {
                        char[]   splitter = { '|' };
                        string[] st       = line.Split(splitter);
                        if (st.Length == 2)
                        {
                            string key = st[0];
                            string val = st[1];
                            Set(key, val);
                            nr++;
                        }
                    }
                    PPather.WriteLine("Loaded " + nr + " toon state data");

                    s.Close();
                }
                catch (Exception)
                {
                    PPather.WriteLine("!Warning:Failed reading toon state data");
                }
                changed = false;
            }
        }
Ejemplo n.º 15
0
        public void Load()
        {
            lock (this)
            {
                if (continent == null)
                {
                    return;
                }
                NPCs = new Dictionary <string, NPC>(StringComparer.InvariantCultureIgnoreCase);
                // Load from file
                try
                {
                    string filename        = "PPather\\NPCInfo\\" + continent + "_" + myFaction + ".txt";
                    System.IO.TextReader s = System.IO.File.OpenText(filename);

                    int    nr = 0;
                    string line;
                    while ((line = s.ReadLine()) != null)
                    {
                        NPC n = new NPC();
                        if (n.FromString(line))
                        {
                            if (!NPCs.ContainsKey(n.name))
                            {
                                NPCs.Add(n.name, n);
                                nr++;
                            }
                        }
                    }
                    PPather.WriteLine("Loaded " + nr + " NPCs");

                    s.Close();
                }
                catch (Exception)
                {
                    //PPather.WriteLine("Exception reading NPC data: " + e);
                    PPather.WriteLine("!Warning:Failed to load NPC data");
                }
                changed = false;
            }
        }
Ejemplo n.º 16
0
 public void Update()
 {
     lock (this)
     {
         if (continent == null)
         {
             return;
         }
         if (NPCs == null)
         {
             return;
         }
         GUnit[] units = GObjectList.GetUnits();
         foreach (GUnit unit in units)
         {
             if ((unit.Reaction == GReaction.Friendly || unit.Reaction == GReaction.Neutral) &&
                 !unit.IsPlayer &&
                 unit.CreatureType != GCreatureType.Critter &&
                 unit.CreatureType != GCreatureType.Totem &&
                 !PPather.IsPlayerFaction(unit))
             {
                 string name = unit.Name;
                 NPC    n    = null;
                 if (!NPCs.TryGetValue(name, out n))
                 {
                     n          = new NPC();
                     n.name     = name;
                     n.faction  = unit.FactionID;
                     n.location = unit.Location;
                     n.reaction = unit.Reaction;
                     PPather.WriteLine("New NPC found: " + name);
                     NPCs.Add(name, n);
                     changed = true;
                 }
             }
         }
     }
 }
Ejemplo n.º 17
0
        public void Update(BoogieBot.Common.Object[] units)
        {
            int dt = (int)-updateTimer.TicksLeft;

            foreach (BoogieBot.Common.Object u in units)
            {
                if (!u.IsDead && !PPather.IsStupidItem(u))
                {
                    UnitData ud;
                    if (dic.TryGetValue((long)u.GUID.GetOldGuid(), out ud))
                    {
                        ud.Update((int)dt);
                    }
                    else
                    {
                        // new one
                        ud = new UnitData(u);
                        dic.Add((long)u.GUID.GetOldGuid(), ud);
                    }
                }
            }

            List <long> rem = new List <long>();

            foreach (UnitData ud in dic.Values)
            {
                if (!ud.unit.IsValid)
                {
                    rem.Add(ud.guid);
                }
            }
            foreach (long guid in rem)
            {
                dic.Remove(guid);
            }
            updateTimer.Reset();
        }
Ejemplo n.º 18
0
 public static void SaveSettings()
 {
     PPather.PatherSettings.FormTitle =
         form.txt_setting_formtitle.Text;
     PPather.PatherSettings.UseMount =
         form.cb_setting_usemount.SelectedItem.ToString();
     PPather.PatherSettings.MountRange =
         float.Parse(form.txt_setting_mountrange.Text);
     PPather.PatherSettings.MaxResurrection =
         form.chk_setting_maxres.Checked;
     PPather.PatherSettings.MaxResurrectionAmount =
         int.Parse(form.txt_setting_maxres.Text);
     PPather.PatherSettings.StopAtLevel =
         int.Parse(form.txt_setting_stoplevel.Text);
     try
     {
         PPather.PatherSettings.Save();
         PPather.WriteLine("Your settings have been saved");
     }
     catch
     {
         PPather.WriteLine("!Error:Couldn't access PPather.xml. Is it open in another program?");
     }
 }
Ejemplo n.º 19
0
        GSpellTimer StuckTimeout = new GSpellTimer(333); // Check every 333ms

        #endregion Fields

        #region Constructors

        //Coordinate StuckLocation = null;
        public StuckDetecter(PPather pather, int stuckSensitivity, int abortSensitivity)
        {
            this.Me = BoogieCore.Player;
            this.stuckSensitivity = stuckSensitivity;
            this.abortSensitivity = abortSensitivity;
            this.mover = PPather.mover;
            firstStuckCheck = true;
        }
Ejemplo n.º 20
0
        public bool checkStuck()
        {
            if (firstStuckCheck)
            {
                oldLocation     = GContext.Main.Me.Location;
                predictedDX     = 0;
                predictedDY     = 0;
                firstStuckCheck = false;
                lastStuckCheck.Reset();
            }
            else
            {
                // update predicted location
                double h;
                double speed;
                h = mover.GetMoveHeading(out speed);

                float dt = (float)-lastStuckCheck.TicksLeft / 1000f;
                float dx = (float)Math.Cos(h) * (float)speed * dt;
                float dy = (float)Math.Sin(h) * (float)speed * dt;
                //PPather.WriteLine("speed: " + speed + " dt: " + dt + " dx: " + dx + " dy : " + dy);
                predictedDX += dx;
                predictedDY += dy;

                lastStuckCheck.Reset();
                if (StuckTimeout.IsReady)
                {
                    // Check stuck
                    GLocation loc    = Me.Location;
                    float     realDX = loc.X - oldLocation.X;
                    float     realDY = loc.Y - oldLocation.Y;
                    //PPather.WriteLine(" dx: " + predictedDX + " dy : " + predictedDY + " Real dx: " + realDX + " dy : " + realDY );

                    float predictDist = (float)Math.Sqrt(predictedDX * predictedDX + predictedDY * predictedDY);
                    float realDist    = (float)Math.Sqrt(realDX * realDX + realDY * realDY);

                    //PPather.WriteLine(" pd " + predictDist + " rd " + realDist);

                    int multiplier = 3;
                    if (GPlayerSelf.Me.IsStealth)
                    {
                        multiplier = 4;
                    }

                    if (predictDist > realDist * multiplier)
                    {
                        // moving a lot slower than predicted
                        // check direction
                        GLocation excpected = new GLocation(loc.X + predictedDX, loc.Y + predictedDY);

                        PPather.WriteLine("I am stuck " + stuckMove);                         //. Jumping to get free");
                        if (stuckMove == 0)
                        {
                            mover.Forwards(false);
                            mover.Forwards(true);
                            mover.StrafeLeft(true);
                            //mover.Jump();
                            //mover.StrafeRight(false);
                        }
                        else if (stuckMove == 1)
                        {
                            mover.Forwards(false);
                            mover.Forwards(true);
                            mover.StrafeLeft(true);
                            //PPather.WriteLine("  strafe left");
                            //mover.Jump();
                            //mover.StrafeLeft(false);
                        }
                        else if (stuckMove == 2)
                        {
                            mover.Forwards(false);
                            mover.Forwards(true);
                            mover.StrafeRight(true);
                            //PPather.WriteLine("  strafe left");
                            //mover.StrafeLeft(true);
                        }
                        else if (stuckMove == 2)
                        {
                            mover.Forwards(false);
                            mover.Forwards(true);
                            mover.StrafeRight(true);
                            //PPather.WriteLine("  strafe left");
                            //mover.StrafeLeft(true);
                        }
                        stuckMove++;
                        if (stuckMove >= abortSensitivity)
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        stuckMove = 0;
                    }
                    predictedDX = 0;
                    predictedDY = 0;
                    oldLocation = loc;
                    StuckTimeout.Reset();
                }
            }
            return(false);
        }
Ejemplo n.º 21
0
 public MoveAlonger(PPather pather, Path path)
 {
     this.Me = BoogieCore.Player;
     this.path = path;
     this.world = pather.world;
     mover = PPather.mover;
     sd = new StuckDetecter(pather, 1, 2);
     prev = null;
     current = path.GetFirst();
     next = path.GetSecond();
 }
Ejemplo n.º 22
0
        // called when we have died, return when we are alive again
        private void GhostRun()
        {
            BoogieCore.Log(LogType.System, "I died. Let's resurrect");
            Coordinate CorpseLocation = null;



            Coordinate gloc = new Coordinate(0, 0, 0);

            if (CorpseLocation != null)
            {
                gloc = CorpseLocation;
            }

            Location   target = null;
            Coordinate gtarget;

            BoogieCore.Log(LogType.System, "Corpse is at " + gloc);

            if (gloc.Z == 0)
            {
                BoogieCore.Log(LogType.System, "hmm, corpse Z == 0");
                target = new Location(gloc);
                for (int q = 0; q < 50; q += 5)
                {
                    float stand_z = 0;
                    int   flags   = 0;
                    float x       = gloc.X + random.Next(20) - 10;
                    float y       = gloc.Y + random.Next(20) - 10;
                    bool  ok      = world.triangleWorld.FindStandableAt(x, y,
                                                                        -5000,
                                                                        5000,
                                                                        out stand_z, out flags, 0, 0);
                    if (ok)
                    {
                        target = new Location(x, y, stand_z);
                        break;
                    }
                }
            }
            else
            {
                target = new Location(gloc);
            }
            gtarget = new Coordinate(target.X, target.Y, target.Z);

            BoogieCore.Log(LogType.System, "Corpse is at " + target);
            EasyMover em = new EasyMover(this, target, false, false);

            // 2. Run to corpse
            while (Me.IsDead && Me.DistanceTo(gloc) > 20)     // fixme
            {
                EasyMover.MoveResult mr = em.move();
                if (mr != EasyMover.MoveResult.Moving)
                {
                    return;                                        // buhu
                }
                UpdateMyPos();
                Thread.Sleep(50);
            }
            mover.Stop();

            // 3. Find a safe place to res
            // is within 20 yds of corpse now, dialog must be up
            float SafeDistance = 25.0f;

            while (true)
            {
                // some brute force :p
                BoogieBot.Common.Object[] monsters = BoogieCore.world.getObjectListArray();
                float    best_score    = 1E30f;
                float    best_distance = 1E30f;
                Location best_loc      = null;
                for (float x = -35; x <= 35; x += 5)
                {
                    for (float y = -35; y <= 35; y += 5)
                    {
                        float      rx  = target.X + x;
                        float      ry  = target.Y + y;
                        Coordinate xxx = new Coordinate(rx, ry, 0);
                        if (xxx.DistanceTo(gtarget) < 35)
                        {
                            float stand_z = 0;
                            int   flags   = 0;
                            bool  ok      = world.triangleWorld.FindStandableAt(rx, ry,
                                                                                target.Z - 20,
                                                                                target.Z + 20,
                                                                                out stand_z, out flags, 0, 0);
                            if (ok)
                            {
                                float      score = 0.0f;
                                Coordinate l     = new Coordinate(rx, ry, stand_z);
                                foreach (BoogieBot.Common.Object monster in monsters)
                                {
                                    if (monster != null && !monster.IsDead)
                                    {
                                        float d = l.DistanceTo(monster.GetCoordinates());
                                        if (d < 35)
                                        {
                                            // one point per yard
                                            score += 35 - d;
                                        }
                                    }
                                }
                                float this_d = Me.DistanceTo(l);
                                if (score <= best_score && this_d < best_distance)
                                {
                                    best_score    = score;
                                    best_distance = this_d;
                                    best_loc      = new Location(l);
                                }
                            }
                        }
                    }
                }
                if (best_loc != null)
                {
                    Coordinate best_gloc = new Coordinate(best_loc.X, best_loc.Y, best_loc.Z);
                    // walk over there
                    WalkTo(best_gloc, false, 10000, true);

                    // Check if I am safe
                    bool safe = true;
                    BoogieBot.Common.Object unsafe_monster = null;
                    foreach (BoogieBot.Common.Object monster in monsters)
                    {
                        if (!monster.IsDead && !PPather.IsStupidItem(monster))
                        {
                            float d = Me.DistanceTo(monster.GetCoordinates());
                            if (d < SafeDistance)
                            {
                                if (Math.Abs(monster.GetPositionZ() - Me.Location.Z) < 15)
                                {
                                    safe           = false;
                                    unsafe_monster = monster;
                                }
                            }
                        }
                    }
                    if (safe)
                    {
                        break;     // yeah
                    }
                }

                // hmm, look again
                Thread.Sleep(2000);
                SafeDistance -= 0.5f;
            }
        }
Ejemplo n.º 23
0
        public bool MoveAlong()
        {
            double    max  = 3.0;
            GLocation loc  = GContext.Main.Me.Location;
            Location  isAt = new Location(loc.X, loc.Y, loc.Z);

            /*
             * while (isAt.GetDistanceTo(current) < max && next != null)
             * {
             *      //PPather.WriteLine(current + " - " + next);
             *      path.RemoveFirst();
             *      if (path.Count() == 0)
             *      {
             *              //PPather.WriteLine("ya");
             *              //return true; // good in some way
             *      }
             *      else
             *      {
             *              prev = current;
             *              current = path.GetFirst();
             *              next = path.GetSecond();
             *      }
             * }
             */
            bool consume = false;

            do
            {
                bool blocked = false;

                consume = false;
                if (next != null)
                {
                    world.triangleWorld.IsStepBlocked(loc.X, loc.Y, loc.Z, next.X, next.Y, next.Z,
                                                      PathGraph.toonHeight, PathGraph.toonSize, null);
                }
                double d = isAt.GetDistanceTo(current);
                if ((d < max && !blocked) ||
                    d < 1.5)
                {
                    consume = true;
                }

                if (consume)
                {
                    //PPather.WriteLine("Consume spot " + current + " d " + d + " block " + blocked);
                    path.RemoveFirst();
                    if (path.Count() == 0)
                    {
                        break;
                    }
                    else
                    {
                        prev    = current;
                        current = path.GetFirst();
                        next    = path.GetSecond();
                    }
                }
            } while (consume);

            {
                //PPather.WriteLine("Move towards " + current);
                GLocation gto = new GLocation((float)current.X, (float)current.Y, (float)current.Z);
                GLocation face;
                if (next != null)
                {
                    face = new GLocation(next.X, next.Y, next.Z);
                }
                else
                {
                    face = gto;
                }

                if (!mover.moveTowardsFacing(Me, gto, 0.5, face))
                {
                    PPather.WriteLine("Can't move " + current);
                    world.BlacklistStep(prev, current);
                    //world.MarkStuckAt(loc, Me.Heading);
                    mover.MoveRandom();
                    Thread.Sleep(500);
                    mover.Stop();
                    return(false);
                    // hmm, mover does not want to move, must be up or down
                }

                {
                    double h;
                    double speed;
                    h = mover.GetMoveHeading(out speed);
                    float stand_z = 0.0f;
                    int   flags   = 0;
                    float x       = isAt.X + (float)Math.Cos(h) * 1.0f;
                    float y       = isAt.Y + (float)Math.Sin(h) * 1.0f;
                    float z       = isAt.Z;
                    bool  aheadOk = world.triangleWorld.FindStandableAt(x, y,
                                                                        z - 4,
                                                                        z + 6,
                                                                        out stand_z, out flags, 0, 0);
                    if (!aheadOk)
                    {
                        blockCount++;
                        PPather.WriteLine("Heading into a wall or off a cliff " + blockCount);
                        world.MarkStuckAt(isAt, (float)Me.Heading);

                        if (prev != null)
                        {
                            GLocation gprev = new GLocation((float)prev.X, (float)prev.Y, (float)prev.Z);

                            if (!mover.moveTowardsFacing(Me, gprev, 0.5, face))
                            {
                                mover.Stop();
                                return(false);
                            }
                        }
                        if (blockCount > 1)
                        {
                            world.BlacklistStep(prev, current);
                            return(false);
                        }

                        return(true);
                    }
                    else
                    {
                        blockCount = 0;
                    }
                }


                if (sd.checkStuck())
                {
                    PPather.WriteLine("Stuck at " + isAt);
                    world.MarkStuckAt(isAt, (float)Me.Heading);
                    world.BlacklistStep(prev, current);
                    mover.Stop();
                    return(false);
                }
            }
            return(true);
        }