diff --git a/implement/alternate-ui/elm-app/src/EveOnline/MemoryReading.elm b/implement/alternate-ui/elm-app/src/EveOnline/MemoryReading.elm index 12094cf5..9cea04e4 100644 --- a/implement/alternate-ui/elm-app/src/EveOnline/MemoryReading.elm +++ b/implement/alternate-ui/elm-app/src/EveOnline/MemoryReading.elm @@ -1,5 +1,6 @@ module EveOnline.MemoryReading exposing - ( ChatUserEntry + ( AgentConversationWindow + , ChatUserEntry , ChatWindow , ChatWindowStack , ChildOfNodeWithDisplayRegion(..) @@ -21,6 +22,7 @@ module EveOnline.MemoryReading exposing , InventoryItemsView(..) , InventoryWindow , InventoryWindowCapacityGauge + , MarketOrdersWindow , MaybeVisible(..) , MessageBox , ModuleButtonTooltip @@ -31,6 +33,7 @@ module EveOnline.MemoryReading exposing , ParsedUserInterface , ProbeScanResult , ProbeScannerWindow + , SelectedItemWindow , ShipManeuverType(..) , ShipUI , ShipUIIndication @@ -80,11 +83,14 @@ type alias ParsedUserInterface = , infoPanelLocationInfo : MaybeVisible InfoPanelLocationInfo , infoPanelRoute : MaybeVisible InfoPanelRoute , overviewWindow : MaybeVisible OverviewWindow + , selectedItemWindow : MaybeVisible SelectedItemWindow , dronesWindow : MaybeVisible DronesWindow , probeScannerWindow : MaybeVisible ProbeScannerWindow , stationWindow : MaybeVisible StationWindow , inventoryWindows : List InventoryWindow , chatWindowStacks : List ChatWindowStack + , agentConversationWindows : List AgentConversationWindow + , marketOrdersWindow : MaybeVisible MarketOrdersWindow , moduleButtonTooltip : MaybeVisible ModuleButtonTooltip , neocom : MaybeVisible Neocom , messageBoxes : List MessageBox @@ -151,13 +157,16 @@ type alias ShipUI = type alias ShipUIIndication = - { maneuverType : MaybeVisible ShipManeuverType + { uiNode : UITreeNodeWithDisplayRegion + , maneuverType : MaybeVisible ShipManeuverType } type alias ShipUIModule = { uiNode : UITreeNodeWithDisplayRegion + , slotUINode : UITreeNodeWithDisplayRegion , isActive : Maybe Bool + , isHiliteVisible : Bool } @@ -223,6 +232,17 @@ type alias OverviewWindowEntry = } +type alias SelectedItemWindow = + { uiNode : UITreeNodeWithDisplayRegion + , orbitButton : Maybe UITreeNodeWithDisplayRegion + } + + +type alias MarketOrdersWindow = + { uiNode : UITreeNodeWithDisplayRegion + } + + type alias ColorComponents = { a : Int, r : Int, g : Int, b : Int } @@ -345,6 +365,11 @@ type alias NeocomClock = } +type alias AgentConversationWindow = + { uiNode : UITreeNodeWithDisplayRegion + } + + type alias Expander = { uiNode : UITreeNodeWithDisplayRegion , texturePath : Maybe String @@ -377,12 +402,15 @@ parseUserInterfaceFromUITree uiTree = , infoPanelLocationInfo = parseInfoPanelLocationInfoFromUITreeRoot uiTree , infoPanelRoute = parseInfoPanelRouteFromUITreeRoot uiTree , overviewWindow = parseOverviewWindowFromUITreeRoot uiTree + , selectedItemWindow = parseSelectedItemWindowFromUITreeRoot uiTree , dronesWindow = parseDronesWindowFromUITreeRoot uiTree , probeScannerWindow = parseProbeScannerWindowFromUITreeRoot uiTree , stationWindow = parseStationWindowFromUITreeRoot uiTree , inventoryWindows = parseInventoryWindowsFromUITreeRoot uiTree , moduleButtonTooltip = parseModuleButtonTooltipFromUITreeRoot uiTree , chatWindowStacks = parseChatWindowStacksFromUITreeRoot uiTree + , agentConversationWindows = parseAgentConversationWindowsFromUITreeRoot uiTree + , marketOrdersWindow = parseMarketOrdersWindowFromUITreeRoot uiTree , neocom = parseNeocomFromUITreeRoot uiTree , messageBoxes = parseMessageBoxesFromUITreeRoot uiTree } @@ -602,29 +630,44 @@ parseShipUIFromUITreeRoot uiTreeRoot = |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "SpeedGauge") |> List.head - maybeIndicationElement = - shipUINode.uiNode - |> listDescendantsInUITreeNode - |> List.filter (getNameFromDictEntries >> Maybe.map (String.toLower >> String.contains "indicationcontainer") >> Maybe.withDefault False) + maybeIndicationNode = + shipUINode + |> listDescendantsWithDisplayRegion + |> List.filter (.uiNode >> getNameFromDictEntries >> Maybe.map (String.toLower >> String.contains "indicationcontainer") >> Maybe.withDefault False) |> List.head indication = - maybeIndicationElement + maybeIndicationNode |> Maybe.map (parseShipUIIndication >> CanSee) |> Maybe.withDefault CanNotSeeIt modules = shipUINode |> listDescendantsWithDisplayRegion - |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "ModuleButton") - |> List.map - (\moduleNode -> - { uiNode = moduleNode - , isActive = - moduleNode.uiNode.dictEntriesOfInterest - |> Dict.get "ramp_active" - |> Maybe.andThen (Json.Decode.decodeValue Json.Decode.bool >> Result.toMaybe) - } + |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "ShipSlot") + |> List.filterMap + (\slotNode -> + slotNode + |> listDescendantsWithDisplayRegion + |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "ModuleButton") + |> List.head + |> Maybe.map + (\moduleNode -> + { uiNode = moduleNode + , slotUINode = slotNode + , isActive = + moduleNode.uiNode.dictEntriesOfInterest + |> Dict.get "ramp_active" + |> Maybe.andThen (Json.Decode.decodeValue Json.Decode.bool >> Result.toMaybe) + , isHiliteVisible = + slotNode + |> listDescendantsWithDisplayRegion + |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "Sprite") + |> List.filter (.uiNode >> getNameFromDictEntries >> (==) (Just "hilite")) + |> List.isEmpty + |> not + } + ) ) getLastValuePercentFromGaugeName gaugeName = @@ -690,11 +733,11 @@ parseTarget targetNode = } -parseShipUIIndication : UITreeNode -> ShipUIIndication +parseShipUIIndication : UITreeNodeWithDisplayRegion -> ShipUIIndication parseShipUIIndication indicationUINode = let displayTexts = - indicationUINode |> getAllContainedDisplayTexts + indicationUINode.uiNode |> getAllContainedDisplayTexts maneuverType = [ ( "Warp", ManeuverWarp ) @@ -713,7 +756,7 @@ parseShipUIIndication indicationUINode = |> List.head |> canNotSeeItFromMaybeNothing in - { maneuverType = maneuverType } + { uiNode = indicationUINode, maneuverType = maneuverType } parseOverviewWindowFromUITreeRoot : UITreeNodeWithDisplayRegion -> MaybeVisible OverviewWindow @@ -866,6 +909,36 @@ parseOverviewEntryDistanceInMetersFromText distanceDisplayTextBeforeTrim = Err ("Text did not match expected number format: '" ++ distanceDisplayText ++ "'") +parseSelectedItemWindowFromUITreeRoot : UITreeNodeWithDisplayRegion -> MaybeVisible SelectedItemWindow +parseSelectedItemWindowFromUITreeRoot uiTreeRoot = + uiTreeRoot + |> listDescendantsWithDisplayRegion + |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "ActiveItem") + |> List.head + |> Maybe.map parseSelectedItemWindow + |> canNotSeeItFromMaybeNothing + + +parseSelectedItemWindow : UITreeNodeWithDisplayRegion -> SelectedItemWindow +parseSelectedItemWindow windowNode = + let + actionButtonFromTexturePathEnding texturePathEnding = + windowNode + |> listDescendantsWithDisplayRegion + |> List.filter + (.uiNode + >> getTexturePathFromDictEntries + >> Maybe.map (String.toLower >> String.endsWith (String.toLower texturePathEnding)) + >> Maybe.withDefault False + ) + |> List.head + + orbitButton = + actionButtonFromTexturePathEnding "44_32_21.png" + in + { uiNode = windowNode, orbitButton = orbitButton } + + parseDronesWindowFromUITreeRoot : UITreeNodeWithDisplayRegion -> MaybeVisible DronesWindow parseDronesWindowFromUITreeRoot uiTreeRoot = case @@ -1320,6 +1393,36 @@ parseChatUserEntry chatUserUiNode = } +parseAgentConversationWindowsFromUITreeRoot : UITreeNodeWithDisplayRegion -> List AgentConversationWindow +parseAgentConversationWindowsFromUITreeRoot uiTreeRoot = + uiTreeRoot + |> listDescendantsWithDisplayRegion + |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "AgentDialogueWindow") + |> List.map parseAgentConversationWindow + + +parseAgentConversationWindow : UITreeNodeWithDisplayRegion -> AgentConversationWindow +parseAgentConversationWindow windowUINode = + { uiNode = windowUINode + } + + +parseMarketOrdersWindowFromUITreeRoot : UITreeNodeWithDisplayRegion -> MaybeVisible MarketOrdersWindow +parseMarketOrdersWindowFromUITreeRoot uiTreeRoot = + uiTreeRoot + |> listDescendantsWithDisplayRegion + |> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "MarketOrdersWnd") + |> List.head + |> Maybe.map parseMarketOrdersWindow + |> canNotSeeItFromMaybeNothing + + +parseMarketOrdersWindow : UITreeNodeWithDisplayRegion -> MarketOrdersWindow +parseMarketOrdersWindow windowUINode = + { uiNode = windowUINode + } + + parseNeocomFromUITreeRoot : UITreeNodeWithDisplayRegion -> MaybeVisible Neocom parseNeocomFromUITreeRoot uiTreeRoot = case diff --git a/implement/alternate-ui/elm-app/src/FrontendWeb/InspectParsedUserInterface.elm b/implement/alternate-ui/elm-app/src/FrontendWeb/InspectParsedUserInterface.elm index f779e80c..159b86a5 100644 --- a/implement/alternate-ui/elm-app/src/FrontendWeb/InspectParsedUserInterface.elm +++ b/implement/alternate-ui/elm-app/src/FrontendWeb/InspectParsedUserInterface.elm @@ -151,6 +151,12 @@ renderTreeNodeFromParsedUserInterface maybeInputRoute uiNodesWithDisplayRegion p , fieldValueSummary = always "..." , fieldValueChildren = treeNodeChildrenFromOverviewWindow viewConfig } + , parsedUserInterface.selectedItemWindow + |> fieldFromMaybeVisibleInstance + { fieldName = "selectedItemWindow" + , fieldValueSummary = always "..." + , fieldValueChildren = treeNodeChildrenFromSelectedItemWindow viewConfig + } , parsedUserInterface.dronesWindow |> fieldFromMaybeVisibleInstance { fieldName = "dronesWindow" @@ -179,6 +185,17 @@ renderTreeNodeFromParsedUserInterface maybeInputRoute uiNodesWithDisplayRegion p { fieldName = "chatWindowStacks" , fieldValueChildren = treeNodeChildrenFromChatWindowStack viewConfig } + , parsedUserInterface.agentConversationWindows + |> fieldFromListInstance + { fieldName = "agentConversationWindows" + , fieldValueChildren = treeNodeChildrenFromAgentConversationWindow viewConfig + } + , parsedUserInterface.marketOrdersWindow + |> fieldFromMaybeVisibleInstance + { fieldName = "marketOrdersWindow" + , fieldValueSummary = always "..." + , fieldValueChildren = treeNodeChildrenFromMarketOrdersWindow viewConfig + } , parsedUserInterface.moduleButtonTooltip |> fieldFromMaybeVisibleInstance { fieldName = "moduleButtonTooltip" @@ -265,7 +282,13 @@ treeNodeChildrenFromParsedUserInterfaceShipUIModule viewConfig parsedUserInterfa treeNodeChildrenFromRecordWithUINode viewConfig parsedUserInterfaceShipUIModule.uiNode - [ parsedUserInterfaceShipUIModule.isActive |> fieldFromMaybeBool "isActive" + [ { fieldName = "slotUINode" + , fieldValueSummary = "..." + , fieldValueChildren = + always [ treeViewNodeFromUINode viewConfig parsedUserInterfaceShipUIModule.slotUINode ] + } + , parsedUserInterfaceShipUIModule.isActive |> fieldFromMaybeBool "isActive" + , parsedUserInterfaceShipUIModule.isHiliteVisible |> fieldFromBool "isHiliteVisible" ] @@ -652,6 +675,39 @@ treeNodeChildrenFromModuleButtonTooltip viewConfig moduleButtonTooltip = [] +treeNodeChildrenFromAgentConversationWindow : + ViewConfig event + -> EveOnline.MemoryReading.AgentConversationWindow + -> List (TreeViewNode event ParsedUITreeViewPathNode) +treeNodeChildrenFromAgentConversationWindow viewConfig agentConversationWindow = + treeNodeChildrenFromRecordWithUINode + viewConfig + agentConversationWindow.uiNode + [] + + +treeNodeChildrenFromSelectedItemWindow : + ViewConfig event + -> EveOnline.MemoryReading.SelectedItemWindow + -> List (TreeViewNode event ParsedUITreeViewPathNode) +treeNodeChildrenFromSelectedItemWindow viewConfig selectedItemWindow = + treeNodeChildrenFromRecordWithUINode + viewConfig + selectedItemWindow.uiNode + [] + + +treeNodeChildrenFromMarketOrdersWindow : + ViewConfig event + -> EveOnline.MemoryReading.MarketOrdersWindow + -> List (TreeViewNode event ParsedUITreeViewPathNode) +treeNodeChildrenFromMarketOrdersWindow viewConfig marketOrdersWindow = + treeNodeChildrenFromRecordWithUINode + viewConfig + marketOrdersWindow.uiNode + [] + + treeNodeChildrenFromNeocom : ViewConfig event -> EveOnline.MemoryReading.Neocom @@ -947,6 +1003,17 @@ fieldFromListInstance listField list = } +fieldFromBool : + String + -> Bool + -> { fieldName : String, fieldValueSummary : String, fieldValueChildren : () -> List (TreeViewNode event ParsedUITreeViewPathNode) } +fieldFromBool fieldName fieldValue = + { fieldName = fieldName + , fieldValueSummary = Json.Encode.bool fieldValue |> Json.Encode.encode 0 + , fieldValueChildren = always [] + } + + fieldFromMaybeBool : String -> Maybe Bool