diff options
author | jak1 <jak1@themanaworld.org> | 2022-06-19 09:34:16 +0200 |
---|---|---|
committer | jak1 <jak1@themanaworld.org> | 2022-06-19 09:34:16 +0200 |
commit | 38fcd221d8fe03208abdafe0f01a6e54a601b71a (patch) | |
tree | 6a1ba5a5943b9dc0617e0046b39b82ba2284d53e | |
parent | 9a351fb1abd5694bbbb7e38fcb64bb30b3fa74bb (diff) | |
download | messworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.tar.gz messworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.tar.bz2 messworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.tar.xz messworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.zip |
45 files changed, 189 insertions, 182 deletions
diff --git a/CI/licensecheck/serverdata.py b/CI/licensecheck/serverdata.py index f7c3eb6..acdb42f 100755 --- a/CI/licensecheck/serverdata.py +++ b/CI/licensecheck/serverdata.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2018 TMW-2 diff --git a/CI/testxml/testxml.py b/CI/testxml/testxml.py index 4eb97b1..5d28c84 100755 --- a/CI/testxml/testxml.py +++ b/CI/testxml/testxml.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2010-2011 Evol Online @@ -260,7 +260,7 @@ def testDye(id, color, text, src, iserr): showMsg(id, "dye to small size: " + text, src, iserr) continue - c = col[0]; + c = col[0] if col[1] != ":": showMsg(id, "incorrect dye string: " + text, src, iserr) continue @@ -449,7 +449,7 @@ def testSpriteFile(id, fullPath, file, fileLoc, dnum, variant, checkAction, iser # except: # variant_offset = 0 -# root = dom.childNodes[0]; +# root = dom.childNodes[0] imagesets = dom.getElementsByTagName("imageset") if imagesets is None or len(imagesets) < 1: showMsgSprite(fileLoc, "incorrect number of imageset tags", iserr) @@ -892,7 +892,7 @@ def testSpriteAction(file, name, action, numframes, iserr): try: cont = int(lastNode.attributes["continue"].value) except: - cont = 0; + cont = 0 if cont == 0: try: delay = int(lastNode.attributes["delay"].value) @@ -1143,7 +1143,7 @@ def testItems(fileName, imgDir): if colors is None: testDye(id, floorcolor, "floor=" + floor0, fileName, True) else: - testDyeChannel(id, imagecolor, "floor=" + floor0, True); + testDyeChannel(id, imagecolor, "floor=" + floor0, True) if colors not in colorsList: print("error: " + fileName + ": colors value " + colors + " not found in itemcolors.xml") errors = errors + 1 @@ -1709,7 +1709,7 @@ def testMap(mapName, file, path): id1=readAttr(objx, "id", "?", "invalid object ID", False) name1=readAttr(objx, "name", "?", "invalid object name", False) type1=readAttr(objx, "type", "?", "invalid object type", False) - showMsgFile(file, "Broken object: id %s name %s (%s,%s,%s,%s) type %s" % (id1, name1, x, y, w, h, type1), True); + showMsgFile(file, "Broken object: id %s name %s (%s,%s,%s,%s) type %s" % (id1, name1, x, y, w, h, type1), True) except: id1=readAttr(objx, "id", "?", "invalid object ID", False) showMsgFile(file, "Broken object ID %s - x/y/h/w corrupted data detected" % id1, True) diff --git a/client/minimap-dyecmd.py b/client/minimap-dyecmd.py index 28c35ee..8594dbd 100755 --- a/client/minimap-dyecmd.py +++ b/client/minimap-dyecmd.py @@ -2,7 +2,7 @@ #-*- coding:utf-8 -*- import os -f=open("minimap-dyecmd.sh", "w"); +f=open("minimap-dyecmd.sh", "w") CLIENT_DATA_ROOT="../../client-data" map_names = sorted([os.path.splitext(p)[0] for p in os.listdir(os.path.join(CLIENT_DATA_ROOT, u'graphics', u'minimaps'))]) diff --git a/client/weapons.py b/client/weapons.py index 2f689a6..65d6c2d 100755 --- a/client/weapons.py +++ b/client/weapons.py @@ -64,9 +64,17 @@ shields=[] mem=[] -f1=open("../../client-data/items/equip-1hand.xml", "r"); main(f1); f1.close() -f2=open("../../client-data/items/equip-2hand.xml", "r"); main(f2); f2.close() -f3=open("../../client-data/items/equip-shield.xml", "r"); main(f3, TYPE_SHD); f3.close() +f1=open("../../client-data/items/equip-1hand.xml", "r") +main(f1) +f1.close() + +f2=open("../../client-data/items/equip-2hand.xml", "r") +main(f2) +f2.close() + +f3=open("../../client-data/items/equip-shield.xml", "r") +main(f3, TYPE_SHD) +f3.close() mem=sorted(mem, key=lambda xcv: xcv.lvl, reverse=True) diff --git a/hercules/code/clienttoserver/maps.py b/hercules/code/clienttoserver/maps.py index b9a1626..745bebe 100644 --- a/hercules/code/clienttoserver/maps.py +++ b/hercules/code/clienttoserver/maps.py @@ -54,21 +54,21 @@ def findFirstGid(tilesets, tile): # 6 - monster walk not allowed def convertTileType(tile, idx, width, height): if tile == 5: - tile = 0; + tile = 0 if tile > 6 or tile < 0: y = int(idx / width) x = idx - y * width - print "Error: wrong tile: ({0}, {1}) = {2}".format(x, y, tile) + print("Error: wrong tile: ({0}, {1}) = {2}".format(x, y, tile)) tile = 1 return tile # map file format # -# int16 version; -# uint8 md5_checksum[16]; -# int16 xs; -# int16 ys; -# int32 len; +# int16 version +# uint8 md5_checksum[16] +# int16 xs +# int16 ys +# int32 len # ...data... def recreateMap(names): @@ -77,7 +77,7 @@ def recreateMap(names): tmxName = names[0] mCaheName = destDir + names[1][:-3] + "mcache" with open(mCaheName, "wb") as w: - print tmxName + print(tmxName) dom = minidom.parse(tmxName) root = dom.documentElement tilesets = [] @@ -116,7 +116,7 @@ def recreateMap(names): tileType = 0 else: firstgid = findFirstGid(tilesets, tile) - tileType = convertTileType(tile - firstgid, idx, width, height); + tileType = convertTileType(tile - firstgid, idx, width, height) tiles.append(tileType) idx = idx + 1 elif encoding == "csv": @@ -132,7 +132,7 @@ def recreateMap(names): tileType = 0 else: firstgid = findFirstGid(tilesets, tile) - tileType = convertTileType(tile - firstgid, idx, width, height); + tileType = convertTileType(tile - firstgid, idx, width, height) # tmx collision format # 0 - walkable ground # 1 - non walkable wall @@ -156,7 +156,7 @@ def recreateMap(names): idx = idx + 1 f.close() else: - print "map format not supported: " + tmxName + print("map format not supported: " + tmxName) continue #comp = zlib.compressobj() @@ -172,7 +172,7 @@ def recreateMap(names): found = True break if found == False: - print "Error: missing collision layer in file: {0}".format(tmxName) + print("Error: missing collision layer in file: {0}".format(tmxName)) return return with open(mCaheName + ".debug", "wb") as w: diff --git a/hercules/code/server/account.py b/hercules/code/server/account.py index 7763766..ef83bc2 100644 --- a/hercules/code/server/account.py +++ b/hercules/code/server/account.py @@ -30,7 +30,7 @@ def convertAccount(): if len(rows) == 2: continue if len(rows) != 14: - print "wrong account.txt line: " + stripNewLine(line) + print("wrong account.txt line: " + stripNewLine(line)) continue if firstLine == False: diff --git a/hercules/code/server/accreg.py b/hercules/code/server/accreg.py index b69910f..2319780 100644 --- a/hercules/code/server/accreg.py +++ b/hercules/code/server/accreg.py @@ -26,7 +26,7 @@ def convertAccReg(): line = stripNewLine(line) rows = fieldsSplit.split(line) if len(rows) != 2: - print "wrong accreg.txt line: " + line + print("wrong accreg.txt line: " + line) continue accountId = rows[0] diff --git a/hercules/code/server/evol/athena.py b/hercules/code/server/evol/athena.py index bad35da..9f403da 100644 --- a/hercules/code/server/evol/athena.py +++ b/hercules/code/server/evol/athena.py @@ -30,7 +30,7 @@ def parseInventory(line, data): rows2 = comaSplit.split(data2) if len(rows2) != 12: - print "wrong inventory in account.txt line: " + stripNewLine(line) + print("wrong inventory in account.txt line: " + stripNewLine(line)) continue item = Item() @@ -69,7 +69,7 @@ def parseSkills(line, data): rows2 = comaSplit.split(data2) if len(rows2) != 2: - print "wrong skills in account.txt line: " + stripNewLine(line) + print("wrong skills in account.txt line: " + stripNewLine(line)) continue skill = Skill() @@ -98,7 +98,7 @@ def parseVars(line, data): rows2 = comaSplit.split(data2) if len(rows2) != 2: - print "wrong variables in account.txt line: " + stripNewLine(line) + print("wrong variables in account.txt line: " + stripNewLine(line)) continue variables[rows2[0]] = rows2[1] @@ -118,7 +118,7 @@ def readAthena(): if len(rows) == 2: continue if len(rows) != 20: - print "wrong account.txt line: " + stripNewLine(line) + print("wrong account.txt line: " + stripNewLine(line)) continue user = User() diff --git a/hercules/code/server/evol/consts.py b/hercules/code/server/evol/consts.py index c63f559..a1cdf18 100644 --- a/hercules/code/server/evol/consts.py +++ b/hercules/code/server/evol/consts.py @@ -27,7 +27,7 @@ def convertConsts(quests): else: w.write("{0}\t{1}\t{2}".format(rows[0], rows[1], rows[2])) # build in parameters - w.write("ClientVersion\t10000\t1\n"); + w.write("ClientVersion\t10000\t1\n") srcFile = "oldserverdata/db/const.txt" w.write("// evol constants\n") @@ -44,6 +44,6 @@ def convertConsts(quests): rows[1] = str(quests[rows[0]]) + "\n" if rows[0] in fields: if fields[rows[0]] != rows[1][:-1]: - print "warning: different const values for {0} ({1}, {2})".format(rows[0], rows[1][:-1], fields[rows[0]]) + print("warning: different const values for {0} ({1}, {2})".format(rows[0], rows[1][:-1], fields[rows[0]])) else: w.write("{0}\t{1}".format(rows[0], rows[1])) diff --git a/hercules/code/server/evol/itemdb.py b/hercules/code/server/evol/itemdb.py index a60e57d..a7a54b0 100644 --- a/hercules/code/server/evol/itemdb.py +++ b/hercules/code/server/evol/itemdb.py @@ -18,7 +18,7 @@ def convertItemDb(): with open(srcFile, "r") as r: with open(dstFile, "w") as w: with open(constsFile, "a") as c: - c.write("// items\n"); + c.write("// items\n") tpl = readFile("templates/item_db.tpl") w.write(tpl) for line in r: diff --git a/hercules/code/server/evol/main.py b/hercules/code/server/evol/main.py index be9f0ab..6072a80 100644 --- a/hercules/code/server/evol/main.py +++ b/hercules/code/server/evol/main.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online diff --git a/hercules/code/server/evol/npcs.py b/hercules/code/server/evol/npcs.py index 6efe811..dd2c7be 100644 --- a/hercules/code/server/evol/npcs.py +++ b/hercules/code/server/evol/npcs.py @@ -31,7 +31,7 @@ monsterRe = re.compile("^(?P<map>[^/](.+))[.]gat,([ ]*)(?P<x>[\d]+),([ ]*)(?P<y> "(?P<tag>monster)[\t](?P<name>[\w#' ]+)[\t]" "(?P<class>[\d]+),(?P<num>[\d]+),(?P<look>[\d-]+),(?P<delay1>[\d]+),(?P<delay2>[\d]+)$") -setRe = re.compile("^(?P<space>[ ]+)set[ ](?P<var>[^,]+),([ ]*)(?P<val>[^;]+);$"); +setRe = re.compile("^(?P<space>[ ]+)set[ ](?P<var>[^,]+),([ ]*)(?P<val>[^;]+);$") class ScriptTracker: pass @@ -115,7 +115,7 @@ def processScriptMapLine(line): def writeScript(w, m): if m.group("gender") != None: - w.write("// Gender = {0}\n".format(m.group("gender"))); + w.write("// Gender = {0}\n".format(m.group("gender"))) if m.group("x") == 0 and m.group("y") == 0: # float npc w.write("-") @@ -128,7 +128,7 @@ def writeScript(w, m): class_ = int(class_) if class_ > 125 and class_ <= 400: class_ = class_ + 100 - w.write("\t{0}\t{1}\t{2}".format(m.group("tag"), m.group("name"), class_)); + w.write("\t{0}\t{1}\t{2}".format(m.group("tag"), m.group("name"), class_)) def processScript(tracker): line = tracker.line @@ -139,7 +139,7 @@ def processScript(tracker): m = scriptRe.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -149,11 +149,11 @@ def processScript(tracker): # m.group("tag"), m.group("name"), m.group("class"), m.group("xs"), m.group("ys"), m.group("size")) if m.group("size") != None: - w.write("// Size = {0}\n".format(m.group("size"))); + w.write("// Size = {0}\n".format(m.group("size"))) writeScript(w, m) if m.group("xs") != None: - w.write(",{0},{1}".format(m.group("xs"), m.group("ys"))); - w.write(",{\n"); + w.write(",{0},{1}".format(m.group("xs"), m.group("ys"))) + w.write(",{\n") def itemsToShop(tracker, itemsStr): @@ -175,7 +175,7 @@ def processShop(tracker): m = shopRe.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -193,7 +193,7 @@ def processMapFlag(tracker): m = mapFlagRe.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -212,7 +212,7 @@ def processWarp(tracker): w = tracker.w m = warpRe.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -237,7 +237,7 @@ def processMonster(tracker): w = tracker.w m = monsterRe.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -273,7 +273,7 @@ def processStrReplace(tracker): line = line.replace("getmapmobs(", "mobcount(") - m = setRe.search(line); + m = setRe.search(line) if m != None: line = "{0}{1} = {2};\n".format(m.group("space"), m.group("var"), m.group("val")) diff --git a/hercules/code/server/maps.py b/hercules/code/server/maps.py index 2ef0173..5e65feb 100644 --- a/hercules/code/server/maps.py +++ b/hercules/code/server/maps.py @@ -10,14 +10,14 @@ import zlib from code.fileutils import readMapName, readInt16, readInt32, readData, makeDir def listMapCache(f, mapsCount): - print "Known maps:" - print "{0:12} {1:<4}x {2:<4} {3:<10}".format("Map name", "sx", "sy", "compressed size") + print("Known maps:") + print("{0:12} {1:<4}x {2:<4} {3:<10}".format("Map name", "sx", "sy", "compressed size")) for i in xrange(0, mapsCount): name = readMapName(f) sx = readInt16(f) sy = readInt16(f) sz = readInt32(f) - print "{0:12} {1:<4}x {2:<4} {3:<10}".format(name, sx, sy, sz) + print("{0:12} {1:<4}x {2:<4} {3:<10}".format(name, sx, sy, sz)) f.seek(sz, 1) def extractMaps(f, mapsCount): diff --git a/hercules/code/server/party.py b/hercules/code/server/party.py index c75a541..bcd7fc5 100644 --- a/hercules/code/server/party.py +++ b/hercules/code/server/party.py @@ -34,7 +34,7 @@ def convertParty(users): if len(rows) == 2: continue if len(rows) < 3: - print "wrong party.txt line: " + line + print("wrong party.txt line: " + line) continue partyId = rows[0] diff --git a/hercules/code/server/storage.py b/hercules/code/server/storage.py index 6bddb52..6c1d2e7 100644 --- a/hercules/code/server/storage.py +++ b/hercules/code/server/storage.py @@ -28,7 +28,7 @@ def convertStorage(): if len(rows) == 2: continue if len(rows) != 3: - print "wrong storage.txt line: " + stripNewLine(line) + print("wrong storage.txt line: " + stripNewLine(line)) continue tmp = comaSplit.split(rows[0]) diff --git a/hercules/code/server/tmw/athena.py b/hercules/code/server/tmw/athena.py index 6548b2e..f2e4dd9 100644 --- a/hercules/code/server/tmw/athena.py +++ b/hercules/code/server/tmw/athena.py @@ -30,7 +30,7 @@ def parseInventory(line, data): rows2 = comaSplit.split(data2) if len(rows2) != 12: - print "wrong inventory in account.txt line: " + stripNewLine(line) + print("wrong inventory in account.txt line: " + stripNewLine(line)) continue item = Item() @@ -69,7 +69,7 @@ def parseSkills(line, data): rows2 = comaSplit.split(data2) if len(rows2) != 2: - print "wrong skills in account.txt line: " + stripNewLine(line) + print("wrong skills in account.txt line: " + stripNewLine(line)) continue skill = Skill() @@ -98,7 +98,7 @@ def parseVars(line, data): rows2 = comaSplit.split(data2) if len(rows2) != 2: - print "wrong variables in account.txt line: " + stripNewLine(line) + print("wrong variables in account.txt line: " + stripNewLine(line)) continue variables[rows2[0]] = rows2[1] @@ -118,7 +118,7 @@ def readAthena(): if len(rows) == 2: continue if len(rows) != 20: - print "wrong account.txt line: " + stripNewLine(line) + print("wrong account.txt line: " + stripNewLine(line)) continue user = User() diff --git a/hercules/code/server/tmw/consts.py b/hercules/code/server/tmw/consts.py index 5b8403e..971b23f 100644 --- a/hercules/code/server/tmw/consts.py +++ b/hercules/code/server/tmw/consts.py @@ -27,14 +27,14 @@ def readOneConst(r, line): line = r.next().strip() rows = fieldsSplit.split(line) if len(rows) != 2: - print "error" + print("error") return ("", "", 0) if rows[0] == "Value": val = rows[1] line = r.next().strip() rows = fieldsSplit.split(line) if len(rows) != 2: - print "error" + print("error") return ("", "", 0) rows[1] = rows[1].strip() if rows[0] == "Deprecated" and rows[1].find("true") == 0: @@ -43,7 +43,7 @@ def readOneConst(r, line): rows = fieldsSplit.split(line) if len(rows) != 2: return ("", "", 0) - key = rows[0]; + key = rows[0] val = rows[1] return (key, val, depr) @@ -77,7 +77,7 @@ def convertConsts(quests, npcIds): ] with open(dstFile, "w") as w: tpl = readFile("templates/constants.tpl") - w.write(tpl); + w.write(tpl) srcFile = "serverdata/db/constants.conf" with open(srcFile, "r") as r: for line in r: @@ -116,7 +116,7 @@ def convertConsts(quests, npcIds): rows[1] = str(quests[rows[0]]) + "\n" if rows[0] in fields: if fields[rows[0]] != rows[1][:-1]: - print "warning: different const values for {0} ({1}, {2})".format(rows[0], rows[1][:-1], fields[rows[0]]) + print("warning: different const values for {0} ({1}, {2})".format(rows[0], rows[1][:-1], fields[rows[0]])) else: writeConst(w, (rows[0], stripNewLine(rows[1]), 0)) w.write("// tmw npcs\n") diff --git a/hercules/code/server/tmw/itemdb.py b/hercules/code/server/tmw/itemdb.py index dde9aaa..43c8342 100644 --- a/hercules/code/server/tmw/itemdb.py +++ b/hercules/code/server/tmw/itemdb.py @@ -132,10 +132,10 @@ def replaceStr(line): # fix at same time usage with same name function and variable ("\"DailyQuestPoints\"", "\"DailyQuestPointsFunc\""), ("sc_adrenaline", "SC_ADRENALINE"), - ]; + ] for val in vals: - line = line.replace(val[0], val[1]); + line = line.replace(val[0], val[1]) return line def getItType(it): @@ -186,7 +186,7 @@ def convertItemDb(isNew): with open(dstFile, "w") as w: w.write(tpl) with open(constsFile, "a") as c: - c.write("// items\n"); + c.write("// items\n") for srcFile in getItemDbFile(srcDir): with open(srcDir + srcFile, "r") as r: for line in r: diff --git a/hercules/code/server/tmw/main.py b/hercules/code/server/tmw/main.py index bfbf5ef..0364975 100644 --- a/hercules/code/server/tmw/main.py +++ b/hercules/code/server/tmw/main.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online @@ -26,7 +26,7 @@ def serverTmwMain(isNew): try: cleanServerData() except: - print "Updating server" + print("Updating server") createMainScript() items = convertItemDb(isNew) npcIds = Set() diff --git a/hercules/code/server/tmw/mobdb.py b/hercules/code/server/tmw/mobdb.py index 10edfd1..acecd70 100644 --- a/hercules/code/server/tmw/mobdb.py +++ b/hercules/code/server/tmw/mobdb.py @@ -26,10 +26,10 @@ def replaceStr(line): ("Scorpion", "ScorpionMob"), ("Tritan", "TritanMob"), ("Ukar", "UkarMob"), - ]; + ] for val in vals: - line = line.replace(val[0], val[1]); + line = line.replace(val[0], val[1]) return line def convertMobDb(items): diff --git a/hercules/code/server/tmw/npcs.py b/hercules/code/server/tmw/npcs.py index c51da78..c7fa0f5 100644 --- a/hercules/code/server/tmw/npcs.py +++ b/hercules/code/server/tmw/npcs.py @@ -54,7 +54,7 @@ monsterRe2 = re.compile("^(?P<map>[^/](.+))[.]gat,([ ]*)(?P<x>[\d]+),([ ]*)(?P<y "(?P<tag>monster)[\t](?P<name>[\w#' ]+)([\t]+)" "(?P<class>[\d]+),(?P<num>[\d]+),(?P<delay1>[\d]+),(?P<delay2>[\d]+)(|,(?P<label>[\w+-:#]+))$") -setRe = re.compile("^(?P<space>[ ]+)set[ ](?P<var>[^,]+),([ ]*)(?P<val>[^;]+);$"); +setRe = re.compile("^(?P<space>[ ]+)set[ ](?P<var>[^,]+),([ ]*)(?P<val>[^;]+);$") class ScriptTracker: pass @@ -107,7 +107,7 @@ def convertTextLine(tracker): return False if line == "};\n": - tracker.w.write("}\n"); + tracker.w.write("}\n") return False idx = line.find("|script|") @@ -165,7 +165,7 @@ def writeScript(w, m, npcIds): isFunction = False if isFunction: - w.write("function"); + w.write("function") elif m.group("x") == None or (m.group("x") == 0 and m.group("y") == 0): # float npc w.write("-") else: @@ -174,13 +174,13 @@ def writeScript(w, m, npcIds): funcName = m.group("name") if funcName == "DailyQuestPoints": funcName = "DailyQuestPointsFunc" - w.write("\t{0}\t{1}\t".format(m.group("tag"), funcName)); + w.write("\t{0}\t{1}\t".format(m.group("tag"), funcName)) else: class_ = m.group("class") if class_ == "0": # hidden npc class_ = 32767 elif class_ == None: - class_ = -1; + class_ = -1 else: class_ = int(class_) # if class_ > 125 and class_ <= 400: @@ -188,7 +188,7 @@ def writeScript(w, m, npcIds): npcIds.add(int(class_)) if class_ == -1: class_ = "MINUS1" - w.write("\t{0}\t{1}\tNPC{2}".format(m.group("tag"), m.group("name"), class_)); + w.write("\t{0}\t{1}\tNPC{2}".format(m.group("tag"), m.group("name"), class_)) def processScript(tracker): line = tracker.line[:-1] @@ -198,7 +198,7 @@ def processScript(tracker): if m == None: m = scriptRe2.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -219,12 +219,12 @@ def processScript(tracker): writeScript(w, m, tracker.npcIds) if m.group("xs") != None: - w.write(",{0},{1}".format(m.group("xs"), m.group("ys"))); + w.write(",{0},{1}".format(m.group("xs"), m.group("ys"))) if isFunction == False: - w.write(",{\n"); + w.write(",{\n") else: - w.write("{\n"); + w.write("{\n") def itemsToShop(tracker, itemsStr): itemsSplit = re.compile(",") @@ -235,7 +235,7 @@ def itemsToShop(tracker, itemsStr): for str2 in items: parts = itemsSplit2.split(str2) if len(parts) != 2: - print "Wrong shop item name {0}: {1}".format(str2, itemsStr) + print("Wrong shop item name {0}: {1}".format(str2, itemsStr)) continue if parts[1][0] == "*": parts[1] = str((int(parts[1][1:]) * int(itemsDict[parts[0].strip()]['buy']))) @@ -245,7 +245,7 @@ def itemsToShop(tracker, itemsStr): if itemName in itemsDict: outStr = outStr + itemsDict[itemName]['id'] + ":" + parts[1] else: - print "Wrong item name in shop: {0}".format(itemName) + print("Wrong item name in shop: {0}".format(itemName)) return outStr def processShop(tracker): @@ -256,7 +256,7 @@ def processShop(tracker): if m == None: m = shopRe2.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -277,7 +277,7 @@ def processMapFlag(tracker): if m == None: m = mapFlagRe2.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -304,7 +304,7 @@ def processWarp(tracker): m = warpRe3.search(line) noName = True if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -336,7 +336,7 @@ def processMonster(tracker): if m == None: m = monsterRe2.search(line) if m == None: - print "error in parsing: " + line + print("error in parsing: " + line) w.write("!!!error parsing line") w.write(line) return @@ -856,10 +856,10 @@ def processStrReplace(tracker): ("if @opacityID < 0 ", "if (@opacityID < 0) "), ("if countitem(\"MaggotSlime\") >= 10 goto", "if (countitem(\"MaggotSlime\") >= 10) goto"), ("if @colorID < 0 set", "if (@colorID < 0) set"), - ]; + ] for val in vals: - line = line.replace(val[0], val[1]); + line = line.replace(val[0], val[1]) idx = line.find("getmapmobs(") if idx >= 0: @@ -870,7 +870,7 @@ def processStrReplace(tracker): line = line.replace("getmapmobs(", "mobcount(") - m = setRe.search(line); + m = setRe.search(line) if m != None: line = "{0}{1} = {2};\n".format(m.group("space"), m.group("var"), m.group("val")) diff --git a/hercules/code/servertoclient/groups.py b/hercules/code/servertoclient/groups.py index 99424e5..6372c31 100644 --- a/hercules/code/servertoclient/groups.py +++ b/hercules/code/servertoclient/groups.py @@ -49,7 +49,7 @@ def readCommands(f): value = value[idx1 + 1: idx2 - idx1] parts = comaSplit.split(value) commands[name] = (parts[0].strip(), parts[1].strip()) - print "command: {0}, {1}".format(name, commands[name]) + print("command: {0}, {1}".format(name, commands[name])) return commands def readPermissions(f): @@ -63,7 +63,7 @@ def readPermissions(f): name = parts[0].strip() value = parts[1].strip() permissions[name] = value - print "permission: {0}, {1}".format(name, value) + print("permission: {0}, {1}".format(name, value)) return permissions def readInherit(data): @@ -98,26 +98,26 @@ def readGroup(groups, f): continue name = parts[0].strip() value = parts[1].strip() - print "line: {0}, {1}".format(name, value) + print("line: {0}, {1}".format(name, value)) if name == "id": fields["id"] = value elif name == "name": fields["name"] = value elif name == "commands": commands = readCommands(f) - print "Commands: {0}".format(commands) + print("Commands: {0}".format(commands)) elif name == "permissions": permissions = readPermissions(f) - print "Permissions: {0}".format(permissions) + print("Permissions: {0}".format(permissions)) elif name == "inherit": inherit = readInherit(value) - print "Inherit: {0}".format(inherit) + print("Inherit: {0}".format(inherit)) def getCommandType(data): if data[0] == "false" and data[1] == "false": return "false" elif data[0] == "false" and data[1] == "true": - return "other"; + return "other" elif data[0] == "true" and data[1] == "false": return "self" elif data[0] == "true" and data[1] == "true": diff --git a/hercules/code/servertoclient/homunculuses.py b/hercules/code/servertoclient/homunculuses.py index 678a96c..e95d9a1 100644 --- a/hercules/code/servertoclient/homunculuses.py +++ b/hercules/code/servertoclient/homunculuses.py @@ -16,7 +16,7 @@ def convertHomunculuses(): tpl = readFile(templatesDir + "homunculus.tpl") homunculuses = readFile(templatesDir + "homunculuses.xml") data = "" - homunculusSprite = "<sprite>monsters/tortuga.xml</sprite>"; + homunculusSprite = "<sprite>monsters/tortuga.xml</sprite>" with open(homunculusesDbFile, "r") as f: for line in f: if line == "" or line[0:2] == "//": diff --git a/hercules/code/servertoclient/items.py b/hercules/code/servertoclient/items.py index 3fdb531..fa408a9 100644 --- a/hercules/code/servertoclient/items.py +++ b/hercules/code/servertoclient/items.py @@ -85,46 +85,46 @@ def convertItems(): if itemType == 0 or itemType == 2 or itemType == 18: # usable image = "usable/bread.png" typeStr = "usable" - spriteStr = ""; + spriteStr = "" elif equipLocations == "0": image = "usable/bread.png" typeStr = "usable" - spriteStr = ""; + spriteStr = "" elif equipLocations == "1": image = "equipment/legs/shorts.png|S:#4d4d4d,514d47,686868,706662,919191,99917b,b6b6b6,c0b698,dfdfdf,e4dfca" typeStr = "equip-legs" - spriteStr = "equipment/legs/shorts-male.xml|#4d4d4d,514d47,686868,706662,919191,99917b,b6b6b6,c0b698,dfdfdf,e0d5bf"; + spriteStr = "equipment/legs/shorts-male.xml|#4d4d4d,514d47,686868,706662,919191,99917b,b6b6b6,c0b698,dfdfdf,e0d5bf" elif equipLocations == "2": image = "equipment/weapons/knife.png" typeStr = "equip-1hand" - spriteStr = "equipment/weapons/knife.xml"; + spriteStr = "equipment/weapons/knife.xml" elif equipLocations == "4": image = "equipment/hands/armbands.png" typeStr = "equip-arms" - spriteStr = "equipment/hands/armbands-male.xml"; + spriteStr = "equipment/hands/armbands-male.xml" elif equipLocations == "16": image = "equipment/chest/cottonshirt.png|S:#3c3c3c,3e3c38,4d4d4d,514d47,686868,706662,919191,99917b,b6b6b6,c0b698,dfdfdf,e4dfca" typeStr = "equip-torso" - spriteStr = "equipment/chest/cottonshirt-male.xml|#43413d,59544f,7a706c,8a8176,a69e88,d1c7a7,e0d5bf"; + spriteStr = "equipment/chest/cottonshirt-male.xml|#43413d,59544f,7a706c,8a8176,a69e88,d1c7a7,e0d5bf" elif equipLocations == "64": image = "equipment/feet/boots.png|S:#3c3c3c,40332d,4d4d4d,5e4a3d,686868,705740,919191,a1825d,b6b6b6,b59767,dfdfdf,dbbf88" typeStr = "equip-feet" - spriteStr = "equipment/feet/boots-male.xml|#40332d,5e4a3d,705740,a1825d,b59767,dbbf88"; + spriteStr = "equipment/feet/boots-male.xml|#40332d,5e4a3d,705740,a1825d,b59767,dbbf88" elif equipLocations == "136": image = "equipment/chest/cottonshirt.png|S:#3c3c3c,3e3c38,4d4d4d,514d47,686868,706662,919191,99917b,b6b6b6,c0b698,dfdfdf,e4dfca" typeStr = "equip-torso" - spriteStr = "equipment/chest/cottonshirt-male.xml|#43413d,59544f,7a706c,8a8176,a69e88,d1c7a7,e0d5bf"; + spriteStr = "equipment/chest/cottonshirt-male.xml|#43413d,59544f,7a706c,8a8176,a69e88,d1c7a7,e0d5bf" elif equipLocations == "256": image = "equipment/head/bandana.png" typeStr = "equip-head" - spriteStr = "equipment/head/bandana-male.xml"; + spriteStr = "equipment/head/bandana-male.xml" elif equipLocations == "512": # no sprites in evol image = "equipment/chest/sailorshirt.png" typeStr = "equip-torso" - spriteStr = "equipment/chest/shirt-male.xml|#131913,1b231d,233129,35433e,4e6059,6c8279;#72571e,836737,a5854d,b18f45"; + spriteStr = "equipment/chest/shirt-male.xml|#131913,1b231d,233129,35433e,4e6059,6c8279;#72571e,836737,a5854d,b18f45" - name = strToXml(name); + name = strToXml(name) if itemId not in ids: ids.add(itemId) diff --git a/hercules/code/servertoclient/maps.py b/hercules/code/servertoclient/maps.py index 0f1ca5b..7ac7e4f 100644 --- a/hercules/code/servertoclient/maps.py +++ b/hercules/code/servertoclient/maps.py @@ -20,7 +20,7 @@ def covertToTmx(f, mapsCount): tmx = readFile("templates/template.tmx") for i in xrange(0, mapsCount): name = readMapName(f) - print "converting map [{0:4}/{1:4}]: {2}".format(i, mapsCount + 1, name) + print("converting map [{0:4}/{1:4}]: {2}".format(i, mapsCount + 1, name)) sx = readInt16(f) sy = readInt16(f) sz = readInt32(f) @@ -37,11 +37,11 @@ def covertToTmx(f, mapsCount): if x + 1 == sx and y + 1 == sy: ground = ground + tile[0] collision = collision + tile[1] - fringe = fringe + "0"; + fringe = fringe + "0" else: ground = ground + tile[0] + "," collision = collision + tile[1] + "," - fringe = fringe + "0,"; + fringe = fringe + "0," ground = ground + "\n" collision = collision + "\n" fringe = fringe + "\n" diff --git a/hercules/code/servertoclient/mercenaries.py b/hercules/code/servertoclient/mercenaries.py index 481f66c..610e7d4 100644 --- a/hercules/code/servertoclient/mercenaries.py +++ b/hercules/code/servertoclient/mercenaries.py @@ -16,7 +16,7 @@ def convertMercenaries(): tpl = readFile(templatesDir + "mercenary.tpl") mercenaries = readFile(templatesDir + "mercenaries.xml") data = "" - mercenarySprite = "<sprite>monsters/croc.xml</sprite>"; + mercenarySprite = "<sprite>monsters/croc.xml</sprite>" with open(mercenariesDbFile, "r") as f: for line in f: if line == "" or line[0:2] == "//": diff --git a/hercules/code/servertoclient/monsters.py b/hercules/code/servertoclient/monsters.py index 969795d..0c8e3f7 100644 --- a/hercules/code/servertoclient/monsters.py +++ b/hercules/code/servertoclient/monsters.py @@ -35,7 +35,7 @@ def convertMonsters(isNonFree = False, idtofile = None): monsterSprite = "<sprite>sprites/{0}.xml</sprite>".format(idtofile[monsterId]) else: monsterSprite = """<sprite>monsters/blub.xml</sprite> - <sprite>accessories/blub-tentacle.xml|#3e4164,3a3968,544a82,64437a,7d6db4,a26392,8f99c4,d294ab,b3cdcd,e7b8b8,d9ecd1,f0e8c5</sprite>"""; + <sprite>accessories/blub-tentacle.xml|#3e4164,3a3968,544a82,64437a,7d6db4,a26392,8f99c4,d294ab,b3cdcd,e7b8b8,d9ecd1,f0e8c5</sprite>""" name = strToXml(stripQuotes(rows[2])) data = data + tpl.format(monsterId, name, monsterSprite) diff --git a/hercules/code/servertoclient/pets.py b/hercules/code/servertoclient/pets.py index bc6deef..6694ca7 100644 --- a/hercules/code/servertoclient/pets.py +++ b/hercules/code/servertoclient/pets.py @@ -16,7 +16,7 @@ def convertPets(): tpl = readFile(templatesDir + "pet.tpl") pets = readFile(templatesDir + "pets.xml") data = "" - petSprite = "<sprite>monsters/tortuga.xml</sprite>"; + petSprite = "<sprite>monsters/tortuga.xml</sprite>" with open(petsDbFile, "r") as f: for line in f: if line == "" or line[0:2] == "//": diff --git a/hercules/code/servertoclient/quests.py b/hercules/code/servertoclient/quests.py index df47fd5..b8874e1 100644 --- a/hercules/code/servertoclient/quests.py +++ b/hercules/code/servertoclient/quests.py @@ -9,7 +9,7 @@ from code.fileutils import makeDir, readFile, saveFile from code.stringutils import strToXml, stripQuotes def convertQuests(): - print "quests disabled for now" + print("quests disabled for now") return destDir = "clientdata/" templatesDir = "templates/" diff --git a/hercules/code/servertoclient/sprites.py b/hercules/code/servertoclient/sprites.py index 5dad9d1..4b683bc 100644 --- a/hercules/code/servertoclient/sprites.py +++ b/hercules/code/servertoclient/sprites.py @@ -55,7 +55,7 @@ def readIndexedRLEImage(f, spr): while readCnt < compressSize: c = readInt8(f) readCnt = readCnt + 1 - data[idx] = c; + data[idx] = c #print "{0:4}: {1}".format(idx, c) idx = idx + 1 if c == 0: @@ -132,7 +132,7 @@ def decodeSprite(spr): # png.save("test{0}.png".format(imageN)) if alpha: - print "detected alpha" + print("detected alpha") for imageN in range(0, spr.rgbaSpritesCount): image = spr.images[imageN + spr.indexedSpritesCount] @@ -206,7 +206,7 @@ def saveSpriteImage(act, spr, spriteDir, spriteName): continue if frame.frameIndex not in spr.images: - print "wrong frame index: {0}".format(frame.frameIndex) + print("wrong frame index: {0}".format(frame.frameIndex)) continue image = spr.images[frame.frameIndex] png = Image.new('RGBA', (image.width, image.height)) @@ -326,7 +326,7 @@ def readAct(actFile): act.minorVersion = readInt8(f) act.majorVersion = readInt8(f) act.nanimations = readInt16(f) - print "{0}, {1}.{2}, {3}".format(actFile, act.majorVersion, act.minorVersion, act.nanimations) + print("{0}, {1}.{2}, {3}".format(actFile, act.majorVersion, act.minorVersion, act.nanimations)) #print " animations: " + str(act.nanimations) act.animations = dict() skipData(f, 10) @@ -391,7 +391,7 @@ def readAct(actFile): act.events = dict() for eventN in range(0, act.nevents): event = ActEventClass() - act.events[eventN] = event; + act.events[eventN] = event event.name = readData(f, 40) if act.majorVersion > 2 or (act.majorVersion == 2 and act.minorVersion >= 2): for animN in range(0, act.nanimations): @@ -413,7 +413,7 @@ def readSpr(sprFile): spr.rgbaSpritesCount = readInt16(f) else: spr.rgbaSpritesCount = 0 - print "{0}, {1}.{2}, {3}, {4}".format(sprFile, spr.majorVersion, spr.minorVersion, spr.indexedSpritesCount, spr.rgbaSpritesCount) + print("{0}, {1}.{2}, {3}, {4}".format(sprFile, spr.majorVersion, spr.minorVersion, spr.indexedSpritesCount, spr.rgbaSpritesCount)) spr.frames = spr.indexedSpritesCount + spr.rgbaSpritesCount if spr.majorVersion > 2 or (spr.majorVersion == 2 and spr.minorVersion >= 1): @@ -455,13 +455,13 @@ def convertSpritesNonFree(idtofile): for spriteid in idtofile: spriteName = idtofile[spriteid] if spriteName in processed: - print "skipping " + spriteName + print("skipping " + spriteName) continue path = findSpritePath(spriteName) if path is None: - print "not found " + spriteName + print("not found " + spriteName) continue - print spriteName + print(spriteName) convertSprite(path, spriteName) processed.append(spriteName) diff --git a/hercules/code/stringutils.py b/hercules/code/stringutils.py index 73db611..986792d 100644 --- a/hercules/code/stringutils.py +++ b/hercules/code/stringutils.py @@ -24,9 +24,9 @@ def stripQuotes2(data): return data def strToXml(data): - data = data.replace("&", "&"); - data = data.replace("<", "<"); - data = data.replace(">", ">"); + data = data.replace("&", "&") + data = data.replace("<", "<") + data = data.replace(">", ">") return data def stripNewLine(data): @@ -49,11 +49,11 @@ def stripWindows(data): return data def escapeSqlStr(data): - data = data.replace("\\", "\\\\"); - data = data.replace("'", "\\'"); - data = data.replace("`", "\\`"); - data = data.replace("{", "\\{"); - data = data.replace("}", "\\}"); + data = data.replace("\\", "\\\\") + data = data.replace("'", "\\'") + data = data.replace("`", "\\`") + data = data.replace("{", "\\{") + data = data.replace("}", "\\}") return data def removeGat(data): diff --git a/hercules/convert_db.py b/hercules/convert_db.py index e10ad8a..0e361d9 100755 --- a/hercules/convert_db.py +++ b/hercules/convert_db.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2015 Evol Online @@ -10,8 +10,8 @@ from code.server.evol.main import dbEvolMain from code.server.tmw.main import dbTmwMain def showHelp(): - print "Usage: ./convert_db.py evol" - print " ./convert_db.py tmw" + print("Usage: ./convert_db.py evol") + print(" ./convert_db.py tmw") exit(1) if len(sys.argv) != 2: diff --git a/hercules/convert_groups.py b/hercules/convert_groups.py index cbb3988..89598b9 100755 --- a/hercules/convert_groups.py +++ b/hercules/convert_groups.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2017 Evol Online diff --git a/hercules/convert_mapcache_to_tmx.py b/hercules/convert_mapcache_to_tmx.py index e6e6bc9..15fc499 100755 --- a/hercules/convert_mapcache_to_tmx.py +++ b/hercules/convert_mapcache_to_tmx.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online @@ -13,10 +13,10 @@ def runFunction(path): with open(path, "rb") as f: size = readInt32(f) if os.path.getsize(path) != size: - print "Map cache corrupted, wrong file size." + print("Map cache corrupted, wrong file size.") exit(1) mapsCount = readInt16(f) - print "Maps count: " + str(mapsCount) + print("Maps count: " + str(mapsCount)) readInt16(f) # padding covertToTmx(f, mapsCount) diff --git a/hercules/convert_server.py b/hercules/convert_server.py index 83e9149..f474baa 100755 --- a/hercules/convert_server.py +++ b/hercules/convert_server.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online @@ -10,9 +10,9 @@ from code.server.evol.main import serverEvolMain from code.server.tmw.main import serverTmwMain def showHelp(): - print "Usage: ./convert_server.py evol" - print " ./convert_server.py tmwold" - print " ./convert_server.py tmwnew" + print("Usage: ./convert_server.py evol") + print(" ./convert_server.py tmwold") + print(" ./convert_server.py tmwnew") exit(1) if len(sys.argv) != 2: @@ -21,10 +21,10 @@ if len(sys.argv) != 2: serverType = sys.argv[1] if serverType == "evol": - serverEvolMain(); + serverEvolMain() elif serverType == "tmwold": - serverTmwMain(False); + serverTmwMain(False) elif serverType == "tmwnew": - serverTmwMain(True); + serverTmwMain(True) else: - print "Wrong parameter"
\ No newline at end of file + print("Wrong parameter")
\ No newline at end of file diff --git a/hercules/convert_server_to_client.py b/hercules/convert_server_to_client.py index f98ead3..f3d8c1f 100755 --- a/hercules/convert_server_to_client.py +++ b/hercules/convert_server_to_client.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online diff --git a/hercules/convert_tmx_to_mapcache.py b/hercules/convert_tmx_to_mapcache.py index 62d0d18..0f69634 100755 --- a/hercules/convert_tmx_to_mapcache.py +++ b/hercules/convert_tmx_to_mapcache.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online @@ -6,4 +6,4 @@ from code.clienttoserver.maps import recreateMapCache -recreateMapCache(); +recreateMapCache() diff --git a/hercules/extract_mapcache.py b/hercules/extract_mapcache.py index 39a63c3..9facbeb 100755 --- a/hercules/extract_mapcache.py +++ b/hercules/extract_mapcache.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online @@ -14,10 +14,10 @@ def runFunction(path): with open(path, "rb") as f: size = readInt32(f) if os.path.getsize(path) != size: - print "Map cache corrupted, wrong file size." + print("Map cache corrupted, wrong file size.") exit(1) mapsCount = readInt16(f) - print "Maps count: " + str(mapsCount) + print("Maps count: " + str(mapsCount)) readInt16(f) # padding extractMaps(f, mapsCount) diff --git a/hercules/list_mapcache.py b/hercules/list_mapcache.py index 2a83f53..5288d95 100755 --- a/hercules/list_mapcache.py +++ b/hercules/list_mapcache.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2014 Evol Online @@ -13,10 +13,10 @@ def runFunction(path): with open(path, "rb") as f: size = readInt32(f) if os.path.getsize(path) != size: - print "Map cache corrupted, wrong file size." + print("Map cache corrupted, wrong file size.") exit(1) mapsCount = readInt16(f) - print "Maps count: " + str(mapsCount) + print("Maps count: " + str(mapsCount)) readInt16(f) # padding listMapCache(f, mapsCount) diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py index a6b0943..76bfa4f 100755 --- a/hercules/tmx_converter.py +++ b/hercules/tmx_converter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- encoding: utf-8 -*- ## tmx_converter.py - Extract walkmap, warp, and spawn information from maps. @@ -468,8 +468,8 @@ class ContentHandler(xml.sax.ContentHandler): ]) ) self.warp_cnt = True - except AttributeError, prop: - print("\n\nERROR: missing property on object \"%s\": %s is mandatory on a %s object." % (obj.name, prop, obj.__class__.__name__.lower())); + except AttributeError as prop: + print("\n\nERROR: missing property on object \"%s\": %s is mandatory on a %s object." % (obj.name, prop, obj.__class__.__name__.lower())) raise if name == u'data': @@ -558,7 +558,7 @@ def main(argv): map_db.write('%s %d\n' % (arg.split('.')[0], map_count)) map_conf.write(' "%s",\n' % (arg.split('.')[0])) map_count += 1 - except Exception, e: + except Exception as e: if 'CI' in os.environ and str(e) != 'ignore': raise # re-raise to make CI jobs fail elif str(e) == 'ignore': diff --git a/lang/fetch.py b/lang/fetch.py index a0e454a..1d8f3ab 100755 --- a/lang/fetch.py +++ b/lang/fetch.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2018 TMW-2 diff --git a/lang/updatelang.py b/lang/updatelang.py index aa36823..44ecb5c 100755 --- a/lang/updatelang.py +++ b/lang/updatelang.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2010-2015 Evol Online @@ -27,7 +27,7 @@ langs = set() itemNamesByName = dict() def addStr(text, comment, fileName, lineNum, addNoC): - text = text.replace("\a", "\""); + text = text.replace("\a", "\"") allStrings.add(text) if comment[-1:] == "\n": comment = comment[:-1] @@ -45,7 +45,7 @@ def collectScriptFileStrings(codeFile, file2): cnt = -1 for line in f: cnt = cnt + 1 - line = line.replace("\\\"", "\a"); + line = line.replace("\\\"", "\a") m = strre1.findall(line) if len(m) > 0: for str in m: @@ -123,8 +123,7 @@ def parseFile(name, readFirstLine): firstLine = None if os.path.exists(name): with open(name, "r") as f: - line1 = ""; - line2 = ""; + line1 = line2 = "" for line in f: if readFirstLine is True and firstLine is None: firstLine = line @@ -178,7 +177,7 @@ def parsePoFile(name, path): if flag == 2: if line1 != "": if line1 in langFile and line2 != "": - langFile[line1] = line2.replace("\\\"", "\""); + langFile[line1] = line2.replace("\\\"", "\"") flag = 0 idx = line.find ("\"") @@ -285,7 +284,7 @@ def writePoFile(poDir, texts, trans): else: langDir = poDir + "/" + trans + ".po" - print langDir + print(langDir) with open (langDir, "w") as w: w.write ("# " + texts[1] + "") w.write ("#\n\n") @@ -301,13 +300,13 @@ def writePoFile(poDir, texts, trans): writePoComments(w, strComments[line[0]]) srcLine = line[0] - srcLine = srcLine.replace("\\", "\\\\"); + srcLine = srcLine.replace("\\", "\\\\") srcLine = srcLine.replace("\"", "\\\"") w.write ("msgid \"" + srcLine + "\"\n") trLine = line[1] if trans == "en": trLine = "" - trLine = trLine.replace("\\", "\\\\"); + trLine = trLine.replace("\\", "\\\\") trLine = trLine.replace("\"", "\\\"") w.write ("msgstr \"" + trLine + "\"\n\n") @@ -353,21 +352,21 @@ def loadItemDb(dir): def dumpTranslations(): for trans in oldLangFiles: - print "old lang: " + trans + print("old lang: " + trans) newFile = oldLangFiles[trans][0] for line in newFile: - print line + print(line) if line in newFile: - print newFile[line] - print "\n" + print(newFile[line]) + print("\n") for trans in langFiles: - print "new lang: " + trans + print("new lang: " + trans) newFile = langFiles[trans][0] for line in newFile: - print line + print(line) if line in newFile: - print newFile[line] - print "\n" + print(newFile[line]) + print("\n") def loadMobNames(dir): @@ -392,8 +391,8 @@ collectScriptFileStrings("db/pre-re/item_db.conf", rootPath + "/db/pre-re/item_d #collectMessages(rootPath + "/conf/messages.conf") loadFiles(rootPath + "/langs") addMissingLines() -loadPoFiles("in"); -#dumpTranslations(); +loadPoFiles("in") +#dumpTranslations() sorting() saveFiles(rootPath + "/langs", "out") os.rename("out/"+defaultLang+".pot", "serverdata.pot") diff --git a/lang_client/fetch.py b/lang_client/fetch.py index 1058e43..3a8cee4 100755 --- a/lang_client/fetch.py +++ b/lang_client/fetch.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2018 TMW-2 diff --git a/wiki/redesign.py b/wiki/redesign.py index d2828d7..5a17b9a 100755 --- a/wiki/redesign.py +++ b/wiki/redesign.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2010-2011 Evol Online @@ -279,7 +279,7 @@ def testMobs(): x=Mob() # Only for pyflakes2 for a2 in src: - a=a2.replace(' ', '\t'); + a=a2.replace(' ', '\t') if a == "{\n": if skip: skip=0 @@ -743,7 +743,7 @@ wikib.close() # Aeros allocation if aeros: - print("// These arrays are filled automatically by redesign.py"); + print("// These arrays are filled automatically by redesign.py") print("setarray .ML_Plants, "+ str(Plants).replace('[','').replace(']','').replace("'","")+";") print("setarray .ML_Boss, "+ diff --git a/wiki/wikigen.py b/wiki/wikigen.py index 7a7d2ec..7c2bfe6 100755 --- a/wiki/wikigen.py +++ b/wiki/wikigen.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf8 -*- # # Copyright (C) 2010-2011 Evol Online @@ -844,7 +844,7 @@ def DoQuest(): aksort.append(i.group) for key in aktbl: - #print(aktbl[key]); + #print(aktbl[key]) aktbl[key]=sorted(aktbl[key], key=sortlv) # Individual file |