Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Fixed bugs implemented in last version including window selection bug…
Browse files Browse the repository at this point in the history
…s, broken AFK mode and more. Now uses a more robust method of finding the smite window meaning the user no longer has to set this manually.
  • Loading branch information
Lumbridge committed Mar 29, 2018
1 parent 04db0a4 commit 115ce78
Show file tree
Hide file tree
Showing 78 changed files with 149 additions and 331 deletions.
Binary file modified .vs/MixerSmiteCodeRedeemer/v14/.suo
Binary file not shown.
Binary file modified Dolphin Script/bin/Debug/DolphinScript.dll
Binary file not shown.
Binary file modified Dolphin Script/bin/Debug/DolphinScript.pdb
Binary file not shown.
Binary file modified Dolphin Script/bin/Release/DolphinScript.dll
Binary file not shown.
Binary file modified Dolphin Script/bin/Release/DolphinScript.pdb
Binary file not shown.
Binary file modified Dolphin Script/obj/Debug/DolphinScript.dll
Binary file not shown.
Binary file modified Dolphin Script/obj/Debug/DolphinScript.pdb
Binary file not shown.
Binary file modified Dolphin Script/obj/Release/DolphinScript.dll
Binary file not shown.
Binary file modified Dolphin Script/obj/Release/DolphinScript.pdb
Binary file not shown.
Binary file modified MixerChatAPI/bin/Release/MixerChat.dll
Binary file not shown.
Binary file modified MixerChatAPI/bin/Release/MixerChat.pdb
Binary file not shown.
Binary file modified MixerChatAPI/obj/Release/MixerChat.dll
Binary file not shown.
Binary file modified MixerChatAPI/obj/Release/MixerChat.pdb
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Debug/DolphinScript.dll
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Debug/DolphinScript.pdb
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Debug/SmiteMixerListener.dll
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Debug/SmiteMixerListener.pdb
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Release/DolphinScript.dll
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Release/DolphinScript.pdb
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Release/MixerChat.dll
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Release/MixerChat.pdb
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Release/SmiteMixerListener.dll
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/bin/Release/SmiteMixerListener.pdb
Binary file not shown.
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/obj/Debug/SmiteMixerListener.dll
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/obj/Debug/SmiteMixerListener.pdb
Binary file not shown.
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/obj/Release/SmiteMixerListener.dll
Binary file not shown.
Binary file modified SmiteMixerCodeGrabberCLI/obj/Release/SmiteMixerListener.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion SmiteMixerCodeGrabberGUI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<value>False</value>
</setting>
<setting name="smiteWindowTitle" serializeAs="String">
<value>Smite (32-bit, DX9)</value>
<value>Current Smite Client: SMITE Client Not Found (Automation Disabled).</value>
</setting>
<setting name="use64bitSmite" serializeAs="String">
<value>False</value>
Expand Down
16 changes: 0 additions & 16 deletions SmiteMixerCodeGrabberGUI/Classes/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,5 @@ public static void PlayNotificationSound()
catch { Console.WriteLine("Unable to play notification sound (invalid file format/path)."); }

}

