Advertisement
tedlol

Untitled

Sep 19th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.93 KB | None | 0 0
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
  3. * Foundation, either version 3 of the License, or (at your option) any later version.
  4. *
  5. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  6. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  7. *
  8. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
  9. */
  10.  
  11. package custom.GrandWedding;
  12.  
  13. import com.l2jserver.gameserver.instancemanager.CoupleManager;
  14. import com.l2jserver.gameserver.ai.CtrlIntention;
  15. import com.l2jserver.gameserver.datatables.SkillTable;
  16. import com.l2jserver.gameserver.network.serverpackets.SocialAction;
  17. import com.l2jserver.util.Rnd;
  18. import java.util.Collection;
  19. import javolution.util.FastList;
  20. import com.l2jserver.gameserver.Announcements;
  21. import com.l2jserver.gameserver.model.quest.Quest;
  22. import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.entity.Couple;
  26. import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
  27. import com.l2jserver.gameserver.model.L2CharPosition;
  28. import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
  29. import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
  30.  
  31. public class GrandWedding extends Quest
  32. {
  33. private static int GIFT = 889; // Reward ID: tateossian ring
  34. private static int NEEDED_ADENA = 100000000; // need 100.000.000 Adena
  35. private static int REQUIRED = 5283; // ID of required item (rice cake)
  36. private static int QTY_REQUIRED = 20; // Qty of required items
  37. private static int NEEDED_ADENA_ID = 57;
  38.  
  39. private static int[] Gourd = { 102504, 102513 };
  40. private static int[] entertainmentId = { 102501, 102511, 102512 };
  41. private static int pixyId = 102500;
  42. private static int[] specialGuests = { 102517, 102518, 102519, 102520, 102521, 102522 };
  43. private static int[] NPCS = { 102502, 102509, 102510 };
  44.  
  45. private static int Point1X = -51480;
  46. private static int Point1Y = -54091;
  47. private static int Point1Z = -2808;
  48. private static int head1 = 15308;
  49. private static int Point2X = -51480;
  50. private static int Point2Y = -54242;
  51. private static int head2 = 48643;
  52.  
  53. private static int[] numberGuards = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
  54.  
  55. private static int WeddingLocked = 0;
  56. private static int WeddingStep = 0;
  57. private static L2Npc giftBox;
  58. private static L2PcInstance husband;
  59. private static L2PcInstance wife;
  60. private static boolean husbandOk = false;
  61. private static boolean wifeOk = false;
  62. private static int HusbandCoupleId = 0;
  63. private static int WifeCoupleId = 0;
  64. private static L2Npc Anakim;
  65. private static FastList<L2Npc> WeddingManagers = new FastList<L2Npc>();
  66. private static Collection<L2PcInstance> players = null;
  67. private static FastList<L2Npc> guards = new FastList<L2Npc>();
  68. private static FastList<L2PcInstance> WeddingList = new FastList<L2PcInstance>();
  69. private static FastList<L2Npc> guests = new FastList<L2Npc>();
  70. private static FastList<L2Npc> pixies = new FastList<L2Npc>();
  71. private static FastList<L2Npc> entertainment = new FastList<L2Npc>();
  72. private static FastList<L2Npc> entertainment2 = new FastList<L2Npc>();
  73. private static FastList<L2Npc> gourds = new FastList<L2Npc>();
  74. private static L2Npc pet1;
  75. private static L2Npc pet2;
  76.  
  77. private static String htmltext_01 = "<html><body>Good luck!<br><br>And congratulations again from the married couple!!!</body></html>";
  78. private static String htmltext_02 = "<html><body>Only the married couple can get the reward!!!</body></html>";
  79. private static String htmltext_03 = "<html><body>You need to be engaged to get married!</body></html>";
  80. private static String htmltext_04 = "<html><body>You need to be wearing formal wear to get married!</body></html>";
  81. private static String htmltext_05 = "<html><body>You need to be level 60 or more to use this service.</body></html>";
  82. private static String htmltext_06 = "<html><body>You are late, please be quiet during the ceremony.</body></html>";
  83. private static String htmltext_07 = "<html><body>It is not your turn to speak.</body></html>";
  84. private static String htmltext_08 = "<html><body>What do you think you are doing interfering in the wedding?</body></html>";
  85. private static String htmltext_09 = "<html><body>You do not have enough items.</body></html>";
  86. private static String htmltext_10 = "<html><body>Another Wedding request is already in progress, you need to wait until either that wedding is completed or until the 2 minutes allowed for the answer is over.</body></html>";
  87. private static String htmltext_11 = "<html><body>You are already married! What are you doing talking to me?</body></html>";
  88. private static String htmltext_12 = "<html><body>You are now on the Wedding guest list, you will be teleported 1 minute before the beginning of the ceremony.</body></html>";
  89. private static String htmltext_13 = "<html><body>You are the one getting married!!! You cannot be a guest too! ;)</body></html>";
  90. private static String htmltext_14 = "<html><body>You are already on the Wedding guest list.</body></html>";
  91.  
  92.  
  93. private static String text_01 = "Your bride has 2 minutes to give an answer or the ceremony will be cancelled.";
  94. private static String text_02 = "I will now announce your wedding so that guests can register to come see it. Congratulations! The wedding ceremony will start in 5 minutes.";
  95. private static String text_03 = "Your groom has 2 minutes to give an answer or the ceremony will be cancelled.";
  96. private static String text_04 = "The wedding request is cancelled. Another couple may now ask to get married.";
  97. private static String text_05 = "The Grand Wedding to celebrate ";
  98. private static String text_06 = " and ";
  99. private static String text_07 = "'s union will start in 5 minutes. All those who want to come to see this great ceremony, please register with a Grand Wedding Manager in Giran, Aden or Goddard.";
  100. private static String text_08 = "Players on the Wedding guest list will now be teleported to the Ceremony's location. Once there the ceremony will start in 1 minute.";
  101. private static String text_09 = "You will now be paralyzed until we are ready for your vows. This is a necessary mesure :)";
  102. private static String text_10 = "Please stay quiet during the preparation of the ceremony";
  103. private static String text_11 = "So... where are you my lovely pets?...";
  104. private static String text_12 = "Oh, here you are!";
  105. private static String text_13 = "Hmmm... I think we are missing some guests...";
  106. private static String text_14 = "Oh, I see them coming! ^^";
  107. private static String text_15 = "Anyone else coming?...";
  108. private static String text_16 = "The entertainment staff were supposed to be here too...";
  109. private static String text_17 = "Ok, now we can start this wedding";
  110. private static String text_18 = "But some more guests were supposed to be here too... oh, I see them now!";
  111. private static String text_19 = "Could ";
  112. private static String text_20 = " please come to me so we can start the ceremony.";
  113. private static String text_21 = "Now lets start this ceremony... ";
  114. private static String text_22 = " do you take ";
  115. private static String text_23 = " as your game wife and promise to protect her from PKers and to help her in game whenever necessary?";
  116. private static String text_24 = "And you, ";
  117. private static String text_25 = ", do you promise to help and protect ";
  118. private static String text_26 = " when necessary, and to be there by his side when he needs you?";
  119. private static String text_27 = "By the powers given to me, I now pronounce you two married.";
  120. private static String text_28 = "And now a wedding present from the Server Team, enjoy!!";
  121.  
  122. public GrandWedding(int questId, String name, String descr)
  123. {
  124. super(questId, name, descr);
  125. WeddingManagers.add(addSpawn(102510, 146364, 27322, -2205, 62980, false, 0));
  126. WeddingManagers.add(addSpawn(102510, 147982, -56568, -2781, 20998, false, 0));
  127. WeddingManagers.add(addSpawn(102510, 83486, 149328, -3405, 47599, false, 0));
  128. for (int i : NPCS)
  129. {
  130. addStartNpc(i);
  131. addTalkId(i);
  132. }
  133. }
  134.  
  135. public static void main(String[] args)
  136. {
  137. // now call the constructor (starts up the)
  138. new GrandWedding(-1, "GrandWedding", "custom");
  139. }
  140.  
  141. @Override
  142. public String onTalk(L2Npc npc, L2PcInstance player)
  143. {
  144. int npcId = npc.getNpcId();
  145. String htmltext = "<html><body>:(((</body></html>";
  146.  
  147. if (player.getQuestState("GrandWedding") == null)
  148. return "";
  149.  
  150. if (npcId == 102502)
  151. {
  152. if (player == husband || player == wife)
  153. {
  154. htmltext = htmltext_01;
  155. husband.getQuestState("GrandWedding").giveItems(GIFT, 1);
  156. wife.getQuestState("GrandWedding").giveItems(GIFT, 1);
  157. // L2Npc lilith = addSpawn(25283, -51772, -54523, -2825, 0,
  158. // false, 0);
  159. husband = null;
  160. wife = null;
  161. giftBox.deleteMe();
  162. }
  163. else
  164. htmltext = htmltext_02;
  165. }
  166. else if (npcId == 102510)
  167. {
  168. int level = player.getLevel();
  169. switch (WeddingLocked) {
  170. case 0:
  171. if (level >= 60)
  172. {
  173. if (player.getCoupleId() == 0)
  174. htmltext = htmltext_03;
  175. else
  176. {
  177. L2ItemInstance item = player.getChestArmorInstance();
  178.  
  179. if (item != null && item.getItemId() == 6408)
  180. htmltext = "EngageRequest.htm";
  181. else
  182. htmltext = htmltext_04;
  183. }
  184. }
  185. else
  186. htmltext = htmltext_05;
  187. break;
  188. case 1:
  189. htmltext = "WeddingList.htm";
  190. break;
  191. case 2:
  192. player.teleToLocation(-51848, -54165, -2826);
  193. htmltext = htmltext_06;
  194. break;
  195. }
  196. }
  197. else if (npcId == 102509)
  198. {
  199. if (player == husband || player.getName().equals(husband.getName()))
  200. {
  201. if (WeddingStep == 1)
  202. htmltext = "1.htm";
  203. else
  204. htmltext = htmltext_07;
  205. }
  206. else if (player == wife || player.getName().equals(wife.getName()))
  207. {
  208. if (WeddingStep == 2)
  209. htmltext = "2.htm";
  210. else
  211. htmltext = htmltext_07;
  212. }
  213. else
  214. htmltext = htmltext_08;
  215. }
  216.  
  217. return htmltext;
  218. }
  219.  
  220. @Override
  221. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  222. {
  223. int xx;
  224. int yy;
  225. int zz;
  226. int x1;
  227. int y1;
  228. int x2;
  229. int y2;
  230.  
  231. if (event.equals("EngageRequest"))
  232. {
  233. boolean sex = player.getAppearance().getSex();
  234. boolean married = player.isMarried();
  235. if (!married)
  236. {
  237. if (sex == false)
  238. {
  239. if (husbandOk == false)
  240. {
  241. if (HusbandCoupleId == 0 && WifeCoupleId == 0)
  242. {
  243. if (player.getQuestState("GrandWedding").getQuestItemsCount(REQUIRED) >= QTY_REQUIRED
  244. && player.getQuestState("GrandWedding").getQuestItemsCount(NEEDED_ADENA_ID) >= NEEDED_ADENA)
  245. {
  246. WeddingList.clear();
  247. player.getQuestState("GrandWedding").takeItems(REQUIRED, QTY_REQUIRED);
  248. player.getQuestState("GrandWedding").takeItems(NEEDED_ADENA_ID, NEEDED_ADENA);
  249. husband = player;
  250. husbandOk = true;
  251. HusbandCoupleId = player.getCoupleId();
  252. startQuestTimer("WeddingAnswer", 120000, null, null);
  253. for (L2Npc i : WeddingManagers)
  254. {
  255. players = i.getKnownList().getKnownPlayers().values();
  256. if (players.contains(husband))
  257. i.broadcastPacket(new CreatureSay(i.getNpcId(), 0, "Wedding Manager", text_01));
  258. }
  259. }
  260. else
  261. return htmltext_09;
  262. }
  263. if (WifeCoupleId == player.getCoupleId())
  264. {
  265. husband = player;
  266. husbandOk = true;
  267. HusbandCoupleId = player.getCoupleId();
  268. WeddingLocked = 1;
  269. cancelQuestTimer("WeddingAnswer", null, null);
  270. startQuestTimer("WeddingAnnounce", 10000, null, null);
  271. for (L2Npc i : WeddingManagers)
  272. {
  273. players = i.getKnownList().getKnownPlayers().values();
  274. if (players.contains(husband))
  275. i.broadcastPacket(new CreatureSay(i.getNpcId(), 0,
  276. "Wedding Manager", text_02));
  277. }
  278. }
  279. if (husband != player)
  280. return htmltext_10;
  281. }
  282. else
  283. return htmltext_10;
  284. }
  285. else if (sex == true)
  286. {
  287. if (wifeOk == false)
  288. {
  289. if (HusbandCoupleId == 0 && WifeCoupleId == 0)
  290. {
  291. if (player.getQuestState("GrandWedding").getQuestItemsCount(REQUIRED) >= QTY_REQUIRED
  292. && player.getQuestState("GrandWedding").getQuestItemsCount(NEEDED_ADENA_ID) >= NEEDED_ADENA)
  293. {
  294. WeddingList.clear();
  295. player.getQuestState("GrandWedding").takeItems(REQUIRED, QTY_REQUIRED);
  296. player.getQuestState("GrandWedding").takeItems(NEEDED_ADENA_ID, NEEDED_ADENA);
  297. wife = player;
  298. wifeOk = true;
  299. WifeCoupleId = player.getCoupleId();
  300. cancelQuestTimer("WeddingAnswer", null, null);
  301. startQuestTimer("WeddingAnswer", 120000, null, null);
  302. for (L2Npc i : WeddingManagers)
  303. {
  304. players = i.getKnownList().getKnownPlayers().values();
  305. if (players.contains(wife))
  306. i.broadcastPacket(new CreatureSay(i.getNpcId(), 0, "Wedding Manager", text_03));
  307. }
  308. }
  309. else
  310. return htmltext_09;
  311. }
  312. if (HusbandCoupleId == player.getCoupleId())
  313. {
  314. wife = player;
  315. wifeOk = true;
  316. WifeCoupleId = player.getCoupleId();
  317. WeddingLocked = 1;
  318. cancelQuestTimer("WeddingAnswer", null, null);
  319. startQuestTimer("WeddingAnnounce", 10000, null, null);
  320. for (L2Npc i : WeddingManagers)
  321. {
  322. players = i.getKnownList().getKnownPlayers().values();
  323. if (players.contains(wife))
  324. i.broadcastPacket(new CreatureSay(i.getNpcId(), 0, "Wedding Manager", text_02));
  325. }
  326. }
  327. if (wife != player)
  328. return htmltext_10;
  329.  
  330. }
  331. else
  332. return htmltext_10;
  333. }
  334. }
  335. else
  336. return htmltext_11;
  337. }
  338. if (event.equals("WeddingAnswer"))
  339. {
  340. husbandOk = false;
  341. wifeOk = false;
  342. husband = null;
  343. wife = null;
  344. HusbandCoupleId = 0;
  345. WifeCoupleId = 0;
  346. WeddingLocked = 0;
  347. WeddingStep = 0;
  348. for (L2Npc i : WeddingManagers)
  349. i.broadcastPacket(new CreatureSay(i.getNpcId(), 0, "Wedding Manager", text_04));
  350. }
  351. if (event.equals("WeddingAnnounce"))
  352. {
  353. String Announcestart = text_05
  354. + husband.getName()
  355. + text_06
  356. + wife.getName()
  357. + text_07;
  358. Announcements.getInstance().announceToAll(Announcestart);
  359. startQuestTimer("WeddingTeleportAnnounce", 50000, null, null);
  360. startQuestTimer("WeddingTeleport", 60000, null, null);
  361. }
  362. if (event.equals("WeddingList"))
  363. {
  364. if (!WeddingList.contains(player))
  365. {
  366. if (player != wife && player != husband)
  367. {
  368. WeddingList.add(player);
  369. return htmltext_12;
  370. }
  371. else
  372. return htmltext_13;
  373. }
  374. else
  375. return htmltext_14;
  376. }
  377. if (event.equals("WeddingTeleportAnnounce"))
  378. {
  379. Announcements
  380. .getInstance()
  381. .announceToAll(text_08);
  382. }
  383. if (event.equals("WeddingTeleport"))
  384. {
  385. xx = 0;
  386. yy = 0;
  387.  
  388. WeddingLocked = 2;
  389. husband.teleToLocation(-51659, -54137, -2820);
  390. husband.sendMessage(text_09);
  391. husband.setIsParalyzed(true);
  392. wife.teleToLocation(-51659, -54194, -2819);
  393. wife.sendMessage(text_09);
  394. wife.setIsParalyzed(true);
  395. if (WeddingList.size() > 0)
  396. {
  397. for (L2PcInstance i : WeddingList)
  398. {
  399. xx = -51848 + (Rnd.get(100) - 50);
  400. yy = -54165 + (Rnd.get(100) - 50);
  401. i.teleToLocation(xx, yy, -2826);
  402. }
  403. }
  404. startQuestTimer("WeddingGuardsSpawn", 60000, null, null);
  405. }
  406. if (event.equals("WeddingGuardsSpawn"))
  407. {
  408. L2Npc guard = null;
  409. int val = 1;
  410. guards.clear();
  411. y1 = Point1Y;
  412. y2 = Point2Y;
  413. x1 = Point1X;
  414. x2 = Point2X;
  415. for (int i = 0; i < numberGuards.length; i++)
  416. {
  417. x1 = x1 + val;
  418. x2 = x2 + val;
  419. guard = addSpawn(102503, x1, y1, Point1Z, head1, false, 0);
  420. guards.add(guard);
  421. guard = addSpawn(102503, x2, y2, Point1Z, head2, false, 0);
  422. guards.add(guard);
  423. val = 80;
  424. }
  425. startQuestTimer("guardsPart2", 6000, null, null);
  426. }
  427. if (event.equals("guardsPart2"))
  428. {
  429. zz = guards.get(0).getZ();
  430. for (int i = 0; i < guards.size(); i += 2)
  431. {
  432. int xx1 = guards.get(i).getX();
  433. int yy1 = guards.get(i).getY() - 30;
  434. int xx2 = guards.get(i + 1).getX();
  435. int yy2 = guards.get(i + 1).getY() + 30;
  436. guards.get(i).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx1, yy1, zz, 0));
  437. guards.get(i + 1).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx2, yy2, zz, 0));
  438. }
  439. startQuestTimer("guardsPart3", 2500, null, null);
  440. }
  441. if (event.equals("guardsPart3"))
  442. {
  443. for (L2Npc i : guards)
  444. i.broadcastPacket(new SocialAction(i.getObjectId(), 2));
  445.  
  446. startQuestTimer("AnakimSpawn", 2000, null, null);
  447. }
  448. if (event.equals("AnakimSpawn"))
  449. {
  450. Anakim = addSpawn(102509, -52241, -54176, -2827, 0, false, 0);
  451. startQuestTimer("AnakimSpeak", 100, null, null);
  452. }
  453. if (event.equals("AnakimSpeak"))
  454. {
  455. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_10));
  456. Anakim.broadcastPacket(new SpecialCamera(Anakim.getObjectId(), 200, 0, 150, 0, 5000));
  457. startQuestTimer("AnakimAnim", 1000, null, null);
  458. startQuestTimer("AnakimPets", 8000, null, null);
  459. }
  460. if (event.equals("AnakimAnim"))
  461. {
  462. Anakim.broadcastPacket(new SocialAction(Anakim.getObjectId(), 2));
  463. }
  464. if (event.equals("AnakimPets"))
  465. {
  466. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_11));
  467. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_12));
  468. pet1 = addSpawn(102514, -52241, -54146, -2827, 0, false, 0);
  469. pet2 = addSpawn(102514, -52241, -54206, -2827, 0, false, 0);
  470. startQuestTimer("AnakimWalk", 3000, null, null);
  471. }
  472. if (event.equals("AnakimWalk"))
  473. {
  474. Anakim.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-49877, -54168, -2688, 0));
  475. startQuestTimer("petsWalk", 1500, null, null);
  476. }
  477. if (event.equals("petsWalk"))
  478. {
  479. pet1.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-49896, -54116, -2688, 0));
  480. pet2.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-49896, -54220, -2688, 0));
  481. startQuestTimer("AnakimHeading", 27000, null, null);
  482. Anakim.broadcastPacket(new SpecialCamera(Anakim.getObjectId(), 400, 180, 150, 0, 31500));
  483. }
  484. if (event.equals("AnakimHeading"))
  485. {
  486. startQuestTimer("witnessSpawn", 500, null, null);
  487. startQuestTimer("AnakimSpeak2", 3000, null, null);
  488. }
  489. if (event.equals("witnessSpawn"))
  490. {
  491. L2Npc witness = addSpawn(102508, -50034, -54068, -2688, head2, false, 0);
  492. guards.add(witness);
  493. witness = addSpawn(102507, -50034, -54268, -2688, head1, false, 0);
  494. guards.add(witness);
  495. }
  496. if (event.equals("AnakimSpeak2"))
  497. {
  498. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_13));
  499. startQuestTimer("AnakimSpeak3", 2000, null, null);
  500. }
  501. if (event.equals("AnakimSpeak3"))
  502. {
  503. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_14));
  504. startQuestTimer("PixiesSpawn", 1000, null, null);
  505. startQuestTimer("PixiesCamera", 10500, null, null);
  506. }
  507. if (event.equals("PixiesSpawn"))
  508. {
  509. for (int i = 0; i < 45; i++)
  510. {
  511. xx = -51910 + (Rnd.get(120) - 60);
  512. yy = -54985 + (Rnd.get(120) - 60);
  513. L2Npc pixy = addSpawn(pixyId, xx, yy, -2824, 0, false, 0);
  514. pixy.setRunning();
  515. pixies.add(pixy);
  516. }
  517. startQuestTimer("pixiesMove1", 9000, null, null);
  518. }
  519. if (event.equals("PixiesCamera"))
  520. {
  521. pixies.get(0).broadcastPacket(new SpecialCamera(pixies.get(0).getObjectId(), 400, 180, 150, 0, 14000));
  522. }
  523. if (event.equals("pixiesMove1"))
  524. {
  525. for (L2Npc i : pixies)
  526. {
  527. xx = -51433 + (Rnd.get(250) - 125);
  528. yy = -54725 + (Rnd.get(250) - 125);
  529. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2827, 0));
  530. }
  531. startQuestTimer("pixiesMove2", 3000, null, null);
  532. }
  533. if (event.equals("pixiesMove2"))
  534. {
  535. for (L2Npc i : pixies)
  536. {
  537. xx = -51848 + (Rnd.get(60) - 30);
  538. yy = -54165 + (Rnd.get(60) - 30);
  539. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2826, 0));
  540. }
  541. startQuestTimer("pixiesMove3", 2500, null, null);
  542. }
  543. if (event.equals("pixiesMove3"))
  544. {
  545. for (L2Npc i : pixies)
  546. {
  547. xx = -51228 + (Rnd.get(1200) - 600);
  548. yy = -54178 + (Rnd.get(1200) - 600);
  549. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2809, 0));
  550. }
  551. startQuestTimer("AnakimSpeak4", 5000, null, null);
  552. }
  553. if (event.equals("AnakimSpeak4"))
  554. {
  555. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_15));
  556. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_16));
  557. startQuestTimer("fix", 100, null, null);
  558. startQuestTimer("entertainmentSpawn", 1000, null, null);
  559. }
  560. if (event.equals("fix"))
  561. {
  562. Anakim.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-49932, -54168, -2688, 0));
  563. pet2.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-49976, -54241, -2688, 0));
  564. startQuestTimer("petsHeading", 100, null, null);
  565. }
  566. if (event.equals("petsHeading"))
  567. {
  568. pet1.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-49976, -54104, -2688, 0));
  569. }
  570. if (event.equals("entertainmentSpawn"))
  571. {
  572. for (int i = 0; i < 24; i++)
  573. {
  574. int rr = Rnd.get(3);
  575. xx = -53714 + (Rnd.get(150) - 75);
  576. yy = -54142 + (Rnd.get(150) - 75);
  577. L2Npc show = addSpawn(entertainmentId[rr], xx, yy, -2674, 0, false, 0);
  578. show.setRunning();
  579. entertainment.add(show);
  580. }
  581. startQuestTimer("entertainmentMove", 4000, null, null);
  582. }
  583. if (event.equals("showCamera"))
  584. {
  585. entertainment.get(0).broadcastPacket(new SpecialCamera(entertainment.get(0).getObjectId(), 400, 180, 150, 0, 20000));
  586. }
  587. if (event.equals("entertainmentMove"))
  588. {
  589. for (L2Npc i : entertainment)
  590. {
  591. xx = -52083 + (Rnd.get(100) - 50);
  592. yy = -54117 + (Rnd.get(100) - 50);
  593. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2826, 0));
  594. }
  595. startQuestTimer("entertainmentMove2", 10500, null, null);
  596. }
  597. if (event.equals("entertainmentMove2"))
  598. {
  599. for (L2Npc i : entertainment)
  600. {
  601. xx = -51770 + (Rnd.get(220) - 110);
  602. yy = -54863 + (Rnd.get(220) - 110);
  603. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2825, 0));
  604. }
  605. for (L2Npc show : entertainment)
  606. show.setWalking();
  607.  
  608. startQuestTimer("showCamera", 100, null, null);
  609. startQuestTimer("entertainmentMove3", 10500, null, null);
  610. }
  611. if (event.equals("entertainmentMove3"))
  612. {
  613. for (L2Npc i : entertainment)
  614. {
  615. xx = -51150 + (Rnd.get(200) - 100);
  616. yy = -54511 + (Rnd.get(200) - 100);
  617. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2825, 0));
  618. }
  619. startQuestTimer("AnakimSpeak5", 10000, null, null);
  620. }
  621. if (event.equals("AnakimSpeak5"))
  622. {
  623. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_17));
  624. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", text_18));
  625. startQuestTimer("SpecialGuestsSpawn", 4000, null, null);
  626. }
  627. if (event.equals("SpecialGuestsSpawn"))
  628. {
  629. for (int i = 0; i < specialGuests.length; i++)
  630. {
  631. x1 = -51311 + (Rnd.get(500) - 250);
  632. y1 = -53695 + (Rnd.get(500) - 250);
  633. L2Npc guard = addSpawn(specialGuests[i], x1, y1, Point1Z, 58609, false, 0);
  634. guests.add(guard);
  635. }
  636. startQuestTimer("GuestCamera", 100, null, null);
  637. startQuestTimer("AnakimSpeak6", 8500, null, null);
  638. startQuestTimer("CoupleMarch", 10000, null, null);
  639. }
  640. if (event.equals("GuestCamera"))
  641. {
  642. guests.get(0).broadcastPacket(new SpecialCamera(guests.get(0).getObjectId(), 1000, 180, 150, 0, 6000));
  643. }
  644. if (event.equals("AnakimSpeak6"))
  645. {
  646. String AnakimTalk = text_19 + wife.getName() + text_06 + husband.getName() + text_20;
  647. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", AnakimTalk));
  648. startQuestTimer("AnakimSpeak7", 24000, null, null);
  649. }
  650. if (event.equals("CoupleMarch"))
  651. {
  652. for (L2PcInstance i : WeddingList)
  653. i.sendPacket(new PlaySound(1, "ns23_f", 0, 0, i.getX(), i.getY(), i.getZ()));
  654.  
  655. wife.sendPacket(new PlaySound(1, "ns23_f", 0, 0, wife.getX(), wife.getY(), wife.getZ()));
  656. husband.sendPacket(new PlaySound(1, "ns23_f", 0, 0, husband.getX(), husband.getY(), husband.getZ()));
  657. husband.setIsParalyzed(false);
  658. wife.setIsParalyzed(false);
  659. husband.setWalking();
  660. wife.setWalking();
  661. husband.broadcastPacket(new SpecialCamera(husband.getObjectId(), 700, 180, 140, 0, 20000));
  662. wife.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-50042, -54178, -2688, 0));
  663. husband.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(-50042, -54147, -2688, 0));
  664. }
  665. if (event.equals("AnakimSpeak7"))
  666. {
  667. String AnakimTalk = text_21 + husband.getName() + text_22 + wife.getName() + text_23;
  668. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", AnakimTalk));
  669. WeddingStep = 1;
  670. }
  671. if (event.equals("AnakimSpeak8"))
  672. {
  673. String AnakimTalk = text_24 + wife.getName() + text_25 + husband.getName() + text_26;
  674. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", AnakimTalk));
  675. WeddingStep = 2;
  676. }
  677. if (event.equals("AnakimSpeak9"))
  678. {
  679. String AnakimTalk = text_27;
  680. Anakim.broadcastPacket(new CreatureSay(Anakim.getNpcId(), 0, "Anakim", AnakimTalk));
  681. WeddingStep = 0;
  682. husband.setPartnerId(wife.getObjectId());
  683. husband.setMarryAccepted(true);
  684. husband.setMarried(true);
  685. wife.setPartnerId(husband.getObjectId());
  686. wife.setMarryAccepted(true);
  687. wife.setMarried(true);
  688. husband.setRunning();
  689. wife.setRunning();
  690. Couple couple = CoupleManager.getInstance().getCouple(HusbandCoupleId);
  691. couple.marry();
  692. Anakim.doCast(SkillTable.getInstance().getInfo(2025, 1));
  693. for (L2Npc i : guards)
  694. {
  695. int rr = Rnd.get(1);
  696. if (rr == 0)
  697. i.doCast(SkillTable.getInstance().getInfo(2024, 1));
  698. if (rr == 1)
  699. i.doCast(SkillTable.getInstance().getInfo(2023, 1));
  700. }
  701. startQuestTimer("WeddingFinale", 3000, null, null);
  702. }
  703. if (event.equals("WeddingFinale"))
  704. {
  705. for (L2Npc i : pixies)
  706. {
  707. xx = -51228 + (Rnd.get(1200) - 600);
  708. yy = -54178 + (Rnd.get(1200) - 600);
  709. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2809, 0));
  710. }
  711. for (int i = 0; i < 25; i++)
  712. {
  713. int rr = Rnd.get(2);
  714. xx = -51228 + (Rnd.get(1200) - 600);
  715. yy = -54178 + (Rnd.get(1200) - 600);
  716. L2Npc gourd = addSpawn(Gourd[rr], xx, yy, -2824, 0, false, 0);
  717. gourds.add(gourd);
  718. }
  719. startQuestTimer("WeddingFinale2", 4000, null, null);
  720. }
  721. if (event.equals("WeddingFinale2"))
  722. {
  723. for (final L2Npc i : guests)
  724. i.deleteMe();
  725.  
  726. for (final L2Npc i : guards)
  727. i.deleteMe();
  728.  
  729. for (final L2Npc i : entertainment)
  730. {
  731. xx = -51862 + (Rnd.get(50) - 25);
  732. yy = -54451 + (Rnd.get(50) - 25);
  733. i.setRunning();
  734. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2825, 0));
  735. }
  736. for (int n = 0; n < 25; n++)
  737. gourds.get(n).reduceCurrentHp(999999, gourds.get(n), null);
  738.  
  739. startQuestTimer("WeddingFinale3", 6000, null, null);
  740. }
  741. if (event.equals("WeddingFinale3"))
  742. {
  743. for (int i = 0; i < 12; i++)
  744. {
  745. entertainment2.add(entertainment.get(i));
  746. entertainment.remove(i);
  747. }
  748.  
  749. for (final L2Npc i : entertainment)
  750. {
  751. xx = -51867;
  752. yy = -54209;
  753. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2825, 0));
  754. }
  755. for (final L2Npc i : entertainment2)
  756. {
  757. xx = -51867;
  758. yy = -54120;
  759. i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(xx, yy, -2825, 0));
  760. }
  761. startQuestTimer("WeddingFinale4", 6000, null, null);
  762. }
  763. if (event.equals("WeddingFinale4"))
  764. {
  765. int val = 1;
  766. x1 = Point1X + 30;
  767. x2 = Point2X - 30;
  768. for (int i = 0; i < entertainment.size(); i++)
  769. {
  770. x1 = x1 + val;
  771. x2 = x2 + val;
  772. yy = -54209;
  773. entertainment.get(i).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(x1, yy, Point1Z, 0));
  774. entertainment2.get(i).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(x2, yy, Point1Z, 0));
  775. val = 80;
  776. }
  777. startQuestTimer("WeddingFinale5", 6000, null, null);
  778. }
  779. if (event.equals("WeddingFinale5"))
  780. {
  781. entertainment2.get(0).broadcastPacket(new CreatureSay(entertainment2.get(0).getNpcId(), 0, "Ceremony Staff", text_28));
  782. startQuestTimer("WeddingFinale6", 4000, null, null);
  783. }
  784. if (event.equals("WeddingFinale6"))
  785. {
  786. giftBox = addSpawn(102502, husband.getX() + 20, husband.getY() + 20, husband.getZ(), 0, false, 0);
  787. startQuestTimer("weddingDespawn", 5000, null, null);
  788. }
  789. if (event.equals("weddingDespawn"))
  790. {
  791. husbandOk = false;
  792. wifeOk = false;
  793. HusbandCoupleId = 0;
  794. WifeCoupleId = 0;
  795. WeddingLocked = 0;
  796. WeddingStep = 0;
  797. Anakim.deleteMe();
  798. pet1.deleteMe();
  799. pet2.deleteMe();
  800. for (final L2Npc s : entertainment2)
  801. s.deleteMe();
  802. for (final L2Npc s : entertainment)
  803. s.deleteMe();
  804. for (final L2Npc n : pixies)
  805. n.deleteMe();
  806. for (final L2Npc i : guards)
  807. i.deleteMe();
  808. }
  809. return "";
  810. }
  811. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement