mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-26 00:28:28 -05:00
Dynamically set r/w count
This commit is contained in:
parent
789097c7a6
commit
8aa1f9ad5e
|
|
@ -115,7 +115,8 @@ private void B_EditPlayerItems_Click(object sender, EventArgs e)
|
|||
var p1 = pers.Pocket1;
|
||||
var p2 = pers.Pocket2;
|
||||
var items = p2.Concat(p1).ToArray();
|
||||
using var editor = new PlayerItemEditor<Item>(items, 10, 4, sysbot: true);
|
||||
int sys = p1.Count; // disjointed 20-20
|
||||
using var editor = new PlayerItemEditor<Item>(items, 10, 4, sysbot: sys);
|
||||
if (editor.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ public partial class PlayerItemEditor<T> : Form where T : Item
|
|||
{
|
||||
private readonly IReadOnlyList<T> Items;
|
||||
private readonly Action LoadItems;
|
||||
private readonly int SysBotLength;
|
||||
|
||||
public PlayerItemEditor(IReadOnlyList<T> array, int width, int height, bool sysbot = false)
|
||||
public PlayerItemEditor(IReadOnlyList<T> array, int width, int height, int sysbot = 0)
|
||||
{
|
||||
InitializeComponent();
|
||||
Items = array;
|
||||
|
|
@ -26,7 +27,7 @@ public PlayerItemEditor(IReadOnlyList<T> array, int width, int height, bool sysb
|
|||
Editor.LoadItems();
|
||||
DialogResult = DialogResult.Cancel;
|
||||
LoadItems = () => Editor.LoadItems();
|
||||
B_Inject.Visible = sysbot;
|
||||
B_Inject.Visible = (SysBotLength = sysbot) > 0;
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e) => Close();
|
||||
|
|
@ -78,7 +79,7 @@ private void B_Inject_Click(object sender, EventArgs e)
|
|||
return;
|
||||
}
|
||||
|
||||
byte[] Write() => Items.Take(20).SelectMany(z => z.ToBytesClass()).ToArray();
|
||||
byte[] Write() => Items.Take(SysBotLength).SelectMany(z => z.ToBytesClass()).ToArray();
|
||||
void Read(byte[] data)
|
||||
{
|
||||
var items = Item.GetArray(data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user