View difference between Paste ID: cq447nyQ and yFbrjHke
SHOW: | | - or go back to the newest paste.
1
package net.sf.l2j.gameserver.scripting.script.ai.boss;
2
 
3
import java.util.List;
4
import java.util.Set;
5
import java.util.concurrent.ConcurrentHashMap;
6
import java.util.concurrent.CopyOnWriteArrayList;
7
 
8
import net.sf.l2j.commons.data.StatSet;
9
import net.sf.l2j.commons.random.Rnd;
10
 
11
import net.sf.l2j.Config;
12
import net.sf.l2j.gameserver.data.SkillTable;
13
import net.sf.l2j.gameserver.data.manager.GrandBossManager;
14
import net.sf.l2j.gameserver.data.manager.ZoneManager;
15
import net.sf.l2j.gameserver.data.xml.DoorData;
16
import net.sf.l2j.gameserver.enums.SayType;
17
import net.sf.l2j.gameserver.enums.skills.AbnormalEffect;
18
import net.sf.l2j.gameserver.enums.skills.FlyType;
19
import net.sf.l2j.gameserver.model.actor.Attackable;
20
import net.sf.l2j.gameserver.model.actor.Creature;
21
import net.sf.l2j.gameserver.model.actor.Npc;
22
import net.sf.l2j.gameserver.model.actor.Player;
23
import net.sf.l2j.gameserver.model.actor.instance.GrandBoss;
24
import net.sf.l2j.gameserver.model.actor.instance.Monster;
25
import net.sf.l2j.gameserver.model.group.CommandChannel;
26
import net.sf.l2j.gameserver.model.group.Party;
27
import net.sf.l2j.gameserver.model.zone.type.BossZone;
28
import net.sf.l2j.gameserver.network.SystemMessageId;
29
import net.sf.l2j.gameserver.network.serverpackets.AbstractNpcInfo;
30
import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
31
import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
32
import net.sf.l2j.gameserver.network.serverpackets.FlyToLocation;
33
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillCanceled;
34
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
35
import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
36
import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
37
import net.sf.l2j.gameserver.network.serverpackets.SpecialCamera;
38
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
39
import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
40
import net.sf.l2j.gameserver.scripting.script.ai.AttackableAIScript;
41
import net.sf.l2j.gameserver.skills.L2Skill;
42
 
43
public class Frintezza extends AttackableAIScript {
44
  private static BossZone ZONE = ZoneManager.getInstance().getZoneById(110012, BossZone.class);
45
  
46
  private static final int[][] _invadeLoc = new int[][] { { 174102, -76039, -5105 }, { 173235, -76884, -5105 }, { 175003, -76933, -5105 }, { 174196, -76190, -5105 }, { 174013, -76120, -5105 }, { 173263, -75161, -5105 } };
47
  
48
  private static final int[][] _skill = new int[][] { 
49
      { 5015, 1, 5000 }, { 5015, 4, 5000 }, { 5015, 2, 5000 }, { 5015, 5, 5000 }, { 5018, 1, 10000 }, { 5016, 1, 5000 }, { 5015, 3, 5000 }, { 5015, 6, 5000 }, { 5018, 2, 10000 }, { 5019, 1, 10000 }, 
50
      { 5016, 1, 5000 } };
51
  
52
  private static final int[][] _mobLoc = new int[][] { 
53
      { 18328, 172894, -76019, -5107, 243 }, { 18328, 174095, -77279, -5107, 16216 }, { 18328, 174111, -74833, -5107, 49043 }, { 18328, 175344, -76042, -5107, 32847 }, { 18330, 173489, -76227, -5134, 63565 }, { 18330, 173498, -75724, -5107, 58498 }, { 18330, 174365, -76745, -5107, 22424 }, { 18330, 174570, -75584, -5107, 31968 }, { 18330, 174613, -76179, -5107, 31471 }, { 18332, 173620, -75981, -5107, 4588 }, 
54
      { 18332, 173630, -76340, -5107, 62454 }, { 18332, 173755, -75613, -5107, 57892 }, { 18332, 173823, -76688, -5107, 2411 }, { 18332, 174000, -75411, -5107, 54718 }, { 18332, 174487, -75555, -5107, 33861 }, { 18332, 174517, -76471, -5107, 21893 }, { 18332, 174576, -76122, -5107, 31176 }, { 18332, 174600, -75841, -5134, 35927 }, { 18329, 173481, -76043, -5107, 61312 }, { 18329, 173539, -75678, -5107, 59524 }, 
55
      { 18329, 173584, -76386, -5107, 3041 }, { 18329, 173773, -75420, -5107, 51115 }, { 18329, 173777, -76650, -5107, 12588 }, { 18329, 174585, -76510, -5107, 21704 }, { 18329, 174623, -75571, -5107, 40141 }, { 18329, 174744, -76240, -5107, 29202 }, { 18329, 174769, -75895, -5107, 29572 }, { 18333, 173861, -76011, -5107, 383 }, { 18333, 173872, -76461, -5107, 8041 }, { 18333, 173898, -75668, -5107, 51856 }, 
56
      { 18333, 174422, -75689, -5107, 42878 }, { 18333, 174460, -76355, -5107, 27311 }, { 18333, 174483, -76041, -5107, 30947 }, { 18331, 173515, -76184, -5107, 6971 }, { 18331, 173516, -75790, -5134, 3142 }, { 18331, 173696, -76675, -5107, 6757 }, { 18331, 173766, -75502, -5134, 60827 }, { 18331, 174473, -75321, -5107, 37147 }, { 18331, 174493, -76505, -5107, 34503 }, { 18331, 174568, -75654, -5134, 41661 }, 
57
      { 18331, 174584, -76263, -5107, 31729 }, { 18339, 173892, -81592, -5123, 50849 }, { 18339, 173958, -81820, -5123, 7459 }, { 18339, 174128, -81805, -5150, 21495 }, { 18339, 174245, -81566, -5123, 41760 }, { 18334, 173264, -81529, -5072, 1646 }, { 18334, 173265, -81656, -5072, 441 }, { 18334, 173267, -81889, -5072, 0 }, { 18334, 173271, -82015, -5072, 65382 }, { 18334, 174867, -81655, -5073, 32537 }, 
58
      { 18334, 174868, -81890, -5073, 32768 }, { 18334, 174869, -81485, -5073, 32315 }, { 18334, 174871, -82017, -5073, 33007 }, { 18335, 173074, -80817, -5107, 8353 }, { 18335, 173128, -82702, -5107, 5345 }, { 18335, 173181, -82544, -5107, 65135 }, { 18335, 173191, -80981, -5107, 6947 }, { 18335, 174859, -80889, -5134, 24103 }, { 18335, 174924, -82666, -5107, 38710 }, { 18335, 174947, -80733, -5107, 22449 }, 
59
      { 18335, 175096, -82724, -5107, 42205 }, { 18336, 173435, -80512, -5107, 65215 }, { 18336, 173440, -82948, -5107, 417 }, { 18336, 173443, -83120, -5107, 1094 }, { 18336, 173463, -83064, -5107, 286 }, { 18336, 173465, -80453, -5107, 174 }, { 18336, 173465, -83006, -5107, 2604 }, { 18336, 173468, -82889, -5107, 316 }, { 18336, 173469, -80570, -5107, 65353 }, { 18336, 173469, -80628, -5107, 166 }, 
60
      { 18336, 173492, -83121, -5107, 394 }, { 18336, 173493, -80683, -5107, 0 }, { 18336, 173497, -80510, -5134, 417 }, { 18336, 173499, -82947, -5107, 0 }, { 18336, 173521, -83063, -5107, 316 }, { 18336, 173523, -82889, -5107, 128 }, { 18336, 173524, -80627, -5134, 65027 }, { 18336, 173524, -83007, -5107, 0 }, { 18336, 173526, -80452, -5107, 64735 }, { 18336, 173527, -80569, -5134, 65062 }, 
61
      { 18336, 174602, -83122, -5107, 33104 }, { 18336, 174604, -82949, -5107, 33184 }, { 18336, 174609, -80514, -5107, 33234 }, { 18336, 174609, -80684, -5107, 32851 }, { 18336, 174629, -80627, -5107, 33346 }, { 18336, 174632, -80570, -5107, 32896 }, { 18336, 174632, -83066, -5107, 32768 }, { 18336, 174635, -82893, -5107, 33594 }, { 18336, 174636, -80456, -5107, 32065 }, { 18336, 174639, -83008, -5107, 33057 }, 
62
      { 18336, 174660, -80512, -5107, 33057 }, { 18336, 174661, -83121, -5107, 32768 }, { 18336, 174663, -82948, -5107, 32768 }, { 18336, 174664, -80685, -5107, 32676 }, { 18336, 174687, -83008, -5107, 32520 }, { 18336, 174691, -83066, -5107, 32961 }, { 18336, 174692, -80455, -5107, 33202 }, { 18336, 174692, -80571, -5107, 32768 }, { 18336, 174693, -80630, -5107, 32994 }, { 18336, 174693, -82889, -5107, 32622 }, 
63
      { 18337, 172837, -82382, -5107, 58363 }, { 18337, 172867, -81123, -5107, 64055 }, { 18337, 172883, -82495, -5107, 64764 }, { 18337, 172916, -81033, -5107, 7099 }, { 18337, 172940, -82325, -5107, 58998 }, { 18337, 172946, -82435, -5107, 58038 }, { 18337, 172971, -81198, -5107, 14768 }, { 18337, 172992, -81091, -5107, 9438 }, { 18337, 173032, -82365, -5107, 59041 }, { 18337, 173064, -81125, -5107, 5827 }, 
64
      { 18337, 175014, -81173, -5107, 26398 }, { 18337, 175061, -82374, -5107, 43290 }, { 18337, 175096, -81080, -5107, 24719 }, { 18337, 175169, -82453, -5107, 37672 }, { 18337, 175172, -80972, -5107, 32315 }, { 18337, 175174, -82328, -5107, 41760 }, { 18337, 175197, -81157, -5107, 27617 }, { 18337, 175245, -82547, -5107, 40275 }, { 18337, 175249, -81075, -5107, 28435 }, { 18337, 175292, -82432, -5107, 42225 }, 
65
      { 18338, 173014, -82628, -5107, 11874 }, { 18338, 173033, -80920, -5107, 10425 }, { 18338, 173095, -82520, -5107, 49152 }, { 18338, 173115, -80986, -5107, 9611 }, { 18338, 173144, -80894, -5107, 5345 }, { 18338, 173147, -82602, -5107, 51316 }, { 18338, 174912, -80825, -5107, 24270 }, { 18338, 174935, -80899, -5107, 18061 }, { 18338, 175016, -82697, -5107, 39533 }, { 18338, 175041, -80834, -5107, 25420 }, 
66
      { 18338, 175071, -82549, -5107, 39163 }, { 18338, 175154, -82619, -5107, 36345 } };
67
  
68
  private static long _lastAction = 0L;
69
  
70
  private static int _angle = 0;
71
  
72
  private static int _heading = 0;
73
  
74
  private static int _locCycle = 0;
75
  
76
  private static int _bomber = 0;
77
  
78
  private static int _checkDie = 0;
79
  
80
  private static int _onCheck = 0;
81
  
82
  private static int _onSong = 0;
83
  
84
  private static int _abnormal = 0;
85
  
86
  private static int _onMorph = 0;
87
  
88
  private static int _scarlet_x = 0;
89
  
90
  private static int _scarlet_y = 0;
91
  
92
  private static int _scarlet_z = 0;
93
  
94
  private static int _scarlet_h = 0;
95
  
96
  private static int _weakScarlet_x = 0;
97
  
98
  private static int _weakScarlet_y = 0;
99
  
100
  private static int _eakScarlet_z = 0;
101
  
102
  private static int _secondMorph = 0;
103
  
104
  private static int _thirdMorph = 0;
105
  
106
  private static int _killHallAlarmDevice = 0;
107
  
108
  private static int _killDarkChoirPlayer = 0;
109
  
110
  private static int _killDarkChoirCaptain = 0;
111
  
112
  private static int _soulBreakArrowUse = 0;
113
  
114
  private GrandBoss _frintezza;
115
  
116
  private GrandBoss _weakScarlet;
117
  
118
  private GrandBoss _strongScarlet;
119
  
120
  private GrandBoss _activeScarlet;
121
  
122
  private Monster _demon1;
123
  
124
  private Monster _demon2;
125
  
126
  private Monster _demon3;
127
  
128
  private Monster _demon4;
129
  
130
  private Monster _portrait1;
131
  
132
  private Monster _portrait2;
133
  
134
  private Monster _portrait3;
135
  
136
  private Monster _portrait4;
137
  
138
  private Npc _frintezzaDummy;
139
  
140
  private Npc _overheadDummy;
141
  
142
  private Npc _portraitDummy1;
143
  
144
  private Npc _portraitDummy3;
145
  
146
  private Npc _scarletDummy;
147
  
148
  private static List<Player> _playersInside = new CopyOnWriteArrayList<>();
149
  
150
  private static List<Attackable> _minions = new CopyOnWriteArrayList<>();
151
  
152
  private Set<Npc> _roomMobs1 = ConcurrentHashMap.newKeySet();
153
  
154
  private Set<Npc> _roomMobs2 = ConcurrentHashMap.newKeySet();
155
  
156
  private static final int[] NPCS = new int[] { 
157
      29046, 29047, 29045, 18328, 18329, 18330, 18331, 18332, 18333, 18334, 
158
      18335, 18336, 18337, 18338, 18339, 29048, 29049, 29050, 29051, 32011 };
159
  
160
  public Frintezza() {
161
    super("ai/boss");
162
  }
163
  
164
  @Override
165
protected void registerNpcs() {
166
    addAttackId(NPCS);
167
    addKillId(NPCS);
168
    addSkillSeeId(new int[] { 29045, 29048, 29049 });
169
    addStartNpc(new int[] { 32011, 29061 });
170
    addTalkId(new int[] { 32011, 29061 });
171
    int status = GrandBossManager.getInstance().getBossStatus(29045);
172
    if (status == 3) {
173
      long temp = GrandBossManager.getInstance().getStatSet(29045).getLong("respawn_time") - System.currentTimeMillis();
174
      if (temp > 0L) {
175
        startQuestTimer("frintezza_unlock", null, null, temp);
176
      } else {
177
        GrandBossManager.getInstance().setBossStatus(29045, 0);
178
      } 
179
    } else if (status != 0) {
180
      GrandBossManager.getInstance().setBossStatus(29045, 0);
181
    } 
182
  }
183
  
184
  @Override
185
public String onTimer(String event, Npc npc, Player player) {
186
    if (event.equalsIgnoreCase("waiting")) {
187
      startQuestTimer("close", null, null, 27000L);
188
      startQuestTimer("camera_1", null, null, 30000L);
189
    } else if (event.equalsIgnoreCase("room1_spawn")) {
190
      CreatureSay cs = new CreatureSay(0, SayType.SHOUT, "Hall Alarm Device", "Intruders! Sound the alarm!");
191
      ZONE.broadcastPacket(cs);
192
      for (int i = 0; i <= 17; i++)
193
        _roomMobs1.add(addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0L, false)); 
194
    } else if (event.equalsIgnoreCase("room1_spawn2")) {
195
      for (int i = 18; i <= 26; i++)
196
        _roomMobs1.add(addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0L, false)); 
197
    } else if (event.equalsIgnoreCase("room1_spawn3")) {
198
      for (int i = 27; i <= 32; i++)
199
        _roomMobs1.add(addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0L, false)); 
