Beispiel #1
0
 def onKill(self, npc, player, isPet):
     st = player.getQuestState(qn)
     if not st: return
     if st.getState() != State.STARTED: return
     npcId = npc.getId()
     cond = st.getInt("cond")
     if npcId == Angel and cond == 12:
         st.set("angel", "1")
         self.isAngelSpawned = 0
         npc.broadcastPacket(
             NpcSay(npc.getObjectId(), 0, npc.getId(),
                    "Grr. I've been hit..."))
         if self.isKatenarSpawned == 0:
             katenar = st.addSpawn(32242, 36110, 191921, -3712, 60000)
             katenar.broadcastPacket(
                 NpcSay(katenar.getObjectId(), 0, katenar.getId(),
                        "I am late!"))
             self.isKatenarSpawned == 1
             self.startQuestTimer("katenar_cleanup", 60000, katenar, player)
     if npcId == Wyrm and st.getQuestItemsCount(
             Heart) < 10 and cond == 15 and st.getRandom(100) <= 25:
         if st.getQuestItemsCount(Heart) == 9:
             st.giveItems(Heart, 1)
             st.set("cond", "16")
             st.playSound("ItemSound.quest_middle")
         else:
             st.giveItems(Heart, 1)
             st.playSound("ItemSound.quest_itemget")
     return
Beispiel #2
0
 def onKill(self, npc, player, isPet):
     leaderst = leader(player)
     if not leaderst: return
     if not leaderst.getState() == State.STARTED:
         if DEBUG:
             print "onKill says leader needs to start quest"
             return "Need to start quest!"
         return
     part = leaderst.getInt("part")
     npcId = npc.getId()
     if npcId in CHESTS and part == 4:
         wins = leaderst.getInt("chest_wins")
         if (self.chests - wins) == 12 or (wins < 4
                                           and not leaderst.getRandom(4)):
             wins += 1
             leaderst.set("chest_wins", str(wins))
             npc.broadcastPacket(
                 NpcSay(npc.getObjectId(), 0, npc.getId(),
                        "###### BINGO! ######"))
         self.chests += 1
     elif npcId in MOBS.keys():
         st = player.getQuestState(qn)
         if not st: st = self.newQuestState(player)
         if st == leaderst: return
         if part >= 3 and part < 6:
             if not st.getRandom(10):
                 st.giveItems(MOBS[npcId], 1)
                 st.playSound("ItemSound.quest_itemget")
         elif DEBUG:
             print "onKill says leader is not correct state" + str(part)
             return "leader is not correct state"
     return
Beispiel #3
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     htmltext = event
     if event == "31328-02.htm":  # call 31328-03.htm
         st.giveItems(MapForestofDeadman, 1)
         st.giveItems(SilverKey, 1)
         st.set("cond", "1")
         st.playSound("ItemSound.quest_accept")
         st.setState(State.STARTED)
     elif event == "31328-03.htm":  # call 31328-05.htm and 31328-06.htm
         st.set("cond", "2")
         st.playSound("ItemSound.quest_middle")
     elif event == "31526-05.htm":  # called by 31526-03.htm for hairpin
         if st.getQuestItemsCount(LidiaHairPin) == 0:
             st.giveItems(LidiaHairPin, 1)  # give hairpin
             if st.getQuestItemsCount(
                     LidiaDiary) != 0:  # if has diary cond = 4
                 st.set("cond", "4")
                 st.playSound("ItemSound.quest_middle")
     elif event == "31526-11.htm":  # called by 31526-07 for diary
         if st.getQuestItemsCount(LidiaDiary) == 0:
             st.giveItems(LidiaDiary, 1)
             if st.getQuestItemsCount(
                     LidiaHairPin) != 0:  # if has hairpin cond = 4
                 st.set("cond", "4")
                 st.playSound("ItemSound.quest_middle")
     elif event == "31328-19.htm":  # end of questions loop go to ghost
         st.set("cond", "6")
         st.playSound("ItemSound.quest_middle")
     elif event == "31524-04.htm":  # sends you to the tombstone to dig
         st.set("cond", "7")
         st.playSound("ItemSound.quest_middle")
         st.takeItems(LidiaDiary, -1)
     elif event == "31523-02.htm":
         st.playSound("SkillSound5.horror_02")
         ghost = st.addSpawn(31524, 51432, -54570, -3136, 1800000)
         ghost.broadcastPacket(
             NpcSay(ghost.getObjectId(), 0, ghost.getId(), "Who awoke me?"))
     elif event == "31523-05.htm":
         st.startQuestTimer("ghost_timer", 10000)
     elif event == "ghost_timer":
         st.set("cond", "8")
         htmltext = "31523-06.htm"
         st.giveItems(SilverKey, 1)
     elif event == "31530-02.htm":  # box gives spear takes key
         st.set("cond", "10")
         st.playSound("ItemSound.quest_middle")
         st.takeItems(SilverKey, -1)
         st.giveItems(SilverSpear, 1)
     return htmltext
Beispiel #4
0
 def onKill(self, npc, player, isPet):
     # all kill events triggered by the leader occur automatically.
     # However, kill events that were triggered by members occur via the leader and
     # only if the leader is online and within a certain distance!
     leader_st = 0
     if player.isClanLeader():
         leader_st = player.getQuestState(qn)
     else:
         clan = player.getClan()
         if clan:
             c_leader = clan.getLeader()
             if c_leader:
                 leader = c_leader.getPlayerInstance()
                 if leader:
                     if player.isInsideRadius(leader, 1600, 1, 0):
                         leader_st = leader.getQuestState(qn)
     if leader_st:
         if leader_st.getState() != State.STARTED: return
         npcId = npc.getId()
         condition, maxcount, chance, itemList = DROPLIST[npcId]
         random = leader_st.getRandom(100)
         cond = leader_st.getInt("cond")
         if cond == condition and random < chance:
             if len(itemList) > 1:
                 stoneRandom = leader_st.getRandom(3)
                 if stoneRandom == 0:
                     if leader_st.getInt("Kurtz") < 4:
                         return
                     else:
                         maxcount *= 4
                 giveItem(itemList[stoneRandom], maxcount, leader_st)
             elif len(itemList):
                 giveItem(itemList[0], maxcount, leader_st)
             else:
                 if npcId == 27181:  # Imperial Gravekeeper
                     spawnedNpc = leader_st.addSpawn(30765, 120000)
                     npc.broadcastPacket(
                         NpcSay(
                             spawnedNpc.getObjectId(), 0,
                             spawnedNpc.getId(),
                             "Curse of the gods on the one that defiles the property of the empire!"
                         ))
                     leader_st.set("ImpGraveKeeper", "3")
                     self.ImpGraveKepperStat = 1
                 else:
                     leader_st.addSpawn(27179)
     return
Beispiel #5
0
 def onKill(self, npc, player, isPet):
     self.cancelQuestTimer("npc_cleanup", None, None)
     self.isNpcSpawned = 0
     st = player.getQuestState(qn)
     if not st: return
     if st.getState() != State.STARTED: return
     npcId = npc.getNpcId()
     cond = st.getInt("cond")
     if npcId == 27340 and cond == 1:
         string = "You are strong. This was a mistake."
         if st.getRandom(1):
             string = "You have good luck. I shall return."
         npc.broadcastPacket(
             NpcSay(npc.getObjectId(), 0, npc.getNpcId(), string))
         st.giveItems(10867, 1)
         st.set("cond", "2")
         st.playSound("ItemSound.quest_middle")
     return
Beispiel #6
0
    def onEvent(self, event, st):
        htmltext = event
        # Events Gustaf
        if event == "30760-08.htm":
            st.giveItems(G_Let_Martien, 1)
            for var in STATS:
                st.set(var, "1")
            st.setState(State.STARTED)
        elif event == "30760-12.htm":
            st.giveItems(G_Let_Balthazar, 1)
            st.set("cond", "4")
        elif event == "30760-16.htm":
            st.giveItems(G_Let_Rodemai, 1)
            st.set("cond", "7")
        elif event == "30760-20.htm":
            exit503(1, st)
        elif event == "30760-22.htm":
            st.set("cond", "13")
        elif event == "30760-23.htm":
            exit503(1, st)
# Events Martien
        elif event == "30645-03.htm":
            st.takeItems(G_Let_Martien, -1)
            st.set("cond", "2")
            suscribe_members(st)
            try:
                members = st.getPlayer().getClan().getOnlineMembers(0)[0]
                for i in members:
                    pst = QuestManager.getInstance().getQuest(
                        qn).newQuestState(
                            st.getPlayer().getClan().getClanMember(
                                int(i)).getPlayerInstance())
                    pst.setState(State.STARTED)
            except:
                return htmltext
# Events Kurtz
        elif event == "30763-03.htm":
            if st.getInt("Kurtz") == 1:
                htmltext = "30763-02.htm"
                st.giveItems(Mi_Drake_Eggs, 6)
                st.giveItems(Brooch, 1)
                st.set("Kurtz", "2")
# Events Lutz
        elif event == "30762-03.htm":
            lutz = st.getInt("Lutz")
            if lutz == 1:
                htmltext = "30762-02.htm"
                st.giveItems(Mi_Drake_Eggs, 4)
                st.giveItems(Bl_Wyrm_Eggs, 3)
                st.set("Lutz", "2")
            st.addSpawn(27178, 112268, 112761, -2770, 120000)
            st.addSpawn(27178, 112234, 112705, -2770, 120000)
# Events Fritz
        elif event == "30761-03.htm":
            fritz = st.getInt("Fritz")
            if fritz == 1:
                htmltext = "30761-02.htm"
                st.giveItems(Bl_Wyrm_Eggs, 3)
                st.set("Fritz", "2")
            st.addSpawn(27178, 103841, 116809, -3025, 120000)
            st.addSpawn(27178, 103848, 116910, -3020, 120000)
# Events Kusto
        elif event == "30512-03.htm":
            st.takeItems(Brooch, -1)
            st.giveItems(Bl_Anvil_Coin, 1)
            st.set("Kurtz", "3")
# Events Balthazar
        elif event == "30764-03.htm":
            st.takeItems(G_Let_Balthazar, -1)
            st.set("cond", "5")
            st.set("Kurtz", "3")
        elif event == "30764-05.htm":
            st.takeItems(G_Let_Balthazar, -1)
            st.set("cond", "5")
        elif event == "30764-06.htm":
            st.takeItems(Bl_Anvil_Coin, -1)
            st.set("Kurtz", "4")
# Events Rodemai
        elif event == "30868-04.htm":
            st.takeItems(G_Let_Rodemai, -1)
            st.set("cond", "8")
        elif event == "30868-06a.htm":
            st.set("cond", "10")
        elif event == "30868-10.htm":
            st.set("cond", "12")


# Events Cleo
        elif event == "30766-04.htm":
            st.set("cond", "9")
            spawnedNpc = st.addSpawn(30766, 160622, 21230, -3710, 90000)
            spawnedNpc.broadcastPacket(
                NpcSay(spawnedNpc.getObjectId(), 0, spawnedNpc.getId(),
                       "Blood and Honour."))
            spawnedNpc = st.addSpawn(30759, 160665, 21209, -3710, 90000)
            spawnedNpc.broadcastPacket(
                NpcSay(spawnedNpc.getObjectId(), 0, spawnedNpc.getId(),
                       "Ambition and Power"))
            spawnedNpc = st.addSpawn(30758, 160665, 21291, -3710, 90000)
            spawnedNpc.broadcastPacket(
                NpcSay(spawnedNpc.getObjectId(), 0, spawnedNpc.getId(),
                       "War and Death"))
        elif event == "30766-08.htm":
            st.takeItems(Scepter_Judgement, -1)
            exit503(0, st)
        return htmltext
Beispiel #7
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.getId(), "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.getId(),
                 "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
Beispiel #8
0
def AutoChat(npc, text):
    chars = npc.getKnownList().getKnownPlayers().values().toArray()
    if chars != None:
        for pc in chars:
            sm = NpcSay(npc.getObjectId(), 0, npc.getId(), text)
            pc.sendPacket(sm)
Beispiel #9
0
def autochat(npc, text):
    if npc:
        npc.broadcastPacket(NpcSay(npc.getObjectId(), 0, npc.getId(), text))
    return
Beispiel #10
0
 def onAdvEvent(self, event, npc, player):
     if event == "npc_cleanup":
         self.isNpcSpawned = 0
         return
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "31435-03.htm":
         st.set("cond", "1")
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
     elif event == "31435-05.htm":
         st.set("cond", "4")
         st.playSound("ItemSound.quest_middle")
     elif event == "31435-08.htm":
         st.set("cond", "9")
         st.playSound("ItemSound.quest_middle")
     elif event == "32487-02.htm" and self.isNpcSpawned == 0:
         npc = st.addSpawn(27340, 72590, 148100, -3312, 1800000)
         npc.broadcastPacket(
             NpcSay(
                 npc.getObjectId(), 0, npc.getNpcId(),
                 player.getName() +
                 "! I must kill you. Blame your own curiosity."))
         npc.setRunning()
         npc.addDamageHate(st.getPlayer(), 0, 999)
         npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK,
                                  st.getPlayer())
         self.isNpcSpawned = 1
         self.startQuestTimer("npc_cleanup", 1800000, None, None)
     elif event == "32487-06.htm":
         st.set("cond", "8")
         st.playSound("ItemSound.quest_middle")
         st.takeItems(10868, -1)
     elif event == "30081-03.htm":
         st.set("cond", "5")
         st.playSound("ItemSound.quest_middle")
         st.takeItems(10867, -1)
     elif event == "30081-05.htm":
         st.set("cond", "6")
         st.playSound("ItemSound.quest_middle")
     elif event == "30081-08.htm":
         if st.getQuestItemsCount(57) >= 3000000:
             st.takeItems(57, 3000000)
             st.giveItems(10868, 1)
             st.set("cond", "7")
             st.playSound("ItemSound.quest_middle")
         else:
             htmltext = "30081-07.htm"
     elif event == "31092-05.htm":
         st.exitQuest(False)
         st.playSound("ItemSound.quest_finish")
         if player.getClassId().level() == 1:
             text = BYPASS[player.getClassId().getId()]
             htmltext = "<html><body>Black Marketeer of Mammon:<br>Forget about the money!<br>I will help you complete the class transfer, which is far more valuable! Which class would you like to be? Choose one.<br>" + text + "</body></html>"
         else:
             htmltext = "31092-06.htm"
     elif event == "31092-06.htm":
         text = BYPASS[player.getClassId().getId()]
         htmltext = "<html><body>Black Marketeer of Mammon:<br>If you are finished thinking, select one. Which class would you like to be?<br>" + text + "</body></html>"
     elif event == "31092-07.htm":
         st.giveAdena(3000000, False)
         st.set("onlyone", "1")
     elif event in CLASSES.keys():
         newclass, req_item = CLASSES[event]
         adena = 0
         for i in req_item:
             if not st.getQuestItemsCount(i):
                 st.giveItems(i, 1)
             else:
                 adena = adena + 1
         if adena == 3:
             return "31092-06.htm"
         if adena > 0:
             st.giveAdena(adena * 1000000, False)
         htmltext = "31092-05.htm"
         st.set("onlyone", "1")
     return htmltext
