BoatInnadrilTour.java 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (C) 2004-2014 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package vehicles;
  20. import java.util.logging.Level;
  21. import java.util.logging.Logger;
  22. import com.l2jserver.gameserver.ThreadPoolManager;
  23. import com.l2jserver.gameserver.instancemanager.BoatManager;
  24. import com.l2jserver.gameserver.model.VehiclePathPoint;
  25. import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
  26. import com.l2jserver.gameserver.network.SystemMessageId;
  27. import com.l2jserver.gameserver.network.clientpackets.Say2;
  28. import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
  29. import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  30. /**
  31. * @author DS
  32. */
  33. public class BoatInnadrilTour implements Runnable
  34. {
  35. private static final Logger _log = Logger.getLogger(BoatInnadrilTour.class.getName());
  36. // Time: 1867s
  37. private static final VehiclePathPoint[] TOUR =
  38. {
  39. new VehiclePathPoint(105129, 226240, -3610, 150, 800),
  40. new VehiclePathPoint(90604, 238797, -3610, 150, 800),
  41. new VehiclePathPoint(74853, 237943, -3610, 150, 800),
  42. new VehiclePathPoint(68207, 235399, -3610, 150, 800),
  43. new VehiclePathPoint(63226, 230487, -3610, 150, 800),
  44. new VehiclePathPoint(61843, 224797, -3610, 150, 800),
  45. new VehiclePathPoint(61822, 203066, -3610, 150, 800),
  46. new VehiclePathPoint(59051, 197685, -3610, 150, 800),
  47. new VehiclePathPoint(54048, 195298, -3610, 150, 800),
  48. new VehiclePathPoint(41609, 195687, -3610, 150, 800),
  49. new VehiclePathPoint(35821, 200284, -3610, 150, 800),
  50. new VehiclePathPoint(35567, 205265, -3610, 150, 800),
  51. new VehiclePathPoint(35617, 222471, -3610, 150, 800),
  52. new VehiclePathPoint(37932, 226588, -3610, 150, 800),
  53. new VehiclePathPoint(42932, 229394, -3610, 150, 800),
  54. new VehiclePathPoint(74324, 245231, -3610, 150, 800),
  55. new VehiclePathPoint(81872, 250314, -3610, 150, 800),
  56. new VehiclePathPoint(101692, 249882, -3610, 150, 800),
  57. new VehiclePathPoint(107907, 256073, -3610, 150, 800),
  58. new VehiclePathPoint(112317, 257133, -3610, 150, 800),
  59. new VehiclePathPoint(126273, 255313, -3610, 150, 800),
  60. new VehiclePathPoint(128067, 250961, -3610, 150, 800),
  61. new VehiclePathPoint(128520, 238249, -3610, 150, 800),
  62. new VehiclePathPoint(126428, 235072, -3610, 150, 800),
  63. new VehiclePathPoint(121843, 234656, -3610, 150, 800),
  64. new VehiclePathPoint(120096, 234268, -3610, 150, 800),
  65. new VehiclePathPoint(118572, 233046, -3610, 150, 800),
  66. new VehiclePathPoint(117671, 228951, -3610, 150, 800),
  67. new VehiclePathPoint(115936, 226540, -3610, 150, 800),
  68. new VehiclePathPoint(113628, 226240, -3610, 150, 800),
  69. new VehiclePathPoint(111300, 226240, -3610, 150, 800),
  70. new VehiclePathPoint(111264, 226240, -3610, 150, 800)
  71. };
  72. private static final VehiclePathPoint DOCK = TOUR[TOUR.length - 1];
  73. private final L2BoatInstance _boat;
  74. private int _cycle = 0;
  75. private final CreatureSay ARRIVED_AT_INNADRIL;
  76. private final CreatureSay LEAVE_INNADRIL5;
  77. private final CreatureSay LEAVE_INNADRIL1;
  78. private final CreatureSay LEAVE_INNADRIL0;
  79. private final CreatureSay LEAVING_INNADRIL;
  80. private final CreatureSay ARRIVAL20;
  81. private final CreatureSay ARRIVAL15;
  82. private final CreatureSay ARRIVAL10;
  83. private final CreatureSay ARRIVAL5;
  84. private final CreatureSay ARRIVAL1;
  85. private final PlaySound INNADRIL_SOUND;
  86. public BoatInnadrilTour(L2BoatInstance boat)
  87. {
  88. _boat = boat;
  89. ARRIVED_AT_INNADRIL = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_ANCHOR_10_MINUTES);
  90. LEAVE_INNADRIL5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_LEAVE_IN_5_MINUTES);
  91. LEAVE_INNADRIL1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_LEAVE_IN_1_MINUTE);
  92. LEAVE_INNADRIL0 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_LEAVE_SOON);
  93. LEAVING_INNADRIL = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_LEAVING);
  94. ARRIVAL20 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_ARRIVE_20_MINUTES);
  95. ARRIVAL15 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_ARRIVE_15_MINUTES);
  96. ARRIVAL10 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_ARRIVE_10_MINUTES);
  97. ARRIVAL5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_ARRIVE_5_MINUTES);
  98. ARRIVAL1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.INNADRIL_BOAT_ARRIVE_1_MINUTE);
  99. INNADRIL_SOUND = new PlaySound(0, "itemsound.ship_arrival_departure", 1, _boat.getObjectId(), DOCK.getX(), DOCK.getY(), DOCK.getZ());
  100. }
  101. @Override
  102. public void run()
  103. {
  104. try
  105. {
  106. switch (_cycle)
  107. {
  108. case 0:
  109. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL5);
  110. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  111. break;
  112. case 1:
  113. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL1);
  114. ThreadPoolManager.getInstance().scheduleGeneral(this, 40000);
  115. break;
  116. case 2:
  117. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL0);
  118. ThreadPoolManager.getInstance().scheduleGeneral(this, 20000);
  119. break;
  120. case 3:
  121. BoatManager.getInstance().broadcastPackets(DOCK, DOCK, LEAVING_INNADRIL, INNADRIL_SOUND);
  122. _boat.payForRide(0, 1, 107092, 219098, -3952);
  123. _boat.executePath(TOUR);
  124. ThreadPoolManager.getInstance().scheduleGeneral(this, 650000);
  125. break;
  126. case 4:
  127. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL20);
  128. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  129. break;
  130. case 5:
  131. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL15);
  132. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  133. break;
  134. case 6:
  135. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL10);
  136. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  137. break;
  138. case 7:
  139. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL5);
  140. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  141. break;
  142. case 8:
  143. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL1);
  144. break;
  145. case 9:
  146. BoatManager.getInstance().broadcastPackets(DOCK, DOCK, ARRIVED_AT_INNADRIL, INNADRIL_SOUND);
  147. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  148. break;
  149. }
  150. _cycle++;
  151. if (_cycle > 9)
  152. {
  153. _cycle = 0;
  154. }
  155. }
  156. catch (Exception e)
  157. {
  158. _log.log(Level.WARNING, e.getMessage());
  159. }
  160. }
  161. public static void main(String[] args)
  162. {
  163. final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(4, 111264, 226240, -3610, 32768);
  164. if (boat != null)
  165. {
  166. boat.registerEngine(new BoatInnadrilTour(boat));
  167. boat.runEngine(180000);
  168. }
  169. }
  170. }