Exemple #1
0
        private bool TestLevel()
        {
            if (!IsInRoom)
            {
                return(false);
            }

            MappedMob m = Pathfinder.Mobs.Find(PreeliminationPredicate);

            if (m != null)
            {
                if (m.Level == 0 && m.Rage == 0)
                {
                    // this mob probably isn't mapped fully
                    return(true);
                }

                mSkipLoad = true;

                if ((m.Level > CoreUI.Instance.Settings.LvlLimit && CoreUI.Instance.Settings.LvlLimit != 0) ||
                    m.Level < CoreUI.Instance.Settings.LvlLimitMin)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #2
0
 internal static void Add(Mob mb)
 {
     MappedMob mm = new MappedMob(mb.Name, mb.Id, mb.Room.Id, mb.Level, mb.Rage);
     if (!mMobs.Contains(mm) && !mSubmitted.Contains(mm))
     {
         mMobs.Add(mm);
     }
 }
Exemple #3
0
        private bool TestRage(bool useRageLimit)
        {
            if (!IsInRoom)
            {
                return(false);
            }

            if (mRoom.Mover.Account.Rage < 0)
            {
                // Rage level is -1 because it's not yet initialized, so we can't tell.
                return(true);
            }

            MappedMob m = Pathfinder.Mobs.Find(PreeliminationPredicate);

            if (m != null)
            {
                if (m.Level == 0 && m.Rage == 0)
                {
                    // this mob probably isn't mapped fully
                    return(true);
                }

                mSkipLoad = true;

                if ((useRageLimit && CoreUI.Instance.Settings.RageLimit != 0 && m.Rage > CoreUI.Instance.Settings.RageLimit) ||
                    m.Rage > mRoom.Mover.Account.Rage)
                {
                    return(false);
                }

                if (mRoom.Mover.Account.Rage > -1 && mRoom.Mover.Account.Rage < Math.Max(1, CoreUI.Instance.Settings.StopBelowRage))
                {
                    // TODO this all needs cleaning
                    // go to next account
                    CoreUI.Instance.LogPanel.Log(string.Format("Stopping attacks on {0}, reached rage limit", mRoom.Mover.Account.Name));
                    mQuit            = true;
                    Globals.AttackOn = false;
                    return(false);
                }
            }
            return(true);
        }
Exemple #4
0
        private static void DoBuildMap(bool update)
        {
            Rooms = new List<MappedRoom>();
            Mobs = new List<MappedMob>();
            Spawns = new List<MappedMob>();
            Adventures = new SortedList<string, int>();

            string map;
            List<int> nbrs;
            string name;
            int id;
            string[] tmp;

            //*
            for (int i = 0; i < 2 && Rooms.Count < 1; i++)
            {
                if (!File.Exists("rooms.dat") || update)
                {
                    Download("rooms");
                }
                if ((map = ReadDecrypt("rooms")) == null)
                    continue;

                foreach (string token in map.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (string.IsNullOrEmpty(token.Trim()) || token.StartsWith("#"))
                        continue;

                    tmp = token.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (!int.TryParse(tmp[0], out id))
                    {
                        continue;
                    }
                    name = tmp[tmp.Length - 1];
                    nbrs = new List<int>();
                    for (int j = 1; j < tmp.Length - 1; j++)
                    {
                        nbrs.Add(int.Parse(tmp[j]));
                    }
                    if (nbrs.Count < 1)
                        continue;
                    Rooms.Add(new MappedRoom(id, name, nbrs));
                }
            }
            Rooms.Sort();
            LinkRooms();
            //*/

            // ------------------

            MappedMob mm;
            string[] parts;
            for (int i = 0; i < 2 && Mobs.Count < 1; i++)
            {
                if (!File.Exists("mobs.dat") || update)
                {
                    Download("mobs");
                }
                if ((map = ReadDecrypt("mobs")) == null)
                    continue;
                foreach (string token in map.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (string.IsNullOrEmpty(token.Trim()) || token.StartsWith("#"))
                        continue;
                    parts = token.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length != 5)
                    {
                        // not good input
                        continue;
                    }
                    mm = new MappedMob(parts[0], long.Parse(parts[1]), int.Parse(parts[2]), long.Parse(parts[3]), long.Parse(parts[4]));
                    Mobs.Add(mm);
                }
                i++;
            }
            Mobs.Sort();

            // -----------------

            for (int i = 0; i < 2 && Adventures.Count < 1; i++)
            {
                if (!File.Exists("raids.dat") || update)
                {
                    Download("raids");
                }
                if ((map = ReadDecrypt("raids")) == null)
                    continue;

                foreach (string token in map.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (string.IsNullOrEmpty(token.Trim()) || token.StartsWith("#"))
                        continue;
                    int j = token.IndexOf(";");
                    name = token.Substring(0, j);
                    id = int.Parse(token.Substring(j + 1));
                    Adventures.Add(name, id);
                }
                i++;
            }

            // ------------------
            // Spawns

            for (int i = 0; i < 2 && Spawns.Count < 1; i++)
            {
                if (!File.Exists("spawns.dat") || update)
                {
                    Download("spawns");
                }
                if ((map = ReadDecrypt("spawns")) == null)
                    continue;
                foreach (string token in map.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (string.IsNullOrEmpty(token.Trim()) || token.StartsWith("#"))
                        continue;
                    parts = token.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length != 3)
                    {
                        // not good input
                        continue;
                    }
                    mm = new MappedMob(parts[0], -1, int.Parse(parts[2]), long.Parse(parts[1]), -1);
                    Spawns.Add(mm);
                }
                i++;
            }
            Spawns.Sort();
        }
Exemple #5
0
 private bool PreeliminationPredicate(MappedMob m)
 {
     return m.Name.Equals(mName);
 }
Exemple #6
0
 private bool PreeliminationPredicate(MappedMob m)
 {
     return(m.Name.Equals(mName));
 }