Ejemplo n.º 1
0
        public SMWE()
        {
            InitializeComponent();

            PB_DayIcon.Image = Properties.Resources.sun;
            PB_NightIcon.Image = Properties.Resources.moon;
            PB_DayIcon.SizeMode = PictureBoxSizeMode.CenterImage;
            PB_NightIcon.SizeMode = PictureBoxSizeMode.CenterImage;

            font = L_Location.Font;

            speciesList[0] = "(None)";
            for (int i = 0; i < locationList.Length; i++)
                locationList[i] = locationList[i].Replace("\r", "");

            var metSM_00000 = locationList;

            var metSM_00000_good = (string[])metSM_00000.Clone();
            for (int i = 0; i < metSM_00000.Length; i += 2)
            {
                var nextLoc = metSM_00000[i + 1];
                if (!string.IsNullOrWhiteSpace(nextLoc) && nextLoc[0] != '[')
                    metSM_00000_good[i] += $" ({nextLoc})";
                if (i > 0 && !string.IsNullOrWhiteSpace(metSM_00000_good[i]) && metSM_00000_good.Take(i - 1).Contains(metSM_00000_good[i]))
                    metSM_00000_good[i] += $" ({metSM_00000_good.Take(i - 1).Count(s => s == metSM_00000_good[i]) + 1})";
            }
            metSM_00000_good.CopyTo(metSM_00000, 0);

            metSM_00000.CopyTo(locationList, 0);

            nup_spec = new[]
            {
                new []
                {
                    NUP_Forme1, NUP_Forme2, NUP_Forme3, NUP_Forme4, NUP_Forme5, NUP_Forme6, NUP_Forme7, NUP_Forme8,
                    NUP_Forme9, NUP_Forme10
                },
                new []
                {
                    NUP_Forme11, NUP_Forme12, NUP_Forme13, NUP_Forme14, NUP_Forme15, NUP_Forme16, NUP_Forme17, NUP_Forme18,
                    NUP_Forme19, NUP_Forme20
                },
                new []
                {
                    NUP_Forme21, NUP_Forme22, NUP_Forme23, NUP_Forme24, NUP_Forme25, NUP_Forme26, NUP_Forme27, NUP_Forme28,
                    NUP_Forme29, NUP_Forme30
                },
                new []
                {
                    NUP_Forme31, NUP_Forme32, NUP_Forme33, NUP_Forme34, NUP_Forme35, NUP_Forme36, NUP_Forme37, NUP_Forme38,
                    NUP_Forme39, NUP_Forme40
                },
                new []
                {
                    NUP_Forme41, NUP_Forme42, NUP_Forme43, NUP_Forme44, NUP_Forme45, NUP_Forme46, NUP_Forme47, NUP_Forme48,
                    NUP_Forme49, NUP_Forme50
                },
                new []
                {
                    NUP_Forme51, NUP_Forme52, NUP_Forme53, NUP_Forme54, NUP_Forme55, NUP_Forme56, NUP_Forme57, NUP_Forme58,
                    NUP_Forme59, NUP_Forme60
                },
                new []
                {
                    NUP_Forme61, NUP_Forme62, NUP_Forme63, NUP_Forme64, NUP_Forme65, NUP_Forme66, NUP_Forme67, NUP_Forme68,
                    NUP_Forme69, NUP_Forme70
                },
                new []
                {
                    NUP_Forme71, NUP_Forme72, NUP_Forme73, NUP_Forme74, NUP_Forme75, NUP_Forme76, NUP_Forme77, NUP_Forme78,
                    NUP_Forme79, NUP_Forme80
                },
                new[]
                {
                    NUP_WeatherForme1, NUP_WeatherForme2, NUP_WeatherForme3, NUP_WeatherForme4, NUP_WeatherForme5, NUP_WeatherForme6
                }
            };
            cb_spec = new[]
            {
                new[] {CB_Enc1, CB_Enc2, CB_Enc3, CB_Enc4, CB_Enc5, CB_Enc6, CB_Enc7, CB_Enc8, CB_Enc9, CB_Enc10},
                new[]
                {CB_Enc11, CB_Enc12, CB_Enc13, CB_Enc14, CB_Enc15, CB_Enc16, CB_Enc17, CB_Enc18, CB_Enc19, CB_Enc20},
                new[]
                {CB_Enc21, CB_Enc22, CB_Enc23, CB_Enc24, CB_Enc25, CB_Enc26, CB_Enc27, CB_Enc28, CB_Enc29, CB_Enc30},
                new[]
                {CB_Enc31, CB_Enc32, CB_Enc33, CB_Enc34, CB_Enc35, CB_Enc36, CB_Enc37, CB_Enc38, CB_Enc39, CB_Enc40},
                new[]
                {CB_Enc41, CB_Enc42, CB_Enc43, CB_Enc44, CB_Enc45, CB_Enc46, CB_Enc47, CB_Enc48, CB_Enc49, CB_Enc50},
                new[]
                {CB_Enc51, CB_Enc52, CB_Enc53, CB_Enc54, CB_Enc55, CB_Enc56, CB_Enc57, CB_Enc58, CB_Enc59, CB_Enc60},
                new[]
                {CB_Enc61, CB_Enc62, CB_Enc63, CB_Enc64, CB_Enc65, CB_Enc66, CB_Enc67, CB_Enc68, CB_Enc69, CB_Enc70},
                new[]
                {CB_Enc71, CB_Enc72, CB_Enc73, CB_Enc74, CB_Enc75, CB_Enc76, CB_Enc77, CB_Enc78, CB_Enc79, CB_Enc80},
                new[]{CB_WeatherEnc1, CB_WeatherEnc2, CB_WeatherEnc3, CB_WeatherEnc4, CB_WeatherEnc5, CB_WeatherEnc6}
            };
            rate_spec = new[]
            {L_Rate1, L_Rate2, L_Rate3, L_Rate4, L_Rate5, L_Rate6, L_Rate7, L_Rate8, L_Rate9, L_Rate10};

            foreach (var cb_l in cb_spec) foreach (var cb in cb_l) { cb.Items.AddRange(speciesList); cb.SelectedIndex = 0; cb.SelectedIndexChanged += updateSpeciesForm; }
            foreach (var nup_l in nup_spec) foreach (var nup in nup_l) { nup.ValueChanged += updateSpeciesForm; }
            foreach (var l in rate_spec)
                l.Text = "0%";

            worldData = File.ReadAllBytes(zdpaths[0]); // 1.bin
            zoneData = File.ReadAllBytes(zdpaths[1]); // dec_0.bin
            Zones = new Zone[zoneData.Length / 0x54];

            var Worlds = wdpaths.Select(f => mini.unpackMini(File.ReadAllBytes(f), "WD")[0]).ToArray();
            for (int i = 0; i < Zones.Length; i++)
            {
                Zones[i] = new Zone(i);
                Zones[i].WorldIndex = BitConverter.ToUInt16(worldData, i * 0x2);
                var World = Worlds[Zones[i].WorldIndex];
                var mappingOffset = BitConverter.ToInt32(World, 0x8);
                for (var ofs = mappingOffset; ofs < World.Length; ofs += 4)
                {
                    if (BitConverter.ToUInt16(World, ofs) == i)
                    {
                        Zones[i].AreaIndex = BitConverter.ToUInt16(World, ofs + 2);
                        break;
                    }
                }
            }

            LoadData("encdata");
        }
