Select TID SID setter method

This commit is contained in:
Manu 2023-10-06 20:16:49 +02:00
parent 9e895d34af
commit fb7d53c1f1
5 changed files with 90 additions and 1 deletions

View File

@ -122,6 +122,24 @@ public class BCATManager
return false;
}
public bool GetRequiresMethodSelection(int index)
{
if (WCList is not null && WCList.Count > 0 && WCList.Count >= index - 1 && index >= 0)
if (WCList.ElementAt(index) is WC9 wc9)
return wc9.RequiresMethodSelection;
return false;
}
public void SetTIDSID(int index, bool after200)
{
if (WCList is not null && WCList.Count > 0 && WCList.Count >= index - 1 && index >= 0)
if (WCList.ElementAt(index) is WC9 wc9 && wc9.RequiresMethodSelection)
if (after200)
wc9.UpdateNewToOldTIDSID();
else
wc9.UpdateOldToNewTIDSID();
}
public int GetIndex(ushort wcid)
{
if (WCList is not null && WCList.Count > 0)

View File

@ -20,8 +20,10 @@ public class WC9 : Wondercard
// Entities with set TID / SID prior to the v2.0.1 game update would've had their TID / SID modified based on the Wondercard ID.
private readonly HashSet<ushort> OldGifts = new() { 0024, 0025, 0028, 0501, 0503, 0504, 0505, 0506, 1002, 1003, 1005 };
// These Gifts (Birthday Flabébé, Glaseado Cetitan) could be obtained both before and after the v2.0.1 game update.
private readonly HashSet<ushort> MixedGifts = new() { 0001, 1524 };
public bool RequiresMethodSelection { get => MixedGifts.Contains(WCID); }
public WC9(ReadOnlySpan<byte> data) : base(data)
{

View File

@ -39,7 +39,9 @@ partial class MainWindow
BtnOpen = new Button();
BtnSave = new Button();
GrpBCAT = new GroupBox();
cmbRedemptionMethod = new ComboBox();
ChkRepeatable = new CheckBox();
lblRedemptionMethod = new Label();
BtnApply = new Button();
GrpContent = new GroupBox();
LblInfo7 = new Label();
@ -59,6 +61,7 @@ partial class MainWindow
MenuStrip = new MenuStrip();
ToolsToolStripMenu = new ToolStripMenuItem();
MenuItemMGDB = new ToolStripMenuItem();
toolTipRedemptionMethod = new ToolTip(components);
GrpBCAT.SuspendLayout();
GrpContent.SuspendLayout();
ContextMenuStripWC.SuspendLayout();
@ -180,7 +183,9 @@ partial class MainWindow
//
// GrpBCAT
//
GrpBCAT.Controls.Add(cmbRedemptionMethod);
GrpBCAT.Controls.Add(ChkRepeatable);
GrpBCAT.Controls.Add(lblRedemptionMethod);
GrpBCAT.Controls.Add(BtnApply);
GrpBCAT.Controls.Add(GrpContent);
GrpBCAT.Controls.Add(TxtWCID);
@ -196,6 +201,18 @@ partial class MainWindow
GrpBCAT.TabStop = false;
GrpBCAT.Text = "BCAT Manager";
//
// cmbRedemptionMethod
//
cmbRedemptionMethod.Enabled = false;
cmbRedemptionMethod.FormattingEnabled = true;
cmbRedemptionMethod.Items.AddRange(new object[] { "Before 2.0.1", "After 2.0.1" });
cmbRedemptionMethod.Location = new Point(501, 32);
cmbRedemptionMethod.Name = "cmbRedemptionMethod";
cmbRedemptionMethod.Size = new Size(121, 28);
cmbRedemptionMethod.TabIndex = 14;
cmbRedemptionMethod.Visible = false;
cmbRedemptionMethod.SelectedIndexChanged += CmbRedemptionMethod_IndexChanged;
//
// ChkRepeatable
//
ChkRepeatable.AutoSize = true;
@ -207,6 +224,17 @@ partial class MainWindow
ChkRepeatable.UseVisualStyleBackColor = true;
ChkRepeatable.CheckedChanged += ChkRepeatable_CheckedChanged;
//
// lblRedemptionMethod
//
lblRedemptionMethod.AutoSize = true;
lblRedemptionMethod.Enabled = false;
lblRedemptionMethod.Location = new Point(324, 35);
lblRedemptionMethod.Name = "lblRedemptionMethod";
lblRedemptionMethod.Size = new Size(171, 20);
lblRedemptionMethod.TabIndex = 13;
lblRedemptionMethod.Text = "Redemption Method (?):";
lblRedemptionMethod.Visible = false;
//
// BtnApply
//
BtnApply.Enabled = false;
@ -394,6 +422,16 @@ partial class MainWindow
MenuItemMGDB.Text = "Download latest Mystery Gift Database";
MenuItemMGDB.Click += MenuItemMGDB_Click;
//
// toolTipRedemptionMethod
//
toolTipRedemptionMethod.AutoPopDelay = 50000;
toolTipRedemptionMethod.InitialDelay = 500;
toolTipRedemptionMethod.IsBalloon = true;
toolTipRedemptionMethod.ReshowDelay = 100;
toolTipRedemptionMethod.ShowAlways = true;
toolTipRedemptionMethod.ToolTipIcon = ToolTipIcon.Info;
toolTipRedemptionMethod.ToolTipTitle = "Redemption Date";
//
// MainWindow
//
AllowDrop = true;
@ -457,4 +495,7 @@ partial class MainWindow
private MenuStrip MenuStrip;
private ToolStripMenuItem ToolsToolStripMenu;
private ToolStripMenuItem MenuItemMGDB;
private Label lblRedemptionMethod;
private ToolTip toolTipRedemptionMethod;
private ComboBox cmbRedemptionMethod;
}

View File

@ -24,6 +24,10 @@ public partial class MainWindow : Form
Task.Run(TryUpdate).Wait();
InitializeComponent();
Text += BCATManager.Version;
cmbRedemptionMethod.SelectedIndex = 0;
toolTipRedemptionMethod.SetToolTip(lblRedemptionMethod, $"The Pokémon Scarlet & Violet v2.0.1 Update, released on September 13 - 2023, introduced a new TID / SID handling method for Wondercards.{Environment.NewLine}" +
$"This Pokémon Gift could be redeemed both before and after the v2.0.1 release, meaning it can be redeemed with either the old or new TID/SID handling method, depending on the redemption date.{Environment.NewLine}" +
$"The redemption date can be changed with the homebrew 'switch-time'. If you're not going to use 'switch-time', please select any date greater or equal than 'September 13, 2023'.");
}
private static async Task TryUpdate()
@ -299,6 +303,21 @@ public partial class MainWindow : Form
BtnApply.Enabled = false;
}
private void CmbRedemptionMethod_IndexChanged(object sender, EventArgs e)
{
int newIndex = cmbRedemptionMethod.SelectedIndex;
if (newIndex != cmbRedemptionMethod.Tag as int?)
{
if (CurrentGame is Games.SCVI)
{
var list = GetCurrentList();
list.SetTIDSID(ListBoxWC.SelectedIndex, newIndex == 1);
}
cmbRedemptionMethod.Tag = newIndex;
}
}
private void ToolTipWcid_Draw(object sender, DrawToolTipEventArgs e)
{
Point screenPosition = ListBox.MousePosition;
@ -368,6 +387,8 @@ public partial class MainWindow : Form
TxtWCID.Text = content.ElementAt(0);
ChkRepeatable.Checked = list.GetIsRepeatable(index);
cmbRedemptionMethod.Visible = cmbRedemptionMethod.Enabled = lblRedemptionMethod.Visible
= lblRedemptionMethod.Enabled = list.GetRequiresMethodSelection(index);
EnableContent();
}
else
@ -451,6 +472,10 @@ public partial class MainWindow : Form
GrpContent.Enabled = false;
ChkRepeatable.Checked = false;
ChkRepeatable.Enabled = false;
lblRedemptionMethod.Visible = false;
lblRedemptionMethod.Enabled = false;
cmbRedemptionMethod.Visible = false;
cmbRedemptionMethod.Enabled = false;
}
private void MenuItemMGDB_Click(object sender, EventArgs e) =>
@ -505,7 +530,7 @@ public partial class MainWindow : Form
var gen9Path = Path.Combine(genPath, "Gen 9");
Directory.Delete(Path.Combine(gen9Path, "Raid Events"), true);
MessageBox.Show($"The Mystery Gift Database has been downloaded in {mgdbPath}", "MGDB",
MessageBox.Show($"The Mystery Gift Database has been downloaded in {mgdbPath}", "MGDB",
MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
}
}

View File

@ -129,6 +129,9 @@
<metadata name="MenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>549, 17</value>
</metadata>
<metadata name="toolTipRedemptionMethod.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>677, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>