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 onKill(self, npc, player, isPet): if self.worlds.has_key(npc.getInstanceId()): world = self.worlds[npc.getInstanceId()] npcId = npc.getNpcId() npc.getSpawn().stopRespawn() if npcId == KEYMASTER: if Rnd.get(100) >= 40: text = "Oh no my key............." dropItem(npc, KEY, 1, player) spawnAmaskari(self, world) else: text = "You will never get my key!" npc.broadcastPacket(NpcSay(npc.getObjectId(), 0, npcId, text)) elif npcId == CHARMED_NATIVE: HellboundManager.getInstance().decreaseTrustPoints(10) elif npcId == AMASKARI: for slave in world.AmaskariSlaves.npclist: slave.setRunning() slave.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(17384, 251788, -2015, 0)) self.startQuestTimer("decayNpc", 8000, slave, None) slave.broadcastPacket( NpcSay(slave.getObjectId(), 0, CHARMED_NATIVE, SLAVES_TEXT[Rnd.get(len(SLAVES_TEXT))])) return
def npcTalk(self, npc, text, chan=0, broadcaster=npc): if isinstance(text, []): broadcaster.broadcastPacket( NpcSay(npc.getObjId, chan, npc.getNpcId(), text[Rnd.get(len(text))])) else: broadcaster.broadcastPacket( NpcSay(npc.getObjId, chan, npc.getNpcId(), text))
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(), "Come on, I'll take you on!")) else : self.FirstAttacked = True npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "How dare you interrupt a sacred duel! You must be taught a lesson!")) 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(), "Hey! Were having a duel here!")) else: self.FirstAttacked = True npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "How dare you interrupt our fight! Hey guys, help!")) return
def onAttack(self, npc, player, damage, isPet, skill): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(4): return npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "Your rear is practically unguarded!")) else: self.FirstAttacked = True if Rnd.get(4): return npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "Watch your back!")) return
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(), "Removing intruders.")) else: self.FirstAttacked = True npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "A non-permitted target has been discovered.")) npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "Starting intruder removal system.")) return
def onTalk (self,npc,player): st = player.getQuestState(qn) npcId = npc.getNpcId() if not st: return ################### # Start Locations # ################### if TELEPORTERS.has_key(npcId) : st.getPlayer().teleToLocation(12661,181687,-3560) st.setState(State.STARTED) st.set("id",str(TELEPORTERS[npcId])) ############################ # Monster Derby Race Track # ############################ elif npcId == RACE_MANAGER: if st.getState() == State.STARTED and st.getInt("id") : # back to start location return_id = st.getInt("id") - 1 if return_id < 13: 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 player.sendPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),"You've arrived here from a different way. I'll send you to Dion Castle Town which is the nearest town.")) st.getPlayer().teleToLocation(15670,142983,-2700) 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 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 onAttack(self, npc, player, damage, isPet, skill): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(50): return npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "Dear ultimate power!!!")) else: self.FirstAttacked = True return
def onAttack(self, npc, player, damage, isPet, skill): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(50): return npc.broadcastPacket( NpcSay(objId, 0, npc.getNpcId(), "Destroy the enemy, my brothers!")) else: self.FirstAttacked = True 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, "A fatal error has occurred.")) npc.broadcastPacket( NpcSay(objId, 0, npcId, "System is being shut down...")) 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 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, 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(GhostofvonHellmann, 51432, -54570, -3136, 1800000) ghost.broadcastPacket( NpcSay(ghost.getObjectId(), 0, ghost.getNpcId(), "Who awoke me?")) elif event == "31523-05.htm": st.startQuestTimer("ghost_timer", GHOST_TIMER) 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 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 onAttack(self, npc, player, damage, isPet, skill): st = player.getQuestState(qn) if self.worlds.has_key(npc.getInstanceId()): world = self.worlds[npc.getInstanceId()] npcId = npc.getNpcId() if npcId == AMASKARI: if not world.amaskariAttacked: world.amaskariAttacked = True sendSlaves(self, player, world) text = AMASKARI_TEXT[Rnd.get(len(AMASKARI_TEXT))] npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npcId, text)) 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 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 == 27340 and cond == 1: self.isNpcSpawned = 0 string = "You are strong. This was a mistake." if st.getRandom(1): string = "You have good luck. I shall return." npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), string)) st.giveItems(10867, 1) st.set("cond", "2") st.playSound("ItemSound.quest_middle") 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(),"You will never pass this test!")) idx += 1 if debug: print "DarkCloudMansion: spawned fifth room" if debug: print str(world.FifthRoom.npclist)
def onAdvEvent(self, event, npc, player): if event == "CheckIfSafe": if npc.isDead(): cancelTimers(self, npc) HellboundManager.getInstance().decreaseTrustPoints(30) return if (npc.getX() >= -5967 and npc.getX() <= -4163) and ( npc.getY() >= 251137 and npc.getY() <= 251970) and (npc.getZ() >= -3400 and npc.getZ() <= -3100): HellboundManager.getInstance().addTrustPoints(30) npc.broadcastPacket( NpcSay( npc.getObjectId(), 0, npc.getNpcId(), "Thank you, you saved me! I'll remember you my whole life!" )) npc.decayMe() cancelTimers(self, npc) else: if debug: print "Not on position. Currently: X: " + str( npc.getX()) + " Y: " + str(npc.getY()) + " Z: " + str( npc.getZ()) self.startQuestTimer("CheckIfSafe", 10000, npc, None) elif event == "CallKillers": if npc.isDead(): cancelTimers(self, npc) HellboundManager.getInstance().decreaseTrustPoints(30) return for object in npc.getKnownList().getKnownObjects().values(): if object != None: if isinstance(object, L2MonsterInstance): objectId = object.getNpcId() if objectId in [22347, 22344, 22346]: object.setTarget(npc) object.addDamageHate(npc, 0, 999) object.setIsRunning(True) object.getAI().setIntention( CtrlIntention.AI_INTENTION_ATTACK) self.startQuestTimer("CallKillers", 1000, npc, None) return
def onTalk(self, npc, player): npcId = npc.getNpcId() if npcId == KANAF: if HellboundManager.getInstance().getCurrentLevel() >= 10: instanceId = 0 tele = PyObject() tele.x = 13881 tele.y = 255491 tele.z = -2025 instanceId = enterInstance(self, player, "MarketTown.xml", tele) if instanceId == 0: return else: htmltext = "You may not yet enter the Market Town..." return htmltext elif npcId == STELE: world = self.worlds[npc.getInstanceId()] if not world.instanceFinished: key = player.getInventory().getItemByItemId(KEY) if key != None: world.instanceFinished = True player.destroyItemByItemId("Moonlight Stone", KEY, 1, player, True) instance = InstanceManager.getInstance().getInstance( npc.getInstanceId()) if instance != None: instance.setDuration(330000) self.startQuestTimer("finishInstance", 300000, npc, None) elif npcId == PRISONER: world = self.worlds[npc.getInstanceId()] npc.broadcastPacket( NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "Thank you, i hope Amaskari wont notice!")) self.startQuestTimer("decayNpc", 15000, npc, None) HellboundManager.getInstance().addTrustPoints(10) if not world.guardsSpawned: callGuards(self, npc, player, world) world.guardsSpawned = True 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 AutoChat(self, npc, text, type): sm = NpcSay(npc.getObjectId(), type, npc.getNpcId(), text) npc.broadcastPacket(sm)
def AutoChat(self, 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): htmltext = event st = player.getQuestState(qn) if not st: return 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.addExpAndSp(410358, 32060) 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, " + st.getPlayer().getName() + ", you attacked Wendy. Prepare to die!")) golem.setRunning() golem.addDamageHate(player, 0, 999) golem.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player) self.isSpawned = 1 else: htmltext = "32047-19a.htm" elif event == "32047-17a.htm": st.set("cond", "12") st.playSound("ItemSound.quest_middle") elif event == "32047-20.htm": st.set("talk", "2") elif event == "32047-23.htm": st.set("cond", "13") st.playSound("ItemSound.quest_middle") st.set("talk", "0") elif event == "32047-25.htm": st.set("cond", "15") st.playSound("ItemSound.quest_middle") st.takeItems(Starstone, 1) elif event == "32047-30.htm": st.set("talk", "2") elif event == "32047-33.htm": if st.getInt("cond") == 7: st.set("cond", "8") st.set("talk", "0") st.playSound("ItemSound.quest_middle") elif st.getInt("cond") == 8: st.set("cond", "9") st.playSound("ItemSound.quest_middle") htmltext = "32047-34.htm" elif event == "32047-34.htm": st.set("cond", "9") st.playSound("ItemSound.quest_middle") elif event == "32047-38.htm": st.giveItems(Starstone2, 1) st.takeItems(57, 3000) st.set("cond", "26") st.playSound("ItemSound.quest_middle") elif event == "32050-02.htm": st.playSound("ItemSound.armor_wood_3") st.set("talk", "1") elif event == "32050-04.htm": st.set("cond", "14") st.giveItems(Starstone, 1) st.playSound("ItemSound.quest_middle") st.set("talk", "0") return htmltext
def onTalk (self,npc,player): htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</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 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, 11973) 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 onEvent(self, event, st): htmltext = event player = st.getPlayer() 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() + "! I must kill you. Blame your own curiosity.")) npc.setRunning() npc.addDamageHate(st.getPlayer(), 0, 999) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, st.getPlayer()) self.isNpcSpawned = 1 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 = "32435-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>Black Marketeer of Mammon:<br>Forget about the money!<br>I will help you complete the class transfer, which is far more valuable! Which class would you like to be? Choose one.<br>" + text + "</body></html>" else: htmltext = "31092-06.htm" elif event == "31092-06.htm": text = BYPASS[player.getClassId().getId()] htmltext = "<html><body>Black Marketeer of Mammon:<br>If you are finished thinking, select one. Which class would you like to be?<br>" + text + "</body></html>" elif event == "31092-07.htm": st.giveItems(57, 3000000) st.set("onlyone", "1") elif event in CLASSES.keys(): if player.getLevel() >= 40: newclass, req_item = CLASSES[event] adena = 0 for i in req_item: if not st.getQuestItemsCount(i): st.giveItems(i, 1) else: adena + 1 if adena == 3: return "31092-06.htm" if adena > 0: st.giveItems(57, adena * 1000000) htmltext = "31092-05.htm" st.set("onlyone", "1") else: htmltext = "<html><body>Black Marketeer of Mammon:<br>To change occupation, your level must be over 40. Come back after you finish thinking about it.</body></html>" return htmltext
def autochat(npc, text): if npc: npc.broadcastPacket(NpcSay(npc.getObjectId(), 0, npc.getNpcId(), text)) return