Skip to content

Commit

Permalink
Merge popular functionality from JongoFett
Browse files Browse the repository at this point in the history
Adapt for the idea from JongoFett at #7 (comment):

> Just a suggestion though, is it possible to only have the mining bot click once to approach the nearest asteroid? I feel like there is a chance that as it continually repeats clicking the 'approach' button this might signal that a bot is being used and get you banned?

On the catalog, I see this variant has been used for 156 hours already: https://catalog.botengine.org/F28BBA079FFAEDEE1A992368DF49347A8401775AF0EFAE970EC0165A2CF47192

Since this has become so popular, integrate it into more example apps.
  • Loading branch information
Viir committed May 23, 2020
2 parents 164f25f + a307028 commit eff8c77
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions implement/applications/eve-online/eve-online-mining-bot/src/Bot.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{- EVE Online mining bot version 2020-05-21
{- EVE Online mining bot version 2020-05-23
The bot warps to an asteroid belt, mines there until the ore hold is full, and then docks at a station to unload the ore. It then repeats this cycle until you stop it.
It remembers the station in which it was last docked, and docks again at the same station.
Expand Down Expand Up @@ -484,6 +484,7 @@ travelToMiningSiteAndLaunchDronesAndTargetAsteroid context =
(DescribeBranch
("Choosing asteroid '" ++ (asteroidInOverview.objectName |> Maybe.withDefault "Nothing") ++ "'")
(lockTargetFromOverviewEntryAndEnsureIsInRange
context.readingFromGameClient
(min (context |> botSettingsFromDecisionContext).targetingRange
(context |> botSettingsFromDecisionContext).miningModuleRange
)
Expand Down Expand Up @@ -545,8 +546,8 @@ ensureOreHoldIsSelectedInInventoryWindow readingFromGameClient continueWithInven
)


lockTargetFromOverviewEntryAndEnsureIsInRange : Int -> OverviewWindowEntry -> DecisionPathNode
lockTargetFromOverviewEntryAndEnsureIsInRange rangeInMeters overviewEntry =
lockTargetFromOverviewEntryAndEnsureIsInRange : ReadingFromGameClient -> Int -> OverviewWindowEntry -> DecisionPathNode
lockTargetFromOverviewEntryAndEnsureIsInRange readingFromGameClient rangeInMeters overviewEntry =
case overviewEntry.objectDistanceInMeters of
Ok distanceInMeters ->
if distanceInMeters <= rangeInMeters then
Expand All @@ -559,16 +560,20 @@ lockTargetFromOverviewEntryAndEnsureIsInRange rangeInMeters overviewEntry =

else
DescribeBranch ("Object is not in range (" ++ (distanceInMeters |> String.fromInt) ++ " meters away). Approach.")
(EndDecisionPath
(actStartingWithRightClickOnOverviewEntry
overviewEntry
[ ( "Click menu entry 'approach'."
, lastContextMenuOrSubmenu
>> Maybe.andThen (menuEntryContainingTextIgnoringCase "approach")
>> Maybe.map (.uiNode >> clickOnUIElement MouseButtonLeft >> List.singleton)
)
]
)
(if shipManeuverIsApproaching readingFromGameClient then
DescribeBranch "I see we already approach." waitForProgressInGame

else
EndDecisionPath
(actStartingWithRightClickOnOverviewEntry
overviewEntry
[ ( "Click menu entry 'approach'."
, lastContextMenuOrSubmenu
>> Maybe.andThen (menuEntryContainingTextIgnoringCase "approach")
>> Maybe.map (.uiNode >> clickOnUIElement MouseButtonLeft >> List.singleton)
)
]
)
)

Err error ->
Expand Down Expand Up @@ -1225,3 +1230,14 @@ isShipWarpingOrJumping =
)
-- If the ship is just floating in space, there might be no indication displayed.
>> Maybe.withDefault False


shipManeuverIsApproaching : ReadingFromGameClient -> Bool
shipManeuverIsApproaching =
.shipUI
>> maybeNothingFromCanNotSeeIt
>> Maybe.andThen (.indication >> maybeNothingFromCanNotSeeIt)
>> Maybe.andThen (.maneuverType >> maybeNothingFromCanNotSeeIt)
>> Maybe.map ((==) EveOnline.ParseUserInterface.ManeuverApproach)
-- If the ship is just floating in space, there might be no indication displayed.
>> Maybe.withDefault False

0 comments on commit eff8c77

Please sign in to comment.