module Game.Antisplice.Monad where
import Game.Antisplice.Templates
import Data.Chatty.AVL
import Data.Chatty.None
import Data.Chatty.Fail
import Data.Chatty.Counter
import Game.Antisplice.Monad.Dungeon
import Game.Antisplice.Monad.Vocab
import Data.Chatty.Atoms
import Data.Chatty.BST
import Game.Antisplice.Errors
import Control.Monad
import Control.Monad.Trans.Class
import Text.Chatty.Expansion
import Text.Chatty.Expansion.Vars
import Text.Chatty.Templates
import Text.Chatty.Interactor
import Text.Chatty.Interactor.Templates
import Text.Chatty.Channel.Printer
import Text.Chatty.Channel.Broadcast
import Text.Chatty.Extended.HTML
import Text.Chatty.Extended.ANSI
import Text.Chatty.Printer
import System.IO
mkInteractor ''SplErrT mkChatty mkRoom mkDungeon mkObject mkCounter mkPlayer mkIO mkVocab mkAtoms (mkChannelPrinter ''PlayerId)
mkInteractor ''DungeonT mkPrinter mkDefCP mkExtendedPrinter mkScanner mkFinalizer mkClock mkExpanderEnv mkHistoryEnv mkRandom (mkFail ''SplErr) mkCounter mkIO mkVocab mkAtoms (mkChannelPrinter ''PlayerId)
mkInteractor ''RoomT mkChatty (mkFail ''SplErr) mkCounter mkIO mkVocab mkAtoms (mkChannelPrinter ''PlayerId)
mkInteractor ''ObjectT mkChatty (mkFail ''SplErr) mkCounter mkIO mkVocab mkAtoms (mkChannelPrinter ''PlayerId)
mkInteractor ''CounterT mkChatty (mkFail ''SplErr) mkRoom mkObject mkDungeon mkPlayer mkIO mkVocab mkAtoms (mkChannelPrinter ''PlayerId)
mkInteractor ''PlayerT mkChatty (mkFail ''SplErr) mkCounter mkIO mkVocab mkAtoms (mkChannelPrinter ''PlayerId)
mkInteractor ''VocabT mkChatty (mkFail ''SplErr) mkCounter mkDungeon mkRoom mkAtoms mkPlayer (mkChannelPrinter ''PlayerId)
mkInteractor ''AtomStoreT mkChatty (mkFail ''SplErr) mkDungeon mkRoom mkVocab mkPlayer (mkChannelPrinter ''PlayerId)
mkInteractor ''PlayerFilterT mkArchiver mkVocab mkAtoms mkCounter
liftM concat $ forM [''AnsiPrinterT,''HtmlPrinterT,''ExpanderT,''NullExpanderT,''RecorderT] $ \s ->
mkInteractor s (mkChannelPrinter ''PlayerId) mkDungeon mkPlayer mkRoom (mkFail ''SplErr)
instance ChChannelPrinter PlayerId m => ChBroadcaster PlayerId (DungeonT m) where
bprint c str = do
s <- getDungeonState
forM_ (anyBstInorder $ playersOf s) $ \p -> do
b <- c $ indexOf p
when b $ cprint (indexOf p) str