def onAttack(self, npc, player, damage, isPet):
     npcId = npc.getNpcId()
     objId = npc.getObjectId()
     if self.MobSpawns.has_key(npcId):
         if npc.getStatus().getCurrentHp() <= npc.getMaxHp(
         ) * self.MobSpawns[npcId]['HP'] / 100 and Rnd.get(
                 100) < self.MobSpawns[npcId]['chance']:
             if self.MobTexts.has_key(npcId):
                 text = self.MobTexts[npcId][Rnd.get(
                     len(self.MobTexts[npcId]))]
                 npc.broadcastPacket(
                     CreatureSay(objId, 0, npc.getName(), text))
             posX = npc.getX()
             posY = npc.getY()
             posZ = npc.getZ()
             signX = -500
             signY = -500
             if npc.getX() > player.getX():
                 signX = 500
             if npc.getY() > player.getY():
                 signY = 500
             posX = posX + signX
             posY = posY + signY
             npc.setIsAfraid(1)
             npc.setRunning()
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(posX, posY, posZ, 0))
             self.startQuestTimer("Retreat", 10000, npc, player)
     return
Beispiel #2
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.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() == 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() == 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 onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(4) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Your rear is practically unguarded!"))
     else :
        self.FirstAttacked = True
        if Rnd.get(4) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Watch your back!"))
     return 
Beispiel #4
0
 def onTalk(self, npc, player) :
   npcId = npc.getNpcId()
   castleOwner = CastleManager.getInstance().getCastleById(8).getOwnerId()
   clanId = player.getClanId()
   if castleOwner and clanId :
     if castleOwner == clanId :
       X = 12558 + (Rnd.get(200) - 100)
       Y = -49279 + (Rnd.get(200) - 100)
       player.teleToLocation(X, Y, -3007)
       return
     else :
       htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>"
   else :
     htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>"
   return htmltext
Beispiel #5
0
 def onKill(self,npc,player,isPet):
   # get 1 party member among those with cond between 1 and 4
   partyMember = 0
   j = 0
   for i in range(1,5) :  # i between 1 and 4 inclusive
       partyMember = self.getRandomPartyMember(player,str(i))
       if partyMember :
           j = i
           break
   if not partyMember : return
   
   # if at least 1 cond exists with a party member, check if there also exist in a different cond as well
   for i in range(j+1,5) :
       partyMember2 = self.getRandomPartyMember(player,str(i))
       # if a party member is found in another cond, randomly choose between
       # the new one and the previous one
       if partyMember2 :
           if Rnd.get(2) : partyMember = partyMember2
           
   st = partyMember.getQuestState(qn)
   if not st : return 
   if st.getState() != STARTED : return
   
   count = st.getQuestItemsCount(SPINNERET)
   if count < 10 :
     st.giveItems(SPINNERET,1)
     if count == 9 :
       st.playSound("ItemSound.quest_middle")
       st.set("cond","5")
     else :
       st.playSound("ItemSound.quest_itemget")
   return
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 :
     st.exitQuest(1)
     htmltext = "31331-0a.htm"
  elif player.getClan().getLevel() < 6 :
     st.exitQuest(1)
     htmltext =  "31331-0b.htm"
  else :
     cond = st.getInt("cond")
     raid = st.getInt("raid")
     id = st.getState()
     if id == CREATED and cond == 0 :
        htmltext =  "31331-0c.htm"
     elif id == 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))
  return htmltext
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(40) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You childish fool, do you think you can catch me?"))
     else :
        self.FirstAttacked = True
     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
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(50): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(), "Dear ultimate power!!!"))
     else:
         self.FirstAttacked = True
     return
