/** * Returns the description of the previous loaded resource. * * @return */ @Nonnull public String getPrevDescription() { if (index <= 0) { return ""; } return res.get(index - 1).getDescription(); }
@Override protected final void writeImpl() { if (getClient().getActiveChar() == null) return; for (PartyMatchRoom room : PartyMatchRoomList.getInstance().getRooms()) { if (room.getMembersCount() < 1 || room.getOwner() == null || room.getOwner().isOnline() == 0 || room.getOwner().getPartyRoom() != room.getId()) { PartyMatchRoomList.getInstance().deleteRoom(room.getId()); continue; } if (_loc > 0 && _loc != room.getLocation()) continue; if (_lim == 0 && ((_cha.getLevel() < room.getMinLvl()) || (_cha.getLevel() > room.getMaxLvl()))) continue; _rooms.add(room); } int count = 0; int size = _rooms.size(); writeC(0x96); if (size > 0) writeD(1); else writeD(0); writeD(_rooms.size()); while (size > count) { writeD(_rooms.get(count).getId()); writeS(_rooms.get(count).getTitle()); writeD(_rooms.get(count).getLocation()); writeD(_rooms.get(count).getMinLvl()); writeD(_rooms.get(count).getMaxLvl()); writeD(_rooms.get(count).getMembersCount()); writeD(_rooms.get(count).getMaxMembers()); writeS(_rooms.get(count).getOwner().getName()); count++; } }
public void showHeroDiary(L2PcInstance activeChar, int heroclass, int charid, int page) { final int perpage = 10; if (_herodiary.containsKey(charid)) { List<StatsSet> _mainlist = _herodiary.get(charid); final NpcHtmlMessage DiaryReply = new NpcHtmlMessage(); final String htmContent = HtmCache.getInstance() .getHtm(activeChar.getHtmlPrefix(), "data/html/olympiad/herodiary.htm"); if ((htmContent != null) && _heroMessage.containsKey(charid)) { DiaryReply.setHtml(htmContent); DiaryReply.replace("%heroname%", CharNameTable.getInstance().getNameById(charid)); DiaryReply.replace("%message%", _heroMessage.get(charid)); DiaryReply.disableValidation(); if (!_mainlist.isEmpty()) { FastList<StatsSet> _list = FastList.newInstance(); _list.addAll(_mainlist); Collections.reverse(_list); boolean color = true; final StringBuilder fList = new StringBuilder(500); int counter = 0; int breakat = 0; for (int i = ((page - 1) * perpage); i < _list.size(); i++) { breakat = i; StatsSet _diaryentry = _list.get(i); StringUtil.append(fList, "<tr><td>"); if (color) { StringUtil.append(fList, "<table width=270 bgcolor=\"131210\">"); } else { StringUtil.append(fList, "<table width=270>"); } StringUtil.append( fList, "<tr><td width=270><font color=\"LEVEL\">" + _diaryentry.getString("date") + ":xx</font></td></tr>"); StringUtil.append( fList, "<tr><td width=270>" + _diaryentry.getString("action") + "</td></tr>"); StringUtil.append(fList, "<tr><td> </td></tr></table>"); StringUtil.append(fList, "</td></tr>"); color = !color; counter++; if (counter >= perpage) { break; } } if (breakat < (_list.size() - 1)) { DiaryReply.replace( "%buttprev%", "<button value=\"Prev\" action=\"bypass _diary?class=" + heroclass + "&page=" + (page + 1) + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } else { DiaryReply.replace("%buttprev%", ""); } if (page > 1) { DiaryReply.replace( "%buttnext%", "<button value=\"Next\" action=\"bypass _diary?class=" + heroclass + "&page=" + (page - 1) + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); } else { DiaryReply.replace("%buttnext%", ""); } DiaryReply.replace("%list%", fList.toString()); FastList.recycle(_list); } else { DiaryReply.replace("%list%", ""); DiaryReply.replace("%buttprev%", ""); DiaryReply.replace("%buttnext%", ""); } activeChar.sendPacket(DiaryReply); } } }
/** * Returns the description of the next resources. * * @return */ @Nonnull public String getNextDescription() { return res.get(index).getDescription(); }
/** * Loads the next resource. * * @throws IOException */ public void loadNext() throws IOException { res.get(index++).load(); }
public synchronized void start(L2PcInstance player, byte type, L2Npc npc) { boolean canPass = true; if (!player.isInParty()) { showHtmlFile(player, "data/html/seven_signs/rift/NoParty.htm", npc); return; } if (player.getParty().getPartyLeaderOID() != player.getObjectId()) { showHtmlFile(player, "data/html/seven_signs/rift/NotPartyLeader.htm", npc); return; } if (player.getParty().isInDimensionalRift()) { handleCheat(player, npc); return; } if (player.getParty().getMemberCount() < Config.RIFT_MIN_PARTY_SIZE) { NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/SmallParty.htm"); html.replace("%npc_name%", npc.getName()); html.replace("%count%", Integer.toString(Config.RIFT_MIN_PARTY_SIZE)); player.sendPacket(html); return; } // max parties inside is rooms count - 1 if (!isAllowedEnter(type)) { player.sendMessage("Rift is full. Try later."); return; } for (L2PcInstance p : player.getParty().getPartyMembers()) if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ())) { canPass = false; break; } if (!canPass) { showHtmlFile(player, "data/html/seven_signs/rift/NotInWaitingRoom.htm", npc); return; } L2ItemInstance i; int count = getNeededItems(type); for (L2PcInstance p : player.getParty().getPartyMembers()) { i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID); if (i == null) { canPass = false; break; } if (i.getCount() > 0) { if (i.getCount() < getNeededItems(type)) { canPass = false; break; } } else { canPass = false; break; } } if (!canPass) { NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm"); html.replace("%npc_name%", npc.getName()); html.replace("%count%", Integer.toString(count)); player.sendPacket(html); return; } for (L2PcInstance p : player.getParty().getPartyMembers()) { i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID); if (!p.destroyItem("RiftEntrance", i, count, null, false)) { NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm"); html.replace("%npc_name%", npc.getName()); html.replace("%count%", Integer.toString(count)); player.sendPacket(html); return; } } byte room; FastList<Byte> emptyRooms; do { emptyRooms = getFreeRooms(type); room = emptyRooms.get(Rnd.get(1, emptyRooms.size()) - 1); } // find empty room while (_rooms.get(type).get(room).ispartyInside()); new DimensionalRift(player.getParty(), type, room); }