Exemple #1
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "30512-03.htm":
         st.playSound("ItemSound.quest_accept")
         st.set("cond", "1")
         st.setState(State.STARTED)
     elif event == "30673-04.htm":
         st.set("cond", "2")
         st.playSound("ItemSound.quest_middle")
     elif event == "30621-02.htm":
         if player.getLevel() < 50:
             st.addExpAndSp(60000, 3000)
         st.giveItems(57, 18100)
         st.exitQuest(False)
         st.playSound("ItemSound.quest_finish")
     elif event == "Contract":
         q1 = QuestManager.getInstance().getQuest(
             "184_Nikolas_Cooperation_Contract")
         if q1:
             qs1 = q1.newQuestState(player)
             qs1.setState(State.STARTED)
             q1.notifyEvent("30621-01.htm", npc, player)
         return
     elif event == "Consideration":
         q2 = QuestManager.getInstance().getQuest(
             "185_Nikolas_Cooperation_Consideration")
         if q2:
             qs2 = q2.newQuestState(st.getPlayer())
             qs2.setState(State.STARTED)
             q2.notifyEvent("30621-01.htm", npc, player)
         return
     return htmltext
 def onAdvEvent (self,event,npc, player) :
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "30512-03.htm":
         st.playSound("ItemSound.quest_accept")
         st.set("cond","1")
         st.setState(State.STARTED)
     elif event == "30673-04.htm":
         st.set("cond","2")
         st.playSound("ItemSound.quest_middle")
     elif event == "30621-02.htm":
         if player.getLevel() < 50:
            st.addExpAndSp(60000,3000)
         st.giveItems(57,18100)
         st.exitQuest(False)
         st.playSound("ItemSound.quest_finish")
     elif event == "Contract" :
         q1 = QuestManager.getInstance().getQuest("184_Nikolas_Cooperation_Contract")
         if q1 :
             qs1 = q1.newQuestState(player)
             qs1.setState(State.STARTED)
             q1.notifyEvent("30621-01.htm",npc,player)
         return
     elif event == "Consideration" :
         q2 = QuestManager.getInstance().getQuest("185_Nikolas_Cooperation_Consideration")
         if q2 :
             qs2 = q2.newQuestState(st.getPlayer())
             qs2.setState(State.STARTED)
             q2.notifyEvent("30621-01.htm",npc,player)
         return
     return htmltext
 def onFirstTalk(self, npc, player):
     qs = player.getQuestState("184_Nikolas_Cooperation_Contract")
     qs2 = player.getQuestState("185_Nikolas_Cooperation_Consideration")
     qs3 = player.getQuestState("186_Contract_Execution")
     qs4 = player.getQuestState("187_Nikolas_Heart")
     qs5 = player.getQuestState("188_Seal_Removal")
     q4 = QuestManager.getInstance().getQuest("187_Nikolas_Heart")
     q5 = QuestManager.getInstance().getQuest("188_Seal_Removal")
     if qs or qs2:
         if qs3 or qs4 or qs5 or not q4 or not q5:
             npc.showChatWindow(player)
             return None
         if qs and qs.getState() == State.COMPLETED:
             if qs.getQuestItemsCount(Certificate):
                 qs3 = self.newQuestState(player)
                 qs3.setState(State.STARTED)
             else:
                 qs5 = q5.newQuestState(player)
                 qs5.setState(State.STARTED)
         elif qs2 and qs2.getState() == State.COMPLETED:
             if qs2.getQuestItemsCount(Certificate):
                 qs4 = q4.newQuestState(player)
                 qs4.setState(State.STARTED)
             else:
                 qs5 = q5.newQuestState(player)
                 qs5.setState(State.STARTED)
     npc.showChatWindow(player)
     return None
Exemple #4
0
 def onFirstTalk (self,npc,player):
    qs = player.getQuestState("184_Nikolas_Cooperation_Contract")
    qs2 = player.getQuestState("185_Nikolas_Cooperation_Consideration")
    qs3 = player.getQuestState("186_Contract_Execution")
    qs4 = player.getQuestState("187_Nikolas_Heart")
    qs5 = player.getQuestState("188_Seal_Removal")
    q4 = QuestManager.getInstance().getQuest("187_Nikolas_Heart")
    q5 = QuestManager.getInstance().getQuest("188_Seal_Removal")
    if qs or qs2 :
        if qs3 or qs4 or qs5 or not q4 or not q5:
            npc.showChatWindow(player)
            return None
        if qs and qs.getState() == State.COMPLETED:
            if qs.getQuestItemsCount(Certificate) :
                qs3 = self.newQuestState(player)
                qs3.setState(State.STARTED)
            else :
                qs5 = q5.newQuestState(player)
                qs5.setState(State.STARTED)
        elif qs2 and qs2.getState() == State.COMPLETED:
            if qs2.getQuestItemsCount(Certificate) :
                qs4 = q4.newQuestState(player)
                qs4.setState(State.STARTED)
            else :
                qs5 = q5.newQuestState(player)
                qs5.setState(State.STARTED)
    npc.showChatWindow(player)
    return None
Exemple #5
0
 def onAdvEvent(self, event, npc, player):
     htmltext = event
     st = player.getQuestState(qn)
     if not st: return
     id = st.getState()
     cond = st.getInt("cond")
     if event == "30894-02.htm":
         st.set("cond", "1")
         st.playSound("ItemSound.quest_accept")
     elif event == "30894-04.htm":
         st.set("cond", "2")
         st.playSound("ItemSound.quest_middle")
     elif event == "30894-15.htm":
         st.set("cond", "4")
         st.unset("talk")
         st.playSound("ItemSound.quest_middle")
     elif event == "30894-18.htm":
         st.playSound("ItemSound.quest_finish")
         st.exitQuest(False)
         st.giveItems(57, 88888)
         player = st.getPlayer()
         if player.getLevel() >= 37 and player.getLevel() <= 42:
             st.addExpAndSp(278005, 17058)
         qs = player.getQuestState("998_FallenAngelSelect")
         if not qs:
             q = QuestManager.getInstance().getQuest(
                 "998_FallenAngelSelect")
             if q:
                 qs = q.newQuestState(player)
         qs.setState(State.STARTED)
     return htmltext
Exemple #6
0
 def onAdvEvent (self,event,npc, player) :
    htmltext = event
    st = player.getQuestState(qn)
    if not st : return
    id = st.getState()
    cond = st.getInt("cond")
    if event == "30894-02.htm" :
       st.set("cond","1")
       st.playSound("ItemSound.quest_accept")
    elif event == "30894-04.htm" :
       st.set("cond","2")
       st.playSound("ItemSound.quest_middle")
    elif event == "30894-15.htm" :
       st.set("cond","4")
       st.unset("talk")
       st.playSound("ItemSound.quest_middle")
    elif event == "30894-18.htm" :
       st.playSound("ItemSound.quest_finish")
       st.exitQuest(False)
       st.giveItems(57, 88888)
       player = st.getPlayer()
       if player.getLevel() >= 37 and player.getLevel() <= 42:
          st.addExpAndSp(278005,17058)
       qs = player.getQuestState("998_FallenAngelSelect")
       if not qs:
           q = QuestManager.getInstance().getQuest("998_FallenAngelSelect")
           if q :
               qs = q.newQuestState(player)
       qs.setState(State.STARTED)
    return htmltext
Exemple #7
0
	def icefairysirra_unlock(self):
		q = QuestManager.getInstance().getQuest("IceFairySirra")
		self.saveGlobalQuestVar("Sirra_Respawn", "0")
		try:
			q.cancelQuestTimers("respawn")
			q.startQuestTimer("respawn", 1000, None, None)
		except:
			pass
Exemple #8
0
 def onEvent (self,event,st) :
    if event == "dawn" :
       q1 = QuestManager.getInstance().getQuest("142_FallenAngelRequestOfDawn")
       if q1 :
          qs1 = q1.newQuestState(st.getPlayer())
          qs1.setState(State.STARTED)
          q1.notifyEvent("30894-01.htm",None,st.getPlayer())
          st.setState(State.COMPLETED)
       return
    elif event == "dusk" :
       q2 = QuestManager.getInstance().getQuest("143_FallenAngelRequestOfDusk")
       if q2 :
          qs2 = q2.newQuestState(st.getPlayer())
          qs2.setState(State.STARTED)
          q2.notifyEvent("30894-01.htm",None,st.getPlayer())
          st.setState(State.COMPLETED)
       return
    return event
 def onEvent (self,event,st) :
    if event == "dawn" :
       q1 = QuestManager.getInstance().getQuest("142_FallenAngelRequestOfDawn")
       if q1 :
          qs1 = q1.newQuestState(st.getPlayer())
          qs1.setState(State.STARTED)
          q1.notifyEvent("30894-01.htm",None,st.getPlayer())
          st.setState(State.COMPLETED)
       return
    elif event == "dusk" :
       q2 = QuestManager.getInstance().getQuest("143_FallenAngelRequestOfDusk")
       if q2 :
          qs2 = q2.newQuestState(st.getPlayer())
          qs2.setState(State.STARTED)
          q2.notifyEvent("30894-01.htm",None,st.getPlayer())
          st.setState(State.COMPLETED)
       return
    return event
 def onFirstTalk (self,npc,player):
    st = player.getQuestState(qn)
    q2 = QuestManager.getInstance().getQuest("184_Nikolas_Cooperation_Contract")
    if st:
        player.setLastQuestNpcObject(npc.getObjectId())
        return "32367-01.htm"
    elif q2:
        player.setLastQuestNpcObject(npc.getObjectId())
        q2.notifyEvent("32367-01.htm",npc,player)
    return None
Exemple #11
0
 def onFirstTalk (self,npc,player):
    st = player.getQuestState(qn)
    q2 = QuestManager.getInstance().getQuest("184_Nikolas_Cooperation_Contract")
    if st:
        player.setLastQuestNpcObject(npc.getObjectId())
        return "32367-01.htm"
    elif q2:
        player.setLastQuestNpcObject(npc.getObjectId())
        q2.notifyEvent("32367-01.htm",npc,player)
    return None
Exemple #12
0
	def general_unlock(self, arg):
		quest_name, unlock_timer_name = arg
		if len(quest_name) > 0:
			q = QuestManager.getInstance().getQuest(quest_name)
			if len(unlock_timer_name) > 0:
				try:
					q.cancelQuestTimers(unlock_timer_name)
					q.startQuestTimer(unlock_timer_name, 1000, None, None)
				except:
					pass
Exemple #13
0
	def reset_queststate(self, player, quest_name):
		qs = player.getQuestState(quest_name)
		if qs:
			qs.setState(State.STARTED);
			qs.exitQuest(True)
			if quest_name == "10286_ReunionWithSirra":
				q = QuestManager.getInstance().getQuest("10286_ReunionWithSirra")
				st = player.getQuestState(quest_name)
				if not st:
					st = q.newQuestState(player)
					st.setState(State.STARTED)
				st.set("cond", "1")
				st.set("cond", "2")
				st.set("cond", "3")
				st.set("cond", "4")
				st.set("cond", "5")
				st.set("Ex", "2")
				st.set("progress", "2")
Exemple #14
0
 def webadmin_restart(self):
     self.webadmin_stop()
     QuestManager.getInstance().reload(self.qn)
