Beispiel #1
0
        public bool CourseTurn(int offset, bool message)
        {
            if (CurrentTurnTimer != null)
            {
                CurrentTurnTimer.Stop();
            }

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

            if (Anchored)
            {
                if (message)
                {
                    TillerMan.Say(501419); // Ar, the anchor is down sir!
                }
                return(false);
            }
            else if (SetFacing((Direction)(((int)Facing + offset) & 0x7)))
            {
                return(true);
            }
            else
            {
                if (message)
                {
                    TillerMan.Say(501423); // Ar, can't turn sir.
                }
                return(false);
            }
        }
Beispiel #2
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!
                }
            }
        }
Beispiel #3
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.
            }
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public bool LowerAnchor(bool message)
        {
            if (CheckDecay())
            {
                return(false);
            }

            if (Anchored)
            {
                if (message && TillerMan != null)
                {
                    TillerMan.Say(501445);                     // Ar, the anchor was already dropped sir.
                }
                return(false);
            }

            EndMove();

            Anchored = true;

            if (message && TillerMan != null)
            {
                TillerMan.Say(501444);                 // Ar, anchor dropped sir.
            }
            return(true);
        }
Beispiel #6
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);
            }
        }
Beispiel #7
0
        public override void Refresh()
        {
            base.Refresh();

            if (TillerMan != null)
            {
                TillerMan.RefreshTillerMan();
            }
        }
Beispiel #8
0
        public bool StartCourse(bool single, bool message)
        {
            if (Anchored)
            {
                if (message && TillerMan != null)
                {
                    TillerMan.Say(501419); // Ar, the anchor is down sir!
                }
                return(false);
            }

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

            if (MapItem == null || MapItem.Deleted)
            {
                if (message && TillerMan != null)
                {
                    TillerMan.Say(502513); // I have seen no map, sir.
                }
                return(false);
            }
            else if (Map != MapItem.Map || !Contains(MapItem.GetWorldLocation()))
            {
                if (message && TillerMan != null)
                {
                    TillerMan.Say(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.Say(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.Say(501429); // Aye aye sir.
            }
            return(true);
        }
Beispiel #9
0
        public void EndDryDock(Mobile from)
        {
            if (Deleted || CheckDecay())
            {
                return;
            }

            DryDockResult result = CheckDryDock(from);

            if (result == DryDockResult.Dead)
            {
                from.SendLocalizedMessage(502493); // You appear to be dead.
            }
            else if (result == DryDockResult.NoKey)
            {
                from.SendLocalizedMessage(502494); // You must have a key to the ship to dock the boat.
            }
            else if (result == DryDockResult.NotAnchored)
            {
                from.SendLocalizedMessage(1010570); // You must lower the anchor to dock the boat.
            }
            else if (result == DryDockResult.Mobiles)
            {
                from.SendLocalizedMessage(502495); // You cannot dock the ship with beings on board!
            }
            else if (result == DryDockResult.Items)
            {
                from.SendLocalizedMessage(502496); // You cannot dock the ship with a cluttered deck.
            }
            else if (result == DryDockResult.Hold)
            {
                from.SendLocalizedMessage(502497); // Make sure your hold is empty, and try again!
            }
            if (result != DryDockResult.Valid)
            {
                return;
            }

            BaseDockedGalleon boat = DockedGalleon;

            if (boat == null)
            {
                return;
            }

            RemoveKeys(from);

            from.AddToBackpack(boat);

            if (TillerMan != null)
            {
                TillerMan.Delete();
            }

            Delete();
        }
Beispiel #10
0
        protected override bool EndMove()
        {
            if (!base.EndMove())
            {
                return(false);
            }

            if (TillerMan != null)
            {
                TillerMan.Say(501424);                 //Ar, we've stopped sir.
            }

            return(true);
        }
Beispiel #11
0
 public void EmergencyRepairs()
 {
     if (NextRepairTime < DateTime.Now)
     {
         //TillerMan.Say(1116597, "5, 5, 5");
         Durability     = 50;
         NextRepairTime = DateTime.Now + TimeSpan.FromMinutes(5.0);
     }
     else
     {
         TimeSpan TimeBeforeRepair = NextRepairTime - DateTime.Now;
         TillerMan.Say(1116592, TimeBeforeRepair.ToString());
     }
 }
Beispiel #12
0
        protected override bool EndMove()
        {
            if (!base.EndMove())
            {
                return(false);
            }

            if (TillerMan != null)
            {
                TillerMan.RefreshTillerMan();
            }

            return(true);
        }
Beispiel #13
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);
     }
 }
Beispiel #14
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));
        }
Beispiel #15
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);
        }
Beispiel #16
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);
        }
Beispiel #17
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);
        }
Beispiel #18
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.
            }
        }
Beispiel #19
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~.
                }
            }
        }
Beispiel #20
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~.
                }
            }
        }
Beispiel #21
0
        protected override void OnDurabilityChange(ushort oldDurability)
        {
            GalleonStatus newStatus = (GalleonStatus)(Durability / Math.Ceiling(MaxDurability / 3.0));

            if (newStatus != Status)
            {
                Status = newStatus;
                ItemID = GetMultiId(Facing);
                OnStatusChange();
            }

            GalleonCondition newCondition = (GalleonCondition)(Durability / Math.Ceiling(MaxDurability / 4.0));

            if (newCondition != Condition)
            {
                Condition = newCondition;

                if (TillerMan != null)
                {
                    TillerMan.RefreshTillerMan();
                }
            }
        }
Beispiel #22
0
        public bool RaiseAnchor(bool message)
        {
            if (CheckDecay())
            {
                return(false);
            }

            if (!Anchored)
            {
                if (message && TillerMan != null)
                {
                    TillerMan.Say(501447);                     // Ar, the anchor has not been dropped sir.
                }
                return(false);
            }

            Anchored = false;

            if (message && TillerMan != null)
            {
                TillerMan.Say(501446);                 // Ar, anchor raised sir.
            }
            return(true);
        }
Beispiel #23
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));
        }