Skip to content
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

Egg incubation checks during PokeStop farming, and logging for hatch-events #907

Merged
merged 3 commits into from
Jul 27, 2016

Conversation

patrikwlund
Copy link
Contributor

@patrikwlund patrikwlund commented Jul 27, 2016

Edit: See new comment below

Still doesn't log hatch-events though, since ctx.Client.Inventory.GetHatchedEgg(); doesn't seem to return anything. Perhaps because the inventory (which includes pokemon) has already been refreshed?

@patrikwlund
Copy link
Contributor Author

Since this PR hasn't been merged yet, I added additional functionality to it.

We now have hatch events for eggs. However, they are not based not actual hatch events from the server, because those turn up empty (for whatever reason). Instead, the client now remembers what the incubators stored previously and checks if there's a non-egg pokemon with that ID now (=hatched).

The incubator state is stored in: /bin/Temp/Incubators.json and doesn't require any kind of manual setup.

Not a very good solution, but it works.

@patrikwlund patrikwlund changed the title Run egg incubation checks during PokeStop farming (normal and GPX) Egg incubation checks during PokeStop farming, and logging for hatch-events Jul 27, 2016
@patrikwlund
Copy link
Contributor Author

Since no one else has tested this yet:

I've had this running since I pushed it. Here's a screenshot of me hatching a zubat in-between pokestops. This covers both the frequency-commit and the hatching-commit. Would still be good if someone other than me tried it out though.

incubator

@@ -12,6 +17,8 @@ namespace PoGo.NecroBot.Logic.Tasks
{
internal class UseIncubatorsTask
{
private static readonly string IncubatorUsagePath = Path.Combine(Directory.GetCurrentDirectory(), "Temp", "Incubators.json");
Copy link
Contributor

@Ilses Ilses Jul 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this will break with multiple profiles.

@5andr0
Copy link
Contributor

5andr0 commented Jul 27, 2016

Good find @ Ilses
You can use it like that:

        private static string IncubatorUsagePath;

        public static async Task Execute(Context ctx, StateMachine machine)
        {
                IncubatorUsagePath = Path.Combine(ctx.LogicSettings.ProfilePath, "Temp", "Incubators.json");

                string folder = Path.GetDirectoryName(IncubatorUsagePath);
                if (!Directory.Exists(folder))
                {
                        Directory.CreateDirectory(folder);
                }

You can also use the already existing Logs directory instead of Temp. Otherwise you would have to check for its existence and create it

@Ilses
Copy link
Contributor

Ilses commented Jul 27, 2016

I think I'd rather see:

private static readonly string IncubatorUsageFile = settings.ConfigPath + Path.DirectorySeparatorChar + "incubators.json"

...since the variable is a file, and not a path.

@patrikwlund
Copy link
Contributor Author

Since it's neither a config nor a log, I think "Temp" fits better. It's not something you should include in your config backups.

@Ilses
Copy link
Contributor

Ilses commented Jul 27, 2016

Fair enough. I'd still like the var renamed, but now I'm just picking nits ;)
I'll try it out pretty soon and let you know how it works.

@patrikwlund
Copy link
Contributor Author

Made a commit for ProfilePath now. Also changed variable name to "...FilePath". A good compromise :)

@bjornegrim
Copy link
Contributor

using this with no issues, merged myself with the latests commit, good work!

@Pakobbix
Copy link

can confirm.. it's pretty awesome to really hatch them while the bot runs and knowing the pokemon you got in your egg..

@5andr0
Copy link
Contributor

5andr0 commented Jul 27, 2016

Ready to merge, thanks for the profile path integration. Good work

@NecronomiconCoding NecronomiconCoding merged commit 743b541 into NecronomiconCoding:master Jul 27, 2016
@patrikwlund patrikwlund deleted the Incubation branch July 27, 2016 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants