Roukys / HHauto

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

Incorrect work of the script on the test server (28MAR). #719

Closed UncleBob800 closed 1 year ago

UncleBob800 commented 1 year ago

Apparently, the developers have changed something in the game and now most of the timers (for example, market timer, next PoP timer, etc) of the script have broken, and the battle with the champions does not function correctly (the script cannot recognize that the battle with the champion has already taken place and tries to attack the champion again and again , which already has a 15 minute cooldown)

I would also like to recommend separating the "test server" version of the script from the main script version. This is at least logical, because this way you can immediately make a version for a future update, and when Kinkoid releases an update on a live server, you just need to Ctrl+C Ctrl+V the script code from the "test server" version to the main version. It will also save players from conflict situations when your script works on a live server, but does not work on a test one due to the difference in the versions of the game itself. After all, if you change the main script for test.heroeshentai.com now, then perhaps this script will stop working on the live server. I think it would be logical if there are two files on the github: HHAuto.user.js and TestHHAuto.user.js

Dimka2010 commented 1 year ago

what i see broken: 1) club section with champions. Did it OFF. 2) did OFF pure champions too. 3) did OFF league section bot start working but still broken PoP and Market timers - bot return and return to check it many-many times

UncleBob800 commented 1 year ago

3. but still broken PoP and Market timers - bot return and return to check it many-many times

@Dimka2010 I found this one-minute timer that restarts the market cyclically, and changed it to 30 minutes (everything is better than 1 minute). Replace this line let shopTimer=60; with let shopTimer=1800;. This will not fix the problem, but at least the script will stop restarting the market frequently. Also too for PoP: replace setTimer('minPowerPlacesTime',60); with setTimer('minPowerPlacesTime',1800);

rilitili commented 1 year ago

Has anyone found a solution to the club champion? Today is the day we needed this feature the most.

tsokh commented 1 year ago

@Dimka2010 @UncleBob800 @rilitili I managed to fix market timer, still working on POP timer. Basically, the methods used for getting the remaining timer values are broken at the moment

tsokh commented 1 year ago

@Dimka2010 @UncleBob800 @rilitili Fixed POP timer as well - also added a function for DoAll on POP to set maxTimer for triggering the collection from POP list to have an actual real user activity. hhauto--fixed.txt

rilitili commented 1 year ago

@tsokh does your script fix the club champion?

tsokh commented 1 year ago

@rilitili No, not yet. Found another bug with mission timer - keeps resetting on empty list to default 10min. Another fix introduced. hhauto--fixed.txt

UncleBob800 commented 1 year ago

I think that it is necessary to make the option to turn off the market timer. To tell the truth, I have long wanted to ask for such an opportunity, because this forced transition to the market for any reason is really annoying. It goes there even if I have turned off all the auto-purchase options in the market (and if these options are turned off for me, then there is no point in auto-going to the market). At the moment, my script freezes precisely because it enters the market every time and freezes with the error that is in the screenshot image

rilitili commented 1 year ago

@UncleBob800 That issue is especially annoying for people who use multiple tabs. Each tab ends up performing redundant visits to the market.

It would be great if this got altered as you said.

tsokh commented 1 year ago

@UncleBob800 strange, but for me works fine. Check shopFrozenTimer value while shop is opened $('.shop div.shop_count span[rel="expires"]').first().text(); or add console.log($('.shop div.shop_count span[rel="expires"]').first().text()) to that line and debug

UncleBob800 commented 1 year ago

@tsokh I found the reason for this bug. Your edits do not take into account other localizations of the game. Set, for example, the language to Japanese and it will also stop working for you.

tsokh commented 1 year ago

@UncleBob800 yes, found the issue but it happens only with Japanese symbols - I'll try to fix the method later. @rilitili it seems kinkoid completely broke the clubs page as they even changed the access page to "" so it can't be accessed through regular page redirection

rilitili commented 1 year ago

