def onFirstTalk(self, npc, player): npcId = npc.getNpcId() if npcId == Doctor_Chaos: npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(96323, -110914, -3328, 0)) self.startQuestTimer("1", 3000, npc, player) return ""
def onAdvEvent (self,event,npc, player) : if event == "1" : machine_instance = self.FindTemplate(Strange_Machine) if machine_instance : npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, machine_instance) machine_instance.broadcastPacket(SpecialCamera(machine_instance.getObjectId(),1,-200,15,10000,20000)) else : print "Dr Chaos AI: problem finding Strange Machine (npcid = "+Strange_Machine+"). Error: not spawned!" self.startQuestTimer("2",2000,npc,player) self.startQuestTimer("3",10000,npc,player) elif event == "2" : npc.broadcastPacket(SocialAction(npc.getObjectId(),3)) elif event == "3" : npc.broadcastPacket(SpecialCamera(npc.getObjectId(),1,-150,10,3000,20000)) self.startQuestTimer("4",2500,npc,player) elif event == "4" : npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(96055,-110759,-3312,0)) self.startQuestTimer("5",2000,npc,player) elif event == "5" : player.teleToLocation(94832,-112624,-3304) npc.teleToLocation(-113091,-243942,-15536) if self.isGolemSpawned == 0 : golem = self.addSpawn(25512,94640,-112496,-3336,0,False,0) self.isGolemSpawned == 1 self.startQuestTimer("6",1000,golem,player) player.sendPacket(PlaySound(1,"Rm03_A",0,0,0,0,0)) elif event == "6" : npc.broadcastPacket(SpecialCamera(npc.getObjectId(),30,-200,20,6000,8000)) return
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 onAdvEvent(self, event, npc, pc): if event == "timer_check": gameTime = GameTimeController.getInstance().getGameTime() h = (gameTime / 60) % 24 m = gameTime % 60 if h == 20 and m >= 27 and m <= 33: self.startQuestTimer("Start", 100, None, None) self.cancelQuestTimer("timer_check", None, None) elif event == "Start": mc = self.addSpawn(self.MC, -56698, -56430, -2008, 32768, False, 0) self.AutoChat(mc, TEXT[0], 1) self.startQuestTimer("1", 30000, mc, None) elif event in TALKS.keys() and npc: text, nextEvent, time = TALKS[event] self.AutoChat(npc, text, 1) self.startQuestTimer(nextEvent, time, npc, None) elif event in WALKS.keys() and npc and self.isSpawned == 1: x, y, z, nextEvent, time = WALKS[event] npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(x, y, z, 0)) self.startQuestTimer(nextEvent, time, npc, None) elif event == "6" and npc: self.AutoChat(npc, TEXT[6], 1) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56511, -56647, -2008, 36863)) npc.broadcastPacket(PlaySound(1, "NS22_F", 0, 0, 0, 0, 0)) elf = self.addSpawn(self.singers[0], -56344, -56328, -2008, 32768, False, 0) elf.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56657, -56338, -2008, 33102)) elf1 = self.addSpawn(self.singers[1], -56552, -56245, -2008, 36863, False, 0) elf2 = self.addSpawn(self.singers[1], -56546, -56426, -2008, 28672, False, 0) elf3 = self.addSpawn(self.singers[1], -56570, -56473, -2008, 28672, False, 0) elf4 = self.addSpawn(self.singers[1], -56594, -56516, -2008, 28672, False, 0) elf5 = self.addSpawn(self.singers[1], -56580, -56203, -2008, 36863, False, 0) elf6 = self.addSpawn(self.singers[1], -56606, -56157, -2008, 36863, False, 0) for i in [elf, elf1, elf2, elf3, elf4, elf5, elf6]: self.startQuestTimer("social1", 6000, i, None, True) for j in [npc, elf, elf1, elf2, elf3, elf4, elf5, elf6]: self.startQuestTimer("7", 215000, j, None) elif event == "7" and npc: if npc.getNpcId() == self.MC: self.AutoChat(npc, TEXT[7], 1) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56698, -56430, -2008, 32768)) self.startQuestTimer("8", 12000, npc, None) else: self.cancelQuestTimer("social1", npc, None) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56594, -56064, -2008, 32768)) self.startQuestTimer("clean_npc", 9000, npc, None) elif event == "10" and npc: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56483, -56665, -2034, 32768)) npc1 = self.addSpawn(self.circus[0], -56495, -56375, -2008, 32768, False, 0) npc2 = self.addSpawn(self.circus[0], -56491, -56289, -2008, 32768, False, 0) npc3 = self.addSpawn(self.circus[1], -56502, -56246, -2008, 32768, False, 0) npc4 = self.addSpawn(self.circus[1], -56496, -56429, -2008, 32768, False, 0) npc5 = self.addSpawn(self.circus[2], -56505, -56334, -2008, 32768, False, 0) npc6 = self.addSpawn(self.circus[3], -56545, -56427, -2008, 32768, False, 0) npc7 = self.addSpawn(self.circus[3], -56552, -56248, -2008, 32768, False, 0) npc8 = self.addSpawn(self.circus[4], -56493, -56473, -2008, 32768, False, 0) npc9 = self.addSpawn(self.circus[4], -56504, -56201, -2008, 32768, False, 0) npc.broadcastPacket(PlaySound(1, "TP05_F", 0, 0, 0, 0, 0)) self.startQuestTimer("npc1_1", 3000, npc1, None) self.startQuestTimer("npc2_1", 3000, npc2, None) self.startQuestTimer("npc3_1", 3000, npc3, None) self.startQuestTimer("npc4_1", 3000, npc4, None) self.startQuestTimer("npc5_1", 3500, npc5, None) self.startQuestTimer("npc6_1", 4000, npc6, None) self.startQuestTimer("npc7_1", 4000, npc7, None) self.startQuestTimer("npc8_1", 3000, npc8, None) self.startQuestTimer("npc9_1", 3000, npc9, None) self.isSpawned = 1 for j in [ npc, npc1, npc2, npc3, npc4, npc5, npc6, npc7, npc8, npc9 ]: self.startQuestTimer("11", 100000, j, None) elif event == "11" and npc: if npc.getNpcId() == self.MC: self.AutoChat(npc, TEXT[10], 1) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56698, -56430, -2008, 32768)) self.startQuestTimer("12", 5000, npc, None) else: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56343, -56330, -2008, 32768)) self.startQuestTimer("clean_npc", 1000, npc, None) elif event == "14" and npc: npc1 = self.addSpawn(self.individuals[0], -56700, -56385, -2008, 32768, False, 0) self.startQuestTimer("social1", 2000, npc1, None) self.startQuestTimer("clean_npc", 49000, npc1, None) self.startQuestTimer("15", 7000, npc, None) elif event == "17" and npc: self.AutoChat(npc, TEXT[15], 1) npc1 = self.addSpawn(self.individuals[1], -56700, -56340, -2008, 32768, False, 0) self.startQuestTimer("social1", 2000, npc1, None) self.startQuestTimer("clean_npc", 32000, npc1, None) self.startQuestTimer("18", 9000, npc, None) elif event == "20" and npc: npc1 = self.addSpawn(self.individuals[2], -56703, -56296, -2008, 32768, False, 0) self.startQuestTimer("social1", 2000, npc1, None) self.startQuestTimer("clean_npc", 13000, npc1, None) self.startQuestTimer("21", 8000, npc, None) elif event == "23" and npc: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56702, -56340, -2008, 32768)) self.startQuestTimer("24", 2800, npc, None) npc1 = self.addSpawn(self.showstuff[0], -56672, -56406, -2000, 32768, False, 0) npc2 = self.addSpawn(self.showstuff[1], -56648, -56368, -2000, 32768, False, 0) npc3 = self.addSpawn(self.showstuff[2], -56608, -56338, -2000, 32768, False, 0) npc4 = self.addSpawn(self.showstuff[3], -56652, -56307, -2000, 32768, False, 0) npc5 = self.addSpawn(self.showstuff[4], -56672, -56272, -2000, 32768, False, 0) for j in [npc1, npc2, npc3, npc4, npc5]: self.startQuestTimer("social1", 5500, j, None) self.startQuestTimer("social1_1", 12500, j, None) self.startQuestTimer("28", 19700, j, None) elif event == "28" and npc: self.AutoChat(npc, "We love you.", 0) self.startQuestTimer("social1", 1, npc, None) self.startQuestTimer("clean_npc", 1200, npc, None) elif event == "29" and npc: npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(-56730, -56340, -2008, 32768)) self.startQuestTimer("clean_npc", 4100, npc, None) self.startQuestTimer("timer_check", 60000, None, None, True) elif event in ["social1", "social1_1"] and npc: npc.broadcastPacket(SocialAction(npc.getObjectId(), 1)) elif event == "clean_npc" and npc: if npc.getNpcId() in [ self.circus[0], self.circus[1], self.circus[2], self.circus[3], self.circus[4] ]: self.isSpawned = 0 npc.deleteMe() 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.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( CreatureSay(ghost.getObjectId(), 0, ghost.getName(), "Who awoke me?")) elif event == "31524-06.htm": st.set("cond", "3") st.playSound("ItemSound.quest_middle") ghost = self.addSpawn(31525, npc) ghost.broadcastPacket( CreatureSay( ghost.getObjectId(), 0, ghost.getName(), "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 onAdvEvent(self, event, npc, player): st = player.getQuestState(qn) if not st: return htmltext = event if event == "31522-02.htm": st.setState(STARTED) st.playSound("ItemSound.quest_accept") st.set("cond", "1") elif event == "timer": htmltext = "31328-05.htm" elif event == "31328-05.htm": st.set("cond", "0") st.set("onlyone", "1") st.unset("AGRIPEL") st.unset("DOMINIC") st.unset("BENEDICT") st.setState(COMPLETED) st.takeItems(7140, -1) if st.getQuestItemsCount(7141) == 0: st.giveItems(7141, 1) st.playSound("ItemSound.quest_finish") st.startQuestTimer("timer", 1) htmltext = "Congratulations! You are completed this quest!" + \ " \n The Quest \"Tragedy In Von Hellmann Forest\"" + \ " become available.\n Show Cross of Einhasad to High"+ \ " Priest Tifaren." elif event == "31523-03.htm": st.playSound("SkillSound5.horror_02") st.playSound("ItemSound.quest_middle") st.set("cond", "2") st.addSpawn(31524, 51432, -54570, -3136, 1800000) elif event == "31524-06.htm": st.set("cond", "3") st.playSound("ItemSound.quest_middle") ghost = self.addSpawn(31525, npc) 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() htmltext = None elif event.isdigit(): htmltext = None 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 htmltext