예제 #1
0
파일: MainPK2.cs 프로젝트: Stealthii/PKHeX
        private PKM preparePK2()
        {
            PK2 pk2 = pkm as PK2;
            if (pk2 == null)
                return null;

            pk2.Species = Util.getIndex(CB_Species);
            pk2.TID = Util.ToInt32(TB_TID.Text);
            pk2.EXP = Util.ToUInt32(TB_EXP.Text);
            pk2.HeldItem = Util.getIndex(CB_HeldItem);
            pk2.IsEgg = CHK_IsEgg.Checked;
            pk2.CurrentFriendship = Util.ToInt32(TB_Friendship.Text);
            pk2.Met_Level = Util.ToInt32(TB_MetLevel.Text);
            pk2.Met_Location = Util.getIndex(CB_MetLocation);
            pk2.Met_TimeOfDay = CB_MetTimeOfDay.SelectedIndex;

            pk2.EV_HP = Util.ToInt32(TB_HPEV.Text);
            pk2.EV_ATK = Util.ToInt32(TB_ATKEV.Text);
            pk2.EV_DEF = Util.ToInt32(TB_DEFEV.Text);
            pk2.EV_SPE = Util.ToInt32(TB_SPEEV.Text);
            pk2.EV_SPC = Util.ToInt32(TB_SPAEV.Text);

            if (CHK_Nicknamed.Checked)
                pk2.Nickname = TB_Nickname.Text;
            else 
                pk2.setNotNicknamed();
            pk2.Move1 = Util.getIndex(CB_Move1);
            pk2.Move2 = Util.getIndex(CB_Move2);
            pk2.Move3 = Util.getIndex(CB_Move3);
            pk2.Move4 = Util.getIndex(CB_Move4);
            pk2.Move1_PP = Util.getIndex(CB_Move1) > 0 ? Util.ToInt32(TB_PP1.Text) : 0;
            pk2.Move2_PP = Util.getIndex(CB_Move2) > 0 ? Util.ToInt32(TB_PP2.Text) : 0;
            pk2.Move3_PP = Util.getIndex(CB_Move3) > 0 ? Util.ToInt32(TB_PP3.Text) : 0;
            pk2.Move4_PP = Util.getIndex(CB_Move4) > 0 ? Util.ToInt32(TB_PP4.Text) : 0;
            pk2.Move1_PPUps = Util.getIndex(CB_Move1) > 0 ? CB_PPu1.SelectedIndex : 0;
            pk2.Move2_PPUps = Util.getIndex(CB_Move2) > 0 ? CB_PPu2.SelectedIndex : 0;
            pk2.Move3_PPUps = Util.getIndex(CB_Move3) > 0 ? CB_PPu3.SelectedIndex : 0;
            pk2.Move4_PPUps = Util.getIndex(CB_Move4) > 0 ? CB_PPu4.SelectedIndex : 0;

            pk2.IV_HP = Util.ToInt32(TB_HPIV.Text);
            pk2.IV_ATK = Util.ToInt32(TB_ATKIV.Text);
            pk2.IV_DEF = Util.ToInt32(TB_DEFIV.Text);
            pk2.IV_SPE = Util.ToInt32(TB_SPEIV.Text);
            pk2.IV_SPA = Util.ToInt32(TB_SPAIV.Text);

            pk2.OT_Name = TB_OT.Text;

            // Toss in Party Stats
            Array.Resize(ref pk2.Data, pk2.SIZE_PARTY);
            pk2.Stat_Level = Util.ToInt32(TB_Level.Text);
            pk2.Stat_HPCurrent = Util.ToInt32(Stat_HP.Text);
            pk2.Stat_HPMax = Util.ToInt32(Stat_HP.Text);
            pk2.Stat_ATK = Util.ToInt32(Stat_ATK.Text);
            pk2.Stat_DEF = Util.ToInt32(Stat_DEF.Text);
            pk2.Stat_SPE = Util.ToInt32(Stat_SPE.Text);
            pk2.Stat_SPA = Util.ToInt32(Stat_SPA.Text);
            pk2.Stat_SPD = Util.ToInt32(Stat_SPD.Text);

            if (HaX)
            {
                pk2.Stat_Level = (byte)Math.Min(Convert.ToInt32(MT_Level.Text), byte.MaxValue);
            }

            // Fix Moves if a slot is empty 
            pk2.FixMoves();

            return pk2;
        }
예제 #2
0
파일: MainPK7.cs 프로젝트: Soaprman/PKHeX
        private PKM preparePK7()
        {
            PK7 pk7 = pkm as PK7;

            if (pk7 == null)
            {
                return(null);
            }

            // Repopulate PK6 with Edited Stuff
            if (Util.getIndex(CB_GameOrigin) < 24)
            {
                uint EC  = Util.getHEXval(TB_EC.Text);
                uint PID = Util.getHEXval(TB_PID.Text);
                uint SID = Util.ToUInt32(TB_TID.Text);
                uint TID = Util.ToUInt32(TB_TID.Text);
                uint LID = PID & 0xFFFF;
                uint HID = PID >> 16;
                uint XOR = TID ^ LID ^ SID ^ HID;

                // Ensure we don't have a shiny.
                if (XOR >> 3 == 1) // Illegal, fix. (not 16<XOR>=8)
                {
                    // Keep as shiny, so we have to mod the PID
                    PID        ^= XOR;
                    TB_PID.Text = PID.ToString("X8");
                    TB_EC.Text  = PID.ToString("X8");
                }
                else if ((XOR ^ 0x8000) >> 3 == 1 && PID != EC)
                {
                    TB_EC.Text = (PID ^ 0x80000000).ToString("X8");
                }
                else // Not Illegal, no fix.
                {
                    TB_EC.Text = PID.ToString("X8");
                }
            }

            pk7.EncryptionConstant = Util.getHEXval(TB_EC.Text);
            pk7.Checksum           = 0; // 0 CHK for now

            // Block A
            pk7.Species       = Util.getIndex(CB_Species);
            pk7.HeldItem      = Util.getIndex(CB_HeldItem);
            pk7.TID           = Util.ToInt32(TB_TID.Text);
            pk7.SID           = Util.ToInt32(TB_SID.Text);
            pk7.EXP           = Util.ToUInt32(TB_EXP.Text);
            pk7.Ability       = (byte)Array.IndexOf(GameStrings.abilitylist, CB_Ability.Text.Remove(CB_Ability.Text.Length - 4));
            pk7.AbilityNumber = Util.ToInt32(TB_AbilityNumber.Text);   // Number
            // pkx[0x16], pkx[0x17] are handled by the Medals UI (Hits & Training Bag)
            pk7.PID              = Util.getHEXval(TB_PID.Text);
            pk7.Nature           = (byte)Util.getIndex(CB_Nature);
            pk7.FatefulEncounter = CHK_Fateful.Checked;
            pk7.Gender           = PKX.getGender(Label_Gender.Text);
            pk7.AltForm          = (MT_Form.Enabled ? Convert.ToInt32(MT_Form.Text) : CB_Form.Enabled ? CB_Form.SelectedIndex : 0) & 0x1F;
            pk7.EV_HP            = Util.ToInt32(TB_HPEV.Text); // EVs
            pk7.EV_ATK           = Util.ToInt32(TB_ATKEV.Text);
            pk7.EV_DEF           = Util.ToInt32(TB_DEFEV.Text);
            pk7.EV_SPE           = Util.ToInt32(TB_SPEEV.Text);
            pk7.EV_SPA           = Util.ToInt32(TB_SPAEV.Text);
            pk7.EV_SPD           = Util.ToInt32(TB_SPDEV.Text);

            pk7.CNT_Cool   = Util.ToInt32(TB_Cool.Text);     // CNT
            pk7.CNT_Beauty = Util.ToInt32(TB_Beauty.Text);
            pk7.CNT_Cute   = Util.ToInt32(TB_Cute.Text);
            pk7.CNT_Smart  = Util.ToInt32(TB_Smart.Text);
            pk7.CNT_Tough  = Util.ToInt32(TB_Tough.Text);
            pk7.CNT_Sheen  = Util.ToInt32(TB_Sheen.Text);

            pk7.PKRS_Days   = CB_PKRSDays.SelectedIndex;
            pk7.PKRS_Strain = CB_PKRSStrain.SelectedIndex;
            // Already in buff (then transferred to new pkx)
            // 0x2C, 0x2D, 0x2E, 0x2F
            // 0x30, 0x31, 0x32, 0x33
            // 0x34, 0x35, 0x36, 0x37
            // 0x38, 0x39

            // Unused
            // 0x3A, 0x3B
            // 0x3C, 0x3D, 0x3E, 0x3F

            // Block B
            // Convert Nickname field back to bytes
            pk7.Nickname     = TB_Nickname.Text;
            pk7.Move1        = Util.getIndex(CB_Move1);
            pk7.Move2        = Util.getIndex(CB_Move2);
            pk7.Move3        = Util.getIndex(CB_Move3);
            pk7.Move4        = Util.getIndex(CB_Move4);
            pk7.Move1_PP     = Util.getIndex(CB_Move1) > 0 ? Util.ToInt32(TB_PP1.Text) : 0;
            pk7.Move2_PP     = Util.getIndex(CB_Move2) > 0 ? Util.ToInt32(TB_PP2.Text) : 0;
            pk7.Move3_PP     = Util.getIndex(CB_Move3) > 0 ? Util.ToInt32(TB_PP3.Text) : 0;
            pk7.Move4_PP     = Util.getIndex(CB_Move4) > 0 ? Util.ToInt32(TB_PP4.Text) : 0;
            pk7.Move1_PPUps  = Util.getIndex(CB_Move1) > 0 ? CB_PPu1.SelectedIndex : 0;
            pk7.Move2_PPUps  = Util.getIndex(CB_Move2) > 0 ? CB_PPu2.SelectedIndex : 0;
            pk7.Move3_PPUps  = Util.getIndex(CB_Move3) > 0 ? CB_PPu3.SelectedIndex : 0;
            pk7.Move4_PPUps  = Util.getIndex(CB_Move4) > 0 ? CB_PPu4.SelectedIndex : 0;
            pk7.RelearnMove1 = Util.getIndex(CB_RelearnMove1);
            pk7.RelearnMove2 = Util.getIndex(CB_RelearnMove2);
            pk7.RelearnMove3 = Util.getIndex(CB_RelearnMove3);
            pk7.RelearnMove4 = Util.getIndex(CB_RelearnMove4);
            // 0x72 - Ribbon editor sets this flag (Secret Super Training)
            // 0x73
            pk7.IV_HP       = Util.ToInt32(TB_HPIV.Text);
            pk7.IV_ATK      = Util.ToInt32(TB_ATKIV.Text);
            pk7.IV_DEF      = Util.ToInt32(TB_DEFIV.Text);
            pk7.IV_SPE      = Util.ToInt32(TB_SPEIV.Text);
            pk7.IV_SPA      = Util.ToInt32(TB_SPAIV.Text);
            pk7.IV_SPD      = Util.ToInt32(TB_SPDIV.Text);
            pk7.IsEgg       = CHK_IsEgg.Checked;
            pk7.IsNicknamed = CHK_Nicknamed.Checked;

            // Block C
            pk7.HT_Name = TB_OTt2.Text;

            // 0x90-0xAF
            pk7.HT_Gender = PKX.getGender(Label_CTGender.Text) & 1;
            // Plus more, set by MemoryAmie (already in buff)

            // Block D
            pk7.OT_Name           = TB_OT.Text;
            pk7.CurrentFriendship = Util.ToInt32(TB_Friendship.Text);

            DateTime?egg_date     = null;
            int      egg_location = 0;

            if (CHK_AsEgg.Checked)      // If encountered as an egg, load the Egg Met data from fields.
            {
                egg_date     = CAL_EggDate.Value;
                egg_location = Util.getIndex(CB_EggLocation);
            }
            // Egg Met Data
            pk7.EggMetDate   = egg_date;
            pk7.Egg_Location = egg_location;
            // Met Data
            pk7.MetDate      = CAL_MetDate.Value;
            pk7.Met_Location = Util.getIndex(CB_MetLocation);

            if (pk7.IsEgg && pk7.Met_Location == 0)    // If still an egg, it has no hatch location/date. Zero it!
            {
                pk7.MetDate = null;
            }

            // 0xD7 Unknown

            pk7.Ball          = Util.getIndex(CB_Ball);
            pk7.Met_Level     = Util.ToInt32(TB_MetLevel.Text);
            pk7.OT_Gender     = PKX.getGender(Label_OTGender.Text);
            pk7.EncounterType = Util.getIndex(CB_EncounterType);
            pk7.Version       = Util.getIndex(CB_GameOrigin);
            pk7.Country       = Util.getIndex(CB_Country);
            pk7.Region        = Util.getIndex(CB_SubRegion);
            pk7.ConsoleRegion = Util.getIndex(CB_3DSReg);
            pk7.Language      = Util.getIndex(CB_Language);
            // 0xE4-0xE7

            // Toss in Party Stats
            Array.Resize(ref pk7.Data, pk7.SIZE_PARTY);
            pk7.Stat_Level     = Util.ToInt32(TB_Level.Text);
            pk7.Stat_HPCurrent = Util.ToInt32(Stat_HP.Text);
            pk7.Stat_HPMax     = Util.ToInt32(Stat_HP.Text);
            pk7.Stat_ATK       = Util.ToInt32(Stat_ATK.Text);
            pk7.Stat_DEF       = Util.ToInt32(Stat_DEF.Text);
            pk7.Stat_SPE       = Util.ToInt32(Stat_SPE.Text);
            pk7.Stat_SPA       = Util.ToInt32(Stat_SPA.Text);
            pk7.Stat_SPD       = Util.ToInt32(Stat_SPD.Text);

            // Unneeded Party Stats (Status, Flags, Unused)
            pk7.Data[0xE8]              = pk7.Data[0xE9] = pk7.Data[0xEA] = pk7.Data[0xEB] =
                pk7.Data[0xED]          = pk7.Data[0xEE] = pk7.Data[0xEF] =
                    pk7.Data[0xFE]      = pk7.Data[0xFF] = pk7.Data[0x100] =
                        pk7.Data[0x101] = pk7.Data[0x102] = pk7.Data[0x103] = 0;

            // Hax Illegality
            if (HaX)
            {
                pk7.Ability    = (byte)Util.getIndex(DEV_Ability);
                pk7.Stat_Level = (byte)Math.Min(Convert.ToInt32(MT_Level.Text), byte.MaxValue);
            }

            // Fix Moves if a slot is empty
            pk7.FixMoves();
            pk7.FixRelearn();

            // Fix Handler (Memories & OT) -- no foreign memories for Pokemon without a foreign trainer (none for eggs)
            if (Menu_ModifyPKM.Checked)
            {
                pk7.FixMemories();
            }

            // PKX is now filled
            pk7.RefreshChecksum();
            return(pk7);
        }
