zebscripts/AFK-Daily

Optimize quest chest collection

Closed this issue ยท 4 comments

The script sometimes skips collecting a chest (usually the 4th one), most likely because of some failed RGB checks because of the floating icons that appear in front of the 4th chest when collecting the third one.

It is possible to work around this by implementing a mechanism of "if at least X quests have been completed, we are sure we can at least collect Y chests". This should be fairly easy to implement by adding a counter to the for loop we have going to collect quests, and then acting depending on that counter. Of course, the function should still check for RGBs when in doubt, sort of as a fallback.

Let's play with binary? ๐Ÿ˜ˆ

Something like checking for the 5 values, make something like every chest correspond to a bit, so:

  • Chest 5 is last bit so value +1
  • ...
  • Chest 1 is first bit so value +16

then here with 31 / 10:

$ echo "obase=2;31" | bc | xargs printf "%05d\n"
11111
$ echo "obase=2;10" | bc | xargs printf "%05d\n"
01010

If we store the result it's possible to use it like an array of booleans ๐Ÿ‘

$ chests=$(echo "obase=2;10" | bc | xargs printf "%05d\n")
$ echo ${chests:4:1}
0
$ echo ${chests:3:1}
1
$ echo ${chests:2:1}
0
$ echo ${chests:1:1}
1
$ echo ${chests:0:1}
0

Just need to check if android shell can do it ^^

Isn't that a bit overkill for what we want to do @kevingrillet...? ๐Ÿ˜…

Or just booleans XD

This has been fixed with this commit. We're taking advantage of the games feature of automatically collecting all the missions and chests when collecting the first one of each accordingly.