Jump to content

Community Scripts [Links in OP]


DvDivXXX
 Share

Recommended Posts

It seems that they decided to change the string data to numeric data on all pages to fix the auto-assign for the labyrinth. I was surprised at how bold the bug fix was.

I think all the fixes are done, but if there are any bugs in the scripts that are not fixed, please do not hesitate to let me know.

  • Thanks 4
Link to comment
Share on other sites

@renalove

In league I do now get the following error

Uncaught QuotaExceededError: Failed to execute 'setItem' on 'Storage': Setting the value of 'HHBattleSimulator.TeamData' exceeded the quota.
    at le (chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:12538)
    at he (chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:12841)
    at ye (chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:13120)
    at chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:66478
    at async chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:65972
    at async chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:61899

I cleared this value. When opening the team selection page, the error re-appears. It contains the (small) data of a single team, but the script seems to try adding something much larger (too large).

It is a bit difficult for me debug this in the minified version of the script. If you cannot replicate, a formatted debug version with full function and variable names would help.

Link to comment
Share on other sites

Your localStorage exceeds the maximum authorized for a website.

You should go into devtools and delete keys like HHPlusPlusPlus.League.Snapshot.Previous.

Or write in console `localStorage.removeItem("HHPlusPlusPlus.League.Snapshot.Previous")`

Its size is 3.43MB in my browser but I don't really care about past week league results now.

I encountered the same problem but I went a different way by modifying my browser configuration to authorize 30MB per website but I don't recommend it.

Edited by mdnoria
  • Thanks 1
Link to comment
Share on other sites

11 hours ago, Horsting said:

In league I do now get the following error

Uncaught QuotaExceededError: Failed to execute 'setItem' on 'Storage': Setting the value of 'HHBattleSimulator.TeamData' exceeded the quota.
    at le (chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:12538)
    at he (chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:12841)
    at ye (chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:13120)
    at chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:66478
    at async chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:65972
    at async chrome-extension://jinjaccalgkegednnccohejagnlnfdag/Hentai%20Heroes%20Battle%20Simulator%20v4.user.js#14:20:61899

I cleared this value. When opening the team selection page, the error re-appears. It contains the (small) data of a single team, but the script seems to try adding something much larger (too large).

It is a bit difficult for me debug this in the minified version of the script. If you cannot replicate, a formatted debug version with full function and variable names would help.

That error occurs when there is not enough free space in the local storage. You need to delete other data to free up space. HHBattleSimulator.TeamData requires about 100KB of free space.

If you are interested in debugging, the non-minified version is available here.
https://github.com/rena-jp/hh-battle-simulator-v4/raw/main/dist/hh-battle-simulator-v4.dev.user.js

  • Thanks 1
Link to comment
Share on other sites

Thanks guys. I forgot that there is the overall local storage size limit, instead (or in addition to) per-key limit. Indeed cleaning up a bit worked. HHPlusPlusPlus.League.Snapshot.Previous is never generated in my case in the first place, but instead I need to delete HHPlusPlusPlus.League.Snapshot.Current manually every week after league reset. I guess this is for the very same reason.

Now, when visiting the Harem, HH++ fails to store its HHPlusPlusGirlDictionary, so cleanup is not sustainable. I checked everything and there is no unnecessary/leftover key, all actively used or quickly re-generated. Of course I could clear champ and Pachinko log data from Zoo's recorders, but I actually would like to preserve these. Villain drops are reset already (regularly after events).

Do you guys face these issues as well regularly? Here is my scripts, so nothing uncommon:

image.thumb.png.7686de03b742d3aaf61a030b04889563.png

My own one does not store anything, just hides some more elements and disables transitions/animations.

Link to comment
Share on other sites

Thanks, it is indeed 430i's HH+++ (current) league snapshot which fills up all alone 😄. Seems like I am visiting the league much too often. I do not want to loose the data of lost points etc. I would love to remove some individual timestamps from it which are only seconds apart from each other, e.g. when changing from defensive to offensive team and back, but sadly I see no way to do such properly. One can edit values, but then you have the whole value in a single line selected in a 100 characters width field or so. There is a nice tree view below, but that does not allow editing.

HHPlusPlusPlus.League.Snapshot.Current = 9495.99 KB

