def onAdvEvent(self, event, npc, player): htmltext = event st = player.getQuestState(qn) if not st: return if event in ["30839-02.htm", "31307-02.htm"]: st.set("cond", "1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") elif event == "30839-05.htm": st.set("cond", "2") st.playSound("ItemSound.quest_middle") elif event == "31307-05.htm": st.set("cond", "7") st.playSound("ItemSound.quest_middle") elif event == "32325-03.htm": st.set("cond", "3") st.giveItems(YinSword, 1, Elementals.FIRE, 10) st.playSound("ItemSound.quest_middle") elif event == "32326-03.htm": st.set("cond", "8") st.giveItems(YangSword, 1, Elementals.EARTH, 10) st.playSound("ItemSound.quest_middle") elif event == "32325-06.htm": if st.getQuestItemsCount(YinSword): st.takeItems(YinSword, 1) htmltext = "32325-07.htm" st.giveItems(YinSword, 1, Elementals.FIRE, 10) elif event == "32326-06.htm": if st.getQuestItemsCount(YangSword): st.takeItems(YangSword, 1) htmltext = "32326-07.htm" st.giveItems(YangSword, 1, Elementals.EARTH, 10) elif event == "32325-09.htm": st.set("cond", "5") SkillTable.getInstance().getInfo(2635, 1).getEffects(player, player) st.giveItems(YinSword, 1, Elementals.FIRE, 10) st.playSound("ItemSound.quest_middle") elif event == "32326-09.htm": st.set("cond", "10") SkillTable.getInstance().getInfo(2636, 1).getEffects(player, player) st.giveItems(YangSword, 1, Elementals.EARTH, 10) st.playSound("ItemSound.quest_middle") elif event.isdigit(): st.giveItems(10520 + int(event), 2) st.addExpAndSp(202160, 20375) st.unset("cond") st.exitQuest(False) st.playSound("ItemSound.quest_finish") htmltext = str(npc.getNpcId()) + "-1" + event + ".htm" return htmltext
def onAttack(self, npc, player, damage, isPet, skill): st = player.getQuestState(qn) if not st: return if st.getState() != State.STARTED: return chance = st.getRandom(100) if chance < 3: count = 0 for item in range(5875, 5879): if st.getQuestItemsCount(item): count += 1 st.takeItems(item, -1) if count: st.giveItems(5880, 1) elif chance < 7: for item in range(5875, 5879): if st.getQuestItemsCount(item): npc.doCast(SkillTable.getInstance().getInfo(4072, 4)) st.takeItems(item, -1) st.giveItems(item + 1, 1) if item < 5878: st.playSound("ItemSound.quest_itemget") elif item == 5878: st.playSound("ItemSound.quest_middle") st.set("cond", "2") break return
def onAdvEvent(self, event, npc, player): htmltext = event st = player.getQuestState(qn) if not st: return Alevel = player.getAllianceWithVarkaKetra() if str(event) in BUFF.keys(): skillId, level, horns = BUFF[event] if st.getQuestItemsCount(Horn) >= horns: st.takeItems(Horn, horns) npc.setTarget(player) npc.doCast(SkillTable.getInstance().getInfo(skillId, level)) npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp()) htmltext = "31372-4.htm" elif event == "Withdraw": if player.getWarehouse().getSize() == 0: htmltext = "31374-0.htm" else: player.sendPacket(ActionFailed.STATIC_PACKET) player.setActiveWarehouse(player.getWarehouse()) player.sendPacket(WareHouseWithdrawalList(player, 1)) elif event == "Teleport": if Alevel == 4: htmltext = "31376-4.htm" elif Alevel == 5: htmltext = "31376-5.htm" return htmltext
def transformPlayer(npc, player, transid): if player.isTransformed() == True: player.untransform() time.sleep(2) for effect in player.getAllEffects(): if effect.getAbnormalType() == "speed_up": effect.exit() npc.setTarget(player) npc.doCast(SkillTable.getInstance().getInfo(transid, 1)) return
def onAdvEvent(self, event, npc, player): htmltext = event st = player.getQuestState(qn) if not st: return if event == "32557-06.htm": st.set("cond", "1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") elif event == "32557-09.htm": st.set("transform", "1") SkillTable.getInstance().getInfo(5982, 1).getEffects(player, player) elif event == "32557-10.htm": st.set("transform", "2") SkillTable.getInstance().getInfo(5983, 1).getEffects(player, player) elif event == "32557-13.htm": if st.getInt("transform") == 1: SkillTable.getInstance().getInfo(5982, 1).getEffects(player, player) elif st.getInt("transform") == 2: SkillTable.getInstance().getInfo(5983, 1).getEffects(player, player) return htmltext
def onAcquireSkillList(self, npc, player): asl = AcquireSkillList(AcquireSkillList.SkillType.unk4) st = player.getQuestState(qn) oldSkills = player.getAllSkills() count = 0 for i in SKILLITEMS: for j in SUBSKILLS[i]: minLevel = 0 maxLevel = SkillTable.getInstance().getMaxLevel(j) for oldsk in oldSkills: if oldsk.getId() == j: minLevel = oldsk.getLevel() if minLevel < maxLevel: count += 1 asl.addSkill(j, minLevel + 1, maxLevel, 0, 0) player.sendPacket(asl) if count == 0: player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_MORE_SKILLS_TO_LEARN)) return ""
def onAdvEvent(self, event, npc, player): st = player.getQuestState(qn) if not st: return htmltext = event cond = st.getInt("cond") if htmltext == "31554-03a.htm": # Giving 100 Splinter Stakato Chitins. Getting Recruit mark if st.getQuestItemsCount(CHITIN) >= count and cond == 1: st.set("cond", "2") st.takeItems(CHITIN, -1) st.giveItems(RECRUIT, 1) htmltext = "31554-04.htm" elif event == "31554-07.htm": # Cancelling the quest st.exitQuest(1) st.playSound("ItemSound.quest_giveup") elif event in BUFF.keys() and cond == 3: # Asking for buff skillId, level, coins = BUFF[event] if st.getQuestItemsCount(GOLDEN_RAM_COIN) >= coins: st.takeItems(GOLDEN_RAM_COIN, coins) npc.setTarget(player) npc.doCast(SkillTable.getInstance().getInfo(skillId, level)) htmltext = "31556-1.htm" else: htmltext = "You don't have required items" return htmltext
def onTalk(self, npc, player): htmltext = Quest.getNoQuestMsg(player) st = player.getQuestState(qn) if not st: return htmltext cond = st.getInt("cond") npcId = npc.getNpcId() if npcId == MUSHIKA: first = player.getQuestState("124_MeetingTheElroki") if st.getState() == State.COMPLETED: htmltext = Quest.getAlreadyCompletedMsg(player) elif first and first.getState() == State.COMPLETED and st.getState( ) == State.CREATED and player.getLevel() >= 76: htmltext = "32114-01.htm" elif cond == 0: htmltext = "32114-00.htm" elif cond == 1: htmltext = "32114-07.htm" elif cond == 2: htmltext = "32114-10.htm" elif cond >= 3 and cond < 8: htmltext = "32114-11.htm" elif cond == 8: st.addExpAndSp(859195, 86603) st.unset("cond") st.unset("pilar1") st.unset("pilar2") st.unset("pilar3") st.setState(State.COMPLETED) st.exitQuest(False) st.playSound("ItemSound.quest_finish") htmltext = "32114-12.htm" elif npcId == KARAKAWEI: if cond == 2: htmltext = "32117-01.htm" elif cond == 3: htmltext = "32117-09.htm" elif cond == 4: st.takeItems(ORNITHOMIMUS_CLAW, -1) st.takeItems(DEINONYCHUS_BONE, -1) st.playSound("ItemSound.quest_middle") htmltext = "32117-10.htm" elif cond == 5: htmltext = "32117-15.htm" elif cond == 6 or cond == 7: htmltext = "32117-16.htm" elif cond == 8: htmltext = "32117-17.htm" elif npcId == ULU_KAIMU: if cond == 5: npc.doCast(SkillTable.getInstance().getInfo(5089, 1)) htmltext = "32119-01.htm" elif cond == 6: htmltext = "32119-14.htm" elif npcId == BALU_KAIMU: if cond == 6: npc.doCast(SkillTable.getInstance().getInfo(5089, 1)) htmltext = "32120-01.htm" elif cond == 7: htmltext = "32120-16.htm" elif npcId == CHUTA_KAIMU: if cond == 7: npc.doCast(SkillTable.getInstance().getInfo(5089, 1)) htmltext = "32121-01.htm" elif cond == 8: htmltext = "32121-17.htm" return htmltext
def onTalk(self, npc, player): htmltext = Quest.getNoQuestMsg(player) st = player.getQuestState(qn) if not st: return htmltext id = st.getState() cond = st.getInt("cond") npcId = npc.getNpcId() if id == State.CREATED and npcId == CRONOS: if player.getLevel() < 45 and (st.getQuestItemsCount(3500) or st.getQuestItemsCount(3501) or st.getQuestItemsCount(3502)): st.exitQuest(1) htmltext = "30610-01.htm" elif player.getLevel() >= 45 and ( (st.getQuestItemsCount(3500) + st.getQuestItemsCount(3501) + st.getQuestItemsCount(3502)) >= 2): st.exitQuest(1) htmltext = "30610-02.htm" elif player.getLevel() >= 45 and ( (st.getQuestItemsCount(3500) + st.getQuestItemsCount(3501) + st.getQuestItemsCount(3502)) == 1): if st.getQuestItemsCount(3500) == 1: item = player.getInventory().getItemByItemId(3500) if item.getEnchantLevel() < 55: htmltext = "30610-03.htm" else: htmltext = "30610-04.htm" elif st.getQuestItemsCount(3501) == 1: item = player.getInventory().getItemByItemId(3501) if item.getEnchantLevel() < 55: htmltext = "30610-03.htm" else: htmltext = "30610-04.htm" elif st.getQuestItemsCount(3502) == 1: item = player.getInventory().getItemByItemId(3502) if item.getEnchantLevel() < 55: htmltext = "30610-03.htm" else: htmltext = "30610-04.htm" elif id == State.STARTED: if npcId == CRONOS: htmltext = "30610-07.htm" if npcId == MIMYU: if st.getInt("id") == 1: st.set("id", "2") htmltext = "30747-01.htm" elif st.getInt("id") == 2: summon = player.getPet() if summon: if summon.getControlItem().getObjectId() == st.getInt( "summonOid"): htmltext = "30747-04.htm" else: htmltext = "30747-03.htm" else: htmltext = "30747-02.htm" elif st.getInt("id") == 0: htmltext = "30747-07.htm" elif st.getInt("id") > 0 and st.getInt( "id") < 15 and st.getQuestItemsCount(FT_LEAF) >= 1: htmltext = "30747-11.htm" elif st.getInt("id") == 15 and st.getQuestItemsCount( FT_LEAF) == 0: summon = player.getPet() if summon: if summon.getControlItem().getObjectId() == st.getInt( "summonOid"): st.set("id", "16") htmltext = "30747-13.htm" else: htmltext = "30747-14.htm" else: htmltext = "30747-12.htm" elif st.getInt("id") == 16: summon = player.getPet() if summon: htmltext = "30747-15.htm" elif (st.getQuestItemsCount(3500) + st.getQuestItemsCount(3501) + st.getQuestItemsCount(3502)) == 1: if st.getQuestItemsCount(3500) == 1: item = player.getInventory().getItemByItemId(3500) if item.getObjectId() == st.getInt("summonOid"): # EvolvePet(player,item,4422) st.takeItems(3500, 1) st.giveItems(4422, 1) htmltext = "30747-16.htm" st.exitQuest(1) st.playSound("ItemSound.quest_finish") else: npc.setTarget(player) skill = SkillTable.getInstance().getInfo( 4167, 1) if skill != None: skill.getEffects(npc, player) htmltext = "30747-18.htm" elif st.getQuestItemsCount(3501) == 1: item = player.getInventory().getItemByItemId(3501) if item.getObjectId() == st.getInt("summonOid"): # EvolvePet(player,item,4423) st.takeItems(3501, 1) st.giveItems(4423, 1) htmltext = "30747-16.htm" st.exitQuest(1) st.playSound("ItemSound.quest_finish") else: npc.setTarget(player) skill = SkillTable.getInstance().getInfo( 4167, 1) if skill != None: skill.getEffects(npc, player) htmltext = "30747-18.htm" elif st.getQuestItemsCount(3502) == 1: item = player.getInventory().getItemByItemId(3502) if item.getObjectId() == st.getInt("summonOid"): # EvolvePet(player,item,4424) st.takeItems(3502, 1) st.giveItems(4424, 1) htmltext = "30747-16.htm" st.exitQuest(1) st.playSound("ItemSound.quest_finish") else: npc.setTarget(player) skill = SkillTable.getInstance().getInfo( 4167, 1) if skill != None: skill.getEffects(npc, player) htmltext = "30747-18.htm" else: htmltext = "30747-18.htm" elif (st.getQuestItemsCount(3500) + st.getQuestItemsCount(3501) + st.getQuestItemsCount(3502)) >= 2: htmltext = "30747-17.htm" return htmltext
def onAdvEvent(self, event, npc, player): if event == "chest_timer": self.athrea = 0 return if player.isClanLeader(): leaderst = st = player.getQuestState(qn) else: # non-leaders doing this quest need both their own quest state and the leader's st = player.getQuestState(qn) if not st: return leaderst = leader(player) if not leaderst: if DEBUG: debug = "Event can't find leader" print debug return debug return debug = "" htmltext = event if player.isClanLeader(): if event == "30756-07.htm": st.playSound("ItemSound.quest_accept") st.set("cond", "1") st.setState(State.STARTED) st.set("part", "1") elif event == "30759-03.htm": st.set("part", "2") st.set("cond", "2") st.set("dead_list", " ") elif event == "30759-07.htm": st.takeItems(SYMBOL_OF_LOYALTY, 1) # Item is not stackable, thus need to do this for each item st.takeItems(SYMBOL_OF_LOYALTY, 1) st.takeItems(SYMBOL_OF_LOYALTY, 1) st.giveItems(ANTIDOTE_RECIPE, 1) st.set("part", "3") st.set("cond", "3") st.startQuestTimer("poison_timer", 3600000) st.addNotifyOfDeath(player) SkillTable.getInstance().getInfo(4082, 1).getEffects(npc, player); elif event == "poison_timer": st.exitQuest(1) if DEBUG: debug = "Times Up! Quest failed!" print debug return debug return elif event == "30757-05.htm": if player.isClanLeader(): return "Only Clan Members can sacrifice themselves!" if st.getRandom(10) > 5: htmltext = "30757-06.htm" st.giveItems(SYMBOL_OF_LOYALTY, 1) deadlist = leaderst.get("dead_list").split() deadlist.append(player.getName()) leaderst.set("dead_list", " ".join(deadlist)) else: skill = SkillTable.getInstance().getInfo(4083, 1) npc.setTarget(player) npc.doCast(skill) self.startQuestTimer(player.getName(), 4000, npc, player, 0) elif event == player.getName(): if player.isDead(): st.giveItems(SYMBOL_OF_LOYALTY, 1) deadlist = leaderst.get("dead_list").split() deadlist.append(player.getName()) leaderst.set("dead_list", " ".join(deadlist)) elif DEBUG: debug = "player " + player.getName() + " didn't die!" print debug return debug return elif event == "30758-03.htm": if not self.athrea: self.athrea = 1 self.chests = 0 leaderst.set("part", "4") leaderst.set("chest_wins", "0") for x, y, z in CHEST_LOCS: rand = st.getRandom(5) self.addSpawn(27173 + rand, x, y, z, 0, 0, 300000) self.startQuestTimer("chest_timer", 300000, npc, player, 0) else: htmltext = "30758-04.htm" elif event == "30758-07.htm": if st.getQuestItemsCount(57) >= 10000 and not self.athrea: htmltext = "30758-08.htm" st.takeItems(57, 10000) if DEBUG and debug: print debug return debug return htmltext
def onAdvEvent(self, event, npc, player): htmltext = event st = player.getQuestState(qn) if event == "learn": htmltext = "" st2 = player.getQuestState("136_MoreThanMeetsTheEye") if player.isSubClassActive(): htmltext = "8005-04.htm" elif not st2 or st2.getState() != State.COMPLETED: htmltext = "8005-03.htm" else: j = 0 for i in SKILLITEMS: j += st.getQuestItemsCount(i) if j > 0: self.onAcquireSkillList(npc, player) else: htmltext = "8005-04.htm" elif event == "cancel": if st.getQuestItemsCount(57) < 10000000: htmltext = "8005-07.htm" elif player.getSubClasses().size() == 0: htmltext = "8005-03.htm" elif player.isSubClassActive(): htmltext = "8005-04.htm" else: activeCertifications = 0 for var in QUESTVARSITEMS: for i in range(Config.MAX_SUBCLASS): qvar = st.getGlobalQuestVar(var + str(i + 1)) if qvar.endswith(";"): activeCertifications += 1 elif qvar != "" and qvar != "0": activeCertifications += 1 if activeCertifications == 0: htmltext = "8005-08.htm" else: for var in QUESTVARSITEMS: for i in range(Config.MAX_SUBCLASS): qvar = st.getGlobalQuestVar(var + str(i + 1)) if qvar.endswith(";"): skill = SkillTable.getInstance().getInfo( int(qvar.replace(";", "")), 1) if skill: qvar = st.getGlobalQuestVar(var + str(i + 1)) skillId = int(qvar.replace(";", "")) skillLevel = player.getSkillLevel(skillId) player.removeSkill(skill, skillLevel) st.saveGlobalQuestVar( var + str(i + 1), "0") elif qvar != "" and qvar != "0": Item = player.getInventory().getItemByObjectId( int(qvar)) if Item: player.destroyItem(qn, int(qvar), 1, player, 0) else: Item = player.getWarehouse( ).getItemByObjectId(int(qvar)) if Item: print "Somehow " + player.getName( ) + " put certification book into warehouse!" player.getWarehouse().destroyItem( qn, Item, 1, player, None) else: print "Somehow " + player.getName( ) + " his/her delete certification book!" st.saveGlobalQuestVar(var + str(i + 1), "0") st.takeItems(57, 10000000) htmltext = "8005-09.htm" player.sendSkillList() return htmltext