200
    } else if (event.equalsIgnoreCase("room1_spawn4")) {
201
      for (int i = 33; i <= 40; i++)
202
        _roomMobs1.add(addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0L, false)); 
203
    } else if (event.equalsIgnoreCase("room2_spawn")) {
204
      for (int i = 41; i <= 44; i++)
205
        _roomMobs2.add(addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0L, false)); 
206
    } else if (event.equalsIgnoreCase("room2_spawn2")) {
207
      for (int i = 45; i <= 131; i++)
208
        _roomMobs2.add(addSpawn(_mobLoc[i][0], _mobLoc[i][1], _mobLoc[i][2], _mobLoc[i][3], _mobLoc[i][4], false, 0L, false)); 
209
    } else if (event.equalsIgnoreCase("room1_del")) {
210
      for (Npc mob : _roomMobs1) {
211
        if (mob != null)
212
          mob.deleteMe(); 
213
      } 
214
      _roomMobs1.clear();
215
    } else if (event.equalsIgnoreCase("room2_del")) {
216
      for (Npc mob : _roomMobs2) {
217
        if (mob != null)
218
          mob.deleteMe(); 
219
      } 
220
      _roomMobs2.clear();
221
    } else if (event.equalsIgnoreCase("room3_del")) {
222
      if (_demon1 != null)
223
        _demon1.deleteMe(); 
224
      if (_demon2 != null)
225
        _demon2.deleteMe(); 
226
      if (_demon3 != null)
227
        _demon3.deleteMe(); 
228
      if (_demon4 != null)
229
        _demon4.deleteMe(); 
230
      if (_portrait1 != null)
231
        _portrait1.deleteMe(); 
232
      if (_portrait2 != null)
233
        _portrait2.deleteMe(); 
234
      if (_portrait3 != null)
235
        _portrait3.deleteMe(); 
236
      if (_portrait4 != null)
237
        _portrait4.deleteMe(); 
238
      if (_frintezza != null)
239
        _frintezza.deleteMe(); 
240
      if (_weakScarlet != null)
241
        _weakScarlet.deleteMe(); 
242
      if (_strongScarlet != null)
243
        _strongScarlet.deleteMe(); 
244
      _demon1 = null;
245
      _demon2 = null;
246
      _demon3 = null;
247
      _demon4 = null;
248
      _portrait1 = null;
249
      _portrait2 = null;
250
      _portrait3 = null;
251
      _portrait4 = null;
252
      _frintezza = null;
253
      _weakScarlet = null;
254
      _strongScarlet = null;
255
      _activeScarlet = null;
256
    } else if (event.equalsIgnoreCase("clean")) {
257
      _lastAction = 0L;
258
      _locCycle = 0;
259
      _checkDie = 0;
260
      _onCheck = 0;
261
      _abnormal = 0;
262
      _onMorph = 0;
263
      _secondMorph = 0;
264
      _thirdMorph = 0;
265
      _killHallAlarmDevice = 0;
266
      _killDarkChoirPlayer = 0;
267
      _killDarkChoirCaptain = 0;
268
      _playersInside.clear();
269
    } else if (event.equalsIgnoreCase("close")) {
270
      int i;
271
      for (i = 25150051; i <= 25150058; i++)
272
        DoorData.getInstance().getDoor(i).closeMe(); 
273
      for (i = 25150061; i <= 25150070; i++)
274
        DoorData.getInstance().getDoor(i).closeMe(); 
275
      DoorData.getInstance().getDoor(25150042).closeMe();
276
      DoorData.getInstance().getDoor(25150043).closeMe();
277
      DoorData.getInstance().getDoor(25150045).closeMe();
278
      DoorData.getInstance().getDoor(25150046).closeMe();
279
    } else if (event.equalsIgnoreCase("loc_check")) {
280
      if (GrandBossManager.getInstance().getBossStatus(29045) == 2) {
281
        if (!ZONE.isInsideZone(npc))
282
          npc.teleportTo(174232, -88020, -5116, 0); 
283
        if (npc.getX() < 171932 || npc.getX() > 176532 || npc.getY() < -90320 || npc.getY() > -85720 || npc.getZ() < -5130)
284
          npc.teleportTo(174232, -88020, -5116, 0); 
285
      } 
286
    } else if (event.equalsIgnoreCase("camera_1")) {
287
      GrandBossManager.getInstance().setBossStatus(29045, 2);
288
      _frintezzaDummy = addSpawn(29052, 174240, -89805, -5022, 16048, false, 0L, false);
289
      _frintezzaDummy.setInvul(true);
290
      _frintezzaDummy.setIsImmobilized(true);
291
      _overheadDummy = addSpawn(29052, 174232, -88020, -5110, 16384, false, 0L, false);
292
      _overheadDummy.setInvul(true);
293
      _overheadDummy.setIsImmobilized(true);
294
      _overheadDummy.setCollisionHeight(600.0D);
295
      ZONE.broadcastPacket(new AbstractNpcInfo.NpcInfo(_overheadDummy, null));
296
      _portraitDummy1 = addSpawn(29052, 172450, -87890, -5100, 16048, false, 0L, false);
297
      _portraitDummy1.setIsImmobilized(true);
298
      _portraitDummy1.setInvul(true);
299
      _portraitDummy3 = addSpawn(29052, 176012, -87890, -5100, 16048, false, 0L, false);
300
      _portraitDummy3.setIsImmobilized(true);
301
      _portraitDummy3.setInvul(true);
302
      _scarletDummy = addSpawn(29053, 174232, -88020, -5110, 16384, false, 0L, false);
303
      _scarletDummy.setInvul(true);
304
      _scarletDummy.setIsImmobilized(true);
305
      startQuestTimer("stop_pc", npc, null, 0L);
306
      startQuestTimer("camera_2", _overheadDummy, null, 1000L);
307
    } else if (event.equalsIgnoreCase("camera_2")) {
308
      ZONE.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 0, 75, -89, 0, 100, 0, 0, 1, 0));
309
      startQuestTimer("camera_2b", _overheadDummy, null, 0L);
310
    } else if (event.equalsIgnoreCase("camera_2b")) {
311
      ZONE.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 0, 75, -89, 0, 100, 0, 0, 1, 0));
312
      startQuestTimer("camera_3", _overheadDummy, null, 0L);
313
    } else if (event.equalsIgnoreCase("camera_3")) {
314
      ZONE.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 300, 90, -10, 6500, 7000, 0, 0, 1, 0));
315
      _frintezza = (GrandBoss)addSpawn(29045, 174240, -89805, -5022, 16384, false, 0L, false);
316
      GrandBossManager.getInstance().addBoss(_frintezza);
317
      _frintezza.setIsImmobilized(true);
318
      _frintezza.setInvul(true);
319
      _frintezza.disableAllSkills();
320
      _demon2 = (Monster)addSpawn(29051, 175876, -88713, -5100, 28205, false, 0L, false);
321
      _demon2.setIsImmobilized(true);
322
      _demon2.disableAllSkills();
323
      _demon3 = (Monster)addSpawn(29051, 172608, -88702, -5100, 64817, false, 0L, false);
324
      _demon3.setIsImmobilized(true);
325
      _demon3.disableAllSkills();
326
      _demon1 = (Monster)addSpawn(29050, 175833, -87165, -5100, 35048, false, 0L, false);
327
      _demon1.setIsImmobilized(true);
328
      _demon1.disableAllSkills();
329
      _demon4 = (Monster)addSpawn(29050, 172634, -87165, -5100, 57730, false, 0L, false);
330
      _demon4.setIsImmobilized(true);
331
      _demon4.disableAllSkills();
332
      startQuestTimer("camera_4", _overheadDummy, null, 6500L);
333
    } else if (event.equalsIgnoreCase("camera_4")) {
334
      ZONE.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(), 1800, 90, 8, 6500, 7000, 0, 0, 1, 0));
335
      startQuestTimer("camera_5", _frintezzaDummy, null, 900L);
336
    } else if (event.equalsIgnoreCase("camera_5")) {
337
      ZONE.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(), 140, 90, 10, 2500, 4500, 0, 0, 1, 0));
338
      startQuestTimer("camera_5b", _frintezzaDummy, null, 4000L);
339
    } else if (event.equalsIgnoreCase("camera_5b")) {
340
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 40, 75, -10, 0, 1000, 0, 0, 1, 0));
341
      startQuestTimer("camera_6", _frintezza, null, 0L);
342
    } else if (event.equalsIgnoreCase("camera_6")) {
343
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 40, 75, -10, 0, 12000, 0, 0, 1, 0));
344
      startQuestTimer("camera_7", _frintezza, null, 1350L);
345
    } else if (event.equalsIgnoreCase("camera_7")) {
346
      ZONE.broadcastPacket(new SocialAction(_frintezza, 2));
347
      startQuestTimer("camera_8", _frintezza, null, 7000L);
348
    } else if (event.equalsIgnoreCase("camera_8")) {
349
      startQuestTimer("camera_9", _frintezza, null, 1000L);
350
      _frintezzaDummy.deleteMe();
351
      _frintezzaDummy = null;
352
    } else if (event.equalsIgnoreCase("camera_9")) {
353
      ZONE.broadcastPacket(new SocialAction(_demon2, 1));
354
      ZONE.broadcastPacket(new SocialAction(_demon3, 1));
355
      startQuestTimer("camera_9b", _frintezza, null, 400L);
356
    } else if (event.equalsIgnoreCase("camera_9b")) {
357
      ZONE.broadcastPacket(new SocialAction(_demon1, 1));
358
      ZONE.broadcastPacket(new SocialAction(_demon4, 1));
359
      for (Creature pc : ZONE.getKnownTypeInside(Player.class)) {
360
        if (pc.getX() < 174232) {
361
          pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(), 1000, 118, 0, 0, 1000, 0, 0, 1, 0));
362
          continue;
363
        } 
364
        pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(), 1000, 62, 0, 0, 1000, 0, 0, 1, 0));
365
      } 
366
      startQuestTimer("camera_9c", _frintezza, null, 0L);
367
    } else if (event.equalsIgnoreCase("camera_9c")) {
368
      for (Creature pc : ZONE.getKnownTypeInside(Player.class)) {
369
        if (pc.getX() < 174232) {
370
          pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(), 1000, 118, 0, 0, 10000, 0, 0, 1, 0));
371
          continue;
372
        } 
373
        pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(), 1000, 62, 0, 0, 10000, 0, 0, 1, 0));
374
      } 
375
      startQuestTimer("camera_10", _frintezza, null, 2000L);
376
    } else if (event.equalsIgnoreCase("camera_10")) {
377
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 240, 90, 0, 0, 1000, 0, 0, 1, 0));
378
      startQuestTimer("camera_11", _frintezza, null, 0L);
379
    } else if (event.equalsIgnoreCase("camera_11")) {
380
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 240, 90, 25, 5500, 8000, 0, 0, 1, 0));
381
      ZONE.broadcastPacket(new SocialAction(_frintezza, 3));
382
      _portraitDummy1.deleteMe();
383
      _portraitDummy3.deleteMe();
384
      _portraitDummy1 = null;
385
      _portraitDummy3 = null;
386
      startQuestTimer("camera_11b", _frintezza, null, 4100L);
387
      startQuestTimer("camera_12", _frintezza, null, 2500L);
388
    } else if (event.equalsIgnoreCase("camera_11b")) {
389
      ZONE.broadcastPacket(new MagicSkillUse(_frintezza, _frintezza, 5006, 1, 34000, 0));
390
    } else if (event.equalsIgnoreCase("camera_12")) {
391
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 100, 195, 35, 0, 10000, 0, 0, 1, 0));
392
      startQuestTimer("camera_13", _frintezza, null, 700L);
393
    } else if (event.equalsIgnoreCase("camera_13")) {
394
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 100, 195, 35, 0, 10000, 0, 0, 1, 0));
395
      startQuestTimer("camera_14", _frintezza, null, 1300L);
396
    } else if (event.equalsIgnoreCase("camera_14")) {
397
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 120, 180, 45, 1500, 10000, 0, 0, 1, 0));
398
      startQuestTimer("camera_16", _frintezza, null, 1500L);
