Beispiel #1
0
        public void CheckUpdate(Mobile m)
        {
            if (Schools.ContainsKey(m.Map))
            {
                SchoolEntry entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, SchoolRange));

                if (entry != null)
                {
                    m.SendLocalizedMessage(1152647); // Fish are schooling right here!
                    return;
                }

                entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, MessageRange));

                if (entry != null)
                {
                    m.SendLocalizedMessage(1152638, GetDirectionString(Utility.GetDirection(m, entry.Location))); // The fish finder pulls you to the ~1_DIRECTION~.
                }
                else
                {
                    m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
                }
            }
            else
            {
                m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
            }
        }
Beispiel #2
0
        public static bool HasSchool(Mobile m)
        {
            if (m == null || !m.Alive || m.Backpack == null)
            {
                return(false);
            }

            if (m.Backpack.FindItemByType <MagicalFishFinder>() != null && Schools.ContainsKey(m.Map))
            {
                SchoolEntry entry = null;

                for (var index = 0; index < Schools[m.Map].Count; index++)
                {
                    var e = Schools[m.Map][index];

                    if (m.InRange(e.Location, SchoolRange))
                    {
                        entry = e;
                        break;
                    }
                }

                if (entry != null)
                {
                    entry.OnFish();
                    return(true);
                }
            }

            return(false);
        }
Beispiel #3
0
        public void CheckUpdate(Mobile m)
        {
            if (Schools.ContainsKey(m.Map))
            {
                SchoolEntry entry = null;

                for (var index = 0; index < Schools[m.Map].Count; index++)
                {
                    var e = Schools[m.Map][index];

                    if (m.InRange(e.Location, SchoolRange))
                    {
                        entry = e;
                        break;
                    }
                }

                if (entry != null)
                {
                    m.SendLocalizedMessage(1152647); // Fish are schooling right here!
                    return;
                }

                for (var index = 0; index < Schools[m.Map].Count; index++)
                {
                    var e = Schools[m.Map][index];

                    if (m.InRange(e.Location, MessageRange))
                    {
                        entry = e;
                        break;
                    }
                }

                if (entry != null)
                {
                    m.SendLocalizedMessage(1152638, GetDirectionString(Utility.GetDirection(m, entry.Location))); // The fish finder pulls you to the ~1_DIRECTION~.
                }
                else
                {
                    m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
                }
            }
            else
            {
                m.SendLocalizedMessage(1152637); // The fish finder shows you nothing.
            }
        }
Beispiel #4
0
        public static void ExpireSchool(Map map, SchoolEntry entry)
        {
            if (Schools.ContainsKey(map) && Schools[map].Contains(entry))
            {
                Schools[map].Remove(entry);

                Point3D p;
                int     failsafe = 0;

                do
                {
                    p = SOS.FindLocation(map);
                    failsafe++;
                }while (p == Point3D.Zero && failsafe < 10);

                Schools[map].Add(new SchoolEntry(map, new Point2D(p.X, p.Y)));
            }
        }
Beispiel #5
0
        public static bool HasSchool(Mobile m)
        {
            if (m == null || !m.Alive || m.Backpack == null)
            {
                return(false);
            }

            if (m.Backpack.FindItemByType <MagicalFishFinder>() != null && Schools.ContainsKey(m.Map))
            {
                SchoolEntry entry = Schools[m.Map].FirstOrDefault(e => m.InRange(e.Location, SchoolRange));

                if (entry != null)
                {
                    entry.OnFish();
                    return(true);
                }
            }

            return(false);
        }
Beispiel #6
0
        public static void Initialize()
        {
            Schools = new Dictionary <Map, List <SchoolEntry> >();

            Schools[Map.Trammel]  = new List <SchoolEntry>();
            Schools[Map.Felucca]  = new List <SchoolEntry>();
            Schools[Map.Ilshenar] = new List <SchoolEntry>();
            Schools[Map.Tokuno]   = new List <SchoolEntry>();

            foreach (KeyValuePair <Map, List <SchoolEntry> > kvp in Schools)
            {
                int amount = 150;

                if (kvp.Key == Map.Ilshenar || kvp.Key == Map.Tokuno)
                {
                    amount = 50;
                }

                for (int i = 0; i < amount; i++)
                {
                    Point3D p;
                    int     failsafe = 0;

                    do
                    {
                        p = SOS.FindLocation(kvp.Key);
                        failsafe++;
                    }while (p == Point3D.Zero && failsafe < 10);

                    kvp.Value.Add(new SchoolEntry(kvp.Key, new Point2D(p.X, p.Y)));
                }

                if (kvp.Value.Count == 0)
                {
                    Console.WriteLine("Warning: {0} has 0 School entries!", kvp.Key);
                }
            }

            CommandSystem.Register("MoveToSchool", AccessLevel.GameMaster, e =>
            {
                Mobile m = e.Mobile;

                if (Schools.ContainsKey(m.Map))
                {
                    SchoolEntry entry = Schools[m.Map][Utility.Random(Schools[m.Map].Count)];

                    if (entry != null)
                    {
                        m.MoveToWorld(new Point3D(entry.Location.X, entry.Location.Y, m.Map.GetAverageZ(entry.Location.X, entry.Location.Y)), m.Map);
                    }
                    else
                    {
                        m.SendMessage("Bad entry");
                    }
                }
                else
                {
                    m.SendMessage("Bad map");
                }
            });
        }
Beispiel #7
0
        public static void ExpireSchool(Map map, SchoolEntry entry)
        {
            if (Schools.ContainsKey(map) && Schools[map].Contains(entry))
            {
                Schools[map].Remove(entry);

                Point3D p;
                int failsafe = 0;

                do
                {
                    p = SOS.FindLocation(map);
                    failsafe++;
                }
                while (p == Point3D.Zero && failsafe < 10);

                Schools[map].Add(new SchoolEntry(map, new Point2D(p.X, p.Y)));
            }
        }