OpenPoGoBot icon indicating copy to clipboard operation
OpenPoGoBot copied to clipboard

incubation priority doesn't work, always incubates in order of decreasing distance

Open cantelope opened this issue 9 years ago • 3 comments

Expected Behavior

With these settings: "incubation_fill": true, "incubation_use_all": true, "incubation_priority": ["2km", "5km", "10km"], "incubation_restrict": { "2km": 901 }, I expect 2km eggs to be incubated first and on the unlimited incubater only.

Actual Behavior

10km and 5km eggs were incubated first. As a low level player, I only have the unlimited incubater.

Steps to Reproduce

Set incubation_priority as above.

Other Information

Eggs are always considered in decreasing distance: eggs_by_distance = sorted(eggs, key=lambda x: x.total_distance, reverse=True)

It seems that the incubation priority is only referenced in: for egg_distance in bot.config.incubation_priority:

And the egg_distance is only referenced in checking whether there is an egg restriction: try: egg_restriction = int(bot.config.incubation_restrict[egg_distance])

There's no check whether the distance of the current egg being considered matches the egg_distance.

cantelope avatar Aug 14 '16 10:08 cantelope

Another egg incubation bug. Not sure if related or if i should file separately?

Steps to Reproduce

Ok, I've just leveled up and received limited use incubators (902) as a reward. I've also changed the line eggs_by_distance = sorted(eggs, key=lambda x: x.total_distance, reverse=True)

into eggs_by_distance = sorted(eggs, key=lambda x: x.total_distance, reverse=False) on my copy to attempt to get the eggs to incubate in increasing order.

Expected Behaviour

limited incubators should incubate the 5km egg first, since 2km eggs should only incubate on the unlimited incubater due to "incubation_restrict"

Actual Behaviour

limited incubaters were also filled with 2km eggs.

cantelope avatar Aug 14 '16 10:08 cantelope

Probably related.

wchill avatar Aug 14 '16 10:08 wchill

Rectricting egg type to incubator is also completely wrong. Below is how I fixed it for me. I'm ignoring config files because I'm not very familiar yml parsing. My desired settings are hardcoded - priority 2km, 10km, 5km, restrict 2km to unlimited.

eggs_by_distance = sorted(eggs, key=lambda x: {2: 0, 10: 1, 5: 2}[x.total_distance])
for egg in eggs_by_distance:
     if len(incubators) == 0:
         log("No more free incubators ({}/{} in use)".format(in_use_count, len(inventory["egg_incubators"])), "yellow")
         return

     egg_restriction = 901 if egg.total_distance is 2 else None
     if egg_restriction is None:
         incubator = incubators.pop()

Something similar should be done but instead this should be read from yml.

xasdf avatar Aug 15 '16 21:08 xasdf