コード例 #1
0
 def latlng(self):
     location = self.info.get('locationE6')
     if not location:
         return None
     return utils.LatLng(location['latE6'] * 1e-6, location['lngE6'] * 1e-6)
コード例 #2
0
 def latlng(self):
     return utils.LatLng(self.latE6*1e-6, self.lngE6*1e-6)
コード例 #3
0
import utils
import ingress

import logging;logging.getLogger().setLevel(logging.INFO)
log.enable_pretty_logging()

something = """
.##.....##.########.##.......##........#######.....##......##..#######..########..##.......########.....####
.##.....##.##.......##.......##.......##.....##....##..##..##.##.....##.##.....##.##.......##.....##....####
.##.....##.##.......##.......##.......##.....##....##..##..##.##.....##.##.....##.##.......##.....##....####
.#########.######...##.......##.......##.....##....##..##..##.##.....##.########..##.......##.....##.....##.
.##.....##.##.......##.......##.......##.....##....##..##..##.##.....##.##...##...##.......##.....##........
.##.....##.##.......##.......##.......##.....##....##..##..##.##.....##.##....##..##.......##.....##....####
.##.....##.########.########.########..#######......###..###...#######..##.....##.########.########.....####
"""
start_at = utils.LatLng(39.9943428, 116.3864975).goto(270, 200)
i_meter = 4
j_meter = 4

ingress = ingress.Ingress()
ingress.login()

logging.info('get pen...')
pens = {}
ingress.update_inventory()
for guid, item in ingress.inventory.iteritems():
    name = '%s_%s' % (item.type, item.level) if item.level else item.type
    pens.setdefault(name, []).append(guid)
pens_cnt = {}
for pen_type, cnt in pens.iteritems():
    logging.info('%s x%d' % (pen_type, len(cnt)))
コード例 #4
0
ファイル: auto_hack.py プロジェクト: binux/ingress-api
            ingress.update_inventory()
            break
        except Exception:
            continue
    log_session = database.LogSession()

    logging.info('query portals...')
    portals = ingress.session.query(database.Portal)\
            .filter(database.Portal.ignore == 0)\
            .filter(database.Portal.group == group).all()
    logging.info('gen path...')
    path = gen_path.find_path(portals)
    max_portal = max(path, key=lambda x: x.guid)
    max_index = path.index(max_portal)
    path = path[max_index:] + path[:max_index]
    pre = utils.LatLng(path[-1].latE6 * 1e-6, path[-1].lngE6 * 1e-6)
    total_len = 0
    for each in path:
        cur = utils.LatLng(each.latE6 * 1e-6, each.lngE6 * 1e-6)
        total_len += cur - pre
        pre = cur
    logging.info('path total length: %fkm, need %fh' %
                 (total_len / 1000, total_len / ingress.speed_limit / 60 / 60))

    for portal in itertools.cycle(path):
        if not _continue:
            break
        try:
            # move
            need_time = ingress.goto(portal, wait=False)
            logging.info('goto %s need %ds' % (portal, need_time))
コード例 #5
0
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<*****@*****.**>
#         http://binux.me
# Created on 2013-01-25 23:13:54

import time
#import numpy
import cmath
import random
import logging
#import Pycluster

import utils
import database
TOTAL_GROUP = 7
LAT_FIX = (utils.LatLng(40, 116) - utils.LatLng(39, 116)) / 1000
LNG_FIX = (utils.LatLng(40, 116) - utils.LatLng(40, 117)) / 1000


def draw_group(portals, tofile='group.kml'):
    import simplekml
    styles = [
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/blank.PNG',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker1.png',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker2.png',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker3.png',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker4.png',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker5.png',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker6.png',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker7.png',
        'http://s.binux.me/ingress/icons/smallSQGreenIcons/marker8.png',