Skip to content

Commit

Permalink
Dev 2023 to master branch - v1.4 (#13)
Browse files Browse the repository at this point in the history
* Fixed the layout of the project directory
Fixed string looking for ttr window when it was beta
Added color recognition for red fishing button

* Fixed issue where InputSimulator.dll was missing from source code

* Updated the sln to target VS 2022 instead of VS 17

* Upgraded the project to target .NET 7

* Added the ability to create the coordinates file if it doesn't exist when trying to reset the coordinates

* Update .gitignore
Updating .gitignore to ignore the obj folder.

* Added more files to the .gitignore file

* Added an auto detect red fishing button toggle

* Removed and cleaned up some code

* Added a note on the golf tab to inform how to use

---------
  • Loading branch information
primetime43 authored Mar 3, 2023
1 parent 42dc7b7 commit d668130
Show file tree
Hide file tree
Showing 187 changed files with 217,180 additions and 2,322 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
*/**/bin/Debug
*/**/bin/Release
*/**/obj/Debug
*/**/obj/Release
*/**/obj/Release
.vs/
*/**/obj/
/ToonTown Rewritten Bot/obj/project.assets.json
/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
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.0.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToonTown Rewritten Bot", "ToonTown Rewritten Bot\ToonTown Rewritten Bot.csproj", "{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Debug|x64.ActiveCfg = Debug|Any CPU
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Debug|x64.Build.0 = Debug|Any CPU
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Release|Any CPU.Build.0 = Release|Any CPU
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Release|x64.ActiveCfg = Release|Any CPU
{914AF6DE-BAB5-4DCA-A974-558FC1DD973B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B613185C-4FAC-4331-9B4C-7C154FE8070D}
EndGlobalSection
EndGlobal

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

Original file line number Diff line number Diff line change
Expand Up @@ -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.3";
this.labelVersion.Text = "Version 1.4";
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
File renamed without changes.
144 changes: 144 additions & 0 deletions ToonTown Rewritten Bot/AdvancedSettings.Designer.cs

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

94 changes: 94 additions & 0 deletions ToonTown Rewritten Bot/AdvancedSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ToonTown_Rewritten_Bot
{
public partial class AdvancedSettings : Form
{
public AdvancedSettings()
{
InitializeComponent();
}

static float defaultConfidence = 0.5f;
private static bool debugView = false;
public string x, y, message = "";
public void callImageRecScript(string settingNameForImage)//dont multi-thread so that the py script doesn't keep running if the debug view window isnt closed
{
string imageName = Path.GetFileName(Properties.Settings.Default[settingNameForImage].ToString());
Process p = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.UseShellExecute = false;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/r echo %cd%";
if (checkBox1.Checked)//advanced settings enabled
startInfo.Arguments = "/r cd Search_Images&python ./imageRecognitionTesting.py " + imageFilesComboBox.SelectedItem.ToString() + " " + (trackBar1.Value / 10.0f) + " " + debugView;
else
startInfo.Arguments = "/r cd Search_Images&python ./imageRecognitionTesting.py " + imageName + " " + defaultConfidence + " " + debugView;
p.StartInfo = startInfo;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.Start();
while (!p.StandardOutput.EndOfStream)
{
string line = p.StandardOutput.ReadLine();
Debug.WriteLine(line);
if (line[0] == 'x')
x = line.Substring(line.IndexOf(' ') + 1);
else if (line[0] == 'y')
y = line.Substring(line.IndexOf(' ') + 1);
else//unable to find the image
message = line;
}
p.WaitForExit();
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)//use advanced settings checkbox
{
if (checkBox1.Checked)
{
groupBox1.Enabled = true;
label1.Visible = true;
}
else
{
groupBox1.Enabled = false;
label1.Visible = false;
debugViewChkBox.Checked = false;
}
}

private void debugViewChkBox_CheckedChanged(object sender, EventArgs e)//enable debug view checkbox
{
if (debugViewChkBox.Checked)
debugView = true;
else
debugView = false;
}

string scriptPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @".\Search_Images"));
private void loadImages()//read the images from the directory. These are the images it is searching for on the screen
{
int numOfFiles = Directory.GetFiles(scriptPath, "*.png", SearchOption.AllDirectories).Length;
string[] fileEntries = Directory.GetFiles(scriptPath);

for (int i = 0; i < numOfFiles; i++)
{
if (!fileEntries[i].Substring(fileEntries[i].LastIndexOf(@"\", fileEntries[i].Length) + 1).Contains(" "))//dont add files that contain a space
imageFilesComboBox.Items.Add(fileEntries[i].Substring(fileEntries[i].LastIndexOf(@"\", fileEntries[i].Length) + 1));
}
}
}
}
Loading

0 comments on commit d668130

Please sign in to comment.