From 38fcd221d8fe03208abdafe0f01a6e54a601b71a Mon Sep 17 00:00:00 2001 From: jak1 Date: Sun, 19 Jun 2022 09:34:16 +0200 Subject: updated all leftover scripts to py3 --- hercules/code/server/tmw/athena.py | 8 ++++---- hercules/code/server/tmw/consts.py | 10 +++++----- hercules/code/server/tmw/itemdb.py | 6 +++--- hercules/code/server/tmw/main.py | 4 ++-- hercules/code/server/tmw/mobdb.py | 4 ++-- hercules/code/server/tmw/npcs.py | 38 +++++++++++++++++++------------------- 6 files changed, 35 insertions(+), 35 deletions(-) (limited to 'hercules/code/server/tmw') 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[^/](.+))[.]gat,([ ]*)(?P[\d]+),([ ]*)(?Pmonster)[\t](?P[\w#' ]+)([\t]+)" "(?P[\d]+),(?P[\d]+),(?P[\d]+),(?P[\d]+)(|,(?P