1
This commit is contained in:
		
							
								
								
									
										59
									
								
								hlna.py
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								hlna.py
									
									
									
									
									
								
							| @@ -491,30 +491,48 @@ def modextract(id_mod, id_game_workshop): | |||||||
|         print_line(id_mod) |         print_line(id_mod) | ||||||
|         os.remove(f"{dir_ark_mods}.mod") |         os.remove(f"{dir_ark_mods}.mod") | ||||||
|  |  | ||||||
|     modfile_bytes = b'' |     with open(f"{dir_extract}/mod.info", "rb") as modinfo: | ||||||
|     with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: |         data = modinfo.read() | ||||||
|         data = f.read() |         mapnamelen = struct.unpack_from("<L", data, 0)[0] | ||||||
|         mapnamelen = struct.unpack_from('<L', data, offset=0) |         mapname = data[4:mapnamelen+3] | ||||||
|         mapnamelen = mapnamelen[0] |         nummaps = struct.unpack_from("<L", data, mapnamelen+4)[0] | ||||||
|         mapname = str(data[4:mapnamelen + 3], 'utf-8') |  | ||||||
|         nummaps = struct.unpack_from('<L', data, offset=mapnamelen + 4) |  | ||||||
|         nummaps = nummaps[0] |  | ||||||
|         pos = mapnamelen + 8 |         pos = mapnamelen + 8 | ||||||
|         modname = (modname + mapname + "\x00").encode('utf-8') |         modname = (modname or mapname) | ||||||
|         modnamelen = len(modname) |         modnamelen = len(modname) | ||||||
|         modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mod + "\x00").encode('utf-8') |         modpath = f"../../../" + {dir_shooter} + "/Content/Mods/" + id_mod | ||||||
|         modpathlen = len(modpath) |         modpathlen = len(modpath) | ||||||
|         modfile_bytes += struct.pack('<LLL{}sL{}sL'.format(modnamelen, modpathlen), |         with open(f"{dir_ark_mods}.mod", "wb") as mod: | ||||||
|                                      int(id_mod), 0, modnamelen, |             mod.write(struct.pack('<LLL{}sL{}sL'.format(modnamelen, modpathlen), int(id_mod), 0, modnamelen, modname, modpathlen, modpath, nummaps)) | ||||||
|                                      modname, modpathlen, modpath, nummaps) |             for mapnum in range(nummaps): | ||||||
|         for _ in range(nummaps): |                 mapfilelen = struct.unpack_from("<L", data, pos)[0] | ||||||
|             mapfilelen = struct.unpack_from('<L', data, offset=pos) |                 mapfile = data[mapnamelen+12:mapnamelen+12+mapfilelen] | ||||||
|             mapfilelen = mapfilelen[0] |                 mod.write(struct.pack("<L%ds" % mapfilelen, mapfilelen, mapfile)) | ||||||
|             mapfile = data[mapnamelen + 12:mapnamelen + 12 + mapfilelen] |  | ||||||
|             modfile_bytes += struct.pack('<L{}s'.format(mapfilelen), mapfilelen, mapfile) |  | ||||||
|                 pos = pos + 4 + mapfilelen |                 pos = pos + 4 + mapfilelen | ||||||
|         modfile_bytes += b'\x33\xFF\x22\xFF\x02\x00\x00\x00\x01' |             mod.write(b"\x33\xFF\x22\xFF\x02\x00\x00\x00\x01") | ||||||
|         # os.system(modfile_bytes.decode().replace("$arkserverdir", arkserverdir).replace("$modid", modid).replace("$modname", modname).replace("$modextractdir", modextractdir)) |  | ||||||
|  |     # modfile_bytes = b'' | ||||||
|  |     # with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: | ||||||
|  |     #     data = f.read() | ||||||
|  |     #     mapnamelen = struct.unpack_from('<L', data, offset=0) | ||||||
|  |     #     mapnamelen = mapnamelen[0] | ||||||
|  |     #     mapname = str(data[4:mapnamelen + 3], 'utf-8') | ||||||
|  |     #     nummaps = struct.unpack_from('<L', data, offset=mapnamelen + 4) | ||||||
|  |     #     nummaps = nummaps[0] | ||||||
|  |     #     pos = mapnamelen + 8 | ||||||
|  |     #     modname = (modname + mapname + "\x00").encode('utf-8') | ||||||
|  |     #     modnamelen = len(modname) | ||||||
|  |     #     modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mod + "\x00").encode('utf-8') | ||||||
|  |     #     modpathlen = len(modpath) | ||||||
|  |     #     modfile_bytes += struct.pack('<LLL{}sL{}sL'.format(modnamelen, modpathlen), | ||||||
|  |     #                                  int(id_mod), 0, modnamelen, | ||||||
|  |     #                                  modname, modpathlen, modpath, nummaps) | ||||||
|  |     #     for _ in range(nummaps): | ||||||
|  |     #         mapfilelen = struct.unpack_from('<L', data, offset=pos) | ||||||
|  |     #         mapfilelen = mapfilelen[0] | ||||||
|  |     #         mapfile = data[mapnamelen + 12:mapnamelen + 12 + mapfilelen] | ||||||
|  |     #         modfile_bytes += struct.pack('<L{}s'.format(mapfilelen), mapfilelen, mapfile) | ||||||
|  |     #         pos = pos + 4 + mapfilelen | ||||||
|  |     #     modfile_bytes += b'\x33\xFF\x22\xFF\x02\x00\x00\x00\x01' | ||||||
|  |  | ||||||
|     if os.path.isfile(os.path.join(dir_extract, "modmeta.info")): |     if os.path.isfile(os.path.join(dir_extract, "modmeta.info")): | ||||||
|         with open(os.path.join(dir_extract, "modmeta.info"), "rb") as f: |         with open(os.path.join(dir_extract, "modmeta.info"), "rb") as f: | ||||||
| @@ -774,6 +792,7 @@ dir_logs = f"{dir_config}logs/" | |||||||
| dir_server_ark = f"{dir_server}ARK/" | dir_server_ark = f"{dir_server}ARK/" | ||||||
| dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" | dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" | ||||||
| dir_workshop_ark = f"{home_dir}/.local/share/Steam/steamapps/workshop" | dir_workshop_ark = f"{home_dir}/.local/share/Steam/steamapps/workshop" | ||||||
|  | dir_shooter = "ShooterGame" | ||||||
| dir_mods_ark = f"{dir_server_ark}ShooterGame/Content/Mods" | dir_mods_ark = f"{dir_server_ark}ShooterGame/Content/Mods" | ||||||
|  |  | ||||||
| dir_server_7days = f"{dir_server}/7Days/" | dir_server_7days = f"{dir_server}/7Days/" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user