summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-10-24 12:44:33 -0300
committerJesusaves <cpntb1@ymail.com>2022-10-24 12:44:33 -0300
commit3879d3ca1e63301c7110c1836dec60dc05c6c156 (patch)
tree0abd4ce422f3794e5073a286000b46721e040a16
parent6a31a3e8177704b8bef6ec07c7db79ec04789d4b (diff)
downloadtools-3879d3ca1e63301c7110c1836dec60dc05c6c156.tar.gz
tools-3879d3ca1e63301c7110c1836dec60dc05c6c156.tar.bz2
tools-3879d3ca1e63301c7110c1836dec60dc05c6c156.tar.xz
tools-3879d3ca1e63301c7110c1836dec60dc05c6c156.zip
Fix spacing and ViewSprite
-rwxr-xr-xmerge-server.py87
1 files changed, 48 insertions, 39 deletions
diff --git a/merge-server.py b/merge-server.py
index 5c1df3c..d9a7f4b 100755
--- a/merge-server.py
+++ b/merge-server.py
@@ -14,7 +14,47 @@ REVOLT="../evol/server-data/"
os.chdir("..")
item_db=[]
-## Moubootaur Legends is a raw copy
+def parse(l, offset, prefix):
+ if "\tId:" in l:
+ tmp=l.split("Id:")
+ try:
+ tmp[1]=str(int(tmp[1]) + offset)
+ except ValueError:
+ print("%s invalid ID" % repr(tmp[1]))
+ except:
+ traceback.print_exc()
+ tmp[1]=str(offset*2-1)
+ l="Id: ".join(tmp).replace(" ", " ")
+ l+="\n"
+
+ elif "\tAegisName:" in l:
+ tmp=l.split("\"")
+ tmp[1]="%s_%s" % (prefix, tmp[1])
+ l="\"".join(tmp)
+
+ elif "\tName:" in l:
+ tmp=l.split("\"")
+ tmp[1]="%s %s" % (prefix, tmp[1])
+ l="\"".join(tmp)
+
+ elif "Sprite:" in l:
+ tmp=l.split("Sprite:")
+ try:
+ assert int(tmp[1]) > 1
+ tmp[1]=str(int(tmp[1]) + offset)
+ except ValueError:
+ print("%s invalid Sprite" % repr(tmp[1]))
+ except AssertionError:
+ pass
+ except:
+ traceback.print_exc()
+ tmp[1]=str(offset*2-1)
+ l="Sprite: ".join(tmp).replace(" ", " ")
+ l+="\n"
+ return l
+
+#################################################################################
+## Moubootaur Legends is a raw copy (prefix = 0)
with open("%s/db/re/item_db.conf" % MOUBOO, "r") as f:
for l in f:
#l=l.replace(" ", "\t")
@@ -30,6 +70,7 @@ with open("%s/db/re/item_db.conf" % MOUBOO, "r") as f:
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:
@@ -37,25 +78,7 @@ with open("%s/db/pre-re/item_db.conf" % EVOLVED, "r") as f:
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)
+ l=parse(l, 10000, "L")
##############################
## Recalc Stats
@@ -64,6 +87,8 @@ with open("%s/db/pre-re/item_db.conf" % EVOLVED, "r") as f:
tmp=l.split(":")
try:
tmp[1]=str(min(int(int(tmp[1]) * 1.1), 999))
+ except ValueError:
+ print("%s invalid ATK" % repr(tmp[1]))
except:
traceback.print_exc()
l=": ".join(tmp)
@@ -73,6 +98,8 @@ with open("%s/db/pre-re/item_db.conf" % EVOLVED, "r") as f:
tmp=l.split(":")
try:
tmp[1]=str(min(int(int(tmp[1]) * 1.1), 100))
+ except ValueError:
+ print("%s invalid DEF" % repr(tmp[1]))
except:
traceback.print_exc()
l=": ".join(tmp)
@@ -95,25 +122,7 @@ with open("%s/db/re/item_db.conf" % REVOLT, "r") as f:
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)
+ l=parse(l, 20000, "R")
item_db.append(l)
while not ")" in item_db[-1]: