PokemonGo-Bot
PokemonGo-Bot copied to clipboard
[LVL 40] TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Traceback (most recent call last):
File "pokecli.py", line 865, in
haha... sorry I've not reach level 40 yet...
Can you change your inventory.py at line 115 to the following and let me know if it solve the problem?
if self._level < 40:
if value >= self.next_level_xp:
self.level = self._level + 1
# increase next_level_xp to a big amount
# will be fix on the next heartbeat
self.next_level_xp += 10000000
self._exp = value
I'll push for the fix once you get back to me
@MerlionRock It doesn't work. When I do print(self._level)
, it shows None
.
I replied to a USER in Slack about a month ago, suggesting a possible fix. They did what I suggested plus one additional edit and stated they were able to spin/catch again at level 40. Here is the convo snippet, hope it helps.
crvfts [12:16 PM] perhaps u can increase the MAX_LEVEL in inventory.py to 41 and then add something like " 41, 5000000, 25000000 " in xp_per_level.json so u can keep catching and spinning. may work. also may need to "level_limit": 41 in config
USER [2:32 PM] Thx @crvfts I changed the exp.setter in inventory.py from =self_level + 1 to = self_level in addition to your other suggestion and spinning and catching works.
I can confirm that the following modifications work for me at level 40. However, running an account at lower levels with these modificiations will fail, so i cannot recommend it as a general code modification.
inventory.py: <self.level = self._level +1> changed to <self.level = self._level>
xp_per_level.json add line <41, 10000000, 300000000> config.json, or whatever you named your config file: <level_limit: 41>
Seems like changing level_limit in config.json was not necessary. However, I forgot I had also disabled UpdateLiveStats in config.json. It won't run with the UpdateLiveStats task set to true.
I don't have a level 40 account to troubleshoot this error. If anyone willing lend me an account to troubleshoot this error, please PM me in discord.
Preferably that account doesn't matter to you at all. (Because there might be a lot of invalid calls to server which might get account flagged or worst, banned)
try this to fix: inventory.py : swap line 131 with 130, after changes it should be like this:
self.level = item.get('level', 0)
self.exp = item.get('experience', 0)
the second change would for UpdateLiveStats task, which uses xp_per_level.json file. just add new entry with some fake data, like :
[
41,
50000000,
200000000
]
Third change is to update_live_stats.py around line 259. Make it like this:
level_completion_percentage = 100
if whole_level_xp > 0 :
level_completion_percentage = int((current_level_xp * 100) / whole_level
Please let us know how it works for you (EDITED to fix to update_live_stats.py)
It runs, but still issues with the update_live_stats.
ok, some characters missing above perhaps: Runs fine now, including update_live_stats task
level_completion_percentage = 100 if whole_level_xp > 0 : level_completion_percentage = int((current_level_xp * 100) / whole_level_xp)
note - I set level_limit = 42.. in config.json. At 41 it stopped - "You have reached your target level".
@pogarek perhaps also need to make edit in update_live_stats.py at L147
[39, 3000000, 15000000],
[40, 5000000, 20000000],
[41, 5000000, 20000000],
[42, 5000000, 20000000]
along with what you just suggested.
seems you could also set lvl 42 to a huge number so you don't need to accommodate for an infinite number of theoretical level increments. just have one final level of 41 or 42 that would take forever to complete.
@pogarek, you want to create a PR for this?
Let's get it tested first 😁
@pogarek: your solution works fine, what about a PR for it?
Thanks