Skip to content

Commit

Permalink
Merge dev-2023 to master branch
Browse files Browse the repository at this point in the history
Fixed an issue with the reset all coordinates. Fixed an issue with the coordinates file being wiped when starting the program. Removed an obsolete Abort function for stop fishing & doodle training & implemented a different method.
  • Loading branch information
primetime43 committed Mar 8, 2023
2 parents edc3a04 + 0c19877 commit 0e6f507
Show file tree
Hide file tree
Showing 16 changed files with 331 additions and 264 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/ToonTown Rewritten Bot/obj/project.nuget.cache
/ToonTown Rewritten Bot/obj/ToonTown Rewritten Bot.csproj.nuget.dgspec.json
/ToonTown Rewritten Bot/obj/ToonTown Rewritten Bot.csproj.nuget.g.props
/ToonTown Rewritten Bot/Properties/PublishProfiles
234 changes: 118 additions & 116 deletions ToonTown Rewritten Bot/AboutBox1.Designer.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ToonTown Rewritten Bot/AboutBox1.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
Expand All @@ -16,7 +16,7 @@ public AboutBox1()
InitializeComponent();
this.Text = String.Format("About {0} by primetime43", AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = "Version 1.4";
this.labelVersion.Text = "Version 1.4.1";
this.labelCopyright.Text = "Programmed by primetime43";
this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = "This program is a bot that will perform certain time consuming tasks on ToonTown Rewritten.";
Expand Down
60 changes: 0 additions & 60 deletions ToonTown Rewritten Bot/AboutBox1.resx
Original file line number Diff line number Diff line change
@@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
Expand Down
2 changes: 1 addition & 1 deletion ToonTown Rewritten Bot/AdvancedSettings.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Expand Down
11 changes: 7 additions & 4 deletions ToonTown Rewritten Bot/BotFunctions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
Expand Down Expand Up @@ -92,15 +92,15 @@ public static void maximizeAndFocus()
private static string[] lines;
public static void readTextFile()
{
if (!File.Exists("Coordinates Data File.txt"))
if (File.Exists("Coordinates Data File.txt"))
{
try
{
lines = File.ReadAllLines(Path.GetFullPath("Coordinates Data File.txt"));
}
catch (Exception e)
{
Console.WriteLine("The file could not be read:");
MessageBox.Show("The file could not be read:");
Console.WriteLine(e.Message);
}
}
Expand Down Expand Up @@ -262,7 +262,7 @@ public static void resetAllCoordinates()
string[] lines = File.ReadAllLines(filePath);
for (int i = 0; i < Form1.dataFileMap.Count; i++)
{
lines[i] = $"{i + 1}.(0,0)";
lines[i] = $"{i}.(0,0)";
}
writeDefaultCords(lines);
}
Expand All @@ -271,6 +271,9 @@ public static void resetAllCoordinates()
public static void createFreshCoordinatesFile()
{
string filePath = "Coordinates Data File.txt";
// Delete the file if it exists
if (File.Exists(filePath))
File.Delete(filePath);
// Create the file and write the default coordinates
using (StreamWriter sw = File.CreateText(filePath))
{
Expand Down
120 changes: 120 additions & 0 deletions ToonTown Rewritten Bot/BotFunctions.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
16 changes: 8 additions & 8 deletions ToonTown Rewritten Bot/DevForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions ToonTown Rewritten Bot/DevForm.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Emgu.CV;
using Emgu.CV.Structure;
//using Emgu.CV;
//using Emgu.CV.Structure;
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Tesseract;
//using Tesseract;
using System.Diagnostics;
using System.IO;

Expand Down Expand Up @@ -105,12 +105,12 @@ public void CaptureWindow(IntPtr handle)
//previousImage?.Dispose();

//testing
testImageCapture(result);
//testImageCapture(result);
}
}

//prob just use to show box where the coords are for debugging purposes in release version
Image<Bgr, byte> template = new Image<Bgr, byte>(Properties.Resources.stickerBook.ToImage<Bgr, byte>().Data); // Image A
/*Image<Bgr, byte> template = new Image<Bgr, byte>(Properties.Resources.stickerBook.ToImage<Bgr, byte>().Data); // Image A
private void testImageCapture(Bitmap inputImage)
{
//find image a in b
Expand All @@ -137,7 +137,7 @@ private void testImageCapture(Bitmap inputImage)
}
imageBox1.Image = imageToShow;
}
}*/

[StructLayout(LayoutKind.Sequential)]
public struct POINT
Expand Down Expand Up @@ -184,7 +184,7 @@ public struct Rect

public const string TESS_PATH = "tessdata/";
public const string TESS_LANGUAGE = "eng";
private static TesseractEngine engine;
//private static TesseractEngine engine;

/*public static void readText(Image inputImage)
{
Expand Down
5 changes: 3 additions & 2 deletions ToonTown Rewritten Bot/DoodleTraining.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class DoodleTraining
public static int numberOfFeeds, numberOfScratches;
private static string selectedTrick;
private static bool infiniteTimeCheckBox, justFeedCheckBox, justScratchCheckBox;
public static bool shouldStopTraining = false;
public static void startTrainingDoodle(int feeds, int scratches, bool unlimitedCheckBox, string trick, bool justFeed, bool justScratch)
{
numberOfFeeds = feeds;
Expand All @@ -30,7 +31,7 @@ public static void feedAndScratch()
numberOfScratches = 0;
else if (justScratchCheckBox)
numberOfFeeds = 0;
while (numberOfFeeds > 0 || numberOfScratches > 0)
while (numberOfFeeds > 0 || numberOfScratches > 0 && !shouldStopTraining)
{
Thread.Sleep(5000);
if (numberOfFeeds > 0)//feed doodle
Expand All @@ -48,7 +49,7 @@ public static void feedAndScratch()
}
else //infinite checkbox is checked, so loop until stopped
{
while (true)
while (true && !shouldStopTraining)
{
if (justFeedCheckBox)//just feed is checked
feedDoodle();
Expand Down
Loading

0 comments on commit 0e6f507

Please sign in to comment.