Add water/weed cheat buttons

This commit is contained in:
Kurt 2015-08-16 19:16:26 -07:00
parent ec7eb468cc
commit c6c40eeeff
2 changed files with 62 additions and 5 deletions

View File

@ -101,6 +101,8 @@ private void InitializeComponent()
this.PB_island02 = new System.Windows.Forms.PictureBox();
this.PB_island01 = new System.Windows.Forms.PictureBox();
this.PB_island00 = new System.Windows.Forms.PictureBox();
this.B_ClearWeeds = new System.Windows.Forms.Button();
this.B_WaterFlowers = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.PB_JPEG0)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
@ -249,6 +251,8 @@ private void InitializeComponent()
//
// tabPage1
//
this.tabPage1.Controls.Add(this.B_WaterFlowers);
this.tabPage1.Controls.Add(this.B_ClearWeeds);
this.tabPage1.Controls.Add(this.PB_acre54);
this.tabPage1.Controls.Add(this.PB_acre53);
this.tabPage1.Controls.Add(this.PB_acre52);
@ -961,6 +965,26 @@ private void InitializeComponent()
this.PB_island00.TabStop = false;
this.PB_island00.Visible = false;
//
// B_ClearWeeds
//
this.B_ClearWeeds.Location = new System.Drawing.Point(569, 4);
this.B_ClearWeeds.Name = "B_ClearWeeds";
this.B_ClearWeeds.Size = new System.Drawing.Size(75, 34);
this.B_ClearWeeds.TabIndex = 10;
this.B_ClearWeeds.Text = "Clear Weeds";
this.B_ClearWeeds.UseVisualStyleBackColor = true;
this.B_ClearWeeds.Click += new System.EventHandler(this.B_RemoveWeeds_Click);
//
// B_WaterFlowers
//
this.B_WaterFlowers.Location = new System.Drawing.Point(488, 4);
this.B_WaterFlowers.Name = "B_WaterFlowers";
this.B_WaterFlowers.Size = new System.Drawing.Size(75, 34);
this.B_WaterFlowers.TabIndex = 62;
this.B_WaterFlowers.Text = "Water Flowers";
this.B_WaterFlowers.UseVisualStyleBackColor = true;
this.B_WaterFlowers.Click += new System.EventHandler(this.B_WaterFlowers_Click);
//
// Garden
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1128,5 +1152,7 @@ private void InitializeComponent()
private System.Windows.Forms.PictureBox PB_island02;
private System.Windows.Forms.PictureBox PB_island01;
private System.Windows.Forms.PictureBox PB_island00;
private System.Windows.Forms.Button B_WaterFlowers;
private System.Windows.Forms.Button B_ClearWeeds;
}
}

View File

@ -330,13 +330,44 @@ private bool getIsWilted(ushort item)
{
return (item >= 0xce && item <= 0xfb);
}
private int clearWeeds(ref uint[] items)
// Quick Cheats
private void B_WaterFlowers_Click(object sender, EventArgs e)
{
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Water all flowers?"))
return;
int ctr = waterFlowers(ref TownItems);
fillTownItems(TownItems, TownAcres);
Util.Alert(String.Format("{0} flowers were watered!", ctr));
}
private void B_RemoveWeeds_Click(object sender, EventArgs e)
{
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Clear all weeds?"))
return;
int ctr = clearWeeds(ref TownItems);
fillTownItems(TownItems, TownAcres);
Util.Alert(String.Format("{0} weeds were cleared!", ctr));
}
private int waterFlowers(ref Item[] items)
{
int ctr = 0;
for (int i = 0; i < items.Length; i++)
if (getIsWeed(items[i]))
{ ctr++; items[i] = 0x7FFE; }
foreach (Item i in items.Where(t => getIsWilted(t.ID)))
{
ctr++;
i.Flag1 = 0x40;
}
return ctr;
}
private int clearWeeds(ref Item[] items)
{
int ctr = 0;
foreach (Item i in items.Where(t => getIsWeed(t.ID)))
{
ctr++;
i.ID = 0x7FFE;
i.Flag1 = 0;
i.Flag2 = 0;
}
return ctr;
}