summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-10-24 09:37:21 -0300
committerJesusaves <cpntb1@ymail.com>2022-10-24 09:37:21 -0300
commitfa36741e13ece55aff15210e811c1df1f5c8db2c (patch)
tree1c6b569a366d35a4458e2c9aabedee3c0005ce9f
parentc2ccb14ffff0e45398365e19dfd2874307ddb943 (diff)
downloadtools-fa36741e13ece55aff15210e811c1df1f5c8db2c.tar.gz
tools-fa36741e13ece55aff15210e811c1df1f5c8db2c.tar.bz2
tools-fa36741e13ece55aff15210e811c1df1f5c8db2c.tar.xz
tools-fa36741e13ece55aff15210e811c1df1f5c8db2c.zip
Server DB merger script
-rwxr-xr-xmerge-server.py106
1 files changed, 106 insertions, 0 deletions
diff --git a/merge-server.py b/merge-server.py
new file mode 100755
index 0000000..04441ef
--- /dev/null
+++ b/merge-server.py
@@ -0,0 +1,106 @@
+#!/usr/bin/python3
+# This consolidates server databases
+import os, traceback
+
+MYSELF="serverdata/"
+EVOLVED="../pre-renewal/server-data/"
+MOUBOO="../server-data/"
+REVOLT="../evol/server-data/"
+
+# Rewrite db/re/item_db.conf
+# Pets? Can't be carried over :< Homunculus? Same :<
+# Skills? Eugh.
+
+os.chdir("..")
+item_db=[]
+
+## Moubootaur Legends is a raw copy
+with open("%s/db/re/item_db.conf" % MOUBOO, "r") as f:
+ for l in f:
+ #l=l.replace(" ", "\t")
+ ## Add headers
+ if "== License ==" in l:
+ item_db.append("//=========================================================================\n")
+ item_db.append("// This file is generated automatically.\n")
+ item_db.append("// Please do not edit it directly.\n")
+ ## Save the line
+ item_db.append(l)
+ while not ")" in item_db[-1]:
+ item_db=item_db[:-1]
+item_db=item_db[:-1]
+print("\033[32;1mMoubootaur Legends OK\033[0m")
+
+## Legacy/Evolved has an offset of 10k
+with open("%s/db/pre-re/item_db.conf" % EVOLVED, "r") as f:
+ for l in f:
+ l=l.replace(" ", "\t")
+ if "item_db:" in l:
+ continue
+
+ if "\tId:" in l:
+ tmp=l.split("Id:")
+ try:
+ tmp[1]=str(int(tmp[1]) + 10000)
+ except:
+ traceback.print_exc()
+ tmp[1]="19999"
+ l="Id:".join(tmp)
+ l+="\n"
+
+ if "\tAegisName:" in l:
+ tmp=l.split("\"")
+ tmp[1]="L_%s" % tmp[1]
+ l="\"".join(tmp)
+
+ if "\tName:" in l:
+ tmp=l.split("\"")
+ tmp[1]="L %s" % tmp[1]
+ l="\"".join(tmp)
+
+ item_db.append(l)
+ while not ")" in item_db[-1]:
+ item_db=item_db[:-1]
+item_db=item_db[:-1]
+print("\033[32;1mLegacy/Evolved OK\033[0m")
+
+## rEvolt has an offset of 20k
+with open("%s/db/re/item_db.conf" % REVOLT, "r") as f:
+ for l in f:
+ l=l.replace(" ", "\t")
+ if "item_db:" in l:
+ continue
+
+ if "\tId:" in l:
+ tmp=l.split("Id:")
+ try:
+ tmp[1]=str(int(tmp[1]) + 20000)
+ except:
+ traceback.print_exc()
+ tmp[1]="29999"
+ l="Id:".join(tmp)
+ l+="\n"
+
+ if "\tAegisName:" in l:
+ tmp=l.split("\"")
+ tmp[1]="R_%s" % tmp[1]
+ l="\"".join(tmp)
+
+ if "\tName:" in l:
+ tmp=l.split("\"")
+ tmp[1]="R %s" % tmp[1]
+ l="\"".join(tmp)
+
+ item_db.append(l)
+ while not ")" in item_db[-1]:
+ item_db=item_db[:-1]
+#item_db=item_db[:-1]
+print("\033[32;1mrEvolt OK\033[0m")
+
+
+## Save the final item database
+with open(MYSELF+"db/re/item_db.conf", "w") as f:
+ for l in item_db:
+ f.write(l)
+
+print("\033[33;1mSaved! Databases merged!\033[0m")
+