diff --git a/PokeViewer.NET/MainViewer.Designer.cs b/PokeViewer.NET/MainViewer.Designer.cs index 63c1322..67fe814 100644 --- a/PokeViewer.NET/MainViewer.Designer.cs +++ b/PokeViewer.NET/MainViewer.Designer.cs @@ -52,6 +52,7 @@ private void InitializeComponent() ToggleSwitchProtocol = new CheckBox(); ViewerControl = new TabControl(); ConnectionPage = new TabPage(); + EventRedeemButton = new Button(); MoodGroup = new GroupBox(); BackColorLabel = new Label(); ForeColorLabel = new Label(); @@ -168,7 +169,7 @@ private void InitializeComponent() // OriginIcon // OriginIcon.ImageLocation = "https://raw.githubusercontent.com/zyro670/PokeTextures/main/OriginMarks/icon_generation_00%5Esb.png"; - OriginIcon.Location = new Point(215, 18); + OriginIcon.Location = new Point(213, 18); OriginIcon.Name = "OriginIcon"; OriginIcon.Size = new Size(64, 64); OriginIcon.SizeMode = PictureBoxSizeMode.AutoSize; @@ -334,6 +335,7 @@ private void InitializeComponent() // ConnectionPage // ConnectionPage.BackColor = SystemColors.ControlLightLight; + ConnectionPage.Controls.Add(EventRedeemButton); ConnectionPage.Controls.Add(MoodGroup); ConnectionPage.Controls.Add(ScreenLabel); ConnectionPage.Controls.Add(TrainerPassportGroup); @@ -349,6 +351,17 @@ private void InitializeComponent() ConnectionPage.TabIndex = 0; ConnectionPage.Text = "Connection 🔌"; // + // EventRedeemButton + // + EventRedeemButton.Location = new Point(404, 6); + EventRedeemButton.Name = "EventRedeemButton"; + EventRedeemButton.Size = new Size(75, 23); + EventRedeemButton.TabIndex = 49; + EventRedeemButton.Text = "Event"; + EventRedeemButton.UseVisualStyleBackColor = true; + EventRedeemButton.Visible = false; + EventRedeemButton.Click += button1_Click; + // // MoodGroup // MoodGroup.Controls.Add(BackColorLabel); @@ -358,9 +371,9 @@ private void InitializeComponent() MoodGroup.Controls.Add(SetMoodButton); MoodGroup.Controls.Add(DefaultMoodRadio); MoodGroup.Controls.Add(AltMoodRadio); - MoodGroup.Location = new Point(276, 291); + MoodGroup.Location = new Point(276, 288); MoodGroup.Name = "MoodGroup"; - MoodGroup.Size = new Size(212, 129); + MoodGroup.Size = new Size(212, 132); MoodGroup.TabIndex = 48; MoodGroup.TabStop = false; MoodGroup.Text = "Mood"; @@ -814,5 +827,6 @@ private void InitializeComponent() private ComboBox AltBackCombo; private Label BackColorLabel; private Label ForeColorLabel; + private Button EventRedeemButton; } } \ No newline at end of file diff --git a/PokeViewer.NET/MainViewer.cs b/PokeViewer.NET/MainViewer.cs index 628eb2b..583f901 100644 --- a/PokeViewer.NET/MainViewer.cs +++ b/PokeViewer.NET/MainViewer.cs @@ -15,8 +15,8 @@ namespace PokeViewer.NET public partial class MainViewer : Form { public ViewerExecutor Executor = null!; - private const string ViewerVersion = "2.0.0"; - private const int AzureBuildID = 431; + private const string ViewerVersion = "2.1.0"; + private const int AzureBuildID = 432; private readonly bool[] FormLoaded = new bool[8]; private int GameType; private SimpleTrainerInfo TrainerInfo = new(); @@ -56,7 +56,7 @@ private static void GetVersionsOnStart(int azurematch) { DialogResult dialogResult = MessageBox.Show("A new azure-artifact build is available. Go to artifacts page?", "An update is available", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) - Process.Start(new ProcessStartInfo("https://dev.azure.com/zyrocodez/zyro670/_build?definitionId=5") { UseShellExecute = true }); + Process.Start(new ProcessStartInfo("https://dev.azure.com/zyrocodez/Project%20Zyro/_build?definitionId=5") { UseShellExecute = true }); else if (dialogResult == DialogResult.No) return; } @@ -65,7 +65,7 @@ private static void GetVersionsOnStart(int azurematch) private static async Task CheckAzureLabel() { int azurematch; - string latestazure = "https://dev.azure.com/zyrocodez/zyro670/_apis/build/builds?definitions=5&$top=1&api-version=5.0-preview.5"; + string latestazure = "https://dev.azure.com/zyrocodez/Project%20Zyro/_apis/build/builds?definitions=5&$top=1&api-version=5.0-preview.5"; HttpClient client = new(); var content = await client.GetStringAsync(latestazure); int buildId = int.Parse(content.Substring(135, 3)); @@ -231,13 +231,16 @@ private async void FillPokeData(PKM pk, ulong offset, uint offset2, int size) string ec = HidePIDEC.Checked ? "" : $"{Environment.NewLine}EC: {pk.EncryptionConstant:X8}"; var form = FormOutput(pk.Species, pk.Form, out _); string gender = string.Empty; + var scaleS = (IScaledSize)pk; + string scale = $"Scale: {PokeSizeDetailedUtil.GetSizeRating(scaleS.HeightScalar)} ({scaleS.HeightScalar})"; + switch (pk.Gender) { case 0: gender = " (M)"; break; case 1: gender = " (F)"; break; case 2: break; } - string output = $"{(pk.ShinyXor == 0 ? "■ - " : pk.ShinyXor <= 16 ? "★ - " : "")}{isAlpha}{(Species)pk.Species}{form}{gender}{ec}{pid}{Environment.NewLine}Nature: {(Nature)pk.Nature}{Environment.NewLine}Ability: {GameInfo.GetStrings(1).Ability[pk.Ability]}{Environment.NewLine}IVs: {pk.IV_HP}/{pk.IV_ATK}/{pk.IV_DEF}/{pk.IV_SPA}/{pk.IV_SPD}/{pk.IV_SPE}{msg}"; + string output = $"{(pk.ShinyXor == 0 ? "■ - " : pk.ShinyXor <= 16 ? "★ - " : "")}{isAlpha}{(Species)pk.Species}{form}{gender}{ec}{pid}{Environment.NewLine}Nature: {(Nature)pk.Nature}{Environment.NewLine}Ability: {GameInfo.GetStrings(1).Ability[pk.Ability]}{Environment.NewLine}IVs: {pk.IV_HP}/{pk.IV_ATK}/{pk.IV_DEF}/{pk.IV_SPA}/{pk.IV_SPD}/{pk.IV_SPE}{Environment.NewLine}{scale}{msg}"; LiveStats.Text = $"{GameInfo.GetStrings(1).Move[pk.Move1]} - {pk.Move1_PP}PP{Environment.NewLine}{GameInfo.GetStrings(1).Move[pk.Move2]} - {pk.Move2_PP}PP{Environment.NewLine}{GameInfo.GetStrings(1).Move[pk.Move3]} - {pk.Move3_PP}PP{Environment.NewLine}{GameInfo.GetStrings(1).Move[pk.Move4]} - {pk.Move4_PP}PP"; ViewBox.Text = output; sprite = PokeImg(pk, isGmax); @@ -246,7 +249,7 @@ private async void FillPokeData(PKM pk, ulong offset, uint offset2, int size) Typing1.Load(type1spr); if (pk.PersonalInfo.Type1 != pk.PersonalInfo.Type2) { - var type2spr = $"https://raw.githubusercontent.com/zyro670/PokeTextures/844a15d0f5ac62bebb265d015537e94fc7b8738c/Typings/grptxt_icon_type_gem_text_" + $"{pk.PersonalInfo.Type1}" + ".png"; + var type2spr = $"https://raw.githubusercontent.com/zyro670/PokeTextures/844a15d0f5ac62bebb265d015537e94fc7b8738c/Typings/grptxt_icon_type_gem_text_" + $"{pk.PersonalInfo.Type2}" + ".png"; Typing2.Load(type2spr); } if (alpha) @@ -557,14 +560,11 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(MiscPage); WideButton.Enabled = true; RaidButton.Enabled = true; + EventRedeemButton.Visible = true; }); - var sav = new SAV9SV(); - var info = sav.MyStatus; - var read = await Executor.SwitchConnection.PointerPeek(info.Data.Length, Offsets.MyStatusPointerSV, token).ConfigureAwait(false); - read.CopyTo(info.Data, 0); - TrainerInfo.OT = sav.OT; - TrainerInfo.TID16 = sav.TID16; - TrainerInfo.SID16 = sav.SID16; + var strings = await GetFakeTrainerSAVSV(token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case VioletID: @@ -580,8 +580,11 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(MiscPage); WideButton.Enabled = true; RaidButton.Enabled = true; + EventRedeemButton.Visible = true; }); - TrainerInfo = await GetFakeTrainerSAVSV(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVSV(token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case LegendsArceusID: @@ -595,7 +598,9 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(InGameScreenshotPage); WideButton.Enabled = true; }); - TrainerInfo = await GetFakeTrainerSAVLA(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVLA(token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case ShiningPearlID: @@ -610,7 +615,9 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(InGameScreenshotPage); WideButton.Enabled = true; }); - TrainerInfo = await GetFakeTrainerSAVBDSP(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVBDSP(type, token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case BrilliantDiamondID: @@ -625,7 +632,9 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(InGameScreenshotPage); WideButton.Enabled = true; }); - TrainerInfo = await GetFakeTrainerSAVBDSP(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVBDSP(type, token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case SwordID: @@ -642,7 +651,9 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(InGameScreenshotPage); WideButton.Enabled = true; }); - TrainerInfo = await GetFakeTrainerSAVSWSH(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVSWSH(token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case ShieldID: @@ -659,7 +670,9 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(InGameScreenshotPage); WideButton.Enabled = true; }); - TrainerInfo = await GetFakeTrainerSAVSWSH(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVSWSH(token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case EeveeID: @@ -673,7 +686,9 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(InGameScreenshotPage); WideButton.Enabled = true; }); - TrainerInfo = await GetFakeTrainerSAVLGPE(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVLGPE(token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } case PikachuID: @@ -687,7 +702,9 @@ private async void Window_Loaded() ViewerControl.TabPages.Add(InGameScreenshotPage); WideButton.Enabled = true; }); - TrainerInfo = await GetFakeTrainerSAVLGPE(token).ConfigureAwait(false); + var strings = await GetFakeTrainerSAVLGPE(token).ConfigureAwait(false); + TrainerLabel.Text = strings.Item1; + TIDSID.Text = strings.Item2; break; } } @@ -695,8 +712,6 @@ private async void Window_Loaded() ConnectionSpriteBox.ImageLocation = url; GameType = type; ViewBox.Text = "Click View!"; - TrainerLabel.Text = $"Name: {TrainerInfo.OT}"; - TIDSID.Text = $"TID | SID: {TrainerInfo.TID16} | {TrainerInfo.SID16}"; ToggleSwitchProtocol.Enabled = false; SwitchIP.Enabled = false; var bg = "https://raw.githubusercontent.com/kwsch/PKHeX/master/PKHeX.Drawing.PokeSprite/Resources/img/Pokemon%20Sprite%20Overlays/starter.png"; @@ -706,7 +721,7 @@ private async void Window_Loaded() private void CaptureWindow_Click(object sender, EventArgs e) { Rectangle bounds = ViewPage.Bounds; - Bitmap bmp = new(ViewPage.Width, ViewPage.Height - 60); + Bitmap bmp = new(ViewPage.Width, ViewPage.Height + 25); DrawToBitmap(bmp, bounds); Clipboard.SetImage(bmp); MessageBox.Show("Copied to clipboard!"); @@ -847,6 +862,8 @@ private void SetColorsConnection(Color back, Color fore) AltForeCombo.ForeColor = fore; AltBackCombo.BackColor = back; AltBackCombo.ForeColor = fore; + EventRedeemButton.BackColor = back; + EventRedeemButton.ForeColor = fore; } private static bool CheckForMood() @@ -994,81 +1011,81 @@ private void SetMoodOnStart() #region TrainerSav // via SysBot.NET - public async Task GetFakeTrainerSAVSWSH(CancellationToken token) + public async Task<(string, string)> GetFakeTrainerSAVSWSH(CancellationToken token) { - var simplesav = new SimpleTrainerInfo(); var sav = new SAV8SWSH(); var info = sav.MyStatus; var read = await Executor.Connection.ReadBytesAsync(Offsets.TrainerDataOffsetSWSH, Offsets.TrainerDataLengthSWSH, token).ConfigureAwait(false); read.CopyTo(info.Data, 0); - simplesav.OT = sav.OT; - simplesav.TID16 = sav.TID16; - simplesav.SID16 = sav.SID16; - return simplesav; + TrainerInfo.OT = sav.OT; + TrainerInfo.TID16 = sav.TID16; + TrainerInfo.SID16 = sav.SID16; + return ($"Name: {sav.OT}", $"TID: {sav.TrainerTID7} | SID: {sav.TrainerSID7}"); } - public async Task GetFakeTrainerSAVSV(CancellationToken token) + public async Task<(string, string)> GetFakeTrainerSAVSV(CancellationToken token) { - var simplesav = new SimpleTrainerInfo(); var sav = new SAV9SV(); var info = sav.MyStatus; var read = await Executor.SwitchConnection.PointerPeek(info.Data.Length, Offsets.MyStatusPointerSV, token).ConfigureAwait(false); read.CopyTo(info.Data, 0); - simplesav.OT = sav.OT; - simplesav.TID16 = sav.TID16; - simplesav.SID16 = sav.SID16; - return simplesav; + TrainerInfo.OT = sav.OT; + TrainerInfo.TID16 = sav.TID16; + TrainerInfo.SID16 = sav.SID16; + return ($"Name: {sav.OT}", $"TID: {sav.TrainerTID7} | SID: {sav.TrainerSID7}"); } - public async Task GetFakeTrainerSAVLA(CancellationToken token) + public async Task<(string, string)> GetFakeTrainerSAVLA(CancellationToken token) { - var simplesav = new SimpleTrainerInfo(); var sav = new SAV8LA(); var info = sav.MyStatus; var read = await Executor.SwitchConnection.PointerPeek(info.Data.Length, Offsets.MyStatusPointerLA, token).ConfigureAwait(false); read.CopyTo(info.Data, 0); - simplesav.OT = sav.OT; - simplesav.TID16 = sav.TID16; - simplesav.SID16 = sav.SID16; - return simplesav; + TrainerInfo.OT = sav.OT; + TrainerInfo.TID16 = sav.TID16; + TrainerInfo.SID16 = sav.SID16; + return ($"Name: {sav.OT}", $"TID: {sav.TrainerTID7} | SID: {sav.TrainerSID7}"); } - public async Task GetFakeTrainerSAVBDSP(CancellationToken token) + public const int MaxByteLengthStringObject = 0x14 + 0x1A; + public async Task<(string, string)> GetFakeTrainerSAVBDSP(int type, CancellationToken token) { - var simplesav = new SimpleTrainerInfo(); var sav = new SAV8BS(); var info = sav.MyStatus; - var name = await Executor.SwitchConnection.PointerPeek(0x14 + 0x1A, GameType == (int)GameSelected.BrilliantDiamond ? Offsets.MyStatusTrainerPointerBD : Offsets.MyStatusTrainerPointerSP, token).ConfigureAwait(false); + var name = await Executor.SwitchConnection.PointerPeek(MaxByteLengthStringObject, type == (int)GameSelected.BrilliantDiamond ? Offsets.MyStatusTrainerPointerBD : Offsets.MyStatusTrainerPointerSP, token).ConfigureAwait(false); info.OT = ReadStringFromRAMObject(name); - var offset = await Executor.SwitchConnection.PointerAll(GameType == (int)GameSelected.BrilliantDiamond ? Offsets.MyStatusTIDPointerBD : Offsets.MyStatusTIDPointerSP, token).ConfigureAwait(false); + var offset = await Executor.SwitchConnection.PointerAll(type == (int)GameSelected.BrilliantDiamond ? Offsets.MyStatusTIDPointerBD : Offsets.MyStatusTIDPointerSP, token).ConfigureAwait(false); var tid = await Executor.SwitchConnection.ReadBytesAbsoluteAsync(offset, 2, token).ConfigureAwait(false); var sid = await Executor.SwitchConnection.ReadBytesAbsoluteAsync(offset + 2, 2, token).ConfigureAwait(false); info.TID16 = System.Buffers.Binary.BinaryPrimitives.ReadUInt16LittleEndian(tid); info.SID16 = System.Buffers.Binary.BinaryPrimitives.ReadUInt16LittleEndian(sid); - simplesav.OT = sav.OT; - simplesav.TID16 = sav.TID16; - simplesav.SID16 = sav.SID16; - return simplesav; + TrainerInfo.OT = sav.OT; + TrainerInfo.TID16 = sav.TID16; + TrainerInfo.SID16 = sav.SID16; + return ($"Name: {sav.OT}", $"TID: {sav.TrainerTID7} | SID: {sav.TrainerSID7}"); } - public async Task GetFakeTrainerSAVLGPE(CancellationToken token) + public async Task<(string, string)> GetFakeTrainerSAVLGPE(CancellationToken token) { - var simplesav = new SimpleTrainerInfo(); var sav = new SAV7b(); byte[] bytes = sav.Blocks.Status.Data; int startofs = sav.Blocks.Status.Offset; byte[]? data = await Executor.Connection.ReadBytesAsync(Offsets.TrainerDataLGPE, Offsets.TrainerSizeLGPE, token).ConfigureAwait(false); data.CopyTo(bytes, startofs); - simplesav.OT = sav.OT; - simplesav.TID16 = sav.TID16; - simplesav.SID16 = sav.SID16; - return simplesav; + TrainerInfo.OT = sav.OT; + TrainerInfo.TID16 = sav.TID16; + TrainerInfo.SID16 = sav.SID16; + return ($"Name: {sav.OT}", $"TID: {sav.TrainerTID7} | SID: {sav.TrainerSID7}"); } public static string ReadStringFromRAMObject(byte[] obj) { + // 0x10 typeinfo/monitor, 0x4 len, char[len] const int ofs_len = 0x10; const int ofs_chars = 0x14; Debug.Assert(obj.Length >= ofs_chars); + + // Detect string length, but be cautious about its correctness (protect against bad data) int maxCharCount = (obj.Length - ofs_chars) / 2; int length = BitConverter.ToInt32(obj, ofs_len); if (length < 0 || length > maxCharCount) length = maxCharCount; + return StringConverter8.GetString(obj.AsSpan(ofs_chars, length * 2)); } #endregion @@ -1124,5 +1141,12 @@ private void AltBackCombo_SelectedIndexChanged(object sender, EventArgs e) var selection = AltBackCombo.SelectedIndex; Settings.Default.DefaultBackColor = UIColors[selection]; } + + private void button1_Click(object sender, EventArgs e) + { + var colors = CheckForColors(Settings.Default.DarkMode); + EventCodeEntry form = new(Executor, colors); + form.ShowDialog(); + } } } \ No newline at end of file diff --git a/PokeViewer.NET/MainViewer.resx b/PokeViewer.NET/MainViewer.resx index 1658d5a..561b72a 100644 --- a/PokeViewer.NET/MainViewer.resx +++ b/PokeViewer.NET/MainViewer.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/Properties/Resources.resx b/PokeViewer.NET/Properties/Resources.resx index 1af7de1..f298a7b 100644 --- a/PokeViewer.NET/Properties/Resources.resx +++ b/PokeViewer.NET/Properties/Resources.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/RoutineExecutor.cs b/PokeViewer.NET/RoutineExecutor.cs index 86d3cf8..0bad73b 100644 --- a/PokeViewer.NET/RoutineExecutor.cs +++ b/PokeViewer.NET/RoutineExecutor.cs @@ -1,5 +1,4 @@ using PKHeX.Core; -using SysBot.Pokemon; namespace PokeViewer.NET { diff --git a/PokeViewer.NET/SubForms/BoxViewerMini.resx b/PokeViewer.NET/SubForms/BoxViewerMini.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/BoxViewerMini.resx +++ b/PokeViewer.NET/SubForms/BoxViewerMini.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/BoxViewerMode.resx b/PokeViewer.NET/SubForms/BoxViewerMode.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/BoxViewerMode.resx +++ b/PokeViewer.NET/SubForms/BoxViewerMode.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/Egg Viewer.Designer.cs b/PokeViewer.NET/SubForms/Egg Viewer.Designer.cs index 8e75b93..5a9b8a3 100644 --- a/PokeViewer.NET/SubForms/Egg Viewer.Designer.cs +++ b/PokeViewer.NET/SubForms/Egg Viewer.Designer.cs @@ -67,6 +67,9 @@ private void InitializeComponent() pictureBox4 = new PictureBox(); pictureBox5 = new PictureBox(); pictureBox6 = new PictureBox(); + ForceDumpCheck = new CheckBox(); + NumericWaitTime = new NumericUpDown(); + WaitTime = new Label(); ((System.ComponentModel.ISupportInitialize)PokeSpriteBox).BeginInit(); ((System.ComponentModel.ISupportInitialize)BallBox).BeginInit(); ((System.ComponentModel.ISupportInitialize)NumberOfFillings).BeginInit(); @@ -76,6 +79,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)pictureBox4).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBox5).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBox6).BeginInit(); + ((System.ComponentModel.ISupportInitialize)NumericWaitTime).BeginInit(); SuspendLayout(); // // PokeSpriteBox @@ -135,7 +139,7 @@ private void InitializeComponent() // EatOnStart // EatOnStart.AutoSize = true; - EatOnStart.Location = new Point(263, 43); + EatOnStart.Location = new Point(263, 28); EatOnStart.Name = "EatOnStart"; EatOnStart.Size = new Size(93, 19); EatOnStart.TabIndex = 13; @@ -145,7 +149,7 @@ private void InitializeComponent() // Item1Value // Item1Value.BackColor = SystemColors.Control; - Item1Value.Location = new Point(310, 144); + Item1Value.Location = new Point(313, 119); Item1Value.Name = "Item1Value"; Item1Value.Size = new Size(32, 23); Item1Value.TabIndex = 14; @@ -155,7 +159,7 @@ private void InitializeComponent() // Item1Label // Item1Label.AutoSize = true; - Item1Label.Location = new Point(260, 149); + Item1Label.Location = new Point(260, 122); Item1Label.Name = "Item1Label"; Item1Label.Size = new Size(40, 15); Item1Label.TabIndex = 15; @@ -164,7 +168,7 @@ private void InitializeComponent() // Item2Label // Item2Label.AutoSize = true; - Item2Label.Location = new Point(260, 174); + Item2Label.Location = new Point(260, 150); Item2Label.Name = "Item2Label"; Item2Label.Size = new Size(40, 15); Item2Label.TabIndex = 16; @@ -173,7 +177,7 @@ private void InitializeComponent() // Item2Value // Item2Value.BackColor = SystemColors.Control; - Item2Value.Location = new Point(310, 172); + Item2Value.Location = new Point(313, 147); Item2Value.Name = "Item2Value"; Item2Value.Size = new Size(32, 23); Item2Value.TabIndex = 17; @@ -184,7 +188,7 @@ private void InitializeComponent() // EatAgain.AutoSize = true; EatAgain.BackColor = Color.Transparent; - EatAgain.Location = new Point(263, 65); + EatAgain.Location = new Point(263, 50); EatAgain.Name = "EatAgain"; EatAgain.Size = new Size(81, 19); EatAgain.TabIndex = 18; @@ -194,7 +198,7 @@ private void InitializeComponent() // Item3Label // Item3Label.AutoSize = true; - Item3Label.Location = new Point(260, 201); + Item3Label.Location = new Point(260, 178); Item3Label.Name = "Item3Label"; Item3Label.Size = new Size(40, 15); Item3Label.TabIndex = 19; @@ -203,7 +207,7 @@ private void InitializeComponent() // Item3Value // Item3Value.BackColor = SystemColors.Control; - Item3Value.Location = new Point(310, 200); + Item3Value.Location = new Point(313, 175); Item3Value.Name = "Item3Value"; Item3Value.Size = new Size(32, 23); Item3Value.TabIndex = 20; @@ -213,7 +217,7 @@ private void InitializeComponent() // checkBox5 // checkBox5.AutoSize = true; - checkBox5.Location = new Point(357, 148); + checkBox5.Location = new Point(362, 121); checkBox5.Name = "checkBox5"; checkBox5.Size = new Size(49, 19); checkBox5.TabIndex = 21; @@ -225,7 +229,7 @@ private void InitializeComponent() checkBox6.AutoSize = true; checkBox6.Checked = true; checkBox6.CheckState = CheckState.Checked; - checkBox6.Location = new Point(357, 174); + checkBox6.Location = new Point(362, 149); checkBox6.Name = "checkBox6"; checkBox6.Size = new Size(49, 19); checkBox6.TabIndex = 22; @@ -237,7 +241,7 @@ private void InitializeComponent() checkBox7.AutoSize = true; checkBox7.Checked = true; checkBox7.CheckState = CheckState.Checked; - checkBox7.Location = new Point(357, 201); + checkBox7.Location = new Point(362, 177); checkBox7.Name = "checkBox7"; checkBox7.Size = new Size(49, 19); checkBox7.TabIndex = 23; @@ -283,7 +287,7 @@ private void InitializeComponent() // HoldIngredients // HoldIngredients.AutoSize = true; - HoldIngredients.Location = new Point(263, 87); + HoldIngredients.Location = new Point(263, 72); HoldIngredients.Name = "HoldIngredients"; HoldIngredients.Size = new Size(97, 19); HoldIngredients.TabIndex = 32; @@ -293,7 +297,7 @@ private void InitializeComponent() // NumberOfFillings // NumberOfFillings.BackColor = SystemColors.Control; - NumberOfFillings.Location = new Point(350, 232); + NumberOfFillings.Location = new Point(355, 232); NumberOfFillings.Maximum = new decimal(new int[] { 10, 0, 0, 0 }); NumberOfFillings.Name = "NumberOfFillings"; NumberOfFillings.Size = new Size(49, 23); @@ -303,7 +307,7 @@ private void InitializeComponent() // label1 // label1.AutoSize = true; - label1.Location = new Point(259, 237); + label1.Location = new Point(259, 235); label1.Name = "label1"; label1.Size = new Size(85, 15); label1.TabIndex = 34; @@ -321,7 +325,7 @@ private void InitializeComponent() // FillingHoldTime // FillingHoldTime.BackColor = SystemColors.Control; - FillingHoldTime.Location = new Point(366, 262); + FillingHoldTime.Location = new Point(369, 262); FillingHoldTime.Name = "FillingHoldTime"; FillingHoldTime.Size = new Size(33, 23); FillingHoldTime.TabIndex = 36; @@ -341,7 +345,7 @@ private void InitializeComponent() // DisplayPartyCheck // DisplayPartyCheck.AutoSize = true; - DisplayPartyCheck.Location = new Point(263, 108); + DisplayPartyCheck.Location = new Point(263, 93); DisplayPartyCheck.Name = "DisplayPartyCheck"; DisplayPartyCheck.Size = new Size(99, 19); DisplayPartyCheck.TabIndex = 64; @@ -369,7 +373,7 @@ private void InitializeComponent() // HidePIDEC // HidePIDEC.AutoSize = true; - HidePIDEC.Location = new Point(263, 22); + HidePIDEC.Location = new Point(263, 7); HidePIDEC.Name = "HidePIDEC"; HidePIDEC.Size = new Size(129, 19); HidePIDEC.TabIndex = 67; @@ -435,12 +439,47 @@ private void InitializeComponent() pictureBox6.TabIndex = 74; pictureBox6.TabStop = false; // + // ForceDumpCheck + // + ForceDumpCheck.AutoSize = true; + ForceDumpCheck.Font = new Font("Segoe UI", 9.75F, FontStyle.Regular, GraphicsUnit.Point); + ForceDumpCheck.Location = new Point(362, 93); + ForceDumpCheck.Name = "ForceDumpCheck"; + ForceDumpCheck.Size = new Size(45, 21); + ForceDumpCheck.TabIndex = 75; + ForceDumpCheck.Text = "👻"; + ForceDumpCheck.UseVisualStyleBackColor = true; + ForceDumpCheck.CheckedChanged += ForceEgg_CheckedChanged; + // + // NumericWaitTime + // + NumericWaitTime.BackColor = SystemColors.Control; + NumericWaitTime.Location = new Point(355, 204); + NumericWaitTime.Maximum = new decimal(new int[] { 600, 0, 0, 0 }); + NumericWaitTime.Minimum = new decimal(new int[] { 120, 0, 0, 0 }); + NumericWaitTime.Name = "NumericWaitTime"; + NumericWaitTime.Size = new Size(48, 23); + NumericWaitTime.TabIndex = 76; + NumericWaitTime.Value = new decimal(new int[] { 180, 0, 0, 0 }); + // + // WaitTime + // + WaitTime.AutoSize = true; + WaitTime.Location = new Point(259, 207); + WaitTime.Name = "WaitTime"; + WaitTime.Size = new Size(95, 15); + WaitTime.TabIndex = 77; + WaitTime.Text = "Picnic Wait Time"; + // // Egg_Viewer // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; BackColor = SystemColors.Control; ClientSize = new Size(426, 404); + Controls.Add(WaitTime); + Controls.Add(NumericWaitTime); + Controls.Add(ForceDumpCheck); Controls.Add(pictureBox6); Controls.Add(pictureBox5); Controls.Add(pictureBox4); @@ -490,6 +529,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)pictureBox4).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBox5).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBox6).EndInit(); + ((System.ComponentModel.ISupportInitialize)NumericWaitTime).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -533,5 +573,8 @@ private void InitializeComponent() private PictureBox pictureBox4; private PictureBox pictureBox5; private PictureBox pictureBox6; + private CheckBox ForceDumpCheck; + private NumericUpDown NumericWaitTime; + private Label WaitTime; } } \ No newline at end of file diff --git a/PokeViewer.NET/SubForms/Egg Viewer.cs b/PokeViewer.NET/SubForms/Egg Viewer.cs index 7431206..1e8bd50 100644 --- a/PokeViewer.NET/SubForms/Egg Viewer.cs +++ b/PokeViewer.NET/SubForms/Egg Viewer.cs @@ -48,6 +48,10 @@ private void SetColors((Color, Color) color) ScreenshotButton.ForeColor = color.Item2; PokeStats.BackColor = color.Item1; PokeStats.ForeColor = color.Item2; + WaitTime.BackColor = color.Item1; + WaitTime.ForeColor = color.Item2; + NumericWaitTime.BackColor = color.Item1; + NumericWaitTime.ForeColor = color.Item2; setcolors = color; } @@ -142,7 +146,7 @@ private async Task WaitForEggs(CancellationToken token) waiting++; await Task.Delay(1_500, token).ConfigureAwait(false); pk = await ReadPokemonSV(Offsets.EggData, 344, token).ConfigureAwait(false); - if (waiting == 120) + if (waiting == (int)NumericWaitTime.Value) { await ReopenPicnic(token).ConfigureAwait(false); await MakeSandwich(token).ConfigureAwait(false); @@ -173,7 +177,7 @@ private async Task WaitForEggs(CancellationToken token) case 2: break; } string sensitiveinfo = HidePIDEC.Checked ? "" : $"{pid}{ec}"; - string output = $"{$"Egg #{eggcount}"}{Environment.NewLine}{(pk.ShinyXor == 0 ? "■ - " : pk.ShinyXor <= 16 ? "★ - " : "")}{(Species)pk.Species}{form}{gender}{sensitiveinfo}{Environment.NewLine}Nature: {(Nature)pk.Nature}{Environment.NewLine}Ability: {(Ability)pk.Ability}{Environment.NewLine}IVs: {pk.IV_HP}/{pk.IV_ATK}/{pk.IV_DEF}/{pk.IV_SPA}/{pk.IV_SPD}/{pk.IV_SPE}{Environment.NewLine}Scale: {PokeSizeDetailedUtil.GetSizeRating(pk.Scale)}"; + string output = $"{$"Egg #{eggcount}"}{Environment.NewLine}{(pk.ShinyXor == 0 ? "■ - " : pk.ShinyXor <= 16 ? "★ - " : "")}{(Species)pk.Species}{form}{gender}{sensitiveinfo}{Environment.NewLine}Nature: {(Nature)pk.Nature}{Environment.NewLine}Ability: {(Ability)pk.Ability}{Environment.NewLine}IVs: {pk.IV_HP}/{pk.IV_ATK}/{pk.IV_DEF}/{pk.IV_SPA}/{pk.IV_SPD}/{pk.IV_SPE}{Environment.NewLine}Scale: {PokeSizeDetailedUtil.GetSizeRating(pk.Scale)} ({pk.Scale})"; PokeStats.Text = output; LogUtil.LogText(output); string? sprite; @@ -230,6 +234,9 @@ private bool ValidateEncounter(PK9 pk) starcount++; ShinyFoundLabel.Text = $"Shinies Found: {squarecount + starcount}"; SquareStarCount.Text = $"■ - {squarecount} | ★ - {starcount}"; + + if (ForceDumpCheck.Checked) + ForcifyEgg(pk); } if (!pk.IVs.SequenceEqual(IVFilters) && !Settings.Default.IgnoreIVFilter) @@ -271,6 +278,37 @@ private async Task ReadPokemonSV(uint offset, int size, CancellationToken t return pk; } + private static void ForcifyEgg(PK9 pk) + { + pk.IsEgg = true; + pk.Nickname = "Egg"; + pk.Met_Location = 0; + pk.Egg_Location = 30023; + pk.MetDate = DateOnly.Parse("2023/02/17"); + pk.EggMetDate = pk.MetDate; + pk.OT_Name = "ZYZYZYZY"; + pk.HeldItem = 0; + pk.CurrentLevel = 1; + pk.EXP = 0; + pk.Met_Level = 1; + pk.CurrentHandler = 0; + pk.OT_Friendship = 1; + pk.HT_Name = ""; + pk.HT_Friendship = 0; + pk.ClearMemories(); + pk.StatNature = pk.Nature; + pk.SetEVs(new int[] { 0, 0, 0, 0, 0, 0 }); + pk.SetMarking(0, 0); + pk.SetMarking(1, 0); + pk.SetMarking(2, 0); + pk.SetMarking(3, 0); + pk.SetMarking(4, 0); + pk.SetMarking(5, 0); + pk.ClearInvalidMoves(); + + ViewerUtil.DumpPokemon(AppDomain.CurrentDomain.BaseDirectory, "forced-eggs", pk); + } + private async Task SetStick(SwitchStick stick, short x, short y, int delay, CancellationToken token) { var cmd = SwitchCommand.SetStick(stick, x, y, true); @@ -628,5 +666,11 @@ private async Task ReadBoxPokemonSV(ulong offset, int size, CancellationTok var pk = new PK9(data); return pk; } + + private void ForceEgg_CheckedChanged(object sender, EventArgs e) + { + if (ForceDumpCheck.Checked) + MessageBox.Show("You have enabled force dump eggs. These should not be considered legitimate and are only a backup for ghost eggs. Please do not pass these off as legitimate eggs."); + } } } diff --git a/PokeViewer.NET/SubForms/Egg Viewer.resx b/PokeViewer.NET/SubForms/Egg Viewer.resx index a395bff..a289a9d 100644 --- a/PokeViewer.NET/SubForms/Egg Viewer.resx +++ b/PokeViewer.NET/SubForms/Egg Viewer.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/EventCodeEntry.Designer.cs b/PokeViewer.NET/SubForms/EventCodeEntry.Designer.cs new file mode 100644 index 0000000..ce8f978 --- /dev/null +++ b/PokeViewer.NET/SubForms/EventCodeEntry.Designer.cs @@ -0,0 +1,100 @@ +namespace PokeViewer.NET.SubForms +{ + partial class EventCodeEntry + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + RedeemButton = new Button(); + textBox1 = new TextBox(); + ClearButton = new Button(); + label1 = new Label(); + SuspendLayout(); + // + // RedeemButton + // + RedeemButton.Location = new Point(15, 55); + RedeemButton.Name = "RedeemButton"; + RedeemButton.Size = new Size(98, 23); + RedeemButton.TabIndex = 0; + RedeemButton.Text = "Redeem!"; + RedeemButton.UseVisualStyleBackColor = true; + RedeemButton.Click += RedeemButton_Click; + // + // textBox1 + // + textBox1.Location = new Point(15, 12); + textBox1.MaxLength = 16; + textBox1.Multiline = true; + textBox1.Name = "textBox1"; + textBox1.Size = new Size(233, 36); + textBox1.TabIndex = 1; + // + // ClearButton + // + ClearButton.Location = new Point(150, 55); + ClearButton.Name = "ClearButton"; + ClearButton.Size = new Size(98, 23); + ClearButton.TabIndex = 2; + ClearButton.Text = "Clear Text"; + ClearButton.UseVisualStyleBackColor = true; + ClearButton.Click += ClearButton_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Font = new Font("Segoe UI", 15.75F, FontStyle.Regular, GraphicsUnit.Point); + label1.Location = new Point(113, 50); + label1.Name = "label1"; + label1.Size = new Size(39, 30); + label1.TabIndex = 3; + label1.Text = "🎁"; + // + // EventCodeEntry + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(260, 92); + Controls.Add(ClearButton); + Controls.Add(textBox1); + Controls.Add(RedeemButton); + Controls.Add(label1); + MaximizeBox = false; + Name = "EventCodeEntry"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Code Entry"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button RedeemButton; + private TextBox textBox1; + private Button ClearButton; + private Label label1; + } +} \ No newline at end of file diff --git a/PokeViewer.NET/SubForms/EventCodeEntry.cs b/PokeViewer.NET/SubForms/EventCodeEntry.cs new file mode 100644 index 0000000..9d52fb7 --- /dev/null +++ b/PokeViewer.NET/SubForms/EventCodeEntry.cs @@ -0,0 +1,84 @@ +using PKHeX.Core; +using SysBot.Base; +using static SysBot.Base.SwitchButton; + +namespace PokeViewer.NET.SubForms +{ + public partial class EventCodeEntry : Form + { + private readonly ViewerExecutor Executor; + protected ViewerOffsets ViewerOffsets { get; } = new(); + public EventCodeEntry(ViewerExecutor executor, (Color, Color) color) + { + InitializeComponent(); + Executor = executor; + SetColors(color); + } + + private void SetColors((Color, Color) color) + { + BackColor = color.Item1; + ForeColor = color.Item2; + RedeemButton.BackColor = color.Item1; + RedeemButton.ForeColor = color.Item2; + ClearButton.BackColor = color.Item1; + ClearButton.ForeColor = color.Item2; + textBox1.BackColor = color.Item1; + textBox1.ForeColor = color.Item2; + } + + private async Task EnterCode(CancellationToken token) + { + var strokes = textBox1.Text.ToUpper().Trim().ToArray(); + var number = $"NumPad"; + string[] badVals = { "@", "I", "O", "=", "&", ";", "Z", "*", "#", "!", "?" }; + List keystopress = new(); + foreach (var str in strokes) + { + if (badVals.Contains(str.ToString())) + { + MessageBox.Show($"{str} is not a valid button. Stopping code entry."); + return; + } + foreach (HidKeyboardKey keypress in (HidKeyboardKey[])Enum.GetValues(typeof(HidKeyboardKey))) + { + if (str.ToString().Equals(keypress.ToString()) || (number + str.ToString()).Equals(keypress.ToString())) + keystopress.Add(keypress); + } + } + + for (int i = 0; i < keystopress.Count; i++) + { + await Executor.SwitchConnection.SendAsync(SwitchCommand.TypeKey(keystopress[i], true), token).ConfigureAwait(false); + await Task.Delay(0_050, token).ConfigureAwait(false); + } + await Click(PLUS, 0_500, token).ConfigureAwait(false); + await Click(PLUS, 0_500, token).ConfigureAwait(false); + + } + + private async void RedeemButton_Click(object sender, EventArgs e) + { + if (textBox1.Text.Length > 16) + { + MessageBox.Show($"{textBox1.Text} is not a valid code entry. Please try again."); + } + + if (!string.IsNullOrEmpty(textBox1.Text)) + await EnterCode(CancellationToken.None).ConfigureAwait(false); + else + MessageBox.Show("TextBox is empty. Try again after you fill it in!"); + } + + private new async Task Click(SwitchButton b, int delay, CancellationToken token) + { + await Executor.SwitchConnection.SendAsync(SwitchCommand.Click(b, true), token).ConfigureAwait(false); + await Task.Delay(delay, token).ConfigureAwait(false); + } + + private void ClearButton_Click(object sender, EventArgs e) + { + textBox1.Text = string.Empty; + } + } +} diff --git a/PokeViewer.NET/SubForms/EventCodeEntry.resx b/PokeViewer.NET/SubForms/EventCodeEntry.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/PokeViewer.NET/SubForms/EventCodeEntry.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PokeViewer.NET/SubForms/MapViewSV.Designer.cs b/PokeViewer.NET/SubForms/MapViewSV.Designer.cs index 4b6cf7b..1a9cd74 100644 --- a/PokeViewer.NET/SubForms/MapViewSV.Designer.cs +++ b/PokeViewer.NET/SubForms/MapViewSV.Designer.cs @@ -29,33 +29,33 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MapViewSV)); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); + pictureBox1 = new PictureBox(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); + SuspendLayout(); // // pictureBox1 // - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.Location = new System.Drawing.Point(12, 12); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(447, 391); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 0; - this.pictureBox1.TabStop = false; + pictureBox1.Image = (Image)resources.GetObject("pictureBox1.Image"); + pictureBox1.Location = new Point(12, 12); + pictureBox1.Name = "pictureBox1"; + pictureBox1.Size = new Size(447, 391); + pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; + pictureBox1.TabIndex = 0; + pictureBox1.TabStop = false; // // MapViewSV // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(471, 415); - this.Controls.Add(this.pictureBox1); - this.MaximizeBox = false; - this.Name = "MapViewSV"; - this.Text = "MapViewSV"; - this.FormBorderStyle = FormBorderStyle.FixedSingle; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(471, 415); + Controls.Add(pictureBox1); + FormBorderStyle = FormBorderStyle.FixedSingle; + MaximizeBox = false; + MinimizeBox = false; + Name = "MapViewSV"; + Text = "MapViewSV"; + ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); + ResumeLayout(false); } #endregion diff --git a/PokeViewer.NET/SubForms/MiscView.cs b/PokeViewer.NET/SubForms/MiscView.cs index c74736c..cfffa0d 100644 --- a/PokeViewer.NET/SubForms/MiscView.cs +++ b/PokeViewer.NET/SubForms/MiscView.cs @@ -83,7 +83,7 @@ private void SetColors((Color, Color) color) groupBox3.BackColor = color.Item1; groupBox3.ForeColor = color.Item2; groupBox4.BackColor = color.Item1; - groupBox4.ForeColor = color.Item2; + groupBox4.ForeColor = color.Item2; DPADUpDown.BackColor = color.Item1; DPADUpDown.ForeColor = color.Item2; OverShootUpDown.BackColor = color.Item1; diff --git a/PokeViewer.NET/SubForms/MiscView.resx b/PokeViewer.NET/SubForms/MiscView.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/MiscView.resx +++ b/PokeViewer.NET/SubForms/MiscView.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/NPCViewer.resx b/PokeViewer.NET/SubForms/NPCViewer.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/NPCViewer.resx +++ b/PokeViewer.NET/SubForms/NPCViewer.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/PartyViewer.resx b/PokeViewer.NET/SubForms/PartyViewer.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/PartyViewer.resx +++ b/PokeViewer.NET/SubForms/PartyViewer.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/RaidCodeEntry.Designer.cs b/PokeViewer.NET/SubForms/RaidCodeEntry.Designer.cs index 81dc1ef..ea3f20b 100644 --- a/PokeViewer.NET/SubForms/RaidCodeEntry.Designer.cs +++ b/PokeViewer.NET/SubForms/RaidCodeEntry.Designer.cs @@ -167,6 +167,7 @@ private void InitializeComponent() numericUpDown1.Size = new Size(104, 23); numericUpDown1.TabIndex = 9; numericUpDown1.TextAlign = HorizontalAlignment.Right; + numericUpDown1.ValueChanged += NumericValue_Changed; // // GoButton // diff --git a/PokeViewer.NET/SubForms/RaidCodeEntry.cs b/PokeViewer.NET/SubForms/RaidCodeEntry.cs index 0c15e72..7d52180 100644 --- a/PokeViewer.NET/SubForms/RaidCodeEntry.cs +++ b/PokeViewer.NET/SubForms/RaidCodeEntry.cs @@ -129,6 +129,7 @@ private async void GoButton_Click(object sender, EventArgs e) try { await ReadRaids(CancellationToken.None).ConfigureAwait(false); + MessageBox.Show("Done. Use the arrows to scroll through your results!"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } GoButton.Enabled = true; @@ -136,6 +137,18 @@ private async void GoButton_Click(object sender, EventArgs e) checkBox1.Enabled = true; } + private void NumericValue_Changed(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(raidimages[(int)numericUpDown1.Value])) + { + pictureBox1.Load(raidimages[(int)numericUpDown1.Value]); + Results.Text = results[(int)numericUpDown1.Value]; + pictureBox2.Image = teratype[(int)numericUpDown1.Value]; + } + else + MessageBox.Show("No results saved, please hit GO again."); + } + private (string, string) CalculateFromSeed(uint seed, PK9 pk) { var raidseed = checkBox1.Checked ? "Hidden" : $"0x{seed:X8}"; @@ -152,6 +165,9 @@ private async void GoButton_Click(object sender, EventArgs e) return (sprite, results); } + private List raidimages = new(); + private List results = new(); + private List teratype = new(); private ulong TeraRaidBlockOffset; private RaidContainer? container; private int StoryProgress; @@ -255,22 +271,26 @@ private async Task ReadRaids(CancellationToken token) if (delivery > 0) MessageBox.Show($"Invalid delivery group ID for {delivery} raid(s). Try deleting the \"cache\" folder."); - var raids = container.Raids; - int index = (int)numericUpDown1.Value; - Raid raid = raids[index]; - var encounter = container.Encounters[index]; - var param = encounter.GetParam(); - var blank = new PK9 + for (int i = 0; i < 69; i++) { - Species = encounter.Species, - Form = encounter.Form - }; - Encounter9RNG.GenerateData(blank, param, EncounterCriteria.Unrestricted, raid.Seed); - var (spr, txt) = CalculateFromSeed(raid.Seed, blank); - Results.Text = txt; - pictureBox1.Load(spr); - var tera = blank.TeraType; - pictureBox2.Image = TypeSpriteUtil.GetTypeSpriteGem((byte)tera); + var raids = container.Raids; + int index = i; + Raid raid = raids[index]; + var encounter = container.Encounters[index]; + var param = encounter.GetParam(); + var blank = new PK9 + { + Species = encounter.Species, + Form = encounter.Form + }; + Encounter9RNG.GenerateData(blank, param, EncounterCriteria.Unrestricted, raid.Seed); + var (spr, txt) = CalculateFromSeed(raid.Seed, blank); + results.Add(txt); + raidimages.Add(spr); + var tera = blank.TeraType; + var type = TypeSpriteUtil.GetTypeSpriteGem((byte)tera); + teratype.Add(type!); + } } public async Task ReadEventRaids(ulong BaseBlockKeyPointer, RaidContainer container, CancellationToken token, bool force = false) diff --git a/PokeViewer.NET/SubForms/RaidCodeEntry.resx b/PokeViewer.NET/SubForms/RaidCodeEntry.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/RaidCodeEntry.resx +++ b/PokeViewer.NET/SubForms/RaidCodeEntry.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/ScreenshotForm.resx b/PokeViewer.NET/SubForms/ScreenshotForm.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/ScreenshotForm.resx +++ b/PokeViewer.NET/SubForms/ScreenshotForm.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/StopConditions.resx b/PokeViewer.NET/SubForms/StopConditions.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/StopConditions.resx +++ b/PokeViewer.NET/SubForms/StopConditions.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/WideViewerBDSP.resx b/PokeViewer.NET/SubForms/WideViewerBDSP.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/WideViewerBDSP.resx +++ b/PokeViewer.NET/SubForms/WideViewerBDSP.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/WideViewerLA.resx b/PokeViewer.NET/SubForms/WideViewerLA.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/WideViewerLA.resx +++ b/PokeViewer.NET/SubForms/WideViewerLA.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/WideViewerLGPE.resx b/PokeViewer.NET/SubForms/WideViewerLGPE.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/WideViewerLGPE.resx +++ b/PokeViewer.NET/SubForms/WideViewerLGPE.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/WideViewerSV.resx b/PokeViewer.NET/SubForms/WideViewerSV.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/WideViewerSV.resx +++ b/PokeViewer.NET/SubForms/WideViewerSV.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/SubForms/WideViewerSWSH.resx b/PokeViewer.NET/SubForms/WideViewerSWSH.resx index a395bff..f298a7b 100644 --- a/PokeViewer.NET/SubForms/WideViewerSWSH.resx +++ b/PokeViewer.NET/SubForms/WideViewerSWSH.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PokeViewer.NET/Util/ViewerUtil.cs b/PokeViewer.NET/Util/ViewerUtil.cs index 695ff31..d9011c0 100644 --- a/PokeViewer.NET/Util/ViewerUtil.cs +++ b/PokeViewer.NET/Util/ViewerUtil.cs @@ -123,10 +123,10 @@ public class ViewerOffsets public IReadOnlyList OverworldPointer { get; } = new long[] { 0x44E5068, 0x348, 0x10, 0xD8, 0x28 }; public IReadOnlyList MyStatusPointerSV { get; } = new long[] { 0x44C1C18, 0x100, 0x40 }; public IReadOnlyList MyStatusPointerLA { get; } = new long[] { 0x42BA6B0, 0x218, 0x68 }; - public IReadOnlyList MyStatusTrainerPointerBD { get; } = new long[] { 0x4E36C58, 0xB8, 0x10, 0xE0, 0x0 }; - public IReadOnlyList MyStatusTIDPointerBD { get; } = new long[] { 0x4E36C58, 0xB8, 0x10, 0xE8 }; - public IReadOnlyList MyStatusTrainerPointerSP { get; } = new long[] { 0x4E36C58, 0xB8, 0x10, 0xE0, 0x0 }; - public IReadOnlyList MyStatusTIDPointerSP { get; } = new long[] { 0x4E36C58, 0xB8, 0x10, 0xE8 }; + public IReadOnlyList MyStatusTrainerPointerBD { get; } = new long[] { 0x4C64DC0, 0xB8, 0x10, 0xE0, 0x0 }; + public IReadOnlyList MyStatusTIDPointerBD { get; } = new long[] { 0x4C64DC0, 0xB8, 0x10, 0xE8 }; + public IReadOnlyList MyStatusTrainerPointerSP { get; } = new long[] { 0x4E7BE98, 0xB8, 0x10, 0xE0, 0x0 }; + public IReadOnlyList MyStatusTIDPointerSP { get; } = new long[] { 0x4E7BE98, 0xB8, 0x10, 0xE8 }; public readonly uint EggData = 0x044C3348; public readonly uint PicnicMenu = 0x04553020; public readonly uint StartingOffset = 0x4505B880; diff --git a/PokeViewer.NET/deps/HelperEnums.cs b/PokeViewer.NET/deps/HelperEnums.cs index 8a31697..c58e4ec 100644 --- a/PokeViewer.NET/deps/HelperEnums.cs +++ b/PokeViewer.NET/deps/HelperEnums.cs @@ -1,4 +1,4 @@ -namespace SysBot.Pokemon +namespace PokeViewer.NET { public enum GenderDependent : ushort { diff --git a/PokeViewer.NET/deps/RaidCrawler.Core.dll b/PokeViewer.NET/deps/RaidCrawler.Core.dll index 78bfd60..9af594b 100644 Binary files a/PokeViewer.NET/deps/RaidCrawler.Core.dll and b/PokeViewer.NET/deps/RaidCrawler.Core.dll differ