From 3e8497db2ddf715b195d4d222e03e574ec4c7e64 Mon Sep 17 00:00:00 2001 From: sitisll Date: Tue, 14 Feb 2023 15:51:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B0=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=84=D0=B8=D0=B3=D0=B0=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 111.py | 0 dodo.py | 62 +++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 22 deletions(-) create mode 100644 111.py diff --git a/111.py b/111.py new file mode 100644 index 0000000..e69de29 diff --git a/dodo.py b/dodo.py index 4847fa0..c9b7020 100755 --- a/dodo.py +++ b/dodo.py @@ -18,14 +18,16 @@ def dodo(): pass list_config = next(os.walk(config_dodo), (None, None, []))[2] # [] if no file -list_config.remove('.directory') +x = list_config.count('.directory') +if x>0: + list_config.remove('.directory') def print_line(text): "Добавление тире вокруг текста, потом сюда можно поместить и расскраску текста" - print(Fore.YELLOW + "-"*25) - print(Fore.GREEN + text) - print(Fore.YELLOW + "-"*25 + Fore.RESET_ALL) + print(colorama.Fore.YELLOW + "-"*25) + print(colorama.Fore.GREEN + text) + print(colorama.Fore.YELLOW + "-"*25 + colorama.Style.RESET_ALL) def create_dir(directory): @@ -40,7 +42,7 @@ def check_int(number=""): try: x = input(number) if x == "": - return x + return 0 x = x.replace(' ', '') x = x.replace(',', '') x = int(x) @@ -72,7 +74,7 @@ def config(map_server=list_config): 1. Да 2. Нет : """) - if count_cluster == "": + if count_cluster == 0: count_cluster = 2 if count_cluster == 1: cluster_server = True @@ -90,7 +92,7 @@ def config(map_server=list_config): print(i) count_maps = check_int("Укажите количество карт: \n") - if count_maps == "": + if count_maps == 0: count_maps = 1 for i in range(count_maps): while True: @@ -110,10 +112,10 @@ def config(map_server=list_config): 11. Lost Island 12. Fjordur : """) + if amount_map == 0: + amount_map = i + 1 if 0: \n") - if port_server == "": + if port_server == 0: if port_s == []: port_server = 7777 else: @@ -157,7 +159,7 @@ def config(map_server=list_config): break while True: query_port = check_int("Укажите Query-порт Сервера <27015>: \n") - if query_port == "": + if query_port == 0: if query_p == []: query_port = 27015 else: @@ -196,7 +198,26 @@ def yaml_create(cluster_server, map_server, name_server, port_server, query_port settings_dodo[0]['clusterdir'] = cluster_dir_override with open(config_dodo + f"{map_server[-1]}", 'w') as yamlfile: data = yaml.dump(settings_dodo, yamlfile) - print(Fore.GREEN + "Конфиг создан" + Fore.RESET_ALL) + print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) +@dodo.command() +def servers(map_servers=list_config): + if map_servers==[]: + print("Сервера не установлены") + else: + for i in map_servers: + cluster_server, name_server, port_server, query_port, password_server, max_players, dir_server, mods_id, listen_server, cluster_id, cluster_dir_ovverride = read_yaml(i) + print(f""" + Сервер: {i} + Имя сервера: {name_server} + Кластер: {cluster_server} + Порт сервера: {port_server} + Query порт: {query_port} + Пароль: {password_server} + Максимальное кол-во игроков: {max_players} + Моды: {mods_id} + Кластер id: {cluster_id}""") + print("\n") + @dodo.command() def start(map_server=list_config): @@ -204,16 +225,13 @@ def start(map_server=list_config): while True: "Проверка на выбор имеющихся карт" for i in range(len(map_server)): - print(f"{i}) {map_server[i]}") - map_list = check_int(map_server) - for k in range(map_list): - if 0>map_list[k]>len(map_list) and len(map_list)>len(map_server): - print("Укажите карты для установки в формате 1,3,5 или 145 или 1 2 3") - else: - break - - - + print(f"{i+1}) {map_server[i]}") + map_list = check_int("\n") + #for k in range(map_list): + # if 0>int(map_list[k])>map_list and len(str(map_list))>len(str(map_server)): + # print("Укажите карты для установки в формате 1,3,5 или 145 или 1 2 3") + # else: + break for j in str(map_list): map_choise.append(map_server[int(j) - 1])