def onKill(self, npc, player, isPet): objId = npc.getObjectId() npc.broadcastPacket( PlaySound(1, "BS02_D", 1, objId, npc.getX(), npc.getY(), npc.getZ())) # spawn the "Teleportation Cubic" for 15 minutes (to allow players to exit the lair) self.addSpawn(29055, 115203, 16620, 10078, 0, False, 900000) # "lock" baium for 5 days and 1 to 8 hours [i.e. 432,000,000 + 1*3,600,000 + random-less-than(8*3,600,000) millisecs] respawnTime = 435600000 + Rnd.get(8 * 3600000) self.isBaiumLocked = True self.startQuestTimer("baium_unlock", respawnTime, None, None) # also save the respawn time so that the info is maintained past reboots self.saveGlobalQuestVar("unlockDatetime", str(System.currentTimeMillis() + respawnTime))
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): 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( CreatureSay(objId, 0, "Core", "A fatal error has occurred.")) npc.broadcastPacket( CreatureSay(objId, 0, "Core", "System is being shut down...")) npc.broadcastPacket(CreatureSay(objId, 0, "Core", "......")) 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): 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( CreatureSay(objId, 0, "Core", "A fatal error has occurred.")) npc.broadcastPacket( CreatureSay(objId, 0, "Core", "System is being shut down...")) npc.broadcastPacket(CreatureSay(objId, 0, "Core", "......")) self.FirstAttacked = False self.getPcSpawn(player).removeAllSpawn() self.getPcSpawn(player).addSpawn(31842, 16502, 110165, -6394, 900000) self.getPcSpawn(player).addSpawn(31842, 18948, 110166, -6397, 900000) elif self.FirstAttacked: self.getPcSpawn(player).addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ()) 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, 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 onKill(self,npc,player,isPet): objId=npc.getObjectId() npc.broadcastPacket(PlaySound(1, "BS01_D", 1, objId, npc.getX(), npc.getY(), npc.getZ())) #teleport cube antharas. self.addSpawn(31859,177615,114941,-7709,0,False,900000) return