разбивка config_ark
This commit is contained in:
parent
43ec0f12d1
commit
8b3aaa3f6a
59
hlna.py
59
hlna.py
@ -199,7 +199,9 @@ def ports(port, ports_arr, flag):
|
||||
return port
|
||||
|
||||
|
||||
def clustering():
|
||||
def config_cluster():
|
||||
cluster_id = ""
|
||||
cluster_dir_override = ""
|
||||
count_cluster = check_int("""Укажите требуется ли кластер? default: Нет
|
||||
1. Да
|
||||
2. Нет
|
||||
@ -216,18 +218,17 @@ def clustering():
|
||||
break
|
||||
else:
|
||||
cluster_server = False
|
||||
return cluster_server, cluster_id, cluster_dir_override
|
||||
|
||||
|
||||
def num_maps():
|
||||
def config_nummap():
|
||||
count_maps = check_int("Укажите количество карт: \n")
|
||||
if count_maps == 0: # 0 возвращает check_int когда, ничего не было введено
|
||||
count_maps = 1
|
||||
return count_maps
|
||||
|
||||
|
||||
def name_maps(count_maps=""):
|
||||
for i in range(count_maps):
|
||||
while True:
|
||||
def config_maps(i):
|
||||
"""Проверка на выбор карты из списка"""
|
||||
amount_map = check_int("""Выберите карту из списка указав номер
|
||||
1. The Island
|
||||
@ -246,7 +247,12 @@ def name_maps(count_maps=""):
|
||||
if amount_map == 0: # 0 возвращает check_int когда, ничего не было введено
|
||||
amount_map = i + 1
|
||||
if 0 < amount_map <= 12:
|
||||
break
|
||||
# тут должно быть прерывание цикла из config_ark
|
||||
|
||||
if list_config:
|
||||
port_s, query_p, rcon_p = ports_array()
|
||||
else:
|
||||
port_s = query_p = rcon_p = []
|
||||
|
||||
if amount_map == 1:
|
||||
map_s = "TheIsland"
|
||||
@ -275,11 +281,10 @@ def name_maps(count_maps=""):
|
||||
else:
|
||||
# Если вдруг каким-то боком проверка не отработает и не будет нужной цифры
|
||||
map_s = 'TheIsland'
|
||||
return map_s
|
||||
return map_s, port_s, query_p, rcon_p
|
||||
|
||||
def name_servers(list_config=list_config, map_s=""):
|
||||
if list_config:
|
||||
data = read_yaml(list_config[-1], game="ARK")
|
||||
|
||||
def config_nameserver(map_s):
|
||||
while True:
|
||||
name_server = input("Укажите название Сервера: \n")
|
||||
if name_server == "":
|
||||
@ -290,9 +295,10 @@ def name_servers(list_config=list_config, map_s=""):
|
||||
new_name = f"{map_s}{str(count)}"
|
||||
count += 1
|
||||
list_config.append(new_name)
|
||||
print(list_config)
|
||||
print_line(list_config)
|
||||
break
|
||||
else:
|
||||
print_line(list_config)
|
||||
list_config.append(map_s)
|
||||
break
|
||||
else:
|
||||
@ -301,33 +307,29 @@ def name_servers(list_config=list_config, map_s=""):
|
||||
else:
|
||||
list_config.append(name_server) # если enter, то ставим последним элементом карту
|
||||
break
|
||||
return list_config
|
||||
|
||||
def config_ark(list_config=list_config):
|
||||
"""конфигурирование сервера арк"""
|
||||
create_dir(dir_server_ark)
|
||||
create_dir(dir_maps_ark)
|
||||
|
||||
cluster_id = ""
|
||||
cluster_dir_override = ""
|
||||
|
||||
cluster_server = clustering()
|
||||
cluster_server, cluster_id, cluster_dir_override = config_cluster()
|
||||
|
||||
if list_config:
|
||||
print_line("Уже установленные карты: ")
|
||||
print("Уже установленные карты: ")
|
||||
for i in list_config:
|
||||
data = read_yaml(i, game="ARK")
|
||||
print_line(f"{i} : {data['map']}")
|
||||
print(f"{i} : {data['map']}")
|
||||
count_maps = config_nummap()
|
||||
print_line(count_maps)
|
||||
for i in range(count_maps):
|
||||
while True:
|
||||
map_s, port_s, query_p, rcon_p = config_maps(i)
|
||||
print_line(map_s, port_s, query_p, rcon_p)
|
||||
list_config = config_nameserver(map_s)
|
||||
|
||||
|
||||
num_maps()
|
||||
map_s = name_maps()
|
||||
name_servers()
|
||||
|
||||
if list_config:
|
||||
port_s, query_p, rcon_p = ports_array()
|
||||
else:
|
||||
port_s = query_p = rcon_p = []
|
||||
|
||||
port = check_int("Укажите порт сервера: ")
|
||||
port_server = ports(port, port_s, True)
|
||||
|
||||
@ -339,7 +341,7 @@ def config_ark(list_config=list_config):
|
||||
rcon_enabled = True
|
||||
|
||||
password_server = input("Укажите пароль Сервера: \n")
|
||||
adminpassword_server = input("Укажите пароль администратора: \n")
|
||||
adminpassword_server = 123
|
||||
max_players = check_int("Укажите максимальное количество игроков: \n")
|
||||
if max_players == 0:
|
||||
max_players = 70
|
||||
@ -356,6 +358,9 @@ def config_ark(list_config=list_config):
|
||||
else:
|
||||
listen_server = True
|
||||
|
||||
print_line(cluster_server, map_s, list_config[-1], port_server, query_port,
|
||||
rcon_enabled, rcon_port, adminpassword_server, password_server, max_players,
|
||||
cluster_id, cluster_dir_override, listen_server)
|
||||
yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port,
|
||||
rcon_enabled, rcon_port, adminpassword_server, password_server, max_players,
|
||||
cluster_id, cluster_dir_override, listen_server)
|
||||
|
Loading…
Reference in New Issue
Block a user