ilpersi / BHBot

A bot that automates a game called Bit Heroes
GNU General Public License v3.0
28 stars 32 forks source link

Expedition settings #55

Closed ilpersi closed 5 years ago

ilpersi commented 5 years ago

Right now you have two settings to control how expeditions work:

# Expedition difficulty level
expeditionDifficulty 200

# Expeditions to run
# format is h4 50; h2 50; first letter is expedition type ('h' for hallowed 'i' for inferno) followed by portal number 1-4, second is chance to run
expeditions h2 50; h4 50

Sometimes this can be inconsistent because there will never be two expeditions at the same time and if you forgot settings for an expedition (in the previous example there only are hallowed configurations) the bot will basically switch to the other one keeping the portal.

if (e!= currentExpedition) {
  BHBot.log("Wrong expedition in settings: " + portalName + " , automatically setting it to " + (currentExpedition == 1 ? "Hallowed" : "Inferno"));
  e = currentExpedition;
}

As a new expedition is coming out in a couple of days I would like to change how the settings behave and have something like:

# format is p1 300 25: first letter is p followed by portal number (1, 2, 3, 4) then difficulty (300) and finally the chance to run
expeditions p1 300 25;p2 300 25;p3 300 50;

This would make it more flexible and independent from the expedition. To ease the transition some checks would be added in place to warn the user if he's using the old settings.

@Fortigate what do you think? Are you ok with this?

Fortigate commented 5 years ago

Yup looks good, I can have a look at the Worldboss settings and see if they can be loaded as a string too, that way everything is standardised.

In the future would be nice to have a settings UI, its getting pretty crowded in the settings file at the moment

ilpersi commented 5 years ago

A GUI is a whole new project to build and to maintain, the bot how it is now is enough for me. :)

I've modified the syntax as proposed and I took the chance to also optimize and centralize the random selection logic in a dedicated class. I applied it to expeditions, dungeons and raids and intentionally left out worlbosses waiting for your modification. :)

I had no chance to test the modifications as the whole kongregate.com site is now giving a 503 error to me.

Fortigate commented 5 years ago

True it would be a purely aesthetic upgrade, I'm not up to the task either, maybe we'll get a roaming GUI specialist pass through the project. Hopefully I can find some time before the end of the week to fix the not enough energy and revamp the worldboss settings string.

ilpersi commented 5 years ago

What we can do is to have a "launcher". You basically have a GUI where you set everything and then you launch the bot and the GUI will take care of writing the ini file in the right way.

If we go down this path, to avoid having to write hundreds of lines of code we need to have a better management of the ini file maybe using a library like ini4j.