mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-25 07:37:02 -05:00
Set body customization flags on give all
Closes #190 I checked one of my more recent save files and noticed that bits for remake indexes 2,000+ were set. Not sure why there's 8000 remake sets allocated... Maybe they're using the data there for other unlocks / values. Dunno! Replace '8' with ItemRemakeInfo.BodyColorCountMax for documentation clarity
This commit is contained in:
parent
cca03ea27a
commit
71089b0103
|
|
@ -4,6 +4,8 @@ namespace NHSE.Core
|
|||
{
|
||||
public class ItemRemakeInfo
|
||||
{
|
||||
public const int BodyColorCountMax = 8;
|
||||
|
||||
public readonly short Index;
|
||||
public readonly ushort ItemUniqueID;
|
||||
public readonly sbyte ReBodyPatternNum; // count of body colors
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ private void FillRemake(IReadOnlyList<string> items)
|
|||
var data = Player.Personal.Data;
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
var remakeIndex = i >> 3;
|
||||
var remakeIndex = i >> 3; // ItemRemakeInfo.BodyColorCountMax
|
||||
var variant = i & 7;
|
||||
|
||||
ushort itemId = invert.TryGetValue((short)remakeIndex, out var id) ? id : (ushort)0;
|
||||
|
|
@ -74,7 +74,7 @@ private void FillRemake(IReadOnlyList<string> items)
|
|||
public void GiveAll(IReadOnlyList<ushort> indexes, bool value = true)
|
||||
{
|
||||
foreach (var item in indexes)
|
||||
CLB_Items.SetItemChecked(item, value);
|
||||
GiveItem(item, value);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ private void GiveEverything(IReadOnlyList<string> items, bool value = true)
|
|||
if (!value)
|
||||
{
|
||||
for (ushort i = 0; i < CLB_Items.Items.Count; i++)
|
||||
CLB_Items.SetItemChecked(i, false);
|
||||
GiveItem(i, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -94,11 +94,28 @@ private void GiveEverything(IReadOnlyList<string> items, bool value = true)
|
|||
continue;
|
||||
if (skip.Contains(i))
|
||||
continue;
|
||||
CLB_Items.SetItemChecked(i, true);
|
||||
GiveItem(i);
|
||||
}
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void GiveItem(ushort item, bool value = true)
|
||||
{
|
||||
CLB_Items.SetItemChecked(item, value);
|
||||
|
||||
var remakeIndex = ItemRemakeUtil.GetRemakeIndex(item);
|
||||
if (!ItemRemakeInfoData.List.TryGetValue(remakeIndex, out var info))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < ItemRemakeInfo.BodyColorCountMax; i++)
|
||||
{
|
||||
if (!info.HasBodyColor(i))
|
||||
continue;
|
||||
int rIndex = (remakeIndex * ItemRemakeInfo.BodyColorCountMax) + i;
|
||||
CLB_Remake.SetItemChecked(rIndex, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ShowContextMenuBelow(ToolStripDropDown c, Control n) => c.Show(n.PointToScreen(new System.Drawing.Point(0, n.Height)));
|
||||
private void B_GiveAll_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_Buttons, (Control)sender);
|
||||
private void B_AllBugs_Click(object sender, EventArgs e) => GiveAll(GameLists.Bugs, ModifierKeys != Keys.Alt);
|
||||
|
|
@ -139,7 +156,7 @@ private void CB_Item_SelectedValueChanged(object sender, EventArgs e)
|
|||
|
||||
var remake = ItemRemakeUtil.GetRemakeIndex((ushort)index);
|
||||
if (remake > 0)
|
||||
CLB_Remake.SelectedIndex = remake * 8;
|
||||
CLB_Remake.SelectedIndex = remake * ItemRemakeInfo.BodyColorCountMax;
|
||||
}
|
||||
|
||||
private void CLB_Items_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user