Exemple #1
0
        public static void DoRequest()
        {
            NavList request = GetRequest();

            if (request != null)
            {
                ArrayList list = GetBeacons(request.GetRequester(), request.GetDestination());
                if (list.Count >= 1)
                {
                    list.Sort(new Beacon_Sort(SortDirection.Ascending, request.GetDestination()));

                    Mobile m = request.GetRequester();

                    if (((Item)list[0]) != ((BaseCreature)m).Beacon)
                    {
                        //loop through and for each beacon of same weight add it to a 2nd list then choose a random one from it
                        ArrayList randombeacon = new ArrayList();

                        int weight = ((NavBeacon)list[0]).GetWeight((int)request.GetDestination());

                        foreach (NavBeacon n in list)
                        {
                            if (n.GetWeight((int)request.GetDestination()) == weight)
                            {
                                randombeacon.Add(n);
                            }
                        }

                        int i = Utility.Random(randombeacon.Count);

                        ((BaseCreature)m).NavPoint = ((Item)list[i]).Location;
                        ((BaseCreature)m).Beacon   = ((NavBeacon)list[i]);
                        ((BaseCreature)m).Home     = ((Item)list[i]).Location;;
                        RemoveRequest(request);
                    }
                    else
                    {
                        ((BaseCreature)m).NavPoint       = Point3D.Zero;
                        ((BaseCreature)m).NavDestination = NavDestinations.None;
                        ((BaseCreature)m).Beacon         = null;
                        RemoveRequest(request);
                    }
                }
                else
                {
                    Mobile m = request.GetRequester();
                    ((BaseCreature)m).NavDestination = NavDestinations.None;
                    ((BaseCreature)m).NavPoint       = Point3D.Zero;
                    ((BaseCreature)m).Beacon         = null;
                    RemoveRequest(request);
                }
            }
        }
Exemple #2
0
		private static void RemoveRequest(NavList m)
		{
			Navs.Remove(m);
		}
Exemple #3
0
			public static void AddRequest(Mobile m, NavDestinations nav)
			{
				NavList n = new NavList(m, nav);
				Navs.Add(n);
			}
Exemple #4
0
        public static void AddRequest(Mobile m, NavDestinations nav)
        {
            NavList n = new NavList(m, nav);

            Navs.Add(n);
        }
Exemple #5
0
 private static void RemoveRequest(NavList m)
 {
     Navs.Remove(m);
 }