diff --git a/Dockerfile b/Dockerfile index ca0e784..80cbabd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,23 +33,82 @@ VOLUME [ "/palworld" ] USER steam + ENV DEBIAN_FRONTEND=noninteractive \ PUID=0 \ PGID=0 \ - TZ=Europe/Berlin \ + # Container setttings + TZ="Europe/Berlin" \ ALWAYS_UPDATE_ON_START=true \ MULTITHREAD_ENABLED=true \ COMMUNITY_SERVER=true \ BACKUP_ENABLED=true \ BACKUP_CRON_EXPRESSION="0 * * * *" \ + STEAMCMD_VALIDATE_FILES=true \ + SERVER_SETTINGS_MODE=auto \ + # Server-setting NETSERVERMAXTICKRATE=120 \ + DIFFICULTY=None \ + DAYTIME_SPEEDRATE=1.000000 \ + NIGHTTIME_SPEEDRATE=1.000000 \ + EXP_RATE=1.000000 \ + PAL_CAPTURE_RATE=1.000000 \ + PAL_SPAWN_NUM_RATE=1.000000 \ + PAL_DAMAGE_RATE_ATTACK=1.000000 \ + PAL_DAMAGE_RATE_DEFENSE=1.000000 \ + PLAYER_DAMAGE_RATE_ATTACK=1.000000 \ + PLAYER_DAMAGE_RATE_DEFENSE=1.000000 \ + PLAYER_STOMACH_DECREASE_RATE=1.000000 \ + PLAYER_STAMINA_DECREACE_RATE=1.000000 \ + PLAYER_AUTO_HP_REGENE_RATE=1.000000 \ + PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP=1.000000 \ + PAL_STOMACH_DECREACE_RATE=1.000000 \ + PAL_STAMINA_DECREACE_RATE=1.000000 \ + PAL_AUTO_HP_REGENE_RATE=1.000000 \ + PAL_AUTO_HP_REGENE_RATE_IN_SLEEP=1.000000 \ + BUILD_OBJECT_DAMAGE_RATE=1.000000 \ + BUILD_OBJECT_DETERIORATION_DAMAGE_RATE=1.000000 \ + COLLECTION_DROP_RATE=1.000000 \ + COLLECTION_OBJECT_HP_RATE=1.000000 \ + COLLECTION_OBJECT_RESPAWN_SPEED_RATE=1.000000 \ + ENEMY_DROP_ITEM_RATE=1.000000 \ + DEATH_PENALTY=All \ + ENABLE_PLAYER_TO_PLAYER_DAMAGE=false \ + ENABLE_FRIENDLY_FIRE=false \ + ENABLE_INVADER_ENEMY=true \ + ACTIVE_UNKO=false \ + ENABLE_AIM_ASSIST_PAD=true \ + ENABLE_AIM_ASSIST_KEYBOARD=false \ + DROP_ITEM_MAX_NUM=3000 \ + DROP_ITEM_MAX_NUM_UNKO=100 \ + BASE_CAMP_MAX_NUM=128 \ + BASE_CAMP_WORKER_MAXNUM=15 \ + DROP_ITEM_ALIVE_MAX_HOURS=1.000000 \ + AUTO_RESET_GUILD_NO_ONLINE_PLAYERS=false \ + AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS=72.000000 \ + GUILD_PLAYER_MAX_NUM=20 \ + PAL_EGG_DEFAULT_HATCHING_TIME=72.000000 \ + WORK_SPEED_RATE=1.000000 \ + IS_MULTIPLAY=false \ + IS_PVP=false \ + CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP=false \ + ENABLE_NON_LOGIN_PENALTY=true \ + ENABLE_FAST_TRAVEL=true \ + IS_START_LOCATION_SELECT_BY_MAP=true \ + EXIST_PLAYER_AFTER_LOGOUT=false \ + ENABLE_DEFENSE_OTHER_GUILD_PLAYER=false \ + COOP_PLAYER_MAX_NUM=4 \ MAX_PLAYERS=32 \ - SERVER_NAME=jammsen-docker-generated-###RANDOM### \ + SERVER_NAME="jammsen-docker-generated-###RANDOM###" \ SERVER_DESCRIPTION="Palworld-Dedicated-Server running in Docker by jammsen" \ ADMIN_PASSWORD=adminPasswordHere \ SERVER_PASSWORD=serverPasswordHere \ - PUBLIC_IP=10.0.0.1 \ PUBLIC_PORT=8211 \ - RCON_ENABLED=true + PUBLIC_IP= \ + RCON_ENABLED=false \ + RCON_PORT=25575 \ + REGION= \ + USEAUTH=true \ + BAN_LIST_URL=https://api.palworldgame.com/api/banlist.txt CMD ["/servermanager.sh"] diff --git a/README.md b/README.md index a9de85b..ad7fac1 100644 --- a/README.md +++ b/README.md @@ -70,14 +70,18 @@ To run this Docker image, you need a basic understanding of Docker, Docker-Compo These settings control the behavior of the Docker container: -| Variable | Description | Default value | Allowed value | -| ---------------------- | ------------------------------------------------------------------- | ------------------------------ | ------------------------------------- | -| TZ | Timezone used for time stamping server backups | Europe/Berlin | See [TZ identifiers](#tz-identifiers) | -| ALWAYS_UPDATE_ON_START | Updates the server on startup | true | false/true | -| MULTITHREAD_ENABLED | Sets options for "Improved multi-threaded CPU performance" | true | false/true | -| COMMUNITY_SERVER | Set to enabled, the server will appear in the Community-Serverlist. | true | false/true | -| BACKUP_ENABLED | Backup function, creates backups in your `game` directory | true | false/true | -| BACKUP_CRON_EXPRESSION | Needs a Cron-Expression - See [Cron expression](#cron-expression) | 0 * * * * (meaning every hour) | Cron-Expression | +> If you want to change the server settings via environment variables use the default value (`auto`) for the environment variable `SERVER_SETTINGS_MODE`, otherwise change it to `manual` and edit the config file directly. + +| Variable | Description | Default value | Allowed values | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| TZ | Timezone used for time stamping server backups | Europe/Berlin | See [TZ identifiers](#tz-identifiers) | +| ALWAYS_UPDATE_ON_START | Updates the server on startup | true | false/true | +| MULTITHREAD_ENABLED | Sets options for "Improved multi-threaded CPU performance" | true | false/true | +| COMMUNITY_SERVER | Set to enabled, the server will appear in the Community-Serverlist. | true | false/true | +| BACKUP_ENABLED | Backup function, creates backups in your `game` directory | true | false/true | +| BACKUP_CRON_EXPRESSION | Needs a Cron-Expression - See [Cron expression](#cron-expression) | 0 * * * * (meaning every hour) | Cron-Expression | +| SERVER_SETTINGS_MODE | Determines whether settings can be modified via environment variables or via file, except `COMMUNITY_SERVER` and `MULTITHREAD_ENABLED`! | `auto` | `auto`: Settings are modified only by environment variables, manual edits will be ignored
`manual`: Settings are modified only by editing the file directly, environment variables are ignored | +| STEAMCMD_VALIDATE_FILES | Set to enabled SteamCMD will also validate the gameserver files, making sure nothing is corrupted and also overwrite any file changes of the source
See https://developer.valvesoftware.com/wiki/SteamCMD#Downloading_an_App | true | false/true | ### TZ identifiers @@ -95,9 +99,12 @@ Information sources and credits to the following websites: * [Palworld Tech Guide](https://tech.palworldgame.com/optimize-game-balance) for the game server documentation * [PalworldSettingGenerator](https://dysoncheng.github.io/PalWorldSettingGenerator/setting.html) for variable descriptions -**Important:** Please note that all of this is subject to change. **The game is still in early access.** +**Importtant:** Please note that all of this is subject to change. **The game is still in early access.** -| Variable | Game setting | Description | Default Value | Allowed Value | +> To change a setting, you can set the environment variable to the value you want. If the environment variable is not set or is blank, the default value will be used. + + +| Variable | Game setting | Description | Default value | Allowed value | | ----------------------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------- | | NETSERVERMAXTICKRATE | NetServerMaxTickRate | Changes the TickRate of the server, be very careful with this setting! | 120 | 30-120 | | DIFFICULTY | Difficulty | Choose one of the following:
`None`
`Normal`
`Difficult` | None | Enum | @@ -106,10 +113,10 @@ Information sources and credits to the following websites: | EXP_RATE | ExpRate | EXP rate | 1.000000 | Float | | PAL_CAPTURE_RATE | PalCaptureRate | Pal capture rate | 1.000000 | Float | | PAL_SPAWN_NUM_RATE | PalSpawnNumRate | Pal appearance rate | 1.000000 | Float | -| PAL_DAMAGE_RATE_ATTACK | PalDamageRateAttack | Damage from pals multipiler | 1.000000 | Float | -| PAL_DAMAGE_RATE_DEFENSE | PalDamageRateDefense | Damage to pals multipiler | 1.000000 | Float | -| PLAYER_DAMAGE_RATE_ATTACK | PlayerDamageRateAttack | Damage from player multipiler | 1.000000 | Float | -| PLAYER_DAMAGE_RATE_DEFENSE | PlayerDamageRateDefense | Damage to player multipiler | 1.000000 | Float | +| PAL_DAMAGE_RATE_ATTACK | PalDamageRateAttack | Damage from pals multiplier | 1.000000 | Float | +| PAL_DAMAGE_RATE_DEFENSE | PalDamageRateDefense | Damage to pals multiplier | 1.000000 | Float | +| PLAYER_DAMAGE_RATE_ATTACK | PlayerDamageRateAttack | Damage from player multiplier | 1.000000 | Float | +| PLAYER_DAMAGE_RATE_DEFENSE | PlayerDamageRateDefense | Damage to player multiplier | 1.000000 | Float | | PLAYER_STOMACH_DECREASE_RATE | PlayerStomachDecreaceRate | Player hunger depletion rate | 1.000000 | Float | | PLAYER_STAMINA_DECREACE_RATE | PlayerStaminaDecreaceRate | Player stamina reduction rate | 1.000000 | Float | | PLAYER_AUTO_HP_REGENE_RATE | PlayerAutoHPRegeneRate | Player auto HP regeneration rate | 1.000000 | Float | @@ -118,12 +125,12 @@ Information sources and credits to the following websites: | PAL_STAMINA_DECREACE_RATE | PalStaminaDecreaceRate | Pal stamina reduction rate | 1.000000 | Float | | PAL_AUTO_HP_REGENE_RATE | PalAutoHPRegeneRate | Pal auto HP regeneration rate | 1.000000 | Float | | PAL_AUTO_HP_REGENE_RATE_IN_SLEEP | PalAutoHpRegeneRateInSleep | Pal sleep health regeneration rate (in Palbox) | 1.000000 | Float | -| BUILD_OBJECT_DAMAGE_RATE | BuildObjectDamageRate | Damage to structure multipiler | 1.000000 | Float | +| BUILD_OBJECT_DAMAGE_RATE | BuildObjectDamageRate | Damage to structure multiplier | 1.000000 | Float | | BUILD_OBJECT_DETERIORATION_DAMAGE_RATE | PalAutoHpRegeneRateInSleep | Structure determination rate | 1.000000 | Float | -| COLLECTION_DROP_RATE | CollectionDropRate | Getherable items multipiler | 1.000000 | Float | -| COLLECTION_OBJECT_HP_RATE | CollectionObjectHpRate | Getherable objects HP multipiler | 1.000000 | Float | -| COLLECTION_OBJECT_RESPAWN_SPEED_RATE | CollectionObjectRespawnSpeedRate | Getherable objects respawn interval | 1.000000 | Float | -| ENEMY_DROP_ITEM_RATE | EnemyDropItemRate | Dropped Items Multipiler | 1.000000 | Float | +| COLLECTION_DROP_RATE | CollectionDropRate | Gatherable items multiplier | 1.000000 | Float | +| COLLECTION_OBJECT_HP_RATE | CollectionObjectHpRate | Gatherable objects HP multiplier | 1.000000 | Float | +| COLLECTION_OBJECT_RESPAWN_SPEED_RATE | CollectionObjectRespawnSpeedRate | Gatherable objects respawn interval | 1.000000 | Float | +| ENEMY_DROP_ITEM_RATE | EnemyDropItemRate | Dropped Items Multiplier | 1.000000 | Float | | DEATH_PENALTY | DeathPenalty | `None` : No lost
`Item` : Lost item without equipment
`ItemAndEquipment` : Lost item and equipment
`All`: Lost All item, equipment, pal(in inventory) | All | Enum | | ENABLE_PLAYER_TO_PLAYER_DAMAGE | bEnablePlayerToPlayerDamage | Allows players to cause damage to players | false | Boolean | | ENABLE_FRIENDLY_FIRE | bEnableFriendlyFire | Allow friendly fire | false | Boolean | @@ -140,7 +147,7 @@ Information sources and credits to the following websites: | AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS | AutoResetGuildTimeNoOnlinePlayers | Time to automatically reset guild when no players are online | 72.000000 | Float | | GUILD_PLAYER_MAX_NUM | GuildPlayerMaxNum | Max player of Guild | 20 | Integer | | PAL_EGG_DEFAULT_HATCHING_TIME | PalEggDefaultHatchingTime | Time(h) to incubate massive egg | 72.000000 | Float | -| WORK_SPEED_RATE | WorkSpeedRate | Work speed muliplier | 1.000000 | Float | +| WORK_SPEED_RATE | WorkSpeedRate | Work speed multiplier | 1.000000 | Float | | IS_MULTIPLAY | bIsMultiplay | Enable multiplayer | false | Boolean | | IS_PVP | bIsPvP | Enable PVP | false | Boolean | | CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP | bCanPickupOtherGuildDeathPenaltyDrop | Allow players from other guilds to pick up death penalty items | false | Boolean | @@ -156,7 +163,7 @@ Information sources and credits to the following websites: | ADMIN_PASSWORD | server admin password | AdminPassword | adminPasswordHere | String | | SERVER_PASSWORD | AdminPassword | Set the server password. | serverPasswordHere | String | | PUBLIC_PORT | public port | Public port number | 8211 | Integer | -| PUBLIC_IP | public ip or FQDN | Public IP or FQDN | | String | +| PUBLIC_IP | public ip or FQDN | Public IP or FQDN | | String | | RCON_ENABLED | RCONEnabled | Enable RCON - Use ADMIN_PASSWORD to login | false | Boolean | | RCON_PORT | RCONPort | Port number for RCON | 25575 | Integer | | REGION | Region | Area | | String | @@ -191,6 +198,8 @@ services: - COMMUNITY_SERVER=true - BACKUP_ENABLED=true - BACKUP_CRON_EXPRESSION=0 * * * * + - STEAMCMD_VALIDATE_FILES=true + - SERVER_SETTINGS_MODE=auto # Change this to manual if you want to edit the config yourself - NETSERVERMAXTICKRATE=120 - DIFFICULTY=None - DAYTIME_SPEEDRATE=1.000000 @@ -284,6 +293,8 @@ services: - COMMUNITY_SERVER=true - BACKUP_ENABLED=true - BACKUP_CRON_EXPRESSION=0 * * * * + - STEAMCMD_VALIDATE_FILES=true + - SERVER_SETTINGS_MODE=auto # Change this to manual if you want to edit the config yourself - NETSERVERMAXTICKRATE=120 - DIFFICULTY=None - DAYTIME_SPEEDRATE=1.000000 @@ -356,6 +367,124 @@ services: profiles: ['rcon'] ``` +*Note: The profiles definition, prevents the container from starting with the server, this is on purpose, because of Docker-Compose's ability to run container over the CLI, after the start* + +#### Run RCON commands + +In your shell, you can now run commands against the gameserver via Docker-Compose and RCON +```shell +$ docker compose run --rm rcon ShowPlayers +name,playeruid,steamid +$ docker compose run --rm rcon info +Welcome to Pal Server[v0.1.3.0] jammsen-docker-generated-20384 +$ docker compose run --rm rcon save +Complete Save +``` +**Important:** +- Keep the `--rm` in the command line, or you will have many exited containers in your list. +- All RCON-Commands can be research here: https://tech.palworldgame.com/server-commands + +### Gameserver with Portainer +For Portainer it is recommended to use the Stacks feature, which allows you to deploy a stack from a docker-compose.yml file. The following configuration will allow you to use the one-click console access feature. + +```yaml +version: "3.9" +services: + palworld-dedicated-server: + #build: . + container_name: palworld-dedicated-server + image: jammsen/palworld-dedicated-server:latest + restart: unless-stopped + ports: + - target: 8211 # Gamerserver port inside of the container + published: 8211 # Gamerserver port on your host + protocol: udp + mode: host + - target: 25575 # RCON port inside of the container + published: 25575 # RCON port on your host + protocol: tcp + mode: host + environment: + - TZ=Europe/Berlin # Change this for logging and backup, see "Environment-Variables" + - ALWAYS_UPDATE_ON_START=true + - MULTITHREAD_ENABLED=true + - COMMUNITY_SERVER=true + - BACKUP_ENABLED=true + - BACKUP_CRON_EXPRESSION=0 * * * * + - STEAMCMD_VALIDATE_FILES=true + - SERVER_SETTINGS_MODE=auto # Change this to manual if you want to edit the config yourself + - NETSERVERMAXTICKRATE=120 + - DIFFICULTY=None + - DAYTIME_SPEEDRATE=1.000000 + - NIGHTTIME_SPEEDRATE=1.000000 + - EXP_RATE=1.000000 + - PAL_CAPTURE_RATE=1.000000 + - PAL_SPAWN_NUM_RATE=1.000000 + - PAL_DAMAGE_RATE_ATTACK=1.000000 + - PAL_DAMAGE_RATE_DEFENSE=1.000000 + - PLAYER_DAMAGE_RATE_ATTACK=1.000000 + - PLAYER_DAMAGE_RATE_DEFENSE=1.000000 + - PLAYER_STOMACH_DECREASE_RATE=1.000000 + - PLAYER_STAMINA_DECREACE_RATE=1.000000 + - PLAYER_AUTO_HP_REGENE_RATE=1.000000 + - PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP=1.000000 + - PAL_STOMACH_DECREACE_RATE=1.000000 + - PAL_STAMINA_DECREACE_RATE=1.000000 + - PAL_AUTO_HP_REGENE_RATE=1.000000 + - PAL_AUTO_HP_REGENE_RATE_IN_SLEEP=1.000000 + - BUILD_OBJECT_DAMAGE_RATE=1.000000 + - BUILD_OBJECT_DETERIORATION_DAMAGE_RATE=1.000000 + - COLLECTION_DROP_RATE=1.000000 + - COLLECTION_OBJECT_HP_RATE=1.000000 + - COLLECTION_OBJECT_RESPAWN_SPEED_RATE=1.000000 + - ENEMY_DROP_ITEM_RATE=1.000000 + - DEATH_PENALTY=All + - ENABLE_PLAYER_TO_PLAYER_DAMAGE=false + - ENABLE_FRIENDLY_FIRE=false + - ENABLE_INVADER_ENEMY=true + - ACTIVE_UNKO=false + - ENABLE_AIM_ASSIST_PAD=true + - ENABLE_AIM_ASSIST_KEYBOARD=false + - DROP_ITEM_MAX_NUM=3000 + - DROP_ITEM_MAX_NUM_UNKO=100 + - BASE_CAMP_MAX_NUM=128 + - BASE_CAMP_WORKER_MAXNUM=15 + - DROP_ITEM_ALIVE_MAX_HOURS=1.000000 + - AUTO_RESET_GUILD_NO_ONLINE_PLAYERS=false + - AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS=72.000000 + - GUILD_PLAYER_MAX_NUM=20 + - PAL_EGG_DEFAULT_HATCHING_TIME=72.000000 + - WORK_SPEED_RATE=1.000000 + - IS_MULTIPLAY=false + - IS_PVP=false + - CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP=false + - ENABLE_NON_LOGIN_PENALTY=true + - ENABLE_FAST_TRAVEL=true + - IS_START_LOCATION_SELECT_BY_MAP=true + - EXIST_PLAYER_AFTER_LOGOUT=false + - ENABLE_DEFENSE_OTHER_GUILD_PLAYER=false + - COOP_PLAYER_MAX_NUM=4 + - MAX_PLAYERS=32 + - SERVER_NAME=jammsen-docker-generated-###RANDOM### + - SERVER_DESCRIPTION=Palworld-Dedicated-Server running in Docker by jammsen + - ADMIN_PASSWORD=adminPasswordHere + - SERVER_PASSWORD=serverPasswordHere + - PUBLIC_PORT=8211 + - PUBLIC_IP= + - RCON_ENABLED=false + - RCON_PORT=25575 + - REGION= + - USEAUTH=true + - BAN_LIST_URL=https://api.palworldgame.com/api/banlist.txt + volumes: + - /path/to/your/game/directory:/palworld + + rcon: + image: outdead/rcon:latest + entrypoint: ['/rcon', '-a', '10.0.0.5:25575', '-p', 'adminPasswordHere'] + profiles: ['rcon'] +``` + *Note: The profiles defintion, prevents the container from starting with the server, this is on purpose, because of Docker-Compose's ability to run container over the CLI, after the start* #### What do the parameters in the entrypoint for RCON mean @@ -377,7 +506,7 @@ Welcome to Pal Server[v0.1.3.0] jammsen-docker-generated-20384 $ docker compose run --rm rcon save Complete Save ``` -**Imporant:** +**Important:** - Keep the `--rm` in the command line, or you will have many exited containers in your list. - All RCON-Commands can be research here: https://tech.palworldgame.com/server-commands @@ -408,6 +537,8 @@ services: - COMMUNITY_SERVER=true - BACKUP_ENABLED=true - BACKUP_CRON_EXPRESSION=0 * * * * + - STEAMCMD_VALIDATE_FILES=true + - SERVER_SETTINGS_MODE=auto - NETSERVERMAXTICKRATE=120 - DIFFICULTY=None - DAYTIME_SPEEDRATE=1.000000 diff --git a/servermanager.sh b/servermanager.sh index c563e0e..1f135f9 100755 --- a/servermanager.sh +++ b/servermanager.sh @@ -13,317 +13,346 @@ function installServer() { function updateServer() { # force an update and validation - echo ">>> Doing an update of the gameserver" - /home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 validate +quit + if [[ -n $STEAMCMD_VALIDATE_FILES ]] && [[ $STEAMCMD_VALIDATE_FILES == "true" ]]; then + echo ">>> Doing an update and validate of the gameserver files" + /home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 validate +quit + else + echo ">>> Doing an update of the gameserver files" + /home/steam/steamcmd/steamcmd.sh +force_install_dir "$GAME_PATH" +login anonymous +app_update 2394010 +quit + fi } -function startServer() { - # IF Bash extendion usaged: - # https://stackoverflow.com/a/13864829 - # https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 - - echo ">>> Starting the gameserver" - cd $GAME_PATH +function setupEngineIni() { echo ">>> Setting up Engine.ini ..." - config_file="${GAME_PATH}/Pal/Saved/Config/LinuxServer/Engine.ini" - pattern1="OnlineSubsystemUtils.IpNetDriver" - pattern2="^NetServerMaxTickRate=[0-9]*" + if [[ -n $SERVER_SETTINGS_MODE ]] && [[ $SERVER_SETTINGS_MODE == "auto" ]]; then + echo "> SERVER_SETTINGS_MODE is set to auto, using environment variables to configure the server!" - if grep -qE "$pattern1" "$config_file"; then - echo "Found [/Script/OnlineSubsystemUtils.IpNetDriver] section" - else - echo "Found no [/Script/OnlineSubsystemUtils.IpNetDriver], adding it" - echo -e "\n[/Script/OnlineSubsystemUtils.IpNetDriver]" >> "$config_file" - fi - if grep -qE "$pattern2" "$config_file"; then - echo "Found NetServerMaxTickRate parameter, chaning it to $NETSERVERMAXTICKRATE" - sed -E -i "s/$pattern2/NetServerMaxTickRate=$NETSERVERMAXTICKRATE/" "$config_file" + config_file="${GAME_PATH}/Pal/Saved/Config/LinuxServer/Engine.ini" + pattern1="OnlineSubsystemUtils.IpNetDriver" + pattern2="^NetServerMaxTickRate=[0-9]*" + + if grep -qE "$pattern1" "$config_file"; then + echo ">Found [/Script/OnlineSubsystemUtils.IpNetDriver] section" + else + echo ">Found no [/Script/OnlineSubsystemUtils.IpNetDriver], adding it" + echo -e "\n[/Script/OnlineSubsystemUtils.IpNetDriver]" >> "$config_file" + fi + if grep -qE "$pattern2" "$config_file"; then + echo ">Found NetServerMaxTickRate parameter, changing it to $NETSERVERMAXTICKRATE" + sed -E -i "s/$pattern2/NetServerMaxTickRate=$NETSERVERMAXTICKRATE/" "$config_file" + else + echo ">Found no NetServerMaxTickRate parameter, adding it to $NETSERVERMAXTICKRATE" + echo "NetServerMaxTickRate=$NETSERVERMAXTICKRATE" >> "$config_file" + fi else - echo "Found no NetServerMaxTickRate parameter, adding it to $NETSERVERMAXTICKRATE" - echo "NetServerMaxTickRate=$NETSERVERMAXTICKRATE" >> "$config_file" + echo "> SERVER_SETTINGS_MODE is set to manual, NOT using environment variables to configure the server!" + echo "> File ${GAME_PATH}/Pal/Saved/Config/LinuxServer/Engine.ini has to be manually set by user" fi echo ">>> Finished setting up Engine.ini ..." +} +function setupPalWorldSettingsIni() { + # setup the server config file echo ">>> Setting up PalWorldSettings.ini ..." - echo "Checking if config exists" + echo "> Checking if config already exists" if [ ! -f ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then - echo "No config found, generating one" + echo "> No config found, generating one" if [ ! -d ${GAME_PATH}/Pal/Saved/Config/LinuxServer ]; then mkdir -p ${GAME_PATH}/Pal/Saved/Config/LinuxServer fi # Copy default-config, which comes with the server to gameserver-save location cp ${GAME_PATH}/DefaultPalWorldSettings.ini ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + else + echo "> Found existing config" fi - if [[ ! -z ${DIFFICULTY+x} ]]; then - echo "Setting Difficulty to $DIFFICULTY" - sed -E -i "s/Difficulty=[a-zA-Z]*/Difficulty=$DIFFICULTY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${DAYTIME_SPEEDRATE+x} ]]; then - echo "Setting DayTimeSpeedRate to $DAYTIME_SPEEDRATE" - sed -E -i "s/DayTimeSpeedRate=[+-]?([0-9]*[.])?[0-9]+/DayTimeSpeedRate=$DAYTIME_SPEEDRATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${NIGHTTIME_SPEEDRATE+x} ]]; then - echo "Setting NightTimeSpeedRate to $NIGHTTIME_SPEEDRATE" - sed -E -i "s/NightTimeSpeedRate=[+-]?([0-9]*[.])?[0-9]+/NightTimeSpeedRate=$NIGHTTIME_SPEEDRATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${EXP_RATE+x} ]]; then - echo "Setting ExpRate to $EXP_RATE" - sed -E -i "s/ExpRate=[+-]?([0-9]*[.])?[0-9]+/ExpRate=$EXP_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_CAPTURE_RATE+x} ]]; then - echo "Setting PalCaptureRate to $PAL_CAPTURE_RATE" - sed -E -i "s/PalCaptureRate=[+-]?([0-9]*[.])?[0-9]+/PalCaptureRate=$PAL_CAPTURE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_SPAWN_NUM_RATE+x} ]]; then - echo "Setting PalSpawnNumRate to $PAL_SPAWN_NUM_RATE" - sed -E -i "s/PalSpawnNumRate=[+-]?([0-9]*[.])?[0-9]+/PalSpawnNumRate=$PAL_SPAWN_NUM_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_DAMAGE_RATE_ATTACK+x} ]]; then - echo "Setting PalDamageRateAttack to $PAL_DAMAGE_RATE_ATTACK" - sed -E -i "s/PalDamageRateAttack=[+-]?([0-9]*[.])?[0-9]+/PalDamageRateAttack=$PAL_DAMAGE_RATE_ATTACK/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_DAMAGE_RATE_DEFENSE+x} ]]; then - echo "Setting PalDamageRateDefense to $PAL_DAMAGE_RATE_DEFENSE" - sed -E -i "s/PalDamageRateDefense=[+-]?([0-9]*[.])?[0-9]+/PalDamageRateDefense=$PAL_DAMAGE_RATE_DEFENSE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PLAYER_DAMAGE_RATE_ATTACK+x} ]]; then - echo "Setting PlayerDamageRateAttack to $PLAYER_DAMAGE_RATE_ATTACK" - sed -E -i "s/PlayerDamageRateAttack=[+-]?([0-9]*[.])?[0-9]+/PlayerDamageRateAttack=$PLAYER_DAMAGE_RATE_ATTACK/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PLAYER_DAMAGE_RATE_DEFENSE+x} ]]; then - echo "Setting PlayerDamageRateDefense to $PLAYER_DAMAGE_RATE_DEFENSE" - sed -E -i "s/PlayerDamageRateDefense=[+-]?([0-9]*[.])?[0-9]+/PlayerDamageRateDefense=$PLAYER_DAMAGE_RATE_DEFENSE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PLAYER_STOMACH_DECREASE_RATE+x} ]]; then - echo "Setting PlayerStomachDecreaceRate to $PLAYER_STOMACH_DECREASE_RATE" - sed -E -i "s/PlayerStomachDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PlayerStomachDecreaceRate=$PLAYER_STOMACH_DECREASE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PLAYER_STAMINA_DECREACE_RATE+x} ]]; then - echo "Setting PlayerStaminaDecreaceRate to $PLAYER_STAMINA_DECREACE_RATE" - sed -E -i "s/PlayerStaminaDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PlayerStaminaDecreaceRate=$PLAYER_STAMINA_DECREACE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PLAYER_AUTO_HP_REGENE_RATE+x} ]]; then - echo "Setting PlayerAutoHPRegeneRate to $PLAYER_AUTO_HP_REGENE_RATE" - sed -E -i "s/PlayerAutoHPRegeneRate=[+-]?([0-9]*[.])?[0-9]+/PlayerAutoHPRegeneRate=$PLAYER_AUTO_HP_REGENE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP+x} ]]; then - echo "Setting PlayerAutoHpRegeneRateInSleep to $PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP" - sed -E -i "s/PlayerAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PlayerAutoHpRegeneRateInSleep=$PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_STOMACH_DECREACE_RATE+x} ]]; then - echo "Setting PalStomachDecreaceRate to $PAL_STOMACH_DECREACE_RATE" - sed -E -i "s/PalStomachDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PalStomachDecreaceRate=$PAL_STOMACH_DECREACE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_STAMINA_DECREACE_RATE+x} ]]; then - echo "Setting PalStaminaDecreaceRate to $X" - sed -E -i "s/PalStaminaDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PalStaminaDecreaceRate=$PAL_STAMINA_DECREACE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_AUTO_HP_REGENE_RATE+x} ]]; then - echo "Setting PalAutoHPRegeneRate to $PAL_AUTO_HP_REGENE_RATE" - sed -E -i "s/PalAutoHPRegeneRate=[+-]?([0-9]*[.])?[0-9]+/PalAutoHPRegeneRate=$PAL_AUTO_HP_REGENE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_AUTO_HP_REGENE_RATE_IN_SLEEP+x} ]]; then - echo "Setting PalAutoHpRegeneRateInSleep to $PAL_AUTO_HP_REGENE_RATE_IN_SLEEP" - sed -E -i "s/PalAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PalAutoHpRegeneRateInSleep=$PAL_AUTO_HP_REGENE_RATE_IN_SLEEP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${BUILD_OBJECT_DAMAGE_RATE+x} ]]; then - echo "Setting BuildObjectDamageRate to $BUILD_OBJECT_DAMAGE_RATE" - sed -E -i "s/BuildObjectDamageRate=[+-]?([0-9]*[.])?[0-9]+/BuildObjectDamageRate=$BUILD_OBJECT_DAMAGE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${BUILD_OBJECT_DETERIORATION_DAMAGE_RATE+x} ]]; then - echo "Setting BuildObjectDeteriorationDamageRate to $BUILD_OBJECT_DETERIORATION_DAMAGE_RATE" - sed -E -i "s/BuildObjectDeteriorationDamageRate=[+-]?([0-9]*[.])?[0-9]+/BuildObjectDeteriorationDamageRate=$BUILD_OBJECT_DETERIORATION_DAMAGE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${BUILD_OBJECT_DETERIORATION_DAMAGE_RATE+x} ]]; then - echo "Setting PalAutoHpRegeneRateInSleep to $BUILD_OBJECT_DETERIORATION_DAMAGE_RATE" - sed -E -i "s/PalAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PalAutoHpRegeneRateInSleep=$BUILD_OBJECT_DETERIORATION_DAMAGE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${COLLECTION_DROP_RATE+x} ]]; then - echo "Setting CollectionDropRate to $COLLECTION_DROP_RATE" - sed -E -i "s/CollectionDropRate=[+-]?([0-9]*[.])?[0-9]+/CollectionDropRate=$COLLECTION_DROP_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${COLLECTION_OBJECT_HP_RATE+x} ]]; then - echo "Setting CollectionObjectHpRate to $COLLECTION_OBJECT_HP_RATE" - sed -E -i "s/CollectionObjectHpRate=[+-]?([0-9]*[.])?[0-9]+/CollectionObjectHpRate=$COLLECTION_OBJECT_HP_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${COLLECTION_OBJECT_RESPAWN_SPEED_RATE+x} ]]; then - echo "Setting CollectionObjectRespawnSpeedRate to $COLLECTION_OBJECT_RESPAWN_SPEED_RATE" - sed -E -i "s/CollectionObjectRespawnSpeedRate=[+-]?([0-9]*[.])?[0-9]+/CollectionObjectRespawnSpeedRate=$COLLECTION_OBJECT_RESPAWN_SPEED_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENEMY_DROP_ITEM_RATE+x} ]]; then - echo "Setting EnemyDropItemRate to $ENEMY_DROP_ITEM_RATE" - sed -E -i "s/EnemyDropItemRate=[+-]?([0-9]*[.])?[0-9]+/EnemyDropItemRate=$ENEMY_DROP_ITEM_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${DEATH_PENALTY+x} ]]; then - echo "Setting DeathPenalty to $DEATH_PENALTY" - sed -E -i "s/DeathPenalty=[a-zA-Z]*/DeathPenalty=$DEATH_PENALTY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_PLAYER_TO_PLAYER_DAMAGE+x} ]]; then - echo "Setting bEnablePlayerToPlayerDamage to $ENABLE_PLAYER_TO_PLAYER_DAMAGE" - sed -E -i "s/bEnablePlayerToPlayerDamage=[a-zA-Z]*/bEnablePlayerToPlayerDamage=$ENABLE_PLAYER_TO_PLAYER_DAMAGE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_FRIENDLY_FIRE+x} ]]; then - echo "Setting bEnableFriendlyFire to $ENABLE_FRIENDLY_FIRE" - sed -E -i "s/bEnableFriendlyFire=[a-zA-Z]*/bEnableFriendlyFire=$ENABLE_FRIENDLY_FIRE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_INVADER_ENEMY+x} ]]; then - echo "Setting bEnableInvaderEnemy to $ENABLE_INVADER_ENEMY" - sed -E -i "s/bEnableInvaderEnemy=[a-zA-Z]*/bEnableInvaderEnemy=$ENABLE_INVADER_ENEMY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ACTIVE_UNKO+x} ]]; then - echo "Setting bActiveUNKO to $ACTIVE_UNKO" - sed -E -i "s/bActiveUNKO=[a-zA-Z]*/bActiveUNKO=$ACTIVE_UNKO/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_AIM_ASSIST_PAD+x} ]]; then - echo "Setting bEnableAimAssistPad to $ENABLE_AIM_ASSIST_PAD" - sed -E -i "s/bEnableAimAssistPad=[a-zA-Z]*/bEnableAimAssistPad=$ENABLE_AIM_ASSIST_PAD/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_AIM_ASSIST_KEYBOARD+x} ]]; then - echo "Setting bEnableAimAssistKeyboard to $ENABLE_AIM_ASSIST_KEYBOARD" - sed -E -i "s/bEnableAimAssistKeyboard=[a-zA-Z]*/bEnableAimAssistKeyboard=$ENABLE_AIM_ASSIST_KEYBOARD/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${DROP_ITEM_MAX_NUM+x} ]]; then - echo "Setting DropItemMaxNum to $DROP_ITEM_MAX_NUM" - sed -E -i "s/DropItemMaxNum=[0-9]*/DropItemMaxNum=$DROP_ITEM_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${DROP_ITEM_MAX_NUM_UNKO+x} ]]; then - echo "Setting DropItemMaxNum_UNKO to $DROP_ITEM_MAX_NUM_UNKO" - sed -E -i "s/DropItemMaxNum_UNKO=[0-9]*/DropItemMaxNum_UNKO=$DROP_ITEM_MAX_NUM_UNKO/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${BASE_CAMP_MAX_NUM+x} ]]; then - echo "Setting BaseCampMaxNum to $BASE_CAMP_MAX_NUM" - sed -E -i "s/BaseCampMaxNum=[0-9]*/BaseCampMaxNum=$BASE_CAMP_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${BASE_CAMP_WORKER_MAXNUM+x} ]]; then - echo "Setting BaseCampWorkerMaxNum to $BASE_CAMP_WORKER_MAXNUM" - sed -E -i "s/BaseCampWorkerMaxNum=[0-9]*/BaseCampWorkerMaxNum=$BASE_CAMP_WORKER_MAXNUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${DROP_ITEM_ALIVE_MAX_HOURS+x} ]]; then - echo "Setting DropItemAliveMaxHours to $DROP_ITEM_ALIVE_MAX_HOURS" - sed -E -i "s/DropItemAliveMaxHours=[+-]?([0-9]*[.])?[0-9]+/DropItemAliveMaxHours=$DROP_ITEM_ALIVE_MAX_HOURS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${AUTO_RESET_GUILD_NO_ONLINE_PLAYERS+x} ]]; then - echo "Setting bAutoResetGuildNoOnlinePlayers to $AUTO_RESET_GUILD_NO_ONLINE_PLAYERS" - sed -E -i "s/bAutoResetGuildNoOnlinePlayers=[a-zA-Z]*/bAutoResetGuildNoOnlinePlayers=$AUTO_RESET_GUILD_NO_ONLINE_PLAYERS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS+x} ]]; then - echo "Setting AutoResetGuildTimeNoOnlinePlayers to $AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS" - sed -E -i "s/AutoResetGuildTimeNoOnlinePlayers=[+-]?([0-9]*[.])?[0-9]+/AutoResetGuildTimeNoOnlinePlayers=$AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${GUILD_PLAYER_MAX_NUM+x} ]]; then - echo "Setting GuildPlayerMaxNum to $GUILD_PLAYER_MAX_NUM" - sed -E -i "s/GuildPlayerMaxNum=[0-9]*/GuildPlayerMaxNum=$GUILD_PLAYER_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PAL_EGG_DEFAULT_HATCHING_TIME+x} ]]; then - echo "Setting PalEggDefaultHatchingTime to $PAL_EGG_DEFAULT_HATCHING_TIME" - sed -E -i "s/PalEggDefaultHatchingTime=[+-]?([0-9]*[.])?[0-9]+/PalEggDefaultHatchingTime=$PAL_EGG_DEFAULT_HATCHING_TIME/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${WORK_SPEED_RATE+x} ]]; then - echo "Setting WorkSpeedRate to $WORK_SPEED_RATE" - sed -E -i "s/WorkSpeedRate=[+-]?([0-9]*[.])?[0-9]+/WorkSpeedRate=$WORK_SPEED_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${IS_MULTIPLAY+x} ]]; then - echo "Setting bIsMultiplay to $IS_MULTIPLAY" - sed -E -i "s/bIsMultiplay=[a-zA-Z]*/bIsMultiplay=$IS_MULTIPLAY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${IS_PVP+x} ]]; then - echo "Setting bIsPvP to $IS_PVP" - sed -E -i "s/bIsPvP=[a-zA-Z]*/bIsPvP=$IS_PVP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP+x} ]]; then - echo "Setting bCanPickupOtherGuildDeathPenaltyDrop to $CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP" - sed -E -i "s/bCanPickupOtherGuildDeathPenaltyDrop=[a-zA-Z]*/bCanPickupOtherGuildDeathPenaltyDrop=$CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_NON_LOGIN_PENALTY+x} ]]; then - echo "Setting bEnableNonLoginPenalty to $ENABLE_NON_LOGIN_PENALTY" - sed -E -i "s/bEnableNonLoginPenalty=[a-zA-Z]*/bEnableNonLoginPenalty=$ENABLE_NON_LOGIN_PENALTY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_FAST_TRAVEL+x} ]]; then - echo "Setting bEnableFastTravel to $ENABLE_FAST_TRAVEL" - sed -E -i "s/bEnableFastTravel=[a-zA-Z]*/bEnableFastTravel=$ENABLE_FAST_TRAVEL/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${IS_START_LOCATION_SELECT_BY_MAP+x} ]]; then - echo "Setting bIsStartLocationSelectByMap to $IS_START_LOCATION_SELECT_BY_MAP" - sed -E -i "s/bIsStartLocationSelectByMap=[a-zA-Z]*/bIsStartLocationSelectByMap=$IS_START_LOCATION_SELECT_BY_MAP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${EXIST_PLAYER_AFTER_LOGOUT+x} ]]; then - echo "Setting bExistPlayerAfterLogout to $EXIST_PLAYER_AFTER_LOGOUT" - sed -E -i "s/bExistPlayerAfterLogout=[a-zA-Z]*/bExistPlayerAfterLogout=$EXIST_PLAYER_AFTER_LOGOUT/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ENABLE_DEFENSE_OTHER_GUILD_PLAYER+x} ]]; then - echo "Setting bEnableDefenseOtherGuildPlayer to $ENABLE_DEFENSE_OTHER_GUILD_PLAYER" - sed -E -i "s/bEnableDefenseOtherGuildPlayer=[a-zA-Z]*/bEnableDefenseOtherGuildPlayer=$ENABLE_DEFENSE_OTHER_GUILD_PLAYER/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${COOP_PLAYER_MAX_NUM+x} ]]; then - echo "Setting CoopPlayerMaxNum to $COOP_PLAYER_MAX_NUM" - sed -E -i "s/CoopPlayerMaxNum=[0-9]*/CoopPlayerMaxNum=$COOP_PLAYER_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${MAX_PLAYERS+x} ]]; then - echo "Setting max-players to $MAX_PLAYERS" - sed -E -i "s/ServerPlayerMaxNum=[0-9]*/ServerPlayerMaxNum=$MAX_PLAYERS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${SERVER_NAME+x} ]]; then - echo "Setting server name to $SERVER_NAME" - sed -E -i "s/ServerName=\"[^\"]*\"/ServerName=\"$SERVER_NAME\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - if [[ "$SERVER_NAME" == *"###RANDOM###"* ]]; then - RAND_VALUE=$RANDOM - echo "Found standard template, using random numbers in server name" - sed -E -i -e "s/###RANDOM###/$RAND_VALUE/g" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - echo "Server name is now jammsen-docker-generated-$RAND_VALUE" + if [[ -n $SERVER_SETTINGS_MODE ]] && [[ $SERVER_SETTINGS_MODE == "auto" ]]; then + echo "> SERVER_SETTINGS_MODE is set to auto, using environment variables to configure the server!" + if [[ ! -z ${DIFFICULTY+x} ]]; then + echo "> Setting Difficulty to $DIFFICULTY" + sed -E -i "s/Difficulty=[a-zA-Z]*/Difficulty=$DIFFICULTY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi - fi - if [[ ! -z ${SERVER_DESCRIPTION+x} ]]; then - echo "Setting server description to $SERVER_DESCRIPTION" - sed -E -i "s/ServerDescription=\"[^\"]*\"/ServerDescription=\"$SERVER_DESCRIPTION\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${ADMIN_PASSWORD+x} ]]; then - echo "Setting server admin password to $ADMIN_PASSWORD" - sed -E -i "s/AdminPassword=\"[^\"]*\"/AdminPassword=\"$ADMIN_PASSWORD\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${SERVER_PASSWORD+x} ]]; then - echo "Setting server password to $SERVER_PASSWORD" - sed -E -i "s/ServerPassword=\"[^\"]*\"/ServerPassword=\"$SERVER_PASSWORD\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PUBLIC_PORT+x} ]]; then - echo "Setting public port to $PUBLIC_PORT" - sed -E -i "s/PublicPort=[0-9]*/PublicPort=$PUBLIC_PORT/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${PUBLIC_IP+x} ]]; then - echo "Setting public ip to $PUBLIC_IP" - sed -E -i "s/PublicIP=\"[^\"]*\"/PublicIP=\"$PUBLIC_IP\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${RCON_ENABLED+x} ]]; then - echo "Setting rcon-enabled to $RCON_ENABLED" - sed -E -i "s/RCONEnabled=[a-zA-Z]*/RCONEnabled=$RCON_ENABLED/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${RCON_PORT+x} ]]; then - echo "Setting RCONPort to $RCON_PORT" - sed -E -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${REGION+x} ]]; then - echo "Setting Region to $REGION" - sed -E -i "s/Region=\"[^\"]*\"/Region=\"$REGION\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${USEAUTH+x} ]]; then - echo "Setting bUseAuth to $USEAUTH" - sed -E -i "s/bUseAuth=[a-zA-Z]*/bUseAuth=$USEAUTH/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - fi - if [[ ! -z ${BAN_LIST_URL+x} ]]; then - echo "Setting BanListURL to $BAN_LIST_URL" - sed -E -i "s~BanListURL=\"[^\"]*\"~BanListURL=\"$BAN_LIST_URL\"~" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini - # sed -E -i 's/BanListURL=(((ftp|http|https):\/\/)|(\/)|(..\/))(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/BanListURL=$BAN_LIST_URL/g' ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + if [[ ! -z ${DAYTIME_SPEEDRATE+x} ]]; then + echo "> Setting DayTimeSpeedRate to $DAYTIME_SPEEDRATE" + sed -E -i "s/DayTimeSpeedRate=[+-]?([0-9]*[.])?[0-9]+/DayTimeSpeedRate=$DAYTIME_SPEEDRATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${NIGHTTIME_SPEEDRATE+x} ]]; then + echo "> Setting NightTimeSpeedRate to $NIGHTTIME_SPEEDRATE" + sed -E -i "s/NightTimeSpeedRate=[+-]?([0-9]*[.])?[0-9]+/NightTimeSpeedRate=$NIGHTTIME_SPEEDRATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${EXP_RATE+x} ]]; then + echo "> Setting ExpRate to $EXP_RATE" + sed -E -i "s/ExpRate=[+-]?([0-9]*[.])?[0-9]+/ExpRate=$EXP_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_CAPTURE_RATE+x} ]]; then + echo "> Setting PalCaptureRate to $PAL_CAPTURE_RATE" + sed -E -i "s/PalCaptureRate=[+-]?([0-9]*[.])?[0-9]+/PalCaptureRate=$PAL_CAPTURE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_SPAWN_NUM_RATE+x} ]]; then + echo "> Setting PalSpawnNumRate to $PAL_SPAWN_NUM_RATE" + sed -E -i "s/PalSpawnNumRate=[+-]?([0-9]*[.])?[0-9]+/PalSpawnNumRate=$PAL_SPAWN_NUM_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_DAMAGE_RATE_ATTACK+x} ]]; then + echo "> Setting PalDamageRateAttack to $PAL_DAMAGE_RATE_ATTACK" + sed -E -i "s/PalDamageRateAttack=[+-]?([0-9]*[.])?[0-9]+/PalDamageRateAttack=$PAL_DAMAGE_RATE_ATTACK/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_DAMAGE_RATE_DEFENSE+x} ]]; then + echo "> Setting PalDamageRateDefense to $PAL_DAMAGE_RATE_DEFENSE" + sed -E -i "s/PalDamageRateDefense=[+-]?([0-9]*[.])?[0-9]+/PalDamageRateDefense=$PAL_DAMAGE_RATE_DEFENSE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PLAYER_DAMAGE_RATE_ATTACK+x} ]]; then + echo "> Setting PlayerDamageRateAttack to $PLAYER_DAMAGE_RATE_ATTACK" + sed -E -i "s/PlayerDamageRateAttack=[+-]?([0-9]*[.])?[0-9]+/PlayerDamageRateAttack=$PLAYER_DAMAGE_RATE_ATTACK/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PLAYER_DAMAGE_RATE_DEFENSE+x} ]]; then + echo "> Setting PlayerDamageRateDefense to $PLAYER_DAMAGE_RATE_DEFENSE" + sed -E -i "s/PlayerDamageRateDefense=[+-]?([0-9]*[.])?[0-9]+/PlayerDamageRateDefense=$PLAYER_DAMAGE_RATE_DEFENSE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PLAYER_STOMACH_DECREASE_RATE+x} ]]; then + echo "> Setting PlayerStomachDecreaceRate to $PLAYER_STOMACH_DECREASE_RATE" + sed -E -i "s/PlayerStomachDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PlayerStomachDecreaceRate=$PLAYER_STOMACH_DECREASE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PLAYER_STAMINA_DECREACE_RATE+x} ]]; then + echo "> Setting PlayerStaminaDecreaceRate to $PLAYER_STAMINA_DECREACE_RATE" + sed -E -i "s/PlayerStaminaDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PlayerStaminaDecreaceRate=$PLAYER_STAMINA_DECREACE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PLAYER_AUTO_HP_REGENE_RATE+x} ]]; then + echo "> Setting PlayerAutoHPRegeneRate to $PLAYER_AUTO_HP_REGENE_RATE" + sed -E -i "s/PlayerAutoHPRegeneRate=[+-]?([0-9]*[.])?[0-9]+/PlayerAutoHPRegeneRate=$PLAYER_AUTO_HP_REGENE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP+x} ]]; then + echo "> Setting PlayerAutoHpRegeneRateInSleep to $PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP" + sed -E -i "s/PlayerAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PlayerAutoHpRegeneRateInSleep=$PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_STOMACH_DECREACE_RATE+x} ]]; then + echo "> Setting PalStomachDecreaceRate to $PAL_STOMACH_DECREACE_RATE" + sed -E -i "s/PalStomachDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PalStomachDecreaceRate=$PAL_STOMACH_DECREACE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_STAMINA_DECREACE_RATE+x} ]]; then + echo "> Setting PalStaminaDecreaceRate to $X" + sed -E -i "s/PalStaminaDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PalStaminaDecreaceRate=$PAL_STAMINA_DECREACE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_AUTO_HP_REGENE_RATE+x} ]]; then + echo "> Setting PalAutoHPRegeneRate to $PAL_AUTO_HP_REGENE_RATE" + sed -E -i "s/PalAutoHPRegeneRate=[+-]?([0-9]*[.])?[0-9]+/PalAutoHPRegeneRate=$PAL_AUTO_HP_REGENE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_AUTO_HP_REGENE_RATE_IN_SLEEP+x} ]]; then + echo "> Setting PalAutoHpRegeneRateInSleep to $PAL_AUTO_HP_REGENE_RATE_IN_SLEEP" + sed -E -i "s/PalAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PalAutoHpRegeneRateInSleep=$PAL_AUTO_HP_REGENE_RATE_IN_SLEEP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${BUILD_OBJECT_DAMAGE_RATE+x} ]]; then + echo "> Setting BuildObjectDamageRate to $BUILD_OBJECT_DAMAGE_RATE" + sed -E -i "s/BuildObjectDamageRate=[+-]?([0-9]*[.])?[0-9]+/BuildObjectDamageRate=$BUILD_OBJECT_DAMAGE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${BUILD_OBJECT_DETERIORATION_DAMAGE_RATE+x} ]]; then + echo "> Setting BuildObjectDeteriorationDamageRate to $BUILD_OBJECT_DETERIORATION_DAMAGE_RATE" + sed -E -i "s/BuildObjectDeteriorationDamageRate=[+-]?([0-9]*[.])?[0-9]+/BuildObjectDeteriorationDamageRate=$BUILD_OBJECT_DETERIORATION_DAMAGE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${BUILD_OBJECT_DETERIORATION_DAMAGE_RATE+x} ]]; then + echo "> Setting PalAutoHpRegeneRateInSleep to $BUILD_OBJECT_DETERIORATION_DAMAGE_RATE" + sed -E -i "s/PalAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PalAutoHpRegeneRateInSleep=$BUILD_OBJECT_DETERIORATION_DAMAGE_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${COLLECTION_DROP_RATE+x} ]]; then + echo "> Setting CollectionDropRate to $COLLECTION_DROP_RATE" + sed -E -i "s/CollectionDropRate=[+-]?([0-9]*[.])?[0-9]+/CollectionDropRate=$COLLECTION_DROP_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${COLLECTION_OBJECT_HP_RATE+x} ]]; then + echo "> Setting CollectionObjectHpRate to $COLLECTION_OBJECT_HP_RATE" + sed -E -i "s/CollectionObjectHpRate=[+-]?([0-9]*[.])?[0-9]+/CollectionObjectHpRate=$COLLECTION_OBJECT_HP_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${COLLECTION_OBJECT_RESPAWN_SPEED_RATE+x} ]]; then + echo "> Setting CollectionObjectRespawnSpeedRate to $COLLECTION_OBJECT_RESPAWN_SPEED_RATE" + sed -E -i "s/CollectionObjectRespawnSpeedRate=[+-]?([0-9]*[.])?[0-9]+/CollectionObjectRespawnSpeedRate=$COLLECTION_OBJECT_RESPAWN_SPEED_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENEMY_DROP_ITEM_RATE+x} ]]; then + echo "> Setting EnemyDropItemRate to $ENEMY_DROP_ITEM_RATE" + sed -E -i "s/EnemyDropItemRate=[+-]?([0-9]*[.])?[0-9]+/EnemyDropItemRate=$ENEMY_DROP_ITEM_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${DEATH_PENALTY+x} ]]; then + echo "> Setting DeathPenalty to $DEATH_PENALTY" + sed -E -i "s/DeathPenalty=[a-zA-Z]*/DeathPenalty=$DEATH_PENALTY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_PLAYER_TO_PLAYER_DAMAGE+x} ]]; then + echo "> Setting bEnablePlayerToPlayerDamage to $ENABLE_PLAYER_TO_PLAYER_DAMAGE" + sed -E -i "s/bEnablePlayerToPlayerDamage=[a-zA-Z]*/bEnablePlayerToPlayerDamage=$ENABLE_PLAYER_TO_PLAYER_DAMAGE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_FRIENDLY_FIRE+x} ]]; then + echo "> Setting bEnableFriendlyFire to $ENABLE_FRIENDLY_FIRE" + sed -E -i "s/bEnableFriendlyFire=[a-zA-Z]*/bEnableFriendlyFire=$ENABLE_FRIENDLY_FIRE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_INVADER_ENEMY+x} ]]; then + echo "> Setting bEnableInvaderEnemy to $ENABLE_INVADER_ENEMY" + sed -E -i "s/bEnableInvaderEnemy=[a-zA-Z]*/bEnableInvaderEnemy=$ENABLE_INVADER_ENEMY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ACTIVE_UNKO+x} ]]; then + echo "> Setting bActiveUNKO to $ACTIVE_UNKO" + sed -E -i "s/bActiveUNKO=[a-zA-Z]*/bActiveUNKO=$ACTIVE_UNKO/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_AIM_ASSIST_PAD+x} ]]; then + echo "> Setting bEnableAimAssistPad to $ENABLE_AIM_ASSIST_PAD" + sed -E -i "s/bEnableAimAssistPad=[a-zA-Z]*/bEnableAimAssistPad=$ENABLE_AIM_ASSIST_PAD/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_AIM_ASSIST_KEYBOARD+x} ]]; then + echo "> Setting bEnableAimAssistKeyboard to $ENABLE_AIM_ASSIST_KEYBOARD" + sed -E -i "s/bEnableAimAssistKeyboard=[a-zA-Z]*/bEnableAimAssistKeyboard=$ENABLE_AIM_ASSIST_KEYBOARD/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${DROP_ITEM_MAX_NUM+x} ]]; then + echo "> Setting DropItemMaxNum to $DROP_ITEM_MAX_NUM" + sed -E -i "s/DropItemMaxNum=[0-9]*/DropItemMaxNum=$DROP_ITEM_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${DROP_ITEM_MAX_NUM_UNKO+x} ]]; then + echo "> Setting DropItemMaxNum_UNKO to $DROP_ITEM_MAX_NUM_UNKO" + sed -E -i "s/DropItemMaxNum_UNKO=[0-9]*/DropItemMaxNum_UNKO=$DROP_ITEM_MAX_NUM_UNKO/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${BASE_CAMP_MAX_NUM+x} ]]; then + echo "> Setting BaseCampMaxNum to $BASE_CAMP_MAX_NUM" + sed -E -i "s/BaseCampMaxNum=[0-9]*/BaseCampMaxNum=$BASE_CAMP_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${BASE_CAMP_WORKER_MAXNUM+x} ]]; then + echo "> Setting BaseCampWorkerMaxNum to $BASE_CAMP_WORKER_MAXNUM" + sed -E -i "s/BaseCampWorkerMaxNum=[0-9]*/BaseCampWorkerMaxNum=$BASE_CAMP_WORKER_MAXNUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${DROP_ITEM_ALIVE_MAX_HOURS+x} ]]; then + echo "> Setting DropItemAliveMaxHours to $DROP_ITEM_ALIVE_MAX_HOURS" + sed -E -i "s/DropItemAliveMaxHours=[+-]?([0-9]*[.])?[0-9]+/DropItemAliveMaxHours=$DROP_ITEM_ALIVE_MAX_HOURS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${AUTO_RESET_GUILD_NO_ONLINE_PLAYERS+x} ]]; then + echo "> Setting bAutoResetGuildNoOnlinePlayers to $AUTO_RESET_GUILD_NO_ONLINE_PLAYERS" + sed -E -i "s/bAutoResetGuildNoOnlinePlayers=[a-zA-Z]*/bAutoResetGuildNoOnlinePlayers=$AUTO_RESET_GUILD_NO_ONLINE_PLAYERS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS+x} ]]; then + echo "> Setting AutoResetGuildTimeNoOnlinePlayers to $AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS" + sed -E -i "s/AutoResetGuildTimeNoOnlinePlayers=[+-]?([0-9]*[.])?[0-9]+/AutoResetGuildTimeNoOnlinePlayers=$AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${GUILD_PLAYER_MAX_NUM+x} ]]; then + echo "> Setting GuildPlayerMaxNum to $GUILD_PLAYER_MAX_NUM" + sed -E -i "s/GuildPlayerMaxNum=[0-9]*/GuildPlayerMaxNum=$GUILD_PLAYER_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PAL_EGG_DEFAULT_HATCHING_TIME+x} ]]; then + echo "> Setting PalEggDefaultHatchingTime to $PAL_EGG_DEFAULT_HATCHING_TIME" + sed -E -i "s/PalEggDefaultHatchingTime=[+-]?([0-9]*[.])?[0-9]+/PalEggDefaultHatchingTime=$PAL_EGG_DEFAULT_HATCHING_TIME/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${WORK_SPEED_RATE+x} ]]; then + echo "> Setting WorkSpeedRate to $WORK_SPEED_RATE" + sed -E -i "s/WorkSpeedRate=[+-]?([0-9]*[.])?[0-9]+/WorkSpeedRate=$WORK_SPEED_RATE/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${IS_MULTIPLAY+x} ]]; then + echo "> Setting bIsMultiplay to $IS_MULTIPLAY" + sed -E -i "s/bIsMultiplay=[a-zA-Z]*/bIsMultiplay=$IS_MULTIPLAY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${IS_PVP+x} ]]; then + echo "> Setting bIsPvP to $IS_PVP" + sed -E -i "s/bIsPvP=[a-zA-Z]*/bIsPvP=$IS_PVP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP+x} ]]; then + echo "> Setting bCanPickupOtherGuildDeathPenaltyDrop to $CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP" + sed -E -i "s/bCanPickupOtherGuildDeathPenaltyDrop=[a-zA-Z]*/bCanPickupOtherGuildDeathPenaltyDrop=$CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_NON_LOGIN_PENALTY+x} ]]; then + echo "> Setting bEnableNonLoginPenalty to $ENABLE_NON_LOGIN_PENALTY" + sed -E -i "s/bEnableNonLoginPenalty=[a-zA-Z]*/bEnableNonLoginPenalty=$ENABLE_NON_LOGIN_PENALTY/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_FAST_TRAVEL+x} ]]; then + echo "> Setting bEnableFastTravel to $ENABLE_FAST_TRAVEL" + sed -E -i "s/bEnableFastTravel=[a-zA-Z]*/bEnableFastTravel=$ENABLE_FAST_TRAVEL/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${IS_START_LOCATION_SELECT_BY_MAP+x} ]]; then + echo "> Setting bIsStartLocationSelectByMap to $IS_START_LOCATION_SELECT_BY_MAP" + sed -E -i "s/bIsStartLocationSelectByMap=[a-zA-Z]*/bIsStartLocationSelectByMap=$IS_START_LOCATION_SELECT_BY_MAP/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${EXIST_PLAYER_AFTER_LOGOUT+x} ]]; then + echo "> Setting bExistPlayerAfterLogout to $EXIST_PLAYER_AFTER_LOGOUT" + sed -E -i "s/bExistPlayerAfterLogout=[a-zA-Z]*/bExistPlayerAfterLogout=$EXIST_PLAYER_AFTER_LOGOUT/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ENABLE_DEFENSE_OTHER_GUILD_PLAYER+x} ]]; then + echo "> Setting bEnableDefenseOtherGuildPlayer to $ENABLE_DEFENSE_OTHER_GUILD_PLAYER" + sed -E -i "s/bEnableDefenseOtherGuildPlayer=[a-zA-Z]*/bEnableDefenseOtherGuildPlayer=$ENABLE_DEFENSE_OTHER_GUILD_PLAYER/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${COOP_PLAYER_MAX_NUM+x} ]]; then + echo "> Setting CoopPlayerMaxNum to $COOP_PLAYER_MAX_NUM" + sed -E -i "s/CoopPlayerMaxNum=[0-9]*/CoopPlayerMaxNum=$COOP_PLAYER_MAX_NUM/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${MAX_PLAYERS+x} ]]; then + echo "> Setting max-players to $MAX_PLAYERS" + sed -E -i "s/ServerPlayerMaxNum=[0-9]*/ServerPlayerMaxNum=$MAX_PLAYERS/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${SERVER_NAME+x} ]]; then + echo "> Setting server name to $SERVER_NAME" + sed -E -i "s/ServerName=\"[^\"]*\"/ServerName=\"$SERVER_NAME\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + if [[ "$SERVER_NAME" == *"###RANDOM###"* ]]; then + RAND_VALUE=$RANDOM + echo "> Found standard template, using random numbers in server name" + sed -E -i -e "s/###RANDOM###/$RAND_VALUE/g" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + echo "> Server name is now jammsen-docker-generated-$RAND_VALUE" + fi + fi + if [[ ! -z ${SERVER_DESCRIPTION+x} ]]; then + echo "> Setting server description to $SERVER_DESCRIPTION" + sed -E -i "s/ServerDescription=\"[^\"]*\"/ServerDescription=\"$SERVER_DESCRIPTION\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${ADMIN_PASSWORD+x} ]]; then + echo "> Setting server admin password to $ADMIN_PASSWORD" + sed -E -i "s/AdminPassword=\"[^\"]*\"/AdminPassword=\"$ADMIN_PASSWORD\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${SERVER_PASSWORD+x} ]]; then + echo "> Setting server password to $SERVER_PASSWORD" + sed -E -i "s/ServerPassword=\"[^\"]*\"/ServerPassword=\"$SERVER_PASSWORD\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PUBLIC_PORT+x} ]]; then + echo "> Setting public port to $PUBLIC_PORT" + sed -E -i "s/PublicPort=[0-9]*/PublicPort=$PUBLIC_PORT/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${PUBLIC_IP+x} ]]; then + echo "> Setting public ip to $PUBLIC_IP" + sed -E -i "s/PublicIP=\"[^\"]*\"/PublicIP=\"$PUBLIC_IP\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${RCON_ENABLED+x} ]]; then + echo "> Setting rcon-enabled to $RCON_ENABLED" + sed -E -i "s/RCONEnabled=[a-zA-Z]*/RCONEnabled=$RCON_ENABLED/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${RCON_PORT+x} ]]; then + echo "> Setting RCONPort to $RCON_PORT" + sed -E -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${REGION+x} ]]; then + echo "> Setting Region to $REGION" + sed -E -i "s/Region=\"[^\"]*\"/Region=\"$REGION\"/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${USEAUTH+x} ]]; then + echo "> Setting bUseAuth to $USEAUTH" + sed -E -i "s/bUseAuth=[a-zA-Z]*/bUseAuth=$USEAUTH/" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + if [[ ! -z ${BAN_LIST_URL+x} ]]; then + echo "> Setting BanListURL to $BAN_LIST_URL" + sed -E -i "s~BanListURL=\"[^\"]*\"~BanListURL=\"$BAN_LIST_URL\"~" ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini + fi + else + echo "> SERVER_SETTINGS_MODE is set to manual, NOT using environment variables to configure the server!" + echo "> File ${GAME_PATH}/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini has to be manually set by user" fi echo ">>> Finished setting up PalWorldSettings.ini ..." +} + +function startServer() { + # IF Bash extension used: + # https://stackoverflow.com/a/13864829 + # https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 + + echo ">>> Starting the gameserver" + cd $GAME_PATH + + setupEngineIni + setupPalWorldSettingsIni + START_OPTIONS="" if [[ -n $COMMUNITY_SERVER ]] && [[ $COMMUNITY_SERVER == "true" ]]; then - echo "Setting Community-Mode to enabled" + echo "> Setting Community-Mode to enabled" START_OPTIONS="$START_OPTIONS EpicApp=PalServer" fi if [[ -n $MULTITHREAD_ENABLED ]] && [[ $MULTITHREAD_ENABLED == "true" ]]; then - echo "Setting Multi-Core-Enchancements to enabled" + echo "> Setting Multi-Core-Enchancements to enabled" START_OPTIONS="$START_OPTIONS -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS" fi ./PalServer.sh "$START_OPTIONS" @@ -342,15 +371,13 @@ function checkForDefaultCredentials() { } function startMain() { + checkForDefaultCredentials if [[ -n $BACKUP_ENABLED ]] && [[ $BACKUP_ENABLED == "true" ]]; then # Preparing the cronlist file echo "$BACKUP_CRON_EXPRESSION /backupmanager.sh" >> cronlist # Making sure supercronic is enabled and the cronfile is loaded /usr/local/bin/supercronic cronlist & fi - - checkForDefaultCredentials - # Check if server is installed, if not try again if [ ! -f "$GAME_PATH/PalServer.sh" ]; then installServer