예제 #3
0
        }                                       // Populate Ribbons prompted

        private void setRibbons()
        {
            // pass kalos data
            int kalos1a = 0, kalos1b = 0, kalos2a = 0, kalos2b = 0;

            kalos1a            |= addRibbon(Kalos1a_0);
            kalos1a            |= addRibbon(Kalos1a_1);
            kalos1a            |= addRibbon(Kalos1a_2);
            kalos1a            |= addRibbon(Kalos1a_3);
            kalos1a            |= addRibbon(Kalos1a_4);
            kalos1a            |= addRibbon(Kalos1a_5);
            kalos1a            |= addRibbon(Kalos1a_6);
            kalos1a            |= addRibbon(Kalos1a_7);////
            kalos1b            |= addRibbon(Kalos1b_0);
            kalos1b            |= addRibbon(Kalos1b_1);
            kalos1b            |= addRibbon(Kalos1b_2);
            kalos1b            |= addRibbon(Kalos1b_3);
            kalos1b            |= addRibbon(Kalos1b_4);
            kalos1b            |= addRibbon(Kalos1b_5);
            kalos1b            |= addRibbon(Kalos1b_6);
            kalos1b            |= addRibbon(Kalos1b_7);////
            kalos2a            |= addRibbon(Kalos2a_0);
            kalos2a            |= addRibbon(Kalos2a_1);
            kalos2a            |= addRibbon(Kalos2a_2);
            kalos2a            |= addRibbon(Kalos2a_3);
            kalos2a            |= addRibbon(Kalos2a_4);
            kalos2a            |= addRibbon(Kalos2a_5);
            kalos2a            |= addRibbon(Kalos2a_6);
            kalos2a            |= addRibbon(Kalos2a_7);////
            kalos2b            |= addRibbon(Kalos2b_0);
            kalos2b            |= addRibbon(Kalos2b_1);
            kalos2b            |= addRibbon(Kalos2b_2);
            kalos2b            |= addRibbon(Kalos2b_3);
            kalos2b            |= addRibbon(Kalos2b_4);
            kalos2b            |= addRibbon(Kalos2b_5);
            kalos2b            |= addRibbon(Kalos2b_6);
            kalos2b            |= addRibbon(Kalos2b_7);////
            m_parent.buff[0x30] = (byte)kalos1a;
            m_parent.buff[0x31] = (byte)kalos1b;
            m_parent.buff[0x32] = (byte)kalos2a;
            m_parent.buff[0x33] = (byte)kalos2b;

            // Pass Extra Ribbon
            int extra1 = 0;

            extra1 |= addRibbon(Extra1_0);
            extra1 |= addRibbon(Extra1_1);
            extra1 |= addRibbon(Extra1_2);
            extra1 |= addRibbon(Extra1_3);
            extra1 |= addRibbon(Extra1_4);

            // ORAS
            extra1 |= addRibbon(Extra1_7); // Hoenn Champ
            m_parent.buff[0x34] = (byte)extra1;

            int oras = 0;

            oras |= addRibbon(ORAS_0);
            oras |= addRibbon(ORAS_1);
            oras |= addRibbon(ORAS_2);
            oras |= addRibbon(ORAS_3);
            oras |= addRibbon(ORAS_4);
            oras |= addRibbon(ORAS_5);
            m_parent.buff[0x35] = (byte)oras;

            // Gather Super Training Medals
            int medals1 = 0, medals2 = 0, medals3 = 0, medals4 = 0;

            medals1            |= addRibbon(TMedal1_0);
            medals1            |= addRibbon(TMedal1_1);
            medals1            |= addRibbon(TMedal1_2);
            medals1            |= addRibbon(TMedal1_3);
            medals1            |= addRibbon(TMedal1_4);
            medals1            |= addRibbon(TMedal1_5);
            medals1            |= addRibbon(TMedal1_6);
            medals1            |= addRibbon(TMedal1_7);////
            medals2            |= addRibbon(TMedal2_0);
            medals2            |= addRibbon(TMedal2_1);
            medals2            |= addRibbon(TMedal2_2);
            medals2            |= addRibbon(TMedal2_3);
            medals2            |= addRibbon(TMedal2_4);
            medals2            |= addRibbon(TMedal2_5);
            medals2            |= addRibbon(TMedal2_6);
            medals2            |= addRibbon(TMedal2_7);////
            medals3            |= addRibbon(TMedal3_0);
            medals3            |= addRibbon(TMedal3_1);
            medals3            |= addRibbon(TMedal3_2);
            medals3            |= addRibbon(TMedal3_3);
            medals3            |= addRibbon(TMedal3_4);
            medals3            |= addRibbon(TMedal3_5);
            medals3            |= addRibbon(TMedal3_6);
            medals3            |= addRibbon(TMedal3_7);////
            medals4            |= addRibbon(TMedal4_0);
            medals4            |= addRibbon(TMedal4_1);
            medals4            |= addRibbon(TMedal4_2);
            medals4            |= addRibbon(TMedal4_3);
            medals4            |= addRibbon(TMedal4_4);
            medals4            |= addRibbon(TMedal4_5);
            medals4            |= addRibbon(TMedal4_6);
            medals4            |= addRibbon(TMedal4_7);////
            m_parent.buff[0x2C] = (byte)medals1;
            m_parent.buff[0x2D] = (byte)medals2;
            m_parent.buff[0x2E] = (byte)medals3;
            m_parent.buff[0x2F] = (byte)medals4;

            m_parent.buff[0x38] = (byte)Util.ToUInt32(TB_PastContest.Text);
            m_parent.buff[0x39] = (byte)Util.ToUInt32(TB_PastBattle.Text);

            int dis = 0;

            dis |= addRibbon(CHK_D0);
            dis |= addRibbon(CHK_D1);
            dis |= addRibbon(CHK_D2);
            dis |= addRibbon(CHK_D3);
            dis |= addRibbon(CHK_D4);
            dis |= addRibbon(CHK_D5);
            m_parent.buff[0x3A] = (byte)dis;

            m_parent.buff[0x72] = Convert.ToByte(CHK_Secret.Checked);
        }                                       // Saving Ribbons prompted
