Пример #1
0
        public void OnPlacement(Mobile from, Point3D p)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID) && map != Map.Ilshenar && map != Map.Malas)
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;
                    boat.ShipName = m_ShipName;

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.MoveToWorld(p, map);
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                }
            }
        }
Пример #2
0
        public void OnSummonBoat(Mobile from, Point3D p)
        {
            Map map = from.Map;

            if (map == null)
            {
                return;
            }

            BaseBoat boat = SummonedBoat;

            if (boat == null)
            {
                return;
            }

            p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

            if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
            {
                Delete();

                boat.Owner    = from;
                boat.Anchored = true;

                uint keyValue = boat.CreateKeys(from);

                if (boat.PPlank != null)
                {
                    boat.PPlank.KeyValue = keyValue;
                }

                if (boat.SPlank != null)
                {
                    boat.SPlank.KeyValue = keyValue;
                }

                boat.MoveToWorld(p, map);
            }
            else
            {
                boat.Delete();

                from.SendMessage("A ship cannot be summoned here.");
            }

            from.Frozen = false;
        }
Пример #3
0
        public void OnPlacement(Mobile from, Point3D p)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
                {
                    from.SendLocalizedMessage(1043284); // A ship can not be created here.
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
                {
                    from.SendLocalizedMessage(1010568, null, 0x25); // You may not place a ship while on another ship or inside a house.
                    return;
                }

                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.MoveToWorld(p, map);
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284); // A ship can not be created here.
                }
            }
        }
Пример #4
0
        public void OnPlacement(Mobile from, Point3D p, int itemID, Direction d)
        {
            if (Deleted)
            {
                return;
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
                {
                    from.SendLocalizedMessage(1043284); // A ship can not be created here.
                    return;
                }

                BaseBoat b = BaseBoat.FindBoatAt(from, from.Map);

                if (from.Region.IsPartOf(typeof(HouseRegion)) || b != null && (b.GetType() == Boat.GetType() || !b.IsRowBoat && !(this is RowBoatDeed)))
                {
                    from.SendLocalizedMessage(1010568, null, 0x25); // You may not place a ship while on another ship or inside a house.
                    return;
                }

                BoatDirection = d;
                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, itemID))
                {
                    if (boat.IsRowBoat)
                    {
                        BaseBoat lastrowboat = World.Items.Values.OfType <BaseBoat>().Where(x => x.Owner == from && x.IsRowBoat && x.Map != Map.Internal && !x.GetMobilesOnBoard().Any()).OrderByDescending(y => y.Serial).FirstOrDefault();

                        if (lastrowboat != null)
                        {
                            lastrowboat.Delete();
                        }
                    }
                    else
                    {
                        Delete();
                    }

                    boat.Owner  = from;
                    boat.ItemID = itemID;

                    if (boat is BaseGalleon)
                    {
                        ((BaseGalleon)boat).SecurityEntry = new SecurityEntry((BaseGalleon)boat);
                        ((BaseGalleon)boat).BaseBoatHue   = RandomBasePaintHue();
                    }

                    if (boat.IsClassicBoat)
                    {
                        uint keyValue = boat.CreateKeys(from);

                        if (boat.PPlank != null)
                        {
                            boat.PPlank.KeyValue = keyValue;
                        }

                        if (boat.SPlank != null)
                        {
                            boat.SPlank.KeyValue = keyValue;
                        }
                    }

                    boat.MoveToWorld(p, map);
                    boat.OnAfterPlacement(true);

                    var addon = LighthouseAddon.GetLighthouse(from);

                    if (addon != null)
                    {
                        if (boat.CanLinkToLighthouse)
                        {
                            from.SendLocalizedMessage(1154592); // You have linked your boat lighthouse.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1154597); // Failed to link to lighthouse.
                        }
                    }
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284); // A ship can not be created here.
                }
            }
        }
Пример #5
0
        public void OnPlacement(Mobile from, Point3D p, int itemID, Direction d)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                BoatDirection = d;
                BaseBoat boat = BoatItem;

                if (boat == null || boat.Deleted)
                {
                    boat = Boat;
                }

                if (boat == null)
                {
                    return;
                }

                Mobile oldOwner = boat.Owner;

                boat.BoatItem = this;
                boat.Owner    = from;

                if (oldOwner != from && boat is BaseGalleon)
                {
                    ((BaseGalleon)boat).SecurityEntry = new SecurityEntry((BaseGalleon)boat);
                }

                p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, itemID) && map != Map.Ilshenar && map != Map.Malas)
                {
                    boat.SetFacing(d);
                    boat.MoveToWorld(p, map);
                    boat.OnPlacement(from);
                    boat.Refresh();

                    boat.OnAfterPlacement(false);

                    var addon = LighthouseAddon.GetLighthouse(from);

                    if (addon != null)
                    {
                        if (boat.CanLinkToLighthouse)
                        {
                            from.SendLocalizedMessage(1154592); // You have linked your boat lighthouse.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1154597); // Failed to link to lighthouse.
                        }
                    }

                    if (boat.IsClassicBoat)
                    {
                        uint keyValue = boat.CreateKeys(from);

                        if (boat.PPlank != null)
                        {
                            boat.PPlank.KeyValue = keyValue;
                        }

                        if (boat.SPlank != null)
                        {
                            boat.SPlank.KeyValue = keyValue;
                        }
                    }

                    Internalize();
                }
                else
                {
                    from.SendLocalizedMessage(1043284); // A ship can not be created here.
                }
            }
        }
