diff --git a/src/RocketBotGUI/App.config b/src/RocketBotGUI/App.config
index 0c71708..448876f 100644
--- a/src/RocketBotGUI/App.config
+++ b/src/RocketBotGUI/App.config
@@ -92,6 +92,8 @@
<add key="ExcludedPokemonTransfer" value="" />
<!--Pokemon filter, seperated by comma-->
<add key="ExcludedPokemonEvolve" value="" />
+ <!--Item count, format ItemId,MaxCount;ItemId,MaxCount;...etc-->
+ <add key="ItemCounts" value="ItemPokeball,100;ItemGreatBall,100;ItemUltraBall,50;ItemRazzBerry,25;ItemPotion,0;ItemSuperPotion,0;ItemHyperPotion,10;ItemMaxPotion,20;ItemRevive,10;ItemMaxRevive,10" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
diff --git a/src/RocketBotGUI/ItemSetting.Designer.cs b/src/RocketBotGUI/ItemSetting.Designer.cs
new file mode 100644
index 0000000..b093c0e
--- /dev/null
+++ b/src/RocketBotGUI/ItemSetting.Designer.cs
@@ -0,0 +1,77 @@
+namespace PokemonGo.RocketAPI.Window {
+ partial class ItemSetting {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.count = new System.Windows.Forms.NumericUpDown();
+ this.ItemId = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.count)).BeginInit();
+ this.SuspendLayout();
+ //
+ // count
+ //
+ this.count.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.count.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.count.Location = new System.Drawing.Point(132, 0);
+ this.count.Maximum = new decimal(new int[] {
+ 999,
+ 0,
+ 0,
+ 0});
+ this.count.Name = "count";
+ this.count.Size = new System.Drawing.Size(75, 22);
+ this.count.TabIndex = 0;
+ this.count.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // ItemId
+ //
+ this.ItemId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.ItemId.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.ItemId.Location = new System.Drawing.Point(-1, -1);
+ this.ItemId.Name = "ItemId";
+ this.ItemId.Size = new System.Drawing.Size(127, 20);
+ this.ItemId.TabIndex = 1;
+ this.ItemId.Text = "Pokeball";
+ this.ItemId.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // ItemSetting
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.ItemId);
+ this.Controls.Add(this.count);
+ this.Margin = new System.Windows.Forms.Padding(0);
+ this.Name = "ItemSetting";
+ this.Size = new System.Drawing.Size(210, 21);
+ ((System.ComponentModel.ISupportInitialize)(this.count)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.NumericUpDown count;
+ private System.Windows.Forms.Label ItemId;
+ }
+}
diff --git a/src/RocketBotGUI/ItemSetting.cs b/src/RocketBotGUI/ItemSetting.cs
new file mode 100644
index 0000000..d47f6fc
--- /dev/null
+++ b/src/RocketBotGUI/ItemSetting.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using POGOProtos.Inventory.Item;
+
+namespace PokemonGo.RocketAPI.Window {
+ public partial class ItemSetting : UserControl {
+
+ private ItemData itemData_;
+
+ public ItemSetting(ItemData itemData) {
+ InitializeComponent();
+ ItemData = itemData;
+
+ count.ValueChanged += Count_ValueChanged;
+ }
+
+ private void Count_ValueChanged(object sender, EventArgs e) {
+ ItemData.Count = Decimal.ToInt32(count.Value);
+ }
+
+ public ItemData ItemData
+ {
+ get
+ {
+ return itemData_;
+ }
+ set
+ {
+ itemData_ = value;
+ ItemId.Text = itemData_.ItemId.ToString().Remove(0, 4);
+ count.Value = itemData_.Count;
+ }
+ }
+ }
+}
diff --git a/src/RocketBotGUI/ItemSetting.resx b/src/RocketBotGUI/ItemSetting.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/src/RocketBotGUI/ItemSetting.resx
@@ -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>
\ No newline at end of file
diff --git a/src/RocketBotGUI/MainForm.cs b/src/RocketBotGUI/MainForm.cs
index 300d78e..3d8a1e1 100644
--- a/src/RocketBotGUI/MainForm.cs
+++ b/src/RocketBotGUI/MainForm.cs
@@ -5,6 +5,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
+using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@@ -35,6 +36,9 @@ namespace PokemonGo.RocketAPI.Window
public static MainForm Instance;
public static SynchronizationContext SynchronizationContext;
+ //delay between actions, to similate human operation
+ private const int ACTIONDELAY = 1500;
+
public static Settings ClientSettings;
private static int _currentlevel = -1;
private static int _totalExperience;
@@ -131,7 +135,7 @@ namespace PokemonGo.RocketAPI.Window
public static double GetRuntime()
{
- return (DateTime.Now - TimeStarted).TotalSeconds/3600;
+ return (DateTime.Now - TimeStarted).TotalSeconds / 3600;
}
public void CheckVersion()
@@ -314,10 +318,10 @@ namespace PokemonGo.RocketAPI.Window
//Calculating the exp needed to level up
float expNextLvl = v.NextLevelXp - v.Experience;
//Calculating the exp made per second
- xpSec = Math.Round(_totalExperience/GetRuntime())/60/60;
+ xpSec = Math.Round(_totalExperience / GetRuntime()) / 60 / 60;
//Calculating the seconds left to level up
if (xpSec != 0)
- secondsLeft = Convert.ToInt32(expNextLvl/xpSec);
+ secondsLeft = Convert.ToInt32(expNextLvl / xpSec);
//formatting data to make an output like DateFormat
while (secondsLeft > 60)
{
@@ -340,8 +344,8 @@ namespace PokemonGo.RocketAPI.Window
_getSessionRuntimeInTimeFormat(), v.Experience - v.PrevLevelXp - XpDiff,
v.NextLevelXp - v.PrevLevelXp - XpDiff,
profile.PlayerData.Currencies.ToArray()[1].Amount) +
- " | XP/Hour: " + Math.Round(_totalExperience/GetRuntime()) + " | Pokemon/Hour: " +
- Math.Round(_totalPokemon/GetRuntime()) + " | NextLevel in: " + hoursLeft + ":" +
+ " | XP/Hour: " + Math.Round(_totalExperience / GetRuntime()) + " | Pokemon/Hour: " +
+ Math.Round(_totalPokemon / GetRuntime()) + " | NextLevel in: " + hoursLeft + ":" +
minutesLeft +
":" + secondsLeft);
}
@@ -587,7 +591,7 @@ namespace PokemonGo.RocketAPI.Window
var request =
(HttpWebRequest)
WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" + name_english);
- var response = (HttpWebResponse) request.GetResponse();
+ var response = (HttpWebResponse)request.GetResponse();
pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
else
@@ -685,7 +689,7 @@ namespace PokemonGo.RocketAPI.Window
{
SynchronizationContext.Post(o =>
{
- _playerMarker.Position = (PointLatLng) o;
+ _playerMarker.Position = (PointLatLng)o;
_searchAreaOverlay.Polygons.Clear();
}, new PointLatLng(latitude, longitude));
@@ -785,10 +789,14 @@ namespace PokemonGo.RocketAPI.Window
PokeStopOutput.Write($", Gems: {fortSearch.GemsAwarded}");
if (fortSearch.PokemonDataEgg != null)
PokeStopOutput.Write($", Eggs: {fortSearch.PokemonDataEgg}");
- if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty)
+ if (GetFriendlyItemsString(fortSearch.ItemsAwarded) != string.Empty) {
PokeStopOutput.Write($", Items: {GetFriendlyItemsString(fortSearch.ItemsAwarded)} ");
+ }
+
ColoredConsoleWrite(Color.Cyan, PokeStopOutput.ToString());
+ await RecycleItems(client);
+
if (fortSearch.ExperienceAwarded != 0)
_totalExperience += fortSearch.ExperienceAwarded;
@@ -798,11 +806,11 @@ namespace PokemonGo.RocketAPI.Window
await ExecuteCatchAllNearbyPokemons(client);
}
_farmingStops = false;
- if (!_forceUnbanning && !_stopping)
+ /*if (!_forceUnbanning && !_stopping)
{
- await RecycleItems(client);
+
//await ExecuteFarmingPokestopsAndPokemons(client);
- }
+ }*/
}
private async Task ForceUnban(Client client)
@@ -882,7 +890,7 @@ namespace PokemonGo.RocketAPI.Window
return string.Empty;
return enumerable.GroupBy(i => i.ItemId)
- .Select(kvp => new {ItemName = kvp.Key.ToString().Substring(4), Amount = kvp.Sum(x => x.ItemCount)})
+ .Select(kvp => new { ItemName = kvp.Key.ToString().Substring(4), Amount = kvp.Sum(x => x.ItemCount) })
.Select(y => $"{y.Amount}x {y.ItemName}")
.Aggregate((a, b) => $"{a}, {b}");
}
@@ -893,7 +901,7 @@ namespace PokemonGo.RocketAPI.Window
var unwantedPokemonTypes = new List<PokemonId>();
for (var i = 1; i <= 151; i++)
{
- unwantedPokemonTypes.Add((PokemonId) i);
+ unwantedPokemonTypes.Add((PokemonId)i);
}
var inventory = await client.Inventory.GetInventory();
@@ -920,7 +928,7 @@ namespace PokemonGo.RocketAPI.Window
{
if (poke == null)
return 0f;
- return (poke.IndividualAttack + poke.IndividualDefense + poke.IndividualStamina)/45f*100f;
+ return (poke.IndividualAttack + poke.IndividualDefense + poke.IndividualStamina) / 45f * 100f;
}
private async Task TransferAllGivenPokemons(Client client, IEnumerable<PokemonData> unwantedPokemons,
@@ -960,7 +968,7 @@ namespace PokemonGo.RocketAPI.Window
(HttpWebRequest)
WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" +
name_english);
- var response = (HttpWebResponse) request.GetResponse();
+ var response = (HttpWebResponse)request.GetResponse();
pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
else
@@ -992,7 +1000,7 @@ namespace PokemonGo.RocketAPI.Window
inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.PokemonData)
.Where(p => p != null && p?.PokemonId > 0);
- var dupes = allpokemons.OrderBy(x => x.Cp).Select((x, i) => new {index = i, value = x})
+ var dupes = allpokemons.OrderBy(x => x.Cp).Select((x, i) => new { index = i, value = x })
.GroupBy(x => x.value.PokemonId)
.Where(x => x.Skip(1).Any());
@@ -1018,7 +1026,7 @@ namespace PokemonGo.RocketAPI.Window
(HttpWebRequest)
WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" +
name_english);
- var response = (HttpWebResponse) request.GetResponse();
+ var response = (HttpWebResponse)request.GetResponse();
pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
else
@@ -1039,7 +1047,7 @@ namespace PokemonGo.RocketAPI.Window
inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.PokemonData)
.Where(p => p != null && p?.PokemonId > 0);
- var dupes = allpokemons.OrderBy(x => Perfect(x)).Select((x, i) => new {index = i, value = x})
+ var dupes = allpokemons.OrderBy(x => Perfect(x)).Select((x, i) => new { index = i, value = x })
.GroupBy(x => x.value.PokemonId)
.Where(x => x.Skip(1).Any());
@@ -1065,7 +1073,7 @@ namespace PokemonGo.RocketAPI.Window
(HttpWebRequest)
WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" +
name_english);
- var response = (HttpWebResponse) request.GetResponse();
+ var response = (HttpWebResponse)request.GetResponse();
pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
else
@@ -1085,7 +1093,7 @@ namespace PokemonGo.RocketAPI.Window
inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.PokemonData)
.Where(p => p != null && p?.PokemonId > 0);
- var dupes = allpokemons.OrderBy(x => Perfect(x)).Select((x, i) => new {index = i, value = x})
+ var dupes = allpokemons.OrderBy(x => Perfect(x)).Select((x, i) => new { index = i, value = x })
.GroupBy(x => x.value.PokemonId)
.Where(x => x.Skip(1).Any());
@@ -1117,7 +1125,7 @@ namespace PokemonGo.RocketAPI.Window
(HttpWebRequest)
WebRequest.Create("http://boosting-service.de/pokemon/index.php?pokeName=" +
name_english);
- var response = (HttpWebResponse) request.GetResponse();
+ var response = (HttpWebResponse)request.GetResponse();
pokemonName = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
else
@@ -1172,7 +1180,7 @@ namespace PokemonGo.RocketAPI.Window
await Task.Delay(1000);
else
- await Task.Delay(ClientSettings.LevelTimeInterval*1000);
+ await Task.Delay(ClientSettings.LevelTimeInterval * 1000);
// PrintLevel(client);
}
@@ -1199,10 +1207,10 @@ namespace PokemonGo.RocketAPI.Window
//Calculating the exp needed to level up
float expNextLvl = v.NextLevelXp - v.Experience;
//Calculating the exp made per second
- xpSec = Math.Round(_totalExperience/GetRuntime())/60/60;
+ xpSec = Math.Round(_totalExperience / GetRuntime()) / 60 / 60;
//Calculating the seconds left to level up
if (xpSec != 0)
- secondsLeft = Convert.ToInt32(expNextLvl/xpSec);
+ secondsLeft = Convert.ToInt32(expNextLvl / xpSec);
//formatting data to make an output like DateFormat
while (secondsLeft > 60)
{
@@ -1223,8 +1231,8 @@ namespace PokemonGo.RocketAPI.Window
" | Level: {0:0} - ({2:0} / {3:0}) | Runtime {1} | Stardust: {4:0}", v.Level,
_getSessionRuntimeInTimeFormat(), v.Experience - v.PrevLevelXp - XpDiff,
v.NextLevelXp - v.PrevLevelXp - XpDiff, profile.PlayerData.Currencies.ToArray()[1].Amount) +
- " | XP/Hour: " + Math.Round(_totalExperience/GetRuntime()) + " | Pokemon/Hour: " +
- Math.Round(_totalPokemon/GetRuntime()) + " | NextLevel in: " + hoursLeft + ":" + minutesLeft +
+ " | XP/Hour: " + Math.Round(_totalExperience / GetRuntime()) + " | Pokemon/Hour: " +
+ Math.Round(_totalPokemon / GetRuntime()) + " | NextLevel in: " + hoursLeft + ":" + minutesLeft +
":" + secondsLeft);
}
await Task.Delay(1000);
@@ -1434,24 +1442,23 @@ namespace PokemonGo.RocketAPI.Window
{
olvPokemonList.ButtonClick += PokemonListButton_Click;
- pkmnName.ImageGetter = delegate(object rowObject)
+ pkmnName.ImageGetter = delegate (object rowObject)
{
var pokemon = rowObject as PokemonObject;
var key = pokemon.PokemonId.ToString();
if (!olvPokemonList.SmallImageList.Images.ContainsKey(key))
{
- var img = GetPokemonImage((int) pokemon.PokemonId);
+ var img = GetPokemonImage((int)pokemon.PokemonId);
olvPokemonList.SmallImageList.Images.Add(key, img);
}
return key;
};
- olvPokemonList.FormatRow += delegate(object sender, FormatRowEventArgs e)
+ olvPokemonList.FormatRow += delegate (object sender, FormatRowEventArgs e)
{
var pok = e.Model as PokemonObject;
- if (
- olvPokemonList.Objects.Cast<PokemonObject>()
+ if (olvPokemonList.Objects.Cast<PokemonObject>()
.Select(i => i.PokemonId)
.Where(p => p == pok.PokemonId)
.Count() > 1)
@@ -1466,7 +1473,7 @@ namespace PokemonGo.RocketAPI.Window
}
};
- cmsPokemonList.Opening += delegate(object sender, CancelEventArgs e)
+ cmsPokemonList.Opening += delegate (object sender, CancelEventArgs e)
{
e.Cancel = false;
cmsPokemonList.Items.Clear();
@@ -1493,6 +1500,20 @@ namespace PokemonGo.RocketAPI.Window
item.Click += delegate { TransferPokemon(pokemons); };
cmsPokemonList.Items.Add(item);
+ item = new ToolStripMenuItem();
+ item.Text = "Rename";
+ item.Click += delegate
+ {
+ using (var form = count == 1 ? new NicknamePokemonForm(pokemonObject) : new NicknamePokemonForm())
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ NicknamePokemon(pokemons, form.txtNickname.Text);
+ }
+ }
+ };
+ cmsPokemonList.Items.Add(item);
+
if (canAllEvolve)
{
item = new ToolStripMenuItem();
@@ -1531,27 +1552,13 @@ namespace PokemonGo.RocketAPI.Window
cmsPokemonList.Items.Add(item);
cmsPokemonList.Items.Add(separator);
-
- item = new ToolStripMenuItem();
- item.Text = "Rename";
- item.Click += delegate
- {
- using (var form = new NicknamePokemonForm(pokemonObject))
- {
- if (form.ShowDialog() == DialogResult.OK)
- {
- NicknamePokemon(pokemonObject, form.txtNickname.Text);
- }
- }
- };
- cmsPokemonList.Items.Add(item);
}
};
}
private Image GetPokemonImage(int pokemonId)
{
- return (Image) Properties.Resources.ResourceManager.GetObject("Pokemon_" + pokemonId);
+ return (Image)Properties.Resources.ResourceManager.GetObject("Pokemon_" + pokemonId);
}
private void SetState(bool state)
@@ -1607,7 +1614,7 @@ namespace PokemonGo.RocketAPI.Window
{
var pokemonObject = new PokemonObject(pokemon);
var family =
- families.Where(i => (int) i.FamilyId <= (int) pokemon.PokemonId)
+ families.Where(i => (int)i.FamilyId <= (int)pokemon.PokemonId)
.First();
pokemonObject.Candy = family.Candy_;
pokemonObjects.Add(pokemonObject);
@@ -1674,7 +1681,7 @@ namespace PokemonGo.RocketAPI.Window
private async void ItemBox_ItemClick(object sender, EventArgs e)
{
- var item = (ItemData) sender;
+ var item = (ItemData)sender;
using (var form = new ItemForm(item))
{
@@ -1764,15 +1771,15 @@ namespace PokemonGo.RocketAPI.Window
var cName = olvPokemonList.AllColumns[e.ColumnIndex].AspectToStringFormat;
if (cName.Equals("Transfer"))
{
- TransferPokemon(new List<PokemonData> {pokemon.PokemonData});
+ TransferPokemon(new List<PokemonData> { pokemon.PokemonData });
}
else if (cName.Equals("Power Up"))
{
- PowerUpPokemon(new List<PokemonData> {pokemon.PokemonData});
+ PowerUpPokemon(new List<PokemonData> { pokemon.PokemonData });
}
else if (cName.Equals("Evolve"))
{
- EvolvePokemon(new List<PokemonData> {pokemon.PokemonData});
+ EvolvePokemon(new List<PokemonData> { pokemon.PokemonData });
}
}
catch (Exception ex)
@@ -1928,19 +1935,23 @@ namespace PokemonGo.RocketAPI.Window
public async Task<IEnumerable<ItemData>> GetItemsToRecycle(ISettings _settings, Client client)
{
- var settings = (Settings) _settings;
+ var itemCounts = (_settings as Settings).ItemCounts;
+ var settings = (Settings)_settings;
var myItems = await GetItems(client);
+ var itemsToRecycle = new List<ItemData>();
+
+ foreach (var itemData in myItems) {
+ foreach (var itemCount in itemCounts) {
+ if (itemData.ItemId == itemCount.ItemId && itemData.Count > itemCount.Count) {
+ var itemToRecycle = new ItemData();
+ itemToRecycle.ItemId = itemData.ItemId;
+ itemToRecycle.Count = itemData.Count - itemCount.Count;
+ itemsToRecycle.Add(itemToRecycle);
+ }
+ }
+ }
- return myItems
- .Where(x => settings.ItemRecycleFilter.Any(f => f.Key == x.ItemId && x.Count > f.Value))
- .Select(
- x =>
- new ItemData
- {
- ItemId = x.ItemId,
- Count = x.Count - settings.ItemRecycleFilter.Single(f => f.Key == x.ItemId).Value,
- Unseen = x.Unseen
- });
+ return itemsToRecycle;
}
public async Task RecycleItems(Client client)
@@ -1951,7 +1962,7 @@ namespace PokemonGo.RocketAPI.Window
{
var transfer = await client.Inventory.RecycleItem(item.ItemId, item.Count);
ColoredConsoleWrite(Color.DarkCyan, $"Recycled {item.Count}x {item.ItemId.ToString().Substring(4)}");
- await Task.Delay(500);
+ //await Task.Delay(500);
}
}
@@ -1986,20 +1997,20 @@ namespace PokemonGo.RocketAPI.Window
var ballCollection = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Item)
.Where(p => p != null)
.GroupBy(i => i.ItemId)
- .Select(kvp => new {ItemId = kvp.Key, Amount = kvp.Sum(x => x.Count)})
+ .Select(kvp => new { ItemId = kvp.Key, Amount = kvp.Sum(x => x.Count) })
.Where(y => y.ItemId == ItemId.ItemPokeBall
|| y.ItemId == ItemId.ItemGreatBall
|| y.ItemId == ItemId.ItemUltraBall
|| y.ItemId == ItemId.ItemMasterBall);
var pokeBallsCount = ballCollection.Where(p => p.ItemId == ItemId.ItemPokeBall).
- DefaultIfEmpty(new {ItemId = ItemId.ItemPokeBall, Amount = 0}).FirstOrDefault().Amount;
+ DefaultIfEmpty(new { ItemId = ItemId.ItemPokeBall, Amount = 0 }).FirstOrDefault().Amount;
var greatBallsCount = ballCollection.Where(p => p.ItemId == ItemId.ItemGreatBall).
- DefaultIfEmpty(new {ItemId = ItemId.ItemGreatBall, Amount = 0}).FirstOrDefault().Amount;
+ DefaultIfEmpty(new { ItemId = ItemId.ItemGreatBall, Amount = 0 }).FirstOrDefault().Amount;
var ultraBallsCount = ballCollection.Where(p => p.ItemId == ItemId.ItemUltraBall).
- DefaultIfEmpty(new {ItemId = ItemId.ItemUltraBall, Amount = 0}).FirstOrDefault().Amount;
+ DefaultIfEmpty(new { ItemId = ItemId.ItemUltraBall, Amount = 0 }).FirstOrDefault().Amount;
var masterBallsCount = ballCollection.Where(p => p.ItemId == ItemId.ItemMasterBall).
- DefaultIfEmpty(new {ItemId = ItemId.ItemMasterBall, Amount = 0}).FirstOrDefault().Amount;
+ DefaultIfEmpty(new { ItemId = ItemId.ItemMasterBall, Amount = 0 }).FirstOrDefault().Amount;
// Use better balls for high CP pokemon
if (masterBallsCount > 0 && pokemonCP >= 1000)
@@ -2045,19 +2056,36 @@ namespace PokemonGo.RocketAPI.Window
return ItemId.ItemPokeBall;
}
- public async void NicknamePokemon(PokemonObject pokemon, string nickname)
+ public async void NicknamePokemon(IEnumerable<PokemonData> pokemons, string nickname)
{
SetState(false);
- var response = await _client2.Inventory.NicknamePokemon(pokemon.Id, nickname);
- if (response.Result == NicknamePokemonResponse.Types.Result.Success)
- {
- ColoredConsoleWrite(Color.Green, $"Successfully renamed {pokemon.PokemonId} to \"{nickname}\"");
- }
- else
+ foreach (var pokemon in pokemons)
{
- ColoredConsoleWrite(Color.Red, $"Failed renaming {pokemon.PokemonId} to \"{nickname}\"");
+ var newName = new StringBuilder(nickname);
+ newName.Replace("{Name}", Convert.ToString(pokemon.PokemonId));
+ newName.Replace("{CP}", Convert.ToString(pokemon.Cp));
+ newName.Replace("{IV}", Convert.ToString(Math.Round(Perfect(pokemon))));
+ newName.Replace("{IA}", Convert.ToString(pokemon.IndividualAttack));
+ newName.Replace("{ID}", Convert.ToString(pokemon.IndividualDefense));
+ newName.Replace("{IS}", Convert.ToString(pokemon.IndividualStamina));
+ nickname = newName.ToString();
+ if (nickname.Length > 12)
+ {
+ ColoredConsoleWrite(Color.Red, $"\"{nickname}\" is too long, please choose another name");
+ continue;
+ }
+ var response = await _client2.Inventory.NicknamePokemon(pokemon.Id, nickname);
+ if (response.Result == NicknamePokemonResponse.Types.Result.Success)
+ {
+ ColoredConsoleWrite(Color.Green, $"Successfully renamed {pokemon.PokemonId} to \"{nickname}\"");
+ }
+ else
+ {
+ ColoredConsoleWrite(Color.Red, $"Failed renaming {pokemon.PokemonId} to \"{nickname}\"");
+ }
+ await Task.Delay(ACTIONDELAY);
}
- ReloadPokemonList();
+ await ReloadPokemonList();
}
private async void button1_Click(object sender, EventArgs e)
diff --git a/src/RocketBotGUI/NicknamePokemonForm.Designer.cs b/src/RocketBotGUI/NicknamePokemonForm.Designer.cs
index 1c50675..2aefa2d 100644
--- a/src/RocketBotGUI/NicknamePokemonForm.Designer.cs
+++ b/src/RocketBotGUI/NicknamePokemonForm.Designer.cs
@@ -27,6 +27,9 @@
this.txtNickname = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnNickname = new System.Windows.Forms.Button();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
this.pnl.SuspendLayout();
this.SuspendLayout();
//
@@ -34,20 +37,23 @@
//
this.pnl.BackColor = System.Drawing.SystemColors.Window;
this.pnl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pnl.Controls.Add(this.label4);
+ this.pnl.Controls.Add(this.label3);
+ this.pnl.Controls.Add(this.label2);
this.pnl.Controls.Add(this.txtNickname);
this.pnl.Controls.Add(this.label1);
this.pnl.Controls.Add(this.btnNickname);
this.pnl.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnl.Location = new System.Drawing.Point(0, 0);
this.pnl.Name = "pnl";
- this.pnl.Size = new System.Drawing.Size(401, 144);
+ this.pnl.Size = new System.Drawing.Size(401, 205);
this.pnl.TabIndex = 0;
//
// txtNickname
//
this.txtNickname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtNickname.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.txtNickname.Location = new System.Drawing.Point(16, 44);
+ this.txtNickname.Location = new System.Drawing.Point(16, 41);
this.txtNickname.Name = "txtNickname";
this.txtNickname.Size = new System.Drawing.Size(372, 35);
this.txtNickname.TabIndex = 0;
@@ -55,13 +61,13 @@
//
// label1
//
- this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.SystemColors.ControlDark;
- this.label1.Location = new System.Drawing.Point(11, 8);
+ this.label1.Location = new System.Drawing.Point(11, 7);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(377, 33);
+ this.label1.Size = new System.Drawing.Size(377, 30);
this.label1.TabIndex = 6;
this.label1.Text = "Nickname Pokemon";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@@ -73,18 +79,52 @@
this.btnNickname.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNickname.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnNickname.ForeColor = System.Drawing.SystemColors.ControlDark;
- this.btnNickname.Location = new System.Drawing.Point(133, 95);
+ this.btnNickname.Location = new System.Drawing.Point(133, 160);
this.btnNickname.Name = "btnNickname";
- this.btnNickname.Size = new System.Drawing.Size(140, 35);
+ this.btnNickname.Size = new System.Drawing.Size(140, 32);
this.btnNickname.TabIndex = 1;
this.btnNickname.Text = "Rename";
this.btnNickname.UseVisualStyleBackColor = true;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.label2.Location = new System.Drawing.Point(11, 79);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(105, 15);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "Rename Template:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.label3.Location = new System.Drawing.Point(13, 98);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(142, 45);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "{Name} : Pokemon Name\r\n{CP} : Pokemon CP\r\n{IV} : Pokemon IV %";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.label4.Location = new System.Drawing.Point(191, 98);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(186, 45);
+ this.label4.TabIndex = 9;
+ this.label4.Text = "{IA} : Pokemon Individual Attack\r\n{ID} : Pokemon Individual Defense\r\n{IS} : Pokem" +
+ "on Individual Stamina";
//
// NicknamePokemonForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(401, 144);
+ this.ClientSize = new System.Drawing.Size(401, 205);
this.Controls.Add(this.pnl);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "NicknamePokemonForm";
@@ -102,5 +142,8 @@
private System.Windows.Forms.Button btnNickname;
public System.Windows.Forms.TextBox txtNickname;
private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label4;
}
}
\ No newline at end of file
diff --git a/src/RocketBotGUI/NicknamePokemonForm.cs b/src/RocketBotGUI/NicknamePokemonForm.cs
index 1bd3d54..b549819 100644
--- a/src/RocketBotGUI/NicknamePokemonForm.cs
+++ b/src/RocketBotGUI/NicknamePokemonForm.cs
@@ -4,6 +4,13 @@ namespace PokemonGo.RocketAPI.Window
{
public partial class NicknamePokemonForm : Form
{
+ public NicknamePokemonForm()
+ {
+ InitializeComponent();
+ txtNickname.Text = @"{IV}_{Name}";
+ txtNickname.KeyDown += TxtNickname_KeyDown;
+ }
+
public NicknamePokemonForm(PokemonObject pokemon)
{
InitializeComponent();
diff --git a/src/RocketBotGUI/NicknamePokemonForm.resx b/src/RocketBotGUI/NicknamePokemonForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/src/RocketBotGUI/NicknamePokemonForm.resx
@@ -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>
\ No newline at end of file
diff --git a/src/RocketBotGUI/PokemonGo.RocketBot.csproj b/src/RocketBotGUI/PokemonGo.RocketBot.csproj
index 24273d2..b955eaf 100644
--- a/src/RocketBotGUI/PokemonGo.RocketBot.csproj
+++ b/src/RocketBotGUI/PokemonGo.RocketBot.csproj
@@ -92,6 +92,12 @@
<Compile Include="ItemForm.Designer.cs">
<DependentUpon>ItemForm.cs</DependentUpon>
</Compile>
+ <Compile Include="ItemSetting.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="ItemSetting.Designer.cs">
+ <DependentUpon>ItemSetting.cs</DependentUpon>
+ </Compile>
<Compile Include="LocationManager.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
@@ -117,9 +123,15 @@
<Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon>
</Compile>
+ <EmbeddedResource Include="ItemSetting.resx">
+ <DependentUpon>ItemSetting.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="NicknamePokemonForm.resx">
+ <DependentUpon>NicknamePokemonForm.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
diff --git a/src/RocketBotGUI/Settings.cs b/src/RocketBotGUI/Settings.cs
index 07d044c..8cb10cb 100644
--- a/src/RocketBotGUI/Settings.cs
+++ b/src/RocketBotGUI/Settings.cs
@@ -123,6 +123,46 @@ namespace PokemonGo.RocketAPI.Window
public double RazzBerrySetting
=> GetSetting() != string.Empty ? double.Parse(GetSetting(), CultureInfo.InvariantCulture) : 500;
+ public List<ItemData> ItemCounts
+ {
+ get
+ {
+ var itemCounts = new List<ItemData>();
+ var items = GetSetting() != String.Empty ? GetSetting() :
+ "ItemPokeball,100;ItemGreatBall,100;ItemUltraBall,50;ItemRazzBerry,25;ItemPotion,0;ItemSuperPotion,0;ItemHyperPotion,10;ItemMaxPotion,20;ItemRevive,10;ItemMaxRevive,10";
+ if (items.Contains(";")) {
+ foreach (var item in items.Split(';')) {
+ if (item.Contains(",")) {
+ var itemId = item.Split(',')[0];
+ var count = Int32.Parse(item.Split(',')[1]);
+ foreach (ItemId id in Enum.GetValues(typeof(ItemId))) {
+ if (id.ToString().Equals(itemId)) {
+ ItemData itemData = new ItemData();
+ itemData.ItemId = id;
+ itemData.Count = count;
+ itemCounts.Add(itemData);
+ break;
+ }
+ }
+ }
+ }
+ }
+ return itemCounts;
+ }
+
+ set
+ {
+ var items = "";
+ foreach (var itemData in value) {
+ items += itemData.ItemId.ToString() + "," + itemData.Count + ";";
+ }
+ if (items != string.Empty) {
+ items = items.Remove(items.Length - 1, 1);
+ }
+ SetSetting(items);
+ }
+ }
+
public List<PokemonId> ExcludedPokemonCatch
{
get
diff --git a/src/RocketBotGUI/SettingsForm.Designer.cs b/src/RocketBotGUI/SettingsForm.Designer.cs
index 23b41f3..781e413 100644
--- a/src/RocketBotGUI/SettingsForm.Designer.cs
+++ b/src/RocketBotGUI/SettingsForm.Designer.cs
@@ -63,8 +63,8 @@ namespace PokemonGo.RocketAPI.Window
this.label6 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.tabControl = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.tabLocation = new System.Windows.Forms.TabPage();
+ this.tabPokemon = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.cbSelectAllEvolve = new System.Windows.Forms.CheckBox();
this.clbEvolve = new System.Windows.Forms.CheckedListBox();
@@ -74,7 +74,8 @@ namespace PokemonGo.RocketAPI.Window
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cbSelectAllTransfer = new System.Windows.Forms.CheckBox();
this.clbTransfer = new System.Windows.Forms.CheckedListBox();
- this.tabPage3 = new System.Windows.Forms.TabPage();
+ this.tabItems = new System.Windows.Forms.TabPage();
+ this.tabDevice = new System.Windows.Forms.TabPage();
this.label22 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
@@ -108,16 +109,18 @@ namespace PokemonGo.RocketAPI.Window
this.DeviceIdTb = new System.Windows.Forms.TextBox();
this.deviceIdlb = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
+ this.flpItems = new System.Windows.Forms.FlowLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.tabControl.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.tabPage2.SuspendLayout();
+ this.tabLocation.SuspendLayout();
+ this.tabPokemon.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
- this.tabPage3.SuspendLayout();
+ this.tabItems.SuspendLayout();
+ this.tabDevice.SuspendLayout();
this.SuspendLayout();
//
// authTypeLabel
@@ -499,9 +502,10 @@ namespace PokemonGo.RocketAPI.Window
//
// tabControl
//
- this.tabControl.Controls.Add(this.tabPage1);
- this.tabControl.Controls.Add(this.tabPage2);
- this.tabControl.Controls.Add(this.tabPage3);
+ this.tabControl.Controls.Add(this.tabLocation);
+ this.tabControl.Controls.Add(this.tabPokemon);
+ this.tabControl.Controls.Add(this.tabItems);
+ this.tabControl.Controls.Add(this.tabDevice);
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabControl.Location = new System.Drawing.Point(0, 0);
@@ -510,32 +514,32 @@ namespace PokemonGo.RocketAPI.Window
this.tabControl.Size = new System.Drawing.Size(597, 458);
this.tabControl.TabIndex = 26;
//
- // tabPage1
- //
- this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
- this.tabPage1.Controls.Add(this.trackBar);
- this.tabPage1.Controls.Add(this.AdressBox);
- this.tabPage1.Controls.Add(this.FindAdressButton);
- this.tabPage1.Controls.Add(this.gMapControl1);
- this.tabPage1.Location = new System.Drawing.Point(4, 24);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(589, 430);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "Location";
- //
- // tabPage2
- //
- this.tabPage2.BackColor = System.Drawing.SystemColors.Control;
- this.tabPage2.Controls.Add(this.groupBox3);
- this.tabPage2.Controls.Add(this.groupBox2);
- this.tabPage2.Controls.Add(this.groupBox1);
- this.tabPage2.Location = new System.Drawing.Point(4, 24);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(589, 430);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "Pokemon";
+ // tabLocation
+ //
+ this.tabLocation.BackColor = System.Drawing.SystemColors.Control;
+ this.tabLocation.Controls.Add(this.trackBar);
+ this.tabLocation.Controls.Add(this.AdressBox);
+ this.tabLocation.Controls.Add(this.FindAdressButton);
+ this.tabLocation.Controls.Add(this.gMapControl1);
+ this.tabLocation.Location = new System.Drawing.Point(4, 24);
+ this.tabLocation.Name = "tabLocation";
+ this.tabLocation.Padding = new System.Windows.Forms.Padding(3);
+ this.tabLocation.Size = new System.Drawing.Size(589, 430);
+ this.tabLocation.TabIndex = 0;
+ this.tabLocation.Text = "Location";
+ //
+ // tabPokemon
+ //
+ this.tabPokemon.BackColor = System.Drawing.SystemColors.Control;
+ this.tabPokemon.Controls.Add(this.groupBox3);
+ this.tabPokemon.Controls.Add(this.groupBox2);
+ this.tabPokemon.Controls.Add(this.groupBox1);
+ this.tabPokemon.Location = new System.Drawing.Point(4, 24);
+ this.tabPokemon.Name = "tabPokemon";
+ this.tabPokemon.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPokemon.Size = new System.Drawing.Size(589, 430);
+ this.tabPokemon.TabIndex = 1;
+ this.tabPokemon.Text = "Pokemon";
//
// groupBox3
//
@@ -645,46 +649,57 @@ namespace PokemonGo.RocketAPI.Window
this.clbTransfer.Size = new System.Drawing.Size(188, 364);
this.clbTransfer.TabIndex = 0;
//
- // tabPage3
- //
- this.tabPage3.Controls.Add(this.label22);
- this.tabPage3.Controls.Add(this.label20);
- this.tabPage3.Controls.Add(this.label21);
- this.tabPage3.Controls.Add(this.RandomIDBtn);
- this.tabPage3.Controls.Add(this.deviceTypeCb);
- this.tabPage3.Controls.Add(this.RandomDeviceBtn);
- this.tabPage3.Controls.Add(this.FirmwareFingerprintTb);
- this.tabPage3.Controls.Add(this.label14);
- this.tabPage3.Controls.Add(this.FirmwareTypeTb);
- this.tabPage3.Controls.Add(this.label13);
- this.tabPage3.Controls.Add(this.FirmwareTagsTb);
- this.tabPage3.Controls.Add(this.label12);
- this.tabPage3.Controls.Add(this.FirmwareBrandTb);
- this.tabPage3.Controls.Add(this.label11);
- this.tabPage3.Controls.Add(this.HardwareModelTb);
- this.tabPage3.Controls.Add(this.label10);
- this.tabPage3.Controls.Add(this.HardwareManufacturerTb);
- this.tabPage3.Controls.Add(this.label9);
- this.tabPage3.Controls.Add(this.DeviceModelBootTb);
- this.tabPage3.Controls.Add(this.label8);
- this.tabPage3.Controls.Add(this.DeviceModelIdentifierTb);
- this.tabPage3.Controls.Add(this.label7);
- this.tabPage3.Controls.Add(this.DeviceModelTb);
- this.tabPage3.Controls.Add(this.label15);
- this.tabPage3.Controls.Add(this.DeviceBrandTb);
- this.tabPage3.Controls.Add(this.label16);
- this.tabPage3.Controls.Add(this.AndroidBootloaderTb);
- this.tabPage3.Controls.Add(this.label17);
- this.tabPage3.Controls.Add(this.AndroidBoardNameTb);
- this.tabPage3.Controls.Add(this.BoardName);
- this.tabPage3.Controls.Add(this.DeviceIdTb);
- this.tabPage3.Controls.Add(this.deviceIdlb);
- this.tabPage3.Controls.Add(this.label18);
- this.tabPage3.Location = new System.Drawing.Point(4, 24);
- this.tabPage3.Name = "tabPage3";
- this.tabPage3.Size = new System.Drawing.Size(589, 430);
- this.tabPage3.TabIndex = 0;
- this.tabPage3.Text = "Device";
+ // tabItems
+ //
+ this.tabItems.BackColor = System.Drawing.SystemColors.Control;
+ this.tabItems.Controls.Add(this.flpItems);
+ this.tabItems.Location = new System.Drawing.Point(4, 24);
+ this.tabItems.Name = "tabItems";
+ this.tabItems.Padding = new System.Windows.Forms.Padding(3);
+ this.tabItems.Size = new System.Drawing.Size(589, 430);
+ this.tabItems.TabIndex = 2;
+ this.tabItems.Text = "Items";
+ //
+ // tabDevice
+ //
+ this.tabDevice.Controls.Add(this.label22);
+ this.tabDevice.Controls.Add(this.label20);
+ this.tabDevice.Controls.Add(this.label21);
+ this.tabDevice.Controls.Add(this.RandomIDBtn);
+ this.tabDevice.Controls.Add(this.deviceTypeCb);
+ this.tabDevice.Controls.Add(this.RandomDeviceBtn);
+ this.tabDevice.Controls.Add(this.FirmwareFingerprintTb);
+ this.tabDevice.Controls.Add(this.label14);
+ this.tabDevice.Controls.Add(this.FirmwareTypeTb);
+ this.tabDevice.Controls.Add(this.label13);
+ this.tabDevice.Controls.Add(this.FirmwareTagsTb);
+ this.tabDevice.Controls.Add(this.label12);
+ this.tabDevice.Controls.Add(this.FirmwareBrandTb);
+ this.tabDevice.Controls.Add(this.label11);
+ this.tabDevice.Controls.Add(this.HardwareModelTb);
+ this.tabDevice.Controls.Add(this.label10);
+ this.tabDevice.Controls.Add(this.HardwareManufacturerTb);
+ this.tabDevice.Controls.Add(this.label9);
+ this.tabDevice.Controls.Add(this.DeviceModelBootTb);
+ this.tabDevice.Controls.Add(this.label8);
+ this.tabDevice.Controls.Add(this.DeviceModelIdentifierTb);
+ this.tabDevice.Controls.Add(this.label7);
+ this.tabDevice.Controls.Add(this.DeviceModelTb);
+ this.tabDevice.Controls.Add(this.label15);
+ this.tabDevice.Controls.Add(this.DeviceBrandTb);
+ this.tabDevice.Controls.Add(this.label16);
+ this.tabDevice.Controls.Add(this.AndroidBootloaderTb);
+ this.tabDevice.Controls.Add(this.label17);
+ this.tabDevice.Controls.Add(this.AndroidBoardNameTb);
+ this.tabDevice.Controls.Add(this.BoardName);
+ this.tabDevice.Controls.Add(this.DeviceIdTb);
+ this.tabDevice.Controls.Add(this.deviceIdlb);
+ this.tabDevice.Controls.Add(this.label18);
+ this.tabDevice.Location = new System.Drawing.Point(4, 24);
+ this.tabDevice.Name = "tabDevice";
+ this.tabDevice.Size = new System.Drawing.Size(589, 430);
+ this.tabDevice.TabIndex = 0;
+ this.tabDevice.Text = "Device";
//
// label22
//
@@ -1000,6 +1015,15 @@ namespace PokemonGo.RocketAPI.Window
this.label18.TabIndex = 36;
this.label18.Text = "Device Type:";
//
+ // flpItems
+ //
+ this.flpItems.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.flpItems.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+ this.flpItems.Location = new System.Drawing.Point(3, 3);
+ this.flpItems.Name = "flpItems";
+ this.flpItems.Size = new System.Drawing.Size(583, 424);
+ this.flpItems.TabIndex = 0;
+ //
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -1021,17 +1045,18 @@ namespace PokemonGo.RocketAPI.Window
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.tabControl.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.tabPage1.PerformLayout();
- this.tabPage2.ResumeLayout(false);
+ this.tabLocation.ResumeLayout(false);
+ this.tabLocation.PerformLayout();
+ this.tabPokemon.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
- this.tabPage3.ResumeLayout(false);
- this.tabPage3.PerformLayout();
+ this.tabItems.ResumeLayout(false);
+ this.tabDevice.ResumeLayout(false);
+ this.tabDevice.PerformLayout();
this.ResumeLayout(false);
}
@@ -1072,8 +1097,8 @@ namespace PokemonGo.RocketAPI.Window
private System.Windows.Forms.Label CatchPokemonText;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TabControl tabControl;
- private System.Windows.Forms.TabPage tabPage1;
- private System.Windows.Forms.TabPage tabPage2;
+ private System.Windows.Forms.TabPage tabLocation;
+ private System.Windows.Forms.TabPage tabPokemon;
private System.Windows.Forms.CheckedListBox clbTransfer;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
@@ -1083,7 +1108,7 @@ namespace PokemonGo.RocketAPI.Window
private System.Windows.Forms.CheckBox cbSelectAllEvolve;
private System.Windows.Forms.CheckBox cbSelectAllCatch;
private System.Windows.Forms.CheckBox cbSelectAllTransfer;
- private System.Windows.Forms.TabPage tabPage3;
+ private System.Windows.Forms.TabPage tabDevice;
private System.Windows.Forms.Button RandomIDBtn;
private System.Windows.Forms.ComboBox deviceTypeCb;
private System.Windows.Forms.Button RandomDeviceBtn;
@@ -1117,5 +1142,7 @@ namespace PokemonGo.RocketAPI.Window
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
+ private System.Windows.Forms.TabPage tabItems;
+ private System.Windows.Forms.FlowLayoutPanel flpItems;
}
}
diff --git a/src/RocketBotGUI/SettingsForm.cs b/src/RocketBotGUI/SettingsForm.cs
index e123405..844ce9a 100644
--- a/src/RocketBotGUI/SettingsForm.cs
+++ b/src/RocketBotGUI/SettingsForm.cs
@@ -8,6 +8,7 @@ using System.Windows.Forms;
using GMap.NET;
using GMap.NET.MapProviders;
using POGOProtos.Enums;
+using POGOProtos.Inventory.Item;
namespace PokemonGo.RocketAPI.Window
{
@@ -16,6 +17,18 @@ namespace PokemonGo.RocketAPI.Window
private DeviceHelper _deviceHelper;
private List<DeviceInfo> _deviceInfos;
private bool _doNotPopulate;
+ private List<ItemId> itemSettings = new List<ItemId> {
+ ItemId.ItemPokeBall,
+ ItemId.ItemGreatBall,
+ ItemId.ItemUltraBall,
+ ItemId.ItemRazzBerry,
+ ItemId.ItemPotion,
+ ItemId.ItemSuperPotion,
+ ItemId.ItemHyperPotion,
+ ItemId.ItemMaxPotion,
+ ItemId.ItemRevive,
+ ItemId.ItemMaxRevive,
+ };
public SettingsForm()
{
@@ -32,6 +45,12 @@ namespace PokemonGo.RocketAPI.Window
clbTransfer.Items.Add(id);
clbEvolve.Items.Add(id);
}
+
+ foreach (ItemId itemId in itemSettings) {
+ ItemData item = new ItemData();
+ item.ItemId = itemId;
+ flpItems.Controls.Add(new ItemSetting(item));
+ }
}
private void SettingsForm_Load(object sender, EventArgs e)
@@ -124,6 +143,15 @@ namespace PokemonGo.RocketAPI.Window
}
}
+ var itemCounts = Settings.Instance.ItemCounts;
+ foreach (ItemSetting itemSetting in flpItems.Controls) {
+ foreach(var itemCount in itemCounts) {
+ if (itemSetting.ItemData.ItemId == itemCount.ItemId) {
+ itemSetting.ItemData = itemCount;
+ }
+ }
+ }
+
// Device settings
_deviceHelper = new DeviceHelper();
_deviceInfos = _deviceHelper.DeviceBucket;
@@ -185,6 +213,7 @@ namespace PokemonGo.RocketAPI.Window
Settings.Instance.ExcludedPokemonCatch = clbCatch.CheckedItems.Cast<PokemonId>().ToList();
Settings.Instance.ExcludedPokemonTransfer = clbTransfer.CheckedItems.Cast<PokemonId>().ToList();
Settings.Instance.ExcludedPokemonEvolve = clbEvolve.CheckedItems.Cast<PokemonId>().ToList();
+ Settings.Instance.ItemCounts = flpItems.Controls.Cast<ItemSetting>().Select(i => i.ItemData).ToList();
Settings.Instance.Reload();
//Device settings
You may download the files in Public Git.