예제 #4
0
        private PKM preparePK5()
        {
            PK5 pk5 = pkm as PK5;

            if (pk5 == null)
            {
                return(null);
            }

            pk5.Species  = Util.getIndex(CB_Species);
            pk5.HeldItem = Util.getIndex(CB_HeldItem);
            pk5.TID      = Util.ToInt32(TB_TID.Text);
            pk5.SID      = Util.ToInt32(TB_SID.Text);
            pk5.EXP      = Util.ToUInt32(TB_EXP.Text);
            pk5.PID      = Util.getHEXval(TB_PID.Text);

            pk5.Nature           = (byte)Util.getIndex(CB_Nature);
            pk5.FatefulEncounter = CHK_Fateful.Checked;
            pk5.Gender           = PKX.getGender(Label_Gender.Text);
            pk5.AltForm          = (MT_Form.Enabled ? Convert.ToInt32(MT_Form.Text) : CB_Form.Enabled ? CB_Form.SelectedIndex : 0) & 0x1F;
            pk5.EV_HP            = Util.ToInt32(TB_HPEV.Text);
            pk5.EV_ATK           = Util.ToInt32(TB_ATKEV.Text);
            pk5.EV_DEF           = Util.ToInt32(TB_DEFEV.Text);
            pk5.EV_SPE           = Util.ToInt32(TB_SPEEV.Text);
            pk5.EV_SPA           = Util.ToInt32(TB_SPAEV.Text);
            pk5.EV_SPD           = Util.ToInt32(TB_SPDEV.Text);

            pk5.CNT_Cool   = Util.ToInt32(TB_Cool.Text);
            pk5.CNT_Beauty = Util.ToInt32(TB_Beauty.Text);
            pk5.CNT_Cute   = Util.ToInt32(TB_Cute.Text);
            pk5.CNT_Smart  = Util.ToInt32(TB_Smart.Text);
            pk5.CNT_Tough  = Util.ToInt32(TB_Tough.Text);
            pk5.CNT_Sheen  = Util.ToInt32(TB_Sheen.Text);

            pk5.PKRS_Days   = CB_PKRSDays.SelectedIndex;
            pk5.PKRS_Strain = CB_PKRSStrain.SelectedIndex;
            pk5.Nickname    = TB_Nickname.Text;
            pk5.Move1       = Util.getIndex(CB_Move1);
            pk5.Move2       = Util.getIndex(CB_Move2);
            pk5.Move3       = Util.getIndex(CB_Move3);
            pk5.Move4       = Util.getIndex(CB_Move4);
            pk5.Move1_PP    = Util.getIndex(CB_Move1) > 0 ? Util.ToInt32(TB_PP1.Text) : 0;
            pk5.Move2_PP    = Util.getIndex(CB_Move2) > 0 ? Util.ToInt32(TB_PP2.Text) : 0;
            pk5.Move3_PP    = Util.getIndex(CB_Move3) > 0 ? Util.ToInt32(TB_PP3.Text) : 0;
            pk5.Move4_PP    = Util.getIndex(CB_Move4) > 0 ? Util.ToInt32(TB_PP4.Text) : 0;
            pk5.Move1_PPUps = Util.getIndex(CB_Move1) > 0 ? CB_PPu1.SelectedIndex : 0;
            pk5.Move2_PPUps = Util.getIndex(CB_Move2) > 0 ? CB_PPu2.SelectedIndex : 0;
            pk5.Move3_PPUps = Util.getIndex(CB_Move3) > 0 ? CB_PPu3.SelectedIndex : 0;
            pk5.Move4_PPUps = Util.getIndex(CB_Move4) > 0 ? CB_PPu4.SelectedIndex : 0;

            pk5.IV_HP       = Util.ToInt32(TB_HPIV.Text);
            pk5.IV_ATK      = Util.ToInt32(TB_ATKIV.Text);
            pk5.IV_DEF      = Util.ToInt32(TB_DEFIV.Text);
            pk5.IV_SPE      = Util.ToInt32(TB_SPEIV.Text);
            pk5.IV_SPA      = Util.ToInt32(TB_SPAIV.Text);
            pk5.IV_SPD      = Util.ToInt32(TB_SPDIV.Text);
            pk5.IsEgg       = CHK_IsEgg.Checked;
            pk5.IsNicknamed = CHK_Nicknamed.Checked;

            pk5.OT_Name           = TB_OT.Text;
            pk5.CurrentFriendship = Util.ToInt32(TB_Friendship.Text);

            // Default Dates
            DateTime?egg_date     = null;
            int      egg_location = 0;

            if (CHK_AsEgg.Checked) // If encountered as an egg, load the Egg Met data from fields.
            {
                egg_date     = CAL_EggDate.Value;
                egg_location = Util.getIndex(CB_EggLocation);
            }
            // Egg Met Data
            pk5.EggMetDate   = egg_date;
            pk5.Egg_Location = egg_location;
            // Met Data
            pk5.MetDate      = CAL_MetDate.Value;
            pk5.Met_Location = Util.getIndex(CB_MetLocation);

            if (pk5.IsEgg && pk5.Met_Location == 0)    // If still an egg, it has no hatch location/date. Zero it!
            {
                pk5.MetDate = null;
            }

            pk5.Ball          = Util.getIndex(CB_Ball);
            pk5.Met_Level     = Util.ToInt32(TB_MetLevel.Text);
            pk5.OT_Gender     = PKX.getGender(Label_OTGender.Text);
            pk5.EncounterType = Util.getIndex(CB_EncounterType);
            pk5.Version       = Util.getIndex(CB_GameOrigin);
            pk5.Language      = Util.getIndex(CB_Language);

            pk5.NPokémon = CHK_NSparkle.Checked;

            // Toss in Party Stats
            Array.Resize(ref pk5.Data, pk5.SIZE_PARTY);
            pk5.Stat_Level     = Util.ToInt32(TB_Level.Text);
            pk5.Stat_HPCurrent = Util.ToInt32(Stat_HP.Text);
            pk5.Stat_HPMax     = Util.ToInt32(Stat_HP.Text);
            pk5.Stat_ATK       = Util.ToInt32(Stat_ATK.Text);
            pk5.Stat_DEF       = Util.ToInt32(Stat_DEF.Text);
            pk5.Stat_SPE       = Util.ToInt32(Stat_SPE.Text);
            pk5.Stat_SPA       = Util.ToInt32(Stat_SPA.Text);
            pk5.Stat_SPD       = Util.ToInt32(Stat_SPD.Text);

            if (HaX)
            {
                pk5.Ability    = (byte)Util.getIndex(DEV_Ability);
                pk5.Stat_Level = (byte)Math.Min(Convert.ToInt32(MT_Level.Text), byte.MaxValue);
            }
            else
            {
                pk5.Ability       = (byte)Array.IndexOf(GameStrings.abilitylist, CB_Ability.Text.Remove(CB_Ability.Text.Length - 4));
                pk5.HiddenAbility = CB_Ability.SelectedIndex > 1; // not 0 or 1
            }

            // Fix Moves if a slot is empty
            pk5.FixMoves();

            pk5.RefreshChecksum();
            return(pk5);
        }
