def onTalk(self, npc, player): npcId = npc.getNpcId() htmltext = "" if npcId == STONE_BAIUM: if player in self.playersInside: if not npc.isBusy(): npc.setBusy(True) npc.setBusyMessage("Attending another player's request") npc.deleteMe() baium = self.addSpawn(LIVE_BAIUM, npc) baium.broadcastPacket(SocialAction(baium.getObjectId(), 2)) self.startQuestTimer("baium_wakeup", 15000, baium, None) self.playersInside = [] else: htmltext = "Conditions are not right to wake up Baium" elif npcId == ANGELIC_VORTEX: if not self.isBaiumLocked: if player.isFlying(): print "Player " + player.getName( ) + " attempted to enter Baium's layer while flying!" htmltext = '<html><body>Angelic Vortex:<br>You may not enter while flying a wyvern</body></html>' if player.getQuestState("baium").getQuestItemsCount( 4295): # bloody fabric player.getQuestState("baium").takeItems(4295, 1) player.teleToLocation(113100, 14500, 10077) if not self.isBaiumAwake: self.playersInside.append(player) else: htmltext = '<html><body>Angelic Vortex:<br>You do not have enough items</body></html>' else: htmltext = '<html><body>Angelic Vortex:<br>You may not enter at this time</body></html>' return htmltext
def onEvent(self, event, st): htmltext = event player = st.getPlayer() if event == "30587_1": if player.getClassId().getId() != 0x2c: if player.getClassId().getId() == 0x2f: htmltext = "30587-02a.htm" st.exitQuest(1) else: htmltext = "30587-02.htm" st.exitQuest(1) else: if player.getLevel() < 19: htmltext = "30587-03.htm" else: if st.getQuestItemsCount(KHAVATARI_TOTEM) != 0: htmltext = "30587-04.htm" else: htmltext = "30587-05.htm" elif event == "1": st.set("id", "0") st.set("cond", "1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") htmltext = "30587-06.htm" st.giveItems(POMEGRANATE, 1) elif event == "30587-09a.htm": st.takeItems(ROSHEEKS_LETTER, 1) st.giveItems(GANTAKIS_LETTER, 1) st.set("cond", "9") st.playSound("ItemSound.quest_middle") elif event == "30587-09b.htm": st.takeItems(ROSHEEKS_LETTER, 1) st.giveItems(GANTAKIS_LETTER, 1) st.set("cond", "14") st.playSound("ItemSound.quest_middle") elif event == "32056-03.htm": st.set("cond", "15") st.playSound("ItemSound.quest_middle") elif event == "32056-08.htm": st.set("cond", "19") st.playSound("ItemSound.quest_middle") st.takeItems(8546, -1) elif event == "31979-03.htm": st.takeItems(SCROLL_FIERY_SPIRIT, 1) st.giveItems(KHAVATARI_TOTEM, 1) player.sendPacket(SocialAction(player.getObjectId(), 3)) st.set("cond", "0") st.set("onlyone", "1") st.exitQuest(False) st.playSound("ItemSound.quest_finish") return htmltext
def onAttack(self, npc, player, damage, isPet): npcId = npc.getNpcId() objId = npc.getObjectId() heading = npc.getHeading() if npcId == HALISHWEAK: if npc.getCurrentHp() < npc.getMaxHp() * 0.25: npc.reduceCurrentHp(9999999, npc) newNpc = self.addSpawn(HALISHSTRONG, npc) newNpc.setHeading(heading) newNpc.broadcastPacket(SocialAction(objId, 3)) newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player) return
def onAdvEvent(self, event, npc, player): objId = 0 if event == "baium_unlock": self.isBaiumLocked = False self.deleteGlobalQuestVar("unlockDatetime") self.addSpawn(STONE_BAIUM, 115213, 16623, 10080, 41740, False, 0) elif event == "baium_wakeup" and npc: if npc.getNpcId() == LIVE_BAIUM: npc.broadcastPacket(SocialAction(npc.getObjectId(), 1)) npc.broadcastPacket( Earthquake(npc.getX(), npc.getY(), npc.getZ(), 40, 5)) # once Baium is awaken, no more people may enter until he dies, the server reboots, or # 30 pass with no attacks made against Baium. self.isBaiumLocked = True # start monitoring baium's inactivity self.lastAttackVsBaiumTime = System.currentTimeMillis() self.startQuestTimer("baium_despawn", 60000, npc, None) # TODO: the person who woke baium up should be knocked across the room, onto a wall, and # lose massive amounts of HP. # despawn the live baium after 30 minutes of inactivity elif event == "baium_despawn" and npc: if (npc.getNpcId() == LIVE_BAIUM) and (self.lastAttackVsBaiumTime + 1800000 < System.currentTimeMillis()): npc.deleteMe() # despawn the live-baium self.addSpawn(STONE_BAIUM, 115213, 16623, 10080, 41740, False, 0) # spawn stone-baium self.deleteGlobalQuestVar( "unlockDatetime" ) # make sure that all locks are deleted from the DB self.isBaiumAwake = False # mark that Baium is not awake any more self.isBaiumLocked = False # unlock the entrance self.playersInside = [] else: # if baium's inactivity is still younger than 30 minutes, just re-add the timer self.startQuestTimer("baium_despawn", 60000, npc, None) return
def onAdvEvent(self, event, npc, player): if event == "1": machine_instance = self.FindTemplate(Strange_Machine) if machine_instance: npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, machine_instance) machine_instance.broadcastPacket( SpecialCamera(machine_instance.getObjectId(), 1, -200, 15, 10000, 20000)) else: print "Dr Chaos AI: problem finding Strange Machine (npcid = " + Strange_Machine + "). Error: not spawned!" self.startQuestTimer("2", 2000, npc, player) self.startQuestTimer("3", 10000, npc, player) elif event == "2": npc.broadcastPacket(SocialAction(npc.getObjectId(), 3)) elif event == "3": npc.broadcastPacket( SpecialCamera(npc.getObjectId(), 1, -150, 10, 3000, 20000)) self.startQuestTimer("4", 2500, npc, player) elif event == "4": npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(96055, -110759, -3312, 0)) self.startQuestTimer("5", 2000, npc, player) elif event == "5": player.teleToLocation(94832, -112624, -3304) npc.teleToLocation(-113091, -243942, -15536) if self.isGolemSpawned == 0: golem = self.addSpawn(25512, 94640, -112496, -3336, 0, False, 0) self.isGolemSpawned == 1 self.startQuestTimer("6", 1000, golem, player) player.sendPacket(PlaySound(1, "Rm03_A", 0, 0, 0, 0, 0)) elif event == "6": npc.broadcastPacket( SpecialCamera(npc.getObjectId(), 30, -200, 20, 6000, 8000)) return
def onSkillUse(self, npc, player, skill): # gather some values on local variables npcId = npc.getNpcId() skillId = skill.getId() # check if the npc and skills used are valid for this script. Exit if invalid. if npcId not in self.feedableBeasts: return if skillId not in [SKILL_GOLDEN_SPICE, SKILL_CRYSTAL_SPICE]: return # first gather some values on local variables objectId = npc.getObjectId() growthLevel = 3 # if a mob is in feedableBeasts but not in growthCapableMobs, then it's at max growth (3) if self.growthCapableMobs.has_key(npcId): growthLevel = self.growthCapableMobs[npcId][0] # prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast # If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder! if (growthLevel == 0) and self.feedInfo.has_key(objectId): return else: self.feedInfo[objectId] = player.getObjectId() food = 0 if skillId == SKILL_GOLDEN_SPICE: food = GOLDEN_SPICE elif skillId == SKILL_CRYSTAL_SPICE: food = CRYSTAL_SPICE # display the social action of the beast eating the food. npc.broadcastPacket(SocialAction(objectId, 2)) # if this pet can't grow, it's all done. if npcId in self.growthCapableMobs.keys(): # do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect). if len(self.growthCapableMobs[npcId][1][food]) == 0: return # rare random talk... if Rnd.get(20) == 0: npc.broadcastPacket( CreatureSay( objectId, 0, npc.getName(), self.Text[growthLevel][Rnd.get( len(self.Text[growthLevel]))])) if growthLevel > 0: # check if this is the same player as the one who raised it from growth 0. # if no, then do not allow a chance to raise the pet (food gets consumed but has no effect). if self.feedInfo[objectId] != player.getObjectId(): return # Polymorph the mob, with a certain chance, given its current growth level if Rnd.get(100) < self.growthCapableMobs[npcId][2]: self.spawnNext(npc, growthLevel, player, food) elif npcId in self.tamedBeasts: if skillId == npc.getFoodType(): npc.onReceiveFood() mytext = [ "Refills! Yeah!", "I am such a gluttonous beast, it is embarrassing! Ha ha", "Your cooperative feeling has been getting better and better.", "I will help you!", "The weather is really good. Wanna go for a picnic?", "I really like you! This is tasty...", "If you do not have to leave this place, then I can help you.", "What can I help you with?", "I am not here only for food!", "Yam, yam, yam, yam, yam!" ] npc.broadcastPacket( CreatureSay(objectId, 0, npc.getName(), mytext[Rnd.get(len(mytext))])) return
def onTalk(self, npc, player): htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>" st = player.getQuestState(qn) if not st: return htmltext npcId = npc.getNpcId() id = st.getState() if npcId != KARUKIA and id != State.STARTED: return htmltext playerClassID = player.getClassId().getId() playerLvl = player.getLevel() cond = st.getInt("cond") if npcId == KARUKIA and cond == 0: if playerLvl >= 18 and playerClassID == 0x2c and st.getQuestItemsCount( MARK_OF_RAIDER) == 0 and st.getQuestItemsCount( GOBLIN_DWELLING_MAP) == 0: htmltext = "30570-01.htm" elif playerClassID != 0x2c: if playerClassID == 0x2d: htmltext = "30570-02a.htm" else: htmltext = "30570-03.htm" elif playerLvl < 19 and playerClassID == 0x2c: htmltext = "30570-02.htm" elif playerLvl >= 18 and playerClassID == 0x2c and st.getQuestItemsCount( MARK_OF_RAIDER) == 1: htmltext = "30570-04.htm" else: htmltext = "30570-02.htm" elif npcId == KARUKIA and cond and st.getQuestItemsCount( GOBLIN_DWELLING_MAP ) == 1 and st.getQuestItemsCount(KURUKA_RATMAN_TOOTH) < 10: htmltext = "30570-06.htm" elif npcId == KARUKIA and cond and st.getQuestItemsCount( GOBLIN_DWELLING_MAP) == 1 and st.getQuestItemsCount( KURUKA_RATMAN_TOOTH) >= 10 and st.getQuestItemsCount( BETRAYER_UMBAR_REPORT) == 0: htmltext = "30570-07.htm" elif npcId == KARUKIA and cond > 5: htmltext = "30570-07b.htm" elif npcId == KARUKIA and cond and st.getQuestItemsCount( BETRAYER_UMBAR_REPORT ) and st.getQuestItemsCount(HEAD_OF_BETRAYER) < 2: htmltext = "30570-08.htm" elif npcId == KARUKIA and cond and st.getQuestItemsCount( BETRAYER_UMBAR_REPORT) and st.getQuestItemsCount( HEAD_OF_BETRAYER) == 2: htmltext = "30570-09.htm" elif npcId == KASMAN and cond and st.getQuestItemsCount( BETRAYER_UMBAR_REPORT) and st.getQuestItemsCount( HEAD_OF_BETRAYER) == 0: htmltext = "30501-01.htm" elif npcId == KASMAN and cond and st.getQuestItemsCount( HEAD_OF_BETRAYER) > 0 and st.getQuestItemsCount( HEAD_OF_BETRAYER) < 2: htmltext = "30501-02.htm" elif npcId == KASMAN and cond and st.getQuestItemsCount( HEAD_OF_BETRAYER) == 2: htmltext = "30501-03.htm" st.takeItems(HEAD_OF_BETRAYER, -1) st.takeItems(BETRAYER_UMBAR_REPORT, -1) st.giveItems(MARK_OF_RAIDER, 1) player.sendPacket(SocialAction(player.getObjectId(), 3)) st.unset("cond") st.exitQuest(False) st.playSound("ItemSound.quest_finish") elif npcId == TAZEER: if cond == 5: htmltext = "31978-01.htm" elif cond == 6: htmltext = "31978-04.htm" elif cond == 7: htmltext = "31978-05.htm" st.takeItems(TIMORA_ORC_HEAD, -1) st.giveItems(MARK_OF_RAIDER, 1) player.sendPacket(SocialAction(player.getObjectId(), 3)) st.unset("cond") st.exitQuest(False) st.playSound("ItemSound.quest_finish") return htmltext
def onAdvEvent(self, event, npc, pc): if event == "timer_check": gameTime = GameTimeController.getInstance().getGameTime() h = (gameTime / 60) % 24 m = gameTime % 60 if h == 20 and m >= 27 and m <= 33: self.startQuestTimer("Start", 100, None, None) self.cancelQuestTimer("timer_check", None, None) elif event == "Start": mc = self.addSpawn(self.MC, -56698, -56430, -2008, 32768, False, 0) self.AutoChat(mc, TEXT[0], 1) self.startQuestTimer("1", 30000, mc, None) elif event in TALKS.keys() and npc: text, nextEvent, time = TALKS[event] self.AutoChat(npc, text, 1) self.startQuestTimer(nextEvent, time, npc, None) elif event in WALKS.keys() and npc and self.isSpawned == 1: x, y, z, nextEvent, time = WALKS[event] npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x, y, z, 0)) self.startQuestTimer(nextEvent, time, npc, None) elif event == "6" and npc: self.AutoChat(npc, TEXT[6], 1) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56511, -56647, -2008, 36863)) npc.broadcastPacket(PlaySound(1, "NS22_F", 0, 0, 0, 0, 0)) elf = self.addSpawn(self.singers[0], -56344, -56328, -2008, 32768, False, 0) elf.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56657, -56338, -2008, 33102)) elf1 = self.addSpawn(self.singers[1], -56552, -56245, -2008, 36863, False, 0) elf2 = self.addSpawn(self.singers[1], -56546, -56426, -2008, 28672, False, 0) elf3 = self.addSpawn(self.singers[1], -56570, -56473, -2008, 28672, False, 0) elf4 = self.addSpawn(self.singers[1], -56594, -56516, -2008, 28672, False, 0) elf5 = self.addSpawn(self.singers[1], -56580, -56203, -2008, 36863, False, 0) elf6 = self.addSpawn(self.singers[1], -56606, -56157, -2008, 36863, False, 0) for i in [elf, elf1, elf2, elf3, elf4, elf5, elf6]: self.startQuestTimer("social1", 6000, i, None, True) for j in [npc, elf, elf1, elf2, elf3, elf4, elf5, elf6]: self.startQuestTimer("7", 215000, j, None) elif event == "7" and npc: if npc.getNpcId() == self.MC: self.AutoChat(npc, TEXT[7], 1) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56698, -56430, -2008, 32768)) self.startQuestTimer("8", 12000, npc, None) else: self.cancelQuestTimer("social1", npc, None) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56594, -56064, -2008, 32768)) self.startQuestTimer("clean_npc", 9000, npc, None) elif event == "10" and npc: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56483, -56665, -2034, 32768)) npc1 = self.addSpawn(self.circus[0], -56495, -56375, -2008, 32768, False, 0) npc2 = self.addSpawn(self.circus[0], -56491, -56289, -2008, 32768, False, 0) npc3 = self.addSpawn(self.circus[1], -56502, -56246, -2008, 32768, False, 0) npc4 = self.addSpawn(self.circus[1], -56496, -56429, -2008, 32768, False, 0) npc5 = self.addSpawn(self.circus[2], -56505, -56334, -2008, 32768, False, 0) npc6 = self.addSpawn(self.circus[3], -56545, -56427, -2008, 32768, False, 0) npc7 = self.addSpawn(self.circus[3], -56552, -56248, -2008, 32768, False, 0) npc8 = self.addSpawn(self.circus[4], -56493, -56473, -2008, 32768, False, 0) npc9 = self.addSpawn(self.circus[4], -56504, -56201, -2008, 32768, False, 0) npc.broadcastPacket(PlaySound(1, "TP05_F", 0, 0, 0, 0, 0)) self.startQuestTimer("npc1_1", 3000, npc1, None) self.startQuestTimer("npc2_1", 3000, npc2, None) self.startQuestTimer("npc3_1", 3000, npc3, None) self.startQuestTimer("npc4_1", 3000, npc4, None) self.startQuestTimer("npc5_1", 3500, npc5, None) self.startQuestTimer("npc6_1", 4000, npc6, None) self.startQuestTimer("npc7_1", 4000, npc7, None) self.startQuestTimer("npc8_1", 3000, npc8, None) self.startQuestTimer("npc9_1", 3000, npc9, None) self.isSpawned = 1 for j in [ npc, npc1, npc2, npc3, npc4, npc5, npc6, npc7, npc8, npc9 ]: self.startQuestTimer("11", 100000, j, None) elif event == "11" and npc: if npc.getNpcId() == self.MC: self.AutoChat(npc, TEXT[10], 1) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56698, -56430, -2008, 32768)) self.startQuestTimer("12", 5000, npc, None) else: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56343, -56330, -2008, 32768)) self.startQuestTimer("clean_npc", 1000, npc, None) elif event == "14" and npc: npc1 = self.addSpawn(self.individuals[0], -56700, -56385, -2008, 32768, False, 0) self.startQuestTimer("social1", 2000, npc1, None) self.startQuestTimer("clean_npc", 49000, npc1, None) self.startQuestTimer("15", 7000, npc, None) elif event == "17" and npc: self.AutoChat(npc, TEXT[15], 1) npc1 = self.addSpawn(self.individuals[1], -56700, -56340, -2008, 32768, False, 0) self.startQuestTimer("social1", 2000, npc1, None) self.startQuestTimer("clean_npc", 32000, npc1, None) self.startQuestTimer("18", 9000, npc, None) elif event == "20" and npc: npc1 = self.addSpawn(self.individuals[2], -56703, -56296, -2008, 32768, False, 0) self.startQuestTimer("social1", 2000, npc1, None) self.startQuestTimer("clean_npc", 13000, npc1, None) self.startQuestTimer("21", 8000, npc, None) elif event == "23" and npc: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56702, -56340, -2008, 32768)) self.startQuestTimer("24", 2800, npc, None) npc1 = self.addSpawn(self.showstuff[0], -56672, -56406, -2000, 32768, False, 0) npc2 = self.addSpawn(self.showstuff[1], -56648, -56368, -2000, 32768, False, 0) npc3 = self.addSpawn(self.showstuff[2], -56608, -56338, -2000, 32768, False, 0) npc4 = self.addSpawn(self.showstuff[3], -56652, -56307, -2000, 32768, False, 0) npc5 = self.addSpawn(self.showstuff[4], -56672, -56272, -2000, 32768, False, 0) for j in [npc1, npc2, npc3, npc4, npc5]: self.startQuestTimer("social1", 5500, j, None) self.startQuestTimer("social1_1", 12500, j, None) self.startQuestTimer("28", 19700, j, None) elif event == "28" and npc: self.AutoChat(npc, "We love you.", 0) self.startQuestTimer("social1", 1, npc, None) self.startQuestTimer("clean_npc", 1200, npc, None) elif event == "29" and npc: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56730, -56340, -2008, 32768)) self.startQuestTimer("clean_npc", 4100, npc, None) self.startQuestTimer("timer_check", 60000, None, None, True) elif event in ["social1", "social1_1"] and npc: npc.broadcastPacket(SocialAction(npc.getObjectId(), 1)) elif event == "clean_npc" and npc: if npc.getNpcId() in [ self.circus[0], self.circus[1], self.circus[2], self.circus[3], self.circus[4] ]: self.isSpawned = 0 npc.deleteMe() return
def onTalk (self,npc,player): htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>" st = player.getQuestState(qn) if not st : return htmltext npcId = npc.getNpcId() id = st.getState() cond = st.getInt("cond") if id == State.COMPLETED : htmltext = "<html><body>This quest has already been completed.</body></html>" 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.addExpAndSp(189831,21526) 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.getNpcId(),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.getNpcId(),"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
def onEvent(self, event, st): htmltext = event player = st.getPlayer() if event == "1": st.set("id", "0") st.set("cond", "1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") htmltext = "30585-06.htm" st.giveItems(FIRE_CHARM, 1) elif event == "32057_1": htmltext = "32057-02.htm" st.playSound("ItemSound.quest_middle") st.set("cond", "14") elif event == "32057_2": htmltext = "32057-05.htm" st.playSound("ItemSound.quest_middle") st.set("cond", "21") elif event == "32090_1": htmltext = "32090-04.htm" st.playSound("ItemSound.quest_middle") st.set("cond", "18") elif event == "30585_1": if player.getClassId().getId() != 0x31: if player.getClassId().getId() == 0x32: htmltext = "30585-02a.htm" else: htmltext = "30585-02.htm" else: if player.getLevel() < 19: htmltext = "30585-03.htm" else: if st.getQuestItemsCount(MASK_OF_MEDIUM) != 0: htmltext = "30585-04.htm" else: htmltext = "30585-05.htm" return htmltext elif event == "30585_1a": htmltext = "30585-10a.htm" elif event == "30585_2": htmltext = "30585-11.htm" st.takeItems(TOTEM_SPIRIT_CLAW, 1) st.giveItems(TATARUS_LETTER, 1) st.set("cond", "5") st.playSound("ItemSound.quest_middle") elif event == "30585_3": htmltext = "30585-11a.htm" st.takeItems(TOTEM_SPIRIT_CLAW, 1) st.playSound("ItemSound.quest_middle") st.set("cond", "12") elif event == "30592_1": htmltext = "30592-02.htm" elif event == "30592_2": htmltext = "30592-03.htm" st.takeItems(HESTUI_MASK, 1) st.takeItems(FIERY_EGG2, 1) st.giveItems(TOTEM_SPIRIT_CLAW, 1) st.set("cond", "4") st.playSound("ItemSound.quest_middle") elif event == "30502_2": htmltext = "30502-07.htm" st.takeItems(TOTEM_SPIRIT_BLOOD, st.getQuestItemsCount(TOTEM_SPIRIT_BLOOD)) st.giveItems(MASK_OF_MEDIUM, 1) st.addExpAndSp(3200, 2600) player.sendPacket(SocialAction(player.getObjectId(), 3)) st.set("cond", "0") st.exitQuest(False) st.playSound("ItemSound.quest_finish") elif event == "30593_1": htmltext = "30593-02.htm" elif event == "30593_2": htmltext = "30593-03.htm" st.takeItems(BLOOD_CAULDRON, 1) st.giveItems(SPIRIT_NET, 1) st.set("cond", "9") st.playSound("ItemSound.quest_middle") return htmltext
def onTalk(self, npc, player): htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>" st = player.getQuestState(qn) if not st: return htmltext npcId = npc.getNpcId() id = st.getState() if npcId != 30585 and id != State.STARTED: return htmltext if npcId == 30585 and st.getInt("cond") == 0: htmltext = "30585-01.htm" elif npcId == 30585 and st.getInt("cond") == 12: htmltext = "30585-11a.htm" elif npcId == 31979 and st.getInt("cond") == 12: htmltext = "31979-01.htm" st.playSound("ItemSound.quest_middle") st.set("cond", "13") elif npcId == 31979 and st.getInt("cond") == 21: htmltext = "31979-03.htm" st.giveItems(MASK_OF_MEDIUM, 1) st.addExpAndSp(3200, 2600) player.sendPacket(SocialAction(player.getObjectId(), 3)) st.set("cond", "0") st.exitQuest(False) st.playSound("ItemSound.quest_finish") elif npcId == 31979 and st.getInt("cond") == 13: htmltext = "31979-02.htm" elif npcId == 32057 and st.getInt("cond") == 13: htmltext = "32057-01.htm" elif npcId == 32057 and st.getInt("cond") == 14: htmltext = "32057-03.htm" elif npcId == 32057 and st.getInt("cond") == 20: htmltext = "32057-04.htm" elif npcId == 32057 and st.getInt("cond") == 21: htmltext = "32057-05.htm" elif npcId == 32090 and st.getInt("cond") == 15: htmltext = "32090-01.htm" st.playSound("ItemSound.quest_middle") st.set("cond", "16") elif npcId == 32090 and st.getInt("cond") == 16: htmltext = "32090-01.htm" elif npcId == 32090 and st.getInt("cond") == 17: htmltext = "32090-02.htm" elif npcId == 32090 and st.getInt("cond") == 18: htmltext = "32090-05.htm" elif npcId == 32090 and st.getInt("cond") == 19: htmltext = "32090-06.htm" st.playSound("ItemSound.quest_middle") st.set("cond", "20") elif npcId == 32090 and st.getInt("cond") == 20: htmltext = "32090-06.htm" elif npcId == 30585 and st.getInt("cond") and st.getQuestItemsCount( FIRE_CHARM) == 1 and ( (st.getQuestItemsCount(KASHA_BEAR_PELT) + st.getQuestItemsCount(KASHA_BSPIDER_HUSK) + st.getQuestItemsCount(FIERY_EGG1)) < 3): htmltext = "30585-07.htm" elif npcId == 30585 and st.getInt("cond") and st.getQuestItemsCount( FIRE_CHARM) == 1 and ( (st.getQuestItemsCount(KASHA_BEAR_PELT) + st.getQuestItemsCount(KASHA_BSPIDER_HUSK) + st.getQuestItemsCount(FIERY_EGG1)) >= 3): htmltext = "30585-08.htm" st.takeItems(FIRE_CHARM, 1) st.takeItems(KASHA_BEAR_PELT, 1) st.takeItems(KASHA_BSPIDER_HUSK, 1) st.takeItems(FIERY_EGG1, 1) st.giveItems(HESTUI_MASK, 1) st.giveItems(FIERY_EGG2, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") elif npcId == 30585 and st.getInt("cond") and st.getQuestItemsCount( HESTUI_MASK) == 1 and st.getQuestItemsCount(FIERY_EGG2) == 1: htmltext = "30585-09.htm" elif npcId == 30585 and st.getInt("cond") and st.getQuestItemsCount( TOTEM_SPIRIT_CLAW) == 1: htmltext = "30585-10.htm" elif npcId == 30585 and st.getInt("cond") and st.getQuestItemsCount( TATARUS_LETTER) == 1: htmltext = "30585-12.htm" elif npcId == 30585 and st.getInt("cond") and ( st.getQuestItemsCount(GRIZZLY_BLOOD) or st.getQuestItemsCount(FLAME_CHARM) or st.getQuestItemsCount(BLOOD_CAULDRON) or st.getQuestItemsCount(SPIRIT_NET) or st.getQuestItemsCount(BOUND_DURKA_SPIRIT) or st.getQuestItemsCount(TOTEM_SPIRIT_BLOOD)): htmltext = "30585-13.htm" elif npcId == 30592 and st.getInt("cond") and st.getQuestItemsCount( HESTUI_MASK) and st.getQuestItemsCount(FIERY_EGG2): htmltext = "30592-01.htm" elif npcId == 30592 and st.getInt("cond") and st.getQuestItemsCount( TOTEM_SPIRIT_CLAW): htmltext = "30592-04.htm" elif npcId == 30592 and st.getInt("cond") and ( st.getQuestItemsCount(GRIZZLY_BLOOD) or st.getQuestItemsCount(FLAME_CHARM) or st.getQuestItemsCount(BLOOD_CAULDRON) or st.getQuestItemsCount(SPIRIT_NET) or st.getQuestItemsCount(BOUND_DURKA_SPIRIT) or st.getQuestItemsCount(TOTEM_SPIRIT_BLOOD) or st.getQuestItemsCount(TATARUS_LETTER)): htmltext = "30592-05.htm" elif npcId == 30502 and st.getInt("cond") and st.getQuestItemsCount( TATARUS_LETTER): htmltext = "30502-01.htm" st.giveItems(FLAME_CHARM, 1) st.takeItems(TATARUS_LETTER, 1) st.set("cond", "6") st.playSound("ItemSound.quest_middle") elif npcId == 30502 and st.getInt("cond") and st.getQuestItemsCount( FLAME_CHARM) == 1 and st.getQuestItemsCount(GRIZZLY_BLOOD) < 3: htmltext = "30502-02.htm" elif npcId == 30502 and st.getInt("cond") and st.getQuestItemsCount( FLAME_CHARM ) == 1 and st.getQuestItemsCount(GRIZZLY_BLOOD) >= 3: htmltext = "30502-03.htm" st.takeItems(FLAME_CHARM, 1) st.takeItems(GRIZZLY_BLOOD, st.getQuestItemsCount(GRIZZLY_BLOOD)) st.giveItems(BLOOD_CAULDRON, 1) st.set("cond", "8") st.playSound("ItemSound.quest_middle") elif npcId == 30502 and st.getInt("cond") and st.getQuestItemsCount( BLOOD_CAULDRON) == 1: htmltext = "30502-04.htm" elif npcId == 30502 and st.getInt("cond") and ( st.getQuestItemsCount(BOUND_DURKA_SPIRIT) == 1 or st.getQuestItemsCount(SPIRIT_NET) == 1): htmltext = "30502-05.htm" elif npcId == 30502 and st.getInt("cond") and st.getQuestItemsCount( TOTEM_SPIRIT_BLOOD) == 1: htmltext = "30502-06.htm" elif npcId == 30593 and st.getInt("cond") and st.getQuestItemsCount( BLOOD_CAULDRON): htmltext = "30593-01.htm" elif npcId == 30593 and st.getInt("cond") and st.getQuestItemsCount( SPIRIT_NET) and st.getQuestItemsCount(BOUND_DURKA_SPIRIT) == 0: htmltext = "30593-04.htm" elif npcId == 30593 and st.getInt("cond") and st.getQuestItemsCount( SPIRIT_NET) == 0 and st.getQuestItemsCount(BOUND_DURKA_SPIRIT): htmltext = "30593-05.htm" st.takeItems(BOUND_DURKA_SPIRIT, 1) st.giveItems(TOTEM_SPIRIT_BLOOD, 1) st.set("cond", "11") st.playSound("ItemSound.quest_middle") elif npcId == 30593 and st.getInt( "cond") == 1 and st.getQuestItemsCount(TOTEM_SPIRIT_BLOOD): htmltext = "30593-06.htm" return htmltext
def onTalk(self, npc, player): htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>" st = player.getQuestState(qn) if not st: return htmltext npcId = npc.getNpcId() id = st.getState() if npcId != 30587 and id != State.STARTED: return htmltext if npcId == 30587 and st.getInt("cond") == 0 and st.getInt( "onlyone") == 0: htmltext = "30587-01.htm" elif npcId == 30587 and st.getInt("cond") == 0 and st.getInt( "onlyone") == 1: htmltext = "30587-04.htm" elif npcId == 30587 and st.getInt("cond") and st.getQuestItemsCount( SCROLL_FIERY_SPIRIT) == 0 and st.getQuestItemsCount( POMEGRANATE) == 1 and st.getQuestItemsCount( GANTAKIS_LETTER) == 0 and st.getQuestItemsCount( ROSHEEKS_LETTER) == 0 and ( (st.getQuestItemsCount(LEATHER_POUCH1) + st.getQuestItemsCount(LEATHER_POUCH2) + st.getQuestItemsCount(LEATHER_POUCH3) + st.getQuestItemsCount(LEATHER_POUCH1FULL) + st.getQuestItemsCount(LEATHER_POUCH2FULL) + st.getQuestItemsCount(LEATHER_POUCH3FULL)) == 0): htmltext = "30587-07.htm" elif npcId == 30587 and st.getInt("cond") and st.getQuestItemsCount( SCROLL_FIERY_SPIRIT) == 0 and st.getQuestItemsCount( POMEGRANATE) == 0 and st.getQuestItemsCount( GANTAKIS_LETTER) == 0 and st.getQuestItemsCount( ROSHEEKS_LETTER) == 0 and ( (st.getQuestItemsCount(LEATHER_POUCH1) + st.getQuestItemsCount(LEATHER_POUCH2) + st.getQuestItemsCount(LEATHER_POUCH3) + st.getQuestItemsCount(LEATHER_POUCH1FULL) + st.getQuestItemsCount(LEATHER_POUCH2FULL) + st.getQuestItemsCount(LEATHER_POUCH3FULL)) == 1): htmltext = "30587-08.htm" elif npcId == 30587 and st.getInt("cond") and st.getQuestItemsCount( SCROLL_FIERY_SPIRIT) == 1 and st.getQuestItemsCount( POMEGRANATE) == 0 and st.getQuestItemsCount( GANTAKIS_LETTER) == 0 and st.getQuestItemsCount( ROSHEEKS_LETTER) == 1 and ( (st.getQuestItemsCount(LEATHER_POUCH1) + st.getQuestItemsCount(LEATHER_POUCH2) + st.getQuestItemsCount(LEATHER_POUCH3) + st.getQuestItemsCount(LEATHER_POUCH1FULL) + st.getQuestItemsCount(LEATHER_POUCH2FULL) + st.getQuestItemsCount(LEATHER_POUCH3FULL)) == 0): htmltext = "30587-09.htm" elif npcId == 30587 and st.getInt("cond") >= 14: htmltext = "30587-09b.htm" elif npcId == 30587 and st.getInt("cond") and st.getQuestItemsCount( SCROLL_FIERY_SPIRIT) == 1 and st.getQuestItemsCount( POMEGRANATE) == 0 and st.getQuestItemsCount( GANTAKIS_LETTER) == 1 and st.getQuestItemsCount( ROSHEEKS_LETTER) == 0 and ( (st.getQuestItemsCount(LEATHER_POUCH1) + st.getQuestItemsCount(LEATHER_POUCH2) + st.getQuestItemsCount(LEATHER_POUCH3) + st.getQuestItemsCount(LEATHER_POUCH1FULL) + st.getQuestItemsCount(LEATHER_POUCH2FULL) + st.getQuestItemsCount(LEATHER_POUCH3FULL)) == 0): htmltext = "30587-10.htm" elif npcId == 30587 and st.getInt("cond") and st.getQuestItemsCount( SCROLL_FIERY_SPIRIT) == 1 and st.getQuestItemsCount( POMEGRANATE) == 0 and st.getQuestItemsCount( GANTAKIS_LETTER) == 0 and st.getQuestItemsCount( ROSHEEKS_LETTER) == 0 and ( (st.getQuestItemsCount(LEATHER_POUCH1) + st.getQuestItemsCount(LEATHER_POUCH2) + st.getQuestItemsCount(LEATHER_POUCH3) + st.getQuestItemsCount(LEATHER_POUCH1FULL) + st.getQuestItemsCount(LEATHER_POUCH2FULL) + st.getQuestItemsCount(LEATHER_POUCH3FULL)) == 0): htmltext = "30587-11.htm" elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( POMEGRANATE): htmltext = "30590-01.htm" st.takeItems(POMEGRANATE, 1) st.giveItems(LEATHER_POUCH1, 1) st.set("cond", "2") st.playSound("ItemSound.quest_middle") elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_POUCH1) and st.getQuestItemsCount( LEATHER_POUCH1FULL) == 0: htmltext = "30590-02.htm" elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_POUCH1) == 0 and st.getQuestItemsCount( LEATHER_POUCH1FULL): htmltext = "30590-03.htm" st.takeItems(LEATHER_POUCH1FULL, 1) st.giveItems(LEATHER_POUCH2, 1) st.set("cond", "4") st.playSound("ItemSound.quest_middle") elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_POUCH2) == 1 and st.getQuestItemsCount( LEATHER_POUCH2FULL) == 0: htmltext = "30590-04.htm" elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_POUCH2) == 0 and st.getQuestItemsCount( LEATHER_POUCH2FULL) == 1: htmltext = "30590-05.htm" st.takeItems(LEATHER_POUCH2FULL, 1) st.giveItems(LEATHER_POUCH3, 1) st.set("cond", "6") st.playSound("ItemSound.quest_middle") elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_POUCH3) == 1 and st.getQuestItemsCount( LEATHER_POUCH3FULL) == 0: htmltext = "30590-06.htm" elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_POUCH3) == 0 and st.getQuestItemsCount( LEATHER_POUCH3FULL) == 1: htmltext = "30590-07.htm" st.takeItems(LEATHER_POUCH3FULL, 1) st.giveItems(SCROLL_FIERY_SPIRIT, 1) st.giveItems(ROSHEEKS_LETTER, 1) st.set("cond", "8") st.playSound("ItemSound.quest_middle") elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( ROSHEEKS_LETTER) == 1 and st.getQuestItemsCount( SCROLL_FIERY_SPIRIT) == 1: htmltext = "30590-08.htm" elif npcId == 30590 and st.getInt("cond") and st.getQuestItemsCount( ROSHEEKS_LETTER) == 0 and st.getQuestItemsCount( SCROLL_FIERY_SPIRIT) == 1: htmltext = "30590-09.htm" elif npcId == 30501 and st.getInt("cond") and st.getQuestItemsCount( GANTAKIS_LETTER): htmltext = "30501-01.htm" st.takeItems(GANTAKIS_LETTER, 1) st.giveItems(FIG, 1) st.set("cond", "10") st.playSound("ItemSound.quest_middle") elif npcId == 30501 and st.getInt("cond") and st.getQuestItemsCount( FIG) and (st.getQuestItemsCount(LEATHER_PURSE4) == 0 or st.getQuestItemsCount(LEATHER_POUCH4FULL) == 0): htmltext = "30501-02.htm" elif npcId == 30501 and st.getInt("cond") and st.getQuestItemsCount( FIG) == 0 and (st.getQuestItemsCount(LEATHER_PURSE4) == 1 or st.getQuestItemsCount(LEATHER_POUCH4FULL) == 1): htmltext = "30501-03.htm" elif npcId == 30501 and st.getInt("cond") and st.getQuestItemsCount( SCROLL_IRON_WILL): htmltext = "30501-04.htm" st.takeItems(SCROLL_IRON_WILL, 1) st.takeItems(SCROLL_FIERY_SPIRIT, 1) st.takeItems(TORUKUS_LETTER, 1) st.giveItems(KHAVATARI_TOTEM, 1) player.sendPacket(SocialAction(player.getObjectId(), 3)) st.set("cond", "0") st.set("onlyone", "1") st.exitQuest(False) st.playSound("ItemSound.quest_finish") elif npcId == 30591 and st.getInt("cond") and st.getQuestItemsCount( FIG): htmltext = "30591-01.htm" st.takeItems(FIG, 1) st.giveItems(LEATHER_PURSE4, 1) st.set("cond", "11") st.playSound("ItemSound.quest_middle") elif npcId == 30591 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_PURSE4) and st.getQuestItemsCount( LEATHER_POUCH4FULL) == 0: htmltext = "30591-02.htm" elif npcId == 30591 and st.getInt("cond") and st.getQuestItemsCount( LEATHER_PURSE4) == 0 and st.getQuestItemsCount( LEATHER_POUCH4FULL) == 1: htmltext = "30591-03.htm" st.takeItems(LEATHER_POUCH4FULL, 1) st.giveItems(SCROLL_IRON_WILL, 1) st.giveItems(TORUKUS_LETTER, 1) st.set("cond", "13") st.playSound("ItemSound.quest_middle") elif npcId == 30591 and st.getInt("cond") and st.getQuestItemsCount( SCROLL_IRON_WILL) == 1 and st.getQuestItemsCount( TORUKUS_LETTER) == 1: htmltext = "30591-04.htm" elif npcId == 32056: if cond == 14: htmltext = "32056-01.htm" elif cond == 15: htmltext = "32056-04.htm" elif cond == 16: htmltext = "32056-05.htm" st.set("cond", "17") st.playSound("ItemSound.quest_middle") st.takeItems(8545, -1) elif cond == 17: htmltext = "32056-06.htm" elif cond == 18: htmltext = "32056-07.htm" elif cond == 19: htmltext = "32056-09.htm" elif npcId == 31979: if cond == 19: htmltext = "31979-01.htm" return htmltext