Slightly tweak number displays

This commit is contained in:
2025-01-08 00:21:17 +00:00
parent 5fa5bdf21e
commit 47aa8655b1
3 changed files with 62 additions and 53 deletions
+17 -1
View File
@@ -6,6 +6,7 @@ module Dodge.Item.Display (
basicItemDisplay,
) where
import ShortShow
import Data.Maybe
import Dodge.Data.World
import Dodge.Item.InvSize
@@ -19,9 +20,24 @@ import LensHelp
basicItemDisplay :: Item -> [String]
basicItemDisplay itm =
Prelude.take (itInvHeight itm) $
itemBaseName (itm ^. itType) :
(itemBaseName (itm ^. itType) ++ anyinternalvalue) :
catMaybes [maybeWarmupStatus itm]
++ repeat "*"
where
anyinternalvalue = maybe "" f $ itemInternalValue itm
f (Left i) = ' ':shortShow i
f (Right s) = ' ':s
itemInternalValue :: Item -> Maybe (Either Int String)
itemInternalValue itm
| Just x <- itm ^? itUse . uInt = Just (Left x)
| Just x <- itm ^? itUse . useToggle = Just (Right $ show x)
| isJust $ itm ^? itTargeting . itTgPos . _Just = Just $ Right "!TARGETING"
| Just x <- itm ^? itConsumables . magLoadStatus . iaLoaded = Just $ Left x
| UseAttach (APInt i) <- itm ^. itUse = Just $ Left i
| UseAttach (APProjectiles x) <- itm ^. itUse = Just . Right $ show x
| otherwise = mempty
maybeWarmupStatus :: Item -> Maybe String
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of