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.HandleHumanGlobalM

Contents

- Meta commands
- Global commands that usually take time
- Global commands that never take time
- Internal operations

Description

Semantics of Game.LambdaHack.Client.UI.HumanCmd client commands that return server requests. A couple of them do not take time, the rest does. Here prompts and menus are displayed, but any feedback resulting from the commands (e.g., from inventory manipulation) is generated later on, by the server, for all clients that witness the results of the commands.

Synopsis

- byAreaHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> [(CmdArea, HumanCmd)] -> m (Either MError ReqUI)
- byAimModeHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI)
- composeIfLocalHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI)
- composeUnlessErrorHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI)
- compose2ndLocalHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI)
- loopOnNothingHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI)
- executeIfClearHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI)
- waitHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed)
- waitHuman10 :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed)
- yellHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed)
- moveRunHuman :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> Bool -> Bool -> Vector -> m (FailOrCmd RequestTimed)
- runOnceAheadHuman :: MonadClientUI m => ActorId -> m (Either MError RequestTimed)
- moveOnceToXhairHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed)
- runOnceToXhairHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed)
- continueToXhairHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed)
- moveItemHuman :: MonadClientUI m => ActorId -> [CStore] -> CStore -> Maybe Text -> Bool -> m (FailOrCmd RequestTimed)
- projectHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed)
- applyHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed)
- alterDirHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed)
- alterWithPointerHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed)
- closeDirHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed)
- helpHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- hintHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- dashboardHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- itemMenuHuman :: MonadClientUI m => ActorId -> (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- chooseItemMenuHuman :: MonadClientUI m => ActorId -> (KM -> HumanCmd -> m (Either MError ReqUI)) -> ItemDialogMode -> m (Either MError ReqUI)
- mainMenuHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- mainMenuAutoOnHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- mainMenuAutoOffHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- settingsMenuHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- challengeMenuHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI)
- gameDifficultyIncr :: MonadClient m => Int -> m ()
- gameFishToggle :: MonadClient m => m ()
- gameGoodsToggle :: MonadClient m => m ()
- gameWolfToggle :: MonadClient m => m ()
- gameKeeperToggle :: MonadClient m => m ()
- gameScenarioIncr :: MonadClientUI m => Int -> m ()
- gameExitWithHuman :: MonadClientUI m => ExitStrategy -> m (FailOrCmd ReqUI)
- data ExitStrategy
  - = Restart
  - | Quit
- gameDropHuman :: MonadClientUI m => m ReqUI
- gameExitHuman :: Monad m => m ReqUI
- gameSaveHuman :: MonadClientUI m => m ReqUI
- doctrineHuman :: MonadClientUI m => m (FailOrCmd ReqUI)
- automateHuman :: MonadClientUI m => m (FailOrCmd ReqUI)
- automateToggleHuman :: MonadClientUI m => m (FailOrCmd ReqUI)
- automateBackHuman :: MonadClientUI m => m (Either MError ReqUI)
- areaToRectangles :: MonadClientUI m => CmdArea -> m [Maybe Area]
- meleeAid :: (MonadClient m, MonadClientUI m) => ActorId -> ActorId -> m (FailOrCmd RequestTimed)
- displaceAid :: MonadClientUI m => ActorId -> ActorId -> m (FailOrCmd RequestTimed)
- moveSearchAlter :: MonadClientUI m => ActorId -> Bool -> Vector -> m (FailOrCmd RequestTimed)
- alterCommon :: MonadClientUI m => ActorId -> Bool -> Point -> m (FailOrCmd RequestTimed)
- goToXhair :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> m (FailOrCmd RequestTimed)
- goToXhairExplorationMode :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> m (FailOrCmd RequestTimed)
- goToXhairGoTo :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> m (FailOrCmd RequestTimed)
- multiActorGoTo :: (MonadClient m, MonadClientUI m) => LevelId -> Point -> RunParams -> m (FailOrCmd (Bool, Vector))
- moveOrSelectItem :: MonadClientUI m => ActorId -> [CStore] -> CStore -> Maybe Text -> Bool -> m (FailOrCmd RequestTimed)
- selectItemsToMove :: MonadClientUI m => ActorId -> [CStore] -> CStore -> Maybe Text -> Bool -> m (FailOrCmd (CStore, [(ItemId, ItemQuant)]))
- moveItems :: MonadClientUI m => ActorId -> [CStore] -> (CStore, [(ItemId, ItemQuant)]) -> CStore -> m RequestTimed
- projectItem :: (MonadClient m, MonadClientUI m) => ActorId -> (CStore, (ItemId, ItemFull)) -> m (FailOrCmd RequestTimed)
- applyItem :: MonadClientUI m => ActorId -> (CStore, (ItemId, ItemFullKit)) -> m (FailOrCmd RequestTimed)
- alterTileAtPos :: MonadClientUI m => ActorId -> Point -> m (FailOrCmd RequestTimed)
- verifyAlters :: MonadClientUI m => ActorId -> Bool -> Point -> m (FailOrCmd ())
- processTileActions :: MonadClientUI m => ActorId -> Bool -> Point -> [TileAction] -> m (FailOrCmd ())
- verifyEscape :: MonadClientUI m => m (FailOrCmd ())
- verifyToolEffect :: MonadClientUI m => LevelId -> CStore -> ItemFull -> m (FailOrCmd ())
- closeTileAtPos :: MonadClientUI m => ActorId -> Point -> m (FailOrCmd RequestTimed)
- msgAddDone :: MonadClientUI m => Bool -> ActorId -> Point -> Text -> m ()
- pickPoint :: MonadClientUI m => ActorId -> Text -> m (Maybe Point)
- generateMenu :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> FontOverlayMap -> [(Text, HumanCmd, Maybe HumanCmd, Maybe FontOverlayMap)] -> [String] -> String -> m (Either MError ReqUI)

# Meta commands

byAreaHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> [(CmdArea, HumanCmd)] -> m (Either MError ReqUI) Source #

Pick command depending on area the mouse pointer is in. The first matching area is chosen. If none match, only interrupt.

byAimModeHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI) Source #

composeIfLocalHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI) Source #

composeUnlessErrorHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI) Source #

compose2ndLocalHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) -> m (Either MError ReqUI) Source #

loopOnNothingHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) Source #

executeIfClearHuman :: MonadClientUI m => m (Either MError ReqUI) -> m (Either MError ReqUI) Source #

# Global commands that usually take time

waitHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed) Source #

Leader waits a turn (and blocks, etc.).

waitHuman10 :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed) Source #

Leader waits a 1/10th of a turn (and doesn't block, etc.).

yellHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed) Source #

Leader yells or yawns, if sleeping.

moveRunHuman :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> Bool -> Bool -> Vector -> m (FailOrCmd RequestTimed) Source #

runOnceAheadHuman :: MonadClientUI m => ActorId -> m (Either MError RequestTimed) Source #

moveOnceToXhairHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed) Source #

runOnceToXhairHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed) Source #

continueToXhairHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed) Source #

moveItemHuman :: MonadClientUI m => ActorId -> [CStore] -> CStore -> Maybe Text -> Bool -> m (FailOrCmd RequestTimed) Source #

projectHuman :: (MonadClient m, MonadClientUI m) => ActorId -> m (FailOrCmd RequestTimed) Source #

applyHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed) Source #

alterDirHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed) Source #

Ask for a direction and alter a tile, if possible.

alterWithPointerHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed) Source #

Try to alter a tile using a feature under the pointer.

closeDirHuman :: MonadClientUI m => ActorId -> m (FailOrCmd RequestTimed) Source #

Close nearby open tile; ask for direction, if there is more than one.

helpHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display command help.

hintHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display hint or, if already displayed, display help.

dashboardHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display the dashboard.

itemMenuHuman :: MonadClientUI m => ActorId -> (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

chooseItemMenuHuman :: MonadClientUI m => ActorId -> (KM -> HumanCmd -> m (Either MError ReqUI)) -> ItemDialogMode -> m (Either MError ReqUI) Source #

mainMenuHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display the main menu.

mainMenuAutoOnHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display the main menu and set `swasAutomated`.

mainMenuAutoOffHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display the main menu and unset `swasAutomated`.

settingsMenuHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display the settings menu.

challengeMenuHuman :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> m (Either MError ReqUI) Source #

Display the challenge menu.

gameDifficultyIncr :: MonadClient m => Int -> m () Source #

gameFishToggle :: MonadClient m => m () Source #

gameGoodsToggle :: MonadClient m => m () Source #

gameWolfToggle :: MonadClient m => m () Source #

gameKeeperToggle :: MonadClient m => m () Source #

gameScenarioIncr :: MonadClientUI m => Int -> m () Source #

# Global commands that never take time

gameExitWithHuman :: MonadClientUI m => ExitStrategy -> m (FailOrCmd ReqUI) Source #

data ExitStrategy Source #

Constructors

Restart |
Quit |

gameDropHuman :: MonadClientUI m => m ReqUI Source #

gameExitHuman :: Monad m => m ReqUI Source #

gameSaveHuman :: MonadClientUI m => m ReqUI Source #

doctrineHuman :: MonadClientUI m => m (FailOrCmd ReqUI) Source #

automateHuman :: MonadClientUI m => m (FailOrCmd ReqUI) Source #

automateToggleHuman :: MonadClientUI m => m (FailOrCmd ReqUI) Source #

automateBackHuman :: MonadClientUI m => m (Either MError ReqUI) Source #

# Internal operations

areaToRectangles :: MonadClientUI m => CmdArea -> m [Maybe Area] Source #

meleeAid :: (MonadClient m, MonadClientUI m) => ActorId -> ActorId -> m (FailOrCmd RequestTimed) Source #

Actor attacks an enemy actor or his own projectile.

displaceAid :: MonadClientUI m => ActorId -> ActorId -> m (FailOrCmd RequestTimed) Source #

Actor swaps position with another.

moveSearchAlter :: MonadClientUI m => ActorId -> Bool -> Vector -> m (FailOrCmd RequestTimed) Source #

Leader moves or searches or alters. No visible actor at the position.

alterCommon :: MonadClientUI m => ActorId -> Bool -> Point -> m (FailOrCmd RequestTimed) Source #

goToXhair :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> m (FailOrCmd RequestTimed) Source #

goToXhairExplorationMode :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> m (FailOrCmd RequestTimed) Source #

goToXhairGoTo :: (MonadClient m, MonadClientUI m) => ActorId -> Bool -> Bool -> m (FailOrCmd RequestTimed) Source #

multiActorGoTo :: (MonadClient m, MonadClientUI m) => LevelId -> Point -> RunParams -> m (FailOrCmd (Bool, Vector)) Source #

moveOrSelectItem :: MonadClientUI m => ActorId -> [CStore] -> CStore -> Maybe Text -> Bool -> m (FailOrCmd RequestTimed) Source #

selectItemsToMove :: MonadClientUI m => ActorId -> [CStore] -> CStore -> Maybe Text -> Bool -> m (FailOrCmd (CStore, [(ItemId, ItemQuant)])) Source #

moveItems :: MonadClientUI m => ActorId -> [CStore] -> (CStore, [(ItemId, ItemQuant)]) -> CStore -> m RequestTimed Source #

projectItem :: (MonadClient m, MonadClientUI m) => ActorId -> (CStore, (ItemId, ItemFull)) -> m (FailOrCmd RequestTimed) Source #

applyItem :: MonadClientUI m => ActorId -> (CStore, (ItemId, ItemFullKit)) -> m (FailOrCmd RequestTimed) Source #

alterTileAtPos :: MonadClientUI m => ActorId -> Point -> m (FailOrCmd RequestTimed) Source #

Try to alter a tile using a feature at the given position.

We don't check if the tile is interesting, e.g., if any embedded item can be triggered, because the player explicitely requested the action. Consequently, even if all embedded items are recharching, the time will be wasted and the server will describe the failure in detail.

verifyAlters :: MonadClientUI m => ActorId -> Bool -> Point -> m (FailOrCmd ()) Source #

Verify that the tile can be transformed or any embedded item effect triggered and the player is aware if the effect is dangerous or grave, such as ending the game.

processTileActions :: MonadClientUI m => ActorId -> Bool -> Point -> [TileAction] -> m (FailOrCmd ()) Source #

verifyEscape :: MonadClientUI m => m (FailOrCmd ()) Source #

verifyToolEffect :: MonadClientUI m => LevelId -> CStore -> ItemFull -> m (FailOrCmd ()) Source #

closeTileAtPos :: MonadClientUI m => ActorId -> Point -> m (FailOrCmd RequestTimed) Source #

Close tile at given position.

msgAddDone :: MonadClientUI m => Bool -> ActorId -> Point -> Text -> m () Source #

Adds message with proper names.

pickPoint :: MonadClientUI m => ActorId -> Text -> m (Maybe Point) Source #

Prompts user to pick a point.

generateMenu :: MonadClientUI m => (KM -> HumanCmd -> m (Either MError ReqUI)) -> FontOverlayMap -> [(Text, HumanCmd, Maybe HumanCmd, Maybe FontOverlayMap)] -> [String] -> String -> m (Either MError ReqUI) Source #