def onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(100): return npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "清除入侵者。")) else: self.FirstAttacked = True npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "發現非法的目標。")) npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "開始入侵者清除系統。")) return
def onTalk(self, npc, player): st = player.getQuestState(qn) npcId = npc.getNpcId() if not st: return ################### # Start Locations # ################### if TELEPORTERS.has_key(npcId): random_id = st.getRandom(len(ISLE_LOCS)) x, y, z = ISLE_LOCS[random_id][0], ISLE_LOCS[random_id][ 1], ISLE_LOCS[random_id][2] st.getPlayer().teleToLocation(x, y, z) st.setState(State.STARTED) st.set("id", str(TELEPORTERS[npcId])) ################ # Fantasy Isle # ################ elif npcId == PADDIES: if st.getState() == State.STARTED and st.getInt("id"): # back to start location return_id = st.getInt("id") - 1 st.getPlayer().teleToLocation(RETURN_LOCS[return_id][0], RETURN_LOCS[return_id][1], RETURN_LOCS[return_id][2]) st.unset("id") else: # no base location founded (player swimmed) player.sendPacket( NpcSay( npc.getObjectId(), 0, npc.getNpcId(), "You've arrived here from a different way. I'll send you to Rune Township which is the nearest town." )) st.getPlayer().teleToLocation(43835, -47749, -792) st.exitQuest(1) return
def onKill(self, npc, player, isPet): leaderst = leader(player) if not leaderst: return if not leaderst.getState() == State.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( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "###### 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
def onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == self.Core: objId = npc.getObjectId() npc.broadcastPacket( PlaySound(1, "BS02_D", 1, objId, npc.getX(), npc.getY(), npc.getZ())) npc.broadcastPacket(NpcSay(objId, 0, npcId, "出現致命的錯誤。")) npc.broadcastPacket(NpcSay(objId, 0, npcId, "系統即將關閉...")) npc.broadcastPacket(NpcSay(objId, 0, npcId, "......")) self.FirstAttacked = False self.addSpawn(31842, 16502, 110165, -6394, 0, False, 900000) self.addSpawn(31842, 18948, 110166, -6397, 0, False, 900000) elif self.FirstAttacked: self.addSpawn(npcId, 17726, 108915, -6480, npc.getHeading(), True, 0) return
def onKill(self, npc, player, isPet): st = player.getQuestState(qn) if not st: return npcId = npc.getNpcId() if st.getState() == State.STARTED and st.getInt("cond") == 10: if npcId == Guardian: npc.broadcastPacket( NpcSay( npc.getObjectId(), 0, npcId, "This enemy is far too powerful for me to fight. I must withdraw" )) st.set("cond", "11") st.playSound("ItemSound.quest_middle")
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(State.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( NpcSay(ghost.getObjectId(), 0, ghost.getNpcId(), "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
def onKill(self,npc,player,isPet): st = player.getQuestState(qn) if not st : return if st.getState() != State.STARTED : return npcId = npc.getNpcId() cond = st.getInt("cond") if npcId == Angel and cond == 12: st.set("angel","1") self.isAngelSpawned = 0 npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),"Grr. I've been hit...")) if self.isKatenarSpawned == 0 : katenar = st.addSpawn(32242,36110,191921,-3712,60000) katenar.broadcastPacket(NpcSay(katenar.getObjectId(),0,katenar.getNpcId(),"I am late!")) self.isKatenarSpawned == 1 self.startQuestTimer("katenar_cleanup",60000,katenar,player) if npcId == Wyrm and st.getQuestItemsCount(Heart) < 10 and cond == 15 and st.getRandom(100) <= 25: if st.getQuestItemsCount(Heart) == 9 : st.giveItems(Heart,1) st.set("cond","16") st.playSound("ItemSound.quest_middle") else : st.giveItems(Heart,1) st.playSound("ItemSound.quest_itemget") return
def onAttack(self, npc, player, damage, isPet) : st = player.getQuestState(str(QUEST_NUMBER)+"_"+QUEST_NAME) if not st: return npcId = npc.getNpcId() for pc, mobId, in self.killedTrees: if pc == player and mobId == npcId: return if isPet : pet = player.getPet() if st.getRandom(100) <= 2 and st.getQuestItemsCount(FT_LEAF) >= 0: st.takeItems(FT_LEAF,1) st.playSound("ItemSound.quest_middle") npc.broadcastPacket(NpcSay(npc.getNpcId(),0,npcId,"gives me spirit leaf...!")) self.killedTrees.append([player,npcId]) if st.getQuestItemsCount(FT_LEAF) == 0 : st.set("cond","3") return
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() != State.STARTED : 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(NpcSay(spawnedNpc.getObjectId(),0,spawnedNpc.getNpcId(),"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
def AutoChat(npc, text): chars = npc.getKnownList().getKnownPlayers().values().toArray() if chars != None: for pc in chars: sm = NpcSay(npc.getObjectId(), 0, npc.getNpcId(), text) pc.sendPacket(sm)
def onKill(self, npc, player, isPet): st = player.getQuestState(qn) if not st: return id = st.getState() npcId = npc.getNpcId() cond = st.getInt("cond") #incipios drop skins = st.getQuestItemsCount(TD_BCK_SKN) if id == State.STARTED and cond < 5 and ( st.getQuestItemsCount(FSN_LIST) == 1 and skins < 10) or ( st.getQuestItemsCount(FSN_LIST_DLX) == 1 and skins < 20): if npcId == TD_LORD: count = 0 if st.getQuestItemsCount(FSN_LIST) == 1: count = 10 else: count = 20 numItems, chance = divmod(BACK_DROP * Config.RATE_DROP_QUEST, 100) if st.getRandom(100) <= chance: numItems += 1 numItems = int(numItems) if numItems != 0: if count <= (skins + numItems): numItems = count - skins st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") st.giveItems(TD_BCK_SKN, numItems) #dragon detection elif id == State.STARTED and cond >= 5 and (st.get("progress") in [ "14", "15", "21", "22" ]): whom = int(st.get("dragon")) if whom == 1: eggs = EX_EGG scale = SCALE_1 eggdropper = LO_LZRD_W elif whom == 2: eggs = ZW_EGG scale = SCALE_2 eggdropper = MS_SPIDER elif whom == 3: eggs = KA_EGG scale = SCALE_3 eggdropper = RD_SCVNGR elif whom == 4: eggs = SU_EGG scale = SCALE_4 eggdropper = BO_OVERLD elif whom == 5: eggs = SH_EGG scale = SCALE_5 eggdropper = DD_SEEKER prevItems = st.getQuestItemsCount(eggs) if st.getQuestItemsCount(scale) == 1 and prevItems < REQUIRED_EGGS: if npcId == eggdropper: chance = EGG_DROP * Config.RATE_DROP_QUEST numItems, chance = divmod(chance, 100) if st.getRandom(100) <= chance: numItems += 1 numItems = int(numItems) if numItems != 0: if REQUIRED_EGGS <= (prevItems + numItems): numItems = REQUIRED_EGGS - prevItems st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") st.giveItems(eggs, numItems) npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "If the eggs get taken, we're dead!")) #fairy stone destruction elif id == State.STARTED and cond < 5 and st.getQuestItemsCount( FRY_STN_DLX) == 1: if npcId in range(20589, 20600) + [20719]: st.takeItems(FRY_STN_DLX, 1) st.set("progress", "7") return "你失去了純白妖精石!"
def AutoChat(self, npc, text, type): sm = NpcSay(npc.getObjectId(), type, npc.getNpcId(), text) npc.broadcastPacket(sm)
def onAdvEvent (self,event,npc,player): st = player.getQuestState(qn) if not st : return htmltext = event if event == "31522-02.htm": st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") st.set("cond","1") elif event == "31328-05.htm": st.set("cond","0") st.set("onlyone","1") st.unset("AGRIPEL") st.unset("DOMINIC") st.unset("BENEDICT") st.exitQuest(False) st.takeItems(7140,-1) if st.getQuestItemsCount(7141) == 0 : st.giveItems(7141,1) st.playSound("ItemSound.quest_finish") htmltext = "31328-05.htm" elif event == "31523-03.htm" : st.playSound("SkillSound5.horror_02") st.set("cond","2") ghost = st.addSpawn(31524,51432,-54570,-3136,1800000) ghost.broadcastPacket(NpcSay(ghost.getObjectId(),0,ghost.getNpcId(),"Who awoke me?")) elif event == "31524-06.htm" : st.set("cond","3") st.playSound("ItemSound.quest_middle") ghost = self.addSpawn(31525,npc) ghost.broadcastPacket(NpcSay(ghost.getObjectId(),0,ghost.getNpcId(),"My master has instructed me to be your guide, "+ player.getName())) self.startQuestTimer("1",1,ghost,player) self.startQuestTimer("despawn",1800000,ghost,player) elif event == "31526-03.htm" : st.playSound("ItemSound.item_drop_equip_armor_cloth") elif event == "31526-08.htm" : st.playSound("AmdSound.ed_chimes_05") st.set("cond","5") st.playSound("ItemSound.quest_middle") elif event == "31526-14.htm" : st.giveItems(7140,1) st.set("cond","6") st.playSound("ItemSound.quest_middle") elif event == "despawn" : npc.deleteMe() return elif event.isdigit() : loc = int(event) x,y,z,heading=ROUTES[loc] if event == "1" : npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x,y,z,heading)) self.startQuestTimer("2",5000,npc,player) elif event == "2" : npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x,y,z,heading)) self.startQuestTimer("3",12000,npc,player) elif event == "3" : npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x,y,z,heading)) self.startQuestTimer("4",15000,npc,player) elif event == "4" : npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x,y,z,heading)) self.startQuestTimer("5",5000,npc,player) elif event == "5" : npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x,y,z,heading)) return return htmltext
def autochat(npc, text): if npc: npc.broadcastPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), text)) return
def onTalk (self,npc,player): htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>" st = player.getQuestState(qn) if not st : return htmltext npcId = npc.getNpcId() id = st.getState() cond = st.getInt("cond") if id == State.COMPLETED : htmltext = "<html><body>This quest has already been completed.</body></html>" elif npcId == Vitus : if player.getClassId().getId() not in [125,126] or player.getLevel() < 39: htmltext = "<html><body>Only Troopers or Warders are allowed to take this quest! Go away before I get angry!<br>You must be level 39 or higher to undertake this quest.</body></html>" st.exitQuest(1) elif id == State.CREATED : htmltext = "32213-01.htm" elif cond >= 1 and cond <= 3 : htmltext = "32213-04.htm" elif cond >= 4 and cond <17 : htmltext = "32213-05.htm" elif cond == 17 and st.getQuestItemsCount(Recommend) == 1 : htmltext = "32213-06.htm" player.sendPacket(SocialAction(player.getObjectId(),3)) st.takeItems(Recommend,-1) st.giveItems(certificate,1) st.exitQuest(False) st.playSound("ItemSound.quest_finish") st.addExpAndSp(189831,21526) elif npcId == Kekropus : if cond == 1 : htmltext = "32138-00.htm" elif cond == 2 : htmltext = "32138-04.htm" elif cond == 14 : htmltext = "32138-05.htm" elif cond == 15 : htmltext = "32138-07.htm" elif cond == 16 : htmltext = "32138-08.htm" elif cond == 17 : htmltext = "32138-12.htm" elif npcId == Casca : if cond == 2 : htmltext = "32139-01.htm" elif cond == 3 : htmltext = "32139-03.htm" elif cond == 4 : htmltext = "32139-05.htm" elif cond == 13 : htmltext = "32139-06.htm" elif cond == 14 : htmltext = "32139-09.htm" elif npcId == Holst : if cond == 4 : htmltext = "32199-01.htm" elif cond == 5 : htmltext = "32199-03.htm" st.set("cond","6") st.playSound("ItemSound.quest_middle") elif cond == 6 : htmltext = "32199-04.htm" elif npcId == Harlan : if cond == 6 : htmltext = "30074-01.htm" elif cond == 7 : htmltext = "30074-02.htm" elif npcId == Jacob : if cond == 6 : htmltext = "30073-01.htm" st.set("cond","7") st.playSound("ItemSound.quest_middle") elif cond == 7 : htmltext = "30073-02.htm" elif npcId == Lucas : if cond == 7 : htmltext = "30071-01.htm" elif cond == 8 : htmltext = "30071-03.htm" elif npcId == Xaber : if cond == 8 : htmltext = "30075-01.htm" elif cond == 9 : htmltext = "30075-02.htm" elif npcId == Liam : if cond == 8 : htmltext = "30076-01.htm" st.set("cond","9") st.playSound("ItemSound.quest_middle") elif cond == 9 : htmltext = "30076-02.htm" elif npcId == Zerome : if cond == 9 : htmltext = "30124-01.htm" elif cond == 10 : htmltext = "30124-02.htm" elif npcId == Vesa : if cond == 9 : htmltext = "30123-01.htm" st.set("cond","10") st.playSound("ItemSound.quest_middle") elif cond == 10 : htmltext = "30123-02.htm" elif npcId == Meldina : if cond == 10 : htmltext = "32214-01.htm" elif cond == 11 : htmltext = "32214-03.htm" elif npcId == Felton : if cond == 11 : htmltext = "30879-01.htm" elif cond == 12 : htmltext = "30879-04.htm" elif npcId == CargoBox : if cond == 12 : htmltext = "32243-01.htm" if st.getInt("angel") == 0 and self.isAngelSpawned == 0 : angel = st.addSpawn(27332,36198,191949,-3728,180000) angel.broadcastPacket(NpcSay(angel.getObjectId(),0,angel.getNpcId(),player.getName()+"! Step back from the confounded box! I will take it myself!")) angel.setRunning() angel.addDamageHate(player,0,999) angel.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player) self.isAngelSpawned = 1 self.startQuestTimer("angel_cleanup",180000,angel,player) elif self.isKatenarSpawned == 0 and st.getInt("angel") == 1: katenar = st.addSpawn(32242,36110,191921,-3712,60000) katenar.broadcastPacket(NpcSay(katenar.getObjectId(),0,katenar.getNpcId(),"I am late!")) self.isKatenarSpawned == 1 self.startQuestTimer("katenar_cleanup",60000,katenar,player) htmltext = "32243-02.htm" elif cond == 13 : htmltext = "32243-03.htm" return htmltext
def onSkillSee(self, npc, player, skill, targets, isPet): # this behavior is only run when the target of skill is the passed npc (chest) # i.e. when the player is attempting to open the chest using a skill if not npc in targets: return # 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( NpcSay( objectId, 0, npc.getNpcId(), 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( NpcSay(objectId, 0, npc.getNpcId(), mytext[Rnd.get(len(mytext))])) return
def onKill(self, npc, player, isPet): st = player.getQuestState(qn) if not st: return if st.getState() != State.STARTED: return npcId = npc.getNpcId() if npcId == 20479: st.set("id", "0") if st.getInt("cond") and st.getQuestItemsCount( FIRE_CHARM ) == 1 and st.getQuestItemsCount(KASHA_BEAR_PELT) < 1: if st.getQuestItemsCount( KASHA_BEAR_PELT) + st.getQuestItemsCount( KASHA_BSPIDER_HUSK) + st.getQuestItemsCount( FIERY_EGG1) == 2: st.giveItems(KASHA_BEAR_PELT, 1) st.playSound("ItemSound.quest_middle") st.set("cond", "2") else: st.giveItems(KASHA_BEAR_PELT, 1) st.playSound("ItemSound.quest_itemget") elif npcId == 27319: if st.getInt("cond") == 14: st.set("cond", "15") st.playSound("ItemSound.quest_middle") npc.broadcastPacket( NpcSay( npc.getObjectId(), 0, npc.getNpcId(), "My dear friend of " + player.getName() + ", who has gone on ahead of me!")) elif st.getInt("cond") == 16: st.set("cond", "17") st.playSound("ItemSound.quest_middle") npc.broadcastPacket( NpcSay( npc.getObjectId(), 0, npc.getNpcId(), "Listen to Tejakar Gandi, young Oroka! The spirit of the slain leopard is calling you, " + player.getName() + "!")) elif st.getInt("cond") == 18: st.set("cond", "19") st.playSound("ItemSound.quest_middle") elif npcId == 20478: st.set("id", "0") if st.getInt("cond") and st.getQuestItemsCount( FIRE_CHARM ) == 1 and st.getQuestItemsCount(KASHA_BSPIDER_HUSK) < 1: if st.getQuestItemsCount( KASHA_BEAR_PELT) + st.getQuestItemsCount( KASHA_BSPIDER_HUSK) + st.getQuestItemsCount( FIERY_EGG1) == 2: st.giveItems(KASHA_BSPIDER_HUSK, 1) st.playSound("ItemSound.quest_middle") st.set("cond", "2") else: st.giveItems(KASHA_BSPIDER_HUSK, 1) st.playSound("ItemSound.quest_itemget") elif npcId == 20415: st.set("id", "0") if st.getInt("cond") and st.getQuestItemsCount( FIRE_CHARM) == 1 and st.getQuestItemsCount(FIERY_EGG1) < 1: if st.getQuestItemsCount( KASHA_BEAR_PELT) + st.getQuestItemsCount( KASHA_BSPIDER_HUSK) + st.getQuestItemsCount( FIERY_EGG1) == 2: st.giveItems(FIERY_EGG1, 1) st.playSound("ItemSound.quest_middle") st.set("cond", "2") else: st.giveItems(FIERY_EGG1, 1) st.playSound("ItemSound.quest_itemget") elif npcId == 20335: st.set("id", "0") if st.getInt("cond") and st.getQuestItemsCount( FLAME_CHARM ) == 1 and st.getQuestItemsCount(GRIZZLY_BLOOD) < 3: if st.getQuestItemsCount(GRIZZLY_BLOOD) == 2: st.giveItems(GRIZZLY_BLOOD, 1) st.playSound("ItemSound.quest_middle") st.set("cond", "7") else: st.giveItems(GRIZZLY_BLOOD, 1) st.playSound("ItemSound.quest_itemget") elif npcId == 20038: st.set("id", "0") if st.getInt("cond") and st.getQuestItemsCount( SPIRIT_NET) == 1 and st.getQuestItemsCount( BOUND_DURKA_SPIRIT ) == 0 and st.getQuestItemsCount(DURKA_PARASITE) < 8: n = st.getRandom(10) if st.getQuestItemsCount(DURKA_PARASITE) == 5 and n < 1: st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) st.addSpawn(27056) st.playSound("ItemSound.quest_itemget") elif st.getQuestItemsCount(DURKA_PARASITE) == 6 and n < 2: st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) st.playSound("ItemSound.quest_itemget") st.addSpawn(27056) elif st.getQuestItemsCount(DURKA_PARASITE) == 7 and n < 2: st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) st.playSound("ItemSound.quest_itemget") st.addSpawn(27056) elif st.getQuestItemsCount(DURKA_PARASITE) >= 7: st.addSpawn(27056) st.playSound("ItemSound.quest_itemget") st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) else: st.giveItems(DURKA_PARASITE, 1) st.playSound("ItemSound.quest_itemget") elif npcId == 20043: st.set("id", "0") if st.getInt("cond") and st.getQuestItemsCount( SPIRIT_NET) == 1 and st.getQuestItemsCount( BOUND_DURKA_SPIRIT ) == 0 and st.getQuestItemsCount(DURKA_PARASITE) < 8: n = st.getRandom(10) if st.getQuestItemsCount(DURKA_PARASITE) == 5 and n < 1: st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) st.addSpawn(27056) st.playSound("ItemSound.quest_itemget") elif st.getQuestItemsCount(DURKA_PARASITE) == 6 and n < 2: st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) st.playSound("ItemSound.quest_itemget") st.addSpawn(27056) elif st.getQuestItemsCount(DURKA_PARASITE) == 7 and n < 2: st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) st.playSound("ItemSound.quest_itemget") st.addSpawn(27056) elif st.getQuestItemsCount(DURKA_PARASITE) >= 7: st.addSpawn(27056) st.playSound("ItemSound.quest_itemget") st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) else: st.giveItems(DURKA_PARASITE, 1) st.playSound("ItemSound.quest_itemget") elif npcId == 27056: st.set("id", "0") if st.getInt("cond") and st.getQuestItemsCount( SPIRIT_NET) == 1 and st.getQuestItemsCount( BOUND_DURKA_SPIRIT) == 0: st.giveItems(BOUND_DURKA_SPIRIT, 1) st.takeItems(SPIRIT_NET, 1) st.takeItems(DURKA_PARASITE, st.getQuestItemsCount(DURKA_PARASITE)) st.playSound("ItemSound.quest_middle") st.set("cond", "10") return
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(State.STARTED) 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)[0] for i in members: pst = QuestManager.getInstance().getQuest(qn).newQuestState(st.getPlayer().getClan().getClanMember(int(i)).getPlayerInstance()) pst.setState(State.STARTED) 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(NpcSay(spawnedNpc.getObjectId(),0,spawnedNpc.getNpcId(),"Blood and Honour.")) spawnedNpc=st.addSpawn(30759,160665,21209,-3710,90000) spawnedNpc.broadcastPacket(NpcSay(spawnedNpc.getObjectId(),0,spawnedNpc.getNpcId(),"Ambition and Power")) spawnedNpc=st.addSpawn(30758,160665,21291,-3710,90000) spawnedNpc.broadcastPacket(NpcSay(spawnedNpc.getObjectId(),0,spawnedNpc.getNpcId(),"War and Death")) elif event == "30766-08.htm": st.takeItems(Scepter_Judgement,-1) exit503(0,st) return htmltext
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(State.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.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( NpcSay( golem.getObjectId(), 0, golem.getNpcId(), "You, " + player.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
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( NpcSay( objectId, 0, nextNpc.getNpcId(), player.getName() + ", will you show me your hideaway?")) elif rand == 1: npc.broadcastPacket( NpcSay( objectId, 0, nextNpc.getNpcId(), player.getName() + ", whenever I look at spice, I think about you.")) elif rand == 2: npc.broadcastPacket( NpcSay( objectId, 0, nextNpc.getNpcId(), player.getName() + ", you do not need to return to the village. I will give you strength" )) elif rand == 3: npc.broadcastPacket( NpcSay( objectId, 0, nextNpc.getNpcId(), "Thanks, " + player.getName() + ". I hope I can help you")) elif rand == 4: npc.broadcastPacket( NpcSay(objectId, 0, nextNpc.getNpcId(), 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)