399
    } else if (event.equalsIgnoreCase("camera_16")) {
400
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 520, 135, 45, 8000, 10000, 0, 0, 1, 0));
401
      startQuestTimer("camera_17", _frintezza, null, 7500L);
402
    } else if (event.equalsIgnoreCase("camera_17")) {
403
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 1500, 110, 25, 10000, 13000, 0, 0, 1, 0));
404
      startQuestTimer("camera_18", _frintezza, null, 9500L);
405
    } else if (event.equalsIgnoreCase("camera_18")) {
406
      ZONE.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 930, 160, -20, 0, 1000, 0, 0, 1, 0));
407
      startQuestTimer("camera_18b", _overheadDummy, null, 0L);
408
    } else if (event.equalsIgnoreCase("camera_18b")) {
409
      ZONE.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 600, 180, -25, 0, 10000, 0, 0, 1, 0));
410
      ZONE.broadcastPacket(new MagicSkillUse(_scarletDummy, _scarletDummy, 5004, 1, 5800, 0));
411
      _weakScarlet = (GrandBoss)addSpawn(29046, 174232, -88020, -5114, 20458, false, 0L, true);
412
      _weakScarlet.setInvul(true);
413
      _weakScarlet.setIsImmobilized(true);
414
      _weakScarlet.disableAllSkills();
415
      _activeScarlet = _weakScarlet;
416
      startQuestTimer("camera_19", _scarletDummy, null, 2400L);
417
      startQuestTimer("camera_19b", _scarletDummy, null, 5000L);
418
      startQuestTimer("camera_19c", _scarletDummy, null, 6300L);
419
    } else if (event.equalsIgnoreCase("camera_19")) {
420
      _weakScarlet.teleportTo(174232, -88020, -5114, 0);
421
    } else if (event.equalsIgnoreCase("camera_19b")) {
422
      ZONE.broadcastPacket(new SpecialCamera(_scarletDummy.getObjectId(), 800, 180, 10, 1000, 10000, 0, 0, 1, 0));
423
      startQuestTimer("camera_20", _scarletDummy, null, 2100L);
424
    } else if (event == "camera_19c") {
425
      throwUp(npc, 500.0D, SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5004, 1));
426
    } else if (event.equalsIgnoreCase("camera_20")) {
427
      ZONE.broadcastPacket(new SpecialCamera(_weakScarlet.getObjectId(), 300, 60, 8, 0, 10000, 0, 0, 1, 0));
428
      startQuestTimer("camera_21", _weakScarlet, null, 2000L);
429
    } else if (event.equalsIgnoreCase("camera_21")) {
430
      ZONE.broadcastPacket(new SpecialCamera(_weakScarlet.getObjectId(), 500, 90, 10, 3000, 5000, 0, 0, 1, 0));
431
      startQuestTimer("camera_22", _weakScarlet, null, 3000L);
432
    } else if (event.equalsIgnoreCase("camera_22")) {
433
      _portrait2 = (Monster)addSpawn(29049, 175876, -88713, -5000, 28205, false, 0L, false);
434
      _portrait2.setIsImmobilized(true);
435
      _portrait2.disableAllSkills();
436
      _portrait3 = (Monster)addSpawn(29049, 172608, -88702, -5000, 64817, false, 0L, false);
437
      _portrait3.setIsImmobilized(true);
438
      _portrait3.disableAllSkills();
439
      _portrait1 = (Monster)addSpawn(29048, 175833, -87165, -5000, 35048, false, 0L, false);
440
      _portrait1.setIsImmobilized(true);
441
      _portrait1.disableAllSkills();
442
      _portrait4 = (Monster)addSpawn(29048, 172634, -87165, -5000, 57730, false, 0L, false);
443
      _portrait4.setIsImmobilized(true);
444
      _portrait4.disableAllSkills();
445
      _overheadDummy.deleteMe();
446
      _scarletDummy.deleteMe();
447
      _overheadDummy = null;
448
      _scarletDummy = null;
449
      startQuestTimer("camera_23", _weakScarlet, null, 2000L);
450
      startQuestTimer("start_pc", _weakScarlet, null, 2000L);
451
      startQuestTimer("loc_check", _weakScarlet, null, 60000L);
452
      startQuestTimerAtFixedRate("songs_play", _frintezza, null, (10000 + Rnd.get(10000)));
453
      startQuestTimer("skill01", _weakScarlet, null, (10000 + Rnd.get(10000)));
454
    } else if (event.equalsIgnoreCase("camera_23")) {
455
      _demon1.setIsImmobilized(false);
456
      _demon2.setIsImmobilized(false);
457
      _demon3.setIsImmobilized(false);
458
      _demon4.setIsImmobilized(false);
459
      _demon1.enableAllSkills();
460
      _demon2.enableAllSkills();
461
      _demon3.enableAllSkills();
462
      _demon4.enableAllSkills();
463
      _portrait1.setIsImmobilized(false);
464
      _portrait2.setIsImmobilized(false);
465
      _portrait3.setIsImmobilized(false);
466
      _portrait4.setIsImmobilized(false);
467
      _portrait1.enableAllSkills();
468
      _portrait2.enableAllSkills();
469
      _portrait3.enableAllSkills();
470
      _portrait4.enableAllSkills();
471
      _weakScarlet.setInvul(false);
472
      _weakScarlet.setIsImmobilized(false);
473
      _weakScarlet.enableAllSkills();
474
      _weakScarlet.setMove();
475
      startQuestTimer("spawn_minion", _portrait1, null, 20000L);
476
      startQuestTimer("spawn_minion", _portrait2, null, 20000L);
477
      startQuestTimer("spawn_minion", _portrait3, null, 20000L);
478
      startQuestTimer("spawn_minion", _portrait4, null, 20000L);
479
    } else if (event.equalsIgnoreCase("stop_pc")) {
480
      for (Creature cha : ZONE.getKnownTypeInside(Player.class)) {
481
        cha.abortAll(true);
482
        cha.disableAllSkills();
483
        cha.setTarget(null);
484
        cha.setInvul(true);
485
        cha.setIsImmobilized(true);
486
        cha.getAI().tryToIdle();
487
      } 
488
    } else if (event.equalsIgnoreCase("start_pc")) {
489
      for (Creature cha : ZONE.getKnownTypeInside(Player.class)) {
490
        cha.enableAllSkills();
491
        cha.setIsImmobilized(false);
492
      } 
493
    } else if (event.equalsIgnoreCase("stop_npc")) {
494
      for (Npc mob : ZONE.getKnownTypeInside(Npc.class)) {
495
        if (mob.getNpcId() != 29045) {
496
          mob.abortAll(false);
497
          mob.disableAllSkills();
498
          mob.setInvul(true);
499
          mob.setIsImmobilized(true);
500
          mob.getAI().tryToIdle();
501
        } 
502
      } 
503
    } else if (event.equalsIgnoreCase("start_npc")) {
504
      for (Npc mob : ZONE.getKnownTypeInside(Npc.class)) {
505
        if (mob.getNpcId() != 29045) {
506
          mob.enableAllSkills();
507
          mob.isRunning();
508
          mob.setInvul(false);
509
          mob.setIsImmobilized(false);
510
        } 
511
      } 
512
    } else if (event.equalsIgnoreCase("morph_end")) {
513
      _onMorph = 0;
514
    } else if (event.equalsIgnoreCase("morph_01")) {
515
      _heading = npc.getHeading();
516
      if (_heading < 32768) {
517
        _angle = Math.abs(180 - (int)(_heading / 182.044444444D));
518
      } else {
519
        _angle = Math.abs(540 - (int)(_heading / 182.044444444D));
520
      } 
521
      _weakScarlet_x = _weakScarlet.getX();
522
      _weakScarlet_y = _weakScarlet.getY();
523
      _eakScarlet_z = _weakScarlet.getZ() + 50;
524
      _weakScarlet.teleportTo(_weakScarlet_x, _weakScarlet_y, _eakScarlet_z, 0);
525
      ZONE.broadcastPacket(new SpecialCamera(_weakScarlet.getObjectId(), 250, _angle, 12, 2000, 11000, 0, 0, 1, 0));
526
      startQuestTimer("morph_02", _weakScarlet, null, 3000L);
527
    } else if (event.equalsIgnoreCase("morph_02")) {
528
      ZONE.broadcastPacket(new SocialAction(_weakScarlet, 1));
529
      _weakScarlet.setRightHandItemId(7903);
530
      startQuestTimer("morph_03", _weakScarlet, null, 1500L);
531
    } else if (event.equalsIgnoreCase("morph_03")) {
532
      startQuestTimer("morph_04", _weakScarlet, null, 1500L);
533
    } else if (event.equalsIgnoreCase("morph_04")) {
534
      ZONE.broadcastPacket(new SocialAction(_weakScarlet, 4));
535
      L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
536
      if (skill != null)
537
        skill.getEffects(_weakScarlet, _weakScarlet); 
538
      startQuestTimer("morph_end", _weakScarlet, null, 3000L);
539
      startQuestTimer("start_pc", _weakScarlet, player, 1000L);
540
      startQuestTimer("start_npc", _weakScarlet, player, 1000L);
541
      startQuestTimerAtFixedRate("songs_play", _frintezza, null, (10000 + Rnd.get(10000)));
542
      startQuestTimer("skill02", _weakScarlet, null, (10000 + Rnd.get(10000)));
543
    } else if (event.equalsIgnoreCase("morph_05a")) {
544
      ZONE.broadcastPacket(new SocialAction(_frintezza, 4));
545
    } else if (event.equalsIgnoreCase("morph_05")) {
546
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 250, 120, 15, 0, 1000, 0, 0, 1, 0));
547
      startQuestTimer("morph_06", _frintezza, null, 0L);
