Example #1
0
        public override void OnClick(bool rightClick)
        {
            if (rightClick && m_From != null)
            {
                ShipTrackingContext st = ShipTrackingContext.GetContext(m_From);

                if (st != null)
                {
                    st.RemoveArrow(this);
                }

                m_From = null;
                Stop();
            }
        }
Example #2
0
        public static void StopTracking(Mobile from)
        {
            ShipTrackingContext st = ShipTrackingContext.GetContext(from);

            if (st != null)
            {
                for (int i = 0; i < st.Arrows.Count; i++)
                {
                    st.Arrows[i].Stop();
                }

                ShipTrackingContext.RemoveContext(from);
            }

            from.QuestArrow = null;
        }
Example #3
0
        public static void StartTracking(Mobile from)
        {
            if (!ShipTrackingContext.CanAddContext(from))
            {
                return;
            }

            List <Item> targets = new List <Item>();
            Map         map     = from.Map;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            BaseBoat            fromBoat = BaseBoat.FindBoatAt(from, map);
            ShipTrackingContext context  = ShipTrackingContext.GetContext(from);

            if (fromBoat == null)
            {
                from.SendMessage("You must be on your boat to use this command.");
            }

            IPooledEnumerable eable = map.GetItemsInRange(from.Location, MaxRange);

            foreach (Item item in eable)
            {
                if (context != null && context.IsTrackingBoat(item))
                {
                    continue;
                }
                if (!targets.Contains(item) && (item is BaseBoat boat && boat != fromBoat || item is PlunderBeaconAddon))
                {
                    targets.Add(item);
                }
            }

            eable.Free();

            List <BoatTrackingArrow> arrows = new List <BoatTrackingArrow>();

            for (int i = 0; i < targets.Count; i++)
            {
                if (i >= MaxBoats)
                {
                    break;
                }

                BoatTrackingArrow arrow = new BoatTrackingArrow(from, targets[i], MaxRange);

                if (context == null)
                {
                    arrows.Add(arrow);
                }
                else
                {
                    context.AddArrow(arrow);
                }
            }

            if (from.QuestArrow == null && arrows.Count > 0)
            {
                from.QuestArrow = arrows[0];
            }

            if (context == null)
            {
                new ShipTrackingContext(from, arrows);
            }
        }
        public static void StartTracking(Mobile from)
        {
            if (!ShipTrackingContext.CanAddContext(from))
            {
                from.SendMessage("You are already tracking 5 boats.");
                return;
            }

            List <BaseBoat> targets = new List <BaseBoat>();
            Map             map     = from.Map;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            BaseBoat            fromBoat = BaseBoat.FindBoatAt(from, map);
            ShipTrackingContext context  = ShipTrackingContext.GetContext(from);

            if (fromBoat == null)
            {
                from.SendMessage("You must be on your boat to use this command.");
            }

            //int prowessBonus = Server.Engines.Quests.BountyPlayerEntry.GetRange(from) / 4;//BoatMovementRecord.GetRange(Server.Engines.Quests.BountyPlayerEntry.GetSeaProwess(from));
            //int range = (int)(Math.Max(32, from.Skills[SkillName.Tracking].Value * 1.5) + prowessBonus); //between 32 and 150 + Sea Prowess Range
            int range = ShipTrackingContext.GetTrackingRange(from);

            IPooledEnumerable eable = map.GetItemsInRange(from.Location, range);

            foreach (Item item in eable)
            {
                if (context != null && context.IsTrackingBoat(item))
                {
                    continue;
                }
                if (item is BaseBoat && (BaseBoat)item != fromBoat && !targets.Contains((BaseBoat)item))
                {
                    targets.Add((BaseBoat)item);
                }
            }

            eable.Free();

            List <BoatTrackingArrow> arrows = new List <BoatTrackingArrow>();

            if (targets.Count == 0)
            {
                from.SendMessage("There are no boats in the area to track.");
                return;
            }

            for (int i = 0; i < targets.Count; i++)
            {
                if (i >= MaxBoats)
                {
                    break;
                }

                BoatTrackingArrow arrow = new BoatTrackingArrow(from, targets[i], MaxRange + (int)from.Skills[SkillName.Tracking].Value);

                if (context == null)
                {
                    arrows.Add(arrow);
                }
                else
                {
                    context.AddArrow(arrow);
                }
            }

            if (from.QuestArrow == null && arrows.Count > 0)
            {
                from.QuestArrow = arrows[0];
            }

            if (context == null)
            {
                new ShipTrackingContext(from, arrows);
            }
        }