Skip to content

Commit

Permalink
Also detect gift box if only 5* EXP is visible
Browse files Browse the repository at this point in the history
  • Loading branch information
reconman committed Apr 1, 2024
1 parent ab6cbc6 commit 94746fa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class ImageLoader @Inject constructor(
Images.SelectedParty -> "selected_party.png"
Images.SilverXP -> "SilverXP.png"
Images.GoldXP -> "GoldXP.png"
Images.Gold5StarXP -> "Gold5StarXP.png"
Images.GiftBoxCheck -> "gift_box_check.png"
Images.GiftBoxScrollEnd -> "gift_box_scroll_end.png"
Images.DropCE -> "drop_ce.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ interface AutomataApi {
similarity: Double? = null
): Match? = findAll(pattern, similarity).firstOrNull()

fun Region.find(
patterns: Collection<Pattern>,
similarity: Double? = null
): Match? = patterns.firstNotNullOfOrNull { find(it, similarity) }

fun Region.exists(
image: Pattern,
timeout: Duration = Duration.ZERO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum class Images {
SelectedParty,
SilverXP,
GoldXP,
Gold5StarXP,
GiftBoxCheck,
GiftBoxScrollEnd,
DropCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AutoDetect @Inject constructor(
images[Images.LotteryBoxFinished] in locations.lottery.checkRegion || images[Images.LotteryBoxFinished] in locations.lottery.finishedRegion ->
ScriptModeEnum.Lottery

listOf(images[Images.GoldXP], images[Images.SilverXP]) in emberSearchRegion ->
listOf(images[Images.GoldXP], images[Images.SilverXP], images[Images.Gold5StarXP]) in emberSearchRegion ->
ScriptModeEnum.PresentBox

locations.support.confirmSetupButtonRegion.exists(images[Images.SupportConfirmSetupButton], similarity = 0.75) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AutoGiftBox @Inject constructor(

override fun script(): Nothing {
var totalSelected = IterationResult()
val xpOffsetX = (locations.scriptArea.find(images[Images.GoldXP]) ?: locations.scriptArea.find(images[Images.SilverXP]))
val xpOffsetX = locations.scriptArea.find(listOf(images[Images.GoldXP], images[Images.SilverXP], images[Images.Gold5StarXP]))
?.region?.center?.x
?: throw ExitException(ExitReason.NoEmbersFound)

Expand Down

0 comments on commit 94746fa

Please sign in to comment.