-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better tokenizing of PalWorldSettings.ini - Will allow commas and quo…
…tes in string fields #4 Adding test cases
- Loading branch information
mphelan
committed
Jan 29, 2024
1 parent
eb68074
commit 93a4c46
Showing
32 changed files
with
340 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(bEnablePlayerToPlayerDamage=0,bEnableFriendlyFire=0,bEnableInvaderEnemy=0,bActiveUNKO=0,bEnableAimAssistPad=0,bEnableAimAssistKeyboard=0,bAutoResetGuildNoOnlinePlayers=0,bIsMultiplay=0,bIsPvP=0,bCanPickupOtherGuildDeathPenaltyDrop=0,bEnableNonLoginPenalty=0,bEnableFastTravel=0,bIsStartLocationSelectByMap=0,bExistPlayerAfterLogout=0,bEnableDefenseOtherGuildPlayer=0,RCONEnabled=0,bUseAuth=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(bEnablePlayerToPlayerDamage=false,bEnableFriendlyFire=false,bEnableInvaderEnemy=false,bActiveUNKO=false,bEnableAimAssistPad=false,bEnableAimAssistKeyboard=false,bAutoResetGuildNoOnlinePlayers=false,bIsMultiplay=false,bIsPvP=false,bCanPickupOtherGuildDeathPenaltyDrop=false,bEnableNonLoginPenalty=false,bEnableFastTravel=false,bIsStartLocationSelectByMap=false,bExistPlayerAfterLogout=false,bEnableDefenseOtherGuildPlayer=false,RCONEnabled=false,bUseAuth=false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(bEnablePlayerToPlayerDamage=FALSE,bEnableFriendlyFire=FALSE,bEnableInvaderEnemy=FALSE,bActiveUNKO=FALSE,bEnableAimAssistPad=FALSE,bEnableAimAssistKeyboard=FALSE,bAutoResetGuildNoOnlinePlayers=FALSE,bIsMultiplay=FALSE,bIsPvP=FALSE,bCanPickupOtherGuildDeathPenaltyDrop=FALSE,bEnableNonLoginPenalty=FALSE,bEnableFastTravel=FALSE,bIsStartLocationSelectByMap=FALSE,bExistPlayerAfterLogout=FALSE,bEnableDefenseOtherGuildPlayer=FALSE,RCONEnabled=FALSE,bUseAuth=FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(bEnablePlayerToPlayerDamage=1,bEnableFriendlyFire=1,bEnableInvaderEnemy=1,bActiveUNKO=1,bEnableAimAssistPad=1,bEnableAimAssistKeyboard=1,bAutoResetGuildNoOnlinePlayers=1,bIsMultiplay=1,bIsPvP=1,bCanPickupOtherGuildDeathPenaltyDrop=1,bEnableNonLoginPenalty=1,bEnableFastTravel=1,bIsStartLocationSelectByMap=1,bExistPlayerAfterLogout=1,bEnableDefenseOtherGuildPlayer=1,RCONEnabled=1,bUseAuth=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(bEnablePlayerToPlayerDamage=true,bEnableFriendlyFire=true,bEnableInvaderEnemy=true,bActiveUNKO=true,bEnableAimAssistPad=true,bEnableAimAssistKeyboard=true,bAutoResetGuildNoOnlinePlayers=true,bIsMultiplay=true,bIsPvP=true,bCanPickupOtherGuildDeathPenaltyDrop=true,bEnableNonLoginPenalty=true,bEnableFastTravel=true,bIsStartLocationSelectByMap=true,bExistPlayerAfterLogout=true,bEnableDefenseOtherGuildPlayer=true,RCONEnabled=true,bUseAuth=true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(bEnablePlayerToPlayerDamage=TRUE,bEnableFriendlyFire=TRUE,bEnableInvaderEnemy=TRUE,bActiveUNKO=TRUE,bEnableAimAssistPad=TRUE,bEnableAimAssistKeyboard=TRUE,bAutoResetGuildNoOnlinePlayers=TRUE,bIsMultiplay=TRUE,bIsPvP=TRUE,bCanPickupOtherGuildDeathPenaltyDrop=TRUE,bEnableNonLoginPenalty=TRUE,bEnableFastTravel=TRUE,bIsStartLocationSelectByMap=TRUE,bExistPlayerAfterLogout=TRUE,bEnableDefenseOtherGuildPlayer=TRUE,RCONEnabled=TRUE,bUseAuth=TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=All) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=Item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=ItemAndEquipment) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
; This configuration file is a sample of the default server settings. | ||
; Changes to this file will NOT be reflected on the server. | ||
; To change the server settings, modify Pal/Saved/Config/WindowsServer/PalWorldSettings.ini. | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DeathPenalty=Perma) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DayTimeSpeedRate=1.100000,NightTimeSpeedRate=1.100000,ExpRate=1.100000,PalCaptureRate=1.100000,PalSpawnNumRate=1.100000,PalDamageRateAttack=1.100000,PalDamageRateDefense=1.100000,PlayerDamageRateAttack=1.100000,PlayerDamageRateDefense=1.100000,PlayerStomachDecreaceRate=1.100000,PlayerStaminaDecreaceRate=1.100000,PlayerAutoHPRegeneRate=1.100000,PlayerAutoHpRegeneRateInSleep=1.100000,PalStomachDecreaceRate=1.100000,PalStaminaDecreaceRate=1.100000,PalAutoHPRegeneRate=1.100000,PalAutoHpRegeneRateInSleep=1.100000,BuildObjectDamageRate=1.100000,BuildObjectDeteriorationDamageRate=1.100000,CollectionDropRate=1.100000,CollectionObjectHpRate=1.100000,CollectionObjectRespawnSpeedRate=1.100000,EnemyDropItemRate=1.100000,DropItemAliveMaxHours=1.100000,AutoResetGuildTimeNoOnlinePlayers=72.100000,PalEggDefaultHatchingTime=72.100000,WorkSpeedRate=1.100000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DayTimeSpeedRate=2,NightTimeSpeedRate=2,ExpRate=2,PalCaptureRate=2,PalSpawnNumRate=2,PalDamageRateAttack=2,PalDamageRateDefense=2,PlayerDamageRateAttack=2,PlayerDamageRateDefense=2,PlayerStomachDecreaceRate=2,PlayerStaminaDecreaceRate=2,PlayerAutoHPRegeneRate=2,PlayerAutoHpRegeneRateInSleep=2,PalStomachDecreaceRate=2,PalStaminaDecreaceRate=2,PalAutoHPRegeneRate=2,PalAutoHpRegeneRateInSleep=2,BuildObjectDamageRate=2,BuildObjectDeteriorationDamageRate=2,CollectionDropRate=2,CollectionObjectHpRate=2,CollectionObjectRespawnSpeedRate=2,EnemyDropItemRate=2,DropItemAliveMaxHours=2,AutoResetGuildTimeNoOnlinePlayers=72,PalEggDefaultHatchingTime=72,WorkSpeedRate=2),,,=2,NightTimeSpeedRate=20,ExpRate=2,PalCaptureRate=2,PalSpawnNumRate=2,PalDamageRateAttack=2,PalDamageRateDefense=2,PlayerDamageRateAttack=2,PlayerDamageRateDefense=2,PlayerStomachDecreaceRate=2,PlayerStaminaDecreaceRate=2,PlayerAutoHPRegeneRate=2,PlayerAutoHpRegeneRateInSleep=2,PalStomachDecreaceRate=2,PalStaminaDecreaceRate=2,PalAutoHPRegeneRate=2,PalAutoHpRegeneRateInSleep=2,BuildObjectDamageRate=2,BuildObjectDeteriorationDamageRate=2,CollectionDropRate=2,CollectionObjectHpRate=2,CollectionObjectRespawnSpeedRate=2,EnemyDropItemRate=2,DropItemAliveMaxHours=2,AutoResetGuildTimeNoOnlinePlayers=24,PalEggDefaultHatchingTime=24,WorkSpeedRate=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DropItemMaxNum=2000,DropItemMaxNum_UNKO=50,BaseCampMaxNum=64,BaseCampWorkerMaxNum=20,GuildPlayerMaxNum=40,CoopPlayerMaxNum=8,ServerPlayerMaxNum=20,PublicPort=9000,RCONPort=25576) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(DropItemMaxNum=2000.0,DropItemMaxNum_UNKO=50.0,BaseCampMaxNum=64.0,BaseCampWorkerMaxNum=20.0,GuildPlayerMaxNum=40.0,CoopPlayerMaxNum=8.0,ServerPlayerMaxNum=20.0,PublicPort=9000.0,RCONPort=25576.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(ServerName="MY Palworld Server",ServerDescription="This is my server",AdminPassword="s3cure",ServerPassword="passw0rd",PublicIP="127.0.0.1",Region="Tokyo",BanListURL="https://api.palworldgame.com/api/banlist_test.txt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(ServerName="[MY] Palworld Server",ServerDescription="This is my server",ServerPassword="i,have,commas,") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[/Script/Pal.PalGameWorldSettings] | ||
OptionSettings=(ServerName=""MY" Palworld Server",ServerDescription="This is "my" server",ServerPassword="use"this"password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from lib.palworldsettings import load_palworldsettings, parse_config, generate_json_config | ||
from typing import Dict | ||
import unittest | ||
|
||
|
||
def load_data(path: str) -> Dict: | ||
raw_config = load_palworldsettings(path) | ||
parsed_config = parse_config(raw_config) | ||
return generate_json_config(parsed_config) | ||
|
||
|
||
BoolsFalse = {'bEnableInvaderEnemy': {'Bool': {'value': False}}, 'bEnableAimAssistPad': {'Bool': {'value': False}}, 'bEnableNonLoginPenalty': {'Bool': {'value': False}}, 'bEnableFastTravel': {'Bool': {'value': False}}, 'bIsStartLocationSelectByMap': {'Bool': {'value': False}}, 'bUseAuth': {'Bool': {'value': False}}} | ||
BoolsTrue = {'bEnablePlayerToPlayerDamage': {'Bool': {'value': True}}, 'bEnableFriendlyFire': {'Bool': {'value': True}}, 'bActiveUNKO': {'Bool': {'value': True}}, 'bEnableAimAssistKeyboard': {'Bool': {'value': True}}, 'bAutoResetGuildNoOnlinePlayers': {'Bool': {'value': True}}, 'bIsMultiplay': {'Bool': {'value': True}}, 'bIsPvP': {'Bool':{'value': True}}, 'bCanPickupOtherGuildDeathPenaltyDrop': {'Bool': {'value': True}}, 'bExistPlayerAfterLogout': {'Bool': {'value': True}}, 'bEnableDefenseOtherGuildPlayer': {'Bool': {'value': True}}, 'RCONEnabled': {'Bool': {'value': True}}} | ||
|
||
|
||
class TestBools(unittest.TestCase): | ||
def test_bools_false_upper(self): | ||
data = load_data("tests/configs/BoolsFalseUpper.ini") | ||
assert(BoolsFalse == data) | ||
|
||
def test_bools_false_lower(self): | ||
data = load_data("tests/configs/BoolsFalseLower.ini") | ||
assert(BoolsFalse == data) | ||
|
||
def test_bools_false_int(self): | ||
data = load_data("tests/configs/BoolsFalseInt.ini") | ||
assert(BoolsFalse == data) | ||
|
||
def test_bools_true_upper(self): | ||
data = load_data("tests/configs/BoolsTrueUpper.ini") | ||
assert(BoolsTrue == data) | ||
|
||
def test_bools_true_lower(self): | ||
data = load_data("tests/configs/BoolsTrueLower.ini") | ||
assert(BoolsTrue == data) | ||
|
||
def test_bools_true_int(self): | ||
data = load_data("tests/configs/BoolsTrueInt.ini") | ||
assert(BoolsTrue == data) |
Oops, something went wrong.