예제 #5
0
        private void save()
        {
            SAV.Game   = (byte)(CB_Game.SelectedIndex + 30);
            SAV.Gender = (byte)CB_Gender.SelectedIndex;

            SAV.TID           = (ushort)Util.ToUInt32(MT_TID.Text);
            SAV.SID           = (ushort)Util.ToUInt32(MT_SID.Text);
            SAV.Money         = Util.ToUInt32(MT_Money.Text);
            SAV.SubRegion     = Util.getIndex(CB_Region);
            SAV.Country       = Util.getIndex(CB_Country);
            SAV.ConsoleRegion = Util.getIndex(CB_3DSReg);
            SAV.Language      = Util.getIndex(CB_Language);
            SAV.AlolaTime     = (ulong)Util.getIndex(CB_AlolaTime);

            SAV.OT = TB_OTName.Text;

            // Copy Position
            if (GB_Map.Enabled && MapUpdated)
            {
                SAV.M = (int)NUD_M.Value;
                SAV.X = (float)NUD_X.Value;
                SAV.Z = (float)NUD_Z.Value;
                SAV.Y = (float)NUD_Y.Value;
                SAV.R = (float)NUD_R.Value;
            }

            // Save PlayTime
            SAV.PlayedHours   = ushort.Parse(MT_Hours.Text);
            SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text) % 60;
            SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text) % 60;

            int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;

            seconds           -= seconds % 86400;
            seconds           += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
            SAV.SecondsToStart = seconds;

            int fame = (int)(CAL_HoFDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;

            fame -= fame % 86400;
            fame += (int)(CAL_HoFTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
            SAV.SecondsToFame = fame;

            SAV.LastSavedYear   = CAL_LastSavedDate.Value.Year;
            SAV.LastSavedMonth  = CAL_LastSavedDate.Value.Month;
            SAV.LastSavedDay    = CAL_LastSavedDate.Value.Day;
            SAV.LastSavedHour   = CAL_LastSavedTime.Value.Hour;
            SAV.LastSavedMinute = CAL_LastSavedTime.Value.Minute;

            SAV.BP         = (uint)NUD_BP.Value;
            SAV.FestaCoins = (uint)NUD_FC.Value;

            // Poké Finder
            SAV.PokeFinderSnapCount        = (uint)NUD_SnapCount.Value;
            SAV.PokeFinderThumbsTotalValue = (uint)NUD_ThumbsTotal.Value;
            SAV.PokeFinderThumbsHighValue  = (uint)NUD_ThumbsRecord.Value;

            SAV.PokeFinderCameraVersion = (ushort)CB_CameraVersion.SelectedIndex;
            SAV.PokeFinderGyroFlag      = CHK_Gyro.Checked;

            // Battle Tree
            SAV.setTreeStreak((int)NUD_RCStreak0.Value, 0, super: false, max: false);
            SAV.setTreeStreak((int)NUD_RCStreak1.Value, 1, super: false, max: false);
            SAV.setTreeStreak((int)NUD_RCStreak2.Value, 2, super: false, max: false);
            SAV.setTreeStreak((int)NUD_RMStreak0.Value, 0, super: false, max: true);
            SAV.setTreeStreak((int)NUD_RMStreak1.Value, 1, super: false, max: true);
            SAV.setTreeStreak((int)NUD_RMStreak2.Value, 2, super: false, max: true);

            SAV.setTreeStreak((int)NUD_SCStreak0.Value, 0, super: true, max: false);
            SAV.setTreeStreak((int)NUD_SCStreak1.Value, 1, super: true, max: false);
            SAV.setTreeStreak((int)NUD_SCStreak2.Value, 2, super: true, max: false);
            SAV.setTreeStreak((int)NUD_SMStreak0.Value, 0, super: true, max: true);
            SAV.setTreeStreak((int)NUD_SMStreak1.Value, 1, super: true, max: true);
            SAV.setTreeStreak((int)NUD_SMStreak2.Value, 2, super: true, max: true);
        }
예제 #6
0
        }  // Value (from ByteArray) to String (textBox): 1 byte

        private void s1v(MaskedTextBox t, int o)
        {
            h[o] = (byte)Util.ToUInt32(t.Text);
        }  // String (textBox) to Value (in ByteArray): 1 byte
