добавлен выбор требуется ли настройка сервера
This commit is contained in:
parent
47546c48e7
commit
24e08b6f22
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
||||
__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 yaml
|
||||
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"):
|
||||
#os.system("")
|
||||
home_Dir = Path.home()
|
||||
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():
|
||||
if not os.path.exists(f"{home_Dir}/.config/dodo/"):
|
||||
os.mkdir(f"{home_Dir}/.config/dodo/")
|
||||
if not os.path.exists("config.yaml"):
|
||||
example = open("/usr/share/dodo/config.yaml", "r")
|
||||
f = example.read()
|
||||
else:
|
||||
example = open("config.yaml")
|
||||
f = example.read()
|
||||
config = open(f"{home_Dir}/.config/dodo/config.yaml", "w+")
|
||||
config.write(f)
|
||||
example.close()
|
||||
config.close()
|
||||
|
||||
|
||||
|
||||
#if not os.path.exists(dir_server):
|
||||
# os.mkdir(dir_server)
|
||||
if not os.path.exists(f"{home_Dir}/.config/dodo/settings.yaml"):
|
||||
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/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():
|
||||
print("""Используем стандартные настройки?(Карта TheIsland)
|
||||
В противном случае придётся произвести настройки
|
||||
1. Стандартные настройки
|
||||
2. Настроить""")
|
||||
count_Settings = input(":\n")
|
||||
if count_Settings == "2":
|
||||
print("""Укажите требуется ли кластер?
|
||||
1. Да
|
||||
2. Нет""")
|
||||
count_cluster = input(":\n")
|
||||
if count_cluster == "1":
|
||||
Cluster = True
|
||||
count_Cluster = input(":\n")
|
||||
if count_Cluster == "1":
|
||||
cluster_Server = True
|
||||
else:
|
||||
Cluster = False
|
||||
cluster_Server = False
|
||||
|
||||
print("Укажите название Сервера")
|
||||
session_name = input("")
|
||||
name_Server = input("")
|
||||
|
||||
print("Укажите порт Сервера <7777>")
|
||||
Port = input("")
|
||||
port_Server = input("")
|
||||
|
||||
print("Укажите Query-порт Сервера <27015>")
|
||||
QueryPort = input("")
|
||||
query_Port = input("")
|
||||
|
||||
while True:
|
||||
count_maps = input("Укажите количество карт:\n")
|
||||
@ -80,44 +101,45 @@ def yaml_edit():
|
||||
if count_maps.isdigit:
|
||||
break
|
||||
if count_map == "1":
|
||||
map_server = "TheIsland"
|
||||
map_Server = "TheIsland"
|
||||
elif count_map == "2":
|
||||
map_server = "TheCenter"
|
||||
map_Server = "TheCenter"
|
||||
elif count_map == "3":
|
||||
map_server = "ScorchedEarth_P"
|
||||
map_Server = "ScorchedEarth_P"
|
||||
elif count_map == "4":
|
||||
map_server = "Ragnarok"
|
||||
map_Server = "Ragnarok"
|
||||
elif count_map == "5":
|
||||
map_server = "Aberration_P"
|
||||
map_Server = "Aberration_P"
|
||||
elif count_map == "6":
|
||||
map_server = "Extinction"
|
||||
map_Server = "Extinction"
|
||||
elif count_map == "7":
|
||||
map_server = "Valguero_P"
|
||||
map_Server = "Valguero_P"
|
||||
elif count_map == "8":
|
||||
map_server = "Genesis"
|
||||
map_Server = "Genesis"
|
||||
elif count_map == "9":
|
||||
map_server = "CrystalIsles"
|
||||
map_Server = "CrystalIsles"
|
||||
elif count_map == "10":
|
||||
map_server = "Gen2"
|
||||
map_Server = "Gen2"
|
||||
elif count_map == "11":
|
||||
map_server = "LostIsland"
|
||||
map_Server = "LostIsland"
|
||||
elif count_map == "12":
|
||||
map_server = "Fjordur"
|
||||
map_Server = "Fjordur"
|
||||
print("Введите цифры")
|
||||
with open("/usr/share/dodo/config.yaml", "rw+") as f:
|
||||
config_Data = yaml.safe_load(f)
|
||||
config_Data[""]
|
||||
def install(map_server):
|
||||
if not os.path.isdir(dir_server + map_server):
|
||||
os.mkdir(dir_server + map_server)
|
||||
# with open(f"{home_Dir}/.config/dodo/settings.yaml", "w+") as f:
|
||||
# config_Data = yaml.safe_load(f)
|
||||
# config_Data["map_Server"] = [map_Server]
|
||||
|
||||
def install():
|
||||
|
||||
if not os.path.isdir(dir_Server + map_Server):
|
||||
os.mkdir(dir_Server + map_Server)
|
||||
else:
|
||||
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/")
|
||||
os.system(f"steamcmd +force_install_dir {dir_Server + map_Server} +login anonymous +app_update 376030 +quit")
|
||||
def start():
|
||||
if Cluster == False:
|
||||
os.system(f"./ShooterGameServer {map_server}?SessionName={session_name}?Port={Port}?QueryPort={QueryPort}?MaxPlayers={MaxPlayers}?GameModIds={ModsId}?listen={listen}")
|
||||
#os.system("ShooterGameServer")
|
||||
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}")
|
||||
yaml_create()
|
||||
yaml_edit()
|
||||
install(map_server)
|
||||
install()
|
||||
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