From d96fe45141b75f5adde7f742cd59bfadc027b715 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Sun, 28 Jan 2024 17:45:39 -0500 Subject: [PATCH] fix(palworld) update config and add new gui options (#17560) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Clean up the initcontainer and add new gui options. some options were moved and partially breaking. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [X] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- charts/incubator/palworld/Chart.yaml | 2 +- charts/incubator/palworld/questions.yaml | 304 +++++++++++++++++------ charts/incubator/palworld/values.yaml | 147 ++++++++--- 3 files changed, 340 insertions(+), 113 deletions(-) diff --git a/charts/incubator/palworld/Chart.yaml b/charts/incubator/palworld/Chart.yaml index 8d560629e03..557d0e6ce7c 100644 --- a/charts/incubator/palworld/Chart.yaml +++ b/charts/incubator/palworld/Chart.yaml @@ -34,4 +34,4 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/palworld - https://ghcr.io/ich777/steamcmd type: application -version: 0.0.2 +version: 0.1.0 diff --git a/charts/incubator/palworld/questions.yaml b/charts/incubator/palworld/questions.yaml index c52fa4ee2f9..148a08a6b69 100644 --- a/charts/incubator/palworld/questions.yaml +++ b/charts/incubator/palworld/questions.yaml @@ -18,8 +18,8 @@ questions: additional_attrs: true type: dict attrs: - - variable: game - label: Game Configuration + - variable: steam + label: Steam Configuration schema: additional_attrs: true type: dict @@ -31,37 +31,6 @@ questions: type: string required: true default: "2394010" - - variable: name - label: Server Name - description: The name of your server. - schema: - type: string - default: "TrueCharts Palworld Server" - - variable: description - label: Server Description - description: The description of your server. - schema: - type: string - default: "A Palworld Server running in Kubernetes" - - variable: max_players - label: Max Players - description: The max players that can play on your server. - schema: - type: int - default: 32 - - variable: password - label: Server Password - description: Optionally set a password for the server. - schema: - type: string - private: true - default: "" - - variable: steam - label: Steam Configuration - schema: - additional_attrs: true - type: dict - attrs: - variable: username label: Username description: Optionally set a steam username otherwise (disable Steam Guard). @@ -75,61 +44,252 @@ questions: type: string private: true default: "" - - variable: admin - label: Admin Configuration + - variable: validate + label: Validate + description: Validates the game data. + schema: + type: boolean + default: false + - variable: game + label: Game Configuration schema: additional_attrs: true type: dict attrs: - - variable: password - label: Server Admin Password + - variable: name + label: Server Name + description: The name of your server. + schema: + type: string + default: "TrueCharts Palworld Server" + - variable: description + label: Server Description + description: The description of your server. + schema: + type: string + default: "A Palworld Server running in Kubernetes" + - variable: use_auth + label: Use Auth + schema: + type: boolean + private: true + - variable: admin_password + label: Admin Server Password description: Optionally set a password for the admin (this field accepts no spaces) schema: type: string private: true default: "" - - variable: params - label: Game Params - schema: - type: list - default: - - EpicApp=PalServer - required: true - items: - - variable: param - label: Param + - variable: password + label: Server Password + description: Optionally set a password for the server. schema: type: string - required: true + private: true default: "" - - variable: params_extra - label: Game Params Extra - schema: - type: list - default: - - -useperfthreads - - -NoAsyncLoadingThread - - -UseMultithreadForDS - required: true - items: - - variable: extra_param - label: Extra Param + - variable: difficulty + label: Server Difficulty schema: type: string + default: "None" + - variable: death_penalty + label: Server Death Penalty + schema: + type: string + default: "ALL" + - variable: max_players + label: Max Players + schema: + type: int + default: 32 + - variable: max_players_coop + label: Max Co-Op Players + schema: + type: int + default: 4 + min: 1 + - variable: max_players_guild + label: Max Guild Players + schema: + type: int + default: 20 + min: 1 + - variable: drop_item_max + label: Drop Item Max + schema: + type: int + default: 3000 + min: 1 + - variable: drop_item_max_unko + label: Drop Item Max Unko + schema: + type: int + default: 100 + min: 1 + - variable: base_camp_max + label: Base Camp Max + schema: + type: int + default: 128 + min: 1 + - variable: base_camp_worker_max + label: Base Camp Worker Max + schema: + type: int + default: 15 + min: 1 + - variable: enable_pvp_damage + label: Enable PVP Damage + schema: + type: boolean + default: false + - variable: enable_friendly_fire + label: Enable Friendly Fire + schema: + type: boolean + default: false + - variable: enable_invader_enemy + label: Enable Invader Enemy + schema: + type: boolean + default: true + - variable: enable_defense_other_guild_player + label: Enable Defense Other Guild Player + schema: + type: boolean + default: true + - variable: enable_non_login_penalty + label: Enable Non Login Penalty + schema: + type: boolean + default: true + - variable: enable_aim_assist_pad + label: Enable Aim Assist Pad + schema: + type: boolean + default: false + - variable: enable_aim_assist_kb + label: Enable Aim Assist KeyBoard + schema: + type: boolean + default: false + - variable: enable_fast_travel + label: Enable Fast Travel + schema: + type: boolean + default: true + - variable: enable_friendly_fire + label: Enable Friendly Fire + schema: + type: boolean + default: false + - variable: is_multiplay + label: Is Multiplay + schema: + type: boolean + default: false + - variable: is_pvp + label: Is PVP + schema: + type: boolean + default: false + - variable: is_start_location_select_by_map + label: Is Start Location Select By Map + schema: + type: boolean + default: true + - variable: active_unko + label: Active Unko + schema: + type: boolean + default: false + - variable: guild_auto_reset_no_online_players + label: Guild Auto Reset No Online Players + schema: + type: boolean + default: false + - variable: auto_reset_guild_time_no_online_players + label: Auto Reset Guid Time No Online Players + schema: + type: string + default: "72.000000" + - variable: can_pickup_other_guild_death_penalty_drop + label: Can Pickup Other Guild Death Penalty Drop + schema: + type: boolean + default: false + - variable: exist_players_after_logout + label: Exist Players After LogOut + schema: + type: boolean + default: false + - variable: update_public_ip + label: Update Public IP + description: Will check if the Public IP is still valid. + schema: + type: boolean + default: false + - variable: ban_list_url + label: Ban List Url + schema: + type: string + default: "https://api.palworldgame.com/api/banlist.txt" + - variable: params + label: Game Params + schema: + type: list + default: + - EpicApp=PalServer required: true - default: "" - - variable: update_public_ip - label: Update Public IP - description: Will check if the Public IP is still valid (the container will try to grab your public IP on the first server start since the public IP is necessary to run a community server). + items: + - variable: param + label: Param + schema: + type: string + required: true + default: "" + - variable: params_extra + label: Game Params Extra + schema: + type: list + default: + - -useperfthreads + - -NoAsyncLoadingThread + - -UseMultithreadForDS + required: true + items: + - variable: extra_param + label: Extra Param + schema: + type: string + required: true + default: "" + - variable: backup + label: Backup Configuration schema: - type: boolean - default: false - - variable: validate - label: Validate - description: Validates the game data. - schema: - type: boolean - default: false + additional_attrs: true + type: dict + attrs: + - variable: enabled + label: Enable Backups + description: To enable the automated backup function. + schema: + type: boolean + default: true + - variable: interval + label: Backup Interval + description: The backup interval in minutes. + schema: + type: int + default: 200 + min: 1 + - variable: to_keep + label: Backups To Keep + description: Number of backups to keep. + schema: + type: int + default: 12 + min: 1 # Include{containerConfig} # Include{podOptions} diff --git a/charts/incubator/palworld/values.yaml b/charts/incubator/palworld/values.yaml index b6612858b7d..0783e254fc8 100644 --- a/charts/incubator/palworld/values.yaml +++ b/charts/incubator/palworld/values.yaml @@ -24,25 +24,54 @@ service: port: 25575 palworld: - game: - id: "2394010" - name: "TrueCharts Palworld Server" - description: "A Palworld Server running in Kubernetes" - max_players: 32 - password: "" steam: + id: "2394010" username: "" password: "" - admin: + validate: false + game: + name: "TrueCharts Palworld Server" + description: "A Palworld Server running in Kubernetes" + use_auth: true + admin_password: "" password: "" - params: - - EpicApp=PalServer - params_extra: - - -useperfthreads - - -NoAsyncLoadingThread - - -UseMultithreadForDS - update_public_ip: false - validate: false + difficulty: "None" + death_penalty: "ALL" + max_players: 32 + max_players_coop: 4 + max_players_guild: 20 + drop_item_max: 3000 + drop_item_max_unko: 100 + base_camp_max: 128 + base_camp_worker_max: 15 + enable_pvp_damage: false + enable_friendly_fire: false + enable_invader_enemy: true + enable_defense_other_guild_player: true + enable_non_login_penalty: true + enable_aim_assist_pad: false + enable_aim_assist_kb: false + enable_fast_travel: true + is_multiplay: false + is_pvp: false + is_start_location_select_by_map: true + active_unko: false + guild_auto_reset_no_online_players: false + auto_reset_guild_time_no_online_players: "72.000000" + can_pickup_other_guild_death_penalty_drop: false + exist_players_after_logout: true + update_public_ip: false + ban_list_url: "https://api.palworldgame.com/api/banlist.txt" + params: + - EpicApp=PalServer + params_extra: + - -useperfthreads + - -NoAsyncLoadingThread + - -UseMultithreadForDS + backup: + enabled: true + interval: 120 + to_keep: 12 workload: main: @@ -59,13 +88,6 @@ workload: - | config={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/Pal/Saved/Config/LinuxServer cfgFile=${config}/PalWorldSettings.ini - rconPort={{ .Values.service.rcon.ports.rcon.port }} - mainPort={{ .Values.service.main.ports.main.port }} - name="{{ .Values.palworld.game.name }}" - description="{{ .Values.palworld.game.description }}" - maxPlayers={{ .Values.palworld.game.max_players }} - gamePass={{ .Values.palworld.game.password }} - adminPass={{ .Values.palworld.admin.password }} mkdir -p ${config} if [ ! -f ${cfgFile} ]; then @@ -75,23 +97,61 @@ workload: fi set_ini_value() { - local key="${1}" - local value="${2}" + local key="${1}" + local value="${2}" - echo "Setting ${key}..." - sed -i "s|\(${key}=\)[^,]*|\1${value}|g" "${cfgFile}" - echo "Set to $(grep -Po "${key}=[^,]*" "${cfgFile}")" + # Check if the value contains spaces or special characters + if echo "$value" | grep -q '[[:space:]]\|[^\w.-]'; then + # Add quotes around the value + value="\"$value\"" + fi + + echo "Setting ${key}..." + sed -i "s|\(${key}=\)[^,]*|\1${value}|g" "${cfgFile}" + echo "Set to $(grep -Po "(?<=${key}=)[^,]*" "${cfgFile}")" } set_ini_value "RCONEnabled" "True" - set_ini_value "RCONPort" "${rconPort}" - set_ini_value "PublicPort" "${mainPort}" - set_ini_value "ServerName" "${name}" - set_ini_value "ServerDescription" "${description}" - set_ini_value "ServerPlayerMaxNum" "${maxPlayers}" - set_ini_value "ServerPassword" "${gamePass}" - set_ini_value "AdminPassword" "${adminPass}" + set_ini_value "RCONPort" "{{ .Values.service.rcon.ports.rcon.port }}" + set_ini_value "PublicPort" "{{ .Values.service.main.ports.main.port }}" + + set_ini_value "ServerName" "{{ .Values.palworld.game.name }}" + set_ini_value "ServerDescription" "{{ .Values.palworld.game.description }}" + set_ini_value "Difficulty" "{{ .Values.palworld.game.difficulty }}" + set_ini_value "DeathPenalty" "{{ .Values.palworld.game.death_penalty }}" + + set_ini_value "ServerPlayerMaxNum" "{{ .Values.palworld.game.max_players }}" + set_ini_value "CoopPlayerMaxNum" "{{ .Values.palworld.game.max_players_coop }}" + set_ini_value "GuildPlayerMaxNum" "{{ .Values.palworld.game.max_players_guild }}" + + set_ini_value "DropItemMaxNum" "{{ .Values.palworld.game.max_players_guild }}" + set_ini_value "DropItemMaxNum_UNKO" "{{ .Values.palworld.game.drop_item_max_unko }}" + set_ini_value "BaseCampMaxNum" "{{ .Values.palworld.game.base_camp_max }}" + set_ini_value "BaseCampWorkerMaxNum" "{{ .Values.palworld.game.base_camp_worker_max }}" + + set_ini_value "bUseAuth" "{{ .Values.palworld.game.use_auth }}" + set_ini_value "bEnablePlayerToPlayerDamage" "{{ .Values.palworld.game.enable_pvp_damage }}" + set_ini_value "bEnableFriendlyFire" "{{ .Values.palworld.game.enable_friendly_fire }}" + set_ini_value "bEnableInvaderEnemy" "{{ .Values.palworld.game.enable_invader_enemy }}" + set_ini_value "bEnableAimAssistPad" "{{ .Values.palworld.game.enable_aim_assist_pad }}" + set_ini_value "bEnableAimAssistKeyboard" "{{ .Values.palworld.game.enable_aim_assist_kb }}" + set_ini_value "bEnableNonLoginPenalty" "{{ .Values.palworld.game.enable_non_login_penalty }}" + set_ini_value "bEnableFastTravel" "{{ .Values.palworld.game.enable_fast_travel }}" + set_ini_value "bEnableDefenseOtherGuildPlayer" "{{ .Values.palworld.game.enable_defense_other_guild_player }}" + set_ini_value "bIsMultiplay" "{{ .Values.palworld.game.is_multiplay }}" + set_ini_value "bIsStartLocationSelectByMap" "{{ .Values.palworld.game.is_start_location_select_by_map }}" + set_ini_value "bIsPvP" "{{ .Values.palworld.game.is_pvp }}" + set_ini_value "bExistPlayerAfterLogout" "{{ .Values.palworld.game.exist_players_after_logout }}" + set_ini_value "bActiveUNKO" "{{ .Values.palworld.game.active_unko }}" + set_ini_value "bAutoResetGuildNoOnlinePlayers" "{{ .Values.palworld.game.guild_auto_reset_no_online_players }}" + set_ini_value "AutoResetGuildTimeNoOnlinePlayers" "{{ .Values.palworld.game.auto_reset_guild_time_no_online_players }}" + set_ini_value "bCanPickupOtherGuildDeathPenaltyDrop" "{{ .Values.palworld.game.can_pickup_other_guild_death_penalty_drop }}" + set_ini_value "ServerPassword" "{{ .Values.palworld.game.password }}" + set_ini_value "AdminPassword" "{{ .Values.palworld.game.admin_password }}" + set_ini_value "BanListURL" "{{ .Values.palworld.game.ban_list_url }}" + echo "Done!" + containers: main: probes: @@ -105,16 +165,23 @@ workload: type: tcp port: "{{ .Values.service.rcon.ports.rcon.port }}" env: + # paths STEAMCMD_DIR: "{{ .Values.persistence.steamcmd.mountPath }}" SERVER_DIR: "{{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}" - GAME_ID: "{{ .Values.palworld.game.id }}" - SRV_ADMIN_PWD: "{{ .Values.palworld.admin.password }}" - GAME_PARAMS: '{{ join " " .Values.palworld.params }}' - GAME_PARAMS_EXTRA: '{{ join " " .Values.palworld.params_extra }}' - UPDATE_PUBLIC_IP: "{{ .Values.palworld.update_public_ip }}" - VALIDATE: "{{ .Values.palworld.validate }}" + # steam + GAME_ID: "{{ .Values.palworld.steam.id }}" USERNAME: "{{ .Values.palworld.steam.username }}" PASSWRD: "{{ .Values.palworld.steam.password }}" + VALIDATE: "{{ .Values.palworld.steam.validate }}" + # game + SRV_ADMIN_PWD: "{{ .Values.palworld.game.admin_password }}" + UPDATE_PUBLIC_IP: "{{ .Values.palworld.game.update_public_ip }}" + GAME_PARAMS: '{{ join " " .Values.palworld.game.params }}' + GAME_PARAMS_EXTRA: '{{ join " " .Values.palworld.game.params_extra }}' + # backup + BACKUP: "{{ .Values.palworld.backup.enabled }}" + BACKUP_INTERVAL: "{{ .Values.palworld.backup.interval }}" + BACKUP_TO_KEEP: "{{ .Values.palworld.backup.to_keep }}" persistence: steamcmd: