Esempio n. 1
0
 public SaveBlockAccessor8LA(SAV8LA sav)
 {
     BlockInfo      = sav.AllBlocks;
     BoxInfo        = new Box8(sav, GetBlock(KBox));
     PokedexSave    = new PokedexSave8a(sav, GetBlock(KZukan));
     BoxLayout      = new BoxLayout8a(sav, GetBlock(KBoxLayout));
     PartyInfo      = new Party8a(sav, GetBlock(KParty));
     MyStatus       = new MyStatus8a(sav, GetBlock(KMyStatus));
     Items          = new MyItem8a(sav, GetBlock(KItemRegular));
     AdventureStart = new AdventureStart8a(sav, GetBlock(KAdventureStart));
     LastSaved      = new LastSaved8a(sav, GetBlock(KLastSaved));
     Played         = new PlayTime8a(sav, GetBlock(KPlayTime));
     Coordinates    = new Coordinates8a(sav, GetBlock(KCoordinates));
     FashionPlayer  = new PlayerFashion8a(sav, GetBlock(KFashionPlayer));
 }
Esempio n. 2
0
        private void GetEntry(int index, int formIndex)
        {
            var species = DexToSpecies[index + 1];
            var form    = DisplayedForms[formIndex].Value;

            // Flags
            var seenWild   = Dex.GetPokeSeenInWildFlags(species, form);
            var obtain     = Dex.GetPokeObtainFlags(species, form);
            var caughtWild = Dex.GetPokeCaughtInWildFlags(species, form);

            for (var i = 0; i < CHK_SeenWild.Length; ++i)
            {
                CHK_SeenWild[i].Checked   = (seenWild & (1 << i)) != 0;
                CHK_Obtained[i].Checked   = (obtain & (1 << i)) != 0;
                CHK_CaughtWild[i].Checked = (caughtWild & (1 << i)) != 0;
            }

            // Display
            if (CB_DisplayForm.Enabled)
            {
                var selectedForm = Dex.GetSelectedForm(species);
                CB_DisplayForm.SelectedIndex = 0;
                for (var i = 0; i < CB_DisplayForm.Items.Count; ++i)
                {
                    if (((ComboItem)CB_DisplayForm.Items[i]).Value != selectedForm)
                    {
                        continue;
                    }

                    CB_DisplayForm.SelectedIndex = i;
                    break;
                }
            }

            CHK_A.Checked = Dex.GetSelectedAlpha(species);
            CHK_S.Checked = Dex.GetSelectedShiny(species);

            CHK_G.Enabled = PokedexSave8a.HasMultipleGenders(species);
            CHK_G.Checked = Dex.GetSelectedGender1(species);

            // Research
            var reportedRate   = Dex.GetPokeResearchRate(species);
            var unreportedRate = reportedRate;

            for (var i = 0; i < PokedexConstants8a.ResearchTasks[index].Length; i++)
            {
                var unreportedLevels = Dex.GetResearchTaskLevel(species, i, out _, out var taskValue, out _);
                TaskControls[i].CurrentValue = taskValue;
                unreportedRate += unreportedLevels * TaskControls[i].PointsPerLevel;
            }

            MTB_UpdateIndex.Text             = Dex.GetUpdateIndex(species).ToString();
            MTB_ResearchLevelReported.Text   = reportedRate.ToString();
            MTB_ResearchLevelUnreported.Text = unreportedRate.ToString();

            CHK_Seen.Checked     = Dex.HasPokeEverBeenUpdated(species);
            CHK_Complete.Checked = Dex.IsComplete(species);
            CHK_Perfect.Checked  = Dex.IsPerfect(species);

            // Statistics
            Dex.GetSizeStatistics(species, form, out var hasMax, out var minHeight, out var maxHeight, out var minWeight, out var maxWeight);
            CHK_MinAndMax.Checked = hasMax;
            TB_MinHeight.Text     = minHeight.ToString(CultureInfo.InvariantCulture);
            TB_MaxHeight.Text     = maxHeight.ToString(CultureInfo.InvariantCulture);
            TB_MinWeight.Text     = minWeight.ToString(CultureInfo.InvariantCulture);
            TB_MaxWeight.Text     = maxWeight.ToString(CultureInfo.InvariantCulture);

            var pt = SAV.Personal;
            var pi = pt.GetFormEntry(species, form);
            var minTheoryHeight = PA8.GetHeightAbsolute(pi, 0x00).ToString(CultureInfo.InvariantCulture);
            var maxTheoryHeight = PA8.GetHeightAbsolute(pi, 0xFF).ToString(CultureInfo.InvariantCulture);
            var minTheoryWeight = PA8.GetWeightAbsolute(pi, 0x00, 0x00).ToString(CultureInfo.InvariantCulture);
            var maxTheoryWeight = PA8.GetWeightAbsolute(pi, 0xFF, 0xFF).ToString(CultureInfo.InvariantCulture);

            L_TheoryHeight.Text = $"Min: {minTheoryHeight}, Max: {maxTheoryHeight}";
            L_TheoryWeight.Text = $"Min: {minTheoryWeight}, Max: {maxTheoryWeight}";
        }
