Создаем файл com.l2jserver.gameserver.model.actor.instance.L2PVPInstance.java
NPC
HTML:
Create PVPMerchant directory in data/html.
data/html/PVPMerchant/40000.htm
rev 3900+ тестировалось
(с)
- Код:
package com.l2jserver.gameserver.model.actor.instance;
import java.util.StringTokenizer;
import com.l2jserver.gameserver.TradeController;
import com.l2jserver.gameserver.model.L2Multisell;
import com.l2jserver.gameserver.model.L2TradeList;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ExBuySellListPacket;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
import com.l2jserver.gameserver.util.StringUtil;
/**
*
* @author Mentor
* @version 1.1
* @web www.teamsrv.net
*
*/
public class L2PVPInstance extends L2NpcInstance
{
public L2PVPInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}
@Override
public String getHtmlPath(int npcId, int val)
{
String pom = "";
if (val == 0) pom = "" + npcId;
else pom = npcId + "-" + val;
return "data/html/PVPMerchant/" + pom + ".htm";
}
protected final void showBuyWindow(L2PcInstance player, int val)
{
player.tempInventoryDisable();
L2TradeList list = TradeController.getInstance().getBuyList(val);
if (list != null && list.getNpcId().equals(String.valueOf(getNpcId())))
player.sendPacket(new ExBuySellListPacket(player, list, 0, false));
else
{
_log.warning("buylist id:" + val);
}
player.sendPacket(ActionFailed.STATIC_PACKET);
}
@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
StringTokenizer st = new StringTokenizer(command, " ");
String actualCommand = st.nextToken(); // Get actual command
int pvp = Integer.parseInt(st.nextToken());
if (actualCommand.equalsIgnoreCase("Buy") && player.getPvpKills() >= pvp)
{
if (st.countTokens() < 1)
return;
int val = Integer.parseInt(st.nextToken());
showBuyWindow(player, val);
}
else if (actualCommand.equalsIgnoreCase("Multisell") && player.getPvpKills() >= pvp)
{
if (st.countTokens() < 1)
return;
int val = Integer.parseInt(st.nextToken());
L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), false, getCastle().getTaxRate());
}
else if (actualCommand.equalsIgnoreCase("Exc_Multisell") && player.getPvpKills() >= pvp)
{
if (st.countTokens() < 1)
return;
int val = Integer.parseInt(st.nextToken());
L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), true, getCastle().getTaxRate());
}
else
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
final StringBuilder html1 = StringUtil.startAppend(2000,
"<html><body><font color=\"06ff0a\">PvP Manager:</font><br> You not enough pvp kills.<br1>You have <font color=\"LEVEL\">",
String.valueOf(player.getPvpKills()),
"</font> pvp kills in <font color=\"FF0000\">",
String.valueOf(pvp),
"</font> pvp kills.<br><center>Created by <font color=\"06ff0a\">Mentor</font></center></body></html>");
html.setHtml(html1.toString());
player.sendPacket(html);
super.onBypassFeedback(player, command);
}
}
}
NPC
- Код:
INSERT INTO `custom_npc` VALUES ('40000', '32226', 'Barika', '1', 'PVP Shop Manager', '1', 'LineageNPC2.K_F1_grand', '11.00', '22.25', '70', 'male', '[b]L2PVP[/b]', '40', '2444', '2444', '0.00', '0.00', '10', '10', '10', '10', '10', '10', '0', '0', '500', '500', '500', '500', '278', '0', '333', '0', '0', null, '0', '28', '120', '0', '0', 'LAST_HIT', 'false');
HTML:
Create PVPMerchant directory in data/html.
data/html/PVPMerchant/40000.htm
- Код:
<html><body>L2PVP Shop Instance By Mentor:<br>
<font color="LEVEL">Npc by Mentor</font><br>
<a action="bypass -h npc_%objectId%_multisell 200 452">Multisell PvP (PVP 200)</a><br1>
<a action="bypass -h npc_%objectId%_exc_multisell 400 452">Exc_Multisell PvP (PVP 400)</a><br1>
<a action="bypass -h npc_%objectId%_buy 0 40000">Buy (PVP 0)</a><br1>
</body></html>
- Код:
<a action="bypass -h npc_%objectId%_multisell PVP_COUNT MULTISELL_ID">Buy Weapon</a>
<a action="bypass -h npc_%objectId%_exc_multisell PVP_COUNT MULTISELL_ID">Buy Weapon</a>
<a action="bypass -h npc_%objectId%_buy PVP_COUNT MERCHANT_BUYLIST_ID">Buy Weapon</a>
rev 3900+ тестировалось
(с)