Flatten HUDElement
This commit is contained in:
@@ -39,9 +39,9 @@ import Picture.Base
|
||||
updateCombinePositioning :: Universe -> Universe
|
||||
updateCombinePositioning u =
|
||||
u
|
||||
& uvWorld . hud . hudElement . subInventory . ciSections
|
||||
& uvWorld . hud . subInventory . ciSections
|
||||
%~ updateCombineSections (_uvWorld u) (_uvConfig u)
|
||||
& uvWorld . hud . hudElement . subInventory %~ checkCombineSelectionExists
|
||||
& uvWorld . hud . subInventory %~ checkCombineSelectionExists
|
||||
|
||||
updateCombineSections ::
|
||||
World ->
|
||||
@@ -51,18 +51,18 @@ updateCombineSections ::
|
||||
updateCombineSections w cfig =
|
||||
updateSectionsPositioning
|
||||
(const 0)
|
||||
(w ^? hud . hudElement . subInventory . ciSelection . _Just)
|
||||
(w ^? hud . subInventory . ciSelection . _Just)
|
||||
(getAvailableListLines secondColumnParams cfig)
|
||||
(IM.fromDistinctAscList [(-1, sfclose),(0, sclose')])
|
||||
where
|
||||
filtcurs = w ^? hud . hudElement . subInventory . ciSelection . _Just . _1 == Just (-1)
|
||||
filtcurs = w ^? hud . subInventory . ciSelection . _Just . _1 == Just (-1)
|
||||
(sfclose, sclose) =
|
||||
filterSectionsPair
|
||||
filtcurs
|
||||
(flip . andOrRegex $ regexCombs invitms)
|
||||
(IM.fromDistinctAscList . zip [0 ..] $ combineList w)
|
||||
"COMBINATIONS"
|
||||
$ w ^? hud . hudElement . subInventory . ciFilter . _Just
|
||||
$ w ^? hud . subInventory . ciFilter . _Just
|
||||
invitms = _unNIntMap $ fmap (\k -> w ^?! cWorld . lWorld . items . ix k) $ fold $ w ^? cWorld . lWorld . creatures . ix 0 . crInv
|
||||
sclose'
|
||||
| null sclose =
|
||||
@@ -87,17 +87,17 @@ orRegex f x str = case words str of
|
||||
|
||||
updateInventoryPositioning :: Universe -> Universe
|
||||
updateInventoryPositioning u =
|
||||
u & uvWorld . hud . hudElement . diSections
|
||||
u & uvWorld . hud . diSections
|
||||
%~ updateDisplaySections (_uvWorld u) (_uvConfig u)
|
||||
& uvWorld
|
||||
%~ checkInventorySelectionExists
|
||||
|
||||
checkInventorySelectionExists :: World -> World
|
||||
checkInventorySelectionExists w
|
||||
| isJust $ w ^? hud . hudElement . diSections . ix i . ssItems . ix j = w
|
||||
| isJust $ w ^? hud . diSections . ix i . ssItems . ix j = w
|
||||
| otherwise = scrollAugNextInSection w
|
||||
where
|
||||
(i, j, _) = fromMaybe (1, -1, mempty) $ w ^? hud . hudElement . diSelection . _Just
|
||||
(i, j, _) = fromMaybe (1, -1, mempty) $ w ^? hud . diSelection . _Just
|
||||
|
||||
checkCombineSelectionExists :: SubInventory -> SubInventory
|
||||
checkCombineSelectionExists si
|
||||
@@ -135,15 +135,15 @@ updateDisplaySections w cfig =
|
||||
]
|
||||
)
|
||||
where
|
||||
mselpos = w ^? hud . hudElement . diSelection . _Just
|
||||
mselpos = w ^? hud . diSelection . _Just
|
||||
invfiltcurs = mselpos ^? _Just . _1 == Just (-1)
|
||||
(sfinv, sinv) =
|
||||
filterSectionsPair invfiltcurs plainRegex invitems "INVENTORY" $
|
||||
w ^? hud . hudElement . diInvFilter . _Just
|
||||
w ^? hud . diInvFilter . _Just
|
||||
closefiltcurs = mselpos ^? _Just . _1 == Just 2
|
||||
(sfclose, sclose) =
|
||||
filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY ITEMS" $
|
||||
w ^? hud . hudElement . diCloseFilter . _Just
|
||||
w ^? hud . diCloseFilter . _Just
|
||||
nearbyhead
|
||||
| null sfclose && not (null sclose) = makehead "NEARBY ITEMS"
|
||||
| otherwise = sfclose
|
||||
@@ -315,16 +315,16 @@ regexList = any . List.isInfixOf
|
||||
|
||||
toggleCombineInv :: Universe -> Universe
|
||||
toggleCombineInv uv =
|
||||
uv & case uv ^? uvWorld . hud . hudElement . subInventory of
|
||||
Just CombineInventory{} -> uvWorld . hud . hudElement . subInventory .~ NoSubInventory
|
||||
uv & case uv ^? uvWorld . hud . subInventory of
|
||||
Just CombineInventory{} -> uvWorld . hud . subInventory .~ NoSubInventory
|
||||
_ -> uvWorld %~ enterCombineInv (uv ^. uvConfig)
|
||||
|
||||
enterCombineInv :: Configuration -> World -> World
|
||||
enterCombineInv cfig w =
|
||||
w & hud . hudElement . subInventory
|
||||
w & hud . subInventory
|
||||
.~ CombineInventory
|
||||
{ _ciSections = updateCombineSections w cfig mempty
|
||||
, _ciSelection = Just (0,0,mempty)
|
||||
, _ciFilter = Nothing
|
||||
}
|
||||
& hud . hudElement . diInvFilter .~ Nothing
|
||||
& hud . diInvFilter .~ Nothing
|
||||
|
||||
Reference in New Issue
Block a user