eileen12 / HaremHeroes Automatic

the harem is now in a loop of open and closing with out collecting money

DO you have the auto arena battles on? If so that maybe the problem cuz i have it too.

yeah i know where the problem is. its the thing that checks for the time to collect the salary it goes undefined.

Nevermind I see where the error is occuring. I'll start debugging soon

it has been a bug that happens if you read the patch notes on the front page

I'm not sure where they place the actual count for the timer now. They seem to have hidden it from where it used to be so I"m testing out a new method of collection. I'll continue to test it out when I can though. Will try to post an idea of the changes if I solve it.

Re: @MrKeeney:
Answer from sleazyfork :

Muffinmans
25 Jun Chrome
I've made a fix that auto checks every 30 seconds until I (or the author) can find where the devs have hidden the salary timers.

Change line 345 as follows

From
Cookies.remove('nextSalaryTime')
To
Cookies.set('nextSalaryTime',closestTime,{expires:new Date(new Date().getTime() + 30 * 1000)});

I thought of using something similar but I've been testing out using a solution that looks at the presence of the collect all button on the home page instead.

Alright. I think I have something functioning correctly. While the main developers are working on this to make a more elegant solution that uses the hidden timers, try setting your autoSalary block to this:

if (sessionStorage.autoSalary === "true" && busy === false) {
        Cookies.set('possibleSalaryTime', Number($("#collect_all .sum").attr('amount')));
        if (!isNaN(Cookies.get("possibleSalaryTime"))) {
            Cookies.set('nextSalaryTime', Cookies.get("possibleSalaryTime"));
        }
        if (Cookies.get("nextSalaryTime") > 0) {
          console.log("Time to fetch salary.");
          getSalary();
          busy = true;
        }
        else if (Cookies.get("nextSalaryTime") === "none") {
            if ($("nav div[rel='content'] a:has(.home)").attr("href") !== window.location.pathname) {
                console.log("Moving to home.");
                sessionStorage.autoLoop = "false";
                // Goto Home page.
                window.location = window.location.origin + $("nav div[rel='content'] a:has(.home)").attr("href");
                busy=true;
                return;
            }
            busy = false;
        }
    }

It would be great if someone could test that out on their end to confirm. It should emulate the timers close enough so that when you get the ability to collect all money, the script will collect. Without the need to check every 30 seconds.

Once you hit the main screen, that change should work without needing changes anywhere else. Pretty sure I kept the getSalary() function the same. I tested out changing it but it didn't seem necessary. If anyone runs into an error, please post here so I can take a look and try to recreate and debug it.

Re: @eileen12:

No problem. Glad I could contribute a little until you updated. And thanks for continuing to return to the script to update it for everyone! :)