summaryrefslogtreecommitdiff
path: root/sw-common-model/src/commonMain/kotlin/org
diff options
context:
space:
mode:
Diffstat (limited to 'sw-common-model/src/commonMain/kotlin/org')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/AutoGame.kt27
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt4
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt10
3 files changed, 40 insertions, 1 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/AutoGame.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/AutoGame.kt
new file mode 100644
index 00000000..9822b303
--- /dev/null
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/AutoGame.kt
@@ -0,0 +1,27 @@
+package org.luxons.sevenwonders.model.api
+
+import kotlinx.serialization.Serializable
+import org.luxons.sevenwonders.model.Settings
+import org.luxons.sevenwonders.model.TableState
+import org.luxons.sevenwonders.model.api.actions.BotConfig
+import org.luxons.sevenwonders.model.score.ScoreBoard
+import org.luxons.sevenwonders.model.wonders.AssignedWonder
+import kotlin.random.Random
+
+@Serializable
+data class AutoGameAction(
+ val nbPlayers: Int = 3,
+ val gameName: String = "AutoGame-${Random.nextInt().toString(16)}",
+ val customSettings: Settings? = null,
+ val customWonders: List<AssignedWonder>? = null,
+ /**
+ * The configuration of the bots that will play the game.
+ */
+ val config: BotConfig = BotConfig(0, 0),
+)
+
+@Serializable
+data class AutoGameResult(
+ val scoreBoard: ScoreBoard,
+ val table: TableState,
+)
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt
index 3963112a..8ed15f24 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Player.kt
@@ -17,7 +17,9 @@ data class ConnectedPlayer(
override val displayName: String,
override val isHuman: Boolean,
override val icon: Icon?,
-) : BasicPlayerInfo
+) : BasicPlayerInfo {
+ override fun toString(): String = "'$displayName' ($username)"
+}
@Serializable
data class PlayerDTO(
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt
index b0be3ae0..8d352402 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/actions/Actions.kt
@@ -106,4 +106,14 @@ class AddBotAction(
* The display name for the bot to add.
*/
val botDisplayName: String,
+ /**
+ * The configuration of the bot to add.
+ */
+ val config: BotConfig = BotConfig(),
+)
+
+@Serializable
+data class BotConfig(
+ val minActionDelayMillis: Long = 50,
+ val maxActionDelayMillis: Long = 500,
)
bgstack15