diff --git a/Test/ME3Test.cs b/Test/ME3Test.cs
index 6423642..1f0b793 100644
--- a/Test/ME3Test.cs
+++ b/Test/ME3Test.cs
@@ -6,28 +6,12 @@ namespace Test
{
public class ME3Test
{
- private const string CleanSavesDir = "../../../data/saves/clean/";
- private const string ExpectedSavesDir = "../../../data/saves/expected/";
- private const string MysteryDataDir = "../../../data/mysterydata/";
- private const string EM_EN = "em_en.sav";
- private const string RS_EN = "rs_en.sav";
- private const string EM_JP = "em_jp.sav";
- private const string RS_JP = "rs_jp.sav";
- private const string EM_EN_ME3 = "em_en_me3.sav";
- private const string RS_EN_ME3 = "rs_en_me3.sav";
- private const string EM_JP_ME3 = "em_jp_me3.sav";
- private const string RS_JP_ME3 = "rs_jp_me3.sav";
- private const string Eonticket_RS_EN = "eonticket_rs_en.me3";
- private const string Eonticket_RS_JP = "eonticket_rs_jp.me3";
- private const string Eonticket_EM_EN = "eonticket_em_en.me3";
- private const string Eonticket_EM_JP = "eonticket_em_jp.me3";
-
[Test]
public void ImportEmeraldEnglish()
{
- byte[] clean = File.ReadAllBytes($"{CleanSavesDir}{EM_EN}");
- byte[] expected = File.ReadAllBytes($"{ExpectedSavesDir}{EM_EN_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_EM_EN}");
+ byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.EM_EN}");
+ byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_EN_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_EM_EN}");
SAV3E sav = new(clean);
sav.ImportME3(me3);
@@ -38,9 +22,9 @@ public void ImportEmeraldEnglish()
[Test]
public void ImportEmeraldJapanese()
{
- byte[] clean = File.ReadAllBytes($"{CleanSavesDir}{EM_JP}");
- byte[] expected = File.ReadAllBytes($"{ExpectedSavesDir}{EM_JP_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_EM_JP}");
+ byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.EM_JP}");
+ byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_JP_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_EM_JP}");
SAV3E sav = new(clean);
sav.ImportME3(me3);
@@ -52,9 +36,9 @@ public void ImportEmeraldJapanese()
[Test]
public void ImportRSEnglish()
{
- byte[] clean = File.ReadAllBytes($"{CleanSavesDir}{RS_EN}");
- byte[] expected = File.ReadAllBytes($"{ExpectedSavesDir}{RS_EN_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_RS_EN}");
+ byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.RS_EN}");
+ byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_EN_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_RS_EN}");
SAV3RS sav = new(clean);
sav.ImportME3(me3);
@@ -65,9 +49,9 @@ public void ImportRSEnglish()
[Test]
public void ImportRSJapanese()
{
- byte[] clean = File.ReadAllBytes($"{CleanSavesDir}{RS_JP}");
- byte[] expected = File.ReadAllBytes($"{ExpectedSavesDir}{RS_JP_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_RS_JP}");
+ byte[] clean = File.ReadAllBytes($"{Data.CleanSavesDir}{Data.RS_JP}");
+ byte[] expected = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_JP_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_RS_JP}");
SAV3RS sav = new(clean);
sav.ImportME3(me3);
@@ -78,8 +62,8 @@ public void ImportRSJapanese()
[Test]
public void ExportEmeraldEnglish()
{
- byte[] sav_me3 = File.ReadAllBytes($"{ExpectedSavesDir}{EM_EN_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_EM_EN}");
+ byte[] sav_me3 = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_EN_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_EM_EN}");
SAV3E sav = new(sav_me3);
@@ -88,8 +72,8 @@ public void ExportEmeraldEnglish()
[Test]
public void ExportEmeraldJapanese()
{
- byte[] sav_me3 = File.ReadAllBytes($"{ExpectedSavesDir}{EM_JP_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_EM_JP}");
+ byte[] sav_me3 = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.EM_JP_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_EM_JP}");
SAV3E sav = new(sav_me3);
@@ -98,8 +82,8 @@ public void ExportEmeraldJapanese()
[Test]
public void ExportRSEnglish()
{
- byte[] sav_me3 = File.ReadAllBytes($"{ExpectedSavesDir}{RS_EN_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_RS_EN}");
+ byte[] sav_me3 = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_EN_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_RS_EN}");
SAV3RS sav = new(sav_me3);
@@ -108,8 +92,8 @@ public void ExportRSEnglish()
[Test]
public void ExportRSJapanese()
{
- byte[] sav_me3 = File.ReadAllBytes($"{ExpectedSavesDir}{RS_JP_ME3}");
- byte[] me3 = File.ReadAllBytes($"{MysteryDataDir}{Eonticket_RS_JP}");
+ byte[] sav_me3 = File.ReadAllBytes($"{Data.ExpectedSavesDir}{Data.RS_JP_ME3}");
+ byte[] me3 = File.ReadAllBytes($"{Data.MysteryDataDir}{Data.Eonticket_RS_JP}");
SAV3RS sav = new(sav_me3);
diff --git a/Test/Test.csproj b/Test/Test.csproj
index 7678244..a3eeddf 100644
--- a/Test/Test.csproj
+++ b/Test/Test.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/WC3Plugin/Forms/RM3Form.cs b/WC3Plugin/Forms/RM3Form.cs
index 7111068..23c47e8 100644
--- a/WC3Plugin/Forms/RM3Form.cs
+++ b/WC3Plugin/Forms/RM3Form.cs
@@ -12,8 +12,7 @@ public RM3Form(SAV3 sav)
InitializeComponent();
- List items = sav.GetRecordMixingItemDataSource();
- ItemComboBox.DataSource = new BindingSource(items, null);
+ ItemComboBox.DataSource = new BindingSource(sav.GetRecordMixingItemDataSource(), null);
ItemComboBox.DisplayMember = "Text";
ItemComboBox.ValueMember = "Value";
@@ -23,12 +22,13 @@ public RM3Form(SAV3 sav)
private void SaveButton_Click(object sender, EventArgs e)
{
- sav.SetRecordMixing((ushort)((ushort)ItemComboBox.SelectedValue! & 0xFFFF), (byte)CountBox.Value);
+ sav.SetRecordMixing((ushort)((ComboItem)ItemComboBox.SelectedItem!).Value, (byte)CountBox.Value);
+ Close();
}
private void ItemComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
- ushort selected = (ushort)((int)ItemComboBox.SelectedValue! & 0xFFFF);
+ ushort selected = (ushort)((ComboItem)ItemComboBox.SelectedItem!).Value;
if (selected == 0)
{
CountBox.Value = 0;
diff --git a/WC3Plugin/MysteryDataUtil.cs b/WC3Plugin/MysteryDataUtil.cs
index 71a758d..60a9fc7 100644
--- a/WC3Plugin/MysteryDataUtil.cs
+++ b/WC3Plugin/MysteryDataUtil.cs
@@ -171,7 +171,7 @@ private static uint GetECTChecksum(byte[] data)
public static void ImportECB(this SAV3 sav, byte[] data)
{
FixECBChecksum(data).CopyTo(sav.EReaderBerry());
- sav.SetWork((sav is SAV3RS or SAV3E) ? VAR_ENIGMA_BERRY_AVAILABLE_RSE : VAR_ENIGMA_BERRY_AVAILABLE_FRLG, 1);
+ sav.SetWork((sav is IGen3Hoenn) ? VAR_ENIGMA_BERRY_AVAILABLE_RSE : VAR_ENIGMA_BERRY_AVAILABLE_FRLG, 1);
}
public static byte[] ExportECB(this SAV3 sav)
@@ -248,7 +248,8 @@ public static bool IsValidForRecordMixing(this SAV3 sav, ushort item)
return storage.GetItems(InventoryType.PCItems).Contains(item);
}
- public static List GetRecordMixingItemDataSource(this SAV3 sav) => [
+ public static IReadOnlyList GetRecordMixingItemDataSource(this SAV3 sav) =>
+ [
.. GameInfo.FilteredSources.Items,
new(GameInfo.Strings.GetItemStrings(sav.Context, sav.Version)[EONTICKET], EONTICKET),
];
diff --git a/WC3Plugin/WC3Plugin.csproj b/WC3Plugin/WC3Plugin.csproj
index 409f7d6..bccf55e 100644
--- a/WC3Plugin/WC3Plugin.csproj
+++ b/WC3Plugin/WC3Plugin.csproj
@@ -2,7 +2,7 @@
WC3 Plugin
- 2.2.1.0
+ 2.2.2.0
net8.0-windows
12
true
@@ -11,7 +11,7 @@
-
+