Greasy Fork

Greasy Fork is available in English.

HeroWarsHelper

Automation of actions for the game Hero Wars

< 脚本 HeroWarsHelper 的反馈

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

§
发布于:2025-05-26
编辑于:2025-05-26

For the "Mail" button in the "Actions" menu, can you also add an exception for the "Successful Brawls Defense" reward coins that are collected during the Hero \ Titan brawls and also the Cosmic Battle event?

Collecting these rewards one at at a time (and refreshing the game each time) after the event shop has closed provides us with things like skin stone chests at big discounts (eg: 300 coins instead of 600 during the Titan Brawls). However, while the event is active, we have to manually clear the rest of the mail in order to avoid collecting these rewards, which is very tedious and a HUGE hassle.

Adding exceptions for Brawl and Cosmic Battle mails would be a great timesaver!

§
发布于:2025-06-15

I join the request, maybe there will be some possibility to choose which letters not to collect

§
发布于:2025-06-24

I repeat the request - is it possible to exclude awards for successful brawl defense from collect mail task?

ZingerY作者
§
发布于:2025-06-24

Anything is possible, but I won't do it in the script.
Better write to the game's technical support so that they make a normal reward.

§
发布于:2025-06-24

heah.... I'm sure they even don't reply to my message...

this letters are containing coins.... - {coin: {33: 300}}
if I was a bit more technical and better understood your script and how it works I might try to do it myself... but for now I can't

§
发布于:2025-06-25
编辑于:2025-06-25

Anything is possible, but I won't do it in the script.

Just curious, why did you say you "won't" do it? Is not worth the time to implement, or are you against the idea itself?

BTW, writing to the game's tech support will not help as they will 100% reject the request. The Brawls Defence reward is supposed to be collected so that the coins can be spent in the shop. Saving it until the event ends so that we get more rewards for cheap goes against the intended function of the reward coins and will not be supported by the developers.

ZingerY作者
§
发布于:2025-06-25

The main reason I won’t implement this is that the benefit seems too minor to justify the effort. Adding exceptions would require extra interface work, and if enabled by default, it could confuse users who expect the script to collect all mail. Additionally, reloading the game for each reward puts extra strain on resources, and successful defenses don’t happen often enough to make this a priority.

§
发布于:2025-06-26

Fair enough, thanks for the explanation. Especially the part about repeated reloading would probably bring a lot of negative attention to the script. Makes sense.

§
发布于:2025-06-26

Thanks Zingery for the answer.
Thanks to you and your information I was able to make some modifications to the script and I almost achieved what I wanted.
I still have to exclude a few things from automatic collection, but I was able to exclude brawl coins from collection.
I will think about "my own" add-on extending your script - something like completing missions (HWHCampaign) or automatic raids in the campaign (HWHRAIDExt).
Thanks a lot!

§
发布于:2025-06-27

Can you publish the script as a separate project on this site, or share the code here? I'm interested in the Brawl Coins aspect. I don't care if it collects everything else, as long as it excludes the coins. Thanks.

§
发布于:2025-06-29

Sure, I'll let you know when I'm done

§
发布于:2025-06-29

Great! Another event that has these coins is the Cosmic Battle, in which you first select heroes to be banned and then progress through leagues. If you could add an exception for that coin type too, that would be awesome. :-)

§
发布于:2025-06-29

yeah. yeah - there are brawls and titan brawls with similar mechanics and i nboth cases with different brawl coins as reward. I already identified them both, i know their identifiers... so when I do my addon, there will be both of them excluded from collecting.

ZingerY作者
§
发布于:2025-06-29

Sure, I'll let you know when I'm done

Added the ability to override the filter for letters in version 2.355, here is an example of an extension with an override:
https://zingery.ru/scripts/HWHLettersFilterExt.user.js

§
发布于:2025-06-30

thx ZingerY

§
发布于:2025-06-30

I have trouble setting the exclusions correctly in collecting letters.... I am definitely doing something wrong.
I want to exclude coins e.g. 6, 14, 33, 37 and resources 3 and 51

If I do list like this:

// You can add your own conditions here

(reward?.coin ? reward.coin[6] : false);
(reward?.coin ? reward.coin[14] : false);
(reward?.coin ? reward.coin[33] : false);
(reward?.coin ? reward.coin[37] : false);
(reward?.starmoney ? true : false);
(reward?.consumable ? reward.consumable[3] : false);
(reward?.consumable ? reward.consumable[51] : false)

console.log(reward, standardCheck);

the script is collecting them anyway,

What this list of conditions should look like? Could you help?

ZingerY作者
§
发布于:2025-06-30
编辑于:2025-06-30

I guess something like this
class NewLetters extends Letters {
static shouldCollectLetter(reward) {
const standardCheck = Letters.shouldCollectLetter(reward);
console.log(reward, standardCheck);
return standardCheck && !(
(reward?.coin ? reward.coin[6] : false) ||
(reward?.coin ? reward.coin[14] : false) ||
(reward?.coin ? reward.coin[33] : false) ||
(reward?.coin ? reward.coin[37] : false) ||
(reward?.starmoney ? true : false) ||
(reward?.consumable ? reward.consumable[3] : false) ||
(reward?.consumable ? reward.consumable[51] : false)
);
}
}

§
发布于:2025-06-30

Great! I'll test it tomorrow.

Thanks a lot, I wasn't able to figure it out myself!

§
发布于:2025-07-01

It works... kind of - every item listek like above is ommited from collecting, so it's great!
But it also prevents from collecting them if false is changed into true.... and in both cases the console log shows true as a result of collecting.
The false shows only with letters excluded in main script (e.q. with buff or stamina).

§
发布于:2025-07-01

It works... kind of - every item listek like above is ommited from collecting, so it's great!

Which of the lines above refer to Hero Brawls, Titan Brawls, and Cosmic Battle coins? I assume I have to paste this code into the .JS file given previously and then import it using TamperMonkey?

§
发布于:2025-07-01

coins 33 and 37, but cosmic battle dosn't reward you with successful defense

Yes, install script given above and then insert theese lines after "// You can add...."

//
//Brawl Coin
(reward?.coin ? reward.coin[33] : false) ||
//Titan Brawl Coin
(reward?.coin ? reward.coin[37] : false)
//


To test it, if it works - You can change 33 into 6 (Friendship Coin) and test if it's collect them from postmail or not

§
发布于:2025-07-01

Thanks for the code snippet. I imported the .JS file into TamperMonkey, edited it, and pasted the line (reward?.coin ? reward.coin[6] : false) after the comment // You can add..... However, that did not work and it still collected the friendship coins.

I noticed that Zinger had posted a slightly different syntax in his code snippet, so here is how I edited the file:

class NewLetters extends Letters {
static shouldCollectLetter(reward) {
const standardCheck = Letters.shouldCollectLetter(reward);
// You can add your own conditions here
console.log(reward, standardCheck);
return standardCheck && !(
//Friendship Coin test
(reward?.coin ? reward.coin[6] : false)
);
}
}


However, this too did not work. Is this code correct? Should I remove the comment //Friendship Coin test as it appears inside the parameters?

§
发布于:2025-07-02

as far as I can see it should work - probably You are collecting letter via postmail [Collect all] button.

To collect chosen letters you have to do it via HWH script. To do so, click Actions -> Mail (in popup window).

You'll see confirmation at the top of window if "Collected X letters" or "Nothing to collect"

§
发布于:2025-07-02

You're right, I was indeed using the "Collect All" button, LOL. I used the script's "Mail" function and it didn't collect the Friendship Coins. Thanks for your help, and to Zinger too, for making this possible. This is such a huge "quality of life" improvement in the UI!

发布留言

登录以发布留言。