Skip to content

Commit

Permalink
Merge pull request #3 from luvsicz/main
Browse files Browse the repository at this point in the history
fix: typo fix(Decrease->Decreace)
  • Loading branch information
limitcool authored Feb 2, 2024
2 parents 28cb900 + 68d9bd2 commit 638bdd6
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 105 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SaveConfig:
MaxRetentionDays: 7 # 存档最大保留时间,默认为7天
BackupDirectory: backups/ # 存档保存目录
RestartCommand: "docker restart palworld" # 自动重启的命令
#RestartCommand: "taskkill /f /im PalServer-Win64-Test-Cmd.exe && start D:\\Pal-Steam-Cmd\\steamapps\\common\\PalServer\\Pal\\Binaries\\Win64\\PalServer-Win64-Test-Cmd.exe" # (Windows) 需要修改路径为实际的的PalServer-Win64-Test-Cmd.exe路径
```

### 修改配置文件方法
Expand Down
2 changes: 1 addition & 1 deletion global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ var AppDir = util.AppDataDir("palworld-admin", false)
// var ConfigPath = filepath.Join(AppDir, "config")
var ConfigFile = filepath.Join(AppDir, "config.yaml")

const VERSION = "0.1.4"
const VERSION = "0.1.5"
156 changes: 78 additions & 78 deletions routers/dist/assets/index-VWXIhQZU.js

Large diffs are not rendered by default.

49 changes: 23 additions & 26 deletions settings-parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ type ServerConfig struct {
PalDamageRateDefense float64 `json:"PalDamageRateDefense"`
PlayerDamageRateAttack float64 `json:"PlayerDamageRateAttack"`
PlayerDamageRateDefense float64 `json:"PlayerDamageRateDefense"`
PlayerStomachDecreaseRate float64 `json:"PlayerStomachDecreaseRate"`
PlayerStaminaDecreaseRate float64 `json:"PlayerStaminaDecreaseRate"`
PlayerStomachDecreaceRate float64 `json:"PlayerStomachDecreaceRate"`
PlayerStaminaDecreaceRate float64 `json:"PlayerStaminaDecreaceRate"`
PlayerAutoHPRegeneRate float64 `json:"PlayerAutoHPRegeneRate"`
PlayerAutoHpRegeneRateInSleep float64 `json:"PlayerAutoHpRegeneRateInSleep"`
PalStomachDecreaseRate float64 `json:"PalStomachDecreaseRate"`
PalStaminaDecreaseRate float64 `json:"PalStaminaDecreaseRate"`
PalStomachDecreaceRate float64 `json:"PalStomachDecreaceRate"`
PalStaminaDecreaceRate float64 `json:"PalStaminaDecreaceRate"`
PalAutoHPRegeneRate float64 `json:"PalAutoHPRegeneRate"`
PalAutoHpRegeneRateInSleep float64 `json:"PalAutoHpRegeneRateInSleep"`
BuildObjectDamageRate float64 `json:"BuildObjectDamageRate"`
Expand Down Expand Up @@ -129,18 +129,27 @@ func FillStructFromMap(configMap map[string]string, config *ServerConfig) {
config.PlayerDamageRateAttack = cast.ToFloat64(value)
case "PlayerDamageRateDefense":
config.PlayerDamageRateDefense = cast.ToFloat64(value)
case "PlayerStomachDecreaseRate":
config.PlayerStomachDecreaseRate = cast.ToFloat64(value)
case "PlayerStaminaDecreaseRate":
config.PlayerStaminaDecreaseRate = cast.ToFloat64(value)
case "PlayerAutoHPRegeneRate":
config.PlayerAutoHPRegeneRate = cast.ToFloat64(value)
case "PlayerAutoHpRegeneRateInSleep":
config.PlayerAutoHpRegeneRateInSleep = cast.ToFloat64(value)
case "PalStomachDecreaseRate":
config.PalStomachDecreaseRate = cast.ToFloat64(value)
case "PalStaminaDecreaseRate":
config.PalStaminaDecreaseRate = cast.ToFloat64(value)

//case "PlayerStomachDecreaseRate":
// config.PlayerStomachDecreaceRate = cast.ToFloat64(value)
//case "PlayerStaminaDecreaseRate":
// config.PlayerStaminaDecreaceRate = cast.ToFloat64(value)
//case "PalStomachDecreaseRate":
// config.PalStomachDecreaceRate = cast.ToFloat64(value)
//case "PalStaminaDecreaseRate":
// config.PalStaminaDecreaceRate = cast.ToFloat64(value)
case "PlayerStaminaDecreaceRate":
config.PlayerStaminaDecreaceRate = cast.ToFloat64(value)
case "PlayerStomachDecreaceRate":
config.PlayerStomachDecreaceRate = cast.ToFloat64(value)
case "PalStaminaDecreaceRate":
config.PalStaminaDecreaceRate = cast.ToFloat64(value)
case "PalStomachDecreaceRate":
config.PalStomachDecreaceRate = cast.ToFloat64(value)
case "PalAutoHPRegeneRate":
config.PalAutoHPRegeneRate = cast.ToFloat64(value)
case "PalAutoHpRegeneRateInSleep":
Expand Down Expand Up @@ -243,18 +252,6 @@ func FillStructFromMap(configMap map[string]string, config *ServerConfig) {
} else {
config.BanListURL = strings.Trim(value, ")")
}
case "PalStaminaDecreaceRate":
{
config.PalStaminaDecreaseRate = cast.ToFloat64(value)
}
case "PlayerStaminaDecreaceRate":
{
config.PlayerStaminaDecreaseRate = cast.ToFloat64(value)
}
case "PlayerStomachDecreaceRate":
config.PlayerStomachDecreaseRate = cast.ToFloat64(value)
case "PalStomachDecreaceRate":
config.PalStomachDecreaseRate = cast.ToFloat64(value)
case "bUseAuth":
config.BUseAuth = cast.ToBool(value)
default:
Expand All @@ -266,8 +263,8 @@ func FillStructFromMap(configMap map[string]string, config *ServerConfig) {
// Struct2String converts the ServerConfig struct to a string representation.
func Struct2String(config *ServerConfig) string {
// 使用字符串拼接构建格式化后的字符串
result := fmt.Sprintf("Difficulty=%s,DayTimeSpeedRate=%f,NightTimeSpeedRate=%f,ExpRate=%f,PalCaptureRate=%f,PalSpawnNumRate=%f,PalDamageRateAttack=%f,PalDamageRateDefense=%f,PlayerDamageRateAttack=%f,PlayerDamageRateDefense=%f,PlayerStomachDecreaseRate=%f,PlayerStaminaDecreaseRate=%f,PlayerAutoHPRegeneRate=%f,PlayerAutoHpRegeneRateInSleep=%f,PalStomachDecreaseRate=%f,PalStaminaDecreaseRate=%f,PalAutoHPRegeneRate=%f,PalAutoHpRegeneRateInSleep=%f,BuildObjectDamageRate=%f,BuildObjectDeteriorationDamageRate=%f,CollectionDropRate=%f,CollectionObjectHpRate=%f,CollectionObjectRespawnSpeedRate=%f,EnemyDropItemRate=%f,DeathPenalty=%s,bEnablePlayerToPlayerDamage=%t,bEnableFriendlyFire=%t,bEnableInvaderEnemy=%t,bActiveUNKO=%t,bEnableAimAssistPad=%t,bEnableAimAssistKeyboard=%t,DropItemMaxNum=%d,DropItemMaxNum_UNKO=%d,BaseCampMaxNum=%d,BaseCampWorkerMaxNum=%d,DropItemAliveMaxHours=%f,bAutoResetGuildNoOnlinePlayers=%t,AutoResetGuildTimeNoOnlinePlayers=%f,GuildPlayerMaxNum=%d,PalEggDefaultHatchingTime=%f,WorkSpeedRate=%f,bIsMultiplay=%t,bIsPvP=%t,bCanPickupOtherGuildDeathPenaltyDrop=%t,bEnableNonLoginPenalty=%t,bEnableFastTravel=%t,bIsStartLocationSelectByMap=%t,bExistPlayerAfterLogout=%t,bEnableDefenseOtherGuildPlayer=%t,CoopPlayerMaxNum=%d,ServerPlayerMaxNum=%d,ServerName=%s,ServerDescription=%s,AdminPassword=%s,ServerPassword=%s,PublicPort=%d,PublicIP=%s,RCONEnabled=%t,RCONPort=%d,Region=%s,bUseAuth=%t,BanListURL=%s",
config.Difficulty, config.DayTimeSpeedRate, config.NightTimeSpeedRate, config.ExpRate, config.PalCaptureRate, config.PalSpawnNumRate, config.PalDamageRateAttack, config.PalDamageRateDefense, config.PlayerDamageRateAttack, config.PlayerDamageRateDefense, config.PlayerStomachDecreaseRate, config.PlayerStaminaDecreaseRate, config.PlayerAutoHPRegeneRate, config.PlayerAutoHpRegeneRateInSleep, config.PalStomachDecreaseRate, config.PalStaminaDecreaseRate, config.PalAutoHPRegeneRate, config.PalAutoHpRegeneRateInSleep, config.BuildObjectDamageRate, config.BuildObjectDeteriorationDamageRate, config.CollectionDropRate, config.CollectionObjectHpRate, config.CollectionObjectRespawnSpeedRate, config.EnemyDropItemRate, config.DeathPenalty, config.BEnablePlayerToPlayerDamage, config.BEnableFriendlyFire, config.BEnableInvaderEnemy, config.BActiveUNKO, config.BEnableAimAssistPad, config.BEnableAimAssistKeyboard, config.DropItemMaxNum, config.DropItemMaxNumUNKO, config.BaseCampMaxNum, config.BaseCampWorkerMaxNum, config.DropItemAliveMaxHours, config.BAutoResetGuildNoOnlinePlayers, config.AutoResetGuildTimeNoOnlinePlayers, config.GuildPlayerMaxNum, config.PalEggDefaultHatchingTime, config.WorkSpeedRate, config.BIsMultiplay, config.BIsPvP, config.BCanPickupOtherGuildDeathPenaltyDrop, config.BEnableNonLoginPenalty, config.BEnableFastTravel, config.BIsStartLocationSelectByMap, config.BExistPlayerAfterLogout, config.BEnableDefenseOtherGuildPlayer, config.CoopPlayerMaxNum, config.ServerPlayerMaxNum, config.ServerName, config.ServerDescription, config.AdminPassword, config.ServerPassword, config.PublicPort, config.PublicIP, config.RCONEnabled, config.RCONPort, config.Region, config.BUseAuth, config.BanListURL)
result := fmt.Sprintf("Difficulty=%s,DayTimeSpeedRate=%f,NightTimeSpeedRate=%f,ExpRate=%f,PalCaptureRate=%f,PalSpawnNumRate=%f,PalDamageRateAttack=%f,PalDamageRateDefense=%f,PlayerDamageRateAttack=%f,PlayerDamageRateDefense=%f,PlayerStomachDecreaceRate=%f,PlayerStaminaDecreaceRate=%f,PlayerAutoHPRegeneRate=%f,PlayerAutoHpRegeneRateInSleep=%f,PalStomachDecreaceRate=%f,PalStaminaDecreaceRate=%f,PalAutoHPRegeneRate=%f,PalAutoHpRegeneRateInSleep=%f,BuildObjectDamageRate=%f,BuildObjectDeteriorationDamageRate=%f,CollectionDropRate=%f,CollectionObjectHpRate=%f,CollectionObjectRespawnSpeedRate=%f,EnemyDropItemRate=%f,DeathPenalty=%s,bEnablePlayerToPlayerDamage=%t,bEnableFriendlyFire=%t,bEnableInvaderEnemy=%t,bActiveUNKO=%t,bEnableAimAssistPad=%t,bEnableAimAssistKeyboard=%t,DropItemMaxNum=%d,DropItemMaxNum_UNKO=%d,BaseCampMaxNum=%d,BaseCampWorkerMaxNum=%d,DropItemAliveMaxHours=%f,bAutoResetGuildNoOnlinePlayers=%t,AutoResetGuildTimeNoOnlinePlayers=%f,GuildPlayerMaxNum=%d,PalEggDefaultHatchingTime=%f,WorkSpeedRate=%f,bIsMultiplay=%t,bIsPvP=%t,bCanPickupOtherGuildDeathPenaltyDrop=%t,bEnableNonLoginPenalty=%t,bEnableFastTravel=%t,bIsStartLocationSelectByMap=%t,bExistPlayerAfterLogout=%t,bEnableDefenseOtherGuildPlayer=%t,CoopPlayerMaxNum=%d,ServerPlayerMaxNum=%d,ServerName=%s,ServerDescription=%s,AdminPassword=%s,ServerPassword=%s,PublicPort=%d,PublicIP=%s,RCONEnabled=%t,RCONPort=%d,Region=%s,bUseAuth=%t,BanListURL=%s",
config.Difficulty, config.DayTimeSpeedRate, config.NightTimeSpeedRate, config.ExpRate, config.PalCaptureRate, config.PalSpawnNumRate, config.PalDamageRateAttack, config.PalDamageRateDefense, config.PlayerDamageRateAttack, config.PlayerDamageRateDefense, config.PlayerStomachDecreaceRate, config.PlayerStaminaDecreaceRate, config.PlayerAutoHPRegeneRate, config.PlayerAutoHpRegeneRateInSleep, config.PalStomachDecreaceRate, config.PalStaminaDecreaceRate, config.PalAutoHPRegeneRate, config.PalAutoHpRegeneRateInSleep, config.BuildObjectDamageRate, config.BuildObjectDeteriorationDamageRate, config.CollectionDropRate, config.CollectionObjectHpRate, config.CollectionObjectRespawnSpeedRate, config.EnemyDropItemRate, config.DeathPenalty, config.BEnablePlayerToPlayerDamage, config.BEnableFriendlyFire, config.BEnableInvaderEnemy, config.BActiveUNKO, config.BEnableAimAssistPad, config.BEnableAimAssistKeyboard, config.DropItemMaxNum, config.DropItemMaxNumUNKO, config.BaseCampMaxNum, config.BaseCampWorkerMaxNum, config.DropItemAliveMaxHours, config.BAutoResetGuildNoOnlinePlayers, config.AutoResetGuildTimeNoOnlinePlayers, config.GuildPlayerMaxNum, config.PalEggDefaultHatchingTime, config.WorkSpeedRate, config.BIsMultiplay, config.BIsPvP, config.BCanPickupOtherGuildDeathPenaltyDrop, config.BEnableNonLoginPenalty, config.BEnableFastTravel, config.BIsStartLocationSelectByMap, config.BExistPlayerAfterLogout, config.BEnableDefenseOtherGuildPlayer, config.CoopPlayerMaxNum, config.ServerPlayerMaxNum, config.ServerName, config.ServerDescription, config.AdminPassword, config.ServerPassword, config.PublicPort, config.PublicIP, config.RCONEnabled, config.RCONPort, config.Region, config.BUseAuth, config.BanListURL)

// 替换布尔类型的 true/false 为字符串格式
result = strings.ReplaceAll(result, "true", "True")
Expand Down

0 comments on commit 638bdd6

Please sign in to comment.