-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raids [BACKEND ONLY] #306
base: develop
Are you sure you want to change the base?
Raids [BACKEND ONLY] #306
Conversation
0.4 has not been released yet so use the latest commit from the develop branch instead.
Use asynchronous spawn cache in pogeo.monotools.
Remove dependence on shapely and geopy, improve performance of landmarks, automate landmark pickling/unpickling, read landmarks from config as a sequence of dicts instead of a Landmarks object, a little refactoring, miscellaneous fixes.
Add an example script for converting old-style landmarks configurations (constructing an actual Landmarks instance in config.py) with the new-style of using standard Python data-types (a tuple/list of dicts).
monocle/db.py
Outdated
pokemon_id = Column(TINY_TYPE) | ||
cp = Column(TINY_TYPE) | ||
move_1 = Column(SmallInteger) | ||
move_2 = Column(SmallInteger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do the moves matter at all? as everyone will get something else after catching it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moves are the same for everyone in the battle against the raid boss. Thus it is a strategy part knowing if he has certain moves
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you sure? what i heard is not same when in battle and after caught
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't use it but that could be usefull to counter him
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@walaoaaa1234 the moveset is the same for the raid boss battle but afterwards we get a randomized moveset for the capturable version.
monocle/db.py
Outdated
raid_level = Column(Integer) | ||
complete = Column(TINY_TYPE) | ||
pokemon_id = Column(TINY_TYPE) | ||
cp = Column(TINY_TYPE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the CP not the same for the same pokemon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the CP of the boss ;) Not everytime the same imo
fort_raid['pokemon_id'] = fort.raid_info.raid_pokemon.pokemon_id | ||
fort_raid['cp'] = fort.raid_info.raid_pokemon.cp | ||
fort_raid['move_1'] = fort.raid_info.raid_pokemon.move_1 | ||
fort_raid['move_2'] = fort.raid_info.raid_pokemon.move_2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these lines (after if fort.HasField('raid_info'):
) should be part of normalize_raid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already does...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the code should be moved to the normalize_raid
method
only leaving {} here
if fort.HasField('raid_info') and fort not in RAID_CACHE:
db_proc.add(self.normalize_raid(fort_raid))
@@ -27,7 +27,7 @@ | |||
from monocle.utils import get_address, dump_pickle | |||
from monocle.worker import Worker | |||
from monocle.overseer import Overseer | |||
from monocle.db import FORT_CACHE | |||
from monocle.db import FORT_CACHE,RAID_CACHE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put a space in between :)
fort_raid['pokemon_id'] = fort.raid_info.raid_pokemon.pokemon_id | ||
fort_raid['cp'] = fort.raid_info.raid_pokemon.cp | ||
fort_raid['move_1'] = fort.raid_info.raid_pokemon.move_1 | ||
fort_raid['move_2'] = fort.raid_info.raid_pokemon.move_2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the code should be moved to the normalize_raid
method
only leaving {} here
if fort.HasField('raid_info') and fort not in RAID_CACHE:
db_proc.add(self.normalize_raid(fort_raid))
monocle/worker.py
Outdated
fort_raid['pokemon_id'] = "" | ||
fort_raid['cp'] = "" | ||
fort_raid['move_1'] = "" | ||
fort_raid['move_2'] = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be set to 0
as they are being saved as integer
Can you do a rebase with whitespace / newline fix? |
Everything should be stable now. Tell me if you still have some troubles |
I'm not sure why it happens, but when I run locally on my windows pc, it works fine. So it looks like it isn't able to write the data to the fort_raids table (because that stays empty) and that is clogging upp the writing to the DB. |
Can you drop fort_raid table, rerun create_db and retest it plz? (Don't forget to pull the lastest version of the PR) |
Removing everything and reinstalling it all seems to have worked. However, the update function seems to be clogging it all up now. |
monocle/db.py
Outdated
cp = '{cp}', | ||
move_1 = '{move_1}', | ||
move_2 = '{move_2}', | ||
notifDiscord = NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notifDiscord has to be removed in order for the update function to work.
Corrected notifDiscord ;) |
monocle/db.py
Outdated
raid_spawn_ms = Column(Integer, index=True) | ||
raid_end_ms = Column(Integer, index=True) | ||
raid_level = Column(Integer) | ||
complete = Column(TINY_TYPE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This need to be boolean for postgresql
__tablename__ = 'fort_raids' | ||
id = Column(Integer, primary_key=True) | ||
fort_id = Column(Integer, ForeignKey('forts.id')) | ||
raid_seed = Column(String(50)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
postgresql complain this
psycopg2.ProgrammingError: operator does not exist: character varying = bigint
LINE 3: WHERE fort_raids.raid_seed = -6036655490970226155 AND fort_...
monocle/db.py
Outdated
cp = '{cp}', | ||
move_1 = '{move_1}', | ||
move_2 = '{move_2}', | ||
notifDiscord = NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notifdiscord
not exist in the table defination
I just want to make sure that this will work with |
Ok Im testing this out and Im getting a bunch of MySQL errors when the raid hasn't started yet since move_1, move_2, etc can not be "None" since they are smallint according to your specs, so the only thing that can be saved at this point are actual raid battles, not raid eggs. Update 1: Ok I set it so that those fields could be NULL and that fixed that problem. My raid seed is a negative number.. is that correct? |
Yep the raid_seed is a negative number for what i saw |
@sebast1219 Im unsure if I have the proper MySQL column types, do you have a create table that I can compare to? Also as I've been running this it doesn't seem like the raids are updated. I get when the initial raid is going to start, so all the moves, etc are NULL, but they never update to the actual raid info when it starts. I have a bunch of NULL in the database and only a very few that actually have the raid info after it has started, but I have a feeling that it was the first time it put those raids in the database and the raid was going when that happened.. so basically it doesn't seem to be updating the raid info. Also is there a way to keep track of when a raid is going to start and then deploy an account to get the raid info, just like a spawnpoint TTL? |
@sebast1219 I know I asked on the gym one, but maybe a combo of gym and raid webhook? So when a gym changes teams and also when a raid is announced and starts? |
Raid infos are implemented, feel free to add this fuctionnality on the frontend (I'm just using a personnal discord bot)
Table fort_raids
Fields :
pokemon_id,cp,move_1 and move_2 are updated when raid battle starts