예제 #1
0
파일: SAV_Trainer.cs 프로젝트: antwa/PKHeX
        private void GetTextBoxes()
        {
            int badgeval = SAV.Badges;

            for (int i = 0; i < 8; i++)
            {
                cba[i].Checked = (badgeval & 1 << i) != 0;
            }

            // Get Data
            string OT_NAME = SAV.OT;

            CB_Game.SelectedIndex   = SAV.Game - 0x18;
            CB_Gender.SelectedIndex = SAV.Gender;

            // Display Data
            TB_OTName.Text = OT_NAME;

            MT_TID.Text   = SAV.TID.ToString("00000");
            MT_SID.Text   = SAV.SID.ToString("00000");
            MT_Money.Text = SAV.Money.ToString();

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

            CB_Country.SelectedValue  = SAV.Country;
            CB_Region.SelectedValue   = SAV.SubRegion;
            CB_3DSReg.SelectedValue   = SAV.ConsoleRegion;
            CB_Language.SelectedValue = SAV.Language;

            // Maison Data
            if (SAV.MaisonStats > -1)
            {
                for (int i = 0; i < MaisonRecords.Length; i++)
                {
                    MaisonRecords[i].Text = SAV.GetMaisonStat(i).ToString();
                }
            }

            NUD_M.Value = SAV.M;
            // Sanity Check Map Coordinates
            if (!GB_Map.Enabled || SAV.X % 0.5 != 0 || SAV.Z % 0.5 != 0 || SAV.Y % 0.5 != 0)
            {
                GB_Map.Enabled = false;
            }
            else
            {
                try
                {
                    NUD_X.Value = (decimal)SAV.X;
                    NUD_Z.Value = (decimal)SAV.Z;
                    NUD_Y.Value = (decimal)SAV.Y;
                }
                catch { GB_Map.Enabled = false; }
            }

            // Load BP and PokeMiles
            TB_BP.Text = SAV.BP.ToString();
            TB_PM.Text = SAV.GetPSSStat(0xFC / 4).ToString();

            TB_Style.Text = SAV.Style.ToString();

            // Load Play Time
            MT_Hours.Text   = SAV.PlayedHours.ToString();
            MT_Minutes.Text = SAV.PlayedMinutes.ToString();
            MT_Seconds.Text = SAV.PlayedSeconds.ToString();

            // Load PSS Sprite
            CB_MultiplayerSprite.SelectedValue = SAV.MultiplayerSpriteID;
            PB_Sprite.Image = SAV.Sprite();

            if (SAV.XY)
            {
                // Load Clothing Data
                int hat       = SAV.Data[SAV.TrainerCard + 0x31] >> 3;
                int haircolor = SAV.Data[SAV.TrainerCard + 0x31] & 7;
                MT_Hat.Text       = hat.ToString();
                MT_HairColor.Text = haircolor.ToString();
                MT_14030.Text     = SAV.Data[SAV.TrainerCard + 0x30].ToString();
                MT_14031.Text     = SAV.Data[SAV.TrainerCard + 0x31].ToString();
                MT_14032.Text     = SAV.Data[SAV.TrainerCard + 0x32].ToString();
                MT_14033.Text     = SAV.Data[SAV.TrainerCard + 0x33].ToString();
                MT_14034.Text     = SAV.Data[SAV.TrainerCard + 0x34].ToString();
                MT_14035.Text     = SAV.Data[SAV.TrainerCard + 0x35].ToString();
                MT_14036.Text     = SAV.Data[SAV.TrainerCard + 0x36].ToString();
                MT_14037.Text     = SAV.Data[SAV.TrainerCard + 0x37].ToString();
                MT_14038.Text     = SAV.Data[SAV.TrainerCard + 0x38].ToString();
                MT_14039.Text     = SAV.Data[SAV.TrainerCard + 0x39].ToString();
                MT_1403A.Text     = SAV.Data[SAV.TrainerCard + 0x3A].ToString();
                MT_1403B.Text     = SAV.Data[SAV.TrainerCard + 0x3B].ToString();
                MT_1403C.Text     = SAV.Data[SAV.TrainerCard + 0x3C].ToString();
                MT_1403D.Text     = SAV.Data[SAV.TrainerCard + 0x3D].ToString();
                MT_1403E.Text     = SAV.Data[SAV.TrainerCard + 0x3E].ToString();
                MT_1403F.Text     = SAV.Data[SAV.TrainerCard + 0x3F].ToString();

                TB_TRNick.Text = SAV.OT_Nick;
            }

            CB_Vivillon.SelectedIndex = SAV.Vivillon;
            if (SAV.LastSavedDate.HasValue)
            {
                CAL_LastSavedDate.Value = SAV.LastSavedDate.Value;
                CAL_LastSavedTime.Value = SAV.LastSavedDate.Value;
            }
            else
            {
                L_LastSaved.Visible = CAL_LastSavedDate.Visible = CAL_LastSavedTime.Visible = false;
            }
            CAL_AdventureStartDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart);
            CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart % 86400);
            CAL_HoFDate.Value            = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame);
            CAL_HoFTime.Value            = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame % 86400);
        }
        private void GetTextBoxes()
        {
            int badgeval = SAV.Badges;

            for (int i = 0; i < 8; i++)
            {
                cba[i].Checked = (badgeval & 1 << i) != 0;
            }

            // Get Data
            string OT_NAME = SAV.OT;

            CB_Game.SelectedIndex   = SAV.Game - 0x18;
            CB_Gender.SelectedIndex = SAV.Gender;

            // Display Data
            TB_OTName.Text = OT_NAME;

            MT_TID.Text   = SAV.TID.ToString("00000");
            MT_SID.Text   = SAV.SID.ToString("00000");
            MT_Money.Text = SAV.Money.ToString();

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

            CB_Country.SelectedValue  = SAV.Country;
            CB_Region.SelectedValue   = SAV.SubRegion;
            CB_3DSReg.SelectedValue   = SAV.ConsoleRegion;
            CB_Language.SelectedValue = SAV.Language;

            // Maison Data
            if (SAV.MaisonStats > -1)
            {
                for (int i = 0; i < MaisonRecords.Length; i++)
                {
                    MaisonRecords[i].Text = SAV.GetMaisonStat(i).ToString();
                }
            }

            NUD_M.Value = SAV.M;
            // Sanity Check Map Coordinates
            if (!GB_Map.Enabled || SAV.X % 0.5 != 0 || SAV.Z % 0.5 != 0 || SAV.Y % 0.5 != 0)
            {
                GB_Map.Enabled = false;
            }
            else
            {
                try
                {
                    NUD_X.Value = (decimal)SAV.X;
                    NUD_Z.Value = (decimal)SAV.Z;
                    NUD_Y.Value = (decimal)SAV.Y;
                }
                catch { GB_Map.Enabled = false; }
            }

            // Load BP and PokeMiles
            TB_BP.Text = SAV.BP.ToString();
            TB_PM.Text = SAV.GetRecord(63).ToString();

            TB_Style.Text = SAV.Style.ToString();

            // Load Play Time
            MT_Hours.Text   = SAV.PlayedHours.ToString();
            MT_Minutes.Text = SAV.PlayedMinutes.ToString();
            MT_Seconds.Text = SAV.PlayedSeconds.ToString();

            // Load PSS Sprite
            CB_MultiplayerSprite.SelectedValue = SAV.MultiplayerSpriteID;
            PB_Sprite.Image = SAV.Sprite();

            if (SAV.XY)
            {
                // Load Clothing Data
                propertyGrid1.SelectedObject = TrainerFashion6.GetFashion(SAV.Data, SAV.TrainerCard + 0x30, SAV.Gender);

                TB_TRNick.Text = SAV.OT_Nick;
            }

            CB_Vivillon.SelectedIndex = SAV.Vivillon;
            if (SAV.LastSavedDate.HasValue)
            {
                CAL_LastSavedDate.Value = SAV.LastSavedDate.Value;
                CAL_LastSavedTime.Value = SAV.LastSavedDate.Value;
            }
            else
            {
                L_LastSaved.Visible = CAL_LastSavedDate.Visible = CAL_LastSavedTime.Visible = false;
            }

            var epoch = new DateTime(2000, 1, 1);

            CAL_AdventureStartDate.Value = epoch.AddSeconds(SAV.SecondsToStart);
            CAL_AdventureStartTime.Value = epoch.AddSeconds(SAV.SecondsToStart % 86400);
            CAL_HoFDate.Value            = epoch.AddSeconds(SAV.SecondsToFame);
            CAL_HoFTime.Value            = epoch.AddSeconds(SAV.SecondsToFame % 86400);
        }
예제 #3
0
        private void GetTextBoxes()
        {
            int badgeval = SAV.Badges;

            for (int i = 0; i < 8; i++)
            {
                cba[i].Checked = (badgeval & 1 << i) != 0;
            }

            // Get Data
            string OT_NAME = SAV.OT;

            CB_Game.SelectedIndex   = SAV.Game - 0x18;
            CB_Gender.SelectedIndex = SAV.Gender;

            // Display Data
            TB_OTName.Text = OT_NAME;

            MT_TID.Text   = SAV.TID.ToString("00000");
            MT_SID.Text   = SAV.SID.ToString("00000");
            MT_Money.Text = SAV.Money.ToString();

            var status = SAV.Status;

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

            CB_Country.SelectedValue  = SAV.Country;
            CB_Region.SelectedValue   = SAV.SubRegion;
            CB_3DSReg.SelectedValue   = SAV.ConsoleRegion;
            CB_Language.SelectedValue = SAV.Language;

            // Maison Data
            if (SAV.MaisonStats > -1)
            {
                for (int i = 0; i < MaisonRecords.Length; i++)
                {
                    MaisonRecords[i].Text = SAV.GetMaisonStat(i).ToString();
                }
            }

            var sit = SAV.Situation;

            NUD_M.Value = sit.M;
            // Sanity Check Map Coordinates
            if (!GB_Map.Enabled || sit.X % 0.5 != 0 || sit.Z % 0.5 != 0 || sit.Y % 0.5 != 0)
            {
                GB_Map.Enabled = false;
            }
            else
            {
                try
                {
                    NUD_X.Value = (decimal)sit.X;
                    NUD_Z.Value = (decimal)sit.Z;
                    NUD_Y.Value = (decimal)sit.Y;
                }
                catch { GB_Map.Enabled = false; }
            }

            // Load BP and PokeMiles
            TB_BP.Text = SAV.BP.ToString();
            TB_PM.Text = SAV.GetRecord(63).ToString();

            TB_Style.Text = sit.Style.ToString();

            // Load Play Time
            MT_Hours.Text   = SAV.PlayedHours.ToString();
            MT_Minutes.Text = SAV.PlayedMinutes.ToString();
            MT_Seconds.Text = SAV.PlayedSeconds.ToString();

            // Load PSS Sprite
            CB_MultiplayerSprite.SelectedValue = SAV.MultiplayerSpriteID;
            PB_Sprite.Image = SAV.Sprite();

            if (SAV is SAV6XY xy)
            {
                var xystat = ((MyStatus6XY)xy.Status);
                PG_CurrentAppearance.SelectedObject = xystat.Fashion;
                TB_TRNick.Text = xystat.OT_Nick;
            }

            CB_Vivillon.SelectedIndex = SAV.Vivillon;
            if (SAV.Played.LastSavedDate.HasValue)
            {
                CAL_LastSavedDate.Value = SAV.Played.LastSavedDate.Value;
                CAL_LastSavedTime.Value = SAV.Played.LastSavedDate.Value;
            }
            else
            {
                L_LastSaved.Visible = CAL_LastSavedDate.Visible = CAL_LastSavedTime.Visible = false;
            }

            Util.GetDateTime2000(SAV.SecondsToStart, out var date, out var time);
            CAL_AdventureStartDate.Value = date;
            CAL_AdventureStartTime.Value = time;

            Util.GetDateTime2000(SAV.SecondsToFame, out date, out time);
            CAL_HoFDate.Value = date;
            CAL_HoFTime.Value = time;
        }