def onKill(self,npc,player,isPet):
     npcId = npc.getNpcId()
     if npcId == DAIMON :
        respawnMinDelay = 43200000  * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
        respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
        respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay)
        self.saveGlobalQuestVar("604_respawn", str(System.currentTimeMillis()+respawn_delay))
        self.startQuestTimer("spawn_npc", respawn_delay, None, None)
        self.cancelQuestTimer("Daimon the White-Eyed has despawned",npc,None)
        party = player.getParty()
        if party :
            PartyQuestMembers = []
            for player1 in party.getPartyMembers().toArray() :
                st1 = player1.getQuestState(qn)
                if st1 :
                    if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) :
                        PartyQuestMembers.append(st1)
            if len(PartyQuestMembers) == 0 : return
            st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
            if st.getQuestItemsCount(S_SUMMON) > 0 :
                st.takeItems(S_SUMMON,1)
            st.giveItems(ESSENCE,1)
            st.set("cond","3")
            st.playSound("ItemSound.quest_middle")
        else :
            st = player.getQuestState(qn)
            if not st : return
            if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) :
                if st.getQuestItemsCount(S_SUMMON) > 0 :
                    st.takeItems(S_SUMMON,1)
                st.giveItems(ESSENCE,1)
                st.set("cond","3")
                st.playSound("ItemSound.quest_middle")
     return
Beispiel #2
0
    def onKill(self, npc, player, isPet):
        npcId = npc.getNpcId()
        if npcId == Ashutar:
            respawnMinDelay = 43200000 * int(
                Config.RAID_MIN_RESPAWN_MULTIPLIER)
            respawnMaxDelay = 129600000 * int(
                Config.RAID_MAX_RESPAWN_MULTIPLIER)
            respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay)
            self.saveGlobalQuestVar(
                "610_respawn", str(System.currentTimeMillis() + respawn_delay))
            self.startQuestTimer("spawn_npc", respawn_delay, None, None)
            self.cancelQuestTimer("Soul of Water Ashutar has despawned", npc,
                                  None)
            self.gstate.setRespawnDate(24 * 60 * 60000)
            self.gstate.setState(StateEnum.INTERVAL)

            party = player.getParty()
            if party:
                PartyQuestMembers = []
                for player1 in party.getPartyMembers().toArray():
                    st1 = player1.getQuestState(qn)
                    if st1:
                        if st1.getState() == State.STARTED and (
                                st1.getInt("cond") == 1
                                or st1.getInt("cond") == 2):
                            PartyQuestMembers.append(st1)
                if len(PartyQuestMembers) == 0: return
                st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
                if st.getQuestItemsCount(Totem2) > 0:
                    st.takeItems(Totem2, 1)
                st.giveItems(Ice_Heart, 1)
                st.set("cond", "3")
                st.set("id", "3")
                st.playSound("ItemSound.quest_middle")
            else:
                st = player.getQuestState(qn)
                if not st: return
                if st.getState() == State.STARTED and (
                        st.getInt("cond") == 1 or st.getInt("cond") == 2):
                    if st.getQuestItemsCount(Totem2) > 0:
                        st.takeItems(Totem2, 1)
                    st.giveItems(Ice_Heart, 1)
                    st.set("cond", "3")
                    st.set("id", "3")
                    st.playSound("ItemSound.quest_middle")
        elif npcId in Ketra_Orcs:
            st = player.getQuestState(qn)
            if st:
                if st.getQuestItemsCount(Ice_Heart):
                    st.takeItems(Ice_Heart, -1)
                st.unset("cond")
                st.unset("id")
                st.exitQuest(1)
        return
Beispiel #3
0
 def onAttack(self, npc, player, damage, isPet, skill):
   npdId = npc.getNpcId()
   if (npc.getMaxHp()/2) > npc.getStatus().getCurrentHp():
     if Rnd.get(100) < 4:
       if self.ImpGraveKepperStat == 1:
         for j in range(2):
           for k in range(2):
             self.addSpawn(27180,npc.getX()+70*pow(-1,j%2),npc.getY()+70*pow(-1,k%2),npc.getZ(),0,False,0)
         self.ImpGraveKepperStat = 2
       else:
         players = npc.getKnownList().getKnownPlayers().values().toArray()
         if len(players) :
           playerToTP = players[Rnd.get(int(len(players)))]
           playerToTP.getPosition().setXYZ(185462,20342,-3250)
   return
Beispiel #4
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId == Nastron:
         respawnMinDelay = 43200000 * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
         respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
         respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay)
         self.saveGlobalQuestVar("616_respawn", str(System.currentTimeMillis() + respawn_delay))
         self.startQuestTimer("spawn_npc", respawn_delay, None, None)
         self.cancelQuestTimer("Soul of Fire Nastron has despawned", npc, None)
         self.gstate.setRespawnDate(24 * 60 * 60000)
         self.gstate.setState(StateEnum.INTERVAL)
         party = player.getParty()
         if party:
             PartyQuestMembers = []
             for player1 in party.getPartyMembers().toArray():
                 st1 = player1.getQuestState(qn)
                 if st1:
                     if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2):
                         PartyQuestMembers.append(st1)
             if len(PartyQuestMembers) == 0:
                 return
             st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
             if st.getQuestItemsCount(Totem2) > 0:
                 st.takeItems(Totem2, 1)
             st.giveItems(Fire_Heart, 1)
             st.set("cond", "3")
             st.set("id", "3")
             st.playSound("ItemSound.quest_middle")
         else:
             st = player.getQuestState(qn)
             if not st:
                 return
             if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2):
                 if st.getQuestItemsCount(Totem2) > 0:
                     st.takeItems(Totem2, 1)
                 st.giveItems(Fire_Heart, 1)
                 st.set("cond", "3")
                 st.set("id", "3")
                 st.playSound("ItemSound.quest_middle")
     elif npcId in Varka_Mobs:
         st = player.getQuestState(qn)
         if st:
             if st.getQuestItemsCount(Fire_Heart):
                 st.takeItems(Fire_Heart, -1)
             st.unset("cond")
             st.unset("id")
             st.exitQuest(1)
     return
 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

  clan = player.getClan()
  npcId = npc.getNpcId()
  if player.getClan() == None or player.isClanLeader() == 0 :
    htmltext = "30868-0a.htm"
    st.exitQuest(1)
  elif player.getClan().getLevel() < 5 :
    htmltext = "30868-0b.htm"
    st.exitQuest(1)
  else :
    cond = st.getInt("cond")
    raid = st.getInt("raid")
    id = st.getState()
    if id == State.CREATED and cond == 0 :
      htmltext = "30868-0c.htm"
    elif id == State.STARTED and cond == 1 and not raid :
      htmltext = "30868-0.htm"
    elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() :
      npc, item, min, max = REWARDS_LIST[raid]
      count = st.getQuestItemsCount(item)
      CLAN_POINTS_REWARD = Rnd.get(min, max)
      if not count :
        htmltext = "30868-"+str(raid)+"a.htm"
      elif count == 1 :
        htmltext = "30868-"+str(raid)+"b.htm"
        st.takeItems(item,1)
        clan.setReputationScore(clan.getReputationScore()+CLAN_POINTS_REWARD,True)
        player.sendPacket(SystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
        clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
        st.unset("raid")
  return htmltext
Beispiel #6
0
 def generateBoard(self, player, bet):
     board = []
     num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     for i in range(9):
         board.append(num.pop(Rnd.get(1, len(num)) - 1))
     self.gameStatus[player.getName()] = [board, [], bet]
     return
Beispiel #7
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

  clan = player.getClan()
  npcId = npc.getNpcId()
  if player.getClan() == None or player.isClanLeader() == 0 :
    htmltext = "31331-0a.htm"
    st.exitQuest(1)
  elif player.getClan().getLevel() < 6 :
    htmltext = "31331-0b.htm"
    st.exitQuest(1)
  else :
    cond = st.getInt("cond")
    raid = st.getInt("raid")
    id = st.getState()
    if id == State.CREATED and cond == 0 :
      htmltext = "31331-0c.htm"
    elif id == State.STARTED and cond == 1 and not raid :
      htmltext = "31331-0.htm"
    elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() :
      npc, item, min, max = REWARDS_LIST[raid]
      count = st.getQuestItemsCount(item)
      CLAN_POINTS_REWARD = Rnd.get(min, max)
      if not count :
        htmltext = "31331-"+str(raid)+"a.htm"
      elif count == 1 :
        htmltext = "31331-"+str(raid)+"b.htm"
        st.takeItems(item,1)
        clan.setReputationScore(clan.getReputationScore()+CLAN_POINTS_REWARD,True)
        player.sendPacket(SystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
        clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
        st.unset("raid")
  return htmltext
 def onKill(self,npc,player,isPet) :
     st = player.getQuestState(qn)
     if not st : return
     npcId = npc.getNpcId()
     if npcId in Droplist.keys() :
         if Rnd.get(100) < Droplist[npcId] :
             st.giveItems(Medal,1)
             st.playSound("ItemSound.quest_itemget")
     return
Beispiel #9
0
 def onKill(self, npc, player, isPet):
     st = player.getQuestState(qn)
     if not st: return
     npcId = npc.getNpcId()
     if npcId in Droplist.keys():
         if Rnd.get(100) < Droplist[npcId]:
             st.giveItems(Medal, 1)
             st.playSound("ItemSound.quest_itemget")
     return
Beispiel #10
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId == DAIMON:
         respawnMinDelay = 43200000 * int(
             Config.RAID_MIN_RESPAWN_MULTIPLIER)
         respawnMaxDelay = 129600000 * int(
             Config.RAID_MAX_RESPAWN_MULTIPLIER)
         respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay)
         self.saveGlobalQuestVar(
             "604_respawn", str(System.currentTimeMillis() + respawn_delay))
         self.startQuestTimer("spawn_npc", respawn_delay, None, None)
         self.cancelQuestTimer("Daimon the White-Eyed has despawned", npc,
                               None)
         party = player.getParty()
         if party:
             PartyQuestMembers = []
             for player1 in party.getPartyMembers().toArray():
                 st1 = player1.getQuestState(qn)
                 if st1:
                     if st1.getState() == State.STARTED and (
                             st1.getInt("cond") == 1
                             or st1.getInt("cond") == 2):
                         PartyQuestMembers.append(st1)
             if len(PartyQuestMembers) == 0: return
             st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
             if st.getQuestItemsCount(S_SUMMON) > 0:
                 st.takeItems(S_SUMMON, 1)
             st.giveItems(ESSENCE, 1)
             st.set("cond", "3")
             st.playSound("ItemSound.quest_middle")
         else:
             st = player.getQuestState(qn)
             if not st: return
             if st.getState() == State.STARTED and (
                     st.getInt("cond") == 1 or st.getInt("cond") == 2):
                 if st.getQuestItemsCount(S_SUMMON) > 0:
                     st.takeItems(S_SUMMON, 1)
                 st.giveItems(ESSENCE, 1)
                 st.set("cond", "3")
                 st.playSound("ItemSound.quest_middle")
     return
Beispiel #11
0
 def onKill(self, npc, player, isPet):
     partyMember1 = self.getRandomPartyMember(player, "1")
     partyMember2 = self.getRandomPartyMemberState(player, State.COMPLETED)
     if not partyMember1 and not partyMember2: return
     partyMember = partyMember1
     numItems, chance = divmod(100 * Config.RATE_DROP_QUEST, 100)
     dropchance = Rnd.get(100)
     if dropchance < chance:
         # player who has State.COMPLETED up to 2 out of 3 item collections may consume the party drop
         if partyMember2:
             if Rnd.get(100) <= 66:
                 return
             else:
                 partyMember = partyMember1
     st = partyMember.getQuestState(qn)
     if st:
         if st.getState() == State.STARTED:
             npcId = npc.getNpcId()
             if st.getInt("cond") == 1:
                 if dropchance < chance:
                     numItems = numItems + 1
                 numItems = int(numItems)
                 item = ITEMS[npcId]
                 count = st.getQuestItemsCount(item)
                 if count < 50:
                     if count + numItems > 50:
                         numItems = 50 - count
                     st.giveItems(item, numItems)
                     count_trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES)
                     count_foot = st.getQuestItemsCount(
                         FOOT_OF_BANDERSNATCHLING)
                     count_spice = st.getQuestItemsCount(SECRET_SPICE)
                     if count_trunk == count_foot == count_spice == 50:
                         st.set("cond", "3")
                         st.playSound("ItemSound.quest_middle")
                     else:
                         st.playSound("ItemSound.quest_itemget")
     return
 def onKill(self,npc,player,isPet):
   partyMember1 = self.getRandomPartyMember(player,"1")
   partyMember2 = self.getRandomPartyMemberState(player, State.COMPLETED)
   if not partyMember1 and not partyMember2 : return
   partyMember = partyMember1
   numItems,chance = divmod(100*Config.RATE_DROP_QUEST,100)
   dropchance = Rnd.get(100)
   if dropchance  < chance:
    # player who has State.COMPLETED up to 2 out of 3 item collections may consume the party drop
    if partyMember2 :
      if Rnd.get(100) <= 66:
         return
      else :
         partyMember = partyMember1
   st = partyMember.getQuestState(qn)
   if st :
        if st.getState() == State.STARTED :
            npcId = npc.getNpcId()
            if st.getInt("cond") == 1:
             if dropchance < chance :
               numItems = numItems + 1
             numItems = int(numItems)
             item = ITEMS[npcId]
             count = st.getQuestItemsCount(item)
             if count < 50 :
               if count + numItems > 50 :
                 numItems = 50 - count
               st.giveItems(item,numItems)
               count_trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES)
               count_foot = st.getQuestItemsCount(FOOT_OF_BANDERSNATCHLING)
               count_spice = st.getQuestItemsCount(SECRET_SPICE)
               if count_trunk == count_foot == count_spice == 50 :
                 st.set("cond","3")
                 st.playSound("ItemSound.quest_middle")
               else:
                 st.playSound("ItemSound.quest_itemget")  
   return
Beispiel #13
0
 def onKill(self,npc,player,isPet):
    npcId = npc.getNpcId()
    if npcId == BUMPALUMP :
        respawnMinDelay = 43200000  * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
        respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
        respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay)
        self.gstate.setRespawnDate(24*60*60000) 
        self.gstate.setState(StateEnum.INTERVAL)
        self.saveGlobalQuestVar("625_respawn", str(System.currentTimeMillis()+respawn_delay))
        self.startQuestTimer("spawn_npc", respawn_delay, None, None)
        self.cancelQuestTimer("Icicle Emperor Bumbalump has despawned",npc,None)
        party = player.getParty()
        if party :
            PartyQuestMembers = []
            for player1 in party.getPartyMembers().toArray() :
                st1 = player1.getQuestState(qn)
                if st1 :
                    if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) :
                        PartyQuestMembers.append(st1)
            if len(PartyQuestMembers) == 0 : return
            st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
            if st.getQuestItemsCount(FOOD) > 0 :
                st.takeItems(FOOD,1)
            st.giveItems(MEAT,1)
            st.set("cond","3")
            st.playSound("ItemSound.quest_middle")
        else :
            st = player.getQuestState(qn)
            if not st : return
            if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) :
                if st.getQuestItemsCount(FOOD) > 0 :
                    st.takeItems(FOOD,1)
                st.giveItems(MEAT,1)
                st.set("cond","3")
                st.playSound("ItemSound.quest_middle")
    return
 def onKill(self,npc,player,isPet):
   partyMember1 = self.getRandomPartyMember(player,"1")
   partyMember2 = self.getRandomPartyMember(player,"2")
   partyMember = partyMember1 # initialize
   if not partyMember1 and not partyMember2: return
   elif not partyMember2 : partyMember = partyMember1
   elif not partyMember1 : partyMember = partyMember2
   else :
       if Rnd.get(2): partyMember = partyMember2
   
   if not partyMember : return
   st = partyMember.getQuestState(qn)
   if not st : return 
   if st.getState() != State.STARTED : return   
   count = st.getQuestItemsCount(ROUGH_JEWEL)
   if count<10 :
     st.giveItems(ROUGH_JEWEL,1)
     if count == 9 :
       st.playSound("ItemSound.quest_middle")
       st.set("cond","3")
     else:
       st.playSound("ItemSound.quest_itemget")
   return
Beispiel #15
0
    def onKill(self, npc, player, isPet):
        partyMember1 = self.getRandomPartyMember(player, "1")
        partyMember2 = self.getRandomPartyMember(player, "2")
        partyMember = partyMember1  # initialize
        if not partyMember1 and not partyMember2: return
        elif not partyMember2: partyMember = partyMember1
        elif not partyMember1: partyMember = partyMember2
        else:
            if Rnd.get(2): partyMember = partyMember2

        if not partyMember: return
        st = partyMember.getQuestState(qn)
        if not st: return
        if st.getState() != State.STARTED: return
        count = st.getQuestItemsCount(ROUGH_JEWEL)
        if count < 10:
            st.giveItems(ROUGH_JEWEL, 1)
            if count == 9:
                st.playSound("ItemSound.quest_middle")
                st.set("cond", "3")
            else:
                st.playSound("ItemSound.quest_itemget")
        return
Beispiel #16
0
 def getReward(self, rewards):
     rand = Rnd.get(100)
     for item in rewards.keys():
         if rand < rewards[item]:
             return item
 def onAdvEvent (self,event,npc,player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "30744-03.htm" :
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
         st.giveItems(Test_Instructions_1,1)
         st.set("cond","1")
         #set Memo = 0
     elif event == "30744-32.htm" :
         st.playSound("ItemSound.quest_finish")
         if st.getQuestItemsCount(Leaf_Pin) >= 20 :
             htmltext = "30744-33.htm"
             st.rewardItems(57,20000)
         st.exitQuest(1)
     elif event == "30744-19.htm" :
         if not HasItems(st,1) :
             st.giveItems(Test_Instructions_2,1)
             htmltext = "30744-18.htm"
     elif event == "30745-03.htm" :
         if st.getQuestItemsCount(Test_Instructions_2) :
             htmltext = "30745-04.htm"
     elif event == "Tor_list_1" :
         if not st.getInt("hasTask") :
             htmltext = "<html><body>Guild Member Tor:<br>"
             pins = st.getQuestItemsCount(Leaf_Pin)
             reply_0 = Rnd.get(12)
             reply_1 = Rnd.get(12)
             reply_2 = Rnd.get(12)
             reply_3 = Rnd.get(12)
             reply_4 = Rnd.get(12)
             if Rnd.get(100) < 20 :
                 if pins < 4 and pins :
                     reply_0 = Rnd.get(6) + 12
                     reply_2 = Rnd.get(6)
                     reply_3 = Rnd.get(6) + 6
                 elif pins >= 4 :
                     reply_0 = Rnd.get(6) + 6
                     if not Rnd.get(20) :
                         reply_1 = Rnd.get(2) + 18
                     reply_2 = Rnd.get(6)
                     reply_3 = Rnd.get(6) + 6
             elif pins >= 4 :
                 if not Rnd.get(20) :
                     reply_1 = Rnd.get(2) + 18
                 reply_2 = Rnd.get(6)
                 reply_3 = Rnd.get(6) + 6
             htmltext += Tor_menu[reply_0] + Tor_menu[reply_1] + Tor_menu[reply_2] + Tor_menu[reply_3] + Tor_menu[reply_4]
             htmltext += "</body></html>"
     elif event == "Tor_list_2" :
         if not st.getInt("hasTask") :
             htmltext = "<html><body>Guild Member Tor:<br>"
             pins = st.getQuestItemsCount(Leaf_Pin)
             reply_0 = Rnd.get(10)
             reply_1 = Rnd.get(10)
             reply_2 = Rnd.get(5)
             reply_3 = Rnd.get(5) + 5
             reply_4 = Rnd.get(10)
             if Rnd.get(100) < 20 :
                 if pins < 4 and pins:
                     reply_0 = Rnd.get(6) + 10
                 elif pins >= 4 :
                     reply_0 = Rnd.get(6) + 10
                     if not Rnd.get(20):
                         reply_1 = Rnd.get(3) + 16
             elif pins >= 4 :
                 if not Rnd.get(20) :
                     reply_1 = Rnd.get(3) + 16
             htmltext += Tor_menu[reply_0 + 20] + Tor_menu[reply_1 + 20] + Tor_menu[reply_2 + 20] + Tor_menu[reply_3 + 20] + Tor_menu[reply_4 + 20]
             htmltext += "</body></html>"
     elif event == "30745-10.htm" :
         st.takeItems(Leaf_Pin,1)
         for item in range(3727,3811) :
             st.takeItems(item,-1)
         st.set("hasTask","0")
     elif event == "30746-03.htm" :
         if not st.getQuestItemsCount(Cyb_Req) :
             st.giveItems(Cyb_Req,1)
         if not st.getQuestItemsCount(3471) :
             st.giveItems(3471,1)
         if not st.getQuestItemsCount(3698) :
             st.giveItems(3698,1)
         st.takeItems(6708,-1)
     elif event == "30746-08.htm" :
         for item in Cyb_Rewards.keys() :
             if st.getQuestItemsCount(item) :
                 st.takeItems(item,-1)
                 st.rewardItems(57,Cyb_Rewards[item])
                 break
     elif event == "30746-12.htm" :
         st.takeItems(3698,-1)
         st.takeItems(3697,-1)
         st.takeItems(3471,-1)
     elif event.isdigit() :
         event = int(event)
         st.giveItems(event,1)
         st.set("hasTask","1")
         event = event - 3712
         htmltext = "30745-" + str(event) + ".htm"
     return htmltext
 def onKill(self,npc,player,isPet):
     st = player.getQuestState(qn)
     if not st : return
     npcId = npc.getNpcId()
     cond = st.getInt("cond")
     rand = Rnd.get(100)
     instructions_1 = st.getQuestItemsCount(Test_Instructions_1)
     instructions_2 = st.getQuestItemsCount(Test_Instructions_2)
     if cond == 1 and instructions_1 :
         if npcId in Level_1.keys() :
             item,amount,chance = Level_1[npcId]
             if rand < chance and st.getQuestItemsCount(item) < amount :
                 st.giveItems(item,1)
                 if st.getQuestItemsCount(item) >= amount :
                     st.playSound("ItemSound.quest_middle")
                 else :
                     st.playSound("ItemSound.quest_itemget")
         elif npcId == Breka_Orc_Warrior and rand < 10 :
             if st.getQuestItemsCount(3711) == 0 :
                 st.addSpawn(27140,300000)
             elif st.getQuestItemsCount(3712) == 0 :
                 st.addSpawn(27141,300000)
             elif st.getQuestItemsCount(3713) == 0 :
                 st.addSpawn(27142,300000)
         elif npcId == Windsus and not st.getQuestItemsCount(3714) and rand < 10 :
             st.addSpawn(27143,300000)
     elif cond == 2 :
         if instructions_2 :
             if npcId in Level_2.keys() :
                 item,amount,chance = Level_2[npcId]
                 if rand < chance and st.getQuestItemsCount(item) < amount :
                     st.giveItems(item,1)
                     if st.getQuestItemsCount(item) >= amount :
                         st.playSound("ItemSound.quest_middle")
                     else :
                         st.playSound("ItemSound.quest_itemget")
             elif npcId == Tarlk_Bugbear_Warrior and rand < 10 :
                 if st.getQuestItemsCount(3722) == 0 :
                     st.addSpawn(27144,300000)
                 elif st.getQuestItemsCount(3723) == 0 :
                     st.addSpawn(27145,300000)
                 elif st.getQuestItemsCount(3724) == 0 :
                     st.addSpawn(27146,300000)
                 elif st.getQuestItemsCount(3725) == 0 :
                     st.addSpawn(27147,300000)
                 elif st.getQuestItemsCount(3726) == 0 :
                     st.addSpawn(27148,300000)
         elif npcId in Tor_requests_1.keys() :
             req,give,giveAmount,amount,chance = Tor_requests_1[npcId]
             if rand < chance and st.getQuestItemsCount(req) and st.getQuestItemsCount(give) < amount :
                 st.giveItems(give,eval(giveAmount))
                 if st.getQuestItemsCount(give) >= amount :
                     st.playSound("ItemSound.quest_middle")
                 else :
                     st.playSound("ItemSound.quest_itemget")
                 if npcId in [27160,27164] and Rnd.get(2) :
                     st.addSpawn(27150,300000)
                     st.addSpawn(27150,300000)
                     AutoChat(npc,"We will destroy the legacy of the ancient empire!")
     elif cond == 3 :
         if npcId in Tor_requests_2.keys() :
             req,give,amount,chance = Tor_requests_2[npcId]
             if st.getQuestItemsCount(req) and st.getQuestItemsCount(give) < amount :
                 if rand < chance :
                     st.giveItems(give,1)
                     if st.getQuestItemsCount(give) >= amount :
                         st.playSound("ItemSound.quest_middle")
                     else :
                         st.playSound("ItemSound.quest_itemget")
                     if npcId == 27162 and Rnd.get(2) :
                         st.addSpawn(27150,300000)
                         st.addSpawn(27150,300000)
                         AutoChat(npc,"We will destroy the legacy of the ancient empire!")
                 if npcId in [20661,20662,20589,20590,20639] and not Rnd.get(20) :
                     st.addSpawn(Gremlin_Filcher,300000)
                     AutoChat(npc,"Get out! The jewels are mine!")
         elif npcId == Gremlin_Filcher :
             req = 0
             for item in Filcher.keys() :
                 if st.getQuestItemsCount(item) :
                     req = item
                     break
             if req :
                 item,amount,bonus = Filcher[req]
                 if st.getQuestItemsCount(item) < amount :
                     st.giveItems(item,bonus)
                     if st.getQuestItemsCount(item) >= amount :
                         st.playSound("ItemSound.quest_middle")
                     else :
                         st.playSound("ItemSound.quest_itemget")
                     AutoChat(npc,"What!")
     if npcId in Tor_requests_tospawn.keys() and rand < 10:
         it1,it2,id = Tor_requests_tospawn[npcId]
         if st.getQuestItemsCount(it1) and not st.getQuestItemsCount(it2) :
             st.addSpawn(id,300000)
     if npcId in Lizardmen and player.getActiveWeaponItem() and player.getActiveWeaponItem().getItemId() == Cyb_Dagger and st.getQuestItemsCount(Cyb_Req) and not st.getQuestItemsCount(3708):
         if Rnd.get(2) :
             if cond == 2 or cond == 3 :
                 for item in range(3698,3707) :
                     if st.getQuestItemsCount(item) :
                         st.giveItems(item+1,1)
                         st.takeItems(item,-1)
                         if item >= 3703 :
                             st.playSound("ItemSound.quest_jackpot")
                         break
         else :
             for item in range(3698,3707) :
                 st.takeItems(item,-1)
             st.giveItems(3708,1)
     return
Beispiel #19
0
 def onKill(self, npc, player, isPet):
     st = player.getQuestState(qn)
     if not st: return
     npcId = npc.getNpcId()
     cond = st.getInt("cond")
     rand = Rnd.get(100)
     instructions_1 = st.getQuestItemsCount(Test_Instructions_1)
     instructions_2 = st.getQuestItemsCount(Test_Instructions_2)
     if cond == 1 and instructions_1:
         if npcId in Level_1.keys():
             item, amount, chance = Level_1[npcId]
             if rand < chance and st.getQuestItemsCount(item) < amount:
                 st.giveItems(item, 1)
                 if st.getQuestItemsCount(item) >= amount:
                     st.playSound("ItemSound.quest_middle")
                 else:
                     st.playSound("ItemSound.quest_itemget")
         elif npcId == Breka_Orc_Warrior and rand < 10:
             if st.getQuestItemsCount(3711) == 0:
                 st.addSpawn(27140, 300000)
             elif st.getQuestItemsCount(3712) == 0:
                 st.addSpawn(27141, 300000)
             elif st.getQuestItemsCount(3713) == 0:
                 st.addSpawn(27142, 300000)
         elif npcId == Windsus and not st.getQuestItemsCount(
                 3714) and rand < 10:
             st.addSpawn(27143, 300000)
     elif cond == 2:
         if instructions_2:
             if npcId in Level_2.keys():
                 item, amount, chance = Level_2[npcId]
                 if rand < chance and st.getQuestItemsCount(item) < amount:
                     st.giveItems(item, 1)
                     if st.getQuestItemsCount(item) >= amount:
                         st.playSound("ItemSound.quest_middle")
                     else:
                         st.playSound("ItemSound.quest_itemget")
             elif npcId == Tarlk_Bugbear_Warrior and rand < 10:
                 if st.getQuestItemsCount(3722) == 0:
                     st.addSpawn(27144, 300000)
                 elif st.getQuestItemsCount(3723) == 0:
                     st.addSpawn(27145, 300000)
                 elif st.getQuestItemsCount(3724) == 0:
                     st.addSpawn(27146, 300000)
                 elif st.getQuestItemsCount(3725) == 0:
                     st.addSpawn(27147, 300000)
                 elif st.getQuestItemsCount(3726) == 0:
                     st.addSpawn(27148, 300000)
         elif npcId in Tor_requests_1.keys():
             req, give, giveAmount, amount, chance = Tor_requests_1[npcId]
             if rand < chance and st.getQuestItemsCount(
                     req) and st.getQuestItemsCount(give) < amount:
                 st.giveItems(give, eval(giveAmount))
                 if st.getQuestItemsCount(give) >= amount:
                     st.playSound("ItemSound.quest_middle")
                 else:
                     st.playSound("ItemSound.quest_itemget")
                 if npcId in [27160, 27164] and Rnd.get(2):
                     st.addSpawn(27150, 300000)
                     st.addSpawn(27150, 300000)
                     AutoChat(
                         npc,
                         "We will destroy the legacy of the ancient empire!"
                     )
     elif cond == 3:
         if npcId in Tor_requests_2.keys():
             req, give, amount, chance = Tor_requests_2[npcId]
             if st.getQuestItemsCount(
                     req) and st.getQuestItemsCount(give) < amount:
                 if rand < chance:
                     st.giveItems(give, 1)
                     if st.getQuestItemsCount(give) >= amount:
                         st.playSound("ItemSound.quest_middle")
                     else:
                         st.playSound("ItemSound.quest_itemget")
                     if npcId == 27162 and Rnd.get(2):
                         st.addSpawn(27150, 300000)
                         st.addSpawn(27150, 300000)
                         AutoChat(
                             npc,
                             "We will destroy the legacy of the ancient empire!"
                         )
                 if npcId in [20661, 20662, 20589, 20590, 20639
                              ] and not Rnd.get(20):
                     st.addSpawn(Gremlin_Filcher, 300000)
                     AutoChat(npc, "Get out! The jewels are mine!")
         elif npcId == Gremlin_Filcher:
             req = 0
             for item in Filcher.keys():
                 if st.getQuestItemsCount(item):
                     req = item
                     break
             if req:
                 item, amount, bonus = Filcher[req]
                 if st.getQuestItemsCount(item) < amount:
                     st.giveItems(item, bonus)
                     if st.getQuestItemsCount(item) >= amount:
                         st.playSound("ItemSound.quest_middle")
                     else:
                         st.playSound("ItemSound.quest_itemget")
                     AutoChat(npc, "What!")
     if npcId in Tor_requests_tospawn.keys() and rand < 10:
         it1, it2, id = Tor_requests_tospawn[npcId]
         if st.getQuestItemsCount(it1) and not st.getQuestItemsCount(it2):
             st.addSpawn(id, 300000)
     if npcId in Lizardmen and player.getActiveWeaponItem(
     ) and player.getActiveWeaponItem().getItemId(
     ) == Cyb_Dagger and st.getQuestItemsCount(
             Cyb_Req) and not st.getQuestItemsCount(3708):
         if Rnd.get(2):
             if cond == 2 or cond == 3:
                 for item in range(3698, 3707):
                     if st.getQuestItemsCount(item):
                         st.giveItems(item + 1, 1)
                         st.takeItems(item, -1)
                         if item >= 3703:
                             st.playSound("ItemSound.quest_jackpot")
                         break
         else:
             for item in range(3698, 3707):
                 st.takeItems(item, -1)
             st.giveItems(3708, 1)
     return
Beispiel #20
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "30744-03.htm":
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
         st.giveItems(Test_Instructions_1, 1)
         st.set("cond", "1")
         #set Memo = 0
     elif event == "30744-32.htm":
         st.playSound("ItemSound.quest_finish")
         if st.getQuestItemsCount(Leaf_Pin) >= 20:
             htmltext = "30744-33.htm"
             st.rewardItems(57, 20000)
         st.exitQuest(1)
     elif event == "30744-19.htm":
         if not HasItems(st, 1):
             st.giveItems(Test_Instructions_2, 1)
             htmltext = "30744-18.htm"
     elif event == "30745-03.htm":
         if st.getQuestItemsCount(Test_Instructions_2):
             htmltext = "30745-04.htm"
     elif event == "Tor_list_1":
         if not st.getInt("hasTask"):
             htmltext = "<html><body>Guild Member Tor:<br>"
             pins = st.getQuestItemsCount(Leaf_Pin)
             reply_0 = Rnd.get(12)
             reply_1 = Rnd.get(12)
             reply_2 = Rnd.get(12)
             reply_3 = Rnd.get(12)
             reply_4 = Rnd.get(12)
             if Rnd.get(100) < 20:
                 if pins < 4 and pins:
                     reply_0 = Rnd.get(6) + 12
                     reply_2 = Rnd.get(6)
                     reply_3 = Rnd.get(6) + 6
                 elif pins >= 4:
                     reply_0 = Rnd.get(6) + 6
                     if not Rnd.get(20):
                         reply_1 = Rnd.get(2) + 18
                     reply_2 = Rnd.get(6)
                     reply_3 = Rnd.get(6) + 6
             elif pins >= 4:
                 if not Rnd.get(20):
                     reply_1 = Rnd.get(2) + 18
                 reply_2 = Rnd.get(6)
                 reply_3 = Rnd.get(6) + 6
             htmltext += Tor_menu[reply_0] + Tor_menu[reply_1] + Tor_menu[
                 reply_2] + Tor_menu[reply_3] + Tor_menu[reply_4]
             htmltext += "</body></html>"
     elif event == "Tor_list_2":
         if not st.getInt("hasTask"):
             htmltext = "<html><body>Guild Member Tor:<br>"
             pins = st.getQuestItemsCount(Leaf_Pin)
             reply_0 = Rnd.get(10)
             reply_1 = Rnd.get(10)
             reply_2 = Rnd.get(5)
             reply_3 = Rnd.get(5) + 5
             reply_4 = Rnd.get(10)
             if Rnd.get(100) < 20:
                 if pins < 4 and pins:
                     reply_0 = Rnd.get(6) + 10
                 elif pins >= 4:
                     reply_0 = Rnd.get(6) + 10
                     if not Rnd.get(20):
                         reply_1 = Rnd.get(3) + 16
             elif pins >= 4:
                 if not Rnd.get(20):
                     reply_1 = Rnd.get(3) + 16
             htmltext += Tor_menu[reply_0 + 20] + Tor_menu[
                 reply_1 + 20] + Tor_menu[reply_2 + 20] + Tor_menu[
                     reply_3 + 20] + Tor_menu[reply_4 + 20]
             htmltext += "</body></html>"
     elif event == "30745-10.htm":
         st.takeItems(Leaf_Pin, 1)
         for item in range(3727, 3811):
             st.takeItems(item, -1)
         st.set("hasTask", "0")
     elif event == "30746-03.htm":
         if not st.getQuestItemsCount(Cyb_Req):
             st.giveItems(Cyb_Req, 1)
         if not st.getQuestItemsCount(3471):
             st.giveItems(3471, 1)
         if not st.getQuestItemsCount(3698):
             st.giveItems(3698, 1)
         st.takeItems(6708, -1)
     elif event == "30746-08.htm":
         for item in Cyb_Rewards.keys():
             if st.getQuestItemsCount(item):
                 st.takeItems(item, -1)
                 st.rewardItems(57, Cyb_Rewards[item])
                 break
     elif event == "30746-12.htm":
         st.takeItems(3698, -1)
         st.takeItems(3697, -1)
         st.takeItems(3471, -1)
     elif event.isdigit():
         event = int(event)
         st.giveItems(event, 1)
         st.set("hasTask", "1")
         event = event - 3712
         htmltext = "30745-" + str(event) + ".htm"
     return htmltext
 def generateBoard(self,player,bet) :
     board = []
     num = [1,2,3,4,5,6,7,8,9]
     for i in range(9) : board.append(num.pop(Rnd.get(1,len(num))-1))
     self.gameStatus[player.getName()] = [board,[],bet]
     return
 def getReward(self,rewards) :
     rand = Rnd.get(100)
     for item in rewards.keys() :
        if rand < rewards[item] :
            return item