BoatGiranTalking.java 12 KB

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