Advertisement
Sarada-L2

zone

Jul 12th, 2021
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. /* l2jfrozen Project - www.l2jfrozen.com
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2, or (at your option)
  6. * any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. * 02111-1307, USA.
  17. *
  18. * http://www.gnu.org/copyleft/gpl.html
  19. */
  20. package l2jfrozen.game.model.zone.type;
  21.  
  22. import l2jfrozen.game.datatables.csv.MapRegionTable.TeleportWhereType;
  23. import l2jfrozen.game.model.L2Character;
  24. import l2jfrozen.game.model.actor.instance.L2PcInstance;
  25. import l2jfrozen.game.model.zone.L2ZoneType;
  26. import l2jfrozen.game.network.SystemMessageId;
  27. import l2jfrozen.game.network.serverpackets.SystemMessage;
  28.  
  29. public class L2OlympiadStadiumZone extends L2ZoneType
  30. {
  31. private int _stadiumId;
  32.  
  33. public L2OlympiadStadiumZone(final int id)
  34. {
  35. super(id);
  36. }
  37.  
  38. @Override
  39. public void setParameter(final String name, final String value)
  40. {
  41. if (name.equals("stadiumId"))
  42. {
  43. _stadiumId = Integer.parseInt(value);
  44. }
  45. else
  46. super.setParameter(name, value);
  47. }
  48.  
  49. @Override
  50. public void onEnter(final L2Character character)
  51. {
  52. character.setInsideZone(L2Character.ZONE_PVP, true);
  53.  
  54. if (character instanceof L2PcInstance)
  55. {
  56. final L2PcInstance player = character.getActingPlayer();
  57.  
  58. if (player.getOlympiadGameId() + 1 == getStadiumId() || player.isArenaProtection() || player.isGM())
  59. player.sendPacket(new SystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));
  60. else
  61. player.teleToLocation(TeleportWhereType.Town);
  62. }
  63. }
  64. /*public void onEnter(final L2Character character)
  65. {
  66. character.setInsideZone(L2Character.ZONE_PVP, true);
  67. character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);
  68. character.setInsideZone(L2Character.ZONE_NOLANDING, true);
  69.  
  70. if (character instanceof L2PcInstance)
  71. {
  72. final L2PcInstance player = character.getActingPlayer();
  73.  
  74. if (player.getOlympiadGameId() + 1 == getStadiumId() || player.isArenaProtection() || player.isGM())
  75. player.sendPacket(new SystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));
  76. // ((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.ENTERED_COMBAT_ZONE));
  77.  
  78. if (character.charIsGM())
  79. {
  80. ((L2PcInstance) character).sendMessage("You entered to OLYMPIAD STADIUM - ID:"+getId());
  81. return;
  82. }
  83. }
  84.  
  85. if (character instanceof L2PlayableInstance)
  86. {
  87. final L2PcInstance player = character.getActingPlayer();
  88. if (player != null)
  89. {
  90. // only participants, observers and GMs allowed
  91. if (!player.isGM() && !player.isInOlympiadMode())
  92. {
  93. if (character instanceof L2Summon)
  94. {
  95. ((L2Summon)character).unSummon(player);
  96. }
  97.  
  98. player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
  99. }
  100. }
  101. }
  102. }*/
  103.  
  104. @Override
  105. protected void onExit(L2Character character)
  106. {
  107. character.setInsideZone(L2Character.ZONE_PVP, false);
  108. character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);
  109. character.setInsideZone(L2Character.ZONE_NOLANDING, false);
  110.  
  111. if (character instanceof L2PcInstance)
  112. {
  113. ((L2PcInstance) character).sendPacket(new SystemMessage(SystemMessageId.LEFT_COMBAT_ZONE));
  114.  
  115. if (character.charIsGM())
  116. {
  117. ((L2PcInstance) character).sendMessage("You left OLYMPIAD STADIUM - ID:"+getId());
  118. return;
  119. }
  120. }
  121. }
  122.  
  123. @Override
  124. public void onDieInside(final L2Character character)
  125. {
  126. }
  127.  
  128. @Override
  129. public void onReviveInside(final L2Character character)
  130. {
  131. }
  132.  
  133. /**
  134. * Returns this zones stadium id (if any)
  135. * @return
  136. */
  137. public int getStadiumId()
  138. {
  139. return _stadiumId;
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement