BoatInnadrilTour.java 7.2 KB

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