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 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 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 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