Ejemplo n.º 1
0
        private static void LoadLists()
        {
            m_Monster = new ArrayList();
            m_Animal  = new ArrayList();
            m_Sea     = new ArrayList();
            m_Human   = new ArrayList();

            List <BodyEntry> entries = Docs.LoadBodies();

            for (int i = 0; i < entries.Count; ++i)
            {
                BodyEntry oldEntry = (BodyEntry)entries[i];
                int       bodyID   = oldEntry.Body.BodyID;

                if (((Body)bodyID).IsEmpty)
                {
                    continue;
                }

                ArrayList list = null;

                switch (oldEntry.BodyType)
                {
                case ModelBodyType.Monsters:
                    list = m_Monster;
                    break;

                case ModelBodyType.Animals:
                    list = m_Animal;
                    break;

                case ModelBodyType.Sea:
                    list = m_Sea;
                    break;

                case ModelBodyType.Human:
                    list = m_Human;
                    break;
                }

                if (list == null)
                {
                    continue;
                }

                int itemID = ShrinkTable.Lookup(bodyID, -1);

                if (itemID != -1)
                {
                    list.Add(new InternalEntry(bodyID, itemID, oldEntry.Name));
                }
            }

            m_Monster.Sort();
            m_Animal.Sort();
            m_Sea.Sort();
            m_Human.Sort();
        }
Ejemplo n.º 2
0
        public int Compare(object x, object y)
        {
            BodyEntry a = (BodyEntry)x;
            BodyEntry b = (BodyEntry)y;

            int v = a.BodyType.CompareTo(b.BodyType);

            if (v == 0)
            {
                v = a.Body.BodyID.CompareTo(b.Body.BodyID);
            }

            if (v == 0)
            {
                v = a.Name.CompareTo(b.Name);
            }

            return(v);
        }
Ejemplo n.º 3
0
        public static ArrayList LoadBodies()
        {
            ArrayList list = new ArrayList();

            string path = Core.FindDataFile("models/models.txt");

            if (File.Exists(path))
            {
                using (StreamReader ip = new StreamReader(path))
                {
                    string line;

                    while ((line = ip.ReadLine()) != null)
                    {
                        line = line.Trim();

                        if (line.Length == 0 || line.StartsWith("#"))
                        {
                            continue;
                        }

                        string[] split = line.Split('\t');

                        if (split.Length >= 9)
                        {
                            Body          body = Utility.ToInt32(split[0]);
                            ModelBodyType type = (ModelBodyType)Utility.ToInt32(split[1]);
                            string        name = split[8];

                            BodyEntry entry = new BodyEntry(body, type, name);

                            if (!list.Contains(entry))
                            {
                                list.Add(entry);
                            }
                        }
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 4
0
        public static List <BodyEntry> LoadBodies()
        {
            var list = new List <BodyEntry>();

            var path = Path.Combine(Core.BaseDirectory, "Data/models.txt");

            if (File.Exists(path))
            {
                using var ip = new StreamReader(path);
                string line;

                while ((line = ip.ReadLine()) != null)
                {
                    line = line.Trim();

                    if (line.Length == 0 || line.StartsWithOrdinal("#"))
                    {
                        continue;
                    }

                    var split = line.Split('\t');

                    if (split.Length >= 9)
                    {
                        Body body = Utility.ToInt32(split[0]);
                        var  type = (ModelBodyType)Utility.ToInt32(split[1]);
                        var  name = split[8];

                        var entry = new BodyEntry(body, type, name);

                        if (!list.Contains(entry))
                        {
                            list.Add(entry);
                        }
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 5
0
        public override bool Equals(object obj)
        {
            BodyEntry e = (BodyEntry)obj;

            return(m_Body == e.m_Body && m_BodyType == e.m_BodyType && m_Name == e.m_Name);
        }