Advertisement
CostyKiller

DCM Instance java

May 5th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.37 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Mobius_CT_2.6_HighFive
  3. Index: dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java
  4. ===================================================================
  5. --- dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java (revision 7173)
  6. +++ dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java (working copy)
  7. @@ -16,57 +16,53 @@
  8. */
  9. package instances.DarkCloudMansion;
  10.  
  11. -import java.util.ArrayList;
  12. import java.util.List;
  13.  
  14. +import org.l2jmobius.commons.util.CommonUtil;
  15. import org.l2jmobius.gameserver.enums.ChatType;
  16. import org.l2jmobius.gameserver.instancemanager.InstanceManager;
  17. import org.l2jmobius.gameserver.model.Location;
  18. import org.l2jmobius.gameserver.model.Party;
  19. +import org.l2jmobius.gameserver.model.PlayerCondOverride;
  20. +import org.l2jmobius.gameserver.model.StatSet;
  21. import org.l2jmobius.gameserver.model.actor.Npc;
  22. import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  23. -import org.l2jmobius.gameserver.model.instancezone.Instance;
  24. +import org.l2jmobius.gameserver.model.holders.SkillHolder;
  25. import org.l2jmobius.gameserver.model.instancezone.InstanceWorld;
  26. -import org.l2jmobius.gameserver.model.skills.Skill;
  27. import org.l2jmobius.gameserver.network.NpcStringId;
  28. import org.l2jmobius.gameserver.network.SystemMessageId;
  29. -import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
  30. -import org.l2jmobius.gameserver.network.serverpackets.NpcSay;
  31. import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
  32.  
  33. import instances.AbstractInstance;
  34.  
  35. /**
  36. - * Dark Cloud Mansion instance zone.
  37. + * Dark Cloud Mansion instance.
  38. + * @author malyelfik
  39. */
  40. public class DarkCloudMansion extends AbstractInstance
  41. {
  42. // NPCs
  43. - private static int YIYEN = 32282;
  44. - private static int SOFaith = 32288; // Symbol of Faith
  45. - private static int SOAdversity = 32289; // Symbol of Adversity
  46. - private static int SOAdventure = 32290; // Symbol of Adventure
  47. - private static int SOTruth = 32291; // Symbol of Truth
  48. - private static int BSM = 32324; // Black Stone Monolith
  49. - private static int SC = 22402; // Shadow Column
  50. + private static final int YIYEN = 32282;
  51. + private static final int FAITH = 32288; // Symbol of Faith
  52. + private static final int ADVERSITY = 32289; // Symbol of Adversity
  53. + private static final int ADVENTURE = 32290; // Symbol of Adventure
  54. + private static final int TRUTH = 32291; // Symbol of Truth
  55. + private static final int MONOLITH = 32324; // Black Stone Monolith
  56. + private static final int COLUMN = 22402; // Shadow Column
  57. // Mobs
  58. - private static int[] CCG =
  59. + private static final int PARME_HEALER = 22400;
  60. + private static final int[] BELETH_SUBORDINATE =
  61. {
  62. - 18369,
  63. - 18370
  64. - }; // Chromatic Crystal Golem
  65. - private static int[] BM =
  66. - {
  67. 22272,
  68. 22273,
  69. 22274
  70. - }; // Beleth's Minions
  71. - private static int[] HG =
  72. + };
  73. + private static final int[] MONOLITH_PRIVATES =
  74. {
  75. - 22264,
  76. - 22264
  77. - }; // [22318,22319] #Hall Guards
  78. - private static int[] BS =
  79. + 18369,
  80. + 18370
  81. + };
  82. + private static final int[] BELETH_SAMPLE =
  83. {
  84. 18371,
  85. 18372,
  86. @@ -75,46 +71,23 @@
  87. 18375,
  88. 18376,
  89. 18377
  90. - }; // Beleth's Samples
  91. - private static int[] TOKILL =
  92. - {
  93. - 18371,
  94. - 18372,
  95. - 18373,
  96. - 18374,
  97. - 18375,
  98. - 18376,
  99. - 18377,
  100. - // 22318,
  101. - // 22319,
  102. - 22272,
  103. - 22273,
  104. - 22274,
  105. - 18369,
  106. - 18370,
  107. - 22402,
  108. - 22264
  109. };
  110. -
  111. + // Skill
  112. + private static final SkillHolder INCARNATION = new SkillHolder(5441, 1);
  113. // Items
  114. - private static int CC = 9690; // Contaminated Crystal
  115. - // Misc
  116. - private static final int TEMPLATE_ID = 9;
  117. - private static int D1 = 24230001; // Starting Room
  118. - private static int D2 = 24230002; // First Room
  119. - private static int D3 = 24230005; // Second Room
  120. - private static int D4 = 24230003; // Third Room
  121. - private static int D5 = 24230004; // Forth Room
  122. - private static int D6 = 24230006; // Fifth Room
  123. - private static int W1 = 24230007; // Wall 1
  124. - // private static int W2 = 24230008; // Wall 2
  125. - // private static int W3 = 24230009; // Wall 3
  126. - // private static int W4 = 24230010; // Wall 4
  127. - // private static int W5 = 24230011; // Wall 5
  128. - // private static int W6 = 24230012; // Wall 6
  129. - // private static int W7 = 24230013; // Wall 7
  130. - private static boolean noRndWalk = true;
  131. - private static NpcStringId[] _spawnChat =
  132. + private static final int CC = 9690; // Contaminated Crystal
  133. + // Doors
  134. + private static final int START_DOOR = 24230001; // Starting Room
  135. + private static final int ROOM_A_DOOR = 24230002; // First Room
  136. + private static final int ROOM_B_DOOR = 24230005; // Second Room
  137. + private static final int ROOM_C_DOOR = 24230003; // Third Room
  138. + private static final int ROOM_D_DOOR = 24230004; // Forth Room
  139. + private static final int ROOM_E_DOOR = 24230006; // Fifth Room
  140. + // Locations
  141. + private static final Location ENTER_LOC = new Location(146534, 180464, -6117);
  142. + private static final Location EXIT_LOC = new Location(139968, 150367, -3111);
  143. + // Messages
  144. + private static final NpcStringId[] SPAWN_CHAT =
  145. {
  146. NpcStringId.I_M_THE_REAL_ONE,
  147. NpcStringId.PICK_ME,
  148. @@ -122,13 +95,13 @@
  149. NpcStringId.NOT_THAT_DUDE_I_M_THE_REAL_ONE,
  150. NpcStringId.DON_T_BE_FOOLED_DON_T_BE_FOOLED_I_M_THE_REAL_ONE
  151. };
  152. - private static NpcStringId[] _decayChat =
  153. + private static final NpcStringId[] DECAY_CHAT =
  154. {
  155. NpcStringId.I_M_THE_REAL_ONE_PHEW,
  156. NpcStringId.CAN_T_YOU_EVEN_FIND_OUT,
  157. NpcStringId.FIND_ME
  158. };
  159. - private static NpcStringId[] _successChat =
  160. + private static final NpcStringId[] SUCCESS_CHAT =
  161. {
  162. NpcStringId.HUH_HOW_DID_YOU_KNOW_IT_WAS_ME,
  163. NpcStringId.EXCELLENT_CHOICE_TEEHEE,
  164. @@ -135,101 +108,35 @@
  165. NpcStringId.YOU_VE_DONE_WELL,
  166. NpcStringId.OH_VERY_SENSIBLE
  167. };
  168. - private static NpcStringId[] _faildChat =
  169. + private static final NpcStringId[] FAIL_CHAT =
  170. {
  171. NpcStringId.YOU_VE_BEEN_FOOLED,
  172. NpcStringId.SORRY_BUT_I_M_THE_FAKE_ONE
  173. };
  174. - // @formatter:off
  175. - // Second room - random monolith order
  176. - private static int[][] MonolithOrder = new int[][]
  177. - {
  178. - {1, 2, 3, 4, 5, 6},
  179. - {6, 5, 4, 3, 2, 1},
  180. - {4 ,5, 6, 3, 2, 1},
  181. - {2, 6, 3, 5, 1, 4},
  182. - {4, 1, 5, 6, 2, 3},
  183. - {3, 5, 1, 6, 2, 4},
  184. - {6, 1, 3, 4, 5, 2},
  185. - {5, 6, 1, 2, 4, 3},
  186. - {5, 2, 6, 3, 4, 1},
  187. - {1, 5, 2, 6, 3, 4},
  188. - {1, 2, 3, 6, 5, 4},
  189. - {6, 4, 3, 1, 5, 2},
  190. - {3, 5, 2, 4, 1, 6},
  191. - {3, 2, 4, 5, 1, 6},
  192. - {5, 4, 3, 1, 6, 2},
  193. - };
  194. - // Second room - golem spawn locatons - random
  195. - private static int[][] GolemSpawn = new int[][]
  196. - {
  197. - {CCG[0], 148060, 181389},
  198. - {CCG[1], 147910, 181173},
  199. - {CCG[0], 147810, 181334},
  200. - {CCG[1], 147713, 181179},
  201. - {CCG[0], 147569, 181410},
  202. - {CCG[1], 147810, 181517},
  203. - {CCG[0], 147805, 181281},
  204. - };
  205.  
  206. - // forth room - random shadow column
  207. - private static int[][] ColumnRows = new int[][]
  208. - {
  209. - {1, 1, 0, 1, 0},
  210. - {0, 1, 1, 0, 1},
  211. - {1, 0, 1, 1, 0},
  212. - {0, 1, 0, 1, 1},
  213. - {1, 0, 1, 0, 1},
  214. - };
  215. + // Misc
  216. + private static final int TEMPLATE_ID = 9;
  217.  
  218. - // Fifth room - beleth order
  219. - private static int[][] Beleths = new int[][]
  220. + public DarkCloudMansion()
  221. {
  222. - {1, 0, 1, 0, 1, 0, 0},
  223. - {0, 0, 1, 0, 1, 1, 0},
  224. - {0, 0, 0, 1, 0, 1, 1},
  225. - {1, 0, 1, 1, 0, 0, 0},
  226. - {1, 1, 0, 0, 0, 1, 0},
  227. - {0, 1, 0, 1, 0, 1, 0},
  228. - {0, 0, 0, 1, 1, 1, 0},
  229. - {1, 0, 1, 0, 0, 1, 0},
  230. - {0, 1, 1, 0, 0, 0, 1},
  231. - };
  232. - // @formatter:on
  233. -
  234. - private DarkCloudMansion()
  235. - {
  236. - addFirstTalkId(BSM, SOTruth);
  237. + super();
  238. addStartNpc(YIYEN);
  239. - addTalkId(YIYEN, SOTruth);
  240. - addAttackId(SC);
  241. - addAttackId(BS);
  242. - addAttackId(CCG);
  243. - addKillId(TOKILL);
  244. + addFirstTalkId(MONOLITH, TRUTH, FAITH, ADVERSITY, ADVENTURE);
  245. + addTalkId(YIYEN, TRUTH);
  246. + addAttackId(COLUMN, PARME_HEALER);
  247. + addAttackId(BELETH_SAMPLE);
  248. + addKillId(COLUMN, PARME_HEALER);
  249. + addKillId(BELETH_SAMPLE);
  250. + addKillId(BELETH_SUBORDINATE);
  251. }
  252.  
  253. - protected static class DMCNpc
  254. - {
  255. - public Npc npc;
  256. - public boolean isDead = false;
  257. - public Npc golem = null;
  258. - public int status = 0;
  259. - public int order = 0;
  260. - public int count = 0;
  261. - }
  262. -
  263. - protected static class DMCRoom
  264. - {
  265. - public List<DMCNpc> npcList = new ArrayList<>();
  266. - public int counter = 0;
  267. - public int reset = 0;
  268. - public int founded = 0;
  269. - public int[] Order;
  270. - }
  271. -
  272. @Override
  273. protected boolean checkConditions(PlayerInstance player)
  274. {
  275. + if (player.canOverrideCond(PlayerCondOverride.INSTANCE_CONDITIONS))
  276. + {
  277. + return true;
  278. + }
  279. final Party party = player.getParty();
  280. if (party == null)
  281. {
  282. @@ -269,9 +176,15 @@
  283. @Override
  284. public void onEnterInstance(PlayerInstance player, InstanceWorld world, boolean firstEntrance)
  285. {
  286. - if (firstEntrance)
  287. + if (player.canOverrideCond(PlayerCondOverride.INSTANCE_CONDITIONS))
  288. {
  289. - runStartRoom(world);
  290. + world.setStatus(0);
  291. + world.addAllowed(player);
  292. + teleportPlayer(player, ENTER_LOC, world.getInstanceId());
  293. + }
  294. + else if (firstEntrance)
  295. + {
  296. + world.setStatus(0);
  297. final Party party = player.getParty();
  298. if (party != null)
  299. {
  300. @@ -282,651 +195,174 @@
  301. newQuestState(partyMember);
  302. }
  303. world.addAllowed(partyMember);
  304. - teleportPlayer(partyMember, new Location(146534, 180464, -6117), world.getInstanceId());
  305. + teleportPlayer(partyMember, ENTER_LOC, world.getInstanceId());
  306. }
  307. }
  308. }
  309. else
  310. {
  311. - teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId());
  312. + teleportPlayer(player, ENTER_LOC, world.getInstanceId());
  313. }
  314. }
  315.  
  316. - protected void runStartRoom(InstanceWorld world)
  317. + @Override
  318. + public String onAdvEvent(String event, Npc npc, PlayerInstance player)
  319. {
  320. - world.setStatus(0);
  321. - final DMCRoom startRoom = new DMCRoom();
  322. - DMCNpc thisNpc;
  323. - thisNpc = new DMCNpc();
  324. - thisNpc.npc = addSpawn(BM[0], 146817, 180335, -6117, 0, false, 0, false, world.getInstanceId());
  325. - startRoom.npcList.add(thisNpc);
  326. - if (noRndWalk)
  327. + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  328. + if (world != null)
  329. {
  330. - thisNpc.npc.setRandomWalking(false);
  331. - }
  332. -
  333. - thisNpc = new DMCNpc();
  334. - thisNpc.npc = addSpawn(BM[0], 146741, 180589, -6117, 0, false, 0, false, world.getInstanceId());
  335. - startRoom.npcList.add(thisNpc);
  336. - if (noRndWalk)
  337. - {
  338. - thisNpc.npc.setRandomWalking(false);
  339. - }
  340. - world.setParameter("StartRoom", startRoom);
  341. - }
  342. -
  343. - protected void spawnHall(InstanceWorld world)
  344. - {
  345. - final DMCRoom hall = new DMCRoom();
  346. - DMCNpc thisNpc;
  347. - world.getParameters().remove("Hall"); // remove room instance to avoid adding mob every time
  348. - thisNpc = new DMCNpc();
  349. - thisNpc.npc = addSpawn(BM[1], 147217, 180112, -6117, 0, false, 0, false, world.getInstanceId());
  350. - if (noRndWalk)
  351. - {
  352. - thisNpc.npc.setRandomWalking(false);
  353. - }
  354. - hall.npcList.add(thisNpc);
  355. -
  356. - thisNpc = new DMCNpc();
  357. - thisNpc.npc = addSpawn(BM[2], 147217, 180209, -6117, 0, false, 0, false, world.getInstanceId());
  358. - if (noRndWalk)
  359. - {
  360. - thisNpc.npc.setRandomWalking(false);
  361. - }
  362. - hall.npcList.add(thisNpc);
  363. -
  364. - thisNpc = new DMCNpc();
  365. - thisNpc.npc = addSpawn(BM[1], 148521, 180112, -6117, 0, false, 0, false, world.getInstanceId());
  366. - if (noRndWalk)
  367. - {
  368. - thisNpc.npc.setRandomWalking(false);
  369. - }
  370. - hall.npcList.add(thisNpc);
  371. -
  372. - thisNpc = new DMCNpc();
  373. - thisNpc.npc = addSpawn(BM[0], 148521, 180209, -6117, 0, false, 0, false, world.getInstanceId());
  374. - if (noRndWalk)
  375. - {
  376. - thisNpc.npc.setRandomWalking(false);
  377. - }
  378. - hall.npcList.add(thisNpc);
  379. -
  380. - thisNpc = new DMCNpc();
  381. - thisNpc.npc = addSpawn(BM[1], 148525, 180910, -6117, 0, false, 0, false, world.getInstanceId());
  382. - if (noRndWalk)
  383. - {
  384. - thisNpc.npc.setRandomWalking(false);
  385. - }
  386. - hall.npcList.add(thisNpc);
  387. -
  388. - thisNpc = new DMCNpc();
  389. - thisNpc.npc = addSpawn(BM[2], 148435, 180910, -6117, 0, false, 0, false, world.getInstanceId());
  390. - if (noRndWalk)
  391. - {
  392. - thisNpc.npc.setRandomWalking(false);
  393. - }
  394. - hall.npcList.add(thisNpc);
  395. -
  396. - thisNpc = new DMCNpc();
  397. - thisNpc.npc = addSpawn(BM[1], 147242, 180910, -6117, 0, false, 0, false, world.getInstanceId());
  398. - if (noRndWalk)
  399. - {
  400. - thisNpc.npc.setRandomWalking(false);
  401. - }
  402. - hall.npcList.add(thisNpc);
  403. -
  404. - thisNpc = new DMCNpc();
  405. - thisNpc.npc = addSpawn(BM[2], 147242, 180819, -6117, 0, false, 0, false, world.getInstanceId());
  406. - if (noRndWalk)
  407. - {
  408. - thisNpc.npc.setRandomWalking(false);
  409. - }
  410. - hall.npcList.add(thisNpc);
  411. -
  412. - world.setParameter("Hall", hall);
  413. - }
  414. -
  415. - protected void runHall(InstanceWorld world)
  416. - {
  417. - spawnHall(world);
  418. - world.setStatus(1);
  419. - world.openDoor(D1);
  420. - }
  421. -
  422. - protected void runFirstRoom(InstanceWorld world)
  423. - {
  424. - final DMCRoom firstRoom = new DMCRoom();
  425. - DMCNpc thisNpc;
  426. - thisNpc = new DMCNpc();
  427. - thisNpc.npc = addSpawn(HG[1], 147842, 179837, -6117, 0, false, 0, false, world.getInstanceId());
  428. - if (noRndWalk)
  429. - {
  430. - thisNpc.npc.setRandomWalking(false);
  431. - }
  432. - firstRoom.npcList.add(thisNpc);
  433. -
  434. - thisNpc = new DMCNpc();
  435. - thisNpc.npc = addSpawn(HG[0], 147711, 179708, -6117, 0, false, 0, false, world.getInstanceId());
  436. - if (noRndWalk)
  437. - {
  438. - thisNpc.npc.setRandomWalking(false);
  439. - }
  440. - firstRoom.npcList.add(thisNpc);
  441. -
  442. - thisNpc = new DMCNpc();
  443. - thisNpc.npc = addSpawn(HG[1], 147842, 179552, -6117, 0, false, 0, false, world.getInstanceId());
  444. - if (noRndWalk)
  445. - {
  446. - thisNpc.npc.setRandomWalking(false);
  447. - }
  448. - firstRoom.npcList.add(thisNpc);
  449. -
  450. - thisNpc = new DMCNpc();
  451. - thisNpc.npc = addSpawn(HG[0], 147964, 179708, -6117, 0, false, 0, false, world.getInstanceId());
  452. - if (noRndWalk)
  453. - {
  454. - thisNpc.npc.setRandomWalking(false);
  455. - }
  456. - firstRoom.npcList.add(thisNpc);
  457. -
  458. - world.setParameter("FirstRoom", firstRoom);
  459. - world.setStatus(2);
  460. - world.openDoor(D2);
  461. - }
  462. -
  463. - protected void runHall2(InstanceWorld world)
  464. - {
  465. - addSpawn(SOFaith, 147818, 179643, -6117, 0, false, 0, false, world.getInstanceId());
  466. - spawnHall(world);
  467. - world.setStatus(3);
  468. - }
  469. -
  470. - protected void runSecondRoom(InstanceWorld world)
  471. - {
  472. - final DMCRoom secondRoom = new DMCRoom();
  473. - DMCNpc thisNpc;
  474. -
  475. - // TODO: find a better way to initialize to [1,0,0,0,0,0,0]
  476. - secondRoom.Order = new int[7];
  477. - secondRoom.Order[0] = 1;
  478. - for (int i = 1; i < 7; i++)
  479. - {
  480. - secondRoom.Order[i] = 0;
  481. - }
  482. -
  483. - final int i = getRandom(MonolithOrder.length);
  484. - thisNpc = new DMCNpc();
  485. - thisNpc.npc = addSpawn(BSM, 147800, 181150, -6117, 0, false, 0, false, world.getInstanceId());
  486. - thisNpc.order = MonolithOrder[i][0];
  487. - secondRoom.npcList.add(thisNpc);
  488. -
  489. - thisNpc = new DMCNpc();
  490. - thisNpc.npc = addSpawn(BSM, 147900, 181215, -6117, 0, false, 0, false, world.getInstanceId());
  491. - thisNpc.order = MonolithOrder[i][1];
  492. - secondRoom.npcList.add(thisNpc);
  493. -
  494. - thisNpc = new DMCNpc();
  495. - thisNpc.npc = addSpawn(BSM, 147900, 181345, -6117, 0, false, 0, false, world.getInstanceId());
  496. - thisNpc.order = MonolithOrder[i][2];
  497. - secondRoom.npcList.add(thisNpc);
  498. -
  499. - thisNpc = new DMCNpc();
  500. - thisNpc.npc = addSpawn(BSM, 147800, 181410, -6117, 0, false, 0, false, world.getInstanceId());
  501. - thisNpc.order = MonolithOrder[i][3];
  502. - secondRoom.npcList.add(thisNpc);
  503. -
  504. - thisNpc = new DMCNpc();
  505. - thisNpc.npc = addSpawn(BSM, 147700, 181345, -6117, 0, false, 0, false, world.getInstanceId());
  506. - thisNpc.order = MonolithOrder[i][4];
  507. - secondRoom.npcList.add(thisNpc);
  508. -
  509. - thisNpc = new DMCNpc();
  510. - thisNpc.npc = addSpawn(BSM, 147700, 181215, -6117, 0, false, 0, false, world.getInstanceId());
  511. - thisNpc.order = MonolithOrder[i][5];
  512. - secondRoom.npcList.add(thisNpc);
  513. -
  514. - world.setParameter("SecondRoom", secondRoom);
  515. - world.setStatus(4);
  516. - world.openDoor(D3);
  517. - }
  518. -
  519. - protected void runHall3(InstanceWorld world)
  520. - {
  521. - addSpawn(SOAdversity, 147808, 181281, -6117, 16383, false, 0, false, world.getInstanceId());
  522. - spawnHall(world);
  523. - world.setStatus(5);
  524. - }
  525. -
  526. - protected void runThirdRoom(InstanceWorld world)
  527. - {
  528. - final DMCRoom thirdRoom = new DMCRoom();
  529. - final DMCNpc thisNpc = new DMCNpc();
  530. - thisNpc.isDead = false;
  531. - thisNpc.npc = addSpawn(BM[1], 148765, 180450, -6117, 0, false, 0, false, world.getInstanceId());
  532. - if (noRndWalk)
  533. - {
  534. - thisNpc.npc.setRandomWalking(false);
  535. - }
  536. - thirdRoom.npcList.add(thisNpc);
  537. - thisNpc.npc = addSpawn(BM[2], 148865, 180190, -6117, 0, false, 0, false, world.getInstanceId());
  538. - if (noRndWalk)
  539. - {
  540. - thisNpc.npc.setRandomWalking(false);
  541. - }
  542. - thirdRoom.npcList.add(thisNpc);
  543. - thisNpc.npc = addSpawn(BM[1], 148995, 180190, -6117, 0, false, 0, false, world.getInstanceId());
  544. - if (noRndWalk)
  545. - {
  546. - thisNpc.npc.setRandomWalking(false);
  547. - }
  548. - thirdRoom.npcList.add(thisNpc);
  549. - thisNpc.npc = addSpawn(BM[0], 149090, 180450, -6117, 0, false, 0, false, world.getInstanceId());
  550. - if (noRndWalk)
  551. - {
  552. - thisNpc.npc.setRandomWalking(false);
  553. - }
  554. - thirdRoom.npcList.add(thisNpc);
  555. - thisNpc.npc = addSpawn(BM[1], 148995, 180705, -6117, 0, false, 0, false, world.getInstanceId());
  556. - if (noRndWalk)
  557. - {
  558. - thisNpc.npc.setRandomWalking(false);
  559. - }
  560. - thirdRoom.npcList.add(thisNpc);
  561. - thisNpc.npc = addSpawn(BM[2], 148865, 180705, -6117, 0, false, 0, false, world.getInstanceId());
  562. - if (noRndWalk)
  563. - {
  564. - thisNpc.npc.setRandomWalking(false);
  565. - }
  566. - thirdRoom.npcList.add(thisNpc);
  567. - world.setParameter("ThirdRoom", thirdRoom);
  568. - world.setStatus(6);
  569. - world.openDoor(D4);
  570. - }
  571. -
  572. - protected void runThirdRoom2(InstanceWorld world)
  573. - {
  574. - addSpawn(SOAdventure, 148910, 178397, -6117, 16383, false, 0, false, world.getInstanceId());
  575. - final DMCRoom thirdRoom = new DMCRoom();
  576. - final DMCNpc thisNpc = new DMCNpc();
  577. - thisNpc.isDead = false;
  578. - thisNpc.npc = addSpawn(BM[1], 148765, 180450, -6117, 0, false, 0, false, world.getInstanceId());
  579. - if (noRndWalk)
  580. - {
  581. - thisNpc.npc.setRandomWalking(false);
  582. - }
  583. - thirdRoom.npcList.add(thisNpc);
  584. - thisNpc.npc = addSpawn(BM[2], 148865, 180190, -6117, 0, false, 0, false, world.getInstanceId());
  585. - if (noRndWalk)
  586. - {
  587. - thisNpc.npc.setRandomWalking(false);
  588. - }
  589. - thirdRoom.npcList.add(thisNpc);
  590. - thisNpc.npc = addSpawn(BM[1], 148995, 180190, -6117, 0, false, 0, false, world.getInstanceId());
  591. - if (noRndWalk)
  592. - {
  593. - thisNpc.npc.setRandomWalking(false);
  594. - }
  595. - thirdRoom.npcList.add(thisNpc);
  596. - thisNpc.npc = addSpawn(BM[0], 149090, 180450, -6117, 0, false, 0, false, world.getInstanceId());
  597. - if (noRndWalk)
  598. - {
  599. - thisNpc.npc.setRandomWalking(false);
  600. - }
  601. - thirdRoom.npcList.add(thisNpc);
  602. - thisNpc.npc = addSpawn(BM[1], 148995, 180705, -6117, 0, false, 0, false, world.getInstanceId());
  603. - if (noRndWalk)
  604. - {
  605. - thisNpc.npc.setRandomWalking(false);
  606. - }
  607. - thirdRoom.npcList.add(thisNpc);
  608. - thisNpc.npc = addSpawn(BM[2], 148865, 180705, -6117, 0, false, 0, false, world.getInstanceId());
  609. - if (noRndWalk)
  610. - {
  611. - thisNpc.npc.setRandomWalking(false);
  612. - }
  613. - thirdRoom.npcList.add(thisNpc);
  614. - world.setParameter("ThirdRoom2", thirdRoom);
  615. - world.setStatus(8);
  616. - }
  617. -
  618. - protected void runForthRoom(InstanceWorld world)
  619. - {
  620. - final DMCRoom forthRoom = new DMCRoom();
  621. - forthRoom.counter = 0;
  622. - DMCNpc thisNpc;
  623. - final int[] temp = new int[7];
  624. - final int[][] templist = new int[7][5];
  625. - int xx = 0;
  626. - for (int i = 0; i < 7; i++)
  627. - {
  628. - temp[i] = getRandom(ColumnRows.length);
  629. - }
  630. -
  631. - for (int i = 0; i < 7; i++)
  632. - {
  633. - templist[i] = ColumnRows[temp[i]];
  634. - }
  635. -
  636. - for (int x = 148660; x < 149285; x += 125)
  637. - {
  638. - int yy = 0;
  639. - for (int y = 179280; y > 178405; y -= 125)
  640. + switch (event)
  641. {
  642. - thisNpc = new DMCNpc();
  643. - thisNpc.npc = addSpawn(SC, x, y, -6115, 16215, false, 0, false, world.getInstanceId());
  644. - thisNpc.status = templist[yy][xx];
  645. - thisNpc.order = yy;
  646. - forthRoom.npcList.add(thisNpc);
  647. - yy++;
  648. + case "DELETE_ONE":
  649. + {
  650. + npc.deleteMe();
  651. + break;
  652. + }
  653. + case "DELETE":
  654. + {
  655. + world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n != npc).forEach(Npc::deleteMe);
  656. + world.setParameter("blocked", false);
  657. + spawnRoomE(world);
  658. + break;
  659. + }
  660. + case "CHAT":
  661. + {
  662. + world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n.isScriptValue(1)).forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(DECAY_CHAT)));
  663. + break;
  664. + }
  665. }
  666. - xx++;
  667. }
  668. - // TODO: unify this into previous loop
  669. - for (DMCNpc npc : forthRoom.npcList)
  670. - {
  671. - if (npc.status == 0)
  672. - {
  673. - npc.npc.setInvul(true);
  674. - }
  675. - }
  676. -
  677. - world.setParameter("ForthRoom", forthRoom);
  678. - world.setStatus(7);
  679. - world.openDoor(D5);
  680. + return null;
  681. }
  682.  
  683. - protected void runFifthRoom(InstanceWorld world)
  684. + @Override
  685. + public String onTalk(Npc npc, PlayerInstance player)
  686. {
  687. - spawnFifthRoom(world);
  688. - world.setStatus(9);
  689. - world.openDoor(D6);
  690. - }
  691. -
  692. - private void spawnFifthRoom(InstanceWorld world)
  693. - {
  694. - final DMCRoom fifthRoom = new DMCRoom();
  695. - DMCNpc thisNpc;
  696. - int idx = 0;
  697. - final int[] temp = Beleths[getRandom(Beleths.length)];
  698. - fifthRoom.reset = 0;
  699. - fifthRoom.founded = 0;
  700. - for (int x = 148720; x < 149175; x += 65)
  701. + if (npc.getId() == YIYEN)
  702. {
  703. - thisNpc = new DMCNpc();
  704. - thisNpc.npc = addSpawn(BS[idx], x, 182145, -6117, 48810, false, 0, false, world.getInstanceId());
  705. - thisNpc.npc.setRandomWalking(false);
  706. - thisNpc.order = idx;
  707. - thisNpc.status = temp[idx];
  708. - thisNpc.count = 0;
  709. - fifthRoom.npcList.add(thisNpc);
  710. - if ((temp[idx] == 1) && (getRandom(100) < 95))
  711. - {
  712. - thisNpc.npc.broadcastPacket(new NpcSay(thisNpc.npc.getObjectId(), ChatType.GENERAL, thisNpc.npc.getId(), _spawnChat[getRandom(_spawnChat.length)]));
  713. - }
  714. - else if ((temp[idx] != 1) && (getRandom(100) < 67))
  715. - {
  716. - thisNpc.npc.broadcastPacket(new NpcSay(thisNpc.npc.getObjectId(), ChatType.GENERAL, thisNpc.npc.getId(), _spawnChat[getRandom(_spawnChat.length)]));
  717. - }
  718. - idx++;
  719. + enterInstance(player, TEMPLATE_ID);
  720. }
  721. -
  722. - world.setParameter("FifthRoom", fifthRoom);
  723. - }
  724. -
  725. - protected boolean checkKillProgress(Npc npc, DMCRoom room)
  726. - {
  727. - boolean cont = true;
  728. - for (DMCNpc npcobj : room.npcList)
  729. + else
  730. {
  731. - if (npcobj.npc == npc)
  732. + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  733. + if (world != null)
  734. {
  735. - npcobj.isDead = true;
  736. + teleportPlayer(player, EXIT_LOC, 0);
  737. }
  738. - if (!npcobj.isDead)
  739. - {
  740. - cont = false;
  741. - }
  742. }
  743. - return cont;
  744. + return null;
  745. }
  746.  
  747. - protected void spawnRndGolem(InstanceWorld world, DMCNpc npc)
  748. + @Override
  749. + public String onFirstTalk(Npc npc, PlayerInstance player)
  750. {
  751. - if (npc.golem != null)
  752. + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  753. + if (world != null)
  754. {
  755. - return;
  756. - }
  757. -
  758. - final int i = getRandom(GolemSpawn.length);
  759. - final int mobId = GolemSpawn[i][0];
  760. - final int x = GolemSpawn[i][1];
  761. - final int y = GolemSpawn[i][2];
  762. - npc.golem = addSpawn(mobId, x, y, -6117, 0, false, 0, false, world.getInstanceId());
  763. - if (noRndWalk)
  764. - {
  765. - npc.golem.setRandomWalking(false);
  766. - }
  767. - }
  768. -
  769. - protected void checkStone(Npc npc, int[] order, DMCNpc npcObj, InstanceWorld world)
  770. - {
  771. - for (int i = 1; i < 7; i++)
  772. - {
  773. - // if there is a non zero value in the precedent step, the sequence is ok
  774. - if ((order[i] == 0) && (order[i - 1] != 0) && (npcObj.order == i) && (npcObj.status == 0))
  775. + switch (npc.getId())
  776. {
  777. - order[i] = 1;
  778. - npcObj.status = 1;
  779. - npcObj.isDead = true;
  780. - npc.broadcastPacket(new MagicSkillUse(npc, npc, 5441, 1, 1, 0));
  781. - return;
  782. - }
  783. - }
  784. -
  785. - spawnRndGolem(world, npcObj);
  786. - }
  787. -
  788. - protected void endInstance(InstanceWorld world)
  789. - {
  790. - world.setStatus(10);
  791. - addSpawn(SOTruth, 148911, 181940, -6117, 16383, false, 0, false, world.getInstanceId());
  792. - world.getParameters().remove("StartRoom");
  793. - world.getParameters().remove("Hall");
  794. - world.getParameters().remove("FirstRoom");
  795. - world.getParameters().remove("SecondRoom");
  796. - world.getParameters().remove("ThirdRoom");
  797. - world.getParameters().remove("ForthRoom");
  798. - world.getParameters().remove("FifthRoom");
  799. - }
  800. -
  801. - protected void checkBelethSample(InstanceWorld world, Npc npc, PlayerInstance player)
  802. - {
  803. - final DMCRoom fifthRoom = world.getParameters().getObject("FifthRoom", DMCRoom.class);
  804. - for (DMCNpc mob : fifthRoom.npcList)
  805. - {
  806. - if (mob.npc == npc)
  807. - {
  808. - if (mob.count == 0)
  809. + case FAITH:
  810. {
  811. - mob.count = 1;
  812. - if (mob.status == 1)
  813. + world.openDoor(ROOM_A_DOOR);
  814. + npc.showChatWindow(player);
  815. + break;
  816. + }
  817. + case MONOLITH:
  818. + {
  819. + if (world.isStatus(4) && !npc.isScriptValue(-1))
  820. {
  821. - mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), ChatType.NPC_GENERAL, mob.npc.getId(), _successChat[getRandom(_successChat.length)]));
  822. - fifthRoom.founded += 1;
  823. - startQuestTimer("decayMe", 1500, npc, player);
  824. + int current = world.getParameters().getInt("current", 0);
  825. + if (npc.isScriptValue(current))
  826. + {
  827. + npc.setScriptValue(-1);
  828. + npc.doCast(INCARNATION.getSkill());
  829. + world.setParameter("current", ++current);
  830. + if (current == 6)
  831. + {
  832. + world.setStatus(5);
  833. + world.spawnGroup("roomBClear");
  834. + world.spawnGroup("hall");
  835. + world.getNpcs(MONOLITH).forEach(Npc::deleteMe);
  836. + }
  837. + }
  838. + else
  839. + {
  840. + addSpawn(getRandomEntry(MONOLITH_PRIVATES), npc, false, 0, false, world.getInstanceId());
  841. + }
  842. + world.closeDoor(ROOM_B_DOOR);
  843. }
  844. - else
  845. - {
  846. - fifthRoom.reset = 1;
  847. - mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), ChatType.NPC_GENERAL, mob.npc.getId(), _faildChat[getRandom(_faildChat.length)]));
  848. - startQuestTimer("decayChatBelethSamples", 4000, npc, player);
  849. - startQuestTimer("decayBelethSamples", 4500, npc, player);
  850. - }
  851. + break;
  852. }
  853. - else
  854. + case ADVERSITY:
  855. {
  856. - return;
  857. + world.openDoor(ROOM_B_DOOR);
  858. + npc.showChatWindow(player);
  859. + break;
  860. }
  861. - }
  862. - }
  863. - }
  864. -
  865. - protected void killedBelethSample(InstanceWorld world, Npc npc)
  866. - {
  867. - int decayedSamples = 0;
  868. - final DMCRoom fifthRoom = world.getParameters().getObject("FifthRoom", DMCRoom.class);
  869. - for (DMCNpc mob : fifthRoom.npcList)
  870. - {
  871. - if (mob.npc == npc)
  872. - {
  873. - decayedSamples += 1;
  874. - mob.count = 2;
  875. - }
  876. - else
  877. - {
  878. - if (mob.count == 2)
  879. + case ADVENTURE:
  880. {
  881. - decayedSamples += 1;
  882. + if (world.isStatus(7))
  883. + {
  884. + world.spawnGroup("roomC").forEach(n -> n.setScriptValue(8));
  885. + world.setStatus(8);
  886. + world.openDoor(ROOM_D_DOOR);
  887. + }
  888. + npc.showChatWindow(player);
  889. + break;
  890. }
  891. - }
  892. - }
  893. -
  894. - if (fifthRoom.reset == 1)
  895. - {
  896. - for (DMCNpc mob : fifthRoom.npcList)
  897. - {
  898. - if ((mob.count == 0) || ((mob.status == 1) && (mob.count != 2)))
  899. + case TRUTH:
  900. {
  901. - decayedSamples += 1;
  902. - mob.npc.decayMe();
  903. - mob.count = 2;
  904. - }
  905. - }
  906. - if (decayedSamples == 7)
  907. - {
  908. - startQuestTimer("respawnFifth", 6000, npc, null);
  909. - }
  910. - }
  911. - else
  912. - {
  913. - if ((fifthRoom.reset == 0) && (fifthRoom.founded == 3))
  914. - {
  915. - for (DMCNpc mob : fifthRoom.npcList)
  916. - {
  917. - mob.npc.decayMe();
  918. - }
  919. - endInstance(world);
  920. - }
  921. - }
  922. - }
  923. -
  924. - protected boolean allStonesDone(InstanceWorld world)
  925. - {
  926. - final DMCRoom secondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
  927. - for (DMCNpc mob : secondRoom.npcList)
  928. - {
  929. - if (mob.isDead)
  930. - {
  931. - continue;
  932. - }
  933. - return false;
  934. - }
  935. - return true;
  936. - }
  937. -
  938. - protected void removeMonoliths(InstanceWorld world)
  939. - {
  940. - final DMCRoom secondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
  941. - for (DMCNpc mob : secondRoom.npcList)
  942. - {
  943. - mob.npc.decayMe();
  944. - }
  945. - }
  946. -
  947. - protected void chkShadowColumn(InstanceWorld world, Npc npc)
  948. - {
  949. - final DMCRoom forthRoom = world.getParameters().getObject("ForthRoom", DMCRoom.class);
  950. - for (DMCNpc mob : forthRoom.npcList)
  951. - {
  952. - if (mob.npc == npc)
  953. - {
  954. - for (int i = 0; i < 7; i++)
  955. - {
  956. - if ((mob.order == i) && (forthRoom.counter == i))
  957. + if (!hasQuestItems(player, CC))
  958. {
  959. - world.openDoor(W1 + i);
  960. - forthRoom.counter += 1;
  961. - if (forthRoom.counter == 7)
  962. - {
  963. - runThirdRoom2(world);
  964. - }
  965. + giveItems(player, CC, 1);
  966. }
  967. + npc.showChatWindow(player);
  968. + break;
  969. }
  970. }
  971. }
  972. + return null;
  973. }
  974.  
  975. @Override
  976. - public String onAdvEvent(String event, Npc npc, PlayerInstance player)
  977. + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
  978. {
  979. - if (npc == null)
  980. - {
  981. - return "";
  982. - }
  983. -
  984. final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  985. - if (world == null)
  986. + if (world != null)
  987. {
  988. - return "";
  989. - }
  990. -
  991. - final DMCRoom fifthRoom = world.getParameters().getObject("FifthRoom", DMCRoom.class);
  992. - if (fifthRoom != null)
  993. - {
  994. - if (event.equalsIgnoreCase("decayMe"))
  995. + switch (npc.getId())
  996. {
  997. - for (DMCNpc mob : fifthRoom.npcList)
  998. + case PARME_HEALER:
  999. {
  1000. - if ((mob.npc == npc) || ((fifthRoom.reset == 0) && (fifthRoom.founded == 3)))
  1001. + if (world.isStatus(2) && (attacker.getY() < 179986))
  1002. {
  1003. - mob.npc.decayMe();
  1004. - mob.count = 2;
  1005. + world.closeDoor(ROOM_A_DOOR);
  1006. }
  1007. + break;
  1008. }
  1009. - if ((fifthRoom.reset == 0) && (fifthRoom.founded == 3))
  1010. + case COLUMN:
  1011. {
  1012. - endInstance(world);
  1013. - }
  1014. - }
  1015. - else if (event.equalsIgnoreCase("decayBelethSamples"))
  1016. - {
  1017. - for (DMCNpc mob : fifthRoom.npcList)
  1018. - {
  1019. - if (mob.count == 0)
  1020. + if (world.isStatus(7))
  1021. {
  1022. - mob.npc.decayMe();
  1023. - mob.count = 2;
  1024. + world.closeDoor(ROOM_D_DOOR);
  1025. + // if (npc.isHpBlocked() && (getRandom(100) < 12))
  1026. + if (npc.isInvul() && (getRandom(100) < 12))
  1027. + {
  1028. + addSpawn(getRandomEntry(BELETH_SUBORDINATE), npc, false, 0, false, world.getInstanceId());
  1029. + }
  1030. }
  1031. + break;
  1032. }
  1033. - }
  1034. - else if (event.equalsIgnoreCase("decayChatBelethSamples"))
  1035. - {
  1036. - for (DMCNpc mob : fifthRoom.npcList)
  1037. + default:
  1038. {
  1039. - if (mob.status == 1)
  1040. + if (world.isStatus(9))
  1041. {
  1042. - mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), ChatType.NPC_GENERAL, mob.npc.getId(), _decayChat[getRandom(_decayChat.length)]));
  1043. + handleRoomE(world, npc);
  1044. }
  1045. }
  1046. }
  1047. - else if (event.equalsIgnoreCase("respawnFifth"))
  1048. - {
  1049. - spawnFifthRoom(world);
  1050. - }
  1051. }
  1052. -
  1053. - return "";
  1054. + return super.onAttack(npc, attacker, damage, isSummon);
  1055. }
  1056.  
  1057. @Override
  1058. @@ -935,178 +371,158 @@
  1059. final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  1060. if (world != null)
  1061. {
  1062. - if (world.getStatus() == 0)
  1063. + switch (world.getStatus())
  1064. {
  1065. - if (checkKillProgress(npc, world.getParameters().getObject("StartRoom", DMCRoom.class)))
  1066. + case 0: // Start room
  1067. {
  1068. - runHall(world);
  1069. + if (world.getAliveNpcs().isEmpty())
  1070. + {
  1071. + world.setStatus(1);
  1072. + world.spawnGroup("hall");
  1073. + world.openDoor(START_DOOR);
  1074. + }
  1075. + break;
  1076. }
  1077. - }
  1078. - if (world.getStatus() == 1)
  1079. - {
  1080. - if (checkKillProgress(npc, world.getParameters().getObject("Hall", DMCRoom.class)))
  1081. + case 1: // Hall
  1082. {
  1083. - runFirstRoom(world);
  1084. + if (world.getAliveNpcs().isEmpty())
  1085. + {
  1086. + world.setStatus(2);
  1087. + world.spawnGroup("roomA");
  1088. + world.openDoor(ROOM_A_DOOR);
  1089. + }
  1090. + break;
  1091. }
  1092. - }
  1093. - if (world.getStatus() == 2)
  1094. - {
  1095. - if (checkKillProgress(npc, world.getParameters().getObject("FirstRoom", DMCRoom.class)))
  1096. + case 2: // Room A - cleared
  1097. {
  1098. - runHall2(world);
  1099. + if (world.getAliveNpcs().isEmpty())
  1100. + {
  1101. + world.setStatus(3);
  1102. + world.spawnGroup("roomAClear");
  1103. + world.spawnGroup("hall");
  1104. + }
  1105. + break;
  1106. }
  1107. - }
  1108. - if (world.getStatus() == 3)
  1109. - {
  1110. - if (checkKillProgress(npc, world.getParameters().getObject("Hall", DMCRoom.class)))
  1111. + case 3: // Hall
  1112. {
  1113. - runSecondRoom(world);
  1114. + if (world.getAliveNpcs(BELETH_SUBORDINATE).isEmpty())
  1115. + {
  1116. + world.setStatus(4);
  1117. + world.openDoor(ROOM_B_DOOR);
  1118. + int current = 0;
  1119. + final List<Npc> desks = world.spawnGroup("roomB");
  1120. + while (!desks.isEmpty())
  1121. + {
  1122. + final Npc desk = desks.remove(getRandom(desks.size()));
  1123. + desk.setScriptValue(current++);
  1124. + }
  1125. + }
  1126. + break;
  1127. }
  1128. - }
  1129. - if (world.getStatus() == 4)
  1130. - {
  1131. - final DMCRoom SecondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
  1132. - for (DMCNpc mob : SecondRoom.npcList)
  1133. + case 5: // Hall
  1134. {
  1135. - if (mob.golem == npc)
  1136. + if (world.getAliveNpcs(BELETH_SUBORDINATE).isEmpty())
  1137. {
  1138. - mob.golem = null;
  1139. + world.setStatus(6);
  1140. + world.spawnGroup("roomC");
  1141. + world.openDoor(ROOM_C_DOOR);
  1142. }
  1143. + break;
  1144. }
  1145. - }
  1146. - if (world.getStatus() == 5)
  1147. - {
  1148. - if (checkKillProgress(npc, world.getParameters().getObject("Hall", DMCRoom.class)))
  1149. + case 6: // Room C
  1150. {
  1151. - runThirdRoom(world);
  1152. + if (world.getAliveNpcs(BELETH_SUBORDINATE).isEmpty())
  1153. + {
  1154. + world.setStatus(7);
  1155. + world.spawnGroup("roomD");
  1156. + world.openDoor(ROOM_D_DOOR);
  1157. + for (int i = 1; i <= 7; i++)
  1158. + {
  1159. + final List<Npc> row = world.spawnGroup("roomD" + i);
  1160. + for (int x = 0; x < 2; x++)
  1161. + {
  1162. + final Npc col = row.remove(getRandom(row.size()));
  1163. + col.setInvul(true);
  1164. + }
  1165. + }
  1166. + }
  1167. + break;
  1168. }
  1169. - }
  1170. - if (world.getStatus() == 6)
  1171. - {
  1172. - if (checkKillProgress(npc, world.getParameters().getObject("ThirdRoom", DMCRoom.class)))
  1173. + case 8: // Room C
  1174. {
  1175. - runForthRoom(world);
  1176. + final long roomClear = world.getAliveNpcs(BELETH_SUBORDINATE).stream().filter(n -> n.isScriptValue(8)).count();
  1177. + if (roomClear == 0)
  1178. + {
  1179. + world.setStatus(9);
  1180. + world.openDoor(ROOM_E_DOOR);
  1181. + spawnRoomE(world);
  1182. + }
  1183. + break;
  1184. }
  1185. - }
  1186. - if (world.getStatus() == 7)
  1187. - {
  1188. - chkShadowColumn(world, npc);
  1189. - }
  1190. - if (world.getStatus() == 8)
  1191. - {
  1192. - if (checkKillProgress(npc, world.getParameters().getObject("ThirdRoom2", DMCRoom.class)))
  1193. + case 9:
  1194. {
  1195. - runFifthRoom(world);
  1196. + handleRoomE(world, npc);
  1197. + break;
  1198. }
  1199. }
  1200. - if (world.getStatus() == 9)
  1201. - {
  1202. - killedBelethSample(world, npc);
  1203. - }
  1204. }
  1205. - return "";
  1206. + return null;
  1207. }
  1208.  
  1209. - @Override
  1210. - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
  1211. + private void spawnRoomE(InstanceWorld world)
  1212. {
  1213. - final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  1214. - if (world != null)
  1215. + final List<Npc> npcs = world.spawnGroup("roomE");
  1216. + for (Npc n : npcs)
  1217. {
  1218. - if (world.getStatus() == 7)
  1219. - {
  1220. - final DMCRoom forthRoom = world.getParameters().getObject("ForthRoom", DMCRoom.class);
  1221. - for (DMCNpc mob : forthRoom.npcList)
  1222. - {
  1223. - if ((mob.npc == npc) && mob.npc.isInvul() && (getRandom(100) < 12))
  1224. - {
  1225. - addSpawn(BM[getRandom(BM.length)], attacker.getX(), attacker.getY(), attacker.getZ(), 0, false, 0, false, world.getInstanceId());
  1226. - }
  1227. - }
  1228. - }
  1229. - if (world.getStatus() == 9)
  1230. - {
  1231. - checkBelethSample(world, npc, attacker);
  1232. - }
  1233. + n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SPAWN_CHAT));
  1234. }
  1235. - return super.onAttack(npc, attacker, damage, isSummon);
  1236. + for (int i = 0; i < 3; i++)
  1237. + {
  1238. + final Npc n = npcs.remove(getRandom(npcs.size()));
  1239. + n.setScriptValue(1);
  1240. + }
  1241. }
  1242.  
  1243. - @Override
  1244. - public String onFirstTalk(Npc npc, PlayerInstance player)
  1245. + private void handleRoomE(InstanceWorld world, Npc npc)
  1246. {
  1247. - final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  1248. - if (world != null)
  1249. + if (CommonUtil.contains(BELETH_SAMPLE, npc.getId()))
  1250. {
  1251. - if (world.getStatus() == 4)
  1252. + final StatSet params = world.getParameters();
  1253. + if (!params.getBoolean("blocked", false))
  1254. {
  1255. - final DMCRoom secondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
  1256. - for (DMCNpc mob : secondRoom.npcList)
  1257. + if (npc.isScriptValue(1))
  1258. {
  1259. - if (mob.npc == npc)
  1260. + final int found = params.getInt("found", 0) + 1;
  1261. + world.setParameter("found", found);
  1262. + npc.setScriptValue(-1);
  1263. + npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SUCCESS_CHAT));
  1264. + if (found != 3)
  1265. {
  1266. - checkStone(npc, secondRoom.Order, mob, world);
  1267. + startQuestTimer("DELETE_ONE", 1500, npc, null);
  1268. }
  1269. + else
  1270. + {
  1271. + world.setStatus(10);
  1272. + world.getNpcs().forEach(Npc::deleteMe);
  1273. + world.spawnGroup("roomEClear");
  1274. + }
  1275. }
  1276. -
  1277. - if (allStonesDone(world))
  1278. + else if (!npc.isScriptValue(-1))
  1279. {
  1280. - removeMonoliths(world);
  1281. - runHall3(world);
  1282. + world.setParameter("blocked", true);
  1283. + world.setParameter("found", 0);
  1284. + npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(FAIL_CHAT));
  1285. + npc.setScriptValue(-1);
  1286. + startQuestTimer("CHAT", 4000, npc, null);
  1287. + startQuestTimer("DELETE", 4500, npc, null);
  1288. }
  1289. + world.closeDoor(ROOM_E_DOOR);
  1290. }
  1291. -
  1292. - if ((npc.getId() == SOTruth) && (world.getStatus() == 10))
  1293. - {
  1294. - npc.showChatWindow(player);
  1295. -
  1296. - if (!hasQuestItems(player, CC))
  1297. - {
  1298. - giveItems(player, CC, 1);
  1299. - }
  1300. - }
  1301. }
  1302. -
  1303. - return "";
  1304. }
  1305.  
  1306. - @Override
  1307. - public String onTalk(Npc npc, PlayerInstance player)
  1308. - {
  1309. - final int npcId = npc.getId();
  1310. - if (npcId == YIYEN)
  1311. - {
  1312. - enterInstance(player, TEMPLATE_ID);
  1313. - }
  1314. - else
  1315. - {
  1316. - final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
  1317. - if (world == null)
  1318. - {
  1319. - return "";
  1320. - }
  1321. -
  1322. - if (npcId == SOTruth)
  1323. - {
  1324. - if (world.isAllowed(player))
  1325. - {
  1326. - world.removeAllowed(player);
  1327. - }
  1328. - teleportPlayer(player, new Location(139968, 150367, -3111), 0);
  1329. - final int instanceId = npc.getInstanceId();
  1330. - final Instance instance = InstanceManager.getInstance().getInstance(instanceId);
  1331. - if (instance.getPlayers().isEmpty())
  1332. - {
  1333. - InstanceManager.getInstance().destroyInstance(instanceId);
  1334. - }
  1335. - return "";
  1336. - }
  1337. - }
  1338. - return "";
  1339. - }
  1340. -
  1341. public static void main(String[] args)
  1342. {
  1343. new DarkCloudMansion();
  1344. }
  1345. -}
  1346. +}
  1347. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement