Skip to content

Commit

Permalink
beta43
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoshinonyaruko committed Mar 2, 2024
2 parents 5977c8d + 485f7a3 commit 0ca7960
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 30 deletions.
5 changes: 3 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ type GameWorldSettings struct {
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"`
Expand Down Expand Up @@ -507,7 +508,7 @@ func ReadGameWorldSettings(config *Config) (*GameWorldSettings, error) {
section, err := cfg.GetSection(sectionName)
if err != nil {
fmt.Printf("初次使用,正在为您自动设置游戏默认参数\n")
settingsString = "(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName=\"palgo\",ServerDescription=\"https://github.com/Hoshinonyaruko/palworld-go\",AdminPassword=\"useradmin\",ServerPassword=\"\",PublicPort=8211,PublicIP=\"\",RCONEnabled=True,RCONPort=25575,Region=\"\",bUseAuth=True,BanListURL=\"https://api.palworldgame.com/api/banlist.txt\")"
settingsString = "(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,bShowPlayerList=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName=\"palgo\",ServerDescription=\"https://github.com/Hoshinonyaruko/palworld-go\",AdminPassword=\"useradmin\",ServerPassword=\"\",PublicPort=8211,PublicIP=\"\",RCONEnabled=True,RCONPort=25575,Region=\"\",bUseAuth=True,BanListURL=\"https://api.palworldgame.com/api/banlist.txt\")"
fmt.Printf("已为您生成默认游戏配置,默认控制台地址:http://127.0.0.1:52000\n")
fmt.Printf("控制台默认用户名(在ServerName配置):palgo\n")
fmt.Printf("控制台默认密码(在AdminPassword配置):useradmin\n")
Expand All @@ -520,7 +521,7 @@ func ReadGameWorldSettings(config *Config) (*GameWorldSettings, error) {
optionSettingsKey, err := section.GetKey("OptionSettings")
if err != nil {
fmt.Printf("未找到配置设置,使用游戏默认配置\n")
settingsString = "(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName=\"palgo\",ServerDescription=\"https://github.com/Hoshinonyaruko/palworld-go\",AdminPassword=\"useradmin\",ServerPassword=\"\",PublicPort=8211,PublicIP=\"\",RCONEnabled=True,RCONPort=25575,Region=\"\",bUseAuth=True,BanListURL=\"https://api.palworldgame.com/api/banlist.txt\")"
settingsString = "(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,bShowPlayerList=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName=\"palgo\",ServerDescription=\"https://github.com/Hoshinonyaruko/palworld-go\",AdminPassword=\"useradmin\",ServerPassword=\"\",PublicPort=8211,PublicIP=\"\",RCONEnabled=True,RCONPort=25575,Region=\"\",bUseAuth=True,BanListURL=\"https://api.palworldgame.com/api/banlist.txt\")"
fmt.Printf("已为您生成默认游戏配置,默认控制台地址:http://127.0.0.1:52000\n")
fmt.Printf("控制台默认用户名(在ServerName配置):palgo\n")
fmt.Printf("控制台默认密码(在AdminPassword配置):useradmin\n")
Expand Down
13 changes: 6 additions & 7 deletions front/palworld-front/src/pages/IndexView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
/>
<q-toggle
v-model="config.communityServer"
label="启动为社区服务器(需设置steam路径)"
label="启动为社区服务器"
class="q-my-md"
/>
<q-toggle
Expand Down Expand Up @@ -152,12 +152,6 @@
label="游戏存档备份存放路径"
class="q-my-md"
/>
<q-input
filled
v-model="config.steamPath"
label="Steam安装路径(启动社区服务器用)"
class="q-my-md"
/>
<q-input
filled
v-model="config.steamCmdPath"
Expand Down Expand Up @@ -755,6 +749,11 @@
label="启用对其他公会玩家的防御"
class="q-my-md"
/>
<q-toggle
v-model="config.worldSettings.showPlayerList"
label="启用服务器内可以查看其他玩家列表"
class="q-my-md"
/>
<q-toggle
v-model="config.worldSettings.isMultiplay"
label="是否多人游戏"
Expand Down
9 changes: 9 additions & 0 deletions sys/restart_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ func RestartService(config config.Config) {
fmt.Sprintf("-players=%d", config.WorldSettings.ServerPlayerMaxNum),
}

if config.CommunityServer {
args = append(args, "-publiclobby")
}

// 如果RCON启用,则添加RCON参数
if config.WorldSettings.RconEnabled {
args = append(args, "-rcon")
}

args = append(args, config.ServerOptions...) // 添加GameWorldSettings参数

// 执行启动命令
Expand Down
16 changes: 12 additions & 4 deletions sys/restart_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,7 @@ func RestartService(config config.Config) {

//发送机器人推送
bot.SendCommandMessages("run", config)
if config.CommunityServer {
exePath = filepath.Join(config.SteamPath, "Steam.exe")
args = []string{"-applaunch", "2394010"}
} else if config.UseDll {
if config.UseDll {
err := mod.CheckAndWriteFiles(filepath.Join(config.GamePath, "Pal", "Binaries", "Win64"), config)
if err != nil {
log.Printf("Failed to write files: %v", err)
Expand Down Expand Up @@ -253,6 +250,17 @@ func RestartService(config config.Config) {
}
}

if config.CommunityServer {
// https://tech.palworldgame.com/getting-started/deploy-community-server
// 启动社区服务器可以直接使用PalSerer.exe 启动
args = append(args, "-publiclobby")
}

// 如果RCON启用,则添加RCON参数
if config.WorldSettings.RconEnabled {
args = append(args, "-rcon")
}

args = append(args, config.ServerOptions...) // 添加GameWorldSettings参数

// 执行启动命令
Expand Down
3 changes: 1 addition & 2 deletions tool/rcon.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,14 @@ func Broadcast(config config.Config, message string) error {
}
defer exec.Close()

response, err := exec.Execute("Broadcast "+strings.ReplaceAll(message, " ", "_"), config.UseDll)
response, err := exec.Execute("broadcast "+strings.ReplaceAll(message, " ", "_"), config.UseDll)
if err != nil {
return err
}
if response != fmt.Sprintf("Broadcasted: %s", message) {
return errors.New(response)
}
return nil

}

func Shutdown(config config.Config, seconds string, message string) error {
Expand Down
61 changes: 61 additions & 0 deletions webui/dist2/assets/index-uaZDSxZ1.js

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions webui/dist2/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/assets/favicon-orkAu1xw.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Palworld Server Configuration Generator</title>
<script type="module" crossorigin src="/assets/index-PXu6TukB.js"></script>
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/assets/favicon-orkAu1xw.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Palworld Server Configuration Generator</title>
<script type="module" crossorigin src="/assets/index-uaZDSxZ1.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-M1eIIqPy.css">
</head>

<body>
<div id="root"></div>
</body>

</head>

<body>
<div id="root"></div>

</body>

</html>

0 comments on commit 0ca7960

Please sign in to comment.