BoatInnadrilTour.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.clientpackets.Say2;
  23. import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
  24. import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  25. /**
  26. *
  27. * @author DS
  28. *
  29. */
  30. public class BoatInnadrilTour implements Runnable
  31. {
  32. private static final Logger _log = Logger.getLogger(BoatInnadrilTour.class.getName());
  33. // Time: 1867s
  34. private static final VehiclePathPoint[] TOUR =
  35. {
  36. new VehiclePathPoint(105129, 226240, -3610, 150, 800),
  37. new VehiclePathPoint(90604, 238797, -3610, 150, 800),
  38. new VehiclePathPoint(74853, 237943, -3610, 150, 800),
  39. new VehiclePathPoint(68207, 235399, -3610, 150, 800),
  40. new VehiclePathPoint(63226, 230487, -3610, 150, 800),
  41. new VehiclePathPoint(61843, 224797, -3610, 150, 800),
  42. new VehiclePathPoint(61822, 203066, -3610, 150, 800),
  43. new VehiclePathPoint(59051, 197685, -3610, 150, 800),
  44. new VehiclePathPoint(54048, 195298, -3610, 150, 800),
  45. new VehiclePathPoint(41609, 195687, -3610, 150, 800),
  46. new VehiclePathPoint(35821, 200284, -3610, 150, 800),
  47. new VehiclePathPoint(35567, 205265, -3610, 150, 800),
  48. new VehiclePathPoint(35617, 222471, -3610, 150, 800),
  49. new VehiclePathPoint(37932, 226588, -3610, 150, 800),
  50. new VehiclePathPoint(42932, 229394, -3610, 150, 800),
  51. new VehiclePathPoint(74324, 245231, -3610, 150, 800),
  52. new VehiclePathPoint(81872, 250314, -3610, 150, 800),
  53. new VehiclePathPoint(101692, 249882, -3610, 150, 800),
  54. new VehiclePathPoint(107907, 256073, -3610, 150, 800),
  55. new VehiclePathPoint(112317, 257133, -3610, 150, 800),
  56. new VehiclePathPoint(126273, 255313, -3610, 150, 800),
  57. new VehiclePathPoint(128067, 250961, -3610, 150, 800),
  58. new VehiclePathPoint(128520, 238249, -3610, 150, 800),
  59. new VehiclePathPoint(126428, 235072, -3610, 150, 800),
  60. new VehiclePathPoint(121843, 234656, -3610, 150, 800),
  61. new VehiclePathPoint(120096, 234268, -3610, 150, 800),
  62. new VehiclePathPoint(118572, 233046, -3610, 150, 800),
  63. new VehiclePathPoint(117671, 228951, -3610, 150, 800),
  64. new VehiclePathPoint(115936, 226540, -3610, 150, 800),
  65. new VehiclePathPoint(113628, 226240, -3610, 150, 800),
  66. new VehiclePathPoint(111300, 226240, -3610, 150, 800),
  67. new VehiclePathPoint(111264, 226240, -3610, 150, 800)
  68. };
  69. private static final VehiclePathPoint DOCK = TOUR[TOUR.length - 1];
  70. private final L2BoatInstance _boat;
  71. private int _cycle = 0;
  72. private final CreatureSay ARRIVED_AT_INNADRIL;
  73. private final CreatureSay LEAVE_INNADRIL5;
  74. private final CreatureSay LEAVE_INNADRIL1;
  75. private final CreatureSay LEAVE_INNADRIL0;
  76. private final CreatureSay LEAVING_INNADRIL;
  77. private final CreatureSay ARRIVAL20;
  78. private final CreatureSay ARRIVAL15;
  79. private final CreatureSay ARRIVAL10;
  80. private final CreatureSay ARRIVAL5;
  81. private final CreatureSay ARRIVAL1;
  82. private final PlaySound INNADRIL_SOUND;
  83. public BoatInnadrilTour(L2BoatInstance boat)
  84. {
  85. _boat = boat;
  86. ARRIVED_AT_INNADRIL = new CreatureSay(0, Say2.BOAT, 801, 998);
  87. LEAVE_INNADRIL5 = new CreatureSay(0, Say2.BOAT, 801, 999);
  88. LEAVE_INNADRIL1 = new CreatureSay(0, Say2.BOAT, 801, 1000);
  89. LEAVE_INNADRIL0 = new CreatureSay(0, Say2.BOAT, 801, 1001);
  90. LEAVING_INNADRIL = new CreatureSay(0, Say2.BOAT, 801, 1002);
  91. ARRIVAL20 = new CreatureSay(0, Say2.BOAT, 801, 1171);
  92. ARRIVAL15 = new CreatureSay(0, Say2.BOAT, 801, 1172);
  93. ARRIVAL10 = new CreatureSay(0, Say2.BOAT, 801, 1173);
  94. ARRIVAL5 = new CreatureSay(0, Say2.BOAT, 801, 1174);
  95. ARRIVAL1 = new CreatureSay(0, Say2.BOAT, 801, 1175);
  96. INNADRIL_SOUND = new PlaySound(0, "itemsound.ship_arrival_departure", 1, _boat.getObjectId(), DOCK.x, DOCK.y, DOCK.z);
  97. }
  98. public void run()
  99. {
  100. try
  101. {
  102. switch (_cycle)
  103. {
  104. case 0:
  105. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL5);
  106. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  107. break;
  108. case 1:
  109. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL1);
  110. ThreadPoolManager.getInstance().scheduleGeneral(this, 40000);
  111. break;
  112. case 2:
  113. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL0);
  114. ThreadPoolManager.getInstance().scheduleGeneral(this, 20000);
  115. break;
  116. case 3:
  117. BoatManager.getInstance().broadcastPackets(DOCK, DOCK, LEAVING_INNADRIL, INNADRIL_SOUND);
  118. _boat.payForRide(0, 1, 107092, 219098, -3952);
  119. _boat.executePath(TOUR);
  120. ThreadPoolManager.getInstance().scheduleGeneral(this, 650000);
  121. break;
  122. case 4:
  123. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL20);
  124. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  125. break;
  126. case 5:
  127. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL15);
  128. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  129. break;
  130. case 6:
  131. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL10);
  132. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  133. break;
  134. case 7:
  135. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL5);
  136. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  137. break;
  138. case 8:
  139. BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL1);
  140. break;
  141. case 9:
  142. BoatManager.getInstance().broadcastPackets(DOCK, DOCK, ARRIVED_AT_INNADRIL, INNADRIL_SOUND);
  143. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  144. break;
  145. }
  146. _cycle++;
  147. if (_cycle > 9)
  148. _cycle = 0;
  149. }
  150. catch (Exception e)
  151. {
  152. _log.log(Level.WARNING, e.getMessage());
  153. }
  154. }
  155. public static void main(String[] args)
  156. {
  157. final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(4, 111264, 226240, -3610, 32768);
  158. if (boat != null)
  159. {
  160. boat.registerEngine(new BoatInnadrilTour(boat));
  161. boat.runEngine(180000);
  162. }
  163. }
  164. }