From 538a95cb0d9022c5c253a53b618557160569a495 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 31 Dec 2014 21:03:59 +0300 Subject: hercules: tmw: fix DailyQuestPoints variable and function name conflict. --- hercules/code/server/tmw/npcs.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'hercules/code/server/tmw') diff --git a/hercules/code/server/tmw/npcs.py b/hercules/code/server/tmw/npcs.py index 4a38c9c..938f8ac 100644 --- a/hercules/code/server/tmw/npcs.py +++ b/hercules/code/server/tmw/npcs.py @@ -131,7 +131,10 @@ def writeScript(w, m): else: w.write("{0},{1},{2},{3}".format(m.group("map"), m.group("x"), m.group("y"), m.group("dir"))) if isFunction: - w.write("\t{0}\t{1}\t".format(m.group("tag"), m.group("name"))); + funcName = m.group("name") + if funcName == "DailyQuestPoints": + funcName = "DailyQuestPointsFunc" + w.write("\t{0}\t{1}\t".format(m.group("tag"), funcName)); else: class_ = m.group("class") if class_ == "0": # hidden npc @@ -156,11 +159,6 @@ def processScript(tracker): # m.group("map"), m.group("x"), m.group("y"), m.group("dir"), # m.group("tag"), m.group("name"), m.group("class"), m.group("xs"), m.group("ys")) - writeScript(w, m) - if m.group("xs") != None: - w.write(",{0},{1}".format(m.group("xs"), m.group("ys"))); - - try: if m.group("function") != None: isFunction = True @@ -168,6 +166,12 @@ def processScript(tracker): isFunction = False except: isFunction = True + + writeScript(w, m) + + if m.group("xs") != None: + w.write(",{0},{1}".format(m.group("xs"), m.group("ys"))); + if isFunction == False: w.write(",{\n"); else: @@ -291,8 +295,13 @@ def processStrReplace(tracker): line = line.replace("sc_poison", "SC_POISON") line = line.replace("sc_slowpoison", "SC_SLOWPOISON") line = line.replace("countitem(", "countitemcolor(") + line = line.replace("Bugleg", "BugLeg") line = re.sub("([^@^$])@([^@])", "\\1.@\\2", line) line = line.replace(".@menu", "@menu") + + # fix at same time usage with same name function and variable + line = line.replace("\"DailyQuestPoints\"", "\"DailyQuestPointsFunc\"") + idx = line.find("getmapmobs(") if idx >= 0: idx2 = line.find("\"", idx + len("getmapmobs(") + 1) -- cgit v1.2.3-70-g09d2