Where i can find a top of pvp's and pk's available for l2jmobius-high five? For community board i need or npc.
I do something, it is not good. I get error like
Account: admin2 - IP: 127.0.0.1] sent not handled RequestBypassToServer: [_toppk]
and code looks like this
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.communityboard;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;
import org.l2jmobius.gameserver.cache.HtmCache;
import org.l2jmobius.gameserver.data.xml.impl.ClassListData;
import org.l2jmobius.gameserver.handler.CommunityBoardHandler;
import org.l2jmobius.gameserver.handler.IParseBoardHandler;
import org.l2jmobius.gameserver.model.PageResult;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.util.HtmlUtil;
/**
* @author Administrator
*/
public class TopPk implements IParseBoardHandler
{
private static final String NAVIGATION_PATH = "data/html/CommunityBoard/Custom/navigation.html";
private static final String[] COMMAND =
{
"toppk",
};
public boolean topPk(String command, PlayerInstance activeChar)
{
if (command.startsWith("toppk"))
{
{
final String val = command.substring(22);
final int page = Integer.parseInt(val);
listCharacters(activeChar, page);
}
}
else
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Command : " + command + " is not implemented yet</center><br><br></body></html>", activeChar);
}
return true;
}
private void listCharacters(PlayerInstance activeChar, int page)
{
final List<PlayerInstance> players = new ArrayList<>(World.getInstance().getPlayers());
players.sort(Comparator.comparingLong(PlayerInstance::getUptime));
HtmCache.getInstance().getHtm(activeChar, NAVIGATION_PATH);
String content = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/tops/toppk.html");
final PageResult result = HtmlUtil.createPage(players, page, 20, i ->
{
return "<td align=center><a action=\"action=\"bypass _toppk " + i + "\">Page " + (i + 1) + "</a></td>";
}, player ->
{
final StringBuilder sb = new StringBuilder();
sb.append("<tr>");
sb.append("<td width=80><a action=\"bypass _toppk " + player.getName() + "\">" + player.getName() + "</a></td>");
sb.append("<td width=110>" + ClassListData.getInstance().getClass(player.getClassId()).getClientCode() + "</td><td width=40>" + player.getPkKills() + "</td>");
sb.append("</tr>");
return sb.toString();
});
if (result.getPages() > 0)
{
content.replace("%pages%", "<table width=280 cellspacing=0><tr>" + result.getPagerTemplate() + "</tr></table>");
}
else
{
content.replace("%pages%", "");
}
content.replace("%players%", result.getBodyTemplate().toString());
CommunityBoardHandler.separateAndSend(content, activeChar);
}
@Override
public boolean parseCommunityBoardCommand(String command, PlayerInstance player)
{
if (command.startsWith("_toppk"))
{
final StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
}
else
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Command : " + command + " is not implemented yet</center><br><br></body></html>", player);
}
return true;
}
@Override
public String[] getCommunityBoardCommands()
{
return COMMAND;
}
/*
* (non-Javadoc)
* @see org.l2jmobius.gameserver.handler.IParseBoardHandler#parseCommunityBoardCommand(java.lang.String, org.l2jmobius.gameserver.model.actor.instance.PlayerInstance)
*/
}
What i do wrong or what is missing?
Thank you !