summaryrefslogtreecommitdiff
path: root/hercules/code
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-24 12:37:53 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-24 12:37:53 +0300
commit82e46225071629e5cb9f4c54c57bea2e0e8e292d (patch)
treeff8f6fc1be1d244707d13e83a9de0b66bcb5132a /hercules/code
parent77dec55fb286637d4bc1ebbc7f44779af9371fee (diff)
downloadtools-82e46225071629e5cb9f4c54c57bea2e0e8e292d.tar.gz
tools-82e46225071629e5cb9f4c54c57bea2e0e8e292d.tar.bz2
tools-82e46225071629e5cb9f4c54c57bea2e0e8e292d.tar.xz
tools-82e46225071629e5cb9f4c54c57bea2e0e8e292d.zip
hercules: convert mob spawns.
Diffstat (limited to 'hercules/code')
-rw-r--r--hercules/code/server/npcs.py30
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