@tsokh Can we alter the club champion code then? Make the code more simplified. Go directly into /club-champion.html to so the fighting every 15-17 minutes. No need to enter /clubs.html

We would lose the ticket limit ability, but it's a way to make the thing work, as we just need to manually enable this feature once a week anyway.

UncleBob800 commented 1 year ago

@tsokh I found that the timers for the CollectAll option for PoV, PoG, and Seasons also don't work, which can cause the script to fire prematurely. image Also, in addition to Japanese, the timer does not work when using Cyrillic. In general, the modified code accepts only localization with Latin characters (which is quite logical, given how the convertTimeToInt() function works). Any ideas how this can be changed?

UncleBob800 commented 1 year ago

Regular (not club) champions do not work correctly. The attack of the first champion starts, but after it the script each time goes to the first champion and returns to the main page and repeats in a circle until its cooldown ends. The script does not even reach the rest of the champions, leaving them idle. I don't know what Kinkoid did in this shitty update, but I really hate them. How to make useful innovations that their people ask for - they ignore it for years. But to make another useless update that ruins everything and breaks - oh yes, they just love it.

UncleBob800 commented 1 year ago

Another bug. If I personally attack a champion (any) before the script timer expires, then when the script tries to attack the champion, it will lead to a cyclic refresh. The script fails to detect that the champion is already on cooldown and tries to revisit the page over and over again to attack instead of just updating the timer until the next launch.

Franck-75 commented 1 year ago

And now, all the bugs are on production.

tsokh commented 1 year ago

@UncleBob800 I have some idea to recode it for all translations, but I need to get symbols for hours,minutes and seconds for each translation. Can you help with that? On nutaku there is no russian, only Japanese. @rilitili try to use the following: verify that you can battle the champion, set "Force" option and then enable battling, it can go to other section of code and set the timer to default 15mins instead of validating non-existent timer. @Franck-75 it was on nutaku live yesterday)

Dimka2010 commented 1 year ago

English = Russian = short russian hours = часы = ч minutes = минуты = мин seconds = секунды = сек

tsokh commented 1 year ago

@Dimka2010 @UncleBob800 New implementation for multiple languages - same fixes as above (only POP, mission after completion, market timers) - verified on Japanese locale. Also found one bug within my fixes for mission timer. Work required:

tsokh commented 1 year ago

Non-working:

tsokh commented 1 year ago

Non-working:

tsokh commented 1 year ago

@deuxge some improvement to do:

Both resolved by most recent script fix

deuxge commented 1 year ago

Thanks to provide some fixes already. I had no time this week to have a look to this game update. I just added your changes and try to fix the rest in the next few days.

deuxge commented 1 year ago

@tsokh Did you have a look to getLanguageCode() ?

tsokh commented 1 year ago

@deuxge Yes, but at that time I didn't want to mess with translations texts. Couldn't find a global variable so had to play with HHAuto_Lang - cleaned up my script and verified that it's still working hhauto--fixed.txt .

tsokh commented 1 year ago

@deuxge also found function parseTime(inTimeString) but it's used only once in a whole script so maybe we can leave only one function

UncleBob800 commented 1 year ago

https://github.com/zoop0kemon/hh-plus-plus I found that the HH++ BSDM script is still displaying some timers, maybe their script gets this data somehow differently. It seems to me that it makes sense to study their script in order to understand how the interaction with the game takes place. At least after the game update, their script suffered the least, the only patch they had was to restore the button for hiding defeated opponents in the League. Simply put, the rest of the script was not subject to incompatibility issues. Also, the script does not have any bugs in different localizations. Either they already have provision for reading data at different localizations, or their script receives the timer information in a different way. I can't figure out what's going on in their script because I don't know JS. Also, I don’t know in what form the timer information comes from the server to the game page, in the form of initial data (a huge number of seconds converted into days, hours, minutes and seconds on the client side) or immediately in the final form.

tsokh commented 1 year ago