548
    } else if (event.equalsIgnoreCase("morph_06")) {
549
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 250, 120, 15, 0, 10000, 0, 0, 1, 0));
550
      cancelQuestTimers("loc_check");
551
      _scarlet_x = _weakScarlet.getX();
552
      _scarlet_y = _weakScarlet.getY();
553
      _scarlet_z = _weakScarlet.getZ();
554
      _scarlet_h = _weakScarlet.getHeading();
555
      _weakScarlet.deleteMe();
556
      _weakScarlet = null;
557
      _activeScarlet = null;
558
      _weakScarlet = (GrandBoss)addSpawn(29046, _scarlet_x, _scarlet_y, _scarlet_z, _scarlet_h, false, 0L, false);
559
      _weakScarlet.setInvul(true);
560
      _weakScarlet.setIsImmobilized(true);
561
      _weakScarlet.disableAllSkills();
562
      _weakScarlet.setRightHandItemId(7903);
563
      startQuestTimer("morph_07", _frintezza, null, 4000L);
564
    } else if (event.equalsIgnoreCase("morph_07")) {
565
      ZONE.broadcastPacket(new MagicSkillUse(_frintezza, _frintezza, 5006, 1, 34000, 0));
566
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 500, 70, 15, 3000, 10000, 0, 0, 1, 0));
567
      startQuestTimer("morph_08", _frintezza, null, 3000L);
568
    } else if (event.equalsIgnoreCase("morph_08")) {
569
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 2500, 90, 12, 6000, 10000, 0, 0, 1, 0));
570
      startQuestTimer("morph_09", _frintezza, null, 3000L);
571
    } else if (event.equalsIgnoreCase("morph_09")) {
572
      _heading = npc.getHeading();
573
      if (_heading < 32768) {
574
        _angle = Math.abs(180 - (int)(_heading / 182.044444444D));
575
      } else {
576
        _angle = Math.abs(540 - (int)(_heading / 182.044444444D));
577
      } 
578
      ZONE.broadcastPacket(new SpecialCamera(_weakScarlet.getObjectId(), 250, _angle, 12, 0, 1000, 0, 0, 1, 0));
579
      startQuestTimer("morph_10", _weakScarlet, null, 0L);
580
    } else if (event.equalsIgnoreCase("morph_10")) {
581
      _heading = npc.getHeading();
582
      if (_heading < 32768) {
583
        _angle = Math.abs(180 - (int)(_heading / 182.044444444D));
584
      } else {
585
        _angle = Math.abs(540 - (int)(_heading / 182.044444444D));
586
      } 
587
      ZONE.broadcastPacket(new SpecialCamera(_weakScarlet.getObjectId(), 250, _angle, 12, 0, 10000, 0, 0, 1, 0));
588
      startQuestTimer("morph_11", _weakScarlet, null, 500L);
589
    } else if (event.equalsIgnoreCase("morph_11")) {
590
      _heading = npc.getHeading();
591
      if (_heading < 32768) {
592
        _angle = Math.abs(180 - (int)(_heading / 182.044444444D));
593
      } else {
594
        _angle = Math.abs(540 - (int)(_heading / 182.044444444D));
595
      } 
596
      _weakScarlet.doDie(_weakScarlet);
597
      ZONE.broadcastPacket(new SpecialCamera(_weakScarlet.getObjectId(), 450, _angle, 14, 8000, 8000, 0, 0, 1, 0));
598
      startQuestTimer("morph_12", _weakScarlet, null, 6250L);
599
      startQuestTimer("morph_13", _weakScarlet, null, 7200L);
600
    } else if (event.equalsIgnoreCase("morph_12")) {
601
      _weakScarlet.deleteMe();
602
      _weakScarlet = null;
603
    } else if (event.equalsIgnoreCase("morph_13")) {
604
      _heading = npc.getHeading();
605
      if (_heading < 32768) {
606
        _angle = Math.abs(180 - (int)(_heading / 182.044444444D));
607
      } else {
608
        _angle = Math.abs(540 - (int)(_heading / 182.044444444D));
609
      } 
610
      _strongScarlet = (GrandBoss)addSpawn(29047, _scarlet_x, _scarlet_y, _scarlet_z, _scarlet_h, false, 0L, false);
611
      _strongScarlet.setInvul(true);
612
      _strongScarlet.setIsImmobilized(true);
613
      _strongScarlet.disableAllSkills();
614
      _activeScarlet = _strongScarlet;
615
      ZONE.broadcastPacket(new SpecialCamera(_strongScarlet.getObjectId(), 450, _angle, 12, 500, 20000, 0, 0, 1, 0));
616
      startQuestTimer("morph_14", _strongScarlet, null, 3000L);
617
      startQuestTimer("loc_check", _strongScarlet, null, 60000L);
618
    } else if (event.equalsIgnoreCase("morph_14")) {
619
      startQuestTimer("morph_15", _strongScarlet, null, 11100L);
620
    } else if (event.equalsIgnoreCase("morph_15")) {
621
      ZONE.broadcastPacket(new SocialAction(_strongScarlet, 2));
622
      L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
623
      if (skill != null)
624
        skill.getEffects(_strongScarlet, _strongScarlet); 
625
      startQuestTimer("morph_end", _strongScarlet, null, 9000L);
626
      startQuestTimer("start_pc", _strongScarlet, null, 6000L);
627
      startQuestTimer("start_npc", _strongScarlet, null, 6000L);
628
      startQuestTimerAtFixedRate("songs_play", _frintezza, null, (10000 + Rnd.get(10000)));
629
      startQuestTimer("skill03", _strongScarlet, null, (10000 + Rnd.get(10000)));
630
    } else if (event.equalsIgnoreCase("morph_16")) {
631
      _heading = npc.getHeading();
632
      if (_heading < 32768) {
633
        _angle = Math.abs(180 - (int)(_heading / 182.044444444D));
634
      } else {
635
        _angle = Math.abs(540 - (int)(_heading / 182.044444444D));
636
      } 
637
      ZONE.broadcastPacket(new SpecialCamera(_strongScarlet.getObjectId(), 300, _angle - 180, 5, 0, 7000, 0, 0, 1, 0));
638
      startQuestTimer("morph_17", _strongScarlet, null, 0L);
639
    } else if (event.equalsIgnoreCase("morph_17")) {
640
      _heading = npc.getHeading();
641
      if (_heading < 32768) {
642
        _angle = Math.abs(180 - (int)(_heading / 182.044444444D));
643
      } else {
644
        _angle = Math.abs(540 - (int)(_heading / 182.044444444D));
645
      } 
646
      ZONE.broadcastPacket(new SpecialCamera(_strongScarlet.getObjectId(), 200, _angle, 85, 4000, 10000, 0, 0, 1, 0));
647
      startQuestTimer("morph_17b", _frintezza, null, 7400L);
648
      startQuestTimer("morph_18", _frintezza, null, 7500L);
649
    } else if (event.equalsIgnoreCase("morph_17b")) {
650
      _frintezza.doDie(_frintezza);
651
    } else if (event.equalsIgnoreCase("morph_18")) {
652
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 100, 120, 5, 0, 7000, 0, 0, 1, 0));
653
      startQuestTimer("morph_19", _frintezza, null, 0L);
654
    } else if (event.equalsIgnoreCase("morph_19")) {
655
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 100, 90, 5, 5000, 15000, 0, 0, 1, 0));
656
      startQuestTimer("morph_20", _frintezza, null, 7000L);
657
      startQuestTimer("spawn_cubes", _frintezza, null, 7000L);
