blob: 04441efabb144a6ed057273132c1304af681a0f1 (
plain) (
tree)
|
|
#!/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")
|