Skip to content

Commit

Permalink
Use 'Format' command
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Jan 26, 2023
1 parent 6c35f63 commit 2a14191
Showing 1 changed file with 60 additions and 58 deletions.
118 changes: 60 additions & 58 deletions implement/applications/eve-online/eve-online-mining-bot/Bot.elm
Original file line number Diff line number Diff line change
Expand Up @@ -405,30 +405,31 @@ dockedWithMiningHoldSelected context inventoryWindowWithMiningHoldSelected =
inSpaceWithMiningHoldSelectedWithFleetHangar : BotDecisionContext -> EveOnline.ParseUserInterface.InventoryWindow -> DecisionPathNode
inSpaceWithMiningHoldSelectedWithFleetHangar context inventoryWindowWithMiningHoldSelected =
case
inventoryWindowWithMiningHoldSelected |> fleetHangarFromInventoryWindow |> Maybe.map .uiNode of
Nothing ->
describeBranch "I do not see the fleet hangar in the inventory." askForHelpToGetUnstuck

Just fleetHangarFromInventory ->
case inventoryWindowWithMiningHoldSelected |> selectedContainerFirstItemFromInventoryWindow of
Nothing ->
describeBranch "I see no item in the mining hold. Click the tree entry representing the fleet Hangar."
(decideActionForCurrentStep
(mouseClickOnUIElement MouseButtonLeft fleetHangarFromInventory)
)
inventoryWindowWithMiningHoldSelected |> fleetHangarFromInventoryWindow |> Maybe.map .uiNode
of
Nothing ->
describeBranch "I do not see the fleet hangar in the inventory." askForHelpToGetUnstuck

Just itemInInventory ->
describeBranch "I see at least one item in the mining hold. Move this to the fleet hangar."
(describeBranch "Drag and drop."
(decideActionForCurrentStep
(EffectOnWindow.effectsForDragAndDrop
{ startLocation = itemInInventory.totalDisplayRegionVisible |> centerFromDisplayRegion
, endLocation = fleetHangarFromInventory.totalDisplayRegionVisible |> centerFromDisplayRegion
, mouseButton = MouseButtonLeft
}
)
Just fleetHangarFromInventory ->
case inventoryWindowWithMiningHoldSelected |> selectedContainerFirstItemFromInventoryWindow of
Nothing ->
describeBranch "I see no item in the mining hold. Click the tree entry representing the fleet Hangar."
(decideActionForCurrentStep
(mouseClickOnUIElement MouseButtonLeft fleetHangarFromInventory)
)

Just itemInInventory ->
describeBranch "I see at least one item in the mining hold. Move this to the fleet hangar."
(describeBranch "Drag and drop."
(decideActionForCurrentStep
(EffectOnWindow.effectsForDragAndDrop
{ startLocation = itemInInventory.totalDisplayRegionVisible |> centerFromDisplayRegion
, endLocation = fleetHangarFromInventory.totalDisplayRegionVisible |> centerFromDisplayRegion
, mouseButton = MouseButtonLeft
}
)
)
)


undockUsingStationWindow :
Expand Down Expand Up @@ -514,44 +515,45 @@ inSpaceWithMiningHoldSelected context seeUndockingComplete inventoryWindowWithMi
)

else if context.eventContext.botSettings.unloadFleetHangarPercent > 0 && context.eventContext.botSettings.unloadFleetHangarPercent <= fillPercent then
describeBranch ("The mining hold is filled at least " ++ describeThresholdToUnloadFleetHangar ++ ". Unload the ore on fleet hangar.")
(ensureMiningHoldIsSelectedInInventoryWindow
context.readingFromGameClient
(inSpaceWithMiningHoldSelectedWithFleetHangar context)
)
else
describeBranch ("The mining hold is not yet filled " ++ describeThresholdToUnload ++ ". Get more ore.")
(case context.readingFromGameClient.targets |> List.head of
Nothing ->
describeBranch "I see no locked target."
(travelToMiningSiteAndLaunchDronesAndTargetAsteroid context)

Just _ ->
{- Depending on the UI configuration, the game client might automatically target rats.
To avoid these targets interfering with mining, unlock them here.
-}
unlockTargetsNotForMining context
|> Maybe.withDefault
(describeBranch "I see a locked target."
(case knownMiningModules |> List.filter (.isActive >> Maybe.withDefault False >> not) |> List.head of
Nothing ->
describeBranch
(if knownMiningModules == [] then
"Found no mining modules so far."

else
"All known mining modules found so far are active."
)
(readShipUIModuleButtonTooltips context
|> Maybe.withDefault waitForProgressInGame
)

Just inactiveModule ->
describeBranch "I see an inactive mining module. Activate it."
(clickModuleButtonButWaitIfClickedInPreviousStep context inactiveModule)
)
describeBranch ("The mining hold is filled at least " ++ describeThresholdToUnloadFleetHangar ++ ". Unload the ore on fleet hangar.")
(ensureMiningHoldIsSelectedInInventoryWindow
context.readingFromGameClient
(inSpaceWithMiningHoldSelectedWithFleetHangar context)
)

else
describeBranch ("The mining hold is not yet filled " ++ describeThresholdToUnload ++ ". Get more ore.")
(case context.readingFromGameClient.targets |> List.head of
Nothing ->
describeBranch "I see no locked target."
(travelToMiningSiteAndLaunchDronesAndTargetAsteroid context)

Just _ ->
{- Depending on the UI configuration, the game client might automatically target rats.
To avoid these targets interfering with mining, unlock them here.
-}
unlockTargetsNotForMining context
|> Maybe.withDefault
(describeBranch "I see a locked target."
(case knownMiningModules |> List.filter (.isActive >> Maybe.withDefault False >> not) |> List.head of
Nothing ->
describeBranch
(if knownMiningModules == [] then
"Found no mining modules so far."

else
"All known mining modules found so far are active."
)
(readShipUIModuleButtonTooltips context
|> Maybe.withDefault waitForProgressInGame
)

Just inactiveModule ->
describeBranch "I see an inactive mining module. Activate it."
(clickModuleButtonButWaitIfClickedInPreviousStep context inactiveModule)
)
)
)
)


unlockTargetsNotForMining : BotDecisionContext -> Maybe DecisionPathNode
Expand Down

0 comments on commit 2a14191

Please sign in to comment.