From a19801b6dfbf62e5f962c9aed7574ac961c2c165 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 24 Oct 2022 10:36:28 -0300 Subject: Copy XML/PNG/etc. as well --- merge-client.py | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/merge-client.py b/merge-client.py index 988fc40..a960fe0 100755 --- a/merge-client.py +++ b/merge-client.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 # This consolidates client XMLs -import os, traceback +import os, shutil, traceback, subprocess, time MYSELF="clientdata/" EVOLVED="../pre-renewal/client-data/" @@ -12,6 +12,7 @@ REVOLT="../evol/client-data/" os.chdir("..") item_db=[] +paths=[] def fix_id(l, offset): if "id=" in l: @@ -24,6 +25,74 @@ def fix_id(l, offset): l="\"".join(tmp) return l +def hp(l): + global paths + if "" in j: break + hp(j) item_db.append(j) continue ## Save the line + hp(l) item_db.append(l) while not "" in item_db[-1]: item_db=item_db[:-1] @@ -60,7 +131,8 @@ item_db=item_db[:-1] print("\033[32;1mMoubootaur Legends OK\033[0m") - +## Handle copy pastes +unify(MOUBOO) ## Legacy/Evolved has an offset of 10k with open("%s/items.xml" % EVOLVED, "r") as f: @@ -87,6 +159,7 @@ with open("%s/items.xml" % EVOLVED, "r") as f: break j=fix_id(j, 10000) item_db.append(j) + hp(j) continue ## Save the line @@ -95,6 +168,7 @@ with open("%s/items.xml" % EVOLVED, "r") as f: saving=True continue item_db.append(l) + hp(l) while not "" in item_db[-1]: item_db=item_db[:-1] #item_db=item_db[:-1] @@ -102,6 +176,11 @@ print("\033[32;1mLegacy/Evolved OK\033[0m") +## Handle copy pastes +unify(EVOLVED) + + + ## Save the final item database @@ -111,5 +190,10 @@ with open(MYSELF+"items.xml", "w") as f: print("\033[33;1mSaved! Databases merged!\033[0m") -## TODO: Sync files +## Clean empty dirs +time.sleep(1) +print("Now deleting empty folders:") +time.sleep(4) +os.chdir(MYSELF) +subprocess.call("""find . -type d -empty -not -iwholename "./.*" -print -delete""", shell=True) -- cgit v1.2.3-70-g09d2