|
|
|
@@ -1,6 +1,13 @@
|
|
|
|
package model
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
import (
|
|
|
|
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type IntString int
|
|
|
|
|
|
|
|
|
|
|
|
// Config tracks configuration modifications
|
|
|
|
// Config tracks configuration modifications
|
|
|
|
type Config struct {
|
|
|
|
type Config struct {
|
|
|
|
@@ -24,77 +31,101 @@ type ServerSettings struct {
|
|
|
|
ServerName string `json:"serverName"`
|
|
|
|
ServerName string `json:"serverName"`
|
|
|
|
AdminPassword string `json:"adminPassword"`
|
|
|
|
AdminPassword string `json:"adminPassword"`
|
|
|
|
CarGroup string `json:"carGroup"`
|
|
|
|
CarGroup string `json:"carGroup"`
|
|
|
|
TrackMedalsRequirement int `json:"trackMedalsRequirement"`
|
|
|
|
TrackMedalsRequirement IntString `json:"trackMedalsRequirement"`
|
|
|
|
SafetyRatingRequirement int `json:"safetyRatingRequirement"`
|
|
|
|
SafetyRatingRequirement IntString `json:"safetyRatingRequirement"`
|
|
|
|
RacecraftRatingRequirement int `json:"racecraftRatingRequirement"`
|
|
|
|
RacecraftRatingRequirement IntString `json:"racecraftRatingRequirement"`
|
|
|
|
Password string `json:"password"`
|
|
|
|
Password string `json:"password"`
|
|
|
|
SpectatorPassword string `json:"spectatorPassword"`
|
|
|
|
SpectatorPassword string `json:"spectatorPassword"`
|
|
|
|
MaxCarSlots int `json:"maxCarSlots"`
|
|
|
|
MaxCarSlots IntString `json:"maxCarSlots"`
|
|
|
|
DumpLeaderboards int `json:"dumpLeaderboards"`
|
|
|
|
DumpLeaderboards IntString `json:"dumpLeaderboards"`
|
|
|
|
IsRaceLocked int `json:"isRaceLocked"`
|
|
|
|
IsRaceLocked IntString `json:"isRaceLocked"`
|
|
|
|
RandomizeTrackWhenEmpty int `json:"randomizeTrackWhenEmpty"`
|
|
|
|
RandomizeTrackWhenEmpty IntString `json:"randomizeTrackWhenEmpty"`
|
|
|
|
CentralEntryListPath string `json:"centralEntryListPath"`
|
|
|
|
CentralEntryListPath string `json:"centralEntryListPath"`
|
|
|
|
AllowAutoDQ int `json:"allowAutoDQ"`
|
|
|
|
AllowAutoDQ IntString `json:"allowAutoDQ"`
|
|
|
|
ShortFormationLap int `json:"shortFormationLap"`
|
|
|
|
ShortFormationLap IntString `json:"shortFormationLap"`
|
|
|
|
FormationLapType int `json:"formationLapType"`
|
|
|
|
FormationLapType IntString `json:"formationLapType"`
|
|
|
|
IgnorePrematureDisconnects int `json:"ignorePrematureDisconnects"`
|
|
|
|
IgnorePrematureDisconnects IntString `json:"ignorePrematureDisconnects"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type EventConfig struct {
|
|
|
|
type EventConfig struct {
|
|
|
|
Track string `json:"track"`
|
|
|
|
Track string `json:"track"`
|
|
|
|
PreRaceWaitingTimeSeconds int `json:"preRaceWaitingTimeSeconds"`
|
|
|
|
PreRaceWaitingTimeSeconds IntString `json:"preRaceWaitingTimeSeconds"`
|
|
|
|
SessionOverTimeSeconds int `json:"sessionOverTimeSeconds"`
|
|
|
|
SessionOverTimeSeconds IntString `json:"sessionOverTimeSeconds"`
|
|
|
|
AmbientTemp int `json:"ambientTemp"`
|
|
|
|
AmbientTemp IntString `json:"ambientTemp"`
|
|
|
|
CloudLevel float64 `json:"cloudLevel"`
|
|
|
|
CloudLevel float64 `json:"cloudLevel"`
|
|
|
|
Rain float64 `json:"rain"`
|
|
|
|
Rain float64 `json:"rain"`
|
|
|
|
WeatherRandomness int `json:"weatherRandomness"`
|
|
|
|
WeatherRandomness IntString `json:"weatherRandomness"`
|
|
|
|
PostQualySeconds int `json:"postQualySeconds"`
|
|
|
|
PostQualySeconds IntString `json:"postQualySeconds"`
|
|
|
|
PostRaceSeconds int `json:"postRaceSeconds"`
|
|
|
|
PostRaceSeconds IntString `json:"postRaceSeconds"`
|
|
|
|
SimracerWeatherConditions int `json:"simracerWeatherConditions"`
|
|
|
|
SimracerWeatherConditions IntString `json:"simracerWeatherConditions"`
|
|
|
|
IsFixedConditionQualification int `json:"isFixedConditionQualification"`
|
|
|
|
IsFixedConditionQualification IntString `json:"isFixedConditionQualification"`
|
|
|
|
|
|
|
|
|
|
|
|
Sessions []Session `json:"sessions"`
|
|
|
|
Sessions []Session `json:"sessions"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Session struct {
|
|
|
|
type Session struct {
|
|
|
|
HourOfDay int `json:"hourOfDay"`
|
|
|
|
HourOfDay IntString `json:"hourOfDay"`
|
|
|
|
DayOfWeekend int `json:"dayOfWeekend"`
|
|
|
|
DayOfWeekend IntString `json:"dayOfWeekend"`
|
|
|
|
TimeMultiplier int `json:"timeMultiplier"`
|
|
|
|
TimeMultiplier IntString `json:"timeMultiplier"`
|
|
|
|
SessionType string `json:"sessionType"`
|
|
|
|
SessionType string `json:"sessionType"`
|
|
|
|
SessionDurationMinutes int `json:"sessionDurationMinutes"`
|
|
|
|
SessionDurationMinutes IntString `json:"sessionDurationMinutes"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type AssistRules struct {
|
|
|
|
type AssistRules struct {
|
|
|
|
StabilityControlLevelMax int `json:"stabilityControlLevelMax"`
|
|
|
|
StabilityControlLevelMax IntString `json:"stabilityControlLevelMax"`
|
|
|
|
DisableAutosteer int `json:"disableAutosteer"`
|
|
|
|
DisableAutosteer IntString `json:"disableAutosteer"`
|
|
|
|
DisableAutoLights int `json:"disableAutoLights"`
|
|
|
|
DisableAutoLights IntString `json:"disableAutoLights"`
|
|
|
|
DisableAutoWiper int `json:"disableAutoWiper"`
|
|
|
|
DisableAutoWiper IntString `json:"disableAutoWiper"`
|
|
|
|
DisableAutoEngineStart int `json:"disableAutoEngineStart"`
|
|
|
|
DisableAutoEngineStart IntString `json:"disableAutoEngineStart"`
|
|
|
|
DisableAutoPitLimiter int `json:"disableAutoPitLimiter"`
|
|
|
|
DisableAutoPitLimiter IntString `json:"disableAutoPitLimiter"`
|
|
|
|
DisableAutoGear int `json:"disableAutoGear"`
|
|
|
|
DisableAutoGear IntString `json:"disableAutoGear"`
|
|
|
|
DisableAutoClutch int `json:"disableAutoClutch"`
|
|
|
|
DisableAutoClutch IntString `json:"disableAutoClutch"`
|
|
|
|
DisableIdealLine int `json:"disableIdealLine"`
|
|
|
|
DisableIdealLine IntString `json:"disableIdealLine"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type EventRules struct {
|
|
|
|
type EventRules struct {
|
|
|
|
QualifyStandingType int `json:"qualifyStandingType"`
|
|
|
|
QualifyStandingType IntString `json:"qualifyStandingType"`
|
|
|
|
PitWindowLengthSec int `json:"pitWindowLengthSec"`
|
|
|
|
PitWindowLengthSec IntString `json:"pitWindowLengthSec"`
|
|
|
|
DriverStintTimeSec int `json:"driverStintTimeSec"`
|
|
|
|
DriverStIntStringTimeSec IntString `json:"driverStIntStringTimeSec"`
|
|
|
|
MandatoryPitstopCount int `json:"mandatoryPitstopCount"`
|
|
|
|
MandatoryPitstopCount IntString `json:"mandatoryPitstopCount"`
|
|
|
|
MaxTotalDrivingTime int `json:"maxTotalDrivingTime"`
|
|
|
|
MaxTotalDrivingTime IntString `json:"maxTotalDrivingTime"`
|
|
|
|
IsRefuellingAllowedInRace bool `json:"isRefuellingAllowedInRace"`
|
|
|
|
IsRefuellingAllowedInRace bool `json:"isRefuellingAllowedInRace"`
|
|
|
|
IsRefuellingTimeFixed bool `json:"isRefuellingTimeFixed"`
|
|
|
|
IsRefuellingTimeFixed bool `json:"isRefuellingTimeFixed"`
|
|
|
|
IsMandatoryPitstopRefuellingRequired bool `json:"isMandatoryPitstopRefuellingRequired"`
|
|
|
|
IsMandatoryPitstopRefuellingRequired bool `json:"isMandatoryPitstopRefuellingRequired"`
|
|
|
|
IsMandatoryPitstopTyreChangeRequired bool `json:"isMandatoryPitstopTyreChangeRequired"`
|
|
|
|
IsMandatoryPitstopTyreChangeRequired bool `json:"isMandatoryPitstopTyreChangeRequired"`
|
|
|
|
IsMandatoryPitstopSwapDriverRequired bool `json:"isMandatoryPitstopSwapDriverRequired"`
|
|
|
|
IsMandatoryPitstopSwapDriverRequired bool `json:"isMandatoryPitstopSwapDriverRequired"`
|
|
|
|
TyreSetCount int `json:"tyreSetCount"`
|
|
|
|
TyreSetCount IntString `json:"tyreSetCount"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Configuration struct {
|
|
|
|
type Configuration struct {
|
|
|
|
UdpPort int `json:"udpPort"`
|
|
|
|
UdpPort IntString `json:"udpPort"`
|
|
|
|
TcpPort int `json:"tcpPort"`
|
|
|
|
TcpPort IntString `json:"tcpPort"`
|
|
|
|
MaxConnections int `json:"maxConnections"`
|
|
|
|
MaxConnections IntString `json:"maxConnections"`
|
|
|
|
LanDiscovery int `json:"lanDiscovery"`
|
|
|
|
LanDiscovery IntString `json:"lanDiscovery"`
|
|
|
|
RegisterToLobby int `json:"registerToLobby"`
|
|
|
|
RegisterToLobby IntString `json:"registerToLobby"`
|
|
|
|
ConfigVersion int `json:"configVersion"`
|
|
|
|
ConfigVersion IntString `json:"configVersion"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (i *IntString) UnmarshalJSON(b []byte) error {
|
|
|
|
|
|
|
|
var str string
|
|
|
|
|
|
|
|
if err := json.Unmarshal(b, &str); err == nil {
|
|
|
|
|
|
|
|
if (str == "") {
|
|
|
|
|
|
|
|
*i = IntString(0)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
n, err := strconv.Atoi(str)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*i = IntString(n)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var num int
|
|
|
|
|
|
|
|
if err := json.Unmarshal(b, &num); err == nil {
|
|
|
|
|
|
|
|
*i = IntString(num)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fmt.Errorf("invalid postQualySeconds value")
|
|
|
|
|
|
|
|
}
|