Ejemplo n.º 1
0
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(100) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
     else :
        self.FirstAttacked = True
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I will definitely repay this humiliation!"))
     return 
Ejemplo n.º 2
0
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(40) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"There is no reason for you to kill me! I have nothing you need!"))
     else :
        self.FirstAttacked = True
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
     return 
Ejemplo n.º 3
0
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(40) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You wont take me down easily."))
     else :
        self.FirstAttacked = True
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!"))
     return 
Ejemplo n.º 4
0
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(4) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Your rear is practically unguarded!"))
     else :
        self.FirstAttacked = True
        if Rnd.get(4) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Watch your back!"))
     return 
Ejemplo n.º 5
0
 def onAttack(self, npc, player, damage, isPet):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(40): return
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Hey! Were having a duel here!"))
     else:
         self.FirstAttacked = True
         npc.broadcastPacket(
             CreatureSay(
                 objId, 0, npc.getName(),
                 "How dare you interrupt our fight! Hey guys, help!"))
     return
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def onKill(self, npc, player, isPet):
     leaderst = leader(player)
     if not leaderst: return
     if not leaderst.getState() == STARTED:
         if DEBUG:
             print "onKill says leader needs to start quest"
             return "Need to start quest!"
         return
     part = leaderst.getInt("part")
     npcId = npc.getNpcId()
     if npcId in CHESTS and part == 4:
         wins = leaderst.getInt("chest_wins")
         if (self.chests - wins) == 12 or (wins < 4
                                           and not leaderst.getRandom(4)):
             wins += 1
             leaderst.set("chest_wins", str(wins))
             npc.broadcastPacket(
                 CreatureSay(npc.getObjectId(), 0, npc.getName(),
                             "###### BINGO! ######"))
         self.chests += 1
     elif npcId in MOBS.keys():
         st = player.getQuestState(qn)
         if not st: st = self.newQuestState(player)
         if st == leaderst: return
         if part >= 3 and part < 6:
             if not st.getRandom(10):
                 st.giveItems(MOBS[npcId], 1)
                 st.playSound("ItemSound.quest_itemget")
         elif DEBUG:
             print "onKill says leader is not correct state" + str(part)
             return "leader is not correct state"
     return
Ejemplo n.º 8
0
 def onAttack(self, npc, player, damage, isPet):
     npcId = npc.getNpcId()
     objId = npc.getObjectId()
     if self.MobSpawns.has_key(npcId):
         if npc.getStatus().getCurrentHp() <= npc.getMaxHp(
         ) * self.MobSpawns[npcId]['HP'] / 100 and Rnd.get(
                 100) < self.MobSpawns[npcId]['chance']:
             if self.MobTexts.has_key(npcId):
                 text = self.MobTexts[npcId][Rnd.get(
                     len(self.MobTexts[npcId]))]
                 npc.broadcastPacket(
                     CreatureSay(objId, 0, npc.getName(), text))
             posX = npc.getX()
             posY = npc.getY()
             posZ = npc.getZ()
             signX = -500
             signY = -500
             if npc.getX() > player.getX():
                 signX = 500
             if npc.getY() > player.getY():
                 signY = 500
             posX = posX + signX
             posY = posY + signY
             npc.setIsAfraid(1)
             npc.setRunning()
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(posX, posY, posZ, 0))
             self.startQuestTimer("Retreat", 10000, npc, player)
     return
Ejemplo n.º 9
0
def AutoChat(npc,text) :
    chars = npc.getKnownList().getKnownPlayers().values().toArray()
    if chars != None:
       for pc in chars :
            sm = CreatureSay(npc.getObjectId(), 0, npc.getName(), text)
            pc.sendPacket(sm)
    return
Ejemplo n.º 10
0
    def onKill(self, npc, player, isPet):
        st = player.getQuestState(qn)
        if not st: return
        if st.getState() != CREATED: return
        leaderst = leader(player)

        ### first part, general checking
        npcId = npc.getNpcId()
        if not leaderst:
            st.exitQuest(1)
            if DEBUG:
                return "DEBUG: onKill can't find leader info. Leader d/c?"
            return "Quest Failed"
        else:
            ingredients = []
            timer = leaderst.getQuestTimer("poison_timer")
            if timer == None:
                self.chest_game(st, "stop")
                if DEBUG:
                    return "DEBUG: onKill can't find poison timer. Too much time have passed"
                return "Quest Failed"
            try:
                ingredients = leaderst.get("ingredients").split()
            finally:
                ### second part, herbs gathering
                if len(ingredients):
                    for m in range(len(MOBS)):
                        if not int(ingredients[m]):
                            if npcId == MOBS[m][0]:
                                if st.getQuestItemsCount(MOBS[m][1]) == 0:
                                    if st.getRandom(100) < RATE:
                                        st.giveItems(MOBS[m][1], 1)
                                        ingredients[m] = '1'
                                        leaderst.set("ingredients",
                                                     " ".join(ingredients))
                                        st.playSound("ItemSound.quest_middle")
                                        return
        ### third part, chest game
            if npcId in CHESTS:
                timer = leaderst.getQuestTimer("chest_timer")
                #if timer == None : self.chest_game(st,"stop");return "Time is up!"
                chests = leaderst.get("chests").split()
                for i in range(len(chests)):
                    if npcId == 18257 + i and chests[i] == '1':
                        npc.broadcastPacket(
                            CreatureSay(npc.getObjectId(), 0, npc.getName(),
                                        "###### BINGO! ######"))
                        count = int(leaderst.get("chest_count"))
                        if count < 4:
                            count += 1
                            leaderst.set("chest_count", str(count))
                            if count == 4:
                                leaderst.getQuestTimer("chest_timer").cancel()
                                self.chest_game(leaderst, "stop")
                                leaderst.set("chest_game", "2")
                                st.playSound("ItemSound.quest_middle")
                            else:
                                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(),"Destroy the enemy, my brothers!"))
     else :
        self.FirstAttacked = True
     return 
Ejemplo n.º 12
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 
Ejemplo n.º 13
0
 def onAttack (self,npc,player,damage,isPet):
     objId=npc.getObjectId()
     if self.FirstAttacked:
        if Rnd.get(40) : return
        npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"You childish fool, do you think you can catch me?"))
     else :
        self.FirstAttacked = True
     return
Ejemplo n.º 14
0
    def onKill (self,npc,player,isPet):
        npcId = npc.getNpcId()
        if npcId == self.cats_eye_bandit:
            objId=npc.getObjectId()
            if Rnd.get(80) : npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I must do something about this shameful incident..."))

            self.FirstAttacked = False
        elif self.FirstAttacked :
            self.addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ())
        return
Ejemplo n.º 15
0
 def onAdvEvent(self, event, npc, player):
     objId = npc.getObjectId()
     if event == "Good By" and npc and player:
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(), "Good By!!  LOL."))
         npc.onDecay()
     elif event == "Good By1" and npc and player:
         npc.broadcastPacket(
             CreatureSay(
                 objId, 0, npc.getName(),
                 "Всем, до свидания... Большая тыква сказала до свидания ..."
             ))
         npc.onDecay()
     elif event == "Good By2" and npc and player:
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Вы можете быстрее? Через 30 секунд я сбегу ..."))
     elif event == "Good By3" and npc and player:
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "Я прерву отношения с Вами через 20 секунд!"))
     elif event == "Good By4" and npc and player:
         npc.broadcastPacket(
             CreatureSay(objId, 0, npc.getName(),
                         "У меня осталось всего 10 секунд! 9. 8. 7 ..!"))
     elif event == "Good By5" and npc and player:
         npc.broadcastPacket(
             CreatureSay(
                 objId, 0, npc.getName(),
                 "Эй! Счастливо оставаться! Идиот, забудь обо мне!"))
     return
Ejemplo n.º 16
0
 def onKill(self, npc, player, isPet):
     st = player.getQuestState(qn)
     if not st: return
     npcId = npc.getNpcId()
     if st.getState() == STARTED and st.getInt("cond") == 10:
         if npcId == Guardian:
             npc.broadcastPacket(
                 CreatureSay(
                     npc.getObjectId(), 0, npc.getName(),
                     "This enemy is far too powerful for me to fight. I must withdraw"
                 ))
             st.set("cond", "11")
             st.playSound("ItemSound.quest_middle")
     return
Ejemplo n.º 17
0
 def onKill(self, npc, player, isPet):
     st = player.getQuestState(qn)
     if not st: return
     if st.getState() != STARTED: return
     if st.getInt("cond") == 7:
         st.playSound("ItemSound.quest_itemget")
         st.set("cond", "8")
         npc.broadcastPacket(
             CreatureSay(
                 npc.getObjectId(), 0, npc.getName(),
                 "You've ended my immortal life! You've protected by the feudal lord, aren't you?"
             ))
         st.giveItems(TotemDoll, 1)
         st.set("step", "2")
     return
