Add base certifications config option

This commit is contained in:
Jakob Gillich 2021-05-22 07:11:02 +02:00
parent 2781d1d5b8
commit 91e76d2397
5 changed files with 21 additions and 11 deletions

View file

@ -355,7 +355,7 @@ class AvatarActor(
loadouts = loadouts,
// make sure we always have the base certifications
certifications =
certs.map(cert => Certification.withValue(cert.id)).toSet ++ Certification.values.filter(_.cost == 0),
certs.map(cert => Certification.withValue(cert.id)).toSet ++ Config.app.game.baseCertifications,
implants = implants.map(implant => Some(Implant(implant.toImplantDefinition))).padTo(3, None)
)

View file

@ -92,7 +92,7 @@ case object Certification extends IntEnum[Certification] {
case object BFRAntiInfantry
extends Certification(value = 25, name = "TODO4", cost = 1, requires = Set(BattleFrameRobotics)) // TODO name
case object StandardExoSuit extends Certification(value = 26, name = "TODO5", cost = 0)
case object StandardExoSuit extends Certification(value = 26, name = "standard_armor", cost = 0)
case object AgileExoSuit extends Certification(value = 27, name = "agile_armor", cost = 0)

View file

@ -295,7 +295,7 @@ object GamePacketOpcode extends Enumeration {
= Value
private def noDecoder(opcode: GamePacketOpcode.Type) =
(bits: BitVector) => Attempt.failure(Err(s"Could not find a marshaller for game packet $opcode (${bits.toHex}"))
(bits: BitVector) => Attempt.failure(Err(s"Could not find a marshaller for game packet $opcode (${bits.toHex})"))
/// Mapping of packet IDs to decoders. Notice that we are using the @switch annotation which ensures that the Scala
/// compiler will be able to optimize this as a lookup table (switch statement). Microbenchmarks show a nearly 400x

View file

@ -1,11 +1,10 @@
package net.psforever.util
import java.nio.file.Paths
import com.typesafe.config.{Config => TypesafeConfig}
import enumeratum.{Enum, EnumEntry}
import enumeratum.values.{IntEnum, IntEnumEntry}
import net.psforever.objects.avatar.{BattleRank, CommandRank}
import net.psforever.objects.avatar.{BattleRank, Certification, CommandRank}
import net.psforever.packet.game.ServerType
import net.psforever.types.ChatMessageType
import pureconfig.ConfigConvert.viaNonEmptyStringOpt
@ -34,6 +33,7 @@ object Config {
case e: ServerType if e.name == v => e.asInstanceOf[A]
case e: BattleRank if e.value.toString == v => e.asInstanceOf[A]
case e: CommandRank if e.value.toString == v => e.asInstanceOf[A]
case e: Certification if e.name == v => e.asInstanceOf[A]
},
_.value.toString
)
@ -119,10 +119,10 @@ case class NetworkConfig(
)
case class MiddlewareConfig(
packetBundlingDelay: FiniteDuration,
inReorderTimeout: FiniteDuration,
inSubslotMissingDelay: FiniteDuration,
inSubslotMissingAttempts: Int
packetBundlingDelay: FiniteDuration,
inReorderTimeout: FiniteDuration,
inSubslotMissingDelay: FiniteDuration,
inSubslotMissingAttempts: Int
)
case class SessionConfig(
@ -138,7 +138,8 @@ case class GameConfig(
cepRate: Double,
newAvatar: NewAvatar,
hart: HartConfig,
sharedMaxCooldown: Boolean
sharedMaxCooldown: Boolean,
baseCertifications: Seq[Certification]
)
case class NewAvatar(