Add more data to battle record
authorTheSaminator <TheSaminator@users.noreply.github.com>
Thu, 10 Feb 2022 16:22:08 +0000 (11:22 -0500)
committerTheSaminator <TheSaminator@users.noreply.github.com>
Thu, 10 Feb 2022 16:22:08 +0000 (11:22 -0500)
src/jsMain/kotlin/starshipfights/game/popup.kt
src/jvmMain/kotlin/starshipfights/data/admiralty/battle_records.kt
src/jvmMain/kotlin/starshipfights/game/server_game.kt
src/jvmMain/kotlin/starshipfights/info/views_user.kt

index cfe1a4318cd2e1dbbbe30a7610a4e6cdcd46979a..cac0087aa00a925f4cb5ef29a08214d99365b475 100644 (file)
@@ -158,6 +158,9 @@ sealed class Popup<out T> {
                                        if (battleSize <= maxBattleSize)
                                                button {
                                                        +battleSize.displayName
+                                                       +" ("
+                                                       +battleSize.numPoints.toString()
+                                                       +")"
                                                        onClickFunction = { e ->
                                                                e.preventDefault()
                                                                callback(battleSize)
@@ -299,6 +302,9 @@ sealed class Popup<out T> {
                                                td {
                                                        style = "text-align:center"
                                                        +joinable.battleInfo.size.displayName
+                                                       +" ("
+                                                       +joinable.battleInfo.size.numPoints.toString()
+                                                       +")"
                                                }
                                                td {
                                                        style = "text-align:center"
index 83a36fa06514a228c569d66e9542c30db0ed45a8..bf7ce749fdc89ffbf4196afc04456bec87228ef5 100644 (file)
@@ -8,6 +8,7 @@ import starshipfights.data.DocumentTable
 import starshipfights.data.Id
 import starshipfights.data.auth.User
 import starshipfights.data.invoke
+import starshipfights.game.BattleInfo
 import starshipfights.game.GlobalSide
 import java.time.Instant
 
@@ -16,6 +17,8 @@ data class BattleRecord(
        @SerialName("_id")
        override val id: Id<BattleRecord> = Id(),
        
+       val battleInfo: BattleInfo,
+       
        val whenStarted: @Contextual Instant,
        val whenEnded: @Contextual Instant,
        
index 265182527d0bf8cb63f09b9efddd5f0983c4c7ad..4b08a724b602267e723a2ada0fe08c00f5b6921a 100644 (file)
@@ -64,6 +64,8 @@ object GameManager {
                        }
                        
                        val battleRecord = BattleRecord(
+                               battleInfo = session.state.value.battleInfo,
+                               
                                whenStarted = startedAt,
                                whenEnded = endedAt,
                                
index a9b740e836dd8f24afa0a1b783115e4edfc4c257..324c2b8eded4cbffd34dc8be8d30a76698a0a542 100644 (file)
@@ -353,6 +353,7 @@ suspend fun ApplicationCall.admiralPage(): HTML.() -> Unit {
                        table {
                                tr {
                                        th { +"When" }
+                                       th { +"Size" }
                                        th { +"Role" }
                                        th { +"Against" }
                                        th { +"Result" }
@@ -372,6 +373,12 @@ suspend fun ApplicationCall.admiralPage(): HTML.() -> Unit {
                                                                +record.whenEnded.toEpochMilli().toString()
                                                        }
                                                }
+                                               td {
+                                                       +record.battleInfo.size.displayName
+                                                       +" ("
+                                                       +record.battleInfo.size.numPoints.toString()
+                                                       +")"
+                                               }
                                                td {
                                                        +when (recordRoles[record.id]) {
                                                                GlobalSide.HOST -> "Host"