Example #1
0
 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
Example #2
0
 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
Example #3
0
File: baium.py Project: lorck/svn
 def onAttack(self, npc, player, damage, isPet) :
   if npc.getNpcId() == ARCHANGEL:
     if Rnd.get(100) < 10 :
       skill = SkillTable.getInstance().getInfo(4132,1)
       if skill != None :
         npc.setTarget(player)
         npc.doCast(skill)
     if Rnd.get(100) < 5 and ((npc.getCurrentHp() / npc.getMaxHp())*100) < 50:
       skill = SkillTable.getInstance().getInfo(4133,1)
       if skill != None :
         npc.setTarget(npc)
         npc.doCast(skill)
   else:
     BaiumManager.getInstance().setLastAttackTime()
   return
Example #4
0
 def onAttack(self, npc, player, damage, isPet, skill) :
   if npc.getNpcId() == ARCHANGEL:
     if Rnd.get(100) < 10 :
       skill = SkillTable.getInstance().getInfo(SPEAR_POUND,1)
       if skill != None :
         npc.setTarget(player)
         npc.doCast(skill)
     if Rnd.get(100) < 5 and ((npc.getStatus().getCurrentHp() / npc.getStat().getMaxHp())*100) < 50:
       skill = SkillTable.getInstance().getInfo(ANGEL_HEAL,1)
       if skill != None :
         npc.setTarget(npc)
         npc.doCast(skill)
   else:
     BaiumManager.getInstance().setLastAttackTime()
   return
Example #5
0
    def onAttack(self, npc, player, damage, isPet):
        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
Example #6
0
 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, seeds = BUFF[event]
         if st.getQuestItemsCount(Seed) >= seeds:
             st.takeItems(Seed, seeds)
             npc.setTarget(player)
             npc.doCast(SkillTable.getInstance().getInfo(skillId, level))
             npc.getStatus().setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp())
             htmltext = "31379-4.htm"
     elif event == "Withdraw":
         if player.getWarehouse().getSize() == 0:
             htmltext = "31381-0.htm"
         else:
             player.sendPacket(ActionFailed.STATIC_PACKET)
             player.setActiveWarehouse(player.getWarehouse())
             player.sendPacket(WareHouseWithdrawalList(player, 1))
     elif event == "Teleport":
         if Alevel == -4:
             htmltext = "31383-4.htm"
         elif Alevel == -5:
             htmltext = "31383-5.htm"
     return htmltext
Example #7
0
def castInvul(self):
    if self.spawned:
        skill = SkillTable.getInstance().getInfo(5225, 1)
        if skill != None:
            self.tears.doCast(skill)
            self.startQuestTimer("CastInvul", 180000, None, None)
    return
Example #8
0
def castInvul(self):
	if self.spawned:
		skill = SkillTable.getInstance().getInfo(5225,1)
		if skill != None:
			self.tears.doCast(skill)
			self.startQuestTimer("CastInvul", 180000, None, None)
	return
Example #9
0
 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
Example #10
0
 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.getStatus().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
Example #11
0
 def onKill (self,npc,player,isPet):
     npcId = npc.getNpcId()
     if npcId in range(27185,27189) :
        for x in xrange(20):
            newNpc = self.addSpawn(27189,npc)
            killer = player
            if isPet :
                killer = player.getPet()
            newNpc.setRunning()
            newNpc.addDamageHate(killer,0,999)
            newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, killer)
            self.startQuestTimer("despawn",300000, newNpc, None)
            if Rnd.get(2) :
               skill = SkillTable.getInstance().getInfo(4243,1)
               if skill != None :
                  skill.getEffects(newNpc, killer)
     return 
Example #12
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId in range(27185, 27189):
         for x in xrange(20):
             newNpc = self.addSpawn(27189, npc)
             killer = player
             if isPet:
                 killer = player.getPet()
             newNpc.setRunning()
             newNpc.addDamageHate(killer, 0, 999)
             newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK,
                                         killer)
             self.startQuestTimer("despawn", 300000, newNpc, None)
             if Rnd.get(2):
                 skill = SkillTable.getInstance().getInfo(4243, 1)
                 if skill != None:
                     skill.getEffects(newNpc, killer)
     return
Example #13
0
 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
Example #14
0
 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
Example #15
0
 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
Example #16
0
 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
Example #17
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
   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
Example #18
0
    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)
                skill = SkillTable.getInstance().getInfo(4082, 1)
                npc.setTarget(player)
                npc.broadcastPacket(
                    MagicSkillUse(npc, player, skill.getDisplayId(), 1,
                                  skill.getHitTime(), 0))
                npc.doCast(skill)
            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.broadcastPacket(
                    MagicSkillUse(npc, player, skill.getDisplayId(), 1,
                                  skill.getHitTime(), 0))
                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
Example #19
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
   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
Example #20
0
 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)
           skill = SkillTable.getInstance().getInfo(4082,1)
           npc.setTarget(player)
           npc.doCast(skill)
           skill.getEffects(player,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