Advertisement
horato

Frintezza.java

Jul 26th, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.37 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. private static final int SCARLET1 = 29046;
  236. private static final int SCARLET2 = 29047;
  237. private static final int FRINTEZZA = 29045;
  238. private static final int GUIDE = 32011;
  239. private static final int CUBE = 29061;
  240.  
  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.  
  249. private static byte CurrentStatus = DORMANT;
  250.  
  251. private static long _LastAction = 0;
  252. private static int _Angle = 0;
  253. private static int _Heading = 0;
  254. private static int _LocCycle = 0;
  255. private static int _Bomber = 0;
  256. private static int _CheckDie = 0;
  257. private static int _OnCheck = 0;
  258. private static int _OnSong = 0;
  259. private static int _Abnormal = 0;
  260. private static int _OnMorph = 0;
  261. private static int _Scarlet_x = 0;
  262. private static int _Scarlet_y = 0;
  263. private static int _Scarlet_z = 0;
  264. private static int _Scarlet_h = 0;
  265. private static int _SecondMorph = 0;
  266. private static int _ThirdMorph = 0;
  267. private static int _KillHallAlarmDevice = 0;
  268. private static int _KillDarkChoirPlayer = 0;
  269. private static int _KillDarkChoirCaptain = 0;
  270.  
  271. private static QuestState st = null;
  272. private static boolean debugMSG = true;
  273.  
  274. private static L2BossZone _Zone;
  275. private L2GrandBossInstance frintezza, weakScarlet, strongScarlet, activeScarlet;
  276. private L2MonsterInstance demon1, demon2, demon3, demon4, portrait1, portrait2, portrait3, portrait4;
  277. private L2Npc _frintezzaDummy, _overheadDummy, _portraitDummy1, _portraitDummy3, _scarletDummy;
  278. private static List<L2PcInstance> _PlayersInside = new FastList<L2PcInstance>();
  279. private static List<L2Npc> _Room1Mobs = new FastList<L2Npc>();
  280. private static List<L2Npc> _Room2Mobs = new FastList<L2Npc>();
  281. private static List<L2Attackable> Minions = new FastList<L2Attackable>();
  282.  
  283. private static List<String> _TimerControl = new FastList<String>();
  284. // Initialization at 6:30 am on Wednesday and Saturday
  285. private static final int RESET_HOUR = 6;
  286. private static final int RESET_MIN = 30;
  287. private static final int RESET_DAY_1 = 4;
  288. private static final int RESET_DAY_2 = 7;
  289. private static int currentInstanceID = 0;
  290. private final static Logger _log = Logger.getLogger("FrintezzaInstance");
  291.  
  292. // Boss: Frintezza
  293. public Frintezza(int id, String name, String descr)
  294. {
  295. super(id,name,descr);
  296. int[] mob = {SCARLET1, SCARLET2, FRINTEZZA, 18328, 18329, 18330, 18331, 18332, 18333, 18334, 18335, 18336, 18337, 18338, 18339, 29048, 29049, 29050, 29051};
  297. _Zone = GrandBossManager.getInstance().getZone(getXFix(174232), getYFix(-88020), getZFix(-5116));
  298. registerMobs(mob);
  299. addStartNpc(GUIDE);
  300. addTalkId(GUIDE);
  301. addStartNpc(CUBE);
  302. addTalkId(CUBE);
  303.  
  304. /*
  305. //tempfix for messed door cords
  306. for (int i = 0; i < 8; i++)
  307. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130051 + i).setRange(0, 0, 0, 0, 0, 0);
  308. */
  309. }
  310.  
  311. @Override
  312. public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
  313. {
  314. long temp = 0;
  315. if (event.equalsIgnoreCase("waiting"))
  316. {
  317. startQuestTimer("close", 27000, npc, null);
  318. startQuestTimer("camera_1", 30000, npc, null);
  319. _Zone.broadcastPacket(new Earthquake(getXFix(174232), getYFix(-88020), getZFix(-5116), 45, 27));
  320. }
  321. else if (event.equalsIgnoreCase("room1_spawn"))
  322. {
  323. for (int i = 0; i <= 17; i++)
  324. {
  325. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  326. _Room1Mobs.add(mob);
  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. }
  336. }
  337. else if (event.equalsIgnoreCase("room1_spawn3"))
  338. {
  339. for (int i = 27; i <= 32; i++)
  340. {
  341. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  342. _Room1Mobs.add(mob);
  343. }
  344. }
  345. else if (event.equalsIgnoreCase("room1_spawn4"))
  346. {
  347. for (int i = 33; i <= 40; i++)
  348. {
  349. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  350. _Room1Mobs.add(mob);
  351. }
  352. }
  353. else if (event.equalsIgnoreCase("room2_spawn"))
  354. {
  355. for (int i = 41; i <= 44; i++)
  356. {
  357. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  358. _Room2Mobs.add(mob);
  359. }
  360. }
  361. else if (event.equalsIgnoreCase("room2_spawn2"))
  362. {
  363. for (int i = 45; i <= 131; i++)
  364. {
  365. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  366. _Room2Mobs.add(mob);
  367. }
  368. }
  369. else if (event.equalsIgnoreCase("room1_del"))
  370. {
  371. for (L2Npc mob : _Room1Mobs)
  372. {
  373. if (mob != null)
  374. mob.deleteMe();
  375. }
  376. _Room1Mobs.clear();
  377. }
  378. else if (event.equalsIgnoreCase("room2_del"))
  379. {
  380. for (L2Npc mob : _Room2Mobs)
  381. {
  382. if (mob != null)
  383. mob.deleteMe();
  384. }
  385. _Room2Mobs.clear();
  386. }
  387. else if (event.equalsIgnoreCase("room3_del"))
  388. {
  389. if (demon1 != null)
  390. demon1.deleteMe();
  391. if (demon2 != null)
  392. demon2.deleteMe();
  393. if (demon3 != null)
  394. demon3.deleteMe();
  395. if (demon4 != null)
  396. demon4.deleteMe();
  397. if (portrait1 != null)
  398. portrait1.deleteMe();
  399. if (portrait2 != null)
  400. portrait2.deleteMe();
  401. if (portrait3 != null)
  402. portrait3.deleteMe();
  403. if (portrait4 != null)
  404. portrait4.deleteMe();
  405. if (frintezza != null)
  406. frintezza.deleteMe();
  407. if (weakScarlet != null)
  408. weakScarlet.deleteMe();
  409. if (strongScarlet != null)
  410. strongScarlet.deleteMe();
  411.  
  412. demon1 = null;
  413. demon2 = null;
  414. demon3 = null;
  415. demon4 = null;
  416. portrait1 = null;
  417. portrait2 = null;
  418. portrait3 = null;
  419. portrait4 = null;
  420. frintezza = null;
  421. weakScarlet = null;
  422. strongScarlet = null;
  423. activeScarlet = null;
  424. }
  425. else if (event.equalsIgnoreCase("clean"))
  426. {
  427. _LastAction = 0;
  428. _LocCycle = 0;
  429. _CheckDie = 0;
  430. _OnCheck = 0;
  431. _Abnormal = 0;
  432. _OnMorph = 0;
  433. _SecondMorph = 0;
  434. _ThirdMorph = 0;
  435. _KillHallAlarmDevice = 0;
  436. _KillDarkChoirPlayer = 0;
  437. _KillDarkChoirCaptain = 0;
  438. _PlayersInside.clear();
  439. }
  440. else if (event.equalsIgnoreCase("close"))
  441. {
  442. for (int i = 17130051; i <= 17130058; i++)
  443. {
  444. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  445. if(door != null)
  446. door.closeMe();
  447. }
  448. for (int i = 17130061; i <= 17130070; i++)
  449. {
  450. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  451. if(door != null)
  452. door.closeMe();
  453. }
  454.  
  455. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  456. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  457. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  458. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  459. }
  460. else if (event.equalsIgnoreCase("loc_check"))
  461. {
  462. if (CurrentStatus == FIGHTING)
  463. {
  464. if (!_Zone.isInsideZone(npc))
  465. npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
  466. if (npc.getX() < getXFix(171932) || npc.getX() > getXFix(176532) || npc.getY() < getYFix(-90320) || npc.getY() > getYFix(-85720) || npc.getZ() < getZFix(-5130))
  467. npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
  468. }
  469. }
  470. else if (event.equalsIgnoreCase("camera_1"))
  471. {
  472. CurrentStatus = FIGHTING;
  473.  
  474. _frintezzaDummy = addSpawn(29052,174240,-89805,-5022,16048,false,0);
  475. _frintezzaDummy.setIsInvul(true);
  476. _frintezzaDummy.setIsImmobilized(true);
  477.  
  478. _overheadDummy = addSpawn(29052,174232,-88020,-5110,16384,false,0);
  479. _overheadDummy.setIsInvul(true);
  480. _overheadDummy.setIsImmobilized(true);
  481. _overheadDummy.setCollisionHeight(600);
  482. _Zone.broadcastPacket(new NpcInfo(_overheadDummy, null));
  483.  
  484. _portraitDummy1 = addSpawn(29052, 172450, -87890, -5100, 16048,false,0);
  485. _portraitDummy1.setIsImmobilized(true);
  486. _portraitDummy1.setIsInvul(true);
  487.  
  488. _portraitDummy3 = addSpawn(29052, 176012, -87890, -5100, 16048,false,0);
  489. _portraitDummy3.setIsImmobilized(true);
  490. _portraitDummy3.setIsInvul(true);
  491.  
  492. _scarletDummy = addSpawn(29053,174232,-88020,-5110,16384,false,0);
  493. _scarletDummy.setIsInvul(true);
  494. _scarletDummy.setIsImmobilized(true);
  495.  
  496. startQuestTimer("stop_pc", 0, npc, null);
  497. startQuestTimer("camera_2", 1000, _overheadDummy, null);
  498. }
  499. else if (event.equalsIgnoreCase("camera_2"))
  500. {
  501. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100,0,0,1,0));
  502. startQuestTimer("camera_2b", 0, _overheadDummy, null);
  503. }
  504. else if (event.equalsIgnoreCase("camera_2b"))
  505. {
  506. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100,0,0,1,0));
  507. startQuestTimer("camera_3", 0, _overheadDummy, null);
  508. }
  509. else if (event.equalsIgnoreCase("camera_3"))
  510. {
  511. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),300, 90, -10, 6500, 7000,0,0,1,0));
  512.  
  513. frintezza = (L2GrandBossInstance) addSpawn(FRINTEZZA,174240,-89805,-5022,16048,false,0);
  514. frintezza.setIsImmobilized(true);
  515. frintezza.setIsInvul(true);
  516. frintezza.disableAllSkills();
  517. _Zone.updateKnownList(frintezza);
  518.  
  519. demon2 = (L2MonsterInstance) addSpawn(29051, 175876, -88713, -5100, 28205,false,0);
  520. demon2.setIsImmobilized(true);
  521. demon2.disableAllSkills();
  522. _Zone.updateKnownList(demon2);
  523.  
  524. demon3 = (L2MonsterInstance) addSpawn(29051, 172608, -88702, -5100, 64817,false,0);
  525. demon3.setIsImmobilized(true);
  526. demon3.disableAllSkills();
  527. _Zone.updateKnownList(demon3);
  528.  
  529. demon1 = (L2MonsterInstance) addSpawn(29050, 175833, -87165, -5100, 35048,false,0);
  530. demon1.setIsImmobilized(true);
  531. demon1.disableAllSkills();
  532. _Zone.updateKnownList(demon1);
  533.  
  534. demon4 = (L2MonsterInstance) addSpawn(29050, 172634, -87165, -5100, 57730,false,0);
  535. demon4.setIsImmobilized(true);
  536. demon4.disableAllSkills();
  537. _Zone.updateKnownList(demon4);
  538.  
  539. startQuestTimer("camera_4", 6500, _overheadDummy, null);
  540. }
  541. else if (event.equalsIgnoreCase("camera_4"))
  542. {
  543. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),1800, 90, 8, 6500, 7000,0,0,1,0));
  544. startQuestTimer("camera_5", 900, _frintezzaDummy, null);
  545. }
  546. else if (event.equalsIgnoreCase("camera_5"))
  547. {
  548. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),140, 90, 10, 2500, 4500,0,0,1,0));
  549. startQuestTimer("camera_5b", 4000, _frintezzaDummy, null);
  550. }
  551. else if (event.equalsIgnoreCase("camera_5b"))
  552. {
  553. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 1000,0,0,1,0));
  554. startQuestTimer("camera_6", 0, frintezza, null);
  555. }
  556. else if (event.equalsIgnoreCase("camera_6"))
  557. {
  558. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 12000,0,0,1,0));
  559. startQuestTimer("camera_7", 1350, frintezza, null);
  560. }
  561. else if (event.equalsIgnoreCase("camera_7"))
  562. {
  563. _Zone.broadcastPacket(new SocialAction(frintezza,2));
  564. startQuestTimer("camera_8", 7000, frintezza, null);
  565. }
  566. else if (event.equalsIgnoreCase("camera_8"))
  567. {
  568. startQuestTimer("camera_9", 1000, frintezza, null);
  569. _frintezzaDummy.deleteMe();
  570. _frintezzaDummy = null;
  571. }
  572. else if (event.equalsIgnoreCase("camera_9"))
  573. {
  574. _Zone.broadcastPacket(new SocialAction(demon2,1));
  575. _Zone.broadcastPacket(new SocialAction(demon3,1));
  576. startQuestTimer("camera_9b", 400, frintezza, null);
  577. }
  578. else if (event.equalsIgnoreCase("camera_9b"))
  579. {
  580. _Zone.broadcastPacket(new SocialAction(demon1,1));
  581. _Zone.broadcastPacket(new SocialAction(demon4,1));
  582.  
  583. for (L2Character pc : _Zone.getCharactersInside().values())
  584. {
  585. if (pc instanceof L2PcInstance)
  586. {
  587. if (pc.getX() < getXFix(174232))
  588. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 1000,0,0,1,0));
  589. else
  590. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 1000,0,0,1,0));
  591. }
  592. }
  593. startQuestTimer("camera_9c", 0, frintezza, null);
  594. }
  595. else if (event.equalsIgnoreCase("camera_9c"))
  596. {
  597. for (L2Character pc : _Zone.getCharactersInside().values())
  598. {
  599. if (pc instanceof L2PcInstance)
  600. {
  601. if (pc.getX() < getXFix(174232))
  602. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 10000,0,0,1,0));
  603. else
  604. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 10000,0,0,1,0));
  605. }
  606. }
  607. startQuestTimer("camera_10", 2000, frintezza, null);
  608. }
  609. else if (event.equalsIgnoreCase("camera_10"))
  610. {
  611. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 0, 0, 1000,0,0,1,0));
  612. startQuestTimer("camera_11", 0, frintezza, null);
  613. }
  614. else if (event.equalsIgnoreCase("camera_11"))
  615. {
  616. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 25, 5500, 10000,0,0,1,0));
  617. _Zone.broadcastPacket(new SocialAction(frintezza,3));
  618. _portraitDummy1.deleteMe();
  619. _portraitDummy3.deleteMe();
  620. _portraitDummy1 = null;
  621. _portraitDummy3 = null;
  622.  
  623. startQuestTimer("camera_12", 4500, frintezza, null);
  624. }
  625. else if (event.equalsIgnoreCase("camera_12"))
  626. {
  627. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000,0,0,1,0));
  628. startQuestTimer("camera_13", 700, frintezza, null);
  629. }
  630. else if (event.equalsIgnoreCase("camera_13"))
  631. {
  632. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000,0,0,1,0));
  633. startQuestTimer("camera_14", 1300, frintezza, null);
  634. }
  635. else if (event.equalsIgnoreCase("camera_14"))
  636. {
  637. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),120, 180, 45, 1500, 10000,0,0,1,0));
  638. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  639. startQuestTimer("camera_16", 1500, frintezza, null);
  640. }
  641. else if (event.equalsIgnoreCase("camera_16"))
  642. {
  643. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),520, 135, 45, 8000, 10000,0,0,1,0));
  644. startQuestTimer("camera_17", 7500, frintezza, null);
  645. }
  646. else if (event.equalsIgnoreCase("camera_17"))
  647. {
  648. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),1500, 110, 25, 10000, 13000,0,0,1,0));
  649. startQuestTimer("camera_18", 9500, frintezza, null);
  650. }
  651. else if (event.equalsIgnoreCase("camera_18"))
  652. {
  653. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),930, 160, -20, 0, 1000,0,0,1,0));
  654. startQuestTimer("camera_18b", 0, _overheadDummy, null);
  655. }
  656. else if (event.equalsIgnoreCase("camera_18b"))
  657. {
  658. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 600, 180, -25, 0, 10000,0,0,1,0));
  659. _Zone.broadcastPacket(new MagicSkillUse(_scarletDummy,_overheadDummy, 5004, 1, 5800, 0));
  660.  
  661. weakScarlet = (L2GrandBossInstance) addSpawn(29046, 174232, -88020, -5110, 16384, false, 0, true);
  662. weakScarlet.setIsInvul(true);
  663. weakScarlet.setIsImmobilized(true);
  664. weakScarlet.disableAllSkills();
  665. _Zone.updateKnownList(weakScarlet);
  666. activeScarlet = weakScarlet;
  667.  
  668. startQuestTimer("camera_19", 2400, _scarletDummy, null);
  669. startQuestTimer("camera_19b", 5000, _scarletDummy, null);
  670. }
  671. else if (event.equalsIgnoreCase("camera_19"))
  672. {
  673. weakScarlet.teleToLocation(getXFix(174232), getYFix(-88020), getZFix(-5110));
  674. }
  675. else if (event.equalsIgnoreCase("camera_19b"))
  676. {
  677. _Zone.broadcastPacket(new SpecialCamera(_scarletDummy.getObjectId(), 800, 180, 10, 1000, 10000,0,0,1,0));
  678. startQuestTimer("camera_20", 2100, _scarletDummy, null);
  679. }
  680. else if (event.equalsIgnoreCase("camera_20"))
  681. {
  682. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),300, 60, 8, 0, 10000,0,0,1,0));
  683. startQuestTimer("camera_21", 2000, weakScarlet, null);
  684. }
  685. else if (event.equalsIgnoreCase("camera_21"))
  686. {
  687. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),500, 90, 10, 3000, 5000,0,0,1,0));
  688. startQuestTimer("camera_22", 3000, weakScarlet, null);
  689. }
  690. else if (event.equalsIgnoreCase("camera_22"))
  691. {
  692. portrait2 = (L2MonsterInstance) addSpawn(29049, 175876, -88713, -5000, 28205,false,0);
  693. portrait2.setIsImmobilized(true);
  694. portrait2.disableAllSkills();
  695. _Zone.updateKnownList(portrait2);
  696.  
  697. portrait3 = (L2MonsterInstance) addSpawn(29049, 172608, -88702, -5000, 64817,false,0);
  698. portrait3.setIsImmobilized(true);
  699. portrait3.disableAllSkills();
  700. _Zone.updateKnownList(portrait3);
  701.  
  702. portrait1 = (L2MonsterInstance) addSpawn(29048, 175833, -87165, -5000, 35048,false,0);
  703. portrait1.setIsImmobilized(true);
  704. portrait1.disableAllSkills();
  705. _Zone.updateKnownList(portrait1);
  706.  
  707. portrait4 = (L2MonsterInstance) addSpawn(29048, 172634, -87165, -5000, 57730,false,0);
  708. portrait4.setIsImmobilized(true);
  709. portrait4.disableAllSkills();
  710. _Zone.updateKnownList(portrait4);
  711.  
  712. _overheadDummy.deleteMe();
  713. _scarletDummy.deleteMe();
  714. _overheadDummy = null;
  715. _scarletDummy = null;
  716.  
  717. startQuestTimer("camera_23", 2000, weakScarlet, null);
  718. startQuestTimer("start_pc", 2000, weakScarlet, null);
  719. startQuestTimer("loc_check", 60000, weakScarlet, null, true);
  720. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  721. startQuestTimer("skill01", 10000 + Rnd.get(10000), weakScarlet, null);
  722. }
  723. else if (event.equalsIgnoreCase("camera_23"))
  724. {
  725. demon1.setIsImmobilized(false);
  726. demon2.setIsImmobilized(false);
  727. demon3.setIsImmobilized(false);
  728. demon4.setIsImmobilized(false);
  729. demon1.enableAllSkills();
  730. demon2.enableAllSkills();
  731. demon3.enableAllSkills();
  732. demon4.enableAllSkills();
  733. portrait1.setIsImmobilized(false);
  734. portrait2.setIsImmobilized(false);
  735. portrait3.setIsImmobilized(false);
  736. portrait4.setIsImmobilized(false);
  737. portrait1.enableAllSkills();
  738. portrait2.enableAllSkills();
  739. portrait3.enableAllSkills();
  740. portrait4.enableAllSkills();
  741. weakScarlet.setIsInvul(false);
  742. weakScarlet.setIsImmobilized(false);
  743. weakScarlet.enableAllSkills();
  744. weakScarlet.setRunning();
  745.  
  746. startQuestTimer("spawn_minion", 20000, portrait1, null);
  747. startQuestTimer("spawn_minion", 20000, portrait2, null);
  748. startQuestTimer("spawn_minion", 20000, portrait3, null);
  749. startQuestTimer("spawn_minion", 20000, portrait4, null);
  750. }
  751. else if (event.equalsIgnoreCase("stop_pc"))
  752. {
  753. for (L2Character cha : _Zone.getCharactersInside().values())
  754. {
  755. cha.abortAttack();
  756. cha.abortCast();
  757. cha.disableAllSkills();
  758. cha.setTarget(null);
  759. cha.stopMove(null);
  760. cha.setIsImmobilized(true);
  761. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  762. }
  763. }
  764. else if (event.equalsIgnoreCase("stop_npc"))
  765. {
  766. _Heading = npc.getHeading();
  767. if (_Heading < 32768)
  768. _Angle = Math.abs(180 - (int)(_Heading / 182.044444444));
  769. else
  770. _Angle = Math.abs(540 - (int)(_Heading / 182.044444444));
  771. }
  772. else if (event.equalsIgnoreCase("start_pc"))
  773. {
  774. for (L2Character cha : _Zone.getCharactersInside().values())
  775. {
  776. if (cha != frintezza)
  777. {
  778. cha.enableAllSkills();
  779. cha.setIsImmobilized(false);
  780. }
  781. }
  782. }
  783. else if (event.equalsIgnoreCase("start_npc"))
  784. {
  785. npc.setRunning();
  786. npc.setIsInvul(false);
  787. }
  788. else if (event.equalsIgnoreCase("morph_end"))
  789. {
  790. _OnMorph = 0;
  791. }
  792. else if (event.equalsIgnoreCase("morph_01"))
  793. {
  794. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 2000, 15000,0,0,1,0));
  795. startQuestTimer("morph_02", 3000, weakScarlet, null);
  796. }
  797. else if (event.equalsIgnoreCase("morph_02"))
  798. {
  799. _Zone.broadcastPacket(new SocialAction(weakScarlet,1));
  800. weakScarlet.setRHandId(7903);
  801. startQuestTimer("morph_03", 4000, weakScarlet, null);
  802. }
  803. else if (event.equalsIgnoreCase("morph_03"))
  804. {
  805. startQuestTimer("morph_04", 1500, weakScarlet, null);
  806. }
  807. else if (event.equalsIgnoreCase("morph_04"))
  808. {
  809. _Zone.broadcastPacket(new SocialAction(weakScarlet,4));
  810. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  811. if (skill != null)
  812. skill.getEffects(weakScarlet, weakScarlet);
  813.  
  814. startQuestTimer("morph_end", 6000, weakScarlet, null);
  815. startQuestTimer("start_pc", 3000, weakScarlet, null);
  816. startQuestTimer("start_npc", 3000, weakScarlet, null);
  817. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  818. startQuestTimer("skill02", 10000 + Rnd.get(10000), weakScarlet, null);
  819. }
  820. else if (event.equalsIgnoreCase("morph_05a"))
  821. {
  822. _Zone.broadcastPacket(new SocialAction(frintezza,4));
  823. }
  824. else if (event.equalsIgnoreCase("morph_05"))
  825. {
  826. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 1000,0,0,1,0));
  827. startQuestTimer("morph_06", 0, frintezza, null);
  828. }
  829. else if (event.equalsIgnoreCase("morph_06"))
  830. {
  831. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 10000,0,0,1,0));
  832.  
  833. cancelQuestTimers("loc_check");
  834.  
  835. _Scarlet_x = weakScarlet.getX();
  836. _Scarlet_y = weakScarlet.getY();
  837. _Scarlet_z = weakScarlet.getZ();
  838. _Scarlet_h = weakScarlet.getHeading();
  839. weakScarlet.deleteMe();
  840. weakScarlet = null;
  841. activeScarlet = null;
  842. weakScarlet = (L2GrandBossInstance) addSpawn(29046, _Scarlet_x, _Scarlet_y, _Scarlet_z, _Scarlet_h, false,0);
  843. weakScarlet.setIsInvul(true);
  844. weakScarlet.setIsImmobilized(true);
  845. weakScarlet.disableAllSkills();
  846. weakScarlet.setRHandId(7903);
  847. _Zone.updateKnownList(weakScarlet);
  848.  
  849. startQuestTimer("morph_07", 7000, frintezza, null);
  850. }
  851. else if (event.equalsIgnoreCase("morph_07"))
  852. {
  853. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  854. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),500, 70, 15, 3000, 10000,0,0,1,0));
  855. startQuestTimer("morph_08", 3000, frintezza, null);
  856. }
  857. else if (event.equalsIgnoreCase("morph_08"))
  858. {
  859. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),2500, 90, 12, 6000, 10000,0,0,1,0));
  860. startQuestTimer("morph_09", 3000, frintezza, null);
  861. }
  862. else if (event.equalsIgnoreCase("morph_09"))
  863. {
  864. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 1000,0,0,1,0));
  865. startQuestTimer("morph_10", 0, weakScarlet, null);
  866. }
  867. else if (event.equalsIgnoreCase("morph_10"))
  868. {
  869. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 10000,0,0,1,0));
  870. startQuestTimer("morph_11", 500, weakScarlet, null);
  871. }
  872. else if (event.equalsIgnoreCase("morph_11"))
  873. {
  874. weakScarlet.doDie(weakScarlet);
  875. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),450, _Angle, 14, 8000, 8000,0,0,1,0));
  876.  
  877. startQuestTimer("morph_12", 6250, weakScarlet, null);
  878. startQuestTimer("morph_13", 7200, weakScarlet, null);
  879. }
  880. else if (event.equalsIgnoreCase("morph_12"))
  881. {
  882. weakScarlet.deleteMe();
  883. weakScarlet = null;
  884. }
  885. else if (event.equalsIgnoreCase("morph_13"))
  886. {
  887. strongScarlet = (L2GrandBossInstance) addSpawn(SCARLET2, reverseXFix(_Scarlet_x), reverseYFix(_Scarlet_y), reverseZFix(_Scarlet_z), _Scarlet_h, false,0);
  888. strongScarlet.setIsInvul(true);
  889. strongScarlet.setIsImmobilized(true);
  890. strongScarlet.disableAllSkills();
  891. _Zone.updateKnownList(strongScarlet);
  892. activeScarlet = strongScarlet;
  893.  
  894. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),450, _Angle, 12, 500, 14000,0,0,1,0));
  895.  
  896. startQuestTimer("morph_14", 3000, strongScarlet, null);
  897. startQuestTimer("loc_check", 60000, strongScarlet, null, true);
  898. }
  899. else if (event.equalsIgnoreCase("morph_14"))
  900. {
  901. startQuestTimer("morph_15", 5100, strongScarlet, null);
  902. }
  903. else if (event.equalsIgnoreCase("morph_15"))
  904. {
  905. _Zone.broadcastPacket(new SocialAction(strongScarlet,2));
  906. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  907. if (skill != null)
  908. skill.getEffects(strongScarlet, strongScarlet);
  909.  
  910. startQuestTimer("morph_end", 9000, strongScarlet, null);
  911. startQuestTimer("start_pc", 6000, strongScarlet, null);
  912. startQuestTimer("start_npc", 6000, strongScarlet, null);
  913. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  914. startQuestTimer("skill03", 10000 + Rnd.get(10000), strongScarlet, null);
  915. }
  916. else if (event.equalsIgnoreCase("morph_16"))
  917. {
  918. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),300, _Angle - 180 , 5, 0, 7000,0,0,1,0));
  919. startQuestTimer("morph_17", 0, strongScarlet, null);
  920. }
  921. else if (event.equalsIgnoreCase("morph_17"))
  922. {
  923. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),200, _Angle, 85, 4000, 10000,0,0,1,0));
  924. startQuestTimer("morph_17b", 7400, frintezza, null);
  925. startQuestTimer("morph_18", 7500, frintezza, null);
  926. }
  927. else if (event.equalsIgnoreCase("morph_17b"))
  928. {
  929. frintezza.doDie(frintezza);
  930. }
  931. else if (event.equalsIgnoreCase("morph_18"))
  932. {
  933. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 120, 5, 0, 7000,0,0,1,0));
  934. startQuestTimer("morph_19", 0, frintezza, null);
  935. }
  936. else if (event.equalsIgnoreCase("morph_19"))
  937. {
  938. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 90, 5, 5000, 15000,0,0,1,0));
  939. startQuestTimer("morph_20", 7000, frintezza, null);
  940. startQuestTimer("spawn_cubes", 7000, frintezza, null);
  941. }
  942. else if (event.equalsIgnoreCase("morph_20"))
  943. {
  944. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),900, 90, 25, 7000, 10000,0,0,1,0));
  945. startQuestTimer("start_pc", 7000, frintezza, null);
  946. }
  947. else if (event.equalsIgnoreCase("songs_play"))
  948. {
  949. if (frintezza != null && !frintezza.isDead() && _OnMorph == 0)
  950. {
  951. _OnSong = Rnd.get(1, 5);
  952. if (_OnSong == 1 && _ThirdMorph == 1 && strongScarlet.getCurrentHp() < strongScarlet.getMaxHp() * 0.6 && Rnd.get(100) < 80)
  953. {
  954. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 1, 32000, 0));
  955. startQuestTimer("songs_effect", 5000, frintezza, null);
  956. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  957. }
  958. else if (_OnSong == 2 || _OnSong == 3)
  959. {
  960. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, _OnSong, 32000, 0));
  961. startQuestTimer("songs_effect", 5000, frintezza, null);
  962. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  963. }
  964. else if (_OnSong == 4 && _SecondMorph == 1)
  965. {
  966. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 4, 31000, 0));
  967. startQuestTimer("songs_effect", 5000, frintezza, null);
  968. startQuestTimer("songs_play", 31000 + Rnd.get(10000), frintezza, null);
  969. }
  970. else if (_OnSong == 5 && _ThirdMorph == 1 && _Abnormal == 0)
  971. {
  972. _Abnormal = 1;
  973. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 5, 35000, 0));
  974. startQuestTimer("songs_effect", 5000, frintezza, null);
  975. startQuestTimer("songs_play", 35000 + Rnd.get(10000), frintezza, null);
  976. }
  977. else
  978. startQuestTimer("songs_play", 5000 + Rnd.get(5000), frintezza, null);
  979. }
  980. }
  981. else if (event.equalsIgnoreCase("songs_effect"))
  982. {
  983. L2Skill skill = SkillTable.getInstance().getInfo(5008, _OnSong);
  984. if (skill == null)
  985. return null;
  986.  
  987. if (_OnSong == 1 || _OnSong == 2 || _OnSong == 3)
  988. {
  989. if (frintezza != null && !frintezza.isDead() && activeScarlet != null && !activeScarlet.isDead())
  990. skill.getEffects(frintezza, activeScarlet);
  991. }
  992. else if (_OnSong == 4)
  993. {
  994. for (L2Character cha : _Zone.getCharactersInside().values())
  995. {
  996. if (cha instanceof L2PcInstance && Rnd.get(100) < 80)
  997. {
  998. skill.getEffects(frintezza, cha);
  999. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 4));
  1000. }
  1001. }
  1002. }
  1003. else if (_OnSong == 5)
  1004. {
  1005. for (L2Character cha : _Zone.getCharactersInside().values())
  1006. {
  1007. if (cha instanceof L2PcInstance && Rnd.get(100) < 70)
  1008. {
  1009. cha.abortAttack();
  1010. cha.abortCast();
  1011. cha.disableAllSkills();
  1012. cha.stopMove(null);
  1013. cha.setIsParalyzed(true);
  1014. cha.setIsImmobilized(true);
  1015. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1016. skill.getEffects(frintezza, cha);
  1017. cha.startAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1018. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 5));
  1019. }
  1020. }
  1021. startQuestTimer("stop_effect", 25000, frintezza, null);
  1022. }
  1023. }
  1024. else if (event.equalsIgnoreCase("stop_effect"))
  1025. {
  1026. for (L2Character cha : _Zone.getCharactersInside().values())
  1027. {
  1028. if (cha instanceof L2PcInstance)
  1029. {
  1030. cha.stopAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1031. cha.stopAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1032. cha.enableAllSkills();
  1033. cha.setIsImmobilized(false);
  1034. cha.setIsParalyzed(false);
  1035. }
  1036. }
  1037. _Abnormal = 0;
  1038. }
  1039. else if (event.equalsIgnoreCase("attack_stop"))
  1040. {
  1041. cancelQuestTimers("skill01");
  1042. cancelQuestTimers("skill02");
  1043. cancelQuestTimers("skill03");
  1044. cancelQuestTimers("songs_play");
  1045. cancelQuestTimers("songs_effect");
  1046.  
  1047. if (frintezza != null)
  1048. _Zone.broadcastPacket(new MagicSkillCanceld(frintezza.getObjectId()));
  1049. }
  1050. else if (event.equalsIgnoreCase("check_hp"))
  1051. {
  1052. if (npc.isDead())
  1053. {
  1054. _OnMorph = 1;
  1055. _Zone.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
  1056.  
  1057. startQuestTimer("attack_stop", 0, frintezza, null);
  1058. startQuestTimer("stop_pc", 0, npc, null);
  1059. startQuestTimer("stop_npc", 0, npc, null);
  1060. startQuestTimer("morph_16", 0, npc, null);
  1061. }
  1062. else
  1063. {
  1064. _CheckDie = _CheckDie + 10;
  1065. if (_CheckDie < 3000)
  1066. startQuestTimer("check_hp", 10, npc, null);
  1067. else
  1068. {
  1069. _OnCheck = 0;
  1070. _CheckDie = 0;
  1071. }
  1072. }
  1073. }
  1074. else if (event.equalsIgnoreCase("skill01"))
  1075. {
  1076. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0)
  1077. {
  1078. int i = Rnd.get(0,1);
  1079. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1080. if (skill != null)
  1081. {
  1082. weakScarlet.stopMove(null);
  1083. weakScarlet.setIsCastingNow(true);
  1084. weakScarlet.doCast(skill);
  1085. }
  1086. startQuestTimer("skill01", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1087. }
  1088. }
  1089. else if (event.equalsIgnoreCase("skill02"))
  1090. {
  1091. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0)
  1092. {
  1093. int i = 0;
  1094. if (_Abnormal == 0)
  1095. i = Rnd.get(2,5);
  1096. else
  1097. i = Rnd.get(2,4);
  1098.  
  1099. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1100. if (skill != null)
  1101. {
  1102. weakScarlet.stopMove(null);
  1103. weakScarlet.setIsCastingNow(true);
  1104. weakScarlet.doCast(skill);
  1105. }
  1106. startQuestTimer("skill02", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1107.  
  1108. if (i == 5)
  1109. {
  1110. _Abnormal = 1;
  1111. startQuestTimer("float_effect", 4000, weakScarlet, null);
  1112. }
  1113. }
  1114. }
  1115. else if (event.equalsIgnoreCase("skill03"))
  1116. {
  1117. if (strongScarlet != null && !strongScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 1 && _OnMorph == 0)
  1118. {
  1119. int i = 0;
  1120. if (_Abnormal == 0)
  1121. i = Rnd.get(6,10);
  1122. else
  1123. i = Rnd.get(6,9);
  1124.  
  1125. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1126. if (skill != null)
  1127. {
  1128. strongScarlet.stopMove(null);
  1129. strongScarlet.setIsCastingNow(true);
  1130. strongScarlet.doCast(skill);
  1131. }
  1132. startQuestTimer("skill03", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1133.  
  1134. if (i == 10)
  1135. {
  1136. _Abnormal = 1;
  1137. startQuestTimer("float_effect", 3000, npc, null);
  1138. }
  1139. }
  1140. }
  1141. else if (event.equalsIgnoreCase("float_effect"))
  1142. {
  1143. if (npc.isCastingNow())
  1144. {
  1145. startQuestTimer("float_effect", 500, npc, null);
  1146. }
  1147. else
  1148. {
  1149. for (L2Character cha : _Zone.getCharactersInside().values())
  1150. {
  1151. if (cha instanceof L2PcInstance)
  1152. {
  1153. if (cha.getFirstEffect(5016) != null)
  1154. {
  1155. cha.abortAttack();
  1156. cha.abortCast();
  1157. cha.disableAllSkills();
  1158. cha.stopMove(null);
  1159. cha.setIsParalyzed(true);
  1160. cha.setIsImmobilized(true);
  1161. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1162. cha.startAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1163. }
  1164. }
  1165. }
  1166. startQuestTimer("stop_effect", 25000, npc, null);
  1167. }
  1168. }
  1169. else if (event.equalsIgnoreCase("action"))
  1170. {
  1171. _Zone.broadcastPacket(new SocialAction(npc,1));
  1172. }
  1173. else if (event.equalsIgnoreCase("bomber"))
  1174. {
  1175. _Bomber = 0;
  1176. }
  1177. else if (event.equalsIgnoreCase("room_final"))
  1178. {
  1179. _Zone.broadcastPacket(new NpcSay(npc.getObjectId(),1,npc.getNpcId(),"Exceeded his time limit, challenge failed!"));
  1180. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1181. playerInsideTezza.setInstanceId(0);
  1182. _Zone.oustAllPlayers();
  1183.  
  1184. cancelQuestTimers("waiting");
  1185. cancelQuestTimers("frintezza_despawn");
  1186. startQuestTimer("clean", 1000, npc, null);
  1187. startQuestTimer("close", 1000, npc, null);
  1188. startQuestTimer("room1_del", 1000, npc, null);
  1189. startQuestTimer("room2_del", 1000, npc, null);
  1190. startQuestTimer("destroy_instance", 30000, npc, null);
  1191. }
  1192. else if (event.equalsIgnoreCase("all_dead_frintezza_despawn"))
  1193. {
  1194. temp = (System.currentTimeMillis() - _LastAction);
  1195. if (temp > 30000)
  1196. {
  1197. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1198. {
  1199. playerInsideTezza.setInstanceId(0);
  1200. playerInsideTezza.removeNotifyQuestOfDeath(st);
  1201. }
  1202. _Zone.oustAllPlayers();
  1203. cancelQuestTimers("all_dead_frintezza_despawn");
  1204. cancelQuestTimers("waiting");
  1205. cancelQuestTimers("loc_check");
  1206. cancelQuestTimers("room_final");
  1207. cancelQuestTimers("spawn_minion");
  1208. startQuestTimer("clean", 1000, npc, null);
  1209. startQuestTimer("close", 1000, npc, null);
  1210. startQuestTimer("attack_stop", 1000, npc, null);
  1211. startQuestTimer("room1_del", 1000, npc, null);
  1212. startQuestTimer("room2_del", 1000, npc, null);
  1213. startQuestTimer("room3_del", 1000, npc, null);
  1214. startQuestTimer("minions_despawn", 1000, npc, null);
  1215. startQuestTimer("destroy_instance", 30000, npc, null);
  1216.  
  1217. }
  1218. }
  1219. else if (event.equalsIgnoreCase("frintezza_despawn"))
  1220. {
  1221. temp = (System.currentTimeMillis() - _LastAction);
  1222. if (temp > 900000)
  1223. {
  1224. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1225. {
  1226. playerInsideTezza.setInstanceId(0);
  1227. playerInsideTezza.removeNotifyQuestOfDeath(st);
  1228. }
  1229. _Zone.oustAllPlayers();
  1230.  
  1231. cancelQuestTimers("frintezza_despawn");
  1232. cancelQuestTimers("waiting");
  1233. cancelQuestTimers("loc_check");
  1234. cancelQuestTimers("room_final");
  1235. cancelQuestTimers("spawn_minion");
  1236. startQuestTimer("clean", 1000, npc, null);
  1237. startQuestTimer("close", 1000, npc, null);
  1238. startQuestTimer("attack_stop", 1000, npc, null);
  1239. startQuestTimer("room1_del", 1000, npc, null);
  1240. startQuestTimer("room2_del", 1000, npc, null);
  1241. startQuestTimer("room3_del", 1000, npc, null);
  1242. startQuestTimer("minions_despawn", 1000, npc, null);
  1243. startQuestTimer("destroy_instance", 30000, npc, null);
  1244. }
  1245. }
  1246. else if (event.equalsIgnoreCase("minions_despawn"))
  1247. {
  1248. for (int i = 0; i < Minions.size(); i++)
  1249. {
  1250. L2Attackable mob = Minions.get(i);
  1251. if (mob != null)
  1252. mob.decayMe();
  1253. }
  1254. Minions.clear();
  1255. }
  1256. else if (event.equalsIgnoreCase("spawn_minion"))
  1257. {
  1258. if (npc != null && !npc.isDead() && frintezza != null && !frintezza.isDead())
  1259. {
  1260. L2Attackable mob = (L2Attackable)addSpawn(npc.getNpcId()+2,npc.getX(),npc.getY(),npc.getZ(),npc.getHeading(),false,0);
  1261. if(mob != null)
  1262. {
  1263. mob.setIsRaidMinion(true);
  1264. Minions.add(mob);
  1265.  
  1266. startQuestTimer("action", 200, mob, null);
  1267. startQuestTimer("spawn_minion", 18000, npc, null);
  1268. }
  1269. }
  1270. }
  1271. else if (event.equalsIgnoreCase("spawn_cubes"))
  1272. {
  1273. addSpawn(CUBE, 174232, -88020, -5114, 16384, false, 900000);
  1274. startQuestTimer("frintezza_despawn", 60000, null, null, true);
  1275. }
  1276. else if (event.equalsIgnoreCase("remove_players"))
  1277. {
  1278. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1279. playerInsideTezza.setInstanceId(0);
  1280. _Zone.oustAllPlayers();
  1281.  
  1282. }else if (event.equalsIgnoreCase("destroy_instance"))
  1283. {
  1284. if(debugMSG)
  1285. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", "Tezza's entrance is opened."));
  1286. InstanceManager.getInstance().destroyInstance(currentInstanceID);
  1287. for(String timer : _TimerControl)
  1288. cancelQuestTimers(timer);
  1289. _TimerControl.clear();
  1290.  
  1291. CurrentStatus = DORMANT;
  1292. }
  1293.  
  1294. return super.onAdvEvent(event, npc, player);
  1295. }
  1296.  
  1297. @Override
  1298. public String onTalk (L2Npc npc, L2PcInstance player)
  1299. {
  1300. if (npc.getNpcId() == CUBE)
  1301. {
  1302. int x = 150037 + Rnd.get(500);
  1303. int y = -57720 + Rnd.get(500);
  1304. player.removeNotifyQuestOfDeath(st);
  1305. player.setInstanceId(0);
  1306. player.teleToLocation(x, y, -2976);
  1307.  
  1308. if(!_PlayersInside.isEmpty())
  1309. _PlayersInside.remove(player);
  1310.  
  1311. if(_PlayersInside.isEmpty())
  1312. startQuestTimer("destroy_instance", 30000, npc, null);
  1313.  
  1314. return null;
  1315. }
  1316.  
  1317. if(CurrentStatus != DORMANT)
  1318. return "<html><body>Someone is already inside instance. Try again later.</body></html>";
  1319.  
  1320. st = player.getQuestState(getName());
  1321.  
  1322. if (player.getParty() == null || player.getParty().getCommandChannel() == null || player.getParty().getCommandChannel().getChannelLeader() != player)
  1323. return "<html><body>I speak only with command channel leader.</body></html>";
  1324.  
  1325. if (player.getParty().getCommandChannel().getMemberCount() < 36 || player.getParty().getCommandChannel().getMemberCount() > 45)
  1326. return "<html><body>Your command channel have incorrect size. You need between 36 and 45 players.</body></html>";
  1327.  
  1328. if (player.getInventory().getItemByItemId(8073) == null)
  1329. return "<html><body>You dont have required item.</body></html>";
  1330.  
  1331. L2CommandChannel CC = player.getParty().getCommandChannel();
  1332. for (L2Party _party : CC.getPartys())
  1333. {
  1334. if (_party == null)
  1335. continue;
  1336. for (L2PcInstance _member : _party.getPartyMembers())
  1337. {
  1338. if (_member == null)
  1339. continue;
  1340.  
  1341. if (_member.getLevel() < 80)
  1342. return "<html><body>Player " + _member.getName() + " have too low level. Minimum level required is 80.</body></html>";
  1343. if (!Util.checkIfInRange(1000, player, _member, false))
  1344. return "<html><body>" + _member.getName() + " is not near NPC.</body></html>";
  1345.  
  1346. Long reentertime = InstanceManager.getInstance().getInstanceTime(_member.getObjectId(), INSTANCEID);
  1347. if (System.currentTimeMillis() < reentertime)
  1348. {
  1349. return "<html><body>" + _member.getName() + " may not reenter yet.</body></html>";
  1350. }
  1351.  
  1352. }
  1353. }
  1354. ClearVariables();
  1355. currentInstanceID = InstanceManager.getInstance().createDynamicInstance("Frintezza.xml");
  1356.  
  1357. if(debugMSG)
  1358. {
  1359. if(player.getClan() != null)
  1360. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", player.getClan()+" clan with leader "+player.getName()+" entered to tezza."));
  1361. else
  1362. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", "CC leader "+player.getName()+" without clan entered to tezza."));
  1363. }
  1364.  
  1365. player.destroyItemByItemId("Quest", 8073, 1, player, true);
  1366. CurrentStatus = WAITING;
  1367.  
  1368. startQuestTimer("close", 0, npc, null);
  1369. startQuestTimer("room1_spawn", 5000, npc, null);
  1370. startQuestTimer("room_final", 2100000, npc, null);
  1371. startQuestTimer("frintezza_despawn", 60000, npc, null, true);
  1372.  
  1373. _LastAction = System.currentTimeMillis();
  1374. for (L2Party party : CC.getPartys())
  1375. {
  1376. if (party == null)
  1377. continue;
  1378. for (L2PcInstance member : party.getPartyMembers())
  1379. {
  1380. _PlayersInside.add(member);
  1381. _Zone.allowPlayerEntry(member, 300);
  1382. member.addNotifyQuestOfDeath(st);
  1383. member.setInstanceId(currentInstanceID);
  1384. member.teleToLocation(getXFix(_invadeLoc[_LocCycle][0]) + Rnd.get(50), getYFix(_invadeLoc[_LocCycle][1]) + Rnd.get(50), getZFix(_invadeLoc[_LocCycle][2]));
  1385. }
  1386. _LocCycle++;
  1387. if (_LocCycle >= 6)
  1388. _LocCycle = 1;
  1389. }
  1390.  
  1391. setInstanceTimeRestrictions();
  1392. _log.log(Level.INFO, "Frintezza's instance with ID "+currentInstanceID+" has been created by player "+player.getName());
  1393. return "";
  1394. }
  1395.  
  1396. private void ClearVariables()
  1397. {
  1398. _PlayersInside.clear();
  1399. _TimerControl.clear();
  1400. _KillHallAlarmDevice = 0;
  1401. _KillDarkChoirPlayer = 0;
  1402. _KillDarkChoirCaptain = 0;
  1403. currentInstanceID = 0;
  1404. _LastAction = 0;
  1405. _LocCycle = 0;
  1406. _CheckDie = 0;
  1407. _OnCheck = 0;
  1408. _Abnormal = 0;
  1409. _OnMorph = 0;
  1410. _SecondMorph = 0;
  1411. _ThirdMorph = 0;
  1412. }
  1413.  
  1414. @Override
  1415. public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
  1416. {
  1417. _LastAction = System.currentTimeMillis();
  1418. if (npc.getNpcId() == FRINTEZZA)
  1419. {
  1420. npc.setCurrentHpMp(npc.getMaxHp(), 0);
  1421. return null;
  1422. }
  1423. if (npc.getNpcId() == SCARLET1 && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.75 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
  1424. {
  1425. startQuestTimer("attack_stop", 0, frintezza, null);
  1426.  
  1427. _SecondMorph = 1;
  1428. _OnMorph = 1;
  1429.  
  1430. startQuestTimer("stop_pc", 1000, npc, null);
  1431. startQuestTimer("stop_npc", 1000, npc, null);
  1432. startQuestTimer("morph_01", 1100, npc, null);
  1433. }
  1434. else if (npc.getNpcId() == SCARLET1 && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.5 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
  1435. {
  1436. startQuestTimer("attack_stop", 0, frintezza, null);
  1437.  
  1438. _ThirdMorph = 1;
  1439. _OnMorph = 1;
  1440.  
  1441. startQuestTimer("stop_pc", 2000, npc, null);
  1442. startQuestTimer("stop_npc", 2000, npc, null);
  1443. startQuestTimer("morph_05a", 2000, npc, null);
  1444. startQuestTimer("morph_05", 2100, npc, null);
  1445. }
  1446. else if (npc.getNpcId() == SCARLET2 && _SecondMorph == 1 && _ThirdMorph == 1 && _OnCheck == 0 && damage >= npc.getCurrentHp() && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
  1447. {
  1448. _OnCheck = 1;
  1449. startQuestTimer("check_hp", 0, npc, null);
  1450. }
  1451. else if ((npc.getNpcId() == 29050 || npc.getNpcId() == 29051) && _Bomber == 0)
  1452. {
  1453. if (npc.getCurrentHp() < npc.getMaxHp() * 0.1)
  1454. {
  1455. if (Rnd.get(100) < 30)
  1456. {
  1457. _Bomber = 1;
  1458. startQuestTimer("bomber", 3000, npc, null);
  1459.  
  1460. L2Skill skill = SkillTable.getInstance().getInfo(5011,1);
  1461. if (skill != null)
  1462. {
  1463. npc.setIsCastingNow(true);
  1464. npc.doCast(skill);
  1465. }
  1466. }
  1467. }
  1468. }
  1469.  
  1470. return super.onAttack(npc, attacker, damage, isPet);
  1471. }
  1472.  
  1473. @Override
  1474. public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet)
  1475. {
  1476. if (npc.getNpcId() == FRINTEZZA)
  1477. {
  1478. return null;
  1479. }
  1480. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 0 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
  1481. {
  1482. _OnCheck = 1;
  1483. startQuestTimer("stop_pc", 0, npc, null);
  1484. startQuestTimer("stop_npc", 0, npc, null);
  1485. startQuestTimer("morph_16", 0, npc, null);
  1486. }
  1487. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 1 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
  1488. {
  1489. cancelQuestTimers("loc_check");
  1490. cancelQuestTimers("spawn_minion");
  1491. cancelQuestTimers("frintezza_despawn");
  1492. startQuestTimer("clean", 30000, npc, null);
  1493. startQuestTimer("close", 30000, npc, null);
  1494. startQuestTimer("room3_del", 60000, npc, null);
  1495. startQuestTimer("minions_despawn", 60000, npc, null);
  1496. startQuestTimer("remove_players", 900000, npc, null);
  1497. startQuestTimer("destroy_instance", 900001, npc, null);
  1498. }
  1499. else if (npc.getNpcId() == 18328)
  1500. {
  1501. _KillHallAlarmDevice++;
  1502. if (_KillHallAlarmDevice == 4)
  1503. {
  1504. startQuestTimer("room1_del", 100, npc, null);
  1505. startQuestTimer("room2_spawn", 100, npc, null);
  1506.  
  1507. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).openMe();
  1508. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).openMe();
  1509. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1510. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1511. for (int i = 17130051; i <= 17130058; i++)
  1512. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1513. }
  1514. }
  1515. else if (npc.getNpcId() == 18339)
  1516. {
  1517. _KillDarkChoirPlayer ++;
  1518. if (_KillDarkChoirPlayer == 2)
  1519. {
  1520. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  1521. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  1522. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  1523. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  1524. int outside = 0;
  1525. for (L2PcInstance room2_pc : _PlayersInside)
  1526. {
  1527. if (_Zone.isInsideZone(room2_pc) && room2_pc.getY() > getYFix(-86130))
  1528. outside++;
  1529. }
  1530. if (outside == 0)
  1531. {
  1532. startQuestTimer("room2_del", 100, npc, null);
  1533. startQuestTimer("waiting", 180000, npc, null);
  1534. cancelQuestTimers("room_final");
  1535. }
  1536. else
  1537. {
  1538. for (int i = 17130061; i <= 17130070; i++)
  1539. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1540.  
  1541. startQuestTimer("room2_spawn2", 1000, npc, null);
  1542. }
  1543. }
  1544. }
  1545. else if (npc.getNpcId() == 18334)
  1546. {
  1547. _KillDarkChoirCaptain ++;
  1548. if (_KillDarkChoirCaptain == 8)
  1549. {
  1550. startQuestTimer("room2_del", 100, npc, null);
  1551.  
  1552. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1553. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1554.  
  1555. startQuestTimer("waiting", 180000, npc, null);
  1556. cancelQuestTimers("room_final");
  1557. }
  1558. }
  1559.  
  1560. return super.onKill(npc,killer,isPet);
  1561. }
  1562.  
  1563. @Override
  1564. public String onDeath(L2Character killer, L2Character victim, QuestState qs)
  1565. {
  1566. for(L2PcInstance player : _PlayersInside)
  1567. if(!player.isDead())
  1568. return "";
  1569. _log.log(Level.INFO, "Everyone inside Frintezza are dead. Closing instance in 30s.");
  1570. for(L2PcInstance playerInside : _PlayersInside)
  1571. playerInside.removeNotifyQuestOfDeath(st);
  1572.  
  1573. if(debugMSG)
  1574. L2World.getInstance().getPlayer("xCorsiN").sendPacket(new CreatureSay(L2World.getInstance().getPlayer("xCorsiN").getObjectId(), 2, "xCorsiN", "Attemp to kill Tezza failed"));
  1575.  
  1576. startQuestTimer("all_dead_frintezza_despawn", 1000, null, null, true);
  1577. return super.onDeath(killer, victim, qs);
  1578. }
  1579.  
  1580.  
  1581.  
  1582. /**
  1583. * Override spawn method to correct spawn cords after lair move<BR>
  1584. * TODO: Update cords in script, im just lazy :)
  1585. */
  1586. @Override
  1587. public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
  1588. {
  1589.  
  1590. // cords fix:
  1591. return super.addSpawn(npcId, getXFix(x), getYFix(y), getZFix(z), heading, randomOffset, despawnDelay, isSummonSpawn, currentInstanceID);
  1592. }
  1593.  
  1594.  
  1595. public int getXFix(int x)
  1596. {
  1597. return x - 262016;
  1598. }
  1599. public int getYFix(int y)
  1600. {
  1601. return y - 65278;
  1602. }
  1603. public int getZFix(int z)
  1604. {
  1605. return z - 4065;
  1606. }
  1607.  
  1608. public int reverseXFix(int x)
  1609. {
  1610. return x + 262016;
  1611. }
  1612. public int reverseYFix(int y)
  1613. {
  1614. return y + 65278;
  1615. }
  1616. public int reverseZFix(int z)
  1617. {
  1618. return z + 4065;
  1619. }
  1620.  
  1621. protected void setInstanceTimeRestrictions()
  1622. {
  1623. Calendar reenter = Calendar.getInstance();
  1624. reenter.set(Calendar.MINUTE, RESET_MIN);
  1625. reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
  1626. // if time is >= RESET_HOUR - roll to the next day
  1627. if (reenter.getTimeInMillis() <= System.currentTimeMillis())
  1628. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1629. if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
  1630. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
  1631. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1632. else
  1633. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
  1634. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1635.  
  1636. // set instance reenter time for all allowed players
  1637. for (L2PcInstance playerInside : _PlayersInside)
  1638. InstanceManager.getInstance().setInstanceTime(playerInside.getObjectId(), INSTANCEID, reenter.getTimeInMillis());
  1639. }
  1640.  
  1641. @Override
  1642. public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player)
  1643. {
  1644. _TimerControl.add(name);
  1645. super.startQuestTimer(name, time, npc, player);
  1646. }
  1647.  
  1648. @Override
  1649. public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player, boolean repeating)
  1650. {
  1651. _TimerControl.add(name);
  1652. super.startQuestTimer(name, time, npc, player, repeating);
  1653. }
  1654.  
  1655. @Override
  1656. public void cancelQuestTimers(String name)
  1657. {
  1658. _TimerControl.remove(name);
  1659. super.cancelQuestTimers(name);
  1660. }
  1661.  
  1662. public static void main(String[] args)
  1663. {
  1664. // now call the constructor (starts up the ai)
  1665. new Frintezza(-1,"Frintezza","ai");
  1666. }
  1667. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement