Example #1
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))
      
    return 
Example #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
Example #3
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(),
                         "Sua parte traseira é praticamente desprotegida!"))
     else:
         self.FirstAttacked = True
         if Rnd.get(4): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(), "Tome cuidado!"))
     return
Example #4
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId == Nastron:
         respawnMinDelay = 43200000 * int(
             Config.RAID_MIN_RESPAWN_MULTIPLIER)
         respawnMaxDelay = 129600000 * int(
             Config.RAID_MAX_RESPAWN_MULTIPLIER)
         respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay)
         self.saveGlobalQuestVar(
             "616_respawn", str(System.currentTimeMillis() + respawn_delay))
         self.startQuestTimer("spawn_npc", respawn_delay, None, None)
         self.cancelQuestTimer("Soul of Fire Nastron has despawned", npc,
                               None)
         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(Totem2) > 0:
                 st.takeItems(Totem2, 1)
             st.giveItems(Fire_Heart, 1)
             st.set("cond", "3")
             st.set("id", "3")
             st.playSound("ItemSound.quest_middle")
         else:
             st = player.getQuestState(qn)
             if not st: return
             if st.getState() == STARTED and (st.getInt("cond") == 1
                                              or st.getInt("cond") == 2):
                 if st.getQuestItemsCount(Totem2) > 0:
                     st.takeItems(Totem2, 1)
                 st.giveItems(Fire_Heart, 1)
                 st.set("cond", "3")
                 st.set("id", "3")
                 st.playSound("ItemSound.quest_middle")
     elif npcId in Varka_Mobs:
         st = player.getQuestState(qn)
         if st:
             if st.getQuestItemsCount(Fire_Heart):
                 st.takeItems(Fire_Heart, -1)
             st.unset("cond")
             st.unset("id")
             st.exitQuest(1)
     return
Example #5
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
Example #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
Example #7
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
Example #8
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(),"Destrua o inimigo, meus irmãos!"))
     else :
        self.FirstAttacked = True
     return 
Example #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(), "Caro poder supremo !!!"))
     else:
         self.FirstAttacked = True
     return
Example #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 onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(40) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Ei! Estava tendo um duelo aqui!"))
     else :
        self.FirstAttacked = True
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Como ousa interromper nossa luta! Ei pessoal, ajude!"))
     return 
Example #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
Example #14
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(),
                         "Seu tolo infantil, você acha que pode me pegar?"))
     else:
         self.FirstAttacked = True
     return
Example #15
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(), "Vamos ver isso!"))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Eu definitivamente vou pagar essa humilhação!"))
     return
Example #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 = [
                 "Mordidas tecer rendas ... para substituir ... corpo ...!",
                 "Ha ha, cresci! Totalmente em tudo!",
                 "Você não pode chtoli todo objetivo? Veja tudo para não fugir ...",
                 "Eu conto seus socos! Oh, lembra soco de novo!",
                 "Não perca seu tempo!",
                 "Ha, esse som é realmente bom de se ouvir?",
                 "Eu consumo seus ataques para crescer!",
                 "Hora de bater de novo! Bata mais uma vez!",
                 "Apenas música útil pode abrir uma grande abóbora ... Eu não posso ser aberto com uma arma!"
             ]
             npc.broadcastPacket(
                 CreatureSay(objId, 0, npc.getName(),
                             mytext[Rnd.get(len(mytext))]))
     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(),
                         "Você não vai me derrubar facilmente."))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(), "Vamos ver isso!"))
     return
Example #18
0
    def onSkillUse(self, npc, player, skill):
        npcId = npc.getNpcId()
        skillId = skill.getId()
        skillLevel = skill.getLevel()

        # verifique se o npc e as habilidades usadas são válidas para este script. Saia se for inválido.
        if npcId not in self.chests: return

        # se isso já tiver sido interagido, nenhuma outra decisão do ai será necessária
        # se for a primeira interação, verifique se é uma caixa ou imite
        if not npc.isInteracted():
            npc.setInteracted()
            if Rnd.get(100) < IS_BOX:
                # se for uma caixa, ela será aberta com sucesso por uma chave apropriada ou desaparecerá instantaneamente
                if skillId == SKILL_DELUXE_KEY:
                    # marque a chance de abrir a caixa
                    keyLevelNeeded = int(npc.getLevel() / 10)
                    levelDiff = keyLevelNeeded - skillLevel
                    if levelDiff < 0:
                        levelDiff = levelDiff * (-1)
                    chance = BASE_CHANCE - levelDiff * LEVEL_DECREASE

                    # sucesso, fingir-morte com recompensas: npc.reduceCurrentHp (99999999, player)
                    if Rnd.get(100) < chance:
                        npc.setMustRewardExpSp(False)
                        npc.setSpecialDrop()
                        npc.reduceCurrentHp(99999999, player)
                        return
                # usou uma habilidade diferente da chave no peito, ou usou uma chave no peito, mas não conseguiu abrir: desaparecer sem recompensas
                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
 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(),
                 "Não há razão para você me matar! Eu não tenho nada que você precise!"
             ))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(), "Vamos ver isso!"))
     return
Example #20
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(),
                        "Eu devo fazer algo sobre esse incidente vergonhoso ..."
                    ))

            self.FirstAttacked = False
        elif self.FirstAttacked:
            self.addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ())
        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
Example #22
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
Example #23
0
    def onAttack(self, npc, player, damage, isPet):
        npcId = npc.getNpcId()
        # verifique se o npc e as habilidades usadas são válidas para este script. Saia se for inválido.
        if npcId not in self.chests: return

        # se isto foi um mímico, defina o alvo, comece as habilidades e torne-se
        if not npc.isInteracted():
            npc.setInteracted()
            if Rnd.get(100) < IS_BOX:
                npc.onDecay()
            else:  # se isso não fosse uma caixa, após a interação, inicie os comportamentos mímicos ...
                # todo: talvez um auto-buff (id de habilidade 4245) com chance aleatória vai aqui?
                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
Example #24
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
Example #25
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
    def onSkillUse (self,npc,player,skill):
            # coletar alguns valores em variáveis locais
        npcId = npc.getNpcId()
        skillId = skill.getId()
        # verifique se o npc e as habilidades usadas são válidas para este script. Saia se for inválido.
        if npcId not in self.feedableBeasts : return
        if skillId not in [SKILL_GOLDEN_SPICE,SKILL_CRYSTAL_SPICE] : return

            # primeiro reúne alguns valores em variáveis locais
        objectId = npc.getObjectId()
        growthLevel = 3  # se um mob estiver em feedableBeasts, mas não em growthCapableMobs, então ele estará no crescimento máximo (3)
        if self.growthCapableMobs.has_key(npcId) :
            growthLevel = self.growthCapableMobs[npcId][0]

            # impede a exploração que permite que 2 jogadores levantem simultaneamente a mesma fera de 0-crescimento
            # Se o mob estiver no nível 0 (quando ainda ouvir todos os alimentadores), trave-o no primeiro alimentador!      
        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

            # exibir a ação social da besta comendo a comida.
        npc.broadcastPacket(SocialAction(objectId,2))

            # se este animal não puder crescer, está tudo pronto.
        if npcId in self.growthCapableMobs.keys() :
            # não fazer nada se esta multidão não comer o alimento especificado (a comida é consumida, mas não tem efeito).
            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 :
            # verifique se este é o mesmo jogador daquele que o levantou do crescimento 0.
            # se não, então não permita a chance de criar o animal de estimação (a comida é consumida, mas não tem efeito).
                if self.feedInfo[objectId] != player.getObjectId() : return

            # Polimorfia a máfia, com uma certa chance, dado seu atual nível de crescimento
            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 = ["Recargas! Yeah! "," Eu sou um animal tão guloso, é constrangedor! Ha ha",
                          "Seu sentimento cooperativo está ficando cada vez melhor.",
                          "Vou te ajudar!",
                          "O tempo está muito bom. Quer ir para um piquenique?",
                          "Eu gosto mesmo de você! Isso é gostoso ...",
                          "Se você não precisa sair deste lugar, eu posso ajudá-lo.",
                          "Com o que posso ajudar?",
                          "Eu não estou aqui só por comida!",
                          "Yam, inhame, inhame, inhame, inhame!"]
                npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
        return
Example #27
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
Example #28
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
    def spawnNext(self, npc, growthLevel,player,food) :
        npcId = npc.getNpcId()
        nextNpcId = 0

        # encontre o próximo mob para gerar, com base no atual npcId, growthlevel e food.
        if growthLevel == 2:
            rand = Rnd.get(2)
            # se domado, o mob que irá aparecer depende do tipo de classe (lutador / mago) do jogador!
            if rand == 1 :
                if player.getClassId().isMage() :
                    nextNpcId = self.growthCapableMobs[npcId][1][food][1][1]
                else :
                    nextNpcId = self.growthCapableMobs[npcId][1][food][1][0]
  
            # se não domada, há uma pequena chance de ter a doença da "vaca louca".
            # que é um animal mais forte que o normal que ataca seu alimentador
            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()
        
        # se esta é finalmente uma multidão treinada, então despawn quaisquer outros mobs treinados que o
        # player pode ter e inicializar a Besta Tamed.
        if nextNpcId in self.tamedBeasts :
            oldTrained = player.getTrainedBeast()
            if oldTrained :
                oldTrained.doDespawn()

            #o seguinte 5 linhas comentadas não são necessárias, mas eles fornecem uma implementação alternativa plausível ... apenas no caso ...
            #nextNpc = self.addSpawn (nextNpcId, npc)
            # nextNpc.setOwner (player)
            # nextNpc.setFoodType (foodSkill [comida])
            # 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) # se o jogador tiver 20 missões, dê o item da missão
                    st.set("cond","2")   # é mais fácil codificá-lo aqui do que tentar repetir essas coisas na missão

            # também, execute um bate-papo aleatório raro
            rand = Rnd.get(20)
            if rand > 4 : pass
            elif rand == 0 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", você vai me mostrar o seu refúgio?"))
            elif rand == 1 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", Sempre que olho para o tempero, penso em você."))
            elif rand == 2 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", você não precisa voltar para a aldeia. Eu vou te dar força"))
            elif rand == 3 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), "Thanks, "+player.getName()+".  Espero poder te ajudar"))
            elif rand == 4 : npc.broadcastPacket(CreatureSay(objectId,0,nextNpc.getName(), player.getName()+", O que eu posso fazer para te ajudar?"))

            # se não for treinado, o mob recém-criado será automaticamente agro contra seu alimentador
            # (o que aconteceu com "nunca morder a mão que te alimenta" de qualquer maneira ?!)
        else :
            # desovar o novo mob
            nextNpc = self.addSpawn(nextNpcId,npc)

            if nextNpcId in self.madCowPolymorph :
                self.startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player)            
            
            # registrar o jogador no feedinfo para a multidão que acabou de gerar
            self.feedInfo[nextNpc.getObjectId()] = player.getObjectId()
            nextNpc.setRunning()
            nextNpc.addDamageHate(player,0,99999)
            nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
Example #30
0
 def onTalk(self, npc, player):
     npcId = npc.getNpcId()
     htmltext = ""
     if npcId == 13001:  #heart of warding
         if self.antharasAI:
             status = GrandBossManager.getInstance().getBossStatus(29019)
             statusW = GrandBossManager.getInstance().getBossStatus(29066)
             statusN = GrandBossManager.getInstance().getBossStatus(29067)
             statusS = GrandBossManager.getInstance().getBossStatus(29068)
             if status == 2 or statusW == 2 or statusN == 2 or statusS == 2:
                 htmltext = "13001-02.htm"
             elif status == 3 or statusW == 3 or statusN == 3 or statusS == 3:
                 htmltext = "13001-01.htm"
             elif status == 0 or status == 1:  #If entrance to see Antharas is unlocked (he is Dormant or Waiting)
                 st = player.getQuestState(qn)
                 if st.getQuestItemsCount(3865) > 0:
                     st.takeItems(3865, 1)
                     zone = GrandBossManager.getInstance().getZone(
                         179700, 113800, -7709)
                     if zone:
                         zone.allowPlayerEntry(player, 30)
                     x = 179700 + Rnd.get(700)
                     y = 113800 + Rnd.get(2100)
                     player.teleToLocation(x, y, -7709)
                     if status == 0:
                         self.antharasAI.setAntharasSpawnTask()
                     return
                 else:
                     htmltext = "13001-03.htm"
     elif npcId == 31859:  #antharas teleport cube
         x = 79800 + Rnd.get(600)
         y = 151200 + Rnd.get(1100)
         player.teleToLocation(x, y, -3534)
         return
     elif npcId == 31385:  #heart of volcano
         htmltext = "31385-01.htm"
         if self.valakasAI:
             status = GrandBossManager.getInstance().getBossStatus(29028)
             if status == 0 or status == 1:  #If entrance to see Valakas is unlocked (he is Dormant or Waiting)
                 st = player.getQuestState(qn)
                 if self.count >= 200:
                     htmltext = "31385-03.htm"
                 elif st.getInt("allowEnter") == 1:
                     st.unset("allowEnter")
                     zone = GrandBossManager.getInstance().getZone(
                         212852, -114842, -1632)
                     if zone:
                         zone.allowPlayerEntry(player, 30)
                     x = 204328 + Rnd.get(600)
                     y = -111874 + Rnd.get(600)
                     player.teleToLocation(x, y, 70)
                     self.count = self.count + 1
                     if status == 0:
                         valakas = GrandBossManager.getInstance().getBoss(
                             29028)
                         self.valakasAI.startQuestTimer(
                             "lock_entry_and_spawn_valakas",
                             60000 * Config.VALAKAS_WAIT_TIME, valakas,
                             None)
                         GrandBossManager.getInstance().setBossStatus(
                             29028, 1)
                     return
                 else:  #player cheated, wasn't ported via npc Klein
                     htmltext = "31385-04.htm"
             elif status == 2:
                 htmltext = "31385-02.htm"
             else:
                 htmltext = "31385-01.htm"
         else:
             htmltext = "31385-01.htm"
     elif npcId == 31384:  #Gatekeeper of Fire Dragon
         DoorTable.getInstance().getDoor(24210004).openMe()
         return
     elif npcId == 31686:  #Gatekeeper of Fire Dragon
         DoorTable.getInstance().getDoor(24210006).openMe()
         return
     elif npcId == 31687:  #Gatekeeper of Fire Dragon
         DoorTable.getInstance().getDoor(24210005).openMe()
         return
     elif npcId == 31540:  #Watcher of Valakas Klein
         st = player.getQuestState(qn)
         if self.count < 50:
             htmltext = "31540-01.htm"
         elif self.count < 100:
             htmltext = "31540-02.htm"
         elif self.count < 150:
             htmltext = "31540-03.htm"
         elif self.count < 200:
             htmltext = "31540-04.htm"
         else:
             htmltext = "31540-05.htm"
     elif npcId == 31759:  #valakas teleport cube
         x = 150037 + Rnd.get(500)
         y = -57720 + Rnd.get(500)
         player.teleToLocation(x, y, -2976)
         return
     return htmltext