private static final void renameSubPledge( L2PcInstance player, int pledgeType, String pledgeName) { if (!player.isClanLeader()) { player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT)); return; } final L2Clan clan = player.getClan(); final SubPledge subPledge = player.getClan().getSubPledge(pledgeType); if (subPledge == null) { player.sendMessage("Pledge don't exists."); return; } if (!Util.isAlphaNumeric(pledgeName) || 2 > pledgeName.length()) { player.sendPacket(new SystemMessage(SystemMessageId.CLAN_NAME_INCORRECT)); return; } if (pledgeName.length() > 16) { player.sendPacket(new SystemMessage(SystemMessageId.CLAN_NAME_TOO_LONG)); return; } subPledge.setName(pledgeName); clan.updateSubPledgeInDB(subPledge.getId()); clan.broadcastClanStatus(); player.sendMessage("Pledge name changed."); }
@Override public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.setCond(2, true); } }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); if (qs == null) { return super.onKill(npc, killer, isSummon); } switch (npc.getId()) { case MARSH_ZOMBIE: { if (hasQuestItems(killer, PRESERVE_OIL) && (getRandom(10) < 5) && Util.checkIfInRange(1500, npc, killer, true)) { giveItems(killer, ZOMBIE_HEAD, 1); takeItems(killer, PRESERVE_OIL, -1); qs.setCond(7, true); } break; } case DOOM_SOLDIER: case SKELETON_HUNTER: case SKELETON_HUNTER_ARCHER: { if (hasQuestItems(killer, CECKTINONS_VOUCHER2) && giveItemRandomly(qs.getPlayer(), npc, BONE_FRAGMENT, 1, 10, 1.0, true)) { qs.setCond(4, true); } break; } } return super.onKill(npc, killer, isSummon); }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); if (st == null) { return getNoQuestMsg(player); } if (Util.isDigit(event)) { int i = Integer.valueOf(event); final ClassId cid = player.getClassId(); if ((cid.getRace() == Race.DARK_ELF) && (cid.getId() == CLASSES[i][1])) { int suffix; final boolean item = st.hasQuestItems(CLASSES[i][6]); if (player.getLevel() < 20) { suffix = (!item) ? CLASSES[i][2] : CLASSES[i][3]; } else { if (!item) { suffix = CLASSES[i][4]; } else { suffix = CLASSES[i][5]; st.giveItems(SHADOW_WEAPON_COUPON_DGRADE, 15); st.takeItems(CLASSES[i][6], -1); player.setClassId(CLASSES[i][0]); player.setBaseClass(CLASSES[i][0]); st.playSound(QuestSound.ITEMSOUND_QUEST_FANFARE_2); player.broadcastUserInfo(); st.exitQuest(false); } } event = npc.getId() + "-" + suffix + ".html"; } } return event; }
@Override protected void runImpl() { // Get the current L2PcInstance of the player final L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) { return; } // Get the level of the used skill int level = activeChar.getSkillLevel(_skillId); if (level <= 0) { activeChar.sendPacket(ActionFailed.STATIC_PACKET); return; } // Get the L2Skill template corresponding to the skillID received from the client Skill skill = SkillData.getInstance().getSkill(_skillId, level); // Check the validity of the skill if (skill != null) { activeChar.setCurrentSkillWorldPosition(new Location(_x, _y, _z)); // normally magicskilluse packet turns char client side but for these skills, it doesn't (even // with correct target) activeChar.setHeading( Util.calculateHeadingFrom(activeChar.getX(), activeChar.getY(), _x, _y)); Broadcast.toKnownPlayers(activeChar, new ValidateLocation(activeChar)); activeChar.useMagic(skill, _ctrlPressed, _shiftPressed); } else { activeChar.sendPacket(ActionFailed.STATIC_PACKET); _log.warning("No skill found with id " + _skillId + " and level " + level + " !!"); } }
@Override public void parseDocument(Document doc, File f) { try { int id = Integer.parseInt(f.getName().replaceAll(".xml", "")); int entryId = 1; Node att; final ListContainer list = new ListContainer(id); for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { att = n.getAttributes().getNamedItem("applyTaxes"); list.setApplyTaxes((att != null) && Boolean.parseBoolean(att.getNodeValue())); att = n.getAttributes().getNamedItem("useRate"); if (att != null) { try { list.setUseRate(Double.valueOf(att.getNodeValue())); if (list.getUseRate() <= 1e-6) { throw new NumberFormatException( "The value cannot be 0"); // threat 0 as invalid value } } catch (NumberFormatException e) { try { list.setUseRate(Config.class.getField(att.getNodeValue()).getDouble(Config.class)); } catch (Exception e1) { LOG.warn( "{}: Unable to parse {}", getClass().getSimpleName(), doc.getLocalName(), e1); list.setUseRate(1.0); } } catch (DOMException e) { LOG.warn("{}: Unable to parse {}", getClass().getSimpleName(), doc.getLocalName(), e); } } att = n.getAttributes().getNamedItem("maintainEnchantment"); list.setMaintainEnchantment((att != null) && Boolean.parseBoolean(att.getNodeValue())); for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) { Entry e = parseEntry(d, entryId++, list); list.getEntries().add(e); } else if ("npcs".equalsIgnoreCase(d.getNodeName())) { for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling()) { if ("npc".equalsIgnoreCase(b.getNodeName())) { if (Util.isDigit(b.getTextContent())) { list.allowNpc(Integer.parseInt(b.getTextContent())); } } } } } } } _entries.put(id, list); } catch (Exception e) { LOG.error("{}: Error in file {}", getClass().getSimpleName(), f, e); } }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final List<L2PcInstance> randomList = new ArrayList<>(); final QuestState st = killer.getQuestState(getName()); if ((st != null) && st.isStarted()) { randomList.add(killer); randomList.add(killer); } final int monsterChance = MONSTER_DROP_CHANCES.get(npc.getId()); if (killer.isInParty()) { for (L2PcInstance member : killer.getParty().getMembers()) { final QuestState qs = member.getQuestState(getName()); if ((qs != null) && qs.isStarted()) { randomList.add(member); } } } if (!randomList.isEmpty()) { final L2PcInstance player = randomList.get(getRandom(randomList.size())); if ((getRandom(1000) < monsterChance) && Util.checkIfInRange(1500, npc, player, true)) { giveItems(player, REMNANTS_OF_OLD_DWARVES_DREAMS, 1); playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } return super.onKill(npc, killer, isSummon); }
/** * Return the number of playable characters in a defined radius around the specified object. * * @param range : the radius in which to look for players * @param npc : the object whose knownlist to check * @param playable : if {@code true}, count summons and pets aswell * @param invisible : if {@code true}, count invisible characters aswell * @return the number of targets found */ public static int getPlayersCountInRadius( int range, L2Object npc, boolean playable, boolean invisible) { int count = 0; final Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values(); for (L2Object obj : objs) { if ((obj != null) && ((obj.isPlayable() && playable) || obj.isPet())) { if (obj.isPlayer() && !invisible && obj.getActingPlayer().getAppearance().getInvisible()) { continue; } final L2Character cha = (L2Character) obj; if (((cha.getZ() < (npc.getZ() - 100)) && (cha.getZ() > (npc.getZ() + 100))) || !(GeoData.getInstance() .canSeeTarget( cha.getX(), cha.getY(), cha.getZ(), npc.getX(), npc.getY(), npc.getZ()))) { continue; } if (Util.checkIfInRange(range, npc, obj, true) && !cha.isDead()) { count++; } } } return count; }
private boolean checkTeleport(L2PcInstance player) { final L2Party party = player.getParty(); if (party == null) { return false; } if (!party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; } for (L2PcInstance partyMember : party.getMembers()) { if (partyMember.getLevel() < 78) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } if (!Util.checkIfInRange(500, player, partyMember, true)) { final SystemMessage sm = SystemMessage.getSystemMessage( SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } if (InstanceManager.getInstance().getPlayerWorld(player) != null) { final SystemMessage sm = SystemMessage.getSystemMessage( SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); if (System.currentTimeMillis() < reentertime) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_5, -1, false) < 1) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_QUEST_REQUIREMENT_NOT_SUFFICIENT); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } } return true; }
/** Handle chat type 'all' */ @Override public void handleChat(int type, L2PcInstance activeChar, String params, String text) { boolean vcd_used = false; if (text.startsWith(".")) { StringTokenizer st = new StringTokenizer(text); IVoicedCommandHandler vch; String command = ""; if (st.countTokens() > 1) { command = st.nextToken().substring(1); params = text.substring(command.length() + 2); vch = VoicedCommandHandler.getInstance().getHandler(command); } else { command = text.substring(1); if (Config.DEBUG) { _log.info("Command: " + command); } vch = VoicedCommandHandler.getInstance().getHandler(command); } if (vch != null) { vch.useVoicedCommand(command, activeChar, params); vcd_used = true; } else { if (Config.DEBUG) { _log.warning("No handler registered for bypass '" + command + "'"); } vcd_used = false; } } if (!vcd_used) { if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type)) { activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } /** * Match the character "." literally (Exactly 1 time) Match any character that is NOT a . * character. Between one and unlimited times as possible, giving back as needed (greedy) */ if (text.matches("\\.{1}[^\\.]+")) { activeChar.sendPacket(SystemMessageId.INCORRECT_SYNTAX); } else { CreatureSay cs = new CreatureSay( activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text); Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values(); for (L2PcInstance player : plrs) { if ((player != null) && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar)) { player.sendPacket(cs); } } activeChar.sendPacket(cs); } } }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { switch (npc.getId()) { case SCAVENGER_WERERAT: { if (qs.isMemoState(5) && (getQuestItemsCount(killer, RATMAN_SCAVENGERS_SKULL) < 10)) { if (getQuestItemsCount(killer, RATMAN_SCAVENGERS_SKULL) == 9) { giveItems(killer, RATMAN_SCAVENGERS_SKULL, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { giveItems(killer, RATMAN_SCAVENGERS_SKULL, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case TYRANT_KINGPIN: { if (qs.isMemoState(7) && !hasQuestItems(killer, TYRANT_KINGPINS_HEART)) { giveItems(killer, TYRANT_KINGPINS_HEART, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } break; } case TUREK_WAR_HOUND: { if (qs.isMemoState(6) && (getQuestItemsCount(killer, TUREK_WAR_HOUNDS_TAIL) < 10)) { if (getQuestItemsCount(killer, TUREK_WAR_HOUNDS_TAIL) == 9) { giveItems(killer, TUREK_WAR_HOUNDS_TAIL, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { giveItems(killer, TUREK_WAR_HOUNDS_TAIL, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case TRISALIM_TARANTULA: { if (qs.isMemoState(8) && (getQuestItemsCount(killer, TRISALIM_TARANTULAS_VENOM_SAC) < 3)) { if (getQuestItemsCount(killer, TRISALIM_TARANTULAS_VENOM_SAC) == 2) { giveItems(killer, TRISALIM_TARANTULAS_VENOM_SAC, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { giveItems(killer, TRISALIM_TARANTULAS_VENOM_SAC, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } } } return super.onKill(npc, killer, isSummon); }
@Override public String onAttack( L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { final L2Playable playable = (isSummon) ? attacker.getSummon() : attacker; final int longRangeGuardRate = npc.getTemplate().getParameters().getInt("LongRangeGuardRate"); final double distance = Util.calculateDistance(npc, playable, true, false); if (npc.isAffectedBySkill(ULTIMATE_DEFENSE.getSkillId()) && (distance <= MIN_DISTANCE)) { npc.stopSkillEffects(true, ULTIMATE_DEFENSE.getSkillId()); } else if ((distance > MIN_DISTANCE) && !npc.isSkillDisabled(ULTIMATE_DEFENSE.getSkillId()) && !((skill != null) && Util.contains(NOT_ALLOWED_SKILLS, skill.getId())) && (getRandom(100) < longRangeGuardRate)) { npc.setTarget(npc); npc.doCast(ULTIMATE_DEFENSE.getSkill()); } return super.onAttack(npc, attacker, damage, isSummon, skill); }
private void giveItem(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); if ((st != null) && (st.isStarted()) && (!st.isCond(5)) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(MONSTER_DROPS.get(npc.getId()), 1); st.setCond(5, true); } }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { switch (npc.getId()) { case VENOMOUS_SPIDER: { if (hasQuestItems(killer, MORTE_TALISMAN) && (getQuestItemsCount(killer, VENOMOUS_SPIDERS_CARAPACE) < 1)) { giveItems(killer, VENOMOUS_SPIDERS_CARAPACE, 1); if (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) >= 5) { qs.setCond(5, true); } } break; } case ARACHNID_TRACKER: { if (hasQuestItems(killer, MORTE_TALISMAN) && (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) < 5)) { giveItems(killer, ARACHNID_TRACKER_SILK, 1); if (getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) == 5) { if ((getQuestItemsCount(killer, ARACHNID_TRACKER_SILK) >= 4) && hasQuestItems(killer, VENOMOUS_SPIDERS_CARAPACE)) { qs.setCond(5, true); } } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case LYCANTHROPE: { if (hasQuestItems(killer, PALLUS_TALISMAN) && (getQuestItemsCount(killer, LYCANTHROPE_SKULL) < 13)) { giveItems(killer, LYCANTHROPE_SKULL, 1); if (getQuestItemsCount(killer, LYCANTHROPE_SKULL) == 13) { qs.setCond(2, true); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } } } return super.onKill(npc, killer, isSummon); }
public void handleCheat(L2PcInstance player, L2Npc npc) { showHtmlFile(player, "data/html/seven_signs/rift/Cheater.htm", npc); if (!player.isGM()) { _log.warning( "Player " + player.getName() + "(" + player.getObjectId() + ") was cheating in dimension rift area!"); Util.handleIllegalPlayerAction( player, "Warning!! Character " + player.getName() + " tried to cheat in dimensional rift.", Config.DEFAULT_PUNISH); } }
@Override public L2Object[] getTargetList( Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new ArrayList<>(); target = activeChar.getSummon(); if ((target == null) || !target.isServitor() || target.isDead()) { return EMPTY_TARGET_LIST; } if (onlyFirst) { return new L2Character[] {target}; } final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE)); final Collection<L2Character> objs = target.getKnownList().getKnownCharacters(); int maxTargets = skill.getAffectLimit(); for (L2Character obj : objs) { if ((obj == null) || (obj == target) || (obj == activeChar)) { continue; } if (!Util.checkIfInRange(skill.getAffectRange(), target, obj, true)) { continue; } if (!(obj.isAttackable() || obj.isPlayable())) { continue; } if (!Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena)) { continue; } if ((maxTargets > 0) && (targetList.size() >= maxTargets)) { break; } targetList.add(obj); } if (targetList.isEmpty()) { return EMPTY_TARGET_LIST; } return targetList.toArray(new L2Character[targetList.size()]); }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false)) { if (!st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { st.giveItems(MIDDLE_GRADE_LIZARD_SCALE, 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); st.setCond(2, true); } else if (!st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) { st.giveItems(HIGH_GRADE_LIZARD_SCALE, 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); st.setCond(3, true); } } return super.onKill(npc, killer, isSummon); }
private final void refreshAiParams(L2Character attacker, L2Npc npc, int damage, int aggro) { final int newAggroVal = damage + getRandom(3000); final int aggroVal = aggro + 1000; final NpcVariables vars = npc.getVariables(); for (int i = 0; i < 3; i++) { if (attacker == vars.getObject("c_quest" + i, L2Character.class)) { if (vars.getInt("i_quest" + i) < aggroVal) { vars.set("i_quest" + i, newAggroVal); } return; } } final int index = Util.getIndexOfMinValue( vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2")); vars.set("i_quest" + index, newAggroVal); vars.set("c_quest" + index, attacker); }
/** * Handle chat type 'partymatchroom' * * @see net.sf.l2j.gameserver.handler.IChatHandler#handleChat(int, * net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String) */ public void handleChat(int type, L2PcInstance activeChar, String target, String text) { if (activeChar.isInPartyMatchRoom()) { PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar); if (_room != null) { if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type)) { activeChar.sendPacket( SystemMessage.getSystemMessage(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED)); return; } CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); for (L2PcInstance _member : _room.getPartyMembers()) { _member.sendPacket(cs); } } } }
@Override protected void runImpl() { final L2PcInstance player = getClient().getActiveChar(); if ((player == null) || (player.getBuyList() == null)) { return; } if ((_storeMsg != null) && (_storeMsg.length() > MAX_MSG_LENGTH)) { Util.handleIllegalPlayerAction( player, "Player " + player.getName() + " tried to overflow private store buy message", Config.DEFAULT_PUNISH); return; } player.getBuyList().setTitle(_storeMsg); player.sendPacket(new PrivateStoreMsgBuy(player)); }
@Override protected void runImpl() { final L2PcInstance player = getClient().getActiveChar(); if (player == null) { return; } if ((_name != null) && (_name.length() > MAX_MSG_LENGTH)) { Util.handleIllegalPlayerAction( player, "Player " + player.getName() + " tried to overflow recipe shop message", Config.DEFAULT_PUNISH); return; } if (player.hasManufactureShop()) { player.setStoreName(_name); } }
private int moveTo(L2Npc npc, int[] coords) { int time = 0; if (npc != null) { double distance = npc.calculateDistance(coords[0], coords[1], coords[2], true, false); int heading = Util.calculateHeadingFrom(npc.getX(), npc.getY(), coords[0], coords[1]); time = (int) ((distance / npc.getWalkSpeed()) * 1000); npc.setIsRunning(false); npc.disableCoreAI(true); npc.setIsNoRndWalk(true); npc.getAI() .setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, new Location(coords[0], coords[1], coords[2], heading)); npc.getSpawn().setX(coords[0]); npc.getSpawn().setY(coords[1]); npc.getSpawn().setZ(coords[2]); } return time == 0 ? 100 : time; }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { if (Util.checkIfInRange(1500, killer, npc, true)) { if (npc.getId() == SOUL_OF_WELL) { _soulWellNpc = null; } else { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isCond(4) && hasQuestItems(killer, CROSS_OF_EINHASAD) && !hasQuestItems(killer, LOST_SKULL_OF_ELF) && (getRandom(100) < 10)) { giveItems(killer, LOST_SKULL_OF_ELF, 1); qs.setCond(5, true); } } } return super.onKill(npc, killer, isSummon); }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isStarted() && npc.isScriptValue(1) && Util.checkIfInRange(1500, npc, killer, true)) { switch (npc.getId()) { case lIZARDMAN_WARRIOR: { if (!hasQuestItems(killer, LIZARD_CAPTAIN_ORDER)) { npc.broadcastPacket( new NpcSay( npc, ChatType.NPC_GENERAL, NpcStringId.ARRGHH_WE_SHALL_NEVER_SURRENDER)); giveItems(killer, LIZARD_CAPTAIN_ORDER, 1); qs.setCond(3, true); } break; } case LIZARDMAN_SCOUT: case LIZARDMAN_SOLDIER: { if (!hasQuestItems(killer, LIZARD_CAPTAIN_ORDER)) { giveItems(killer, LIZARD_CAPTAIN_ORDER, 1); qs.setCond(3, true); } break; } case TAMIL: { if (!hasQuestItems(killer, TAMIL_NECKLACE)) { giveItems(killer, TAMIL_NECKLACE, 1); qs.setCond(5, true); } break; } } } return super.onKill(npc, killer, isSummon); }
@Override public L2Object[] getTargetList( L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target) { List<L2Character> targetList = new FastList<>(); if (onlyFirst) return new L2Character[] {activeChar}; L2PcInstance player = null; if (activeChar instanceof L2Summon) { player = ((L2Summon) activeChar).getOwner(); targetList.add(player); } else if (activeChar instanceof L2PcInstance) { player = (L2PcInstance) activeChar; if (activeChar.getPet() != null) targetList.add(activeChar.getPet()); } if (activeChar.getParty() != null) { List<L2PcInstance> partyList = activeChar.getParty().getMembers(); for (L2PcInstance partyMember : partyList) { if (partyMember == null) continue; else if (partyMember == player) continue; else if (!partyMember.isDead() && Util.checkIfInRange(skill.getSkillRadius(), activeChar, partyMember, true)) { if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets()) break; targetList.add(partyMember); if (partyMember.getPet() != null && !partyMember.getPet().isDead()) { targetList.add(partyMember.getPet()); } } } } return targetList.toArray(new L2Character[targetList.size()]); }
private boolean validatePassword(String password) { if (!Util.isDigit(password)) return false; if (password.length() < 6 || password.length() > 8) return false; for (int i = 0; i < password.length() - 1; i++) { char curCh = password.charAt(i); char nxtCh = password.charAt(i + 1); if (curCh + 1 == nxtCh) return false; else if (curCh - 1 == nxtCh) return false; else if (curCh == nxtCh) return false; } for (int i = 0; i < password.length() - 2; i++) { String toChk = password.substring(i + 1); StringBuffer chkEr = new StringBuffer(password.substring(i, i + 2)); if (toChk.contains(chkEr)) return false; else if (toChk.contains(chkEr.reverse())) return false; } _wrongAttempts = 0; return true; }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { switch (npc.getId()) { case LAVA_SALAMANDER: { if (qs.isMemoState(3) && !hasQuestItems(killer, ESSENSE_OF_FLAME)) { qs.setMemoState(4); qs.setCond(4, true); giveItems(killer, ESSENSE_OF_FLAME, 1); } break; } case NAHIR: { if (qs.isMemoState(10) && !hasQuestItems(killer, HAIR_OF_NAHIR)) { qs.setMemoState(11); qs.setCond(11, true); giveItems(killer, HAIR_OF_NAHIR, 1); } break; } case BLACK_WILLOW: { if (qs.isMemoState(13) && !hasQuestItems(killer, DEBRIS_OF_WILLOW)) { qs.setMemoState(14); qs.setCond(14, true); giveItems(killer, DEBRIS_OF_WILLOW, 1); } break; } } } return super.onKill(npc, killer, isSummon); }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { switch (npc.getId()) { case MONSTER_EYE_DESTREOYER: { if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) < 5)) { giveItems(killer, MONSTER_EYE_DESTROYER_SKIN, 1); if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) == 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) >= 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) >= 2)) { qs.setCond(17, true); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case MEDUSA: { if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, MEDUSAS_BLOOD) < 12)) { giveItems(killer, MEDUSAS_BLOOD, 1); if (getQuestItemsCount(killer, MEDUSAS_BLOOD) == 12) { playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case GHOUL: { if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, GHOULS_SKIN) < 10)) { giveItems(killer, GHOULS_SKIN, 1); if (getQuestItemsCount(killer, GHOULS_SKIN) == 10) { qs.setCond(29, true); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case SHACKLE1: case SHACKLE2: { if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, SHACKLES_SCALP) < 2)) { giveItems(killer, SHACKLES_SCALP, 1); if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) >= 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) >= 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) == 2)) { qs.setCond(17, true); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case BREKA_ORC_SHAMAN: { if (hasQuestItems(killer, MIRIENS_2ND_SIGIL, GRAND_MAGISTER_SIGIL, JUREKS_LIST) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) < 5)) { giveItems(killer, SHAMANS_NECKLACE, 1); if ((getQuestItemsCount(killer, MONSTER_EYE_DESTROYER_SKIN) >= 5) && (getQuestItemsCount(killer, SHAMANS_NECKLACE) == 5) && (getQuestItemsCount(killer, SHACKLES_SCALP) >= 2)) { qs.setCond(17, true); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case FETTERED_SOUL: { if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, FETTERED_SOULS_ICHOR) < 5)) { giveItems(killer, FETTERED_SOULS_ICHOR, 1); if (getQuestItemsCount(killer, FETTERED_SOULS_ICHOR) >= 5) { playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case GRANDIS: { if (hasQuestItems(killer, MIRIENS_3RD_SIGIL, CRONOS_SIGIL, TRIFFS_RING) && !hasQuestItems(killer, SCRIPTURE_CHAPTER_3)) { giveItems(killer, SCRIPTURE_CHAPTER_3, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } break; } case ENCHANTED_GARGOYLE: { if (hasQuestItems(killer, TRIFFS_RING, POITANS_NOTES, CASIANS_LIST) && (getQuestItemsCount(killer, ENCHANTED_GARGOYLES_NAIL) < 5)) { giveItems(killer, ENCHANTED_GARGOYLES_NAIL, 1); if (getQuestItemsCount(killer, ENCHANTED_GARGOYLES_NAIL) >= 5) { playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case LETO_LIZARDMAN_WARRIOR: { if (hasQuestItems(killer, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL, CRERAS_PAINTING3) && (getQuestItemsCount(killer, BROWN_SCROLL_SCRAP) < 5)) { giveItems(killer, BROWN_SCROLL_SCRAP, 1); if (getQuestItemsCount(killer, BROWN_SCROLL_SCRAP) == 5) { qs.setCond(12, true); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } } } return super.onKill(npc, killer, isSummon); }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); if (tmpworld instanceof DNPWorld) { final DNPWorld world = (DNPWorld) tmpworld; switch (event) { case "FINISH": { if (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4) { player.showQuestMovie(13); startQuestTimer("TELEPORT", 27000, null, player); } break; } case "TELEPORT": { player.teleToLocation(ENTER, 0); break; } case "FIGHT": { for (L2Npc caster : world.anakimGroup) { if ((caster != null) && !caster.isCastingNow()) { makeCast(caster, world.lilithGroup); } if ((caster != null) && (caster.getId() == ANAKIM)) { if (caster.isScriptValue(0)) { caster.broadcastPacket( new NpcSay( caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId .YOU_SUCH_A_FOOL_THE_VICTORY_OVER_THIS_WAR_BELONGS_TO_SHILIEN)); caster.setScriptValue(1); } else if (getRandom(100) < 10) { caster.broadcastPacket( new NpcSay( caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), LILITH_SHOUT[getRandom(3)])); } } } for (L2Npc caster : world.lilithGroup) { if ((caster != null) && !caster.isCastingNow()) { makeCast(caster, world.anakimGroup); } if ((caster != null) && (caster.getId() == 32715)) { if (caster.isScriptValue(0)) { caster.broadcastPacket( new NpcSay( caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.FOR_THE_ETERNITY_OF_EINHASAD)); if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket( new NpcSay( caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.MY_POWERS_WEAKENING_HURRY_AND_TURN_ON_THE_SEALING_DEVICE)); } caster.setScriptValue(1); } else if (getRandom(100) < 10) { switch (getRandom(3)) { case 0: { caster.broadcastPacket( new NpcSay( caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId .DEAR_SHILLIENS_OFFSPRINGS_YOU_ARE_NOT_CAPABLE_OF_CONFRONTING_US)); if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket( new NpcSay( caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.ALL_4_SEALING_DEVICES_MUST_BE_TURNED_ON)); } break; } case 1: { caster.broadcastPacket( new NpcSay( caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.ILL_SHOW_YOU_THE_REAL_POWER_OF_EINHASAD)); if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket( new NpcSay( caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId .LILITHS_ATTACK_IS_GETTING_STRONGER_GO_AHEAD_AND_TURN_IT_ON)); } break; } case 2: { caster.broadcastPacket( new NpcSay( caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId .DEAR_MILITARY_FORCE_OF_LIGHT_GO_DESTROY_THE_OFFSPRINGS_OF_SHILLIEN)); if (Util.checkIfInRange(2000, caster, player, true)) { player.sendPacket( new NpcSay( caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.DEAR_S1_GIVE_ME_MORE_STRENGTH) .addStringParameter(player.getName())); } break; } } } } startQuestTimer("FIGHT", 1000, null, player); } break; } } } return super.onAdvEvent(event, npc, player); }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true)) { switch (npc.getId()) { case GIANT_MIST_LEECH: { if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, BLOOD_OF_LEECH) < 10)) { giveItems(killer, BLOOD_OF_LEECH, 1); if (getQuestItemsCount(killer, BLOOD_OF_LEECH) >= 10) { playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case STINGER_WASP: { if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, STINGER_WASP_NEEDLE) < 10)) { giveItems(killer, STINGER_WASP_NEEDLE, 1); if (getQuestItemsCount(killer, STINGER_WASP_NEEDLE) >= 10) { playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case MARSH_SPIDER: { if (qs.isMemoState(4) && hasQuestItems(killer, INGREDIENTS_OF_ANTIDOTE) && (getQuestItemsCount(killer, MARSH_SPIDERS_WEB) < 10)) { giveItems(killer, MARSH_SPIDERS_WEB, 1); if (getQuestItemsCount(killer, MARSH_SPIDERS_WEB) >= 10) { playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } else { playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } break; } case EVIL_EYE_LORD: { if (qs.isMemoState(2) && hasQuestItems(killer, PAINT_OF_KAMURU) && !hasQuestItems(killer, NECKLACE_OF_KAMUTU)) { giveItems(killer, NECKLACE_OF_KAMUTU, 1); playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE); } break; } } } return super.onKill(npc, killer, isSummon); }