Beispiel #11
0
 def onKill(self, npc, player, isPet):
     found = False
     for effect in player.getAllEffects():
         if effect.getSkill().getId() in KISS_OF_EVA:
             found = True
     if found:
         dropid = Rnd.get(len(REWARDS))
         dropItem(npc, REWARDS[dropid], 1, player)
     return
    def onKill (self,npc,player,isPet):
        npcId = npc.getNpcId()
        if npcId == self.cats_eye_bandit:
            objId=npc.getObjectId()
            if Rnd.get(80) : npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I must do something about this shameful incident..."))

            self.FirstAttacked = False
        elif self.FirstAttacked :
            self.addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ())
        return
Beispiel #13
0
 def onAttack(self, npc, player, damage, isPet):
     npdId = npc.getNpcId()
     if (npc.getMaxHp() / 2) > npc.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.setXYZ(185462, 20342, -3250)
     return
Beispiel #14
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(50): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Destroy the enemy, my brothers!"))
     else:
         self.FirstAttacked = True
     return
Beispiel #15
0
 def onAttack(self, npc, player, damage, isPet):
     npcId = npc.getNpcId()
     objId = npc.getObjectId()
     if npcId not in WATERED_SQUASH: return
     if npcId in self.adultLargeSquash:
         if Rnd.get(30) < 2:
             mytext = [
                 "����� ������ ������� ������ ..., ����� �������� ... ���� ...!",
                 "�� ��, �����! ��������� �� ����!",
                 "�� ������ ����� ��� �����������? �������� ���, ����� �� ������� ...",
                 "� ������ ���� �����! �, ���������� ���� �����!",
                 "�� ������� ������� ���� �����!",
                 "��, ���� ���� ������������� ������� �������?",
                 "� ��������� ���� �����, ����� �����!",
                 "�����, ����� ������� �����! ����� ��� �����!",
                 "T����� �������� ������ ����� ������� ������� �����... ���� ������ ������� � �������!"
             ]
             npc.broadcastPacket(
                 CreatureSay(objId, 0, npc.getName(),
                             mytext[Rnd.get(len(mytext))]))
     return
Beispiel #16
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(40): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "You wont take me down easily."))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "We shall see about that!"))
     return
Beispiel #17
0
    def onSkillUse (self,npc,player,skill):
        npcId = npc.getNpcId()
        skillId = skill.getId()
        skillLevel= skill.getLevel()

        # check if the npc and skills used are valid for this script.  Exit if invalid.
        if npcId not in self.chests : return

        # if this has already been interacted, no further ai decisions are needed
        # if it's the first interaction, check if this is a box or mimic
        if not npc.isInteracted() :
            npc.setInteracted()
            if Rnd.get(100) < IS_BOX :
                # if it's a box, either it will be successfully openned by a proper key, or instantly disappear
                if skillId == SKILL_DELUXE_KEY :
                    # check the chance to open the box
                    keyLevelNeeded = int(npc.getLevel()/10)
                    levelDiff = keyLevelNeeded - skillLevel
                    if levelDiff < 0 :
                        levelDiff = levelDiff * (-1)
                    chance = BASE_CHANCE - levelDiff * LEVEL_DECREASE

                    # success, pretend-death with rewards:  npc.reduceCurrentHp(99999999, player)
                    if Rnd.get(100) < chance :
                        npc.setMustRewardExpSp(False)
                        npc.setSpecialDrop();
                        npc.reduceCurrentHp(99999999, player)
                        return
                # used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards    
                npc.onDecay()
            else :
                attacker = player
                if npc.getAttackByList().contains(player.getPet()):
                    attacker = player.getPet()
                npc.setRunning()
                npc.addDamageHate(attacker,0,999)
                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker)
        return
Beispiel #18
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(40): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Hey! Were having a duel here!"))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(
                 objId, 0, npc.getName(),
                 "How dare you interrupt our fight! Hey guys, help!"))
     return
Beispiel #19
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(40): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Come on, Ill take you on!"))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(
                 objId, 0, npc.getName(),
                 "How dare you interrupt a sacred duel! You must be taught a lesson!"
             ))
     return
Beispiel #20
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(40): return
         npc.broadcastPacket(
             CreatureSay(
                 objId, 0, npc.getName(),
                 "There is no reason for you to kill me! I have nothing you need!"
             ))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "We shall see about that!"))
     return
Beispiel #21
0
 def onAttack (self,npc,player,damage,isPet):
    npcId = npc.getNpcId()
    if npcId in HSMOBS:
      if (Rnd.get(2) == 1):
        if (Rnd.get(2) == 1):
          if player.getFirstEffect(int(4552)):
            holera = player.getFirstEffect(int(4552)).getLevel()
            if (Rnd.get(100) < 30):
              if holera < 10:
                newholera = int(holera + 1)
                npc.setTarget(player)
                npc.doCast(SkillTable.getInstance().getInfo(4552,newholera))
          else:
            npc.setTarget(player)
            npc.doCast(SkillTable.getInstance().getInfo(4552,1))
        else:
          if player.getFirstEffect(int(4554)):
            malaria = player.getFirstEffect(int(4554)).getLevel()
            if (Rnd.get(100) < 15):
              if malaria < 10:
                newmalaria = int(malaria + 1)
                npc.setTarget(player)
                npc.doCast(SkillTable.getInstance().getInfo(4554,newmalaria))
          else:
            npc.setTarget(player)
            npc.doCast(SkillTable.getInstance().getInfo(4554,1))
      else:
        if (Rnd.get(2) == 1):
          if player.getFirstEffect(int(4551)):
            rheumatism = player.getFirstEffect(int(4551)).getLevel()
            if (Rnd.get(100) < 30):
              if rheumatism < 10:
                newrheumatism = int(rheumatism + 1)
                npc.setTarget(player)
                npc.doCast(SkillTable.getInstance().getInfo(4551,newrheumatism))
          else:
            npc.setTarget(player)
            npc.doCast(SkillTable.getInstance().getInfo(4551,1))
        else:
          if player.getFirstEffect(int(4553)):
            flu = player.getFirstEffect(int(4553)).getLevel()
            if (Rnd.get(100) < 15):
              if flu < 10:
                newflu = int(flu + 1)
                npc.setTarget(player)
                npc.doCast(SkillTable.getInstance().getInfo(4553,newflu))
          else:
            npc.setTarget(player)
            npc.doCast(SkillTable.getInstance().getInfo(4553,1))
    return 
Beispiel #22
0
    def onAttack(self,npc,player,damage,isPet) :
        npcId = npc.getNpcId()
        # check if the npc and skills used are valid for this script.  Exit if invalid.
        if npcId not in self.chests : return

        # if this was a mimic, set the target, start the skills and become agro
        if not npc.isInteracted() :
            npc.setInteracted()
            if Rnd.get(100) < IS_BOX :
                npc.onDecay()
            else :  # if this weren't a box, upon interaction start the mimic behaviors...
                # todo: perhaps a self-buff (skill id 4245) with random chance goes here?
                attacker = player
                if isPet:
                    attacker = player.getPet()
                npc.setRunning()
                npc.addDamageHate(attacker,0,(damage*100)/(npc.getLevel()+7))
                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker)
        return
Beispiel #23
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId == self.scarlet_stokate_noble:
         if Rnd.get(100) <= 20:
             self.addSpawn(self.scarlet_stokate_noble_b, npc.getX(),
                           npc.getY(), npc.getZ(), npc.getHeading(), True,
                           0)
             self.addSpawn(self.scarlet_stokate_noble_b, npc.getX(),
                           npc.getY(), npc.getZ(), npc.getHeading(), True,
                           0)
             self.addSpawn(self.scarlet_stokate_noble_b, npc.getX(),
                           npc.getY(), npc.getZ(), npc.getHeading(), True,
                           0)
             self.addSpawn(self.scarlet_stokate_noble_b, npc.getX(),
                           npc.getY(), npc.getZ(), npc.getHeading(), True,
                           0)
             self.addSpawn(self.scarlet_stokate_noble_b, npc.getX(),
                           npc.getY(), npc.getZ(), npc.getHeading(), True,
                           0)
     return
Beispiel #24
0
 def onAttack(self, npc, player, isPet, damage):
     npcId = npc.getNpcId()
     NewMob, chance, ModeSpawn = SplendorId[npcId]
     if Rnd.get(100) <= chance * Config.RATE_DROP_QUEST:
         if SplendorId.has_key(npcId):
             if ModeSpawn == 1:
                 npc.deleteMe()
                 newNpc = self.addSpawn(NewMob, npc)
                 newNpc.addDamageHate(player, 0, 999)
                 newNpc.getAI().setIntention(
                     CtrlIntention.AI_INTENTION_ATTACK, player)
             elif self.AlwaysSpawn:
                 return
             elif ModeSpawn == 2:
                 self.AlwaysSpawn = True
                 newNpc1 = self.addSpawn(NewMob, npc)
                 newNpc1.addDamageHate(player, 0, 999)
                 newNpc1.getAI().setIntention(
                     CtrlIntention.AI_INTENTION_ATTACK, player)
     return
Beispiel #25
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() != 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 #26
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "30744-03.htm":
         st.setState(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.giveItems(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.giveItems(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
Beispiel #27
0
 def onSkillUse(self, npc, player, skill):
     npcId = npc.getNpcId()
     skillId = skill.getId()
     if skillId != SKILL_NECTAR: return
     if npcId not in WATERED_SQUASH: return
     objectId = npc.getObjectId()
     if skillId == SKILL_NECTAR:
         # ������ �����
         if npc.getNectar() == 0:
             if Rnd.get(2) == 1:
                 mytext = [
                     "����� ���� ��������� �����, � ������ ���� ������ ������ ... ������ ����",
                     "���� �� ����� ������� �������� ��� ������ - � ������� �������!",
                     "��, ������ ���, ��������� ������! � ���� ������� ������������ � ������� �����!!!",
                     "������� ������, ����� ��������� �����!",
                     "���� ���������� ������� ����� �������� ��������, ����� ���� ������� �����! � ����� ������� ����� �������� ����� �������� � �������!",
                     "�, ����� �� ��������?",
                     "�������� ������� ��� �������� ���������?",
                     "�������! ��� - �����! ������?",
                     "����������! ������� 5 �������, ����� � ������ ������������ � ������� �����! �!"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "�� �����! ������� �����, � �� �������!",
                     "� �� �� �������, ���� ����������������� �� ������",
                     "�� ���� �� �� ����������! ������� �����, � �� �������!",
                     "���, ����� ������� ������",
                     "����� ����� �����������, �� �����, �������� ������� ������� � �������� �� �����!",
                     "� ���� ��� ������� ��������? ��������� �����"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # ������ �����
         elif npc.getNectar() == 1:
             if Rnd.get(2) == 1:
                 mytext = [
                     "����� ����� ������� ������!",
                     "���, ���, ���! �����! ��������� - ������!",
                     "��� ������, � ������ ��� ������?",
                     "������ - ������ ������! ��! ��! ��!"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "�! ����� ����! ����� ������� ������ ��������� ������?",
                     "���� � ���� ����� ��� ������, �� �������� ������ ������� ����� ...",
                     "���������� ������� �������! ������� ���� �� ����� ������� ������, ������� ����� �� ������!",
                     "T���� ��������� ����� �� ��� ������ ����? ��������� ������, � ���� ���� ������!"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # ������ �����
         elif npc.getNectar() == 2:
             if Rnd.get(2) == 1:
                 mytext = [
                     "T����, ������������! ������ ������� �����!",
                     "�� �������-�� ..., ��� ������������� ������! ���� ���?",
                     "���������� �� ���� ������ ��� ����, ����� ����? �������, �������� ��������� ��� ..., ����� �� ���� ����� �� ������������"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "�� ���� �� �� ����������? ����� ����?",
                     "������, ������� ����... � �� ���� ������� �������, � ������ ������� ..."
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # ��������� �����
         elif npc.getNectar() == 3:
             if Rnd.get(2) == 1:
                 mytext = [
                     "����� ������, ������� ����������� ������! ������ ��� ��������� ����� ������ ������?",
                     "���� �� �������� ����, � ��� ��� 10 ��������� adena!!! ��������?"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "� �������, T� ����� ���� � �������?",
                     "T����� ������, ����� ����� ������� �������."
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # ����� �����
         elif npc.getNectar() == 4:
             if Rnd.get(2) == 1:
                 npc.addGood()
             if npc.getGood() >= 3:
                 if npcId == 12774:
                     newGourd = self.addSpawn(12775, npc)
                     newGourd.setOwner(player.getName())
                     self.startQuestTimer(
                         "Good By", 120000, newGourd,
                         player)  # ����� 2 ������ ������������
                     self.startQuestTimer(
                         "Good By2", 90000, newGourd,
                         player)  # 30 ������ �� ������������
                     self.startQuestTimer(
                         "Good By3", 100000, newGourd,
                         player)  # 20 ������ �� ������������
                     self.startQuestTimer(
                         "Good By4", 110000, newGourd,
                         player)  # 10 ������ �� ������������
                     mytext = [
                         "������� �����, ��������! ���, ��� �������?",
                         "� ����� ����� 2 ������"
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
                 else:
                     newGourd = self.addSpawn(12778, npc)
                     newGourd.setOwner(player.getName())
                     self.startQuestTimer(
                         "Good By1", 120000, newGourd,
                         player)  # ����� 2 ������ ������������
                     self.startQuestTimer(
                         "Good By2", 90000, newGourd,
                         player)  # 30 ������ �� ������������
                     self.startQuestTimer(
                         "Good By3", 100000, newGourd,
                         player)  # 20 ������ �� ������������
                     self.startQuestTimer(
                         "Good By4", 110000, newGourd,
                         player)  # 10 ������ �� ������������
                     mytext = [
                         "������������� �������� ����� ������� ������. T����� ����������, � �������� ���� ��� ����� ������",
                         "� ����� ����� 2 ������"
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
             else:
                 if npcId == 12774:
                     newGourd = self.addSpawn(12776, npc)
                     newGourd.setOwner(player.getName())
                     mytext = [
                         "��! ���� - �� ����! ����! ������ ��! T� �� ������ ������� ������� ����������? � �� ��� �����!",
                         "������ ����, ���������? �� ��� ���� �����������",
                         "����� ������� � ...",
                         "�� ������ ������� �����? �� � ���� �������� ��������� �������� ..."
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
                 if npcId == 12777:
                     newGourd = self.addSpawn(12779, npc)
                     newGourd.setOwner(player.getName())
                     mytext = [
                         "��! ���� - �� ����! ����! ������ ��! T� �� ������ ������� ������� ����������? � ��� �����!",
                         "������ ����, ���������? �� ��� ���� �����������",
                         "����� ������� � ...",
                         "�� ������ ������� �����? �� � ���� �������� ��������� �������� ..."
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
     return
Beispiel #28
0
 def getReward(self, rewards):
     rand = Rnd.get(100)
     for item in rewards.keys():
         if rand < rewards[item]:
             return item
Beispiel #29
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 #30
0
 def onAdvEvent(self, event, npc, player) :
   status = GrandBossManager.getInstance().getBossStatus(Benom)
   if event == "BenomTeleSpawn" :
     self.Teleport = self.addSpawn(BenomTeleport, 11013, -49629, -547, 13400, False, 0)
   elif event == "BenomRaidRoomSpawn" :
     if self.BenomIsSpawned == 0 and status == 0 :
       self.Benomm = self.addSpawn(Benom, 12047, -49211, -3009, 0, False, 0)
       self.BenomIsSpawned = 1
   elif event == "BenomRaidSiegeSpawn" :
     if status == 0 :
       if self.BenomIsSpawned == 0 :
         self.Benomm = self.addSpawn(Benom, 11025, -49152, -537, 0, False, 0)
         self.BenomIsSpawned = 1
       elif self.BenomIsSpawned == 1 :
         self.Benomm.teleToLocation(11025, -49152, -537)
       self.startQuestTimer("BenomSpawnEffect", 100, npc, None)
       self.startQuestTimer("BenomBossDespawn", 5400000, npc, None)
       self.cancelQuestTimer("BenomSpawn", npc, None)
       self.Teleport.deleteMe()
   elif event == "BenomSpawnEffect" :
     npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE)
     npc.broadcastPacket(SpecialCamera(npc.getObjectId(), 200, 0, 150, 0, 5000))
     npc.broadcastPacket(SocialAction(npc.getObjectId(), 3))
     self.startQuestTimer("BenomWalk", 5000, npc, None)
     self.BenomWalkRouteStep = 0
   elif event == "Attacking" :
     NumPlayers = []
     for player in npc.getKnownList().getKnownPlayers().values() :
       NumPlayers.append(player)
     if len(NumPlayers) > 0 :
       target = NumPlayers[Rnd.get(len(NumPlayers))]
       npc.addDamageHate(target, 0, 999)
       npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target)
       self.startQuestTimer("Attacking", 2000, npc, player)
     elif len(NumPlayers) == 0 :
         self.startQuestTimer("BenomWalkFinish", 2000, npc, None)
   elif event == "BenomWalkFinish" :
     if npc.getCastle().getSiege().getIsInProgress() :
       self.cancelQuestTimer("Attacking", npc, player)
       X = benomWalkRoutes[self.BenomWalkRouteStep][0]
       Y = benomWalkRoutes[self.BenomWalkRouteStep][1]
       Z = benomWalkRoutes[self.BenomWalkRouteStep][2]
       npc.teleToLocation(X, Y, Z)
       npc.setWalking()
       self.BenomWalkRouteStep = 0
       self.startQuestTimer("BenomWalk", 2200, npc, None)
   elif event == "BenomWalk" :
     if self.BenomWalkRouteStep == 33 :
       self.BenomWalkRouteStep = 0
       self.startQuestTimer("BenomWalk", 100, npc, None)
     else :
       self.startQuestTimer("Talk", 100, npc, None)
       if self.BenomWalkRouteStep == 14 :
         self.startQuestTimer("DoorOpen", 15000, None, None)
         self.startQuestTimer("DoorClose", 23000, None, None)
       if self.BenomWalkRouteStep == 32 :
         self.startQuestTimer("DoorOpen", 500, None, None)
         self.startQuestTimer("DoorClose", 4000, None, None)
       Time = WalkTimes[self.BenomWalkRouteStep]
       npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE)
       X = benomWalkRoutes[self.BenomWalkRouteStep][0]
       Y = benomWalkRoutes[self.BenomWalkRouteStep][1]
       Z = benomWalkRoutes[self.BenomWalkRouteStep][2]
       npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(X, Y, Z, 0))
       self.BenomWalkRouteStep = int(self.BenomWalkRouteStep) + 1
       self.startQuestTimer("BenomWalk", Time, npc, None)
   elif event == "DoorOpen" :
     DoorTable.getInstance().getDoor(20160005).openMe()
   elif event == "DoorClose" :
     DoorTable.getInstance().getDoor(20160005).closeMe()
   elif event == "Talk" :
     if Rnd.get(100) < 40 :
       npc.broadcastPacket(CreatureSay(npc.getObjectId(), 0, "Benom", BenomSpeak[Rnd.get(4)]))
   elif event == "BenomBossDespawn" :
     GrandBossManager.getInstance().setBossStatus(Benom,LIVE)
     self.BenomIsSpawned = 0
     self.Benomm.deleteMe()
   return