Roukys / HHauto

GNU General Public License v3.0
45 stars 44 forks source link

Some of my ideas, PoP and Leagues stuff #38

Closed Tucho1m closed 3 years ago

Tucho1m commented 3 years ago

@Roukys Nice job you did with HH I didn't know that github could be used this way. First, thank you for your work and time.

In all the scripting attempts I was doing, I found things that can help a little to reduce POP load that repeats 3x3 times.

*- You can collect all the rewards at once, but with one condition, that all the PoPs have finished the time and have given the reward. If this condition is met, on the page activities -> place of power you can collect all the rewards. By doing this you are free to go to Autofill things.

*- It is not recommended to return to the home page (harem) when the function is running, only when it has been completed. Example: I finish doing the Autofill then go back to activities -> places of power. And then you go find the time. All completed tasks return to the home page.

*- A problem to be considered is whether the "Autofill" of all PoPs is done in a one-time function, since it takes time and if it is interrupted, it has to "know" where it was interrupted to continue from there (or repeat).

*- In the same way that you collected the rewards you can also collect the time of each PoP in activities -> places of power. all in 1 attempt but only if all PoPs were completed.In my script, I only saved the longest wait time, with this I made sure that all the PoPs have finished the tasks.

I know that several things I said are not very "compatible" with the way you programmed PoP. But I think that in the long run this will be a problem if more PoPs are added, and that this single function will be very time consuming, as it is more likely to be "interrupted by another function", there is the option to activate the "busy function". But it is not fully implemented in all other features and all should be checked to work properly.

It is recommended that AutoPoP be executed under the protection of the "Busy" function and if the execution is "interrupted" by the page refresh, force the repetition of the last function that was executed with "busy" activated.

It is important when you first start in HH and have a low level to be able to select which PoP you want to do, because it does not have enough power to do others that are not your main stat. For the other top tier players I'd like it to "auto-detect" how many PoPs are available and do all of them (In my script add 1 more to the total, just in case ...). This worked quite well in mi case. Integrate this with "what PoP do you want to do?" this would be a new button next to "PowerPlaces" that says "All" and then "Index Filter". When "All" is enabled it ignores "Index Filter" and do all PoP available. I love the "AutoShits" stuff.

This is a lot to consider, I just wanted to say my point of view, implementing all this is a lot of long-term work and testing, if the "All" button is added for places of power, I'm happy with just that :)

On the other hand, the "Autoleague" function does not collect the reward when one league ends and another begins, directly fight, leaving the "reward" to collect on the league screen and you do not see the players, a user should not be able to fight if I did not collect the reward. This is solved by adding below line 1470 this: $('#leagues_middle .forced_info button[rel="claim"]').click(); //click reward

All I said is to make the script "look" a bit more to a normal user. Wow I didn't want to write that much but if I wanted to be specific, I hope everything I wrote is understood.

Roukys commented 3 years ago

hello @Tucho1m,

Glad to see you here :)

Many good ideas here,

my thoughts : 1 : yes very good idea, I'll try to separate collect from autoFill :) would be much more effective 2 I'll check but normally should not do it I'm using a for loop to parse through the powerplaces :) 3 same thing, the for loop combined with the fact I'm keeping each counter should do the trick => counter launched means autofill is done 4 : same as one

for autoleague I'll open it as a new enhancement :)

by the way, even if I'm just familiarizing myself with github, if you're willing to help for code I'm taking :D

Branches are very useful to test on developpement

Roukys commented 3 years ago

in fact on pop_thumb div there is now a status :)

Roukys commented 3 years ago

@Tucho1m I've rewriten Powerplaces : https://github.com/Roukys/HHauto/raw/PopDelay-issue/HHAuto.user.js

Was only able to test once though ...

Tucho1m commented 3 years ago

Excellent! To know if it works well, the scrip has to do 4 complete cycles without problems, why 4 cycles? Well, in many of my attempts to program it I used the ".each" parameter and found that it tends to bugi, on the second or third cycle, I don't know why but it didn't work for me, I went into the ".each" loop and i stayed frozen there ... but it only happened in the second or third loop, i didn't understand why ... then i changed it to "while" with a "flag" to repeat the process x times i mean lines 513 to 518 ,.

By 4 cycles I mean letting the script run and calling the function 4 times in a row without interruption. What I describe above is a problem I have with the ".each" is just my experience, it does not mean the same thing happens. I hope the scrip complete 4 cycles without problems, we will know in 28 hours ...

What I noticed when testing it is that when the function was going to get only the remaining time for the next PoP, after obtaining it, not return to the home page. The funcion only go to home page after getting the remaining time.

The PoP timeline: Home goes to activities -> PoP and gets all the rewards

In activities-> PoP goes to every PoP and "Autofill" stuff and goes back to activities-> PoP (repeats this for every PoP)

In activities-> PoP and gets the remaining time.

Last In activities-> PoP goes Home. (This is what it doesn't do)

Roukys commented 3 years ago

added in new version :) Thanks for your valuable inputs :)

https://github.com/Roukys/HHauto/raw/PopDelay-issue/HHAuto.user.js

Tucho1m commented 3 years ago

I found a problem, when the "Autofill" function of PoP is interrupted, 1 or 2 PoP are not activated, depending on where it is interrupted. To solve this, it should be count if there is X remaining times in activities -> PoP screen, if the number of times found is different from the number of available PoPs, the entire PoP function must be restarted. In other words 2 times were found, but it should be 3, restart.

Roukys commented 3 years ago

@Tucho1m strange it should be taken by the popToStart storage still keeping the PoP which remains to start

Tucho1m commented 3 years ago

It's strange, because he got the time but only 2 of the 3 PoP had activated ...

Tucho1m commented 3 years ago

Nutaku was updated to the new interface ... after several problems with cache files I can continue testing, and I think the problem with PoP time is that it loads it in 2 different functions ... Eliminating lines 596 to 646 I think that solved the problem with the time and the interruption of the function. Now it's time to wait for another cycle ...

I do not understand why the time is loaded in both functions in lines 520 to 563 and also in 596 to 646, I think that's why when it was interrupted, they didn't go through the remaining PoPs again, because it has a valid storage time (from lines 520 to 563)

I delete from 596 to 646 and I'm testing if PoP works fine.

Roukys commented 3 years ago

@Tucho1m last working version seems promising : https://github.com/Roukys/HHauto/raw/PopDelay-issue/HHAuto.user.js

getting the timers by the powerplace main page only therefore make sure too launch them.

I'm still not explaining why it need to go 2 time to some powerplaces to be able to autofill then start ...

Tucho1m commented 3 years ago

I don't know if this experience is going to help you. I don't understand much about javascrip, but little by little I am learning. Something like this happened to me when I programmed my old version of the srcip and I did not understand why when I used this line [sessionStorage.autoLoop = "false";] it worked, but without that it did not work ... javascrip is not my strength and I did not understand in what it changed if there was that or not .. so how it worked (it did what it had to do) I left it.

If you skip one or two PoP because it is interrupted, the best option would be to only save the time if it finds all 3 times and save the longest time. And if it only finds 1 or 2 times, it would have to calculate what the missing PoP is and do the collect + autofill in that PoP.

Roukys commented 3 years ago

in fact in the collect I'm getting the to start status of the Pop, thus preventing to miss one. Last try this evening was good I'll check the next ones same thing I'm learning, that's a strange language ...

Roukys commented 3 years ago

in fact it seems that getting button with $() do not update if you click on one button the second is not always updated ...

Roukys commented 3 years ago

I'm trying to move to document.querySelector ...

But my last version at least is able to do all :)

Tucho1m commented 3 years ago

I see, try this: instead go from PoP1 to PoP2, go to PoP1, do the "autofill" and then go to activities-> PoP and then to PoP2.

Roukys commented 3 years ago

I'll check, but I think even the first one sometimes needs 2 go to be able to autofill then start

Tucho1m commented 3 years ago

Maybe it's because when you use the "autofill" the page changes, and this is not reflected in the script? and "think" that its working with the previous state of the page? Is this why it does not "find" the button ... or because the script is faster than the loading of the page?

The way you describe it looks like something like this ... but I don't know, I'm just guessing xD

Roukys commented 3 years ago

same thing, I've got a version ready for next Pop using document;queryselector I'll see otherwise the current version do work, even if sometimes it needs 2 go of Pop to be able to start it

