示例#1
0
        public void RemoveArrow(BoatTrackingArrow arrow)
        {
            if (m_Arrows.Contains(arrow))
            {
                m_Arrows.Remove(arrow);
            }

            if (m_Mobile == null)
            {
                return;
            }

            if (m_Arrows.Count == 0)
            {
                m_Mobile.QuestArrow = null;
                RemoveContext(m_Mobile);
            }
            else
            {
                if (m_Mobile.QuestArrow == arrow)
                {
                    m_Mobile.QuestArrow = null;
                }

                if (m_Arrows.Count > 0)
                {
                    m_Mobile.QuestArrow = m_Arrows[0];
                }
            }
        }
示例#2
0
        public bool IsTrackingBoat(Item item)
        {
            if (item is BaseBoat || item is PlunderBeaconAddon)
            {
                for (var index = 0; index < m_Arrows.Count; index++)
                {
                    BoatTrackingArrow arrow = m_Arrows[index];

                    if (arrow.Boat == item)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#3
0
        public void RemoveArrow(BoatTrackingArrow arrow)
        {
            if (m_Arrows.Contains(arrow))
                m_Arrows.Remove(arrow);

            if(m_Mobile == null)
                return;

            if (m_Arrows.Count == 0)
            {
                m_Mobile.QuestArrow = null;
                RemoveContext(m_Mobile);
            }
            else
            {
                if (m_Mobile.QuestArrow == arrow)
                    m_Mobile.QuestArrow = null;

                if (m_Arrows.Count > 0)
                    m_Mobile.QuestArrow = m_Arrows[0];
            }
        }
示例#4
0
 public void AddArrow(BoatTrackingArrow arrow)
 {
     m_Arrows.Add(arrow);
 }
示例#5
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);
            }
        }
示例#7
0
		public void AddArrow(BoatTrackingArrow arrow)
		{
			m_Arrows.Add(arrow);
		}
示例#8
0
		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);
		}