MC_Show.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. /*
  2. * Copyright (C) 2004-2015 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 ai.fantasy_isle;
  20. import java.text.SimpleDateFormat;
  21. import java.util.HashMap;
  22. import java.util.Map;
  23. import ai.npc.AbstractNpcAI;
  24. import com.l2jserver.Config;
  25. import com.l2jserver.gameserver.GameTimeController;
  26. import com.l2jserver.gameserver.ThreadPoolManager;
  27. import com.l2jserver.gameserver.ai.CtrlIntention;
  28. import com.l2jserver.gameserver.model.Location;
  29. import com.l2jserver.gameserver.model.actor.L2Npc;
  30. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  31. import com.l2jserver.gameserver.network.NpcStringId;
  32. import com.l2jserver.gameserver.network.clientpackets.Say2;
  33. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  34. import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  35. /**
  36. * MC Show AI.
  37. * @author Kerberos
  38. */
  39. public class MC_Show extends AbstractNpcAI
  40. {
  41. private static int MC = 32433;
  42. // @formatter:off
  43. private static int[] SINGERS =
  44. {
  45. 32431, 32432
  46. };
  47. private static int[] CIRCUS =
  48. {
  49. 32442, 32443, 32444, 32445, 32446
  50. };
  51. private static int[] INDIVIDUALS =
  52. {
  53. 32439, 32440, 32441
  54. };
  55. private static int[] SHOWSTUFF =
  56. {
  57. 32424, 32425, 32426, 32427, 32428
  58. };
  59. // @formatter:on
  60. private static boolean IS_STARTED = false;
  61. private static NpcStringId[] MESSAGES =
  62. {
  63. NpcStringId.HOW_COME_PEOPLE_ARE_NOT_HERE_WE_ARE_ABOUT_TO_START_THE_SHOW_HMM,
  64. NpcStringId.UGH_I_HAVE_BUTTERFLIES_IN_MY_STOMACH_THE_SHOW_STARTS_SOON,
  65. NpcStringId.THANK_YOU_ALL_FOR_COMING_HERE_TONIGHT,
  66. NpcStringId.IT_IS_AN_HONOR_TO_HAVE_THE_SPECIAL_SHOW_TODAY,
  67. NpcStringId.FANTASY_ISLE_IS_FULLY_COMMITTED_TO_YOUR_HAPPINESS,
  68. NpcStringId.NOW_ID_LIKE_TO_INTRODUCE_THE_MOST_BEAUTIFUL_SINGER_IN_ADEN_PLEASE_WELCOMELEYLA_MIRA,
  69. NpcStringId.HERE_SHE_COMES,
  70. NpcStringId.THANK_YOU_VERY_MUCH_LEYLA,
  71. NpcStringId.NOW_WERE_IN_FOR_A_REAL_TREAT,
  72. NpcStringId.JUST_BACK_FROM_THEIR_WORLD_TOUR_PUT_YOUR_HANDS_TOGETHER_FOR_THE_FANTASY_ISLE_CIRCUS,
  73. NpcStringId.COME_ON_EVERYONE,
  74. NpcStringId.DID_YOU_LIKE_IT_THAT_WAS_SO_AMAZING,
  75. NpcStringId.NOW_WE_ALSO_INVITED_INDIVIDUALS_WITH_SPECIAL_TALENTS,
  76. NpcStringId.LETS_WELCOME_THE_FIRST_PERSON_HERE,
  77. NpcStringId.OH,
  78. NpcStringId.OKAY_NOW_HERE_COMES_THE_NEXT_PERSON_COME_ON_UP_PLEASE,
  79. NpcStringId.OH_IT_LOOKS_LIKE_SOMETHING_GREAT_IS_GOING_TO_HAPPEN_RIGHT,
  80. NpcStringId.OH_MY,
  81. NpcStringId.THATS_G_GREAT_NOW_HERE_COMES_THE_LAST_PERSON,
  82. NpcStringId.NOW_THIS_IS_THE_END_OF_TODAYS_SHOW,
  83. NpcStringId.HOW_WAS_IT_I_HOPE_YOU_ALL_ENJOYED_IT,
  84. NpcStringId.PLEASE_REMEMBER_THAT_FANTASY_ISLE_IS_ALWAYS_PLANNING_A_LOT_OF_GREAT_SHOWS_FOR_YOU,
  85. NpcStringId.WELL_I_WISH_I_COULD_CONTINUE_ALL_NIGHT_LONG_BUT_THIS_IS_IT_FOR_TODAY_THANK_YOU,
  86. NpcStringId.WE_LOVE_YOU
  87. };
  88. private class ShoutInfo
  89. {
  90. private final NpcStringId _npcStringId;
  91. private final String _nextEvent;
  92. private final int _time;
  93. public ShoutInfo(NpcStringId npcStringId, String nextEvent, int time)
  94. {
  95. _npcStringId = npcStringId;
  96. _nextEvent = nextEvent;
  97. _time = time;
  98. }
  99. /**
  100. * @return the _npcStringId
  101. */
  102. public NpcStringId getNpcStringId()
  103. {
  104. return _npcStringId;
  105. }
  106. /**
  107. * @return the _nextEvent
  108. */
  109. public String getNextEvent()
  110. {
  111. return _nextEvent;
  112. }
  113. /**
  114. * @return the _time
  115. */
  116. public int getTime()
  117. {
  118. return _time;
  119. }
  120. }
  121. private class WalkInfo
  122. {
  123. private final Location _charPos;
  124. private final String _nextEvent;
  125. private final int _time;
  126. public WalkInfo(Location charPos, String nextEvent, int time)
  127. {
  128. _charPos = charPos;
  129. _nextEvent = nextEvent;
  130. _time = time;
  131. }
  132. /**
  133. * @return the _charPos
  134. */
  135. public Location getCharPos()
  136. {
  137. return _charPos;
  138. }
  139. /**
  140. * @return the _nextEvent
  141. */
  142. public String getNextEvent()
  143. {
  144. return _nextEvent;
  145. }
  146. /**
  147. * @return the _time
  148. */
  149. public int getTime()
  150. {
  151. return _time;
  152. }
  153. }
  154. private static final Map<String, ShoutInfo> TALKS = new HashMap<>();
  155. private static final Map<String, WalkInfo> WALKS = new HashMap<>();
  156. private MC_Show()
  157. {
  158. super(MC_Show.class.getSimpleName(), "ai/fantasy_isle");
  159. addSpawnId(32433, 32431, 32432, 32442, 32443, 32444, 32445, 32446, 32424, 32425, 32426, 32427, 32428);
  160. load();
  161. scheduleTimer();
  162. }
  163. private void load()
  164. {
  165. // TODO put this stuff in Routes.xml
  166. TALKS.put("1", new ShoutInfo(MESSAGES[1], "2", 1000));
  167. TALKS.put("2", new ShoutInfo(MESSAGES[2], "3", 6000));
  168. TALKS.put("3", new ShoutInfo(MESSAGES[3], "4", 4000));
  169. TALKS.put("4", new ShoutInfo(MESSAGES[4], "5", 5000));
  170. TALKS.put("5", new ShoutInfo(MESSAGES[5], "6", 3000));
  171. TALKS.put("8", new ShoutInfo(MESSAGES[9], "9", 5000));
  172. TALKS.put("9", new ShoutInfo(MESSAGES[10], "10", 5000));
  173. TALKS.put("12", new ShoutInfo(MESSAGES[12], "13", 5000));
  174. TALKS.put("13", new ShoutInfo(MESSAGES[13], "14", 5000));
  175. TALKS.put("15", new ShoutInfo(MESSAGES[14], "16", 5000));
  176. TALKS.put("16", new ShoutInfo(MESSAGES[15], "17", 5000));
  177. TALKS.put("18", new ShoutInfo(MESSAGES[17], "19", 5000));
  178. TALKS.put("19", new ShoutInfo(MESSAGES[18], "20", 5000));
  179. TALKS.put("21", new ShoutInfo(MESSAGES[19], "22", 5000));
  180. TALKS.put("22", new ShoutInfo(MESSAGES[20], "23", 400));
  181. TALKS.put("25", new ShoutInfo(MESSAGES[21], "26", 5000));
  182. TALKS.put("26", new ShoutInfo(MESSAGES[22], "27", 5400));
  183. WALKS.put("npc1_1", new WalkInfo(new Location(-56546, -56384, -2008, 0), "npc1_2", 1200));
  184. WALKS.put("npc1_2", new WalkInfo(new Location(-56597, -56384, -2008, 0), "npc1_3", 1200));
  185. WALKS.put("npc1_3", new WalkInfo(new Location(-56596, -56428, -2008, 0), "npc1_4", 1200));
  186. WALKS.put("npc1_4", new WalkInfo(new Location(-56593, -56474, -2008, 0), "npc1_5", 1000));
  187. WALKS.put("npc1_5", new WalkInfo(new Location(-56542, -56474, -2008, 0), "npc1_6", 1000));
  188. WALKS.put("npc1_6", new WalkInfo(new Location(-56493, -56473, -2008, 0), "npc1_7", 2000));
  189. WALKS.put("npc1_7", new WalkInfo(new Location(-56495, -56425, -2008, 0), "npc1_1", 4000));
  190. WALKS.put("npc2_1", new WalkInfo(new Location(-56550, -56291, -2008, 0), "npc2_2", 1200));
  191. WALKS.put("npc2_2", new WalkInfo(new Location(-56601, -56293, -2008, 0), "npc2_3", 1200));
  192. WALKS.put("npc2_3", new WalkInfo(new Location(-56603, -56247, -2008, 0), "npc2_4", 1200));
  193. WALKS.put("npc2_4", new WalkInfo(new Location(-56605, -56203, -2008, 0), "npc2_5", 1000));
  194. WALKS.put("npc2_5", new WalkInfo(new Location(-56553, -56202, -2008, 0), "npc2_6", 1100));
  195. WALKS.put("npc2_6", new WalkInfo(new Location(-56504, -56200, -2008, 0), "npc2_7", 2000));
  196. WALKS.put("npc2_7", new WalkInfo(new Location(-56503, -56243, -2008, 0), "npc2_1", 4000));
  197. WALKS.put("npc3_1", new WalkInfo(new Location(-56500, -56290, -2008, 0), "npc3_2", 1200));
  198. WALKS.put("npc3_2", new WalkInfo(new Location(-56551, -56313, -2008, 0), "npc3_3", 1200));
  199. WALKS.put("npc3_3", new WalkInfo(new Location(-56601, -56293, -2008, 0), "npc3_4", 1200));
  200. WALKS.put("npc3_4", new WalkInfo(new Location(-56651, -56294, -2008, 0), "npc3_5", 1200));
  201. WALKS.put("npc3_5", new WalkInfo(new Location(-56653, -56250, -2008, 0), "npc3_6", 1200));
  202. WALKS.put("npc3_6", new WalkInfo(new Location(-56654, -56204, -2008, 0), "npc3_7", 1200));
  203. WALKS.put("npc3_7", new WalkInfo(new Location(-56605, -56203, -2008, 0), "npc3_8", 1200));
  204. WALKS.put("npc3_8", new WalkInfo(new Location(-56554, -56202, -2008, 0), "npc3_9", 1200));
  205. WALKS.put("npc3_9", new WalkInfo(new Location(-56503, -56200, -2008, 0), "npc3_10", 1200));
  206. WALKS.put("npc3_10", new WalkInfo(new Location(-56502, -56244, -2008, 0), "npc3_1", 900));
  207. WALKS.put("npc4_1", new WalkInfo(new Location(-56495, -56381, -2008, 0), "npc4_2", 1200));
  208. WALKS.put("npc4_2", new WalkInfo(new Location(-56548, -56383, -2008, 0), "npc4_3", 1200));
  209. WALKS.put("npc4_3", new WalkInfo(new Location(-56597, -56383, -2008, 0), "npc4_4", 1200));
  210. WALKS.put("npc4_4", new WalkInfo(new Location(-56643, -56385, -2008, 0), "npc4_5", 1200));
  211. WALKS.put("npc4_5", new WalkInfo(new Location(-56639, -56436, -2008, 0), "npc4_6", 1200));
  212. WALKS.put("npc4_6", new WalkInfo(new Location(-56639, -56473, -2008, 0), "npc4_7", 1200));
  213. WALKS.put("npc4_7", new WalkInfo(new Location(-56589, -56473, -2008, 0), "npc4_8", 1200));
  214. WALKS.put("npc4_8", new WalkInfo(new Location(-56541, -56473, -2008, 0), "npc4_9", 1200));
  215. WALKS.put("npc4_9", new WalkInfo(new Location(-56496, -56473, -2008, 0), "npc4_10", 1200));
  216. WALKS.put("npc4_10", new WalkInfo(new Location(-56496, -56429, -2008, 0), "npc4_1", 900));
  217. WALKS.put("npc5_1", new WalkInfo(new Location(-56549, -56335, -2008, 0), "npc5_2", 1000));
  218. WALKS.put("npc5_2", new WalkInfo(new Location(-56599, -56337, -2008, 0), "npc5_3", 2000));
  219. WALKS.put("npc5_3", new WalkInfo(new Location(-56649, -56341, -2008, 0), "npc5_4", 26000));
  220. WALKS.put("npc5_4", new WalkInfo(new Location(-56600, -56341, -2008, 0), "npc5_5", 1000));
  221. WALKS.put("npc5_5", new WalkInfo(new Location(-56553, -56341, -2008, 0), "npc5_6", 1000));
  222. WALKS.put("npc5_6", new WalkInfo(new Location(-56508, -56331, -2008, 0), "npc5_2", 8000));
  223. WALKS.put("npc6_1", new WalkInfo(new Location(-56595, -56428, -2008, 0), "npc6_2", 1000));
  224. WALKS.put("npc6_2", new WalkInfo(new Location(-56596, -56383, -2008, 0), "npc6_3", 1000));
  225. WALKS.put("npc6_3", new WalkInfo(new Location(-56648, -56384, -2008, 0), "npc6_4", 1000));
  226. WALKS.put("npc6_4", new WalkInfo(new Location(-56645, -56429, -2008, 0), "npc6_5", 1000));
  227. WALKS.put("npc6_5", new WalkInfo(new Location(-56644, -56475, -2008, 0), "npc6_6", 1000));
  228. WALKS.put("npc6_6", new WalkInfo(new Location(-56595, -56473, -2008, 0), "npc6_7", 1000));
  229. WALKS.put("npc6_7", new WalkInfo(new Location(-56542, -56473, -2008, 0), "npc6_8", 1000));
  230. WALKS.put("npc6_8", new WalkInfo(new Location(-56492, -56472, -2008, 0), "npc6_9", 1200));
  231. WALKS.put("npc6_9", new WalkInfo(new Location(-56495, -56426, -2008, 0), "npc6_10", 2000));
  232. WALKS.put("npc6_10", new WalkInfo(new Location(-56540, -56426, -2008, 0), "npc6_1", 3000));
  233. WALKS.put("npc7_1", new WalkInfo(new Location(-56603, -56249, -2008, 0), "npc7_2", 1000));
  234. WALKS.put("npc7_2", new WalkInfo(new Location(-56601, -56294, -2008, 0), "npc7_3", 1000));
  235. WALKS.put("npc7_3", new WalkInfo(new Location(-56651, -56295, -2008, 0), "npc7_4", 1000));
  236. WALKS.put("npc7_4", new WalkInfo(new Location(-56653, -56248, -2008, 0), "npc7_5", 1000));
  237. WALKS.put("npc7_5", new WalkInfo(new Location(-56605, -56203, -2008, 0), "npc7_6", 1000));
  238. WALKS.put("npc7_6", new WalkInfo(new Location(-56554, -56202, -2008, 0), "npc7_7", 1000));
  239. WALKS.put("npc7_7", new WalkInfo(new Location(-56504, -56201, -2008, 0), "npc7_8", 1000));
  240. WALKS.put("npc7_8", new WalkInfo(new Location(-56502, -56247, -2008, 0), "npc7_9", 1200));
  241. WALKS.put("npc7_9", new WalkInfo(new Location(-56549, -56248, -2008, 0), "npc7_10", 2000));
  242. WALKS.put("npc7_10", new WalkInfo(new Location(-56549, -56248, -2008, 0), "npc7_1", 3000));
  243. WALKS.put("npc8_1", new WalkInfo(new Location(-56493, -56426, -2008, 0), "npc8_2", 1000));
  244. WALKS.put("npc8_2", new WalkInfo(new Location(-56497, -56381, -2008, 0), "npc8_3", 1200));
  245. WALKS.put("npc8_3", new WalkInfo(new Location(-56544, -56381, -2008, 0), "npc8_4", 1200));
  246. WALKS.put("npc8_4", new WalkInfo(new Location(-56596, -56383, -2008, 0), "npc8_5", 1200));
  247. WALKS.put("npc8_5", new WalkInfo(new Location(-56594, -56428, -2008, 0), "npc8_6", 900));
  248. WALKS.put("npc8_6", new WalkInfo(new Location(-56645, -56429, -2008, 0), "npc8_7", 1200));
  249. WALKS.put("npc8_7", new WalkInfo(new Location(-56647, -56384, -2008, 0), "npc8_8", 1200));
  250. WALKS.put("npc8_8", new WalkInfo(new Location(-56649, -56362, -2008, 0), "npc8_9", 9200));
  251. WALKS.put("npc8_9", new WalkInfo(new Location(-56654, -56429, -2008, 0), "npc8_10", 1200));
  252. WALKS.put("npc8_10", new WalkInfo(new Location(-56644, -56474, -2008, 0), "npc8_11", 900));
  253. WALKS.put("npc8_11", new WalkInfo(new Location(-56593, -56473, -2008, 0), "npc8_12", 1100));
  254. WALKS.put("npc8_12", new WalkInfo(new Location(-56543, -56472, -2008, 0), "npc8_13", 1200));
  255. WALKS.put("npc8_13", new WalkInfo(new Location(-56491, -56471, -2008, 0), "npc8_1", 1200));
  256. WALKS.put("npc9_1", new WalkInfo(new Location(-56505, -56246, -2008, 0), "npc9_2", 1000));
  257. WALKS.put("npc9_2", new WalkInfo(new Location(-56504, -56291, -2008, 0), "npc9_3", 1200));
  258. WALKS.put("npc9_3", new WalkInfo(new Location(-56550, -56291, -2008, 0), "npc9_4", 1200));
  259. WALKS.put("npc9_4", new WalkInfo(new Location(-56600, -56292, -2008, 0), "npc9_5", 1200));
  260. WALKS.put("npc9_5", new WalkInfo(new Location(-56603, -56248, -2008, 0), "npc9_6", 900));
  261. WALKS.put("npc9_6", new WalkInfo(new Location(-56653, -56249, -2008, 0), "npc9_7", 1200));
  262. WALKS.put("npc9_7", new WalkInfo(new Location(-56651, -56294, -2008, 0), "npc9_8", 1200));
  263. WALKS.put("npc9_8", new WalkInfo(new Location(-56650, -56316, -2008, 0), "npc9_9", 9200));
  264. WALKS.put("npc9_9", new WalkInfo(new Location(-56660, -56250, -2008, 0), "npc9_10", 1200));
  265. WALKS.put("npc9_10", new WalkInfo(new Location(-56656, -56205, -2008, 0), "npc9_11", 900));
  266. WALKS.put("npc9_11", new WalkInfo(new Location(-56606, -56204, -2008, 0), "npc9_12", 1100));
  267. WALKS.put("npc9_12", new WalkInfo(new Location(-56554, -56203, -2008, 0), "npc9_13", 1200));
  268. WALKS.put("npc9_13", new WalkInfo(new Location(-56506, -56203, -2008, 0), "npc9_1", 1200));
  269. WALKS.put("24", new WalkInfo(new Location(-56730, -56340, -2008, 0), "25", 1800));
  270. WALKS.put("27", new WalkInfo(new Location(-56702, -56340, -2008, 0), "29", 1800));
  271. }
  272. private void scheduleTimer()
  273. {
  274. int gameTime = GameTimeController.getInstance().getGameTime();
  275. int hours = (gameTime / 60) % 24;
  276. int minutes = gameTime % 60;
  277. int hourDiff, minDiff;
  278. hourDiff = (20 - hours);
  279. if (hourDiff < 0)
  280. {
  281. hourDiff = 24 - (hourDiff *= -1);
  282. }
  283. minDiff = (30 - minutes);
  284. if (minDiff < 0)
  285. {
  286. minDiff = 60 - (minDiff *= -1);
  287. }
  288. long diff;
  289. hourDiff *= 3600000;
  290. minDiff *= 60000;
  291. diff = hourDiff + minDiff;
  292. if (Config.DEBUG)
  293. {
  294. SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
  295. _log.info("Fantasy Isle: MC show script starting at " + format.format(System.currentTimeMillis() + diff) + " and is scheduled each next 4 hours.");
  296. }
  297. // TODO startRepeatingQuestTimer("Start", diff, 14400000, null, null);
  298. // missing option to provide different initial delay
  299. ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new StartMCShow(), diff, 14400000L);
  300. }
  301. private void autoChat(L2Npc npc, NpcStringId npcString, int type)
  302. {
  303. npc.broadcastPacket(new NpcSay(npc.getObjectId(), type, npc.getId(), npcString));
  304. }
  305. @Override
  306. public String onSpawn(L2Npc npc)
  307. {
  308. if (IS_STARTED)
  309. {
  310. switch (npc.getId())
  311. {
  312. case 32433:
  313. autoChat(npc, MESSAGES[0], Say2.NPC_SHOUT);
  314. startQuestTimer("1", 30000, npc, null);
  315. break;
  316. case 32431:
  317. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56657, -56338, -2008, 33102));
  318. startQuestTimer("social1", 6000, npc, null, true);
  319. startQuestTimer("7", 215000, npc, null);
  320. break;
  321. case 32432:
  322. startQuestTimer("social1", 6000, npc, null, true);
  323. startQuestTimer("7", 215000, npc, null);
  324. break;
  325. case 32442:
  326. case 32443:
  327. case 32444:
  328. case 32445:
  329. case 32446:
  330. startQuestTimer("11", 100000, npc, null);
  331. break;
  332. case 32424:
  333. case 32425:
  334. case 32426:
  335. case 32427:
  336. case 32428:
  337. startQuestTimer("social1", 5500, npc, null);
  338. startQuestTimer("social1", 12500, npc, null);
  339. startQuestTimer("28", 19700, npc, null);
  340. break;
  341. }
  342. }
  343. return super.onSpawn(npc);
  344. }
  345. @Override
  346. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  347. {
  348. if ((event == null) || event.isEmpty())
  349. {
  350. _log.warning("MC_Show: Null/Empty event for npc " + npc + " and player " + player + "!");
  351. return null;
  352. }
  353. if (event.equalsIgnoreCase("Start"))
  354. {
  355. IS_STARTED = true;
  356. addSpawn(MC, -56698, -56430, -2008, 32768, false, 0);
  357. }
  358. else if ((npc != null) && IS_STARTED)
  359. {
  360. // TODO switch on event
  361. if (event.equalsIgnoreCase("6"))
  362. {
  363. autoChat(npc, MESSAGES[6], Say2.NPC_SHOUT);
  364. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56511, -56647, -2008, 36863));
  365. npc.broadcastPacket(new PlaySound(1, "NS22_F", 0, 0, 0, 0, 0));
  366. addSpawn(SINGERS[0], -56344, -56328, -2008, 32768, false, 224000);
  367. addSpawn(SINGERS[1], -56552, -56245, -2008, 36863, false, 224000);
  368. addSpawn(SINGERS[1], -56546, -56426, -2008, 28672, false, 224000);
  369. addSpawn(SINGERS[1], -56570, -56473, -2008, 28672, false, 224000);
  370. addSpawn(SINGERS[1], -56594, -56516, -2008, 28672, false, 224000);
  371. addSpawn(SINGERS[1], -56580, -56203, -2008, 36863, false, 224000);
  372. addSpawn(SINGERS[1], -56606, -56157, -2008, 36863, false, 224000);
  373. startQuestTimer("7", 215000, npc, null);
  374. }
  375. else if (event.equalsIgnoreCase("7"))
  376. {
  377. switch (npc.getId())
  378. {
  379. case 32433:
  380. autoChat(npc, MESSAGES[7], Say2.NPC_SHOUT);
  381. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56698, -56430, -2008, 32768));
  382. startQuestTimer("8", 12000, npc, null);
  383. break;
  384. default:
  385. cancelQuestTimer("social1", npc, null);
  386. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56594, -56064, -2008, 32768));
  387. break;
  388. }
  389. }
  390. else if (event.equalsIgnoreCase("10"))
  391. {
  392. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56483, -56665, -2034, 32768));
  393. npc.broadcastPacket(new PlaySound(1, "TP05_F", 0, 0, 0, 0, 0));
  394. startQuestTimer("npc1_1", 3000, addSpawn(CIRCUS[0], -56495, -56375, -2008, 32768, false, 101000), null);
  395. startQuestTimer("npc2_1", 3000, addSpawn(CIRCUS[0], -56491, -56289, -2008, 32768, false, 101000), null);
  396. startQuestTimer("npc3_1", 3000, addSpawn(CIRCUS[1], -56502, -56246, -2008, 32768, false, 101000), null);
  397. startQuestTimer("npc4_1", 3000, addSpawn(CIRCUS[1], -56496, -56429, -2008, 32768, false, 101000), null);
  398. startQuestTimer("npc5_1", 3500, addSpawn(CIRCUS[2], -56505, -56334, -2008, 32768, false, 101000), null);
  399. startQuestTimer("npc6_1", 4000, addSpawn(CIRCUS[3], -56545, -56427, -2008, 32768, false, 101000), null);
  400. startQuestTimer("npc7_1", 4000, addSpawn(CIRCUS[3], -56552, -56248, -2008, 32768, false, 101000), null);
  401. startQuestTimer("npc8_1", 3000, addSpawn(CIRCUS[4], -56493, -56473, -2008, 32768, false, 101000), null);
  402. startQuestTimer("npc9_1", 3000, addSpawn(CIRCUS[4], -56504, -56201, -2008, 32768, false, 101000), null);
  403. startQuestTimer("11", 100000, npc, null);
  404. }
  405. else if (event.equalsIgnoreCase("11"))
  406. {
  407. switch (npc.getId())
  408. {
  409. case 32433:
  410. autoChat(npc, MESSAGES[11], Say2.NPC_SHOUT);
  411. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56698, -56430, -2008, 32768));
  412. startQuestTimer("12", 5000, npc, null);
  413. break;
  414. default:
  415. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56343, -56330, -2008, 32768));
  416. break;
  417. }
  418. }
  419. else if (event.equalsIgnoreCase("14"))
  420. {
  421. startQuestTimer("social1", 2000, addSpawn(INDIVIDUALS[0], -56700, -56385, -2008, 32768, false, 49000), null);
  422. startQuestTimer("15", 7000, npc, null);
  423. }
  424. else if (event.equalsIgnoreCase("17"))
  425. {
  426. autoChat(npc, MESSAGES[16], Say2.NPC_SHOUT);
  427. startQuestTimer("social1", 2000, addSpawn(INDIVIDUALS[1], -56700, -56340, -2008, 32768, false, 32000), null);
  428. startQuestTimer("18", 9000, npc, null);
  429. }
  430. else if (event.equalsIgnoreCase("20"))
  431. {
  432. startQuestTimer("social1", 2000, addSpawn(INDIVIDUALS[2], -56703, -56296, -2008, 32768, false, 13000), null);
  433. startQuestTimer("21", 8000, npc, null);
  434. }
  435. else if (event.equalsIgnoreCase("23"))
  436. {
  437. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56702, -56340, -2008, 32768));
  438. startQuestTimer("24", 2800, npc, null);
  439. addSpawn(SHOWSTUFF[0], -56672, -56406, -2000, 32768, false, 20900);
  440. addSpawn(SHOWSTUFF[1], -56648, -56368, -2000, 32768, false, 20900);
  441. addSpawn(SHOWSTUFF[2], -56608, -56338, -2000, 32768, false, 20900);
  442. addSpawn(SHOWSTUFF[3], -56652, -56307, -2000, 32768, false, 20900);
  443. addSpawn(SHOWSTUFF[4], -56672, -56272, -2000, 32768, false, 20900);
  444. }
  445. else if (event.equalsIgnoreCase("28"))
  446. {
  447. autoChat(npc, MESSAGES[23], Say2.NPC_ALL);
  448. startQuestTimer("social1", 1, npc, null);
  449. }
  450. else if (event.equalsIgnoreCase("29"))
  451. {
  452. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56730, -56340, -2008, 32768));
  453. startQuestTimer("clean_npc", 4100, npc, null);
  454. startQuestTimer("timer_check", 60000, null, null, true);
  455. }
  456. else if (event.equalsIgnoreCase("social1"))
  457. {
  458. npc.broadcastSocialAction(1);
  459. }
  460. else if (event.equalsIgnoreCase("clean_npc"))
  461. {
  462. IS_STARTED = false;
  463. npc.deleteMe();
  464. }
  465. else
  466. {
  467. if (TALKS.containsKey(event))
  468. {
  469. final ShoutInfo si = TALKS.get(event);
  470. if (si != null)
  471. {
  472. autoChat(npc, si.getNpcStringId(), Say2.NPC_SHOUT);
  473. startQuestTimer(si.getNextEvent(), si.getTime(), npc, null);
  474. }
  475. }
  476. else if (WALKS.containsKey(event))
  477. {
  478. final WalkInfo wi = WALKS.get(event);
  479. if (wi != null)
  480. {
  481. npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, wi.getCharPos());
  482. startQuestTimer(wi.getNextEvent(), wi.getTime(), npc, null);
  483. }
  484. }
  485. }
  486. }
  487. return null;
  488. }
  489. public static void main(String[] args)
  490. {
  491. new MC_Show();
  492. }
  493. }