Advertisement
horato

Frintezza.java

Jul 25th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 66.33 KB | None | 0 0
  1. datapack/data/scripts/ai/individual/Frintezza.java
  2.  
  3. /*
  4. * This program is free software: you can redistribute it and/or modify it under
  5. * the terms of the GNU General Public License as published by the Free Software
  6. * Foundation, either version 3 of the License, or (at your option) any later
  7. * version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  12. * details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package ai.individual;
  18.  
  19. import java.util.Calendar;
  20. import java.util.List;
  21. import java.util.logging.Level;
  22. import java.util.logging.Logger;
  23.  
  24. import javolution.util.FastList;
  25. import ai.group_template.L2AttackableAIScript;
  26.  
  27. import com.l2jserver.gameserver.ai.CtrlIntention;
  28. import com.l2jserver.gameserver.datatables.SkillTable;
  29. import com.l2jserver.gameserver.instancemanager.GrandBossManager;
  30. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  31. import com.l2jserver.gameserver.model.L2CommandChannel;
  32. import com.l2jserver.gameserver.model.L2Party;
  33. import com.l2jserver.gameserver.model.L2Skill;
  34. import com.l2jserver.gameserver.model.L2World;
  35. import com.l2jserver.gameserver.model.actor.L2Attackable;
  36. import com.l2jserver.gameserver.model.actor.L2Character;
  37. import com.l2jserver.gameserver.model.actor.L2Npc;
  38. import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
  39. import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
  40. import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
  41. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  42. import com.l2jserver.gameserver.model.quest.*;
  43. import com.l2jserver.gameserver.model.zone.type.L2BossZone;
  44. import com.l2jserver.gameserver.network.SystemMessageId;
  45. import com.l2jserver.gameserver.network.serverpackets.AbstractNpcInfo.NpcInfo;
  46. import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
  47. import com.l2jserver.gameserver.network.serverpackets.Earthquake;
  48. import com.l2jserver.gameserver.network.serverpackets.MagicSkillCanceld;
  49. import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
  50. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  51. import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  52. import com.l2jserver.gameserver.network.serverpackets.SocialAction;
  53. import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
  54. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  55. import com.l2jserver.gameserver.skills.AbnormalEffect;
  56. import com.l2jserver.gameserver.util.Util;
  57. import com.l2jserver.util.Rnd;
  58.  
  59. /**
  60. * Frintezza AI
  61. *
  62. * @author Darki699
  63. * @author SANDMAN L2J_JP(modified)
  64. * @author JOJO
  65. *
  66. * Update by rocknow
  67. * Updated by L2jOff team
  68. * Updated to use instances by horato
  69. *
  70. * <BR>
  71. * Warn: be careful with adding new spawns {@link #getXFix(int)}
  72. *
  73. */
  74. public class Frintezza extends L2AttackableAIScript
  75. {
  76. private static final int[][] _invadeLoc =
  77. {
  78. { 174102, -76039, -5105 },
  79. { 173235, -76884, -5105 },
  80. { 175003, -76933, -5105 },
  81. { 174196, -76190, -5105 },
  82. { 174013, -76120, -5105 },
  83. { 173263, -75161, -5105 }
  84. };
  85.  
  86. private static final int[][] _skill =
  87. {
  88. { 5015, 1, 5000 },
  89. { 5015, 4, 5000 },
  90. { 5015, 2, 5000 },
  91. { 5015, 5, 5000 },
  92. { 5018, 1, 10000 },
  93. { 5016, 1, 5000 },
  94. { 5015, 3, 5000 },
  95. { 5015, 6, 5000 },
  96. { 5018, 2, 10000 },
  97. { 5019, 1, 10000 },
  98. { 5016, 1, 5000 }
  99. };
  100.  
  101. private static final int[][] _mobLoc =
  102. {
  103. { 18328, 172894, -76019, -5107, 243 },
  104. { 18328, 174095, -77279, -5107, 16216 },
  105. { 18328, 174111, -74833, -5107, 49043 },
  106. { 18328, 175344, -76042, -5107, 32847 },
  107. { 18330, 173489, -76227, -5134, 63565 },
  108. { 18330, 173498, -75724, -5107, 58498 },
  109. { 18330, 174365, -76745, -5107, 22424 },
  110. { 18330, 174570, -75584, -5107, 31968 },
  111. { 18330, 174613, -76179, -5107, 31471 },
  112. { 18332, 173620, -75981, -5107, 4588 },
  113. { 18332, 173630, -76340, -5107, 62454 },
  114. { 18332, 173755, -75613, -5107, 57892 },
  115. { 18332, 173823, -76688, -5107, 2411 },
  116. { 18332, 174000, -75411, -5107, 54718 },
  117. { 18332, 174487, -75555, -5107, 33861 },
  118. { 18332, 174517, -76471, -5107, 21893 },
  119. { 18332, 174576, -76122, -5107, 31176 },
  120. { 18332, 174600, -75841, -5134, 35927 },
  121. { 18329, 173481, -76043, -5107, 61312 },
  122. { 18329, 173539, -75678, -5107, 59524 },
  123. { 18329, 173584, -76386, -5107, 3041 },
  124. { 18329, 173773, -75420, -5107, 51115 },
  125. { 18329, 173777, -76650, -5107, 12588 },
  126. { 18329, 174585, -76510, -5107, 21704 },
  127. { 18329, 174623, -75571, -5107, 40141 },
  128. { 18329, 174744, -76240, -5107, 29202 },
  129. { 18329, 174769, -75895, -5107, 29572 },
  130. { 18333, 173861, -76011, -5107, 383 },
  131. { 18333, 173872, -76461, -5107, 8041 },
  132. { 18333, 173898, -75668, -5107, 51856 },
  133. { 18333, 174422, -75689, -5107, 42878 },
  134. { 18333, 174460, -76355, -5107, 27311 },
  135. { 18333, 174483, -76041, -5107, 30947 },
  136. { 18331, 173515, -76184, -5107, 6971 },
  137. { 18331, 173516, -75790, -5134, 3142 },
  138. { 18331, 173696, -76675, -5107, 6757 },
  139. { 18331, 173766, -75502, -5134, 60827 },
  140. { 18331, 174473, -75321, -5107, 37147 },
  141. { 18331, 174493, -76505, -5107, 34503 },
  142. { 18331, 174568, -75654, -5134, 41661 },
  143. { 18331, 174584, -76263, -5107, 31729 },
  144. { 18339, 173892, -81592, -5123, 50849 },
  145. { 18339, 173958, -81820, -5123, 7459 },
  146. { 18339, 174128, -81805, -5150, 21495 },
  147. { 18339, 174245, -81566, -5123, 41760 },
  148. { 18334, 173264, -81529, -5072, 1646 },
  149. { 18334, 173265, -81656, -5072, 441 },
  150. { 18334, 173267, -81889, -5072, 0 },
  151. { 18334, 173271, -82015, -5072, 65382 },
  152. { 18334, 174867, -81655, -5073, 32537 },
  153. { 18334, 174868, -81890, -5073, 32768 },
  154. { 18334, 174869, -81485, -5073, 32315 },
  155. { 18334, 174871, -82017, -5073, 33007 },
  156. { 18335, 173074, -80817, -5107, 8353 },
  157. { 18335, 173128, -82702, -5107, 5345 },
  158. { 18335, 173181, -82544, -5107, 65135 },
  159. { 18335, 173191, -80981, -5107, 6947 },
  160. { 18335, 174859, -80889, -5134, 24103 },
  161. { 18335, 174924, -82666, -5107, 38710 },
  162. { 18335, 174947, -80733, -5107, 22449 },
  163. { 18335, 175096, -82724, -5107, 42205 },
  164. { 18336, 173435, -80512, -5107, 65215 },
  165. { 18336, 173440, -82948, -5107, 417 },
  166. { 18336, 173443, -83120, -5107, 1094 },
  167. { 18336, 173463, -83064, -5107, 286 },
  168. { 18336, 173465, -80453, -5107, 174 },
  169. { 18336, 173465, -83006, -5107, 2604 },
  170. { 18336, 173468, -82889, -5107, 316 },
  171. { 18336, 173469, -80570, -5107, 65353 },
  172. { 18336, 173469, -80628, -5107, 166 },
  173. { 18336, 173492, -83121, -5107, 394 },
  174. { 18336, 173493, -80683, -5107, 0 },
  175. { 18336, 173497, -80510, -5134, 417 },
  176. { 18336, 173499, -82947, -5107, 0 },
  177. { 18336, 173521, -83063, -5107, 316 },
  178. { 18336, 173523, -82889, -5107, 128 },
  179. { 18336, 173524, -80627, -5134, 65027 },
  180. { 18336, 173524, -83007, -5107, 0 },
  181. { 18336, 173526, -80452, -5107, 64735 },
  182. { 18336, 173527, -80569, -5134, 65062 },
  183. { 18336, 174602, -83122, -5107, 33104 },
  184. { 18336, 174604, -82949, -5107, 33184 },
  185. { 18336, 174609, -80514, -5107, 33234 },
  186. { 18336, 174609, -80684, -5107, 32851 },
  187. { 18336, 174629, -80627, -5107, 33346 },
  188. { 18336, 174632, -80570, -5107, 32896 },
  189. { 18336, 174632, -83066, -5107, 32768 },
  190. { 18336, 174635, -82893, -5107, 33594 },
  191. { 18336, 174636, -80456, -5107, 32065 },
  192. { 18336, 174639, -83008, -5107, 33057 },
  193. { 18336, 174660, -80512, -5107, 33057 },
  194. { 18336, 174661, -83121, -5107, 32768 },
  195. { 18336, 174663, -82948, -5107, 32768 },
  196. { 18336, 174664, -80685, -5107, 32676 },
  197. { 18336, 174687, -83008, -5107, 32520 },
  198. { 18336, 174691, -83066, -5107, 32961 },
  199. { 18336, 174692, -80455, -5107, 33202 },
  200. { 18336, 174692, -80571, -5107, 32768 },
  201. { 18336, 174693, -80630, -5107, 32994 },
  202. { 18336, 174693, -82889, -5107, 32622 },
  203. { 18337, 172837, -82382, -5107, 58363 },
  204. { 18337, 172867, -81123, -5107, 64055 },
  205. { 18337, 172883, -82495, -5107, 64764 },
  206. { 18337, 172916, -81033, -5107, 7099 },
  207. { 18337, 172940, -82325, -5107, 58998 },
  208. { 18337, 172946, -82435, -5107, 58038 },
  209. { 18337, 172971, -81198, -5107, 14768 },
  210. { 18337, 172992, -81091, -5107, 9438 },
  211. { 18337, 173032, -82365, -5107, 59041 },
  212. { 18337, 173064, -81125, -5107, 5827 },
  213. { 18337, 175014, -81173, -5107, 26398 },
  214. { 18337, 175061, -82374, -5107, 43290 },
  215. { 18337, 175096, -81080, -5107, 24719 },
  216. { 18337, 175169, -82453, -5107, 37672 },
  217. { 18337, 175172, -80972, -5107, 32315 },
  218. { 18337, 175174, -82328, -5107, 41760 },
  219. { 18337, 175197, -81157, -5107, 27617 },
  220. { 18337, 175245, -82547, -5107, 40275 },
  221. { 18337, 175249, -81075, -5107, 28435 },
  222. { 18337, 175292, -82432, -5107, 42225 },
  223. { 18338, 173014, -82628, -5107, 11874 },
  224. { 18338, 173033, -80920, -5107, 10425 },
  225. { 18338, 173095, -82520, -5107, 49152 },
  226. { 18338, 173115, -80986, -5107, 9611 },
  227. { 18338, 173144, -80894, -5107, 5345 },
  228. { 18338, 173147, -82602, -5107, 51316 },
  229. { 18338, 174912, -80825, -5107, 24270 },
  230. { 18338, 174935, -80899, -5107, 18061 },
  231. { 18338, 175016, -82697, -5107, 39533 },
  232. { 18338, 175041, -80834, -5107, 25420 },
  233. { 18338, 175071, -82549, -5107, 39163 },
  234. { 18338, 175154, -82619, -5107, 36345 }
  235. };
  236.  
  237.  
  238. private static final int SCARLET1 = 29046;
  239. private static final int SCARLET2 = 29047;
  240. private static final int FRINTEZZA = 29045;
  241. private static final int GUIDE = 32011;
  242. private static final int CUBE = 29061;
  243. private static final int INSTANCEID = 136; // Taken from instancenames.xml, I have no idea if it is right but I hope so :}}
  244.  
  245. //Frintezza Status Tracking :
  246. private static final byte DORMANT = 0; //Frintezza is spawned and no one has entered yet. Entry is unlocked
  247. private static final byte WAITING = 1; //Frintezza is spawend and someone has entered, triggering a 30 minute window for additional people to enter
  248. //before he unleashes his attack. Entry is unlocked
  249. private static final byte FIGHTING = 2; //Frintezza is engaged in battle, annihilating his foes. Entry is locked
  250. private static byte CurrentStatus = DORMANT;
  251.  
  252. private static long _LastAction = 0;
  253. private static int _Angle = 0;
  254. private static int _Heading = 0;
  255. private static int _LocCycle = 0;
  256. private static int _Bomber = 0;
  257. private static int _CheckDie = 0;
  258. private static int _OnCheck = 0;
  259. private static int _OnSong = 0;
  260. private static int _Abnormal = 0;
  261. private static int _OnMorph = 0;
  262. private static int _Scarlet_x = 0;
  263. private static int _Scarlet_y = 0;
  264. private static int _Scarlet_z = 0;
  265. private static int _Scarlet_h = 0;
  266. private static int _SecondMorph = 0;
  267. private static int _ThirdMorph = 0;
  268. private static int _KillHallAlarmDevice = 0;
  269. private static int _KillDarkChoirPlayer = 0;
  270. private static int _KillDarkChoirCaptain = 0;
  271. private static L2Npc CubeControl = null;
  272. private static QuestState st = null;
  273. private static boolean debugMSG = true;
  274.  
  275. private static L2BossZone _Zone;
  276. private L2GrandBossInstance frintezza, weakScarlet, strongScarlet, activeScarlet;
  277. private L2MonsterInstance demon1, demon2, demon3, demon4, portrait1, portrait2, portrait3, portrait4;
  278. private L2Npc _frintezzaDummy, _overheadDummy, _portraitDummy1, _portraitDummy3, _scarletDummy;
  279. private static List<L2PcInstance> _PlayersInside = new FastList<L2PcInstance>();
  280. private static List<L2Npc> _Room1Mobs = new FastList<L2Npc>();
  281. private static List<L2Npc> _Room2Mobs = new FastList<L2Npc>();
  282. private static List<L2Attackable> Minions = new FastList<L2Attackable>();
  283. private static List<String> _TimerControl = new FastList<String>();
  284.  
  285. // Initialization at 6:30 am on Wednesday and Saturday
  286. private static final int RESET_HOUR = 6;
  287. private static final int RESET_MIN = 30;
  288. private static final int RESET_DAY_1 = 4;
  289. private static final int RESET_DAY_2 = 7;
  290. private static int currentInstanceID = 0;
  291. private final static Logger _log = Logger.getLogger("FrintezzaInstance");
  292.  
  293. // Boss: Frintezza
  294. public Frintezza(int id, String name, String descr)
  295. {
  296. super(id, name, descr);
  297. int[] mob = { SCARLET1, SCARLET2, FRINTEZZA, 18328, 18329, 18330, 18331, 18332, 18333, 18334, 18335, 18336, 18337, 18338, 18339, 29048, 29049, 29050, 29051 };
  298. _Zone = GrandBossManager.getInstance().getZone(getXFix(174232), getYFix(-88020), getZFix(-5116));
  299. registerMobs(mob);
  300. addStartNpc(GUIDE);
  301. addTalkId(GUIDE);
  302. addStartNpc(CUBE);
  303. addTalkId(CUBE);
  304.  
  305. /*
  306. //tempfix for messed door cords
  307. for (int i = 0; i < 8; i++)
  308. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130051 + i).setRange(0, 0, 0, 0, 0, 0);
  309. */
  310.  
  311. }
  312. @Override
  313. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  314. {
  315. long temp = 0;
  316. if (event.equalsIgnoreCase("waiting"))
  317. {
  318. startQuestTimer("close", 27000, npc, null);
  319. _TimerControl.add("close");
  320. startQuestTimer("camera_1", 30000, npc, null);
  321. _TimerControl.add("camera_1");
  322. _Zone.broadcastPacket(new Earthquake(getXFix(174232), getYFix(-88020), getZFix(-5116), 45, 27));
  323. }
  324. else if (event.equalsIgnoreCase("room1_spawn"))
  325. {
  326. for (int i = 0; i <= 17; i++)
  327. {
  328. L2Npc mob = addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0);
  329. _Room1Mobs.add(mob);
  330. mob.setInstanceId(currentInstanceID);
  331. }
  332. }
  333. else if (event.equalsIgnoreCase("room1_spawn2"))
  334. {
  335. for (int i = 18; i <= 26; i++)
  336. {
  337. L2Npc mob = addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0);
  338. _Room1Mobs.add(mob);
  339. mob.setInstanceId(currentInstanceID);
  340. }
  341. }
  342. else if (event.equalsIgnoreCase("room1_spawn3"))
  343. {
  344. for (int i = 27; i <= 32; i++)
  345. {
  346. L2Npc mob = addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0);
  347. _Room1Mobs.add(mob);
  348. mob.setInstanceId(currentInstanceID);
  349. }
  350. }
  351. else if (event.equalsIgnoreCase("room1_spawn4"))
  352. {
  353. for (int i = 33; i <= 40; i++)
  354. {
  355. L2Npc mob = addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0);
  356. _Room1Mobs.add(mob);
  357. mob.setInstanceId(currentInstanceID);
  358. }
  359. }
  360. else if (event.equalsIgnoreCase("room2_spawn"))
  361. {
  362. for (int i = 41; i <= 44; i++)
  363. {
  364. L2Npc mob = addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0);
  365. _Room2Mobs.add(mob);
  366. mob.setInstanceId(currentInstanceID);
  367. }
  368. }
  369. else if (event.equalsIgnoreCase("room2_spawn2"))
  370. {
  371. for (int i = 45; i <= 131; i++)
  372. {
  373. L2Npc mob = addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0);
  374. _Room2Mobs.add(mob);
  375. mob.setInstanceId(currentInstanceID);
  376. }
  377. }
  378. else if (event.equalsIgnoreCase("room1_del"))
  379. {
  380. for (L2Npc mob : _Room1Mobs)
  381. {
  382. if (mob != null)
  383. mob.deleteMe();
  384. }
  385. if(!_Room1Mobs.isEmpty())
  386. _Room1Mobs.clear();
  387. }
  388. else if (event.equalsIgnoreCase("room2_del"))
  389. {
  390. for (L2Npc mob : _Room2Mobs)
  391. {
  392. if (mob != null)
  393. mob.deleteMe();
  394. }
  395. if(!_Room2Mobs.isEmpty())
  396. _Room2Mobs.clear();
  397. }
  398. else if (event.equalsIgnoreCase("room3_del"))
  399. {
  400. if (demon1 != null)
  401. demon1.deleteMe();
  402. if (demon2 != null)
  403. demon2.deleteMe();
  404. if (demon3 != null)
  405. demon3.deleteMe();
  406. if (demon4 != null)
  407. demon4.deleteMe();
  408. if (portrait1 != null)
  409. portrait1.deleteMe();
  410. if (portrait2 != null)
  411. portrait2.deleteMe();
  412. if (portrait3 != null)
  413. portrait3.deleteMe();
  414. if (portrait4 != null)
  415. portrait4.deleteMe();
  416. if (frintezza != null)
  417. frintezza.deleteMe();
  418. if (weakScarlet != null)
  419. weakScarlet.deleteMe();
  420. if (strongScarlet != null)
  421. strongScarlet.deleteMe();
  422.  
  423. demon1 = null;
  424. demon2 = null;
  425. demon3 = null;
  426. demon4 = null;
  427. portrait1 = null;
  428. portrait2 = null;
  429. portrait3 = null;
  430. portrait4 = null;
  431. frintezza = null;
  432. weakScarlet = null;
  433. strongScarlet = null;
  434. activeScarlet = null;
  435. }
  436. else if (event.equalsIgnoreCase("clean"))
  437. {
  438. _LastAction = 0;
  439. _LocCycle = 0;
  440. _CheckDie = 0;
  441. _OnCheck = 0;
  442. _Abnormal = 0;
  443. _OnMorph = 0;
  444. _SecondMorph = 0;
  445. _ThirdMorph = 0;
  446. _KillHallAlarmDevice = 0;
  447. _KillDarkChoirPlayer = 0;
  448. _KillDarkChoirCaptain = 0;
  449. if(!_PlayersInside.isEmpty())
  450. _PlayersInside.clear();
  451. }
  452. else if (event.equalsIgnoreCase("close"))
  453. {
  454. for (int i = 17130051; i <= 17130058; i++)
  455. {
  456. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  457. if(door != null)
  458. door.closeMe();
  459. }
  460. for (int i = 17130061; i <= 17130070; i++)
  461. {
  462. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  463. if(door != null)
  464. door.closeMe();
  465. }
  466.  
  467. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  468. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  469. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  470. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  471. }
  472. else if (event.equalsIgnoreCase("loc_check"))
  473. {
  474. if (CurrentStatus == FIGHTING)
  475. {
  476. if (!_Zone.isInsideZone(npc))
  477. npc.teleToLocation(getXFix(174232), getYFix(-88020), getZFix(-5116));
  478. if (npc.getX() < getXFix(171932) || npc.getX() > getXFix(176532) || npc.getY() < getYFix(-90320) || npc.getY() > getYFix(-85720) || npc.getZ() < getZFix(-5130))
  479. npc.teleToLocation(getXFix(174232), getYFix(-88020), getZFix(-5116));
  480. }
  481. }
  482. else if (event.equalsIgnoreCase("camera_1"))
  483. {
  484. CurrentStatus = FIGHTING;
  485.  
  486. _frintezzaDummy = addSpawn(29052, 174240, -89805, -5022, 16048, false, 0);
  487. _frintezzaDummy.setInstanceId(currentInstanceID);
  488. _frintezzaDummy.setIsInvul(true);
  489. _frintezzaDummy.setIsImmobilized(true);
  490.  
  491. _overheadDummy = addSpawn(29052, 174232, -88020, -5110, 16384, false, 0);
  492. _overheadDummy.setInstanceId(currentInstanceID);
  493. _overheadDummy.setIsInvul(true);
  494. _overheadDummy.setIsImmobilized(true);
  495. _overheadDummy.setCollisionHeight(600);
  496. _Zone.broadcastPacket(new NpcInfo(_overheadDummy, null));
  497.  
  498. _portraitDummy1 = addSpawn(29052, 172450, -87890, -5100, 16048, false, 0);
  499. _portraitDummy1.setInstanceId(currentInstanceID);
  500. _portraitDummy1.setIsImmobilized(true);
  501. _portraitDummy1.setIsInvul(true);
  502.  
  503. _portraitDummy3 = addSpawn(29052, 176012, -87890, -5100, 16048, false, 0);
  504. _portraitDummy3.setInstanceId(currentInstanceID);
  505. _portraitDummy3.setIsImmobilized(true);
  506. _portraitDummy3.setIsInvul(true);
  507.  
  508. _scarletDummy = addSpawn(29053, 174232, -88020, -5110, 16384, false, 0);
  509. _scarletDummy.setInstanceId(currentInstanceID);
  510. _scarletDummy.setIsInvul(true);
  511. _scarletDummy.setIsImmobilized(true);
  512.  
  513. startQuestTimer("stop_pc", 0, npc, null);
  514. _TimerControl.add("stop_pc");
  515. startQuestTimer("camera_2", 1000, _overheadDummy, null);
  516. _TimerControl.add("camera_2");
  517. }
  518. else if (event.equalsIgnoreCase("camera_2"))
  519. {
  520. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 0, 75, -89, 0, 100, 0, 0, 1, 0));
  521. startQuestTimer("camera_2b", 0, _overheadDummy, null);
  522. _TimerControl.add("camera_2b");
  523. }
  524. else if (event.equalsIgnoreCase("camera_2b"))
  525. {
  526. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 0, 75, -89, 0, 100, 0, 0, 1, 0));
  527. startQuestTimer("camera_3", 0, _overheadDummy, null);
  528. _TimerControl.add("camera_3");
  529. }
  530. else if (event.equalsIgnoreCase("camera_3"))
  531. {
  532. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 300, 90, -10, 6500, 7000, 0, 0, 1, 0));
  533.  
  534. frintezza = (L2GrandBossInstance) addSpawn(FRINTEZZA, 174240, -89805, -5022, 16048, false, 0);
  535. frintezza.setInstanceId(currentInstanceID);
  536. frintezza.setIsImmobilized(true);
  537. frintezza.setIsInvul(true);
  538. frintezza.disableAllSkills();
  539. _Zone.updateKnownList(frintezza);
  540.  
  541. demon2 = (L2MonsterInstance) addSpawn(29051, 175876, -88713, -5100, 28205, false, 0);
  542. demon2.setInstanceId(currentInstanceID);
  543. demon2.setIsImmobilized(true);
  544. demon2.disableAllSkills();
  545. _Zone.updateKnownList(demon2);
  546.  
  547. demon3 = (L2MonsterInstance) addSpawn(29051, 172608, -88702, -5100, 64817, false, 0);
  548. demon3.setInstanceId(currentInstanceID);
  549. demon3.setIsImmobilized(true);
  550. demon3.disableAllSkills();
  551. _Zone.updateKnownList(demon3);
  552.  
  553. demon1 = (L2MonsterInstance) addSpawn(29050, 175833, -87165, -5100, 35048, false, 0);
  554. demon1.setInstanceId(currentInstanceID);
  555. demon1.setIsImmobilized(true);
  556. demon1.disableAllSkills();
  557. _Zone.updateKnownList(demon1);
  558.  
  559. demon4 = (L2MonsterInstance) addSpawn(29050, 172634, -87165, -5100, 57730, false, 0);
  560. demon4.setInstanceId(currentInstanceID);
  561. demon4.setIsImmobilized(true);
  562. demon4.disableAllSkills();
  563. _Zone.updateKnownList(demon4);
  564.  
  565. startQuestTimer("camera_4", 6500, _overheadDummy, null);
  566. _TimerControl.add("camera_4");
  567. }
  568. else if (event.equalsIgnoreCase("camera_4"))
  569. {
  570. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(), 1800, 90, 8, 6500, 7000, 0, 0, 1, 0));
  571. startQuestTimer("camera_5", 900, _frintezzaDummy, null);
  572. _TimerControl.add("camera_5");
  573. }
  574. else if (event.equalsIgnoreCase("camera_5"))
  575. {
  576. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(), 140, 90, 10, 2500, 4500, 0, 0, 1, 0));
  577. startQuestTimer("camera_5b", 4000, _frintezzaDummy, null);
  578. _TimerControl.add("camera_5b");
  579. }
  580. else if (event.equalsIgnoreCase("camera_5b"))
  581. {
  582. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 40, 75, -10, 0, 1000, 0, 0, 1, 0));
  583. startQuestTimer("camera_6", 0, frintezza, null);
  584. _TimerControl.add("camera_6");
  585. }
  586. else if (event.equalsIgnoreCase("camera_6"))
  587. {
  588. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 40, 75, -10, 0, 12000, 0, 0, 1, 0));
  589. startQuestTimer("camera_7", 1350, frintezza, null);
  590. _TimerControl.add("camera_7");
  591. }
  592. else if (event.equalsIgnoreCase("camera_7"))
  593. {
  594. _Zone.broadcastPacket(new SocialAction(frintezza, 2));
  595. startQuestTimer("camera_8", 7000, frintezza, null);
  596. _TimerControl.add("camera_8");
  597. }
  598. else if (event.equalsIgnoreCase("camera_8"))
  599. {
  600. startQuestTimer("camera_9", 1000, frintezza, null);
  601. _TimerControl.add("camera_9");
  602. _frintezzaDummy.deleteMe();
  603. _frintezzaDummy = null;
  604. }
  605. else if (event.equalsIgnoreCase("camera_9"))
  606. {
  607. _Zone.broadcastPacket(new SocialAction(demon2, 1));
  608. _Zone.broadcastPacket(new SocialAction(demon3, 1));
  609. startQuestTimer("camera_9b", 400, frintezza, null);
  610. _TimerControl.add("camera_9b");
  611. }
  612. else if (event.equalsIgnoreCase("camera_9b"))
  613. {
  614. _Zone.broadcastPacket(new SocialAction(demon1, 1));
  615. _Zone.broadcastPacket(new SocialAction(demon4, 1));
  616.  
  617. for (L2Character pc : _Zone.getCharactersInside().values())
  618. {
  619. if (pc instanceof L2PcInstance)
  620. {
  621. if (pc.getX() < getXFix(174232))
  622. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(), 1000, 118, 0, 0, 1000, 0, 0, 1, 0));
  623. else
  624. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(), 1000, 62, 0, 0, 1000, 0, 0, 1, 0));
  625. }
  626. }
  627. startQuestTimer("camera_9c", 0, frintezza, null);
  628. _TimerControl.add("camera_9c");
  629. }
  630. else if (event.equalsIgnoreCase("camera_9c"))
  631. {
  632. for (L2Character pc : _Zone.getCharactersInside().values())
  633. {
  634. if (pc instanceof L2PcInstance)
  635. {
  636. if (pc.getX() < getXFix(174232))
  637. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(), 1000, 118, 0, 0, 10000, 0, 0, 1, 0));
  638. else
  639. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(), 1000, 62, 0, 0, 10000, 0, 0, 1, 0));
  640. }
  641. }
  642. startQuestTimer("camera_10", 2000, frintezza, null);
  643. _TimerControl.add("camera_10");
  644. }
  645. else if (event.equalsIgnoreCase("camera_10"))
  646. {
  647. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 240, 90, 0, 0, 1000, 0, 0, 1, 0));
  648. startQuestTimer("camera_11", 0, frintezza, null);
  649. _TimerControl.add("camera_11");
  650. }
  651. else if (event.equalsIgnoreCase("camera_11"))
  652. {
  653. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 240, 90, 25, 5500, 10000, 0, 0, 1, 0));
  654. _Zone.broadcastPacket(new SocialAction(frintezza, 3));
  655. _portraitDummy1.deleteMe();
  656. _portraitDummy3.deleteMe();
  657. _portraitDummy1 = null;
  658. _portraitDummy3 = null;
  659.  
  660. startQuestTimer("camera_12", 4500, frintezza, null);
  661. _TimerControl.add("camera_12");
  662. }
  663. else if (event.equalsIgnoreCase("camera_12"))
  664. {
  665. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 100, 195, 35, 0, 10000, 0, 0, 1, 0));
  666. startQuestTimer("camera_13", 700, frintezza, null);
  667. _TimerControl.add("camera_13");
  668. }
  669. else if (event.equalsIgnoreCase("camera_13"))
  670. {
  671. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 100, 195, 35, 0, 10000, 0, 0, 1, 0));
  672. startQuestTimer("camera_14", 1300, frintezza, null);
  673. _TimerControl.add("camera_14");
  674. }
  675. else if (event.equalsIgnoreCase("camera_14"))
  676. {
  677. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 120, 180, 45, 1500, 10000, 0, 0, 1, 0));
  678. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  679. startQuestTimer("camera_16", 1500, frintezza, null);
  680. _TimerControl.add("camera_16");
  681. }
  682. else if (event.equalsIgnoreCase("camera_16"))
  683. {
  684. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 520, 135, 45, 8000, 10000, 0, 0, 1, 0));
  685. startQuestTimer("camera_17", 7500, frintezza, null);
  686. _TimerControl.add("camera_17");
  687. }
  688. else if (event.equalsIgnoreCase("camera_17"))
  689. {
  690. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 1500, 110, 25, 10000, 13000, 0, 0, 1, 0));
  691. startQuestTimer("camera_18", 9500, frintezza, null);
  692. _TimerControl.add("camera_18");
  693. }
  694. else if (event.equalsIgnoreCase("camera_18"))
  695. {
  696. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 930, 160, -20, 0, 1000, 0, 0, 1, 0));
  697. startQuestTimer("camera_18b", 0, _overheadDummy, null);
  698. _TimerControl.add("camera_18b");
  699. }
  700. else if (event.equalsIgnoreCase("camera_18b"))
  701. {
  702. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 600, 180, -25, 0, 10000, 0, 0, 1, 0));
  703. _Zone.broadcastPacket(new MagicSkillUse(_scarletDummy, _overheadDummy, 5004, 1, 5800, 0));
  704.  
  705. weakScarlet = (L2GrandBossInstance) addSpawn(29046, 174232, -88020, -5110, 16384, false, 0, true);
  706. weakScarlet.setInstanceId(currentInstanceID);
  707. weakScarlet.setIsInvul(true);
  708. weakScarlet.setIsImmobilized(true);
  709. weakScarlet.disableAllSkills();
  710. _Zone.updateKnownList(weakScarlet);
  711. activeScarlet = weakScarlet;
  712.  
  713. startQuestTimer("camera_19", 2400, _scarletDummy, null);
  714. _TimerControl.add("camera_19");
  715. startQuestTimer("camera_19b", 5000, _scarletDummy, null);
  716. _TimerControl.add("camera_19b");
  717. }
  718. else if (event.equalsIgnoreCase("camera_19"))
  719. {
  720. weakScarlet.teleToLocation(getXFix(174232), getYFix(-88020), getZFix(-5110));
  721. }
  722. else if (event.equalsIgnoreCase("camera_19b"))
  723. {
  724. _Zone.broadcastPacket(new SpecialCamera(_scarletDummy.getObjectId(), 800, 180, 10, 1000, 10000, 0, 0, 1, 0));
  725. startQuestTimer("camera_20", 2100, _scarletDummy, null);
  726. _TimerControl.add("camera_20");
  727. }
  728. else if (event.equalsIgnoreCase("camera_20"))
  729. {
  730. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(), 300, 60, 8, 0, 10000, 0, 0, 1, 0));
  731. startQuestTimer("camera_21", 2000, weakScarlet, null);
  732. _TimerControl.add("camera_21");
  733. }
  734. else if (event.equalsIgnoreCase("camera_21"))
  735. {
  736. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(), 500, 90, 10, 3000, 5000, 0, 0, 1, 0));
  737. startQuestTimer("camera_22", 3000, weakScarlet, null);
  738. _TimerControl.add("camera_22");
  739. }
  740. else if (event.equalsIgnoreCase("camera_22"))
  741. {
  742. portrait2 = (L2MonsterInstance) addSpawn(29049, 175876, -88713, -5000, 28205, false, 0);
  743. portrait2.setInstanceId(currentInstanceID);
  744. portrait2.setIsImmobilized(true);
  745. portrait2.disableAllSkills();
  746. _Zone.updateKnownList(portrait2);
  747.  
  748. portrait3 = (L2MonsterInstance) addSpawn(29049, 172608, -88702, -5000, 64817, false, 0);
  749. portrait3.setInstanceId(currentInstanceID);
  750. portrait3.setIsImmobilized(true);
  751. portrait3.disableAllSkills();
  752. _Zone.updateKnownList(portrait3);
  753.  
  754. portrait1 = (L2MonsterInstance) addSpawn(29048, 175833, -87165, -5000, 35048, false, 0);
  755. portrait1.setInstanceId(currentInstanceID);
  756. portrait1.setIsImmobilized(true);
  757. portrait1.disableAllSkills();
  758. _Zone.updateKnownList(portrait1);
  759.  
  760. portrait4 = (L2MonsterInstance) addSpawn(29048, 172634, -87165, -5000, 57730, false, 0);
  761. portrait4.setInstanceId(currentInstanceID);
  762. portrait4.setIsImmobilized(true);
  763. portrait4.disableAllSkills();
  764. _Zone.updateKnownList(portrait4);
  765.  
  766. _overheadDummy.deleteMe();
  767. _scarletDummy.deleteMe();
  768. _overheadDummy = null;
  769. _scarletDummy = null;
  770.  
  771. startQuestTimer("camera_23", 2000, weakScarlet, null);
  772. _TimerControl.add("camera_23");
  773. startQuestTimer("start_pc", 2000, weakScarlet, null);
  774. _TimerControl.add("start_pc");
  775. startQuestTimer("loc_check", 60000, weakScarlet, null, true);
  776. _TimerControl.add("loc_check");
  777. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  778. _TimerControl.add("songs_play");
  779. startQuestTimer("skill01", 10000 + Rnd.get(10000), weakScarlet, null);
  780. _TimerControl.add("skill01");
  781. }
  782. else if (event.equalsIgnoreCase("camera_23"))
  783. {
  784. demon1.setIsImmobilized(false);
  785. demon2.setIsImmobilized(false);
  786. demon3.setIsImmobilized(false);
  787. demon4.setIsImmobilized(false);
  788. demon1.enableAllSkills();
  789. demon2.enableAllSkills();
  790. demon3.enableAllSkills();
  791. demon4.enableAllSkills();
  792. portrait1.setIsImmobilized(false);
  793. portrait2.setIsImmobilized(false);
  794. portrait3.setIsImmobilized(false);
  795. portrait4.setIsImmobilized(false);
  796. portrait1.enableAllSkills();
  797. portrait2.enableAllSkills();
  798. portrait3.enableAllSkills();
  799. portrait4.enableAllSkills();
  800. weakScarlet.setIsInvul(false);
  801. weakScarlet.setIsImmobilized(false);
  802. weakScarlet.enableAllSkills();
  803. weakScarlet.setRunning();
  804.  
  805. startQuestTimer("spawn_minion", 20000, portrait1, null);
  806. _TimerControl.add("spawn_minion");
  807. startQuestTimer("spawn_minion", 20000, portrait2, null);
  808. _TimerControl.add("spawn_minion");
  809. startQuestTimer("spawn_minion", 20000, portrait3, null);
  810. _TimerControl.add("spawn_minion");
  811. startQuestTimer("spawn_minion", 20000, portrait4, null);
  812. _TimerControl.add("spawn_minion");
  813. }
  814. else if (event.equalsIgnoreCase("stop_pc"))
  815. {
  816. for (L2Character cha : _Zone.getCharactersInside().values())
  817. {
  818. cha.abortAttack();
  819. cha.abortCast();
  820. cha.disableAllSkills();
  821. cha.setTarget(null);
  822. cha.stopMove(null);
  823. cha.setIsImmobilized(true);
  824. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  825. }
  826. }
  827. else if (event.equalsIgnoreCase("stop_npc"))
  828. {
  829. _Heading = npc.getHeading();
  830. if (_Heading < 32768)
  831. _Angle = Math.abs(180 - (int) (_Heading / 182.044444444));
  832. else
  833. _Angle = Math.abs(540 - (int) (_Heading / 182.044444444));
  834. }
  835. else if (event.equalsIgnoreCase("start_pc"))
  836. {
  837. for (L2Character cha : _Zone.getCharactersInside().values())
  838. {
  839. if (cha != frintezza)
  840. {
  841. cha.enableAllSkills();
  842. cha.setIsImmobilized(false);
  843. }
  844. }
  845. }
  846. else if (event.equalsIgnoreCase("start_npc"))
  847. {
  848. npc.setRunning();
  849. npc.setIsInvul(false);
  850. }
  851. else if (event.equalsIgnoreCase("morph_end"))
  852. {
  853. _OnMorph = 0;
  854. }
  855. else if (event.equalsIgnoreCase("morph_01"))
  856. {
  857. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(), 250, _Angle, 12, 2000, 15000, 0, 0, 1, 0));
  858. startQuestTimer("morph_02", 3000, weakScarlet, null);
  859. _TimerControl.add("morph_02");
  860. }
  861. else if (event.equalsIgnoreCase("morph_02"))
  862. {
  863. _Zone.broadcastPacket(new SocialAction(weakScarlet, 1));
  864. weakScarlet.setRHandId(7903);
  865. startQuestTimer("morph_03", 4000, weakScarlet, null);
  866. _TimerControl.add("morph_03");
  867. }
  868. else if (event.equalsIgnoreCase("morph_03"))
  869. {
  870. startQuestTimer("morph_04", 1500, weakScarlet, null);
  871. _TimerControl.add("morph_04");
  872. }
  873. else if (event.equalsIgnoreCase("morph_04"))
  874. {
  875. _Zone.broadcastPacket(new SocialAction(weakScarlet, 4));
  876. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  877. if (skill != null)
  878. skill.getEffects(weakScarlet, weakScarlet);
  879.  
  880. startQuestTimer("morph_end", 6000, weakScarlet, null);
  881. _TimerControl.add("morph_end");
  882. startQuestTimer("start_pc", 3000, weakScarlet, null);
  883. _TimerControl.add("start_pc");
  884. startQuestTimer("start_npc", 3000, weakScarlet, null);
  885. _TimerControl.add("start_ncp");
  886. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  887. _TimerControl.add("songs_play");
  888. startQuestTimer("skill02", 10000 + Rnd.get(10000), weakScarlet, null);
  889. _TimerControl.add("skill02");
  890. }
  891. else if (event.equalsIgnoreCase("morph_05a"))
  892. {
  893. _Zone.broadcastPacket(new SocialAction(frintezza, 4));
  894. }
  895. else if (event.equalsIgnoreCase("morph_05"))
  896. {
  897. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 250, 120, 15, 0, 1000, 0, 0, 1, 0));
  898. startQuestTimer("morph_06", 0, frintezza, null);
  899. _TimerControl.add("morph_06");
  900. }
  901. else if (event.equalsIgnoreCase("morph_06"))
  902. {
  903. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 250, 120, 15, 0, 10000, 0, 0, 1, 0));
  904.  
  905. cancelQuestTimers("loc_check");
  906. _TimerControl.remove("loc_check");
  907.  
  908. _Scarlet_x = weakScarlet.getX();
  909. _Scarlet_y = weakScarlet.getY();
  910. _Scarlet_z = weakScarlet.getZ();
  911. _Scarlet_h = weakScarlet.getHeading();
  912. weakScarlet.deleteMe();
  913. weakScarlet = null;
  914. activeScarlet = null;
  915. weakScarlet = (L2GrandBossInstance) addSpawn(29046, _Scarlet_x, _Scarlet_y, _Scarlet_z, _Scarlet_h, false, 0);
  916. weakScarlet.setInstanceId(currentInstanceID);
  917. weakScarlet.setIsInvul(true);
  918. weakScarlet.setIsImmobilized(true);
  919. weakScarlet.disableAllSkills();
  920. weakScarlet.setRHandId(7903);
  921. _Zone.updateKnownList(weakScarlet);
  922.  
  923. startQuestTimer("morph_07", 7000, frintezza, null);
  924. _TimerControl.add("morph_07");
  925. }
  926. else if (event.equalsIgnoreCase("morph_07"))
  927. {
  928. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  929. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 500, 70, 15, 3000, 10000, 0, 0, 1, 0));
  930. startQuestTimer("morph_08", 3000, frintezza, null);
  931. _TimerControl.add("morph_08");
  932. }
  933. else if (event.equalsIgnoreCase("morph_08"))
  934. {
  935. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 2500, 90, 12, 6000, 10000, 0, 0, 1, 0));
  936. startQuestTimer("morph_09", 3000, frintezza, null);
  937. _TimerControl.add("morph_09");
  938. }
  939. else if (event.equalsIgnoreCase("morph_09"))
  940. {
  941. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(), 250, _Angle, 12, 0, 1000, 0, 0, 1, 0));
  942. startQuestTimer("morph_10", 0, weakScarlet, null);
  943. _TimerControl.add("morph_10");
  944. }
  945. else if (event.equalsIgnoreCase("morph_10"))
  946. {
  947. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(), 250, _Angle, 12, 0, 10000, 0, 0, 1, 0));
  948. startQuestTimer("morph_11", 500, weakScarlet, null);
  949. _TimerControl.add("morph_11");
  950. }
  951. else if (event.equalsIgnoreCase("morph_11"))
  952. {
  953. weakScarlet.doDie(weakScarlet);
  954. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(), 450, _Angle, 14, 8000, 8000, 0, 0, 1, 0));
  955.  
  956. startQuestTimer("morph_12", 6250, weakScarlet, null);
  957. _TimerControl.add("morph_12");
  958. startQuestTimer("morph_13", 7200, weakScarlet, null);
  959. _TimerControl.add("morph_13");
  960. }
  961. else if (event.equalsIgnoreCase("morph_12"))
  962. {
  963. weakScarlet.deleteMe();
  964. weakScarlet = null;
  965. }
  966. else if (event.equalsIgnoreCase("morph_13"))
  967. {
  968. strongScarlet = (L2GrandBossInstance) addSpawn(SCARLET2, reverseXFix(_Scarlet_x), reverseYFix(_Scarlet_y), reverseZFix(_Scarlet_z), _Scarlet_h, false, 0);
  969. strongScarlet.setInstanceId(currentInstanceID);
  970. strongScarlet.setIsInvul(true);
  971. strongScarlet.setIsImmobilized(true);
  972. strongScarlet.disableAllSkills();
  973. _Zone.updateKnownList(strongScarlet);
  974. activeScarlet = strongScarlet;
  975.  
  976. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(), 450, _Angle, 12, 500, 14000, 0, 0, 1, 0));
  977.  
  978. startQuestTimer("morph_14", 3000, strongScarlet, null);
  979. _TimerControl.add("morph_14");
  980. startQuestTimer("loc_check", 60000, strongScarlet, null, true);
  981. _TimerControl.add("loc_check");
  982. }
  983. else if (event.equalsIgnoreCase("morph_14"))
  984. {
  985. startQuestTimer("morph_15", 5100, strongScarlet, null);
  986. _TimerControl.add("morph_15");
  987. }
  988. else if (event.equalsIgnoreCase("morph_15"))
  989. {
  990. _Zone.broadcastPacket(new SocialAction(strongScarlet, 2));
  991. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  992. if (skill != null)
  993. skill.getEffects(strongScarlet, strongScarlet);
  994.  
  995. startQuestTimer("morph_end", 9000, strongScarlet, null);
  996. _TimerControl.add("morph_end");
  997. startQuestTimer("start_pc", 6000, strongScarlet, null);
  998. _TimerControl.add("start_pc");
  999. startQuestTimer("start_npc", 6000, strongScarlet, null);
  1000. _TimerControl.add("start_npc");
  1001. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  1002. _TimerControl.add("songs_play");
  1003. startQuestTimer("skill03", 10000 + Rnd.get(10000), strongScarlet, null);
  1004. _TimerControl.add("skill03");
  1005. }
  1006. else if (event.equalsIgnoreCase("morph_16"))
  1007. {
  1008. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(), 300, _Angle - 180, 5, 0, 7000, 0, 0, 1, 0));
  1009. startQuestTimer("morph_17", 0, strongScarlet, null);
  1010. _TimerControl.add("morph_17");
  1011. }
  1012. else if (event.equalsIgnoreCase("morph_17"))
  1013. {
  1014. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(), 200, _Angle, 85, 4000, 10000, 0, 0, 1, 0));
  1015. startQuestTimer("morph_17b", 7400, frintezza, null);
  1016. _TimerControl.add("morph_17b");
  1017. startQuestTimer("morph_18", 7500, frintezza, null);
  1018. _TimerControl.add("morph_18");
  1019. }
  1020. else if (event.equalsIgnoreCase("morph_17b"))
  1021. {
  1022. frintezza.doDie(frintezza);
  1023. }
  1024. else if (event.equalsIgnoreCase("morph_18"))
  1025. {
  1026. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 100, 120, 5, 0, 7000, 0, 0, 1, 0));
  1027. startQuestTimer("morph_19", 0, frintezza, null);
  1028. _TimerControl.add("morph_19");
  1029. }
  1030. else if (event.equalsIgnoreCase("morph_19"))
  1031. {
  1032. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 100, 90, 5, 5000, 15000, 0, 0, 1, 0));
  1033. startQuestTimer("morph_20", 7000, frintezza, null);
  1034. _TimerControl.add("morph_20");
  1035. startQuestTimer("spawn_cubes", 7000, frintezza, null);
  1036. _TimerControl.add("spawn_cubes");
  1037. }
  1038. else if (event.equalsIgnoreCase("morph_20"))
  1039. {
  1040. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(), 900, 90, 25, 7000, 10000, 0, 0, 1, 0));
  1041. startQuestTimer("start_pc", 7000, frintezza, null);
  1042. _TimerControl.add("start_pc");
  1043. }
  1044. else if (event.equalsIgnoreCase("songs_play"))
  1045. {
  1046. if (frintezza != null && !frintezza.isDead() && _OnMorph == 0)
  1047. {
  1048. _OnSong = Rnd.get(1, 5);
  1049. if (_OnSong == 1 && _ThirdMorph == 1 && strongScarlet.getCurrentHp() < strongScarlet.getMaxHp() * 0.6 && Rnd.get(100) < 80)
  1050. {
  1051. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 1, 32000, 0));
  1052. startQuestTimer("songs_effect", 5000, frintezza, null);
  1053. _TimerControl.add("songs_effect");
  1054. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  1055. _TimerControl.add("songs_play");
  1056. }
  1057. else if (_OnSong == 2 || _OnSong == 3)
  1058. {
  1059. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, _OnSong, 32000, 0));
  1060. startQuestTimer("songs_effect", 5000, frintezza, null);
  1061. _TimerControl.add("songs_effect");
  1062. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  1063. _TimerControl.add("songs_play");
  1064. }
  1065. else if (_OnSong == 4 && _SecondMorph == 1)
  1066. {
  1067. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 4, 31000, 0));
  1068. startQuestTimer("songs_effect", 5000, frintezza, null);
  1069. _TimerControl.add("songs_effect");
  1070. startQuestTimer("songs_play", 31000 + Rnd.get(10000), frintezza, null);
  1071. _TimerControl.add("songs_play");
  1072. }
  1073. else if (_OnSong == 5 && _ThirdMorph == 1 && _Abnormal == 0)
  1074. {
  1075. _Abnormal = 1;
  1076. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 5, 35000, 0));
  1077. startQuestTimer("songs_effect", 5000, frintezza, null);
  1078. _TimerControl.add("songs_effect");
  1079. startQuestTimer("songs_play", 35000 + Rnd.get(10000), frintezza, null);
  1080. _TimerControl.add("songs_play");
  1081. }
  1082. else
  1083. {
  1084. startQuestTimer("songs_play", 5000 + Rnd.get(5000), frintezza, null);
  1085. _TimerControl.add("songs_play");
  1086. }
  1087. }
  1088. }
  1089. else if (event.equalsIgnoreCase("songs_effect"))
  1090. {
  1091. L2Skill skill = SkillTable.getInstance().getInfo(5008, _OnSong);
  1092. if (skill == null)
  1093. return null;
  1094.  
  1095. if (_OnSong == 1 || _OnSong == 2 || _OnSong == 3)
  1096. {
  1097. if (frintezza != null && !frintezza.isDead() && activeScarlet != null && !activeScarlet.isDead())
  1098. skill.getEffects(frintezza, activeScarlet);
  1099. }
  1100. else if (_OnSong == 4)
  1101. {
  1102. for (L2Character cha : _Zone.getCharactersInside().values())
  1103. {
  1104. if (cha instanceof L2PcInstance && Rnd.get(100) < 80)
  1105. {
  1106. skill.getEffects(frintezza, cha);
  1107. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 4));
  1108. }
  1109. }
  1110. }
  1111. else if (_OnSong == 5)
  1112. {
  1113. for (L2Character cha : _Zone.getCharactersInside().values())
  1114. {
  1115. if (cha instanceof L2PcInstance && Rnd.get(100) < 70)
  1116. {
  1117. cha.abortAttack();
  1118. cha.abortCast();
  1119. cha.disableAllSkills();
  1120. cha.stopMove(null);
  1121. cha.setIsParalyzed(true);
  1122. cha.setIsImmobilized(true);
  1123. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1124. skill.getEffects(frintezza, cha);
  1125. cha.startAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1126. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 5));
  1127. }
  1128. }
  1129. startQuestTimer("stop_effect", 25000, frintezza, null);
  1130. _TimerControl.add("stop_effect");
  1131. }
  1132. }
  1133. else if (event.equalsIgnoreCase("stop_effect"))
  1134. {
  1135. for (L2Character cha : _Zone.getCharactersInside().values())
  1136. {
  1137. if (cha instanceof L2PcInstance)
  1138. {
  1139. cha.stopAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1140. cha.stopAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1141. cha.enableAllSkills();
  1142. cha.setIsImmobilized(false);
  1143. cha.setIsParalyzed(false);
  1144. }
  1145. }
  1146. _Abnormal = 0;
  1147. }
  1148. else if (event.equalsIgnoreCase("attack_stop"))
  1149. {
  1150. cancelQuestTimers("skill01");
  1151. _TimerControl.remove("skill01");
  1152. cancelQuestTimers("skill02");
  1153. _TimerControl.remove("skill02");
  1154. cancelQuestTimers("skill03");
  1155. _TimerControl.remove("skill03");
  1156. cancelQuestTimers("songs_play");
  1157. _TimerControl.remove("songs_play");
  1158. cancelQuestTimers("songs_effect");
  1159. _TimerControl.remove("songs_effect");
  1160.  
  1161. if (frintezza != null)
  1162. _Zone.broadcastPacket(new MagicSkillCanceld(frintezza.getObjectId()));
  1163. }
  1164. else if (event.equalsIgnoreCase("check_hp"))
  1165. {
  1166. if (npc.isDead())
  1167. {
  1168. _OnMorph = 1;
  1169. _Zone.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
  1170.  
  1171. startQuestTimer("attack_stop", 0, frintezza, null);
  1172. _TimerControl.add("attack_stop");
  1173. startQuestTimer("stop_pc", 0, npc, null);
  1174. _TimerControl.add("stop_npc");
  1175. startQuestTimer("stop_npc", 0, npc, null);
  1176. _TimerControl.add("stop_npc");
  1177. startQuestTimer("morph_16", 0, npc, null);
  1178. _TimerControl.add("morph_16");
  1179. }
  1180. else
  1181. {
  1182. _CheckDie = _CheckDie + 10;
  1183. if (_CheckDie < 3000)
  1184. startQuestTimer("check_hp", 10, npc, null);
  1185. else
  1186. {
  1187. _OnCheck = 0;
  1188. _CheckDie = 0;
  1189. }
  1190. }
  1191. }
  1192. else if (event.equalsIgnoreCase("skill01"))
  1193. {
  1194. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0)
  1195. {
  1196. int i = Rnd.get(0, 1);
  1197. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0], _skill[i][1]);
  1198. if (skill != null)
  1199. {
  1200. weakScarlet.stopMove(null);
  1201. weakScarlet.setIsCastingNow(true);
  1202. weakScarlet.doCast(skill);
  1203. }
  1204. startQuestTimer("skill01", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1205. _TimerControl.add("skill01");
  1206. }
  1207. }
  1208. else if (event.equalsIgnoreCase("skill02"))
  1209. {
  1210. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0)
  1211. {
  1212. int i = 0;
  1213. if (_Abnormal == 0)
  1214. i = Rnd.get(2, 5);
  1215. else
  1216. i = Rnd.get(2, 4);
  1217.  
  1218. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0], _skill[i][1]);
  1219. if (skill != null)
  1220. {
  1221. weakScarlet.stopMove(null);
  1222. weakScarlet.setIsCastingNow(true);
  1223. weakScarlet.doCast(skill);
  1224. }
  1225. startQuestTimer("skill02", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1226. _TimerControl.add("skill02");
  1227.  
  1228. if (i == 5)
  1229. {
  1230. _Abnormal = 1;
  1231. startQuestTimer("float_effect", 4000, weakScarlet, null);
  1232. _TimerControl.add("float_effect");
  1233. }
  1234. }
  1235. }
  1236. else if (event.equalsIgnoreCase("skill03"))
  1237. {
  1238. if (strongScarlet != null && !strongScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 1 && _OnMorph == 0)
  1239. {
  1240. int i = 0;
  1241. if (_Abnormal == 0)
  1242. i = Rnd.get(6, 10);
  1243. else
  1244. i = Rnd.get(6, 9);
  1245.  
  1246. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0], _skill[i][1]);
  1247. if (skill != null)
  1248. {
  1249. strongScarlet.stopMove(null);
  1250. strongScarlet.setIsCastingNow(true);
  1251. strongScarlet.doCast(skill);
  1252. }
  1253. startQuestTimer("skill03", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1254. _TimerControl.add("skill03");
  1255.  
  1256. if (i == 10)
  1257. {
  1258. _Abnormal = 1;
  1259. startQuestTimer("float_effect", 3000, npc, null);
  1260. _TimerControl.add("float_effect");
  1261. }
  1262. }
  1263. }
  1264. else if (event.equalsIgnoreCase("float_effect"))
  1265. {
  1266. if (npc.isCastingNow())
  1267. {
  1268. startQuestTimer("float_effect", 500, npc, null);
  1269. _TimerControl.add("float_effect");
  1270. }
  1271. else
  1272. {
  1273. for (L2Character cha : _Zone.getCharactersInside().values())
  1274. {
  1275. if (cha instanceof L2PcInstance)
  1276. {
  1277. if (cha.getFirstEffect(5016) != null)
  1278. {
  1279. cha.abortAttack();
  1280. cha.abortCast();
  1281. cha.disableAllSkills();
  1282. cha.stopMove(null);
  1283. cha.setIsParalyzed(true);
  1284. cha.setIsImmobilized(true);
  1285. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1286. cha.startAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1287. }
  1288. }
  1289. }
  1290. startQuestTimer("stop_effect", 25000, npc, null);
  1291. _TimerControl.add("stop_effect");
  1292. }
  1293. }
  1294. else if (event.equalsIgnoreCase("action"))
  1295. {
  1296. _Zone.broadcastPacket(new SocialAction(npc, 1));
  1297. }
  1298. else if (event.equalsIgnoreCase("bomber"))
  1299. {
  1300. _Bomber = 0;
  1301. }
  1302. else if (event.equalsIgnoreCase("room_final"))
  1303. {
  1304. _Zone.broadcastPacket(new NpcSay(npc.getObjectId(), 1, npc.getNpcId(), "Exceeded his time limit, challenge failed!"));
  1305. for(L2PcInstance PlayerInsideTezza : _PlayersInside)
  1306. PlayerInsideTezza.setInstanceId(0);
  1307. _Zone.oustAllPlayers();
  1308.  
  1309. cancelQuestTimers("waiting");
  1310. _TimerControl.remove("waiting");
  1311. cancelQuestTimers("frintezza_despawn");
  1312. _TimerControl.remove("frintezza_despawn");
  1313. startQuestTimer("clean", 1000, npc, null);
  1314.  
  1315. _TimerControl.add("clean");
  1316. startQuestTimer("close", 1000, npc, null);
  1317. _TimerControl.add("close");
  1318. startQuestTimer("room1_del", 1000, npc, null);
  1319. _TimerControl.add("room1_del");
  1320. startQuestTimer("room2_del", 1000, npc, null);
  1321. _TimerControl.add("room2_del");
  1322. startQuestTimer("destroy_instance", 30000, npc, null);
  1323. _TimerControl.add("destroy_instance");
  1324. }
  1325. else if (event.equalsIgnoreCase("all_dead_frintezza_despawn"))
  1326. {
  1327. temp = (System.currentTimeMillis() - _LastAction);
  1328. if (temp > 30000)
  1329. {
  1330. for(L2PcInstance PlayerInsideTezza : _PlayersInside)
  1331. {
  1332. PlayerInsideTezza.setInstanceId(0);
  1333. PlayerInsideTezza.removeNotifyQuestOfDeath(st);
  1334. }
  1335. _Zone.oustAllPlayers();
  1336. cancelQuestTimers("all_dead_frintezza_despawn");
  1337. _TimerControl.remove("all_dead_frintezza_despawn");
  1338. cancelQuestTimers("waiting");
  1339. _TimerControl.remove("waiting");
  1340. cancelQuestTimers("loc_check");
  1341. _TimerControl.remove("loc_check");
  1342. cancelQuestTimers("room_final");
  1343. _TimerControl.remove("room_final");
  1344. cancelQuestTimers("spawn_minion");
  1345. _TimerControl.remove("spawn_minion");
  1346. startQuestTimer("clean", 1000, npc, null);
  1347. _TimerControl.add("clean");
  1348. startQuestTimer("close", 1000, npc, null);
  1349. _TimerControl.add("close");
  1350. startQuestTimer("attack_stop", 1000, npc, null);
  1351. _TimerControl.add("attack_stop");
  1352. startQuestTimer("room1_del", 1000, npc, null);
  1353. _TimerControl.add("room1_del");
  1354. startQuestTimer("room2_del", 1000, npc, null);
  1355. _TimerControl.add("room2_del");
  1356. startQuestTimer("room3_del", 1000, npc, null);
  1357. _TimerControl.add("room3_del");
  1358. startQuestTimer("minions_despawn", 1000, npc, null);
  1359. _TimerControl.add("minions_despawn");
  1360. startQuestTimer("destroy_instance", 30000, npc, null);
  1361. _TimerControl.add("destroy_instance");
  1362.  
  1363. }
  1364. }
  1365. else if (event.equalsIgnoreCase("frintezza_despawn"))
  1366. {
  1367. temp = (System.currentTimeMillis() - _LastAction);
  1368. if (temp > 900000)
  1369. {
  1370. for(L2PcInstance PlayerInsideTezza : _PlayersInside)
  1371. {
  1372. PlayerInsideTezza.setInstanceId(0);
  1373. PlayerInsideTezza.removeNotifyQuestOfDeath(st);
  1374. }
  1375. _Zone.oustAllPlayers();
  1376. cancelQuestTimers("frintezza_despawn");
  1377. _TimerControl.remove("frintezza_despawn");
  1378. cancelQuestTimers("waiting");
  1379. _TimerControl.remove("waiting");
  1380. cancelQuestTimers("loc_check");
  1381. _TimerControl.remove("loc_check");
  1382. cancelQuestTimers("room_final");
  1383. _TimerControl.remove("room_final");
  1384. cancelQuestTimers("spawn_minion");
  1385. _TimerControl.remove("spawn_minion");
  1386. startQuestTimer("clean", 1000, npc, null);
  1387. _TimerControl.add("clean");
  1388. startQuestTimer("close", 1000, npc, null);
  1389. _TimerControl.add("close");
  1390. startQuestTimer("attack_stop", 1000, npc, null);
  1391. _TimerControl.add("attack_stop");
  1392. startQuestTimer("room1_del", 1000, npc, null);
  1393. _TimerControl.add("room1_del");
  1394. startQuestTimer("room2_del", 1000, npc, null);
  1395. _TimerControl.add("room2_del");
  1396. startQuestTimer("room3_del", 1000, npc, null);
  1397. _TimerControl.add("room3_del");
  1398. startQuestTimer("minions_despawn", 1000, npc, null);
  1399. _TimerControl.add("minions_despawn");
  1400. startQuestTimer("destroy_instance", 30000, npc, null);
  1401. _TimerControl.add("destroy_instance");
  1402. }
  1403. }
  1404. else if (event.equalsIgnoreCase("minions_despawn"))
  1405. {
  1406. for (int i = 0; i < Minions.size(); i++)
  1407. {
  1408. L2Attackable mob = Minions.get(i);
  1409. if (mob != null)
  1410. mob.decayMe();
  1411. }
  1412. if(!Minions.isEmpty())
  1413. Minions.clear();
  1414. }
  1415. else if (event.equalsIgnoreCase("spawn_minion"))
  1416. {
  1417. if (npc != null && !npc.isDead() && frintezza != null && !frintezza.isDead())
  1418. {
  1419. L2Attackable mob = (L2Attackable) addSpawn(npc.getNpcId() + 2, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0);
  1420. if(mob != null)
  1421. {
  1422. mob.setInstanceId(currentInstanceID);
  1423. mob.setIsRaidMinion(true);
  1424. Minions.add(mob);
  1425.  
  1426. startQuestTimer("action", 200, mob, null);
  1427. _TimerControl.add("action");
  1428. startQuestTimer("spawn_minion", 18000, npc, null);
  1429. _TimerControl.add("spawn_minion");
  1430. }
  1431. }
  1432. }
  1433. else if (event.equalsIgnoreCase("spawn_cubes"))
  1434. {
  1435. CubeControl = addSpawn(CUBE, 174232, -88020, -5114, 16384, false, 900000);
  1436. CubeControl.setInstanceId(currentInstanceID);
  1437. startQuestTimer("frintezza_despawn", 60000, null, null, true);
  1438. _TimerControl.add("frintezza_despawn");
  1439. }
  1440. else if (event.equalsIgnoreCase("remove_players"))
  1441. {
  1442. for(L2PcInstance PlayerInsideTezza : _PlayersInside)
  1443. PlayerInsideTezza.setInstanceId(0);
  1444. _Zone.oustAllPlayers();
  1445.  
  1446. }else if (event.equalsIgnoreCase("destroy_instance"))
  1447. {
  1448. if(debugMSG)
  1449. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", "Tezza's entrance is opened."));
  1450. InstanceManager.getInstance().destroyInstance(currentInstanceID);
  1451. for(String timer : _TimerControl)
  1452. cancelQuestTimers(timer);
  1453. _TimerControl.clear();
  1454.  
  1455. CurrentStatus = DORMANT;
  1456. }
  1457.  
  1458. return super.onAdvEvent(event, npc, player);
  1459. }
  1460.  
  1461. @Override
  1462. public String onTalk(L2Npc npc, L2PcInstance player)
  1463. {
  1464. if (npc.getNpcId() == CUBE)
  1465. {
  1466. int x = 150037 + Rnd.get(500);
  1467. int y = -57720 + Rnd.get(500);
  1468. player.removeNotifyQuestOfDeath(st);
  1469. player.setInstanceId(0);
  1470. player.teleToLocation(x, y, -2976);
  1471.  
  1472. if(!_PlayersInside.isEmpty())
  1473. _PlayersInside.remove(player);
  1474.  
  1475. if(_PlayersInside.isEmpty())
  1476. startQuestTimer("destroy_instance", 30000, npc, null);
  1477. _TimerControl.add("destroy_instance");
  1478.  
  1479. return null;
  1480. }
  1481. if(CurrentStatus != DORMANT)
  1482. return "<html><body>Someone is already inside instance. Try again later.</body></html>";
  1483.  
  1484. st = player.getQuestState(getName());
  1485.  
  1486.  
  1487. if (player.getParty() == null || player.getParty().getCommandChannel() == null || player.getParty().getCommandChannel().getChannelLeader() != player)
  1488. return "<html><body>I speak only with command channel leader.</body></html>";
  1489.  
  1490. if (player.getParty().getCommandChannel().getMemberCount() < 36 || player.getParty().getCommandChannel().getMemberCount() > 45)
  1491. return "<html><body>Your command channel have incorrect size. You need between 36 and 45 players.</body></html>";
  1492.  
  1493. if (player.getInventory().getItemByItemId(8073) == null)
  1494. return "<html><body>You dont have required item.</body></html>";
  1495.  
  1496. L2CommandChannel CC = player.getParty().getCommandChannel();
  1497. for (L2Party _party : CC.getPartys())
  1498. {
  1499. if (_party == null)
  1500. continue;
  1501. for (L2PcInstance _member : _party.getPartyMembers())
  1502. {
  1503. if (_member == null)
  1504. continue;
  1505.  
  1506. if (_member.getLevel() < 80)
  1507. return "<html><body>Player " + _member.getName() + " have too low level. Minimum level required is 80.</body></html>";
  1508. if (!Util.checkIfInRange(1000, player, _member, false))
  1509. return "<html><body>" + _member.getName() + " is not near NPC.</body></html>";
  1510.  
  1511. Long reentertime = InstanceManager.getInstance().getInstanceTime(_member.getObjectId(), INSTANCEID);
  1512. if (System.currentTimeMillis() < reentertime)
  1513. {
  1514. return "<html><body>" + _member.getName() + " may not reenter yet.</body></html>";
  1515. }
  1516.  
  1517. }
  1518. }
  1519. ClearVariables();
  1520. currentInstanceID = InstanceManager.getInstance().createDynamicInstance("Frintezza.xml");
  1521.  
  1522. if(debugMSG)
  1523. {
  1524. if(player.getClan() != null)
  1525. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", player.getClan()+" clan with leader "+player.getName()+" entered to tezza."));
  1526. else
  1527. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", "CC leader "+player.getName()+" without clan entered to tezza."));
  1528. }
  1529.  
  1530. player.destroyItemByItemId("Quest", 8073, 1, player, true);
  1531. CurrentStatus = WAITING;
  1532.  
  1533. startQuestTimer("close", 0, npc, null);
  1534. _TimerControl.add("close");
  1535. startQuestTimer("room1_spawn", 5000, npc, null);
  1536. _TimerControl.add("room1_spawn");
  1537. startQuestTimer("room_final", 2100000, npc, null);
  1538. _TimerControl.add("room_final");
  1539. startQuestTimer("frintezza_despawn", 60000, npc, null, true);
  1540. _TimerControl.add("frintezza_despawn");
  1541.  
  1542. _LastAction = System.currentTimeMillis();
  1543. for (L2Party party : CC.getPartys())
  1544. {
  1545. if (party == null)
  1546. continue;
  1547. for (L2PcInstance member : party.getPartyMembers())
  1548. {
  1549. _PlayersInside.add(member);
  1550. _Zone.allowPlayerEntry(member, 300);
  1551. member.addNotifyQuestOfDeath(st);
  1552. member.setInstanceId(currentInstanceID);
  1553. member.teleToLocation(getXFix(_invadeLoc[_LocCycle][0]) + Rnd.get(50), getYFix(_invadeLoc[_LocCycle][1]) + Rnd.get(50), getZFix(_invadeLoc[_LocCycle][2]));
  1554. }
  1555. _LocCycle++;
  1556. if (_LocCycle >= 6)
  1557. _LocCycle = 1;
  1558. }
  1559.  
  1560. setInstanceTimeRestrictions();
  1561. _log.log(Level.INFO, "Frintezza's instance with ID "+currentInstanceID+" has been created by player "+player.getName());
  1562. return "";
  1563. }
  1564.  
  1565. private void ClearVariables()
  1566. {
  1567. if(!_PlayersInside.isEmpty())
  1568. _PlayersInside.clear();
  1569. if(!_TimerControl.isEmpty())
  1570. _TimerControl.clear();
  1571. _KillHallAlarmDevice = 0;
  1572. _KillDarkChoirPlayer = 0;
  1573. _KillDarkChoirCaptain = 0;
  1574. currentInstanceID = 0;
  1575. _LastAction = 0;
  1576. _LocCycle = 0;
  1577. _CheckDie = 0;
  1578. _OnCheck = 0;
  1579. _Abnormal = 0;
  1580. _OnMorph = 0;
  1581. _SecondMorph = 0;
  1582. _ThirdMorph = 0;
  1583. }
  1584.  
  1585. @Override
  1586. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
  1587. {
  1588. _LastAction = System.currentTimeMillis();
  1589. if (npc.getNpcId() == FRINTEZZA)
  1590. {
  1591. npc.setCurrentHpMp(npc.getMaxHp(), 0);
  1592. return null;
  1593. }
  1594.  
  1595. if (npc.getNpcId() == SCARLET1 && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.75 && CurrentStatus == FIGHTING)
  1596. {
  1597. startQuestTimer("attack_stop", 0, frintezza, null);
  1598. _TimerControl.add("attack_stop");
  1599.  
  1600. _SecondMorph = 1;
  1601. _OnMorph = 1;
  1602.  
  1603. startQuestTimer("stop_pc", 1000, npc, null);
  1604. _TimerControl.add("stop_pc");
  1605. startQuestTimer("stop_npc", 1000, npc, null);
  1606. _TimerControl.add("stop_npc");
  1607. startQuestTimer("morph_01", 1100, npc, null);
  1608. _TimerControl.add("morph_01");
  1609. }
  1610. else if (npc.getNpcId() == SCARLET1 && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.5 && CurrentStatus == FIGHTING)
  1611. {
  1612. startQuestTimer("attack_stop", 0, frintezza, null);
  1613. _TimerControl.add("attack_stop");
  1614.  
  1615. _ThirdMorph = 1;
  1616. _OnMorph = 1;
  1617.  
  1618. startQuestTimer("stop_pc", 2000, npc, null);
  1619. _TimerControl.add("stop_pc");
  1620. startQuestTimer("stop_npc", 2000, npc, null);
  1621. _TimerControl.add("stop_npc");
  1622. startQuestTimer("morph_05a", 2000, npc, null);
  1623. _TimerControl.add("morph_05a");
  1624. startQuestTimer("morph_05", 2100, npc, null);
  1625. _TimerControl.add("morph_05");
  1626. }
  1627. else if (npc.getNpcId() == SCARLET2 && _SecondMorph == 1 && _ThirdMorph == 1 && _OnCheck == 0 && damage >= npc.getCurrentHp() && CurrentStatus == FIGHTING)
  1628. {
  1629. _OnCheck = 1;
  1630. startQuestTimer("check_hp", 0, npc, null);
  1631. _TimerControl.add("check_hp");
  1632. }
  1633. else if ((npc.getNpcId() == 29050 || npc.getNpcId() == 29051) && _Bomber == 0)
  1634. {
  1635. if (npc.getCurrentHp() < npc.getMaxHp() * 0.1)
  1636. {
  1637. if (Rnd.get(100) < 30)
  1638. {
  1639. _Bomber = 1;
  1640. startQuestTimer("bomber", 3000, npc, null);
  1641. _TimerControl.add("bomber");
  1642.  
  1643. L2Skill skill = SkillTable.getInstance().getInfo(5011, 1);
  1644. if (skill != null)
  1645. {
  1646. npc.setIsCastingNow(true);
  1647. npc.doCast(skill);
  1648. }
  1649. }
  1650. }
  1651. }
  1652.  
  1653. return super.onAttack(npc, attacker, damage, isPet);
  1654. }
  1655.  
  1656. @Override
  1657. public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  1658. {
  1659. if (npc.getNpcId() == FRINTEZZA)
  1660. {
  1661. return null;
  1662. }
  1663. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 0 && CurrentStatus == FIGHTING)
  1664. {
  1665. _OnCheck = 1;
  1666. startQuestTimer("stop_pc", 0, npc, null);
  1667. _TimerControl.add("stop_pc");
  1668. startQuestTimer("stop_npc", 0, npc, null);
  1669. _TimerControl.add("stop_npc");
  1670. startQuestTimer("morph_16", 0, npc, null);
  1671. _TimerControl.add("morph_16");
  1672. }
  1673. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 1 && CurrentStatus == FIGHTING)
  1674. {
  1675. cancelQuestTimers("loc_check");
  1676. _TimerControl.remove("loc_check");
  1677. cancelQuestTimers("spawn_minion");
  1678. _TimerControl.remove("spawn_minion");
  1679. cancelQuestTimers("frintezza_despawn");
  1680. _TimerControl.remove("frintezza_despawn");
  1681. startQuestTimer("clean", 30000, npc, null);
  1682. _TimerControl.add("clean");
  1683. startQuestTimer("close", 30000, npc, null);
  1684. _TimerControl.add("close");
  1685. startQuestTimer("room3_del", 60000, npc, null);
  1686. _TimerControl.add("room3_del");
  1687. startQuestTimer("minions_despawn", 60000, npc, null);
  1688. _TimerControl.add("minions_despawn");
  1689. startQuestTimer("remove_players", 900000, npc, null);
  1690. _TimerControl.add("remove_players");
  1691. startQuestTimer("destroy_instance", 900001, npc, null);
  1692. _TimerControl.add("destroy_instance");
  1693. }
  1694. else if (npc.getNpcId() == 18328)
  1695. {
  1696. _KillHallAlarmDevice++;
  1697. if (_KillHallAlarmDevice == 4)
  1698. {
  1699. startQuestTimer("room1_del", 100, npc, null);
  1700. _TimerControl.add("room1_del");
  1701. startQuestTimer("room2_spawn", 100, npc, null);
  1702. _TimerControl.add("room2_spawn");
  1703.  
  1704. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).openMe();
  1705. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).openMe();
  1706. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1707. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1708. for (int i = 17130051; i <= 17130058; i++)
  1709. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1710. }
  1711. }
  1712. else if (npc.getNpcId() == 18339)
  1713. {
  1714. _KillDarkChoirPlayer++;
  1715. if (_KillDarkChoirPlayer == 2)
  1716. {
  1717. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  1718. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  1719. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  1720. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  1721. int outside = 0;
  1722. for (L2PcInstance room2_pc : _PlayersInside)
  1723. {
  1724. if (_Zone.isInsideZone(room2_pc) && room2_pc.getY() > getYFix(-86130))
  1725. outside++;
  1726. }
  1727. if (outside == 0)
  1728. {
  1729. startQuestTimer("room2_del", 100, npc, null);
  1730. _TimerControl.add("room2_del");
  1731. startQuestTimer("waiting", 180000, npc, null);
  1732. _TimerControl.add("waiting");
  1733. cancelQuestTimers("room_final");
  1734. _TimerControl.remove("room_final");
  1735. }
  1736. else
  1737. {
  1738. for (int i = 17130061; i <= 17130070; i++)
  1739. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1740.  
  1741. startQuestTimer("room2_spawn2", 1000, npc, null);
  1742. _TimerControl.add("room2_spawn2");
  1743. }
  1744. }
  1745. }
  1746. else if (npc.getNpcId() == 18334)
  1747. {
  1748. _KillDarkChoirCaptain++;
  1749. if (_KillDarkChoirCaptain == 8)
  1750. {
  1751. startQuestTimer("room2_del", 100, npc, null);
  1752. _TimerControl.add("room2_del");
  1753.  
  1754. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1755. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1756.  
  1757. startQuestTimer("waiting", 180000, npc, null);
  1758. _TimerControl.add("waiting");
  1759. cancelQuestTimers("room_final");
  1760. _TimerControl.remove("room_final");
  1761. }
  1762. }
  1763.  
  1764. return super.onKill(npc, killer, isPet);
  1765. }
  1766.  
  1767. @Override
  1768. public String onDeath(L2Character killer, L2Character victim, QuestState qs)
  1769. {
  1770. for(L2PcInstance player : _PlayersInside)
  1771. if(!player.isDead())
  1772. return "";
  1773. _log.log(Level.INFO, "Everyone inside Frintezza are dead. Closing instance in 30s.");
  1774. for(L2PcInstance playerInside : _PlayersInside)
  1775. playerInside.removeNotifyQuestOfDeath(st);
  1776.  
  1777. if(debugMSG)
  1778. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", "Attemp to kill Tezza failed"));
  1779.  
  1780. startQuestTimer("all_dead_frintezza_despawn", 1000, null, null, true);
  1781. _TimerControl.add("all_dead_frintezza_despawn");
  1782. return super.onDeath(killer, victim, qs);
  1783. }
  1784.  
  1785.  
  1786.  
  1787. /**
  1788. * Override spawn method to correct spawn cords after lair move<BR>
  1789. * TODO: Update cords in script, im just lazy :)
  1790. */
  1791. @Override
  1792. public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
  1793. {
  1794. // cords fix:
  1795. return super.addSpawn(npcId, getXFix(x), getYFix(y), getZFix(z), heading, randomOffset, despawnDelay, isSummonSpawn, instanceId);
  1796. }
  1797.  
  1798. public int getXFix(int x)
  1799. {
  1800. return x - 262016;
  1801. }
  1802.  
  1803. public int getYFix(int y)
  1804. {
  1805. return y - 65278;
  1806. }
  1807.  
  1808. public int getZFix(int z)
  1809. {
  1810. return z - 4065;
  1811. }
  1812.  
  1813. public int reverseXFix(int x)
  1814. {
  1815. return x + 262016;
  1816. }
  1817.  
  1818. public int reverseYFix(int y)
  1819. {
  1820. return y + 65278;
  1821. }
  1822.  
  1823. public int reverseZFix(int z)
  1824. {
  1825. return z + 4065;
  1826. }
  1827.  
  1828. ///
  1829.  
  1830. protected void setInstanceTimeRestrictions()
  1831. {
  1832. Calendar reenter = Calendar.getInstance();
  1833. reenter.set(Calendar.MINUTE, RESET_MIN);
  1834. reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
  1835. // if time is >= RESET_HOUR - roll to the next day
  1836. if (reenter.getTimeInMillis() <= System.currentTimeMillis())
  1837. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1838. if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
  1839. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
  1840. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1841. else
  1842. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
  1843. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1844.  
  1845. // set instance reenter time for all allowed players
  1846. for (L2PcInstance PlayerInside : _PlayersInside)
  1847. InstanceManager.getInstance().setInstanceTime(PlayerInside.getObjectId(), INSTANCEID, reenter.getTimeInMillis());
  1848. }
  1849.  
  1850. ///
  1851.  
  1852. public static void main(String[] args)
  1853. {
  1854. // now call the constructor (starts up the ai)
  1855. new Frintezza(-1, "Frintezza", "ai");
  1856. }
  1857. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement