summaryrefslogtreecommitdiff
path: root/hercules/code/server
diff options
context:
space:
mode:
authorjak1 <jak1@themanaworld.org>2022-06-19 09:34:16 +0200
committerjak1 <jak1@themanaworld.org>2022-06-19 09:34:16 +0200
commit38fcd221d8fe03208abdafe0f01a6e54a601b71a (patch)
tree6a1ba5a5943b9dc0617e0046b39b82ba2284d53e /hercules/code/server
parent9a351fb1abd5694bbbb7e38fcb64bb30b3fa74bb (diff)
downloadmessworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.tar.gz
messworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.tar.bz2
messworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.tar.xz
messworld-tools-38fcd221d8fe03208abdafe0f01a6e54a601b71a.zip
updated all leftover scripts to py3HEADmaster
Diffstat (limited to 'hercules/code/server')
-rw-r--r--hercules/code/server/account.py2
-rw-r--r--hercules/code/server/accreg.py2
-rw-r--r--hercules/code/server/evol/athena.py8
-rw-r--r--hercules/code/server/evol/consts.py4
-rw-r--r--hercules/code/server/evol/itemdb.py2
-rw-r--r--hercules/code/server/evol/main.py2
-rw-r--r--hercules/code/server/evol/npcs.py24
-rw-r--r--hercules/code/server/maps.py6
-rw-r--r--hercules/code/server/party.py2
-rw-r--r--hercules/code/server/storage.py2
-rw-r--r--hercules/code/server/tmw/athena.py8
-rw-r--r--hercules/code/server/tmw/consts.py10
-rw-r--r--hercules/code/server/tmw/itemdb.py6
-rw-r--r--hercules/code/server/tmw/main.py4
-rw-r--r--hercules/code/server/tmw/mobdb.py4
-rw-r--r--hercules/code/server/tmw/npcs.py38
16 files changed, 62 insertions, 62 deletions
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"))