Ejemplo n.º 18
0
 def onAdvEvent (self,event,npc,player) :
     st = player.getQuestState(qn)
     htmltext = event
     if event == "31328-02.htm": # call 31328-03.htm
         st.giveItems(MapForestofDeadman,1)
         st.giveItems(SilverKey,1)
         st.set("cond","1")
         st.playSound("ItemSound.quest_accept")
         st.setState(STARTED)
     elif event == "31328-03.htm": # call 31328-05.htm and 31328-06.htm
         st.set("cond","2")
         st.playSound("ItemSound.quest_middle")
     elif event == "31526-05.htm": # called by 31526-03.htm for hairpin
         if st.getQuestItemsCount(LidiaHairPin) == 0:
             st.giveItems(LidiaHairPin,1) # give hairpin
             if st.getQuestItemsCount(LidiaDiary) != 0: # if has diary cond = 4
                 st.set("cond","4")
                 st.playSound("ItemSound.quest_middle")
     elif event == "31526-11.htm": # called by 31526-07 for diary
         if st.getQuestItemsCount(LidiaDiary) == 0:
             st.giveItems(LidiaDiary,1)
             if st.getQuestItemsCount(LidiaHairPin) != 0: # if has hairpin cond = 4
                 st.set("cond","4")
                 st.playSound("ItemSound.quest_middle")
     elif event == "31328-19.htm": # end of questions loop go to ghost
         st.set("cond","6")
         st.playSound("ItemSound.quest_middle")
     elif event == "31524-04.htm":# sends you to the tombstone to dig
         st.set("cond","7")
         st.playSound("ItemSound.quest_middle")
         st.takeItems(LidiaDiary,-1)
     elif event == "31523-02.htm":
         st.playSound("SkillSound5.horror_02")
         ghost = st.addSpawn(31524,51432,-54570,-3136,1800000)
         ghost.broadcastPacket(CreatureSay(ghost.getObjectId(),0,ghost.getName(),"Who awoke me?"))
     elif event == "31523-05.htm":
         st.startQuestTimer("ghost_timer",10000)
     elif event == "ghost_timer":
         st.set("cond","8")
         htmltext = "31523-06.htm"
         st.giveItems(SilverKey,1)
     elif event == "31530-02.htm":# box gives spear takes key
         st.set("cond","10")
         st.playSound("ItemSound.quest_middle")
         st.takeItems(SilverKey,-1)
         st.giveItems(SilverSpear,1)
     return htmltext
Ejemplo n.º 19
0
 def onKill(self, npc, player, isPet):
     # all kill events triggered by the leader occur automatically.
     # However, kill events that were triggered by members occur via the leader and
     # only if the leader is online and within a certain distance!
     leader_st = 0
     if player.isClanLeader():
         leader_st = player.getQuestState(qn)
     else:
         clan = player.getClan()
         if clan:
             c_leader = clan.getLeader()
             if c_leader:
                 leader = c_leader.getPlayerInstance()
                 if leader:
                     if player.isInsideRadius(leader, 1600, 1, 0):
                         leader_st = leader.getQuestState(qn)
     if leader_st:
         if leader_st.getState() != PROGRESS: return
         npcId = npc.getNpcId()
         condition, maxcount, chance, itemList = DROPLIST[npcId]
         random = leader_st.getRandom(100)
         cond = leader_st.getInt("cond")
         if cond == condition and random < chance:
             if len(itemList) > 1:
                 stoneRandom = leader_st.getRandom(3)
                 if stoneRandom == 0:
                     if leader_st.getInt("Kurtz") < 4:
                         return
                     else:
                         maxcount *= 4
                 giveItem(itemList[stoneRandom], maxcount, leader_st)
             elif len(itemList):
                 giveItem(itemList[0], maxcount, leader_st)
             else:
                 if npcId == 27181:  # Imperial Gravekeeper
                     spawnedNpc = leader_st.addSpawn(30765, 120000)
                     npc.broadcastPacket(
                         CreatureSay(
                             spawnedNpc.getObjectId(), 0,
                             spawnedNpc.getName(),
                             "Curse of the gods on the one that defiles the property of the empire!"
                         ))
                     leader_st.set("ImpGraveKeeper", "3")
                     self.ImpGraveKepperStat = 1
                 else:
                     leader_st.addSpawn(27179)
     return
