Skip to content

Commit

Permalink
Fixed a couple of issues with WT bot.
Browse files Browse the repository at this point in the history
  • Loading branch information
drgoku282 committed Oct 26, 2016
1 parent fbcee3f commit 22926b1
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 72 deletions.
48 changes: 24 additions & 24 deletions PKMN-NTR/MainForm.Designer.cs

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

95 changes: 49 additions & 46 deletions PKMN-NTR/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public enum GameType { None, X, Y, OR, AS };
public static readonly string buttonerror = "An error has ocurred while sending a button command, please check connection and try again.\r\n\r\nIf the buttons of your 3DS system doesn't work, send any comand from the Remote Control tab to fix them";
public static readonly string writeerror = "An error has ocurred while writting data to your 3DS RAM, please check connection and try again.";

//Game information
public int pid;
//Game information
public int pid;
public byte lang;
public string pname;
public GameType game = GameType.None;
Expand Down Expand Up @@ -493,8 +493,6 @@ public void connectCheck(object sender, EventArgs e)
Settings.Default.Save();
}

#region dump

//This functions handles additional information events from NTR netcode.
//We are only interested in them if they are a process list, containing
//our game's PID and game type.
Expand Down Expand Up @@ -721,6 +719,8 @@ public void getGame(object sender, EventArgs e)
}
}

#region dump

public void dumpAllData()
{
dumpMoney();
Expand Down Expand Up @@ -1266,27 +1266,30 @@ public void handlePkmData(object args_obj)
validator.Data = PKHeX.decryptArray(args.data);

bool dataCorrect = validator.Species != 0;
if (!onlyView.Checked)

if (!botWorking)
{
DialogResult res = DialogResult.Cancel;
if (!dataCorrect)
if (!onlyView.Checked)
{
res = MessageBox.Show("This Pokemon's data seems to be empty.\r\nPress OK if you want to save it, Cancel if you don't.",
"Empty data", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
DialogResult res = DialogResult.Cancel;
if (!dataCorrect)
{
res = MessageBox.Show("This Pokemon's data seems to be empty.\r\nPress OK if you want to save it, Cancel if you don't.",
"Empty data", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
}
if (dataCorrect || res == DialogResult.OK)
{
string folderPath = @Application.StartupPath + "\\" + FOLDERPOKE + "\\";
(new System.IO.FileInfo(folderPath)).Directory.Create();
string fileName = nameek6.Text + ".pk6";
writePokemonToFile(validator.Data, folderPath + fileName);
}
}
if (dataCorrect || res == DialogResult.OK)
else if (!dataCorrect)
{
string folderPath = @Application.StartupPath + "\\" + FOLDERPOKE + "\\";
(new System.IO.FileInfo(folderPath)).Directory.Create();
string fileName = nameek6.Text + ".pk6";
writePokemonToFile(validator.Data, folderPath + fileName);
MessageBox.Show("This Pokemon's data seems to be empty.", "Empty data", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
//Added a bit of code to work with the bots
else if (!dataCorrect)
{
MessageBox.Show("This Pokemon's data seems to be empty.", "Empty data", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

if (!dataCorrect)
return;
Expand Down Expand Up @@ -2687,6 +2690,31 @@ private void stopBotButton_Click(object sender, EventArgs e)
stopBotButton.Enabled = false;
}

private void GenderLSR_Click(object sender, EventArgs e)
{
if (desiredgender == 0)
{
GenderLSR.Font = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size, FontStyle.Bold);
GenderLSR.ForeColor = Color.Red;
GenderLSR.Text = "♀";
desiredgender = 1;
}
else if (desiredgender == 1)
{
GenderLSR.Font = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size, FontStyle.Bold);
GenderLSR.ForeColor = Color.Black;
GenderLSR.Text = "-";
desiredgender = 2;
}
else
{
GenderLSR.Font = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size, FontStyle.Bold);
GenderLSR.ForeColor = Color.Blue;
GenderLSR.Text = "♂";
desiredgender = 0;
}
}

// Wonder Trade bot
private async void RunWTbot_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -3135,10 +3163,10 @@ private async void RunWTbot_Click(object sender, EventArgs e)
{
currentslot = 0;
currentbox++;
boxchange = true;
if (currentbox >= 31)
{
currentbox = 0;
boxchange = true;
}
}
WTtradesNo.Value--;
Expand Down Expand Up @@ -3166,7 +3194,7 @@ private async void RunWTbot_Click(object sender, EventArgs e)
for (waittimeout = 0; waittimeout < 45; waittimeout++)
{ // Wait two seconds
await Task.Delay(1000);
waitNTRtask = waitNTRread(wtboxesOff);
waitNTRtask = waitNTRread(psssmenu1IN);
waitresult = await waitNTRtask;
if (lastmemoryread >= psssmenu1IN && lastmemoryread < psssmenu1IN + 0x10000)
{
Expand Down Expand Up @@ -4011,31 +4039,6 @@ private async void RunLSRbot_Click(object sender, EventArgs e)
}

#endregion Bots

private void GenderLSR_Click(object sender, EventArgs e)
{
if (desiredgender == 0)
{
GenderLSR.Font = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size, FontStyle.Bold);
GenderLSR.ForeColor = Color.Red;
GenderLSR.Text = "♀";
desiredgender = 1;
}
else if (desiredgender == 1)
{
GenderLSR.Font = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size, FontStyle.Bold);
GenderLSR.ForeColor = Color.Black;
GenderLSR.Text = "-";
desiredgender = 2;
}
else
{
GenderLSR.Font = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size, FontStyle.Bold);
GenderLSR.ForeColor = Color.Blue;
GenderLSR.Text = "♂";
desiredgender = 0;
}
}
}

//Objects of this class contains an array for data that have been acquired, a delegate function
Expand Down
4 changes: 2 additions & 2 deletions PKMN-NTR/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@

[assembly: Guid("cd7cfe42-3900-4148-aa42-6a04af45b783")]

[assembly: AssemblyVersion("1.18.4.0")]
[assembly: AssemblyFileVersion("1.18.4.0")]
[assembly: AssemblyVersion("1.18.5.0")]
[assembly: AssemblyFileVersion("1.18.5.0")]

0 comments on commit 22926b1

Please sign in to comment.