Skip to content

Commit 26f395a

Browse files
author
Liam
authored
Merge pull request #33 from tiemonl/feature/GH-26_remove_timer
Remove timer for casting
2 parents 4a1d800 + 705a72d commit 26f395a

17 files changed

+54
-2062
lines changed

csharp/fisher.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ VisualStudioVersion = 15.0.27004.2009
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fisher", "fisher\fisher.csproj", "{93668F5E-8746-4070-AE80-19D2609EDE78}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fisherCLI", "fisherCLI\fisherCLI.csproj", "{76C7907B-3778-443F-9926-E099C04110E7}"
9-
EndProject
108
Global
119
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1210
Debug|Any CPU = Debug|Any CPU
@@ -17,10 +15,6 @@ Global
1715
{93668F5E-8746-4070-AE80-19D2609EDE78}.Debug|Any CPU.Build.0 = Debug|Any CPU
1816
{93668F5E-8746-4070-AE80-19D2609EDE78}.Release|Any CPU.ActiveCfg = Release|Any CPU
1917
{93668F5E-8746-4070-AE80-19D2609EDE78}.Release|Any CPU.Build.0 = Release|Any CPU
20-
{76C7907B-3778-443F-9926-E099C04110E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21-
{76C7907B-3778-443F-9926-E099C04110E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
22-
{76C7907B-3778-443F-9926-E099C04110E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
23-
{76C7907B-3778-443F-9926-E099C04110E7}.Release|Any CPU.Build.0 = Release|Any CPU
2418
EndGlobalSection
2519
GlobalSection(SolutionProperties) = preSolution
2620
HideSolutionNode = FALSE

csharp/fisher/Form1.Designer.cs

Lines changed: 48 additions & 245 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

csharp/fisher/Form1.cs

Lines changed: 4 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public partial class Form1 : Form {
1111
#region Declarations
1212

1313
private static bool steam;
14-
private static int rodType;
1514
private static Point locationStartButton;
1615
private static Point locationCloseShellDialogBox;
1716
private static Point locationTradeFishButton;
@@ -33,7 +32,6 @@ public partial class Form1 : Form {
3332
MethodHelper helper;
3433
#endregion
3534

36-
3735
public Form1() {
3836

3937
InitializeComponent();
@@ -43,35 +41,18 @@ public Form1() {
4341
backgroundThreadGetTimes.WorkerReportsProgress = true;
4442
backgroundThreadGetTimes.WorkerSupportsCancellation = true;
4543

46-
this.Size = new Size(375, 350);
47-
48-
rodTimerDebugToolTip.SetToolTip(rodTimerDebug, "Use this to adjust fishing timer to get a better catch result." +
49-
"\nAdd/subtract milliseconds (you shouldn't have to change more than 10 milliseconds)" +
50-
"\ndepending on if you are stopping before the max value or going past the max.");
51-
getTimesDedubToolTip.SetToolTip(getTimesBtn, "This function will automatically calculate the rod timer.\n" +
52-
"Press the button and wait for the program to time the cast bar going from max value to max value.\n" +
53-
"This will calculate five passes of the cast bar maximizing and return an average.\n" +
54-
"You can use this average as a solid rod timer to get a near 100% max cast.");
55-
5644
kongButton.CheckedChanged += new EventHandler(platform_CheckedChanged);
5745
kartridgeButton.CheckedChanged += new EventHandler(platform_CheckedChanged);
5846
steamButton.CheckedChanged += new EventHandler(platform_CheckedChanged);
5947

60-
woodFishingRod.CheckedChanged += new EventHandler(rodType_CheckedChanged);
61-
trollingRod.CheckedChanged += new EventHandler(rodType_CheckedChanged);
62-
spinningRod.CheckedChanged += new EventHandler(rodType_CheckedChanged);
63-
flyRod.CheckedChanged += new EventHandler(rodType_CheckedChanged);
64-
legRod.CheckedChanged += new EventHandler(rodType_CheckedChanged);
65-
6648
castCatchLocationLbl.Text = "Cast/Catch Location:\nPress start button when on fishing start screen";
6749

68-
rodChoiceGroupBox.Enabled = false;
50+
helper = new MethodHelper(steam);
51+
6952
baitToUseText.Enabled = false;
7053
findLocationBtn.Enabled = false;
7154
autoBtn.Enabled = false;
7255
cancelAutoModeBtn.Enabled = false;
73-
getTimesBtn.Enabled = false;
74-
7556

7657
}
7758
/// <summary>
@@ -80,57 +61,15 @@ public Form1() {
8061
/// </summary>
8162
private void platform_CheckedChanged(object sender, EventArgs e) {
8263
RadioButton radioButton = sender as RadioButton;
83-
8464
if (kongButton.Checked || kartridgeButton.Checked) {
8565
steam = false;
8666
} else if (steamButton.Checked) {
8767
steam = true;
8868
}
89-
rodChoiceGroupBox.Enabled = true;
90-
}
91-
92-
/// <summary>
93-
/// This determines which radio button was clicked.
94-
/// Each rod has a different timing.
95-
/// The timing is the time it takes for the casting bar to go from its max value, down to its lowest point and back up to its max value.
96-
/// I use this method of fishing as it has netted better results over clicking cast as soon as the program detects the casting bar at its max value.
97-
/// </summary>
98-
private void rodType_CheckedChanged(object sender, EventArgs e) {
99-
RadioButton radioButton = sender as RadioButton;
100-
101-
if (woodFishingRod.Checked) {
102-
if (steam)
103-
rodType = 1250;
104-
else
105-
rodType = 1260;
106-
} else if (trollingRod.Checked) {
107-
if (steam)
108-
rodType = 1350;
109-
else
110-
rodType = 1360;
111-
} else if (spinningRod.Checked) {
112-
if (steam)
113-
rodType = 1450;
114-
else
115-
rodType = 1460;
116-
} else if (flyRod.Checked) {
117-
if (steam)
118-
rodType = 1520;
119-
else
120-
rodType = 1525;
121-
} else if (legRod.Checked) {
122-
if (steam)
123-
rodType = 1580;
124-
else
125-
rodType = 1585;
126-
}
127-
rodTimerDebug.Value = rodType;
128-
helper = new MethodHelper(steam, rodType);
12969
baitToUseText.Enabled = true;
13070
findLocationBtn.Enabled = true;
13171
}
13272

133-
13473
private void CastCatchLocation_Click(object sender, EventArgs e) {
13574
locationStartButton = helper.FindColor(startButtonGreen);
13675
if (locationStartButton == new Point()) {
@@ -155,23 +94,13 @@ private void CastCatchLocation_Click(object sender, EventArgs e) {
15594
locationTopLeftWeightScreenshot = new Point(locationStartButton.X - 25, locationStartButton.Y - 130);
15695
locationBottomRightWeightScreenshot = new Point(locationStartButton.X + 160, locationStartButton.Y - 50);
15796
location100Position = new Point(locationStartButton.X + 373, locationStartButton.Y - 81);
158-
15997
}
16098
castCatchLocationLbl.Text = "Cast/Catch Location:\n" + locationStartButton.ToString();
16199
autoBtn.Enabled = true;
162100
cancelAutoModeBtn.Enabled = true;
163-
getTimesBtn.Enabled = true;
164101
}
165102
}
166103

167-
private void getTimesBtn_Click(object sender, EventArgs e) {
168-
getTimesBtn.Enabled = false;
169-
backgroundThreadGetTimes.RunWorkerAsync();
170-
getTimesBtn.Enabled = true;
171-
}
172-
173-
174-
175104
private void autoBtn_Click(object sender, EventArgs e) {
176105
backgroundThread.RunWorkerAsync();
177106
}
@@ -189,7 +118,7 @@ private void backgroundThread_DoWork(object sender, DoWorkEventArgs e) {
189118
//Performs cast
190119
bool caughtFish = true;
191120
bool fishGetAway = true;
192-
printMessage(baitUsed, baitToUse, " bait used.\nPerforming cast.\nTimer: " + rodType);
121+
printMessage(baitUsed, baitToUse, " bait used.\nPerforming cast.");
193122
++baitUsed;
194123
Invoke(new Action(() => Refresh()));
195124
Invoke(new Action(() => helper.startCast(locationStartButton)));
@@ -214,7 +143,7 @@ private void backgroundThread_DoWork(object sender, DoWorkEventArgs e) {
214143
Invoke(new Action(() => helper.catchFish(location100Position, oneHundredCatchColor)));
215144
Thread.Sleep(5000);
216145
while (fishGetAway) {
217-
146+
218147
//fish caught
219148
if (worker.CancellationPending == true) {
220149
e.Cancel = true;
@@ -253,8 +182,6 @@ private void backgroundThread_DoWork(object sender, DoWorkEventArgs e) {
253182
backgroundThread.CancelAsync();
254183
}
255184

256-
257-
258185
private void cancelAutoModeBtn_Click(object sender, EventArgs e) {
259186
backgroundThread.CancelAsync();
260187
}
@@ -264,30 +191,5 @@ private void printMessage(int baitUsed, int baitToUse, string msg) {
264191
debugAutoStepLbl.Text = baitUsed + "/" + baitToUse + msg;
265192
});
266193
}
267-
268-
private void debugOptions_CheckedChanged(object sender, EventArgs e) {
269-
if (debugOptions.Checked) {
270-
this.Size = new Size(500, 350);
271-
272-
} else {
273-
this.Size = new Size(375, 350);
274-
}
275-
}
276-
277-
private void rodTimerDebug_ValueChanged(object sender, EventArgs e) {
278-
rodType = (int)rodTimerDebug.Value;
279-
//initiliaze helper again to reflect the rodtype change.
280-
helper = new MethodHelper(steam, rodType);
281-
}
282-
283-
private void backgroundThreadGetTimes_DoWork(object sender, DoWorkEventArgs e) {
284-
BackgroundWorker worker = sender as BackgroundWorker;
285-
Invoke(new Action(() => helper.getTimesMessageBox(locationStartButton)));
286-
backgroundThreadGetTimes.CancelAsync();
287-
}
288-
289-
private void saveScreenshotButton_Click(object sender, EventArgs e) {
290-
helper.GetScreenShot(true);
291-
}
292194
}
293195
}

csharp/fisher/Form1.resx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,9 @@
120120
<metadata name="backgroundThread.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123-
<metadata name="rodTimerDebugToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124-
<value>172, 17</value>
125-
</metadata>
126123
<metadata name="backgroundThreadGetTimes.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127124
<value>351, 17</value>
128125
</metadata>
129-
<metadata name="getTimesDedubToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
130-
<value>557, 17</value>
131-
</metadata>
132126
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
133127
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
134128
<value>

csharp/fisher/MethodHelper.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ class MethodHelper {
1616
/// Constructor
1717
/// </summary>
1818
/// <param name="usingSteam">Determines whether the user is using Steam or Kongregate for the program.</param>
19-
/// <param name="rod">Determines which fishing rod the user is using to fish</param>
20-
public MethodHelper(bool usingSteam, int rod) {
19+
public MethodHelper(bool usingSteam) {
2120
steam = usingSteam;
22-
rodType = rod;
2321
}
2422

2523
public partial class NativeMethods {
@@ -63,7 +61,6 @@ public partial class NativeMethods {
6361

6462
private int screenNumContainingGame;
6563
private bool steam;
66-
private int rodType;
6764

6865
FindWeight findWeight = new FindWeight();
6966

@@ -257,12 +254,12 @@ public void castRod(Point location, Color color) {
257254
while (true) {
258255
var c = GetPixelColor(location);
259256
if (c.R == color.R && c.G == color.G && c.B == color.B) {
260-
Thread.Sleep(rodType);
261257
SendKeys.Send(" ");
262258
return;
263259
}
264260
}
265261
}
262+
266263
public void catchFish(Point location, Color color) {
267264
Cursor.Position = location;
268265
while (true) {

csharp/fisherCLI/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)