Ejemplo n.º 20
0
 def onAttack(self,npc,player,damage,isPet) :
     npcId = npc.getNpcId()
     objId = npc.getObjectId()
     if npcId not in WATERED_SQUASH : return
     if npcId  in self.adultLargeSquash :
         if Rnd.get(30) < 2 :
             mytext = ["Укусы плетут кружево крысой ..., чтобы заменить ... тело ...!",
                       "Ха ха, росла! Полностью на всех!",
                       "Не можете чтоли все прицелиться? Смотрите все, чтобы не сбежала ...",
                       "Я считаю ваши удары! О, напоминает удар снова!",
                       "Не тратьте впустую ваше время!",
                       "Ха, этот звук действительно приятно слышать?",
                       "Я потребляю ваши атаки, чтобы расти!",
                       "Время, чтобы ударить снова! Ударь еще разок!",
                       "Tолько полезная музыка может открыть большую тыкву... Меня нельзя открыть с оружием!"]
             npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),mytext[Rnd.get(len(mytext))]))
     return
Ejemplo n.º 21
0
 def onKill(self,npc,player,isPet) :
     npcId = npc.getNpcId()
     objId = npc.getObjectId()
     if npcId not in WATERED_SQUASH : return
     if npcId in self.adultSmallSquash :
         npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Tыква открывается!!"))
         npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Ееее! Открывается! Много хороших вещей  ..."))
     elif npcId in self.adultLargeSquash :
         npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Tыква открывается!!"))
         npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Ееее! Открывается! Много хороших вещей  ..."))
     else :
         npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"За что, хозяин?!"))
         npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"Ой, кишки вывалились!!"))
     return
Ejemplo n.º 22
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "32018-04.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "7")
         st.takeItems(Letter2, 1)
     elif event == "32020-02.htm":
         st.setState(STARTED)
         st.playSound("ItemSound.quest_accept")
         st.set("cond", "1")
     elif event == "32020-05.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "3")
         st.takeItems(Letter, 1)
     elif event in ["32020-06.htm", "32020-08a.htm"]:
         st.exitQuest(1)
         st.playSound("ItemSound.quest_finish")
     elif event in ["32020-08.htm", "32020-07a.htm"]:
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "4")
     elif event == "32020-12.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "5")
     elif event == "32020-16.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "10")
         st.takeItems(Report, 1)
     elif event == "32020-18.htm":
         if st.getQuestItemsCount(Tablet) == 0:
             st.playSound("ItemSound.quest_middle")
             st.set("cond", "11")
             htmltext = "32020-19.htm"
         else:
             st.exitQuest(false)
             st.playSound("ItemSound.quest_finish")
             st.giveItems(57, 115673)
             st.addExpAndSp(493595, 40442)
     elif event == "32020-19.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "11")
     elif event == "32022-02.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "9")
         man = st.addSpawn(Suspicious, 104562, -107598, -3688, 0, False,
                           4000)
         man.broadcastPacket(
             CreatureSay(man.getObjectId(), 0, man.getName(),
                         "We meet again."))
         self.startQuestTimer("2", 3700, man, player)
         st.giveItems(Report, 1)
     elif event == "Sculpture-04.htm":
         st.set("talk", "1")
         htmltext = "Sculpture-05.htm"
         st.set(str(npc.getNpcId()), "1")
     elif event == "Sculpture-04a":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "8")
         man = st.addSpawn(Suspicious, 117890, -126478, -2584, 0, False,
                           4000)
         man.broadcastPacket(
             CreatureSay(man.getObjectId(), 0, man.getName(),
                         "This looks like the right place..."))
         self.startQuestTimer("1", 3700, man, player)
         htmltext = "Sculpture-04.htm"
         if st.getInt(str(Sculpture1)) == 0 and st.getInt(
                 str(Sculpture2)) == 0:
             st.giveItems(Tablet, 1)
     elif event == "Sculpture-05.htm":
         st.set(str(npc.getNpcId()), "1")
     elif event == "1":
         npc.broadcastPacket(
             CreatureSay(npc.getObjectId(), 0, npc.getName(),
                         "I see someone. Is this fate?"))
     elif event == "2":
         npc.broadcastPacket(
             CreatureSay(
                 npc.getObjectId(), 0, npc.getName(),
                 "Don't bother trying to find out more about me. Follow your own destiny."
             ))
     return htmltext
