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 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 onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == Ashutar: respawnMinDelay = 43200000 * int( Config.RAID_MIN_RESPAWN_MULTIPLIER) respawnMaxDelay = 129600000 * int( Config.RAID_MAX_RESPAWN_MULTIPLIER) respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay) self.saveGlobalQuestVar( "610_respawn", str(System.currentTimeMillis() + respawn_delay)) self.startQuestTimer("spawn_npc", respawn_delay, None, None) 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 onAttack(self, npc, player, damage, isPet, skill): npdId = npc.getNpcId() if (npc.getMaxHp()/2) > npc.getStatus().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.getPosition().setXYZ(185462,20342,-3250) 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 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 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.addReputationScore(CLAN_POINTS_REWARD,True) player.sendPacket(SystemMessage(1777).addNumber(CLAN_POINTS_REWARD)) clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan)) return htmltext
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 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.getInt( "cond") == 1: PartyQuestMembers.append(st1) if len(PartyQuestMembers) == 0: return st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] st.giveItems(Tissue1, 1) st.giveItems(Tissue2, 1) st.set("cond", "2") 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.getInt("cond") == 1: st.giveItems(Tissue1, 1) st.giveItems(Tissue2, 1) st.set("cond", "2") st.playSound("ItemSound.quest_middle") return
def onAttack(self, npc, player, damage, isPet, skill): npcId = npc.getNpcId() if npcId == TEARS: nowHp = npc.getStatus().getCurrentHp() percentage = nowHp / self.maxHp 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 (percentage <= 0.8 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())) if percentage <= 0.1 and not self.InvulCasted: castInvul(self) self.InvulCasted = True
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, skill): npdId = npc.getNpcId() if (npc.getMaxHp() / 2) > npc.getStatus().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.getPosition().setXYZ(185462, 20342, -3250) return
def onKill(self, npc, player, isPet): npcId = npc.getNpcId() # the chests always spawn, even if the RB is killed with nobody nearby doing the quest. if npcId in CHEST_SPAWNS.keys(): self.addSpawn(CHEST_SPAWNS[npcId], npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), True, 60000) else: value, dropId, chance = DROPLIST[npcId] if chance > 0 and Rnd.get(100) < chance: party = player.getParty() if party: PartyQuestMembers = [] for partyMember in party.getPartyMembers().toArray(): if partyMember.isInsideRadius(player, 1500, True, False): pst = partyMember.getQuestState(qn) if pst: if pst.getInt( "cond" ) == 8 and pst.getQuestItemsCount(dropId) < 30: PartyQuestMembers.append(pst) if len(PartyQuestMembers) == 0: return stw = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] stw.giveItems(dropId, 1) stw.takeItems(WHITE_CLOTH, 1) stw.playSound("Itemsound.quest_itemget") if stw.getQuestItemsCount(dropId) >= 30: stw.set("cond", "9") else: st = player.getQuestState(qn) if not st: return if st.getState() != State.STARTED: return if npcId in DROPLIST.keys(): if st.getInt("cond") == value: if value == 8 and st.getQuestItemsCount( dropId) < 30: st.giveItems(dropId, 1) st.takeItems(WHITE_CLOTH, 1) st.playSound("Itemsound.quest_itemget") if st.getQuestItemsCount(dropId) >= 30: st.set("cond", "9") return
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 onAttack (self, npc, player, damage, isPet, skill): npcId = npc.getNpcId() if npcId == TEARS: nowHp = npc.getStatus().getCurrentHp() percentage = nowHp / self.maxHp 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 (percentage <= 0.8 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())) if percentage <= 0.1 and not self.InvulCasted: castInvul(self) self.InvulCasted = True
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, int(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): 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,int(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): npcId=npc.getNpcId() # the chests always spawn, even if the RB is killed with nobody nearby doing the quest. if npcId in CHEST_SPAWNS.keys() : self.addSpawn(CHEST_SPAWNS[npcId], npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(), True, 60000) else : value,dropId,chance = DROPLIST[npcId] if chance > 0 and Rnd.get(100) < chance: party = player.getParty() if party : PartyQuestMembers = [] for partyMember in party.getPartyMembers().toArray() : if partyMember.isInsideRadius(player,1500,True,False): pst = partyMember.getQuestState(qn) if pst : if pst.getInt("cond") == 8 and pst.getQuestItemsCount(dropId) < 30 : PartyQuestMembers.append(pst) if len(PartyQuestMembers) == 0 : return stw = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))] stw.giveItems(dropId,1) stw.takeItems(WHITE_CLOTH,1) stw.playSound("Itemsound.quest_itemget") if stw.getQuestItemsCount(dropId) >= 30: stw.set("cond","9") else: st = player.getQuestState(qn) if not st : return if st.getState() != State.STARTED : return if npcId in DROPLIST.keys() : if st.getInt("cond") == value: if value == 8 and st.getQuestItemsCount(dropId) < 30: st.giveItems(dropId,1) st.takeItems(WHITE_CLOTH,1) st.playSound("Itemsound.quest_itemget") if st.getQuestItemsCount(dropId) >= 30: st.set("cond","9") 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
def onKill(self, npc, player, isPet): partyMember1 = self.getRandomPartyMember(player, "1") partyMember2 = self.getRandomPartyMember(player, "2") partyMember = partyMember1 # initialize if not partyMember1 and not partyMember2: return elif not partyMember2: partyMember = partyMember1 elif not partyMember1: partyMember = partyMember2 else: if Rnd.get(2): partyMember = partyMember2 if not partyMember: return st = partyMember.getQuestState(qn) if not st: return if st.getState() != State.STARTED: return count = st.getQuestItemsCount(ROUGH_JEWEL) if count < 10: st.giveItems(ROUGH_JEWEL, int(1)) if count == 9: st.playSound("ItemSound.quest_middle") st.set("cond", "3") else: st.playSound("ItemSound.quest_itemget") return
def onKill(self,npc,player,isPet): partyMember1 = self.getRandomPartyMember(player,"1") partyMember2 = self.getRandomPartyMember(player,"2") partyMember = partyMember1 # initialize if not partyMember1 and not partyMember2: return elif not partyMember2 : partyMember = partyMember1 elif not partyMember1 : partyMember = partyMember2 else : if Rnd.get(2): partyMember = partyMember2 if not partyMember : return st = partyMember.getQuestState(qn) if not st : return if st.getState() != State.STARTED : return count = st.getQuestItemsCount(ROUGH_JEWEL) if count<10 : st.giveItems(ROUGH_JEWEL,int(1)) if count == 9 : st.playSound("ItemSound.quest_middle") st.set("cond","3") else: st.playSound("ItemSound.quest_itemget") return
def getReward(self,rewards) : rand = Rnd.get(100) for item in rewards.keys() : if rand < rewards[item] : return item
def getReward(self, rewards): rand = Rnd.get(100) for item in rewards.keys(): if rand < rewards[item]: return item
def calculateChance(self,chance): dice = chance = Rnd.get(100) if dice >= chance: return False return True
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 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 onKill(self,npc,player,isPet): st = player.getQuestState(qn) if not st : return npcId = npc.getNpcId() cond = st.getInt("cond") rand = Rnd.get(100) instructions_1 = st.getQuestItemsCount(Test_Instructions_1) instructions_2 = st.getQuestItemsCount(Test_Instructions_2) if cond == 1 and instructions_1 : if npcId in Level_1.keys() : item,amount,chance = Level_1[npcId] if rand < chance and st.getQuestItemsCount(item) < amount : st.giveItems(item,1) if st.getQuestItemsCount(item) >= amount : st.playSound("ItemSound.quest_middle") else : st.playSound("ItemSound.quest_itemget") elif npcId == Breka_Orc_Warrior and rand < 10 : if st.getQuestItemsCount(3711) == 0 : st.addSpawn(27140,300000) elif st.getQuestItemsCount(3712) == 0 : st.addSpawn(27141,300000) elif st.getQuestItemsCount(3713) == 0 : st.addSpawn(27142,300000) elif npcId == Windsus and not st.getQuestItemsCount(3714) and rand < 10 : st.addSpawn(27143,300000) elif cond == 2 : if instructions_2 : if npcId in Level_2.keys() : item,amount,chance = Level_2[npcId] if rand < chance and st.getQuestItemsCount(item) < amount : st.giveItems(item,1) if st.getQuestItemsCount(item) >= amount : st.playSound("ItemSound.quest_middle") else : st.playSound("ItemSound.quest_itemget") elif npcId == Tarlk_Bugbear_Warrior and rand < 10 : if st.getQuestItemsCount(3722) == 0 : st.addSpawn(27144,300000) elif st.getQuestItemsCount(3723) == 0 : st.addSpawn(27145,300000) elif st.getQuestItemsCount(3724) == 0 : st.addSpawn(27146,300000) elif st.getQuestItemsCount(3725) == 0 : st.addSpawn(27147,300000) elif st.getQuestItemsCount(3726) == 0 : st.addSpawn(27148,300000) elif npcId in Tor_requests_1.keys() : req,give,giveAmount,amount,chance = Tor_requests_1[npcId] if rand < chance and st.getQuestItemsCount(req) and st.getQuestItemsCount(give) < amount : st.giveItems(give,eval(giveAmount)) if st.getQuestItemsCount(give) >= amount : st.playSound("ItemSound.quest_middle") else : st.playSound("ItemSound.quest_itemget") if npcId in [27160,27164] and Rnd.get(2) : st.addSpawn(27150,300000) st.addSpawn(27150,300000) AutoChat(npc,"We will destroy the legacy of the ancient empire!") elif cond == 3 : if npcId in Tor_requests_2.keys() : req,give,amount,chance = Tor_requests_2[npcId] if st.getQuestItemsCount(req) and st.getQuestItemsCount(give) < amount : if rand < chance : st.giveItems(give,1) if st.getQuestItemsCount(give) >= amount : st.playSound("ItemSound.quest_middle") else : st.playSound("ItemSound.quest_itemget") if npcId == 27162 and Rnd.get(2) : st.addSpawn(27150,300000) st.addSpawn(27150,300000) AutoChat(npc,"We will destroy the legacy of the ancient empire!") if npcId in [20661,20662,20589,20590,20639] and not Rnd.get(20) : st.addSpawn(Gremlin_Filcher,300000) AutoChat(npc,"Get out! The jewels are mine!") elif npcId == Gremlin_Filcher : req = 0 for item in Filcher.keys() : if st.getQuestItemsCount(item) : req = item break if req : item,amount,bonus = Filcher[req] if st.getQuestItemsCount(item) < amount : st.giveItems(item,bonus) if st.getQuestItemsCount(item) >= amount : st.playSound("ItemSound.quest_middle") else : st.playSound("ItemSound.quest_itemget") AutoChat(npc,"What!") if npcId in Tor_requests_tospawn.keys() and rand < 10: it1,it2,id = Tor_requests_tospawn[npcId] if st.getQuestItemsCount(it1) and not st.getQuestItemsCount(it2) : st.addSpawn(id,300000) if npcId in Lizardmen and player.getActiveWeaponItem() and player.getActiveWeaponItem().getItemId() == Cyb_Dagger and st.getQuestItemsCount(Cyb_Req) and not st.getQuestItemsCount(3708): if Rnd.get(2) : if cond == 2 or cond == 3 : for item in range(3698,3707) : if st.getQuestItemsCount(item) : st.giveItems(item+1,1) st.takeItems(item,-1) if item >= 3703 : st.playSound("ItemSound.quest_jackpot") break else : for item in range(3698,3707) : st.takeItems(item,-1) st.giveItems(3708,1) return
def onAdvEvent (self,event,npc,player): st = player.getQuestState(qn) if not st: return htmltext = event if event == "30744-03.htm" : st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") st.giveItems(Test_Instructions_1,1) st.set("cond","1") #set Memo = 0 elif event == "30744-32.htm" : st.playSound("ItemSound.quest_finish") if st.getQuestItemsCount(Leaf_Pin) >= 20 : htmltext = "30744-33.htm" st.rewardItems(57,20000) st.exitQuest(1) elif event == "30744-19.htm" : if not HasItems(st,1) : st.giveItems(Test_Instructions_2,1) htmltext = "30744-18.htm" elif event == "30745-03.htm" : if st.getQuestItemsCount(Test_Instructions_2) : htmltext = "30745-04.htm" elif event == "Tor_list_1" : if not st.getInt("hasTask") : htmltext = "<html><body>Guild Member Tor:<br>" pins = st.getQuestItemsCount(Leaf_Pin) reply_0 = Rnd.get(12) reply_1 = Rnd.get(12) reply_2 = Rnd.get(12) reply_3 = Rnd.get(12) reply_4 = Rnd.get(12) if Rnd.get(100) < 20 : if pins < 4 and pins : reply_0 = Rnd.get(6) + 12 reply_2 = Rnd.get(6) reply_3 = Rnd.get(6) + 6 elif pins >= 4 : reply_0 = Rnd.get(6) + 6 if not Rnd.get(20) : reply_1 = Rnd.get(2) + 18 reply_2 = Rnd.get(6) reply_3 = Rnd.get(6) + 6 elif pins >= 4 : if not Rnd.get(20) : reply_1 = Rnd.get(2) + 18 reply_2 = Rnd.get(6) reply_3 = Rnd.get(6) + 6 htmltext += Tor_menu[reply_0] + Tor_menu[reply_1] + Tor_menu[reply_2] + Tor_menu[reply_3] + Tor_menu[reply_4] htmltext += "</body></html>" elif event == "Tor_list_2" : if not st.getInt("hasTask") : htmltext = "<html><body>Guild Member Tor:<br>" pins = st.getQuestItemsCount(Leaf_Pin) reply_0 = Rnd.get(10) reply_1 = Rnd.get(10) reply_2 = Rnd.get(5) reply_3 = Rnd.get(5) + 5 reply_4 = Rnd.get(10) if Rnd.get(100) < 20 : if pins < 4 and pins: reply_0 = Rnd.get(6) + 10 elif pins >= 4 : reply_0 = Rnd.get(6) + 10 if not Rnd.get(20): reply_1 = Rnd.get(3) + 16 elif pins >= 4 : if not Rnd.get(20) : reply_1 = Rnd.get(3) + 16 htmltext += Tor_menu[reply_0 + 20] + Tor_menu[reply_1 + 20] + Tor_menu[reply_2 + 20] + Tor_menu[reply_3 + 20] + Tor_menu[reply_4 + 20] htmltext += "</body></html>" elif event == "30745-10.htm" : st.takeItems(Leaf_Pin,1) for item in range(3727,3811) : st.takeItems(item,-1) st.set("hasTask","0") elif event == "30746-03.htm" : if not st.getQuestItemsCount(Cyb_Req) : st.giveItems(Cyb_Req,1) if not st.getQuestItemsCount(3471) : st.giveItems(3471,1) if not st.getQuestItemsCount(3698) : st.giveItems(3698,1) st.takeItems(6708,-1) elif event == "30746-08.htm" : for item in Cyb_Rewards.keys() : if st.getQuestItemsCount(item) : st.takeItems(item,-1) st.rewardItems(57,Cyb_Rewards[item]) break elif event == "30746-12.htm" : st.takeItems(3698,-1) st.takeItems(3697,-1) st.takeItems(3471,-1) elif event.isdigit() : event = int(event) st.giveItems(event,1) st.set("hasTask","1") event = event - 3712 htmltext = "30745-" + str(event) + ".htm" return htmltext
def onAdvEvent(self, event, npc, player): st = player.getQuestState(qn) if not st: return htmltext = event if event == "30744-03.htm": st.setState(State.STARTED) st.playSound("ItemSound.quest_accept") st.giveItems(Test_Instructions_1, 1) st.set("cond", "1") #set Memo = 0 elif event == "30744-32.htm": st.playSound("ItemSound.quest_finish") if st.getQuestItemsCount(Leaf_Pin) >= 20: htmltext = "30744-33.htm" st.rewardItems(57, 20000) st.exitQuest(1) elif event == "30744-19.htm": if not HasItems(st, 1): st.giveItems(Test_Instructions_2, 1) htmltext = "30744-18.htm" elif event == "30745-03.htm": if st.getQuestItemsCount(Test_Instructions_2): htmltext = "30745-04.htm" elif event == "Tor_list_1": if not st.getInt("hasTask"): htmltext = "<html><body>Guild Member Tor:<br>" pins = st.getQuestItemsCount(Leaf_Pin) reply_0 = Rnd.get(12) reply_1 = Rnd.get(12) reply_2 = Rnd.get(12) reply_3 = Rnd.get(12) reply_4 = Rnd.get(12) if Rnd.get(100) < 20: if pins < 4 and pins: reply_0 = Rnd.get(6) + 12 reply_2 = Rnd.get(6) reply_3 = Rnd.get(6) + 6 elif pins >= 4: reply_0 = Rnd.get(6) + 6 if not Rnd.get(20): reply_1 = Rnd.get(2) + 18 reply_2 = Rnd.get(6) reply_3 = Rnd.get(6) + 6 elif pins >= 4: if not Rnd.get(20): reply_1 = Rnd.get(2) + 18 reply_2 = Rnd.get(6) reply_3 = Rnd.get(6) + 6 htmltext += Tor_menu[reply_0] + Tor_menu[reply_1] + Tor_menu[ reply_2] + Tor_menu[reply_3] + Tor_menu[reply_4] htmltext += "</body></html>" elif event == "Tor_list_2": if not st.getInt("hasTask"): htmltext = "<html><body>Guild Member Tor:<br>" pins = st.getQuestItemsCount(Leaf_Pin) reply_0 = Rnd.get(10) reply_1 = Rnd.get(10) reply_2 = Rnd.get(5) reply_3 = Rnd.get(5) + 5 reply_4 = Rnd.get(10) if Rnd.get(100) < 20: if pins < 4 and pins: reply_0 = Rnd.get(6) + 10 elif pins >= 4: reply_0 = Rnd.get(6) + 10 if not Rnd.get(20): reply_1 = Rnd.get(3) + 16 elif pins >= 4: if not Rnd.get(20): reply_1 = Rnd.get(3) + 16 htmltext += Tor_menu[reply_0 + 20] + Tor_menu[ reply_1 + 20] + Tor_menu[reply_2 + 20] + Tor_menu[ reply_3 + 20] + Tor_menu[reply_4 + 20] htmltext += "</body></html>" elif event == "30745-10.htm": st.takeItems(Leaf_Pin, 1) for item in range(3727, 3811): st.takeItems(item, -1) st.set("hasTask", "0") elif event == "30746-03.htm": if not st.getQuestItemsCount(Cyb_Req): st.giveItems(Cyb_Req, 1) if not st.getQuestItemsCount(3471): st.giveItems(3471, 1) if not st.getQuestItemsCount(3698): st.giveItems(3698, 1) st.takeItems(6708, -1) elif event == "30746-08.htm": for item in Cyb_Rewards.keys(): if st.getQuestItemsCount(item): st.takeItems(item, -1) st.rewardItems(57, Cyb_Rewards[item]) break elif event == "30746-12.htm": st.takeItems(3698, -1) st.takeItems(3697, -1) st.takeItems(3471, -1) elif event.isdigit(): event = int(event) st.giveItems(event, 1) st.set("hasTask", "1") event = event - 3712 htmltext = "30745-" + str(event) + ".htm" return htmltext
def onKill(self, npc, player, isPet): st = player.getQuestState(qn) if not st: return npcId = npc.getNpcId() cond = st.getInt("cond") rand = Rnd.get(100) instructions_1 = st.getQuestItemsCount(Test_Instructions_1) instructions_2 = st.getQuestItemsCount(Test_Instructions_2) if cond == 1 and instructions_1: if npcId in Level_1.keys(): item, amount, chance = Level_1[npcId] if rand < chance and st.getQuestItemsCount(item) < amount: st.giveItems(item, 1) if st.getQuestItemsCount(item) >= amount: st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") elif npcId == Breka_Orc_Warrior and rand < 10: if st.getQuestItemsCount(3711) == 0: st.addSpawn(27140, 300000) elif st.getQuestItemsCount(3712) == 0: st.addSpawn(27141, 300000) elif st.getQuestItemsCount(3713) == 0: st.addSpawn(27142, 300000) elif npcId == Windsus and not st.getQuestItemsCount( 3714) and rand < 10: st.addSpawn(27143, 300000) elif cond == 2: if instructions_2: if npcId in Level_2.keys(): item, amount, chance = Level_2[npcId] if rand < chance and st.getQuestItemsCount(item) < amount: st.giveItems(item, 1) if st.getQuestItemsCount(item) >= amount: st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") elif npcId == Tarlk_Bugbear_Warrior and rand < 10: if st.getQuestItemsCount(3722) == 0: st.addSpawn(27144, 300000) elif st.getQuestItemsCount(3723) == 0: st.addSpawn(27145, 300000) elif st.getQuestItemsCount(3724) == 0: st.addSpawn(27146, 300000) elif st.getQuestItemsCount(3725) == 0: st.addSpawn(27147, 300000) elif st.getQuestItemsCount(3726) == 0: st.addSpawn(27148, 300000) elif npcId in Tor_requests_1.keys(): req, give, giveAmount, amount, chance = Tor_requests_1[npcId] if rand < chance and st.getQuestItemsCount( req) and st.getQuestItemsCount(give) < amount: st.giveItems(give, eval(giveAmount)) if st.getQuestItemsCount(give) >= amount: st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") if npcId in [27160, 27164] and Rnd.get(2): st.addSpawn(27150, 300000) st.addSpawn(27150, 300000) AutoChat( npc, "We will destroy the legacy of the ancient empire!" ) elif cond == 3: if npcId in Tor_requests_2.keys(): req, give, amount, chance = Tor_requests_2[npcId] if st.getQuestItemsCount( req) and st.getQuestItemsCount(give) < amount: if rand < chance: st.giveItems(give, 1) if st.getQuestItemsCount(give) >= amount: st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") if npcId == 27162 and Rnd.get(2): st.addSpawn(27150, 300000) st.addSpawn(27150, 300000) AutoChat( npc, "We will destroy the legacy of the ancient empire!" ) if npcId in [20661, 20662, 20589, 20590, 20639 ] and not Rnd.get(20): st.addSpawn(Gremlin_Filcher, 300000) AutoChat(npc, "Get out! The jewels are mine!") elif npcId == Gremlin_Filcher: req = 0 for item in Filcher.keys(): if st.getQuestItemsCount(item): req = item break if req: item, amount, bonus = Filcher[req] if st.getQuestItemsCount(item) < amount: st.giveItems(item, bonus) if st.getQuestItemsCount(item) >= amount: st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") AutoChat(npc, "What!") if npcId in Tor_requests_tospawn.keys() and rand < 10: it1, it2, id = Tor_requests_tospawn[npcId] if st.getQuestItemsCount(it1) and not st.getQuestItemsCount(it2): st.addSpawn(id, 300000) if npcId in Lizardmen and player.getActiveWeaponItem( ) and player.getActiveWeaponItem().getItemId( ) == Cyb_Dagger and st.getQuestItemsCount( Cyb_Req) and not st.getQuestItemsCount(3708): if Rnd.get(2): if cond == 2 or cond == 3: for item in range(3698, 3707): if st.getQuestItemsCount(item): st.giveItems(item + 1, 1) st.takeItems(item, -1) if item >= 3703: st.playSound("ItemSound.quest_jackpot") break else: for item in range(3698, 3707): st.takeItems(item, -1) st.giveItems(3708, 1) return