Exemple #15
0
    def handleImpl(self, exchange, ibuff):
        r = ""
        try:
            uri = exchange.getRequestURI()
            command = uri.getPath().split("/")
            if not command[1] == "ajax":
                raise

            query = {}
            try:
                for x in uri.getRawQuery().split("&"):
                    x2 = URLDecoder().decode(x, "UTF-8")
                    k, v = x2.split("=", 1)
                    query[k] = v
            except:
                pass

            if command[2] == "webadmin":

                if command[3] == "stop":
                    q = QuestManager.getInstance().getQuest(WebAdmin.qn)
                    try:
                        q.cancelQuestTimers("webadmin_stop")
                        q.startQuestTimer("webadmin_stop", 1000, None, None)
                    except:
                        pass
                    r = "webAdmin stop"
                elif command[3] == "restart":
                    q = QuestManager.getInstance().getQuest(WebAdmin.qn)
                    try:
                        q.cancelQuestTimers("webadmin_restart")
                        q.startQuestTimer("webadmin_restart", 1000, None, None)
                    except:
                        pass
                    r = "webAdmin restart"
                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "quest":

                if command[3] == "list":
                    r2 = {}
                    for quest in QuestManager.getInstance().getAllManagedScripts():
                        qn = quest.getName()
                        r2[qn] = {}
                        if "req" in query:
                            for c in query["req"].split(","):
                                r2[qn][c] = self.getQuestInfo(c, quest)
                    r2 = r2.items()
                    r2.sort()
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json")

                elif command[3] == "unload":
                    if not self.checkQuery(query, ["name"]):
                        raise
                    QuestManager.getInstance().getQuest(query["name"]).unload()

                elif command[3] == "reload":
                    if not self.checkQuery(query, ["name"]):
                        raise
                    QuestManager.getInstance().getQuest(query["name"]).reload()

                elif command[3] == "get_source":
                    if not self.checkQuery(query, ["name"]):
                        raise
                    file = QuestManager.getInstance().getQuest(query["name"]).getScriptFile()
                    try:
                        i = open(file.toString(), "r")
                    except:
                        exchange.sendResponseHeaders(404, 0)
                        return
                    r = i.read()
                    i.close()
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "text/plain; charset=utf-8")

                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "script":
                if command[3] == "writefile_exec":
                    if not self.checkQuery(query, ["file"]):
                        raise
                    query["file"] = query["file"].replace("\\", "/")
                    query["file"] = query["file"].split("/")[-1]
                    path = sourcepath.replace("\\", "/") + "/custom/WebAdmin/WebRoot/temp/" + query["file"]
                    o = open(path, "w")
                    o.write(ibuff)
                    o.close()
                    file = File(path)
                    try:
                        L2ScriptEngineManager.getInstance().executeScript(file)
                    except ScriptException, e:
                        L2ScriptEngineManager.getInstance().reportScriptFileError(file, e)

                elif command[3] == "execjy":
                    pre_script = """
import sys
sys.stdout = out_writer
sys.stderr = out_writer
"""
                    post_script = """
import sys
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
"""
                    r = self.exec_script("jython", pre_script + ibuff, post_script)

                elif command[3] == "execbsh":
                    r = self.exec_script("bsh", ibuff)

                elif command[3] == "execjs":
                    r = self.exec_script("js", ibuff)

                elif command[3] == "execjava":
                    r = self.exec_script("java", ibuff)

                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "player":

                if command[3] == "list":
                    r2 = {}
                    for player in L2World.getInstance().getAllPlayersArray():
                        objid = self.getPlayerInfo("objid", player)
                        r2[objid] = {}
                        if "req" in query:
                            for c in query["req"].split(","):
                                r2[objid][c] = self.getPlayerInfo(c, player)
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json")

                elif command[3] == "info":
                    if not self.checkQuery(query, ["objid", "req"]):
                        raise
                    player = L2World.getInstance().getPlayer(int(query["objid"]))
                    if not player:
                        raise
                    r2 = {}
                    for c in query["req"].split(","):
                        r2[c] = self.getPlayerInfo(c, player)
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json")

                elif command[3] == "edit":
                    if not self.checkQuery(query, ["objid"]):
                        raise
                    player = L2World.getInstance().getPlayer(int(query["objid"]))
                    if not player:
                        raise
                    del query["objid"]
                    for c in query:
                        self.setPlayerInfo(c, query[c], player=player)

                elif command[3] == "teleport":
                    if not self.checkQuery(query, ["objid", "x", "y", "z"]):
                        raise
                    x = int("%d" % float(query["x"]))
                    y = int("%d" % float(query["y"]))
                    z = int("%d" % float(query["z"]))
                    player = L2World.getInstance().getPlayer(int(query["objid"]))
                    if not player:
                        raise
                    player.teleToLocation(x, y, z, 0, False)
                else:
                    exchange.sendResponseHeaders(501, 0)
                    return
 def __init__(self, id, name, descr):
     self.antharasAI = QuestManager.getInstance().getQuest("antharas")
     self.valakasAI = QuestManager.getInstance().getQuest("valakas")
     self.count = 0
     self.count2 = 0
     JQuest.__init__(self, id, name, descr)
