-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unlimited protein usage #307
base: master
Are you sure you want to change the base?
Conversation
A "recent" update added 2 new vitamin types, Calcium and Carbos. This updates the listener in the "item bag" part of the "item" menu so each vitamin can be affected by this script. The pokemon list sorted for protein seems to work in console, but not in here so i used the in game code to get it to work. I also seperated the bypassProtein function from the "main" script for readability and changed variable name to better reflect the in-game change in vitamin mecanics. Also, this will most likely not work for the 4rth, 5th [...] vitamin added if more are added. To fix it, just add X new assignment in line 36 (but it would be great to use a better way to get this to work, this selector is shit). Line 43 and 44 are only used if the user doesn't click on the vitamin img element but on the text or the outer box.
A few suggestions:
And there's definitely some way to avoid that awkward interval. And probably better to just override |
yeah, i didn't take that much time to find a better selector, feel free to improve it of you like. About the interval, i think it is needed because the pokemon filtered list isn't loaded at the same time the click is made, but a bit after. There is only 3 listeners, one for each vitamin type. where is the all vitamin menu ? i haven't seen it yet, or maybe i forgot. Edit : |
Yes, the interval is used because the menu isn't part of the DOM at the time, but there are other options like tying the code to execute alongside other game functions or adding the listeners once during loading before the menu is hidden. Doesn't really matter though as the listeners definitely aren't the right approach—just noticed they also interfere with the button to remove vitamins. I rewrote the script to just modify |
A "recent" update added 2 new vitamin types, Calcium and Carbos. This updates the listener in the "item bag" part of the "item" menu so each vitamin can be affected by this script. The pokemon list sorted for protein seems to work in console, but not in here so i used the in game code to get it to work.
I also seperated the bypassProtein function from the "main" script for readability and changed variable name to better reflect the in-game change in vitamin mecanics.
Also, this will most likely not work for the 4rth, 5th [...] vitamin added if more are added. To fix it, just add X new assignment in line 36 (but it would be great to use a better way to get this to work, this selector is shit).
Line 43 and 44 are only used if the user doesn't click on the vitamin img element but on the text or the outer box.