예제 #1
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
예제 #2
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
예제 #3
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
예제 #4
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
예제 #5
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)>=100 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
예제 #6
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) >= 100 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
예제 #7
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)
                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
예제 #8
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
예제 #9
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)
           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
예제 #10
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