From f0c167d361779512456c7d7a0185802f9910c8ce Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 19 Jun 2021 15:40:11 -0400 Subject: feat(xanthous): Add a command to describe an item in the inventory Add a new DescribeInventory command, bound to I, to prompt for an item in the inventory (anywhere in the inventory, including wielded) and display a (new) panel describing it in detail. This description includes the description, the long description, and the item's physical properties (volume, density, and weight). Change-Id: Idc1a05ab16b4514728d42aa6b520f93bea807c07 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3227 Reviewed-by: grfn Tested-by: BuildkiteCI --- users/grfn/xanthous/src/Xanthous/Entities/Item.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'users/grfn/xanthous/src/Xanthous/Entities') diff --git a/users/grfn/xanthous/src/Xanthous/Entities/Item.hs b/users/grfn/xanthous/src/Xanthous/Entities/Item.hs index 6647c42731fa..eadd62569663 100644 --- a/users/grfn/xanthous/src/Xanthous/Entities/Item.hs +++ b/users/grfn/xanthous/src/Xanthous/Entities/Item.hs @@ -10,6 +10,7 @@ module Xanthous.Entities.Item , newWithType , isEdible , weight + , fullDescription ) where -------------------------------------------------------------------------------- import Xanthous.Prelude @@ -61,3 +62,15 @@ isEdible = Raw.isEdible . view itemType -- density of its material weight :: Item -> Grams weight item = (item ^. density) |*| (item ^. volume) + +-- | Describe the item in full detail +fullDescription :: Item -> Text +fullDescription item = unlines + [ item ^. itemType . Raw.description + , "" + , item ^. itemType . Raw.longDescription + , "" + , "volume: " <> tshow (item ^. volume) + , "density: " <> tshow (item ^. density) + , "weight: " <> tshow (weight item) + ] -- cgit 1.4.1