def onAdvEvent(self, event, npc, pc): if event == "actions": sayNpc = self.addSpawn(32549, -185612, 240750, 1569, 0, False, 0) self.startQuestTimer("say", 60000, sayNpc, None, True) self.startQuestTimer("REPORT1", 40000, sayNpc, None) yy = -31 for x in range(-184975, -185530, -95): yy += 31 xx = 0 for y in range(240860, 241085, 88): actNpc = self.addSpawn(32619, x - xx, y - yy, 1570, 37600, False, 0) xx += 27 actNpc.setIsParalyzed(True) self.startQuestTimer("act", 60000, actNpc, None, True) elif event == "say": npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "實施3次刺擊!")) elif event in REPORTS.keys(): check, report, nextEvent = REPORTS[event] self.isCheck = check npc.broadcastPacket( NpcSay(npc.getObjectId(), 1, npc.getNpcId(), report)) self.startQuestTimer(nextEvent, 300000, npc, None) elif event == "act": self.startQuestTimer("act1", 3000, npc, None) self.startQuestTimer("act2", 7000, npc, None) self.startQuestTimer("act3", 11000, npc, None) elif event == "act1": npc.broadcastPacket(SocialAction(npc.getObjectId(), 4)) elif event == "act2": npc.broadcastPacket(SocialAction(npc.getObjectId(), 4)) elif event == "act3": npc.broadcastPacket(SocialAction(npc.getObjectId(), 4)) return
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, skill) : objId = npc.getObjectId() if self.FirstAttacked : if Rnd.get(40) : return npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), TEXT[Rnd.get(2)])) else : self.FirstAttacked = True npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), TEXT[Rnd.get(2)])) return
def onAttack(self, npc, player, damage, isPet, skill): objId = npc.getObjectId() if npc.getNpcId() == GARGOS: if self.FirstAttacked: if Rnd.get(50): return npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "開...開...始...")) else: self.FirstAttacked = True if Rnd.get(50): return npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "開...開...始...")) 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 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(),"你是用其它的方法來到這裡,因此將傳送到最近的魯因城鎮。")) st.getPlayer().teleToLocation(43835,-47749,-792) st.exitQuest(1) return
def checkBelethSample(self, world, npc, player, BS): world.attacked = True for mob in world.FifthRoom.npclist: if mob[0] == npc: if mob[2] == 0: world.foundBeleth = 0 npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), TEXT[Rnd.get(9, 10)])) for mob in world.FifthRoom.npclist: if mob[0] != npc: mob[0].deleteMe() else: world.foundBeleth += 1 npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), TEXT[Rnd.get(11, 13)]))
def onAdvEvent (self,event,npc,player): if event == "timer" or event =="timer2": if self.npcobject[npc.getObjectId()].correct == False: dx = npc.getX() - 142999 dy = npc.getY() - 151671 d = dx * dx + dy * dy if d < 10000: npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0)) self.npcobject[npc.getObjectId()].correct = True self.worlds[npc.getInstanceId()].correct = self.worlds[npc.getInstanceId()].correct +1 if self.npcobject[npc.getObjectId()].correct == False: dx = npc.getX() - 139494 dy = npc.getY() - 151668 d = dx * dx + dy * dy if d < 10000: npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0)) self.npcobject[npc.getObjectId()].correct = True self.worlds[npc.getInstanceId()].correct = self.worlds[npc.getInstanceId()].correct +1 if self.worlds[npc.getInstanceId()].correct>=2: for door in InstanceManager.getInstance().getInstance(npc.getInstanceId()).getDoors(): if door.getDoorId() == 24220026: door.openMe() return if self.npcobject[npc.getObjectId()].lastitem: L2World.getInstance().removeVisibleObject(self.npcobject[npc.getObjectId()].lastitem, self.npcobject[npc.getObjectId()].lastitem.getWorldRegion()) L2World.getInstance().removeObject(self.npcobject[npc.getObjectId()].lastitem) if len(self.npcobject[npc.getObjectId()].walklist_order)==0: return for item in self.npcobject[npc.getObjectId()].walklist_order: crystal = self.npcobject[npc.getObjectId()].walklist[item] newpos = L2CharPosition(crystal.getX(), crystal.getY(), crystal.getZ(), 0) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, newpos) self.npcobject[npc.getObjectId()].lastitem = crystal self.npcobject[npc.getObjectId()].walklist_order.remove(item) npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),"小氣鬼,只分一個給我!真是絕情耶~ ...")) break; if(len(self.npcobject[npc.getObjectId()].walklist_order))>0: if event == "timer": self.startQuestTimer("timer2",2000,npc,None) else: self.startQuestTimer("timer",2000,npc,None) else: if self.npcobject[npc.getObjectId()].last == False: self.npcobject[npc.getObjectId()].last = True if event == "timer": self.startQuestTimer("timer2",2000,npc,None) else: self.startQuestTimer("timer",2000,npc,None) return
def onKill(self,npc,player,isPet): st = player.getQuestState(qn) if not st : return if st.getState() != State.STARTED : return if st.getInt("cond") == 7: st.playSound("ItemSound.quest_itemget") st.set("cond","8") npc.broadcastPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "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
def onAdvEvent(self, event, npc, pc): if event == "timer_check": sayNpc = self.addSpawn(self.SHADAI, 9041, 253010, -1938, 49909, False, 2410000) autochat(sayNpc, "誰會成為今晚的幸運兒呢?哈哈!真是好奇,真是好奇!") self.startQuestTimer("REPORT1", 600000, sayNpc, None) elif event in REPORTS.keys(): check, report, nextEvent = REPORTS[event] self.isCheck = check npc.broadcastPacket( NpcSay(npc.getObjectId(), 1, npc.getNpcId(), report)) self.startQuestTimer(nextEvent, 600000, npc, None) 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 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(),"是誰叫醒我。")) 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 onTalk (self, npc, player) : npcId = npc.getNpcId() st = player.getQuestState(qn) if not st : st = self.newQuestState(player) if npcId == TRAITOR : if st.getQuestItemsCount(9676) >= 10 : st.takeItems(9676,10) DoorTable.getInstance().getDoor(D1).openMe() self.startQuestTimer("Close_Door1",600000,None,None) DoorTable.getInstance().getDoor(D2).openMe() self.startQuestTimer("Close_Door2",600000,None,None) npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),"好吧,雷歐達斯現在就是你的了!")) htmltext = "" else : htmltext = "32364-1.htm" st.exitQuest(1) return htmltext
def onKill(self, npc, player, isPet): self.cancelQuestTimer("npc_cleanup", None, None) self.isNpcSpawned = 0 st = player.getQuestState(qn) if not st: return if st.getState() != State.STARTED: return npcId = npc.getNpcId() cond = st.getInt("cond") if npcId == 27340 and cond == 1: string = "沒想到會這麼強,我失算了。" if st.getRandom(1): string = "算你走運,我會回來的。" npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), string)) st.giveItems(10867, 1) st.set("cond", "2") st.playSound("ItemSound.quest_middle") return
def onAttack(self, npc, player, damage, isPet, skill) : st = player.getQuestState(qn) if not st: return npcId = npc.getNpcId() for pc, mobId, in self.killedTrees: if pc == player and mobId == npcId: return if isPet and st.getInt("id") < 16: 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("id","15") st.set("cond","3") return
def runFifthRoom(self, world, player): world.status = 9 world.foundBeleth = 0 world.attacked = False openDoor(D6, world.instanceId) world.FifthRoom = PyObject() world.FifthRoom.npclist = [] a, b, c, d, e, f, g = beleths[Rnd.get(len(beleths))] world.FifthRoom.belethOrder = [] world.FifthRoom.belethOrder.append([a, b, c, d, e, f, g]) temp = [a, b, c, d, e, f, g] idx = 0 for x in range(148720, 149175, 65): newNpc = self.addSpawn(BS[idx], x, 182145, -6117, 48810, False, 0, False, world.instanceId) world.FifthRoom.npclist.append([newNpc, idx, temp[idx]]) if temp[idx] == 1 and Rnd.get(100) < 50: newNpc.broadcastPacket( NpcSay(newNpc.getObjectId(), 0, newNpc.getNpcId(), TEXT[Rnd.get(8)])) idx += 1 if debug: print "DarkCloudMansion: spawned fifth room" if debug: print str(world.FifthRoom.npclist)
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(State.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(NpcSay(triol.getObjectId(), 0, triol.getNpcId(), "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
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 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 onAdvEvent (self,event,npc, player) : st = player.getQuestState(qn) if not st: return htmltext = event if event == "30621-01.htm": if player.getLevel() < 40 : htmltext = "30621-00.htm" elif event == "30621-04.htm" : st.playSound("ItemSound.quest_accept") st.set("cond","1") st.giveItems(NicolasMap,1) elif event == "30673-03.htm" : st.playSound("ItemSound.quest_middle") st.set("cond","2") st.takeItems(NicolasMap,-1) elif event == "30673-05.htm" : st.playSound("ItemSound.quest_middle") st.set("cond","3") elif event == "30673-09.htm" : if st.getQuestItemsCount(BrokenMetal) : htmltext = "30673-10.htm" elif st.getQuestItemsCount(Metal) : st.giveItems(Certificate,1) if player.getLevel() < 50 : st.addExpAndSp(203717,14032) st.giveItems(57,72527) st.exitQuest(False) st.playSound("ItemSound.quest_finish") elif event == "32366-02.htm" : alarm = st.addSpawn(32367,16491,113563,-9064) st.set("step","1") st.playSound("ItemSound3.sys_siren") self.startQuestTimer("1",60000, alarm, player) time.sleep(1) player.sendPacket(NpcSay(alarm.getObjectId(), 0, alarm.getNpcId(), "發現入侵者,為避免情報洩漏,將在2分鐘後進行紀錄裝置的爆破。")) elif event == "32366-05.htm" : st.unset("step") st.playSound("ItemSound.quest_middle") st.set("cond","5") st.giveItems(BrokenMetal,1) elif event == "32366-06.htm" : st.unset("step") st.playSound("ItemSound.quest_middle") st.set("cond","4") st.giveItems(Metal,1) elif event == "32367-02.htm" : st.set("pass","0") elif event[0:7] == "correct" : st.set("pass",str(st.getInt("pass")+1)) htmltext = event[8:] if htmltext == "32367-07.htm": if st.getInt("pass") == 4 : st.set("step","3") self.cancelQuestTimer("1",npc,player) self.cancelQuestTimer("2",npc,player) self.cancelQuestTimer("3",npc,player) self.cancelQuestTimer("4",npc,player) st.unset("pass") npc.deleteMe() else : htmltext == "32367-06.htm" elif event == "1" : player.sendPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "距離紀錄裝置爆破時間還剩下60秒,若要中斷請輸入密碼。")) self.startQuestTimer("2",30000, npc, player) return elif event == "2" : player.sendPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "距離紀錄裝置爆破時間還剩下30秒,若要中斷請輸入密碼。")) self.startQuestTimer("3",20000, npc, player) return elif event == "3" : player.sendPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "距離紀錄裝置爆破時間還剩下10秒,若要中斷請輸入密碼。")) self.startQuestTimer("4",10000, npc, player) return elif event == "4" : player.sendPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "紀錄裝置已被摧毀。")) npc.deleteMe() st.set("step","2") return return htmltext
def autochat(npc, text): if npc: npc.broadcastPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), text)) return
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.addExpAndSp(131228, 11978) st.playSound("ItemSound.quest_finish") htmltext = "31328-05.htm" elif event == "31523-03.htm": st.playSound("SkillSound5.horror_02") st.playSound("ItemSound.quest_middle") #pmq修改 st.set("cond", "2") ghost = st.addSpawn(31524, 51432, -54570, -3136, 180000) ghost.broadcastPacket( NpcSay(ghost.getObjectId(), 0, ghost.getNpcId(), "是誰叫醒我?")) 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(), player.getName() + ",依照主人的命令,我將引導您。")) #pmq修改 self.startQuestTimer("1", 1, ghost, player) self.startQuestTimer("despawn", 180000, 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 onAdvEvent(self, event, npc, player): if event == "npc_cleanup": self.isNpcSpawned = 0 return st = player.getQuestState(qn) if not st: return htmltext = event if event == "31435-03.htm": st.set("cond", "1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") elif event == "31435-05.htm": st.set("cond", "4") st.playSound("ItemSound.quest_middle") elif event == "31435-08.htm": st.set("cond", "9") st.playSound("ItemSound.quest_middle") elif event == "32487-02.htm" and self.isNpcSpawned == 0: npc = st.addSpawn(27340, 72590, 148100, -3312, 1800000) npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), player.getName() + "! 去死吧,要怪就怪你的好奇心。")) npc.setRunning() npc.addDamageHate(st.getPlayer(), 0, 999) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, st.getPlayer()) self.isNpcSpawned = 1 self.startQuestTimer("npc_cleanup", 1800000, None, None) elif event == "32487-06.htm": st.set("cond", "8") st.playSound("ItemSound.quest_middle") st.takeItems(10868, -1) elif event == "30081-03.htm": st.set("cond", "5") st.playSound("ItemSound.quest_middle") st.takeItems(10867, -1) elif event == "30081-05.htm": st.set("cond", "6") st.playSound("ItemSound.quest_middle") elif event == "30081-08.htm": if st.getQuestItemsCount(57) >= 3000000: st.takeItems(57, 3000000) st.giveItems(10868, 1) st.set("cond", "7") st.playSound("ItemSound.quest_middle") else: htmltext = "30081-07.htm" elif event == "31092-05.htm": st.exitQuest(False) st.playSound("ItemSound.quest_finish") if player.getClassId().level() == 1: text = BYPASS[player.getClassId().getId()] htmltext = "<html><body>財富的地下商人:<br>錢的事嘛,你還是把它忘了吧...<br>我說過會幫你轉職的嘛!你想要轉職為哪一種職業呢?挑挑看吧...<br>" + text + "</body></html>" else: htmltext = "31092-06.htm" elif event == "31092-06.htm": text = BYPASS[player.getClassId().getId()] htmltext = "<html><body>財富的地下商人:<br>如果考慮好了,那就趕快選擇一下吧。你想要哪一種職業呢?<br>" + text + "</body></html>" elif event == "31092-07.htm": st.giveAdena(3000000, False) st.set("onlyone", "1") elif event in CLASSES.keys(): newclass, req_item = CLASSES[event] adena = 0 for i in req_item: if not st.getQuestItemsCount(i): st.giveItems(i, 1) else: adena = adena + 1 if adena == 3: return "31092-06.htm" if adena > 0: st.giveAdena(adena * 1000000, False) htmltext = "31092-05.htm" st.set("onlyone", "1") return htmltext
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 "you lost fairy stone deluxe!"
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>這是已經完成的任務。</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 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(State.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( NpcSay(man.getObjectId(), 0, man.getNpcId(), "竟能與你在這兒再次相逢!")) 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( NpcSay(man.getObjectId(), 0, man.getNpcId(), "好像就是這兒...")) 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( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "有人在此,難道這也是註定的嗎?")) elif event == "2": npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "有關於我的事情你不必知道。你只要順從你的命運就對了。")) 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() 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