Skip to content

Commit 0720202

Browse files
committed
1 parent 71ded3c commit 0720202

File tree

1 file changed

+60
-17
lines changed
  • implement/applications/eve-online/eve-online-mining-bot

1 file changed

+60
-17
lines changed

implement/applications/eve-online/eve-online-mining-bot/Bot.elm

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{- EVE Online mining bot version 2025-11-20
1+
{- EVE Online mining bot version 2025-11-21
22
33
This bot automates the complete mining process, including offloading the ore and traveling between the mining spot and the unloading location.
44
@@ -62,6 +62,7 @@ module Bot exposing
6262
)
6363

6464
import BotLab.BotInterface_To_Host_2024_10_19 as InterfaceToHost
65+
import Common
6566
import Common.Basics exposing (listElementAtWrappedIndex, stringContainsIgnoringCase)
6667
import Common.DecisionPath exposing (describeBranch)
6768
import Common.EffectOnWindow as EffectOnWindow exposing (MouseButton(..))
@@ -110,6 +111,7 @@ import List.Extra
110111
import Maybe.Extra
111112
import Regex
112113
import Result.Extra
114+
import Set
113115

114116

115117
{-| Sources for the defaults:
@@ -880,9 +882,12 @@ modulesToActivateAlwaysActivated context inventoryWindowWithMiningHoldSelected =
880882
(travelToMiningSiteAndLaunchDronesAndTargetMineable selectedMineables context)
881883

882884
Just nextTarget ->
883-
unlockTargetsNotForMining context
884-
|> Maybe.withDefault
885-
(describeBranch "I see a locked target."
885+
case unlockTargetsNotForMining context selectedMineables of
886+
Just unlockNonMiningTargetAction ->
887+
unlockNonMiningTargetAction
888+
889+
Nothing ->
890+
describeBranch "I see a locked target."
886891
(ensureTargetIsInMiningRange
887892
context
888893
nextTarget
@@ -938,7 +943,6 @@ modulesToActivateAlwaysActivated context inventoryWindowWithMiningHoldSelected =
938943
)
939944
}
940945
)
941-
)
942946
)
943947

944948

@@ -1065,28 +1069,67 @@ readDistanceOfTargetInMeters target =
10651069
)
10661070

10671071

1068-
unlockTargetsNotForMining : BotDecisionContext -> Maybe DecisionPathNode
1069-
unlockTargetsNotForMining context =
1072+
unlockTargetsNotForMining : BotDecisionContext -> SelectedMineablesFromOverview -> Maybe DecisionPathNode
1073+
unlockTargetsNotForMining context selectedMineables =
1074+
{-
1075+
Observation session-recording-2025-11-21T11-27-31:
1076+
Locked target does not contain text 'asteroid' anymore.
1077+
---
1078+
Example of observed label on locked target:
1079+
'<center>Scordite II-Grade <center>2,484 m'
1080+
---
1081+
<https://forum.botlab.org/t/eve-mining-bot-23-02-issue-locks-an-asteroid-then-unlocks-it-and-repeats-this-over-and-over/5278>
1082+
-}
10701083
let
1071-
targetsToUnlock =
1072-
context.readingFromGameClient.targets
1073-
|> List.filter (.textsTopToBottom >> List.any (stringContainsIgnoringCase "asteroid") >> not)
1084+
mineableLabels : Set.Set String
1085+
mineableLabels =
1086+
selectedMineables.clickableMineables
1087+
|> List.concatMap
1088+
(\overviewEntry ->
1089+
case overviewEntry.objectName of
1090+
Nothing ->
1091+
[]
1092+
1093+
Just name ->
1094+
String.words name
1095+
)
1096+
|> Set.fromList
1097+
1098+
shouldUnlockTarget : EveOnline.ParseUserInterface.Target -> Bool
1099+
shouldUnlockTarget target =
1100+
let
1101+
textItems =
1102+
target.textsTopToBottom
1103+
|> List.concatMap String.words
1104+
1105+
looksLikeMineable =
1106+
List.any
1107+
(\word -> Set.member word mineableLabels)
1108+
textItems
1109+
in
1110+
not looksLikeMineable
10741111
in
1075-
targetsToUnlock
1076-
|> List.head
1077-
|> Maybe.map
1078-
(\targetToUnlock ->
1079-
describeBranch
1112+
case
1113+
Common.listFind
1114+
shouldUnlockTarget
1115+
context.readingFromGameClient.targets
1116+
of
1117+
Nothing ->
1118+
Nothing
1119+
1120+
Just targetToUnlock ->
1121+
Just
1122+
(describeBranch
10801123
("I see a target not for mining: '"
1081-
++ (targetToUnlock.textsTopToBottom |> String.join " ")
1124+
++ String.join " " targetToUnlock.textsTopToBottom
10821125
++ "'. Unlock this target."
10831126
)
10841127
(useContextMenuCascade
10851128
( "target", targetToUnlock.barAndImageCont |> Maybe.withDefault targetToUnlock.uiNode )
10861129
(useMenuEntryWithTextContaining "unlock" menuCascadeCompleted)
10871130
context
10881131
)
1089-
)
1132+
)
10901133

10911134

10921135
travelToMiningSiteAndLaunchDronesAndTargetMineable : SelectedMineablesFromOverview -> BotDecisionContext -> DecisionPathNode

0 commit comments

Comments
 (0)