HeroWarsHelper

Automation of actions for the game Hero Wars

< 脚本 HeroWarsHelper 的反馈

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

§
发布于:2025-08-17
编辑于:2025-08-17

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();
§
发布于:2025-08-17

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.

§
发布于:2025-08-17

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

§
发布于:2025-08-18

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

发布留言

登录以发布留言。