-
Notifications
You must be signed in to change notification settings - Fork 25
/
extract.py
59 lines (48 loc) · 1.6 KB
/
extract.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
This script should be placed in the root of a WoWS installation.
It will generate and populate res_extract.
Make sure you have the unpacker:
https://forum.worldofwarships.eu/topic/113847-all-wows-unpack-tool-unpack-game-client-resources/
"""
import argparse
import os
import shutil
import subprocess
OUTPUT_NAME = "res_extract"
UNPACK_LIST = (
"content/GameParams.data",
"scripts/*",
"spaces/*/minimap*.png",
"spaces/*/space.settings",
"gui/achievements/*",
"gui/ribbons/*",
"gui/ship_bars/*",
"gui/ships_silhouettes/*",
"gui/consumables/consumable_*_*.png",
"gui/ship_bars/*",
"gui/service_kit/building_icons/*",
)
EXCLUDE_LIST = (
"gui/consumables/consumable_*_*_empty.png",
)
def main(bin_num):
bin_path = fr"bin\{bin_num}"
idx_path = fr"{bin_path}\idx"
pkg_path = r"..\..\..\res_packages"
include = [i for pattern in UNPACK_LIST for i in ("-I", pattern)]
exclude = [i for pattern in EXCLUDE_LIST for i in ("-X", pattern)]
subprocess.run(["wowsunpack.exe", "-x", idx_path,
"-p", pkg_path,
"-o", OUTPUT_NAME,
*include, *exclude])
texts_src = fr"{bin_path}\res\texts"
texts_dest = fr"{OUTPUT_NAME}\texts"
shutil.copytree(texts_src, texts_dest)
print("Extraction complete.")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Extracts game resources.")
parser.add_argument("--bin",
default=max(os.listdir("bin/")),
help="The game version to use.")
args = parser.parse_args()
main(args.bin)