последнее состояние
This commit is contained in:
parent
bbbde31d20
commit
69e25ecff3
178
dodo.py
178
dodo.py
@ -3,61 +3,39 @@ import os
|
|||||||
import yaml
|
import yaml
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
home_Dir = Path.home()
|
home_dir = Path.home()
|
||||||
#count_Maps = 1
|
count_maps = 1
|
||||||
#map_Server = "TheIsland"
|
map_server = "TheIsland"
|
||||||
dir_Server = f"{home_Dir}/ARK_Servers/"
|
dir_server = f"{home_dir}/ARK_Servers/"
|
||||||
#name_Server = "Dodo server"
|
name_server = "Dodo server"
|
||||||
#port_Server = 7777
|
port_server = 7777
|
||||||
#query_Port = 27015
|
query_port = 27015
|
||||||
password_Server = ""
|
password_server = ""
|
||||||
max_Players = 70
|
max_players = 70
|
||||||
mods_Id = []
|
mods_id = []
|
||||||
listen_Server = True
|
listen_server = True
|
||||||
#cluster_Server = False
|
cluster_server = False
|
||||||
|
|
||||||
if not os.path.exists(dir_Server):
|
if not os.path.exists(dir_server):
|
||||||
os.mkdir(dir_Server)
|
os.mkdir(dir_server)
|
||||||
|
|
||||||
def yaml_create(map_Server, query_Port, port_Server, name_Server, cluster_Server):
|
|
||||||
if not os.path.exists(f"{home_Dir}/.config/dodo/"):
|
|
||||||
os.mkdir(f"{home_Dir}/.config/dodo/")
|
|
||||||
settings_dodo = [
|
|
||||||
{
|
|
||||||
'Map' : f"{map_Server}",
|
|
||||||
'ServerPath' : f"{dir_Server}",
|
|
||||||
'SessionName' : f"{name_Server}",
|
|
||||||
'Port' : f"{port_Server}",
|
|
||||||
'QueryPort' : f"{query_Port}",
|
|
||||||
'ServerPassword' : f"{password_Server}",
|
|
||||||
'MaxPlayers' : f"{max_Players}",
|
|
||||||
'ModsId' : f"{mods_Id}",
|
|
||||||
'Listen' : f"{listen_Server}",
|
|
||||||
'Cluster' : f"{cluster_Server}"
|
|
||||||
}
|
|
||||||
|
|
||||||
]
|
|
||||||
with open(f"{home_Dir}/.config/dodo/{map_Server}.yaml", 'w') as yamlfile:
|
|
||||||
data = yaml.dump(settings_dodo, yamlfile)
|
|
||||||
print("Конфиг создан")
|
|
||||||
|
|
||||||
def yaml_edit():
|
def yaml_edit():
|
||||||
count_Maps = 1
|
count_maps = 1
|
||||||
print("""Укажите требуется ли кластер?
|
print("""Укажите требуется ли кластер?
|
||||||
1. Да
|
1. Да
|
||||||
2. Нет""")
|
2. Нет""")
|
||||||
count_Cluster = input(":\n")
|
count_cluster = input(":\n")
|
||||||
if count_Cluster == "1":
|
if count_cluster == "1":
|
||||||
cluster_Server = True
|
cluster_server = True
|
||||||
else:
|
else:
|
||||||
cluster_Server = False
|
cluster_server = False
|
||||||
|
while cluster_server == True:
|
||||||
while cluster_Server == True:
|
count_maps = input("Укажите количество карт:\n")
|
||||||
count_Maps = input("Укажите количество карт:\n")
|
if count_maps.isdigit:
|
||||||
if count_Maps.isdigit:
|
|
||||||
break
|
break
|
||||||
print("Введите цифры")
|
print("Введите цифры")
|
||||||
for i in range(1, int(count_Maps) + 1):
|
for i in range(1, int(count_maps) + 1):
|
||||||
print("""Выберите карту из списка указав номер
|
print("""Выберите карту из списка указав номер
|
||||||
1. The Island
|
1. The Island
|
||||||
2. The Center
|
2. The Center
|
||||||
@ -73,66 +51,98 @@ def yaml_edit():
|
|||||||
12. Fjordur""")
|
12. Fjordur""")
|
||||||
amount_map = input("")
|
amount_map = input("")
|
||||||
if amount_map == "1":
|
if amount_map == "1":
|
||||||
map_Server = "TheIsland"
|
map_server = "TheIsland"
|
||||||
elif amount_map == "2":
|
elif amount_map == "2":
|
||||||
map_Server = "TheCenter"
|
map_server = "TheCenter"
|
||||||
elif amount_map == "3":
|
elif amount_map == "3":
|
||||||
map_Server = "ScorchedEarth_P"
|
map_server = "ScorchedEarth_P"
|
||||||
elif amount_map == "4":
|
elif amount_map == "4":
|
||||||
map_Server = "Ragnarok"
|
map_server = "Ragnarok"
|
||||||
elif amount_map == "5":
|
elif amount_map == "5":
|
||||||
map_Server = "Aberration_P"
|
map_server = "Aberration_P"
|
||||||
elif amount_map == "6":
|
elif amount_map == "6":
|
||||||
map_Server = "Extinction"
|
map_server = "Extinction"
|
||||||
elif amount_map == "7":
|
elif amount_map == "7":
|
||||||
map_Server = "Valguero_P"
|
map_server = "Valguero_P"
|
||||||
elif amount_map == "8":
|
elif amount_map == "8":
|
||||||
map_Server = "Genesis"
|
map_server = "Genesis"
|
||||||
elif amount_map == "9":
|
elif amount_map == "9":
|
||||||
map_Server = "CrystalIsles"
|
map_server = "CrystalIsles"
|
||||||
elif amount_map == "10":
|
elif amount_map == "10":
|
||||||
map_Server = "Gen2"
|
map_server = "Gen2"
|
||||||
elif amount_map == "11":
|
elif amount_map == "11":
|
||||||
map_Server = "LostIsland"
|
map_server = "LostIsland"
|
||||||
elif amount_map == "12":
|
elif amount_map == "12":
|
||||||
map_Server = "Fjordur"
|
map_server = "Fjordur"
|
||||||
print("Введите цифры")
|
print("Введите цифры")
|
||||||
print("Укажите название Сервера")
|
print("Укажите название Сервера")
|
||||||
name_Server = input("")
|
name_server = input("")
|
||||||
|
|
||||||
print("Укажите порт Сервера <7777>")
|
print("Укажите порт Сервера <7777>")
|
||||||
port_Server = input("")
|
port_server = input("")
|
||||||
|
|
||||||
print("Укажите Query-порт Сервера <27015>")
|
print("Укажите Query-порт Сервера <27015>")
|
||||||
query_Port = input("")
|
query_port = input("")
|
||||||
yaml_create(map_Server, query_Port, port_Server, name_Server, cluster_Server)
|
yaml_create(map_server, query_port, port_server, name_server, cluster_server)
|
||||||
return map_Server, query_Port, port_Server, name_Server, cluster_Server
|
return map_server, query_port, port_server, name_server, cluster_server
|
||||||
|
|
||||||
def read_yaml(map_Server):
|
|
||||||
with open(f"{home_Dir}/.config/dodo/{map_Server}.yaml", "r") as yamlfile:
|
def yaml_create(map_server, query_port, port_server, name_server, cluster_server):
|
||||||
|
if not os.path.exists(f"{home_dir}/.config/dodo/"):
|
||||||
|
os.mkdir(f"{home_dir}/.config/dodo/")
|
||||||
|
settings_dodo = [
|
||||||
|
{
|
||||||
|
'Map' : f"{map_server}",
|
||||||
|
'ServerPath' : f"{dir_server}",
|
||||||
|
'SessionName' : f"{name_server}",
|
||||||
|
'Port' : f"{port_server}",
|
||||||
|
'QueryPort' : f"{query_port}",
|
||||||
|
'ServerPassword' : f"{password_server}",
|
||||||
|
'MaxPlayers' : f"{max_players}",
|
||||||
|
'ModsId' : f"{mods_id}",
|
||||||
|
'Listen' : f"{listen_server}",
|
||||||
|
'Cluster' : f"{cluster_server}"
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
with open(f"{home_dir}/.config/dodo/{map_server}.yaml", 'w') as yamlfile:
|
||||||
|
data = yaml.dump(settings_dodo, yamlfile)
|
||||||
|
print("Конфиг создан")
|
||||||
|
|
||||||
|
|
||||||
|
def read_yaml(map_server):
|
||||||
|
print("начало read" + map_server)
|
||||||
|
with open(f"{home_dir}/.config/dodo/{map_server}.yaml", "r") as yamlfile:
|
||||||
data = yaml.load(yamlfile, Loader=yaml.FullLoader)
|
data = yaml.load(yamlfile, Loader=yaml.FullLoader)
|
||||||
map_Server = 'data.Map'
|
map_server = 'data.Map'
|
||||||
dir_Server = 'data.ServerPath'
|
dir_server = 'data.ServerPath'
|
||||||
name_Server = 'data.SessionName'
|
name_server = 'data.SessionName'
|
||||||
port_Server = 'data.Port'
|
port_server = 'data.Port'
|
||||||
query_Port = 'data.QueryPort'
|
query_port = 'data.QueryPort'
|
||||||
password_Server = 'data.ServerPassword'
|
password_server = 'data.ServerPassword'
|
||||||
max_Players = 'data.MaxPlayers'
|
max_players = 'data.MaxPlayers'
|
||||||
mods_Id = 'data.ModsId'
|
mods_id = 'data.ModsId'
|
||||||
listen_Server = 'data.Listen'
|
listen_server = 'data.Listen'
|
||||||
cluster_Server = 'data.Cluster'
|
cluster_server = 'data.Cluster'
|
||||||
return map_Server, dir_Server, password_Server, max_Players, mods_Id, listen_Server, query_Port, port_Server, name_Server, cluster_Server
|
print(data)
|
||||||
|
print("конец read" + map_server)
|
||||||
|
return map_server, dir_server, password_server, max_players, mods_id, listen_server, query_port, port_server, name_server, cluster_server
|
||||||
|
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
read_yaml(map_Server)
|
read_yaml(map_server)
|
||||||
if not os.path.isdir(dir_Server + map_Server):
|
if not os.path.isdir(dir_server + map_server):
|
||||||
os.mkdir(dir_Server + map_Server)
|
os.mkdir(dir_server + map_server)
|
||||||
else:
|
else:
|
||||||
os.system(f"steamcmd +force_install_dir {dir_Server + map_Server} +login anonymous +app_update 376030 +quit")
|
os.system(f"steamcmd +force_install_dir {dir_server + map_server} +login anonymous +app_update 376030 +quit")
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
read_yaml(map_Server)
|
read_yaml(map_server)
|
||||||
os.chdir(dir_Server + map_Server + "/" + "ShooterGame/Binaries/Linux/")
|
os.chdir(dir_server + map_server + "/" + "ShooterGame/Binaries/Linux/")
|
||||||
if cluster_Server == False:
|
os.system(f"./ShooterGameServer {map_server}?SessionName={name_server}?Port={port_server}?QueryPort={query_port}?MaxPlayers={max_players}?GameModIds={mods_id}?listen={listen_server}")
|
||||||
os.system(f"./ShooterGameServer {map_Server}?SessionName={name_Server}?Port={port_Server}?QueryPort={query_Port}?MaxPlayers={max_Players}?GameModIds={mods_Id}?listen={listen_Server}")
|
|
||||||
map_Server, query_Port, port_Server, name_Server, cluster_Server = yaml_edit()
|
|
||||||
|
map_server, query_port, port_server, name_server, cluster_server = yaml_edit()
|
||||||
install()
|
install()
|
||||||
start()
|
start()
|
||||||
|
Loading…
Reference in New Issue
Block a user