L2JMobius

High Five Top pk/Pvp

oRiGiNaL · 8 · 3446

Offline oRiGiNaL

  • Black Sheep
  • Knight
  • ***
    • Posts: 68
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
Code: [Select]
Account: admin2 - IP: 127.0.0.1] sent not handled RequestBypassToServer: [_toppk]
and code looks like this
Code: [Select]
/*
 * 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 !


Offline ren

  • Vassal
  • *
    • Posts: 7
try to change this
Code: [Select]
private static final String[] COMMAND =
{
"toppk",
};

for this:

Code: [Select]
private static final String[] COMMAND =
{
"_toppk",
};


Offline oRiGiNaL

  • Black Sheep
  • Knight
  • ***
    • Posts: 68

Offline ren

  • Vassal
  • *
    • Posts: 7
you added the new class in the MasterHandler (?

for example...

Code: [Select]
{
// Community Board
ClanBoard.class,
FavoriteBoard.class,
FriendsBoard.class,
HomeBoard.class,
HomepageBoard.class,
MailBoard.class,
MemoBoard.class,
RegionBoard.class,
DropSearchBoard.class,
TopPk.class,
},



Offline ren

  • Vassal
  • *
    • Posts: 7
I tested this on my server just to see if it worked:

Code: [Select]
package handlers.communityboard;

import org.l2jmobius.gameserver.handler.IParseBoardHandler;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;

/**
 * @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)
{
return true;
}

private void listCharacters(PlayerInstance activeChar, int page)
{

System.out.print("x");
}

@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)
*/

/*
* (non-Javadoc)
* @see org.l2jmobius.gameserver.handler.IParseBoardHandler#parseCommunityBoardCommand(java.lang.String, org.l2jmobius.gameserver.model.actor.instance.PlayerInstance)
*/
@Override
public boolean parseCommunityBoardCommand(String command, PlayerInstance player)
{
player.sendMessage("test");
return true;
}

}


calling it and create a button with the following:

Code: [Select]
<td align=center><button value="Enviar" action="bypass _toppk" width=140 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>

Java read me the command and sent me the message, looking quickly I do not see another possible error ... but what you could do is install the toppk inside the HomeBoard file together with the premium, buff, multisell commands.


Offline oRiGiNaL

  • Black Sheep
  • Knight
  • ***
    • Posts: 68
What i should add on HomeBoard.java? What method?, Can you post here to see?


Offline oRiGiNaL

  • Black Sheep
  • Knight
  • ***
    • Posts: 68