Jump to content

Recommended Posts

  • 2 weeks later...
  • 6 months later...
  • 2 weeks later...
  • 5 weeks later...
Posted

Hi!I install the NPC but i cant target it with normal character but its working with GM character!Should i have to change something in my SQL files?By the way very nice share!+1 :) 

  • 7 months later...
Posted

Hello i tried to make it for interlude frozen code:

package custom.PartyTeleporter;

import com.l2jfrozen.gameserver.cache.HtmCache;
import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.L2Party;
import com.l2jfrozen.gameserver.model.L2TeleportLocation;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.quest.Quest;
import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.StatusUpdate;

/**
 * @author `Heroin
 * Made For Maxcheaters.com
 * PartyTeleporter
 */
public class PartyTeleporter extends Quest
{
	private static final int npcid = 36650; // npc id
	//-------------------------------------
	//Teleport Location Coordinates X,Y,Z.
	//Use /loc command in game to find them.
	private static final int locationX = -56742; // npc id
	private static final int locationY = 140569; // npc id
	private static final int locationZ = -2625; // npc id
	//-------------------------------------
	//-------------------------------------
	// Select the id of your zone.
	// If you dont know how to find your zone id is simple.
	// Go to data/zones/(your zone file).xml and find your zone
	// E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
	/**The id of your zone is id="6" */
	/**---------------------------------------------------------------------------*/
	/**WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self*/ // required to calculate parties & players
	/**---------------------------------------------------------------------------*/
	private static final int ZoneId = 155; //Here you have to set your zone Id
	//-------------------------------------
	private static final int MinPtMembers = 2; // Minimum Party Members Count For Enter on Zone.
	private static final int ItemConsumeId = 57; // Item Consume id.
	private static final int ItemConsumeNum = 100; // Item Consume Am.ount.
	private static final boolean ShowPlayersInside = true; //If you set it true, NPC will show how many players are inside area.
	private static final boolean ShowPartiesInside = true; //If you set it true, NPC will show how many parties are inside area.
	//-------------------------------------
	private static String htm = "data/scripts/custom/PartyTeleporter/1.htm"; //html location.
	private static String ItemName = ItemTable.getInstance().createDummyItem(ItemConsumeId).getItemName(); //Item name, Dont Change this

	
	public PartyTeleporter(int questId, String name, String descr)
	{
		super(questId, name, descr);
		addFirstTalkId(npcid);
		addTalkId(npcid);
		addStartNpc(npcid);
	}
	
	@Override
	public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
	{
		if (event.startsWith("partytp"))
		{
			TP(event, npc, player, event);
		}

		return "";
	}
	@SuppressWarnings("deprecation")
	public int getPartiesInside(int zoneId)//Calculating parties inside party area.
    {
        int i = 0;
        for (L2ZoneType zone : L2TeleportLocation.getInstance().getAllZones())
            if (zone.getId() == zoneId)
            {
                for (L2Character character : zone.getCharactersInside().values())
                    if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()) && 
                    		((L2PcInstance) character).getParty() != null && 
                    		((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))
                        i++;
            }
        return i;
    } 
	@SuppressWarnings("deprecation")
	public int getPlayerInside(int zoneId)//Calculating players inside party area.
    {
        int i = 0;
        for (L2ZoneType zone : ZoneManager.getInstance().getAllZones())
            if (zone.getId() == zoneId)
            {
                for (L2Character character : zone.getCharactersInside().values())
                    if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()))
                        i++;
            }
return i;
} 
	private boolean PartyItemsOk(L2PcInstance player)
	//Checks if all party members have the item in their inventory.
	//If pt member has not enough items, party not allowed to enter.
	{
		
		try
		{
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				if (member.getInventory().getItemByItemId(ItemConsumeId) == null)
							
				{
					player.sendMessage("Your party member "+member.getName()+" does not have enough items.");
					return false;
				}
				if (member.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNum)
				{
					player.sendMessage("Your party member "+member.getName()+" does not have enough items.");
					return false;
				}
			}
			return true;
			
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
			return true;
		}
	}

	private void proccessTP(L2PcInstance player) // Teleporting party members to zone
	{
		for (L2PcInstance member : player.getParty().getPartyMembers())
		{
			member.teleToLocation(locationX, locationY, locationZ);//Location X, Y ,Z
		}
	}
	private void TP(String event, L2NpcInstance npc, L2PcInstance player, String command) // Teleport player & his party
	{
		
		try
		{
			L2Party pt = player.getParty();
			if (pt == null)
			{
				player.sendMessage("You are not currently on party.");
				return;
			}
			if (!pt.isLeader(player))
			{
				player.sendMessage("You are not party leader.");
				return;
			}
			if (pt.getMemberCount() < MinPtMembers)
			{
				player.sendMessage("You are going to need a bigger party " +
						"in order to enter party area.");
				return;
			}
			if (!PartyItemsOk(player))
			{
				return;
			}
			else
			{
				proccessTP(player);
				for (L2PcInstance ppl : pt.getPartyMembers())
				{
					if (ppl.getObjectId() != player.getObjectId())//Dont send this message to pt leader.
					{
						ppl.sendMessage("Your party leader asked to teleport on party area!");//Message only to party members
					}
					ppl.sendMessage(ItemConsumeNum+" "+ItemName+" have been dissapeared.");//Item delete from inventory message
					ppl.getInventory().destroyItemByItemId("Party_Teleporter", ItemConsumeId, ItemConsumeNum, ppl, true);//remove item from inventory
					ppl.sendPacket(new InventoryUpdate());//Update
					ppl.sendPacket(new ItemList(ppl, false));//Update
					ppl.sendPacket(new StatusUpdate(ppl));//Update
					
				}
				//Sends message to party leader.
				player.sendMessage(ItemConsumeNum*player.getParty().getMemberCount()+" "+ItemName+" dissapeard from your party.");
			}
			
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
		}
	}
	
	@Override
	public String onFirstTalk(L2NpcInstance npc, L2PcInstance player)
	{
		final int npcId = npc.getNpcId();
		if (player.getQuestState(getName()) == null)
		{
			newQuestState(player);
		}
		if (npcId == npcid)
		{
			String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);
			html = html.replaceAll("%player%", player.getName());//Replaces %player% with player name on html
			html = html.replaceAll("%itemname%", ItemName);//Item name replace on html
			html = html.replaceAll("%price%", player.getParty()!=null ? ""+ItemConsumeNum*player.getParty().getMemberCount()+"": "0");//Price calculate replace
			html = html.replaceAll("%minmembers%", ""+MinPtMembers);//Mimum entry party members replace
			html = html.replaceAll("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" :
				"<font color=FF0000>not allowed</font>");//Condition checker replace on html
			html = html.replaceAll("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: "+getPartiesInside(ZoneId)+"</font><br>": "");//Parties inside
			html = html.replaceAll("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: "+getPlayerInside(ZoneId)+"</font><br>": "");//Players Inside
			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
			npcHtml.setHtml(html);
			player.sendPacket(npcHtml);
		}
		return "";
	}
	private boolean isAllowedEnter(L2PcInstance player) //Checks if player & his party is allowed to teleport.
	{
		if (player.getParty() != null)
		{
			if( player.getParty().getMemberCount() >= MinPtMembers && PartyItemsOk(player))//Party Length & Item Checker
			{
				return true;
			}
			else 
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	public static void main(final String[] args)
	{
		new PartyTeleporter(-1, PartyTeleporter.class.getSimpleName(), "custom");
		System.out.println("Party Teleporter by `Heroin has been loaded successfully!");
	}
}

but there are still some errors

  • 1 year later...
Posted

i have a problem can help me :(?

 

http://postimg.org/image/r9tln9prb/

 

http://postimg.org/image/9vths5nvx/

package custom.PartyTeleporter;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.instancemanager.ZoneManager;
import net.sf.l2j.gameserver.model.L2Party;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
import net.sf.l2j.gameserver.network.serverpackets.ItemList;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;

public class PartyTeleporter extends Quest
{
	private static final int npcid = 36650; // npc id
	//-------------------------------------
	//Teleport Location Coordinates X,Y,Z.
	//Use /loc command in game to find them.
	private static final int locationX = -56742; // npc id
	private static final int locationY = 140569; // npc id
	private static final int locationZ = -2625; // npc id
	//-------------------------------------
	//-------------------------------------
	// Select the id of your zone.
	// If you dont know how to find your zone id is simple.
	// Go to data/zones/(your zone file).xml and find your zone
	// E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
	/**The id of your zone is id="6" */
	/**---------------------------------------------------------------------------*/
	/**WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self*/ // required to calculate parties & players
	/**---------------------------------------------------------------------------*/
	private static final int ZoneId = 155; //Here you have to set your zone Id
	//-------------------------------------
	private static final int MinPtMembers = 7; // Minimum Party Members Count For Enter on Zone.
	private static final boolean ShowPlayersInside = true; //If you set it true, NPC will show how many players are inside area.
	private static final boolean ShowPartiesInside = true; //If you set it true, NPC will show how many parties are inside area.
	public PartyTeleporter(int questId, String name, String descr)
	{
		super(questId, name, descr);
		addFirstTalkId(npcid);
		addTalkId(npcid);
		addStartNpc(npcid);
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		if (event.startsWith("partytp"))
		{
			TP(event, npc, player, event);
		}

		return "";
	}
	@SuppressWarnings("deprecation")
	public int getPartiesInside(int zoneId)//Calculating parties inside party area.
    {
        int i = 0;
        for (L2ZoneType zone : ZoneManager.getInstance().getAllZones(null))
            if (zone.getId() == zoneId)
            {
                for (L2Character character : zone.getCharactersInside().values())
                    if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()) && 
                    		((L2PcInstance) character).getParty() != null && 
                    		((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))
                        i++;
            }
        return i;
    } 
	@SuppressWarnings("deprecation")
	public int getPlayerInside(int zoneId)//Calculating players inside party area.
    {
        int i = 0;
        for (L2ZoneType zone : ZoneManager.getInstance().getAllZones(null))
            if (zone.getId() == zoneId)
            {
                for (L2Character character : zone.getCharactersInside().values())
                    if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()))
                        i++;
            }
return i;
} 
	private void proccessTP(L2PcInstance player) // Teleporting party members to zone
	{
		for (L2PcInstance member : player.getParty().getPartyMembers())
		{
			member.teleToLocation(locationX, locationY, locationZ);//Location X, Y ,Z
		}
	}
	private void TP(String event, L2Npc npc, L2PcInstance player, String command) // Teleport player & his party
	{
		
		try
		{
			L2Party pt = player.getParty();
			if (pt == null)
			{
				player.sendMessage("You are not currently on party.");
				return;
			}
			if (!pt.isLeader(player))
			{
				player.sendMessage("You are not party leader.");
				return;
			}
			if (pt.getMemberCount() < MinPtMembers)
			{
				player.sendMessage("You are going to need a bigger party " +
						"in order to enter party area.");
				return;
			}
			else
			{
				proccessTP(player);
				for (L2PcInstance ppl : pt.getPartyMembers())
				{
					if (ppl.getObjectId() != player.getObjectId())//Dont send this message to pt leader.
					{
						ppl.sendMessage("Your party leader asked to teleport on party area!");//Message only to party members
					}					
				}
			}
			
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
		}
	}
	
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		final int npcId = npc.getNpcId();
		if (player.getQuestState(getName()) == null)
		{
			newQuestState(player);
		}
		if (npcId == npcid)
		{
			String html = HtmCache.getInstance().getHtm(L2PcInstance.getHtmlPrefix());
			html = html.replaceAll("%player%", player.getName());//Replaces %player% with player name on html
			html = html.replaceAll("%minmembers%", ""+MinPtMembers);//Mimum entry party members replace
			html = html.replaceAll("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" :
				"<font color=FF0000>not allowed</font>");//Condition checker replace on html
			html = html.replaceAll("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: "+getPartiesInside(ZoneId)+"</font><br>": "");//Parties inside
			html = html.replaceAll("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: "+getPlayerInside(ZoneId)+"</font><br>": "");//Players Inside
			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
			npcHtml.setHtml(html);
			player.sendPacket(npcHtml);
		}
		return "";
	}
	private boolean isAllowedEnter(L2PcInstance player) //Checks if player & his party is allowed to teleport.
	{
		if (player.getParty() != null)
		{

			{
				return true;
			}
	
		}
		else
		{
			return false;
		}
	}
	public static void main(final String[] args)
	{
		new PartyTeleporter(-1, PartyTeleporter.class.getSimpleName(), "custom");
		System.out.println("Party Teleporter by `Heroin has been loaded successfully!");
	}
}

an gs say me 1 problem at line 20 :(

Posted (edited)

i have a problem can help me :(?

 

http://postimg.org/image/r9tln9prb/

 

http://postimg.org/image/9vths5nvx/

package custom.PartyTeleporter;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.instancemanager.ZoneManager;
import net.sf.l2j.gameserver.model.L2Party;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
import net.sf.l2j.gameserver.network.serverpackets.ItemList;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;

public class PartyTeleporter extends Quest
{
	private static final int npcid = 36650; // npc id
	//-------------------------------------
	//Teleport Location Coordinates X,Y,Z.
	//Use /loc command in game to find them.
	private static final int locationX = -56742; // npc id
	private static final int locationY = 140569; // npc id
	private static final int locationZ = -2625; // npc id
	//-------------------------------------
	//-------------------------------------
	// Select the id of your zone.
	// If you dont know how to find your zone id is simple.
	// Go to data/zones/(your zone file).xml and find your zone
	// E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
	/**The id of your zone is id="6" */
	/**---------------------------------------------------------------------------*/
	/**WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self*/ // required to calculate parties & players
	/**---------------------------------------------------------------------------*/
	private static final int ZoneId = 155; //Here you have to set your zone Id
	//-------------------------------------
	private static final int MinPtMembers = 7; // Minimum Party Members Count For Enter on Zone.
	private static final boolean ShowPlayersInside = true; //If you set it true, NPC will show how many players are inside area.
	private static final boolean ShowPartiesInside = true; //If you set it true, NPC will show how many parties are inside area.
	public PartyTeleporter(int questId, String name, String descr)
	{
		super(questId, name, descr);
		addFirstTalkId(npcid);
		addTalkId(npcid);
		addStartNpc(npcid);
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		if (event.startsWith("partytp"))
		{
			TP(event, npc, player, event);
		}

		return "";
	}
	@SuppressWarnings("deprecation")
	public int getPartiesInside(int zoneId)//Calculating parties inside party area.
    {
        int i = 0;
        for (L2ZoneType zone : ZoneManager.getInstance().getAllZones(null))
            if (zone.getId() == zoneId)
            {
                for (L2Character character : zone.getCharactersInside().values())
                    if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()) && 
                    		((L2PcInstance) character).getParty() != null && 
                    		((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))
                        i++;
            }
        return i;
    } 
	@SuppressWarnings("deprecation")
	public int getPlayerInside(int zoneId)//Calculating players inside party area.
    {
        int i = 0;
        for (L2ZoneType zone : ZoneManager.getInstance().getAllZones(null))
            if (zone.getId() == zoneId)
            {
                for (L2Character character : zone.getCharactersInside().values())
                    if (character instanceof L2PcInstance && (!((L2PcInstance) character).getClient().isDetached()))
                        i++;
            }
return i;
} 
	private void proccessTP(L2PcInstance player) // Teleporting party members to zone
	{
		for (L2PcInstance member : player.getParty().getPartyMembers())
		{
			member.teleToLocation(locationX, locationY, locationZ);//Location X, Y ,Z
		}
	}
	private void TP(String event, L2Npc npc, L2PcInstance player, String command) // Teleport player & his party
	{
		
		try
		{
			L2Party pt = player.getParty();
			if (pt == null)
			{
				player.sendMessage("You are not currently on party.");
				return;
			}
			if (!pt.isLeader(player))
			{
				player.sendMessage("You are not party leader.");
				return;
			}
			if (pt.getMemberCount() < MinPtMembers)
			{
				player.sendMessage("You are going to need a bigger party " +
						"in order to enter party area.");
				return;
			}
			else
			{
				proccessTP(player);
				for (L2PcInstance ppl : pt.getPartyMembers())
				{
					if (ppl.getObjectId() != player.getObjectId())//Dont send this message to pt leader.
					{
						ppl.sendMessage("Your party leader asked to teleport on party area!");//Message only to party members
					}					
				}
			}
			
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
		}
	}
	
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		final int npcId = npc.getNpcId();
		if (player.getQuestState(getName()) == null)
		{
			newQuestState(player);
		}
		if (npcId == npcid)
		{
			String html = HtmCache.getInstance().getHtm(L2PcInstance.getHtmlPrefix());
			html = html.replaceAll("%player%", player.getName());//Replaces %player% with player name on html
			html = html.replaceAll("%minmembers%", ""+MinPtMembers);//Mimum entry party members replace
			html = html.replaceAll("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" :
				"<font color=FF0000>not allowed</font>");//Condition checker replace on html
			html = html.replaceAll("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: "+getPartiesInside(ZoneId)+"</font><br>": "");//Parties inside
			html = html.replaceAll("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: "+getPlayerInside(ZoneId)+"</font><br>": "");//Players Inside
			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
			npcHtml.setHtml(html);
			player.sendPacket(npcHtml);
		}
		return "";
	}
	private boolean isAllowedEnter(L2PcInstance player) //Checks if player & his party is allowed to teleport.
	{
		if (player.getParty() != null)
		{

			{
				return true;
			}
	
		}
		else
		{
			return false;
		}
	}
	public static void main(final String[] args)
	{
		new PartyTeleporter(-1, PartyTeleporter.class.getSimpleName(), "custom");
		System.out.println("Party Teleporter by `Heroin has been loaded successfully!");
	}
}