Ejemplo n.º 23
0
def autochat(npc, text):
    if npc:
        npc.broadcastPacket(
            CreatureSay(npc.getObjectId(), 0, npc.getName(), text))
    return
Ejemplo n.º 24
0
    def onSkillUse(self, npc, player, skill):
        # gather some values on local variables
        npcId = npc.getNpcId()
        skillId = skill.getId()
        # check if the npc and skills used are valid for this script.  Exit if invalid.
        if npcId not in self.feedableBeasts: return
        if skillId not in [SKILL_GOLDEN_SPICE, SKILL_CRYSTAL_SPICE]: return

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

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

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

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

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

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

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

            # Polymorph the mob, with a certain chance, given its current growth level
            if Rnd.get(100) < self.growthCapableMobs[npcId][2]:
                self.spawnNext(npc, growthLevel, player, food)
        elif npcId in self.tamedBeasts:
            if skillId == npc.getFoodType():
                npc.onReceiveFood()
                mytext = [
                    "Refills! Yeah!",
                    "I am such a gluttonous beast, it is embarrassing! Ha ha",
                    "Your cooperative feeling has been getting better and better.",
                    "I will help you!",
                    "The weather is really good.  Wanna go for a picnic?",
                    "I really like you! This is tasty...",
                    "If you do not have to leave this place, then I can help you.",
                    "What can I help you with?",
                    "I am not here only for food!", "Yam, yam, yam, yam, yam!"
                ]
                npc.broadcastPacket(
                    CreatureSay(objectId, 0, npc.getName(),
                                mytext[Rnd.get(len(mytext))]))
        return
Ejemplo n.º 25
0
    def onEvent(self, event, st):
        htmltext = event
        # Events Gustaf
        if event == "30760-08.htm":
            st.giveItems(G_Let_Martien, 1)
            for var in STATS:
                st.set(var, "1")
            st.setState(PROGRESS)
        elif event == "30760-12.htm":
            st.giveItems(G_Let_Balthazar, 1)
            st.set("cond", "4")
        elif event == "30760-16.htm":
            st.giveItems(G_Let_Rodemai, 1)
            st.set("cond", "7")
        elif event == "30760-20.htm":
            exit503(1, st)
        elif event == "30760-22.htm":
            st.set("cond", "13")
        elif event == "30760-23.htm":
            exit503(1, st)
# Events Martien
        elif event == "30645-03.htm":
            st.takeItems(G_Let_Martien, -1)
            st.set("cond", "2")
            suscribe_members(st)
            try:
                members = st.getPlayer().getClan().getOnlineMembers("")[0]
                for i in members:
                    pst = QuestManager.getInstance().getQuest(
                        qn).newQuestState(
                            st.getPlayer().getClan().getClanMember(
                                int(i)).getPlayerInstance())
                    pst.setState(PROGRESS)
            except:
                return htmltext
# Events Kurtz
        elif event == "30763-03.htm":
            if st.getInt("Kurtz") == 1:
                htmltext = "30763-02.htm"
                st.giveItems(Mi_Drake_Eggs, 6)
                st.giveItems(Brooch, 1)
                st.set("Kurtz", "2")
# Events Lutz
        elif event == "30762-03.htm":
            lutz = st.getInt("Lutz")
            if lutz == 1:
                htmltext = "30762-02.htm"
                st.giveItems(Mi_Drake_Eggs, 4)
                st.giveItems(Bl_Wyrm_Eggs, 3)
                st.set("Lutz", "2")
            st.addSpawn(27178, 112268, 112761, -2770, 120000)
            st.addSpawn(27178, 112234, 112705, -2770, 120000)
# Events Fritz
        elif event == "30761-03.htm":
            fritz = st.getInt("Fritz")
            if fritz == 1:
                htmltext = "30761-02.htm"
                st.giveItems(Bl_Wyrm_Eggs, 3)
                st.set("Fritz", "2")
            st.addSpawn(27178, 103841, 116809, -3025, 120000)
            st.addSpawn(27178, 103848, 116910, -3020, 120000)
# Events Kusto
        elif event == "30512-03.htm":
            st.takeItems(Brooch, -1)
            st.giveItems(Bl_Anvil_Coin, 1)
            st.set("Kurtz", "3")
# Events Balthazar
        elif event == "30764-03.htm":
            st.takeItems(G_Let_Balthazar, -1)
            st.set("cond", "5")
            st.set("Kurtz", "3")
        elif event == "30764-05.htm":
            st.takeItems(G_Let_Balthazar, -1)
            st.set("cond", "5")
        elif event == "30764-06.htm":
            st.takeItems(Bl_Anvil_Coin, -1)
            st.set("Kurtz", "4")
            st.giveItems(Recipe_Power_Stone, 1)
# Events Rodemai
        elif event == "30868-04.htm":
            st.takeItems(G_Let_Rodemai, -1)
            st.set("cond", "8")
        elif event == "30868-06a.htm":
            st.set("cond", "10")
        elif event == "30868-10.htm":
            st.set("cond", "12")


# Events Cleo
        elif event == "30766-04.htm":
            st.set("cond", "9")
            spawnedNpc = st.addSpawn(30766, 160622, 21230, -3710, 90000)
            spawnedNpc.broadcastPacket(
                CreatureSay(spawnedNpc.getObjectId(), 0, spawnedNpc.getName(),
                            "Blood and Honour."))
            spawnedNpc = st.addSpawn(30759, 160665, 21209, -3710, 90000)
            spawnedNpc.broadcastPacket(
                CreatureSay(spawnedNpc.getObjectId(), 0, spawnedNpc.getName(),
                            "Ambition and Power"))
            spawnedNpc = st.addSpawn(30758, 160665, 21291, -3710, 90000)
            spawnedNpc.broadcastPacket(
                CreatureSay(spawnedNpc.getObjectId(), 0, spawnedNpc.getName(),
                            "War and Death"))
        elif event == "30766-08.htm":
            st.takeItems(Scepter_Judgement, -1)
            exit503(0, st)
        return htmltext
