diff options
author | defanor <defanor@uberspace.net> | 2019-03-28 07:24:17 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2019-03-28 07:24:17 +0300 |
commit | 62586fc58a06c025419f912bf31532283b022104 (patch) | |
tree | d79ef93ad505c606f984b455c8419363bc2b333c | |
parent | 0165caef2f5651231ef3cd216192f8a3a7a99b39 (diff) |
Shorten commands
-rw-r--r-- | DWProxy.hs | 21 | ||||
-rw-r--r-- | README.md | 6 |
2 files changed, 13 insertions, 14 deletions
@@ -275,19 +275,18 @@ data Config = Config { cClient :: Socket } pRouteChoice :: Parser Command -pRouteChoice = do - _ <- "route " - d <- decimal - _ <- "\r\n" - pure $ RouteChoice d +pRouteChoice = RouteChoice <$> decimal <* "\r\n" pSpeedWalk :: Parser Command -pSpeedWalk = do - _ <- "speedwalk " - from <- ("from " *> (Just <$> manyTill (notChar '\255') " to ")) - <|> ("to " *> pure Nothing) - to <- manyTill (notChar '\255') "\r\n" - pure $ SpeedWalk from to +pSpeedWalk = full <|> short + where + short = "sw " *> (SpeedWalk Nothing <$> manyTill (notChar '\255') "\r\n") + full = do + _ <- "speedwalk " + from <- ("from " *> (Just <$> manyTill (notChar '\255') " to ")) + <|> ("to " *> pure Nothing) + to <- manyTill (notChar '\255') "\r\n" + pure $ SpeedWalk from to pShopSearch :: Parser Command pShopSearch = ShopSearch <$> ("shop " *> manyTill (notChar '\255') "\r\n") @@ -3,9 +3,9 @@ This is a client-agnostic proxy for the Discworld MUD, which adds new commands: -- `speedwalk [from <location>] to <location>`: find routes, walk if - there's only one -- `route <n>`: select a speedwalk route option +- `speedwalk [from <location>] to <location>` or `sw <destination>`: + find routes, walk if there's only one +- `<number>`: select a speedwalk route option - `shop <item>`: search shops by items they sell It uses the database from [Quow's Cow Bar and |