658
    } else if (event.equalsIgnoreCase("morph_20")) {
659
      ZONE.broadcastPacket(new SpecialCamera(_frintezza.getObjectId(), 900, 90, 25, 7000, 10000, 0, 0, 1, 0));
660
      startQuestTimer("start_pc", _frintezza, null, 7000L);
661
    } else if (event.equalsIgnoreCase("songs_play")) {
662
      _soulBreakArrowUse = 0;
663
      if (_frintezza != null && !_frintezza.isDead() && _onMorph == 0) {
664
        _onSong = Rnd.get(1, 5);
665
        String SongName = "";
666
        switch (_onSong) {
667
          case 1:
668
            SongName = "Frintezza's Healing Rhapsody";
669
            break;
670
          case 2:
671
            SongName = "Frintezza's Rampaging Opus";
672
            break;
673
          case 3:
674
            SongName = "Frintezza's Power Concerto";
675
            break;
676
          case 4:
677
            SongName = "Frintezza's Plagued Concerto";
678
            break;
679
          case 5:
680
            SongName = "Frintezza's Psycho Symphony";
681
            break;
682
          default:
683
            SongName = "Frintezza's Song";
684
            break;
685
        } 
686
        ZONE.broadcastPacket(new ExShowScreenMessage(SongName, 6000));
687
        if (_onSong == 1 && _thirdMorph == 1 && _strongScarlet.getStatus().getHp() < _strongScarlet.getStatus().getMaxHp() * 0.6D && Rnd.get(100) < 80) {
688
          ZONE.broadcastPacket(new MagicSkillUse(_frintezza, _frintezza, 5007, 1, 32000, 0));
689
          startQuestTimer("songs_effect", _frintezza, null, 5000L);
690
          startQuestTimerAtFixedRate("songs_play", _frintezza, null, (32000 + Rnd.get(10000)));
691
        } else if (_onSong == 2 || _onSong == 3) {
692
          ZONE.broadcastPacket(new MagicSkillUse(_frintezza, _frintezza, 5007, _onSong, 32000, 0));
693
          startQuestTimer("songs_effect", _frintezza, null, 5000L);
694
          startQuestTimerAtFixedRate("songs_play", _frintezza, null, (32000 + Rnd.get(10000)));
695
        } else if (_onSong == 4 && _secondMorph == 1) {
696
          ZONE.broadcastPacket(new MagicSkillUse(_frintezza, _frintezza, 5007, 4, 31000, 0));
697
          startQuestTimer("songs_effect", _frintezza, null, 5000L);
698
          startQuestTimerAtFixedRate("songs_play", _frintezza, null, (31000 + Rnd.get(10000)));
699
        } else if (_onSong == 5 && _thirdMorph == 1 && _abnormal == 0) {
700
          _abnormal = 1;
701
          ZONE.broadcastPacket(new MagicSkillUse(_frintezza, _frintezza, 5007, 5, 35000, 0));
702
          startQuestTimer("songs_effect", _frintezza, null, 5000L);
703
          startQuestTimerAtFixedRate("songs_play", _frintezza, null, (35000 + Rnd.get(10000)));
704
        } else {
705
          startQuestTimerAtFixedRate("songs_play", _frintezza, null, (5000 + Rnd.get(50000)));
706
        } 
707
      } 
708
    } else if (event.equalsIgnoreCase("songs_effect")) {
709
      L2Skill skill = SkillTable.getInstance().getInfo(5008, _onSong);
710
      if (skill == null)
711
        return null; 
712
      if (_onSong == 1 || _onSong == 2 || _onSong == 3) {
713
        if (_frintezza != null && !_frintezza.isDead() && _activeScarlet != null && !_activeScarlet.isDead())
714
          skill.getEffects(_frintezza, _activeScarlet); 
715
      } else if (_onSong == 4) {
716
        for (Creature cha : ZONE.getKnownTypeInside(Player.class)) {
717
          if (Rnd.get(100) < 80) {
718
            skill.getEffects(_frintezza, cha);
719
            cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 4));
720
          } 
721
        } 
722
      } else if (_onSong == 5) {
723
        for (Creature cha : ZONE.getKnownTypeInside(Player.class)) {
724
          if (Rnd.get(100) < 70) {
725
            cha.abortAll(true);
726
            cha.disableAllSkills();
727
            cha.setIsParalyzed(true);
728
            cha.setIsImmobilized(true);
729
            cha.getAI().tryToIdle();
730
            skill.getEffects(_frintezza, cha);
731
            cha.startAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
732
            cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 5));
733
          } 
734
        } 
735
        startQuestTimer("stop_effect", _frintezza, null, 25000L);
736
      } 
737
    } else if (event.equalsIgnoreCase("stop_effect")) {
738
      for (Creature cha : ZONE.getKnownTypeInside(Player.class)) {
739
        cha.stopAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
740
        cha.stopAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
741
        cha.enableAllSkills();
742
        cha.setIsImmobilized(false);
743
        cha.setIsParalyzed(false);
744
      } 
745
      _abnormal = 0;
746
    } else if (event.equalsIgnoreCase("attack_stop")) {
747
      cancelQuestTimers("skill01");
748
      cancelQuestTimers("skill02");
749
      cancelQuestTimers("skill03");
750
      cancelQuestTimers("songs_play");
751
      cancelQuestTimers("songs_effect");
752
      ZONE.broadcastPacket(new MagicSkillCanceled(_frintezza.getObjectId()));
753
    } else if (event.equalsIgnoreCase("check_hp")) {
754
      if (npc.isDead()) {
755
        _onMorph = 1;
756
        ZONE.broadcastPacket(new PlaySound("BS01_D"));
757
        startQuestTimer("attack_stop", _frintezza, null, 0L);
758
        startQuestTimer("stop_pc", npc, null, 0L);
759
        startQuestTimer("stop_npc", npc, null, 0L);
760
        startQuestTimer("morph_16", npc, null, 0L);
761
      } else {
762
        _checkDie += 10;
763
        if (_checkDie < 3000) {
764
          startQuestTimer("check_hp", npc, null, 10L);
765
        } else {
766
          _onCheck = 0;
767
          _checkDie = 0;
768
        } 
769
      } 
770
    } else if (event.equalsIgnoreCase("skill01")) {
771
      if (_weakScarlet != null && !_weakScarlet.isDead() && _secondMorph == 0 && _thirdMorph == 0 && _onMorph == 0) {
772
        int i = Rnd.get(0, 1);
773
        L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0], _skill[i][1]);
774
        if (skill != null) {
775
          _weakScarlet.getMove().stop();
776
          _weakScarlet.getCast().isCastingNow();
777
          _weakScarlet.getAI().tryToCast(player, skill);
778
        } 
779
        startQuestTimer("skill01", npc, null, (_skill[i][2] + 5000 + Rnd.get(10000)));
780
      } 
781
    } else if (event.equalsIgnoreCase("skill02")) {
782
      if (_weakScarlet != null && !_weakScarlet.isDead() && _secondMorph == 1 && _thirdMorph == 0 && _onMorph == 0) {
783
        int i = 0;
784
        if (_abnormal == 0) {
785
          i = Rnd.get(2, 5);
786
        } else {
787
          i = Rnd.get(2, 4);
788
        } 
789
        L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0], _skill[i][1]);
790
        if (skill != null) {
791
          _weakScarlet.getMove().stop();
792
          _weakScarlet.getCast().isCastingNow();
793
          _weakScarlet.getAI().tryToCast(player, skill);
794
        } 
795
        startQuestTimer("skill02", npc, null, (_skill[i][2] + 5000 + Rnd.get(10000)));
796
        if (i == 5) {
797
          _abnormal = 1;
798
          startQuestTimer("float_effect", _weakScarlet, null, 4000L);
799
        } 
800
      } 
801
    } else if (event.equalsIgnoreCase("skill03")) {
802
      if (_strongScarlet != null && !_strongScarlet.isDead() && _secondMorph == 1 && _thirdMorph == 1 && _onMorph == 0) {
803
        int i = 0;
804
        if (_abnormal == 0) {
805
          i = Rnd.get(6, 10);
806
        } else {
807
          i = Rnd.get(6, 9);
808
        } 
809
        L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0], _skill[i][1]);
810
        if (skill != null) {
811
          _strongScarlet.getMove().stop();
812
          _strongScarlet.getCast().isCastingNow();
813
          _strongScarlet.getAI().tryToCast(player, skill);
814
        } 
815
        startQuestTimer("skill03", npc, null, (_skill[i][2] + 5000 + Rnd.get(10000)));
816
        if (i == 10) {
817
          _abnormal = 1;
818
          startQuestTimer("float_effect", npc, null, 3000L);
819
        } 
820
      } 
821
    } else if (event.equalsIgnoreCase("float_effect")) {
822
      if (npc.getCast().isCastingNow()) {
823
        startQuestTimer("float_effect", npc, null, 500L);
824
      } else {
825
        for (Creature cha : ZONE.getKnownTypeInside(Player.class)) {
826
          if (cha.getFirstEffect(5016) != null) {
827
            cha.abortAll(true);
828
            cha.disableAllSkills();
829
            cha.setIsParalyzed(true);
830
            cha.setIsImmobilized(true);
831
            cha.getAI().tryToIdle();
832
            cha.startAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
833
          } 
834
        } 
835
        startQuestTimer("stop_effect", npc, null, 25000L);
836
      } 
837
    } else if (event.equalsIgnoreCase("action")) {
838
      ZONE.broadcastPacket(new SocialAction(npc, 1));
839
    } else if (event.equalsIgnoreCase("bomber")) {
840
      _bomber = 0;
841
    } else if (event.equalsIgnoreCase("room_final")) {
842
      ZONE.broadcastPacket(new CreatureSay(npc.getObjectId(), SayType.SHOUT, null, "Exceeded his time limit, challenge failed!"));
843
      ZONE.oustAllPlayers();
844
      cancelQuestTimers("waiting");
845
      cancelQuestTimers("frintezza_despawn");
846
      startQuestTimer("clean", npc, null, 1000L);
847
      startQuestTimer("close", npc, null, 1000L);
848
      startQuestTimer("room1_del", npc, null, 1000L);
849
      startQuestTimer("room2_del", npc, null, 1000L);
850
      GrandBossManager.getInstance().setBossStatus(29045, 0);
851
    } else if (event.equalsIgnoreCase("frintezza_despawn")) {
852
      if (System.currentTimeMillis() - _lastAction > 900000L) {
853
        ZONE.oustAllPlayers();
854
        cancelQuestTimers("waiting");
855
        cancelQuestTimers("loc_check");
856
        cancelQuestTimers("room_final");
857
        cancelQuestTimers("spawn_minion");
858
        startQuestTimer("clean", npc, null, 1000L);
859
        startQuestTimer("close", npc, null, 1000L);
860
        startQuestTimer("attack_stop", npc, null, 1000L);
861
        startQuestTimer("room1_del", npc, null, 1000L);
862
        startQuestTimer("room2_del", npc, null, 1000L);
863
        startQuestTimer("room3_del", npc, null, 1000L);
864
        startQuestTimer("minions_despawn", npc, null, 1000L);
865
        GrandBossManager.getInstance().setBossStatus(29045, 0);
866
        cancelQuestTimers("frintezza_despawn");
867
      } 
868
    } else if (event.equalsIgnoreCase("minions_despawn")) {
869
      for (int i = 0; i < _minions.size(); i++) {
870
        Attackable mob = _minions.get(i);
871
        if (mob != null)
872
          mob.decayMe(); 
873
      } 
874
      _minions.clear();
875
    } else if (event.equalsIgnoreCase("spawn_minion")) {
876
      if (npc != null && !npc.isDead() && _frintezza != null && !_frintezza.isDead()) {
877
        Npc mob = addSpawn(npc.getNpcId() + 2, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0L, false);
878
        startQuestTimer("action", mob, null, 200L);
879
        startQuestTimer("spawn_minion", npc, null, 18000L);
880
      } 
881
    } else if (event.equalsIgnoreCase("spawn_cubes")) {
882
      addSpawn(29061, 174232, -88020, -5114, 16384, false, 900000L, false);
883
    } else if (event.equalsIgnoreCase("frintezza_unlock")) {
884
      GrandBossManager.getInstance().setBossStatus(29045, 0);
885
    } else if (event.equalsIgnoreCase("remove_players")) {
886
      ZONE.oustAllPlayers();
887
    } 
888
    return super.onTimer(event, npc, player);
889
  }
890
  
891
  @Override
892
public String onTalk(Npc npc, Player player) {
893
    if (npc.getNpcId() == 29061) {
894
      int x = 150037 + Rnd.get(500);
895
      int y = -57720 + Rnd.get(500);
896
      player.teleportTo(x, y, -2976, 0);
897
      return null;
898
    } 
899
    String htmltext = "";
900
    if (GrandBossManager.getInstance().getBossStatus(29045) == 3) {
901
      htmltext = "<html><body>There is nothing beyond the Magic Force Field. Come back later.<br>(You may not enter because Frintezza is not inside the Imperial Tomb.)</body></html>";
902
    } else if (GrandBossManager.getInstance().getBossStatus(29045) == 0) {
903
      boolean party_check_success = true;
904
      if (!player.isGM())
905
        if (!player.isInParty() || !player.getParty().isLeader(player) || player.getParty().getCommandChannel() == null || player.getParty().getCommandChannel().getLeader() != player) {
906
          htmltext = "<html><body>No reaction. Contact must be initiated by the Command Channel Leader.</body></html>";
907
          party_check_success = false;
908
        } else if (player.getParty().getCommandChannel().getParties().size() < Config.FRINTEZZA_MIN_PARTIES || player.getParty().getCommandChannel().getParties().size() > Config.FRINTEZZA_MAX_PARTIES) {
909
          htmltext = "<html><body>Your command channel needs to have at least 4 parties and a maximum of 5.</body></html>";
910
          party_check_success = false;
911
        }  
912
      if (party_check_success) {
913
        int FRINTEZZA_TEST_MODE = 0;
914
        if (FRINTEZZA_TEST_MODE == 1) {
915
          startQuestTimer("camera_1", npc, null, 5000L);
916
          player.teleportTo(174232, -88020, -5110, 0);
917
        } else if (player.getInventory().getItemByItemId(8073) == null) {
918
          htmltext = "<html><body>You dont have required item.</body></html>";
919
        } else {
920
          player.destroyItemByItemId("Quest", 8073, 1, player, true);
921
          GrandBossManager.getInstance().setBossStatus(29045, 1);
922
          startQuestTimer("close", null, null, 0L);
923
          startQuestTimer("room1_spawn", null, null, 5000L);
924
          startQuestTimer("room_final", null, null, 2100000L);
925
          startQuestTimer("frintezza_despawn", null, null, 60000L);
926
          _lastAction = System.currentTimeMillis();
927
          if (player.isGM()) {
928
            if (player.getParty() != null) {
929
              CommandChannel CC = player.getParty().getCommandChannel();
930
              if (CC != null) {
931
                for (Party party : CC.getParties()) {
932
                  if (party == null)
933
                    continue; 
934
                  synchronized (_playersInside) {
935
                    for (Player member : party.getMembers()) {
936
                      if (member == null || member.getStatus().getLevel() < 74)
937
                        continue; 
938
                      if (!member.isIn3DRadius(npc, 700))
939
                        continue; 
940
                      if (_playersInside.size() > 45) {
941
                        member.sendMessage("The number of challenges have been full, so can not enter.");
942
                        break;
943
                      } 
944
                      _playersInside.add(member);
945
                      ZONE.allowPlayerEntry(member, 300);
946
                      member.teleportTo(_invadeLoc[_locCycle][0] + Rnd.get(50), _invadeLoc[_locCycle][1] + Rnd.get(50), _invadeLoc[_locCycle][2], 0);
947
                    } 
948
                    if (_playersInside.size() > 45)
949
                      break; 
950
                  } 
951
                  _locCycle++;
952
                  if (_locCycle >= 6)
953
                    _locCycle = 1; 
954
                } 
955
              } else {
956
                Party party = player.getParty();
957
                for (Player member : party.getMembers()) {
958
                  if (member == null || member.getStatus().getLevel() < 74)
959
                    continue; 
960
                  if (!member.isIn3DRadius(npc, 700))
961
                    continue; 
962
                  synchronized (_playersInside) {
963
                    if (_playersInside.size() > 45) {
964
                      member.sendMessage("The number of challenges have been full, so can not enter.");
965
                      break;
966
                    } 
967
                    _playersInside.add(member);
968
                  } 
969
                  ZONE.allowPlayerEntry(member, 300);
970
                  member.teleportTo(_invadeLoc[_locCycle][0] + Rnd.get(50), _invadeLoc[_locCycle][1] + Rnd.get(50), _invadeLoc[_locCycle][2], 0);
971
                } 
972
                _locCycle++;
973
                if (_locCycle >= 6)
974
                  _locCycle = 1; 
975
              } 
976
            } else if (player.isIn3DRadius(npc, 700)) {
977
              synchronized (_playersInside) {
978
                _playersInside.add(player);
979
              } 
980
              player.teleportTo(_invadeLoc[_locCycle][0] + Rnd.get(50), _invadeLoc[_locCycle][1] + Rnd.get(50), _invadeLoc[_locCycle][2], 0);
981
            } 
982
          } else {
983
            CommandChannel CC = player.getParty().getCommandChannel();
984
            for (Party party : CC.getParties()) {
985
              if (party == null)
986
                continue; 
987
              synchronized (_playersInside) {
988
                for (Player member : party.getMembers()) {
989
                  if (member == null || member.getStatus().getLevel() < 74)
990
                    continue; 
991
                  if (!member.isIn3DRadius(npc, 700))
992
                    continue; 
993
                  if (_playersInside.size() > 45) {
994
                    member.sendMessage("The number of challenges have been full, so can not enter.");
995
                    break;
996
                  } 
997
                  _playersInside.add(member);
998
                  ZONE.allowPlayerEntry(member, 300);
999
                  member.teleportTo(_invadeLoc[_locCycle][0] + Rnd.get(50), _invadeLoc[_locCycle][1] + Rnd.get(50), _invadeLoc[_locCycle][2], 0);
1000
                } 
1001
                if (_playersInside.size() > 45)
1002
                  break; 
1003
              } 
1004
              _locCycle++;
1005
              if (_locCycle >= 6)
1006
                _locCycle = 1; 
1007
            } 
1008
          } 
1009
        } 
1010
      } 
1011
    } else {
1012
      htmltext = "<html><body>Someone else is already inside the Magic Force Field. Try again later.</body></html>";
1013
    } 
1014
    return htmltext;
1015
  }
1016
  
1017
  @Override
1018
public String onSkillSee(Npc npc, Player caster, L2Skill skill, Creature[] targets, boolean isPet) {
1019
    if (targets.length > 0 && targets[0] == npc) {
1020
      if (npc == _frintezza)
1021
        npc.getStatus().setHp(npc.getStatus().getMaxHp(), false); 
1022
      switch (skill.getId()) {
1023
        case 2234:
1024
          if (_frintezza != null && targets[0] == npc && npc.getNpcId() == 29045 && _soulBreakArrowUse == 1)
1025
            ZONE.broadcastPacket(new SocialAction(npc, 2)); 
1026
          if (_frintezza != null && targets[0] == npc && npc.getNpcId() == 29045 && _soulBreakArrowUse == 0)
1027
            if (Rnd.get(100) < 100) {
1028
              ZONE.broadcastPacket(new MagicSkillCanceled(_frintezza.getObjectId()));
1029
              cancelQuestTimers("songs_play");
1030
              cancelQuestTimers("songs_effect");
1031
              startQuestTimer("stop_effect", _frintezza, null, 0L);
1032
              npc.getCast().stop();
1033
              ZONE.broadcastPacket(new MagicSkillCanceled(_frintezza.getObjectId()));
1034
              for (Creature pc : ZONE.getKnownTypeInside(Player.class))
1035
                pc.stopSkillEffects(5008); 
1036
              startQuestTimerAtFixedRate("songs_play", _frintezza, null, (60000 + Rnd.get(60000)));
1037
              npc.broadcastNpcSay("Musical performance as temporarily interrupted.");
1038
              _soulBreakArrowUse = 1;
1039
            }  
1040
          break;
1041
        case 2276:
1042
          if ((_frintezza != null && targets[0] == npc && npc.getNpcId() == 29048) || (_frintezza != null && targets[0] == npc && npc.getNpcId() == 29049)) {
1043
            npc.doDie(caster);
1044
            npc.broadcastNpcSay("I was destroyed by Dewdrop of Destruction.");
1045
          } 
1046
          break;
1047
      } 
1048
    } 
1049
    return super.onSkillSee(npc, caster, skill, targets, isPet);
1050
  }
