scraw

Party Teleporter l2jfrozen 1132

May 11th, 2020
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.94 KB | None | 0 0
  1. Index: config/head/other.properties
  2. ===================================================================
  3. --- config/head/other.properties (revision 1132)
  4. +++ config/head/other.properties (working copy)
  5. @@ -4,6 +4,36 @@
  6. # Pack: l2jfrozen Site: www.l2jfrozen.com #
  7. #============================================================#
  8.  
  9. +#=============================================================
  10. +# Npc Party Teleporter
  11. +#=============================================================
  12. +# Teleport coordinates
  13. +PtTeleportX = -56781
  14. +PtTeleportY = 140545
  15. +PtTeleportZ = -2629
  16. +
  17. +# ZoneId NpcPtZoneID default: 911
  18. +# Select the id of your zone.
  19. +# If you dont know how to find your zone id is simple.
  20. +# Go to data/zones/(your zone file).xml and find your zone
  21. +# E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0">
  22. +NpcPtZoneID = 255
  23. +
  24. +# Min party members
  25. +NpcPtMinPartyMembers = 2
  26. +
  27. +# Consume Item Id
  28. +NpcPtConsumeItemId = 57
  29. +
  30. +# Consume Item Quantity
  31. +NpcPtConsumeItemQt = 100
  32. +
  33. +# Show Inside players in zone
  34. +NpcPtShowInsidePlayers = True
  35. +
  36. +# Show Inside Parties in zone
  37. +NpcPtShowInsideParties = True
  38. +
  39. #Amount of adena/AA that a new character is given
  40. StartingAdena = 0
  41. StartingAncientAdena = 0
  42. Index: head-src/com/l2jfrozen/Config.java
  43. ===================================================================
  44. --- head-src/com/l2jfrozen/Config.java (revision 1132)
  45. +++ head-src/com/l2jfrozen/Config.java (working copy)
  46. @@ -584,6 +584,17 @@
  47. public static List<int[]> STARTING_CUSTOM_ITEMS_F = new ArrayList<>();
  48. public static List<int[]> STARTING_CUSTOM_ITEMS_M = new ArrayList<>();
  49.  
  50. + /** Npc Party */
  51. + public static int NPC_PT_TELEPORTER_X;
  52. + public static int NPC_PT_TELEPORTER_Y;
  53. + public static int NPC_PT_TELEPORTER_Z;
  54. + public static int NPC_PT_ZONEID;
  55. + public static int NPC_PT_MINPT_MEMBERS;
  56. + public static int NPC_PT_ITEMCONSUME_ID;
  57. + public static int NPC_PT_ITEMCOMSUME_QT;
  58. + public static boolean NPC_PT_SHOWINSIDE_PLAYERS;
  59. + public static boolean NPC_PT_SHOWINSIDE_PARTIES;
  60. +
  61. public static boolean DEEPBLUE_DROP_RULES;
  62. public static int UNSTUCK_INTERVAL;
  63. public static int DEATH_PENALTY_CHANCE;
  64. @@ -774,6 +785,16 @@
  65. }
  66. }
  67.  
  68. + NPC_PT_TELEPORTER_X = Integer.parseInt(otherSettings.getProperty("PtTeleportX", "-56742"));
  69. + NPC_PT_TELEPORTER_Y = Integer.parseInt(otherSettings.getProperty("PtTeleportY", "140569"));
  70. + NPC_PT_TELEPORTER_Z = Integer.parseInt(otherSettings.getProperty("PtTeleportZ", "-2625"));
  71. + NPC_PT_ZONEID = Integer.parseInt(otherSettings.getProperty("NpcPtZoneID", "155"));
  72. + NPC_PT_MINPT_MEMBERS = Integer.parseInt(otherSettings.getProperty("NpcPtMinPartyMembers", "2"));
  73. + NPC_PT_ITEMCONSUME_ID = Integer.parseInt(otherSettings.getProperty("NpcPtConsumeItemId", "57"));
  74. + NPC_PT_ITEMCOMSUME_QT = Integer.parseInt(otherSettings.getProperty("NpcPtConsumeItemQt", "100"));
  75. + NPC_PT_SHOWINSIDE_PLAYERS = Boolean.parseBoolean(otherSettings.getProperty("NpcPtShowInsidePlayers", "true"));
  76. + NPC_PT_SHOWINSIDE_PARTIES = Boolean.parseBoolean(otherSettings.getProperty("NpcPtShowInsideParties", "true"));
  77. +
  78. UNSTUCK_INTERVAL = Integer.parseInt(otherSettings.getProperty("UnstuckInterval", "300"));
  79.  
  80. /* Player protection after teleport or login */
  81. Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/+L2PartyTeleporterInstance.java
  82. ===================================================================
  83. --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PartyTeleporterInstance.java (revision 0)
  84. +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PartyTeleporterInstance.java (working copy)
  85.  
  86. /*
  87. * This program is free software: you can redistribute it and/or modify it under
  88. * the terms of the GNU General Public License as published by the Free Software
  89. * Foundation, either version 3 of the License, or (at your option) any later
  90. * version.
  91. *
  92. * This program is distributed in the hope that it will be useful, but WITHOUT
  93. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  94. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  95. * details.
  96. *
  97. * You should have received a copy of the GNU General Public License along with
  98. * this program. If not, see <http://www.gnu.org/licenses/>.
  99. */
  100. package com.l2jfrozen.gameserver.model.actor.instance;
  101.  
  102. import java.util.StringTokenizer;
  103.  
  104. import com.l2jfrozen.Config;
  105. import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
  106. import com.l2jfrozen.gameserver.model.L2Character;
  107. import com.l2jfrozen.gameserver.model.L2Party;
  108. import com.l2jfrozen.gameserver.model.zone.L2ZoneManager;
  109. import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
  110. import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
  111. import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
  112.  
  113. /**
  114. * @author kef
  115. *
  116. */
  117.  
  118. public class L2PartyTeleporterInstance extends L2FolkInstance
  119. {
  120. public L2PartyTeleporterInstance(int objectId, L2NpcTemplate template)
  121. {
  122. super(objectId, template);
  123. }
  124.  
  125. @Override
  126. public void onBypassFeedback(L2PcInstance player, String command)
  127. {
  128. StringTokenizer st = new StringTokenizer(command, " ");
  129. String actualCommand = st.nextToken();
  130.  
  131. if (actualCommand.equalsIgnoreCase("partytp"))
  132. {
  133. L2Party pt = player.getParty();
  134.  
  135. if (pt == null)
  136. {
  137. player.sendMessage("You are not currently on party.");
  138. return;
  139. }
  140.  
  141. if (!pt.isLeader(player))
  142. {
  143. player.sendMessage("You are not party leader.");
  144. return;
  145. }
  146.  
  147. if (pt.getMemberCount() < Config.NPC_PT_MINPT_MEMBERS)
  148. {
  149. player.sendMessage("You are going to need a bigger party " + "in order to enter party area.");
  150. return;
  151. }
  152.  
  153. for (L2PcInstance member : player.getParty().getPartyMembers())
  154. {
  155. if (member.getInventory().getItemByItemId(Config.NPC_PT_ITEMCONSUME_ID) == null)
  156. {
  157. player.sendMessage("Your party member " + member.getName() + " does not have enough items.");
  158. return;
  159. }
  160.  
  161. if (member.getInventory().getItemByItemId(Config.NPC_PT_ITEMCONSUME_ID).getCount() < Config.NPC_PT_ITEMCOMSUME_QT)
  162. {
  163. player.sendMessage("Your party member " + member.getName() + " does not have enough items.");
  164. return;
  165. }
  166.  
  167. if (member.getObjectId() != player.getObjectId())
  168. member.sendMessage("Your party leader asked to teleport on party area!");
  169.  
  170. member.destroyItemByItemId("Party", Config.NPC_PT_ITEMCONSUME_ID, Config.NPC_PT_ITEMCOMSUME_QT, null, true);
  171. member.teleToLocation(Config.NPC_PT_TELEPORTER_X, Config.NPC_PT_TELEPORTER_Y, Config.NPC_PT_TELEPORTER_Z);
  172. }
  173. }
  174. super.onBypassFeedback(player, command);
  175. }
  176.  
  177. public int getPartiesInside(int zoneId)
  178. {
  179. int i = 0;
  180. for (L2ZoneType zone : L2ZoneManager.getZones())
  181. {
  182. if (zone.getId() == zoneId)
  183. {
  184. for (L2Character character : zone.getCharactersInside().values())
  185. {
  186. if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()) && (((L2PcInstance) character).getParty() != null) && ((L2PcInstance) character).getParty().isLeader((L2PcInstance) character))
  187. i++;
  188. }
  189. }
  190. }
  191. return i;
  192. }
  193.  
  194. public int getPlayerInside(int zoneId)
  195. {
  196. int i = 0;
  197. for (L2ZoneType zone : L2ZoneManager.getZones())
  198. {
  199. if (zone.getId() == zoneId)
  200. {
  201. for (L2Character character : zone.getCharactersInside().values())
  202. {
  203. if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()))
  204. i++;
  205. }
  206. }
  207. }
  208. return i;
  209. }
  210.  
  211. @Override
  212. public void showChatWindow(L2PcInstance player, int val)
  213. {
  214. String name = "data/html/custom/PartyTeleporter/" + getNpcId() + ".htm";
  215. if (val != 0)
  216. name = "data/html/custom/PartyTeleporter/" + getNpcId() + "-" + val + ".htm";
  217.  
  218. final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  219. html.setFile(name);
  220. html.replace("%objectId%", String.valueOf(getObjectId()));
  221. html.replace("%player%", player.getName());
  222. html.replace("%itemname%", ItemTable.getInstance().getTemplate(Config.NPC_PT_ITEMCONSUME_ID).getName());
  223. html.replace("%price%", player.getParty() != null ? "" + (Config.NPC_PT_ITEMCOMSUME_QT * player.getParty().getMemberCount()) + "" : "0");
  224. html.replace("%minmembers%", "" + Config.NPC_PT_MINPT_MEMBERS);
  225. html.replace("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" : "<font color=FF0000>not allowed</font>");
  226. html.replace("%parties%", Config.NPC_PT_SHOWINSIDE_PARTIES ? "<font color=FFA500>Parties Inside: " + getPartiesInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
  227. html.replace("%players%", Config.NPC_PT_SHOWINSIDE_PLAYERS ? "<font color=FFA500>Players Inside: " + getPlayerInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
  228. player.sendPacket(html);
  229. if (player.getParty() != null)
  230. html.replace("%allowed%", player.getParty().getMemberCount() >= Config.NPC_PT_MINPT_MEMBERS ? "<font color=00FF00>allowed</font>" : "<font color=FF0000>not allowed</font>");
  231.  
  232. html.replace("%parties%", Config.NPC_PT_SHOWINSIDE_PARTIES ? "<font color=FFA500>Parties Inside: " + getPartiesInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
  233. html.replace("%players%", Config.NPC_PT_SHOWINSIDE_PLAYERS ? "<font color=FFA500>Players Inside: " + getPlayerInside(Config.NPC_PT_ZONEID) + "</font><br>" : "");
  234. player.sendPacket(html);
  235. }
  236. private static boolean isAllowedEnter(L2PcInstance player)
  237. {
  238. if (player.getParty() != null)
  239. {
  240. if ((player.getParty().getMemberCount() >= Config.NPC_PT_MINPT_MEMBERS))
  241. return true;
  242.  
  243. return false;
  244. }
  245. return false;
  246. }
  247. }
  248.  
  249.  
  250. Index: head-src/com/l2jfrozen/gameserver/model/zone/L2ZoneManager.java
  251. ===================================================================
  252. --- head-src/com/l2jfrozen/gameserver/model/zone/L2ZoneManager.java (revision 1132)
  253. +++ head-src/com/l2jfrozen/gameserver/model/zone/L2ZoneManager.java (working copy)
  254. @@ -34,7 +34,7 @@
  255. public class L2ZoneManager
  256. {
  257. private final Logger LOGGER = Logger.getLogger(L2ZoneManager.class);
  258. - private final FastList<L2ZoneType> _zones;
  259. + private static FastList<L2ZoneType> _zones;
  260.  
  261. /**
  262. * The Constructor creates an initial zone list use registerNewZone() / unregisterZone() to change the zone list
  263. @@ -112,7 +112,7 @@
  264. /**
  265. * @return
  266. */
  267. - public FastList<L2ZoneType> getZones()
  268. + public static FastList<L2ZoneType> getZones()
  269. {
  270. return _zones;
  271. }
  272.  
  273. index: head-src/com/l2jfrozen/gameserver/model/L2WorldRegion.java
  274. ===================================================================
  275.  
  276. public boolean checkEffectRangeInsidePeaceZone(final L2Skill skill, final int x, final int y, final int z)
  277. {
  278. if (_zoneManager != null)
  279. {
  280. final int range = skill.getEffectRange();
  281. final int up = y + range;
  282. final int down = y - range;
  283. final int left = x + range;
  284. final int right = x - range;
  285.  
  286. -for (final L2ZoneType e : _zoneManager.getZones())
  287. +for (final L2ZoneType e : L2ZoneManager.getZones())
  288.  
  289. data/custom/+PartyTeleporter(folder)/+(npcId).htm
  290. ======================================================
  291. example: if your npc id is 30333, you have to create 30333.htm file into your "PartyTeleporter" Folder
  292.  
  293. then paste into htm this :
  294.  
  295. <html>
  296. <title>%player%</title>
  297. <body><center>
  298. <center>
  299. You have to be a party leader in order to ask from me to teleport you and your party inside party area.<br>
  300. Minimum number of members in party: <font color="LEVEL">%minmembers%</font>.<br>
  301. You are currently %allowed% to enter party area with your party.<br>
  302. Party teleport will cost you total: <font color="LEVEL">%price% %itemname%</font><br>
  303. </center>
  304. <center>
  305. %parties%
  306. %players%
  307.  
  308. <table><tr>
  309. <td><a action="bypass -h npc_%objectId%_partytp">Teleport me & My party!</td>
  310. </tr></table>
  311.  
  312.  
  313. <br><br>
  314. <center>
  315. </body></html>
  316.  
  317. =====================================
  318. Sql npc type: "L2PartyTeleporter"
  319. =====================================
Add Comment
Please, Sign In to add comment