def onAttack(self, npc, player, damage, isPet): npcId = npc.getNpcId() if npcId in HSMOBS: if (Rnd.get(2) == 1): if (Rnd.get(2) == 1): if player.getFirstEffect(int(4552)): holera = player.getFirstEffect(int(4552)).getLevel() if (Rnd.get(100) < 30): if holera < 10: newholera = int(holera + 1) npc.setTarget(player) npc.doCast(SkillTable.getInstance().getInfo( 4552, newholera)) else: npc.setTarget(player) npc.doCast(SkillTable.getInstance().getInfo(4552, 1)) else: if player.getFirstEffect(int(4554)): malaria = player.getFirstEffect(int(4554)).getLevel() if (Rnd.get(100) < 15): if malaria < 10: newmalaria = int(malaria + 1) npc.setTarget(player) npc.doCast(SkillTable.getInstance().getInfo( 4554, newmalaria)) else: npc.setTarget(player) npc.doCast(SkillTable.getInstance().getInfo(4554, 1)) return
def onAttack(self, npc, player, damage, isPet): npcId = npc.getNpcId() objId = npc.getObjectId() if self.MobSpawns.has_key(npcId): if npc.getStatus().getCurrentHp() <= npc.getMaxHp( ) * self.MobSpawns[npcId]['HP'] / 100 and Rnd.get( 100) < self.MobSpawns[npcId]['chance']: if self.MobTexts.has_key(npcId): text = self.MobTexts[npcId][Rnd.get( len(self.MobTexts[npcId]))] npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), text)) posX = npc.getX() posY = npc.getY() posZ = npc.getZ() signX = -500 signY = -500 if npc.getX() > player.getX(): signX = 500 if npc.getY() > player.getY(): signY = 500 posX = posX + signX posY = posY + signY npc.setIsAfraid(1) npc.setRunning() npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(posX, posY, posZ, 0)) self.startQuestTimer("Retreat", 10000, npc, player) return
def onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(4): return npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "Your rear is practically unguarded!")) else: self.FirstAttacked = True if Rnd.get(4): return npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "Watch your back!")) 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() == 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() == 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 onTalk(self, npc, player): npcId = npc.getNpcId() castleOwner = CastleManager.getInstance().getCastleById(8).getOwnerId() clanId = player.getClanId() if castleOwner and clanId: if castleOwner == clanId: X = 12558 + (Rnd.get(200) - 100) Y = -49279 + (Rnd.get(200) - 100) player.teleToLocation(X, Y, -3007) return else: htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>" else: htmltext = "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>" return htmltext
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 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>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 = "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 == CREATED and cond == 0 : htmltext = "31331-0c.htm" elif id == 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 onAttack(self,npc,player,damage,isPet) : npcId = npc.getNpcId() objId = npc.getObjectId() if npcId not in WATERED_SQUASH : return if npcId in self.adultLargeSquash : if Rnd.get(30) < 2 : mytext = ["Укусы плетут кружево крысой ..., чтобы заменить ... тело ...!", "Ха ха, росла! Полностью на всех!", "Не можете чтоли все прицелиться? Смотрите все, чтобы не сбежала ...", "Я считаю ваши удары! О, напоминает удар снова!", "Не тратьте впустую ваше время!", "Ха, этот звук действительно приятно слышать?", "Я потребляю ваши атаки, чтобы расти!", "Время, чтобы ударить снова! Ударь еще разок!", "Tолько полезная музыка может открыть большую тыкву... Меня нельзя открыть с оружием!"] npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) return
def onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(50): return npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "Dear ultimate power!!!")) else: self.FirstAttacked = True return
def onAttack (self,npc,player,damage,isPet): objId=npc.getObjectId() if self.FirstAttacked: if Rnd.get(100) : return npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!")) else : self.FirstAttacked = True npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"I will definitely repay this humiliation!")) return
def onKill(self, npc, player, isPet): found = False for effect in player.getAllEffects(): if effect.getSkill().getId() in KISS_OF_EVA: found = True if found: dropid = Rnd.get(len(REWARDS)) dropItem(npc, REWARDS[dropid], 1, player) return
def onAttack (self,npc,player,damage,isPet): objId=npc.getObjectId() if self.FirstAttacked: if Rnd.get(40) : return npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"There is no reason for you to kill me! I have nothing you need!")) else : self.FirstAttacked = True npc.broadcastPacket(CreatureSay(objId,0,npc.getName(),"We shall see about that!")) 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 onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(50): return npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "Destroy the enemy, my brothers!")) else: self.FirstAttacked = True 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.setXYZ(185462, 20342, -3250) return
def onKill (self,npc,player,isPet): npcId = npc.getNpcId() if npcId == self.scarlet_stokate_noble: if Rnd.get(100) <= 20: self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0) self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0) self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0) self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0) self.addSpawn(self.scarlet_stokate_noble_b,npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(),True,0) return
def onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(40): return npc.broadcastPacket( CreatureSay( objId, 0, npc.getName(), "You childish fool, do you think you can catch me?")) else: self.FirstAttacked = True return
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() == 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() == 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 onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(40): return npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "You wont take me down easily.")) else: self.FirstAttacked = True npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "We shall see about that!")) return
def onSkillUse (self,npc,player,skill): 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 onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == self.cats_eye_bandit: objId = npc.getObjectId() if Rnd.get(80): npc.broadcastPacket( CreatureSay( objId, 0, npc.getName(), "I must do something about this shameful incident...")) self.FirstAttacked = False elif self.FirstAttacked: self.addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ()) return
def onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(40): return npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "Hey! Were having a duel here!")) else: self.FirstAttacked = True npc.broadcastPacket( CreatureSay( objId, 0, npc.getName(), "How dare you interrupt our fight! Hey guys, help!")) return
def onAttack(self, npc, player, damage, isPet): objId = npc.getObjectId() if self.FirstAttacked: if Rnd.get(40): return npc.broadcastPacket( CreatureSay(objId, 0, npc.getName(), "Come on, Ill take you on!")) else: self.FirstAttacked = True npc.broadcastPacket( CreatureSay( objId, 0, npc.getName(), "How dare you interrupt a sacred duel! You must be taught a lesson!" )) 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 onAttack(self, npc, player, isPet, damage): npcId = npc.getNpcId() NewMob, chance, ModeSpawn = SplendorId[npcId] if Rnd.get(100) <= chance * Config.RATE_DROP_QUEST: if SplendorId.has_key(npcId): if ModeSpawn == 1: npc.deleteMe() newNpc = self.addSpawn(NewMob, npc) newNpc.addDamageHate(player, 0, 999) newNpc.getAI().setIntention( CtrlIntention.AI_INTENTION_ATTACK, player) elif self.AlwaysSpawn: return elif ModeSpawn == 2: self.AlwaysSpawn = True newNpc1 = self.addSpawn(NewMob, npc) newNpc1.addDamageHate(player, 0, 999) newNpc1.getAI().setIntention( CtrlIntention.AI_INTENTION_ATTACK, player) 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() != STARTED : return count = st.getQuestItemsCount(ROUGH_JEWEL) if count<10 : st.giveItems(ROUGH_JEWEL,1) if count == 9 : st.playSound("ItemSound.quest_middle") st.set("cond","3") else: st.playSound("ItemSound.quest_itemget") return
def onSkillUse(self,npc,player,skill): npcId = npc.getNpcId() skillId = skill.getId() if skillId != SKILL_NECTAR : return if npcId not in WATERED_SQUASH : return objectId = npc.getObjectId() if skillId == SKILL_NECTAR : # Первый полив if npc.getNectar() == 0 : if Rnd.get(2) == 1 : mytext = ["Чтобы быть способной расти, я должна пить только нектар ... причем чаще", "Если ты будеш быстрее выливать мне нектар - я быстрее выросту!", "Ну, верьте мне, прыскайте нектар! Я могу конечно превратиться в большую тыкву!!!", "Принеси нектар, чтобы вырастить тыкву!", "Плод прекрасной молодой тыквы начинает блестеть, когда семя предано земле! С этого времени будет способен стать здоровым и сильным!", "О, давно не виделись?", "Неожидал увидеть мое красивое появление?", "Отлично! Это - нечто! Нектар?", "Дозаправка! Заправь 5 бутылок, чтобы я смогла превратиться в большую тыкву! О!"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() npc.addGood() else : mytext = ["Не спеши! Слишком часто, я не успеваю!", "Я же не автомат, меня скорострельностью не напоиш", "Да куда же ты торопишься! Слишком часто, я не успеваю!", "Упс, опять слишком быстро", "Давай чуток помедленней, не спеши, медленно достань бутылку и медленно ее вылей!", "У тебя нет чувства скорости? Медленнее давай"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() # Второй полив elif npc.getNectar() == 1 : if Rnd.get(2) == 1 : mytext = ["Желаю стать большой тыквой!", "Ням, ням, ням! Вышло! Заботится - хорошо!", "Как думаеш, я зрелая или гнилая?", "Нектар - только лучшее! Ха! Ха! Ха!"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() npc.addGood() else : mytext = ["О! Опять мимо! Может слишком быстро расходуеш нектар?", "Если я умру такой как сейчас, Вы получите только молодую тыкву ...", "Выращивают немного быстрее! Неплохо было бы стать большой тыквой, молодая тыква не хороша!", "Tакую маленькую тыкву вы все должны есть? Принесите нектар, я могу быть больше!"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() # Третий полив elif npc.getNectar() == 2 : if Rnd.get(2) == 1 : mytext = ["Tыква, изголодалась! Просит утолить жажду!", "Ну наконец-то ..., это действительно вкусно! Есть еще?", "Ухаживаешь за мной только для того, чтобы есть? Отлично, является случайным ваш ..., чтобы не дать манну на самоубийство"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() npc.addGood() else : mytext = ["Не воду ли Вы добавляете? Какой вкус?", "Хозяин, спасите меня... Я не имею аромата нектара, я должна умереть ..."] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() # Четвертый полив elif npc.getNectar() == 3 : if Rnd.get(2) == 1 : mytext = ["Очень хорошо, делаешь чрезвычайно хорошо! Знаешь что следующим шагом должен делать?", "Если Вы поймаете меня, я даю Вам 10 миллионов adena!!! Согласны?"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() npc.addGood() else : mytext = ["Я голодна, Tы хочеш чтоб я засохла?", "Tребую нектар, чтобы расти немного быстрее."] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.addNectar() # Пятый полив elif npc.getNectar() == 4 : if Rnd.get(2) == 1 : npc.addGood() if npc.getGood() >= 3 : if npcId == 12774 : newGourd = self.addSpawn(12775,npc) newGourd.setOwner(player.getName()) self.startQuestTimer("Good By", 120000, newGourd, player) # Через 2 минуты исчезновение self.startQuestTimer("Good By2", 90000, newGourd, player) # 30 секунд до исчезновения self.startQuestTimer("Good By3", 100000, newGourd, player) # 20 секунд до исчезновения self.startQuestTimer("Good By4", 110000, newGourd, player) # 10 секунд до исчезновения mytext = ["Молодая тыква, жаждящая! Как, уже выросла?", "Я убегу через 2 минуты"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.onDecay() else : newGourd = self.addSpawn(12778,npc) newGourd.setOwner(player.getName()) self.startQuestTimer("Good By1", 120000, newGourd, player) # Через 2 минуты исчезновение self.startQuestTimer("Good By2", 90000, newGourd, player) # 30 секунд до исчезновения self.startQuestTimer("Good By3", 100000, newGourd, player) # 20 секунд до исчезновения self.startQuestTimer("Good By4", 110000, newGourd, player) # 10 секунд до исчезновения mytext = ["Милосердность является очень хорошей чертой. Tеперь посмотрите, я чувствую себя все более хорошо", "Я убегу через 2 минуты"] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.onDecay() else : if npcId == 12774 : newGourd = self.addSpawn(12776,npc) newGourd.setOwner(player.getName()) mytext = ["Эй! Была - не была! Есть! Сейчас же! Tы не можешь должным образом заботиться? Я же так сгнию!", "Ничего себе, остановки? За что тебя благодарить", "Жажду нектара о ...", "Вы хотите большую тыкву? Но я хочу остаться маленькой тыковкой ..."] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.onDecay() if npcId == 12777 : newGourd = self.addSpawn(12779,npc) newGourd.setOwner(player.getName()) mytext = ["Эй! Была - не была! Есть! Сейчас же! Tы не можешь должным образом заботиться? Я так сгнию!", "Ничего себе, остановки? За что тебя благодарить", "Жажду нектара о ...", "Вы хотите большую тыкву? Но я хочу остаться маленькой тыковкой ..."] npc.broadcastPacket(CreatureSay(objectId,0,npc.getName(),mytext[Rnd.get(len(mytext))])) npc.onDecay() return
def onTalk(self, npc, player): npcId = npc.getNpcId() htmltext = "" if npcId == 13001: #heart of warding if self.antharasAI: status = GrandBossManager.getInstance().getBossStatus(29019) statusW = GrandBossManager.getInstance().getBossStatus(29066) statusN = GrandBossManager.getInstance().getBossStatus(29067) statusS = GrandBossManager.getInstance().getBossStatus(29068) if status == 2 or statusW == 2 or statusN == 2 or statusS == 2: htmltext = "13001-02.htm" elif status == 3 or statusW == 3 or statusN == 3 or statusS == 3: htmltext = "13001-01.htm" elif 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) zone = GrandBossManager.getInstance().getZone( 179700, 113800, -7709) if zone: zone.allowPlayerEntry(player, 30) x = 179700 + Rnd.get(700) y = 113800 + Rnd.get(2100) player.teleToLocation(x, y, -7709) if status == 0: self.antharasAI.setAntharasSpawnTask() return else: htmltext = "13001-03.htm" elif npcId == 31859: #antharas teleport cube x = 79800 + Rnd.get(600) y = 151200 + Rnd.get(1100) player.teleToLocation(x, y, -3534) return elif npcId == 31385: #heart of volcano htmltext = "31385-01.htm" if self.valakasAI: status = GrandBossManager.getInstance().getBossStatus(29028) if status == 0 or status == 1: #If entrance to see Valakas is unlocked (he is Dormant or Waiting) st = player.getQuestState(qn) if self.count >= 200: htmltext = "31385-03.htm" elif st.getInt("allowEnter") == 1: st.unset("allowEnter") zone = GrandBossManager.getInstance().getZone( 212852, -114842, -1632) if zone: zone.allowPlayerEntry(player, 30) x = 204328 + Rnd.get(600) y = -111874 + Rnd.get(600) player.teleToLocation(x, y, 70) self.count = self.count + 1 if status == 0: valakas = GrandBossManager.getInstance().getBoss( 29028) self.valakasAI.startQuestTimer( "lock_entry_and_spawn_valakas", 60000 * Config.VALAKAS_WAIT_TIME, valakas, None) GrandBossManager.getInstance().setBossStatus( 29028, 1) return else: #player cheated, wasn't ported via npc Klein htmltext = "31385-04.htm" elif status == 2: htmltext = "31385-02.htm" else: htmltext = "31385-01.htm" else: htmltext = "31385-01.htm" elif npcId == 31384: #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210004).openMe() return elif npcId == 31686: #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210006).openMe() return elif npcId == 31687: #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210005).openMe() return elif npcId == 31540: #Watcher of Valakas Klein st = player.getQuestState(qn) if self.count < 50: htmltext = "31540-01.htm" elif self.count < 100: htmltext = "31540-02.htm" elif self.count < 150: htmltext = "31540-03.htm" elif self.count < 200: htmltext = "31540-04.htm" else: htmltext = "31540-05.htm" elif npcId == 31759: #valakas teleport cube x = 150037 + Rnd.get(500) y = -57720 + Rnd.get(500) player.teleToLocation(x, y, -2976) return return htmltext
def getReward(self, rewards): rand = Rnd.get(100) for item in rewards.keys(): if rand < rewards[item]: return item