summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-01 16:24:46 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-01 16:24:46 +0300
commitb4ed526ead34b12c801f33889d21c7207796ce4f (patch)
treeb9e662df99fe6d0cb4982d0073e6d8dac4744971
parent2c1e16bd1e47dcaf33ad16367bc44b47a4ffa0b8 (diff)
downloadevol-tools-b4ed526ead34b12c801f33889d21c7207796ce4f.tar.gz
evol-tools-b4ed526ead34b12c801f33889d21c7207796ce4f.tar.bz2
evol-tools-b4ed526ead34b12c801f33889d21c7207796ce4f.tar.xz
evol-tools-b4ed526ead34b12c801f33889d21c7207796ce4f.zip
hercules: add conversion for map flags.
-rw-r--r--hercules/code/server/npcs.py40
1 files changed, 36 insertions, 4 deletions
diff --git a/hercules/code/server/npcs.py b/hercules/code/server/npcs.py
index a60ce81..f3e95c3 100644
--- a/hercules/code/server/npcs.py
+++ b/hercules/code/server/npcs.py
@@ -20,6 +20,9 @@ shopRe = re.compile("^(?P<map>[^/](.+))[.]gat,([ ]*)(?P<x>[\d]+),([ ]*)(?P<y>[\d
"[\t](?P<tag>shop)[\t](?P<name>[\w#' ]+)[\t]"
"(?P<class>[\d]+),(?P<items>(.+))$")
+mapFlagRe = re.compile("^(?P<map>[^/](.+))[.]gat" +
+ "[ ](?P<tag>mapflag)[ ](?P<name>[\w#']+)(|[ ](?P<flag>.*))$")
+
class ScriptTracker:
pass
@@ -71,6 +74,10 @@ def convertTextLine(tracker):
if idx >= 0:
processShop(tracker)
return False
+ idx = line.find(".gat mapflag ")
+ if idx >= 0:
+ processMapFlag(tracker)
+ return False
return True
def processScriptMapLine(line):
@@ -131,10 +138,35 @@ def processShop(tracker):
w.write("!!!error parsing line")
w.write(line)
return
- print "source=" + line[:-1]
- print "map={0} x={1} y={2} dir={3} gender={4} tag={5} name={6} class={7} items={8}".format(
- m.group("map"), m.group("x"), m.group("y"), m.group("dir"), m.group("gender"),
- m.group("tag"), m.group("name"), m.group("class"), m.group("items"))
+# print "source=" + line[:-1]
+# print "map={0} x={1} y={2} dir={3} gender={4} tag={5} name={6} class={7} items={8}".format(
+# m.group("map"), m.group("x"), m.group("y"), m.group("dir"), m.group("gender"),
+# m.group("tag"), m.group("name"), m.group("class"), m.group("items"))
writeScript(w, m)
w.write("," + m.group("items") + "\n")
+
+def processMapFlag(tracker):
+ line = tracker.line
+ w = tracker.w
+
+ m = mapFlagRe.search(line)
+ if m == None:
+ print "error in parsing: " + line
+ w.write("!!!error parsing line")
+ w.write(line)
+ return
+# print "source=" + line[:-1]
+# print "map={0} tag={1} name={2} flag={3}".format(
+# m.group("map"), m.group("tag"), m.group("name"), m.group("flag"))
+
+ if m.group("name") == "invisible":
+ w.write("// {0}\n".format(line));
+ return
+
+ w.write("{0}\t{1}\t{2}".format(m.group("map"), m.group("tag"), m.group("name")))
+ if m.group("flag") == None:
+ w.write("\n")
+ else:
+ w.write("\t{0}\n".format(m.group("flag")))
+