def onKill(self,npc,player,isPet): partyMember1 = self.getRandomPartyMember(player,"1") partyMember2 = self.getRandomPartyMemberState(player, State.COMPLETED) if not partyMember1 and not partyMember2 : return partyMember = partyMember1 item,chance = DROPLIST[npc.getNpcId()] dropchance = Rnd.get(100) if dropchance < chance: # player who has State.COMPLETED up to 2 out of 3 item collections may consume the party drop if partyMember2 : if Rnd.get(100) <= 66: return else : partyMember = partyMember1 st = partyMember.getQuestState(qn) if st : if st.getState() == State.STARTED : count = st.getQuestItemsCount(item) if st.getInt("cond") == 1 and count < 100 : numItems, chance = divmod(chance*Config.RATE_DROP_QUEST,100) if dropchance < chance: numItems += 1 if count + numItems >= 100 : numItems = 100 - count if numItems != 0 : st.giveItems(item,int(numItems)) if st.getQuestItemsCount(LEAF_OF_FLAVA) == st.getQuestItemsCount(BUFFALO_MEAT) == st.getQuestItemsCount(ANTELOPE_HORN) == 100 : st.set("cond","2") st.playSound("ItemSound.quest_middle") else : st.playSound("ItemSound.quest_itemget") return
def runFloor(self, world, floor): world.status = floor world.FloorSt = {} world.FloorSt[floor] = PyObject() world.FloorSt[floor].npclist = {} if floor in [0,1,2,3,5,6,7,8] : i = MOBS[floor][0][1] x = FLOORS[floor][0] y = FLOORS[floor][1] z = FLOORS[floor][4] while i > 0 : rx = Rnd.get(FLOORS[floor][2]) ry = Rnd.get(FLOORS[floor][3]) newNpc = self.addSpawn(MOBS[floor][0][0], x+rx, y+ry, z, 0, False, 0, False, world.instanceId) world.FloorSt[floor].npclist[newNpc] = False i -= 1 if floor in [2,3,6,7,8] : i = MOBS[floor][1][1] x = FLOORS[floor][0] y = FLOORS[floor][1] z = FLOORS[floor][4] while i > 0 : rx = Rnd.get(FLOORS[floor][2]) ry = Rnd.get(FLOORS[floor][3]) newNpc = self.addSpawn(MOBS[floor][1][0], x+rx, y+ry, z, 0, False, 0, False, world.instanceId) world.FloorSt[floor].npclist[newNpc] = False i -= 1 if floor in [4,9] : newNpc = self.addSpawn(MOBS[floor][0][0],MOBS[floor][1][0],MOBS[floor][1][1],MOBS[floor][1][2], 0, False, 0, False, world.instanceId) world.FloorSt[floor].npclist[newNpc] = False
def onEvent (self,event,st) : htmltext = event if event == "32264-02.htm" : st.set("cond", "1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") elif event == "32264-08.htm" : st.giveItems(ECHO_CRYSTAL, 1) st.set("cond", "2") st.playSound("ItemSound.quest_middle") elif event == "32271-03.htm" : st.set("cond", "3") st.giveItems(PARMES_LETTER, 1) st.playSound("ItemSound.quest_middle") x = Rnd.get(-100, 100) y = Rnd.get(-100, 100) st.getPlayer().teleToLocation(143472 + x, 191040 + y, -3696) elif event == "32264-12.htm" : if st.getQuestItemsCount(PARMES_LETTER) : st.takeItems(PARMES_LETTER, 1) st.playSound("ItemSound.quest_middle") elif event == "32264-13.htm" : st.takeItems(ECHO_CRYSTAL, 1) st.addExpAndSp(1304752, 0) st.playSound("ItemSound.quest_finish") st.exitQuest(False) return htmltext
def onEvent(self, event, st): htmltext = event if event == "32264-02.htm": st.set("cond", "1") st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") elif event == "32264-08.htm": st.giveItems(ECHO_CRYSTAL, 1) st.set("cond", "2") st.playSound("ItemSound.quest_middle") elif event == "32271-03.htm": st.set("cond", "3") st.giveItems(PARMES_LETTER, 1) st.playSound("ItemSound.quest_middle") x = Rnd.get(-100, 100) y = Rnd.get(-100, 100) st.getPlayer().teleToLocation(143472 + x, 191040 + y, -3696) elif event == "32264-12.htm": if st.getQuestItemsCount(PARMES_LETTER): st.takeItems(PARMES_LETTER, 1) st.playSound("ItemSound.quest_middle") elif event == "32264-13.htm": st.takeItems(ECHO_CRYSTAL, 1) st.addExpAndSp(1304752, 0) st.playSound("ItemSound.quest_finish") st.exitQuest(False) return htmltext
def onTalk (self,npc,player): npcId = npc.getNpcId() htmltext = "" if npcId == 13001 : #heart of warding htmltext = "13001-01.htm" if self.antharasAI : status = GrandBossManager.getInstance().getBossStatus(29019) if status == 0 or status == 1 : #If entrance to see Antharas is unlocked (he is Dormant or Waiting) st = player.getQuestState(qn) if st.getQuestItemsCount(3865) > 0 : st.takeItems(3865,1) self.antharasAI.zone.allowPlayerEntry(player,30) x = 179700 + Rnd.get(700) y = 113800 + Rnd.get(2100) player.teleToLocation(x,y,-7709) if status == 0 : antharas = GrandBossManager.getInstance().getBoss(29019) self.antharasAI.startQuestTimer("waiting",1800000, antharas, None) GrandBossManager.getInstance().setBossStatus(29019,1) return else : htmltext = "13001-03.htm" elif status == 2 : htmltext = "13001-02.htm" elif npcId == 31859 : #antharas teleport cube x = 79800 + Rnd.get(600) y = 151200 + Rnd.get(1100) player.teleToLocation(x,y,-3534) return return htmltext
def onTalk(self, npc, player): npcId = npc.getNpcId() htmltext = "" if npcId == 13001: #heart of warding htmltext = "13001-01.htm" if self.antharasAI: status = GrandBossManager.getInstance().getBossStatus(29019) if status == 0 or status == 1: #If entrance to see Antharas is unlocked (he is Dormant or Waiting) st = player.getQuestState(qn) if st.getQuestItemsCount(3865) > 0: st.takeItems(3865, 1) self.antharasAI.zone.allowPlayerEntry(player, 30) x = 179700 + Rnd.get(700) y = 113800 + Rnd.get(2100) player.teleToLocation(x, y, -7709) if status == 0: antharas = GrandBossManager.getInstance().getBoss( 29019) self.antharasAI.startQuestTimer( "waiting", 1800000, antharas, None) GrandBossManager.getInstance().setBossStatus( 29019, 1) return else: htmltext = "13001-03.htm" elif status == 2: htmltext = "13001-02.htm" elif npcId == 31859: #antharas teleport cube x = 79800 + Rnd.get(600) y = 151200 + Rnd.get(1100) player.teleToLocation(x, y, -3534) return return htmltext
def onKill(self,npc,player,isPet): npcId = npc.getNpcId() if npcId == BUMPALUMP : respawnMinDelay = 43200000 * int(Config.RAID_MIN_RESPAWN_MULTIPLIER) respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER) respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay) self.saveGlobalQuestVar("625_respawn", str(System.currentTimeMillis()+respawn_delay)) self.startQuestTimer("spawn_npc", respawn_delay, None, None) self.cancelQuestTimer("Icicle Emperor Bumbalump has despawned",npc,None) party = player.getParty() if party : PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray() : st1 = player1.getQuestState(qn) if st1 : if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) : PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0 : return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(FOOD) > 0 : st.takeItems(FOOD,1) st.giveItems(MEAT,1) st.set("cond","3") st.playSound("ItemSound.quest_middle") else : st = player.getQuestState(qn) if not st : return if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) : if st.getQuestItemsCount(FOOD) > 0 : st.takeItems(FOOD,1) st.giveItems(MEAT,1) st.set("cond","3") st.playSound("ItemSound.quest_middle") return
def runFloor(self, world, floor): world.status = floor world.FloorSt = {} world.FloorSt[floor] = PyObject() world.FloorSt[floor].npclist = {} if floor in [0, 1, 2, 3, 5, 6, 7, 8]: i = MOBS[floor][0][1] x = FLOORS[floor][0] y = FLOORS[floor][1] z = FLOORS[floor][4] while i > 0: rx = Rnd.get(FLOORS[floor][2]) ry = Rnd.get(FLOORS[floor][3]) newNpc = self.addSpawn(MOBS[floor][0][0], x + rx, y + ry, z, 0, False, 0, False, world.instanceId) world.FloorSt[floor].npclist[newNpc] = False i -= 1 if floor in [2, 3, 6, 7, 8]: i = MOBS[floor][1][1] x = FLOORS[floor][0] y = FLOORS[floor][1] z = FLOORS[floor][4] while i > 0: rx = Rnd.get(FLOORS[floor][2]) ry = Rnd.get(FLOORS[floor][3]) newNpc = self.addSpawn(MOBS[floor][1][0], x + rx, y + ry, z, 0, False, 0, False, world.instanceId) world.FloorSt[floor].npclist[newNpc] = False i -= 1 if floor in [4, 9]: newNpc = self.addSpawn(MOBS[floor][0][0], MOBS[floor][1][0], MOBS[floor][1][1], MOBS[floor][1][2], 0, False, 0, False, world.instanceId) world.FloorSt[floor].npclist[newNpc] = False
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(), TEXT[Rnd.get(4)])) else : self.FirstAttacked = True 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): chance = Rnd.get(100) if chance <= 5: dropItem(npc,9422,1) elif chance >= 6 and chance <= 10: dropItem(npc,9429,1) elif chance >= 11 and chance <= 15: dropItem(npc,9438,1) elif chance >= 16 and chance <= 30: dropItem(npc,Rnd.get(9455,9457),1) elif chance >= 31 and chance <= 50: dropItem(npc,Rnd.get(6577,6578),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 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 onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == Nastron: respawnMinDelay = 43200000 * int( Config.RAID_MIN_RESPAWN_MULTIPLIER) respawnMaxDelay = 129600000 * int( Config.RAID_MAX_RESPAWN_MULTIPLIER) respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay) self.saveGlobalQuestVar( "616_respawn", str(System.currentTimeMillis() + respawn_delay)) self.startQuestTimer("spawn_npc", respawn_delay, None, None) self.cancelQuestTimer("Soul of Fire Nastron has despawned", npc, None) party = player.getParty() if party: PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray(): st1 = player1.getQuestState(qn) if st1: if st1.getState() == State.STARTED and ( st1.getInt("cond") == 1 or st1.getInt("cond") == 2): PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0: return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(Totem2) > 0: st.takeItems(Totem2, 1) st.giveItems(Fire_Heart, 1) st.set("cond", "3") st.set("id", "3") st.playSound("ItemSound.quest_middle") else: st = player.getQuestState(qn) if not st: return if st.getState() == State.STARTED and ( st.getInt("cond") == 1 or st.getInt("cond") == 2): if st.getQuestItemsCount(Totem2) > 0: st.takeItems(Totem2, 1) st.giveItems(Fire_Heart, 1) st.set("cond", "3") st.set("id", "3") st.playSound("ItemSound.quest_middle") elif npcId in Varka_Mobs: st = player.getQuestState(qn) if st: if st.getQuestItemsCount(Fire_Heart): st.takeItems(Fire_Heart, -1) st.unset("cond") st.unset("id") st.exitQuest(1) return
def onAdvEvent (self,event,npc,player): if event == "out": tele = PyObject() tele.x = 149361+Rnd.get(-100,100) tele.y = 172327+Rnd.get(-100,100) tele.z = -945 st = player.getQuestState("oracle7") if not st : st = self.newQuestState(player) st.takeItems(9694,-1) st.takeItems(9698,-1) st.takeItems(9699,-1) exitInstance(player,tele) return
def onAdvEvent(self, event, npc, player): if event == "out": tele = PyObject() tele.x = 149361 + Rnd.get(-100, 100) tele.y = 172327 + Rnd.get(-100, 100) tele.z = -945 st = player.getQuestState("oracle5") if not st: st = self.newQuestState(player) st.takeItems(9694, -1) st.takeItems(9698, -1) st.takeItems(9699, -1) exitInstance(player, tele) return
def onAttack(self, npc, player, damage, isPet): npdId = npc.getNpcId() if (npc.getMaxHp()/2) > npc.getCurrentHp(): if Rnd.get(100) < 4: if self.ImpGraveKepperStat == 1: for j in range(2): for k in range(2): self.addSpawn(27180,npc.getX()+70*pow(-1,j%2),npc.getY()+70*pow(-1,k%2),npc.getZ(),0,False,0) self.ImpGraveKepperStat = 2 else: players = npc.getKnownList().getKnownPlayers().values().toArray() if len(players) : playerToTP = players[Rnd.get(int(len(players)))] playerToTP.teleToLocation(185462,20342,-3250) return
def onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == BUMPALUMP: FindTemplate(TABLE).setBusy(False) self.cancelQuestTimer("Icicle Emperor Bumbalump has despawned", npc, None) party = player.getParty() if party: PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray(): st1 = player1.getQuestState(qn) if st1: if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2): PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0: return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(FOOD) > 0: st.takeItems(FOOD, 1) st.giveItems(MEAT, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") else: st = player.getQuestState(qn) if not st: return if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2): if st.getQuestItemsCount(FOOD) > 0: st.takeItems(FOOD, 1) st.giveItems(MEAT, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") return
def onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == BUMPALUMP: FindTemplate(TABLE).setBusy(False) self.cancelQuestTimer("Icicle Emperor Bumbalump has despawned", npc, None) party = player.getParty() if party: PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray(): st1 = player1.getQuestState(qn) if st1: if st1.getState() == State.STARTED and ( st1.getInt("cond") == 1 or st1.getInt("cond") == 2): PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0: return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(FOOD) > 0: st.takeItems(FOOD, 1) st.giveItems(MEAT, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") else: st = player.getQuestState(qn) if not st: return if st.getState() == State.STARTED and ( st.getInt("cond") == 1 or st.getInt("cond") == 2): if st.getQuestItemsCount(FOOD) > 0: st.takeItems(FOOD, 1) st.giveItems(MEAT, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") return
def onKill(self,npc,player,isPet): npcId = npc.getNpcId() if npcId == DAIMON : FindTemplate(ALTAR).setBusy(False) self.cancelQuestTimer("Daimon the White-Eyed has despawned",npc,None) party = player.getParty() if party : PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray() : st1 = player1.getQuestState(qn) if st1 : if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) : PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0 : return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(S_SUMMON) > 0 : st.takeItems(S_SUMMON,1) st.giveItems(ESSENCE,1) st.set("cond","3") st.playSound("ItemSound.quest_middle") else : st = player.getQuestState(qn) if not st : return if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) : if st.getQuestItemsCount(S_SUMMON) > 0 : st.takeItems(S_SUMMON,1) st.giveItems(ESSENCE,1) st.set("cond","3") st.playSound("ItemSound.quest_middle") return
def onEvent (self,event,st) : htmltext = event if event == "30081-02.htm" : st.set("cond","1") condition = Rnd.get(1,2) if condition == 1 : st.set("cond","2") htmltext = "30081-02a.htm" else : st.set("cond","5") htmltext = "30081-02b.htm" st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") elif event == "30511-03.htm" : st.set("cond","6") st.playSound("ItemSound.quest_middle") elif event == "31572-03.htm" : st.set("cond","3") st.playSound("ItemSound.quest_middle") elif event == "30081-05a.htm" : st.takeItems(FishChest,1) st.giveItems(WondrousCubic,1) st.playSound("ItemSound.quest_finish") st.exitQuest(False) elif event == "30081-05b.htm" : st.takeItems(SeedJar,1) st.giveItems(WondrousCubic,1) st.playSound("ItemSound.quest_finish") st.exitQuest(False) return htmltext
def runSecondRoom(self, world): world.status = 4 openDoor(D3, world.instanceId) world.SecondRoom = PyObject() world.SecondRoom.monolith = [] i = Rnd.get(len(order)) a, b, c, d, e, f = order[i] world.SecondRoom.monolithOrder = [1, 0, 0, 0, 0, 0, 0] newNpc = self.addSpawn(BSM, 147800, 181150, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, a, 0]) newNpc = self.addSpawn(BSM, 147900, 181215, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, b, 0]) newNpc = self.addSpawn(BSM, 147900, 181345, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, c, 0]) newNpc = self.addSpawn(BSM, 147800, 181410, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, d, 0]) newNpc = self.addSpawn(BSM, 147700, 181345, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, e, 0]) newNpc = self.addSpawn(BSM, 147700, 181215, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, f, 0]) if debug: print "DarkCloudMansion: spawned second room"
def onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == DAIMON: FindTemplate(ALTAR).setBusy(False) self.cancelQuestTimer("Daimon the White-Eyed has despawned", npc, None) party = player.getParty() if party: PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray(): st1 = player1.getQuestState(qn) if st1: if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2): PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0: return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(S_SUMMON) > 0: st.takeItems(S_SUMMON, 1) st.giveItems(ESSENCE, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") else: st = player.getQuestState(qn) if not st: return if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2): if st.getQuestItemsCount(S_SUMMON) > 0: st.takeItems(S_SUMMON, 1) st.giveItems(ESSENCE, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") return
def onTalk(self, npc, player): htmltext = "<html><body>沒進行任務或條件不符合。</body></html>" st = player.getQuestState(qn) if not st: return htmltext clan = player.getClan() npcId = npc.getNpcId() if player.getClan() == None or player.isClanLeader() == 0: st.exitQuest(1) htmltext = "31331-0a.htm" elif player.getClan().getLevel() < 6: st.exitQuest(1) htmltext = "31331-0b.htm" else: cond = st.getInt("cond") raid = st.getInt("raid") id = st.getState() if id == State.CREATED and cond == 0: htmltext = "31331-0c.htm" elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys( ): npc, item, min, max = REWARDS_LIST[raid] count = st.getQuestItemsCount(item) CLAN_POINTS_REWARD = Rnd.get(min, max) if not count: htmltext = "31331-" + str(raid) + "a.htm" elif count == 1: htmltext = "31331-" + str(raid) + "b.htm" st.takeItems(item, 1) clan.setReputationScore( clan.getReputationScore() + CLAN_POINTS_REWARD, True) player.sendPacket( SystemMessage(1777).addNumber(CLAN_POINTS_REWARD)) clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan)) return htmltext
def runForthRoom(self, world): world.status = 7 openDoor(D5, world.instanceId) world.ForthRoom = PyObject() world.ForthRoom.npclist = [] world.ForthRoom.counter = 0 temp = [] templist = [] xx = 0 for i in range(0, 7): temp.append(Rnd.get(len(rows))) a, b, c, d, e, f, g = temp world.ForthRoom.colmnOrder = [] world.ForthRoom.colmnOrder.append([a, b, c, d, e, f, g]) for i in range(0, len(temp)): templist.append(rows[temp[i]]) for x in range(148660, 149285, 125): yy = 0 for y in range(179280, 178405, -125): newNpc = self.addSpawn(SC, x, y, -6115, 16215, False, 0, False, world.instanceId) world.ForthRoom.npclist.append([newNpc, templist[yy][xx], yy]) yy += 1 xx += 1 for npc in world.ForthRoom.npclist: if npc[1] == 0: npc[0].setIsInvul(True) if debug: print "DarkCloudMansion: spawned forth room"
def runForthRoom(self, world) : world.status = 7 openDoor(D5, world.instanceId) world.ForthRoom = PyObject() world.ForthRoom.npclist = [] world.ForthRoom.counter = 0 temp = [] templist = [] xx = 0 for i in range(0, 7) : temp.append(Rnd.get(len(rows))) a, b, c, d, e, f, g = temp world.ForthRoom.colmnOrder = [] world.ForthRoom.colmnOrder.append([a, b, c, d, e, f, g]) for i in range(0, len(temp)) : templist.append(rows[temp[i]]) for x in range(148660, 149285, 125) : yy = 0 for y in range(179280, 178405, -125) : newNpc = self.addSpawn(SC, x, y, -6115, 16215, False, 0, False, world.instanceId) world.ForthRoom.npclist.append([newNpc, templist[yy][xx], yy]) yy += 1 xx += 1 for npc in world.ForthRoom.npclist : if npc[1] == 0 : npc[0].setIsInvul(True) if debug : print "DarkCloudMansion: spawned forth room"
def onKill(self,npc,player,isPet): # get 1 party member among those with cond between 1 and 4 partyMember = 0 j = 0 for i in range(1,5) : # i between 1 and 4 inclusive partyMember = self.getRandomPartyMember(player,str(i)) if partyMember : j = i break if not partyMember : return # if at least 1 cond exists with a party member, check if there also exist in a different cond as well for i in range(j+1,5) : partyMember2 = self.getRandomPartyMember(player,str(i)) # if a party member is found in another cond, randomly choose between # the new one and the previous one if partyMember2 : if Rnd.get(2) : partyMember = partyMember2 st = partyMember.getQuestState(qn) if not st : return if st.getState() != STARTED : return count = st.getQuestItemsCount(SPINNERET) if count < 10 : st.giveItems(SPINNERET,1) if count == 9 : st.playSound("ItemSound.quest_middle") st.set("cond","5") else : st.playSound("ItemSound.quest_itemget") return
def runSteamRoom3Oracle(self,world): world.OracleTriggered = False o1,o2,o3,o4 = ordreOracle3[Rnd.get(len(ordreOracle3))] self.addSpawn(o1, 152461, 152505, -12169, 31613, False, 0, False, world.instanceId) self.addSpawn(o2, 152461, 152575, -12169, 31613, False, 0, False, world.instanceId) self.addSpawn(o3, 152461, 152645, -12169, 31613, False, 0, False, world.instanceId) self.addSpawn(o4, 152461, 152715, -12169, 31613, False, 0, False, world.instanceId)
def generateBoard(self, player, bet): board = [] num = [1, 2, 3, 4, 5, 6, 7, 8, 9] for i in range(9): board.append(num.pop(Rnd.get(1, len(num)) - 1)) self.gameStatus[player.getName()] = [board, [], bet] return
def onTalk (self,npc,player) : htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>" st = player.getQuestState(qn) if not st : return htmltext clan = player.getClan() npcId = npc.getNpcId() if player.getClan() == None or player.isClanLeader() == 0 : st.exitQuest(1) htmltext = "30868-0a.htm" elif player.getClan().getLevel() < 5 : st.exitQuest(1) htmltext = "30868-0b.htm" else : cond = st.getInt("cond") raid = st.getInt("raid") id = st.getState() if id == State.CREATED and cond == 0 : htmltext = "30868-0c.htm" elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() : npc,item,min,max=REWARDS_LIST[raid] count = st.getQuestItemsCount(item) CLAN_POINTS_REWARD = Rnd.get(min, max) if not count : htmltext = "30868-"+str(raid)+"a.htm" elif count == 1 : htmltext = "30868-"+str(raid)+"b.htm" st.takeItems(item,1) clan.setReputationScore(clan.getReputationScore()+CLAN_POINTS_REWARD,True) player.sendPacket(SystemMessage(1777).addNumber(CLAN_POINTS_REWARD)) clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan)) return htmltext
def onEvent(self, event, st): htmltext = event if event == "30081-02.htm": st.set("cond", "1") condition = Rnd.get(1, 2) if condition == 1: st.set("cond", "2") htmltext = "30081-02a.htm" else: st.set("cond", "5") htmltext = "30081-02b.htm" st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") elif event == "30511-03.htm": st.set("cond", "6") st.playSound("ItemSound.quest_middle") elif event == "31572-03.htm": st.set("cond", "3") st.playSound("ItemSound.quest_middle") elif event == "30081-05a.htm": st.takeItems(FishChest, 1) st.giveItems(WondrousCubic, 1) st.playSound("ItemSound.quest_finish") st.exitQuest(False) elif event == "30081-05b.htm": st.takeItems(SeedJar, 1) st.giveItems(WondrousCubic, 1) st.playSound("ItemSound.quest_finish") st.exitQuest(False) return htmltext
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 onAttack(self, npc, player, damage, isPet, skill) : npcId = npc.getNpcId() if self.worlds.has_key(npc.getInstanceId()) : world = self.worlds[player.getInstanceId()] if world.status == 2 : if npcId == 22264 : closeDoor(D2, world.instanceId) if world.status == 7 : if npcId == SC : closeDoor(D5, world.instanceId) for mob in world.ForthRoom.npclist : if mob[0] == npc : if mob[0].isInvul() and Rnd.get(100) < 12 : if debug : print "DarkCloudMansion: spawn room 4 guard" newNpc = self.addSpawn(BM[Rnd.get(len(BM))], player.getX(), player.getY(), player.getZ(), 0, False, 0, False, world.instanceId) if world.status == 9 and not world.attacked : checkBelethSample(self, world, npc, player, BS)
def onKill(self, npc, player, isPet): st = player.getQuestState(qn) if not st: return npcId = npc.getNpcId() if npcId in Droplist.keys(): if Rnd.get(100) < Droplist[npcId]: st.giveItems(Medal, 1) st.playSound("ItemSound.quest_itemget") return
def onKill(self,npc,player,isPet) : st = player.getQuestState(qn) if not st : return npcId = npc.getNpcId() if npcId in Droplist.keys() : if Rnd.get(100) < Droplist[npcId] : st.giveItems(Medal,1) st.playSound("ItemSound.quest_itemget") return
def onKill(self,npc,player,isPet): npcId = npc.getNpcId() if npcId == Nastron : respawnMinDelay = 43200000 * int(Config.RAID_MIN_RESPAWN_MULTIPLIER) respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER) respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay) self.saveGlobalQuestVar("616_respawn", str(System.currentTimeMillis()+respawn_delay)) self.startQuestTimer("spawn_npc", respawn_delay, None, None) self.cancelQuestTimer("Soul of Fire Nastron has despawned",npc,None) party = player.getParty() if party : PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray() : st1 = player1.getQuestState(qn) if st1 : if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) : PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0 : return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(Totem2) > 0 : st.takeItems(Totem2,1) st.giveItems(Fire_Heart,1) st.set("cond","3") st.set("id","3") st.playSound("ItemSound.quest_middle") else : st = player.getQuestState(qn) if not st : return if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) : if st.getQuestItemsCount(Totem2) > 0 : st.takeItems(Totem2,1) st.giveItems(Fire_Heart,1) st.set("cond","3") st.set("id","3") st.playSound("ItemSound.quest_middle") elif npcId in Varka_Mobs : st = player.getQuestState(qn) if st : if st.getQuestItemsCount(Fire_Heart) : st.takeItems(Fire_Heart,-1) st.unset("cond") st.unset("id") st.exitQuest(1) 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(), "清除入侵者。")) else: self.FirstAttacked = True npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "發現非法的目標。")) npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "開始入侵者清除系統。")) 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(),"清除入侵者。")) else : self.FirstAttacked = True npc.broadcastPacket(NpcSay(objId,0,npc.getNpcId(),"發現非法的目標。")) npc.broadcastPacket(NpcSay(objId,0,npc.getNpcId(),"開始入侵者清除系統。")) return
def onSkillSee(self, npc, player, skill, targets, isPet): # this behavior is only run when the target of skill is the passed npc (chest) # i.e. when the player is attempting to open the chest using a skill if not npc in targets: return npcId = npc.getNpcId() skillId = skill.getId() skillLevel = skill.getLevel() # check if the npc and skills used are valid for this script. Exit if invalid. if npcId not in self.chests: return # if this has already been interacted, no further ai decisions are needed # if it's the first interaction, check if this is a box or mimic if not npc.isInteracted(): npc.setInteracted() if Rnd.get(100) < IS_BOX: # if it's a box, either it will be successfully openned by a proper key, or instantly disappear if skillId == SKILL_DELUXE_KEY: # check the chance to open the box keyLevelNeeded = int(npc.getLevel() / 10) levelDiff = keyLevelNeeded - skillLevel if levelDiff < 0: levelDiff = levelDiff * (-1) chance = BASE_CHANCE - levelDiff * LEVEL_DECREASE # success, pretend-death with rewards: npc.reduceCurrentHp(99999999, player) if Rnd.get(100) < chance: npc.setMustRewardExpSp(False) npc.setSpecialDrop() npc.reduceCurrentHp(99999999, player) return # used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards npc.onDecay() else: attacker = player if npc.getAttackByList().contains(player.getPet()): attacker = player.getPet() npc.setRunning() npc.addDamageHate(attacker, 0, 999) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker) return
def runSteamRoom3Oracle(self, world): world.OracleTriggered = False o1, o2, o3, o4 = ordreOracle3[Rnd.get(len(ordreOracle3))] self.addSpawn(o1, 152461, 152505, -12169, 31613, False, 0, False, world.instanceId) self.addSpawn(o2, 152461, 152575, -12169, 31613, False, 0, False, world.instanceId) self.addSpawn(o3, 152461, 152645, -12169, 31613, False, 0, False, world.instanceId) self.addSpawn(o4, 152461, 152715, -12169, 31613, False, 0, False, world.instanceId)
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 onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == DAIMON: respawnMinDelay = 43200000 * int( Config.RAID_MIN_RESPAWN_MULTIPLIER) respawnMaxDelay = 129600000 * int( Config.RAID_MAX_RESPAWN_MULTIPLIER) respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay) self.saveGlobalQuestVar( "604_respawn", str(System.currentTimeMillis() + respawn_delay)) self.startQuestTimer("spawn_npc", respawn_delay, None, None) self.cancelQuestTimer("Daimon the White-Eyed has despawned", npc, None) party = player.getParty() if party: PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray(): st1 = player1.getQuestState(qn) if st1: if st1.getState() == State.STARTED and ( st1.getInt("cond") == 1 or st1.getInt("cond") == 2): PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0: return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(S_SUMMON) > 0: st.takeItems(S_SUMMON, 1) st.giveItems(ESSENCE, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") else: st = player.getQuestState(qn) if not st: return if st.getState() == State.STARTED and ( st.getInt("cond") == 1 or st.getInt("cond") == 2): if st.getQuestItemsCount(S_SUMMON) > 0: st.takeItems(S_SUMMON, 1) st.giveItems(ESSENCE, 1) st.set("cond", "3") st.playSound("ItemSound.quest_middle") return
def onSkillSee (self,npc,player,skill,targets,isPet): # this behavior is only run when the target of skill is the passed npc (chest) # i.e. when the player is attempting to open the chest using a skill if not npc in targets: return npcId = npc.getNpcId() skillId = skill.getId() skillLevel= skill.getLevel() # check if the npc and skills used are valid for this script. Exit if invalid. if npcId not in self.chests : return # if this has already been interacted, no further ai decisions are needed # if it's the first interaction, check if this is a box or mimic if not npc.isInteracted() : npc.setInteracted() if Rnd.get(100) < IS_BOX : # if it's a box, either it will be successfully openned by a proper key, or instantly disappear if skillId == SKILL_DELUXE_KEY : # check the chance to open the box keyLevelNeeded = int(npc.getLevel()/10) levelDiff = keyLevelNeeded - skillLevel if levelDiff < 0 : levelDiff = levelDiff * (-1) chance = BASE_CHANCE - levelDiff * LEVEL_DECREASE # success, pretend-death with rewards: npc.reduceCurrentHp(99999999, player) if Rnd.get(100) < chance : npc.setMustRewardExpSp(False) npc.setSpecialDrop(); npc.reduceCurrentHp(99999999, player) return # used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards npc.onDecay() else : attacker = player if npc.getAttackByList().contains(player.getPet()): attacker = player.getPet() npc.setRunning() npc.addDamageHate(attacker,0,999) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker) return
def onAttack(self, npc, player, damage, isPet, skill): npcId = npc.getNpcId() if npcId == Tears: try: test = self.npcobject[npc.getObjectId()] except: self.npcobject[npc.getObjectId()] = PyObject() try: test = self.npcobject[npc.getObjectId()].copylist except: self.npcobject[npc.getObjectId()].copylist = [] try: test = self.npcobject[npc.getObjectId()].isSpawned except: self.npcobject[npc.getObjectId()].isSpawned = False if self.npcobject[npc.getObjectId()].isSpawned: for onpc in self.npcobject[npc.getObjectId()].copylist: onpc.onDecay() self.npcobject[npc.getObjectId()].copylist = [] self.npcobject[npc.getObjectId()].isSpawned = False return maxHp = npc.getMaxHp() nowHp = npc.getStatus().getCurrentHp() rand = Rnd.get(0, 150) if (nowHp < maxHp * 0.4 and not self.npcobject[npc.getObjectId()].isSpawned ) and rand < 5: party = player.getParty() if party: for partyMember in party.getPartyMembers().toArray(): partyMember.setTarget(None) partyMember.abortAttack() partyMember.abortCast() partyMember.breakAttack() partyMember.breakCast() partyMember.getAI().setIntention( CtrlIntention.AI_INTENTION_IDLE) else: player.setTarget(None) player.abortAttack() player.abortCast() player.breakAttack() player.breakCast() player.getAI().setIntention( CtrlIntention.AI_INTENTION_IDLE) self.npcobject[npc.getObjectId()].isSpawned = True for i in range(0, 10): self.npcobject[npc.getObjectId()].copylist.append( self.addSpawn(Tears_Copy, npc.getX(), npc.getY(), npc.getZ(), 0, False, 0, False, player.getInstanceId()))
def onAttack(self, npc, player, damage, isPet, skill): npcId = npc.getNpcId() if self.worlds.has_key(npc.getInstanceId()): world = self.worlds[player.getInstanceId()] if world.status == 2: if npcId == 22264: closeDoor(D2, world.instanceId) if world.status == 7: if npcId == SC: closeDoor(D5, world.instanceId) for mob in world.ForthRoom.npclist: if mob[0] == npc: if mob[0].isInvul() and Rnd.get(100) < 12: if debug: print "DarkCloudMansion: spawn room 4 guard" newNpc = self.addSpawn(BM[Rnd.get(len(BM))], player.getX(), player.getY(), player.getZ(), 0, False, 0, False, world.instanceId) if world.status == 9 and not world.attacked: checkBelethSample(self, world, npc, player, BS)
def onKill(self, npc, player, isPet): partyMember1 = self.getRandomPartyMember(player, "1") partyMember2 = self.getRandomPartyMemberState(player, State.COMPLETED) if not partyMember1 and not partyMember2: return partyMember = partyMember1 numItems, chance = divmod(100 * Config.RATE_DROP_QUEST, 100) dropchance = Rnd.get(100) if dropchance < chance: # player who has State.COMPLETED up to 2 out of 3 item collections may consume the party drop if partyMember2: if Rnd.get(100) <= 66: return else: partyMember = partyMember1 st = partyMember.getQuestState(qn) if st: if st.getState() == State.STARTED: npcId = npc.getNpcId() if st.getInt("cond") == 1: if dropchance < chance: numItems = numItems + 1 numItems = int(numItems) item = ITEMS[npcId] count = st.getQuestItemsCount(item) if count < 50: if count + numItems > 50: numItems = 50 - count st.giveItems(item, numItems) count_trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES) count_foot = st.getQuestItemsCount( FOOT_OF_BANDERSNATCHLING) count_spice = st.getQuestItemsCount(SECRET_SPICE) if count_trunk == count_foot == count_spice == 50: st.set("cond", "3") st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") 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 onKill(self,npc,player,isPet): partyMember1 = self.getRandomPartyMember(player,"1") partyMember2 = self.getRandomPartyMemberState(player, State.COMPLETED) if not partyMember1 and not partyMember2 : return partyMember = partyMember1 numItems,chance = divmod(100*Config.RATE_DROP_QUEST,100) dropchance = Rnd.get(100) if dropchance < chance: # player who has State.COMPLETED up to 2 out of 3 item collections may consume the party drop if partyMember2 : if Rnd.get(100) <= 66: return else : partyMember = partyMember1 st = partyMember.getQuestState(qn) if st : if st.getState() == State.STARTED : npcId = npc.getNpcId() if st.getInt("cond") == 1: if dropchance < chance : numItems = numItems + 1 numItems = int(numItems) item = ITEMS[npcId] count = st.getQuestItemsCount(item) if count < 50 : if count + numItems > 50 : numItems = 50 - count st.giveItems(item,numItems) count_trunk = st.getQuestItemsCount(TRUNK_OF_NEPENTHES) count_foot = st.getQuestItemsCount(FOOT_OF_BANDERSNATCHLING) count_spice = st.getQuestItemsCount(SECRET_SPICE) if count_trunk == count_foot == count_spice == 50 : st.set("cond","3") st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") return
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 onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(100): return npc.broadcastPacket( CreatureSay(objId, 0, "Core", "Removing intruders.")) else: self.FirstAttacked = True npc.broadcastPacket( CreatureSay(objId, 0, "Core", "A non-permitted target has been discovered.")) npc.broadcastPacket( CreatureSay(objId, 0, "Core", "Starting intruder removal system.")) return
def onAttack (self, npc, player, damage, isPet, skill): npcId = npc.getNpcId() if npcId == Tears: try: test = self.npcobject[npc.getObjectId()] except: self.npcobject[npc.getObjectId()] = PyObject() try: test = self.npcobject[npc.getObjectId()].copylist except: self.npcobject[npc.getObjectId()].copylist = [] try: test = self.npcobject[npc.getObjectId()].isSpawned except: self.npcobject[npc.getObjectId()].isSpawned = False if self.npcobject[npc.getObjectId()].isSpawned: for onpc in self.npcobject[npc.getObjectId()].copylist: onpc.onDecay() self.npcobject[npc.getObjectId()].copylist = [] self.npcobject[npc.getObjectId()].isSpawned = False return maxHp = npc.getMaxHp() nowHp = npc.getStatus().getCurrentHp() rand = Rnd.get(0,150) if (nowHp < maxHp*0.4 and not self.npcobject[npc.getObjectId()].isSpawned) and rand<5: party = player.getParty() if party : for partyMember in party.getPartyMembers().toArray() : partyMember.setTarget(None) partyMember.abortAttack() partyMember.abortCast() partyMember.breakAttack(); partyMember.breakCast(); partyMember.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE) else: player.setTarget(None) player.abortAttack() player.abortCast() player.breakAttack(); player.breakCast(); player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE) self.npcobject[npc.getObjectId()].isSpawned = True for i in range(0,10): self.npcobject[npc.getObjectId()].copylist.append(self.addSpawn(Tears_Copy,npc.getX(),npc.getY(),npc.getZ(),0,False,0,False,player.getInstanceId()))
def onKill (self,npc,player,isPet): npcId = npc.getNpcId() if npcId in range(27185,27189) : for x in xrange(20): newNpc = self.addSpawn(27189,npc) killer = player if isPet : killer = player.getPet() newNpc.setRunning() newNpc.addDamageHate(killer,0,999) newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, killer) self.startQuestTimer("despawn",300000, newNpc, None) if Rnd.get(2) : skill = SkillTable.getInstance().getInfo(4243,1) if skill != None : skill.getEffects(newNpc, killer) return
def onAttack(self,npc,player,damage,isPet) : npcId = npc.getNpcId() # check if the npc and skills used are valid for this script. Exit if invalid. if npcId not in self.chests : return # if this was a mimic, set the target, start the skills and become agro if not npc.isInteracted() : npc.setInteracted() if Rnd.get(100) < IS_BOX : npc.onDecay() else : # if this weren't a box, upon interaction start the mimic behaviors... # todo: perhaps a self-buff (skill id 4245) with random chance goes here? attacker = player if isPet: attacker = player.getPet() npc.setRunning() npc.addDamageHate(attacker,0,(damage*100)/(npc.getLevel()+7)) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker) return
def runSecondRoom(self, world) : world.status = 4 openDoor(D3, world.instanceId) world.SecondRoom = PyObject() world.SecondRoom.monolith = [] i = Rnd.get(len(order)) a, b, c, d, e, f = order[i] world.SecondRoom.monolithOrder = [1, 0, 0, 0, 0, 0, 0] newNpc = self.addSpawn(BSM, 147800, 181150, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, a, 0]) newNpc = self.addSpawn(BSM, 147900, 181215, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, b, 0]) newNpc = self.addSpawn(BSM, 147900, 181345, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, c, 0]) newNpc = self.addSpawn(BSM, 147800, 181410, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, d, 0]) newNpc = self.addSpawn(BSM, 147700, 181345, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, e, 0]) newNpc = self.addSpawn(BSM, 147700, 181215, -6117, 0, False, 0, False, world.instanceId) world.SecondRoom.monolith.append([newNpc, f, 0]) if debug : print "DarkCloudMansion: spawned second room"
def onKill(self,npc,player,isPet): npcId = npc.getNpcId() if npcId == Ashutar : FindTemplate(Alter).setBusy(False) self.cancelQuestTimer("Soul of Water Ashutar has despawned",npc,None) party = player.getParty() if party : PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray() : st1 = player1.getQuestState(qn) if st1 : if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) : PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0 : return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] if st.getQuestItemsCount(Totem2) > 0 : st.takeItems(Totem2,1) st.giveItems(Ice_Heart,1) st.set("cond","3") st.set("id","3") st.playSound("ItemSound.quest_middle") else : st = player.getQuestState(qn) if not st : return if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) : if st.getQuestItemsCount(Totem2) > 0 : st.takeItems(Totem2,1) st.giveItems(Ice_Heart,1) st.set("cond","3") st.set("id","3") st.playSound("ItemSound.quest_middle") elif npcId in Ketra_Orcs : st = player.getQuestState(qn) if st : if st.getQuestItemsCount(Ice_Heart) : st.takeItems(Ice_Heart,-1) st.unset("cond") st.unset("id") st.exitQuest(1) return
def onKill(self, npc, player, isPet): party = player.getParty() if party: PartyQuestMembers = [] for player1 in party.getPartyMembers().toArray(): st1 = player1.getQuestState(qn) if st1: if st1.getState() == State.STARTED and st1.getQuestItemsCount(Tissue) == 0: PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0: return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] st.giveItems(Tissue, 1) st.playSound("ItemSound.quest_middle") else: # in case that party members disconnected or so st = player.getQuestState(qn) if not st: return if st.getState() == State.STARTED and st.getQuestItemsCount(Tissue) == 0: st.giveItems(Tissue, 1) st.playSound("ItemSound.quest_middle") return