HeroWarsHelper

Automation of actions for the game Hero Wars

< Feedback on HeroWarsHelper

Review: Good - script works

§
Posted: 17 Agustus 2025
Edited: 17 Agustus 2025

I added a mission repetition selector in the code. The feature lets a user repeat a campaign mission 5 times, 10 times, 20 times, or until energy is depleted. (ru translated with an online translator)

In original code, just after line 306:

BTN_REPEAT_5: 'Repeat 5x',
BTN_REPEAT_10: 'Repeat 10x',
BTN_REPEAT_20: 'Repeat 20x',
BTN_REPEAT_ENERGY: 'Repeat until energy',

In original code, just after line 676:

BTN_REPEAT_5: 'Повторить 5 раз',
BTN_REPEAT_10: 'Повторить 10 раз',
BTN_REPEAT_20: 'Повторить 20 раз',
BTN_REPEAT_ENERGY: 'Повторять до исчерпания энергии',

In original code, just after line 2478:

if (isSendsMission) return;
const choice = await popup.confirm(I18N('MSG_REPEAT_MISSION'), [
    { msg: I18N('BTN_REPEAT_5'), result: 5 },
    { msg: I18N('BTN_REPEAT_10'), result: 10 },
    { msg: I18N('BTN_REPEAT_20'), result: 20 },
    { msg: I18N('BTN_REPEAT_ENERGY'), result: 'energy' },
    { msg: I18N('BTN_NO'), result: false },
]);
if (!choice) return;
isStopSendMission = false;
isSendsMission = true;
if (choice === 'energy') {
    missionInfo.maxCount = 0;
    missionInfo.untilEnergy = true;
} else {
    missionInfo.maxCount = +choice;
    missionInfo.untilEnergy = false;

In original code, just after line 88381:

const SAFE_LIMIT = param?.safeLimit || 1000;
if ((param.maxCount && param.count >= param.maxCount) || (param.untilEnergy && param.count >= SAFE_LIMIT)) {
    await stopMission();
    return;
}

if (param.untilEnergy) {
    async function getStaminaAmount() {
        try {
            const refillable = await Send({calls:[{name:"userGetInfo", args:{}, ident:"userGetInfo"}]
            }).then(e => e.results[0].result.response.refillable);
            const s = refillable?.find(x => x.id == 1);
            return s?.amount || 0;
        } catch(e) {
            console.log('stamina check failed', e);
            return 0;
        }
    }
    const stamina = await getStaminaAmount();
    const missionData = lib.data.mission[param.id];
    const cost = Math.ceil(3 * (missionData?.normalMode?.teamExp || 0));
    if (!cost || stamina < cost) {
        await stopMission();
        return;
    }
}

lastMissionBattleStart = Date.now();
§
Posted: 17 Agustus 2025

Maybe it would be better if you created this as an extension to the script, so that it doesn't interfere with the main code? Otherwise people will have to manually edit the code each time an update is made. The script does have the feature to add extensions, I'm currently using one that helps collect mail but leaves out brawl rewards (or any other type of mail reward you want). Just a suggestion.

§
Posted: 17 Agustus 2025

I mainly shared this feature in the hope that the author would incorporate it into his script.

§
Posted: 18 Agustus 2025

I mainly shared this feature in the hope that the author would incorporate it into his script.

if I had the time I would have made a extension myself but yeah don't have time so hopfully author would add it into his code

ZingerYPembuat
§
Posted: 23 Agustus 2025

This functionality is quite old, so I would prefer to completely rewrite it, but unfortunately I don’t have time for this yet.

Post reply

Sign in to post a reply.

长期地址
遇到问题?请前往 GitHub 提 Issues。