I read again into the topic, and Chrom(ium) indeed hard-codes the 5 MiB limit (strangely in my case it is 10 MiB in size, probably they upped it). For larger keys, like the girls directory, league opponents data and such, the IndexedDB with its 50 MiB limit and asynchronous access seems much better suited. However, it is more difficult to use. There are libraries which aim to simplify it for simple key-value storages: https://github.com/DVLP/localStorageDB

But having to include a 3rd party library into the own project is of course another decision one is not always happy with. But the methods used could be reviewed/taken, of course.

EDIT: Okay, deleted the league snapshots now. @430i, probably this is a particular issue with my active play style, but I checked the snapshot data structure:

  • In addition to the player points, it contains boosters, (crit?) change, ego, damage etc. Are you using this data for other features? It is not contained in the CSV export at least, and I think it is also of minor interest for most.
  • The snapshot timestamp could be used as index in epoch format (in case converted back for export), and the player ID as index for the contained player data.
  • The rank is not really required when the points are given, as you can sort by points to get the same result. It is inaccurate if two players have the same amount of points, but that will rarely happen and even less play any role.
  • The export could then actually contain players sorted by name of ID in lines, and timestamps in columns, i.e. points in fields of a date-player table, which allows generating nice diagrams as well. That is also more compact, as it does not contain the date 100 times for each player in each snapshot. Sorting by rank (at a specific timestamp) is still possible via sorting by points (the whole table by the specific timestamp column), if wanted.
Edited by Horsting
  • Like 1
Link to comment
Share on other sites

Two minor things regarding scripts:

a. At PoP with @zoopokemon script, the symbol showing which class the girls bel9ng to disappear after starting it. It's a very minor thing, just weird that it's gone after starting the PoP.

b. At the league with @renalove rena's script, I don't see the buttons to check the best boosters/skills after selecting a specific opponent (at the personal opponent screen). I see the buttons at the main league screen, but when I go to a specific opponent screen, these buttons are nowhere to be seen.

Edited by OmerB
  • Like 1
Link to comment
Share on other sites

1 hour ago, OmerB said:

a. At PoP with @zoopokemon script, the symbol showing which class the girls bel9ng to disappear after starting it. It's a very minor thing, just weird that it's gone after starting the PoP.

They show up here while PoPs are running. Is it only temporary until you reload the page or navigate back and forth?

1 hour ago, OmerB said:

b. At the league with @renalove rena's script, I don't see the buttons to check the best boosters/skills after selecting a specific opponent (at the personal opponent screen). I see the buttons at the main league screen, but when I go to a specific opponent screen, these buttons are nowhere to be seen.

This was the case for me when my local storage was full. In case you use 430i's script, try to remove the old opponent data (the [x] beside the symbol with the 3 heads), in case the buttons even show up, else manually via developer tools.

Link to comment
Share on other sites

@430i

Needs review and testing (on next league reset), but here is an update I did to your script to have player data invalidated on league reset and some other things:

