Advertisement
Sarada-L2

FlagZone+ Piscar quando sai da zona Acis 394+

Feb 28th, 2021
994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 KB | None | 0 0
  1. diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
  2. index d4e835f..b883c9f 100644
  3. --- a/java/net/sf/l2j/Config.java
  4. +++ b/java/net/sf/l2j/Config.java
  5. @@ -40,6 +40,7 @@
  6. public static final String COMMANDS = "./config/CustomMods/Commands.ini";
  7. public static final String SCHEMEBUFF = "./config/CustomMods/SchemeBuff.ini";
  8. public static final String BOSSESETTIGNS = "./config/CustomMods/BossSettings.ini";
  9. + public static final String FLAGZONEMOD = "./config/CustomMods/FlagZone.ini";
  10. // --------------------------------------------------
  11. // Clans settings
  12. // --------------------------------------------------
  13. @@ -548,7 +549,10 @@
  14. public static int KARMA_RATE_DROP_ITEM;
  15. public static int KARMA_RATE_DROP_EQUIP;
  16. public static int KARMA_RATE_DROP_EQUIP_WEAPON;
  17. -
  18. + public static String ENTER_FLAGZONE_MESSEGE;
  19. + public static int TIME_MESSEGE_FLAGZONE_ENTER;
  20. + public static String EXIT_FLAGZONE_MESSEGE;
  21. + public static int TIME_MESSEGE_FLAGZONE_EXIT;
  22. public static double PET_XP_RATE;
  23. public static int PET_FOOD_RATE;
  24. public static double SINEATER_XP_RATE;
  25. @@ -1076,6 +1080,17 @@
  26. SPAWN_INTERVAL_ZAKEN = Boss.getProperty("ZakenSpawnInterval", 60);
  27. RANDOM_SPAWN_TIME_ZAKEN = Boss.getProperty("ZakenRandomSpawn", 20);
  28. }
  29. +
  30. +
  31. + private static final void loadFlag()
  32. + {
  33. + final ExProperties flagzone = initProperties(FLAGZONEMOD);
  34. + ENTER_FLAGZONE_MESSEGE = flagzone.getProperty("FlagZoneMessageTextEnter", "voce entro na zona!");
  35. + TIME_MESSEGE_FLAGZONE_ENTER = Integer.parseInt(flagzone.getProperty("FlagZoneMessegeTimeEnter", "6")) * 1000;
  36. + EXIT_FLAGZONE_MESSEGE = flagzone.getProperty("FlagZoneMessageTextExit", "voce saiu da zona!");
  37. + TIME_MESSEGE_FLAGZONE_EXIT = Integer.parseInt(flagzone.getProperty("FlagZoneMessegeTimeExit", "6")) * 1000;
  38. + }
  39. +
  40. private static final void loadScheme()
  41. {
  42. final ExProperties buff = initProperties(SCHEMEBUFF);
  43. @@ -1526,6 +1541,7 @@
  44. loadSpecial();
  45. loadCommands();
  46. loadScheme();
  47. + loadFlag();
  48. loadBoss();
  49. loadNewChar();
  50. // players settings
  51. diff --git a/java/net/sf/l2j/gameserver/enums/ZoneId.java b/java/net/sf/l2j/gameserver/enums/ZoneId.java
  52. index e381336..26e4abe 100644
  53. --- a/java/net/sf/l2j/gameserver/enums/ZoneId.java
  54. +++ b/java/net/sf/l2j/gameserver/enums/ZoneId.java
  55. @@ -21,7 +21,8 @@
  56. CAST_ON_ARTIFACT(16),
  57. NO_RESTART(17),
  58. SCRIPT(18),
  59. - BOSS(19);
  60. + BOSS(19),
  61. + FLAG(20);
  62.  
  63. private final int _id;
  64.  
  65. diff --git a/java/net/sf/l2j/gameserver/model/zone/type/FlagZone.java b/java/net/sf/l2j/gameserver/model/zone/type/FlagZone.java
  66. new file mode 100644
  67. index 0000000..ede26d9
  68. --- /dev/null
  69. +++ b/java/net/sf/l2j/gameserver/model/zone/type/FlagZone.java
  70. @@ -0,0 +1,50 @@
  71. +package net.sf.l2j.gameserver.model.zone.type;
  72. +
  73. +import net.sf.l2j.Config;
  74. +import net.sf.l2j.gameserver.enums.ZoneId;
  75. +import net.sf.l2j.gameserver.model.actor.Creature;
  76. +import net.sf.l2j.gameserver.model.actor.Player;
  77. +import net.sf.l2j.gameserver.model.zone.type.subtype.ZoneType;
  78. +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
  79. +import net.sf.l2j.gameserver.taskmanager.PvpFlagTaskManager;
  80. +
  81. +/**
  82. + * An arena
  83. + * @author Sarada
  84. + */
  85. +public class FlagZone extends ZoneType
  86. +{
  87. + public FlagZone(int id)
  88. + {
  89. + super(id);
  90. + }
  91. +
  92. + @Override
  93. + protected void onEnter(Creature character)
  94. + {
  95. + if (character instanceof Player)
  96. + {
  97. + final Player player = (Player) character;
  98. +
  99. + character.setInsideZone(ZoneId.FLAG, true);
  100. + character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);
  101. + player.updatePvPFlag(1);
  102. + character.sendPacket(new ExShowScreenMessage(Config.ENTER_FLAGZONE_MESSEGE, Config.TIME_MESSEGE_FLAGZONE_ENTER));
  103. + return;
  104. + }
  105. + }
  106. + @Override
  107. + protected void onExit(Creature character)
  108. + {
  109. + if (character instanceof Player)
  110. + {
  111. + final Player activeChar = (Player) character;
  112. + character.setInsideZone(ZoneId.FLAG, false);
  113. + character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);
  114. + activeChar.updatePvPFlag(0);
  115. + PvpFlagTaskManager.getInstance().add(activeChar, Config.PVP_NORMAL_TIME);
  116. + character.sendPacket(new ExShowScreenMessage(Config.EXIT_FLAGZONE_MESSEGE, Config.TIME_MESSEGE_FLAGZONE_EXIT));
  117. + return;
  118. + }
  119. + }
  120. +}
  121. \ No newline at end of file
  122. diff --git a/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java b/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
  123. index 113b1c2..58a7cad 100644
  124. --- a/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
  125. +++ b/java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java
  126. @@ -5,6 +5,7 @@
  127.  
  128. import net.sf.l2j.commons.pool.ThreadPool;
  129.  
  130. +import net.sf.l2j.gameserver.enums.ZoneId;
  131. import net.sf.l2j.gameserver.model.actor.Player;
  132.  
  133. /**
  134. @@ -35,6 +36,11 @@
  135. {
  136. // Get time left and check.
  137. final Player player = entry.getKey();
  138. + if (player.isInsideZone(ZoneId.FLAG))
  139. + {
  140. + _players.remove(player);
  141. + continue;
  142. + }
  143. final long timeLeft = entry.getValue();
  144.  
  145. // Time is running out, clear PvP flag and remove from list.
  146.  
  147.  
  148. Index: DataPack
  149.  
  150. +#============================================================
  151. +# FlagZone Messenge
  152. +#============================================================
  153. +#Messege to enter to Zona FlagZone
  154. +FlagZoneMessageTextEnter = vc entrou na zona de perigo!
  155. +
  156. +#Time Show Messenge to player Entre to Zone
  157. +FlagZoneMessegeTimeEnter = 4
  158. +
  159. +#Messege to enter to Zona FlagZone
  160. +FlagZoneMessageTextExit = vc saiu da zona de perigo xd!
  161. +
  162. +#Time Show Messenge to player Exit the Zone
  163. +FlagZoneMessegeTimeExit = 4
  164.  
  165.  
  166.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement