Skip to content

Commit

Permalink
Merge pull request #4659 from PokemonGoF/dev
Browse files Browse the repository at this point in the history
Dev merge to mater
  • Loading branch information
solderzzc authored Aug 24, 2016
2 parents 73c359f + 5d198c5 commit 6a4580f
Show file tree
Hide file tree
Showing 20 changed files with 157 additions and 297 deletions.
18 changes: 9 additions & 9 deletions configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"config": {
"enabled": true,
"min_free_slot": 5,
"transfer_wait_min": 1,
"transfer_wait_max": 4
"transfer_wait_min": 3,
"transfer_wait_max": 5
}
},
{
Expand Down Expand Up @@ -108,8 +108,8 @@
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
},
"recycle_wait_min": 1,
"recycle_wait_max": 4
"recycle_wait_min": 3,
"recycle_wait_max": 5
}
},
{
Expand All @@ -131,12 +131,12 @@
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 2,
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
}
}
},
Expand Down
18 changes: 9 additions & 9 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"config": {
"enabled": true,
"min_free_slot": 5,
"transfer_wait_min": 1,
"transfer_wait_max": 4
"transfer_wait_min": 3,
"transfer_wait_max": 5
}
},
{
Expand Down Expand Up @@ -121,8 +121,8 @@
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
},
"recycle_wait_min": 1,
"recycle_wait_max": 4
"recycle_wait_min": 3,
"recycle_wait_max": 5
}
},
{
Expand All @@ -146,12 +146,12 @@
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 2,
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
}
}
},
Expand Down
18 changes: 9 additions & 9 deletions configs/config.json.optimizer.example
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"transfer": true,
"// 'transfer_wait_min' and 'transfer_wait_max' are the minimum and maximum": {},
"// time to wait when transferring a pokemon": {},
"transfer_wait_min": 2,
"transfer_wait_max": 4,
"transfer_wait_min": 3,
"transfer_wait_max": 5,
"// the 'evolve' parameter activate or deactivate the evolution of pokemons": {},
"// at false, no pokemon is going to be evolved, ever": {},
"// at false, you will still get the log information of what the": {},
Expand Down Expand Up @@ -169,8 +169,8 @@
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
},
"recycle_wait_min": 1,
"recycle_wait_max": 4
"recycle_wait_min": 3,
"recycle_wait_max": 5
}
},
{
Expand All @@ -193,12 +193,12 @@
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 2,
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
}
}
},
Expand Down
19 changes: 10 additions & 9 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"config": {
"enabled": true,
"min_free_slot": 5,
"transfer_wait_min": 1,
"transfer_wait_max": 4
"transfer_wait_min": 3,
"transfer_wait_max": 5
}
},
{
Expand Down Expand Up @@ -108,8 +108,8 @@
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
},
"recycle_wait_min": 1,
"recycle_wait_max": 4
"recycle_wait_min": 3,
"recycle_wait_max": 5
}
},
{
Expand All @@ -132,12 +132,12 @@
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 2,
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
}
}
},
Expand All @@ -153,6 +153,7 @@
"type": "FollowPath",
"config": {
"enabled": true,
"walker": "StepWalker",
"path_mode": "loop",
"path_start_mode": "first",
"path_file": "configs/path.example.json",
Expand Down
18 changes: 9 additions & 9 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"config": {
"enabled": true,
"min_free_slot": 5,
"transfer_wait_min": 1,
"transfer_wait_max": 4
"transfer_wait_min": 3,
"transfer_wait_max": 5
}
},
{
Expand Down Expand Up @@ -107,8 +107,8 @@
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
},
"recycle_wait_min": 1,
"recycle_wait_max": 4
"recycle_wait_min": 3,
"recycle_wait_max": 5
}
},
{
Expand All @@ -131,12 +131,12 @@
"catch_simulation": {
"flee_count": 3,
"flee_duration": 2,
"catch_wait_min": 2,
"catch_wait_min": 3,
"catch_wait_max": 6,
"berry_wait_min": 2,
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
"berry_wait_min": 3,
"berry_wait_max": 5,
"changeball_wait_min": 3,
"changeball_wait_max": 5
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The behaviors of the bot are configured via the `tasks` key in the `config.json`
* EvolvePokemon
* `evolve_all`: Default `NONE` | Set to `"all"` to evolve Pokémon if possible when the bot starts. Can also be set to individual Pokémon as well as multiple separated by a comma. e.g "Pidgey,Rattata,Weedle,Zubat"
* `min_evolve_speed`: Default `25` | Minimum seconds to wait between each evolution
* `min_evolve_speed`: Default `30` | Maximum seconds to wait between each evolution
* `max_evolve_speed`: Default `30` | Maximum seconds to wait between each evolution
* `use_lucky_egg`: Default: `False`
* FollowPath
* `path_mode`: Default `loop` | Set the mode for the path navigator (loop or linear).
Expand Down Expand Up @@ -495,7 +495,7 @@ If you want to make your bot behave as it did prior to the catch_simulation upda
### Description
[[back to top](#table-of-contents)]

This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map instance. For information on how to properly setup PokemonGo-Map have a look at the Github page of the project [here](https://github.com/AHAAAAAAA/PokemonGo-Map/). There is an example config in `config/config.json.map.example`
This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map instance. For information on how to properly setup PokemonGo-Map have a look at the Github page of the project [here](https://github.com/PokemonGoMap/PokemonGo-Map). There is an example config in `config/config.json.map.example`

### Options
[[back to top](#table-of-contents)]
Expand Down
10 changes: 5 additions & 5 deletions map-chat/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<body>

<!-- Google translate -->
<!-- Google translate
<div class="translation-wrapper hide-on-small-and-down">
Translation
<div id="google_translate_element" style="float: right; padding-left: 10px"></div>
Expand All @@ -34,11 +34,10 @@
}
</script>
<script type="text/javascript" src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

<div class="navbar">
<nav>
<div class="nav-wrapper blue">
<a class="brand-logo center" href="http://idoco.github.io/map-chat/">MapChat</a>
<a class="brand-logo center" href="https://github.com/PokemonGoF/PokemonGo-Bot/tree/master/map-chat">MapChat</a>
<a id="side-nav-button" href="#" data-activates="side-nav"><i class="mdi-navigation-menu"></i></a>
<ul class="side-nav" id="side-nav">
<li>
Expand All @@ -63,9 +62,10 @@
</div>
</nav>
</div>
-->

<!--fork me link-->
<a href="https://github.com/idoco/map-chat/" class="hide-on-med-and-down">
<a href="https://github.com/PokemonGoF/PokemonGo-Bot/tree/master/map-chat" class="hide-on-med-and-down">
<img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"
class="fork-me-link" alt="Fork me on GitHub">
</a>
Expand Down Expand Up @@ -111,7 +111,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/js/materialize.min.js"></script>
<script src="https://cdn.jsdelivr.net/sockjs/1.0.0/sockjs.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vertx/2.0.0/vertxbus.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&language=en"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCbS09u00uAutq-SzZFzwabK0ihFCFCwU0&v=3.exp&language=en"></script>

<script type="text/javascript" src="javascript/modernizr.custom.js"></script>
<script type="text/javascript" src="javascript/html-sanitizer-minified.js"></script>
Expand Down
3 changes: 2 additions & 1 deletion map-chat/javascript/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var urlHashTopic = location.hash ? location.hash.substring(1).toLowerCase() : nu
var topic = urlHashTopic ? urlHashTopic : "pgomapcatch/chat";

function initialiseEventBus(){
window.client = mqtt.connect('ws://test.mosca.io'); // you add a ws:// url here
window.client = mqtt.connect('ws://broker.pikabot.org'); // you add a ws:// url here
client.subscribe("pgomapcatch/#");

client.on("message", function(topic, payload) {
Expand All @@ -18,6 +18,7 @@ function initialiseEventBus(){
if(topic === 'pgomapcatch/chat'){
console.log('Chatting event')
displayChatMessageOnMap(payload)
Materialize.toast(payload, 5000);
} else {

//@ro: let's grab the message and split that shit. (simple for now, maybe we could just parse the json instead)
Expand Down
6 changes: 3 additions & 3 deletions map-chat/javascript/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function displayChatMessageOnMap(raw){
});

// msg.text = msg.text ? embedTweet(msg.text) : "";
msg.text = msg.text.replace(/&#35;(\S*)/g,'<a href="http://idoco.github.io/map-chat/#$1" target="_blank">#$1</a>');
msg.text = msg.text.replace(/&#35;(\S*)/g,'<a href="http://maps.pikabot.org/#$1" target="_blank">#$1</a>');

// linkify
msg.text = msg.text.replace(/(\b(https?|ftp|file):&#x2F;&#x2F;[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
Expand Down Expand Up @@ -240,7 +240,7 @@ function displayMessageOnMap(msg, olat, olong, sessid, icostr, expir, pokenick){
});

// msg.text = msg.text ? embedTweet(msg.text) : "";
msg.text = msg.text.replace(/&#35;(\S*)/g,'<a href="http://idoco.github.io/map-chat/#$1" target="_blank">#$1</a>');
msg.text = msg.text.replace(/&#35;(\S*)/g,'<a href="http://maps.pikabot.org/#$1" target="_blank">#$1</a>');

// linkify
msg.text = msg.text.replace(/(\b(https?|ftp|file):&#x2F;&#x2F;[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
Expand Down Expand Up @@ -323,7 +323,7 @@ function displayMessageOnMap(msg, olat, olong, sessid, icostr, expir, pokenick){

function embedTweet(text) {
var tweetText = "Someone wrote " + text + " on ";
var tweetUrl = "https:\/\/twitter.com\/share?url=http://idoco.github.io/map-chat&text=" + tweetText;
var tweetUrl = "https:\/\/twitter.com\/share?url=http://maps.pikabot.org/&text=" + tweetText;
var width = 500, height = 300;
var left = (screen.width / 2) - (width / 2);
var top = (screen.height / 2) - (height / 2);
Expand Down
4 changes: 4 additions & 0 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ def update_web_location(self, cells=[], lat=None, lng=None, alt=None):
if alt is None:
alt = self.api._position_alt

# dont cache when teleport_to
if self.api.teleporting:
return

if cells == []:
location = self.position[0:2]
cells = self.find_close_cells(*location)
Expand Down
6 changes: 4 additions & 2 deletions pokemongo_bot/api_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, config=None):
PGoApi.__init__(self)
# Set to default, just for CI...
self.actual_lat, self.actual_lng, self.actual_alt = PGoApi.get_position(self)
self.teleporting = False
self.noised_lat, self.noised_lng, self.noised_alt = self.actual_lat, self.actual_lng, self.actual_alt

self.useVanillaRequest = False
Expand Down Expand Up @@ -81,14 +82,15 @@ def login(self, *args):
self.useVanillaRequest = False
return ret_value

def set_position(self, lat, lng, alt=None):
def set_position(self, lat, lng, alt=None, teleporting=False):
self.actual_lat = lat
self.actual_lng = lng
if None != alt:
self.actual_alt = alt
else:
alt = self.actual_alt

self.teleporting = teleporting

if self.config.replicate_gps_xy_noise:
lat_noise = gps_noise_rng(self.config.gps_xy_noise_range)
lng_noise = gps_noise_rng(self.config.gps_xy_noise_range)
Expand Down
4 changes: 1 addition & 3 deletions pokemongo_bot/cell_workers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

from catch_lured_pokemon import CatchLuredPokemon
from catch_visible_pokemon import CatchVisiblePokemon
from evolve_pokemon import EvolvePokemon
from incubate_eggs import IncubateEggs
from move_to_fort import MoveToFort
Expand All @@ -22,4 +20,4 @@
from update_live_inventory import UpdateLiveInventory
from catch_pokemon import CatchPokemon
from complete_tutorial import CompleteTutorial
from random_pause import RandomPause
from random_pause import RandomPause
Loading

0 comments on commit 6a4580f

Please sign in to comment.