Advertisement
horato

Frintezza.java

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