Example #1
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "31522-02.htm":
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
         st.set("cond", "1")
     elif event == "31328-05.htm":
         st.set("cond", "0")
         st.set("onlyone", "1")
         st.unset("AGRIPEL")
         st.unset("DOMINIC")
         st.unset("BENEDICT")
         st.exitQuest(False)
         st.takeItems(7140, -1)
         if st.getQuestItemsCount(7141) == 0:
             st.giveItems(7141, 1)
             st.addExpAndSp(131228, 11978)
         st.playSound("ItemSound.quest_finish")
         htmltext = "31328-05.htm"
     elif event == "31523-03.htm":
         st.playSound("SkillSound5.horror_02")
         st.set("cond", "2")
         ghost = st.addSpawn(31524, 51432, -54570, -3136, 180000)
         ghost.broadcastPacket(NpcSay(ghost.getObjectId(), 0, ghost.getNpcId(), "Who awoke me?"))
     elif event == "31524-06.htm":
         st.set("cond", "3")
         st.playSound("ItemSound.quest_middle")
         ghost = self.addSpawn(31525, npc)
         ghost.broadcastPacket(NpcSay(ghost.getObjectId(), 0, ghost.getNpcId(),
                                      "My master has instructed me to be your guide, " + player.getName()))
         self.startQuestTimer("1", 1, ghost, player)
         self.startQuestTimer("despawn", 180000, ghost, player)
     elif event == "31526-03.htm":
         st.playSound("ItemSound.item_drop_equip_armor_cloth")
     elif event == "31526-08.htm":
         st.playSound("AmdSound.ed_chimes_05")
         st.set("cond", "5")
         st.playSound("ItemSound.quest_middle")
     elif event == "31526-14.htm":
         st.giveItems(7140, 1)
         st.set("cond", "6")
         st.playSound("ItemSound.quest_middle")
     elif event == "despawn":
         npc.deleteMe()
         return
     elif event.isdigit():
         loc = int(event)
         x, y, z, heading = ROUTES[loc]
         if event == "1":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x, y, z, heading))
             self.startQuestTimer("2", 5000, npc, player)
         elif event == "2":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x, y, z, heading))
             self.startQuestTimer("3", 12000, npc, player)
         elif event == "3":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x, y, z, heading))
             self.startQuestTimer("4", 15000, npc, player)
         elif event == "4":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x, y, z, heading))
             self.startQuestTimer("5", 5000, npc, player)
         elif event == "5":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x, y, z, heading))
         return
     return htmltext
Example #2
0
    def onTalk(self, npc, player):
        htmltext = Quest.getNoQuestMsg(player)
        st = player.getQuestState(qn)
        if not st: return htmltext

        npcId = npc.getNpcId()
        cond = st.getInt("cond")
        id = st.getState()
        if npcId == KANEMIKA:
            if cond == 0:
                reset = st.get("reset")
                remain = 0
                if reset and reset.isdigit():
                    remain = long(reset) - System.currentTimeMillis()
                if remain <= 0:
                    if player.getLevel() >= 80:
                        htmltext = "32650-01.htm"
                    else:
                        htmltext = "32650-00.htm"
                        st.exitQuest(True)
                else:
                    htmltext = "32650-09.htm"
            elif cond == 1:
                if st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) >= 1:
                    htmltext = "32650-07.htm"
                else:
                    htmltext = "32650-06.htm"
            elif cond == 2 and st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) == 10:
                htmltext = "32650-08.htm"
                st.giveItems(ADENA, 65000)
                st.takeItems(EVIDENCE_OF_MIGRATION, 10)
                st.setState(State.COMPLETED)
                st.unset("cond")
                st.exitQuest(False)
                st.playSound("ItemSound.quest_finish")
                reset = Calendar.getInstance()
                reset.set(Calendar.MINUTE, RESET_MIN)
                # if time is >= RESET_HOUR - roll to the next day
                if reset.get(Calendar.HOUR_OF_DAY) >= RESET_HOUR:
                    reset.add(Calendar.DATE, 1)
                reset.set(Calendar.HOUR_OF_DAY, RESET_HOUR)
                st.set("reset", str(reset.getTimeInMillis()))
        elif cond == 1 and npcId == WARRIOR_NPC:
            if st.getRandom(100) < 50:
                htmltext = "32651-01.htm"
                st.giveItems(EVIDENCE_OF_MIGRATION, 1)
                st.playSound("ItemSound.quest_itemget")
                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                         L2CharPosition(npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0))
                npc.getSpawn().decreaseCount(npc)
                npc.deleteMe()
                if st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) == 10:
                    st.set("cond", "2")
                    st.playSound("ItemSound.quest_middle")
            else:
                htmltext = ""
                player.sendPacket(ExShowScreenMessage(1, 0, 5, 0, 1, 0, 0, 2, 4000, 1,
                                                      "The grave robber warrior has been filled with dark energy and is attacking you!"))
                warrior = st.addSpawn(WARRIOR_MON, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), True, 600000)
                warrior.setRunning()
                warrior.addDamageHate(player, 0, 999)
                warrior.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
                if st.getRandom(100) < 50:
                    npc.broadcastPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "...Grunt... oh..."))
                    npc.getSpawn().decreaseCount(npc)
                    npc.deleteMe()
                else:
                    npc.broadcastPacket(
                        NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "Grunt... What's... wrong with me..."))
                    npc.getSpawn().decreaseCount(npc)
                    npc.deleteMe()
        return htmltext