This commit is contained in:
Евгений Храмов 2023-05-14 14:07:48 +03:00
parent 8bdca45ba4
commit e23b51ba8a

26
hlna.py

@ -364,17 +364,17 @@ def modinstall(g, m):
if not os.path.isdir(dir_workshop_ark):
create_dir(dir_workshop_ark)
id_mods_ark = input("""Укажите id модов через запятую
:""")
os.environ.get('mod_branch', 'Windows')
os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mods_ark} +quit")
modextract(id_mods_ark, id_game_workshop)
:""").split(",")
for id_mod in id_mods_ark:
os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit")
modextract(int(id_mod), id_game_workshop)
def modextract(id_mods_ark, id_game_workshop):
mod_steam_workshop = "{}/content/{}/{}".format(dir_workshop_ark, id_game_workshop, id_mods_ark)
mod_ark_mods = "{}{}".format(dir_mods_ark, id_mods_ark)
def modextract(id_mod, id_game_workshop):
mod_steam_workshop = "{}/content/{}/{}".format(dir_workshop_ark, id_game_workshop, id_mod)
mod_ark_mods = "{}{}".format(dir_mods_ark, id_mod)
modextractdir = mod_ark_mods
if id_mods_ark == "111111111":
if id_mod == "111111111":
return
if os.path.isfile("{}/WindowsNoEditor/mod.info".format(mod_steam_workshop)):
@ -400,7 +400,7 @@ def modextract(id_mods_ark, id_game_workshop):
if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile):
shutil.copy2(srcfile, dstfile)
modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8')
modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8')
modname = re.search(r'<div class="workshopItemTitle">(.+)</div>', modname)
modname = modname and modname.group(1)
@ -418,11 +418,11 @@ def modextract(id_mods_ark, id_game_workshop):
pos = mapnamelen + 8
modname = (modname + mapname + "\x00").encode('utf-8')
modnamelen = len(modname)
modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8')
modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mod + "\x00").encode('utf-8')
modpathlen = len(modpath)
print(id_mods_ark, 0, modnamelen, modname, modpathlen, modpath)
print(type(id_mods_ark))
modfile_bytes += struct.pack('<L', id_mods_ark)
print(id_mod, 0, modnamelen, modname, modpathlen, modpath)
print(type(id_mod))
modfile_bytes += struct.pack('<L', id_mod)
for _ in range(nummaps):
mapfilelen = struct.unpack_from('<L', data, offset=pos)
mapfilelen = mapfilelen[0]