Skip to content

Commit

Permalink
Added country and subregion back
Browse files Browse the repository at this point in the history
  • Loading branch information
imaboy321 committed Feb 8, 2017
1 parent 01cd7f4 commit ca0c7ba
Show file tree
Hide file tree
Showing 134 changed files with 4,133 additions and 65 deletions.
Binary file modified .vs/Ledybot/v14/.suo
Binary file not shown.
67 changes: 41 additions & 26 deletions Ledybot/Form1.Designer.cs

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

44 changes: 40 additions & 4 deletions Ledybot/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public partial class MainForm : Form
static Dictionary<uint, DataReadyWaiting> waitingForData = new Dictionary<uint, DataReadyWaiting>();
public ArrayList commented = new ArrayList();
public Dictionary<int, Tuple<string, string, int, int, int, ArrayList>> giveawayDetails = new Dictionary<int, Tuple<string, string, int, int, int, ArrayList>>();
public Dictionary<int, string> countries = new Dictionary<int, string>();
public Dictionary<int, string> regions = new Dictionary<int, string>();

public MainForm()
{
Expand All @@ -48,7 +50,7 @@ public MainForm()
ofd_Injection.Filter = "Gen 7 pokémon files|*.pk7";
string path = @Application.StartupPath;
ofd_Injection.InitialDirectory = path;

getCountries();
btn_Disconnect.Enabled = false;
}

Expand Down Expand Up @@ -92,6 +94,30 @@ public void getGame(object sender, EventArgs e)
}
}

public void getCountries()
{
string[] inputCSV = getStringList("countries");
// Gather our data from the input file
for (int i = 1; i < inputCSV.Length; i++)
{
string[] countryData = inputCSV[i].Split(',');
countries.Add(int.Parse(countryData[0]), countryData[2]);
}
}

public void getSubRegions(int country)
{
regions.Clear();

string[] inputCSV = getStringList("sr_" + country.ToString("000"));

for(int i = 1; i < inputCSV.Length; i++)
{
string[] regionData = inputCSV[i].Split(',');
regions.Add(int.Parse(regionData[0]), regionData[2]);
}
}

public void setupButtons()
{
btn_Connect.Enabled = false;
Expand Down Expand Up @@ -176,14 +202,14 @@ private async void btn_Start_Click(object sender, EventArgs e)
botNumber = -1;
}

public void AppendListViewItem(string szTrainerName, string szNickname, string szSent, string fc)
public void AppendListViewItem(string szTrainerName, string szNickname, string szCountry, string szSubRegion, string szSent, string fc)
{
if (InvokeRequired)
{
this.Invoke(new Action<string, string, string, string>(AppendListViewItem), new object[] { szTrainerName, szNickname, szSent, fc });
this.Invoke(new Action<string, string, string, string, string, string>(AppendListViewItem), new object[] { szTrainerName, szNickname, szCountry, szSubRegion, szSent, fc });
return;
}
string[] row = { DateTime.Now.ToString("h:mm:ss"), szTrainerName, szNickname, szSent, fc.Insert(4, "-").Insert(9, "-") };
string[] row = { DateTime.Now.ToString("h:mm:ss"), szTrainerName, szNickname, szCountry, szSubRegion, szSent, fc.Insert(4, "-").Insert(9, "-") };
var listViewItem = new ListViewItem(row);

lv_log.Items.Add(listViewItem);
Expand Down Expand Up @@ -537,6 +563,16 @@ private void btn_Clear_Click(object sender, EventArgs e)
{
lv_log.Items.Clear();
}

public static string[] getStringList(string f)
{
object txt = Properties.Resources.ResourceManager.GetObject(f); // Fetch File, \n to list.
if (txt == null) return new string[0];
string[] rawlist = ((string)txt).Split('\n');
for (int i = 0; i < rawlist.Length; i++)
rawlist[i] = rawlist[i].Trim();
return rawlist;
}
}

public class DataReadyWaiting
Expand Down
9 changes: 8 additions & 1 deletion Ledybot/GTSBot7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,18 @@ public async Task<int> RunBot()

//optional: grab some trainer data
string szTrainerName = Encoding.Unicode.GetString(block, 0x4C, 20).Trim('\0');
int countryIndex = BitConverter.ToInt16(block, 0x68);
string country = "-";
Program.f1.countries.TryGetValue(countryIndex, out country);
Program.f1.getSubRegions(countryIndex);
int subRegionIndex = BitConverter.ToInt16(block, 0x6A);
string subregion = "-";
Program.f1.regions.TryGetValue(subRegionIndex, out subregion);
if (bBlacklist)
{
details.Item6.Add(BitConverter.ToInt32(principal, 0));
}
Program.f1.AppendListViewItem(szTrainerName, szNickname, dexnumber.ToString(), szFC);
Program.f1.AppendListViewItem(szTrainerName, szNickname, country, subregion, Program.PKTable.Species7[dexnumber - 1], szFC);
//Inject the Pokemon to box1slot1
Program.scriptHelper.write(0x330d9838, cloneshort, iPID);
Program.helper.quickbuton(Program.PKTable.keyA, commandtime);
Expand Down
Loading

0 comments on commit ca0c7ba

Please sign in to comment.