vnevermore

rfce

May 14th, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.82 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Reunion_Core
  3. Index: java/l2r/gameserver/GameServer.java
  4. ===================================================================
  5. --- java/l2r/gameserver/GameServer.java (revision 1174)
  6. +++ java/l2r/gameserver/GameServer.java (working copy)
  7. @@ -128,6 +128,7 @@
  8.  import l2r.gameserver.model.entity.Hero;
  9.  import l2r.gameserver.model.entity.olympiad.Olympiad;
  10.  import l2r.gameserver.model.events.EventDispatcher;
  11. +import l2r.gameserver.model.zone.type.L2SoloZone;
  12.  import l2r.gameserver.network.L2GameClient;
  13.  import l2r.gameserver.network.L2GamePacketHandler;
  14.  import l2r.gameserver.pathfinding.PathFinding;
  15. @@ -405,6 +406,8 @@
  16.             _log.info("BattleField Zone Initialized.");
  17.         }
  18.        
  19. +       L2SoloZone.StartScheduler();
  20. +      
  21.         printSection("Elemental");
  22.         // Auction House Manager
  23.         AuctionHouseManager.getInstance();
  24. Index: java/l2r/gameserver/model/zone/type/L2SoloZone.java
  25. ===================================================================
  26. --- java/l2r/gameserver/model/zone/type/L2SoloZone.java (revision 0)
  27. +++ java/l2r/gameserver/model/zone/type/L2SoloZone.java (working copy)
  28. @@ -0,0 +1,153 @@
  29. +/*
  30. + * This program is free software: you can redistribute it and/or modify it under
  31. + * the terms of the GNU General Public License as published by the Free Software
  32. + * Foundation, either version 3 of the License, or (at your option) any later
  33. + * version.
  34. + *
  35. + * This program is distributed in the hope that it will be useful, but WITHOUT
  36. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  37. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  38. + * details.
  39. + *
  40. + * You should have received a copy of the GNU General Public License along with
  41. + * this program. If not, see <http://www.gnu.org/licenses/>.
  42. + */
  43. +package l2r.gameserver.model.zone.type;
  44. +
  45. +import l2r.gameserver.ThreadPoolManager;
  46. +import l2r.gameserver.datatables.xml.SkillData;
  47. +import l2r.gameserver.enums.ZoneIdType;
  48. +import l2r.gameserver.model.actor.L2Character;
  49. +import l2r.gameserver.model.actor.instance.L2PcInstance;
  50. +import l2r.gameserver.model.zone.L2ZoneType;
  51. +import l2r.gameserver.network.clientpackets.Say2;
  52. +import l2r.gameserver.network.serverpackets.CreatureSay;
  53. +import l2r.gameserver.util.Broadcast;
  54. +
  55. +/**
  56. + * @author -=DoctorNvm=-
  57. + */
  58. +public class L2SoloZone extends L2ZoneType
  59. +{
  60. +   private static boolean is_active = false;
  61. +  
  62. +   private static int first_delay = 10; // minutes
  63. +   private static int solo_match_time = 20; // minutes
  64. +   private static int delay_between_solo = 40; // minutes
  65. +  
  66. +   public L2SoloZone(int id)
  67. +   {
  68. +       super(id);
  69. +   }
  70. +  
  71. +   @Override
  72. +   protected void onEnter(L2Character character)
  73. +   {
  74. +       L2PcInstance activeChar = character.getActingPlayer();
  75. +       if (isSoloActive())
  76. +       {
  77. +           if (character.isPlayer())
  78. +           {
  79. +               character.setInsideZone(ZoneIdType.SOLO, true);
  80. +               character.setInsideZone(ZoneIdType.PEACE, false);
  81. +               character.setInsideZone(ZoneIdType.NO_RESTART, true);
  82. +               character.setInsideZone(ZoneIdType.NO_SUMMON_FRIEND, true);
  83. +               character.setInsideZone(ZoneIdType.NO_STORE, true);
  84. +               character.setInsideZone(ZoneIdType.NO_BOOKMARK, true);
  85. +               character.setInsideZone(ZoneIdType.NO_ITEM_DROP, true);
  86. +              
  87. +               activeChar.startAntifeedProtection(true, true); // start antifeed protection
  88. +              
  89. +               SkillData.getInstance().getInfo(1323, 1).getEffects(character, character);
  90. +               ((L2PcInstance) character).setPvpFlag(1);
  91. +               ((L2PcInstance) character).broadcastUserInfo();
  92. +           }
  93. +       }
  94. +       else
  95. +       {
  96. +           activeChar.teleToLocation(52345, 3453, 53452); // teleport in main town if solos is disabled
  97. +       }
  98. +   }
  99. +  
  100. +   @Override
  101. +   protected void onExit(final L2Character character)
  102. +   {
  103. +       if (character.isPlayer())
  104. +       {
  105. +           character.setInsideZone(ZoneIdType.SOLO, false);
  106. +           character.setInsideZone(ZoneIdType.NO_RESTART, false);
  107. +           character.setInsideZone(ZoneIdType.NO_SUMMON_FRIEND, false);
  108. +           character.setInsideZone(ZoneIdType.NO_STORE, false);
  109. +           character.setInsideZone(ZoneIdType.NO_BOOKMARK, false);
  110. +           character.setInsideZone(ZoneIdType.NO_ITEM_DROP, false);
  111. +           ((L2PcInstance) character)._fireZoneDeflagTask = ThreadPoolManager.getInstance().scheduleGeneral(() ->
  112. +           {
  113. +               ((L2PcInstance) character).setPvpFlag(0);
  114. +               ((L2PcInstance) character).broadcastUserInfo();
  115. +           }, 30 * 1000);
  116. +       }
  117. +   }
  118. +  
  119. +   @Override
  120. +   public void onReviveInside(L2Character character)
  121. +   {
  122. +       if (isSoloActive())
  123. +       {
  124. +           L2PcInstance activeChar = character.getActingPlayer();
  125. +           SkillData.getInstance().getInfo(1323, 1).getEffects(activeChar, activeChar);
  126. +           activeChar.setCurrentHpMp(activeChar.getMaxHp(), activeChar.getMaxMp());
  127. +           activeChar.setCurrentCp(activeChar.getMaxCp());
  128. +          
  129. +           if (activeChar.hasSummon())
  130. +           {
  131. +               SkillData.getInstance().getInfo(1323, 1).getEffects(activeChar, activeChar.getSummon());
  132. +               activeChar.getSummon().setCurrentHp(activeChar.getSummon().getMaxHp());
  133. +           }
  134. +       }
  135. +   }
  136. +  
  137. +   public static void StartScheduler()
  138. +   {
  139. +       ThreadPoolManager.getInstance().scheduleGeneral(() ->
  140. +       {
  141. +           setIsSoloActive(true);
  142. +           Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is started for next 20 minutes."));
  143. +           runningTime();
  144. +       }, first_delay * 10000);
  145. +   }
  146. +  
  147. +   public static void runningTime()
  148. +   {
  149. +       ThreadPoolManager.getInstance().scheduleGeneral(() ->
  150. +       {
  151. +           setIsSoloActive(false);
  152. +           Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is finished. Next match in " + delay_between_solo + " minutes."));
  153. +           // activeChar.teleToLocation(52345, 3453, 53452); // teleport again inside the zone to make him leave
  154. +           nextOrganizedSchedule();
  155. +       }, solo_match_time * 10000);
  156. +   }
  157. +  
  158. +   public static void nextOrganizedSchedule()
  159. +   {
  160. +       ThreadPoolManager.getInstance().scheduleGeneral(() ->
  161. +       {
  162. +           Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is about to begin in 10 minutes."));
  163. +       }, (delay_between_solo - 10) * 10000);
  164. +      
  165. +       ThreadPoolManager.getInstance().scheduleGeneral(() ->
  166. +       {
  167. +           Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.BATTLEFIELD, "Solo Zone", "is finished. Next match in " + delay_between_solo + " minutes."));
  168. +           StartScheduler();
  169. +       }, (delay_between_solo - first_delay) * 10000);
  170. +   }
  171. +  
  172. +   public static boolean isSoloActive()
  173. +   {
  174. +       return is_active;
  175. +   }
  176. +  
  177. +   public static void setIsSoloActive(boolean x)
  178. +   {
  179. +       is_active = x;
  180. +   }
  181. +}
  182. \ No newline at end of file
  183. Index: java/l2r/gameserver/enums/ZoneIdType.java
  184. ===================================================================
  185. --- java/l2r/gameserver/enums/ZoneIdType.java   (revision 1174)
  186. +++ java/l2r/gameserver/enums/ZoneIdType.java   (working copy)
  187. @@ -52,7 +52,8 @@
  188.     FLAG,
  189.     FIRE1,
  190.     FIRE2,
  191. -   FIRE3;
  192. +   FIRE3,
  193. +   SOLO;
  194.    
  195.     public static int getZoneCount()
  196.     {
Advertisement
Add Comment
Please, Sign In to add comment