добавлен выбор требуется ли настройка сервера
This commit is contained in:
parent
47546c48e7
commit
24e08b6f22
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
|
# Ignore dynaconf secret files
|
||||||
|
.secrets.*
|
||||||
|
10
config.yaml
10
config.yaml
@ -1,10 +0,0 @@
|
|||||||
map_server: TheIsland
|
|
||||||
dir_server: "~/ARK_Servers/"
|
|
||||||
session_name: Dodo server
|
|
||||||
Port: 7777
|
|
||||||
QueryPort: 27015
|
|
||||||
ServerPassword:
|
|
||||||
MaxPlayers: 70
|
|
||||||
ModsId:
|
|
||||||
listen: True
|
|
||||||
Cluster: False
|
|
140
dodo.py
Normal file → Executable file
140
dodo.py
Normal file → Executable file
@ -2,58 +2,79 @@
|
|||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
home_Dir = Path.home()
|
|
||||||
map_server = "TheIsland"
|
|
||||||
dir_server = "~/ARK_Servers/"
|
|
||||||
#session_name = "Dodo server"
|
|
||||||
#Port = 7777
|
|
||||||
#QueryPort = 27015
|
|
||||||
#ServerPassword = ""
|
|
||||||
#MaxPlayers = 70
|
|
||||||
#ModsId = []
|
|
||||||
#listen = True
|
|
||||||
#Cluster = False
|
|
||||||
|
|
||||||
#if not os.path.exists("~/.config/dodo/config.yaml"):
|
home_Dir = Path.home()
|
||||||
#os.system("")
|
map_Server = "TheIsland"
|
||||||
|
dir_Server = f"{home_Dir}/ARK_Servers/"
|
||||||
|
name_Server = "Dodo server"
|
||||||
|
port_Server = 7777
|
||||||
|
query_Port = 27015
|
||||||
|
password_Server = ""
|
||||||
|
max_Players = 70
|
||||||
|
mods_Id = []
|
||||||
|
listen_Server = True
|
||||||
|
cluster_Server = False
|
||||||
|
|
||||||
|
if not os.path.exists(dir_Server):
|
||||||
|
os.mkdir(dir_Server)
|
||||||
|
|
||||||
def yaml_create():
|
def yaml_create():
|
||||||
if not os.path.exists(f"{home_Dir}/.config/dodo/"):
|
if not os.path.exists(f"{home_Dir}/.config/dodo/"):
|
||||||
os.mkdir(f"{home_Dir}/.config/dodo/")
|
os.mkdir(f"{home_Dir}/.config/dodo/")
|
||||||
if not os.path.exists("config.yaml"):
|
if not os.path.exists(f"{home_Dir}/.config/dodo/settings.yaml"):
|
||||||
example = open("/usr/share/dodo/config.yaml", "r")
|
settings_dodo = [
|
||||||
f = example.read()
|
{
|
||||||
else:
|
'Map' : f"{map_Server}",
|
||||||
example = open("config.yaml")
|
'ServerPath' : f"{dir_Server}",
|
||||||
f = example.read()
|
'SessionName' : f"{name_Server}",
|
||||||
config = open(f"{home_Dir}/.config/dodo/config.yaml", "w+")
|
'Port' : f"{port_Server}",
|
||||||
config.write(f)
|
'QueryPort' : f"{query_Port}",
|
||||||
example.close()
|
'ServerPassword' : f"{password_Server}",
|
||||||
config.close()
|
'MaxPlayers' : f"{max_Players}",
|
||||||
|
'ModsId' : f"{mods_Id}",
|
||||||
|
'Listen' : f"{listen_Server}",
|
||||||
|
'Cluster' : f"{cluster_Server}"
|
||||||
#if not os.path.exists(dir_server):
|
}
|
||||||
# os.mkdir(dir_server)
|
]
|
||||||
|
with open(f"{home_Dir}/.config/dodo/settings.yaml", 'w') as yamlfile:
|
||||||
|
data = yaml.dump(settings_dodo, yamlfile)
|
||||||
|
print("Конфиг создан")
|
||||||
|
#
|
||||||
|
# if not os.path.exists("settings.yaml"):
|
||||||
|
# example = open("/usr/share/dodo/settings.yaml", "r")
|
||||||
|
# f = example.read()
|
||||||
|
# else:
|
||||||
|
# example = open("settings.yaml")
|
||||||
|
# f = example.read()
|
||||||
|
# config = open(f"{home_Dir}/.config/dodo/settings.yaml", "w+")
|
||||||
|
# config.write(f)
|
||||||
|
# example.close()
|
||||||
|
# config.close()
|
||||||
|
|
||||||
def yaml_edit():
|
def yaml_edit():
|
||||||
|
print("""Используем стандартные настройки?(Карта TheIsland)
|
||||||
|
В противном случае придётся произвести настройки
|
||||||
|
1. Стандартные настройки
|
||||||
|
2. Настроить""")
|
||||||
|
count_Settings = input(":\n")
|
||||||
|
if count_Settings == "2":
|
||||||
print("""Укажите требуется ли кластер?
|
print("""Укажите требуется ли кластер?
|
||||||
1. Да
|
1. Да
|
||||||
2. Нет""")
|
2. Нет""")
|
||||||
count_cluster = input(":\n")
|
count_Cluster = input(":\n")
|
||||||
if count_cluster == "1":
|
if count_Cluster == "1":
|
||||||
Cluster = True
|
cluster_Server = True
|
||||||
else:
|
else:
|
||||||
Cluster = False
|
cluster_Server = False
|
||||||
|
|
||||||
print("Укажите название Сервера")
|
print("Укажите название Сервера")
|
||||||
session_name = input("")
|
name_Server = input("")
|
||||||
|
|
||||||
print("Укажите порт Сервера <7777>")
|
print("Укажите порт Сервера <7777>")
|
||||||
Port = input("")
|
port_Server = input("")
|
||||||
|
|
||||||
print("Укажите Query-порт Сервера <27015>")
|
print("Укажите Query-порт Сервера <27015>")
|
||||||
QueryPort = input("")
|
query_Port = input("")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
count_maps = input("Укажите количество карт:\n")
|
count_maps = input("Укажите количество карт:\n")
|
||||||
@ -80,44 +101,45 @@ def yaml_edit():
|
|||||||
if count_maps.isdigit:
|
if count_maps.isdigit:
|
||||||
break
|
break
|
||||||
if count_map == "1":
|
if count_map == "1":
|
||||||
map_server = "TheIsland"
|
map_Server = "TheIsland"
|
||||||
elif count_map == "2":
|
elif count_map == "2":
|
||||||
map_server = "TheCenter"
|
map_Server = "TheCenter"
|
||||||
elif count_map == "3":
|
elif count_map == "3":
|
||||||
map_server = "ScorchedEarth_P"
|
map_Server = "ScorchedEarth_P"
|
||||||
elif count_map == "4":
|
elif count_map == "4":
|
||||||
map_server = "Ragnarok"
|
map_Server = "Ragnarok"
|
||||||
elif count_map == "5":
|
elif count_map == "5":
|
||||||
map_server = "Aberration_P"
|
map_Server = "Aberration_P"
|
||||||
elif count_map == "6":
|
elif count_map == "6":
|
||||||
map_server = "Extinction"
|
map_Server = "Extinction"
|
||||||
elif count_map == "7":
|
elif count_map == "7":
|
||||||
map_server = "Valguero_P"
|
map_Server = "Valguero_P"
|
||||||
elif count_map == "8":
|
elif count_map == "8":
|
||||||
map_server = "Genesis"
|
map_Server = "Genesis"
|
||||||
elif count_map == "9":
|
elif count_map == "9":
|
||||||
map_server = "CrystalIsles"
|
map_Server = "CrystalIsles"
|
||||||
elif count_map == "10":
|
elif count_map == "10":
|
||||||
map_server = "Gen2"
|
map_Server = "Gen2"
|
||||||
elif count_map == "11":
|
elif count_map == "11":
|
||||||
map_server = "LostIsland"
|
map_Server = "LostIsland"
|
||||||
elif count_map == "12":
|
elif count_map == "12":
|
||||||
map_server = "Fjordur"
|
map_Server = "Fjordur"
|
||||||
print("Введите цифры")
|
print("Введите цифры")
|
||||||
with open("/usr/share/dodo/config.yaml", "rw+") as f:
|
# with open(f"{home_Dir}/.config/dodo/settings.yaml", "w+") as f:
|
||||||
config_Data = yaml.safe_load(f)
|
# config_Data = yaml.safe_load(f)
|
||||||
config_Data[""]
|
# config_Data["map_Server"] = [map_Server]
|
||||||
def install(map_server):
|
|
||||||
if not os.path.isdir(dir_server + map_server):
|
def install():
|
||||||
os.mkdir(dir_server + map_server)
|
|
||||||
|
if not os.path.isdir(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")
|
||||||
#os.chdir(dir_server + map_server + "/" + "ShooterGame/Binaries/Linux/")
|
|
||||||
def start():
|
def start():
|
||||||
if Cluster == False:
|
os.chdir(dir_Server + map_Server + "/" + "ShooterGame/Binaries/Linux/")
|
||||||
os.system(f"./ShooterGameServer {map_server}?SessionName={session_name}?Port={Port}?QueryPort={QueryPort}?MaxPlayers={MaxPlayers}?GameModIds={ModsId}?listen={listen}")
|
if cluster_Server == False:
|
||||||
#os.system("ShooterGameServer")
|
os.system(f"./ShooterGameServer {map_Server}?SessionName={name_Server}?Port={port_Server}?QueryPort={query_Port}?MaxPlayers={max_Players}?GameModIds={mods_Id}?listen={listen_Server}")
|
||||||
yaml_create()
|
yaml_create()
|
||||||
yaml_edit()
|
yaml_edit()
|
||||||
install(map_server)
|
install()
|
||||||
start()
|
start()
|
10
settings.yaml
Normal file
10
settings.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
- Cluster: 'False'
|
||||||
|
Listen: 'True'
|
||||||
|
Map: TheIsland
|
||||||
|
MaxPlayers: '70'
|
||||||
|
ModsId: '[]'
|
||||||
|
Port: '7777'
|
||||||
|
QueryPort: '27015'
|
||||||
|
ServerPassword: ''
|
||||||
|
ServerPath: /home/xpamych/ARK_Servers/
|
||||||
|
SessionName: Dodo server
|
Loading…
Reference in New Issue
Block a user