From b4ed526ead34b12c801f33889d21c7207796ce4f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 1 Nov 2014 16:24:46 +0300 Subject: hercules: add conversion for map flags. --- hercules/code/server/npcs.py | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'hercules/code/server/npcs.py') 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[^/](.+))[.]gat,([ ]*)(?P[\d]+),([ ]*)(?P[\d "[\t](?Pshop)[\t](?P[\w#' ]+)[\t]" "(?P[\d]+),(?P(.+))$") +mapFlagRe = re.compile("^(?P[^/](.+))[.]gat" + + "[ ](?Pmapflag)[ ](?P[\w#']+)(|[ ](?P.*))$") + 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"))) + -- cgit v1.2.3-70-g09d2