| 51 | |
| 52 | |
| 53 | class PokemonGoBot(object): |
| 54 | @property |
| 55 | def position(self): |
| 56 | return self.api.actual_lat, self.api.actual_lng, self.api.actual_alt |
| 57 | |
| 58 | @property |
| 59 | def noised_position(self): |
| 60 | return self.api.noised_lat, self.api.noised_lng, self.api.noised_alt |
| 61 | |
| 62 | #@position.setter # these should be called through api now that gps replication is there... |
| 63 | #def position(self, position_tuple): |
| 64 | # self.api._position_lat, self.api._position_lng, self.api._position_alt = position_tuple |
| 65 | |
| 66 | @property |
| 67 | def player_data(self): |
| 68 | """ |
| 69 | Returns the player data as received from the API. |
| 70 | :return: The player data. |
| 71 | :rtype: dict |
| 72 | """ |
| 73 | return self._player |
| 74 | |
| 75 | @property |
| 76 | def inbox(self): |
| 77 | """ |
| 78 | Returns the inbox data as received from the API. |
| 79 | :return: The inbox data. |
| 80 | :rtype: dict |
| 81 | """ |
| 82 | return self._inbox |
| 83 | |
| 84 | @property |
| 85 | def stardust(self): |
| 86 | dust = filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0] |
| 87 | if 'amount' in dust: |
| 88 | return dust['amount'] |
| 89 | else: |
| 90 | return 0 |
| 91 | |
| 92 | @stardust.setter |
| 93 | def stardust(self, value): |
| 94 | dust = filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0] |
| 95 | if 'amount' in dust: |
| 96 | dust['amount'] = value |
| 97 | |
| 98 | def __init__(self, db, config): |
| 99 | |
| 100 | self.database = db |
| 101 | |
| 102 | self.config = config |
| 103 | super(PokemonGoBot, self).__init__() |
| 104 | |
| 105 | self.fort_timeouts = dict() |
| 106 | self.pokemon_list = json.load( |
| 107 | open(os.path.join(_base_dir, 'data', 'pokemon.json')) |
| 108 | ) |
| 109 | self.item_list = json.load(open(os.path.join(_base_dir, 'data', 'items.json'))) |
| 110 | # @var Metrics |