Exemple #1
0
 def activateDetector(self, npc, player, st):
     for obj in npc.getKnownList().getKnownObjects().values():
         if obj != None:
             if obj == player and st.getInt("cond") == 17:
                 st.playSound("ItemSound.quest_middle")
                 st.takeItems(Detector, 1)
                 st.giveItems(Detector2, 1)
                 st.set("cond", "18")
                 player.sendPacket(
                     ExShowScreenMessage(
                         "The radio signal detector is responding. # A suspicious pile of stones catches your eye.",
                         4500))
                 break
     return
Exemple #2
0
 def onFirstTalk(
         self, npc,
         player):  #atm custom, on retail it is when you walk to npcs radius
     st = player.getQuestState(qn)
     if st:
         if npc.getNpcId() == Stones and st.getInt("cond") == 17:
             st.playSound("ItemSound.quest_middle")
             st.takeItems(Detector, 1)
             st.giveItems(Detector2, 1)
             st.set("cond", "18")
             player.sendPacket(
                 ExShowScreenMessage(
                     "The radio signal detector is responding. # A suspicious pile of stones catches your eye.",
                     4500))
     npc.showChatWindow(player)
     return None
Exemple #3
0
    def onTalk(self, npc, player):
        htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
        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.rewardItems(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.roll(Calendar.DATE, True)
                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