diff options
Diffstat (limited to 'hercules/code/server')
-rw-r--r-- | hercules/code/server/npcs.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/hercules/code/server/npcs.py b/hercules/code/server/npcs.py index 6b59736..a9d7ed1 100644 --- a/hercules/code/server/npcs.py +++ b/hercules/code/server/npcs.py @@ -26,6 +26,10 @@ mapFlagRe = re.compile("^(?P<map>[^/](.+))[.]gat" + warpRe = re.compile("^(?P<map>[^/](.+))[.]gat,([ ]*)(?P<x>[\d]+),([ ]*)(?P<y>[\d]+)[\t]" "(?P<tag>warp)[\t](?P<name>[^\t]+)[\t](?P<xs>[\d-]+),(?P<ys>[\d-]+),(?P<targetmap>[^/](.+))[.]gat,([ ]*)(?P<targetx>[\d]+),([ ]*)(?P<targety>[\d]+)$") +monsterRe = re.compile("^(?P<map>[^/](.+))[.]gat,([ ]*)(?P<x>[\d]+),([ ]*)(?P<y>[\d]+),([ ]*)(?P<xs>[\d-]+),(?P<ys>[\d-]+)\t" + "(?P<tag>monster)[\t](?P<name>[\w#' ]+)[\t]" + "(?P<class>[\d]+),(?P<num>[\d]+),(?P<look>[\d-]+),(?P<delay1>[\d]+),(?P<delay2>[\d]+)$") + class ScriptTracker: pass @@ -79,6 +83,10 @@ def convertTextLine(tracker): if idx >= 0: processShop(tracker) return False + idx = line.find("\tmonster\t") + if idx >= 0: + processMonster(tracker) + return False idx = line.find("\twarp\t") if idx >= 0: processWarp(tracker) @@ -225,6 +233,28 @@ def processWarp(tracker): xs, ys, m.group("targetmap"), m.group("targetx"), m.group("targety"))) +def processMonster(tracker): + line = tracker.line + w = tracker.w + m = monsterRe.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} xy={1},{2} xs={3} ys={4} tag={5} name={6} class={7} " + +# "num={8} look={9} delays={10},{11}").format( +# m.group("map"), m.group("x"), m.group("y"), m.group("xs"), m.group("ys"), +# m.group("tag"), m.group("name"), m.group("class"), +# m.group("num"), m.group("look"), m.group("delay1"), m.group("delay2")) + w.write("{0},{1},{2},{3},{4}\t{5}\t{6}\t{7},{8},{9},{10}\n".format(m.group("map"), + m.group("x"), m.group("y"), m.group("xs"), m.group("ys"), + m.group("tag"), m.group("name"), + m.group("class"), m.group("num"), m.group("delay1"), m.group("delay2"))) + + def processStrReplace(tracker): line = tracker.line w = tracker.w |