diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-01 20:14:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-01 20:14:35 +0300 |
commit | 73238e37ab83c0171ffe4f5b7b0a014950c15562 (patch) | |
tree | 5f05045e988473773f3f073e6d30affcb6594494 | |
parent | 1ceca3aa1cb108413c24121a6eb82809a0ac81a4 (diff) | |
download | evol-tools-73238e37ab83c0171ffe4f5b7b0a014950c15562.tar.gz evol-tools-73238e37ab83c0171ffe4f5b7b0a014950c15562.tar.bz2 evol-tools-73238e37ab83c0171ffe4f5b7b0a014950c15562.tar.xz evol-tools-73238e37ab83c0171ffe4f5b7b0a014950c15562.zip |
hercules: add mob_db.txt conversion.
-rw-r--r-- | hercules/code/server/mobdb.py | 92 | ||||
-rw-r--r-- | hercules/code/server/utils.py | 2 | ||||
-rwxr-xr-x | hercules/convert_server.py | 2 |
3 files changed, 95 insertions, 1 deletions
diff --git a/hercules/code/server/mobdb.py b/hercules/code/server/mobdb.py new file mode 100644 index 0000000..a09348b --- /dev/null +++ b/hercules/code/server/mobdb.py @@ -0,0 +1,92 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2014 Evol Online +# Author: Andrei Karas (4144) + +import re + +from code.fileutils import * +from code.stringutils import * + +def convertMobDb(): + srcFile = "oldserverdata/db/mob_db.txt" + dstFile = "newserverdata/db/re/mob_db.txt" + fieldsSplit = re.compile(",") + with open(srcFile, "r") as r: + with open(dstFile, "w") as w: + for line in r: +# if len(line) < 2 or line[0] == "#": + if len(line) < 2: + w.write(line) + continue + rows = fieldsSplit.split(line) + for f in xrange(0, len(rows)): + rows[f] = rows[f].strip() + w.write("{0:<5} {1:<15} {2:<16} {3:<16} {4:<5} {5:<5} {6:<5} " + "{7:<5} {8:<5} {9:<7} {10:<5} {11:<5} {12:<5} {13:<5} " + "{14:<5} {15:<5} {16:<5} {17:<5} {18:<5} {19:<5} {20:<7}" + " {21:<7} {22:<6} {23:<5} {24:<8} {25:<8} {26:<6} " + "{27:<8} {28:<9} {29:<8} {30:<5} {31:<7} {32:<8} {33:<7}" + " {34:<8} {35:<7} {36:<8} {37:<8} {38:<9} {39:<8} " + "{40:<9} {41:<8} {42:<9} {43:<8} {44:<9} {45:<8} {46:<9}" + " {47:<8} {48:<9} {49:<8} {50:<9} {51:<8} {52:<9} " + "{53:<8} {54:<9} {55:<8} {56:<8} \n".format( + rows[0] + ",", + rows[1] + ",", + rows[2] + ",", + rows[2] + ",", + rows[3] + ",", + rows[4] + ",", + rows[5] + ",", + rows[6] + ",", + rows[7] + ",", + rows[8] + ",", + rows[9] + ",", + rows[10] + ",", + rows[11] + ",", + rows[12] + ",", + rows[13] + ",", + rows[14] + ",", + rows[15] + ",", + rows[16] + ",", + rows[17] + ",", + rows[18] + ",", + rows[19] + ",", + rows[20] + ",", + rows[21] + ",", + rows[22] + ",", + rows[23] + ",", + rows[24] + ",", + rows[25] + ",", + rows[26] + ",", + rows[27] + ",", + rows[28] + ",", + rows[45] + ",", + rows[47] + ",", + rows[48] + ",", + rows[49] + ",", + rows[50] + ",", + rows[51] + ",", + rows[52] + ",", + rows[29] + ",", + rows[30] + ",", + rows[31] + ",", + rows[32] + ",", + rows[33] + ",", + rows[34] + ",", + rows[35] + ",", + rows[36] + ",", + rows[37] + ",", + rows[38] + ",", + rows[39] + ",", + rows[40] + ",", + rows[41] + ",", + rows[42] + ",", + rows[43] + ",", + rows[44] + ",", + "0,", + "0,", + "0,", + "0" + )) + diff --git a/hercules/code/server/utils.py b/hercules/code/server/utils.py index c39aeeb..0f164ca 100644 --- a/hercules/code/server/utils.py +++ b/hercules/code/server/utils.py @@ -8,5 +8,5 @@ from code.fileutils import * def cleanServerData(): removeAllFiles("newserverdata") makeDir("newserverdata/conf") - makeDir("newserverdata/db") + makeDir("newserverdata/db/re/") makeDir("newserverdata/npc/re/") diff --git a/hercules/convert_server.py b/hercules/convert_server.py index 3965d37..7ad1fe5 100755 --- a/hercules/convert_server.py +++ b/hercules/convert_server.py @@ -5,8 +5,10 @@ # Author: Andrei Karas (4144) from code.server.npcs import * +from code.server.mobdb import * from code.server.utils import * cleanServerData() createMainScript() convertNpcs(); +convertMobDb(); |