diff options
Diffstat (limited to 'hercules')
-rw-r--r-- | hercules/code/server/npcs.py | 40 |
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"))) + |