@UncleBob800 displaying the timers is a little bit different than trying to convert them - you don't need localizations to display the values in different languages since the objects selectors are still the same (unless there's another game patch that changes elements definitions). our bot actually relies on server timer variables, which are passed to client side, but they have been removed by recent game patch that's why every function that placed some timer for actions is broken. I've checked HH++ BSDM script and found how they retrieve info about timers - I can't say that it's prone to game updates and their method can't be used as a solution that will work on all timer pages, e.g. regular champs timer not working in BSDM

deuxge commented 1 year ago

Hello, This script is using a timer attribute that as been removed or renamed as well. We will find a solution, but I (or we) need time to work on this.

deuxge commented 1 year ago

I just push the changed proposed by tsokh and added a small one. It should now solved the champions issues. v15.11.4

Non-working or to be checked:

tsokh commented 1 year ago

@deuxge Error on club champion on 5.11.4: Uncaught TypeError: Cannot read properties of undefined (reading 'htmlDom') at Proxy.indicateBestTeam (chrome-extension://dhdgffkkebhmkfjojejmpbldmpobfkfo/userscript.html?name=HaremHeroes%2520Automatic%252B%252B.user.js&id=872abce6-cb05-42e4-88af-6132b83742e3:1224:22)

tsokh commented 1 year ago

@deuxge to check:

Non-working:

Dimka2010 commented 1 year ago

about solution with champ timers. maybe you look into this script too? https://gist.githubusercontent.com/Tom-208/a5c7065866fe1de5032aabbbd1ed9eff/raw/HH-game-script.js they updated it some times in last 2 days.

Dimka2010 commented 1 year ago

and another script with auto-collector functions https://sleazyfork.org/en/scripts/436188-hentai-heroes-helper-auto-collect-button-press-and-more/versions updated yesterday too. maybe some ideas we can take from here too?

tsokh commented 1 year ago

Seems like regular champs are broken in 5.11.14 after @deuxge fixes. Had to re-introduce my fixes hhauto--fixed.txt

tsokh commented 1 year ago

Follow-up fixes for CollectAll PoV and CollectAll PoG (seasonal events as I can tell are resetting to some defaults, but maybe will fix that too). Leagues still not touched. hhauto--fixed.txt

UncleBob800 commented 1 year ago

Replcae 'ru':{days: "д", hours: "ч", minutes: "мин", seconds: "сек"}, with 'ru':{days: "д.", hours: "ч", minutes: "м", seconds: "с"},

tsokh commented 1 year ago

@UncleBob800 thx for correct symbols - for those unsupported symbols there's now a debugging log so it'll be easier to find in case of broken translations. Fixed script: hhauto--fixed.txt

UncleBob800 commented 1 year ago

image How realistic is it to take the values of variables from their localization files? This would optimize the work of determining the desired values. The script itself would automatically use for the search those characters that are written in the localization file. So if suddenly the developer wants to make any changes there, then your script will automatically adapt to such changes.

UncleBob800 commented 1 year ago

image Given the fact that now minutes and seconds will not be displayed if the timer shows the end in a few days and hours, then you need to slightly change the way the timer works. The most logical thing is to make a second timer function that would count days and hours until the timer approaches 1 hour and only then call the first timer function, which is designed to work with hours, minutes and seconds. Otherwise, the script will fire prematurely, either 1 hour before the actual end of the timer in the game, or even a day before(I'm not sure if hours will be displayed if the timer says 20 days for example), all depending on how this crappy new timer is displayed in the game. It is possible that the developer intentionally made such a crappy timer to break the automation script. At least I don't remember any of the players asking to reduce the output of the information in the timers. In fact, no one needed this at all, because it is always more pleasant to know more accurate data than the conditional "event will end in X days"

tsokh commented 1 year ago

@UncleBob800 Yes, you're right, but it's better not rely on server variables - based on recent patches I see a trend of removing everything) I removed "default" 5min addition to timer so it'll not be skewed and left only debugging line about symbols. For PoV and PoG this will have no impact - the timer gets renewed each time on page and the default next action there is every 4 hours, so when the timer will get to lesser values, it'll update accordingly. CollectAll is by default set to 12 hours before event end, so it'll work fine. hhauto--fixed.txt

UncleBob800 commented 1 year ago

The most logical thing to do is to make a condition that would determine whether there are days in the time string and whether there are no minutes in the string, and if the condition is met, then a temporary timer will be saved, which after X days and Y hours will start re-identification of a more accurate timer end time, provided that minutes appeared in the time line (seconds can be neglected, I think)

tsokh commented 1 year ago

@UncleBob800 there's already a default timer of 4hours for next action in pog/pov, so I don't see the reason to introduce new timers. "How realistic is it to take the values of variables from their localization files?" - not realistic in all of instances of HH, on nutaku there's no such arrangement and in iframes it's impossible to do, better stick with current realization.

UncleBob800 commented 1 year ago

@tsokh

Yes, you're right, but it's better not rely on server variables - based on recent patches I see a trend of removing everything

However, at the same time, there will be problems with fixing the script if the creator of the script does not know the language, the localization of which was changed by the developer For example, the developer wanted to display "Days" instead of the abbreviated d. To make your script work properly, you will have to find out the correct spelling of this word for each localization language and enter it into the script code. At the same time, if the developer, in addition to the word, also wants to change the name of the variable, then here you just need to change the name of this variable once in the script, instead of changing the word 7 times for each localization language. I do not think that these bastards will change localization variables every update, it will be a pain for them to change the name of the variable in each localization file. Removing/renaming a selector in a CSS file is not the same as editing 7 localization files when the developer himself may not know 6 out of 7 languages

UncleBob800 commented 1 year ago

This is the localization file on the main server https://www.hentaiheroes.com/phoenix-tr_labels-en-1464.js

And this is on Nutaku https://nutaku.haremheroes.com/phoenix-tr_labels-en-1464.js

In fact, the file is the same, only the domains differ. In the script, you have implemented the definition of the game version (main, test, nutaku, etc.) If the script implements the function of accessing the phoenix-tr_labels-[locale]-[number].js file, then we will always receive up-to-date localization data for the language that will be in the index. I also noticed that if I refer to the file phoenix-tr_labels-en-1.js or even phoenix-tr_labels-en-.js, then I get exactly the same file without any differences. Therefore, I did not quite understand why those numbers are needed there.

UPD A list of what to insert after the domain to open the localization file.

/phoenix-tr_labels-en-.js
/phoenix-tr_labels-de_DE-.js
/phoenix-tr_labels-es_ES-.js
/phoenix-tr_labels-fr-.js
/phoenix-tr_labels-it_IT-.js
/phoenix-tr_labels-ja_JP-.js
/phoenix-tr_labels-ru_RU-.js

At the same time, if such a file does not exist on the server (as, for example, with ru localization on Nutaku), then the server will automatically load en localization for such a url

tsokh commented 1 year ago

@UncleBob800 here's my attempt to do dynamic localization, which will do what you ask - still I'd rather use constant variable and place this info hard-coded as those devs can easily change everything again and it's easier to fix simple variable in our code than again verify the missing/broken server JS. hhauto-dynamicLocale.txt .

tsokh commented 1 year ago

Can someone clarify what's currently broken with league timers - seems that it's working fine?

deuxge commented 1 year ago

I just integrated the fixes proposed by tsokh. I will review the rest of the non wokring feature soon.

UncleBob800 commented 1 year ago

@tsokh

  • Also introduced some fixes for those using BSDM script (No opponents detected problem)

Hmm, strange, but for me the League worked together with BSDM all this time even before work began on fixing timer bugs. Or are you talking about a bug when PowerCalc calculates the chances of winning only on the second attempt?

Also I realize this is not really the right time, but can you integrate the code from this thread? https://github.com/Roukys/HHauto/issues/715 Everything is ready there, you just need to add it to the code (just in case, I made a ready-made version with the current version of HHAuto, since I myself personally checked the performance with BSDM and OCD)