pep8 изменение пути к файлам сервера.
This commit is contained in:
parent
9877a12122
commit
964c031dd0
18
hlna.py
18
hlna.py
@ -5,17 +5,16 @@ import threading
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
import click
|
import click
|
||||||
import colorama
|
import colorama
|
||||||
import click_completion
|
import click_completion
|
||||||
|
|
||||||
from rcon.source import Client
|
from rcon.source import Client
|
||||||
|
|
||||||
home_dir = Path.home()
|
home_dir = Path.home()
|
||||||
dir_server = f"{home_dir}/ARK_Servers/"
|
dir_server = f"{home_dir}/ARK_Servers/Server"
|
||||||
config_hlna = f"{home_dir}/.config/hlna/"
|
config_hlna = f"{home_dir}/.config/hlna/"
|
||||||
|
|
||||||
mods_id = ""
|
mods_id = ""
|
||||||
listen_server = True
|
listen_server = True
|
||||||
|
|
||||||
@ -229,6 +228,7 @@ def config(list_config=list_config):
|
|||||||
|
|
||||||
yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override)
|
yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override)
|
||||||
|
|
||||||
|
|
||||||
def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override):
|
def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override):
|
||||||
settings_hlna = [
|
settings_hlna = [
|
||||||
{
|
{
|
||||||
@ -370,14 +370,15 @@ def start(m, name_server=list_config):
|
|||||||
print("Запускаем все активные карты")
|
print("Запускаем все активные карты")
|
||||||
|
|
||||||
names_serverstart = choose_map(names_serverstart)
|
names_serverstart = choose_map(names_serverstart)
|
||||||
server_dir = dir_server + "Server" + "/ShooterGame/Binaries/Linux/"
|
server_dir = dir_server + "/ShooterGame/Binaries/Linux/"
|
||||||
print_line("Качаем сервер")
|
print_line("Валидация файлов сервера")
|
||||||
x = os.system(f"steamcmd +force_install_dir {server_dir} +login anonymous +app_update 376030 +quit")
|
x = os.system(f"steamcmd +force_install_dir {server_dir} +login anonymous +app_update 376030 +quit")
|
||||||
|
os.chdir(server_dir)
|
||||||
for i in names_serverstart:
|
for i in names_serverstart:
|
||||||
data = read_yaml(i)
|
data = read_yaml(i)
|
||||||
starting_map = dict_mapname[i]
|
starting_map = dict_mapname[i]
|
||||||
|
|
||||||
def starting(i):
|
def starting(i):
|
||||||
os.chdir(server_dir)
|
|
||||||
os.system(
|
os.system(
|
||||||
f"./ShooterGameServer {i}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?multihome=127.0.0.1?MaxPlayers={data['MaxPlayers']}?GameModIds={data['ModsId']}?listen={data['Listen']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']}")
|
f"./ShooterGameServer {i}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?multihome=127.0.0.1?MaxPlayers={data['MaxPlayers']}?GameModIds={data['ModsId']}?listen={data['Listen']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']}")
|
||||||
|
|
||||||
@ -437,6 +438,7 @@ def choose_map(arr):
|
|||||||
|
|
||||||
return new_arr
|
return new_arr
|
||||||
|
|
||||||
|
|
||||||
@hlna.command()
|
@hlna.command()
|
||||||
@click.argument('c', nargs=1)
|
@click.argument('c', nargs=1)
|
||||||
@click.option('-m', required=True, help="Название карты для применения rcon команды")
|
@click.option('-m', required=True, help="Название карты для применения rcon команды")
|
||||||
@ -461,8 +463,12 @@ def rcon(m,c):
|
|||||||
with Client('127.0.0.1', port, passwd=str(passwd)) as client:
|
with Client('127.0.0.1', port, passwd=str(passwd)) as client:
|
||||||
response = client.run(c)
|
response = client.run(c)
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
|
|
||||||
def zero(x=""):
|
def zero(x=""):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
if __name__ == 'hlna':
|
if __name__ == 'hlna':
|
||||||
input = zero
|
input = zero
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user