ensingm2/saliengame_idler

Fix bug in Valve's code

ensingm2 opened this issue · 4 comments

in network.js, if CServerInterface.prototype.LeaveGameInstance() is called, and the ajax request is successful but the 'x-eresult' header is not set to '1' in the response, a copy-pasted error callback function will be called. The function error() is not defined in LeaveGameInstance as it is in the functions that call was copy-pasted from, leading to an error.

This should be fixed, as it can halt our script. Whether or not it's better to create an 'error' var that handles it, override the entire LeaveGameInstance() call, or some other solution, I'll have to look into.

Mentioned in issue #50 & PR #60

Seems this is happening semi-frequently at the end of boss-battles as well. I really wish this was more reproduce-able, as I don't actually run this script often (I know, I don't idle the game I created an idler for, blasphemy).

Thinking a decent solution may just be to define the error function to just force a zone switch. I might do that if this continues being an issue.

I got this.
`Planet # 530 has higher XP potential. Switching to it. Bye planet # 526
Attempting to move to Planet # 530

Uncaught ReferenceError: error is not defined
at Object. (network.js?v=:262)
at j (jquery-1.11.1.min.js?v=.is:2)
at Object.fireWith [as resolveWith] (jquery-1.11.1.min.js?v=.is:2)
at x (jquery-1.11.1.min.js?v=.is:4)
at XMLHttpRequest.b (jquery-1.11.1.min.js?v=.is:4)

https://steamcommunity-a.akamaihd.net/public/javascript/saliengame/network.js

Detected the game script is locked. Trying to unlock it.
:817 Array(531)
:886 Planet # 530 has higher XP potential. Switching to it. Bye planet # 526
:155 Attempting to move to Planet # 530
:155 Detected the game script is locked. Trying to unlock it.
:817 Array(531)
:886 Planet # 530 has higher XP potential. Switching to it. Bye planet # 526
:155 Attempting to move to Planet # 530
:155 Detected the game script is locked. Trying to unlock it.
:817 Array(531)
:886 Planet # 530 has higher XP potential. Switching to it. Bye planet # 526
:155 Attempting to move to Planet # 530
:155 Detected the game script is locked. Trying to unlock it.
:817 Array(531)
:886 Planet # 530 has higher XP potential. Switching to it. Bye planet # 526
:155 Attempting to move to Planet # 530
:155 Initializing Planet Selection Menu.
:155 At Planet Selection
:817 Array(531)
:886 Planet # 530 has higher XP potential. Switching to it. Bye planet #undefined
:1047 Object "success" Object
:155 Initializing Battle Selection Menu.
:155 Updating grid
:683 Successfully updated map data on planet: 530
:155 Getting best zone
743 Array(2)
:852 Found new best zone: 87
:376 Round successfully started in zone # 87
:377 Object
:817 Array(531)
:155 Ending Round
:556 Successfully finished the round and got expected data back:
:557 Level: 17
EXP: 10319060
:558 Object
:155 Updating grid
:683 Successfully updated map data on planet: 530
:155 Getting best zone
:743 Array(2)
:856 Current zone # 87 is already the best. No need to switch.
:376 Round successfully started in zone # 87
:377 Object
:817 Array(531)
:155 Ending Round
:556 Successfully finished the round and got expected data back:
:557 Level: 17
EXP: 10321460
:558 {response: {…}}
:155 Updating grid
:683 Successfully updated map data on planet: 530
:155 Getting best zone
:743 (2) [87, false]
:856 Current zone # 87 is already the best. No need to switch.
:376 Round successfully started in zone # 87
:377 {response: {…}}
:817 (531) [empty × 41, 37, empty × 484, 29, 46, empty, 47, 196019]
`
And finally it's dead with Join Planet Error on screen and ask to reload the game. But through some time:
'Ending Round
:155 Updating grid
:683 Successfully updated map data on planet: 530
:549 Error getting zone response (on end): {response: {…}}
:155 Waiting 5s and re-sending score (Attempt # 1).
:155 Ending Round
:549 Error getting zone response (on end): {response: {…}}
:155 Waiting 5s and re-sending score (Attempt # 2).
:155 Ending Round
:155 Updating grid
:683 Successfully updated map data on planet: 530
:549 Error getting zone response (on end): {response: {…}}
:155 Waiting 5s and re-sending score (Attempt # 3).
:155 Ending Round
:549 Error getting zone response (on end): {response: {…}}
:155 Waiting 5s and re-sending score (Attempt # 4).
:155 Ending Round
:155 Updating grid
:683 Successfully updated map data on planet: 530
:549 Error getting zone response (on end): {response: {…}}
:155 Waiting 5s and re-sending score (Attempt # 5).
:155 Ending Round
:817 (531) [empty × 41, 37, empty × 484, 29, 46, empty, 47, 188772]
:155 Updating grid
:683 Successfully updated map data on planet: 530
:155 Getting best zone
:743 (2) [87, false]
:856 Current zone # 87 is already the best. No need to switch.
:155 Previous game detected. Ending it.
:599 Leaving game: 62372
:155 Left Zone # 87
:376 Round successfully started in zone # 87
:377 {response: {…}}
:817 (531) [empty × 41, 37, empty × 484, 29, 46, empty, 47, 188772]'

Please try not to paste in text autolinking to other issues... The above comment just updated a LOT of other issues/PRs.

@ensingm2, really. Sorry. I pasted it in code tag and didn't expect this effect. Will replace in next time.