summaryrefslogtreecommitdiff
path: root/hercules/code/server/tmw/npcs.py
diff options
context:
space:
mode:
Diffstat (limited to 'hercules/code/server/tmw/npcs.py')
-rw-r--r--hercules/code/server/tmw/npcs.py38
1 files changed, 19 insertions, 19 deletions
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"))