Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: config/head/other.properties
- ===================================================================
- --- config/head/other.properties (revision 1132)
- +++ config/head/other.properties (working copy)
- @@ -4,6 +4,36 @@
- # Pack: l2jfrozen Site: www.l2jfrozen.com #
- #============================================================#
- +#=============================================================
- +# Npc Party Teleporter
- +#=============================================================
- +# Teleport coordinates
- +PtTeleportX = -56781
- +PtTeleportY = 140545
- +PtTeleportZ = -2629
- +
- +# ZoneId NpcPtZoneID default: 911
- +# 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">
- +NpcPtZoneID = 255
- +
- +# Min party members
- +NpcPtMinPartyMembers = 2
- +
- +# Consume Item Id
- +NpcPtConsumeItemId = 57
- +
- +# Consume Item Quantity
- +NpcPtConsumeItemQt = 100
- +
- +# Show Inside players in zone
- +NpcPtShowInsidePlayers = True
- +
- +# Show Inside Parties in zone
- +NpcPtShowInsideParties = True
- +
- #Amount of adena/AA that a new character is given
- StartingAdena = 0
- StartingAncientAdena = 0
- Index: head-src/com/l2jfrozen/Config.java
- ===================================================================
- --- head-src/com/l2jfrozen/Config.java (revision 1132)
- +++ head-src/com/l2jfrozen/Config.java (working copy)
- @@ -584,6 +584,17 @@
- public static List<int[]> STARTING_CUSTOM_ITEMS_F = new ArrayList<>();
- public static List<int[]> STARTING_CUSTOM_ITEMS_M = new ArrayList<>();
- + /** Npc Party */
- + public static int NPC_PT_TELEPORTER_X;
- + public static int NPC_PT_TELEPORTER_Y;
- + public static int NPC_PT_TELEPORTER_Z;
- + public static int NPC_PT_ZONEID;
- + public static int NPC_PT_MINPT_MEMBERS;
- + public static int NPC_PT_ITEMCONSUME_ID;
- + public static int NPC_PT_ITEMCOMSUME_QT;
- + public static boolean NPC_PT_SHOWINSIDE_PLAYERS;
- + public static boolean NPC_PT_SHOWINSIDE_PARTIES;
- +
- public static boolean DEEPBLUE_DROP_RULES;
- public static int UNSTUCK_INTERVAL;
- public static int DEATH_PENALTY_CHANCE;
- @@ -774,6 +785,16 @@
- }
- }
- + NPC_PT_TELEPORTER_X = Integer.parseInt(otherSettings.getProperty("PtTeleportX", "-56742"));
- + NPC_PT_TELEPORTER_Y = Integer.parseInt(otherSettings.getProperty("PtTeleportY", "140569"));
- + NPC_PT_TELEPORTER_Z = Integer.parseInt(otherSettings.getProperty("PtTeleportZ", "-2625"));
- + NPC_PT_ZONEID = Integer.parseInt(otherSettings.getProperty("NpcPtZoneID", "155"));
- + NPC_PT_MINPT_MEMBERS = Integer.parseInt(otherSettings.getProperty("NpcPtMinPartyMembers", "2"));
- + NPC_PT_ITEMCONSUME_ID = Integer.parseInt(otherSettings.getProperty("NpcPtConsumeItemId", "57"));
- + NPC_PT_ITEMCOMSUME_QT = Integer.parseInt(otherSettings.getProperty("NpcPtConsumeItemQt", "100"));
- + NPC_PT_SHOWINSIDE_PLAYERS = Boolean.parseBoolean(otherSettings.getProperty("NpcPtShowInsidePlayers", "true"));
- + NPC_PT_SHOWINSIDE_PARTIES = Boolean.parseBoolean(otherSettings.getProperty("NpcPtShowInsideParties", "true"));
- +
- UNSTUCK_INTERVAL = Integer.parseInt(otherSettings.getProperty("UnstuckInterval", "300"));
- /* Player protection after teleport or login */
- Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/+L2PartyTeleporterInstance.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PartyTeleporterInstance.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PartyTeleporterInstance.java (working copy)
- /*
- * 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.l2jfrozen.gameserver.model.actor.instance;
- import java.util.StringTokenizer;
- import com.l2jfrozen.Config;
- import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
- import com.l2jfrozen.gameserver.model.L2Character;
- import com.l2jfrozen.gameserver.model.L2Party;
- import com.l2jfrozen.gameserver.model.zone.L2ZoneManager;
- import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
- import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
- /**
- * @author kef
- *
- */
- public class L2PartyTeleporterInstance extends L2FolkInstance
- {
- public L2PartyTeleporterInstance(int objectId, L2NpcTemplate template)
- {
- super(objectId, template);
- }
- @Override
- public void onBypassFeedback(L2PcInstance player, String command)
- {
- StringTokenizer st = new StringTokenizer(command, " ");
- String actualCommand = st.nextToken();
- if (actualCommand.equalsIgnoreCase("partytp"))
- {
- 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() < Config.NPC_PT_MINPT_MEMBERS)
- {
- player.sendMessage("You are going to need a bigger party " + "in order to enter party area.");
- return;
- }
- for (L2PcInstance member : player.getParty().getPartyMembers())
- {
- if (member.getInventory().getItemByItemId(Config.NPC_PT_ITEMCONSUME_ID) == null)
- {
- player.sendMessage("Your party member " + member.getName() + " does not have enough items.");
- return;
- }
- if (member.getInventory().getItemByItemId(Config.NPC_PT_ITEMCONSUME_ID).getCount() < Config.NPC_PT_ITEMCOMSUME_QT)
- {
- player.sendMessage("Your party member " + member.getName() + " does not have enough items.");
- return;
- }
- if (member.getObjectId() != player.getObjectId())
- member.sendMessage("Your party leader asked to teleport on party area!");
- member.destroyItemByItemId("Party", Config.NPC_PT_ITEMCONSUME_ID, Config.NPC_PT_ITEMCOMSUME_QT, null, true);
- member.teleToLocation(Config.NPC_PT_TELEPORTER_X, Config.NPC_PT_TELEPORTER_Y, Config.NPC_PT_TELEPORTER_Z);
- }
- }
- super.onBypassFeedback(player, command);
- }
- public int getPartiesInside(int zoneId)
- {
- int i = 0;
- for (L2ZoneType zone : L2ZoneManager.getZones())
- {
- 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;
- }
- public int getPlayerInside(int zoneId)
- {
- int i = 0;
- for (L2ZoneType zone : L2ZoneManager.getZones())
- {
- if (zone.getId() == zoneId)
- {
- for (L2Character character : zone.getCharactersInside().values())
- {
- if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()))
- i++;
- }
- }
- }
- return i;
- }
- @Override
- public void showChatWindow(L2PcInstance player, int val)
- {
- String name = "data/html/custom/PartyTeleporter/" + getNpcId() + ".htm";
- if (val != 0)
- name = "data/html/custom/PartyTeleporter/" + getNpcId() + "-" + val + ".htm";
- final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- html.setFile(name);
- html.replace("%objectId%", String.valueOf(getObjectId()));
- html.replace("%player%", player.getName());
- html.replace("%itemname%", ItemTable.getInstance().getTemplate(Config.NPC_PT_ITEMCONSUME_ID).getName());
- html.replace("%price%", player.getParty() != null ? "" + (Config.NPC_PT_ITEMCOMSUME_QT * player.getParty().getMemberCount()) + "" : "0");
- html.replace("%minmembers%", "" + Config.NPC_PT_MINPT_MEMBERS);
- html.replace("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" : "<font color=FF0000>not allowed</font>");
- html.replace("%parties%", Config.NPC_PT_SHOWINSIDE_PARTIES ? "<font color=FFA500>Parties Inside: " + getPartiesInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
- html.replace("%players%", Config.NPC_PT_SHOWINSIDE_PLAYERS ? "<font color=FFA500>Players Inside: " + getPlayerInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
- player.sendPacket(html);
- if (player.getParty() != null)
- html.replace("%allowed%", player.getParty().getMemberCount() >= Config.NPC_PT_MINPT_MEMBERS ? "<font color=00FF00>allowed</font>" : "<font color=FF0000>not allowed</font>");
- html.replace("%parties%", Config.NPC_PT_SHOWINSIDE_PARTIES ? "<font color=FFA500>Parties Inside: " + getPartiesInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
- html.replace("%players%", Config.NPC_PT_SHOWINSIDE_PLAYERS ? "<font color=FFA500>Players Inside: " + getPlayerInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
- player.sendPacket(html);
- }
- private static boolean isAllowedEnter(L2PcInstance player)
- {
- if (player.getParty() != null)
- {
- if ((player.getParty().getMemberCount() >= Config.NPC_PT_MINPT_MEMBERS))
- return true;
- return false;
- }
- return false;
- }
- }
- Index: head-src/com/l2jfrozen/gameserver/model/zone/L2ZoneManager.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/zone/L2ZoneManager.java (revision 1132)
- +++ head-src/com/l2jfrozen/gameserver/model/zone/L2ZoneManager.java (working copy)
- @@ -34,7 +34,7 @@
- public class L2ZoneManager
- {
- private final Logger LOGGER = Logger.getLogger(L2ZoneManager.class);
- - private final FastList<L2ZoneType> _zones;
- + private static FastList<L2ZoneType> _zones;
- /**
- * The Constructor creates an initial zone list use registerNewZone() / unregisterZone() to change the zone list
- @@ -112,7 +112,7 @@
- /**
- * @return
- */
- - public FastList<L2ZoneType> getZones()
- + public static FastList<L2ZoneType> getZones()
- {
- return _zones;
- }
- index: head-src/com/l2jfrozen/gameserver/model/L2WorldRegion.java
- ===================================================================
- public boolean checkEffectRangeInsidePeaceZone(final L2Skill skill, final int x, final int y, final int z)
- {
- if (_zoneManager != null)
- {
- final int range = skill.getEffectRange();
- final int up = y + range;
- final int down = y - range;
- final int left = x + range;
- final int right = x - range;
- -for (final L2ZoneType e : _zoneManager.getZones())
- +for (final L2ZoneType e : L2ZoneManager.getZones())
- data/custom/+PartyTeleporter(folder)/+(npcId).htm
- ======================================================
- example: if your npc id is 30333, you have to create 30333.htm file into your "PartyTeleporter" Folder
- then paste into htm this :
- <html>
- <title>%player%</title>
- <body><center>
- <center>
- You have to be a party leader in order to ask from me to teleport you and your party inside party area.<br>
- Minimum number of members in party: <font color="LEVEL">%minmembers%</font>.<br>
- You are currently %allowed% to enter party area with your party.<br>
- Party teleport will cost you total: <font color="LEVEL">%price% %itemname%</font><br>
- </center>
- <center>
- %parties%
- %players%
- <table><tr>
- <td><a action="bypass -h npc_%objectId%_partytp">Teleport me & My party!</td>
- </tr></table>
- <br><br>
- <center>
- </body></html>
- =====================================
- Sql npc type: "L2PartyTeleporter"
- =====================================
Add Comment
Please, Sign In to add comment