Guest User

Untitled

a guest
Oct 8th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.95 KB | None | 0 0
  1. com.l2jfrozen.gameserver.model.zone.type.L2PartyZone.java
  2. =========================================================
  3. /*
  4. * This program is free software: you can redistribute it and/or modify it under
  5. * the terms of the GNU General Public License as published by the Free Software
  6. * Foundation, either version 3 of the License, or (at your option) any later
  7. * version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  12. * details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package com.l2jfrozen.gameserver.model.zone.type;
  18.  
  19. import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable;
  20. import com.l2jfrozen.gameserver.model.L2Character;
  21. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
  23.  
  24. public class L2PartyZone extends L2ZoneType
  25. {
  26.  
  27. /**
  28. * @param id
  29. */
  30. public L2PartyZone(int id)
  31. {
  32. super(id);
  33. }
  34.  
  35.  
  36. @Override
  37. protected void onEnter(L2Character character)
  38. {
  39. if (character instanceof L2PcInstance)
  40. {
  41. if(((L2PcInstance) character).getParty() != null)
  42. {
  43. ((L2PcInstance) character).setIsInsidePartyZone(true);
  44. ((L2PcInstance) character).sendMessage("You have entered a Party Zone. Prepare for fight.");
  45. }
  46. else
  47. {
  48. ((L2PcInstance) character).sendMessage("This is strict area for Party members ONLY. You will be teleported at the nearest town.");
  49. ((L2PcInstance) character).teleToLocation(MapRegionTable.TeleportWhereType.Town);
  50. }
  51. }
  52. }
  53.  
  54. @Override
  55. protected void onExit(L2Character character)
  56. {
  57. if (character instanceof L2PcInstance)
  58. {
  59. ((L2PcInstance) character).setIsInsidePartyZone(false);
  60. }
  61. }
  62.  
  63.  
  64. @Override
  65. public void onDieInside(L2Character character)
  66. {
  67.  
  68. }
  69.  
  70. @Override
  71. public void onReviveInside(L2Character character)
  72. {
  73. onEnter(character);
  74. }
  75. }
  76. =====================================================================
  77. com.l2jfrozen.gameserver.model.L2Character.java
  78. ====================================================================
  79. /** The Constant ZONE_PARTYZONE. */
  80. public static final int ZONE_PARTYZONE = 16386;
  81.  
  82.  
  83.  
  84. /**
  85. * @return the _isInsidePartyZone
  86. */
  87. public boolean isInsidePartyZone()
  88. {
  89. return isInsidePartyZone();
  90. }
  91.  
  92. /**
  93. * @param _isInsidePartyZone the _isInsidePartyZone to set
  94. */
  95. public void setIsInsidePartyZone(boolean _isInsidePartyZone)
  96. {
  97. this._isInPartyZone = _isInsidePartyZone;
  98. }
  99.  
  100. ======================================================
  101. ZoneData.java
  102. ======================================================
  103. import com.l2jfrozen.gameserver.model.zone.type.L2PartyZone;
  104.  
  105. case "PartyZone":
  106. temp = new L2PartyZone(zoneId);
  107. break;
  108. }
  109.  
  110. ==============================================
  111. com.l2jfrozen.gameserver.network.serverpackets.Die.java
  112. ==============================================
  113. com.l2jfrozen.gameserver.model.zone.type.L2PartyZone
  114.  
  115.  
  116. (player.isInsideZone(L2Character.ZONE_PARTYZONE) && player.isPendingRevive()));
  117.  
  118. =================================================
  119. com.l2jfrozen.gameserver.model.L2Party.java
  120. =================================================
  121. public void removePartyMember(final String name)
  122. {
  123. final L2PcInstance player = getPlayerByName(name);
  124.  
  125. if (player != null)
  126. removePartyMember(player);
  127.  
  128. if (player.isInsidePartyZone())
  129. {
  130. if (getMemberCount() < 5)
  131. {
  132. getPartyMembers().forEach(s -> s.teleToLocation(MapRegionTable.TeleportWhereType.Town));
  133. }
  134. }
  135. }
Add Comment
Please, Sign In to add comment