Page 1 of 1

PVP Shop Instance

Posted: Thu May 27, 2010 6:39 pm
by ZeroCool22
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 4206:
L2JDP Revision 7415:

Create com.l2jserver.gameserver.model.actor.instance.L2PVPInstance.java

Code: Select all

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 http://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:

Code: Select all

INSERT INTO `custom_npc` VALUES ('40000', '32226', 'Barika', '1', 'PVP Shop Manager', '1', 'LineageNPC2.K_F1_grand', '11.00', '22.25', '70', 'male', 'L2PVP', '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

Code: Select all

<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>

Code: Select all

<a action="bypass -h npc_%objectId%_multisell [color=#408040]PVP_COUNT[/color] [color=#4080BF]MULTISELL_ID[/color]">Buy Weapon</a><a action="bypass -h npc_%objectId%_exc_multisell [color=#408040]PVP_COUNT[/color] [color=#4080BF]MULTISELL_ID[/color]">Buy Weapon</a><a action="bypass -h npc_%objectId%_buy [color=#408040]PVP_COUNT[/color] [color=#4080BF]MULTISELL_ID[/color]">Buy Weapon</a>
Now here my problem compiling:

Image



Some help please? =)

Re: PVP Shop Instance

Posted: Thu May 27, 2010 7:15 pm
by janiii
ctrl+shift+o (and choose the StringUtil from com.l2jserver.util)

Re: PVP Shop Instance

Posted: Thu May 27, 2010 9:45 pm
by ZeroCool22
janiii wrote:ctrl+shift+o (and choose the StringUtil from com.l2jserver.util)
Thx =), and in the top? what need choose...

Image

Re: PVP Shop Instance

Posted: Fri May 28, 2010 6:35 am
by janiii
delete your StringUtil import and then ctrl+shift+o and choose the right import like i wrote :)

Re: PVP Shop Instance

Posted: Fri May 28, 2010 6:12 pm
by ZeroCool22
Thx so much janiii for your patience :)

Re: PVP Shop Instance

Posted: Fri Jul 01, 2011 9:01 am
by Legend1
can someone adapt this for freya pls i tried to use it but i get errors

here is the same code

Code: Select all

/* * 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 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.util.StringUtil; /** *  * @author Mentor * @version 1.1 * @web http://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);        }    }}
the errors are
import com.l2jserver.gameserver.model.L2Multisell; can not be resolved


getInstance() the method getinstance() is undefined for the type l2Multisell
L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), true, getCastle().getTaxRate()); cannot be resolved