Exemple #17
0
    def handleImpl(self, exchange, ibuff):
        r = ""
        try:
            uri = exchange.getRequestURI()
            command = uri.getPath().split("/")
            if not command[1] == "ajax":
                raise

            query = {}
            try:
                for x in uri.getRawQuery().split("&"):
                    x2 = URLDecoder().decode(x, 'UTF-8')
                    k, v = x2.split("=", 1)
                    query[k] = v
            except:
                pass

            if command[2] == "webadmin":

                if command[3] == "stop":
                    q = QuestManager.getInstance().getQuest(WebAdmin.qn)
                    try:
                        q.cancelQuestTimers("webadmin_stop")
                        q.startQuestTimer("webadmin_stop", 1000, None, None)
                    except:
                        pass
                    r = "webAdmin stop"
                elif command[3] == "restart":
                    q = QuestManager.getInstance().getQuest(WebAdmin.qn)
                    try:
                        q.cancelQuestTimers("webadmin_restart")
                        q.startQuestTimer("webadmin_restart", 1000, None, None)
                    except:
                        pass
                    r = "webAdmin restart"
                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "quest":

                if command[3] == "list":
                    r2 = {}
                    for quest in QuestManager.getInstance(
                    ).getAllManagedScripts():
                        qn = quest.getName()
                        r2[qn] = {}
                        if 'req' in query:
                            for c in query['req'].split(","):
                                r2[qn][c] = self.getQuestInfo(c, quest)
                    r2 = r2.items()
                    r2.sort()
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json")

                elif command[3] == "unload":
                    if not self.checkQuery(query, ['name']):
                        raise
                    QuestManager.getInstance().getQuest(query['name']).unload()

                elif command[3] == "reload":
                    if not self.checkQuery(query, ['name']):
                        raise
                    QuestManager.getInstance().getQuest(query['name']).reload()

                elif command[3] == "get_source":
                    if not self.checkQuery(query, ['name']):
                        raise
                    file = QuestManager.getInstance().getQuest(
                        query['name']).getScriptFile()
                    try:
                        i = open(file.toString(), "r")
                    except:
                        exchange.sendResponseHeaders(404, 0)
                        return
                    r = i.read()
                    i.close()
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "text/plain; charset=utf-8")

                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "script":
                if command[3] == "writefile_exec":
                    if not self.checkQuery(query, ['file']):
                        raise
                    query['file'] = query['file'].replace("\\", "/")
                    query['file'] = query['file'].split("/")[-1]
                    path = sourcepath.replace(
                        "\\",
                        "/") + "/custom/WebAdmin/WebRoot/temp/" + query['file']
                    o = open(path, "w")
                    o.write(ibuff)
                    o.close()
                    file = File(path)
                    try:
                        L2ScriptEngineManager.getInstance().executeScript(file)
                    except ScriptException, e:
                        L2ScriptEngineManager.getInstance(
                        ).reportScriptFileError(file, e)

                elif command[3] == "execjy":
                    pre_script = """
import sys
sys.stdout = out_writer
sys.stderr = out_writer
"""
                    post_script = """
import sys
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
"""
                    r = self.exec_script("jython", pre_script + ibuff,
                                         post_script)

                elif command[3] == "execbsh":
                    r = self.exec_script("bsh", ibuff)

                elif command[3] == "execjs":
                    r = self.exec_script("js", ibuff)

                elif command[3] == "execjava":
                    r = self.exec_script("java", ibuff)

                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "player":

                if command[3] == "list":
                    r2 = {}
                    for player in L2World.getInstance().getAllPlayersArray():
                        objid = self.getPlayerInfo("objid", player)
                        r2[objid] = {}
                        if 'req' in query:
                            for c in query['req'].split(","):
                                r2[objid][c] = self.getPlayerInfo(c, player)
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json")

                elif command[3] == "info":
                    if not self.checkQuery(query, ['objid', 'req']):
                        raise
                    player = L2World.getInstance().getPlayer(
                        int(query['objid']))
                    if not player:
                        raise
                    r2 = {}
                    for c in query['req'].split(","):
                        r2[c] = self.getPlayerInfo(c, player)
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json")

                elif command[3] == "edit":
                    if not self.checkQuery(query, ['objid']):
                        raise
                    player = L2World.getInstance().getPlayer(
                        int(query['objid']))
                    if not player:
                        raise
                    del query['objid']
                    for c in query:
                        self.setPlayerInfo(c, query[c], player=player)

                elif command[3] == "teleport":
                    if not self.checkQuery(query, ['objid', 'x', 'y', 'z']):
                        raise
                    x = int("%d" % float(query['x']))
                    y = int("%d" % float(query['y']))
                    z = int("%d" % float(query['z']))
                    player = L2World.getInstance().getPlayer(
                        int(query['objid']))
                    if not player:
                        raise
                    player.teleToLocation(x, y, z, 0, False)
                else:
                    exchange.sendResponseHeaders(501, 0)
                    return
Exemple #18
0
 def webadmin_restart(self):
     self.webadmin_stop()
     QuestManager.getInstance().reload(self.qn)
Exemple #19
0
 def __init__(self,id,name,descr):
     self.antharasAI = QuestManager.getInstance().getQuest("antharas")
     self.valakasAI = QuestManager.getInstance().getQuest("valakas")
     self.count = 0
     self.count2 = 0
     JQuest.__init__(self,id,name,descr)