From ae021ac7eaceb0bc5cdbaf623d17c3abd42e56e7 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 4 Nov 2023 23:43:54 +0100 Subject: [PATCH] Added custom level header to make multi env compatible --- .../config/default-level.development.json | 31 +++++++++++++++++++ .../config/default-level.edrafts-lapi.json | 31 +++++++++++++++++++ .../config/default-level.edrafts-pc.json | 31 +++++++++++++++++++ .../level/{ => config}/default-level.json | 0 .../level/config/default-level.staging.json | 31 +++++++++++++++++++ bot/src/modules/level/level_module.py | 4 ++- 6 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 bot/src/modules/level/config/default-level.development.json create mode 100644 bot/src/modules/level/config/default-level.edrafts-lapi.json create mode 100644 bot/src/modules/level/config/default-level.edrafts-pc.json rename bot/src/modules/level/{ => config}/default-level.json (100%) create mode 100644 bot/src/modules/level/config/default-level.staging.json diff --git a/bot/src/modules/level/config/default-level.development.json b/bot/src/modules/level/config/default-level.development.json new file mode 100644 index 00000000..b07cc047 --- /dev/null +++ b/bot/src/modules/level/config/default-level.development.json @@ -0,0 +1,31 @@ +{ + "DefaultLevel": { + "LevelHeader": "~~~ dev-Level ~~~", + "Levels": [ + { + "Name": "dev-Newbie", + "Color": "0x1abc9c", + "MinXp": 0, + "Permissions": 968552209984 + }, + { + "Name": "dev-Keks", + "Color": "0x2ecc71", + "MinXp": 100, + "Permissions": 1002928856640 + }, + { + "Name": "dev-Doppelkeks", + "Color": "0x3498db", + "MinXp": 200, + "Permissions": 1071849660224 + }, + { + "Name": "dev-Auror", + "Color": "0xf1c40f", + "MinXp": 300, + "Permissions": 1089042120513 + } + ] + } +} \ No newline at end of file diff --git a/bot/src/modules/level/config/default-level.edrafts-lapi.json b/bot/src/modules/level/config/default-level.edrafts-lapi.json new file mode 100644 index 00000000..dfe52d5b --- /dev/null +++ b/bot/src/modules/level/config/default-level.edrafts-lapi.json @@ -0,0 +1,31 @@ +{ + "DefaultLevel": { + "LevelHeader": "~~~ ed-Level ~~~", + "Levels": [ + { + "Name": "ed-Newbie", + "Color": "0x1abc9c", + "MinXp": 0, + "Permissions": 968552209984 + }, + { + "Name": "ed-Keks", + "Color": "0x2ecc71", + "MinXp": 100, + "Permissions": 1002928856640 + }, + { + "Name": "ed-Doppelkeks", + "Color": "0x3498db", + "MinXp": 200, + "Permissions": 1071849660224 + }, + { + "Name": "ed-Auror", + "Color": "0xf1c40f", + "MinXp": 300, + "Permissions": 1089042120513 + } + ] + } +} \ No newline at end of file diff --git a/bot/src/modules/level/config/default-level.edrafts-pc.json b/bot/src/modules/level/config/default-level.edrafts-pc.json new file mode 100644 index 00000000..dfe52d5b --- /dev/null +++ b/bot/src/modules/level/config/default-level.edrafts-pc.json @@ -0,0 +1,31 @@ +{ + "DefaultLevel": { + "LevelHeader": "~~~ ed-Level ~~~", + "Levels": [ + { + "Name": "ed-Newbie", + "Color": "0x1abc9c", + "MinXp": 0, + "Permissions": 968552209984 + }, + { + "Name": "ed-Keks", + "Color": "0x2ecc71", + "MinXp": 100, + "Permissions": 1002928856640 + }, + { + "Name": "ed-Doppelkeks", + "Color": "0x3498db", + "MinXp": 200, + "Permissions": 1071849660224 + }, + { + "Name": "ed-Auror", + "Color": "0xf1c40f", + "MinXp": 300, + "Permissions": 1089042120513 + } + ] + } +} \ No newline at end of file diff --git a/bot/src/modules/level/default-level.json b/bot/src/modules/level/config/default-level.json similarity index 100% rename from bot/src/modules/level/default-level.json rename to bot/src/modules/level/config/default-level.json diff --git a/bot/src/modules/level/config/default-level.staging.json b/bot/src/modules/level/config/default-level.staging.json new file mode 100644 index 00000000..abc65e87 --- /dev/null +++ b/bot/src/modules/level/config/default-level.staging.json @@ -0,0 +1,31 @@ +{ + "DefaultLevel": { + "LevelHeader": "~~~ test-Level ~~~", + "Levels": [ + { + "Name": "test-Newbie", + "Color": "0x1abc9c", + "MinXp": 0, + "Permissions": 968552209984 + }, + { + "Name": "test-Keks", + "Color": "0x2ecc71", + "MinXp": 100, + "Permissions": 1002928856640 + }, + { + "Name": "test-Doppelkeks", + "Color": "0x3498db", + "MinXp": 200, + "Permissions": 1071849660224 + }, + { + "Name": "test-Auror", + "Color": "0xf1c40f", + "MinXp": 300, + "Permissions": 1089042120513 + } + ] + } +} \ No newline at end of file diff --git a/bot/src/modules/level/level_module.py b/bot/src/modules/level/level_module.py index 500e4a01..4eb6d4ae 100644 --- a/bot/src/modules/level/level_module.py +++ b/bot/src/modules/level/level_module.py @@ -32,7 +32,9 @@ class LevelModule(ModuleABC): def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): cwd = env.working_directory env.set_working_directory(os.path.dirname(os.path.realpath(__file__))) - config.add_json_file(f"default-level.json", optional=False) + config.add_json_file(f"config/default-level.json", optional=False) + config.add_json_file(f"config/default-level.{env.environment_name}.json", optional=True) + config.add_json_file(f"config/default-level.{env.host_name}.json", optional=True) env.set_working_directory(cwd) def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):