Add automatic read/write items for all pocket items (1-40) (#51)

Decentralizes pocket injection logic from SysBotUI so that other auto-injectors can be passed in (future? like terrain/overworld items).

Adds validation to not modify items if the pocket data doesn't have the expected layout.

Closes #47 by implementing things in a more abstract & extendable way. Thanks @jfmherokiller for the example implementation which served as an inspiration!
This commit is contained in:
Kurt
2020-04-04 20:57:25 -07:00
committed by GitHub
parent 74f6157fa3
commit 1db185151d
19 changed files with 288 additions and 38 deletions

View File

@@ -28,16 +28,20 @@ protected override void Dispose(bool disposing)
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.B_Connect = new System.Windows.Forms.Button();
this.L_Port = new System.Windows.Forms.Label();
this.TB_Port = new System.Windows.Forms.TextBox();
this.L_IP = new System.Windows.Forms.Label();
this.TB_IP = new System.Windows.Forms.TextBox();
this.GB_Inject = new System.Windows.Forms.GroupBox();
this.CHK_AutoRead = new System.Windows.Forms.CheckBox();
this.CHK_AutoWrite = new System.Windows.Forms.CheckBox();
this.RamOffset = new System.Windows.Forms.TextBox();
this.L_Offset = new System.Windows.Forms.Label();
this.B_ReadCurrent = new System.Windows.Forms.Button();
this.B_WriteCurrent = new System.Windows.Forms.Button();
this.TIM_Interval = new System.Windows.Forms.Timer(this.components);
this.GB_Inject.SuspendLayout();
this.SuspendLayout();
//
@@ -89,6 +93,8 @@ private void InitializeComponent()
//
// GB_Inject
//
this.GB_Inject.Controls.Add(this.CHK_AutoRead);
this.GB_Inject.Controls.Add(this.CHK_AutoWrite);
this.GB_Inject.Controls.Add(this.RamOffset);
this.GB_Inject.Controls.Add(this.L_Offset);
this.GB_Inject.Controls.Add(this.B_ReadCurrent);
@@ -96,11 +102,33 @@ private void InitializeComponent()
this.GB_Inject.Enabled = false;
this.GB_Inject.Location = new System.Drawing.Point(16, 66);
this.GB_Inject.Name = "GB_Inject";
this.GB_Inject.Size = new System.Drawing.Size(149, 74);
this.GB_Inject.Size = new System.Drawing.Size(149, 119);
this.GB_Inject.TabIndex = 13;
this.GB_Inject.TabStop = false;
this.GB_Inject.Text = "Injector";
//
// CHK_AutoRead
//
this.CHK_AutoRead.AutoSize = true;
this.CHK_AutoRead.Location = new System.Drawing.Point(18, 93);
this.CHK_AutoRead.Name = "CHK_AutoRead";
this.CHK_AutoRead.Size = new System.Drawing.Size(74, 17);
this.CHK_AutoRead.TabIndex = 22;
this.CHK_AutoRead.Text = "AutoRead";
this.CHK_AutoRead.UseVisualStyleBackColor = true;
this.CHK_AutoRead.CheckedChanged += new System.EventHandler(this.CHK_AutoRead_CheckedChanged);
//
// CHK_AutoWrite
//
this.CHK_AutoWrite.AutoSize = true;
this.CHK_AutoWrite.Location = new System.Drawing.Point(18, 70);
this.CHK_AutoWrite.Name = "CHK_AutoWrite";
this.CHK_AutoWrite.Size = new System.Drawing.Size(73, 17);
this.CHK_AutoWrite.TabIndex = 21;
this.CHK_AutoWrite.Text = "AutoWrite";
this.CHK_AutoWrite.UseVisualStyleBackColor = true;
this.CHK_AutoWrite.CheckedChanged += new System.EventHandler(this.CHK_AutoWrite_CheckedChanged);
//
// RamOffset
//
this.RamOffset.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -110,6 +138,7 @@ private void InitializeComponent()
this.RamOffset.Size = new System.Drawing.Size(63, 20);
this.RamOffset.TabIndex = 20;
this.RamOffset.Text = "AC3B90C0";
this.RamOffset.TextChanged += new System.EventHandler(this.RamOffset_TextChanged);
//
// L_Offset
//
@@ -140,11 +169,15 @@ private void InitializeComponent()
this.B_WriteCurrent.UseVisualStyleBackColor = true;
this.B_WriteCurrent.Click += new System.EventHandler(this.B_WriteCurrent_Click);
//
// TIM_Interval
//
this.TIM_Interval.Interval = 5000;
//
// SysBotUI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(184, 151);
this.ClientSize = new System.Drawing.Size(184, 197);
this.Controls.Add(this.GB_Inject);
this.Controls.Add(this.B_Connect);
this.Controls.Add(this.L_Port);
@@ -177,5 +210,8 @@ private void InitializeComponent()
private System.Windows.Forms.Button B_WriteCurrent;
private System.Windows.Forms.TextBox RamOffset;
private System.Windows.Forms.Label L_Offset;
private System.Windows.Forms.CheckBox CHK_AutoWrite;
private System.Windows.Forms.CheckBox CHK_AutoRead;
private System.Windows.Forms.Timer TIM_Interval;
}
}