Show customization available bits

There's probably other bits used for fabric, but that's not researched
This commit is contained in:
Kurt
2020-05-06 21:03:20 -07:00
parent 46272165dc
commit 528eb2f1ec
2 changed files with 93 additions and 21 deletions

View File

@@ -16,7 +16,8 @@ public ItemReceivedEditor(Player player)
this.TranslateInterface(GameInfo.CurrentLanguage);
FillCheckBoxes();
Initialize(GameInfo.Strings.ItemDataSource);
CLB_Items.SelectedIndex = 0x50;
CLB_Remake.SelectedIndex = 0;
CLB_Items.SelectedIndex = 0x50; // clackercart
}
public void Initialize(List<ComboItem> items)
@@ -29,10 +30,15 @@ public void Initialize(List<ComboItem> items)
private void FillCheckBoxes()
{
var items = GameInfo.Strings.itemlistdisplay;
FillCollect(items);
FillRemake(items);
}
private void FillCollect(IReadOnlyList<string> items)
{
var ofs = Player.Personal.Offsets.ItemCollectBit;
var data = Player.Personal.Data;
for (int i = 0; i < items.Length; i++)
for (int i = 0; i < items.Count; i++)
{
var flag = FlagUtil.GetFlag(data, ofs, i);
string value = items[i];
@@ -41,6 +47,30 @@ private void FillCheckBoxes()
}
}
private void FillRemake(IReadOnlyList<string> items)
{
var invert = ItemRemakeUtil.GetInvertedDictionary();
var ofs = Player.Personal.Offsets.ItemRemakeCollectBit;
var max = Player.Personal.Offsets.MaxRemakeBitFlag;
var data = Player.Personal.Data;
for (int i = 0; i < max; i++)
{
var remakeIndex = i >> 3;
var variant = i & 7;
ushort itemId = invert.TryGetValue((short)remakeIndex, out var id) ? id : (ushort)0;
var itemName = remakeIndex == 0652 ? "photo" : items[itemId];
var flag = FlagUtil.GetFlag(data, ofs, i);
string name = $"{remakeIndex:0000} V{variant:0} - {itemName}";
if (ItemRemakeInfoData.List.TryGetValue((short) remakeIndex, out var info))
name = $"{name} ({info.GetColorDescription(variant)})";
CLB_Remake.Items.Add(name, flag);
}
}
public void GiveAll(IReadOnlyList<ushort> indexes, bool value = true)
{
foreach (var item in indexes)
@@ -89,9 +119,13 @@ private void B_Save_Click(object sender, EventArgs e)
private void CB_Item_SelectedValueChanged(object sender, EventArgs e)
{
var index = WinFormsUtil.GetIndex(CB_Item);
if (index >= CLB_Items.Items.Count)
if ((uint)index >= CLB_Items.Items.Count)
index = 0;
CLB_Items.SelectedIndex = index;
var remake = ItemRemakeUtil.GetRemakeIndex((ushort)index);
if (remake > 0)
CLB_Remake.SelectedIndex = remake * 8;
}
private void CLB_Items_SelectedIndexChanged(object sender, EventArgs e)