#!/usr/bin/env python3 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("") 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) def yaml_edit(): print("""Укажите требуется ли кластер? 1. Да 2. Нет""") count_cluster = input(":\n") if count_cluster == "1": Cluster = True else: Cluster = False print("Укажите название Сервера") session_name = input("") print("Укажите порт Сервера <7777>") Port = input("") print("Укажите Query-порт Сервера <27015>") QueryPort = input("") while True: count_maps = input("Укажите количество карт:\n") if count_maps.isdigit: break print("Введите цифры") for i in range(int(count_maps)): print("""Выберите карту из списка указав номер 1. The Island 2. The Center 3. Scorched Earth 4. Ragnarok 5. Aberration 6. Extinction 7. Valguero 8. Genesis: Part 1 9. Crystal Isles 10. Genesis: Part 2 11. Lost Island 12. Fjordur""") while True: count_map = input("") if count_maps.isdigit: break if count_map == "1": map_server = "TheIsland" elif count_map == "2": map_server = "TheCenter" elif count_map == "3": map_server = "ScorchedEarth_P" elif count_map == "4": map_server = "Ragnarok" elif count_map == "5": map_server = "Aberration_P" elif count_map == "6": map_server = "Extinction" elif count_map == "7": map_server = "Valguero_P" elif count_map == "8": map_server = "Genesis" elif count_map == "9": map_server = "CrystalIsles" elif count_map == "10": map_server = "Gen2" elif count_map == "11": map_server = "LostIsland" elif count_map == "12": 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) 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/") 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") yaml_create() yaml_edit() install(map_server) start()