Slightly tweak number displays
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user