stefan2200 / TWB

Python based bot for Tribal Wars
GNU General Public License v3.0
100 stars 54 forks source link

Added 'Advanced Gather' as an option + other minor changes. #54

Closed acroticguy closed 1 year ago

acroticguy commented 1 year ago

Added Advanced Gather functionality in troopsmanager.py.

What it does is gather all the troops, calculate their total carry size, then split that number into equal parts called batches. Multiple batches get sent to each scavenging option, in order to have maximum efficiency (as long as you select your max gather option in "gather_selection", your selection and all previous gather options will end at the same time). Also added boolean "advanced_gather" in config.example.json. Kept the previous gather method in case people still want to use it instead.

Adjusted the gather call on village.py to include our "advanced_gather" parameter.

Created a is_active_hours() function in twb.py that gets called instead of having the same 3 lines of code 3 times in different places. I feel like this also improves readability, feel free to change it back if you'd like. image_2023-09-09_223019072