Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add random delay for animation if new to dex #4714

Merged
merged 8 commits into from
Aug 25, 2016
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
"changeball_wait_max": 5,
"newtodex_wait_min": 20,
"newtodex_wait_max": 30
}
}
},
Expand Down
4 changes: 3 additions & 1 deletion configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
"changeball_wait_max": 5,
"newtodex_wait_min": 20,
"newtodex_wait_max": 30
}
}
},
Expand Down
4 changes: 3 additions & 1 deletion configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@
"berry_wait_min": 2,
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
"changeball_wait_max": 3,
"newtodex_wait_min": 20,
"newtodex_wait_max": 30
}
}
},
Expand Down
22 changes: 12 additions & 10 deletions configs/config.json.optimizer.example
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,18 @@
"normal_rate": 0.1,
"spin_success_rate" : 0.6
},
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
}
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5,
"newtodex_wait_min": 20,
"newtodex_wait_max": 30
}
}
},
{
Expand Down
4 changes: 3 additions & 1 deletion configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
"changeball_wait_max": 5,
"newtodex_wait_min": 20,
"newtodex_wait_max": 30
}
}
},
Expand Down
40 changes: 21 additions & 19 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -122,33 +122,35 @@
"recycle_force_max": "00:01:00"
}
},
{
"type": "CatchPokemon",
"config": {
"enabled": true,
{
"type": "CatchPokemon",
"config": {
"enabled": true,
"catch_visible_pokemon": true,
"catch_lured_pokemon": true,
"min_ultraball_to_keep": 5,
"berry_threshold": 0.35,
"vip_berry_threshold": 0.9,
"treat_unseen_as_vip": true,
"catch_throw_parameters": {
"excellent_rate": 0.1,
"great_rate": 0.5,
"nice_rate": 0.3,
"normal_rate": 0.1,
"spin_success_rate" : 0.6
"excellent_rate": 0.1,
"great_rate": 0.5,
"nice_rate": 0.3,
"normal_rate": 0.1,
"spin_success_rate" : 0.6
},
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
}
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5,
"newtodex_wait_min": 20,
"newtodex_wait_max": 30
}
}
},
{
Expand Down
10 changes: 9 additions & 1 deletion pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def initialize(self):
self.catchsim_berry_wait_max = self.catchsim_config.get('berry_wait_max', 3)
self.catchsim_changeball_wait_min = self.catchsim_config.get('changeball_wait_min', 2)
self.catchsim_changeball_wait_max = self.catchsim_config.get('changeball_wait_max', 3)
self.catchsim_newtodex_wait_min = self.catchsim_config.get('newtodex_wait_min', 20)
self.catchsim_newtodex_wait_max = self.catchsim_config.get('newtodex_wait_max', 30)


############################################################################
Expand Down Expand Up @@ -499,6 +501,8 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False):

try:
inventory.pokemons().add(pokemon)
exp_gain = sum(response_dict['responses']['CATCH_POKEMON']['capture_award']['xp'])

self.emit_event(
'pokemon_caught',
formatted='Captured {pokemon}! [CP {cp}] [NCP {ncp}] [Potential {iv}] [{iv_display}] [+{exp} exp]',
Expand All @@ -508,7 +512,7 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False):
'cp': pokemon.cp,
'iv': pokemon.iv,
'iv_display': pokemon.iv_display,
'exp': sum(response_dict['responses']['CATCH_POKEMON']['capture_award']['xp']),
'exp': exp_gain,
'encounter_id': self.pokemon['encounter_id'],
'latitude': self.pokemon['latitude'],
'longitude': self.pokemon['longitude'],
Expand Down Expand Up @@ -545,6 +549,10 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False):
}, outfile)
outfile.write('\n')

# if it is a new pokemon to our dex, simulate app animation delay
if exp_gain >= 500:
sleep (randrange(newtodex_wait_min, newtodex_wait_max))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjmadsen the variable here should be catchsim_newtodex_wait_min and catchsim_newtodex_wait_max


except IOError as e:
self.logger.info('[x] Error while opening location file: %s' % e)

Expand Down