Esempio n. 1
0
    private void B_Save_Click(object sender, EventArgs e)
    {
        // If we should, set values.
        if (!WasEmpty || !IsEmpty())
        {
            for (int i = 0; i < TaskNUPs.Length; i++)
            {
                Dex.SetResearchTaskProgressByForce(Species, TaskTypes[i], (int)TaskNUPs[i].Value, TaskIndexes[i]);
            }
        }

        Origin.CopyChangesFrom(SAV);
        Close();
    }
Esempio n. 2
0
        private void SetEntry(int index, int formIndex)
        {
            if (!CanSave || Editing || index < 0 || formIndex < 0)
            {
                return;
            }

            var empty = IsEntryEmpty(index, formIndex);

            if (!CHK_Seen.Checked && empty)
            {
                return;
            }

            var species = DexToSpecies[index + 1];
            var form    = DisplayedForms[formIndex].Value;

            if (!empty)
            {
                Dex.SetPokeHasBeenUpdated(species);
            }

            // Flags
            var seenWild   = 0;
            var obtain     = 0;
            var caughtWild = 0;

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

            Dex.SetPokeSeenInWildFlags(species, form, (byte)seenWild);
            Dex.SetPokeObtainFlags(species, form, (byte)obtain);
            Dex.SetPokeCaughtInWildFlags(species, form, (byte)caughtWild);

            // Display
            var dispForm = form;

            if (CB_DisplayForm.Enabled)
            {
                dispForm = WinFormsUtil.GetIndex(CB_DisplayForm);
            }

            Dex.SetSelectedGenderForm(species, dispForm, CHK_G.Checked, CHK_S.Checked, CHK_A.Checked);

            // Set research
            for (var i = 0; i < PokedexConstants8a.ResearchTasks[index].Length; i++)
            {
                if (TaskControls[i].CanSetCurrentValue)
                {
                    Dex.SetResearchTaskProgressByForce(species, TaskControls[i].Task, TaskControls[i].CurrentValue);
                }
            }

            // Statistics
            Dex.GetSizeStatistics(species, form, out _, out var oldMinHeight, out var oldMaxHeight, out var oldMinWeight, out var oldMaxWeight);

            if (!float.TryParse(TB_MinHeight.Text, out var minHeight))
            {
                minHeight = oldMinHeight;
            }

            if (!float.TryParse(TB_MaxHeight.Text, out var maxHeight))
            {
                maxHeight = oldMaxHeight;
            }

            if (!float.TryParse(TB_MinWeight.Text, out var minWeight))
            {
                minWeight = oldMinWeight;
            }

            if (!float.TryParse(TB_MaxWeight.Text, out var maxWeight))
            {
                maxWeight = oldMaxWeight;
            }

            Dex.SetSizeStatistics(species, form, CHK_MinAndMax.Checked, minHeight, maxHeight, minWeight, maxWeight);
        }