Ejemplo n.º 26
0
 def onEvent(self, event, st):
     htmltext = event
     if event == "31961-02.htm":
         st.set("cond", "22")
         st.takeItems(Letter, 1)
         st.giveItems(Starstone2, 1)
         st.playSound("ItemSound.quest_middle")
     if event == "32041-02.htm":
         st.setState(STARTED)
         st.playSound("ItemSound.quest_accept")
         st.set("cond", "1")
         st.set("talk", "0")
     elif event == "32041-06.htm":
         st.set("talk", "1")
     elif event == "32041-07.htm":
         st.set("cond", "2")
         st.playSound("ItemSound.quest_middle")
         st.set("talk", "0")
     elif event == "32041-10.htm":
         choice = st.getInt("choice")
         if choice == 1:
             htmltext = "32041-10.htm"
         elif choice == 2:
             htmltext = "32041-10a.htm"
         elif choice == 3:
             htmltext = "32041-10b.htm"
     elif event == "32041-11.htm":
         st.set("talk", "1")
     elif event == "32041-18.htm":
         st.set("talk", "2")
     elif event == "32041-20.htm":
         st.set("cond", "6")
         st.playSound("ItemSound.quest_middle")
         st.set("talk", "0")
     elif event == "32041-25.htm":
         st.set("cond", "17")
         st.playSound("ItemSound.quest_middle")
         st.giveItems(Detector, 1)
     elif event == "32041-28.htm":
         st.takeItems(Detector2, 1)
         st.set("talk", "1")
     elif event == "32041-31.htm":
         choice = st.getInt("choice")
         if choice > 1:
             htmltext = "32041-37.htm"
     elif event == "32041-32.htm":
         st.set("cond", "21")
         st.giveItems(Letter, 1)
         st.playSound("ItemSound.quest_middle")
     elif event == "32041-36.htm":
         st.set("cond", "20")
         st.playSound("ItemSound.quest_middle")
     elif event == "32046-02.htm":
         st.set("cond", "19")
         st.playSound("ItemSound.quest_middle")
     elif event == "32046-06.htm":
         st.exitQuest(False)
         st.addExpAndSp(410358, 32060)
         st.playSound("ItemSound.quest_finish")
     elif event == "32047-01.htm":
         if st.getInt("talk") + st.getInt("talk1") == 2:
             htmltext = "32047-04.htm"
         elif st.getInt("talk") + st.getInt("talk1") + st.getInt(
                 "talk2") == 6:
             htmltext = "32047-08.htm"
     elif event == "32047-02.htm":
         if st.getInt("talk") == 0:
             st.set("talk", "1")
     elif event == "32047-03.htm":
         if st.getInt("talk1") == 0:
             st.set("talk1", "1")
     elif event == "32047-05.htm":
         st.set("cond", "3")
         st.playSound("ItemSound.quest_middle")
         st.set("talk", "0")
         st.set("choice", "1")
         st.unset("talk1")
     elif event == "32047-06.htm":
         st.set("cond", "4")
         st.playSound("ItemSound.quest_middle")
         st.set("talk", "0")
         st.set("choice", "2")
         st.unset("talk1")
     elif event == "32047-07.htm":
         st.set("cond", "5")
         st.playSound("ItemSound.quest_middle")
         st.set("talk", "0")
         st.set("choice", "3")
         st.unset("talk1")
     elif event == "32047-13.htm":
         st.set("cond", "7")
         st.playSound("ItemSound.quest_middle")
     elif event == "32047-13a.htm":
         st.set("cond", "10")
         st.playSound("ItemSound.quest_middle")
     elif event == "32047-15.htm":
         if st.getInt("talk") == 0:
             st.set("talk", "1")
     elif event == "32047-15a.htm":
         if self.isSpawned == 0:
             golem = st.addSpawn(Guardian, 96977, -110625, -3280, 0, False,
                                 900000)
             golem.broadcastPacket(
                 CreatureSay(
                     golem.getObjectId(), 0, golem.getName(),
                     "You, " + st.getPlayer().getName() +
                     ", you attacked Wendy. Prepare to die!"))
             golem.setRunning()
             golem.addDamageHate(player, 0, 999)
             golem.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK,
                                        player)
             self.isSpawned = 1
         else:
             htmltext = "32047-19a.htm"
     elif event == "32047-17a.htm":
         st.set("cond", "12")
         st.playSound("ItemSound.quest_middle")
     elif event == "32047-20.htm":
         st.set("talk", "2")
     elif event == "32047-23.htm":
         st.set("cond", "13")
         st.playSound("ItemSound.quest_middle")
         st.set("talk", "0")
     elif event == "32047-25.htm":
         st.set("cond", "15")
         st.playSound("ItemSound.quest_middle")
         st.takeItems(Starstone, 1)
     elif event == "32047-30.htm":
         st.set("talk", "2")
     elif event == "32047-33.htm":
         if st.getInt("cond") == 7:
             st.set("cond", "8")
             st.set("talk", "0")
             st.playSound("ItemSound.quest_middle")
         elif st.getInt("cond") == 8:
             st.set("cond", "9")
             st.playSound("ItemSound.quest_middle")
             htmltext = "32047-34.htm"
     elif event == "32047-34.htm":
         st.set("cond", "9")
         st.playSound("ItemSound.quest_middle")
     elif event == "32047-38.htm":
         st.giveItems(Starstone2, 1)
         st.takeItems(57, 3000)
         st.set("cond", "26")
         st.playSound("ItemSound.quest_middle")
     elif event == "32050-02.htm":
         st.playSound("ItemSound.armor_wood_3")
         st.set("talk", "1")
     elif event == "32050-04.htm":
         st.set("cond", "14")
         st.giveItems(Starstone, 1)
         st.playSound("ItemSound.quest_middle")
         st.set("talk", "0")
     return htmltext