Beispiel #11
0
 def onTalk(self, npc, player):
     htmltext = Quest.getNoQuestMsg(player)
     st = player.getQuestState(qn)
     if not st: return htmltext
     npcId = npc.getId()
     id = st.getState()
     cond = st.getInt("cond")
     if id == State.COMPLETED:
         htmltext = Quest.getAlreadyCompletedMsg(player)
     elif npcId == Vitus:
         if player.getClassId().getId() not in [125, 126
                                                ] or player.getLevel() < 39:
             htmltext = "<html><body>Only Troopers or Warders are allowed to take this quest! Go away before I get angry!<br>You must be level 39 or higher to undertake this quest.</body></html>"
             st.exitQuest(1)
         elif id == State.CREATED:
             htmltext = "32213-01.htm"
         elif cond >= 1 and cond <= 3:
             htmltext = "32213-04.htm"
         elif cond >= 4 and cond < 17:
             htmltext = "32213-05.htm"
         elif cond == 17 and st.getQuestItemsCount(Recommend) == 1:
             htmltext = "32213-06.htm"
             player.sendPacket(SocialAction(player.getObjectId(), 3))
             st.takeItems(Recommend, -1)
             st.giveItems(certificate, 1)
             st.exitQuest(False)
             st.playSound("ItemSound.quest_finish")
             st.giveItems(57, 35597)
             st.addExpAndSp(196875, 13510)
     elif npcId == Kekropus:
         if cond == 1:
             htmltext = "32138-00.htm"
         elif cond == 2:
             htmltext = "32138-04.htm"
         elif cond == 14:
             htmltext = "32138-05.htm"
         elif cond == 15:
             htmltext = "32138-07.htm"
         elif cond == 16:
             htmltext = "32138-08.htm"
         elif cond == 17:
             htmltext = "32138-12.htm"
     elif npcId == Casca:
         if cond == 2:
             htmltext = "32139-01.htm"
         elif cond == 3:
             htmltext = "32139-03.htm"
         elif cond == 4:
             htmltext = "32139-05.htm"
         elif cond == 13:
             htmltext = "32139-06.htm"
         elif cond == 14:
             htmltext = "32139-09.htm"
     elif npcId == Holst:
         if cond == 4:
             htmltext = "32199-01.htm"
         elif cond == 5:
             htmltext = "32199-03.htm"
             st.set("cond", "6")
             st.playSound("ItemSound.quest_middle")
         elif cond == 6:
             htmltext = "32199-04.htm"
     elif npcId == Harlan:
         if cond == 6:
             htmltext = "30074-01.htm"
         elif cond == 7:
             htmltext = "30074-02.htm"
     elif npcId == Jacob:
         if cond == 6:
             htmltext = "30073-01.htm"
             st.set("cond", "7")
             st.playSound("ItemSound.quest_middle")
         elif cond == 7:
             htmltext = "30073-02.htm"
     elif npcId == Lucas:
         if cond == 7:
             htmltext = "30071-01.htm"
         elif cond == 8:
             htmltext = "30071-03.htm"
     elif npcId == Xaber:
         if cond == 8:
             htmltext = "30075-01.htm"
         elif cond == 9:
             htmltext = "30075-02.htm"
     elif npcId == Liam:
         if cond == 8:
             htmltext = "30076-01.htm"
             st.set("cond", "9")
             st.playSound("ItemSound.quest_middle")
         elif cond == 9:
             htmltext = "30076-02.htm"
     elif npcId == Zerome:
         if cond == 9:
             htmltext = "30124-01.htm"
         elif cond == 10:
             htmltext = "30124-02.htm"
     elif npcId == Vesa:
         if cond == 9:
             htmltext = "30123-01.htm"
             st.set("cond", "10")
             st.playSound("ItemSound.quest_middle")
         elif cond == 10:
             htmltext = "30123-02.htm"
     elif npcId == Meldina:
         if cond == 10:
             htmltext = "32214-01.htm"
         elif cond == 11:
             htmltext = "32214-03.htm"
     elif npcId == Felton:
         if cond == 11:
             htmltext = "30879-01.htm"
         elif cond == 12:
             htmltext = "30879-04.htm"
     elif npcId == CargoBox:
         if cond == 12:
             htmltext = "32243-01.htm"
             if st.getInt("angel") == 0 and self.isAngelSpawned == 0:
                 angel = st.addSpawn(27332, 36198, 191949, -3728, 180000)
                 angel.broadcastPacket(
                     NpcSay(
                         angel.getObjectId(), 0, angel.getId(),
                         player.getName() +
                         "! Step back from the confounded box! I will take it myself!"
                     ))
                 angel.setRunning()
                 angel.addDamageHate(player, 0, 999)
                 angel.getAI().setIntention(
                     CtrlIntention.AI_INTENTION_ATTACK, player)
                 self.isAngelSpawned = 1
                 self.startQuestTimer("angel_cleanup", 180000, angel,
                                      player)
             elif self.isKatenarSpawned == 0 and st.getInt("angel") == 1:
                 katenar = st.addSpawn(32242, 36110, 191921, -3712, 60000)
                 katenar.broadcastPacket(
                     NpcSay(katenar.getObjectId(), 0, katenar.getId(),
                            "I am late!"))
                 self.isKatenarSpawned == 1
                 self.startQuestTimer("katenar_cleanup", 60000, katenar,
                                      player)
                 htmltext = "32243-02.htm"
         elif cond == 13:
             htmltext = "32243-03.htm"
     return htmltext