@Override protected void runImpl() { final L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) return; if (_page > 10 || _page < 0) return; switch (_type) { case 0x01: // item case 0x03: // action case 0x04: // macro case 0x05: // recipe { final L2ShortCut sc = new L2ShortCut(_slot, _page, _type, _id, -1, _characterType); sendPacket(new ShortCutRegister(sc)); activeChar.registerShortCut(sc); break; } case 0x02: // skill { int level = activeChar.getSkillLevel(_id); if (level > 0) { final L2ShortCut sc = new L2ShortCut(_slot, _page, _type, _id, level, _characterType); sendPacket(new ShortCutRegister(sc)); activeChar.registerShortCut(sc); } break; } } }
@Override protected void runImpl() { final L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) return; // Check if the player has a clan if (activeChar.getClan() == null) return; final Castle castle = CastleManager.getInstance().getCastleById(_castleId); if (castle == null) return; // Check if leader of the clan who owns the castle? if ((castle.getOwnerId() != activeChar.getClanId()) || (!activeChar.isClanLeader())) return; final L2Clan clan = ClanTable.getInstance().getClan(_clanId); if (clan == null) return; if (!castle.getSiege().getIsRegistrationOver()) { if (_approved == 1) { if (castle.getSiege().checkIsDefenderWaiting(clan)) castle.getSiege().approveSiegeDefenderClan(_clanId); else return; } else { if ((castle.getSiege().checkIsDefenderWaiting(clan)) || (castle.getSiege().checkIsDefender(clan))) castle.getSiege().removeSiegeClan(_clanId); } } // Update the defender list activeChar.sendPacket(new SiegeDefenderList(castle)); }
@Override public String onSpawn(L2Npc npc) { for (L2PcInstance target : npc.getKnownList().getKnownType(L2PcInstance.class)) { if (!target.isDead() && GeoData.getInstance().canSeeTarget(npc, target) && Util.checkIfInRange(npc.getAggroRange(), npc, target, true)) { if (target.getActiveWeaponInstance() != null && !npc.isInCombat() && npc.getTarget() == null) { npc.setTarget(target); npc.broadcastNpcSay( ((target.getAppearance().getSex()) ? "Sister " : "Brother ") + target.getName() + ", move your weapon away!"); switch (npc.getNpcId()) { case 22124: case 22126: case 22127: npc.doCast(SkillTable.getInstance().getInfo(4589, 8)); break; default: attack(((L2Attackable) npc), target); break; } } } } return super.onSpawn(npc); }
@Override protected void runImpl() { final L2PcInstance player = getClient().getActiveChar(); if (player == null) return; player.tryOpenPrivateSellStore(false); }
@Override public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (activeChar == null) return false; StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); // Get actual command if (actualCommand.equalsIgnoreCase("admin_zone_check")) showHtml(activeChar); else if (actualCommand.equalsIgnoreCase("admin_zone_visual")) { String next = st.nextToken(); if (next.equalsIgnoreCase("all")) { for (L2ZoneType zone : ZoneManager.getInstance().getZones(activeChar)) zone.visualizeZone(activeChar.getZ()); showHtml(activeChar); } else { int zoneId = Integer.parseInt(next); ZoneManager.getInstance().getZoneById(zoneId).visualizeZone(activeChar.getZ()); } } else if (actualCommand.equalsIgnoreCase("admin_zone_visual_clear")) { ZoneManager.getInstance().clearDebugItems(); showHtml(activeChar); } return true; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(qn); String htmltext = getNoQuestMsg(); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: if (player.getLevel() >= 18) htmltext = "30361-03.htm"; else { htmltext = "30361-02.htm"; st.exitQuest(true); } break; case STATE_STARTED: int shards = st.getQuestItemsCount(WIND_SHARD); if (shards == 0) htmltext = "30361-05.htm"; else { int reward = 40 * shards + (shards >= 10 ? 2988 : 0); htmltext = "30361-07.htm"; st.takeItems(WIND_SHARD, -1); st.rewardItems(57, reward); } break; } return htmltext; }
/** * Adda mercenary ticket. * * <ul> * <li>find the npc that needs to be saved in the mercenary spawns, given this item * <li>Use the passed character's location info to add the spawn * <li>create a copy of the item to drop in the world returns the id of the mercenary npc that * was added to the spawn returns -1 if this fails. * </ul> * * @param itemId * @param activeChar * @return */ public int addTicket(int itemId, L2PcInstance activeChar) { int x = activeChar.getX(); int y = activeChar.getY(); int z = activeChar.getZ(); int heading = activeChar.getHeading(); Castle castle = CastleManager.getInstance().getCastle(activeChar); if (castle == null) // this should never happen at this point return -1; for (int i = 0; i < ITEM_IDS.length; i++) { if (ITEM_IDS[i] == itemId) // Find the index of the item used { spawnMercenary(NPC_IDS[i], x, y, z, 3000); // Hire merc for this castle. NpcId is at the same index as the item used. castle.getSiege().getSiegeGuardManager().hireMerc(x, y, z, heading, NPC_IDS[i]); // create the ticket in the gameworld ItemInstance dropticket = new ItemInstance(IdFactory.getInstance().getNextId(), itemId); dropticket.setLocation(ItemInstance.ItemLocation.INVENTORY); dropticket.setDestroyProtected(true); dropticket.dropMe(activeChar, x, y, z); L2World.getInstance().storeObject(dropticket); // add to the world // and keep track of this ticket in the list _droppedTickets.add(dropticket); return NPC_IDS[i]; } } return -1; }
/** * This method is used to drop the CW from a monster.<br> * It drops the item on ground, and broadcast earthquake && red sky animations. * * @param attackable : The monster who dropped CW. * @param player : The player who killed the monster. */ private void dropFromMob(L2Attackable attackable, L2PcInstance player) { _isActivated = false; // get position int x = attackable.getX() + Rnd.get(-70, 70); int y = attackable.getY() + Rnd.get(-70, 70); int z = GeoData.getInstance().getHeight(x, y, attackable.getZ()); // create item and drop it _item = ItemTable.getInstance().createItem("CursedWeapon", _itemId, 1, player, attackable); _item.setDestroyProtected(true); _item.dropMe(attackable, x, y, z); // RedSky and Earthquake Broadcast.toAllOnlinePlayers(new ExRedSky(10)); Broadcast.toAllOnlinePlayers(new Earthquake(x, y, z, 14, 3)); _isDropped = true; SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_WAS_DROPPED_IN_THE_S1_REGION); sm.addZoneName(player.getX(), player.getY(), player.getZ()); sm.addItemName(_itemId); Broadcast.toAllOnlinePlayers(sm); }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(qn); String htmltext = getNoQuestMsg(); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: htmltext = (player.getLevel() < 10) ? "30029-01.htm" : "30029-02.htm"; break; case STATE_STARTED: if (st.getInt("cond") == 1) htmltext = "30029-04.htm"; else { htmltext = "30029-05.htm"; st.takeItems(ORCISH_ARROWHEAD, -1); st.rewardItems(57, 1000); st.rewardExpAndSp(2000, 0); st.playSound(QuestState.SOUND_FINISH); st.exitQuest(true); } break; } return htmltext; }
private static void jailOfflinePlayer(L2PcInstance activeChar, String name, int delay) { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement( "UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?"); statement.setInt(1, -114356); statement.setInt(2, -249645); statement.setInt(3, -2984); statement.setInt(4, L2PcInstance.PunishLevel.JAIL.value()); statement.setLong(5, (delay > 0 ? delay * 60000L : 0)); statement.setString(6, name); statement.execute(); int count = statement.getUpdateCount(); statement.close(); if (count == 0) activeChar.sendMessage("Character not found!"); else activeChar.sendMessage( name + " have been jailed for " + (delay > 0 ? delay + " minutes." : "ever!")); } catch (SQLException se) { activeChar.sendMessage("SQLException while jailing player"); if (Config.DEBUG) se.printStackTrace(); } }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(qn); String htmltext = getNoQuestMsg(); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: htmltext = (player.getLevel() < 48) ? "30754-01.htm" : "30754-02.htm"; break; case STATE_STARTED: int cond = st.getInt("cond"); switch (npc.getNpcId()) { case GILMORE: if (cond == 1) htmltext = (st.hasQuestItems(ARTICLE_DEAD_HERO)) ? "30754-05.htm" : "30754-09.htm"; else if (cond == 2) htmltext = (st.get("success") != null) ? "30754-16.htm" : "30754-15.htm"; break; default: if (cond == 2) { if (st.get("success") != null) htmltext = npc.getNpcId() + "-02.htm"; else { rewards(st, npc.getNpcId()); htmltext = npc.getNpcId() + "-01.htm"; } } break; } break; } return htmltext; }
private static void banChatOfflinePlayer( L2PcInstance activeChar, String name, int delay, boolean ban) { int level = 0; long value = 0; if (ban) { level = L2PcInstance.PunishLevel.CHAT.value(); value = (delay > 0 ? delay * 60000L : 60000); } else { level = L2PcInstance.PunishLevel.NONE.value(); value = 0; } try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement( "UPDATE characters SET punish_level=?, punish_timer=? WHERE char_name=?"); statement.setInt(1, level); statement.setLong(2, value); statement.setString(3, name); statement.execute(); int count = statement.getUpdateCount(); statement.close(); if (count == 0) activeChar.sendMessage("Character isn't found."); else if (ban) activeChar.sendMessage( name + " is chat banned for " + (delay > 0 ? delay + " minutes." : "ever !")); else activeChar.sendMessage(name + "'s chat ban have been lifted."); } catch (SQLException se) { activeChar.sendMessage("SQLException while chat-banning player"); if (Config.DEBUG) se.printStackTrace(); } }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(); QuestState st = player.getQuestState(qn); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: if (player.getLevel() < 40) htmltext = npc.getNpcId() + "-lvl.htm"; else htmltext = npc.getNpcId() + "-01.htm"; break; case STATE_STARTED: // Check inventory for soul crystals. for (ItemInstance item : player.getInventory().getItems()) { // Crystal found, show "how to" html. if (SoulCrystalsTable.getSoulCrystalInfos().get(item.getItemId()) != null) return npc.getNpcId() + "-03.htm"; } // No crystal found, offer a new crystal. htmltext = npc.getNpcId() + "-21.htm"; break; } return htmltext; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(qn); String htmltext = getNoQuestMsg(); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: htmltext = (player.getLevel() < 15) ? "30336-01.htm" : "30336-02.htm"; break; case STATE_STARTED: switch (npc.getNpcId()) { case CURTIS: htmltext = (!st.hasQuestItems(ANATOMY_DIAGRAM)) ? "30336-04.htm" : "30336-05.htm"; break; case SAMED: if (!st.hasQuestItems(ANATOMY_DIAGRAM)) htmltext = "30434-01.htm"; else { if (getNumberOfPieces(st) == 0) htmltext = "30434-04.htm"; else htmltext = (!st.hasQuestItems(COMPLETE_SKELETON)) ? "30434-05.htm" : "30434-08.htm"; } break; case VARSAK: htmltext = "30342-01.htm"; break; } break; } return htmltext; }
@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { L2PcInstance partyMember = getRandomPartyMemberState(player, npc, STATE_STARTED); if (partyMember == null) return null; partyMember.getQuestState(qn).dropItems(RED_GEM, 1, 0, CHANCES.get(npc.getNpcId())); return null; }
private void showCharacterInfo(L2PcInstance activeChar, L2PcInstance player) { if (player == null) { L2Object target = activeChar.getTarget(); if (target instanceof L2PcInstance) player = (L2PcInstance) target; else return; } else activeChar.setTarget(player); gatherCharacterInfo(activeChar, player, "charinfo.htm"); }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(qn); String htmltext = getNoQuestMsg(); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: htmltext = (player.getLevel() < 75) ? "32113-01a.htm" : "32113-01.htm"; break; case STATE_STARTED: int cond = st.getInt("cond"); switch (npc.getNpcId()) { case MARQUEZ: if (cond == 1) htmltext = "32113-03.htm"; else if (cond > 1) htmltext = "32113-04a.htm"; break; case MUSHIKA: if (cond == 2) htmltext = "32114-01.htm"; else if (cond > 2) htmltext = "32114-03.htm"; break; case ASAMAH: if (cond == 3) htmltext = "32115-01.htm"; else if (cond == 6) { htmltext = "32115-05.htm"; st.takeItems(8778, -1); st.rewardItems(57, 71318); st.playSound(QuestState.SOUND_FINISH); st.exitQuest(false); } break; case KARAKAWEI: if (cond == 4) { htmltext = "32117-01.htm"; if (st.getInt("progress") == 1) htmltext = "32117-02.htm"; } else if (cond > 4) htmltext = "32117-04.htm"; break; case MANTARASA: if (cond == 5) htmltext = "32118-01.htm"; else if (cond > 5) htmltext = "32118-03.htm"; break; } break; case STATE_COMPLETED: if (npc.getNpcId() == ASAMAH) htmltext = "32115-06.htm"; else htmltext = getAlreadyCompletedMsg(); break; } return htmltext; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(); QuestState st = player.getQuestState(qn); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: htmltext = (player.getLevel() < 61) ? "30845-02.htm" : "30845-01.htm"; break; case STATE_STARTED: int state = st.getInt("state"); int stateEx = st.getInt("stateEx"); if (state == 0 && stateEx == 0) htmltext = (st.getQuestItemsCount(RED_GEM) < 50) ? "30845-04.htm" : "30845-05.htm"; else if (state != 0 && stateEx != 0) { int i0, i1, i2, i3, i4, i5, i9; i0 = state; i1 = stateEx; i5 = i1 % 100; i9 = i1 / 100; i1 = i0 % 100; i2 = i0 % 10000 / 100; i3 = i0 % 1000000 / 10000; i4 = i0 % 100000000 / 1000000; htmltext = getHtmlText("30845-11a.htm"); htmltext = htmltext .replace("%FontColor1%", (i9 % 2 < 1) ? "ffff00" : "ff6f6f") .replace("%Cell1%", (i9 % 2 < 1) ? CARDS.get(0) : CARDS.get(i1)); htmltext = htmltext .replace("%FontColor2%", (i9 % 4 < 2) ? "ffff00" : "ff6f6f") .replace("%Cell2%", (i9 % 4 < 2) ? CARDS.get(0) : CARDS.get(i2)); htmltext = htmltext .replace("%FontColor3%", (i9 % 8 < 4) ? "ffff00" : "ff6f6f") .replace("%Cell3%", (i9 % 8 < 4) ? CARDS.get(0) : CARDS.get(i3)); htmltext = htmltext .replace("%FontColor4%", (i9 % 16 < 8) ? "ffff00" : "ff6f6f") .replace("%Cell4%", (i9 % 16 < 8) ? CARDS.get(0) : CARDS.get(i4)); htmltext = htmltext .replace("%FontColor5%", (i9 % 32 < 16) ? "ffff00" : "ff6f6f") .replace("%Cell5%", (i9 % 32 < 16) ? CARDS.get(0) : CARDS.get(i5)); } break; } return htmltext; }
/** * @param activeChar * @throws IllegalArgumentException */ private void findDualbox(L2PcInstance activeChar, int multibox) throws IllegalArgumentException { Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values(); L2PcInstance[] players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]); Map<String, List<L2PcInstance>> ipMap = new HashMap<String, List<L2PcInstance>>(); String ip = "0.0.0.0"; L2GameClient client; final Map<String, Integer> dualboxIPs = new HashMap<String, Integer>(); for (L2PcInstance player : players) { client = player.getClient(); if (client.isDetached()) continue; else { ip = client.getConnection().getInetAddress().getHostAddress(); if (ipMap.get(ip) == null) ipMap.put(ip, new ArrayList<L2PcInstance>()); ipMap.get(ip).add(player); if (ipMap.get(ip).size() >= multibox) { Integer count = dualboxIPs.get(ip); if (count == null) dualboxIPs.put(ip, multibox); else dualboxIPs.put(ip, count + 1); } } } List<String> keys = new ArrayList<String>(dualboxIPs.keySet()); Collections.sort( keys, new Comparator<String>() { public int compare(String left, String right) { return dualboxIPs.get(left).compareTo(dualboxIPs.get(right)); } }); Collections.reverse(keys); final StringBuilder results = new StringBuilder(); for (String dualboxIP : keys) { StringUtil.append( results, "<a action=\"bypass -h admin_find_ip " + dualboxIP + "\">" + dualboxIP + " (" + dualboxIPs.get(dualboxIP) + ")</a><br1>"); } NpcHtmlMessage adminReply = new NpcHtmlMessage(5); adminReply.setFile("data/html/admin/dualbox.htm"); adminReply.replace("%multibox%", String.valueOf(multibox)); adminReply.replace("%results%", results.toString()); activeChar.sendPacket(adminReply); }
@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { if (player.isInParty()) { for (L2PcInstance partyMember : player.getParty().getPartyMembers()) { if (partyMember != null) testKetraDemote(partyMember); } } else testKetraDemote(player); return null; }
/** * Return the number of players in a defined radius.<br> * Dead players aren't counted, invisible ones is the boolean parameter. * * @param range : the radius. * @param npc : the object to make the test on. * @param invisible : true counts invisible characters. * @return the number of targets found. */ public static int getPlayersCountInRadius(int range, L2Character npc, boolean invisible) { int count = 0; for (L2PcInstance player : npc.getKnownList().getKnownType(L2PcInstance.class)) { if (player.isDead()) continue; if (!invisible && player.getAppearance().getInvisible()) continue; if (Util.checkIfInRange(range, npc, player, true)) count++; } return count; }
private static void auditAction(String fullCommand, L2PcInstance activeChar, String target) { if (!Config.GMAUDIT) return; String[] command = fullCommand.split(" "); GMAudit.auditGMAction( activeChar.getName() + " [" + activeChar.getObjectId() + "]", command[0], (target.equals("") ? "no-target" : target), (command.length > 2 ? command[2] : "")); }
@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { L2PcInstance partyMember = getRandomPartyMemberState(player, npc, STATE_STARTED); if (partyMember == null) return null; partyMember .getQuestState(qn) .dropItems(DIMENSION_FRAGMENT, (int) (npc.getLevel() * 0.15 + 2.6), -1, 80000); return null; }
@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { L2PcInstance partyMember = getRandomPartyMember(player, npc, "1"); if (partyMember == null) return null; QuestState st = partyMember.getQuestState(qn); if (st.dropItems(RED_CRYSTAL, 1, 50, 500000)) st.set("cond", "2"); return null; }
/** * This method selects a random player.<br> * Player can't be dead and isn't an hidden GM aswell. * * @param npc to check. * @return the random player. */ public static L2PcInstance getRandomPlayer(L2Npc npc) { List<L2PcInstance> result = new ArrayList<>(); for (L2PcInstance player : npc.getKnownList().getKnownType(L2PcInstance.class)) { if (player.isDead()) continue; if (player.isGM() && player.getAppearance().getInvisible()) continue; result.add(player); } return (result.isEmpty()) ? null : result.get(Rnd.get(result.size())); }
private static void teleportToCharacter(L2PcInstance activeChar, L2PcInstance target) { if (target.getObjectId() == activeChar.getObjectId()) activeChar.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF); else { int x = target.getX(); int y = target.getY(); int z = target.getZ(); activeChar.getAI().setIntention(CtrlIntention.IDLE); activeChar.teleToLocation(x, y, z, 0); activeChar.sendMessage("You have teleported to " + target.getName() + "."); } }
/** * @param activeChar * @param CharacterToFind */ private void findCharacter(L2PcInstance activeChar, String CharacterToFind) { int CharactersFound = 0; String name; Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values(); L2PcInstance[] players; // synchronized (L2World.getInstance().getAllPlayers()) { players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]); } NpcHtmlMessage adminReply = new NpcHtmlMessage(5); adminReply.setFile("data/html/admin/charfind.htm"); final StringBuilder replyMSG = new StringBuilder(1000); for (L2PcInstance player : players) { // Add player info into new Table row name = player.getName(); if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) { CharactersFound = CharactersFound + 1; StringUtil.append( replyMSG, "<tr><td width=80><a action=\"bypass -h admin_character_list ", name, "\">", name, "</a></td><td width=110>", player.getTemplate().className, "</td><td width=40>", String.valueOf(player.getLevel()), "</td></tr>"); } if (CharactersFound > 20) break; } adminReply.replace("%results%", replyMSG.toString()); final String replyMSG2; if (CharactersFound == 0) { replyMSG2 = MessageTable.Messages[678].getMessage(); } else if (CharactersFound > 20) { adminReply.replace("%number%", MessageTable.Messages[679].getMessage()); replyMSG2 = MessageTable.Messages[680].getMessage(); } else if (CharactersFound == 1) { replyMSG2 = MessageTable.Messages[1196].getMessage(); } else { replyMSG2 = MessageTable.Messages[1197].getMessage(); } adminReply.replace("%number%", String.valueOf(CharactersFound)); adminReply.replace("%end%", replyMSG2); activeChar.sendPacket(adminReply); }
/** * This method is used to drop the CW from player.<br> * It drops the item on ground, and reset player stats. * * @param killer : The player who killed CW owner. */ private void dropFromPlayer(L2Character killer) { _player.abortAttack(); // Prevent item from being removed by ItemsAutoDestroy _item.setDestroyProtected(true); _player.dropItem("DieDrop", _item, killer, true); _isActivated = false; _isDropped = true; _player.setKarma(_playerKarma); _player.setPkKills(_playerPkKills); _player.setCursedWeaponEquippedId(0); removeDemonicSkills(); // Cancel the daily timer. It will be reactivated when someone will pickup the weapon. cancelDailyTimerTask(); // Activate the "1h dropped CW" timer. _dropTimerTask = ThreadPoolManager.getInstance().scheduleGeneral(new DropTimerTask(), 3600000L); // Reset current stage to 1. _currentStage = 1; // Drop infos from database. removeFromDb(); SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_WAS_DROPPED_IN_THE_S1_REGION); sm.addZoneName(_player.getX(), _player.getY(), _player.getZ()); sm.addItemName(_itemId); Broadcast.toAllOnlinePlayers(sm); }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState st = player.getQuestState(qn); if (st == null) return htmltext; if (event.equalsIgnoreCase("32113-03.htm")) { st.setState(STATE_STARTED); st.set("cond", "1"); st.playSound(QuestState.SOUND_ACCEPT); } else if (event.equalsIgnoreCase("32113-04.htm")) { st.set("cond", "2"); st.playSound(QuestState.SOUND_MIDDLE); } else if (event.equalsIgnoreCase("32114-02.htm")) { st.set("cond", "3"); st.playSound(QuestState.SOUND_MIDDLE); } else if (event.equalsIgnoreCase("32115-04.htm")) { st.set("cond", "4"); st.playSound(QuestState.SOUND_MIDDLE); } else if (event.equalsIgnoreCase("32117-02.htm")) { if (st.getInt("cond") == 4) st.set("progress", "1"); } else if (event.equalsIgnoreCase("32117-03.htm")) { st.set("cond", "5"); st.playSound(QuestState.SOUND_MIDDLE); } else if (event.equalsIgnoreCase("32118-02.htm")) { st.set("cond", "6"); st.playSound(QuestState.SOUND_MIDDLE); st.giveItems(8778, 1); // Egg } return htmltext; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState st = player.getQuestState(qn); if (st == null) return htmltext; // Start the quest. if (event.endsWith("-04.htm")) { st.setState(Quest.STATE_STARTED); st.set("cond", "1"); st.playSound(QuestState.SOUND_ACCEPT); } // Give Red Soul Crystal. else if (event.endsWith("-09.htm")) { st.playSound(QuestState.SOUND_MIDDLE); st.giveItems(4629, 1); } // Give Green Soul Crystal. else if (event.endsWith("-10.htm")) { st.playSound(QuestState.SOUND_MIDDLE); st.giveItems(4640, 1); } // Give Blue Soul Crystal. else if (event.endsWith("-11.htm")) { st.playSound(QuestState.SOUND_MIDDLE); st.giveItems(4651, 1); } // Terminate the quest. else if (event.endsWith("-exit.htm")) st.exitQuest(true); return htmltext; }