module Client.UI.Content.Input
( standardKeysAndMouse
#ifdef EXPOSE_INTERNAL
, closeDoorTriggers, applyTs
#endif
) where
import Prelude ()
import Game.LambdaHack.Core.Prelude
import Game.LambdaHack.Client.UI.Content.Input
import Game.LambdaHack.Client.UI.HumanCmd
import qualified Game.LambdaHack.Content.TileKind as TK
import Game.LambdaHack.Definition.Defs
standardKeysAndMouse :: InputContentRaw
standardKeysAndMouse :: InputContentRaw
standardKeysAndMouse = [(KM, CmdTriple)] -> InputContentRaw
InputContentRaw ([(KM, CmdTriple)] -> InputContentRaw)
-> [(KM, CmdTriple)] -> InputContentRaw
forall a b. (a -> b) -> a -> b
$ ((String, CmdTriple) -> (KM, CmdTriple))
-> [(String, CmdTriple)] -> [(KM, CmdTriple)]
forall a b. (a -> b) -> [a] -> [b]
map (String, CmdTriple) -> (KM, CmdTriple)
evalKeyDef ([(String, CmdTriple)] -> [(KM, CmdTriple)])
-> [(String, CmdTriple)] -> [(KM, CmdTriple)]
forall a b. (a -> b) -> a -> b
$
[ ("e", ([CmdCategory
CmdMainMenu], "enter challenges menu>", HumanCmd
ChallengesMenu))
, ("s", ([CmdCategory
CmdMainMenu], "start new game", HumanCmd
GameRestart))
, ("x", ([CmdCategory
CmdMainMenu], "save and exit to desktop", HumanCmd
GameExit))
, ("v", ([CmdCategory
CmdMainMenu], "visit settings menu>", HumanCmd
SettingsMenu))
, ("t", ([CmdCategory
CmdMainMenu], "toggle autoplay (insert coin)", HumanCmd
AutomateToggle))
, ("?", ([CmdCategory
CmdMainMenu], "see command help", HumanCmd
Help))
, ("F12", ([CmdCategory
CmdMainMenu], "switch to dashboard", HumanCmd
Dashboard))
, ("Escape", ([CmdCategory
CmdMainMenu], "back to playing", HumanCmd
AutomateBack))
, ("E", ( [CmdCategory
CmdMinimal, CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, "manage equipment of the leader"
, ItemDialogMode -> HumanCmd
ChooseItemMenu (CStore -> ItemDialogMode
MStore CStore
CEqp) ))
, ("g", CmdCategory -> CmdTriple -> CmdTriple
addCmdCategory CmdCategory
CmdMinimal (CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ Text -> CmdTriple
grabItems "grab item(s)")
, ("Escape", ( [CmdCategory
CmdMinimal, CmdCategory
CmdAim]
, "open main menu/finish aiming"
, AimModeCmd -> HumanCmd
ByAimMode $WAimModeCmd :: HumanCmd -> HumanCmd -> AimModeCmd
AimModeCmd { exploration :: HumanCmd
exploration =
HumanCmd -> HumanCmd
ExecuteIfClear HumanCmd
MainMenuAutoOff
, aiming :: HumanCmd
aiming = HumanCmd
Cancel } ))
, ("C-Escape", ([CmdCategory
CmdNoHelp], "", HumanCmd
MainMenuAutoOn))
, ("Return", ( [CmdCategory
CmdMinimal, CmdCategory
CmdAim]
, "open dashboard/accept target"
, AimModeCmd -> HumanCmd
ByAimMode $WAimModeCmd :: HumanCmd -> HumanCmd -> AimModeCmd
AimModeCmd { exploration :: HumanCmd
exploration = HumanCmd -> HumanCmd
ExecuteIfClear HumanCmd
Dashboard
, aiming :: HumanCmd
aiming = HumanCmd
Accept } ))
, ("space", ( [CmdCategory
CmdMinimal, CmdCategory
CmdMeta]
, "clear messages and show history"
, HumanCmd -> HumanCmd
ExecuteIfClear HumanCmd
LastHistory ))
, ("Tab", ( [CmdCategory
CmdMove]
, "cycle among party members on the level"
, HumanCmd
MemberCycle ))
, ("BackTab", ( [CmdCategory
CmdMinimal, CmdCategory
CmdMove]
, "cycle among all party members"
, HumanCmd
MemberBack ))
, ("KP_Multiply", ( [CmdCategory
CmdMinimal, CmdCategory
CmdAim]
, "cycle x-hair among enemies"
, HumanCmd
AimEnemy ))
, ("KP_Divide", ([CmdCategory
CmdMinimal, CmdCategory
CmdAim], "cycle x-hair among items", HumanCmd
AimItem))
, ("c", ( [CmdCategory
CmdMinimal, CmdCategory
CmdMove]
, [TriggerTile] -> Text
descTs [TriggerTile]
closeDoorTriggers
, [TriggerTile] -> HumanCmd
AlterDir [TriggerTile]
closeDoorTriggers ))
, ("%", ([CmdCategory
CmdMinimal, CmdCategory
CmdMeta], "yell/yawn", HumanCmd
Yell))
, ("comma", Text -> CmdTriple
grabItems "")
, ("d", Text -> CmdTriple
dropItems "drop item(s)")
, ("period", Text -> CmdTriple
dropItems "")
, ("f", CmdCategory -> CmdTriple -> CmdTriple
addCmdCategory CmdCategory
CmdItemMenu (CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ [TriggerItem] -> CmdTriple
projectA [TriggerItem]
flingTs)
, ("C-f", CmdCategory -> CmdTriple -> CmdTriple
addCmdCategory CmdCategory
CmdItemMenu
(CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ Text -> CmdTriple -> CmdTriple
replaceDesc "auto-fling and keep choice"
(CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ [TriggerItem] -> CmdTriple
projectI [TriggerItem]
flingTs)
, ("a", CmdCategory -> CmdTriple -> CmdTriple
addCmdCategory CmdCategory
CmdItemMenu (CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ [TriggerItem] -> CmdTriple
applyI [TriggerItem]
applyTs)
, ("C-a", CmdCategory -> CmdTriple -> CmdTriple
addCmdCategory CmdCategory
CmdItemMenu
(CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ Text -> CmdTriple -> CmdTriple
replaceDesc "apply and keep choice" (CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ [TriggerItem] -> CmdTriple
applyIK [TriggerItem]
applyTs)
, ("p", [CStore] -> CStore -> Part -> Bool -> CmdTriple
moveItemTriple [CStore
CGround, CStore
CEqp, CStore
CSha] CStore
CInv
"item" Bool
False)
, ("i", Text -> CmdTriple -> CmdTriple
replaceDesc "" (CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ [CStore] -> CStore -> Part -> Bool -> CmdTriple
moveItemTriple [CStore
CGround, CStore
CEqp, CStore
CSha] CStore
CInv
"item" Bool
False)
, ("e", [CStore] -> CStore -> Part -> Bool -> CmdTriple
moveItemTriple [CStore
CGround, CStore
CInv, CStore
CSha] CStore
CEqp
"item" Bool
False)
, ("s", [CStore] -> CStore -> Part -> Bool -> CmdTriple
moveItemTriple [CStore
CGround, CStore
CInv, CStore
CEqp] CStore
CSha
"and share item" Bool
False)
, ("C", ([CmdCategory
CmdMove], "open or close or alter", [TriggerTile] -> HumanCmd
AlterDir []))
, ("=", ( [CmdCategory
CmdMove], "select (or deselect) party member", HumanCmd
SelectActor) )
, ("_", ([CmdCategory
CmdMove], "deselect (or select) all on the level", HumanCmd
SelectNone))
, ("semicolon", ( [CmdCategory
CmdMove]
, "go to x-hair for 25 steps"
, [String] -> HumanCmd
Macro ["C-semicolon", "C-quotedbl", "C-V"] ))
, ("colon", ( [CmdCategory
CmdMove]
, "run to x-hair collectively for 25 steps"
, [String] -> HumanCmd
Macro ["C-colon", "C-quotedbl", "C-V"] ))
, ("x", ( [CmdCategory
CmdMove]
, "explore nearest unknown spot"
, HumanCmd
autoexploreCmd ))
, ("X", ( [CmdCategory
CmdMove]
, "autoexplore 25 times"
, HumanCmd
autoexplore25Cmd ))
, ("R", ([CmdCategory
CmdMove], "rest (wait 25 times)", [String] -> HumanCmd
Macro ["KP_Begin", "C-V"]))
, ("C-R", ( [CmdCategory
CmdMove], "heed (lurk 0.1 turns 100 times)"
, [String] -> HumanCmd
Macro ["C-KP_Begin", "V"] ))
, ("P", ( [CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, "manage inventory pack of the leader"
, ItemDialogMode -> HumanCmd
ChooseItemMenu (CStore -> ItemDialogMode
MStore CStore
CInv) ))
, ("I", ( [CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, ""
, ItemDialogMode -> HumanCmd
ChooseItemMenu (CStore -> ItemDialogMode
MStore CStore
CInv) ))
, ("S", ( [CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, "manage the shared party stash"
, ItemDialogMode -> HumanCmd
ChooseItemMenu (CStore -> ItemDialogMode
MStore CStore
CSha) ))
, ("G", ( [CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, "manage items on the ground"
, ItemDialogMode -> HumanCmd
ChooseItemMenu (CStore -> ItemDialogMode
MStore CStore
CGround) ))
, ("A", ( [CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, "manage all owned items"
, ItemDialogMode -> HumanCmd
ChooseItemMenu ItemDialogMode
MOwned ))
, ("@", ( [CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, "describe organs of the leader"
, ItemDialogMode -> HumanCmd
ChooseItemMenu ItemDialogMode
MOrgans ))
, ("#", ( [CmdCategory
CmdItem, CmdCategory
CmdDashboard]
, "show skill summary of the leader"
, ItemDialogMode -> HumanCmd
ChooseItemMenu ItemDialogMode
MSkills ))
, ("~", ( [CmdCategory
CmdItem]
, "display known lore"
, ItemDialogMode -> HumanCmd
ChooseItemMenu (SLore -> ItemDialogMode
MLore SLore
SItem) ))
, ("safeD0", ([CmdCategory
CmdInternal, CmdCategory
CmdDashboard], "", HumanCmd
Cancel))
]
[(String, CmdTriple)]
-> [(String, CmdTriple)] -> [(String, CmdTriple)]
forall a. [a] -> [a] -> [a]
++
((Int, SLore) -> (String, CmdTriple))
-> [(Int, SLore)] -> [(String, CmdTriple)]
forall a b. (a -> b) -> [a] -> [b]
map (\(k :: Int
k, slore :: SLore
slore) -> ("safeD" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (Int
k :: Int)
, ( [CmdCategory
CmdInternal, CmdCategory
CmdDashboard]
, "display" Text -> Text -> Text
<+> SLore -> Text
ppSLore SLore
slore Text -> Text -> Text
<+> "lore"
, ItemDialogMode -> HumanCmd
ChooseItemMenu (SLore -> ItemDialogMode
MLore SLore
slore) )))
([Int] -> [SLore] -> [(Int, SLore)]
forall a b. [a] -> [b] -> [(a, b)]
zip [1..] [SLore
forall a. Bounded a => a
minBound..SLore
forall a. Bounded a => a
maxBound])
[(String, CmdTriple)]
-> [(String, CmdTriple)] -> [(String, CmdTriple)]
forall a. [a] -> [a] -> [a]
++
[ ("safeD98", ( [CmdCategory
CmdInternal, CmdCategory
CmdDashboard]
, "display place lore"
, ItemDialogMode -> HumanCmd
ChooseItemMenu ItemDialogMode
MPlaces) )
, ("safeD99", ([CmdCategory
CmdInternal, CmdCategory
CmdDashboard], "", HumanCmd
Cancel))
, ("!", ([CmdCategory
CmdAim], "", HumanCmd
AimEnemy))
, ("/", ([CmdCategory
CmdAim], "", HumanCmd
AimItem))
, ("+", ([CmdCategory
CmdAim], "swerve the aiming line", Bool -> HumanCmd
EpsIncr Bool
True))
, ("-", ([CmdCategory
CmdAim], "unswerve the aiming line", Bool -> HumanCmd
EpsIncr Bool
False))
, ("\\", ([CmdCategory
CmdAim], "cycle aiming modes", HumanCmd
AimFloor))
, ("C-?", ( [CmdCategory
CmdAim]
, "set x-hair to nearest unknown spot"
, HumanCmd
XhairUnknown ))
, ("C-/", ( [CmdCategory
CmdAim]
, "set x-hair to nearest item"
, HumanCmd
XhairItem ))
, ("C-{", ( [CmdCategory
CmdAim]
, "set x-hair to nearest upstairs"
, Bool -> HumanCmd
XhairStair Bool
True ))
, ("C-}", ( [CmdCategory
CmdAim]
, "set x-hair to nearest dnstairs"
, Bool -> HumanCmd
XhairStair Bool
False ))
, ("<", ([CmdCategory
CmdAim], "move aiming one level up" , Int -> HumanCmd
AimAscend 1))
, ("C-<", ( [CmdCategory
CmdNoHelp], "move aiming 10 levels up"
, Int -> HumanCmd
AimAscend 10) )
, (">", ([CmdCategory
CmdAim], "move aiming one level down", Int -> HumanCmd
AimAscend (-1)))
, ("C->", ( [CmdCategory
CmdNoHelp], "move aiming 10 levels down"
, Int -> HumanCmd
AimAscend (-10)) )
, ("BackSpace" , ( [CmdCategory
CmdAim]
, "clear chosen item and x-hair"
, HumanCmd -> HumanCmd -> HumanCmd
ComposeUnlessError HumanCmd
ClearTargetIfItemClear HumanCmd
ItemClear))
, ("C-s", ([CmdCategory
CmdMeta], "start new game", HumanCmd
GameRestart))
, ("C-x", ([CmdCategory
CmdMeta], "save and exit to desktop", HumanCmd
GameExit))
, ("C-t", ([CmdCategory
CmdMeta], "toggle autoplay (insert coin)", HumanCmd
Automate))
, ("C-q", ([CmdCategory
CmdMeta], "quit game and start autoplay", HumanCmd
GameQuit))
, ("C-c", ([CmdCategory
CmdMeta], "exit to desktop without saving", HumanCmd
GameDrop))
, ("?", ([CmdCategory
CmdMeta], "display help", HumanCmd
Hint))
, ("F1", ([CmdCategory
CmdMeta, CmdCategory
CmdDashboard], "display help immediately", HumanCmd
Help))
, ("F12", ([CmdCategory
CmdMeta], "open dashboard", HumanCmd
Dashboard))
, ("v", ([CmdCategory
CmdMeta], "voice again the recorded commands", Int -> HumanCmd
Repeat 1))
, ("V", Int -> CmdTriple
repeatTriple 100)
, ("C-v", Int -> CmdTriple
repeatTriple 1000)
, ("C-V", Int -> CmdTriple
repeatTriple 25)
, ("'", ([CmdCategory
CmdMeta], "start recording commands", HumanCmd
Record))
, ("C-S", ([CmdCategory
CmdMeta], "save game backup", HumanCmd
GameSave))
, ("C-P", ([CmdCategory
CmdMeta], "print screen", HumanCmd
PrintScreen))
, ("safeD101", ([CmdCategory
CmdInternal, CmdCategory
CmdDashboard], "display history", HumanCmd
AllHistory))
, ( "LeftButtonRelease"
, HumanCmd -> Text -> CmdTriple
mouseLMB HumanCmd
goToCmd
"go to pointer for 25 steps/fling at enemy" )
, ( "S-LeftButtonRelease"
, HumanCmd -> Text -> CmdTriple
mouseLMB HumanCmd
runToAllCmd
"run to pointer collectively for 25 steps/fling at enemy" )
, ("RightButtonRelease", CmdTriple
mouseRMB)
, ("C-LeftButtonRelease", Text -> CmdTriple -> CmdTriple
replaceDesc "" CmdTriple
mouseRMB)
, ( "S-RightButtonRelease"
, ([CmdCategory
CmdMouse], "open or close or alter at pointer", [TriggerTile] -> HumanCmd
AlterWithPointer []) )
, ("MiddleButtonRelease", CmdTriple
mouseMMB)
, ("C-RightButtonRelease", Text -> CmdTriple -> CmdTriple
replaceDesc "" CmdTriple
mouseMMB)
, ( "C-S-LeftButtonRelease",
CmdCategory -> CmdTriple -> CmdTriple
addCmdCategory CmdCategory
CmdNoHelp (CmdTriple -> CmdTriple) -> CmdTriple -> CmdTriple
forall a b. (a -> b) -> a -> b
$ Text -> CmdTriple -> CmdTriple
replaceDesc "" CmdTriple
mouseMMB )
, ("WheelNorth", ([CmdCategory
CmdMouse], "swerve the aiming line", [String] -> HumanCmd
Macro ["+"]))
, ("WheelSouth", ([CmdCategory
CmdMouse], "unswerve the aiming line", [String] -> HumanCmd
Macro ["-"]))
, ("C-semicolon", ( [CmdCategory
CmdNoHelp]
, "move one step towards the x-hair"
, HumanCmd
MoveOnceToXhair ))
, ("C-colon", ( [CmdCategory
CmdNoHelp]
, "run collectively one step towards the x-hair"
, HumanCmd
RunOnceToXhair ))
, ("C-quotedbl", ( [CmdCategory
CmdNoHelp]
, "continue towards the x-hair"
, HumanCmd
ContinueToXhair ))
, ("C-comma", ([CmdCategory
CmdNoHelp], "run once ahead", HumanCmd
RunOnceAhead))
, ("safe1", ( [CmdCategory
CmdInternal]
, "go to pointer for 25 steps"
, HumanCmd
goToCmd ))
, ("safe2", ( [CmdCategory
CmdInternal]
, "run to pointer collectively"
, HumanCmd
runToAllCmd ))
, ("safe3", ( [CmdCategory
CmdInternal]
, "pick new leader on screen"
, HumanCmd
PickLeaderWithPointer ))
, ("safe4", ( [CmdCategory
CmdInternal]
, "select party member on screen"
, HumanCmd
SelectWithPointer ))
, ("safe5", ( [CmdCategory
CmdInternal]
, "set x-hair to enemy"
, HumanCmd
AimPointerEnemy ))
, ("safe6", ( [CmdCategory
CmdInternal]
, "fling at enemy under pointer"
, HumanCmd
aimFlingCmd ))
, ("safe7", ( [CmdCategory
CmdInternal, CmdCategory
CmdDashboard]
, "open main menu"
, HumanCmd
MainMenuAutoOff ))
, ("safe8", ( [CmdCategory
CmdInternal]
, "cancel aiming"
, HumanCmd
Cancel ))
, ("safe9", ( [CmdCategory
CmdInternal]
, "accept target"
, HumanCmd
Accept ))
, ("safe10", ( [CmdCategory
CmdInternal]
, "wait a turn, bracing for impact"
, HumanCmd
Wait ))
, ("safe11", ( [CmdCategory
CmdInternal]
, "lurk 0.1 of a turn"
, HumanCmd
Wait10 ))
, ("safe12", ( [CmdCategory
CmdInternal]
, "snap x-hair to enemy"
, HumanCmd
XhairPointerEnemy ))
]
[(String, CmdTriple)]
-> [(String, CmdTriple)] -> [(String, CmdTriple)]
forall a. [a] -> [a] -> [a]
++ (Int -> (String, CmdTriple)) -> [Int] -> [(String, CmdTriple)]
forall a b. (a -> b) -> [a] -> [b]
map Int -> (String, CmdTriple)
defaultHeroSelect [0..6]
closeDoorTriggers :: [TriggerTile]
closeDoorTriggers :: [TriggerTile]
closeDoorTriggers =
[ $WTriggerTile :: Part -> Part -> Feature -> TriggerTile
TriggerTile { ttverb :: Part
ttverb = "close"
, ttobject :: Part
ttobject = "door"
, ttfeature :: Feature
ttfeature = GroupName TileKind -> Feature
TK.CloseTo "closed vertical door Lit" }
, $WTriggerTile :: Part -> Part -> Feature -> TriggerTile
TriggerTile { ttverb :: Part
ttverb = "close"
, ttobject :: Part
ttobject = "door"
, ttfeature :: Feature
ttfeature = GroupName TileKind -> Feature
TK.CloseTo "closed horizontal door Lit" }
, $WTriggerTile :: Part -> Part -> Feature -> TriggerTile
TriggerTile { ttverb :: Part
ttverb = "close"
, ttobject :: Part
ttobject = "door"
, ttfeature :: Feature
ttfeature = GroupName TileKind -> Feature
TK.CloseTo "closed vertical door Dark" }
, $WTriggerTile :: Part -> Part -> Feature -> TriggerTile
TriggerTile { ttverb :: Part
ttverb = "close"
, ttobject :: Part
ttobject = "door"
, ttfeature :: Feature
ttfeature = GroupName TileKind -> Feature
TK.CloseTo "closed horizontal door Dark" }
]
applyTs :: [TriggerItem]
applyTs :: [TriggerItem]
applyTs = [$WTriggerItem :: Part -> Part -> String -> TriggerItem
TriggerItem { tiverb :: Part
tiverb = "apply"
, tiobject :: Part
tiobject = "consumable"
, tisymbols :: String
tisymbols = "!,?/" }]