Skip to content
Snippets Groups Projects
Commit b8678637 authored by Rsge's avatar Rsge
Browse files

Added the ability to only add CUC to EUI

parent 0e90be93
Branches
No related tags found
No related merge requests found
......@@ -8,40 +8,47 @@ import subprocess
import shutil
import re
#Change to base DLC directory
os.chdir("../..")
## Global Values
print("Configuring variables...")
# Names
# Customize according to your setup here #
# Customize these according to your setup #
vanilla_eui_zip = "!EUI.7z" # Vanilla EUI file (in vanilla_packs_folder)
modded_eui_zip = "!EUI_CUC.7z" # CUC-version file name of EUI
modsave_folder = "zzz_Modsaves" # Folder containing this scripts project folder and it's needed edited files
vanilla_packs_folder = "zz_Vanilla_Versions" # Folder containing the vanilla packs
# Don't change from here [if you don't really know what you're doing that is of cause ;)] #
# Ignore these #
modpack_folder_name = "MP_MODSPACK"
eui_cu_file_names = ["CityBannerManager.lua",
eui_cuc_file_names = ["CityBannerManager.lua",
"CityView.lua",
"Highlights.xml"]
load_tag = "ContextPtr:LoadNewContext"
unit_panel_file_name = "UnitPanel.lua"
ige_compat_file_name = "IGE_Window.lua"
delete_file_names = ["CivilopediaScreen.lua",
# Maybe you also need to add to these lists #
delete_file_names = ["CivilopediaScreen.lua", # Mod files overwriting original UI files, conflicting with EUI
"CityView.lua",
"TechTree.lua",
"TechButtonInclude.lua",
unit_panel_file_name]
unit_panel_modcompat_file_names = ["EvilSpiritsMission.lua",
unit_panel_modcompat_file_names = ["EvilSpiritsMission.lua", # Mod files adding new actions to units
"THTanukiMission.lua"]
# Don't change from here [if you don't really know what you're doing that is of cause ;)] #
# This only runs with 7zip. If you want to use WinRar you'll have to change the methods yourself - or just download 7zip =P
szip = r"C:\Program Files\7-Zip\7z.exe"
# Paths
# Change to base DLC directory
os.chdir("../..")
base_path = os.getcwd()
modsave_path = j(base_path, modsave_folder)
modpack_path = j(base_path, modpack_folder_name)
vanilla_packs_path = j(base_path, vanilla_packs_folder)
ui_path = j(modpack_path, "UI")
eui_path = j(base_path, "UI_bc1")
szip = r"C:\Program Files\7-Zip\7z.exe"
# Files
base_eui_zip_path = j(vanilla_packs_path, vanilla_eui_zip)
modded_eui_zip_path = j(base_path, modded_eui_zip)
......@@ -53,11 +60,15 @@ eui_files = j(eui_path, "*", "*.lua")
load_tags = {}
unit_panel_modcompat_needed = False
null = open(os.devnull, 'w')
eui_only = False
# Get modpack zip
while True:
modpack_name = input("\nWhich pack should be converted?\n")
modpack_name = input("\nWhich pack should be converted?\n(Type 'EUI' to just convert EUI)\n")
if modpack_name == "EUI":
eui_only = True
break
modpack_zips = g(j(vanilla_packs_path, modpack_name + ".*"))
if len(modpack_zips) > 0:
modpack_zip = modpack_zips[0]
......@@ -77,17 +88,25 @@ if not os.path.isfile(modded_eui_zip_path):
print("Creating colored unlocked Citizens EUI...")
subprocess.run([szip, 'x', base_eui_zip_path], stdout=null, stderr=null)
#shutil.move(j(vanilla_packs_path, eui_file_name), eui_path)
for eui_cu_file_name in eui_cu_file_names:
eui_cu_file = g(j(modsave_path, eui_cu_file_name + "*"))[0]
orig_eui_file = g(j(eui_path, "*", eui_cu_file_name))[0]
for eui_cuc_file_name in eui_cuc_file_names:
eui_cuc_file = g(j(modsave_path, eui_cuc_file_name + "*"))[0]
orig_eui_file = g(j(eui_path, "*", eui_cuc_file_name))[0]
shutil.move(orig_eui_file, orig_eui_file + ".orig")
shutil.copyfile(eui_cu_file, orig_eui_file)
shutil.copyfile(eui_cuc_file, orig_eui_file)
subprocess.run([szip, 'a', modded_eui_zip, eui_path], stdout=null, stderr=null)
else:
elif not eui_only:
# Unzip EUI
print("Unzipping EUI...")
subprocess.run([szip, 'x', modded_eui_zip_path], stdout=null, stderr=null)
# Stop here if only EUI should be converted
if eui_only:
if os.path.isdir(eui_path):
shutil.rmtree(eui_path)
null.close()
print("Done.\n")
exit(0)
# Unzip modpack zip
print("Unzipping Modpack...")
......@@ -170,9 +189,10 @@ shutil.rmtree(ui_path)
print("Zipping Modpack...")
subprocess.run([szip, 'a', modpack_name + "_EUI.7z", modpack_path], stdout=null, stderr=null)
##Move modpack folder
# Move modpack folder
#print("Moving Modspack folder")
#shutil.move(modpack_path, j(base_path, modpack_folder_name))
null.close()
print("Done.\n")
exit(0)
\ No newline at end of file
......@@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
..\.gitattributes = ..\.gitattributes
..\.gitignore = ..\.gitignore
..\LICENSE = ..\LICENSE
..\Readme.md = ..\Readme.md
EndProjectSection
EndProject
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment