|
1 | | -{- EVE Online mining bot version 2025-11-20 |
| 1 | +{- EVE Online mining bot version 2025-11-21 |
2 | 2 |
|
3 | 3 | This bot automates the complete mining process, including offloading the ore and traveling between the mining spot and the unloading location. |
4 | 4 |
|
@@ -62,6 +62,7 @@ module Bot exposing |
62 | 62 | ) |
63 | 63 |
|
64 | 64 | import BotLab.BotInterface_To_Host_2024_10_19 as InterfaceToHost |
| 65 | +import Common |
65 | 66 | import Common.Basics exposing (listElementAtWrappedIndex, stringContainsIgnoringCase) |
66 | 67 | import Common.DecisionPath exposing (describeBranch) |
67 | 68 | import Common.EffectOnWindow as EffectOnWindow exposing (MouseButton(..)) |
@@ -110,6 +111,7 @@ import List.Extra |
110 | 111 | import Maybe.Extra |
111 | 112 | import Regex |
112 | 113 | import Result.Extra |
| 114 | +import Set |
113 | 115 |
|
114 | 116 |
|
115 | 117 | {-| Sources for the defaults: |
@@ -880,9 +882,12 @@ modulesToActivateAlwaysActivated context inventoryWindowWithMiningHoldSelected = |
880 | 882 | (travelToMiningSiteAndLaunchDronesAndTargetMineable selectedMineables context) |
881 | 883 |
|
882 | 884 | 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." |
886 | 891 | (ensureTargetIsInMiningRange |
887 | 892 | context |
888 | 893 | nextTarget |
@@ -938,7 +943,6 @@ modulesToActivateAlwaysActivated context inventoryWindowWithMiningHoldSelected = |
938 | 943 | ) |
939 | 944 | } |
940 | 945 | ) |
941 | | - ) |
942 | 946 | ) |
943 | 947 |
|
944 | 948 |
|
@@ -1065,28 +1069,67 @@ readDistanceOfTargetInMeters target = |
1065 | 1069 | ) |
1066 | 1070 |
|
1067 | 1071 |
|
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 | + -} |
1070 | 1083 | 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 |
1074 | 1111 | 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 |
1080 | 1123 | ("I see a target not for mining: '" |
1081 | | - ++ (targetToUnlock.textsTopToBottom |> String.join " ") |
| 1124 | + ++ String.join " " targetToUnlock.textsTopToBottom |
1082 | 1125 | ++ "'. Unlock this target." |
1083 | 1126 | ) |
1084 | 1127 | (useContextMenuCascade |
1085 | 1128 | ( "target", targetToUnlock.barAndImageCont |> Maybe.withDefault targetToUnlock.uiNode ) |
1086 | 1129 | (useMenuEntryWithTextContaining "unlock" menuCascadeCompleted) |
1087 | 1130 | context |
1088 | 1131 | ) |
1089 | | - ) |
| 1132 | + ) |
1090 | 1133 |
|
1091 | 1134 |
|
1092 | 1135 | travelToMiningSiteAndLaunchDronesAndTargetMineable : SelectedMineablesFromOverview -> BotDecisionContext -> DecisionPathNode |
|
0 commit comments