dev.robocode.tankroyale.server.mapper.BotsToBotsWithIdMapper.kt Maven / Gradle / Ivy
package dev.robocode.tankroyale.server.mapper
import dev.robocode.tankroyale.schema.game.BotStateWithId
import dev.robocode.tankroyale.schema.game.Participant
import dev.robocode.tankroyale.server.model.BotId
import dev.robocode.tankroyale.server.model.IBot
object BotsToBotsWithIdMapper {
fun map(bots: Set, participantsMap: Map): List {
val botStates = mutableListOf()
bots.forEach { bot ->
participantsMap[bot.id]?.let { participant ->
botStates += BotToBotStateWithIdMapper.map(bot, participant.sessionId)
}
}
return botStates
}
}