an gs say me 1 problem at line 20 :(

getValues() return integer, thats the problem..

 

 

change to this

L2Character character : zone.getCharactersInside()):

Edited by AccessDenied
Posted (edited)

ok i fix this problem but error at line 20 stil here :(

 

 

http://postimg.org/image/r9tln9prb/

package custom.PartyTeleporter;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.instancemanager.ZoneManager;
import net.sf.l2j.gameserver.model.L2Party;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
import net.sf.l2j.gameserver.network.serverpackets.ItemList;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;

public class PartyTeleporter extends Quest
{
	private static final int npcid = 36650; // npc id
	//-------------------------------------
	//Teleport Location Coordinates X,Y,Z.
	//Use /loc command in game to find them.
line 20 private static final int locationX = -56742; // npc id
	private static final int locationY = 140569; // npc id
	private static final int locationZ = -2625; // npc id
Edited by Tachi
Posted (edited)

ok i fix this problem but error at line 20 stil here :(

 

 

http://postimg.org/image/r9tln9prb/

 

package custom.PartyTeleporter;import net.sf.l2j.gameserver.cache.HtmCache;import net.sf.l2j.gameserver.datatables.ItemTable;import net.sf.l2j.gameserver.instancemanager.ZoneManager;import net.sf.l2j.gameserver.model.L2Party;import net.sf.l2j.gameserver.model.actor.L2Character;import net.sf.l2j.gameserver.model.actor.L2Npc;import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;import net.sf.l2j.gameserver.model.quest.Quest;import net.sf.l2j.gameserver.model.zone.L2ZoneType;import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;import net.sf.l2j.gameserver.network.serverpackets.ItemList;import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;public class PartyTeleporter extends Quest{	private static final int npcid = 36650; // npc id	//-------------------------------------	//Teleport Location Coordinates X,Y,Z.	//Use /loc command in game to find them.line 20 private static final int locationX = -56742; // npc id	private static final int locationY = 140569; // npc id	private static final int locationZ = -2625; // npc id
Just check another file package and replace this on..where is located this file?

And bro with this sources i suggest you to check about backdoors on voicedcommand handler...if you have bought this from nightwolf...

Edited by Reborn12
Posted

getValues() return integer, thats the problem..

 

 

change to this

L2Character character : zone.getCharactersInside()):

package net.sf.l2j.gameserver.model.actor.instance;

 

import java.util.StringTokenizer;

 

import net.sf.l2j.Config;

import net.sf.l2j.gameserver.datatables.ItemTable;

import net.sf.l2j.gameserver.instancemanager.ZoneManager;

import net.sf.l2j.gameserver.model.L2Party;

import net.sf.l2j.gameserver.model.actor.L2Character;

import net.sf.l2j.gameserver.model.zone.L2ZoneType;

import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;

import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;

import net.sf.l2j.gameserver.network.serverpackets.ItemList;

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;

import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;

 

 

/**

 * @author `Heroin Adapter Gandalf PartyTeleporter, Lucas Fernandes

 */

public class L2PartyTeleporterInstance extends L2NpcInstance

{

 

      private static final int npcid = Config.NPC_ID_PT_TELEPORTER; // npc id

      // -------------------------------------

      // Teleport Location Coordinates X,Y,Z.

      // Use /loc command in game to find them.

      private static final int locationX = Config.NPC_PT_TELEPORTER_X; // npc id

      private static final int locationY = Config.NPC_PT_TELEPORTER_Y; // npc id

      private static final int locationZ = Config.NPC_PT_TELEPORTER_Z; // npc id

      // -------------------------------------

      // -------------------------------------

      // Select the id of your zone.

      // If you dont know how to find your zone id is simple.

      // Go to data/zones/(your zone file).xml and find your zone

      // E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">

      /** The id of your zone is id="6" */

      /** --------------------------------------------------------------------------- */

      /** WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self */ // required to calculate parties & players

      /** --------------------------------------------------------------------------- */

      private static final int ZoneId = Config.NPC_PT_ZONEID; // Here you have to set your zone Id

      // -------------------------------------

      private static final int MinPtMembers = Config.NPC_PT_MINPT_MEMBERS; // Minimum Party Members Count For Enter on Zone.

      private static final int ItemConsumeId = Config.NPC_PT_ITEMCONSUME_ID; // Item Consume id.

      private static final int ItemConsumeNum = Config.NPC_PT_ITEMCOMSUME_QT; // Item Consume Am.ount.

      private static final boolean ShowPlayersInside = Config.NPC_PT_SHOWINSIDE_PLAYERS; // If you set it true, NPC will show how many players are inside area.

      private static final boolean ShowPartiesInside = Config.NPC_PT_SHOWINSIDE_PARTIES; // If you set it true, NPC will show how many parties are inside area.

      private static String ItemName = ItemTable.getInstance().getTemplate(ItemConsumeId).getName(); // Item name, Dont Change this

      private String htmContent;

     

      public L2PartyTeleporterInstance(int objectId, L2NpcTemplate template)

      {

              super(objectId, template);

      }

     

      @Override

      public void onBypassFeedback(L2PcInstance player, String command)

      {

              player.sendPacket(ActionFailed.STATIC_PACKET);

             

              StringTokenizer st = new StringTokenizer(command, " ");

              String actualCommand = st.nextToken(); // Get actual command

             

              if (actualCommand.equalsIgnoreCase("partytp"))

              {

                      TP(player);

              }

              super.onBypassFeedback(player, command);

      }

     

      public int getPartiesInside(int zoneId)// Calculating parties inside party area.

      {

              int i = 0;

              for (L2ZoneType zone : ZoneManager.getInstance().getZones(locationX, locationY, locationZ))

              {

                      if (zone.getId() == zoneId)

                      {

                              for (L2Character character : zone.getCharactersInside())

                              {

                                      if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()) && (((L2PcInstance) character).getParty() != null) && ((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))

                                      {

                                              i++;

                                      }

                              }

                      }

              }

              return i;

      }

     

      public int getPlayerInside(int zoneId)// Calculating players inside party area.

      {

              int i = 0;

              for (L2ZoneType zone : ZoneManager.getInstance().getZones(locationX, locationY, locationZ))

              {

                      if (zone.getId() == zoneId)

                      {

                              for (L2Character character : zone.getCharactersInside())

                              {

                                      if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()))

                                      {

                                              i++;

                                      }

                              }

                      }

              }

              return i;

      }

     

      private static boolean PartyItemsOk(L2PcInstance player)

      // Checks if all party members have the item in their inventory.

      // If pt member has not enough items, party not allowed to enter.

      {

              try

              {

                      for (L2PcInstance member : player.getParty().getPartyMembers())

                      {

                              if (member.getInventory().getItemByItemId(ItemConsumeId) == null)

                             

                              {

                                      player.sendMessage("Your party member " + member.getName() + " does not have enough items.");

                                      return false;

                              }

                              if (member.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNum)

                              {

                                      player.sendMessage("Your party member " + member.getName() + " does not have enough items.");

                                      return false;

                              }

                      }

                      return true;

                     

              }

              catch (Exception e)

              {

                      player.sendMessage("Something went wrong try again.");

                      return true;

              }

      }

     

      private static void proccessTP(L2PcInstance player) // Teleporting party members to zone

      {

              for (L2PcInstance member : player.getParty().getPartyMembers())

              {

                      member.teleToLocation(locationX, locationY, locationZ, 1);// Location X, Y ,Z

              }

      }

     

      private static void TP(L2PcInstance player) // Teleport player & his party

      {

              try

              {

                      L2Party pt = player.getParty();

                      if (pt == null)

                      {

                              player.sendMessage("You are not currently on party.");

                              return;

                      }

                      if (!pt.isLeader(player))

                      {

                              player.sendMessage("You are not party leader.");

                              return;

                      }

                      if (pt.getMemberCount() < MinPtMembers)

                      {

                              player.sendMessage("You are going to need a bigger party " + "in order to enter party area.");

                              return;

                      }

                      if (!PartyItemsOk(player))

                      {

                              return;

                      }

                      proccessTP(player);

                      for (L2PcInstance ppl : pt.getPartyMembers())

                      {

                              if (ppl.getObjectId() != player.getObjectId()) // Dont send this message to pt leader.

                              {

                                      ppl.sendMessage("Your party leader asked to teleport on party area!");// Message only to party members

                              }

                              ppl.destroyItemByItemId("Party_Teleporter", ItemConsumeId, ItemConsumeNum, ppl, true);

                            }

                      // Sends message to party leader.

                      player.sendMessage((ItemConsumeNum * player.getParty().getMemberCount()) + " " + ItemName + " dissapeard from your party.");

                     

              }

              catch (Exception e)

              {

                      player.sendMessage("Something went wrong try again.");

              }

      }

     

      @Override

      public void showChatWindow(L2PcInstance player)

      {

              final int npcId = Config.NPC_ID_PT_TELEPORTER;

              if (npcId == npcid)

              {

                // Send a Server->Client NpcHtmlMessage containing the text of the L2Npc to the L2PcInstance

                  NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());

                  html.setFile("data/html/mods/PartyTeleporter.htm");

                  html.replace("%objectId%", getObjectId());

                  html.replace("%objectId%", String.valueOf(getObjectId()));

                html.replace("%player%", player.getName());// Replaces %player% with player name on html

                html.replace("%itemname%", ItemName);// Item name replace on html

                html.replace("%price%", player.getParty() != null ? "" + (ItemConsumeNum * player.getParty().getMemberCount()) + "" : "0");// Price calculate replace

                html.replace("%minmembers%", "" + MinPtMembers);// Mimum entry party members replace

                html.replace("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>Allowed</font>" : "<font color=FF0000>not allowed</font>");// Condition checker replace on html

                html.replace("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: " + getPartiesInside(ZoneId) + "</font><br>" : "");// Parties inside

                html.replace("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: " + getPlayerInside(ZoneId) + "</font><br>" : "");// Players Inside

                  player.sendPacket(html);

                  return;

              }

                player.sendPacket(ActionFailed.STATIC_PACKET);

              }

      

     

       private static boolean isAllowedEnter(L2PcInstance player) // Checks if player & his party is allowed to teleport.

       {

           return player.getParty() != null && (player.getParty().getMemberCount() >= MinPtMembers) && PartyItemsOk(player);

       }

 

}

 

 

 

net.sf.l2j.gameserver.model.actor.instance.L2PartyTeleporterInstance

 

I have make some Corrections in this File

Dont use it like a javascript.

I have add the HTML FILES TO ----> "data/html/mods/PartyTeleporter.htm")           If you wants it somewere else just change the dir.

 

 

  • 5 weeks later...
Posted

i have a problem with this code :)

 

can you give me any ideea ?

 

http://imgur.com/qSERSlm

 

I think u need to change it to values() or getMembers()....Just delete it and use control+space. U will find the correct one. 

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • We've worked hard for 14 years to gather all the information for your preferred type of game server - we've put together your ideas, your suggestions, information and researches from different knowledge bases and we've made a lot of tests to make the project as good as you love it. Our goal is to create a masterpiece that everyone can enjoy. We are one of the best server and we will be forever. There are many things we did damn right in the past and we will do more in future! Because of that - you're going to see many things you have not seen before on any other servers! Our team knows what you want and what we should do! You value quality and technical excellence? You need safety and exceptional security? You seek true adventures, unique game world, exquisite and eventful game? It means you are in right place! Welcome to L2Blaze, only here you will find and enjoy real game! X150 WARFIRE INTERLUDE SPRING SEASON: 2025 APRIL 26th! Opening time: 14:00 UTC+3 Poland opening time: 13:00 UTC+2 Norway opening time: 14:00 UTC+3 UK opening time: 12:00 UTC+1 Brazil opening time: 8:00 UTC-3 OPENING BONUS Opening bonus for first 100 players who will reach 3rd class will receive VIP Coin as bonus! Automatic registration on game login window, unnecessary to register in website! Do you want stability? Lagless and bugless game? Instant support? Daily PVP? Long-Term playing? You are in the right place, time to start! How to connect STEP BY STEP: 1. Install clear Lineage2 Interlude client 2. Download our patch, delete old system folder and add our 3. Delete, turn off anti virus or add our system folder to anti virus exceptions 4. Run l2.exe from Lineage2/system 5. Enter data on login window and enjoy the game! * You have to remove, turn off or use exceptions of antivirus because of our security protection. It is not a virus. * If you have connection issues with Windows 8 or 10, press right mouse button on l2.exe icon, press Properties, choose compatibility and unmark compatibility mode. Hearts of War EVENT! Collect War Hearts from Hot Springs monsters: Yeti, Buffalo, Antelope, Bandersnatch, Atroxspawn, Flava, Nepenthes, Grendel (3%), Atrox with (6%) and Heart Breaker Boss in Hot Springs Stage 2! You can trade it, sell it or spend in shop! Raid Boss Heart Breaker spawn every 4 hours (+4 hours random) Custom Raid Boss drop list: - Raid Boss Horus, Ember and Brakki, Nakondas: 1 VIP COIN (25%) | Korim (70%). - Raid Boss Apepi, Shacram, Atraiban, Korim: 1 BEWS (10%). - Raid Boss Glaki, Olkuth: 1-2 BEAS (40%). - Raid Boss Golkonda, Galaxia: 1-3 BEAS (60%). - Raid Boss Shyeed: 1-3 BEWS (30%) | 1-7 BEAS (40%) | 1-5 TOP LS 76 (50%). - Raid Boss Shuriel: 1-7 TOP LS 76 (50%) | 1-4 BEAS (60%). - Raid Boss Ashakiel: 1-2 BEWS (30%) | 1-7 TOP LS 76 (50%) | 1-4 BEAS (75%). - Raid Boss Antharas Priest Cloe: 1-3 BEWS (30%) | 1-7 TOP LS 76 (70%). ------------------------------------------------ - Hestia: Demon Splinters / Forgotten Blande (30%). - Ember: Arcana Mace / Draconic Bow (30%). - Galaxia: Angel Slayer / Heaven's Divider (30%) Take your friends, clan, alliance, enemys, sharp your sword, clean your armors and meet your destiny at 2025 APRIL 26th! WEBSITE: http://WWW.L2BLAZE.NET
    • ➡ Discount for your purchase: APRIL (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • ➡ Discount for your purchase: APRIL (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • Refunded Too bad that you couldn't finish it on time.
  • Topics

×
×
  • Create New...