Add count of used items to combinations

This commit is contained in:
2022-02-17 10:05:04 +00:00
parent 6573b3346e
commit bae0e1f0b7
3 changed files with 37 additions and 10 deletions
+24 -10
View File
@@ -101,9 +101,11 @@ subInventoryDisplay cfig w = case _inventoryMode w of
, fromMaybe mempty $ do
i <- mi
cpos <- combinePoss w !? i
lnks <- combineListLnks w !? i
return $ (lnkMidPosInvSels cfig w) cpos (snd lnks)
<> foldMap (cursorAtInvSel listCursorNESW cfig w) (snd lnks)
col <- (combineItemListYou w !? i) <&> _itInvColor . snd
lnks <- map fst (combineItemListYou w) !? i
return $ lnkMidPosInvSelsCol cfig w cpos col lnks
<> foldMap (cursorAtInvSel listCursorNESW cfig w) lnks
<> combineCounts cfig w lnks
]
InspectInventory -> invHead cfig "INSPECT"
where
@@ -138,10 +140,25 @@ lnkMidInvSel cfig w lefti midi = winScale cfig
hw = halfWidth cfig
lnkMidPosInvSels :: Configuration -> World -> Int -> [Int] -> Picture
lnkMidPosInvSels cfig w i = winScale cfig
. color white
. concatMap (zConnect rp . selNumMidHeight cfig w)
--lnkMidPosInvSels :: Configuration -> World -> Int -> [Int] -> Picture
--lnkMidPosInvSels cfig w i = winScale cfig
-- . color white
-- . concatMap (zConnect rp . selNumMidHeight cfig w)
-- where
---- lp ipos = V2 (150 - hw) ( hh - (20 * fromIntegral ipos + 17.5))
-- rp = V2 (190 - hw) ( hh - (20 * fromIntegral i + 77.5))
-- hh = halfHeight cfig
-- hw = halfWidth cfig
combineCounts :: Configuration -> World -> [Int] -> Picture
combineCounts cfig w = winScale cfig . foldMap f . group
where
f (i:is) = uncurryV translate (V2 10 5 +.+ selNumMidHeight cfig w i) . scale 0.1 0.1 . text . show $ length is + 1
f _ = mempty
lnkMidPosInvSelsCol :: Configuration -> World -> Int -> Color -> [Int] -> Picture
lnkMidPosInvSelsCol cfig w i col = winScale cfig
. concatMap (\j -> zConnectCol rp (selNumMidHeight cfig w j) col white white (selNumCol j w))
where
-- lp ipos = V2 (150 - hw) ( hh - (20 * fromIntegral ipos + 17.5))
rp = V2 (190 - hw) ( hh - (20 * fromIntegral i + 77.5))
@@ -161,9 +178,6 @@ combineListStringPictures w = case concatMap (itemText . snd) . combineItemListY
[] -> [text "NO POSSIBLE COMBINATIONS"]
xs -> xs
combineListLnks :: World -> [(Int,[Int])]
combineListLnks = zip [0..] . map fst . combineItemListYou
ammoTweakStrings :: Maybe Item -> [String]
ammoTweakStrings it = case it ^? _Just . itTweaks . tweakParams of
Just l -> map tweakString $ IM.elems l