twitch-points-autoclicker icon indicating copy to clipboard operation
twitch-points-autoclicker copied to clipboard

Collected points counter Rework

Open PorTuna opened this issue 3 years ago • 9 comments

Its randomly increased from 2 to 52

PorTuna avatar Jul 12 '20 11:07 PorTuna

Can confirm that I am having issues with the collected points counter as well. Checked the console logs and the autoclicker functionality is indeed still collecting points so it is just an issue with the counter updating somewhere in that pipeline. My counter has been stuck on 63890 points for the past couple weeks. Running on Chrome 85.0.4183.102 (Official Build). Happy to provide more information if it helps!

Sushiimi avatar Sep 16 '20 21:09 Sushiimi

Yup, twitch made some changes to how points are displayed, so I'm gonna have to rework that. Thanks for your reports!

xinitrc-dev avatar Sep 16 '20 21:09 xinitrc-dev

For sure! Happy to help, thanks for the great extension :+1:

Sushiimi avatar Sep 16 '20 23:09 Sushiimi

Woulda of been nice if they didn't hide it behind a react modal :)

svn-dys avatar Sep 28 '20 23:09 svn-dys

Alrighty, I've made an executive decision to just change the amount of points collected to amount of times said points are collected. Should be live in 1.6 update that is currently being pushed to supported webstores.

xinitrc-dev avatar Jan 14 '21 01:01 xinitrc-dev

Was this decision done because you couldn't find a solution to reading how many points were collected per grab? If that's the case, I know a solution to finding out how many points were grabbed when a chest is clicked.

svn-dys avatar Jan 14 '21 16:01 svn-dys

Yeah, it was either trying to go through the react element or wait for the hint to pop up. The hint timing would depend on how fast the browser can render said pop-up and thus is a pain to grab as well

xinitrc-dev avatar Jan 14 '21 16:01 xinitrc-dev

Can use mutations observer to permanently look for hint/small popup after clicking points, thus eliminating any performance issues, timing issues, etc. https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

Would look something like:

MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var observer = new MutationObserver(function(mutations, observer) {
    mutations.forEach(function(mutation) {
         if (mutation.type == "attributes") {
             if (mutation.attributeName == "id") {
                 if ((mutation.target.innerHTML).includes("100")) {
                        // You have found the +100 point hint/popup. Now add to your point pool and 
                           update chrome.storage.sync
                        // Do this for every point variant. e.g 70,60,50 points.
                    })
                 }
             }
         }
    });
});

observer.observe(document, {
    subtree: true,
    attributes: true
    //...
});

This code snippet is from my point clicker. The mutation is looking for the "100" within all elements that are created on the page. Of course it could be refactored to be more precise or even structured to find that specific element... just was too lazy to do so.

Here's the element you're looking for in the mutations: qFh6LCcWQN

svn-dys avatar Jan 14 '21 17:01 svn-dys

ooh, interesting. I Will look into this, thank you!

xinitrc-dev avatar Jan 14 '21 17:01 xinitrc-dev