Ejemplo n.º 27
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
Ejemplo 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
Ejemplo n.º 29
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "31349-02.htm":
         st.playSound("ItemSound.quest_accept")
         st.set("cond", "1")
         st.setState(STARTED)
     elif event == "31349-03.htm":
         if st.getQuestItemsCount(SuspiciousTotem):
             htmltext = "31349-05.htm"
         else:
             st.playSound("ItemSound.quest_middle")
             st.set("cond", "2")
     elif event == "31349-10.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "4")
     elif event == "31348-02.htm":
         st.takeItems(SuspiciousTotem, -1)
     elif event == "31348-07.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "5")
         st.giveItems(GemstoneKey, 1)
     elif event == "31522-04.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "6")
     elif event == "31535-03.htm":
         if st.getInt("step") == 0:
             st.set("step", "1")
             triol = st.addSpawn(Triol, 59712, -47568, -2712, 0, 0, 300000,
                                 1)
             time.sleep(1)
             triol.broadcastPacket(
                 CreatureSay(
                     triol.getObjectId(), 0, triol.getName(),
                     "That box was sealed by my master. Don't touch it!"))
             triol.setRunning()
             triol.addDamageHate(player, 0, 999)
             triol.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK,
                                        player)
             st.playSound("ItemSound.quest_middle")
             st.set("cond", "7")
         elif st.getInt("step") == 2:
             htmltext = "31535-04.htm"
     elif event == "31535-05.htm":
         st.giveItems(Contract, 1)
         st.takeItems(GemstoneKey, -1)
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "9")
     elif event == "31532-02.htm":
         st.takeItems(Contract, -1)
     elif event == "31532-06.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "11")
     elif event == "31531-02.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "12")
         st.addSpawn(Coffin, 60104, -35820, -664, 0, 0, 20000, 1)
     elif event == "31532-18.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "15")
     elif event == "31522-12.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "16")
     elif event == "31348-10.htm":
         st.takeItems(TotemDoll, -1)
     elif event == "31348-15.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "17")
     elif event == "31348-16.htm":
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "18")
     elif event == "31532-20.htm":
         st.giveItems(905, 2)
         st.giveItems(874, 1)
         st.takeItems(7063, -1)
         st.addExpAndSp(572277, 53750)
         st.unset("cond")
         st.exitQuest(False)
         st.playSound("ItemSound.quest_finish")
     elif event == "31522-15.htm":
         st.giveItems(936, 1)
         st.giveItems(874, 1)
         st.takeItems(7063, -1)
         st.addExpAndSp(572277, 53750)
         st.unset("cond")
         st.exitQuest(False)
         st.playSound("ItemSound.quest_finish")
     return htmltext
Ejemplo n.º 30
0
    def spawnNext(self, npc, growthLevel, player, food):
        npcId = npc.getNpcId()
        nextNpcId = 0

        # find the next mob to spawn, based on the current npcId, growthlevel, and food.
        if growthLevel == 2:
            rand = Rnd.get(2)
            # if tamed, the mob that will spawn depends on the class type (fighter/mage) of the player!
            if rand == 1:
                if player.getClassId().isMage():
                    nextNpcId = self.growthCapableMobs[npcId][1][food][1][1]
                else:
                    nextNpcId = self.growthCapableMobs[npcId][1][food][1][0]

            # if not tamed, there is a small chance that have "mad cow" disease.
            # that is a stronger-than-normal animal that attacks its feeder
            else:
                if Rnd.get(5) == 0:
                    nextNpcId = self.growthCapableMobs[npcId][1][food][0][1]
                else:
                    nextNpcId = self.growthCapableMobs[npcId][1][food][0][0]
        # all other levels of growth are straight-forward
        else:
            nextNpcId = self.growthCapableMobs[npcId][1][food][Rnd.get(
                len(self.growthCapableMobs[npcId][1][food]))]

        # remove the feedinfo of the mob that got despawned, if any
        if self.feedInfo.has_key(npc.getObjectId()):
            if self.feedInfo[npc.getObjectId()] == player.getObjectId():
                self.feedInfo.pop(npc.getObjectId())

        # despawn the old mob
        if self.growthCapableMobs[npcId][0] == 0:
            npc.onDecay()
        else:
            npc.deleteMe()

        # if this is finally a trained mob, then despawn any other trained mobs that the
        # player might have and initialize the Tamed Beast.
        if nextNpcId in self.tamedBeasts:
            oldTrained = player.getTrainedBeast()
            if oldTrained:
                oldTrained.doDespawn()

            #the following 5 commented lines are not needed, but they provide a plausible alternate implementation...just in case...
            #nextNpc = self.addSpawn(nextNpcId,npc)
            #nextNpc.setOwner(player)
            #nextNpc.setFoodType(foodSkill[food])
            #nextNpc.setHome(npc)

            template = NpcTable.getInstance().getTemplate(nextNpcId)
            nextNpc = L2TamedBeastInstance(IdFactory.getInstance().getNextId(),
                                           template, player, foodSkill[food],
                                           npc.getX(), npc.getY(), npc.getZ())
            nextNpc.setRunning()

            objectId = nextNpc.getObjectId()

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

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

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

            if nextNpcId in self.madCowPolymorph:
                self.startQuestTimer("polymorph Mad Cow", 10000, nextNpc,
                                     player)

            # register the player in the feedinfo for the mob that just spawned
            self.feedInfo[nextNpc.getObjectId()] = player.getObjectId()
            nextNpc.setRunning()
            nextNpc.addDamageHate(player, 0, 99999)
            nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK,
                                         player)