grcrt / grcrt-script

GRCRT is "the" userscript for MMO web-browser strategy game Grepolis.
https://www.grcrt.net
GNU General Public License v3.0
14 stars 7 forks source link

WW page constantly refreshing #48

Closed Shuri2060 closed 4 years ago

Shuri2060 commented 4 years ago

Description

The window for Individual WWs (where you send resources/favor) constantly refreshes. This only happens when you have over 400 favor in all 6 gods.

I think this is due to this line of code:

setTimeout(function(){RCGP.reloadContent()},100)

at

https://github.com/grcrt/grcrt-script/blob/0915dc9dbd8b3700bb7886d416d64f204c9fd73b/modules/RepConvGRC.js#L2724

It reloads the window content after 100 ms, but in doing so the function is called again. This happens whenever the counter counting down _shotTime goes to 0.

How to reproduce the problem

Expected behavior

No constant refreshes

Actual behavior

Continuous constant refreshes

How often

In en122

Additional information

Shuri2060 commented 4 years ago

To fix this issue, add an if statement that only executes lines 2720 - 2726 if _shotTime isn't 0.

            if (_shotTime) { 
                            CM.register({main : RCGP.getContext().main, sub:"casted_powers"}, 'grcrt_countdown', _elem.countdown2({
                                            value : _shotTime,
                                            display: 'readable_seconds_with_days'
                                        }).on('cd:finish', function() {
                                            setTimeout(function(){RCGP.reloadContent()},100)
                                        })
                            );
            }
tomaski commented 4 years ago

hey @Shuri2060 thanks for taking the time to open the Issue. That function's purpose is/was to reload the window so that the button to shorten the build can be clicked as soon as it becomes possible (otherwise you'd need to close and re-open the window).
Apparently, since that function was written, something's changed in Grepo code (as it always does). The problem is: we have no way of verifying your solution (or troubleshooting ourselves) because we do not have an account on a WW world 😕 and we cannot blindly update the script as it will affect tens of thousands people using it. Would you be interested in running some code inside your console window if needed?

Shuri2060 commented 4 years ago

Yeah sure.

tomaski commented 4 years ago

:tada: This issue has been resolved in version 5.0.10 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: