Skip to content

Commit 619f7f5

Browse files
committed
Cleanup
1 parent 48aaa68 commit 619f7f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+151
-158
lines changed

Feh Farmer/Configurations/Default.xml

-8
This file was deleted.

Feh Farmer/Program.cs

-92
This file was deleted.
-95.5 KB
Binary file not shown.
-61.5 KB
Binary file not shown.

Feh Farmer/bin/Debug/ADB/adb.exe

-1.7 MB
Binary file not shown.

Feh Farmer/bin/Debug/Configurations/Default.xml

-8
This file was deleted.

Feh Farmer/bin/Debug/Feh Farmer.exe

-10 KB
Binary file not shown.

Feh Farmer/bin/Debug/Feh Farmer.exe.config

-6
This file was deleted.

Feh Farmer/bin/Debug/Feh Farmer.pdb

-19.5 KB
Binary file not shown.
-94.5 KB
Binary file not shown.
-95.5 KB
Binary file not shown.
-61.5 KB
Binary file not shown.

Feh Farmer/bin/Release/ADB/adb.exe

-1.7 MB
Binary file not shown.

Feh Farmer/bin/Release/Configurations/Default.xml

-8
This file was deleted.

Feh Farmer/bin/Release/Feh Farmer.exe

-10 KB
Binary file not shown.

Feh Farmer/bin/Release/Feh Farmer.exe.config

-6
This file was deleted.

Feh Farmer/bin/Release/Feh Farmer.pdb

-19.5 KB
Binary file not shown.
-94.5 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

Feh Farmer/obj/Debug/Feh Farmer.csproj.CopyComplete

Whitespace-only changes.

Feh Farmer/obj/Debug/Feh Farmer.csproj.CoreCompileInputs.cache

-1
This file was deleted.

Feh Farmer/obj/Debug/Feh Farmer.csproj.FileListAbsolute.txt

-10
This file was deleted.
Binary file not shown.

Feh Farmer/obj/Debug/Feh Farmer.exe

-10 KB
Binary file not shown.

Feh Farmer/obj/Debug/Feh Farmer.pdb

-19.5 KB
Binary file not shown.

Feh Farmer/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

Whitespace-only changes.

Feh Farmer/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

Whitespace-only changes.

Feh Farmer/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

Whitespace-only changes.

Feh Farmer/obj/Release/Feh Farmer.csproj.CopyComplete

Whitespace-only changes.

Feh Farmer/obj/Release/Feh Farmer.csproj.CoreCompileInputs.cache

-1
This file was deleted.

Feh Farmer/obj/Release/Feh Farmer.csproj.FileListAbsolute.txt

-9
This file was deleted.

Feh Farmer/obj/Release/Feh Farmer.exe

-10 KB
Binary file not shown.

Feh Farmer/obj/Release/Feh Farmer.pdb

-19.5 KB
Binary file not shown.

Feh Farmer/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

Whitespace-only changes.

Feh Farmer/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

Whitespace-only changes.

Feh Farmer/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

Whitespace-only changes.

Feh Farmer.sln GrandHeroFarmer.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.27703.2035
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Feh Farmer", "Feh Farmer\Feh Farmer.csproj", "{DF9A01C1-F523-4E02-AD5A-73A084F65132}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grand Hero Farmer", "GrandHeroFarmer\Grand Hero Farmer.csproj", "{DF9A01C1-F523-4E02-AD5A-73A084F65132}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
File renamed without changes.
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Settings>
3+
<Areas>
4+
<StartGHBButton>
5+
<TopLeftX>100</TopLeftX>
6+
<TopLeftY>850</TopLeftY>
7+
<BottomRightX>1000</BottomRightX>
8+
<BottomRightY>1000</BottomRightY>
9+
</StartGHBButton>
10+
<FightButton>
11+
<TopLeftX>200</TopLeftX>
12+
<TopLeftY>1130</TopLeftY>
13+
<BottomRightX>900</BottomRightX>
14+
<BottomRightY>1230</BottomRightY>
15+
</FightButton>
16+
<SkipDialogButton>
17+
<TopLeftX>750</TopLeftX>
18+
<TopLeftY>50</TopLeftY>
19+
<BottomRightX>1000</BottomRightX>
20+
<BottomRightY>100</BottomRightY>
21+
</SkipDialogButton>
22+
<AutoBattleButton>
23+
<TopLeftX>770</TopLeftX>
24+
<TopLeftY>1770</TopLeftY>
25+
<BottomRightX>900</BottomRightX>
26+
<BottomRightY>1900</BottomRightY>
27+
</AutoBattleButton>
28+
<AcceptAutoBattleButton>
29+
<TopLeftX>230</TopLeftX>
30+
<TopLeftY>900</TopLeftY>
31+
<BottomRightX>870</BottomRightX>
32+
<BottomRightY>1000</BottomRightY>
33+
</AcceptAutoBattleButton>
34+
</Areas>
35+
<Timers>
36+
<CommunicateServerTimer>2</CommunicateServerTimer>
37+
<StageLoadTimer>3</StageLoadTimer>
38+
<InitialDialogTimer>3</InitialDialogTimer>
39+
<StageTimer>13</StageTimer>
40+
</Timers>
41+
</Settings>

Feh Farmer/Feh Farmer.csproj GrandHeroFarmer/Grand Hero Farmer.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{DF9A01C1-F523-4E02-AD5A-73A084F65132}</ProjectGuid>
88
<OutputType>Exe</OutputType>
9-
<RootNamespace>Feh_Farmer</RootNamespace>
10-
<AssemblyName>Feh Farmer</AssemblyName>
9+
<RootNamespace>GrandHeroFarmer</RootNamespace>
10+
<AssemblyName>GrandHeroFarmer</AssemblyName>
1111
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

Feh Farmer/Helpers/Android.cs GrandHeroFarmer/Helpers/Android.cs

+24-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Net;
66
using System.Text;
77
using System.Threading.Tasks;
8+
using System.Xml.Linq;
89

910
namespace Feh_Farmer.Helpers
1011
{
@@ -24,20 +25,24 @@ public Android()
2425
monitor.Start();
2526
}
2627

28+
/// <summary>
29+
/// Tries to connect to an android device by using the ADB interface.
30+
/// </summary>
2731
private void ConnectToAndroid()
2832
{
2933
bool foundDevice = false;
3034
while (!foundDevice)
3135
{
32-
ConsoleLogger.Write("Trying to get Device from adb...", Type.Default);
36+
ConsoleLogger.Write("Trying to get device from adb...", Type.Default);
3337
if(AdbClient.Instance.GetDevices().Count != 0)
3438
{
3539
_device = AdbClient.Instance.GetDevices().First();
3640
foundDevice = true;
3741
ConsoleLogger.WriteLine(_device.Name + " connected!", Type.Info, false);
3842
return;
3943
}
40-
ConsoleLogger.WriteLine("No Device was found! Is it connected?", Type.Error);
44+
45+
ConsoleLogger.WriteLine("No Device was found! Is the phone connected?", Type.Error);
4146
ConsoleLogger.Write("Check the connection and press", Type.Default);
4247
ConsoleLogger.Write(" Enter ", Type.Info, false);
4348
ConsoleLogger.WriteLine("to try again.", Type.Default, false);
@@ -48,13 +53,12 @@ private void ConnectToAndroid()
4853
/// <summary>
4954
/// Sends a tap event to the connected device with the given coordenates
5055
/// </summary>
51-
/// <param name="pX"></param>
52-
/// <param name="pY"></param>
56+
/// <param name="pX">X Coordinate</param>
57+
/// <param name="pY">Y Coordinate</param>
5358
public void Tap(Tuple<int, int> coordenates)
5459
{
5560
string command = "input tap " + coordenates.Item1 + " " + coordenates.Item2;
5661

57-
5862
IShellOutputReceiver receiver = null;
5963

6064
AdbClient.Instance.ExecuteRemoteCommand(command, _device, receiver);
@@ -64,6 +68,7 @@ public void Tap(Tuple<int, int> coordenates)
6468
void OnDeviceDisconnected(object sender, DeviceDataEventArgs e)
6569
{
6670
ConsoleLogger.WriteLine("The device " + _device.Name +" has disconnected to this PC", Type.Error);
71+
ConsoleLogger.WriteLine("Please restart the application and go back to the Mission Select Menu.", Type.Default);
6772
ConnectToAndroid();
6873
}
6974
}
@@ -79,9 +84,22 @@ public class ClickArea
7984
public ClickArea(int pTopLeftX, int pTopLeftY, int pBottomRightX, int pBottomRightY)
8085
{
8186
topLeft = new Tuple<int, int>(pTopLeftX, pTopLeftY);
82-
bottomRight = new Tuple<int, int>(pBottomRightX, pBottomRightY); ;
87+
bottomRight = new Tuple<int, int>(pBottomRightX, pBottomRightY);
8388
}
8489

90+
/// <summary>
91+
/// Creates a click area from a XElement in a XML File.
92+
/// </summary>
93+
/// <param name="element"></param>
94+
public ClickArea(XElement element)
95+
: this
96+
(
97+
(int) element.Descendants("TopLeftX").FirstOrDefault(),
98+
(int) element.Descendants("TopLeftY").FirstOrDefault(),
99+
(int) element.Descendants("BottomRightX").FirstOrDefault(),
100+
(int) element.Descendants("BottomRightY").FirstOrDefault()
101+
) { }
102+
85103
public Tuple<int, int> GenerateRandomCoords()
86104
{
87105
Random r = new Random();
File renamed without changes.

GrandHeroFarmer/Program.cs

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using Feh_Farmer.Helpers;
2+
using SharpAdbClient;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading;
8+
using System.Threading.Tasks;
9+
using System.Xml;
10+
using System.Xml.Linq;
11+
12+
namespace Feh_Farmer
13+
{
14+
class Program
15+
{
16+
static void Main(string[] args)
17+
{
18+
ConsoleLogger.WriteLine("Welcome to Feh Farmer", Helpers.Type.Info, true, ConsoleColor.DarkYellow);
19+
Android phone = new Android();
20+
21+
//Initializing Service Configurations
22+
ConsoleLogger.Write("Loading service configurations from xml... ", Helpers.Type.Default);
23+
XDocument doc = XDocument.Load("Configurations/Default.xml");
24+
25+
ClickArea startGBHButton = new ClickArea(doc.Descendants("StartGHBButton").FirstOrDefault());
26+
ClickArea fightButton = new ClickArea(doc.Descendants("FightButton").FirstOrDefault());
27+
ClickArea skipDialogButton = new ClickArea(doc.Descendants("SkipDialogButton").FirstOrDefault());
28+
ClickArea autoBattleButton = new ClickArea(doc.Descendants("AutoBattleButton").FirstOrDefault());
29+
ClickArea acceptAutoBattleButton = new ClickArea(doc.Descendants("AcceptAutoBattleButton").FirstOrDefault());
30+
31+
int communicateServerTimer = ((int)(doc.Descendants("CommunicateServerTimer").FirstOrDefault()) * 1000);
32+
int stageLoadTimer = ((int)(doc.Descendants("StageLoadTimer").FirstOrDefault()) * 1000);
33+
int initialDialogTimer = ((int)(doc.Descendants("InitialDialogTimer").FirstOrDefault()) * 1000);
34+
int stageTimer = ((int)(doc.Descendants("StageTimer").FirstOrDefault()) * 1000);
35+
36+
ConsoleLogger.WriteLine("OK", Helpers.Type.Info, false);
37+
38+
ConsoleLogger.WriteLine("Setup is done, press enter to start earning feathers.", Helpers.Type.Info);
39+
ConsoleLogger.WriteLine("Press 'Ctrl + C' to exit the application.", Helpers.Type.Info);
40+
Console.ReadLine();
41+
42+
int iterations = 0;
43+
44+
Thread thread = new Thread(() => {
45+
while (true)
46+
{
47+
Console.WriteLine();
48+
ConsoleLogger.Write("Starting iteration ", Helpers.Type.Default);
49+
ConsoleLogger.WriteLine(iterations.ToString(), Helpers.Type.Info, false);
50+
phone.Tap(startGBHButton.GenerateRandomCoords());
51+
52+
phone.Tap(fightButton.GenerateRandomCoords());
53+
54+
Thread.Sleep(communicateServerTimer);
55+
phone.Tap(fightButton.GenerateRandomCoords());
56+
57+
Thread.Sleep(stageLoadTimer);
58+
ConsoleLogger.WriteLine("Skipping initial dialog", Helpers.Type.Default);
59+
phone.Tap(skipDialogButton.GenerateRandomCoords());
60+
Thread.Sleep(initialDialogTimer);
61+
62+
ConsoleLogger.WriteLine("Initializing Auto-Battle", Helpers.Type.Default);
63+
phone.Tap(autoBattleButton.GenerateRandomCoords());
64+
65+
phone.Tap(acceptAutoBattleButton.GenerateRandomCoords());
66+
67+
ConsoleLogger.WriteLine("Waiting for battle to end", Helpers.Type.Default);
68+
Thread.Sleep(stageTimer);
69+
70+
phone.Tap(fightButton.GenerateRandomCoords());
71+
Thread.Sleep(communicateServerTimer);
72+
73+
ConsoleLogger.Write("Finished iteration ", Helpers.Type.Default);
74+
ConsoleLogger.WriteLine(iterations.ToString(), Helpers.Type.Info, false);
75+
76+
iterations++;
77+
}
78+
79+
});
80+
thread.Start();
81+
}
82+
}
83+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)