Esempio n. 3
0
        public SAV_PokedexLA(SAV8LA sav)
        {
            InitializeComponent();
            WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
            SAV = (SAV8LA)(Origin = sav).Clone();
            Dex = SAV.Blocks.PokedexSave;
            var speciesNames = GameInfo.Strings.Species;

            CHK_SeenWild   = new[] { CHK_S0, CHK_S1, CHK_S2, CHK_S3, CHK_S4, CHK_S5, CHK_S6, CHK_S7 };
            CHK_Obtained   = new[] { CHK_O0, CHK_O1, CHK_O2, CHK_O3, CHK_O4, CHK_O5, CHK_O6, CHK_O7 };
            CHK_CaughtWild = new[] { CHK_C0, CHK_C1, CHK_C2, CHK_C3, CHK_C4, CHK_C5, CHK_C6, CHK_C7 };

            TaskControls = new []
            {
                PRT_1,
                PRT_2,
                PRT_3,
                PRT_4,
                PRT_5,
                PRT_6,
                PRT_7,
                PRT_8,
                PRT_9,
                PRT_10,
            };

            foreach (var tc in TaskControls)
            {
                tc.Visible = false;
                tc.SetStrings(TaskDescriptions, SpeciesQuests, TimeTaskDescriptions);
            }

            SpeciesToDex = new int[SAV.Personal.MaxSpeciesID + 1];

            var maxDex = 0;

            for (var s = 1; s <= SAV.Personal.MaxSpeciesID; s++)
            {
                var hisuiDex = PokedexSave8a.GetDexIndex(PokedexType8a.Hisui, s);
                if (hisuiDex == 0)
                {
                    continue;
                }

                SpeciesToDex[s] = hisuiDex;
                if (hisuiDex > maxDex)
                {
                    maxDex = hisuiDex;
                }
            }

            DexToSpecies = new int[maxDex + 1];
            for (var s = 1; s <= SAV.Personal.MaxSpeciesID; s++)
            {
                if (SpeciesToDex[s] != 0)
                {
                    DexToSpecies[SpeciesToDex[s]] = s;
                }
            }

            Editing = true;
            // Clear Listbox and ComboBox
            LB_Species.Items.Clear();
            CB_Species.Items.Clear();

            // Fill List
            CB_Species.InitializeBinding();
            var species = GameInfo.FilteredSources.Species.Where(z => PokedexSave8a.GetDexIndex(PokedexType8a.Hisui, z.Value) != 0).ToArray();

            CB_Species.DataSource = new BindingSource(species, null);

            CB_DisplayForm.InitializeBinding();
            DisplayedForms = new List <ComboItem> {
                new(GameInfo.Strings.types[0], 0)
            };
            CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, null);

            for (var d = 1; d < DexToSpecies.Length; d++)
            {
                LB_Species.Items.Add($"{d:000} - {speciesNames[DexToSpecies[d]]}");
            }

            Editing = false;
            LB_Species.SelectedIndex = 0;
            CB_Species.KeyDown      += WinFormsUtil.RemoveDropCB;
            CanSave = true;
        }
