config

package
v0.0.0-...-96c3957 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoConfigurePaths

func AutoConfigurePaths(config *Config) error

AutoConfigurePaths 自动配置路径

func RemoveEngineSettings

func RemoveEngineSettings(config *Config) error

RemoveEngineSettings 从INI文件中删除Engine结构体的数据

func WriteEngineSettings

func WriteEngineSettings(config *Config, engine *Engine) error

WriteEngineSettings 将Engine结构体的数据写入INI文件

func WriteGameWorldSettings

func WriteGameWorldSettings(config *Config, settings *GameWorldSettings) error

Types

type Bound

type Bound struct {
	Type  string  `json:"Type"`
	Value float64 `json:"Value"`
}

Bound represents a boundary in a frame rate range.

type Config

type Config struct {
	Title                     string             `json:"title"`                     // 自定义标题
	GameService               bool               `json:"gameService"`               // 游戏以服务方式启动
	GameServiceName           string             `json:"gameServiceName"`           // 游戏服务名称
	GamePath                  string             `json:"gamePath"`                  // 游戏可执行文件路径PalServer.exe所处的位置
	GameSavePath              string             `json:"gameSavePath"`              // 游戏存档路径 \PalServer\Pal\Saved\文件夹的完整路径
	BackupPath                string             `json:"backupPath"`                // 备份路径
	SteamPath                 string             `json:"steamPath"`                 // steam路径
	CommunityServer           bool               `json:"communityServer"`           // 社区服务器开关
	UseDll                    bool               `json:"useDll"`                    // dll注入
	DllPort                   string             `json:"dllPort"`                   // dll通信port
	Cert                      string             `json:"cert"`                      // 证书
	Key                       string             `json:"key"`                       // 密钥
	Address                   string             `json:"address"`                   // 服务器 IP 地址
	UseHttps                  bool               `json:"usehttps"`                  // 使用 https
	WebuiPort                 string             `json:"webuiPort"`                 // Webui 端口号
	AutolaunchWebui           bool               `json:"autoLaunchWebui"`           // 自动打开webui
	ProcessName               string             `json:"processName"`               // 进程名称 PalServer
	Onebotv11HttpApiPath      string             `json:"onebotV11HttpApiPath"`      // 机器人框架api地址
	ServerOptions             []string           `json:"serverOptions"`             // 服务器启动参数
	CheckInterval             int                `json:"checkInterval"`             // 进程存活检查时间(秒)
	BackupInterval            int                `json:"backupInterval"`            // 备份间隔(秒)
	RestartInterval           int                `json:"RestartInterval"`           // 自动重启服务器(秒)
	MemoryCheckInterval       int                `json:"memoryCheckInterval"`       // 内存占用检测时间(秒)
	MemoryUsageThreshold      float64            `json:"memoryUsageThreshold"`      // 重启阈值(百分比)
	TotalMemoryGB             int                `json:"totalMemoryGB"`             // 当前服务器总内存
	MemoryCleanupInterval     int                `json:"memoryCleanupInterval"`     // 内存清理时间间隔(秒)
	RegularMessages           []string           `json:"regularMessages"`           // 定期推送的消息数组
	MessageBroadcastInterval  int                `json:"messageBroadcastInterval"`  // 消息广播周期(秒)
	MaintenanceWarningMessage string             `json:"maintenanceWarningMessage"` // 维护警告消息
	WorldSettings             *GameWorldSettings `json:"worldSettings"`             // 帕鲁设定
	Engine                    *Engine            `json:"engine"`                    // 服务端引擎设置
	Players                   []*PlayerW         `json:"players"`                   // 白名单玩家数组
	WhiteCheckTime            int                `json:"whiteCheckTime"`            // 白名单检测时间
	SaveDeleteDays            int                `json:"saveDeleteDays"`            // 存档删除时间
	SteamCmdPath              string             `json:"steamCmdPath"`              // 自定义steamcmd路径
	EnableUe4Debug            bool               `json:"enableUe4Debug"`            // 是否开启UE4 Debug窗口
	EnableEngineSetting       bool               `json:"enableEngineSetting"`       // 是否开启引擎设置
	EnableBotNotification     bool               `json:"enableBotNotification"`     // 是否开启机器人广播
	EnableRebootLater         bool               `json:"enableRebootLater"`         // 是否开启延时关闭&重启
	OverrideDLL               bool               `json:"overrideDLL"`               // 是否由palgo中内置的dll覆盖游戏目录的dll
	UsePalServerExe           bool               `json:"usePalserverexe"`           // 是否维持传统启动行为
}

func ReadConfig

func ReadConfig() Config

readConfig 尝试读取配置文件,如果失败则创建并自动配置默认配置

func ReadConfigv2

func ReadConfigv2() Config

ReadConfigv2 尝试读取配置文件,如果失败则创建并自动配置默认配置

type Engine

type Engine struct {
	Player              PlayerConfig              `json:"player"`
	SocketSubsystemEpic SocketSubsystemEpicConfig `json:"socketsubsystemepic"`
	EngineConfig        EngineConfig              `json:"engine"`
}

Engine is the top-level structure representing the configuration.

func ReadEngineSettings

func ReadEngineSettings(config *Config) (*Engine, error)

ReadEngineSettings 读取并解析引擎的INI配置文件

type EngineConfig

type EngineConfig struct {
	BSmoothFrameRate        bool           `json:"bSmoothFrameRate"`
	BUseFixedFrameRate      bool           `json:"bUseFixedFrameRate"`
	SmoothedFrameRateRange  FrameRateRange `json:"SmoothedFrameRateRange"`
	MinDesiredFrameRate     float64        `json:"MinDesiredFrameRate"`
	FixedFrameRate          float64        `json:"FixedFrameRate"`
	NetClientTicksPerSecond int            `json:"NetClientTicksPerSecond"`
}

EngineConfig represents the configuration for the engine.

type FrameRateRange

type FrameRateRange struct {
	LowerBound Bound `json:"LowerBound"`
	UpperBound Bound `json:"UpperBound"`
}

FrameRateRange represents a range of frame rates.

type GameWorldSettings

