Esempio n. 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
Esempio n. 2
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
Esempio 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 :
                    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
Esempio 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 
Esempio n. 5
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
Esempio n. 6
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
Esempio n. 7
0
 def onTalk(self, npc, player):
     htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
     st = player.getQuestState(qn)
     if not st: return htmltext
     clan = player.getClan()
     npcId = npc.getNpcId()
     if player.getClan() == None or player.isClanLeader() == 0:
         st.exitQuest(1)
         htmltext = "31331-0a.htm"
     elif player.getClan().getLevel() < 6:
         st.exitQuest(1)
         htmltext = "31331-0b.htm"
     else:
         cond = st.getInt("cond")
         raid = st.getInt("raid")
         id = st.getState()
         if id == CREATED and cond == 0:
             htmltext = "31331-0c.htm"
         elif id == STARTED and cond == 1 and raid in REWARDS_LIST.keys():
             npc, item, min, max = REWARDS_LIST[raid]
             count = st.getQuestItemsCount(item)
             CLAN_POINTS_REWARD = Rnd.get(min, max)
             if not count:
                 htmltext = "31331-" + str(raid) + "a.htm"
             elif count == 1:
                 htmltext = "31331-" + str(raid) + "b.htm"
                 st.takeItems(item, 1)
                 clan.setReputationScore(
                     clan.getReputationScore() + CLAN_POINTS_REWARD, True)
                 player.sendPacket(
                     SystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
                 clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
     return htmltext
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(40) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You wont take me down easily."))
     else :
        self.FirstAttacked = True
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
     return 
Esempio n. 9
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(),"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 
Esempio n. 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
Esempio n. 12
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 
Esempio 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(), "Dear ultimate power!!!"))
     else:
         self.FirstAttacked = True
     return
Esempio n. 14
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
Esempio 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
Esempio 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
Esempio n. 17
0
    def onSkillUse(self, npc, player, skill):
        npcId = npc.getNpcId()
        skillId = skill.getId()
        skillLevel = skill.getLevel()

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

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

                    # success, pretend-death with rewards:  npc.reduceCurrentHp(99999999, player)
                    if Rnd.get(100) < chance:
                        npc.setMustRewardExpSp(False)
                        npc.setSpecialDrop()
                        npc.reduceCurrentHp(99999999, player)
                        return
                # used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards
                npc.onDecay()
            else:
                attacker = player
                if npc.getAttackByList().contains(player.getPet()):
                    attacker = player.getPet()
                npc.setRunning()
                npc.addDamageHate(attacker, 0, 999)
                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK,
                                         attacker)
        return
Esempio n. 18
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
Esempio n. 19
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(40): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Come on, Ill take you on!"))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(
                 objId, 0, npc.getName(),
                 "How dare you interrupt a sacred duel! You must be taught a lesson!"
             ))
     return
