Ejemplo n.º 1
0
 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
Ejemplo n.º 2
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 and Util.checkIfInRange(Config.ALT_PARTY_RANGE, player, player1, True) :
                    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(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() == 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
Ejemplo n.º 3
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 and Util.checkIfInRange(Config.ALT_PARTY_RANGE, player, player1, True) :
                    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
Ejemplo n.º 4
0
 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 
Ejemplo n.º 5
0
 def onAttack(self, npc, player, damage, isPet):
     npcId = npc.getNpcId()
     if npcId in HSMOBS:
         if (Rnd.get(2) == 1):
             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))
         elif npcId == 21317 or npcId == 21322:
             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))
         elif npcId == 21319 or npcId == 21316:
             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(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))
     return
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
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
Ejemplo n.º 8
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
Ejemplo n.º 9
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
Ejemplo n.º 10
0
 def onAttack (self,npc,player,damage,isPet):
    npcId = npc.getNpcId()
    if npcId in HSMOBS:
      if (Rnd.get(2) == 1):
        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))
      elif npcId == 21317 or npcId == 21322 :
        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))
      elif npcId == 21319 or npcId == 21316 :
        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(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))
    return 
Ejemplo n.º 11
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
Ejemplo n.º 12
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
Ejemplo n.º 13
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 
 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 
Ejemplo n.º 15
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 childish fool, do you think you can catch me?"))
     else :
        self.FirstAttacked = True
     return
Ejemplo n.º 16
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
Ejemplo n.º 17
0
 def onKill(self,npc,player,isPet):
     self.FirstAttacked = False
     respawnTime = long((19 + Rnd.get(8)) * 3600000)
     GrandBossManager.getInstance().setBossStatus(ORFEN,DEAD)
     self.startQuestTimer("orfen_spawn", respawnTime, None, None)
     info = GrandBossManager.getInstance().getStatsSet(ORFEN)
     info.set("respawn_time",(long(System.currentTimeMillis()) + respawnTime))
     GrandBossManager.getInstance().setStatsSet(ORFEN,info)
     return 
Ejemplo n.º 18
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
Ejemplo n.º 19
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
Ejemplo n.º 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 
 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
Ejemplo n.º 22
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
Ejemplo n.º 23
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
Ejemplo n.º 24
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 
 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 
Ejemplo n.º 26
0
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(100) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
     else :
        self.FirstAttacked = True
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I will definitely repay this humiliation!"))
     return 
 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 
 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 
Ejemplo n.º 29
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
 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 
Ejemplo n.º 31
0
 def onKill(self, npc, player, isPet):
     self.FirstAttacked = False
     respawnTime = long((19 + Rnd.get(8)) * 3600000)
     GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD)
     self.startQuestTimer("orfen_spawn", respawnTime, None, None)
     info = GrandBossManager.getInstance().getStatsSet(ORFEN)
     info.set("respawn_time",
              (long(System.currentTimeMillis()) + respawnTime))
     GrandBossManager.getInstance().setStatsSet(ORFEN, info)
     return
Ejemplo n.º 32
0
    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
Ejemplo n.º 33
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 childish fool, do you think you can catch me?"))
     else:
         self.FirstAttacked = True
     return
Ejemplo n.º 34
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
Ejemplo n.º 35
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
Ejemplo n.º 36
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(100): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "We shall see about that!"))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "I will definitely repay this humiliation!"))
     return
Ejemplo n.º 37
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
Ejemplo n.º 38
0
    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
Ejemplo n.º 39
0
 def onKill(self,npc,player,isPet):
   npcId = npc.getNpcId()
   if npcId == VALAKAS :
     self.addSpawn(31859,213001,-114890,-1635,0,False,900000)
     self.deleteGlobalQuestVar("lasthit")
     self.deleteGlobalQuestVar("underattack")
     respawnTime = long((192 + Rnd.get(144)) * 3600000)
     self.saveGlobalQuestVar("ubit", "1")
     self.saveGlobalQuestVar("respawn", str(System.currentTimeMillis() + respawnTime))
     self.deleteGlobalQuestVar("access")
     self.startQuestTimer("resp", respawnTime, None, None)
     self.cancelQuestTimer("vkrovatku",npc,None)
     print "GrandBossManager:  Valakas was killed."
   return
Ejemplo n.º 40
0
 def onKill(self,npc,player,isPet):
   if npc == self.vlc :
     self.startQuestTimer("round2",30000,npc,player)
   if npc == self.ptr :
     self.startQuestTimer("round3",60000,npc,player)
   if npc == self.trx :
     self.startQuestTimer("sailren",180000,npc,player)
   if npc == self.slrn :
     self.cancelQuestTimer("open",None,None)
     self.cancelQuestTimer("vkrovatku",None,None)
     respawnTime = long((40 + Rnd.get(8)) * 3600000)
     self.saveGlobalQuestVar("resptime", str(System.currentTimeMillis() + respawnTime))
     self.startQuestTimer("open",respawnTime,None,None)
   return
Ejemplo n.º 41
0
 def onKill(self,npc,player,isPet):
   if npc == self.vlc :
     self.startQuestTimer("round2",30000,npc,player)
   if npc == self.ptr :
     self.startQuestTimer("round3",60000,npc,player)
   if npc == self.trx :
     self.startQuestTimer("sailren",180000,npc,player)
   if npc == self.slrn :
     self.cancelQuestTimer("open",None,None)
     self.cancelQuestTimer("vkrovatku",None,None)
     respawnTime = long((40 + Rnd.get(8)) * 3600000)
     self.saveGlobalQuestVar("resptime", str(System.currentTimeMillis() + respawnTime))
     self.startQuestTimer("open",respawnTime,None,None)
   return
 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
Ejemplo n.º 43
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
Ejemplo n.º 44
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId == VALAKAS:
         self.addSpawn(31859, 213001, -114890, -1635, 0, False, 900000)
         self.deleteGlobalQuestVar("lasthit")
         self.deleteGlobalQuestVar("underattack")
         respawnTime = long((192 + Rnd.get(144)) * 3600000)
         self.saveGlobalQuestVar("ubit", "1")
         self.saveGlobalQuestVar(
             "respawn", str(System.currentTimeMillis() + respawnTime))
         self.deleteGlobalQuestVar("access")
         self.startQuestTimer("resp", respawnTime, None, None)
         self.cancelQuestTimer("vkrovatku", npc, None)
         print "GrandBossManager:  Valakas was killed."
     return
Ejemplo n.º 45
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
Ejemplo n.º 46
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
 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
Ejemplo n.º 48
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
Ejemplo n.º 49
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
Ejemplo n.º 50
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
Ejemplo n.º 51
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
Ejemplo n.º 52
0
 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
Ejemplo n.º 53
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
Ejemplo n.º 54
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
Ejemplo n.º 55
0
    def spawnNext(self, npc, growthLevel,player,food) :
        npcId = npc.getNpcId()
        nextNpcId = 0

        # find the next mob to spawn, based on the current npcId, growthlevel, and food.
        if growthLevel == 2:
            rand = Rnd.get(2)
            # if tamed, the mob that will spawn depends on the class type (fighter/mage) of the player!
            if rand == 1 :
                if player.getClassId().isMage() :
                    nextNpcId = self.growthCapableMobs[npcId][1][food][1][1]
                else :
                    nextNpcId = self.growthCapableMobs[npcId][1][food][1][0]
  
            # if not tamed, there is a small chance that have "mad cow" disease.
            # that is a stronger-than-normal animal that attacks its feeder
            else :
                if Rnd.get(5) == 0 :
                    nextNpcId = self.growthCapableMobs[npcId][1][food][0][1]
                else :
                    nextNpcId = self.growthCapableMobs[npcId][1][food][0][0]
        # all other levels of growth are straight-forward
        else :            
            nextNpcId = self.growthCapableMobs[npcId][1][food][Rnd.get(len(self.growthCapableMobs[npcId][1][food]))]
        
        # remove the feedinfo of the mob that got despawned, if any
        if self.feedInfo.has_key(npc.getObjectId()) :
            if self.feedInfo[npc.getObjectId()] == player.getObjectId() :
                self.feedInfo.pop(npc.getObjectId())
        
        # despawn the old mob
        if self.growthCapableMobs[npcId][0] == 0 :
            npc.onDecay()
        else :
            npc.deleteMe()
        
        # if this is finally a trained mob, then despawn any other trained mobs that the
        # player might have and initialize the Tamed Beast.
        if nextNpcId in self.tamedBeasts :
            oldTrained = player.getTrainedBeast()
            if oldTrained :
                oldTrained.doDespawn()

            #the following 5 commented lines are not needed, but they provide a plausible alternate implementation...just in case...
            #nextNpc = self.addSpawn(nextNpcId,npc)
            #nextNpc.setOwner(player)
            #nextNpc.setFoodType(foodSkill[food])
            #nextNpc.setHome(npc)
                
            template = NpcTable.getInstance().getTemplate(nextNpcId)
            nextNpc = L2TamedBeastInstance(IdFactory.getInstance().getNextId(), template, player, foodSkill[food], npc.getX(), npc.getY(), npc.getZ())
            nextNpc.setRunning()

            objectId = nextNpc.getObjectId()
            
            st = player.getQuestState("20_BringUpWithLove")
            if st :
                if Rnd.get(100) <= 5 and st.getQuestItemsCount(7185) == 0 :
                    st.giveItems(7185,1) #if player has quest 20 going, give quest item
                    st.set("cond","2")   #it's easier to hardcode it in here than to try and repeat this stuff in the quest

            # also, perform a rare random chat
            rand = Rnd.get(20)
            if rand > 4 : pass
            elif rand == 0 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", will you show me your hideaway?"))
            elif rand == 1 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", whenever I look at spice, I think about you."))
            elif rand == 2 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", you do not need to return to the village.  I will give you strength"))
            elif rand == 3 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), "Thanks, "+player.getName()+".  I hope I can help you"))
            elif rand == 4 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", what can I do to help you?"))

        # if not trained, the newly spawned mob will automatically be agro against its feeder
        # (what happened to "never bite the hand that feeds you" anyway?!)
        else :
            # spawn the new mob
            nextNpc = self.addSpawn(nextNpcId,npc)

            if nextNpcId in self.madCowPolymorph :
                self.startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player)            
            
            # register the player in the feedinfo for the mob that just spawned
            self.feedInfo[nextNpc.getObjectId()] = player.getObjectId()
            nextNpc.setRunning()
            nextNpc.addDamageHate(player,0,99999)
            nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
Ejemplo n.º 56
0
    def onSkillUse (self,npc,player,skill):
        # gather some values on local variables
        npcId = npc.getNpcId()
        skillId = skill.getId()
        # check if the npc and skills used are valid for this script.  Exit if invalid.
        if npcId not in self.feedableBeasts : return
        if skillId not in [SKILL_GOLDEN_SPICE,SKILL_CRYSTAL_SPICE] : return

        # first gather some values on local variables
        objectId = npc.getObjectId()
        growthLevel = 3  # if a mob is in feedableBeasts but not in growthCapableMobs, then it's at max growth (3)
        if self.growthCapableMobs.has_key(npcId) :
            growthLevel = self.growthCapableMobs[npcId][0]

        # prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast
        # If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder!       
        if (growthLevel==0) and self.feedInfo.has_key(objectId):
            return
        else :
            self.feedInfo[objectId] = player.getObjectId()

        food = 0
        if skillId == SKILL_GOLDEN_SPICE :
            food = GOLDEN_SPICE
        elif skillId == SKILL_CRYSTAL_SPICE :
            food = CRYSTAL_SPICE

        # display the social action of the beast eating the food.
        npc.broadcastPacket(SocialAction(objectId,2))

        # if this pet can't grow, it's all done.
        if npcId in self.growthCapableMobs.keys() :
            # do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect).
            if len(self.growthCapableMobs[npcId][1][food]) == 0 : return

            # rare random talk...
            if Rnd.get(20) == 0 :
                npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),self.Text[growthLevel][Rnd.get(len(self.Text[growthLevel]))]))

            if growthLevel > 0 :
                # check if this is the same player as the one who raised it from growth 0.
                # if no, then do not allow a chance to raise the pet (food gets consumed but has no effect).
                if self.feedInfo[objectId] != player.getObjectId() : return

            # Polymorph the mob, with a certain chance, given its current growth level
            if Rnd.get(100) < self.growthCapableMobs[npcId][2] :
                self.spawnNext(npc, growthLevel,player,food)
        elif npcId in self.tamedBeasts :
            if skillId == npc.getFoodType() :
                npc.onReceiveFood()
                mytext = ["Refills! Yeah!","I am such a gluttonous beast, it is embarrassing! Ha ha",
                          "Your cooperative feeling has been getting better and better.",
                          "I will help you!",
                          "The weather is really good.  Wanna go for a picnic?",
                          "I really like you! This is tasty...",
                          "If you do not have to leave this place, then I can help you.",
                          "What can I help you with?",
                          "I am not here only for food!",
                          "Yam, yam, yam, yam, yam!"]
                npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
        return