[19] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
[258] | 3 | # Copyright 2016 Christian 'Alloc' Illy
|
---|
| 4 | #
|
---|
| 5 | # Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 6 | # you may not use this file except in compliance with the License.
|
---|
| 7 | # You may obtain a copy of the License at
|
---|
| 8 | #
|
---|
| 9 | # http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | #
|
---|
| 11 | # Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | # distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 14 | # See the License for the specific language governing permissions and
|
---|
| 15 | # limitations under the License.
|
---|
| 16 |
|
---|
| 17 |
|
---|
[19] | 18 | # Provides functions to query and validate values for serverconfig.xml
|
---|
| 19 |
|
---|
[23] | 20 | #################################
|
---|
| 21 | ## Definition of options
|
---|
| 22 |
|
---|
[19] | 23 | serverconfig_ServerPort_QueryName() {
|
---|
| 24 | echo "Base Port"
|
---|
| 25 | }
|
---|
| 26 | serverconfig_ServerPort_Type() {
|
---|
| 27 | echo "number"
|
---|
| 28 | }
|
---|
| 29 | serverconfig_ServerPort_Default() {
|
---|
[303] | 30 | echo "26900"
|
---|
[19] | 31 | }
|
---|
| 32 | serverconfig_ServerPort_Range() {
|
---|
| 33 | echo "1024-65533"
|
---|
| 34 | }
|
---|
| 35 | serverconfig_ServerPort_Validate() {
|
---|
| 36 | local I=${INSTANCE:-!}
|
---|
| 37 | if [ $(checkGamePortUsed "$1" "$I") -eq 0 ]; then
|
---|
| 38 | echo "1"
|
---|
| 39 | else
|
---|
| 40 | echo "0"
|
---|
| 41 | fi
|
---|
| 42 | }
|
---|
| 43 | serverconfig_ServerPort_ErrorMessage() {
|
---|
| 44 | echo "Illegal port number or port already in use by another instance."
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 |
|
---|
[303] | 48 | serverconfig_ServerDisabledNetworkProtocols_QueryName() {
|
---|
| 49 | echo "Disabled network protocols"
|
---|
| 50 | }
|
---|
| 51 | serverconfig_ServerDisabledNetworkProtocols_Type() {
|
---|
| 52 | echo "enum"
|
---|
| 53 | }
|
---|
| 54 | serverconfig_ServerDisabledNetworkProtocols_Default() {
|
---|
| 55 | echo "1"
|
---|
| 56 | }
|
---|
| 57 | serverconfig_ServerDisabledNetworkProtocols_Values() {
|
---|
[344] | 58 | config_allowed_values=("None" "SteamNetworking" "SteamNetworking,LiteNetLib" "LiteNetLib")
|
---|
[303] | 59 | }
|
---|
[19] | 60 |
|
---|
[303] | 61 |
|
---|
[344] | 62 | serverconfig_ServerVisibility_QueryName() {
|
---|
[19] | 63 | echo "Public server"
|
---|
| 64 | }
|
---|
[344] | 65 | serverconfig_ServerVisibility_Type() {
|
---|
| 66 | echo "number"
|
---|
[19] | 67 | }
|
---|
[344] | 68 | serverconfig_ServerVisibility_Default() {
|
---|
| 69 | echo "2"
|
---|
[19] | 70 | }
|
---|
[344] | 71 | serverconfig_ServerVisibility_Range() {
|
---|
| 72 | echo "0-2"
|
---|
[19] | 73 | }
|
---|
[344] | 74 | serverconfig_ServerVisibility_Values() {
|
---|
| 75 | config_allowed_values=("Not listed" "Friends only (only works while at least one player is connected manually. Dedi servers do not have friends!)" "Public")
|
---|
| 76 | }
|
---|
[19] | 77 |
|
---|
| 78 |
|
---|
| 79 | serverconfig_ServerName_QueryName() {
|
---|
| 80 | echo "Server name"
|
---|
| 81 | }
|
---|
| 82 | serverconfig_ServerName_Type() {
|
---|
| 83 | echo "string"
|
---|
| 84 | }
|
---|
| 85 | serverconfig_ServerName_Validate() {
|
---|
| 86 | if [ ! -z "$1" ]; then
|
---|
| 87 | echo "1"
|
---|
| 88 | else
|
---|
| 89 | echo "0"
|
---|
| 90 | fi
|
---|
| 91 | }
|
---|
| 92 | serverconfig_ServerName_ErrorMessage() {
|
---|
| 93 | echo "Server name cannot be empty."
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 |
|
---|
[204] | 98 | serverconfig_ServerDescription_QueryName() {
|
---|
| 99 | echo "Server description"
|
---|
| 100 | }
|
---|
| 101 | serverconfig_ServerDescription_Type() {
|
---|
| 102 | echo "string"
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 | serverconfig_ServerWebsiteURL_QueryName() {
|
---|
| 108 | echo "Server website URL"
|
---|
| 109 | }
|
---|
| 110 | serverconfig_ServerWebsiteURL_Type() {
|
---|
| 111 | echo "string"
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 |
|
---|
[19] | 116 | serverconfig_ServerPassword_QueryName() {
|
---|
| 117 | echo "Server password"
|
---|
| 118 | }
|
---|
| 119 | serverconfig_ServerPassword_Type() {
|
---|
| 120 | echo "string"
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 |
|
---|
[302] | 125 | serverconfig_MaxUncoveredMapChunksPerPlayer_QueryName() {
|
---|
| 126 | echo "Max uncovered chunks per player"
|
---|
| 127 | }
|
---|
| 128 | serverconfig_MaxUncoveredMapChunksPerPlayer_Type() {
|
---|
| 129 | echo "number"
|
---|
| 130 | }
|
---|
| 131 | serverconfig_MaxUncoveredMapChunksPerPlayer_Default() {
|
---|
| 132 | echo "131072"
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 | serverconfig_HideCommandExecutionLog_QueryName() {
|
---|
| 137 | echo "Hide command execution in log"
|
---|
| 138 | }
|
---|
| 139 | serverconfig_HideCommandExecutionLog_Type() {
|
---|
| 140 | echo "number"
|
---|
| 141 | }
|
---|
| 142 | serverconfig_HideCommandExecutionLog_Default() {
|
---|
| 143 | echo "0"
|
---|
| 144 | }
|
---|
| 145 | serverconfig_HideCommandExecutionLog_Range() {
|
---|
| 146 | echo "0-3"
|
---|
| 147 | }
|
---|
| 148 | serverconfig_HideCommandExecutionLog_Values() {
|
---|
| 149 | config_allowed_values=("Log all" "Log all but commands from Telnet/ControlPanel" "Also hide commands executed by clients" "Do not log any commands at all")
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 |
|
---|
[19] | 155 | serverconfig_ServerMaxPlayerCount_QueryName() {
|
---|
[302] | 156 | echo "Max players"
|
---|
[19] | 157 | }
|
---|
| 158 | serverconfig_ServerMaxPlayerCount_Type() {
|
---|
[302] | 159 | echo "number"
|
---|
[19] | 160 | }
|
---|
| 161 | serverconfig_ServerMaxPlayerCount_Default() {
|
---|
| 162 | echo "4"
|
---|
| 163 | }
|
---|
| 164 | serverconfig_ServerMaxPlayerCount_Range() {
|
---|
| 165 | echo "1-64"
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 |
|
---|
[302] | 169 | serverconfig_ServerReservedSlots_QueryName() {
|
---|
| 170 | echo "Reserved VIP slots"
|
---|
| 171 | }
|
---|
| 172 | serverconfig_ServerReservedSlots_Type() {
|
---|
| 173 | echo "number"
|
---|
| 174 | }
|
---|
| 175 | serverconfig_ServerReservedSlots_Default() {
|
---|
| 176 | echo "0"
|
---|
| 177 | }
|
---|
| 178 | serverconfig_ServerReservedSlots_Range() {
|
---|
[303] | 179 | echo "0-64"
|
---|
[302] | 180 | }
|
---|
[19] | 181 |
|
---|
[302] | 182 |
|
---|
| 183 | serverconfig_ServerReservedSlotsPermission_QueryName() {
|
---|
| 184 | echo "Permission level required for VIP slots"
|
---|
| 185 | }
|
---|
| 186 | serverconfig_ServerReservedSlotsPermission_Type() {
|
---|
| 187 | echo "number"
|
---|
| 188 | }
|
---|
| 189 | serverconfig_ServerReservedSlotsPermission_Default() {
|
---|
| 190 | echo "100"
|
---|
| 191 | }
|
---|
| 192 | serverconfig_ServerReservedSlotsPermission_Range() {
|
---|
| 193 | echo "0-2000"
|
---|
| 194 | }
|
---|
| 195 |
|
---|
| 196 |
|
---|
| 197 | serverconfig_ServerAdminSlots_QueryName() {
|
---|
| 198 | echo "Admin slots"
|
---|
| 199 | }
|
---|
| 200 | serverconfig_ServerAdminSlots_Type() {
|
---|
| 201 | echo "number"
|
---|
| 202 | }
|
---|
| 203 | serverconfig_ServerAdminSlots_Default() {
|
---|
| 204 | echo "0"
|
---|
| 205 | }
|
---|
| 206 | serverconfig_ServerAdminSlots_Range() {
|
---|
[303] | 207 | echo "0-64"
|
---|
[302] | 208 | }
|
---|
| 209 |
|
---|
| 210 |
|
---|
| 211 | serverconfig_ServerAdminSlotsPermission_QueryName() {
|
---|
| 212 | echo "Permission level required for admin slots"
|
---|
| 213 | }
|
---|
| 214 | serverconfig_ServerAdminSlotsPermission_Type() {
|
---|
| 215 | echo "number"
|
---|
| 216 | }
|
---|
| 217 | serverconfig_ServerAdminSlotsPermission_Default() {
|
---|
| 218 | echo "0"
|
---|
| 219 | }
|
---|
| 220 | serverconfig_ServerAdminSlotsPermission_Range() {
|
---|
| 221 | echo "0-2000"
|
---|
| 222 | }
|
---|
| 223 |
|
---|
| 224 |
|
---|
| 225 |
|
---|
| 226 |
|
---|
[19] | 227 | serverconfig_GameWorld_QueryName() {
|
---|
| 228 | echo "World name"
|
---|
| 229 | }
|
---|
| 230 | serverconfig_GameWorld_Type() {
|
---|
| 231 | echo "enum"
|
---|
| 232 | }
|
---|
| 233 | serverconfig_GameWorld_Default() {
|
---|
| 234 | echo "1"
|
---|
| 235 | }
|
---|
| 236 | serverconfig_GameWorld_Values() {
|
---|
[344] | 237 | config_allowed_values=("RWG" "Navezgane") # "MP Wasteland Horde" "MP Wasteland Skirmish" "MP Wasteland War"
|
---|
[19] | 238 | }
|
---|
| 239 |
|
---|
| 240 |
|
---|
| 241 |
|
---|
[344] | 242 | serverconfig_WorldGenSeed_QueryName() {
|
---|
| 243 | echo "Random generation seed (if world RWG)"
|
---|
| 244 | }
|
---|
| 245 | serverconfig_WorldGenSeed_Type() {
|
---|
| 246 | echo "string"
|
---|
| 247 | }
|
---|
| 248 | serverconfig_WorldGenSeed_Validate() {
|
---|
| 249 | if [ ! -z "$1" ]; then
|
---|
| 250 | echo "1"
|
---|
| 251 | else
|
---|
| 252 | echo "0"
|
---|
| 253 | fi
|
---|
| 254 | }
|
---|
| 255 | serverconfig_WorldGenSeed_ErrorMessage() {
|
---|
| 256 | echo "Seed cannot be empty."
|
---|
| 257 | }
|
---|
| 258 |
|
---|
| 259 |
|
---|
| 260 |
|
---|
| 261 | serverconfig_WorldGenSize_QueryName() {
|
---|
| 262 | echo "Random generation map size (if world RWG)"
|
---|
| 263 | }
|
---|
| 264 | serverconfig_WorldGenSize_Type() {
|
---|
| 265 | echo "number"
|
---|
| 266 | }
|
---|
| 267 | serverconfig_WorldGenSize_Default() {
|
---|
| 268 | echo "6144"
|
---|
| 269 | }
|
---|
| 270 | serverconfig_WorldGenSize_Range() {
|
---|
| 271 | echo "2048-16384"
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 |
|
---|
| 275 |
|
---|
[19] | 276 | serverconfig_GameName_QueryName() {
|
---|
[344] | 277 | echo "World decoration seed"
|
---|
[19] | 278 | }
|
---|
| 279 | serverconfig_GameName_Type() {
|
---|
| 280 | echo "string"
|
---|
| 281 | }
|
---|
| 282 | serverconfig_GameName_Validate() {
|
---|
| 283 | if [ ! -z "$1" ]; then
|
---|
| 284 | echo "1"
|
---|
| 285 | else
|
---|
| 286 | echo "0"
|
---|
| 287 | fi
|
---|
| 288 | }
|
---|
| 289 | serverconfig_GameName_ErrorMessage() {
|
---|
[204] | 290 | echo "Seed cannot be empty."
|
---|
[19] | 291 | }
|
---|
| 292 |
|
---|
| 293 |
|
---|
| 294 |
|
---|
| 295 | serverconfig_GameDifficulty_QueryName() {
|
---|
[204] | 296 | echo "Difficulty (+ damage given / received)"
|
---|
[19] | 297 | }
|
---|
| 298 | serverconfig_GameDifficulty_Type() {
|
---|
| 299 | echo "number"
|
---|
| 300 | }
|
---|
| 301 | serverconfig_GameDifficulty_Default() {
|
---|
| 302 | echo "2"
|
---|
| 303 | }
|
---|
| 304 | serverconfig_GameDifficulty_Range() {
|
---|
[204] | 305 | echo "0-5"
|
---|
[19] | 306 | }
|
---|
| 307 | serverconfig_GameDifficulty_Values() {
|
---|
[204] | 308 | config_allowed_values=("Scavenger (200% / 50%)" "Adventurer (150% / 75%)" "Nomad (100% / 100%)" "Warrior (75% / 150%)" "Survivalist (50% / 200%)" "Insane (25% / 250%)")
|
---|
[19] | 309 | }
|
---|
| 310 |
|
---|
| 311 |
|
---|
| 312 |
|
---|
| 313 | serverconfig_GameMode_QueryName() {
|
---|
| 314 | echo "Game mode"
|
---|
| 315 | }
|
---|
| 316 | serverconfig_GameMode_Type() {
|
---|
| 317 | echo "enum"
|
---|
| 318 | }
|
---|
| 319 | serverconfig_GameMode_Default() {
|
---|
| 320 | echo "1"
|
---|
| 321 | }
|
---|
| 322 | serverconfig_GameMode_Values() {
|
---|
[344] | 323 | config_allowed_values=("GameModeSurvival")
|
---|
[19] | 324 | }
|
---|
| 325 |
|
---|
| 326 |
|
---|
| 327 |
|
---|
[344] | 328 | serverconfig_ZombieMove_QueryName() {
|
---|
| 329 | echo "Zombie speed, regular"
|
---|
[19] | 330 | }
|
---|
[344] | 331 | serverconfig_ZombieMove_Type() {
|
---|
[19] | 332 | echo "number"
|
---|
| 333 | }
|
---|
[344] | 334 | serverconfig_ZombieMove_Default() {
|
---|
[19] | 335 | echo "0"
|
---|
| 336 | }
|
---|
[344] | 337 | serverconfig_ZombieMove_Range() {
|
---|
| 338 | echo "0-4"
|
---|
[19] | 339 | }
|
---|
[344] | 340 | serverconfig_ZombieMove_Values() {
|
---|
| 341 | config_allowed_values=("Walk" "Jog" "Run" "Sprint" "Nightmare")
|
---|
[19] | 342 | }
|
---|
| 343 |
|
---|
| 344 |
|
---|
| 345 |
|
---|
[344] | 346 | serverconfig_ZombieMoveNight_QueryName() {
|
---|
| 347 | echo "Zombie speed, night"
|
---|
| 348 | }
|
---|
| 349 | serverconfig_ZombieMoveNight_Type() {
|
---|
| 350 | echo "number"
|
---|
| 351 | }
|
---|
| 352 | serverconfig_ZombieMoveNight_Default() {
|
---|
| 353 | echo "3"
|
---|
| 354 | }
|
---|
| 355 | serverconfig_ZombieMoveNight_Range() {
|
---|
| 356 | echo "0-4"
|
---|
| 357 | }
|
---|
| 358 | serverconfig_ZombieMoveNight_Values() {
|
---|
| 359 | config_allowed_values=("Walk" "Jog" "Run" "Sprint" "Nightmare")
|
---|
| 360 | }
|
---|
| 361 |
|
---|
| 362 |
|
---|
| 363 |
|
---|
| 364 | serverconfig_ZombieFeralMove_QueryName() {
|
---|
| 365 | echo "Zombie speed, ferals"
|
---|
| 366 | }
|
---|
| 367 | serverconfig_ZombieFeralMove_Type() {
|
---|
| 368 | echo "number"
|
---|
| 369 | }
|
---|
| 370 | serverconfig_ZombieFeralMove_Default() {
|
---|
| 371 | echo "3"
|
---|
| 372 | }
|
---|
| 373 | serverconfig_ZombieFeralMove_Range() {
|
---|
| 374 | echo "0-4"
|
---|
| 375 | }
|
---|
| 376 | serverconfig_ZombieFeralMove_Values() {
|
---|
| 377 | config_allowed_values=("Walk" "Jog" "Run" "Sprint" "Nightmare")
|
---|
| 378 | }
|
---|
| 379 |
|
---|
| 380 |
|
---|
| 381 |
|
---|
| 382 | serverconfig_ZombieBMMove_QueryName() {
|
---|
| 383 | echo "Zombie speed, bloodmoons"
|
---|
| 384 | }
|
---|
| 385 | serverconfig_ZombieBMMove_Type() {
|
---|
| 386 | echo "number"
|
---|
| 387 | }
|
---|
| 388 | serverconfig_ZombieBMMove_Default() {
|
---|
| 389 | echo "3"
|
---|
| 390 | }
|
---|
| 391 | serverconfig_ZombieBMMove_Range() {
|
---|
| 392 | echo "0-4"
|
---|
| 393 | }
|
---|
| 394 | serverconfig_ZombieBMMove_Values() {
|
---|
| 395 | config_allowed_values=("Walk" "Jog" "Run" "Sprint" "Nightmare")
|
---|
| 396 | }
|
---|
| 397 |
|
---|
| 398 |
|
---|
| 399 |
|
---|
| 400 |
|
---|
[19] | 401 | serverconfig_BuildCreate_QueryName() {
|
---|
| 402 | echo "Item spawn menu"
|
---|
| 403 | }
|
---|
| 404 | serverconfig_BuildCreate_Type() {
|
---|
| 405 | echo "boolean"
|
---|
| 406 | }
|
---|
| 407 | serverconfig_BuildCreate_Default() {
|
---|
[204] | 408 | echo "false"
|
---|
[19] | 409 | }
|
---|
| 410 | serverconfig_BuildCreate_ErrorMessage() {
|
---|
| 411 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 412 | }
|
---|
| 413 |
|
---|
| 414 |
|
---|
| 415 |
|
---|
| 416 | serverconfig_DayNightLength_QueryName() {
|
---|
| 417 | echo "Length of one day"
|
---|
| 418 | }
|
---|
| 419 | serverconfig_DayNightLength_Type() {
|
---|
| 420 | echo "number"
|
---|
| 421 | }
|
---|
| 422 | serverconfig_DayNightLength_Default() {
|
---|
[308] | 423 | echo "60"
|
---|
[19] | 424 | }
|
---|
| 425 |
|
---|
| 426 |
|
---|
| 427 |
|
---|
[294] | 428 | serverconfig_DayLightLength_QueryName() {
|
---|
| 429 | echo "Duration of daylight (in ingame hours)"
|
---|
[19] | 430 | }
|
---|
[294] | 431 | serverconfig_DayLightLength_Type() {
|
---|
| 432 | echo "number"
|
---|
| 433 | }
|
---|
| 434 | serverconfig_DayLightLength_Default() {
|
---|
| 435 | echo "18"
|
---|
| 436 | }
|
---|
| 437 | serverconfig_DayLightLength_Range() {
|
---|
| 438 | echo "0-24"
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 |
|
---|
| 442 |
|
---|
[344] | 443 | serverconfig_PartySharedKillRange_QueryName() {
|
---|
| 444 | echo "Party range to share kill / quest XP rewards"
|
---|
| 445 | }
|
---|
| 446 | serverconfig_PartySharedKillRange_Type() {
|
---|
| 447 | echo "number"
|
---|
| 448 | }
|
---|
| 449 | serverconfig_PartySharedKillRange_Default() {
|
---|
| 450 | echo "100"
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 |
|
---|
| 454 |
|
---|
[294] | 455 | serverconfig_PlayerKillingMode_QueryName() {
|
---|
| 456 | echo "Player killing"
|
---|
| 457 | }
|
---|
| 458 | serverconfig_PlayerKillingMode_Type() {
|
---|
[296] | 459 | echo "number"
|
---|
[294] | 460 | }
|
---|
| 461 | serverconfig_PlayerKillingMode_Default() {
|
---|
| 462 | echo "3"
|
---|
| 463 | }
|
---|
[296] | 464 | serverconfig_PlayerKillingMode_Range() {
|
---|
| 465 | echo "0-3"
|
---|
| 466 | }
|
---|
[294] | 467 | serverconfig_PlayerKillingMode_Values() {
|
---|
| 468 | config_allowed_values=("No player killing" "Kill allies only" "Kill strangers only" "Kill everyone")
|
---|
| 469 | }
|
---|
| 470 |
|
---|
| 471 |
|
---|
| 472 |
|
---|
| 473 | serverconfig_PersistentPlayerProfiles_QueryName() {
|
---|
| 474 | echo "Persistent player profiles"
|
---|
| 475 | }
|
---|
| 476 | serverconfig_PersistentPlayerProfiles_Type() {
|
---|
[19] | 477 | echo "boolean"
|
---|
| 478 | }
|
---|
[294] | 479 | serverconfig_PersistentPlayerProfiles_Default() {
|
---|
[19] | 480 | echo "false"
|
---|
| 481 | }
|
---|
[294] | 482 | serverconfig_PersistentPlayerProfiles_ErrorMessage() {
|
---|
[19] | 483 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 484 | }
|
---|
| 485 |
|
---|
| 486 |
|
---|
| 487 |
|
---|
[294] | 488 | serverconfig_PlayerSafeZoneLevel_QueryName() {
|
---|
| 489 | echo "Safe zone up to player level"
|
---|
| 490 | }
|
---|
| 491 | serverconfig_PlayerSafeZoneLevel_Type() {
|
---|
| 492 | echo "number"
|
---|
| 493 | }
|
---|
| 494 | serverconfig_PlayerSafeZoneLevel_Default() {
|
---|
| 495 | echo "5"
|
---|
| 496 | }
|
---|
| 497 |
|
---|
| 498 |
|
---|
| 499 | serverconfig_PlayerSafeZoneHours_QueryName() {
|
---|
| 500 | echo "Safe zone up to played hours"
|
---|
| 501 | }
|
---|
| 502 | serverconfig_PlayerSafeZoneHours_Type() {
|
---|
| 503 | echo "number"
|
---|
| 504 | }
|
---|
| 505 | serverconfig_PlayerSafeZoneHours_Default() {
|
---|
| 506 | echo "5"
|
---|
| 507 | }
|
---|
| 508 |
|
---|
| 509 |
|
---|
[19] | 510 | serverconfig_ControlPanelEnabled_QueryName() {
|
---|
| 511 | echo "Enable control panel"
|
---|
| 512 | }
|
---|
| 513 | serverconfig_ControlPanelEnabled_Type() {
|
---|
| 514 | echo "boolean"
|
---|
| 515 | }
|
---|
| 516 | serverconfig_ControlPanelEnabled_Default() {
|
---|
| 517 | echo "false"
|
---|
| 518 | }
|
---|
| 519 | serverconfig_ControlPanelEnabled_ErrorMessage() {
|
---|
| 520 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 521 | }
|
---|
| 522 |
|
---|
| 523 |
|
---|
| 524 |
|
---|
| 525 | serverconfig_ControlPanelPort_QueryName() {
|
---|
| 526 | echo "Control panel port"
|
---|
| 527 | }
|
---|
| 528 | serverconfig_ControlPanelPort_Type() {
|
---|
| 529 | echo "number"
|
---|
| 530 | }
|
---|
| 531 | serverconfig_ControlPanelPort_Default() {
|
---|
| 532 | echo "8080"
|
---|
| 533 | }
|
---|
| 534 | serverconfig_ControlPanelPort_Range() {
|
---|
| 535 | echo "1024-65535"
|
---|
| 536 | }
|
---|
| 537 | serverconfig_ControlPanelPort_Validate() {
|
---|
| 538 | local I=${INSTANCE:-!}
|
---|
| 539 | if [ $(checkTCPPortUsed "$1" "$I") -eq 0 ]; then
|
---|
| 540 | echo "1"
|
---|
| 541 | else
|
---|
| 542 | echo "0"
|
---|
| 543 | fi
|
---|
| 544 | }
|
---|
| 545 | serverconfig_ControlPanelPort_ErrorMessage() {
|
---|
| 546 | echo "Illegal port number or port already in use by another instance."
|
---|
| 547 | }
|
---|
| 548 |
|
---|
| 549 |
|
---|
| 550 |
|
---|
| 551 | serverconfig_ControlPanelPassword_QueryName() {
|
---|
| 552 | echo "Control panel password"
|
---|
| 553 | }
|
---|
| 554 | serverconfig_ControlPanelPassword_Type() {
|
---|
| 555 | echo "string"
|
---|
| 556 | }
|
---|
| 557 |
|
---|
| 558 |
|
---|
| 559 |
|
---|
| 560 | serverconfig_TelnetPort_QueryName() {
|
---|
| 561 | echo "Telnet port"
|
---|
| 562 | }
|
---|
| 563 | serverconfig_TelnetPort_Type() {
|
---|
| 564 | echo "number"
|
---|
| 565 | }
|
---|
| 566 | serverconfig_TelnetPort_Default() {
|
---|
| 567 | echo "8081"
|
---|
| 568 | }
|
---|
| 569 | serverconfig_TelnetPort_Range() {
|
---|
| 570 | echo "1024-65535"
|
---|
| 571 | }
|
---|
| 572 | serverconfig_TelnetPort_Validate() {
|
---|
| 573 | local I=${INSTANCE:-!}
|
---|
| 574 | if [ $(checkTCPPortUsed "$1" "$I") -eq 0 ]; then
|
---|
| 575 | echo "1"
|
---|
| 576 | else
|
---|
| 577 | echo "0"
|
---|
| 578 | fi
|
---|
| 579 | }
|
---|
| 580 | serverconfig_TelnetPort_ErrorMessage() {
|
---|
| 581 | echo "Illegal port number or port already in use by another instance."
|
---|
| 582 | }
|
---|
| 583 |
|
---|
| 584 |
|
---|
| 585 |
|
---|
| 586 | serverconfig_TelnetPassword_QueryName() {
|
---|
| 587 | echo "Telnet password"
|
---|
| 588 | }
|
---|
| 589 | serverconfig_TelnetPassword_Type() {
|
---|
| 590 | echo "string"
|
---|
| 591 | }
|
---|
| 592 |
|
---|
| 593 |
|
---|
| 594 |
|
---|
[344] | 595 | serverconfig_TelnetFailedLoginLimit_QueryName() {
|
---|
| 596 | echo "Max failed login attempts (0 to disable)"
|
---|
| 597 | }
|
---|
| 598 | serverconfig_TelnetFailedLoginLimit_Type() {
|
---|
| 599 | echo "number"
|
---|
| 600 | }
|
---|
| 601 | serverconfig_TelnetFailedLoginLimit_Default() {
|
---|
| 602 | echo "10"
|
---|
| 603 | }
|
---|
| 604 |
|
---|
| 605 |
|
---|
| 606 |
|
---|
| 607 | serverconfig_TelnetFailedLoginsBlocktime_QueryName() {
|
---|
| 608 | echo "Telnet login blocktime after failed logins (seconds)"
|
---|
| 609 | }
|
---|
| 610 | serverconfig_TelnetFailedLoginsBlocktime_Type() {
|
---|
| 611 | echo "number"
|
---|
| 612 | }
|
---|
| 613 | serverconfig_TelnetFailedLoginsBlocktime_Default() {
|
---|
| 614 | echo "10"
|
---|
| 615 | }
|
---|
| 616 |
|
---|
| 617 |
|
---|
| 618 |
|
---|
[19] | 619 | serverconfig_DropOnDeath_QueryName() {
|
---|
| 620 | echo "Drop on Death"
|
---|
| 621 | }
|
---|
| 622 | serverconfig_DropOnDeath_Type() {
|
---|
| 623 | echo "number"
|
---|
| 624 | }
|
---|
| 625 | serverconfig_DropOnDeath_Default() {
|
---|
| 626 | echo "0"
|
---|
| 627 | }
|
---|
| 628 | serverconfig_DropOnDeath_Range() {
|
---|
| 629 | echo "0-3"
|
---|
| 630 | }
|
---|
| 631 | serverconfig_DropOnDeath_Values() {
|
---|
| 632 | config_allowed_values=("Everything" "Toolbelt only" "Backpack only" "Delete all")
|
---|
| 633 | }
|
---|
| 634 |
|
---|
| 635 |
|
---|
| 636 | serverconfig_DropOnQuit_QueryName() {
|
---|
| 637 | echo "Drop on Quit"
|
---|
| 638 | }
|
---|
| 639 | serverconfig_DropOnQuit_Type() {
|
---|
| 640 | echo "number"
|
---|
| 641 | }
|
---|
| 642 | serverconfig_DropOnQuit_Default() {
|
---|
[204] | 643 | echo "1"
|
---|
[19] | 644 | }
|
---|
| 645 | serverconfig_DropOnQuit_Range() {
|
---|
| 646 | echo "0-3"
|
---|
| 647 | }
|
---|
| 648 | serverconfig_DropOnQuit_Values() {
|
---|
| 649 | config_allowed_values=("Nothing" "Everything" "Toolbelt only" "Backpack only")
|
---|
| 650 | }
|
---|
| 651 |
|
---|
| 652 |
|
---|
| 653 |
|
---|
| 654 |
|
---|
| 655 | serverconfig_EnemySpawnMode_QueryName() {
|
---|
| 656 | echo "Spawn mode"
|
---|
| 657 | }
|
---|
| 658 | serverconfig_EnemySpawnMode_Type() {
|
---|
[302] | 659 | echo "boolean"
|
---|
[19] | 660 | }
|
---|
| 661 | serverconfig_EnemySpawnMode_Default() {
|
---|
[302] | 662 | echo "true"
|
---|
[19] | 663 | }
|
---|
[302] | 664 | serverconfig_EnemySpawnMode_ErrorMessage() {
|
---|
| 665 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
[19] | 666 | }
|
---|
| 667 |
|
---|
| 668 |
|
---|
| 669 | serverconfig_EnemyDifficulty_QueryName() {
|
---|
| 670 | echo "Enemy difficulty"
|
---|
| 671 | }
|
---|
| 672 | serverconfig_EnemyDifficulty_Type() {
|
---|
| 673 | echo "number"
|
---|
| 674 | }
|
---|
| 675 | serverconfig_EnemyDifficulty_Default() {
|
---|
| 676 | echo "0"
|
---|
| 677 | }
|
---|
| 678 | serverconfig_EnemyDifficulty_Range() {
|
---|
| 679 | echo "0-1"
|
---|
| 680 | }
|
---|
| 681 | serverconfig_EnemyDifficulty_Values() {
|
---|
| 682 | config_allowed_values=("Normal" "Feral")
|
---|
| 683 | }
|
---|
| 684 |
|
---|
| 685 |
|
---|
[302] | 686 | serverconfig_BloodMoonEnemyCount_QueryName() {
|
---|
| 687 | echo "Enemies per Player on Blood moons"
|
---|
| 688 | }
|
---|
| 689 | serverconfig_BloodMoonEnemyCount_Type() {
|
---|
| 690 | echo "number"
|
---|
| 691 | }
|
---|
| 692 | serverconfig_BloodMoonEnemyCount_Default() {
|
---|
| 693 | echo "8"
|
---|
| 694 | }
|
---|
| 695 | serverconfig_BloodMoonEnemyCount_Range() {
|
---|
| 696 | echo "0-64"
|
---|
| 697 | }
|
---|
[19] | 698 |
|
---|
| 699 |
|
---|
[302] | 700 |
|
---|
| 701 |
|
---|
[19] | 702 | serverconfig_BlockDurabilityModifier_QueryName() {
|
---|
| 703 | echo "Block durability (%)"
|
---|
| 704 | }
|
---|
| 705 | serverconfig_BlockDurabilityModifier_Type() {
|
---|
| 706 | echo "number"
|
---|
| 707 | }
|
---|
| 708 | serverconfig_BlockDurabilityModifier_Default() {
|
---|
| 709 | echo "100"
|
---|
| 710 | }
|
---|
| 711 |
|
---|
| 712 |
|
---|
| 713 |
|
---|
| 714 |
|
---|
| 715 | serverconfig_LootAbundance_QueryName() {
|
---|
| 716 | echo "Loot abundance (%)"
|
---|
| 717 | }
|
---|
| 718 | serverconfig_LootAbundance_Type() {
|
---|
| 719 | echo "number"
|
---|
| 720 | }
|
---|
| 721 | serverconfig_LootAbundance_Default() {
|
---|
| 722 | echo "100"
|
---|
| 723 | }
|
---|
| 724 |
|
---|
| 725 |
|
---|
| 726 | serverconfig_LootRespawnDays_QueryName() {
|
---|
| 727 | echo "Loot respawn delay (days)"
|
---|
| 728 | }
|
---|
| 729 | serverconfig_LootRespawnDays_Type() {
|
---|
| 730 | echo "number"
|
---|
| 731 | }
|
---|
| 732 | serverconfig_LootRespawnDays_Default() {
|
---|
| 733 | echo "7"
|
---|
| 734 | }
|
---|
| 735 |
|
---|
[302] | 736 | serverconfig_BedrollDeadZoneSize_QueryName() {
|
---|
| 737 | echo "Bedroll deadzone size"
|
---|
| 738 | }
|
---|
| 739 | serverconfig_BedrollDeadZoneSize_Type() {
|
---|
| 740 | echo "number"
|
---|
| 741 | }
|
---|
| 742 | serverconfig_BedrollDeadZoneSize_Default() {
|
---|
| 743 | echo "15"
|
---|
| 744 | }
|
---|
[19] | 745 |
|
---|
| 746 |
|
---|
| 747 |
|
---|
[302] | 748 |
|
---|
[19] | 749 | serverconfig_LandClaimSize_QueryName() {
|
---|
| 750 | echo "Land claim size"
|
---|
| 751 | }
|
---|
| 752 | serverconfig_LandClaimSize_Type() {
|
---|
| 753 | echo "number"
|
---|
| 754 | }
|
---|
| 755 | serverconfig_LandClaimSize_Default() {
|
---|
| 756 | echo "7"
|
---|
| 757 | }
|
---|
| 758 |
|
---|
| 759 |
|
---|
| 760 | serverconfig_LandClaimDeadZone_QueryName() {
|
---|
| 761 | echo "Minimum keystone distance"
|
---|
| 762 | }
|
---|
| 763 | serverconfig_LandClaimDeadZone_Type() {
|
---|
| 764 | echo "number"
|
---|
| 765 | }
|
---|
| 766 | serverconfig_LandClaimDeadZone_Default() {
|
---|
| 767 | echo "30"
|
---|
| 768 | }
|
---|
| 769 |
|
---|
| 770 |
|
---|
| 771 | serverconfig_LandClaimExpiryTime_QueryName() {
|
---|
| 772 | echo "Claim expiry time (days)"
|
---|
| 773 | }
|
---|
| 774 | serverconfig_LandClaimExpiryTime_Type() {
|
---|
| 775 | echo "number"
|
---|
| 776 | }
|
---|
| 777 | serverconfig_LandClaimExpiryTime_Default() {
|
---|
| 778 | echo "3"
|
---|
| 779 | }
|
---|
| 780 |
|
---|
| 781 |
|
---|
| 782 | serverconfig_LandClaimDecayMode_QueryName() {
|
---|
| 783 | echo "Claim decay mode"
|
---|
| 784 | }
|
---|
| 785 | serverconfig_LandClaimDecayMode_Type() {
|
---|
| 786 | echo "number"
|
---|
| 787 | }
|
---|
| 788 | serverconfig_LandClaimDecayMode_Default() {
|
---|
| 789 | echo "0"
|
---|
| 790 | }
|
---|
| 791 | serverconfig_LandClaimDecayMode_Range() {
|
---|
| 792 | echo "0-2"
|
---|
| 793 | }
|
---|
| 794 | serverconfig_LandClaimDecayMode_Values() {
|
---|
| 795 | config_allowed_values=("Linear" "Exponential" "Full protection")
|
---|
| 796 | }
|
---|
| 797 |
|
---|
| 798 |
|
---|
| 799 | serverconfig_LandClaimOnlineDurabilityModifier_QueryName() {
|
---|
| 800 | echo "Claim durability modifier - online"
|
---|
| 801 | }
|
---|
| 802 | serverconfig_LandClaimOnlineDurabilityModifier_Type() {
|
---|
| 803 | echo "number"
|
---|
| 804 | }
|
---|
| 805 | serverconfig_LandClaimOnlineDurabilityModifier_Default() {
|
---|
| 806 | echo "4"
|
---|
| 807 | }
|
---|
| 808 |
|
---|
| 809 |
|
---|
| 810 | serverconfig_LandClaimOfflineDurabilityModifier_QueryName() {
|
---|
| 811 | echo "Claim durability modifier - offline"
|
---|
| 812 | }
|
---|
| 813 | serverconfig_LandClaimOfflineDurabilityModifier_Type() {
|
---|
| 814 | echo "number"
|
---|
| 815 | }
|
---|
| 816 | serverconfig_LandClaimOfflineDurabilityModifier_Default() {
|
---|
| 817 | echo "4"
|
---|
| 818 | }
|
---|
| 819 |
|
---|
| 820 |
|
---|
| 821 |
|
---|
| 822 |
|
---|
| 823 | serverconfig_AirDropFrequency_QueryName() {
|
---|
| 824 | echo "Airdrop delay (hours)"
|
---|
| 825 | }
|
---|
| 826 | serverconfig_AirDropFrequency_Type() {
|
---|
| 827 | echo "number"
|
---|
| 828 | }
|
---|
| 829 | serverconfig_AirDropFrequency_Default() {
|
---|
[204] | 830 | echo "72"
|
---|
[19] | 831 | }
|
---|
| 832 |
|
---|
| 833 |
|
---|
[294] | 834 | serverconfig_AirDropMarker_QueryName() {
|
---|
| 835 | echo "Enable AirDrop markers"
|
---|
| 836 | }
|
---|
| 837 | serverconfig_AirDropMarker_Type() {
|
---|
| 838 | echo "boolean"
|
---|
| 839 | }
|
---|
| 840 | serverconfig_AirDropMarker_Default() {
|
---|
| 841 | echo "false"
|
---|
| 842 | }
|
---|
| 843 | serverconfig_AirDropMarker_ErrorMessage() {
|
---|
| 844 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 845 | }
|
---|
| 846 |
|
---|
| 847 |
|
---|
| 848 |
|
---|
[67] | 849 | serverconfig_MaxSpawnedZombies_QueryName() {
|
---|
| 850 | echo "Maximum number of concurrent zombies"
|
---|
| 851 | }
|
---|
| 852 | serverconfig_MaxSpawnedZombies_Type() {
|
---|
| 853 | echo "number"
|
---|
| 854 | }
|
---|
| 855 | serverconfig_MaxSpawnedZombies_Default() {
|
---|
| 856 | echo "60"
|
---|
| 857 | }
|
---|
[19] | 858 |
|
---|
| 859 |
|
---|
[294] | 860 | serverconfig_MaxSpawnedAnimals_QueryName() {
|
---|
| 861 | echo "Maximum number of concurrent animals"
|
---|
| 862 | }
|
---|
| 863 | serverconfig_MaxSpawnedAnimals_Type() {
|
---|
| 864 | echo "number"
|
---|
| 865 | }
|
---|
| 866 | serverconfig_MaxSpawnedAnimals_Default() {
|
---|
| 867 | echo "50"
|
---|
| 868 | }
|
---|
| 869 |
|
---|
| 870 |
|
---|
[204] | 871 | serverconfig_EACEnabled_QueryName() {
|
---|
| 872 | echo "Enable EasyAntiCheat"
|
---|
[67] | 873 | }
|
---|
[204] | 874 | serverconfig_EACEnabled_Type() {
|
---|
[67] | 875 | echo "boolean"
|
---|
| 876 | }
|
---|
[204] | 877 | serverconfig_EACEnabled_Default() {
|
---|
[67] | 878 | echo "true"
|
---|
| 879 | }
|
---|
[204] | 880 | serverconfig_EACEnabled_ErrorMessage() {
|
---|
[67] | 881 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 882 | }
|
---|
| 883 |
|
---|
| 884 |
|
---|
| 885 |
|
---|
| 886 |
|
---|
[23] | 887 | #################################
|
---|
| 888 | ## Edit option functions
|
---|
| 889 |
|
---|
| 890 | configEditServer() {
|
---|
| 891 | local CV
|
---|
| 892 |
|
---|
| 893 | echo "Server"
|
---|
| 894 | echo "--------------------------------"
|
---|
| 895 | for CV in \
|
---|
[344] | 896 | ServerName ServerPassword ServerVisibility ServerPort ServerDisabledNetworkProtocols ServerDescription ServerWebsiteURL \
|
---|
[302] | 897 | HideCommandExecutionLog MaxUncoveredMapChunksPerPlayer EACEnabled MaxSpawnedZombies MaxSpawnedAnimals \
|
---|
[23] | 898 | ; do
|
---|
[24] | 899 | $1 $CV
|
---|
[23] | 900 | done
|
---|
| 901 | echo
|
---|
| 902 | }
|
---|
| 903 |
|
---|
[302] | 904 | configEditSlots() {
|
---|
| 905 | local CV
|
---|
| 906 |
|
---|
| 907 | echo "Slots"
|
---|
| 908 | echo "--------------------------------"
|
---|
| 909 | for CV in \
|
---|
| 910 | ServerMaxPlayerCount ServerReservedSlots ServerReservedSlotsPermission ServerAdminSlots ServerAdminSlotsPermission \
|
---|
| 911 | ; do
|
---|
| 912 | $1 $CV
|
---|
| 913 | done
|
---|
| 914 | echo
|
---|
| 915 | }
|
---|
| 916 |
|
---|
[23] | 917 | configEditRemoteControl() {
|
---|
| 918 | local CV
|
---|
| 919 |
|
---|
| 920 | echo "Remote control"
|
---|
| 921 | echo "--------------------------------"
|
---|
| 922 | for CV in \
|
---|
| 923 | ControlPanelEnabled ControlPanelPort ControlPanelPassword \
|
---|
[344] | 924 | TelnetPort TelnetPassword TelnetFailedLoginLimit TelnetFailedLoginsBlocktime \
|
---|
[23] | 925 | ; do
|
---|
| 926 | if [ "$CV" = "TelnetPort" ]; then
|
---|
| 927 | echo
|
---|
| 928 | echo "NOTE: Telnet will always be enabled for management purposes!"
|
---|
[88] | 929 | echo "Make sure you block external access to this port or set no password"
|
---|
| 930 | echo "so the server will only listen on the loopback interface!"
|
---|
[23] | 931 | echo
|
---|
| 932 | fi
|
---|
[24] | 933 | $1 $CV
|
---|
[23] | 934 | done
|
---|
| 935 | echo
|
---|
| 936 | }
|
---|
| 937 |
|
---|
| 938 | configEditGameType() {
|
---|
| 939 | local CV
|
---|
| 940 |
|
---|
| 941 | echo "Game type"
|
---|
| 942 | echo "--------------------------------"
|
---|
| 943 | for CV in \
|
---|
[344] | 944 | GameName GameWorld WorldGenSeed WorldGenSize GameMode \
|
---|
[23] | 945 | ; do
|
---|
[24] | 946 | $1 $CV
|
---|
[23] | 947 | done
|
---|
| 948 | echo
|
---|
| 949 | }
|
---|
| 950 |
|
---|
| 951 | configEditGeneric() {
|
---|
| 952 | local CV
|
---|
| 953 |
|
---|
| 954 | echo "Generic options"
|
---|
| 955 | echo "--------------------------------"
|
---|
| 956 | for CV in \
|
---|
[344] | 957 | PartySharedKillRange PlayerKillingMode PersistentPlayerProfiles \
|
---|
[294] | 958 | PlayerSafeZoneLevel PlayerSafeZoneHours \
|
---|
| 959 | BuildCreate \
|
---|
[23] | 960 | BlockDurabilityModifier \
|
---|
| 961 | ; do
|
---|
[24] | 962 | $1 $CV
|
---|
[23] | 963 | done
|
---|
| 964 | echo
|
---|
| 965 | }
|
---|
| 966 |
|
---|
| 967 | configEditDropLoot() {
|
---|
| 968 | local CV
|
---|
| 969 |
|
---|
| 970 | echo "Drop and Loot"
|
---|
| 971 | echo "--------------------------------"
|
---|
| 972 | for CV in \
|
---|
| 973 | DropOnDeath DropOnQuit \
|
---|
[294] | 974 | LootAbundance LootRespawnDays \
|
---|
| 975 | AirDropFrequency AirDropMarker \
|
---|
[23] | 976 | ; do
|
---|
[24] | 977 | $1 $CV
|
---|
[23] | 978 | done
|
---|
| 979 | echo
|
---|
| 980 | }
|
---|
| 981 |
|
---|
| 982 | configEditTimes() {
|
---|
| 983 | local CV
|
---|
| 984 |
|
---|
| 985 | echo "Times / Durations"
|
---|
| 986 | echo "--------------------------------"
|
---|
| 987 | for CV in \
|
---|
[239] | 988 | DayNightLength DayLightLength \
|
---|
[23] | 989 | ; do
|
---|
[24] | 990 | $1 $CV
|
---|
[23] | 991 | done
|
---|
| 992 | echo
|
---|
| 993 | }
|
---|
| 994 |
|
---|
| 995 | configEditDifficulty() {
|
---|
| 996 | local CV
|
---|
| 997 |
|
---|
| 998 | echo "Difficulty"
|
---|
| 999 | echo "--------------------------------"
|
---|
| 1000 | for CV in \
|
---|
[344] | 1001 | GameDifficulty ZombieMove ZombieMoveNight ZombieFeralMove ZombieBMMove \
|
---|
[302] | 1002 | EnemySpawnMode EnemyDifficulty \
|
---|
| 1003 | BloodMoonEnemyCount BedrollDeadZoneSize \
|
---|
[23] | 1004 | ; do
|
---|
[24] | 1005 | $1 $CV
|
---|
[23] | 1006 | done
|
---|
| 1007 | echo
|
---|
| 1008 | }
|
---|
| 1009 |
|
---|
| 1010 | configEditLandClaim() {
|
---|
| 1011 | local CV
|
---|
| 1012 |
|
---|
| 1013 | echo "Land claim options"
|
---|
| 1014 | echo "--------------------------------"
|
---|
| 1015 | for CV in \
|
---|
| 1016 | LandClaimSize LandClaimDeadZone LandClaimExpiryTime LandClaimDecayMode \
|
---|
| 1017 | LandClaimOnlineDurabilityModifier LandClaimOfflineDurabilityModifier \
|
---|
| 1018 | ; do
|
---|
[24] | 1019 | $1 $CV
|
---|
[23] | 1020 | done
|
---|
| 1021 | echo
|
---|
| 1022 | }
|
---|
| 1023 |
|
---|
| 1024 | configEditAll() {
|
---|
[24] | 1025 | configEditServer "$1"
|
---|
[303] | 1026 | configEditSlots "$1"
|
---|
[24] | 1027 | configEditRemoteControl "$1"
|
---|
| 1028 | configEditGameType "$1"
|
---|
| 1029 | configEditGeneric "$1"
|
---|
| 1030 | configEditDropLoot "$1"
|
---|
| 1031 | configEditTimes "$1"
|
---|
| 1032 | configEditDifficulty "$1"
|
---|
| 1033 | configEditLandClaim "$1"
|
---|
[23] | 1034 | }
|
---|
| 1035 |
|
---|
| 1036 |
|
---|
| 1037 |
|
---|
| 1038 |
|
---|
| 1039 |
|
---|
| 1040 | #################################
|
---|
| 1041 | ## Generic worker functions
|
---|
| 1042 |
|
---|
| 1043 |
|
---|
| 1044 | # List all defined config editing parts
|
---|
| 1045 | # Returns:
|
---|
| 1046 | # List of config funcs
|
---|
| 1047 | listConfigEditFuncs() {
|
---|
| 1048 | local CV
|
---|
| 1049 | for CV in $(declare -F | cut -d\ -f3 | grep "^configEdit.*$"); do
|
---|
| 1050 | CV=${CV#configEdit}
|
---|
| 1051 | printf "%s " "$CV"
|
---|
| 1052 | done
|
---|
| 1053 | }
|
---|
| 1054 |
|
---|
| 1055 |
|
---|
| 1056 | # List all defined config options
|
---|
| 1057 | # Returns:
|
---|
| 1058 | # List of defined config options
|
---|
[19] | 1059 | listConfigValues() {
|
---|
| 1060 | local CV
|
---|
| 1061 | for CV in $(declare -F | cut -d\ -f3 | grep "^serverconfig_.*_Type$"); do
|
---|
| 1062 | CV=${CV#serverconfig_}
|
---|
| 1063 | CV=${CV%_Type}
|
---|
| 1064 | printf "%s " "$CV"
|
---|
| 1065 | done
|
---|
| 1066 | }
|
---|
| 1067 |
|
---|
| 1068 |
|
---|
[23] | 1069 | # Validate the given value for the given option
|
---|
| 1070 | # Params:
|
---|
| 1071 | # 1: Option name
|
---|
| 1072 | # 2: Value
|
---|
| 1073 | # Returns:
|
---|
| 1074 | # 0/1: invalid/valid
|
---|
[19] | 1075 | isValidOptionValue() {
|
---|
| 1076 | local TYPE=$(serverconfig_$1_Type)
|
---|
| 1077 | local RANGE=""
|
---|
| 1078 |
|
---|
| 1079 | if [ "$TYPE" = "enum" ]; then
|
---|
| 1080 | TYPE="number"
|
---|
| 1081 | serverconfig_$1_Values
|
---|
| 1082 | RANGE=1-${#config_allowed_values[@]}
|
---|
| 1083 | else
|
---|
| 1084 | if [ "$(type -t serverconfig_$1_Range)" = "function" ]; then
|
---|
| 1085 | RANGE=$(serverconfig_$1_Range)
|
---|
| 1086 | fi
|
---|
| 1087 | fi
|
---|
| 1088 |
|
---|
| 1089 | case "$TYPE" in
|
---|
| 1090 | number)
|
---|
| 1091 | if [ $(isANumber "$2") -eq 0 ]; then
|
---|
| 1092 | echo "0"
|
---|
| 1093 | return
|
---|
| 1094 | fi
|
---|
| 1095 | if [ ! -z "$RANGE" ]; then
|
---|
| 1096 | local MIN=$(cut -d- -f1 <<< "$RANGE")
|
---|
| 1097 | local MAX=$(cut -d- -f2 <<< "$RANGE")
|
---|
| 1098 | if [ $2 -lt $MIN -o $2 -gt $MAX ]; then
|
---|
| 1099 | echo "0"
|
---|
| 1100 | return
|
---|
| 1101 | fi
|
---|
| 1102 | fi
|
---|
| 1103 | ;;
|
---|
| 1104 | boolean)
|
---|
| 1105 | if [ $(isABool "$2") -eq 0 ]; then
|
---|
| 1106 | echo "0"
|
---|
| 1107 | return
|
---|
| 1108 | fi
|
---|
| 1109 | ;;
|
---|
| 1110 | string)
|
---|
| 1111 | ;;
|
---|
| 1112 | esac
|
---|
| 1113 |
|
---|
| 1114 |
|
---|
| 1115 | if [ "$(type -t serverconfig_$1_Validate)" = "function" ]; then
|
---|
| 1116 | if [ $(serverconfig_$1_Validate "$2") -eq 0 ]; then
|
---|
| 1117 | echo "0"
|
---|
| 1118 | return
|
---|
| 1119 | fi
|
---|
| 1120 | fi
|
---|
| 1121 |
|
---|
| 1122 | echo "1"
|
---|
| 1123 | }
|
---|
| 1124 |
|
---|
[23] | 1125 | # Query for the value of a single config option
|
---|
| 1126 | # Will be stored in $configCurrent_$1
|
---|
| 1127 | # Params:
|
---|
| 1128 | # 1: Option name
|
---|
[19] | 1129 | configQueryValue() {
|
---|
| 1130 | local TYPE=$(serverconfig_$1_Type)
|
---|
| 1131 | local NAME=""
|
---|
| 1132 | local RANGE=""
|
---|
| 1133 | local DEFAULT=""
|
---|
| 1134 | local currentValName=configCurrent_$1
|
---|
| 1135 |
|
---|
| 1136 | if [ "$(type -t serverconfig_$1_Values)" = "function" ]; then
|
---|
| 1137 | echo "$(serverconfig_$1_QueryName), options:"
|
---|
| 1138 | serverconfig_$1_Values
|
---|
| 1139 | NAME="Select option"
|
---|
| 1140 | if [ "$TYPE" = "enum" ]; then
|
---|
| 1141 | local OPTOFFSET=1
|
---|
| 1142 | else
|
---|
| 1143 | local OPTOFFSET=0
|
---|
| 1144 | fi
|
---|
| 1145 | for (( i=$OPTOFFSET; i < ${#config_allowed_values[@]}+$OPTOFFSET; i++ )); do
|
---|
| 1146 | printf " %2d: %s\n" $i "${config_allowed_values[$i-$OPTOFFSET]}"
|
---|
| 1147 | done
|
---|
| 1148 | else
|
---|
| 1149 | NAME=$(serverconfig_$1_QueryName)
|
---|
| 1150 | fi
|
---|
| 1151 |
|
---|
| 1152 | if [ "$TYPE" = "enum" ]; then
|
---|
| 1153 | RANGE=1-${#config_allowed_values[@]}
|
---|
| 1154 | if [ ! -z "${!currentValName}" ]; then
|
---|
| 1155 | for (( i=1; i < ${#config_allowed_values[@]}+1; i++ )); do
|
---|
| 1156 | if [ "${!currentValName}" = "${config_allowed_values[$i-1]}" ]; then
|
---|
| 1157 | DEFAULT=$i
|
---|
| 1158 | fi
|
---|
| 1159 | done
|
---|
| 1160 | export $currentValName=
|
---|
| 1161 | fi
|
---|
| 1162 | else
|
---|
| 1163 | if [ "$(type -t serverconfig_$1_Range)" = "function" ]; then
|
---|
| 1164 | RANGE=$(serverconfig_$1_Range)
|
---|
| 1165 | fi
|
---|
| 1166 | fi
|
---|
| 1167 |
|
---|
| 1168 | if [ -z "$DEFAULT" ]; then
|
---|
| 1169 | if [ ! -z "${!currentValName}" ]; then
|
---|
| 1170 | DEFAULT=${!currentValName}
|
---|
| 1171 | else
|
---|
| 1172 | if [ "$(type -t serverconfig_$1_Default)" = "function" ]; then
|
---|
| 1173 | DEFAULT=$(serverconfig_$1_Default)
|
---|
| 1174 | fi
|
---|
| 1175 | fi
|
---|
| 1176 | fi
|
---|
| 1177 |
|
---|
| 1178 | local prompt=$(printf "%s" "$NAME")
|
---|
| 1179 | if [ ! -z "$RANGE" ]; then
|
---|
| 1180 | prompt=$(printf "%s (%s)" "$prompt" "$RANGE")
|
---|
| 1181 | fi
|
---|
| 1182 | if [ ! -z "$DEFAULT" ]; then
|
---|
| 1183 | prompt=$(printf "%s [%s]" "$prompt" "$DEFAULT")
|
---|
| 1184 | fi
|
---|
| 1185 | prompt=$(printf "%s:" "$prompt")
|
---|
[24] | 1186 | prompt=$(printf "%-*s " 40 "$prompt")
|
---|
[19] | 1187 |
|
---|
| 1188 | while : ; do
|
---|
| 1189 | read -p "$prompt" $currentValName
|
---|
| 1190 | export $currentValName="${!currentValName:-$DEFAULT}"
|
---|
| 1191 | if [ $(isValidOptionValue "$1" "${!currentValName}") -eq 0 ]; then
|
---|
| 1192 | if [ "$(type -t serverconfig_$1_ErrorMessage)" = "function" ]; then
|
---|
| 1193 | serverconfig_$1_ErrorMessage "${!currentValName}"
|
---|
| 1194 | fi
|
---|
| 1195 | fi
|
---|
| 1196 | [ $(isValidOptionValue "$1" "${!currentValName}") -eq 1 ] && break
|
---|
| 1197 | done
|
---|
| 1198 |
|
---|
[45] | 1199 | if [ "$TYPE" = "boolean" ]; then
|
---|
| 1200 | if [ $(getBool ${!currentValName}) -eq 1 ]; then
|
---|
| 1201 | export $currentValName="true"
|
---|
| 1202 | else
|
---|
| 1203 | export $currentValName="false"
|
---|
| 1204 | fi
|
---|
| 1205 | fi
|
---|
[19] | 1206 | if [ "$TYPE" = "enum" ]; then
|
---|
| 1207 | export $currentValName="${config_allowed_values[$currentValName-1]}"
|
---|
| 1208 | fi
|
---|
[24] | 1209 | echo
|
---|
[19] | 1210 | }
|
---|
| 1211 |
|
---|
[23] | 1212 | # Set parameters for current instance that have forced values:
|
---|
| 1213 | # - TelnetEnabled must be set so that management scripts can work
|
---|
| 1214 | # - AdminFileName is made to point to the local instance admins.xml
|
---|
| 1215 | # - SaveGameFolder is made to point to the instance folder
|
---|
| 1216 | # Params:
|
---|
[19] | 1217 | # 1: Instance name
|
---|
| 1218 | configSetAutoParameters() {
|
---|
| 1219 | configCurrent_TelnetEnabled=true
|
---|
| 1220 | configCurrent_AdminFileName=admins.xml
|
---|
[35] | 1221 | configCurrent_SaveGameFolder="$(getInstancePath "$1")"
|
---|
[19] | 1222 | }
|
---|
| 1223 |
|
---|
| 1224 |
|
---|
[24] | 1225 | # Print defined config value
|
---|
| 1226 | # Params:
|
---|
| 1227 | # 1: Config option
|
---|
| 1228 | printConfigValue() {
|
---|
| 1229 | local currentValName=configCurrent_$1
|
---|
| 1230 | printf "%-25s = %s\n" "$(serverconfig_$1_QueryName)" "${!currentValName}"
|
---|
[19] | 1231 | }
|
---|
| 1232 |
|
---|
[23] | 1233 | # Query for an instance name (will be saved in $INSTANCE)
|
---|
[19] | 1234 | readInstanceName() {
|
---|
| 1235 | until [ $(isValidInstanceName "$INSTANCE") -eq 1 ]; do
|
---|
| 1236 | read -p "Instance name: " INSTANCE
|
---|
| 1237 | if [ $(isValidInstanceName "$INSTANCE") -eq 0 ]; then
|
---|
| 1238 | echo "Invalid instance name, may only contain:"
|
---|
| 1239 | echo " - letters (A-Z / a-z)"
|
---|
| 1240 | echo " - digits (0-9)"
|
---|
| 1241 | echo " - underscores (_)"
|
---|
| 1242 | echo " - hyphens (-)"
|
---|
| 1243 | fi
|
---|
| 1244 | done
|
---|
| 1245 | }
|
---|
| 1246 |
|
---|
[23] | 1247 | # Undefine the current config values
|
---|
[19] | 1248 | unsetAllConfigValues() {
|
---|
| 1249 | local CV
|
---|
| 1250 | for CV in $(listConfigValues); do
|
---|
| 1251 | local currentValName=configCurrent_$CV
|
---|
| 1252 | export $currentValName=
|
---|
| 1253 | done
|
---|
| 1254 | }
|
---|
| 1255 |
|
---|
[23] | 1256 | # Load all config values from the config.xml of the given instance
|
---|
| 1257 | # Params:
|
---|
[19] | 1258 | # 1: Instance name
|
---|
| 1259 | loadCurrentConfigValues() {
|
---|
| 1260 | local CV
|
---|
| 1261 | for CV in $(listConfigValues); do
|
---|
| 1262 | local currentValName=configCurrent_$CV
|
---|
| 1263 | local cfile=$(getInstancePath "$1")/config.xml
|
---|
| 1264 | local XPATH="/ServerSettings/property[@name='$CV']/@value"
|
---|
| 1265 | local VAL=$($XMLSTARLET sel -t -v "$XPATH" $cfile)
|
---|
| 1266 | if [ ! -z "$VAL" ]; then
|
---|
| 1267 | export $currentValName="$VAL"
|
---|
| 1268 | fi
|
---|
| 1269 | done
|
---|
| 1270 | }
|
---|
| 1271 |
|
---|
[23] | 1272 | # Save all config values to the config.xml of the given instance
|
---|
| 1273 | # Params:
|
---|
[19] | 1274 | # 1: Instance name
|
---|
| 1275 | saveCurrentConfigValues() {
|
---|
| 1276 | local CV
|
---|
| 1277 | for CV in $(listConfigValues) TelnetEnabled AdminFileName SaveGameFolder; do
|
---|
| 1278 | local currentValName=configCurrent_$CV
|
---|
| 1279 | local val="${!currentValName}"
|
---|
| 1280 | local cfile=$(getInstancePath "$1")/config.xml
|
---|
| 1281 |
|
---|
| 1282 | XPATHBASE="/ServerSettings/property[@name='$CV']"
|
---|
| 1283 |
|
---|
| 1284 | if [ -z $($XMLSTARLET sel -t -v "$XPATHBASE/@name" $cfile) ]; then
|
---|
| 1285 | $XMLSTARLET ed -L \
|
---|
| 1286 | -s "/ServerSettings" -t elem -n "property" -v "" \
|
---|
| 1287 | -i "/ServerSettings/property[not(@name)]" -t attr -n "name" -v "$CV" \
|
---|
| 1288 | -i "$XPATHBASE" -t attr -n "value" -v "$val" \
|
---|
| 1289 | $cfile
|
---|
| 1290 | else
|
---|
| 1291 | $XMLSTARLET ed -L \
|
---|
| 1292 | -u "$XPATHBASE/@value" -v "$val" \
|
---|
| 1293 | $cfile
|
---|
| 1294 | fi
|
---|
| 1295 | done
|
---|
| 1296 | }
|
---|
| 1297 |
|
---|
[23] | 1298 | # Check if the config template exists
|
---|
| 1299 | # Returns:
|
---|
| 1300 | # 0/1: no/yes
|
---|
[19] | 1301 | configTemplateExists() {
|
---|
| 1302 | if [ -f $SDTD_BASE/templates/config.xml ]; then
|
---|
| 1303 | echo 1
|
---|
| 1304 | else
|
---|
| 1305 | echo 0
|
---|
| 1306 | fi
|
---|
| 1307 | }
|
---|
| 1308 |
|
---|
| 1309 | # Get a single value from a serverconfig
|
---|
| 1310 | # Params:
|
---|
| 1311 | # 1: Instance name
|
---|
| 1312 | # 2: Property name
|
---|
| 1313 | # Returns:
|
---|
| 1314 | # Property value
|
---|
| 1315 | getConfigValue() {
|
---|
| 1316 | local CONF=$(getInstancePath $1)/config.xml
|
---|
| 1317 | $XMLSTARLET sel -t -v "/ServerSettings/property[@name='$2']/@value" $CONF
|
---|
| 1318 | }
|
---|
| 1319 |
|
---|
| 1320 | # Update a single value in a serverconfig
|
---|
| 1321 | # Params:
|
---|
| 1322 | # 1: Instance name
|
---|
| 1323 | # 2: Property name
|
---|
| 1324 | # 3: New value
|
---|
| 1325 | setConfigValue() {
|
---|
| 1326 | local CONF=$(getInstancePath $1)/config.xml
|
---|
| 1327 | $XMLSTARLET ed -L -u "/ServerSettings/property[@name='$2']/@value" -v "$3" $CONF
|
---|
| 1328 | }
|
---|
| 1329 |
|
---|