Esempio n. 20
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
Esempio n. 21
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
Esempio n. 22
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
Esempio n. 23
0
 def onAdvEvent(self, event, npc, player):
     status = GrandBossManager.getInstance().getBossStatus(Benom)
     if event == "BenomTeleSpawn":
         self.Teleport = self.addSpawn(BenomTeleport, 11013, -49629, -547,
                                       13400, False, 0)
     elif event == "BenomRaidRoomSpawn":
         if self.BenomIsSpawned == 0 and status == 0:
             self.Benomm = self.addSpawn(Benom, 12047, -49211, -3009, 0,
                                         False, 0)
             self.BenomIsSpawned = 1
     elif event == "BenomRaidSiegeSpawn":
         if status == 0:
             if self.BenomIsSpawned == 0:
                 self.Benomm = self.addSpawn(Benom, 11025, -49152, -537, 0,
                                             False, 0)
                 self.BenomIsSpawned = 1
             elif self.BenomIsSpawned == 1:
                 self.Benomm.teleToLocation(11025, -49152, -537)
             self.startQuestTimer("BenomSpawnEffect", 100, None, None)
             self.startQuestTimer("BenomBossDespawn", 5400000, None, None)
             self.Teleport.deleteMe()
     elif event == "BenomSpawnEffect":
         self.Benomm.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE)
         self.Benomm.broadcastPacket(
             SpecialCamera(self.Benomm.getObjectId(), 200, 0, 150, 0, 5000))
         self.Benomm.broadcastPacket(
             SocialAction(self.Benomm.getObjectId(), 3))
         self.startQuestTimer("BenomWalk", 5000, self.Benomm, None)
         self.BenomWalkRouteStep = 0
     elif event == "Attacking":
         NumPlayers = []
         for player in npc.getKnownList().getKnownPlayers().values():
             NumPlayers.append(player)
         if len(NumPlayers) > 0:
             target = NumPlayers[Rnd.get(len(NumPlayers))]
             npc.addDamageHate(target, 0, 999)
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK,
                                      target)
             self.startQuestTimer("Attacking", 2000, npc, player)
         elif len(NumPlayers) == 0:
             self.startQuestTimer("BenomWalkFinish", 2000, npc, None)
     elif event == "BenomWalkFinish":
         if npc.getCastle().getSiege().getIsInProgress():
             self.cancelQuestTimer("Attacking", npc, player)
             X = benomWalkRoutes[self.BenomWalkRouteStep][0]
             Y = benomWalkRoutes[self.BenomWalkRouteStep][1]
             Z = benomWalkRoutes[self.BenomWalkRouteStep][2]
             npc.teleToLocation(X, Y, Z)
             npc.setWalking()
             self.BenomWalkRouteStep = 0
             self.startQuestTimer("BenomWalk", 2200, npc, None)
     elif event == "BenomWalk":
         if self.BenomWalkRouteStep == 33:
             self.BenomWalkRouteStep = 0
             self.startQuestTimer("BenomWalk", 100, npc, None)
         else:
             self.startQuestTimer("Talk", 100, npc, None)
             if self.BenomWalkRouteStep == 14:
                 self.startQuestTimer("DoorOpen", 15000, None, None)
                 self.startQuestTimer("DoorClose", 23000, None, None)
             if self.BenomWalkRouteStep == 32:
                 self.startQuestTimer("DoorOpen", 500, None, None)
                 self.startQuestTimer("DoorClose", 4000, None, None)
             Time = WalkTimes[self.BenomWalkRouteStep]
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE)
             X = benomWalkRoutes[self.BenomWalkRouteStep][0]
             Y = benomWalkRoutes[self.BenomWalkRouteStep][1]
             Z = benomWalkRoutes[self.BenomWalkRouteStep][2]
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(X, Y, Z, 0))
             self.BenomWalkRouteStep = int(self.BenomWalkRouteStep) + 1
             self.startQuestTimer("BenomWalk", Time, npc, None)
     elif event == "DoorOpen":
         DoorTable.getInstance().getDoor(20160005).openMe()
     elif event == "DoorClose":
         DoorTable.getInstance().getDoor(20160005).closeMe()
     elif event == "Talk":
         if Rnd.get(100) < 40:
             npc.broadcastPacket(
                 CreatureSay(npc.getObjectId(), 0, "Benom",
                             BenomSpeak[Rnd.get(4)]))
     elif event == "BenomBossDespawn":
         GrandBossManager.getInstance().setBossStatus(Benom, LIVE)
         self.BenomIsSpawned = 0
         self.Benomm.deleteMe()
     return
Esempio n. 24
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
Esempio n. 25
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
Esempio n. 26
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     st = player.getQuestState(self.qn)
     if npcId in Archon_Minions:
         party = player.getParty()
         if party:
             PartyQuestMembers = []
             for player1 in party.getPartyMembers().toArray():
                 for q in Quests.keys():
                     st1 = player1.getQuestState(Quests[q])
                     if st1:
                         if player1.getClassId().getId() == QuestClass[
                                 int(q) - 70]:
                             if st1.getInt("cond") == 15:
                                 PartyQuestMembers.append(st1)
                                 break
             if len(PartyQuestMembers) > 0:
                 st2 = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
                 st2.getQuest().giveHallishaMark(st2)
         else:
             for q in Quests.keys():
                 st1 = player.getQuestState(Quests[q])
                 if st1:
                     if player.getClassId().getId() == QuestClass[int(q) -
                                                                  70]:
                         if st1.getInt("cond") == 15:
                             st1.getQuest().giveHallishaMark(st1)
                             break
     elif npcId in Archon_Hellisha_Norm:
         for q in Quests.keys():
             st1 = player.getQuestState(Quests[q])
             if st1:
                 if player.getClassId().getId() == QuestClass[int(q) - 70]:
                     if st1.getInt("cond") == 15:
                         #This is just a guess....not really sure what it actually says, if anything
                         self.AutoChat(
                             npc,
                             st1.getQuest().Text[4].replace(
                                 'PLAYERNAME',
                                 st1.getPlayer().getName()))
                         st1.giveItems(st1.getQuest().Items[8], 1)
                         st1.takeItems(st1.getQuest().Items[3], -1)
                         st1.set("cond", "16")
                         st1.playSound("ItemSound.quest_middle")
                         break
     elif npcId in Guardian_Angels:
         for q in Quests.keys():
             st1 = player.getQuestState(Quests[q])
             if st1:
                 if player.getClassId().getId() == QuestClass[int(q) - 70]:
                     if st1.getInt("cond") == 6:
                         if st1.getInt("kills") < 9:
                             st1.set("kills", str(st1.getInt("kills") + 1))
                         else:
                             st1.playSound("ItemSound.quest_middle")
                             st1.giveItems(st1.getQuest().Items[5], 1)
                             st1.set("cond", "7")
                         break
     elif st:
         cond = st.getInt("cond")
         if npcId == self.Mob[0] and cond == 8:
             st2 = self.findRightState(player, npc)
             if st2:
                 if not player.isInParty():
                     if st == st2:
                         self.AutoChat(
                             npc,
                             self.Text[12].replace('PLAYERNAME',
                                                   player.getName()))
                         st.giveItems(self.Items[6], 1)
                         st.set("cond", "9")
                         st.playSound("ItemSound.quest_middle")
                 if st2.getQuestTimer("Mob_1 has despawned"):
                     st2.getQuestTimer("Mob_1 has despawned").cancel()
                 self.DeleteSpawn(st2, st2.getInt("Mob_1"))
                 st2.set("spawned", "0")
         elif npcId == self.Mob[1]:
             if cond == 15:
                 st2 = self.findRightState(player, npc)
                 if st2:
                     if not player.isInParty():
                         if st == st2:
                             self.AutoChat(
                                 npc, self.Text[4].replace(
                                     'PLAYERNAME', player.getName()))
                             st.giveItems(self.Items[8], 1)
                             st.takeItems(self.Items[3], -1)
                             st.set("cond", "16")
                             st.playSound("ItemSound.quest_middle")
                         else:
                             self.AutoChat(
                                 npc, self.Text[5].replace(
                                     'PLAYERNAME', player.getName()))
                     if st2.getQuestTimer("Archon Hellisha has despawned"):
                         st2.getQuestTimer(
                             "Archon Hellisha has despawned").cancel()
                     self.DeleteSpawn(st2, st2.getInt("Archon"))
                     st2.set("spawned", "0")
     else:
         if npcId == self.Mob[0]:
             st = self.findRightState(player, npc)
             if st:
                 if st.getQuestTimer("Mob_1 has despawned"):
                     st.getQuestTimer("Mob_1 has despawned").cancel()
                 self.DeleteSpawn(st, st.getInt("Mob_1"))
                 st.set("spawned", "0")
         elif npcId == self.Mob[1]:
             st = self.findRightState(player, npc)
             if st:
                 if st.getQuestTimer("Archon Hellisha has despawned"):
                     st.getQuestTimer(
                         "Archon Hellisha has despawned").cancel()
                 self.DeleteSpawn(st, st.getInt("Archon"))
                 st.set("spawned", "0")
     return
Esempio n. 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
Esempio n. 28
0
 def onSkillUse(self, npc, player, skill):
     npcId = npc.getNpcId()
     skillId = skill.getId()
     if skillId != SKILL_NECTAR: return
     if npcId not in WATERED_SQUASH: return
     objectId = npc.getObjectId()
     if skillId == SKILL_NECTAR:
         # Первый полив
         if npc.getNectar() == 0:
             if Rnd.get(2) == 1:
                 mytext = [
                     "Чтобы быть способной расти, я должна пить только нектар ... причем чаще",
                     "Если ты будеш быстрее выливать мне нектар - я быстрее выросту!",
                     "Ну, верьте мне, прыскайте нектар! Я могу конечно превратиться в большую тыкву!!!",
                     "Принеси нектар, чтобы вырастить тыкву!",
                     "Плод прекрасной молодой тыквы начинает блестеть, когда семя предано земле! С этого времени будет способен стать здоровым и сильным!",
                     "О, давно не виделись?",
                     "Неожидал увидеть мое красивое появление?",
                     "Отлично! Это - нечто! Нектар?",
                     "Дозаправка! Заправь 5 бутылок, чтобы я смогла превратиться в большую тыкву! О!"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "Не спеши! Слишком часто, я не успеваю!",
                     "Я же не автомат, меня скорострельностью не напоиш",
                     "Да куда же ты торопишься! Слишком часто, я не успеваю!",
                     "Упс, опять слишком быстро",
                     "Давай чуток помедленней, не спеши, медленно достань бутылку и медленно ее вылей!",
                     "У тебя нет чувства скорости? Медленнее давай"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # Второй полив
         elif npc.getNectar() == 1:
             if Rnd.get(2) == 1:
                 mytext = [
                     "Желаю стать большой тыквой!",
                     "Ням, ням, ням! Вышло! Заботится - хорошо!",
                     "Как думаеш, я зрелая или гнилая?",
                     "Нектар - только лучшее! Ха! Ха! Ха!"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "О! Опять мимо! Может слишком быстро расходуеш нектар?",
                     "Если я умру такой как сейчас, Вы получите только молодую тыкву ...",
                     "Выращивают немного быстрее! Неплохо было бы стать большой тыквой, молодая тыква не хороша!",
                     "Tакую маленькую тыкву вы все должны есть? Принесите нектар, я могу быть больше!"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # Третий полив
         elif npc.getNectar() == 2:
             if Rnd.get(2) == 1:
                 mytext = [
                     "Tыква, изголодалась! Просит утолить жажду!",
                     "Ну наконец-то ..., это действительно вкусно! Есть еще?",
                     "Ухаживаешь за мной только для того, чтобы есть? Отлично, является случайным ваш ..., чтобы не дать манну на самоубийство"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "Не воду ли Вы добавляете? Какой вкус?",
                     "Хозяин, спасите меня... Я не имею аромата нектара, я должна умереть ..."
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # Четвертый полив
         elif npc.getNectar() == 3:
             if Rnd.get(2) == 1:
                 mytext = [
                     "Очень хорошо, делаешь чрезвычайно хорошо! Знаешь что следующим шагом должен делать?",
                     "Если Вы поймаете меня, я даю Вам 10 миллионов adena!!! Согласны?"
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
                 npc.addGood()
             else:
                 mytext = [
                     "Я голодна, Tы хочеш чтоб я засохла?",
                     "Tребую нектар, чтобы расти немного быстрее."
                 ]
                 npc.broadcastPacket(
                     CreatureSay(objectId, 0, npc.getName(),
                                 mytext[Rnd.get(len(mytext))]))
                 npc.addNectar()
         # Пятый полив
         elif npc.getNectar() == 4:
             if Rnd.get(2) == 1:
                 npc.addGood()
             if npc.getGood() >= 3:
                 if npcId == 12774:
                     newGourd = self.addSpawn(12775, npc)
                     newGourd.setOwner(player.getName())
                     self.startQuestTimer(
                         "Good By", 120000, newGourd,
                         player)  # Через 2 минуты исчезновение
                     self.startQuestTimer(
                         "Good By2", 90000, newGourd,
                         player)  # 30 секунд до исчезновения
                     self.startQuestTimer(
                         "Good By3", 100000, newGourd,
                         player)  # 20 секунд до исчезновения
                     self.startQuestTimer(
                         "Good By4", 110000, newGourd,
                         player)  # 10 секунд до исчезновения
                     mytext = [
                         "Молодая тыква, жаждящая! Как, уже выросла?",
                         "Я убегу через 2 минуты"
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
                 else:
                     newGourd = self.addSpawn(12778, npc)
                     newGourd.setOwner(player.getName())
                     self.startQuestTimer(
                         "Good By1", 120000, newGourd,
                         player)  # Через 2 минуты исчезновение
                     self.startQuestTimer(
                         "Good By2", 90000, newGourd,
                         player)  # 30 секунд до исчезновения
                     self.startQuestTimer(
                         "Good By3", 100000, newGourd,
                         player)  # 20 секунд до исчезновения
                     self.startQuestTimer(
                         "Good By4", 110000, newGourd,
                         player)  # 10 секунд до исчезновения
                     mytext = [
                         "Милосердность является очень хорошей чертой. Tеперь посмотрите, я чувствую себя все более хорошо",
                         "Я убегу через 2 минуты"
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
             else:
                 if npcId == 12774:
                     newGourd = self.addSpawn(12776, npc)
                     newGourd.setOwner(player.getName())
                     mytext = [
                         "Эй! Была - не была! Есть! Сейчас же! Tы не можешь должным образом заботиться? Я же так сгнию!",
                         "Ничего себе, остановки? За что тебя благодарить",
                         "Жажду нектара о ...",
                         "Вы хотите большую тыкву? Но я хочу остаться маленькой тыковкой ..."
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
                 if npcId == 12777:
                     newGourd = self.addSpawn(12779, npc)
                     newGourd.setOwner(player.getName())
                     mytext = [
                         "Эй! Была - не была! Есть! Сейчас же! Tы не можешь должным образом заботиться? Я так сгнию!",
                         "Ничего себе, остановки? За что тебя благодарить",
                         "Жажду нектара о ...",
                         "Вы хотите большую тыкву? Но я хочу остаться маленькой тыковкой ..."
                     ]
                     npc.broadcastPacket(
                         CreatureSay(objectId, 0, npc.getName(),
                                     mytext[Rnd.get(len(mytext))]))
                     npc.onDecay()
     return