type GameWorldSettings struct {
	Difficulty                          string  `json:"difficulty"`
	DayTimeSpeedRate                    float64 `json:"dayTimeSpeedRate"`
	NightTimeSpeedRate                  float64 `json:"nightTimeSpeedRate"`
	ExpRate                             float64 `json:"expRate"`
	PalCaptureRate                      float64 `json:"palCaptureRate"`
	PalSpawnNumRate                     float64 `json:"palSpawnNumRate"`
	PalDamageRateAttack                 float64 `json:"palDamageRateAttack"`
	PalDamageRateDefense                float64 `json:"palDamageRateDefense"`
	PlayerDamageRateAttack              float64 `json:"playerDamageRateAttack"`
	PlayerDamageRateDefense             float64 `json:"playerDamageRateDefense"`
	PlayerStomachDecreaceRate           float64 `json:"playerStomachDecreaceRate"`
	PlayerStaminaDecreaceRate           float64 `json:"playerStaminaDecreaceRate"`
	PlayerAutoHPRegeneRate              float64 `json:"playerAutoHPRegeneRate"`
	PlayerAutoHpRegeneRateInSleep       float64 `json:"playerAutoHpRegeneRateInSleep"`
	PalStomachDecreaceRate              float64 `json:"palStomachDecreaceRate"`
	PalStaminaDecreaceRate              float64 `json:"palStaminaDecreaceRate"`
	PalAutoHPRegeneRate                 float64 `json:"palAutoHPRegeneRate"`
	PalAutoHpRegeneRateInSleep          float64 `json:"palAutoHpRegeneRateInSleep"`
	BuildObjectDamageRate               float64 `json:"buildObjectDamageRate"`
	BuildObjectDeteriorationDamageRate  float64 `json:"buildObjectDeteriorationDamageRate"`
	CollectionDropRate                  float64 `json:"collectionDropRate"`
	CollectionObjectHpRate              float64 `json:"collectionObjectHpRate"`
	CollectionObjectRespawnSpeedRate    float64 `json:"collectionObjectRespawnSpeedRate"`
	EnemyDropItemRate                   float64 `json:"enemyDropItemRate"`
	DeathPenalty                        string  `json:"deathPenalty"`
	EnablePlayerToPlayerDamage          bool    `json:"enablePlayerToPlayerDamage"`
	EnableFriendlyFire                  bool    `json:"enableFriendlyFire"`
	EnableInvaderEnemy                  bool    `json:"enableInvaderEnemy"`
	ActiveUNKO                          bool    `json:"activeUNKO"`
	EnableAimAssistPad                  bool    `json:"enableAimAssistPad"`
	EnableAimAssistKeyboard             bool    `json:"enableAimAssistKeyboard"`
	DropItemMaxNum                      int     `json:"dropItemMaxNum"`
	DropItemMaxNum_UNKO                 int     `json:"dropItemMaxNum_UNKO"`
	BaseCampMaxNum                      int     `json:"baseCampMaxNum"`
	BaseCampWorkerMaxNum                int     `json:"baseCampWorkerMaxNum"`
	DropItemAliveMaxHours               float64 `json:"dropItemAliveMaxHours"`
	AutoResetGuildNoOnlinePlayers       bool    `json:"autoResetGuildNoOnlinePlayers"`
	AutoResetGuildTimeNoOnlinePlayers   float64 `json:"autoResetGuildTimeNoOnlinePlayers"`
	GuildPlayerMaxNum                   int     `json:"guildPlayerMaxNum"`
	PalEggDefaultHatchingTime           float64 `json:"palEggDefaultHatchingTime"`
	WorkSpeedRate                       float64 `json:"workSpeedRate"`
	IsMultiplay                         bool    `json:"isMultiplay"`
	IsPvP                               bool    `json:"isPvP"`
	CanPickupOtherGuildDeathPenaltyDrop bool    `json:"canPickupOtherGuildDeathPenaltyDrop"`
	EnableNonLoginPenalty               bool    `json:"enableNonLoginPenalty"`
	EnableFastTravel                    bool    `json:"enableFastTravel"`
	IsStartLocationSelectByMap          bool    `json:"isStartLocationSelectByMap"`
	ExistPlayerAfterLogout              bool    `json:"existPlayerAfterLogout"`
	EnableDefenseOtherGuildPlayer       bool    `json:"enableDefenseOtherGuildPlayer"`
	ShowPlayerList                      bool    `json:"showPlayerList"`
	CoopPlayerMaxNum                    int     `json:"coopPlayerMaxNum"`
	ServerPlayerMaxNum                  int     `json:"serverPlayerMaxNum"`
	ServerName                          string  `json:"serverName"`
	ServerDescription                   string  `json:"serverDescription"`
	AdminPassword                       string  `json:"adminPassword"`
	ServerPassword                      string  `json:"serverPassword"`
	PublicPort                          int     `json:"publicPort"`
	PublicIP                            string  `json:"publicIP"`
	RconEnabled                         bool    `json:"rconEnabled"`
	RconPort                            int     `json:"rconPort"`
	Region                              string  `json:"region"`
	UseAuth                             bool    `json:"useAuth"`
	BanListURL                          string  `json:"banListURL"`
}

func ReadGameWorldSettings

func ReadGameWorldSettings(config *Config) (*GameWorldSettings, error)

type PlayerConfig

type PlayerConfig struct {
	ConfiguredInternetSpeed int `json:"ConfiguredInternetSpeed"`
	ConfiguredLanSpeed      int `json:"ConfiguredLanSpeed"`
}

PlayerConfig represents the configuration for the player.

type PlayerW

type PlayerW struct {
	Name      string `json:"name"`
	SteamID   string `json:"steamid"`
	PlayerUID string `json:"playeruid"`
}

type SocketSubsystemEpicConfig

type SocketSubsystemEpicConfig struct {
	MaxClientRate         int `json:"MaxClientRate"`
	MaxInternetClientRate int `json:"MaxInternetClientRate"`
}

SocketSubsystemEpicConfig represents the configuration for the socket subsystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL