Sarada-L2

Flag Zone C4

May 7th, 2021 (edited)
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. diff --git a/java/net/sf/l2j/gameserver/model/L2Character.java b/java/net/sf/l2j/gameserver/model/L2Character.java
  2. index 34ad07f..1a207fd 100644
  3. --- a/java/net/sf/l2j/gameserver/model/L2Character.java
  4. +++ b/java/net/sf/l2j/gameserver/model/L2Character.java
  5. @@ -178,8 +178,8 @@
  6. public static final byte ZONE_BOSS = 12;
  7. public static final byte ZONE_DANGER_AREA = 13;
  8. public static final byte ZONE_NO_STORE = 14;
  9. -
  10. - private final byte[] _zones = new byte[15];
  11. + public static final byte ZONE_FLAG = 15;
  12. + private final byte[] _zones = new byte[16];
  13.  
  14. protected byte _zoneValidateCounter = 4;
  15.  
  16. diff --git a/java/net/sf/l2j/gameserver/model/zone/type/L2FlagZone.java b/java/net/sf/l2j/gameserver/model/zone/type/L2FlagZone.java
  17. new file mode 100644
  18. index 0000000..5148fb1
  19. --- /dev/null
  20. +++ b/java/net/sf/l2j/gameserver/model/zone/type/L2FlagZone.java
  21. @@ -0,0 +1,46 @@
  22. +package net.sf.l2j.gameserver.model.zone.type;
  23. +
  24. +import net.sf.l2j.gameserver.model.L2Character;
  25. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  26. +import net.sf.l2j.gameserver.model.zone.L2ZoneType;
  27. +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  28. +
  29. +/**
  30. + * An arena
  31. + * @author Sarada
  32. + */
  33. +public class L2FlagZone extends L2ZoneType
  34. +{
  35. + public L2FlagZone(int id)
  36. + {
  37. + super(id);
  38. + }
  39. +
  40. + @Override
  41. + protected void onEnter(L2Character character)
  42. + {
  43. + if (character instanceof L2PcInstance)
  44. + {
  45. + final L2PcInstance player = (L2PcInstance) character;
  46. +
  47. + character.setInsideZone(L2Character.ZONE_FLAG, true);
  48. + player.sendPacket(new SystemMessage(SystemMessage.ENTERED_COMBAT_ZONE));
  49. + player.updatePvPFlag(1);
  50. + return;
  51. + }
  52. + }
  53. + @Override
  54. + protected void onExit(L2Character character)
  55. + {
  56. + if (character instanceof L2PcInstance)
  57. + {
  58. + final L2PcInstance activeChar = (L2PcInstance) character;
  59. + character.setInsideZone(L2Character.ZONE_FLAG, false);
  60. + activeChar.updatePvPFlag(0);
  61. + activeChar.sendPacket(new SystemMessage(SystemMessage.LEFT_COMBAT_ZONE));
  62. + return;
  63. + }
  64. + }
  65. +
  66. +}
  67. +
  68. diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java b/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
  69. index 760bb25..438831f 100644
  70. --- a/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
  71. +++ b/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
  72. @@ -19,6 +19,7 @@
  73. import net.sf.l2j.Config;
  74. import net.sf.l2j.gameserver.SevenSignsFestival;
  75. import net.sf.l2j.gameserver.datatables.SkillTable;
  76. +import net.sf.l2j.gameserver.model.L2Character;
  77. import net.sf.l2j.gameserver.model.L2Party;
  78. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  79. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.PrivateStoreType;
  80. @@ -63,7 +64,11 @@
  81. player.sendPacket(new ActionFailed());
  82. return;
  83. }
  84. -
  85. + if(player.isInsideZone(L2Character.ZONE_FLAG))
  86. + {
  87. + player.sendMessage("Cannot exit while in combat zone.");
  88. + return;
  89. + }
  90. // Don't allow leaving if player is fighting
  91. if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player))
  92. {
  93. diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java b/java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
  94. index b854bbd..64e31a3 100644
  95. --- a/java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
  96. +++ b/java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
  97. @@ -19,6 +19,7 @@
  98. import net.sf.l2j.Config;
  99. import net.sf.l2j.gameserver.SevenSignsFestival;
  100. import net.sf.l2j.gameserver.datatables.SkillTable;
  101. +import net.sf.l2j.gameserver.model.L2Character;
  102. import net.sf.l2j.gameserver.model.L2Party;
  103. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  104. import net.sf.l2j.gameserver.network.L2GameClient;
  105. @@ -64,7 +65,11 @@
  106. player.sendPacket(new ActionFailed());
  107. return;
  108. }
  109. -
  110. + if(player.isInsideZone(L2Character.ZONE_FLAG))
  111. + {
  112. + player.sendMessage("Cannot restart while in combat zone.");
  113. + return;
  114. + }
  115. if (player.isInStoreMode())
  116. {
  117. player.sendMessage("Cannot restart while trading.");
  118.  
Add Comment
Please, Sign In to add comment