Safe Haskell | None |
---|---|
Language | Haskell2010 |
High score table operations.
Synopsis
- data ScoreTable
- type ScoreDict = EnumMap (ContentId ModeKind) ScoreTable
- empty :: ScoreDict
- register :: ScoreTable -> Int -> Int -> Time -> Status -> POSIXTime -> Challenge -> Text -> EnumMap (ContentId ItemKind) Int -> EnumMap (ContentId ItemKind) Int -> HiCondPoly -> (Bool, (ScoreTable, Int))
- showScore :: TimeZone -> (Int, ScoreRecord) -> [Text]
- getTable :: ContentId ModeKind -> ScoreDict -> ScoreTable
- getRecord :: Int -> ScoreTable -> ScoreRecord
- highSlideshow :: ScoreTable -> Int -> Text -> TimeZone -> (Text, [[Text]])
- data ScoreRecord
- insertPos :: ScoreRecord -> ScoreTable -> (ScoreTable, Int)
- showTable :: TimeZone -> ScoreTable -> Int -> Int -> [Text]
- showNearbyScores :: TimeZone -> Int -> ScoreTable -> Int -> [[Text]]
Documentation
data ScoreTable Source #
The list of scores, in decreasing order.
Instances
Eq ScoreTable Source # | |
Defined in Game.LambdaHack.Common.HighScore (==) :: ScoreTable -> ScoreTable -> Bool # (/=) :: ScoreTable -> ScoreTable -> Bool # | |
Show ScoreTable Source # | |
Defined in Game.LambdaHack.Common.HighScore showsPrec :: Int -> ScoreTable -> ShowS # show :: ScoreTable -> String # showList :: [ScoreTable] -> ShowS # | |
Binary ScoreTable Source # | |
Defined in Game.LambdaHack.Common.HighScore |
type ScoreDict = EnumMap (ContentId ModeKind) ScoreTable Source #
A dictionary from game mode IDs to scores tables.
:: ScoreTable | old table |
-> Int | the total value of faction items |
-> Int | the total value of dungeon items |
-> Time | game time spent |
-> Status | reason of the game interruption |
-> POSIXTime | current date |
-> Challenge | challenge setup |
-> Text | name of the faction's gplayer |
-> EnumMap (ContentId ItemKind) Int | allies lost |
-> EnumMap (ContentId ItemKind) Int | foes killed |
-> HiCondPoly | |
-> (Bool, (ScoreTable, Int)) |
Register a new score in a score table.
showScore :: TimeZone -> (Int, ScoreRecord) -> [Text] Source #
Show a single high score, from the given ranking in the high score table.
getRecord :: Int -> ScoreTable -> ScoreRecord Source #
:: ScoreTable | current score table |
-> Int | position of the current score in the table |
-> Text | the name of the game mode |
-> TimeZone | the timezone where the game is run |
-> (Text, [[Text]]) |
Generate a slideshow with the current and previous scores.
Internal operations
data ScoreRecord Source #
A single score record. Records are ordered in the highscore table, from the best to the worst, in lexicographic ordering wrt the fields below.
Instances
insertPos :: ScoreRecord -> ScoreTable -> (ScoreTable, Int) Source #
Insert a new score into the table, Return new table and the ranking. Make sure the table doesn't grow too large.
showTable :: TimeZone -> ScoreTable -> Int -> Int -> [Text] Source #
Show a screenful of the high scores table. Parameter height is the number of (3-line) scores to be shown.
showNearbyScores :: TimeZone -> Int -> ScoreTable -> Int -> [[Text]] Source #
Produce a couple of renderings of the high scores table.