Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/dev' into pr/308
Browse files Browse the repository at this point in the history
# Conflicts:
#	.gitignore
#	web/catchable.json
  • Loading branch information
Reaver01 committed Jul 22, 2016
1 parent ae6078f commit 6d93861
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 196 deletions.
4 changes: 3 additions & 1 deletion pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def work_on_cell(self, cell, position, include_fort_on_path):
json.dump(pokemon, outfile)
worker = PokemonCatchWorker(pokemon, self)
worker.work()
with open('web/catchable.json', 'w') as outfile:
json.dump({}, outfile)
if (self.config.mode == "all" or self.config.mode == "poke") and 'wild_pokemons' in cell:
for pokemon in cell['wild_pokemons']:
worker = PokemonCatchWorker(pokemon, self)
Expand All @@ -53,7 +55,7 @@ def work_on_cell(self, cell, position, include_fort_on_path):
worker = SeenFortWorker(fort, self)
hack_chain = worker.work()
if hack_chain > 10:
print('need a rest')
#print('need a rest')
break

def _setup_logging(self):
Expand Down
244 changes: 49 additions & 195 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,237 +17,91 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<div id="pokedex">
<div id="p1"></div>
<div id="p2"></div>
<div id="p3"></div>
<div id="p4"></div>
<div id="p5"></div>
<div id="p6"></div>
<div id="p7"></div>
<div id="p8"></div>
<div id="p9"></div>
<div id="p10"></div>
<div id="p11"></div>
<div id="p12"></div>
<div id="p13"></div>
<div id="p14"></div>
<div id="p15"></div>
<div id="p16"></div>
<div id="p17"></div>
<div id="p18"></div>
<div id="p19"></div>
<div id="p20"></div>
<div id="p21"></div>
<div id="p22"></div>
<div id="p23"></div>
<div id="p24"></div>
<div id="p25"></div>
<div id="p26"></div>
<div id="p27"></div>
<div id="p28"></div>
<div id="p29"></div>
<div id="p30"></div>
<div id="p31"></div>
<div id="p32"></div>
<div id="p33"></div>
<div id="p34"></div>
<div id="p35"></div>
<div id="p36"></div>
<div id="p37"></div>
<div id="p38"></div>
<div id="p39"></div>
<div id="p40"></div>
<div id="p41"></div>
<div id="p42"></div>
<div id="p43"></div>
<div id="p44"></div>
<div id="p45"></div>
<div id="p46"></div>
<div id="p47"></div>
<div id="p48"></div>
<div id="p49"></div>
<div id="p50"></div>
<div id="p51"></div>
<div id="p52"></div>
<div id="p53"></div>
<div id="p54"></div>
<div id="p55"></div>
<div id="p56"></div>
<div id="p57"></div>
<div id="p58"></div>
<div id="p59"></div>
<div id="p60"></div>
<div id="p61"></div>
<div id="p62"></div>
<div id="p63"></div>
<div id="p64"></div>
<div id="p65"></div>
<div id="p66"></div>
<div id="p67"></div>
<div id="p68"></div>
<div id="p69"></div>
<div id="p70"></div>
<div id="p71"></div>
<div id="p72"></div>
<div id="p73"></div>
<div id="p74"></div>
<div id="p75"></div>
<div id="p76"></div>
<div id="p77"></div>
<div id="p78"></div>
<div id="p79"></div>
<div id="p80"></div>
<div id="p81"></div>
<div id="p82"></div>
<div id="p83"></div>
<div id="p84"></div>
<div id="p85"></div>
<div id="p86"></div>
<div id="p87"></div>
<div id="p88"></div>
<div id="p89"></div>
<div id="p90"></div>
<div id="p91"></div>
<div id="p92"></div>
<div id="p93"></div>
<div id="p94"></div>
<div id="p95"></div>
<div id="p96"></div>
<div id="p97"></div>
<div id="p98"></div>
<div id="p99"></div>
<div id="p100"></div>
<div id="p101"></div>
<div id="p102"></div>
<div id="p103"></div>
<div id="p104"></div>
<div id="p105"></div>
<div id="p106"></div>
<div id="p107"></div>
<div id="p108"></div>
<div id="p109"></div>
<div id="p110"></div>
<div id="p111"></div>
<div id="p112"></div>
<div id="p113"></div>
<div id="p114"></div>
<div id="p115"></div>
<div id="p116"></div>
<div id="p117"></div>
<div id="p118"></div>
<div id="p119"></div>
<div id="p120"></div>
<div id="p121"></div>
<div id="p122"></div>
<div id="p123"></div>
<div id="p124"></div>
<div id="p125"></div>
<div id="p126"></div>
<div id="p127"></div>
<div id="p128"></div>
<div id="p129"></div>
<div id="p130"></div>
<div id="p131"></div>
<div id="p132"></div>
<div id="p133"></div>
<div id="p134"></div>
<div id="p135"></div>
<div id="p136"></div>
<div id="p137"></div>
<div id="p138"></div>
<div id="p139"></div>
<div id="p140"></div>
<div id="p141"></div>
<div id="p142"></div>
<div id="p143"></div>
<div id="p144"></div>
<div id="p145"></div>
<div id="p146"></div>
<div id="p147"></div>
<div id="p148"></div>
<div id="p149"></div>
<div id="p150"></div>
<div id="p151"></div>
</div>
<div id="pokedex"><div id="p1"></div><div id="p2"></div><div id="p3"></div><div id="p4"></div><div id="p5"></div><div id="p6"></div><div id="p7"></div><div id="p8"></div><div id="p9"></div><div id="p10"></div><div id="p11"></div><div id="p12"></div><div id="p13"></div><div id="p14"></div><div id="p15"></div><div id="p16"></div><div id="p17"></div><div id="p18"></div><div id="p19"></div><div id="p20"></div><div id="p21"></div><div id="p22"></div><div id="p23"></div><div id="p24"></div><div id="p25"></div><div id="p26"></div><div id="p27"></div><div id="p28"></div><div id="p29"></div><div id="p30"></div><div id="p31"></div><div id="p32"></div><div id="p33"></div><div id="p34"></div><div id="p35"></div><div id="p36"></div><div id="p37"></div><div id="p38"></div><div id="p39"></div><div id="p40"></div><div id="p41"></div><div id="p42"></div><div id="p43"></div><div id="p44"></div><div id="p45"></div><div id="p46"></div><div id="p47"></div><div id="p48"></div><div id="p49"></div><div id="p50"></div><div id="p51"></div><div id="p52"></div><div id="p53"></div><div id="p54"></div><div id="p55"></div><div id="p56"></div><div id="p57"></div><div id="p58"></div><div id="p59"></div><div id="p60"></div><div id="p61"></div><div id="p62"></div><div id="p63"></div><div id="p64"></div><div id="p65"></div><div id="p66"></div><div id="p67"></div><div id="p68"></div><div id="p69"></div><div id="p70"></div><div id="p71"></div><div id="p72"></div><div id="p73"></div><div id="p74"></div><div id="p75"></div><div id="p76"></div><div id="p77"></div><div id="p78"></div><div id="p79"></div><div id="p80"></div><div id="p81"></div><div id="p82"></div><div id="p83"></div><div id="p84"></div><div id="p85"></div><div id="p86"></div><div id="p87"></div><div id="p88"></div><div id="p89"></div><div id="p90"></div><div id="p91"></div><div id="p92"></div><div id="p93"></div><div id="p94"></div><div id="p95"></div><div id="p96"></div><div id="p97"></div><div id="p98"></div><div id="p99"></div><div id="p100"></div><div id="p101"></div><div id="p102"></div><div id="p103"></div><div id="p104"></div><div id="p105"></div><div id="p106"></div><div id="p107"></div><div id="p108"></div><div id="p109"></div><div id="p110"></div><div id="p111"></div><div id="p112"></div><div id="p113"></div><div id="p114"></div><div id="p115"></div><div id="p116"></div><div id="p117"></div><div id="p118"></div><div id="p119"></div><div id="p120"></div><div id="p121"></div><div id="p122"></div><div id="p123"></div><div id="p124"></div><div id="p125"></div><div id="p126"></div><div id="p127"></div><div id="p128"></div><div id="p129"></div><div id="p130"></div><div id="p131"></div><div id="p132"></div><div id="p133"></div><div id="p134"></div><div id="p135"></div><div id="p136"></div><div id="p137"></div><div id="p138"></div><div id="p139"></div><div id="p140"></div><div id="p141"></div><div id="p142"></div><div id="p143"></div><div id="p144"></div><div id="p145"></div><div id="p146"></div><div id="p147"></div><div id="p148"></div><div id="p149"></div><div id="p150"></div><div id="p151"></div></div>
<div id="map"></div>
<script>
var map;
var marker;
var markers = {};
var loc = {}, cachedLoc = {};
var tMarker;
var cMarker;
var tLoc = {}, cachedtLoc = {};
var cLoc = {}, cachedcLoc = {};
var inventory = {};
var playerInfo = {};
var pokedex = {};
var bagPokemon = {};
var bagItems = {};
var bagCandy = {};
var emptyDex = [];
var div = document.createElement('div');
var cInfo = {};
var catchable = {};
var pokemonArray = {};
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 50.0830986, lng: 6.7613762},
zoom: 8
});
setTimeout(function(){
placeTrainer();
addCatchable();
updateInventory();
setTimeout(function(){
setInterval(updateTrainer, 1000);
setInterval(addCatchable, 1000);
}, 5000);
}, 5000);
}
function placeTrainer() {
loadJSON('location.json?_=' + new Date().getTime(),
function(data) { loc = data; map.setZoom(16); map.panTo({lat: parseFloat(loc.lat), lng: parseFloat(loc.lng)}); },
loadJSON('location.json',
function(data) { tLoc = data; map.setZoom(16); map.panTo({lat: parseFloat(tLoc.lat), lng: parseFloat(tLoc.lng)}); },
function(xhr) { console.error(xhr);}
);
console.log("New Marker: Trainer - " + loc.lat + ", " + loc.lng);
marker = new google.maps.Marker({
console.log("New Marker: Trainer - " + tLoc.lat + ", " + tLoc.lng);
tMarker = new google.maps.Marker({
map: map,
position: {lat: parseFloat(loc.lat), lng: parseFloat(loc.lng)},
position: {lat: parseFloat(tLoc.lat), lng: parseFloat(tLoc.lng)},
icon: "image/trainer-icon.png"
});
}
function updateTrainer() {
loadJSON('location.json?_=' + new Date().getTime(),
function(data) { loc = data; map.panTo({lat: parseFloat(loc.lat), lng: parseFloat(loc.lng)}); },
loadJSON('location.json',
function(data) { tLoc = data; map.panTo({lat: parseFloat(tLoc.lat), lng: parseFloat(tLoc.lng)}); },
function(xhr) { console.error(xhr); }
);

if (loc.lat === cachedLoc.lat && loc.lng === cachedLoc.lng) return;
cachedLoc = loc;
console.log("Move Marker: Trainer - " + loc.lat + ", " + loc.lng);
marker.setPosition({lat: parseFloat(loc.lat), lng: parseFloat(loc.lng)});
loc.cells.forEach(function(item, i, arr) {
item.forts.forEach(function(fort, i, arr) {
if(!(fort.id in markers)) {
markers[fort.id] = new google.maps.Marker({
map: map,
position: {lat: parseFloat(fort.latitude), lng: parseFloat(fort.longitude)}
//icon: "image/trainer-icon.png"
});
if(('type' in fort) && (fort.type == 1)){
markers[fort.id].setIcon("image/forts/Pstop.png")
} else {
if(fort.owned_by_team == 0)
markers[fort.id].setIcon("image/forts/Gym.png")
if(fort.owned_by_team == 1)
markers[fort.id].setIcon("image/forts/Mystic.png")
if(fort.owned_by_team == 2)
markers[fort.id].setIcon("image/forts/Valor.png")
if(fort.owned_by_team == 3)
markers[fort.id].setIcon("image/forts/Instinct.png")
}
}

});

});

if (tLoc.lat === cachedtLoc.lat && tLoc.lng === cachedtLoc.lng) return;
cachedtLoc = tLoc;
console.log("Move Marker: Trainer - " + tLoc.lat + ", " + tLoc.lng);
tMarker.setPosition({lat: parseFloat(tLoc.lat), lng: parseFloat(tLoc.lng)});
}
function addCatchable() {
loadJSON('catchable.json',
function(data) { cInfo = data; },
function(xhr) { console.error(xhr); }
);
loadJSON('pokemondata.json',
function(data) { pokemonArray = data; },
function(xhr) { console.error(xhr); }
);
if(cInfo['latitude'] != undefined) {
if(cMarker == undefined) {
console.log("New Marker: Catchable Pokemon - " + parseFloat(cInfo['latitude']) + ", " + parseFloat(cInfo['longitude']));
cMarker = new google.maps.Marker({
map: map,
position: {lat: parseFloat(cInfo['latitude']), lng: parseFloat(cInfo['longitude'])},
icon: "image/icons/" + cInfo['pokemon_id'] + ".png"
});
}
console.log("Update Marker: Catchable Pokemon - " + parseFloat(cInfo['latitude']) + ", " + parseFloat(cInfo['longitude']));
cMarker.setPosition({lat: parseFloat(cInfo['latitude']), lng: parseFloat(cInfo['longitude'])});
cMarker.setIcon("image/icons/" + cInfo['pokemon_id'] + ".png");
}
if(cInfo['latitude'] == undefined && cMarker != undefined) {
cMarker.setIcon("image/icons/blank.png");
}
}
function updateInventory() {
loadJSON('info.json',
function(data) {
function(data) {
inventory = data;
playerInfo = filter(inventory, 'player_stats');
pokedex = filter(inventory, 'pokedex_entry');
Expand Down
1 change: 1 addition & 0 deletions web/pokemondata.json

Large diffs are not rendered by default.

0 comments on commit 6d93861

Please sign in to comment.