Esempio n. 4
0
    public SAV_PokedexResearchEditorLA(SAV8LA sav, int species, int dexIdx, IReadOnlyList <string> tasks, IReadOnlyList <string> timeTasks)
    {
        InitializeComponent();
        WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
        SAV = (SAV8LA)(Origin = sav).Clone();
        Dex = SAV.Blocks.PokedexSave;

        Species = species;

        L_Species.Text = GameInfo.Strings.Species[species];

        #region Declare Arrays
        Label[] taskLabels =
        {
            L_Catch,
            L_CatchAlpha,
            L_CatchLarge,
            L_CatchSmall,
            L_CatchHeavy,
            L_CatchLight,
            L_CatchAtTime,
            L_CatchSleeping,
            L_CatchInAir,
            L_CatchNotSpotted,

            L_UseMove0,
            L_UseMove1,
            L_UseMove2,
            L_UseMove3,
            L_DefeatWithMove0,
            L_DefeatWithMove1,
            L_DefeatWithMove2,
            L_Defeat,
            L_StrongStyle,
            L_AgileStyle,

            L_Evolve,
            L_GiveFood,
            L_Stun,
            L_Scare,
            L_Lure,

            L_LeapTrees,
            L_LeapLeaves,
            L_LeapSnow,
            L_LeapOre,
            L_LeapTussocks,
        };

        TaskNUPs = new[]
        {
            NUP_Catch,
            NUP_CatchAlpha,
            NUP_CatchLarge,
            NUP_CatchSmall,
            NUP_CatchHeavy,
            NUP_CatchLight,
            NUP_CatchAtTime,
            NUP_CatchSleeping,
            NUP_CatchInAir,
            NUP_CatchNotSpotted,

            NUP_UseMove0,
            NUP_UseMove1,
            NUP_UseMove2,
            NUP_UseMove3,
            NUP_DefeatWithMove0,
            NUP_DefeatWithMove1,
            NUP_DefeatWithMove2,
            NUP_Defeat,
            NUP_StrongStyle,
            NUP_AgileStyle,

            NUP_Evolve,
            NUP_GiveFood,
            NUP_Stun,
            NUP_Scare,
            NUP_Lure,

            NUP_LeapTrees,
            NUP_LeapLeaves,
            NUP_LeapSnow,
            NUP_LeapOre,
            NUP_LeapTussocks,
        };

        TaskTypes = new[]
        {
            Catch,
            CatchAlpha,
            CatchLarge,
            CatchSmall,
            CatchHeavy,
            CatchLight,
            CatchAtTime,
            CatchSleeping,
            CatchInAir,
            CatchNotSpotted,

            UseMove,
            UseMove,
            UseMove,
            UseMove,
            DefeatWithMoveType,
            DefeatWithMoveType,
            DefeatWithMoveType,
            Defeat,
            UseStrongStyleMove,
            UseAgileStyleMove,

            Evolve,
            GiveFood,
            StunWithItems,
            ScareWithScatterBang,
            LureWithPokeshiDoll,

            LeapFromTrees,
            LeapFromLeaves,
            LeapFromSnow,
            LeapFromOre,
            LeapFromTussocks,
        };

        TaskIndexes = new[]
        {
            -1,
            -1,
            -1,
            -1,
            -1,
            -1,
            -1,
            -1,
            -1,
            -1,

            0,
            1,
            2,
            3,
            0,
            1,
            2,
            -1,
            -1,
            -1,

            -1,
            -1,
            -1,
            -1,
            -1,

            -1,
            -1,
            -1,
            -1,
            -1,
        };

        TaskParameters = new int[TaskIndexes.Length];
        InitializeTaskParameters(dexIdx);
        #endregion

        // Initialize labels/values
        for (int i = 0; i < taskLabels.Length; i++)
        {
            taskLabels[i].Text = PokedexResearchTask8aExtensions.GetGenericTaskLabelString(TaskTypes[i], TaskIndexes[i], TaskParameters[i], tasks, timeTasks);

            Dex.GetResearchTaskProgressByForce(Species, TaskTypes[i], TaskIndexes[i], out var curValue);
            TaskNUPs[i].Value = curValue;
        }

        // Detect empty
        WasEmpty = IsEmpty();
    }