Example #1
0
        public void OnTarget(Mobile from, Point3D point)
        {
            BaseBoat boatFrom = BaseBoat.FindBoatAt(from.Location, this.Map);
            BaseBoat boatTo   = BaseBoat.FindBoatAt(point, this.Map);

            double distance = 1000;

            if (boatFrom == null)
            {
                from.SendMessage("You must be onboard this ship in order to transfer its doubloons.");
                return;
            }

            if (boatTo != null)
            {
                distance = boatFrom.GetBoatToBoatDistance(boatFrom, boatTo);

                if (!(distance >= 0 && distance <= 6))
                {
                    from.SendMessage("The targeted ship is not close enough to transfer the doubloons.");
                    return;
                }

                if (boatTo.IsOwner(from) || boatTo.IsCoOwner(from))
                {
                    if (boatTo.Hold == null)
                    {
                        from.SendMessage("That ship does not have a hold to transfer doubloons to.");
                        return;
                    }

                    if (boatTo.Hold.Deleted)
                    {
                        from.SendMessage("That ship does not have a hold to transfer doubloons to.");
                        return;
                    }

                    int doubloonsFrom = boatFrom.GetHoldDoubloonTotal(boatFrom);

                    int deposited = 0;

                    return;
                }

                else
                {
                    from.SendMessage("You must be the owner or co-owner of the ship in order to transfer doubloons to that ship.");
                    return;
                }
            }

            else
            {
                from.SendMessage("");
                return;
            }
        }