2023-12-10 16:00:50 +00:00
|
|
|
{-# LANGUAGE LambdaCase #-}
|
2023-12-04 16:20:06 +00:00
|
|
|
module Main where
|
|
|
|
|
2023-12-10 11:44:23 +00:00
|
|
|
import Control.Concurrent (threadDelay)
|
|
|
|
|
|
|
|
import Options.Applicative
|
|
|
|
|
|
|
|
-- internal imports
|
|
|
|
|
|
|
|
import Client.Communication
|
|
|
|
import Client.Types
|
|
|
|
|
2023-12-10 16:00:50 +00:00
|
|
|
import Library.Types
|
|
|
|
|
2023-12-04 16:20:06 +00:00
|
|
|
main :: IO ()
|
2023-12-10 11:44:23 +00:00
|
|
|
main = do
|
|
|
|
putStrLn "Hello, Arena!"
|
|
|
|
(Options socketLocation) <- execParser opts
|
|
|
|
putStrLn $ "connecting to Socket " <> socketLocation
|
2023-12-10 19:12:53 +00:00
|
|
|
sock <- connectSocket socketLocation
|
|
|
|
putStrLn "connected"
|
|
|
|
sendMessage (IdRequest) sock
|
2023-12-10 16:00:50 +00:00
|
|
|
threadDelay $ 5 * 10 ^ 6
|
2023-12-10 19:12:53 +00:00
|
|
|
-- message <- receiveMessage sock
|
|
|
|
-- putStrLn $ "getting first message" <> show message
|
|
|
|
-- let clientUUID = case message of
|
|
|
|
-- (AcceptClient aclientUUID ) -> aclientUUID
|
|
|
|
-- x -> error $ "unexpected message from server: " <> show message
|
|
|
|
-- let reader = ReaderContainer sock clientUUID
|
|
|
|
-- putStrLn $ "received uuid " <> show clientUUID
|
|
|
|
-- threadDelay $ 5 * 10 ^ 6
|
2023-12-10 11:44:23 +00:00
|
|
|
where
|
|
|
|
opts = info (options <**> helper)
|
|
|
|
( fullDesc
|
|
|
|
<> progDesc "Run the \"wizard-wipeout\" Server."
|
|
|
|
<> header "wizard-wipeout - Last Mage standing"
|
|
|
|
)
|