Addition to LeagueTableModule to set an invalidation flag on league reset:

    run(config) {
        if (this.hasRun || !this.shouldRun()) {return}

        // Set player data invalidation flag on league reset
        if (config.load_player_data) {
            $(document).on('league:rollover', () => {
                let players_data = JSON.parse(storage.getItem(LEAGUE_PLAYERS_KEY)) || {};

                for (var r = 0, n = players_data.length; r < n; r++) {
                    if (players_data[r] != undefined) {
                        players_data[r].invalidate = true;
                    }
                }

                storage.setItem(LEAGUE_PLAYERS_KEY, JSON.stringify(players_data));
            })
        }

EDIT: Probably better to do this despite config.load_player_data being false, to assure that possible previously stored data is updated as fast as the checkbox is enabled (and if a league reset happened in the meantime)?

Setting it to false in collectPlayerPlacementsFromAjaxResponse:

        const data = {
            id: parseInt(id),
            number_mythic_equipment,
            best_placement: d3_placement[0],
            placement_count: d3_placement[1],
            invalidate: false,
        };

And in addPlayerSelectHandler, request new data if the flag is not set to false. Could be inverted, but I wanted to test it right now and have my data updated. And it does work well:

            if (opponent.best_placement != undefined && opponent.invalidate == false) {
                return false;
            }

And another thing: In my case rotating the snapshot data never worked, because temporarily the already large key is duplicated. Hence it makes sense to remove the current data from local storage before storing it (from variable) as previous data:

        $(document).on('league:rollover', () => {
            const data = LeagueScoutModule.getCurrent();

            LeagueScoutModule.deleteCurrent();
            LeagueScoutModule.setPrevious(data);
        })

There is a theoretical chance for data loss, if a crash happens between the two commands or storing the data fails for some reason. But it is IMO better than a state where the whole script and other scripts are not usable anymore, because local storage is full. The CSV download/clear buttons are not even visible in my case until I manually remove the key.

And finally in the "still boosted" detector, there was a bug preventing it from detecting any still boosted stats (ego => remaining_ego), I added harmony (rare, but players could boost with Jujubes only), and I removed the large debug logs:

            if (!boosted_data) {
                return;
            }

            if (
                opponent.player.damage >= boosted_data.damage &&
                opponent.player.remaining_ego >= boosted_data.ego &&
                opponent.player.defense >= boosted_data.defense &&
                opponent.player.chance >= boosted_data.chance
            ) {
                const element = $(this).find('.data-column[column=boosters]');
                element.addClass('active_skill');
            }

There was no opportunity to test this part yet. The last opponent with expiring boosters had its stats updated immediately.
EDIT: Works, this ego is still boosted, hence stats in red:
image.png.51c44a1d547c058025072673b055724a.png

EDIT2: Some time later, when the ego finally dropped:
image.png.fc2814184f86862c5ace0473af5c5cc4.png

I attached this version of the script. But to everyone: keep in mind that I am no experienced JS coder, so might have done some mistake. Take it for testing.

HH+++.js

Edited by Horsting
  • uwu 1
Link to comment
Share on other sites

20 hours ago, Der DinX said:

Very nice, many thX 😍

Np, I added support for TPSH and GPSH in v1.39.0 along with the labyrinth module.

 

18 hours ago, DvDivXXX said:

I'm liking the Laby module a lot, it was well worth the wait! Thanks, @zoopokemon. ❤️

Still got some more things planned for the labyrinth module

  • Showing battle end state on skip
  • An option to replace girl's "total power" with the sum of their HC/CH/KH stats and have it sort by that instead. (Maybe also add the ability to sort by each of those stats)
  • Show current relics in the team edit menu, or otherwise show the effects of the relics (it's annoying that the tooltip doesn't show the increase to stats from any relics).

Eventually it would be great if we could get a sim for labyrinth, but we are far from understanding how the battle system works to be able to do that.

  • Like 3
  • Hearts 2
Link to comment
Share on other sites

40 minutes ago, zoopokemon said:

Still got some more things planned for the labyrinth module

Maybe also a way to show the existing relics on the relic selection screen? I never remember what relics I picked so far, especially if it was some element buff, so it would be helpful to look it up.

  • Like 2
Link to comment
Share on other sites

1 hour ago, EpicBacon said:

And my girls seems to have so much ego that its displayed twice

Some of the stuff I put in the labyrinth module was stuff rena already had their own implementations of in their script, so you'll have to disable those conflicting modules.

1 hour ago, 430i said:

Maybe also a way to show the existing relics on the relic selection screen? I never remember what relics I picked so far, especially if it was some element buff, so it would be helpful to look it up.

Someone else also wanted to be able to view their girls while selecting relics. Since the selection is on the main lab page I might be able to just make it so you can open up the squad and relic tabs before selecting.

  • Like 2
Link to comment
Share on other sites

@zoopokemon would it be possible to make the numbers for critical damage more distinct in the labyrinth?
Like changing the color or something? Just to  make it really easy to see if its a critical hit or not? Its not that much difference between normal and critical hits right now, and I really have to pay attention when trying to test relics.

  • Like 1
Link to comment
Share on other sites

12 hours ago, EpicBacon said:

@zoopokemon would it be possible to make the numbers for critical damage more distinct in the labyrinth?

image.png.40732fe9edc30075b72ca26262f70afb.pngWould this work? 

41 minutes ago, Horsting said:

I didn't think about this, but should be possible. I only wonder how to catch the element with developer tools (to see its classes) before it fades 😄. Will see whether I can do this in my today's run and post the results here.

"#battle .impact_text_animation.bigger" would be the css selector your looking for. It's applied when

image.png.53b5ff72265cd6ad81a1d1c832e06c87.png

I believe is_execution is when the "Finish Move" relic activates.

I've actually gone and copied a lot of the game's code so I can then copy player, opponent, and response data to freely playback the battle step by step to better analysis everything.

  • Hearts 2
  • Juicy peach 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...