예제 #1
0
        public bool DoMove()
        {
            Direction dir;
            SpeedCode speed;

            if (Order == BoatOrder.Move)
            {
                dir   = Moving;
                speed = Speed;
            }
            else if (MapItem == null || MapItem.Deleted)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502513); // I have seen no map, sir.
                }
                return(false);
            }
            else if (Map != MapItem.Map || !Contains(MapItem.GetWorldLocation()))
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502514); // The map is too far away from me, sir.
                }
                return(false);
            }
            else if ((Map != Map.Trammel && Map != Map.Felucca) || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(1042551); // I don't see that navpoint, sir.
                }
                return(false);
            }
            else
            {
                Point2D dest = (Point2D)MapItem.Pins[NextNavPoint];

                int x, y;
                MapItem.ConvertToWorld(dest.X, dest.Y, out x, out y);

                int maxSpeed;
                dir = GetMovementFor(x, y, out maxSpeed);

                if (maxSpeed == 0)
                {
                    if (Order == BoatOrder.Single && TillerMan != null)
                    {
                        TillerMan.TillerManSay(1042874, (NextNavPoint + 1).ToString()); // We have arrived at nav point ~1_POINT_NUM~ , sir.
                    }
                    if (NextNavPoint + 1 < MapItem.Pins.Count)
                    {
                        NextNavPoint++;

                        if (Order == BoatOrder.Course)
                        {
                            if (TillerMan != null)
                            {
                                TillerMan.TillerManSay(1042875, (NextNavPoint + 1).ToString()); // Heading to nav point ~1_POINT_NUM~, sir.
                            }
                            return(true);
                        }

                        return(false);
                    }
                    else
                    {
                        this.NextNavPoint = -1;

                        if (Order == BoatOrder.Course && TillerMan != null)
                        {
                            TillerMan.TillerManSay(502515); // The course is completed, sir.
                        }
                        return(false);
                    }
                }

                speed = (SpeedCode)Math.Min((int)SpeedCode.Fast, maxSpeed);
            }

            Turn(dir);

            return(BeginCourse(dir, speed));
        }