Exemple #1
0
        public bool StopMove(bool message)
        {
            if (CheckDecay())
            {
                return(false);
            }

            if (CurrentMoveTimer == null)
            {
                if (message && TillerMan != null)
                {
                    TillerMan.TillerManSay(501443);                     // Er, the ship is not moving sir.
                }
                return(false);
            }

            Moving = Direction.North;

            if (CurrentMoveTimer != null)
            {
                CurrentMoveTimer.Stop();
            }

            if (message && TillerMan != null)
            {
                TillerMan.TillerManSay(501429);                 // Aye aye sir.
            }
            return(true);
        }
Exemple #2
0
        public override void Rename(string newName)
        {
            if (CheckDecay())
            {
                return;
            }

            if (newName != null && newName.Length > 40)
            {
                newName = newName.Substring(0, 40);
            }

            if (ShipName == newName)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502531); // Yes, sir.
                }
                return;
            }

            ShipName = newName;

            if (TillerMan != null && ShipName != null)
            {
                TillerMan.TillerManSay(1042885, ShipName); // This ship is now called the ~1_NEW_SHIP_NAME~.
            }
            else if (TillerMan != null)
            {
                TillerMan.TillerManSay(502534); // This ship now has no name.
            }
        }
Exemple #3
0
        public virtual bool CourseTurn(int offset, bool message)
        {
            if (CurrentTurnTimer != null)
            {
                CurrentTurnTimer.Stop();
            }

            if (CheckDecay())
            {
                return(false);
            }

            if (SetFacing((Direction)(((int)Facing + offset) & 0x7)))
            {
                return(true);
            }
            else
            {
                if (message)
                {
                    TillerMan.TillerManSay(501423); // Ar, can't turn sir.
                }
                return(false);
            }
        }
Exemple #4
0
        public void AssociateMap(MapItem map)
        {
            if (CheckDecay())
            {
                return;
            }

            if (map is BlankMap)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502575);                     // Ar, that is not a map, tis but a blank piece of paper!
                }
            }
            else if (map.Pins.Count == 0)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502576);                     // Arrrr, this map has no course on it!
                }
            }
            else
            {
                StopMove(false);

                MapItem      = map;
                NextNavPoint = -1;

                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502577);                     // A map!
                }
            }
        }
Exemple #5
0
 protected override bool Move(Direction dir, SpeedCode speed)
 {
     if (base.Move(dir, speed))
     {
         return(true);
     }
     else
     {
         if (TillerMan != null)
         {
             TillerMan.TillerManSay(501424);                     //Ar, we've stopped sir.
         }
         return(false);
     }
 }
Exemple #6
0
        public virtual bool StartCourse(bool single, bool message)
        {
            if (CheckDecay())
            {
                return(false);
            }

            if (MapItem == null || MapItem.Deleted)
            {
                if (message && TillerMan != null)
                {
                    TillerMan.TillerManSay(502513); // I have seen no map, sir.
                }
                return(false);
            }
            else if (Map != MapItem.Map || !Contains(MapItem.GetWorldLocation()))
            {
                if (message && 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 (message && TillerMan != null)
                {
                    TillerMan.TillerManSay(1042551); // I don't see that navpoint, sir.
                }
                return(false);
            }

            Order = single ? BoatOrder.Single : BoatOrder.Course;

            if (CurrentMoveTimer != null)
            {
                CurrentMoveTimer.Stop();
            }

            CurrentCourseMoveTimer = new CourseMoveTimer(this, FastInterval, SpeedCode.Fast, false);
            CurrentCourseMoveTimer.Start();

            if (message && TillerMan != null)
            {
                TillerMan.TillerManSay(501429); // Aye aye sir.
            }
            return(true);
        }
Exemple #7
0
        public bool StartCourse(string navPoint, bool single, bool message)
        {
            int number = -1;

            int start = -1;

            for (int i = 0; i < navPoint.Length; i++)
            {
                if (Char.IsDigit(navPoint[i]))
                {
                    start = i;
                    break;
                }
            }

            if (start != -1)
            {
                string sNumber = navPoint.Substring(start);

                if (!int.TryParse(sNumber, out number))
                {
                    number = -1;
                }

                if (number != -1)
                {
                    number--;

                    if (this.MapItem == null || number < 0 || number >= this.MapItem.Pins.Count)
                    {
                        number = -1;
                    }
                }
            }

            if (number == -1)
            {
                if (message && TillerMan != null)
                {
                    TillerMan.TillerManSay(1042551); // I don't see that navpoint, sir.
                }
                return(false);
            }

            NextNavPoint = number;
            return(StartCourse(single, message));
        }
Exemple #8
0
        public override void BeginRename(Mobile from)
        {
            if (from.AccessLevel < AccessLevel.GameMaster && from != Owner)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(Utility.Random(1042876, 4)); // Arr, don't do that! | Arr, leave me alone! | Arr, watch what thour'rt doing, matey! | Arr! Do that again and I’ll throw ye overhead!
                }
                return;
            }

            if (TillerMan != null)
            {
                TillerMan.TillerManSay(502580); // What dost thou wish to name thy ship?
            }
            base.BeginRename(from);
        }
Exemple #9
0
        public override void EndRename(Mobile from, string newName)
        {
            if (from.AccessLevel < AccessLevel.GameMaster && from != Owner)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(1042880);                     // Arr! Only the owner of the ship may change its name!
                }
                return;
            }
            else if (!from.Alive)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502582);                     // You appear to be dead.
                }
                return;
            }

            base.EndRename(from, newName);
        }
Exemple #10
0
        public override void SetName(SpeechEventArgs e)
        {
            if (e.Mobile.AccessLevel < AccessLevel.GameMaster && e.Mobile != Owner)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(1042880); // Arr! Only the owner of the ship may change its name!
                }
                return;
            }
            else if (!e.Mobile.Alive)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502582); // You appear to be dead.
                }
                return;
            }

            base.SetName(e);
        }
Exemple #11
0
        public override void RemoveName(Mobile m)
        {
            if (CheckDecay())
            {
                return;
            }

            if (m.AccessLevel < AccessLevel.GameMaster && m != Owner)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(1042880); // Arr! Only the owner of the ship may change its name!
                }
                return;
            }
            else if (!m.Alive)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502582); // You appear to be dead.
                }
                return;
            }

            if (ShipName == null)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502526); // Ar, this ship has no name.
                }
                return;
            }

            ShipName = null;

            if (TillerMan != null)
            {
                TillerMan.TillerManSay(502534); // This ship now has no name.
            }
        }
Exemple #12
0
        public override void GiveName(Mobile m)
        {
            if (CheckDecay())
            {
                return;
            }

            if (ShipName == null)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(502526);                     // Ar, this ship has no name.
                }
            }
            else
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(1042881, ShipName);                     // This is the ~1_BOAT_NAME~.
                }
            }
        }
Exemple #13
0
        public void GiveNavPoint()
        {
            if (TillerMan == null || CheckDecay())
            {
                return;
            }

            if (this.NextNavPoint < 0)
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(1042882);                     // I have no current nav point.
                }
            }
            else
            {
                if (TillerMan != null)
                {
                    TillerMan.TillerManSay(1042883, (this.NextNavPoint + 1).ToString());                     // My current destination navpoint is nav ~1_NAV_POINT_NUM~.
                }
            }
        }
Exemple #14
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));
        }