Ejemplo n.º 2
0
        private void getEntry()
        {
            if (entry < 0) return;
            byte[] raw = File.ReadAllBytes(filepaths[entry]);
            locationData = CTR.mini.unpackMini(raw, "ZO");
            if (locationData == null) return;

            // Read master ZD table
            byte[] zd = masterZoneData.Skip(ZoneData.Size * entry).Take(ZoneData.Size).ToArray();
            RTB_ZDMaster.Lines = Scripts.getHexLines(zd, 0x10);

            // Load from location Data.
            CurrentZone = new Zone(locationData);
            // File 0 - ZoneData
            RTB_ZD.Lines = Scripts.getHexLines(locationData[0], 0x10);
            getZoneData();

            // File 1 - Overworld Setup & Script
            RTB_OWSC.Lines = Scripts.getHexLines(locationData[1], 0x10);
            getOWSData();

            // File 2 - Map Script
            RTB_MapSC.Lines = Scripts.getHexLines(locationData[2], 0x10);
            getScriptData();

            // File 3 - Encounters
            RTB_Encounter.Lines = Scripts.getHexLines(locationData[3], 0x10);

            // File 4 - ?? (ORAS Only?)
            RTB_File5.Lines = Scripts.getHexLines(locationData.Length <= 4 ? null : locationData[4], 0x10);
        }