Beispiel #1
0
        public static void Init(bool bForce = false)
        {
            if (bAlreadyInitialized && !bForce)
            {
                return;
            }

            List <MainFieldChara> mfc = new List <MainFieldChara>();

            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_FIELD);

            string[] test = aw.GetListOfFiles();

            var CollectionEntry = test.Where(x => x.ToLower().Contains("main_chr"));

            if (!CollectionEntry.Any())
            {
                return;
            }
            string fieldArchiveName = CollectionEntry.First();
            var    fieldArchive     = aw.GetArchive(fieldArchiveName);

            string[] test_ = fieldArchive.GetListOfFiles();

            for (int i = 0; i < test_.Length; i++)
            {
                //if (test_[i].Contains("d008.mch"))
                //    continue;
                if (string.IsNullOrWhiteSpace(test_[i]))
                {
                    continue;
                }
                byte[] oneb = fieldArchive.GetBinaryFile(test_[i]);

                if (oneb.Length < 64) //Hello Kazuo Suzuki! I will skip your dummy files
                {
                    continue;
                }

                MainFieldChara currentLocalChara = ReadMainChara(oneb);
                int            localId           = int.Parse(Path.GetFileNameWithoutExtension(test_[i]).Substring(1, 3));
                currentLocalChara.id = localId;
                mfc.Add(currentLocalChara);
            }
            MainFieldCharacters = mfc.ToArray();
            bAlreadyInitialized = true;
        }
Beispiel #2
0
        /// <summary>
        /// Should be called only once
        /// </summary>
        public static void Init()
        {
            Memory.Log.WriteLine($"{nameof(Fields)} :: {nameof(Initializer)} :: {nameof(Init)}");
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_FIELD);

            ArchiveBase mapdata = aw.GetArchive("mapdata.fs");

            if (mapdata != null)
            {
                string   map      = mapdata.GetListOfFiles()[0];
                string[] maplistb = System.Text.Encoding.UTF8.GetString(mapdata.GetBinaryFile(map))
                                    .Replace("\r", "")
                                    .Split('\n');
                Memory.FieldHolder.fields = maplistb;
                FieldId.FieldId_          = maplistb;
            }
        }
Beispiel #3
0
        public FieldCharaOne(int fieldId)
        {
            if (!FieldMainCharaOne.bAlreadyInitialized)
            {
                FieldMainCharaOne.Init();
            }
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_FIELD);

            string[] test = aw.GetListOfFiles();

            var CollectionEntry = test.Where(x => x.IndexOf(Memory.FieldHolder.fields[Memory.FieldHolder.FieldID], StringComparison.OrdinalIgnoreCase) >= 0);

            if (!CollectionEntry.Any())
            {
                return;
            }
            string fieldArchivename = CollectionEntry.First();
            var    fieldArchive     = aw.GetArchive(fieldArchivename);


            string[] test_ = fieldArchive.GetListOfFiles();


            string one;
            string main_chr;

            try
            {
                one = test_.First(x => x.EndsWith(".one", StringComparison.OrdinalIgnoreCase));
            }
            catch
            {
                return;
            }

            byte[] oneb = fieldArchive.GetBinaryFile(one);
            if (oneb.Length == 0)
            {
                return;
            }
            ReadBuffer(oneb);
        }