-
Notifications
You must be signed in to change notification settings - Fork 230
Auto Evolve #347
Auto Evolve #347
Changes from all commits
f929a4c
3cb2b74
2642581
39f2b96
ce4fdad
79d0f30
c60552e
c3c5e78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
1,25 | ||
2,100 | ||
3,0 | ||
4,25 | ||
5,100 | ||
6,0 | ||
7,25 | ||
8,100 | ||
9,0 | ||
10,12 | ||
11,50 | ||
12,0 | ||
13,12 | ||
14,50 | ||
15,0 | ||
16,12 | ||
17,50 | ||
18,0 | ||
19,25 | ||
20,0 | ||
21,50 | ||
22,0 | ||
23,50 | ||
24,0 | ||
25,50 | ||
26,0 | ||
27,50 | ||
28,0 | ||
29,25 | ||
30,100 | ||
31,0 | ||
32,25 | ||
33,100 | ||
34,0 | ||
35,50 | ||
36,0 | ||
37,50 | ||
38,0 | ||
39,50 | ||
40,0 | ||
41,50 | ||
42,0 | ||
43,25 | ||
44,100 | ||
45,0 | ||
46,50 | ||
47,0 | ||
48,50 | ||
49,0 | ||
50,50 | ||
51,0 | ||
52,50 | ||
53,0 | ||
54,50 | ||
55,0 | ||
56,50 | ||
57,0 | ||
58,50 | ||
59,0 | ||
60,25 | ||
61,100 | ||
62,0 | ||
63,25 | ||
64,100 | ||
65,0 | ||
66,25 | ||
67,100 | ||
68,0 | ||
69,25 | ||
70,100 | ||
71,0 | ||
72,50 | ||
73,0 | ||
74,25 | ||
75,100 | ||
76,0 | ||
77,50 | ||
78,0 | ||
79,50 | ||
80,0 | ||
81,50 | ||
82,0 | ||
83,0 | ||
84,50 | ||
85,0 | ||
86,50 | ||
87,0 | ||
88,50 | ||
89,0 | ||
90,50 | ||
91,0 | ||
92,25 | ||
93,100 | ||
94,0 | ||
95,0 | ||
96,50 | ||
97,0 | ||
98,50 | ||
9,0 | ||
100,50 | ||
101,0 | ||
102,50 | ||
103,0 | ||
104,50 | ||
105,0 | ||
106,0 | ||
107,0 | ||
108,0 | ||
109,50 | ||
110,0 | ||
111,50 | ||
112,0 | ||
113,0 | ||
114,0 | ||
115,0 | ||
116,50 | ||
117,0 | ||
118,50 | ||
119,0 | ||
120,50 | ||
121,0 | ||
122,0 | ||
123,0 | ||
124,0 | ||
125,0 | ||
126,0 | ||
127,0 | ||
128,0 | ||
129,400 | ||
130,0 | ||
131,0 | ||
132,0 | ||
133,25 | ||
134,0 | ||
135,0 | ||
136,0 | ||
137,0 | ||
138,50 | ||
139,0 | ||
140,50 | ||
141,0 | ||
142,0 | ||
143,0 | ||
144,0 | ||
145,0 | ||
146,0 | ||
147,25 | ||
148,100 | ||
149,0 | ||
150,0 | ||
151,0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import ink.abb.pogo.scraper.util.Log | |
import java.io.BufferedReader | ||
import java.io.FileOutputStream | ||
import java.io.FileReader | ||
import java.io.File | ||
import java.util.* | ||
|
||
class Settings(val properties: Properties) { | ||
|
@@ -93,6 +94,19 @@ class Settings(val properties: Properties) { | |
listOf() | ||
} | ||
|
||
val candyRequiredByPokemon = getCandyByPokemon() | ||
|
||
val autoEvolve = getPropertyIfSet("list of pokemon you want to evolve when able to", "auto_evolve", "CATERPIE,PIDGEY,WEEDLE", String::toString).split(",") | ||
|
||
//This method only exists because I wasn't sure if this data was stored somewhere else. If it is then this can be removed. | ||
private fun getCandyByPokemon(): Map<Int, Int> { | ||
val lines = File("pokemon-candy.csv").readLines() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is in PokemonMeta.java if someone wants to mod and remove .csv --
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "IF PokeBank > # (or FULL) as far as lucky egg I think it would be better to have bot count number of possible evolutions from listing in config aka +# list of pokemon you want to auto evolve so that would wait for 50 possible evolutions from that list, then use lucky egg. +# list of pokemon you want to auto evolve Would evolve every pidgey etc after a catch. no egg There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good idea, I just ran this and it evolved 87 Pidgies in less than a minute (build in delays?). Best to leave egg on toggle or manual, they're rare to come by without spending. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Xenxes i suggest letting the user decide how many evolutions/minute he wants (-1 for unlimited) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Xenxes : do you have a link to a compiled jar of this to check out? I can't compile because windows is stupid and I get too long of a file path when compiling dependencies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Clone the repo high on your SSD/HDD, eg. in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ended up doing that, which worked. |
||
return lines.map { | ||
val split = it.split(",") | ||
Pair(split[0].toInt(), split[1].toInt()) | ||
}.toMap() | ||
} | ||
|
||
private fun <T> getPropertyOrDie(description: String, property: String, conversion: (String) -> T): T { | ||
val settingString = "$description setting (\"$property\")" | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Pokemon Go Bot Copyright (C) 2016 PokemonGoBot-authors (see authors.md for more information) | ||
* This program comes with ABSOLUTELY NO WARRANTY; | ||
* This is free software, and you are welcome to redistribute it under certain conditions. | ||
* | ||
* For more information, refer to the LICENSE file in this repositories root directory | ||
*/ | ||
|
||
package ink.abb.pogo.scraper.tasks | ||
|
||
import ink.abb.pogo.scraper.Bot | ||
import ink.abb.pogo.scraper.Context | ||
import ink.abb.pogo.scraper.Settings | ||
import ink.abb.pogo.scraper.Task | ||
import ink.abb.pogo.scraper.util.Log | ||
|
||
/** | ||
* @author Michael Meehan (Javapt) | ||
*/ | ||
|
||
class EvolvePokemon : Task { | ||
override fun run(bot: Bot, ctx: Context, settings: Settings) { | ||
if (settings.autoEvolve.isEmpty()) { | ||
return | ||
} | ||
val groupedPokemon = ctx.api.inventories.pokebank.pokemons.groupBy { it.pokemonId } | ||
val autoEvolve = settings.autoEvolve | ||
val canEvolve = groupedPokemon.filter { | ||
val candyNeeded = settings.candyRequiredByPokemon[it.key.number] | ||
candyNeeded != null && candyNeeded > 0 && autoEvolve.contains(it.key.name) && it.value.first().candy >= candyNeeded | ||
} | ||
if (canEvolve.isEmpty()) { | ||
return | ||
} | ||
canEvolve.forEach { | ||
val sorted = it.value.sortedByDescending { it.cp } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use the sortByIV setting here like: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea just change this: val sorted = it.value.sortedByDescending { it.cp } with this: |
||
val candyNeeded = settings.candyRequiredByPokemon[it.key.number] | ||
if (candyNeeded != null) { | ||
for ((index, pokemon) in sorted.withIndex()) { | ||
if (pokemon.candy < candyNeeded) { | ||
break; | ||
} | ||
Log.green("Evolving ${pokemon.pokemonId.name} because we have ${pokemon.candy} candy and only need ${candyNeeded}.") | ||
pokemon.evolve() | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this moved down after task(catch). Otherwise those Pidgeys get released before we can evolve them for the XP.