예제 #7
0
        private void save()
        {
            SAV.Game   = (byte)(CB_Game.SelectedIndex + 0x18);
            SAV.Gender = (byte)CB_Gender.SelectedIndex;

            SAV.TID           = (ushort)Util.ToUInt32(MT_TID.Text);
            SAV.SID           = (ushort)Util.ToUInt32(MT_SID.Text);
            SAV.Money         = Util.ToUInt32(MT_Money.Text);
            SAV.SubRegion     = Util.getIndex(CB_Region);
            SAV.Country       = Util.getIndex(CB_Country);
            SAV.ConsoleRegion = Util.getIndex(CB_3DSReg);
            SAV.Language      = Util.getIndex(CB_Language);

            SAV.OT = TB_OTName.Text;

            SAV.Saying1 = TB_Saying1.Text;
            SAV.Saying2 = TB_Saying2.Text;
            SAV.Saying3 = TB_Saying3.Text;
            SAV.Saying4 = TB_Saying4.Text;
            SAV.Saying5 = TB_Saying5.Text;

            // Copy Maison Data in
            if (SAV.MaisonStats > -1)
            {
                for (int i = 0; i < MaisonRecords.Length; i++)
                {
                    SAV.setMaisonStat(i, ushort.Parse(MaisonRecords[i].Text));
                }
            }

            // Copy Position
            if (GB_Map.Enabled)
            {
                SAV.M = (int)NUD_M.Value;
                SAV.X = (float)NUD_X.Value;
                SAV.Z = (float)NUD_Z.Value;
                SAV.Y = (float)NUD_Y.Value;
            }

            SAV.BP = ushort.Parse(TB_BP.Text);
            // Set Current PokéMiles
            SAV.setPSSStat(0xFC / 4, Util.ToUInt32(TB_PM.Text));
            // Set Max Obtained Pokémiles
            SAV.setPSSStat(0x100 / 4, Util.ToUInt32(TB_PM.Text));
            SAV.Style = byte.Parse(TB_Style.Text);

            // Copy Badges
            int badgeval = 0;

            for (int i = 0; i < 8; i++)
            {
                badgeval |= (cba[i].Checked ? 1 : 0) << i;
            }
            SAV.Badges = badgeval;

            // Save PlayTime
            SAV.PlayedHours   = ushort.Parse(MT_Hours.Text);
            SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text) % 60;
            SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text) % 60;

            // Sprite
            SAV.Sprite = Convert.ToByte(CB_MultiplayerSprite.SelectedValue);

            // Appearance
            if (SAV.XY)
            {
                SAV.Data[SAV.TrainerCard + 0x30] = byte.Parse(MT_14030.Text);
                SAV.Data[SAV.TrainerCard + 0x31] = (byte)(byte.Parse(MT_HairColor.Text) | (byte.Parse(MT_Hat.Text) << 3));
                SAV.Data[SAV.TrainerCard + 0x32] = byte.Parse(MT_14032.Text);
                SAV.Data[SAV.TrainerCard + 0x33] = byte.Parse(MT_14033.Text);
                SAV.Data[SAV.TrainerCard + 0x34] = byte.Parse(MT_14034.Text);
                SAV.Data[SAV.TrainerCard + 0x35] = byte.Parse(MT_14035.Text);
                SAV.Data[SAV.TrainerCard + 0x36] = byte.Parse(MT_14036.Text);
                SAV.Data[SAV.TrainerCard + 0x37] = byte.Parse(MT_14037.Text);
                SAV.Data[SAV.TrainerCard + 0x38] = byte.Parse(MT_14038.Text);
                SAV.Data[SAV.TrainerCard + 0x39] = byte.Parse(MT_14039.Text);
                SAV.Data[SAV.TrainerCard + 0x3A] = byte.Parse(MT_1403A.Text);
                SAV.Data[SAV.TrainerCard + 0x3B] = byte.Parse(MT_1403B.Text);
                SAV.Data[SAV.TrainerCard + 0x3C] = byte.Parse(MT_1403C.Text);
                SAV.Data[SAV.TrainerCard + 0x3D] = byte.Parse(MT_1403D.Text);
                SAV.Data[SAV.TrainerCard + 0x3E] = byte.Parse(MT_1403E.Text);
                SAV.Data[SAV.TrainerCard + 0x3F] = byte.Parse(MT_1403F.Text);
            }

            // Vivillon
            SAV.Vivillon = CB_Vivillon.SelectedIndex;

            int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;

            seconds           -= seconds % 86400;
            seconds           += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
            SAV.SecondsToStart = seconds;

            int fame = (int)(CAL_HoFDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;

            fame -= fame % 86400;
            fame += (int)(CAL_HoFTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
            SAV.SecondsToFame = fame;

            SAV.LastSavedYear   = CAL_LastSavedDate.Value.Year;
            SAV.LastSavedMonth  = CAL_LastSavedDate.Value.Month;
            SAV.LastSavedDay    = CAL_LastSavedDate.Value.Day;
            SAV.LastSavedHour   = CAL_LastSavedTime.Value.Hour;
            SAV.LastSavedMinute = CAL_LastSavedTime.Value.Minute;
        }
예제 #8
0
파일: MainXK3.cs 프로젝트: Soaprman/PKHeX
        private PKM prepareXK3()
        {
            XK3 xk3 = pkm as XK3;

            if (xk3 == null)
            {
                return(null);
            }

            xk3.Species       = Util.getIndex(CB_Species);
            xk3.HeldItem      = Util.getIndex(CB_HeldItem);
            xk3.TID           = Util.ToInt32(TB_TID.Text);
            xk3.SID           = Util.ToInt32(TB_SID.Text);
            xk3.EXP           = Util.ToUInt32(TB_EXP.Text);
            xk3.PID           = Util.getHEXval(TB_PID.Text);
            xk3.AbilityNumber = CB_Ability.SelectedIndex; // 0/1 (stored in IVbits)

            xk3.FatefulEncounter = CHK_Fateful.Checked;
            xk3.Gender           = PKX.getGender(Label_Gender.Text);
            xk3.EV_HP            = Util.ToInt32(TB_HPEV.Text);
            xk3.EV_ATK           = Util.ToInt32(TB_ATKEV.Text);
            xk3.EV_DEF           = Util.ToInt32(TB_DEFEV.Text);
            xk3.EV_SPE           = Util.ToInt32(TB_SPEEV.Text);
            xk3.EV_SPA           = Util.ToInt32(TB_SPAEV.Text);
            xk3.EV_SPD           = Util.ToInt32(TB_SPDEV.Text);

            xk3.CNT_Cool   = Util.ToInt32(TB_Cool.Text);
            xk3.CNT_Beauty = Util.ToInt32(TB_Beauty.Text);
            xk3.CNT_Cute   = Util.ToInt32(TB_Cute.Text);
            xk3.CNT_Smart  = Util.ToInt32(TB_Smart.Text);
            xk3.CNT_Tough  = Util.ToInt32(TB_Tough.Text);
            xk3.CNT_Sheen  = Util.ToInt32(TB_Sheen.Text);

            xk3.PKRS_Days   = CB_PKRSDays.SelectedIndex;
            xk3.PKRS_Strain = CB_PKRSStrain.SelectedIndex;
            xk3.Nickname    = TB_Nickname.Text;
            xk3.Move1       = Util.getIndex(CB_Move1);
            xk3.Move2       = Util.getIndex(CB_Move2);
            xk3.Move3       = Util.getIndex(CB_Move3);
            xk3.Move4       = Util.getIndex(CB_Move4);
            xk3.Move1_PP    = Util.getIndex(CB_Move1) > 0 ? Util.ToInt32(TB_PP1.Text) : 0;
            xk3.Move2_PP    = Util.getIndex(CB_Move2) > 0 ? Util.ToInt32(TB_PP2.Text) : 0;
            xk3.Move3_PP    = Util.getIndex(CB_Move3) > 0 ? Util.ToInt32(TB_PP3.Text) : 0;
            xk3.Move4_PP    = Util.getIndex(CB_Move4) > 0 ? Util.ToInt32(TB_PP4.Text) : 0;
            xk3.Move1_PPUps = Util.getIndex(CB_Move1) > 0 ? CB_PPu1.SelectedIndex : 0;
            xk3.Move2_PPUps = Util.getIndex(CB_Move2) > 0 ? CB_PPu2.SelectedIndex : 0;
            xk3.Move3_PPUps = Util.getIndex(CB_Move3) > 0 ? CB_PPu3.SelectedIndex : 0;
            xk3.Move4_PPUps = Util.getIndex(CB_Move4) > 0 ? CB_PPu4.SelectedIndex : 0;

            xk3.IV_HP       = Util.ToInt32(TB_HPIV.Text);
            xk3.IV_ATK      = Util.ToInt32(TB_ATKIV.Text);
            xk3.IV_DEF      = Util.ToInt32(TB_DEFIV.Text);
            xk3.IV_SPE      = Util.ToInt32(TB_SPEIV.Text);
            xk3.IV_SPA      = Util.ToInt32(TB_SPAIV.Text);
            xk3.IV_SPD      = Util.ToInt32(TB_SPDIV.Text);
            xk3.IsEgg       = CHK_IsEgg.Checked;
            xk3.IsNicknamed = CHK_Nicknamed.Checked;

            xk3.OT_Name           = TB_OT.Text;
            xk3.CurrentFriendship = Util.ToInt32(TB_Friendship.Text);

            xk3.Ball      = Util.getIndex(CB_Ball);
            xk3.Met_Level = Util.ToInt32(TB_MetLevel.Text);
            xk3.OT_Gender = PKX.getGender(Label_OTGender.Text);
            xk3.Version   = Util.getIndex(CB_GameOrigin);
            xk3.Language  = Util.getIndex(CB_Language);

            xk3.Met_Location = Util.getIndex(CB_MetLocation);

            // Toss in Party Stats
            Array.Resize(ref xk3.Data, xk3.SIZE_PARTY);
            xk3.Stat_Level     = Util.ToInt32(TB_Level.Text);
            xk3.Stat_HPCurrent = Util.ToInt32(Stat_HP.Text);
            xk3.Stat_HPMax     = Util.ToInt32(Stat_HP.Text);
            xk3.Stat_ATK       = Util.ToInt32(Stat_ATK.Text);
            xk3.Stat_DEF       = Util.ToInt32(Stat_DEF.Text);
            xk3.Stat_SPE       = Util.ToInt32(Stat_SPE.Text);
            xk3.Stat_SPA       = Util.ToInt32(Stat_SPA.Text);
            xk3.Stat_SPD       = Util.ToInt32(Stat_SPD.Text);

            if (HaX)
            {
                xk3.Stat_Level = (byte)Math.Min(Convert.ToInt32(MT_Level.Text), byte.MaxValue);
            }

            // Shadow Info
            xk3.ShadowID = (int)NUD_ShadowID.Value;
            if (xk3.ShadowID > 0)
            {
                xk3.Purification = (int)NUD_Purification.Value;
            }

            // Fix Moves if a slot is empty
            xk3.FixMoves();

            xk3.RefreshChecksum();
            return(xk3);
        }
예제 #9
0
        private void save()
        {
            SAV.Game   = (byte)(CB_Game.SelectedIndex + 0x18);
            SAV.Gender = (byte)CB_Gender.SelectedIndex;

            SAV.TID           = (ushort)Util.ToUInt32(MT_TID.Text);
            SAV.SID           = (ushort)Util.ToUInt32(MT_SID.Text);
            SAV.Money         = Util.ToUInt32(MT_Money.Text);
            SAV.SubRegion     = Util.ToInt32(CB_Region.SelectedValue.ToString());
            SAV.Country       = Util.ToInt32(CB_Country.SelectedValue.ToString());
            SAV.ConsoleRegion = Util.ToInt32(CB_3DSReg.SelectedValue.ToString());
            SAV.Language      = Util.ToInt32(CB_Language.SelectedValue.ToString());

            SAV.OT = TB_OTName.Text;

            SAV.Saying1 = TB_Saying1.Text;
            SAV.Saying2 = TB_Saying2.Text;
            SAV.Saying3 = TB_Saying3.Text;
            SAV.Saying4 = TB_Saying4.Text;
            SAV.Saying5 = TB_Saying5.Text;

            // Copy Maison Data in
            for (int i = 0; i < MaisonRecords.Length; i++)
            {
                SAV.setMaisonStat(i, UInt16.Parse(MaisonRecords[i].Text));
            }

            // Copy Position
            SAV.M = (int)NUD_M.Value;
            SAV.X = (float)NUD_X.Value;
            SAV.Z = (float)NUD_M.Value;
            SAV.Y = (float)NUD_Y.Value;

            SAV.BP = UInt16.Parse(TB_BP.Text);
            // Set Current PokéMiles
            SAV.setPSSStat(0xFC / 4, Util.ToUInt32(TB_PM.Text));
            // Set Max Obtained Pokémiles
            SAV.setPSSStat(0x100 / 4, Util.ToUInt32(TB_PM.Text));
            SAV.Style = Byte.Parse(TB_Style.Text);

            // Copy Badges
            int badgeval = 0;

            CheckBox[] cba = { cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, };
            for (int i = 0; i < 8; i++)
            {
                badgeval |= (cba[i].Checked ? 1 : 0) << i;
            }
            SAV.Badges = badgeval;

            // Save PlayTime
            SAV.PlayedHours   = UInt16.Parse(MT_Hours.Text);
            SAV.PlayedMinutes = UInt16.Parse(MT_Minutes.Text) % 60;
            SAV.PlayedSeconds = UInt16.Parse(MT_Seconds.Text) % 60;

            // Sprite
            SAV.Sprite = Convert.ToByte(CB_Multi.SelectedValue);

            // Appearance
            if (SAV.XY)
            {
                SAV.Data[SAV.TrainerCard + 0x30] = Byte.Parse(MT_14030.Text);
                SAV.Data[SAV.TrainerCard + 0x31] = (byte)(Byte.Parse(MT_HairColor.Text) + (Byte.Parse(MT_Hat.Text) << 3));
                SAV.Data[SAV.TrainerCard + 0x32] = Byte.Parse(MT_14032.Text);
                SAV.Data[SAV.TrainerCard + 0x33] = Byte.Parse(MT_14033.Text);
                SAV.Data[SAV.TrainerCard + 0x34] = Byte.Parse(MT_14034.Text);
                SAV.Data[SAV.TrainerCard + 0x35] = Byte.Parse(MT_14035.Text);
                SAV.Data[SAV.TrainerCard + 0x36] = Byte.Parse(MT_14036.Text);
                SAV.Data[SAV.TrainerCard + 0x37] = Byte.Parse(MT_14037.Text);
                SAV.Data[SAV.TrainerCard + 0x38] = Byte.Parse(MT_14038.Text);
                SAV.Data[SAV.TrainerCard + 0x39] = Byte.Parse(MT_14039.Text);
                SAV.Data[SAV.TrainerCard + 0x3A] = Byte.Parse(MT_1403A.Text);
                SAV.Data[SAV.TrainerCard + 0x3B] = Byte.Parse(MT_1403B.Text);
                SAV.Data[SAV.TrainerCard + 0x3C] = Byte.Parse(MT_1403C.Text);
                SAV.Data[SAV.TrainerCard + 0x3D] = Byte.Parse(MT_1403D.Text);
                SAV.Data[SAV.TrainerCard + 0x3E] = Byte.Parse(MT_1403E.Text);
                SAV.Data[SAV.TrainerCard + 0x3F] = Byte.Parse(MT_1403F.Text);
            }

            // Vivillon
            SAV.Vivillon = CB_Vivillon.SelectedIndex;
        }
예제 #10
0
        private void save()
        {
            string OT_Name = TB_OTName.Text;

            //string RIV_Name = TB_Rival.Text;

            sav[TrainerCard + 0x04 + savshift] = (byte)(CB_Game.SelectedIndex + 0x18);
            sav[TrainerCard + 0x05 + savshift] = (byte)CB_Gender.SelectedIndex;

            uint TID   = Util.ToUInt32(MT_TID.Text);
            uint SID   = Util.ToUInt32(MT_SID.Text);
            uint money = Util.ToUInt32(MT_Money.Text);

            string saying1 = TB_Saying1.Text;
            string saying2 = TB_Saying2.Text;
            string saying3 = TB_Saying3.Text;
            string saying4 = TB_Saying4.Text;
            string saying5 = TB_Saying5.Text;

            uint _region   = Util.ToUInt32(CB_Region.SelectedValue.ToString());
            uint _country  = Util.ToUInt32(CB_Country.SelectedValue.ToString());
            uint _3dsreg   = Util.ToUInt32(CB_3DSReg.SelectedValue.ToString());
            uint _language = Util.ToUInt32(CB_Language.SelectedValue.ToString());

            Array.Copy(BitConverter.GetBytes(TID), 0, sav, TrainerCard + 0x0 + savshift, 2);
            Array.Copy(BitConverter.GetBytes(SID), 0, sav, TrainerCard + 0x2 + savshift, 2);
            Array.Copy(BitConverter.GetBytes(money), 0, sav, Trainer2 + 0x8 + savshift, 4);
            Array.Copy(BitConverter.GetBytes(_region), 0, sav, TrainerCard + 0x26 + savshift, 1);
            Array.Copy(BitConverter.GetBytes(_country), 0, sav, TrainerCard + 0x27 + savshift, 1);
            Array.Copy(BitConverter.GetBytes(_3dsreg), 0, sav, TrainerCard + 0x2C + savshift, 1);
            Array.Copy(BitConverter.GetBytes(_language), 0, sav, TrainerCard + 0x2D + savshift, 1);

            byte[] OT = Encoding.Unicode.GetBytes(OT_Name);
            Array.Resize(ref OT, 0x1A);
            Array.Copy(OT, 0, sav, TrainerCard + 0x48 + savshift, 0x1A);
            //byte[] Rival = Encoding.Unicode.GetBytes(RIV_Name);
            //Array.Resize(ref Rival, 0x1A);
            //Array.Copy(Rival, 0, sav, 0x9610 + savshift, 0x1A);

            byte[] s1 = Encoding.Unicode.GetBytes(saying1);
            Array.Resize(ref s1, 0x22);
            Array.Copy(s1, 0, sav, TrainerCard + 0x7C + savshift, 0x22);
            byte[] s2 = Encoding.Unicode.GetBytes(saying2);
            Array.Resize(ref s2, 0x22);
            Array.Copy(s2, 0, sav, TrainerCard + 0x9E + savshift, 0x22);
            byte[] s3 = Encoding.Unicode.GetBytes(saying3);
            Array.Resize(ref s3, 0x22);
            Array.Copy(s3, 0, sav, TrainerCard + 0xC0 + savshift, 0x22);
            byte[] s4 = Encoding.Unicode.GetBytes(saying4);
            Array.Resize(ref s4, 0x22);
            Array.Copy(s4, 0, sav, TrainerCard + 0xE2 + savshift, 0x22);
            byte[] s5 = Encoding.Unicode.GetBytes(saying5);
            Array.Resize(ref s5, 0x22);
            Array.Copy(s5, 0, sav, TrainerCard + 0x104 + savshift, 0x22);

            // New stuff.
            // Copy Maison Data in
            MaskedTextBox[] tba = new MaskedTextBox[] {
                TB_MCSN, TB_MCSS, TB_MBSN, TB_MBSS,
                TB_MCDN, TB_MCDS, TB_MBDN, TB_MBDS,
                TB_MCTN, TB_MCTS, TB_MBTN, TB_MBTS,
                TB_MCRN, TB_MCRS, TB_MBRN, TB_MBRS,
                TB_MCMN, TB_MCMS, TB_MBMN, TB_MBMS,
            };

            for (int i = 0; i < tba.Length; i++)
            {
                byte[] streak = BitConverter.GetBytes(Util.ToUInt32(tba[i].Text));
                Array.Resize(ref streak, 2);
                Array.Copy(streak, 0, sav, Maison + 2 * i + savshift, 2);
            }

            // Copy Position
            byte[] m = BitConverter.GetBytes(Int16.Parse(TB_CoordM.Text)); Array.Resize(ref m, 2); Array.Copy(m, 0, sav, savshift + Trainer1 + 0x02, 2);
            byte[] x = BitConverter.GetBytes(Single.Parse(TB_CoordX.Text)); Array.Resize(ref x, 4); Array.Copy(x, 0, sav, savshift + Trainer1 + 0x10, 4);
            byte[] z = BitConverter.GetBytes(Single.Parse(TB_CoordZ.Text)); Array.Resize(ref z, 4); Array.Copy(z, 0, sav, savshift + Trainer1 + 0x14, 4);
            byte[] y = BitConverter.GetBytes(Single.Parse(TB_CoordY.Text)); Array.Resize(ref y, 4); Array.Copy(y, 0, sav, savshift + Trainer1 + 0x18, 4);

            byte[] bp = BitConverter.GetBytes(Util.ToUInt32(TB_BP.Text)); Array.Resize(ref bp, 2); Array.Copy(bp, 0, sav, savshift + 0x963C - 0xC * Convert.ToInt16(m_parent.savegame_oras), 2);
            byte[] pm = BitConverter.GetBytes(Util.ToUInt32(TB_PM.Text)); Array.Resize(ref pm, 4); Array.Copy(pm, 0, sav, savshift + psssatoffset + 0xFC, 4); Array.Copy(pm, 0, sav, savshift + psssatoffset + 0x100, 4);
            sav[0x694D + savshift] = Byte.Parse(TB_Style.Text);

            // Copy Badges
            badgeval = 0;
            CheckBox[] cba = { cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, };
            for (int i = 0; i < 8; i++)
            {
                badgeval |= (byte)(Convert.ToByte(cba[i].Checked) << i);
            }
            sav[0x960C + savshift] = badgeval;

            // Save PlayTime
            byte[] h = BitConverter.GetBytes(UInt16.Parse(MT_Hours.Text)); Array.Resize(ref h, 2); Array.Copy(h, 0, sav, savshift + 0x6C00, 2);
            sav[0x6C02 + savshift] = (byte)(UInt16.Parse(MT_Minutes.Text) % 60);
            sav[0x6C03 + savshift] = (byte)(UInt16.Parse(MT_Seconds.Text) % 60);

            // Sprite
            sav[TrainerCard + 0x07] = Convert.ToByte(CB_Multi.SelectedValue);

            sav[TrainerCard + 0x31] = (byte)(Byte.Parse(MT_HairColor.Text) + (Byte.Parse(MT_Hat.Text) << 3));

            sav[TrainerCard + 0x30 + savshift] = Byte.Parse(MT_14030.Text);
            //sav[TrainerCard + 0x31 + savshift] = Byte.Parse(MT_14031.Text);
            sav[TrainerCard + 0x32 + savshift] = Byte.Parse(MT_14032.Text);
            sav[TrainerCard + 0x33 + savshift] = Byte.Parse(MT_14033.Text);
            sav[TrainerCard + 0x34 + savshift] = Byte.Parse(MT_14034.Text);
            sav[TrainerCard + 0x35 + savshift] = Byte.Parse(MT_14035.Text);
            sav[TrainerCard + 0x36 + savshift] = Byte.Parse(MT_14036.Text);
            sav[TrainerCard + 0x37 + savshift] = Byte.Parse(MT_14037.Text);
            sav[TrainerCard + 0x38 + savshift] = Byte.Parse(MT_14038.Text);
            sav[TrainerCard + 0x39 + savshift] = Byte.Parse(MT_14039.Text);
            sav[TrainerCard + 0x3A + savshift] = Byte.Parse(MT_1403A.Text);
            sav[TrainerCard + 0x3B + savshift] = Byte.Parse(MT_1403B.Text);
            sav[TrainerCard + 0x3C + savshift] = Byte.Parse(MT_1403C.Text);
            sav[TrainerCard + 0x3D + savshift] = Byte.Parse(MT_1403D.Text);
            sav[TrainerCard + 0x3E + savshift] = Byte.Parse(MT_1403E.Text);
            sav[TrainerCard + 0x3F + savshift] = Byte.Parse(MT_1403F.Text);

            // Vivillon
            sav[VivillonForm + savshift] = (byte)Util.ToUInt32(CB_Vivillon.SelectedValue.ToString());
        }