добавлен label но не на 100%
This commit is contained in:
parent
7ae27b8e81
commit
70fc3e9930
57
hlna.py
57
hlna.py
@ -25,24 +25,20 @@ listen_server = True
|
|||||||
def hlna():
|
def hlna():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
list_config = next(os.walk(config_hlna), (None, None, []))[2] # [] if no file
|
|
||||||
x = list_config.count('.directory')
|
def find_file(path):
|
||||||
y = list_config.count('logs')
|
"Находим все конфиги в зависимости от пути"
|
||||||
if x>0:
|
arr = next(os.walk(path), (None, None, []))[2] # [] if no file
|
||||||
list_config.remove('.directory')
|
x = list_config.count('.directory')
|
||||||
if y>0:
|
y = list_config.count('logs')
|
||||||
list_config.remove('logs')
|
if x>0:
|
||||||
|
arr.remove('.directory')
|
||||||
|
if y>0:
|
||||||
|
arr.remove('logs')
|
||||||
|
|
||||||
|
|
||||||
|
list_config = find_file(config_hlna)
|
||||||
delist_config = next(os.walk(config_hlna+"deactivated"), (None, None, []))[2] # [] if no file
|
delist_config = find_file(config_hlna+"deactivated")
|
||||||
x = list_config.count('.directory')
|
|
||||||
y = list_config.count('logs')
|
|
||||||
if x>0:
|
|
||||||
list_config.remove('.directory')
|
|
||||||
if y>0:
|
|
||||||
list_config.remove('logs')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def print_line(text):
|
def print_line(text):
|
||||||
@ -71,6 +67,8 @@ def check_int(number=""):
|
|||||||
return x
|
return x
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Введите число")
|
print("Введите число")
|
||||||
|
|
||||||
|
|
||||||
create_dir(dir_server)
|
create_dir(dir_server)
|
||||||
create_dir(config_hlna)
|
create_dir(config_hlna)
|
||||||
|
|
||||||
@ -89,6 +87,7 @@ def config(name_server=list_config):
|
|||||||
: """)
|
: """)
|
||||||
if count_cluster == 0: # 0 возвращает функция chek_int, если ничего не было введено
|
if count_cluster == 0: # 0 возвращает функция chek_int, если ничего не было введено
|
||||||
count_cluster = 2
|
count_cluster = 2
|
||||||
|
|
||||||
if count_cluster == 1:
|
if count_cluster == 1:
|
||||||
cluster_server = True
|
cluster_server = True
|
||||||
cluster_id = input("Укажите id для кластера, любое сочетание символов: \n")
|
cluster_id = input("Укажите id для кластера, любое сочетание символов: \n")
|
||||||
@ -96,11 +95,13 @@ def config(name_server=list_config):
|
|||||||
cluster_dir_override = (dir_server + cluster_id)
|
cluster_dir_override = (dir_server + cluster_id)
|
||||||
else:
|
else:
|
||||||
cluster_server = False
|
cluster_server = False
|
||||||
|
|
||||||
if name_server != []:
|
if name_server != []:
|
||||||
print("Уже установленные карты: ")
|
print("Уже установленные карты: ")
|
||||||
for i in name_server:
|
for i in name_server:
|
||||||
con = read_yaml(i)
|
con = read_yaml(i)
|
||||||
print(f"{i} : {con['map']}")
|
print(f"{i} : {con['map']}")
|
||||||
|
|
||||||
count_maps = check_int("Укажите количество карт: \n")
|
count_maps = check_int("Укажите количество карт: \n")
|
||||||
if count_maps == 0: # 0 возрвращает check_int когда, ничего не было введено
|
if count_maps == 0: # 0 возрвращает check_int когда, ничего не было введено
|
||||||
count_maps = 1
|
count_maps = 1
|
||||||
@ -109,12 +110,6 @@ def config(name_server=list_config):
|
|||||||
while True:
|
while True:
|
||||||
"Проверка на выбор карты из списка"
|
"Проверка на выбор карты из списка"
|
||||||
|
|
||||||
for k in name_server:
|
|
||||||
data = read_yaml(k)
|
|
||||||
port_s.append(data['Port'])
|
|
||||||
query_p.append(data['QueryPort'])
|
|
||||||
|
|
||||||
|
|
||||||
os.system("clear")
|
os.system("clear")
|
||||||
amount_map = check_int("""Выберите карту из списка указав номер
|
amount_map = check_int("""Выберите карту из списка указав номер
|
||||||
1. The Island
|
1. The Island
|
||||||
@ -135,6 +130,12 @@ def config(name_server=list_config):
|
|||||||
if 0<amount_map<=12:
|
if 0<amount_map<=12:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
for k in name_server:
|
||||||
|
data = read_yaml(k)
|
||||||
|
port_s.append(data['Port'])
|
||||||
|
query_p.append(data['QueryPort'])
|
||||||
|
|
||||||
|
|
||||||
if amount_map == 1:
|
if amount_map == 1:
|
||||||
map_s = "TheIsland"
|
map_s = "TheIsland"
|
||||||
elif amount_map == 2:
|
elif amount_map == 2:
|
||||||
@ -150,7 +151,7 @@ def config(name_server=list_config):
|
|||||||
elif amount_map == 7:
|
elif amount_map == 7:
|
||||||
map_s = "Valguero_P"
|
map_s = "Valguero_P"
|
||||||
elif amount_map == 8:
|
elif amount_map == 8:
|
||||||
map_S = "Genesis"
|
map_s = "Genesis"
|
||||||
elif amount_map == 9:
|
elif amount_map == 9:
|
||||||
map_s = "CrystalIsles"
|
map_s = "CrystalIsles"
|
||||||
elif amount_map == 10:
|
elif amount_map == 10:
|
||||||
@ -159,11 +160,16 @@ def config(name_server=list_config):
|
|||||||
map_s = "LostIsland"
|
map_s = "LostIsland"
|
||||||
elif amount_map == 12:
|
elif amount_map == 12:
|
||||||
map_s = "Fjordur"
|
map_s = "Fjordur"
|
||||||
|
|
||||||
name_server.append(input("Укажите название Сервера: \n"))
|
name_server.append(input("Укажите название Сервера: \n"))
|
||||||
if name_server[-1] == "":
|
if name_server[-1] == "":
|
||||||
name_server.pop()
|
name_server.pop()
|
||||||
name_server.append(map_s)
|
name_server.append(map_s)
|
||||||
|
|
||||||
|
label = input("Укажите метку для запуска или конфигурирования этой карты, по умолчанию название карты")
|
||||||
|
if label == "":
|
||||||
|
label = map_s
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
port_server = check_int("Укажите порт Сервера <7777>: \n")
|
port_server = check_int("Укажите порт Сервера <7777>: \n")
|
||||||
if port_server == 0:
|
if port_server == 0:
|
||||||
@ -193,13 +199,14 @@ def config(name_server=list_config):
|
|||||||
if max_players == 0:
|
if max_players == 0:
|
||||||
max_players = 70
|
max_players = 70
|
||||||
|
|
||||||
yaml_create(cluster_server, map_s, name_server[-1], port_server, query_port, password_server, max_players, cluster_id, cluster_dir_override)
|
yaml_create(cluster_server, map_s, name_server[-1], port_server, query_port, password_server, max_players, cluster_id, cluster_dir_override, label)
|
||||||
|
|
||||||
|
|
||||||
def yaml_create(cluster_server, map_s, name_server, port_server, query_port, password_server, max_players, cluster_id, cluster_dir_override):
|
def yaml_create(cluster_server, map_s, name_server, port_server, query_port, password_server, max_players, cluster_id, cluster_dir_override, label):
|
||||||
settings_hlna = [
|
settings_hlna = [
|
||||||
{
|
{
|
||||||
'map' : map_s,
|
'map' : map_s,
|
||||||
|
'label' : label,
|
||||||
'Cluster' : cluster_server,
|
'Cluster' : cluster_server,
|
||||||
'SessionName' : name_server,
|
'SessionName' : name_server,
|
||||||
'Port' : port_server,
|
'Port' : port_server,
|
||||||
|
Loading…
Reference in New Issue
Block a user