Пример #6
0
        public void OnPlacement(Mobile from, Point3D p, int hue)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                Map    map = from.Map;
                Region reg = Region.Find(from.Location, from.Map);

                if (map == null)
                {
                    return;
                }

                BaseBoat boat = Boat;
                boat.Hue = hue;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                bool CanBuild = false;

                if (reg.IsPartOf(typeof(OutDoorBadRegion)) ||
                    reg.IsPartOf(typeof(VillageRegion)) ||
                    reg.IsPartOf(typeof(BargeDeadRegion)) ||
                    reg.IsPartOf(typeof(DeadRegion)) ||
                    reg.IsPartOf(typeof(PirateRegion)) ||
                    reg.IsPartOf(typeof(OutDoorRegion)) ||
                    reg.IsPartOf(typeof(PublicRegion)) ||
                    Server.Misc.Worlds.IsMainRegion(Server.Misc.Worlds.GetRegionName(from.Map, from.Location)))
                {
                    CanBuild = true;
                }

                if (DockSearch.NearDock(from) == false)
                {
                    from.SendMessage("You must be near a dock to launch your ship!");
                }
                else if (BaseBoat.IsValidLocation(p, map) && CanBuild == true && boat.CanFit(p, map, boat.ItemID))
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;
                    boat.ShipName = m_ShipName;

                    if (from.Skills[SkillName.Fishing].Base >= 90)
                    {
                        boat.m_BoatDoor.Visible = true;
                    }

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.TillerMan.Hue = hue;
                    boat.Hold.Hue      = hue;
                    boat.BoatDoor.Hue  = hue;
                    boat.PPlank.Hue    = hue;
                    boat.SPlank.Hue    = hue;

                    boat.MoveToWorld(p, map);
                    from.PlaySound(0x026);
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                }
            }
        }
Пример #7
0
        public void OnPlacement(Mobile from, Point3D p, int hue)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                string phrase_a = "You must be near a dock to launch your ship!";
                string phrase_b = "A ship can not be launched here.";
                if (BaseBoat.isCarpet(Boat))
                {
                    phrase_b = "The magic of the carpet cannot be used here.";
                }

                Map    map = from.Map;
                Region reg = Region.Find(from.Location, from.Map);

                if (map == null)
                {
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
                {
                    from.SendMessage(phrase_a);
                    return;
                }

                BaseBoat boat = Boat;
                boat.Hue = hue;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                bool CanBuild = false;

                if (reg.IsPartOf(typeof(OutDoorBadRegion)) ||
                    reg.IsPartOf(typeof(VillageRegion)) ||
                    reg.IsPartOf(typeof(BargeDeadRegion)) ||
                    reg.IsPartOf(typeof(NecromancerRegion)) ||
                    reg.IsPartOf(typeof(DeadRegion)) ||
                    reg.IsPartOf("the Forgotten Lighthouse") ||
                    reg.IsPartOf("Anchor Rock Docks") ||
                    reg.IsPartOf("Kraken Reef Docks") ||
                    reg.IsPartOf("Savage Sea Docks") ||
                    reg.IsPartOf("Serpent Sail Docks") ||
                    reg.IsPartOf(typeof(PirateRegion)) ||
                    reg.IsPartOf(typeof(OutDoorRegion)) ||
                    reg.IsPartOf(typeof(PublicRegion)) ||
                    Server.Misc.Worlds.IsMainRegion(Server.Misc.Worlds.GetRegionName(from.Map, from.Location)))
                {
                    CanBuild = true;
                }

                if (!DockSearch.NearDock(from) && !BaseBoat.isCarpet(boat))
                {
                    from.SendMessage(phrase_a);
                }
                else if (BaseBoat.IsValidLocation(p, map) && CanBuild == true && boat.CanFit(p, map, boat.ItemID))
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;
                    boat.ShipName = m_ShipName;

                    if (from.Skills[SkillName.Fishing].Base >= 90 && boat.m_BoatDoor != null)
                    {
                        boat.m_BoatDoor.Visible = true; boat.BoatDoor.Hue = hue;
                    }

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.TillerMan.Hue = hue;
                    boat.Hold.Hue      = hue;
                    boat.PPlank.Hue    = hue;
                    boat.SPlank.Hue    = hue;

                    boat.MoveToWorld(p, map);
                    if (BaseBoat.isCarpet(boat))
                    {
                        from.PlaySound(0x1FD);
                    }
                    else
                    {
                        from.PlaySound(0x026);
                    }
                }
                else
                {
                    boat.Delete();
                    from.SendMessage(phrase_b);
                }
            }
        }
Пример #8
0
        public void OnPlacement(Mobile from, Point3D p, int itemID, Direction d)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
                {
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || (Server.Multis.BaseBoat.FindBoatAt(from, from.Map) != null && !(this is RowBoatDeed)))
                {
                    from.SendLocalizedMessage(1010568, null, 0x25);                       // You may not place a ship while on another ship or inside a house.
                    return;
                }

                m_Direction = d;
                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, itemID))
                {
                    Delete();

                    boat.Owner  = from;
                    boat.ItemID = itemID;

                    if (boat is BaseGalleon)
                    {
                        ((BaseGalleon)boat).SecurityEntry = new SecurityEntry((BaseGalleon)boat);
                        ((BaseGalleon)boat).BaseBoatHue   = RandomBasePaintHue();
                    }

                    if (boat.IsClassicBoat)
                    {
                        uint keyValue = boat.CreateKeys(from);

                        if (boat.PPlank != null)
                        {
                            boat.PPlank.KeyValue = keyValue;
                        }

                        if (boat.SPlank != null)
                        {
                            boat.SPlank.KeyValue = keyValue;
                        }
                    }

                    boat.MoveToWorld(p, map);
                    boat.OnAfterPlacement(true);

                    var addon = LighthouseAddon.GetLighthouse(from);

                    if (addon != null)
                    {
                        if (boat.CanLinkToLighthouse)
                        {
                            from.SendLocalizedMessage(1154592); // You have linked your boat lighthouse.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1154597); // Failed to link to lighthouse.
                        }
                    }
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                }
            }
        }
Пример #9
0
        public void OnPlacement(Mobile from, Point3D p)
        {
            PlayerMobile player = from as PlayerMobile;

            if (Deleted)
            {
                return;
            }

            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && map != Map.Felucca)
                {
                    from.SendLocalizedMessage(1043284); // A ship can not be created here.
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
                {
                    from.SendLocalizedMessage(1010568, null, 0x25); // You may not place a ship while on another ship or inside a house.
                    return;
                }

                if (from.GetDistanceToSqrt(p) > 10)
                {
                    from.SendMessage("You cannot place a ship that far away from land.");
                    return;
                }

                foreach (BaseBoat boatInstance in BaseBoat.m_Instances)
                {
                    if (boatInstance.Owner == from)
                    {
                        from.SendMessage("You already have a boat at sea.");
                        return;
                    }
                }

                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                Direction newDirection     = Direction.North;
                int       shipFacingItemID = -1;

                switch (from.Direction)
                {
                case Direction.North:
                    newDirection     = Direction.North;
                    shipFacingItemID = boat.NorthID;
                    break;

                case Direction.Up:
                    newDirection     = Direction.North;
                    shipFacingItemID = boat.NorthID;
                    break;

                case Direction.East:
                    newDirection     = Direction.East;
                    shipFacingItemID = boat.EastID;
                    break;

                case Direction.Right:
                    newDirection     = Direction.East;
                    shipFacingItemID = boat.EastID;
                    break;

                case Direction.South:
                    newDirection     = Direction.South;
                    shipFacingItemID = boat.SouthID;
                    break;

                case Direction.Down:
                    newDirection     = Direction.South;
                    shipFacingItemID = boat.SouthID;
                    break;

                case Direction.West:
                    newDirection     = Direction.West;
                    shipFacingItemID = boat.WestID;
                    break;

                case Direction.Left:
                    newDirection     = Direction.West;
                    shipFacingItemID = boat.WestID;
                    break;

                default:
                    newDirection     = Direction.North;
                    shipFacingItemID = boat.NorthID;
                    break;
                }

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, shipFacingItemID))
                {
                    //Set Boat Properties Stored in Deed
                    boat.CoOwners       = m_CoOwners;
                    boat.Friends        = m_Friends;
                    boat.GuildAsFriends = GuildAsFriends;

                    boat.Owner    = from;
                    boat.ShipName = m_ShipName;

                    boat.TargetingMode      = m_TargetingMode;
                    boat.TimeLastRepaired   = m_TimeLastRepaired;
                    boat.NextTimeRepairable = m_NextTimeRepairable;

                    boat.DecayTime = DateTime.UtcNow + boat.BoatDecayDelay;

                    boat.Anchored = true;

                    ShipUniqueness.GenerateShipUniqueness(boat);

                    boat.HitPoints  = HitPoints;
                    boat.SailPoints = SailPoints;
                    boat.GunPoints  = GunPoints;

                    bool fullSailPoints = (boat.SailPoints == boat.BaseMaxSailPoints);
                    bool fullGunPoints  = (boat.GunPoints == boat.BaseMaxGunPoints);
                    bool fullHitPoints  = (boat.HitPoints == boat.BaseMaxHitPoints);

                    boat.SetFacing(newDirection);

                    boat.MoveToWorld(p, map);

                    Delete();

                    BoatRune boatRune = new BoatRune(boat, from);
                    boat.BoatRune = boatRune;

                    BoatRune boatBankRune = new BoatRune(boat, from);
                    boat.BoatBankRune = boatBankRune;

                    bool addedToPack = false;
                    bool addedToBank = false;

                    if (from.AddToBackpack(boatRune))
                    {
                        addedToPack = true;
                    }

                    BankBox bankBox = from.FindBankNoCreate();

                    if (bankBox != null)
                    {
                        if (bankBox.Items.Count < bankBox.MaxItems)
                        {
                            bankBox.AddItem(boatBankRune);
                            addedToBank = true;
                        }
                    }

                    string message = "You place the ship at sea. A boat rune has been placed both in your bankbox and your backpack.";

                    if (!addedToPack && !addedToBank)
                    {
                        message = "You place the ship at sea. However, there was no room in neither your bankbox nor your backpack to place boat runes.";
                    }

                    else if (!addedToPack)
                    {
                        message = "You place the ship at sea. A boat rune was placed in your bankbox, however, there was no room in your backpack to place a boat rune.";
                    }

                    else if (!addedToBank)
                    {
                        message = "You place the ship at sea. A boat rune was placed in your backpack, however, there was no room in your bankbox to place a boat rune.";
                    }

                    from.SendMessage(message);
                }

                else
                {
                    boat.Delete();
                    from.SendMessage("A boat cannot be placed there. You may change your facing to change the direction of the boat placement.");
                }
            }
        }
Пример #10
0
        public void OnPlacement(Mobile from, Point3D p, int hue)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
                {
                    from.SendLocalizedMessage(1010568, null, 0x25);                       // You may not place a ship while on another ship or inside a house.
                    return;
                }

                BaseBoat boat = Boat;
                boat.Hue = hue;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;

                    if (from.Skills[SkillName.Fishing].Base >= 90)
                    {
                        boat.m_BoatDoor.Visible = true;
                    }

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.TillerMan.Hue = hue;
                    boat.Hold.Hue      = hue;
                    boat.BoatDoor.Hue  = hue;
                    boat.PPlank.Hue    = hue;
                    boat.SPlank.Hue    = hue;

                    boat.MoveToWorld(p, map);
                    from.PlaySound(0x026);
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                }
            }
        }
Пример #11
0
        public void OnPlacement(Mobile from, Point3D p)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");                   // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

                if (from.InRange(this.DockLocation, 20))
                {
                }
                else
                {
                    from.SendAsciiMessage("You are too far away from the location at which the ship was docked.");
                    return;
                }

                p = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID) && map != Map.Ilshenar && map != Map.Malas)
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;
                    boat.ShipName = m_ShipName;

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.MoveToWorld(p, map);
                }
                else
                {
                    boat.Delete();
                    from.SendAsciiMessage("A ship can not be created here.");                       // A ship can not be created here.
                }
            }
        }
Пример #12
0
        public void OnPlacement(Mobile from, Point3D p)
        {
            if (Deleted)
            {
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                 // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
                {
                    from.SendLocalizedMessage(1043284);                     // A ship can not be created here.
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
                {
                    // You may not place a ship while on another ship or inside a house.
                    from.SendLocalizedMessage(1010568, null, 0x25);
                    return;
                }

                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

                p = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    foreach (BoatComponent component in boat.BoatComponents)
                    {
                        if (component is BoatRope)
                        {
                            ((BoatRope)component).KeyValue = keyValue;
                        }
                    }

                    boat.MoveToWorld(p, map);
                    from.SendGump(
                        new WarningGump(
                            1060637,
                            30720,
                            "!!! WARNING WARNING WARNING WARNING !!!\nBoats are SINKABLE by using cannons. When a boat has sustained significant damage, it will also be BOARDABLE (the planks or ropes will open to anybody). This means anything that you have on the boat is at risk! The owner of a sunken boat can (through a deed that appears in their bank) either pay a ransom to those who destroyed the boat OR risk venturing out to repair the boat themselves, in which case they have a certain time window to do so or else it can be repaired and captured by anybody else (and therefore LOST TO THEM). Boat deeds and dry-docked boats ARE blessed.",
                            0xFFC000,
                            320,
                            240,
                            null,
                            null));
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                     // A ship can not be created here.
                }
            }
        }