HeroWarsHelper

Automation of actions for the game Hero Wars

< Feedback on HeroWarsHelper

Review: Good - script works

§
Posted: 2024-01-06

Hi ZingerY,

Would you mind teaching me how to calculate a mission statistics, if possible?

Start a mission works by:
{
"calls": [
{
"name": "missionStart",
"args": {
"id": 2,
"heroes": [
2,
6,
7,
20
],
"favor": {}
},
"context": {
"actionTs": 1699833
},
"ident": "body"
}
]
}

But missionEnd includes a argument of progress that is based on a random seed, don't know how to replicate the calculation, or if it is possible to do so.

ZingerYAuthor
§
Posted: 2024-01-06

Hi!
Yes, sure 🙂
You need to pass the result received from the "missionStart" request to the "Calc" or "BattleCalc" function. The difference between them is that the first one return a Promise, and the second one uses a callback function to get the result.
You can find an example code in the script in the following comment: "Mission auto repeat"

§
Posted: 2024-01-07

Hi ZingerY,

Thank you very much for sharing the knowledge.

Would you mind guiding me which script to look for finding the "mission auto repeat"? Btw, how would you find out the "BattleCalc" or any function call structure? I currently go through the game interactively and find the call from whatever captured by chrome devtool network, but I feel there should be a script or code base to study to understand the structure?

Thank you so much.

§
Posted: 2024-01-07

I searched through game.js, app.js and hero.js from the source, but didn't find a match yet.

ZingerYAuthor
§
Posted: 2024-01-07

All the game code is contained in heroes.js, but it is obfuscated and difficult to read and its functions are not available in the global scope. My script uses game functions from heroes.js and gets them in a special way (more details here https://stackoverflow.com/questions/42611719/how-to-intercept-and-modify-a-specific-property-for-any-object) and makes them available as convenient "Calc" or "BattleCalc" functions.

§
Posted: 2024-01-07

Noted. Thank you very much for sharing the insight. I will study your script and do some exploration.

Post reply

Sign in to post a reply.