Roukys commented 3 years ago

Seems I've got a stable version : https://github.com/Roukys/HHauto/raw/PopDelay-issue/HHAuto.user.js

Tucho1m commented 3 years ago

This that I am going to mention is not a problem. I was testing the script and noticed that the PoP2 and PoP3 have an extra minute of phase shift with respect to the PoP1 (which ends one minute earlier), can this be due to the 30 seconds of the 688 line? If I change it to 25 and in lines 561, 584 and 588 I add an extra minute, this would tend to have all the PoPs end up within the range of that extra minute, right?

Roukys commented 3 years ago

I don't think so because it add the 30 secs to nextPowerPlaceX which is no more used for the moment, to check I'm only using the minPowerPlaces you can see in function collectAndUpdatePowerPlaces how it is dealt with :)

Tucho1m commented 3 years ago

_I understand, so if I add 1 extra minute to minPowerPlaces, it would solve the possible phase changes that are produced by the interruptions of the PoP function, which represents the total time since the PoP function started until it finished completing everything. More than 1 minute should not take no matter if there are 15 different PoPs.

Always using minPowerPlaces is the best option, if minPowerPlaces + 60sec> maxPowerPlaces the phase shifts will correct itself._

Forget this .. if the phase shifts is minPowerPlaces + 60sec<maxPowerPlaces, this will incrmentar it ....mmm

Roukys commented 3 years ago

otherwise you could use the maxPowerPlaces ;)

Roukys commented 3 years ago

I'm using min because can happen that in the futur a new pop can last much more than other.

Therefore I do prefer to go multiple time to Pop but make sure they are ok.

but we can maybe add a fixed time to min when getting it

Tucho1m commented 3 years ago

If I use maxPowerPlaces and go through PoP1 but PoP2 and PoP3 still have 2 minutes, the time for the next PoP will be 7 Hs ... and I don't activate PoP2 and 3 ... but the phase shift will correct lol ..

The situation would be times remaining (in the worst case scenario): PoP1: 5min, PoP2: 7min, PoP3: 12Min And Total time remaining: 5min

If I use maxPowerPlaces: PoP1: 7Hs, PoP2: 3min, PoP3: 7Min And Total time remaining: 7H If I use minPowerPlaces: PoP1: 7Hs, PoP2: 3min, PoP3: 7Min And Total time remaining: 3min

To solve this, you should use minPowerPlaces as total time and add the difference between Tmax and Tmin

Tdif (sesion storage variable)=maxPowerPlaces - minPowerPlaces + 1s (This must always be greater than or equal to 1) minPowerPlaces = minPowerPlaces + tdif

From this the result would be: PoP1: 5min, PoP2: 7min, PoP3: 12Min And Total time remaining: 12min It is important to understand that these 12 min are not the "maxPowerPlaces" they are minPowerPlaces + Tdif,

It would tend to regularize all the times, that the times are regular would be the most "normal" situation since the users would do all the PoP at the same time, or would they tend to that ...

I'm confused, I don't know if this is correct or not..

Tucho1m commented 3 years ago

Or instead of playing with the timings, just wait for all the PoP timings to run out before collecting all the rewards? This only if it detects that there are rewards to collect, and waiting times in Actitivies -> PoP. I think this is easier.

OldRon1977 commented 3 years ago

I would not like to wait for all PoPs to be finished. At the moment this might not be a problem, but in the future with let's say 9 PoPs there is a good chance that you can't staff all PoPs with girls so that they finish within 7h. Maybe one or two will run for 15h... Then we will loose effective PoPs. For me, I can live with PoPs that run differently, as long as I know the script will fetch them all and start them all in the order I gave :) I hope that makes sens to you too :)

Tucho1m commented 3 years ago

@OldRon1977 Has a good point there. I was going a little crazy with this, but if I think about it, it's not a problem, but I liked to think of the solution to this as a challenge haha xD

Roukys commented 3 years ago

@Tucho1m I'm like @OldRon1977 I do prefer the script to the Pop as soon as they have finnished, thus using the min time :)

for exmple in test I've got only one Pop given my level, and it takes days ... if you wait that you loose many runs of other pops...