Implement copier, an item that copies the value displayed by other items
This commit is contained in:
@@ -4,8 +4,12 @@ module Dodge.Inventory.SelectionList (
|
||||
invSelectionItem,
|
||||
closeItemToSelectionItem,
|
||||
closeButtonToSelectionItem,
|
||||
getInventoryPath,
|
||||
getItemValue,
|
||||
) where
|
||||
|
||||
import Dodge.Inventory.Path
|
||||
import Control.Applicative
|
||||
import ShortShow
|
||||
import Data.Maybe
|
||||
import Dodge.Data.DoubleTree
|
||||
@@ -48,8 +52,7 @@ itemDisplay w cr ci = -- f
|
||||
itm = ci ^. _1
|
||||
NInt itid = itm ^. itID
|
||||
--f (x:xs) (y:_) = itemDisplayPad x y : xs
|
||||
f (x:xs) (y:_) = (x ++ ' ': y) : xs
|
||||
f xs _ = xs
|
||||
--f xs _ = xs
|
||||
--g (x:xs) (y:_) = (rightPad 15 ' ' x ++ y) : xs
|
||||
g (x:xs) (y:_) = (x ++ y) : xs
|
||||
g xs _ = xs
|
||||
@@ -83,6 +86,11 @@ itemExternalValue itm w cr
|
||||
| ITEMSCAN <- itm ^. itType
|
||||
, Just ExamineInventory <- w ^? hud . hudElement . subInventory
|
||||
= Just (Right "ON")
|
||||
-- , Just x <- itm ^? itScroll . itsInt
|
||||
-- , Just invid <- itm ^? itLocation . ilInvID
|
||||
-- , Just i <- getInventoryPath x ip invid cr
|
||||
-- , Just itm' <- cr ^? crInv . ix i
|
||||
-- = getItemValue itm' w cr
|
||||
| otherwise = mempty
|
||||
|
||||
itemScrollDisplay :: Item -> Maybe String
|
||||
@@ -96,30 +104,33 @@ itemScrollDisplay itm
|
||||
| ItemScrollIntRange _ i <- itm ^. itScroll = Just $ show i
|
||||
| otherwise = Nothing
|
||||
|
||||
itemDisplayPad :: [Char] -> String -> [Char]
|
||||
itemDisplayPad ls rs
|
||||
| rs == "" = ls
|
||||
| otherwise = midPadL 15 ' ' ls (' ' : rs)
|
||||
getItemValue :: Item -> World -> Creature -> Maybe (Either Int String)
|
||||
getItemValue itm w cr = itemInternalValue itm <|> itemExternalValue itm w cr
|
||||
|
||||
itemNumberDisplay :: World -> Creature -> ComposedItem -> [String]
|
||||
itemNumberDisplay w cr ci
|
||||
| Just x <- ci ^? _1 . itUse . uInt = [show x]
|
||||
| Just x <- ci ^? _1 . itUse . useToggle = [show x]
|
||||
| ITEMSCAN <- ci ^. _1 . itType
|
||||
, Just ExamineInventory <- w ^? hud . hudElement . subInventory = ["ACTIVE"]
|
||||
| EQUIP WRIST_ECG <- ci ^. _1 . itType =
|
||||
[displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
|
||||
| isJust $ ci ^? _1 . itTargeting . itTgPos . _Just = ["!TARG!"]
|
||||
| Just x <- ci ^? _1 . itConsumables . magLoadStatus . iaLoaded = [shortShow x]
|
||||
| Just i <- ci ^? _1 . itUse . uaParams . apInt = [show i]
|
||||
| Just x <- ci ^? _1 . itUse . uaParams . apProjectiles = [show x]
|
||||
| Just t <- ci ^? _1 . itType . ibtIntroScanType = [introScanDisplay cr t]
|
||||
| otherwise = mempty
|
||||
--itemDisplayPad :: [Char] -> String -> [Char]
|
||||
--itemDisplayPad ls rs
|
||||
-- | rs == "" = ls
|
||||
-- | otherwise = midPadL 15 ' ' ls (' ' : rs)
|
||||
|
||||
introScanDisplay :: Creature -> IntroScanType -> String
|
||||
introScanDisplay cr = \case
|
||||
HEALTH -> shortShow (cr ^. crHP)
|
||||
MAXHEALTH -> shortShow (cr ^. crMaxHP)
|
||||
--itemNumberDisplay :: World -> Creature -> ComposedItem -> [String]
|
||||
--itemNumberDisplay w cr ci
|
||||
-- | Just x <- ci ^? _1 . itUse . uInt = [show x]
|
||||
-- | Just x <- ci ^? _1 . itUse . useToggle = [show x]
|
||||
-- | ITEMSCAN <- ci ^. _1 . itType
|
||||
-- , Just ExamineInventory <- w ^? hud . hudElement . subInventory = ["ACTIVE"]
|
||||
-- | EQUIP WRIST_ECG <- ci ^. _1 . itType =
|
||||
-- [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
|
||||
-- | isJust $ ci ^? _1 . itTargeting . itTgPos . _Just = ["!TARG!"]
|
||||
-- | Just x <- ci ^? _1 . itConsumables . magLoadStatus . iaLoaded = [shortShow x]
|
||||
-- | Just i <- ci ^? _1 . itUse . uaParams . apInt = [show i]
|
||||
-- | Just x <- ci ^? _1 . itUse . uaParams . apProjectiles = [show x]
|
||||
-- | Just t <- ci ^? _1 . itType . ibtIntroScanType = [introScanDisplay cr t]
|
||||
-- | otherwise = mempty
|
||||
|
||||
--introScanDisplay :: Creature -> IntroScanType -> String
|
||||
--introScanDisplay cr = \case
|
||||
-- HEALTH -> shortShow (cr ^. crHP)
|
||||
-- MAXHEALTH -> shortShow (cr ^. crMaxHP)
|
||||
|
||||
displayPulse :: Int -> String
|
||||
displayPulse 0 = "*****"
|
||||
|
||||
Reference in New Issue
Block a user