BoatGiranTalking.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. * @author DS
  28. */
  29. public class BoatGiranTalking implements Runnable
  30. {
  31. private static final Logger _log = Logger.getLogger(BoatGiranTalking.class.getName());
  32. // Time: 868s
  33. private static final VehiclePathPoint[] GIRAN_TO_TALKING =
  34. {
  35. new VehiclePathPoint(51914, 189023, -3610, 150, 800),
  36. new VehiclePathPoint(60567, 189789, -3610, 150, 800),
  37. new VehiclePathPoint(63732, 197457, -3610, 200, 800),
  38. new VehiclePathPoint(63732, 219946, -3610, 250, 800),
  39. new VehiclePathPoint(62008, 222240, -3610, 250, 1200),
  40. new VehiclePathPoint(56115, 226791, -3610, 250, 1200),
  41. new VehiclePathPoint(40384, 226432, -3610, 300, 800),
  42. new VehiclePathPoint(37760, 226432, -3610, 300, 800),
  43. new VehiclePathPoint(27153, 226791, -3610, 300, 800),
  44. new VehiclePathPoint(12672, 227535, -3610, 300, 800),
  45. new VehiclePathPoint(-1808, 228280, -3610, 300, 800),
  46. new VehiclePathPoint(-22165, 230542, -3610, 300, 800),
  47. new VehiclePathPoint(-42523, 235205, -3610, 300, 800),
  48. new VehiclePathPoint(-68451, 259560, -3610, 250, 800),
  49. new VehiclePathPoint(-70848, 261696, -3610, 200, 800),
  50. new VehiclePathPoint(-83344, 261610, -3610, 200, 800),
  51. new VehiclePathPoint(-88344, 261660, -3610, 180, 800),
  52. new VehiclePathPoint(-92344, 261660, -3610, 180, 800),
  53. new VehiclePathPoint(-94242, 261659, -3610, 150, 800)
  54. };
  55. private static final VehiclePathPoint[] TALKING_DOCK =
  56. {
  57. new VehiclePathPoint(-96622, 261660, -3610, 150, 800)
  58. };
  59. // Time: 1398s
  60. private static final VehiclePathPoint[] TALKING_TO_GIRAN =
  61. {
  62. new VehiclePathPoint(-113925, 261660, -3610, 150, 800),
  63. new VehiclePathPoint(-126107, 249116, -3610, 180, 800),
  64. new VehiclePathPoint(-126107, 234499, -3610, 180, 800),
  65. new VehiclePathPoint(-126107, 219882, -3610, 180, 800),
  66. new VehiclePathPoint(-109414, 204914, -3610, 180, 800),
  67. new VehiclePathPoint(-92807, 204914, -3610, 180, 800),
  68. new VehiclePathPoint(-80425, 216450, -3610, 250, 800),
  69. new VehiclePathPoint(-68043, 227987, -3610, 250, 800),
  70. new VehiclePathPoint(-63744, 231168, -3610, 250, 800),
  71. new VehiclePathPoint(-60844, 231369, -3610, 250, 1800),
  72. new VehiclePathPoint(-44915, 231369, -3610, 200, 800),
  73. new VehiclePathPoint(-28986, 231369, -3610, 200, 800),
  74. new VehiclePathPoint(8233, 207624, -3610, 200, 800),
  75. new VehiclePathPoint(21470, 201503, -3610, 180, 800),
  76. new VehiclePathPoint(40058, 195383, -3610, 180, 800),
  77. new VehiclePathPoint(43022, 193793, -3610, 150, 800),
  78. new VehiclePathPoint(45986, 192203, -3610, 150, 800),
  79. new VehiclePathPoint(48950, 190613, -3610, 150, 800)
  80. };
  81. private static final VehiclePathPoint GIRAN_DOCK = TALKING_TO_GIRAN[TALKING_TO_GIRAN.length - 1];
  82. private final L2BoatInstance _boat;
  83. private int _cycle = 0;
  84. private int _shoutCount = 0;
  85. private final CreatureSay ARRIVED_AT_GIRAN;
  86. private final CreatureSay ARRIVED_AT_GIRAN_2;
  87. private final CreatureSay LEAVE_GIRAN5;
  88. private final CreatureSay LEAVE_GIRAN1;
  89. private final CreatureSay LEAVE_GIRAN0;
  90. private final CreatureSay LEAVING_GIRAN;
  91. private final CreatureSay ARRIVED_AT_TALKING;
  92. private final CreatureSay ARRIVED_AT_TALKING_2;
  93. private final CreatureSay LEAVE_TALKING5;
  94. private final CreatureSay LEAVE_TALKING1;
  95. private final CreatureSay LEAVE_TALKING0;
  96. private final CreatureSay LEAVING_TALKING;
  97. private final CreatureSay BUSY_TALKING;
  98. private final CreatureSay ARRIVAL_TALKING15;
  99. private final CreatureSay ARRIVAL_TALKING10;
  100. private final CreatureSay ARRIVAL_TALKING5;
  101. private final CreatureSay ARRIVAL_TALKING1;
  102. private final CreatureSay ARRIVAL_GIRAN20;
  103. private final CreatureSay ARRIVAL_GIRAN15;
  104. private final CreatureSay ARRIVAL_GIRAN10;
  105. private final CreatureSay ARRIVAL_GIRAN5;
  106. private final CreatureSay ARRIVAL_GIRAN1;
  107. private final PlaySound GIRAN_SOUND;
  108. private final PlaySound TALKING_SOUND;
  109. public BoatGiranTalking(L2BoatInstance boat)
  110. {
  111. _boat = boat;
  112. ARRIVED_AT_GIRAN = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_ARRIVED_AT_GIRAN);
  113. ARRIVED_AT_GIRAN_2 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_TALKING_AFTER_10_MINUTES);
  114. LEAVE_GIRAN5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_TALKING_IN_5_MINUTES);
  115. LEAVE_GIRAN1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_TALKING_IN_1_MINUTE);
  116. LEAVE_GIRAN0 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_SOON_FOR_TALKING);
  117. LEAVING_GIRAN = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVING_FOR_TALKING);
  118. ARRIVED_AT_TALKING = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_ARRIVED_AT_TALKING);
  119. ARRIVED_AT_TALKING_2 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_GIRAN_AFTER_10_MINUTES);
  120. LEAVE_TALKING5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_GIRAN_IN_5_MINUTES);
  121. LEAVE_TALKING1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_GIRAN_IN_1_MINUTE);
  122. LEAVE_TALKING0 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_SOON_FOR_GIRAN);
  123. LEAVING_TALKING = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVING_FOR_GIRAN);
  124. BUSY_TALKING = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_GIRAN_TALKING_DELAYED);
  125. ARRIVAL_TALKING15 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_15_MINUTES);
  126. ARRIVAL_TALKING10 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_10_MINUTES);
  127. ARRIVAL_TALKING5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_5_MINUTES);
  128. ARRIVAL_TALKING1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_1_MINUTE);
  129. ARRIVAL_GIRAN20 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_20_MINUTES);
  130. ARRIVAL_GIRAN15 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_15_MINUTES);
  131. ARRIVAL_GIRAN10 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_10_MINUTES);
  132. ARRIVAL_GIRAN5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_5_MINUTES);
  133. ARRIVAL_GIRAN1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_1_MINUTE);
  134. GIRAN_SOUND = new PlaySound(0, "itemsound.ship_arrival_departure", 1, _boat.getObjectId(), GIRAN_DOCK.x, GIRAN_DOCK.y, GIRAN_DOCK.z);
  135. TALKING_SOUND = new PlaySound(0, "itemsound.ship_arrival_departure", 1, _boat.getObjectId(), TALKING_DOCK[0].x, TALKING_DOCK[0].y, TALKING_DOCK[0].z);
  136. }
  137. @Override
  138. public void run()
  139. {
  140. try
  141. {
  142. switch (_cycle)
  143. {
  144. case 0:
  145. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], LEAVE_GIRAN5);
  146. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  147. break;
  148. case 1:
  149. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], LEAVE_GIRAN1);
  150. ThreadPoolManager.getInstance().scheduleGeneral(this, 40000);
  151. break;
  152. case 2:
  153. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], LEAVE_GIRAN0);
  154. ThreadPoolManager.getInstance().scheduleGeneral(this, 20000);
  155. break;
  156. case 3:
  157. BoatManager.getInstance().broadcastPackets(GIRAN_DOCK, TALKING_DOCK[0], LEAVING_GIRAN, ARRIVAL_TALKING15);
  158. _boat.broadcastPacket(GIRAN_SOUND);
  159. _boat.payForRide(3946, 1, 46763, 187041, -3451);
  160. _boat.executePath(GIRAN_TO_TALKING);
  161. ThreadPoolManager.getInstance().scheduleGeneral(this, 250000);
  162. break;
  163. case 4:
  164. BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, ARRIVAL_TALKING10);
  165. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  166. break;
  167. case 5:
  168. BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, ARRIVAL_TALKING5);
  169. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  170. break;
  171. case 6:
  172. BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, ARRIVAL_TALKING1);
  173. break;
  174. case 7:
  175. if (BoatManager.getInstance().dockBusy(BoatManager.TALKING_ISLAND))
  176. {
  177. if (_shoutCount == 0)
  178. BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, BUSY_TALKING);
  179. _shoutCount++;
  180. if (_shoutCount > 35)
  181. _shoutCount = 0;
  182. ThreadPoolManager.getInstance().scheduleGeneral(this, 5000);
  183. return;
  184. }
  185. _boat.executePath(TALKING_DOCK);
  186. break;
  187. case 8:
  188. BoatManager.getInstance().dockShip(BoatManager.TALKING_ISLAND, true);
  189. BoatManager.getInstance().broadcastPackets(TALKING_DOCK[0], GIRAN_DOCK, ARRIVED_AT_TALKING, ARRIVED_AT_TALKING_2);
  190. _boat.broadcastPacket(TALKING_SOUND);
  191. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  192. break;
  193. case 9:
  194. BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, LEAVE_TALKING5);
  195. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  196. break;
  197. case 10:
  198. BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, LEAVE_TALKING1);
  199. ThreadPoolManager.getInstance().scheduleGeneral(this, 40000);
  200. break;
  201. case 11:
  202. BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, LEAVE_TALKING0);
  203. ThreadPoolManager.getInstance().scheduleGeneral(this, 20000);
  204. break;
  205. case 12:
  206. BoatManager.getInstance().dockShip(BoatManager.TALKING_ISLAND, false);
  207. BoatManager.getInstance().broadcastPackets(TALKING_DOCK[0], GIRAN_DOCK, LEAVING_TALKING);
  208. _boat.broadcastPacket(TALKING_SOUND);
  209. _boat.payForRide(3945, 1, -96777, 258970, -3623);
  210. _boat.executePath(TALKING_TO_GIRAN);
  211. ThreadPoolManager.getInstance().scheduleGeneral(this, 200000);
  212. break;
  213. case 13:
  214. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN20);
  215. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  216. break;
  217. case 14:
  218. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN15);
  219. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  220. break;
  221. case 15:
  222. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN10);
  223. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  224. break;
  225. case 16:
  226. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN5);
  227. ThreadPoolManager.getInstance().scheduleGeneral(this, 240000);
  228. break;
  229. case 17:
  230. BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN1);
  231. break;
  232. case 18:
  233. BoatManager.getInstance().broadcastPackets(GIRAN_DOCK, TALKING_DOCK[0], ARRIVED_AT_GIRAN, ARRIVED_AT_GIRAN_2);
  234. _boat.broadcastPacket(GIRAN_SOUND);
  235. ThreadPoolManager.getInstance().scheduleGeneral(this, 300000);
  236. break;
  237. }
  238. _shoutCount = 0;
  239. _cycle++;
  240. if (_cycle > 18)
  241. _cycle = 0;
  242. }
  243. catch (Exception e)
  244. {
  245. _log.log(Level.WARNING, e.getMessage());
  246. }
  247. }
  248. public static void main(String[] args)
  249. {
  250. final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(2, 48950, 190613, -3610, 60800);
  251. if (boat != null)
  252. {
  253. boat.registerEngine(new BoatGiranTalking(boat));
  254. boat.runEngine(180000);
  255. }
  256. }
  257. }