Skip to content
Browse files

Color map.

  • Loading branch information...
1 parent 37a6fb8 commit ae326fc8015f42e5c20dbce5173d2a64e1fe5b67 @clanehin committed Oct 1, 2012
View
2 Roguestar/Lib/Perception.hs
@@ -89,7 +89,7 @@ whoAmI = DBPerception $ ask
runPerception :: (DBReadable db) => CreatureRef -> (forall m. DBReadable m => DBPerception m a) -> db a
runPerception creature_ref perception = dbSimulate $ runReaderT (fromPerception perception) creature_ref
-visibleTerrain :: (DBReadable db) => DBPerception db [(TerrainPatch,Position)]
+visibleTerrain :: (DBReadable db) => DBPerception db [(Position,TerrainPatch)]
visibleTerrain =
do plane_ref <- whatPlaneAmIOn
faction <- myFaction
View
8 Roguestar/Lib/PlaneVisibility.hs
@@ -34,15 +34,15 @@ dbGetSeersForFaction faction plane_ref =
-- to the specified faction on the specified plane.
--
dbGetVisibleTerrainForFaction :: (DBReadable db) => Faction -> PlaneRef ->
- db [(TerrainPatch,Position)]
+ db [(Position,TerrainPatch)]
dbGetVisibleTerrainForFaction faction plane_ref =
do critters <- dbGetSeersForFaction faction plane_ref
liftM (nub . concat) $ mapRO dbGetVisibleTerrainForCreature critters
-- |
-- Returns a list of all terrain patches that are visible to the specified creature.
--
-dbGetVisibleTerrainForCreature :: (DBReadable db) => CreatureRef -> db [(TerrainPatch,Position)]
+dbGetVisibleTerrainForCreature :: (DBReadable db) => CreatureRef -> db [(Position,TerrainPatch)]
dbGetVisibleTerrainForCreature creature_ref =
do loc <- liftM identityDetail $ getPlanarLocation creature_ref
spot_check <- dbGetSpotCheck creature_ref
@@ -112,10 +112,10 @@ dbGetHideCheck _ | otherwise = return 1
-- visibleTerrain (creature's location) (spot check) (the terrain map) gives
-- a list of visible terrain patches from that location with that spot check.
--
-visibleTerrain :: Position -> Integer -> TerrainGrid -> [(TerrainPatch,Position)]
+visibleTerrain :: Position -> Integer -> TerrainGrid -> [(Position,TerrainPatch)]
visibleTerrain (Position (creature_at@(creature_x,creature_y))) spot_check terrain =
let max_range = maximumRangeForSpotCheck spot_check
- in map (\(x,y) -> (gridAt terrain (x,y),Position (x,y))) $
+ in map (\(x,y) -> (Position (x,y),gridAt terrain (x,y))) $
castRays creature_at
[terrainPatchBrightnessForm creature_at spot_check (creature_x+x,creature_y+y)
| x <- [-max_range..max_range],
View
168 Roguestar/Server/Main.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TemplateHaskell, OverloadedStrings, ScopedTypeVariables #-}
+{-# LANGUAGE TemplateHaskell, OverloadedStrings, ScopedTypeVariables, PatternGuards #-}
import Prelude
import qualified Data.ByteString as BS
@@ -49,6 +49,7 @@ import Data.UUID
import qualified System.UUID.V4 as V4
import GHC.Stats
import Data.Aeson as Aeson
+import qualified Data.HashMap.Strict as HashMap
data App = App {
_app_game_state :: GameState,
@@ -106,17 +107,25 @@ getBasicState = gets _globals
handle404 :: Handler App App ()
handle404 =
do modifyResponse $ setResponseCode 404
- globals <- getBasicState
- writeLazyText =<< liftIO (renderPage "static/404.mustache" globals)
+ staticTemplate "static/404.mustache"
static :: Handler App App ()
static = serveDirectory "./static/"
staticTemplate :: FilePath -> Handler App App ()
staticTemplate filepath = method GET $ ifTop $
do globals <- getBasicState
- t <- liftIO $ renderPage filepath globals
- writeLazyText t
+ renderThemedPage filepath $ object [
+ "static" .= True,
+ "server-globals" .= globals,
+ "path" .= filepath ]
+
+renderThemedPage :: FilePath -> Aeson.Value -> Handler App App ()
+renderThemedPage filepath value =
+ do theme <- liftM (fromMaybe "default") $ getQueryParam "theme"
+ case theme of
+ "default" -> writeLazyText =<< liftIO (renderPage filepath value)
+ "json" -> writeLBS $ Aeson.encode value
postFeedback :: Handler App App ()
postFeedback = method POST $ ifTop $
@@ -134,15 +143,14 @@ options =
let server_statistics = object [
"server-statistics" .= show stats,
"number-of-games" .= number_of_games ]
- writeLazyText =<< liftIO (renderPage "static/options.mustache" server_statistics)
+ renderThemedPage "static/options.mustache" server_statistics
play :: Handler App App ()
play =
do resolveSnapshots
g <- getGame
player_state <- oops $ liftIO $ getPlayerState g
route [("",ifTop $ method GET $ displayGameState player_state),
- ("maptext",method GET $ createMap >>= writeText),
("reroll",method POST $ reroll player_state),
("accept",method POST $ accept player_state),
("move",method POST $ move)]
@@ -177,11 +185,11 @@ getGameState (SpeciesSelectionState (Just creature)) =
]
]
getGameState (PlayerCreatureTurn creature_ref) =
- do map_text <- createMap
+ do map_content <- generateMapContent
player_stats <- createStatsBlock
messages <- liftM (reverse . take 5) $ liftIO . getMessages =<< getGame
return $ object [ "play" .= object [
- "map" .= map_text,
+ "map" .= map_content,
"statsblock" .= player_stats,
"messages" .= messages ]]
getGameState (GameOver PlayerIsDead) =
@@ -194,7 +202,7 @@ getGameState (GameOver PlayerIsVictorious) =
displayGameState :: PlayerState -> Handler App App ()
displayGameState player_state =
do game_state <- getGameState player_state
- writeLazyText =<< liftIO (renderPage "static/play.mustache" game_state)
+ renderThemedPage "static/play.mustache" game_state
data Inventory = Inventory {
inventory_wielded :: Maybe VisibleObject,
@@ -291,7 +299,7 @@ unwield = commitBehavior Unwield
start :: Handler App App ()
start = on_get <|> on_post
- where on_get = method GET $ writeLazyText =<< liftIO (renderPage "static/start.mustache" (object []))
+ where on_get = method GET $ renderThemedPage "static/start.mustache" (object [])
on_post = method POST $
do game_state <- gets _app_game_state
config <- liftIO $ getConfiguration default_timeout
@@ -360,44 +368,42 @@ getGame =
Nothing -> redirect "/start"
data MapData = MapData {
- md_visible_terrain :: [(TerrainPatch,Position)],
+ md_visible_terrain :: Map.Map Position TerrainPatch,
md_visible_objects :: Map.Map Position [VisibleObject],
md_position_info :: (Facing,Position) }
-createMap :: Handler App App T.Text
-createMap =
+generateMapContent :: Handler App App Aeson.Value
+generateMapContent =
do let (x,y) = (21,21) --we'll probably want to let the player customize this later
g <- getGame
map_data <- oops $ liftIO $ perceive g $
- do visible_terrain <- visibleTerrain
+ do visible_terrain <- liftM Map.fromList visibleTerrain
visible_objects <- liftM stackVisibleObjects $ visibleObjects (const $ return True)
my_position <- whereAmI
return $ MapData visible_terrain visible_objects my_position
- return $ constructMapText (x,y) map_data
-
-constructMapText :: (Integer,Integer) -> MapData -> T.Text
-constructMapText (width,height) _ | width `mod` 2 == 0 || height `mod` 2 == 0 = error "Map widths and heights must be odd numbers"
-constructMapText (width,height) (MapData visible_terrain visible_objects (_,Position (center_x,center_y))) = T.unfoldr f (False,0)
- where f :: (Bool,Int) -> Maybe (Char, (Bool,Int))
- f (False,i) = if i > snd (bounds char_array)
- then Nothing
- else Just (char_array ! i,(succ i `mod` fromInteger width == 0,succ i))
- f (True,i) = Just ('\n',(False,i))
- x_adjust = center_x - (width-1) `div` 2
- y_adjust = center_y - (height-1) `div` 2
- array_length = fromInteger $ width*height
- char_array :: UArray Int Char
- char_array = runSTUArray $
- do ax <- newArray (0,array_length-1) ' '
- forM_ visible_terrain $ \(tp,Position (x,y)) ->
- do let i = fromInteger $ (x-x_adjust) + (height-(y-y_adjust)-1)*width
- when (i >= 0 && i < array_length-1) $
- writeArray ax i $ charcodeOf tp
- forM_ (Map.assocs visible_objects) $ \(Position (x,y), vobs) ->
- do let i = fromInteger $ (x-x_adjust) + (height-(y-y_adjust)-1) * width
- when (i >= 0 && i < array_length-1) $
- writeArray ax i $ charcodeOf vobs
- return ax
+ return $ generateMapContent_ (x,y) map_data
+
+generateMapContent_ :: (Integer,Integer) -> MapData -> Aeson.Value
+generateMapContent_ (width,height) _ | width `mod` 2 == 0 || height `mod` 2 == 0 = error "Map widths and heights must be odd numbers"
+generateMapContent_ (width,height) (MapData visible_terrain visible_objects (_,Position (center_x,center_y))) = object [ "map-content" .= maplines ]
+ where maplines =
+ do y <- reverse $ [center_y - height `div` 2 .. center_y + width `div` 2]
+ return $ Aeson.toJSON $ map ungroup $ List.group $ mapline y
+ ungroup [x] = x -- do run-length encoding on the result:
+ ungroup xs@(Aeson.Object hashmap:_) =
+ let String str = fromMaybe (error "no 't'") $ HashMap.lookup "t" hashmap
+ in Aeson.Object $ HashMap.insert "t" (String $ T.replicate (length xs) str) hashmap
+ mapline y =
+ do x <- [center_x - width `div` 2 .. center_x + width `div` 2]
+ return $ Aeson.toJSON $ mapstring x y
+ mapstring x y =
+ let maybe_terrain = Map.lookup (Position (x,y)) visible_terrain
+ maybe_object = Map.lookup (Position (x,y)) visible_objects
+ rendered_json = case () of
+ () | Just (vob:_) <- maybe_object -> rendering vob
+ () | Just terrain <- maybe_terrain -> rendering terrain
+ () | otherwise -> object [ "t" .= ' ' ]
+ in rendered_json
data StatsData = StatsData {
stats_health :: CreatureHealth,
@@ -420,46 +426,66 @@ createStatsBlock =
T.concat ["Compass: ",
T.pack $ show $ stats_compass stats]]
-class Charcoded a where
- charcodeOf :: a -> Char
+data Style = Empty | Strong | Rocky | Icy | Plants | Dusty | Sandy | Wet | DeepWet | Molten | Gloomy | FaintMagic | StrongMagic | StrongDusty
+
+styleToCSS :: Style -> T.Text
+styleToCSS Empty = ""
+styleToCSS Strong = "B"
+styleToCSS Rocky = "r"
+styleToCSS Icy = "i"
+styleToCSS Plants = "p"
+styleToCSS Dusty = "d"
+styleToCSS Sandy = "s"
+styleToCSS Wet = "w"
+styleToCSS Molten = "o"
+styleToCSS Gloomy = "g"
+styleToCSS FaintMagic = "a"
+styleToCSS StrongMagic = "B A"
+styleToCSS StrongDusty = "B d"
-instance Charcoded a => Charcoded [a] where
- charcodeOf (a:as) = charcodeOf a
- charcodeOf [] = ' '
+class Charcoded a where
+ codedRepresentation :: a -> (Char,Style)
+ rendering :: a -> Aeson.Value
+ rendering a = object [ "t" .= t, "c" .= styleToCSS c ]
+ where (t,c) = codedRepresentation a
+
+instance Charcoded a => Charcoded (Maybe a) where
+ codedRepresentation (Just a) = codedRepresentation a
+ codedRepresentation Nothing = (' ',Empty)
instance Charcoded VisibleObject where
- charcodeOf (VisibleTool { visible_tool = t }) = charcodeOf t
- charcodeOf (VisibleCreature { visible_creature_species = s }) = charcodeOf s
- charcodeOf (VisibleBuilding{}) = 'X'
+ codedRepresentation (VisibleTool { visible_tool = t }) = codedRepresentation t
+ codedRepresentation (VisibleCreature { visible_creature_species = s }) = codedRepresentation s
+ codedRepresentation (VisibleBuilding{}) = ('#',StrongMagic)
instance Charcoded Tool where
- charcodeOf (Sphere {}) = '%'
- charcodeOf (DeviceTool Gun _) = ')'
- charcodeOf (DeviceTool Sword _) = ')'
+ codedRepresentation (Sphere {}) = ('%',Strong)
+ codedRepresentation (DeviceTool Gun _) = (')',Strong)
+ codedRepresentation (DeviceTool Sword _) = (')',Strong)
instance Charcoded Species where
- charcodeOf RedRecreant = 'r'
- charcodeOf BlueRecreant = '@'
+ codedRepresentation RedRecreant = ('r',Strong)
+ codedRepresentation BlueRecreant = ('@',Strong)
instance Charcoded TerrainPatch where
- charcodeOf RockFace = '#'
- charcodeOf Rubble = '.'
- charcodeOf Ore = '.'
- charcodeOf RockyGround = '.'
- charcodeOf Dirt = '.'
- charcodeOf Grass = '.'
- charcodeOf Sand = '.'
- charcodeOf Desert = '.'
- charcodeOf Forest = 'f'
- charcodeOf DeepForest = 'f'
- charcodeOf TerrainData.Water = '~'
- charcodeOf DeepWater = '~'
- charcodeOf Ice = '.'
- charcodeOf Lava = '~'
- charcodeOf Glass = '.'
- charcodeOf RecreantFactory = '_'
- charcodeOf Upstairs = '<'
- charcodeOf Downstairs = '>'
+ codedRepresentation RockFace = ('#',Rocky)
+ codedRepresentation Rubble = ('.',Rocky)
+ codedRepresentation Ore = ('.',Rocky)
+ codedRepresentation RockyGround = ('.',Rocky)
+ codedRepresentation Dirt = ('.',Dusty)
+ codedRepresentation Grass = ('.',Plants)
+ codedRepresentation Sand = ('.',Sandy)
+ codedRepresentation Desert = ('.',Sandy)
+ codedRepresentation Forest = ('f',Plants)
+ codedRepresentation DeepForest = ('f',Plants)
+ codedRepresentation TerrainData.Water = ('~',Wet)
+ codedRepresentation DeepWater = ('~',Gloomy)
+ codedRepresentation Ice = ('.',Icy)
+ codedRepresentation Lava = ('~',Molten)
+ codedRepresentation Glass = ('.',Gloomy)
+ codedRepresentation RecreantFactory = ('_',FaintMagic)
+ codedRepresentation Upstairs = ('<',StrongDusty)
+ codedRepresentation Downstairs = ('>',StrongDusty)
main :: IO ()
main =
View
325 devnotes/colors/MonsterColors.html
@@ -1,325 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html><head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Color Palette by Color Scheme Generator</title>
- <meta name="generator" content="ColorSchemeGenerator.com">
-
-<style type="text/css">
-
-/* Palette color codes */
-/* Feel free to copy&paste color codes to your application */
-
-.primary-1 { background-color: #E66A17 }
-.primary-2 { background-color: #8F5F3F }
-.primary-3 { background-color: #6D2E03 }
-.primary-4 { background-color: #F9A56D }
-.primary-5 { background-color: #F9CDB0 }
-
-.secondary-a-1 { background-color: #65189A }
-.secondary-a-2 { background-color: #4C2D60 }
-.secondary-a-3 { background-color: #2D0349 }
-.secondary-a-4 { background-color: #B56CE6 }
-.secondary-a-5 { background-color: #CCA7E6 }
-
-.secondary-b-1 { background-color: #E6E217 }
-.secondary-b-2 { background-color: #8F8E3F }
-.secondary-b-3 { background-color: #6D6B03 }
-.secondary-b-4 { background-color: #F9F66D }
-.secondary-b-5 { background-color: #F9F7B0 }
-
-.complement-1 { background-color: #0F917B }
-.complement-2 { background-color: #285B52 }
-.complement-3 { background-color: #02453A }
-.complement-4 { background-color: #64E4CE }
-.complement-5 { background-color: #A1E4D8 }
-
-/* end */
-
-
-body {
- margin:0; padding: 2em;
- background:white;
- color: #666;
- font: 75%/1.33 Verdana, sans-serif;
- text-align:left;
- }
-h1 {
- margin: 0.5em 0;
- font-size: 200%;
- }
-p {
- margin: 0.5em 0;
- }
-
-.color-table {
- margin: 2em 2em 5em;
- border-collapse:collapse;
- border:none;
- border-spacing:0;
- font-size:100%;
- }
-.color-table th {
- padding: 0 1em 0 0;
- text-align:right;
- vertical-align: middle;
- font-size:110%;
- border: none;
- }
-.color-table td.sample {
- width:10em; height:8em;
- padding: 10px;
- text-align:center;
- vertical-align:middle;
- font-size:90%;
- border: 1px solid white;
- white-space:nowrap;
- }
-.color-table.small td.sample {
- width:4em; height:4em;
- padding:0;
- border:none;
- }
-.color-table .white { margin-bottom:0.2em; color:white }
-.color-table .black { margin-top:0.2em; color:black }
-
-hr {
- border:none;
- border-bottom:1px solid silver;
- }
-#footer {
- padding:1em;
- text-align:center;
- font-size:80%;
- }
-
-</style>
-
-</head>
-<body>
-
-<h1>Color Palette by Color Scheme Designer</h1>
-<p>Palette URL: <a href="http://colorschemedesigner.com/#0p402sOsOK-K-">http://colorschemedesigner.com/#0p402sOsOK-K-</a></p>
-<p>Color Space: RGB; </p>
-
-<table class="color-table">
- <tbody><tr>
- <th>Primary Color:</th>
- <td class="sample primary-1">
- <div class="white">
-<strong>E66A17</strong>
- </div>
- <div class="black">
-<strong>E66A17</strong>
- </div>
- </td>
- <td class="sample primary-2">
- <div class="white">
-<strong>8F5F3F</strong>
- </div>
- <div class="black">
-<strong>8F5F3F</strong>
- </div>
- </td>
- <td class="sample primary-3">
- <div class="white">
-<strong>6D2E03</strong>
- </div>
- <div class="black">
-<strong>6D2E03</strong>
- </div>
- </td>
- <td class="sample primary-4">
- <div class="white">
-<strong>F9A56D</strong>
- </div>
- <div class="black">
-<strong>F9A56D</strong>
- </div>
- </td>
- <td class="sample primary-5">
- <div class="white">
-<strong>F9CDB0</strong>
- </div>
- <div class="black">
-<strong>F9CDB0</strong>
- </div>
- </td>
- </tr>
- <tr>
- <th>Secondary Color A:</th>
- <td class="sample secondary-a-1">
- <div class="white">
-<strong>65189A</strong>
- </div>
- <div class="black">
-<strong>65189A</strong>
- </div>
- </td>
- <td class="sample secondary-a-2">
- <div class="white">
-<strong>4C2D60</strong>
- </div>
- <div class="black">
-<strong>4C2D60</strong>
- </div>
- </td>
- <td class="sample secondary-a-3">
- <div class="white">
-<strong>2D0349</strong>
- </div>
- <div class="black">
-<strong>2D0349</strong>
- </div>
- </td>
- <td class="sample secondary-a-4">
- <div class="white">
-<strong>B56CE6</strong>
- </div>
- <div class="black">
-<strong>B56CE6</strong>
- </div>
- </td>
- <td class="sample secondary-a-5">
- <div class="white">
-<strong>CCA7E6</strong>
- </div>
- <div class="black">
-<strong>CCA7E6</strong>
- </div>
- </td>
- </tr>
- <tr>
- <th>Secondary Color B:</th>
- <td class="sample secondary-b-1">
- <div class="white">
-<strong>E6E217</strong>
- </div>
- <div class="black">
-<strong>E6E217</strong>
- </div>
- </td>
- <td class="sample secondary-b-2">
- <div class="white">
-<strong>8F8E3F</strong>
- </div>
- <div class="black">
-<strong>8F8E3F</strong>
- </div>
- </td>
- <td class="sample secondary-b-3">
- <div class="white">
-<strong>6D6B03</strong>
- </div>
- <div class="black">
-<strong>6D6B03</strong>
- </div>
- </td>
- <td class="sample secondary-b-4">
- <div class="white">
-<strong>F9F66D</strong>
- </div>
- <div class="black">
-<strong>F9F66D</strong>
- </div>
- </td>
- <td class="sample secondary-b-5">
- <div class="white">
-<strong>F9F7B0</strong>
- </div>
- <div class="black">
-<strong>F9F7B0</strong>
- </div>
- </td>
- </tr>
- <tr>
- <th>Complementary Color:</th>
- <td class="sample complement-1">
- <div class="white">
-<strong>0F917B</strong>
- </div>
- <div class="black">
-<strong>0F917B</strong>
- </div>
- </td>
- <td class="sample complement-2">
- <div class="white">
-<strong>285B52</strong>
- </div>
- <div class="black">
-<strong>285B52</strong>
- </div>
- </td>
- <td class="sample complement-3">
- <div class="white">
-<strong>02453A</strong>
- </div>
- <div class="black">
-<strong>02453A</strong>
- </div>
- </td>
- <td class="sample complement-4">
- <div class="white">
-<strong>64E4CE</strong>
- </div>
- <div class="black">
-<strong>64E4CE</strong>
- </div>
- </td>
- <td class="sample complement-5">
- <div class="white">
-<strong>A1E4D8</strong>
- </div>
- <div class="black">
-<strong>A1E4D8</strong>
- </div>
- </td>
- </tr>
-</tbody></table>
-
-<table class="color-table small">
- <tbody><tr>
- <th>Primary Color:</th>
- <td class="sample primary-1"></td>
- <td class="sample primary-2"></td>
- <td class="sample primary-3"></td>
- <td class="sample primary-4"></td>
- <td class="sample primary-5"></td>
- </tr>
- <tr>
- <th>Secondary Color A:</th>
- <td class="sample secondary-a-1"></td>
- <td class="sample secondary-a-2"></td>
- <td class="sample secondary-a-3"></td>
- <td class="sample secondary-a-4"></td>
- <td class="sample secondary-a-5"></td>
- </tr>
- <tr>
- <th>Secondary Color B:</th>
- <td class="sample secondary-b-1"></td>
- <td class="sample secondary-b-2"></td>
- <td class="sample secondary-b-3"></td>
- <td class="sample secondary-b-4"></td>
- <td class="sample secondary-b-5"></td>
- </tr>
- <tr>
- <th>Complementary Color:</th>
- <td class="sample complement-1"></td>
- <td class="sample complement-2"></td>
- <td class="sample complement-3"></td>
- <td class="sample complement-4"></td>
- <td class="sample complement-5"></td>
- </tr>
-</tbody></table>
-
-<p>
-See the HTML source for more details.<br>
-Use the <em>Save / Save As...</em> command in your browser to store the HTML for latter use.
-</p>
-
-<hr>
-
-<p id="footer">Generated by <a href="http://colorschemedesigner.com/">Color Scheme Designer</a> © Petr Stanicek 2002-2010</p>
-
-
-
-</body></html>
View
325 devnotes/colors/TerrainColors.html
@@ -1,325 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html><head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Color Palette by Color Scheme Generator</title>
- <meta name="generator" content="ColorSchemeGenerator.com">
-
-<style type="text/css">
-
-/* Palette color codes */
-/* Feel free to copy&paste color codes to your application */
-
-.primary-1 { background-color: #1F3E9B }
-.primary-2 { background-color: #303D61 }
-.primary-3 { background-color: #04154A }
-.primary-4 { background-color: #7390E6 }
-.primary-5 { background-color: #AAB9E6 }
-
-.secondary-a-1 { background-color: #12B225 }
-.secondary-a-2 { background-color: #316F38 }
-.secondary-a-3 { background-color: #02550C }
-.secondary-a-4 { background-color: #67EC77 }
-.secondary-a-5 { background-color: #A7ECAF }
-
-.secondary-b-1 { background-color: #E62117 }
-.secondary-b-2 { background-color: #8F433F }
-.secondary-b-3 { background-color: #6D0803 }
-.secondary-b-4 { background-color: #F9746D }
-.secondary-b-5 { background-color: #F9B4B0 }
-
-.complement-1 { background-color: #E6A417 }
-.complement-2 { background-color: #8F763F }
-.complement-3 { background-color: #6D4B03 }
-.complement-4 { background-color: #F9CC6D }
-.complement-5 { background-color: #F9E2B0 }
-
-/* end */
-
-
-body {
- margin:0; padding: 2em;
- background:white;
- color: #666;
- font: 75%/1.33 Verdana, sans-serif;
- text-align:left;
- }
-h1 {
- margin: 0.5em 0;
- font-size: 200%;
- }
-p {
- margin: 0.5em 0;
- }
-
-.color-table {
- margin: 2em 2em 5em;
- border-collapse:collapse;
- border:none;
- border-spacing:0;
- font-size:100%;
- }
-.color-table th {
- padding: 0 1em 0 0;
- text-align:right;
- vertical-align: middle;
- font-size:110%;
- border: none;
- }
-.color-table td.sample {
- width:10em; height:8em;
- padding: 10px;
- text-align:center;
- vertical-align:middle;
- font-size:90%;
- border: 1px solid white;
- white-space:nowrap;
- }
-.color-table.small td.sample {
- width:4em; height:4em;
- padding:0;
- border:none;
- }
-.color-table .white { margin-bottom:0.2em; color:white }
-.color-table .black { margin-top:0.2em; color:black }
-
-hr {
- border:none;
- border-bottom:1px solid silver;
- }
-#footer {
- padding:1em;
- text-align:center;
- font-size:80%;
- }
-
-</style>
-
-</head>
-<body>
-
-<h1>Color Palette by Color Scheme Designer</h1>
-<p>Palette URL: <a href="http://colorschemedesigner.com/#3O40tsOsOK-K-">http://colorschemedesigner.com/#3O40tsOsOK-K-</a></p>
-<p>Color Space: RGB; </p>
-
-<table class="color-table">
- <tbody><tr>
- <th>Primary Color:</th>
- <td class="sample primary-1">
- <div class="white">
-<strong>1F3E9B</strong>
- </div>
- <div class="black">
-<strong>1F3E9B</strong>
- </div>
- </td>
- <td class="sample primary-2">
- <div class="white">
-<strong>303D61</strong>
- </div>
- <div class="black">
-<strong>303D61</strong>
- </div>
- </td>
- <td class="sample primary-3">
- <div class="white">
-<strong>04154A</strong>
- </div>
- <div class="black">
-<strong>04154A</strong>
- </div>
- </td>
- <td class="sample primary-4">
- <div class="white">
-<strong>7390E6</strong>
- </div>
- <div class="black">
-<strong>7390E6</strong>
- </div>
- </td>
- <td class="sample primary-5">
- <div class="white">
-<strong>AAB9E6</strong>
- </div>
- <div class="black">
-<strong>AAB9E6</strong>
- </div>
- </td>
- </tr>
- <tr>
- <th>Secondary Color A:</th>
- <td class="sample secondary-a-1">
- <div class="white">
-<strong>12B225</strong>
- </div>
- <div class="black">
-<strong>12B225</strong>
- </div>
- </td>
- <td class="sample secondary-a-2">
- <div class="white">
-<strong>316F38</strong>
- </div>
- <div class="black">
-<strong>316F38</strong>
- </div>
- </td>
- <td class="sample secondary-a-3">
- <div class="white">
-<strong>02550C</strong>
- </div>
- <div class="black">
-<strong>02550C</strong>
- </div>
- </td>
- <td class="sample secondary-a-4">
- <div class="white">
-<strong>67EC77</strong>
- </div>
- <div class="black">
-<strong>67EC77</strong>
- </div>
- </td>
- <td class="sample secondary-a-5">
- <div class="white">
-<strong>A7ECAF</strong>
- </div>
- <div class="black">
-<strong>A7ECAF</strong>
- </div>
- </td>
- </tr>
- <tr>
- <th>Secondary Color B:</th>
- <td class="sample secondary-b-1">
- <div class="white">
-<strong>E62117</strong>
- </div>
- <div class="black">
-<strong>E62117</strong>
- </div>
- </td>
- <td class="sample secondary-b-2">
- <div class="white">
-<strong>8F433F</strong>
- </div>
- <div class="black">
-<strong>8F433F</strong>
- </div>
- </td>
- <td class="sample secondary-b-3">
- <div class="white">
-<strong>6D0803</strong>
- </div>
- <div class="black">
-<strong>6D0803</strong>
- </div>
- </td>
- <td class="sample secondary-b-4">
- <div class="white">
-<strong>F9746D</strong>
- </div>
- <div class="black">
-<strong>F9746D</strong>
- </div>
- </td>
- <td class="sample secondary-b-5">
- <div class="white">
-<strong>F9B4B0</strong>
- </div>
- <div class="black">
-<strong>F9B4B0</strong>
- </div>
- </td>
- </tr>
- <tr>
- <th>Complementary Color:</th>
- <td class="sample complement-1">
- <div class="white">
-<strong>E6A417</strong>
- </div>
- <div class="black">
-<strong>E6A417</strong>
- </div>
- </td>
- <td class="sample complement-2">
- <div class="white">
-<strong>8F763F</strong>
- </div>
- <div class="black">
-<strong>8F763F</strong>
- </div>
- </td>
- <td class="sample complement-3">
- <div class="white">
-<strong>6D4B03</strong>
- </div>
- <div class="black">
-<strong>6D4B03</strong>
- </div>
- </td>
- <td class="sample complement-4">
- <div class="white">
-<strong>F9CC6D</strong>
- </div>
- <div class="black">
-<strong>F9CC6D</strong>
- </div>
- </td>
- <td class="sample complement-5">
- <div class="white">
-<strong>F9E2B0</strong>
- </div>
- <div class="black">
-<strong>F9E2B0</strong>
- </div>
- </td>
- </tr>
-</tbody></table>
-
-<table class="color-table small">
- <tbody><tr>
- <th>Primary Color:</th>
- <td class="sample primary-1"></td>
- <td class="sample primary-2"></td>
- <td class="sample primary-3"></td>
- <td class="sample primary-4"></td>
- <td class="sample primary-5"></td>
- </tr>
- <tr>
- <th>Secondary Color A:</th>
- <td class="sample secondary-a-1"></td>
- <td class="sample secondary-a-2"></td>
- <td class="sample secondary-a-3"></td>
- <td class="sample secondary-a-4"></td>
- <td class="sample secondary-a-5"></td>
- </tr>
- <tr>
- <th>Secondary Color B:</th>
- <td class="sample secondary-b-1"></td>
- <td class="sample secondary-b-2"></td>
- <td class="sample secondary-b-3"></td>
- <td class="sample secondary-b-4"></td>
- <td class="sample secondary-b-5"></td>
- </tr>
- <tr>
- <th>Complementary Color:</th>
- <td class="sample complement-1"></td>
- <td class="sample complement-2"></td>
- <td class="sample complement-3"></td>
- <td class="sample complement-4"></td>
- <td class="sample complement-5"></td>
- </tr>
-</tbody></table>
-
-<p>
-See the HTML source for more details.<br>
-Use the <em>Save / Save As...</em> command in your browser to store the HTML for latter use.
-</p>
-
-<hr>
-
-<p id="footer">Generated by <a href="http://colorschemedesigner.com/">Color Scheme Designer</a> © Petr Stanicek 2002-2010</p>
-
-
-
-</body></html>
View
12 static/help-map.mustache
@@ -6,13 +6,13 @@
<dl class="answer">
-<dt><pre>@</pre></dt>
+<dt><pre class="B">@</pre></dt>
<dd>Your character.</dd>
-<dt><pre>r</pre></dt>
+<dt><pre class="B">r</pre></dt>
<dd>A hostile recreant.</dd>
-<dt><pre>f</pre></dt>
+<dt><pre class="p">f</pre></dt>
<dd>A tree or patch of forest. You can clear a path through them, but slowly.</dd>
<dt><pre>.</pre></dt>
@@ -21,14 +21,14 @@
<dt><pre>#</pre></dt>
<dd>A rock wall or mountain side. You can clear a path through them, but slowly.</dd>
-<dt><pre>_</pre></dt>
+<dt><pre class="a">_</pre></dt>
<dd>A recreant factory. New Recreants will spawn on these.</dd>
-<dt><pre>~</pre></dt>
+<dt><pre class="w">~</pre></dt>
<dd>Water. It's relatively safe.</dd>
<dt>
-<pre>
+<pre class="A">
XXX
X X
View
23 static/index.mustache
@@ -1,9 +1,6 @@
{{> header}}
<div id="documenttext" class="roguebox">
-<h1>Roguestar</h1>
-
-<p>Roguestar is a text-based tactical role-playing game set in a science-fiction universe. You can begin playing right now, in your web browser: <a href="/play/">Play Now</a>.<p>
{{#failed_unit_tests}}
<p>One or more unit tests failed:</p>
@@ -12,6 +9,26 @@
</pre>
{{/failed_unit_tests}}
+<h1>Roguestar</h1>
+
+<p>Roguestar is a text-based tactical role-playing game set in a science-fiction universe. You can begin playing right now, in your web browser: <a href="/play/">Play Now</a>.<p>
+
+<h1>Version History</h1>
+
+<div id="version-history">
+<h6>Roguestar 0.10.0</h6>
+<ul>
+<li>Color map.</li>
+<li>Switched to mustache templates (hastache). You can append <code>?theme=json</code> to any URL to see (debug) the JSON data used to render each template.</li>
+</ul>
+
+<h6>Roguestar 0.8</h6>
+<ul>
+<li>September 2012</li>
+<li>First release of the web version.</li>
+</ul>
+</div>
+
</div>
{{> footer}}
View
7 static/map.mustache
@@ -0,0 +1,7 @@
+<div class="mapcontent">
+<p>
+{{#map-content}}
+{{#mapstring}}<span class="{{{c}}}">{{{t}}}</span>{{/mapstring}}
+{{/map-content}}
+</p>
+</div>
View
4 static/options.mustache
@@ -7,7 +7,9 @@
<button type="submit">Restart Game</button>
</form>
-<pre>{{server-statistics}}</pre>
+<p>
+<code>{{server-statistics}}</code>
+</p>
<p>Current number of game sessions: {{{number-of-games}}}</p>
View
4 static/play.mustache
@@ -3,10 +3,12 @@
{{#play}}
<div id="magicbox">
+{{#map}}
<div id="gameplaybox" class="roguebox">
- <pre>{{{map}}}</pre>
+ {{> map}}
<a href="/help-map" class="help">?</a>
</div>
+{{/map}}
<div id="messagebox" class="roguebox">
{{#messages}}
View
60 static/roguebasic.css
@@ -274,8 +274,14 @@ a:hover {
top: 0px;
width: 500px;
height: 500px;
- letter-spacing: 6.5pt;
- text-align: center;
+ background: #000000;
+}
+
+.mapcontent {
+ font-size: 12pt;
+ letter-spacing: 6.5pt;
+ text-align: center;
+ white-space: pre;
}
#gameplaybox .help {
@@ -342,4 +348,54 @@ a:hover {
.feedback button {
margin-top: 1cm;
clear: both;
+}
+
+/* Strong */
+.B {
+ font-weight: bold;
+}
+
+/* Sandy */
+.s {
+ color: #FFFF00;
+}
+
+/* Dusty */
+.d {
+ color: #888800;
+}
+
+/* Icy */
+.i {
+ color: #00FFFF;
+}
+
+/* Plants */
+.p {
+ color: #00FF00;
+}
+
+/* FaintMagic */
+.a {
+ color: #AA55AA;
+}
+
+/* StrongMagic */
+.A {
+ color: #FF00FF;
+}
+
+/* Wet */
+.w {
+ color: #4488FF;
+}
+
+/* Molten */
+.m {
+ color: #FF0000;
+}
+
+/* Gloomy */
+.g {
+ color: #0000FF;
}

0 comments on commit ae326fc

Please sign in to comment.
Something went wrong with that request. Please try again.