HeroWarsHelper

Automation of actions for the game Hero Wars

< 脚本HeroWarsHelper的反馈

评价:好评 - 脚本运行良好

§
发表于: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.

ZingerY作者
§
发表于: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"

§
发表于: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.

§
发表于:2024-01-07

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

ZingerY作者
§
发表于: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.

§
发表于:2024-01-07

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

发表回复

登录以发表回复。