установка и удаление модов

This commit is contained in:
Евгений Храмов 2023-05-14 22:54:17 +03:00
parent 335faca5a2
commit 05f9126b0d

@ -496,7 +496,7 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods):
os.system(f"mv -f {dir_steam_workshop} {dir_ark_mods}")
modname = subprocess.check_output(
['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8')
['curl', '-s', f'https://steamcommunity.com/sharedfiles/filedetails/?id={id_mod}']).decode('utf-8')
modname = re.search(r'<div class="workshopItemTitle">(.+)</div>', modname)
modname = modname and modname.group(1)
@ -515,7 +515,7 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods):
modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + id_mod.encode() + b'\x00'
modpathlen = len(modpath)
with open(f"{dir_ark_mods}.mod", "wb") as mod:
mod.write(struct.pack('<LLL{}sL{}sL'.format(modnamelen, modpathlen), int(id_mod), 0, modnamelen, modname,
mod.write(struct.pack(f'<LLL{modnamelen}sL{modpathlen}sL', int(id_mod), 0, modnamelen, modname,
modpathlen, modpath, nummaps))
for mapnum in range(nummaps):
mapfilelen = struct.unpack_from("<L", data, pos)[0]