LambdaHack-0.11.0.1: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Client.UI.InventoryM

Contents

- Internal operations

Description

UI of inventory management.

Synopsis

- data Suitability
  - = SuitsEverything
  - | SuitsSomething (Maybe CStore -> ItemFull -> ItemQuant -> Bool)
- data ResultItemDialogMode
  - = RStore CStore [ItemId]
  - | ROwned ItemId
  - | RLore SLore MenuSlot [(ItemId, ItemQuant)]
  - | RSkills MenuSlot
  - | RPlaces MenuSlot
  - | RFactions MenuSlot
  - | RModes MenuSlot
- getFull :: MonadClientUI m => ActorId -> m Suitability -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> [CStore] -> Bool -> Bool -> m (Either Text (CStore, [(ItemId, ItemQuant)]))
- getGroupItem :: MonadClientUI m => ActorId -> m Suitability -> Text -> Text -> Text -> Text -> [CStore] -> m (Either Text (CStore, ItemId))
- getStoreItem :: MonadClientUI m => ActorId -> ItemDialogMode -> m (Either Text ResultItemDialogMode)
- skillCloseUp :: MonadClientUI m => ActorId -> MenuSlot -> m (Text, AttrString)
- placeCloseUp :: MonadClientUI m => [(ContentId PlaceKind, (EnumSet LevelId, Int, Int, Int))] -> Bool -> MenuSlot -> m (Text, [(DisplayFont, [AttrString])])
- factionCloseUp :: MonadClientUI m => [(FactionId, Faction)] -> MenuSlot -> m (Text, [(DisplayFont, [AttrString])])
- data ItemDialogState
  - = ISuitable
  - | IAll
- accessModeBag :: ActorId -> State -> ItemDialogMode -> ItemBag
- storeItemPrompt :: FactionId -> Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text
- getItem :: MonadClientUI m => ActorId -> m Suitability -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> ItemDialogMode -> [ItemDialogMode] -> Bool -> Bool -> m (Either Text ResultItemDialogMode)
- data DefItemKey (m :: Type -> Type) = DefItemKey {
  - defLabel :: Either Text KM
  - defCond :: Bool
  - defAction :: ~(m (Either Text ResultItemDialogMode))
  }
- transition :: MonadClientUI m => ActorId -> m Suitability -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> Bool -> ItemDialogMode -> [ItemDialogMode] -> ItemDialogState -> m (Either Text ResultItemDialogMode)
- runDefMessage :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m ()
- runDefAction :: MonadClientUI m => [(KM, DefItemKey m)] -> (MenuSlot -> Either Text ResultItemDialogMode) -> KeyOrSlot -> m (Either Text ResultItemDialogMode)
- runDefSkills :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> ActorId -> m (Either Text ResultItemDialogMode)
- skillsInRightPane :: MonadClientUI m => ActorId -> Int -> MenuSlot -> m OKX
- runDefPlaces :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m (Either Text ResultItemDialogMode)
- placesInRightPane :: MonadClientUI m => [(ContentId PlaceKind, (EnumSet LevelId, Int, Int, Int))] -> Int -> MenuSlot -> m OKX
- runDefFactions :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m (Either Text ResultItemDialogMode)
- factionsInRightPane :: MonadClientUI m => [(FactionId, Faction)] -> Int -> MenuSlot -> m OKX
- runDefModes :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m (Either Text ResultItemDialogMode)
- runDefInventory :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> ActorId -> ItemDialogMode -> [(ItemId, ItemQuant)] -> m (Either Text ResultItemDialogMode)

# Documentation

data Suitability Source #

Constructors

SuitsEverything |
SuitsSomething (Maybe CStore -> ItemFull -> ItemQuant -> Bool) |

data ResultItemDialogMode Source #

Constructors

RStore CStore [ItemId] |
ROwned ItemId |
RLore SLore MenuSlot [(ItemId, ItemQuant)] |
RSkills MenuSlot |
RPlaces MenuSlot |
RFactions MenuSlot |
RModes MenuSlot |

#### Instances

Instances details

Show ResultItemDialogMode Source # |
Instance details Defined in Game.LambdaHack.Client.UI.InventoryM Methods showsPrec :: Int -> ResultItemDialogMode -> ShowS Source # show :: ResultItemDialogMode -> String Source # showList :: [ResultItemDialogMode] -> ShowS Source #

getFull Source #

Arguments

:: MonadClientUI m |
=> ActorId |
-> m Suitability | which items to consider suitable
-> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) | specific prompt for only suitable items
-> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) | generic prompt
-> [CStore] | stores to cycle through
-> Bool | whether to ask, when the only item in the starting mode is suitable
-> Bool | whether to permit multiple items as a result
-> m (Either Text (CStore, [(ItemId, ItemQuant)])) |

Let the human player choose a single, preferably suitable, item from a list of items. Don't display stores empty for all actors. Start with a non-empty store.

getGroupItem Source #

Arguments

:: MonadClientUI m |
=> ActorId |
-> m Suitability | which items to consider suitable
-> Text | specific prompt for only suitable items
-> Text | generic prompt
-> Text | the verb to use
-> Text | the generic verb to use
-> [CStore] | stores to cycle through
-> m (Either Text (CStore, ItemId)) |

Let a human player choose any item from a given group. Note that this does not guarantee the chosen item belongs to the group, as the player can override the choice. Used e.g., for applying and projecting.

getStoreItem Source #

Arguments

:: MonadClientUI m |
=> ActorId | the pointman
-> ItemDialogMode | initial mode
-> m (Either Text ResultItemDialogMode) |

Display all items from a store and let the human player choose any or switch to any other store. Used, e.g., for viewing inventory and item descriptions.

skillCloseUp :: MonadClientUI m => ActorId -> MenuSlot -> m (Text, AttrString) Source #

placeCloseUp :: MonadClientUI m => [(ContentId PlaceKind, (EnumSet LevelId, Int, Int, Int))] -> Bool -> MenuSlot -> m (Text, [(DisplayFont, [AttrString])]) Source #

factionCloseUp :: MonadClientUI m => [(FactionId, Faction)] -> MenuSlot -> m (Text, [(DisplayFont, [AttrString])]) Source #

# Internal operations

data ItemDialogState Source #

Constructors

ISuitable |
IAll |

#### Instances

Instances details

Show ItemDialogState Source # |
Instance details Defined in Game.LambdaHack.Client.UI.InventoryM Methods showsPrec :: Int -> ItemDialogState -> ShowS Source # show :: ItemDialogState -> String Source # showList :: [ItemDialogState] -> ShowS Source #
Eq ItemDialogState Source # |
Instance details Defined in Game.LambdaHack.Client.UI.InventoryM Methods (==) :: ItemDialogState -> ItemDialogState -> Bool Source # (/=) :: ItemDialogState -> ItemDialogState -> Bool Source #

accessModeBag :: ActorId -> State -> ItemDialogMode -> ItemBag Source #

storeItemPrompt :: FactionId -> Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text Source #

getItem Source #

Arguments

:: MonadClientUI m |
=> ActorId |
-> m Suitability | which items to consider suitable
-> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) | specific prompt for only suitable items
-> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) | generic prompt
-> ItemDialogMode | first mode to display
-> [ItemDialogMode] | the (rest of) modes
-> Bool | whether to ask, when the only item in the starting mode is suitable
-> Bool | whether to permit multiple items as a result
-> m (Either Text ResultItemDialogMode) |

Let the human player choose a single, preferably suitable, item from a list of items.

data DefItemKey (m :: Type -> Type) Source #

Constructors

DefItemKey |

Fields

- defLabel :: Either Text KM
- defCond :: Bool
- defAction :: ~(m (Either Text ResultItemDialogMode))

transition :: MonadClientUI m => ActorId -> m Suitability -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> (Actor -> ActorUI -> Skills -> ItemDialogMode -> State -> Text) -> Bool -> ItemDialogMode -> [ItemDialogMode] -> ItemDialogState -> m (Either Text ResultItemDialogMode) Source #

runDefMessage :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m () Source #

runDefAction :: MonadClientUI m => [(KM, DefItemKey m)] -> (MenuSlot -> Either Text ResultItemDialogMode) -> KeyOrSlot -> m (Either Text ResultItemDialogMode) Source #

runDefSkills :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> ActorId -> m (Either Text ResultItemDialogMode) Source #

skillsInRightPane :: MonadClientUI m => ActorId -> Int -> MenuSlot -> m OKX Source #

runDefPlaces :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m (Either Text ResultItemDialogMode) Source #

placesInRightPane :: MonadClientUI m => [(ContentId PlaceKind, (EnumSet LevelId, Int, Int, Int))] -> Int -> MenuSlot -> m OKX Source #

runDefFactions :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m (Either Text ResultItemDialogMode) Source #

factionsInRightPane :: MonadClientUI m => [(FactionId, Faction)] -> Int -> MenuSlot -> m OKX Source #

runDefModes :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> m (Either Text ResultItemDialogMode) Source #

runDefInventory :: MonadClientUI m => [(KM, DefItemKey m)] -> Text -> ActorId -> ItemDialogMode -> [(ItemId, ItemQuant)] -> m (Either Text ResultItemDialogMode) Source #