public static string GetSmiteWindowTitle()
{
string bit, dx;
if (Properties.Settings.Default.use64bitSmite)
bit = "64";
else
bit = "32";

if (Properties.Settings.Default.useDX11Smite)
dx = "DX11";
else
dx = "DX9";

return "Smite (" + bit + "-bit, " + dx + ")";
}
}
}
9 changes: 3 additions & 6 deletions SmiteMixerCodeGrabberGUI/Classes/DynamicResolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
namespace SmiteMixerCodeGrabberGUI.Classes
{
static class DynamicResolution
{
{
[STAThread]
public static List<ScriptEvent> GetRedeemLoop(string code)
{
try
{
System.Windows.Forms.Clipboard.SetText("/claimpromotion " + code);
}
catch { }
System.Windows.Forms.Clipboard.SetText("/claimpromotion " + code);
List<ScriptEvent> SlowTypingScript = new List<ScriptEvent>()
{
new MouseMoveToAreaOnWindow() { ClickArea = new RECT(), WindowToClickTitle = Properties.Settings.Default.smiteWindowTitle },
Expand Down
2 changes: 1 addition & 1 deletion SmiteMixerCodeGrabberGUI/Classes/MetaInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace SmiteMixerCodeGrabberGUI.Classes
{
public static class MetaInfo
{
public static string Version = "v1.0.5";
public static string Version = "v1.0.6";

public static string GetMetaInfoConsole()
{
Expand Down
64 changes: 64 additions & 0 deletions SmiteMixerCodeGrabberGUI/Classes/ProcessInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmiteMixerCodeGrabberGUI.Classes
{
class ProcessInfo
{
private static Process _SmiteProcess { get; set; }

static ProcessInfo()
{
_SmiteProcess = new Process();
}

public static bool DoesSmiteProcessExist()
{
return ProcessExists("Smite");
}

public static Process GetSmiteProcess()
{
return GetProcess("Smite");
}

public static IntPtr GetSmiteWindowHandle()
{
return GetSmiteProcess().MainWindowHandle;
}

public static string GetSmiteWindowTitle()
{
return GetSmiteProcess().MainWindowTitle;
}

public static List<Process> GetProcessList()
{
var processes = Process.GetProcesses().ToList();
return processes;
}

public static Process GetProcess(string pName)
{
return GetProcessList().Where(x => x.ProcessName == pName).First();
}

public static bool ProcessExists(Process hProcess)
{
if (GetProcessList().Select(x => x.Id).Contains(hProcess.Id))
return true;
return false;
}

public static bool ProcessExists(string pName)
{
if (GetProcessList().Select(x => x.ProcessName).Contains(pName))
return true;
return false;
}
}
}
39 changes: 12 additions & 27 deletions SmiteMixerCodeGrabberGUI/MainForm.Designer.cs

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

98 changes: 61 additions & 37 deletions SmiteMixerCodeGrabberGUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ private void MainForm_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
Console.SetOut(new LogWriter(logbox));

checkbox_64bitSmite.Checked = Properties.Settings.Default.use64bitSmite;
checkbox_DX11.Checked = Properties.Settings.Default.useDX11Smite;

checkbox_AFKMode.Checked = Properties.Settings.Default.AFKMode;


textbox_startCharacters.Text = Properties.Settings.Default.codesStartWith;
numberbox_codeLength.Value = Properties.Settings.Default.codeLength;

Expand All @@ -59,8 +54,20 @@ private void MainForm_Load(object sender, EventArgs e)
chat.OnError += Chat_OnError;
var connected = chat.Connect("SmiteGame");

Task.Run(() => CheckForTerminationKey());
Task.Run(() => MainLoop());
Thread killswitch = new Thread(new ThreadStart(CheckForTerminationKey));
killswitch.SetApartmentState(ApartmentState.STA);
killswitch.IsBackground = true;
killswitch.Start();

Thread AFKModeThread = new Thread(new ThreadStart(AFKModeLoop));
AFKModeThread.SetApartmentState(ApartmentState.STA);
AFKModeThread.IsBackground = true;
AFKModeThread.Start();

Thread CheckSmiteExists = new Thread(new ThreadStart(CheckSmiteIsOpenLoop));
CheckSmiteExists.SetApartmentState(ApartmentState.STA);
CheckSmiteExists.IsBackground = true;
CheckSmiteExists.Start();

Whitelist.SaveWhitelist(textbox_whitelistedUsernames);

Expand Down Expand Up @@ -181,20 +188,9 @@ private void checkbox_whiteListOnly_CheckedChanged(object sender, EventArgs e)
}
private void checkbox_AFKMode_CheckedChanged(object sender, EventArgs e)
{
if (checkbox_AFKMode.Checked)
{
Properties.Settings.Default.AFKMode = true;
Properties.Settings.Default.Save();
IsRunning = true;
Write("AFK Mode Enabled: " + Properties.Settings.Default.AFKMode);
}
else
{
Properties.Settings.Default.AFKMode = false;
Properties.Settings.Default.Save();
IsRunning = false;
Write("AFK Mode Enabled: " + Properties.Settings.Default.AFKMode);
}
Properties.Settings.Default.AFKMode = checkbox_AFKMode.Checked;
IsRunning = checkbox_AFKMode.Checked;
Write("AFK Mode Enabled: " + Properties.Settings.Default.AFKMode);
}
private void button_sendTestEmail_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -270,20 +266,6 @@ private void logbox_TextChanged(object sender, EventArgs e)
logbox.SelectionStart = logbox.Text.Length;
logbox.ScrollToCaret();
}
private void checkbox_64bitSmite_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.use64bitSmite = checkbox_64bitSmite.Checked;
Properties.Settings.Default.smiteWindowTitle = GetSmiteWindowTitle();
Properties.Settings.Default.Save();
Write("Graphics settings toggled; Will now look for Window with title: " + GetSmiteWindowTitle());
}
private void checkbox_DX11_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.useDX11Smite = checkbox_DX11.Checked;
Properties.Settings.Default.smiteWindowTitle = GetSmiteWindowTitle();
Properties.Settings.Default.Save();
Write("Graphics settings toggled; Will now look for Window with title: " + GetSmiteWindowTitle());
}
#endregion

#region Menu Bar Controls
Expand Down Expand Up @@ -379,9 +361,34 @@ private void timer_MainForm_Tick(object sender, EventArgs e)

if (!Properties.Settings.Default.AFKMode)
checkbox_AFKMode.Checked = false;

if (Properties.Settings.Default.smiteWindowTitle != "Current Smite Client: SMITE Client Not Found."
&& Properties.Settings.Default.smiteWindowTitle != label_SmiteClientVersion.Text)
label_SmiteClientVersion.Text = "Current Smite Client: " + Properties.Settings.Default.smiteWindowTitle;

if(Properties.Settings.Default.smiteWindowTitle == "Current Smite Client: SMITE Client Not Found (Automation Disabled).")
{
// disable redeem buttons
button_redeemAllActive.Enabled = false;
button_redeemSelected.Enabled = false;

// disable afk mode checkbox & turn it off
checkbox_AFKMode.Checked = false;
checkbox_AFKMode.Enabled = false;
Properties.Settings.Default.AFKMode = false;
}
else
{
// enable redeem buttons
button_redeemAllActive.Enabled = true;
button_redeemSelected.Enabled = true;

// enable afk mode checkbox
checkbox_AFKMode.Enabled = true;
}
}

public static void MainLoop()
public static void AFKModeLoop()
{
while (true)
{
Expand Down Expand Up @@ -432,5 +439,22 @@ public static void CheckForTerminationKey()
Thread.Sleep(15);
}
}

public static void CheckSmiteIsOpenLoop()
{
while (true)
{
if (!ProcessInfo.DoesSmiteProcessExist())
Properties.Settings.Default.smiteWindowTitle = "Current Smite Client: SMITE Client Not Found (Automation Disabled).";
else
Properties.Settings.Default.smiteWindowTitle = ProcessInfo.GetSmiteWindowTitle();
Thread.Sleep(100);
}
}

private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
}
}
2 changes: 1 addition & 1 deletion SmiteMixerCodeGrabberGUI/Properties/Settings.Designer.cs

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

2 changes: 1 addition & 1 deletion SmiteMixerCodeGrabberGUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="smiteWindowTitle" Type="System.String" Scope="User">
<Value Profile="(Default)">Smite (32-bit, DX9)</Value>
<Value Profile="(Default)">Current Smite Client: SMITE Client Not Found (Automation Disabled).</Value>
</Setting>
<Setting Name="use64bitSmite" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
Expand Down
1 change: 1 addition & 0 deletions SmiteMixerCodeGrabberGUI/SmiteMixerCodeGrabberGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<Compile Include="Classes\DynamicResolution.cs" />
<Compile Include="Classes\MetaInfo.cs" />
<Compile Include="Classes\LogWriter.cs" />
<Compile Include="Classes\ProcessInfo.cs" />
<Compile Include="Classes\SmiteCode.cs" />
<Compile Include="Classes\ThreadHelperClass.cs" />
<Compile Include="Classes\Whitelist.cs" />
Expand Down
Binary file modified SmiteMixerCodeGrabberGUI/bin/Debug/DolphinScript.dll
Binary file not shown.
6 changes: 0 additions & 6 deletions SmiteMixerCodeGrabberGUI/bin/Debug/DolphinScript.dll.config

This file was deleted.

Binary file modified SmiteMixerCodeGrabberGUI/bin/Debug/DolphinScript.pdb
Binary file not shown.
11 changes: 0 additions & 11 deletions SmiteMixerCodeGrabberGUI/bin/Debug/MixerChat.dll.config

This file was deleted.

Binary file modified SmiteMixerCodeGrabberGUI/bin/Debug/Smite Mixer Code Grabber.exe
Binary file not shown.
Loading

0 comments on commit 115ce78

Please sign in to comment.