This commit is contained in:
2024-10-26 09:15:56 +01:00
parent dc34172691
commit f11dfe53db
5 changed files with 96 additions and 136 deletions
+17 -36
View File
@@ -47,31 +47,13 @@ updateCombineSections w cfig =
(getAvailableListLines secondColumnParams cfig)
[(0, sclose), (-1, sfclose)]
where
(sfclose,sclose) = filterSectionsPair (flip (andOrRegex $ regexCombs invitms))
allcombs "COMBINATIONS" $ mstr
(sfclose, sclose) =
filterSectionsPair
(flip . andOrRegex $ regexCombs invitms)
(IM.fromDistinctAscList . zip [0 ..] $ combineList w)
"COMBINATIONS"
$ w ^? hud . hudElement . subInventory . ciFilter . _Just
invitms = fromMaybe mempty $ w ^? hud . hudElement . diSections . ix 0 . ssItems
allcombs = IM.fromDistinctAscList $ zip [0 ..] $ combineList w
-- filtcombs = fromMaybe allcombs $ do
-- str <- mstr
-- invitms <- w ^? hud . hudElement . diSections . ix 0 . ssItems
-- return $ IM.filter (flip (andOrRegex $ regexCombs invitms) str) allcombs
-- showncombs
-- | null filtcombs =
-- IM.singleton 0 $
-- SelectionInfo ["No possible combinations"] 1 False white 0
-- | otherwise = filtcombs
-- filterdisplay = fromMaybe mempty $ do
-- str <- mstr
-- return $
-- IM.singleton 0 $
-- SelectionInfo
-- ["COMBINATIONS FILTER: " ++ str, numfiltitems]
-- 2
-- True
-- white
-- 0
mstr = w ^? hud . hudElement . subInventory . ciFilter . _Just
-- numfiltitems = " " ++ show (length allcombs - length filtcombs) ++ " FILTERED"
regexCombs :: IM.IntMap (SelectionItem ()) -> SelectionItem CombinableItem -> String -> Bool
regexCombs inv ci str = case str of
@@ -113,21 +95,20 @@ updateDisplaySections w cfig =
Just (0, _) -> reverse [filtinv, filtclose, invx, youx, closex]
Just (1, _) -> reverse [filtinv, filtclose, invx, youx, closex]
Just (2, _) -> reverse [filtinv, filtclose, closex, invx, youx]
_ -> reverse [filtinv, filtclose, closex, invx, youx]
(sfinv,sinv) = filterSectionsPair plainRegex invitems "INVTORY" $
Just (3, _) -> reverse [filtinv, filtclose, closex, invx, youx]
_ -> reverse [filtinv, filtclose, invx, closex, youx]
(sfinv, sinv) =
filterSectionsPair plainRegex invitems "INVENTORY" $
w ^? hud . hudElement . diInvFilter . _Just
(filtinv, invx) = ((-1,sfinv),(0,sinv))
-- filtpair (-1) invitems "INV. " $
-- w ^? hud . hudElement . diInvFilter . _Just
(sfclose,sclose) = filterSectionsPair plainRegex coitems "NEARBY" $
(filtinv, invx) = ((-1, sfinv), (0, sinv))
(sfclose, sclose) =
filterSectionsPair plainRegex closeitms "NEARBY" $
w ^? hud . hudElement . diCloseFilter . _Just
(filtclose, closex) = ((2,sfclose),(3,sclose))
-- filtpair 2 coitems "NEARBY " $
-- w ^? hud . hudElement . diCloseFilter . _Just
(filtclose, closex) = ((2, sfclose), (3, sclose))
youx = (1, youitems)
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 ()
thetext = displayFreeSlots nfreeslots
coitems =
thetext = displayFreeSlots (crNumFreeSlots cr)
closeitms =
IM.fromDistinctAscList . zip [0 ..] $
map closeObjectToSelectionItem (w ^. hud . closeObjects)
invitems =
@@ -135,7 +116,7 @@ updateDisplaySections w cfig =
(\k (y, x) -> invSelectionItem y cr k (x ^. locLDT . ldtValue))
(allInvLocs $ _crInv cr)
cr = you w
nfreeslots = crNumFreeSlots cr
-- filtpair i itms filtdescription mstr =
-- ( (i, filtsis)
-- , (i + 1, itms')