1051
  
1052
  private static void throwUp(Creature attacker, double range, SystemMessage msg) {
1053
    int mx = attacker.getX(), my = attacker.getY();
1054
    for (Creature target : ZONE.getKnownTypeInside(Player.class)) {
1055
      if (target == attacker)
1056
        continue; 
1057
      if (target instanceof Npc && isFrintezzaFriend(((Npc)target).getNpcId()))
1058
        continue; 
1059
      double dx = (target.getX() - mx);
1060
      double dy = (target.getY() - my);
1061
      if (dx == 0.0D && dy == 0.0D)
1062
        dx = dy = range / 2.0D; 
1063
      double aa = range / Math.sqrt(dx * dx + dy * dy);
1064
      if (aa > 1.0D) {
1065
        int x = mx + (int)(dx * aa);
1066
        int y = my + (int)(dy * aa);
1067
        int z = target.getZ();
1068
        target.getAI().tryToIdle();
1069
        target.getAttack().stop();
1070
        target.getCast().stop();
1071
        target.broadcastPacket(new FlyToLocation(target, x, y, z, FlyType.THROW_UP));
1072
        target.setXYZ(x, y, z);
1073
        target.broadcastPacket(new ValidateLocation(target));
1074
        if (msg != null)
1075
          target.sendPacket(msg); 
1076
        if (target instanceof Player)
1077
          ((Player)target).standUp(); 
1078
      } 
1079
    } 
1080
  }
1081
  
1082
  @Override
1083
public String onAttack(Npc npc, Creature attacker, int damage, L2Skill skill) {
1084
    _lastAction = System.currentTimeMillis();
1085
    if (npc.getNpcId() == 29045) {
1086
      npc.getStatus().setHpMp(npc.getStatus().getMaxHp(), 0.0D);
1087
      return null;
1088
    } 
1089
    if (npc.getNpcId() == 29046 && _secondMorph == 0 && _thirdMorph == 0 && _onMorph == 0 && npc.getStatus().getHp() < npc.getStatus().getMaxHp() * 0.75D && GrandBossManager.getInstance().getBossStatus(29045) == 2) {
1090
      startQuestTimer("attack_stop", _frintezza, null, 2000L);
1091
      _secondMorph = 1;
1092
      _onMorph = 1;
1093
      startQuestTimer("stop_pc", npc, null, 1000L);
1094
      startQuestTimer("stop_npc", npc, null, 1000L);
1095
      startQuestTimer("morph_01", npc, null, 1100L);
1096
    } else if (npc.getNpcId() == 29046 && _secondMorph == 1 && _thirdMorph == 0 && _onMorph == 0 && npc.getStatus().getHp() < npc.getStatus().getMaxHp() * 0.5D && GrandBossManager.getInstance().getBossStatus(29045) == 2) {
1097
      startQuestTimer("attack_stop", _frintezza, null, 0L);
1098
      _thirdMorph = 1;
1099
      _onMorph = 1;
1100
      startQuestTimer("stop_pc", npc, null, 1000L);
1101
      startQuestTimer("stop_npc", npc, null, 1000L);
1102
      startQuestTimer("morph_05a", npc, null, 2000L);
1103
      startQuestTimer("morph_05", npc, null, 2100L);
1104
    } else if (npc.getNpcId() == 29047 && _secondMorph == 1 && _thirdMorph == 1 && _onCheck == 0 && damage >= npc.getStatus().getHp() && GrandBossManager.getInstance().getBossStatus(29045) == 2) {
1105
      _onCheck = 1;
1106
      startQuestTimer("check_hp", npc, null, 0L);
1107
    } else if ((npc.getNpcId() == 29050 || npc.getNpcId() == 29051) && _bomber == 0) {
1108
      if (npc.getStatus().getHp() < npc.getStatus().getMaxHp() * 0.1D)
1109
        if (Rnd.get(100) < 30) {
1110
          _bomber = 1;
1111
          startQuestTimer("bomber", npc, null, 3000L);
1112
          L2Skill sk = SkillTable.getInstance().getInfo(5011, 1);
1113
          if (sk != null)
1114
            npc.getAI().tryToCast(npc, sk); 
1115
        }  
1116
    } 
1117
    return super.onAttack(npc, attacker, damage, skill);
1118
  }
1119
  
1120
  @Override
1121
public String onKill(Npc npc, Creature killer) {
1122
    Player player = killer.getActingPlayer();
1123
    if (player == null)
1124
      return null; 
1125
    if (npc.getNpcId() == 29047) {
1126
      ZONE.broadcastPacket(new PlaySound(1, "BS01_D", npc));
1127
      startQuestTimer("stop_pc", null, null, 0L);
1128
      startQuestTimer("stop_npc", npc, null, 0L);
1129
      startQuestTimer("morph_16", npc, null, 0L);
1130
      GrandBossManager.getInstance().setBossStatus(29045, 3);
1131
      long respawnTime = Config.SPAWN_INTERVAL_FRINTEZZA + Rnd.get(-Config.RANDOM_SPAWN_TIME_FRINTEZZA, Config.RANDOM_SPAWN_TIME_FRINTEZZA);
1132
      respawnTime *= 3600000L;
1133
      cancelQuestTimers("spawn_minion");
1134
      cancelQuestTimers("frintezza_despawn");
1135
      startQuestTimer("close", null, null, 0L);
1136
      startQuestTimer("rooms_del", npc, null, 0L);
1137
      startQuestTimer("minions_despawn", null, null, 0L);
1138
      startQuestTimer("remove_players", null, null, 900000L);
1139
      startQuestTimer("frintezza_unlock", null, null, respawnTime);
1140
      StatSet info = GrandBossManager.getInstance().getStatSet(29045);
1141
      info.set("respawn_time", System.currentTimeMillis() + respawnTime);
1142
      GrandBossManager.getInstance().setStatSet(29045, info);
1143
    } else if (npc.getNpcId() == 18328) {
1144
      if (Rnd.get(100) < 33)
1145
        player.addItem("Quest", 8556, 1, npc, true); 
1146
      _killHallAlarmDevice++;
1147
      if (_killHallAlarmDevice == 3) {
1148
        for (int i = 25150051; i <= 25150058; i++)
1149
          DoorData.getInstance().getDoor(i).openMe(); 
1150
      } else if (_killHallAlarmDevice == 4) {
1151
        ZONE.broadcastPacket(new CreatureSay(npc.getObjectId(), SayType.SHOUT, npc.getName(), "De-activate the alarm."));
1152
        startQuestTimer("room1_del", npc, null, 100L);
1153
        startQuestTimer("room2_spawn", npc, null, 100L);
1154
        DoorData.getInstance().getDoor(25150042).openMe();
1155
        DoorData.getInstance().getDoor(25150043).openMe();
1156
      } 
1157
    } else if (npc.getNpcId() == 18333) {
1158
      if (Rnd.get(100) < 10)
1159
        player.addItem("Quest", 8556, 1, npc, true); 
1160
    } else if (npc.getNpcId() == 18339) {
1161
      _killDarkChoirPlayer++;
1162
      if (_killDarkChoirPlayer == 2) {
1163
        DoorData.getInstance().getDoor(25150042).closeMe();
1164
        DoorData.getInstance().getDoor(25150043).closeMe();
1165
        for (int i = 25150061; i <= 25150070; i++)
1166
          DoorData.getInstance().getDoor(i).openMe(); 
1167
        startQuestTimer("room2_spawn2", npc, null, 1000L);
1168
      } 
1169
    } else if (npc.getNpcId() == 18334) {
1170
      if (Rnd.get(100) < 33)
1171
        player.addItem("Quest", 8192, Rnd.get(5, 15), npc, true); 
1172
      _killDarkChoirCaptain++;
1173
      if (_killDarkChoirCaptain == 8) {
1174
        startQuestTimer("room2_del", npc, null, 100L);
1175
        DoorData.getInstance().getDoor(25150045).openMe();
1176
        DoorData.getInstance().getDoor(25150046).openMe();
1177
        startQuestTimer("waiting", null, null, Config.WAIT_TIME_FRINTEZZA);
1178
        cancelQuestTimers("room_final");
1179
      } 
1180
    } 
1181
    return super.onKill(npc, killer);
1182
  }
1183
  
1184
  private static boolean isFrintezzaFriend(int npcId) {
1185
    return (npcId >= 29045 && npcId <= 29053);
1186
  }
1187
}