2
0

FourSepulchersManager.java 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861
  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 net.sf.l2j.gameserver.instancemanager;
  16. import java.sql.Connection;
  17. import java.sql.PreparedStatement;
  18. import java.sql.ResultSet;
  19. import java.util.Calendar;
  20. import java.util.List;
  21. import java.util.Map;
  22. import java.util.Set;
  23. import java.util.concurrent.ScheduledFuture;
  24. import javolution.util.FastList;
  25. import javolution.util.FastMap;
  26. import net.sf.l2j.Config;
  27. import net.sf.l2j.L2DatabaseFactory;
  28. import net.sf.l2j.gameserver.ThreadPoolManager;
  29. import net.sf.l2j.gameserver.datatables.DoorTable;
  30. import net.sf.l2j.gameserver.datatables.NpcTable;
  31. import net.sf.l2j.gameserver.datatables.SpawnTable;
  32. import net.sf.l2j.gameserver.model.L2ItemInstance;
  33. import net.sf.l2j.gameserver.model.L2Spawn;
  34. import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
  35. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  36. import net.sf.l2j.gameserver.model.actor.instance.L2SepulcherMonsterInstance;
  37. import net.sf.l2j.gameserver.model.actor.instance.L2SepulcherNpcInstance;
  38. import net.sf.l2j.gameserver.model.quest.QuestState;
  39. import net.sf.l2j.gameserver.network.SystemMessageId;
  40. import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  41. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  42. import net.sf.l2j.gameserver.templates.L2NpcTemplate;
  43. import net.sf.l2j.gameserver.util.Util;
  44. import net.sf.l2j.util.Rnd;
  45. /**
  46. * This class ...
  47. *
  48. * @version $Revision: $ $Date: $
  49. * @author sandman
  50. *
  51. *
  52. * TODO: Gatekeepers shouting some text when doors get opened..so far unknown
  53. * in leaked C4 is this text: 1000502 [brushes hinders competitor's monster.] which is really ugly translation
  54. *
  55. * TODO: Victim should attack one npc, when u save this NPC debuff zones will not be activated
  56. * and NPC will polymorph into some kind of Tammed Beast xD and shout: 1000503 [many thanks rescue.]
  57. * which is again really ugly translation.
  58. * When Victim kill this NPC, debuff zones will get activated
  59. * with current core its impossible to make attack npc * npc i will try to search where is this prevented
  60. * but still is unknown which npc u need to save to survive in next room without debuffs
  61. *
  62. */
  63. public class FourSepulchersManager extends GrandBossManager
  64. {
  65. private static FourSepulchersManager _instance;
  66. private static final String QUEST_ID = "620_FourGoblets";
  67. private static final int ENTRANCE_PASS = 7075;
  68. private static final int USED_PASS = 7261;
  69. private static final int CHAPEL_KEY = 7260;
  70. private static final int ANTIQUE_BROOCH = 7262;
  71. protected boolean _firstTimeRun;
  72. protected boolean _inEntryTime = false;
  73. protected boolean _inWarmUpTime = false;
  74. protected boolean _inAttackTime = false;
  75. protected boolean _inCoolDownTime = false;
  76. protected ScheduledFuture<?> _changeCoolDownTimeTask = null;
  77. protected ScheduledFuture<?> _changeEntryTimeTask = null;
  78. protected ScheduledFuture<?> _changeWarmUpTimeTask = null;
  79. protected ScheduledFuture<?> _changeAttackTimeTask = null;
  80. protected ScheduledFuture<?> _onPartyAnnihilatedTask = null;
  81. private int[][] _startHallSpawn = { { 181632, -85587, -7218 },
  82. { 179963, -88978, -7218 }, { 173217, -86132, -7218 },
  83. { 175608, -82296, -7218 } };
  84. private int[][][] _shadowSpawnLoc = {
  85. { { 25339, 191231, -85574, -7216, 33380 },
  86. { 25349, 189534, -88969, -7216, 32768 },
  87. { 25346, 173195, -76560, -7215, 49277 },
  88. { 25342, 175591, -72744, -7215, 49317 } },
  89. { { 25342, 191231, -85574, -7216, 33380 },
  90. { 25339, 189534, -88969, -7216, 32768 },
  91. { 25349, 173195, -76560, -7215, 49277 },
  92. { 25346, 175591, -72744, -7215, 49317 } },
  93. { { 25346, 191231, -85574, -7216, 33380 },
  94. { 25342, 189534, -88969, -7216, 32768 },
  95. { 25339, 173195, -76560, -7215, 49277 },
  96. { 25349, 175591, -72744, -7215, 49317 } },
  97. { { 25349, 191231, -85574, -7216, 33380 },
  98. { 25346, 189534, -88969, -7216, 32768 },
  99. { 25342, 173195, -76560, -7215, 49277 },
  100. { 25339, 175591, -72744, -7215, 49317 } }, };
  101. protected FastMap<Integer, Boolean> _archonSpawned = new FastMap<Integer, Boolean>();
  102. protected FastMap<Integer, Boolean> _hallInUse = new FastMap<Integer, Boolean>();
  103. protected FastMap<Integer, int[]> _startHallSpawns = new FastMap<Integer, int[]>();
  104. protected FastMap<Integer, Integer> _hallGateKeepers = new FastMap<Integer, Integer>();
  105. protected FastMap<Integer, Integer> _keyBoxNpc = new FastMap<Integer, Integer>();
  106. protected FastMap<Integer, Integer> _victim = new FastMap<Integer, Integer>();
  107. protected FastMap<Integer, L2PcInstance> _challengers = new FastMap<Integer, L2PcInstance>();
  108. protected FastMap<Integer, L2Spawn> _executionerSpawns = new FastMap<Integer, L2Spawn>();
  109. protected FastMap<Integer, L2Spawn> _keyBoxSpawns = new FastMap<Integer, L2Spawn>();
  110. protected FastMap<Integer, L2Spawn> _mysteriousBoxSpawns = new FastMap<Integer, L2Spawn>();
  111. protected FastMap<Integer, L2Spawn> _shadowSpawns = new FastMap<Integer, L2Spawn>();
  112. protected FastMap<Integer, FastList<L2Spawn>> _dukeFinalMobs = new FastMap<Integer, FastList<L2Spawn>>();
  113. protected FastMap<Integer, FastList<L2SepulcherMonsterInstance>> _dukeMobs = new FastMap<Integer, FastList<L2SepulcherMonsterInstance>>();
  114. protected FastMap<Integer, FastList<L2Spawn>> _emperorsGraveNpcs = new FastMap<Integer, FastList<L2Spawn>>();
  115. protected FastMap<Integer, FastList<L2Spawn>> _magicalMonsters = new FastMap<Integer, FastList<L2Spawn>>();
  116. protected FastMap<Integer, FastList<L2Spawn>> _physicalMonsters = new FastMap<Integer, FastList<L2Spawn>>();
  117. protected FastMap<Integer, FastList<L2SepulcherMonsterInstance>> _viscountMobs = new FastMap<Integer, FastList<L2SepulcherMonsterInstance>>();
  118. protected FastList<L2Spawn> _physicalSpawns;
  119. protected FastList<L2Spawn> _magicalSpawns;
  120. protected FastList<L2Spawn> _managers;
  121. protected FastList<L2Spawn> _dukeFinalSpawns;
  122. protected FastList<L2Spawn> _emperorsGraveSpawns;
  123. protected FastList<L2NpcInstance> _allMobs = new FastList<L2NpcInstance>();
  124. protected long _attackTimeEnd = 0;
  125. protected long _coolDownTimeEnd = 0;
  126. protected long _entryTimeEnd = 0;
  127. protected long _warmUpTimeEnd = 0;
  128. protected byte _newCycleMin = 55;
  129. public static final FourSepulchersManager getInstance()
  130. {
  131. if (_instance == null)
  132. _instance = new FourSepulchersManager();
  133. return _instance;
  134. }
  135. public void init()
  136. {
  137. if (_changeCoolDownTimeTask != null)
  138. _changeCoolDownTimeTask.cancel(true);
  139. if (_changeEntryTimeTask != null)
  140. _changeEntryTimeTask.cancel(true);
  141. if (_changeWarmUpTimeTask != null)
  142. _changeWarmUpTimeTask.cancel(true);
  143. if (_changeAttackTimeTask != null)
  144. _changeAttackTimeTask.cancel(true);
  145. _changeCoolDownTimeTask = null;
  146. _changeEntryTimeTask = null;
  147. _changeWarmUpTimeTask = null;
  148. _changeAttackTimeTask = null;
  149. _inEntryTime = false;
  150. _inWarmUpTime = false;
  151. _inAttackTime = false;
  152. _inCoolDownTime = false;
  153. _firstTimeRun = true;
  154. initFixedInfo();
  155. loadMysteriousBox();
  156. initKeyBoxSpawns();
  157. loadPhysicalMonsters();
  158. loadMagicalMonsters();
  159. initLocationShadowSpawns();
  160. initExecutionerSpawns();
  161. loadDukeMonsters();
  162. loadEmperorsGraveMonsters();
  163. spawnManagers();
  164. timeSelector();
  165. }
  166. // phase select on server launch
  167. protected void timeSelector()
  168. {
  169. timeCalculator();
  170. long currentTime = Calendar.getInstance().getTimeInMillis();
  171. // if current time >= time of entry beginning and if current time < time
  172. // of entry beginning + time of entry end
  173. if (currentTime >= _coolDownTimeEnd && currentTime < _entryTimeEnd) // entry
  174. // time
  175. // check
  176. {
  177. clean();
  178. _changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), 0);
  179. _log.info("FourSepulchersManager: Beginning in Entry time");
  180. }
  181. else if (currentTime >= _entryTimeEnd && currentTime < _warmUpTimeEnd) // warmup
  182. // time
  183. // check
  184. {
  185. clean();
  186. _changeWarmUpTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeWarmUpTime(), 0);
  187. _log.info("FourSepulchersManager: Beginning in WarmUp time");
  188. }
  189. else if (currentTime >= _warmUpTimeEnd && currentTime < _attackTimeEnd) // attack
  190. // time
  191. // check
  192. {
  193. clean();
  194. _changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), 0);
  195. _log.info("FourSepulchersManager: Beginning in Attack time");
  196. }
  197. else
  198. // else cooldown time and without cleanup because it's already
  199. // implemented
  200. {
  201. _changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), 0);
  202. _log.info("FourSepulchersManager: Beginning in Cooldown time");
  203. }
  204. }
  205. // phase end times calculator
  206. protected void timeCalculator()
  207. {
  208. Calendar tmp = Calendar.getInstance();
  209. if (tmp.get(Calendar.MINUTE) < _newCycleMin)
  210. tmp.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) - 1);
  211. tmp.set(Calendar.MINUTE, _newCycleMin);
  212. _coolDownTimeEnd = tmp.getTimeInMillis();
  213. _entryTimeEnd = _coolDownTimeEnd + Config.FS_TIME_ENTRY * 60000;
  214. _warmUpTimeEnd = _entryTimeEnd + Config.FS_TIME_WARMUP * 60000;
  215. _attackTimeEnd = _warmUpTimeEnd + Config.FS_TIME_ATTACK * 60000;
  216. }
  217. public void clean()
  218. {
  219. for (int i=31921; i < 31925; i++)
  220. {
  221. int[] Location = _startHallSpawns.get(i);
  222. GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).oustAllPlayers();
  223. }
  224. deleteAllMobs();
  225. closeAllDoors();
  226. _hallInUse.clear();
  227. _hallInUse.put(31921, false);
  228. _hallInUse.put(31922, false);
  229. _hallInUse.put(31923, false);
  230. _hallInUse.put(31924, false);
  231. if (_archonSpawned.size() != 0)
  232. {
  233. Set<Integer> npcIdSet = _archonSpawned.keySet();
  234. for (int npcId : npcIdSet)
  235. {
  236. _archonSpawned.put(npcId, false);
  237. }
  238. }
  239. }
  240. protected void spawnManagers()
  241. {
  242. _managers = new FastList<L2Spawn>();
  243. // L2Spawn spawnDat;
  244. int i = 31921;
  245. for (L2Spawn spawnDat; i <= 31924; i++)
  246. {
  247. if (i < 31921 || i > 31924)
  248. continue;
  249. L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(i);
  250. if (template1 == null)
  251. continue;
  252. try
  253. {
  254. spawnDat = new L2Spawn(template1);
  255. spawnDat.setAmount(1);
  256. spawnDat.setRespawnDelay(60);
  257. switch (i)
  258. {
  259. case 31921: // conquerors
  260. spawnDat.setLocx(181061);
  261. spawnDat.setLocy(-85595);
  262. spawnDat.setLocz(-7200);
  263. spawnDat.setHeading(-32584);
  264. break;
  265. case 31922: // emperors
  266. spawnDat.setLocx(179292);
  267. spawnDat.setLocy(-88981);
  268. spawnDat.setLocz(-7200);
  269. spawnDat.setHeading(-33272);
  270. break;
  271. case 31923: // sages
  272. spawnDat.setLocx(173202);
  273. spawnDat.setLocy(-87004);
  274. spawnDat.setLocz(-7200);
  275. spawnDat.setHeading(-16248);
  276. break;
  277. case 31924: // judges
  278. spawnDat.setLocx(175606);
  279. spawnDat.setLocy(-82853);
  280. spawnDat.setLocz(-7200);
  281. spawnDat.setHeading(-16248);
  282. break;
  283. }
  284. _managers.add(spawnDat);
  285. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  286. spawnDat.doSpawn();
  287. spawnDat.startRespawn();
  288. _log.info("FourSepulchersManager: spawned "
  289. + spawnDat.getTemplate().getName());
  290. }
  291. catch (SecurityException e)
  292. {
  293. e.printStackTrace();
  294. }
  295. catch (ClassNotFoundException e)
  296. {
  297. e.printStackTrace();
  298. }
  299. catch (NoSuchMethodException e)
  300. {
  301. e.printStackTrace();
  302. }
  303. }
  304. }
  305. protected void initFixedInfo()
  306. {
  307. _startHallSpawns.put(31921, _startHallSpawn[0]);
  308. _startHallSpawns.put(31922, _startHallSpawn[1]);
  309. _startHallSpawns.put(31923, _startHallSpawn[2]);
  310. _startHallSpawns.put(31924, _startHallSpawn[3]);
  311. _hallInUse.put(31921, false);
  312. _hallInUse.put(31922, false);
  313. _hallInUse.put(31923, false);
  314. _hallInUse.put(31924, false);
  315. _hallGateKeepers.put(31925, 25150012);
  316. _hallGateKeepers.put(31926, 25150013);
  317. _hallGateKeepers.put(31927, 25150014);
  318. _hallGateKeepers.put(31928, 25150015);
  319. _hallGateKeepers.put(31929, 25150016);
  320. _hallGateKeepers.put(31930, 25150002);
  321. _hallGateKeepers.put(31931, 25150003);
  322. _hallGateKeepers.put(31932, 25150004);
  323. _hallGateKeepers.put(31933, 25150005);
  324. _hallGateKeepers.put(31934, 25150006);
  325. _hallGateKeepers.put(31935, 25150032);
  326. _hallGateKeepers.put(31936, 25150033);
  327. _hallGateKeepers.put(31937, 25150034);
  328. _hallGateKeepers.put(31938, 25150035);
  329. _hallGateKeepers.put(31939, 25150036);
  330. _hallGateKeepers.put(31940, 25150022);
  331. _hallGateKeepers.put(31941, 25150023);
  332. _hallGateKeepers.put(31942, 25150024);
  333. _hallGateKeepers.put(31943, 25150025);
  334. _hallGateKeepers.put(31944, 25150026);
  335. _keyBoxNpc.put(18120, 31455);
  336. _keyBoxNpc.put(18121, 31455);
  337. _keyBoxNpc.put(18122, 31455);
  338. _keyBoxNpc.put(18123, 31455);
  339. _keyBoxNpc.put(18124, 31456);
  340. _keyBoxNpc.put(18125, 31456);
  341. _keyBoxNpc.put(18126, 31456);
  342. _keyBoxNpc.put(18127, 31456);
  343. _keyBoxNpc.put(18128, 31457);
  344. _keyBoxNpc.put(18129, 31457);
  345. _keyBoxNpc.put(18130, 31457);
  346. _keyBoxNpc.put(18131, 31457);
  347. _keyBoxNpc.put(18149, 31458);
  348. _keyBoxNpc.put(18150, 31459);
  349. _keyBoxNpc.put(18151, 31459);
  350. _keyBoxNpc.put(18152, 31459);
  351. _keyBoxNpc.put(18153, 31459);
  352. _keyBoxNpc.put(18154, 31460);
  353. _keyBoxNpc.put(18155, 31460);
  354. _keyBoxNpc.put(18156, 31460);
  355. _keyBoxNpc.put(18157, 31460);
  356. _keyBoxNpc.put(18158, 31461);
  357. _keyBoxNpc.put(18159, 31461);
  358. _keyBoxNpc.put(18160, 31461);
  359. _keyBoxNpc.put(18161, 31461);
  360. _keyBoxNpc.put(18162, 31462);
  361. _keyBoxNpc.put(18163, 31462);
  362. _keyBoxNpc.put(18164, 31462);
  363. _keyBoxNpc.put(18165, 31462);
  364. _keyBoxNpc.put(18183, 31463);
  365. _keyBoxNpc.put(18184, 31464);
  366. _keyBoxNpc.put(18212, 31465);
  367. _keyBoxNpc.put(18213, 31465);
  368. _keyBoxNpc.put(18214, 31465);
  369. _keyBoxNpc.put(18215, 31465);
  370. _keyBoxNpc.put(18216, 31466);
  371. _keyBoxNpc.put(18217, 31466);
  372. _keyBoxNpc.put(18218, 31466);
  373. _keyBoxNpc.put(18219, 31466);
  374. _victim.put(18150, 18158);
  375. _victim.put(18151, 18159);
  376. _victim.put(18152, 18160);
  377. _victim.put(18153, 18161);
  378. _victim.put(18154, 18162);
  379. _victim.put(18155, 18163);
  380. _victim.put(18156, 18164);
  381. _victim.put(18157, 18165);
  382. }
  383. private void loadMysteriousBox()
  384. {
  385. Connection con = null;
  386. _mysteriousBoxSpawns.clear();
  387. try
  388. {
  389. con = L2DatabaseFactory.getInstance().getConnection();
  390. PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY id");
  391. statement.setInt(1, 0);
  392. ResultSet rset = statement.executeQuery();
  393. L2Spawn spawnDat;
  394. L2NpcTemplate template1;
  395. while (rset.next())
  396. {
  397. template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));
  398. if (template1 != null)
  399. {
  400. spawnDat = new L2Spawn(template1);
  401. spawnDat.setAmount(rset.getInt("count"));
  402. spawnDat.setLocx(rset.getInt("locx"));
  403. spawnDat.setLocy(rset.getInt("locy"));
  404. spawnDat.setLocz(rset.getInt("locz"));
  405. spawnDat.setHeading(rset.getInt("heading"));
  406. spawnDat.setRespawnDelay(rset.getInt("respawn_delay"));
  407. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  408. int keyNpcId = rset.getInt("key_npc_id");
  409. _mysteriousBoxSpawns.put(keyNpcId, spawnDat);
  410. }
  411. else
  412. {
  413. _log.warning("FourSepulchersManager.LoadMysteriousBox: Data missing in NPC table for ID: "
  414. + rset.getInt("npc_templateid") + ".");
  415. }
  416. }
  417. rset.close();
  418. statement.close();
  419. _log.info("FourSepulchersManager: loaded "
  420. + _mysteriousBoxSpawns.size() + " Mysterious-Box spawns.");
  421. }
  422. catch (Exception e)
  423. {
  424. // problem with initializing spawn, go to next one
  425. _log.warning("FourSepulchersManager.LoadMysteriousBox: Spawn could not be initialized: "
  426. + e);
  427. }
  428. finally
  429. {
  430. try
  431. {
  432. con.close();
  433. }
  434. catch (Exception e)
  435. {
  436. }
  437. }
  438. }
  439. private void initKeyBoxSpawns()
  440. {
  441. L2Spawn spawnDat;
  442. L2NpcTemplate template;
  443. for (int keyNpcId : _keyBoxNpc.keySet())
  444. {
  445. try
  446. {
  447. template = NpcTable.getInstance().getTemplate(_keyBoxNpc.get(keyNpcId));
  448. if (template != null)
  449. {
  450. spawnDat = new L2Spawn(template);
  451. spawnDat.setAmount(1);
  452. spawnDat.setLocx(0);
  453. spawnDat.setLocy(0);
  454. spawnDat.setLocz(0);
  455. spawnDat.setHeading(0);
  456. spawnDat.setRespawnDelay(3600);
  457. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  458. _keyBoxSpawns.put(keyNpcId, spawnDat);
  459. }
  460. else
  461. {
  462. _log.warning("FourSepulchersManager.InitKeyBoxSpawns: Data missing in NPC table for ID: "
  463. + _keyBoxNpc.get(keyNpcId) + ".");
  464. }
  465. }
  466. catch (Exception e)
  467. {
  468. _log.warning("FourSepulchersManager.InitKeyBoxSpawns: Spawn could not be initialized: "
  469. + e);
  470. }
  471. }
  472. }
  473. private void loadPhysicalMonsters()
  474. {
  475. _physicalMonsters.clear();
  476. int loaded = 0;
  477. Connection con = null;
  478. try
  479. {
  480. con = L2DatabaseFactory.getInstance().getConnection();
  481. PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
  482. statement1.setInt(1, 1);
  483. ResultSet rset1 = statement1.executeQuery();
  484. while (rset1.next())
  485. {
  486. int keyNpcId = rset1.getInt("key_npc_id");
  487. PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
  488. statement2.setInt(1, keyNpcId);
  489. statement2.setInt(2, 1);
  490. ResultSet rset2 = statement2.executeQuery();
  491. L2Spawn spawnDat;
  492. L2NpcTemplate template1;
  493. _physicalSpawns = new FastList<L2Spawn>();
  494. while (rset2.next())
  495. {
  496. template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
  497. if (template1 != null)
  498. {
  499. spawnDat = new L2Spawn(template1);
  500. spawnDat.setAmount(rset2.getInt("count"));
  501. spawnDat.setLocx(rset2.getInt("locx"));
  502. spawnDat.setLocy(rset2.getInt("locy"));
  503. spawnDat.setLocz(rset2.getInt("locz"));
  504. spawnDat.setHeading(rset2.getInt("heading"));
  505. spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
  506. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  507. _physicalSpawns.add(spawnDat);
  508. loaded++;
  509. }
  510. else
  511. {
  512. _log.warning("FourSepulchersManager.LoadPhysicalMonsters: Data missing in NPC table for ID: "
  513. + rset2.getInt("npc_templateid") + ".");
  514. }
  515. }
  516. rset2.close();
  517. statement2.close();
  518. _physicalMonsters.put(keyNpcId, _physicalSpawns);
  519. }
  520. rset1.close();
  521. statement1.close();
  522. _log.info("FourSepulchersManager: loaded " + loaded
  523. + " Physical type monsters spawns.");
  524. }
  525. catch (Exception e)
  526. {
  527. // problem with initializing spawn, go to next one
  528. _log.warning("FourSepulchersManager.LoadPhysicalMonsters: Spawn could not be initialized: "
  529. + e);
  530. }
  531. finally
  532. {
  533. try
  534. {
  535. con.close();
  536. }
  537. catch (Exception e)
  538. {
  539. }
  540. }
  541. }
  542. private void loadMagicalMonsters()
  543. {
  544. _magicalMonsters.clear();
  545. int loaded = 0;
  546. Connection con = null;
  547. try
  548. {
  549. con = L2DatabaseFactory.getInstance().getConnection();
  550. PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
  551. statement1.setInt(1, 2);
  552. ResultSet rset1 = statement1.executeQuery();
  553. while (rset1.next())
  554. {
  555. int keyNpcId = rset1.getInt("key_npc_id");
  556. PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
  557. statement2.setInt(1, keyNpcId);
  558. statement2.setInt(2, 2);
  559. ResultSet rset2 = statement2.executeQuery();
  560. L2Spawn spawnDat;
  561. L2NpcTemplate template1;
  562. _magicalSpawns = new FastList<L2Spawn>();
  563. while (rset2.next())
  564. {
  565. template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
  566. if (template1 != null)
  567. {
  568. spawnDat = new L2Spawn(template1);
  569. spawnDat.setAmount(rset2.getInt("count"));
  570. spawnDat.setLocx(rset2.getInt("locx"));
  571. spawnDat.setLocy(rset2.getInt("locy"));
  572. spawnDat.setLocz(rset2.getInt("locz"));
  573. spawnDat.setHeading(rset2.getInt("heading"));
  574. spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
  575. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  576. _magicalSpawns.add(spawnDat);
  577. loaded++;
  578. }
  579. else
  580. {
  581. _log.warning("FourSepulchersManager.LoadMagicalMonsters: Data missing in NPC table for ID: "
  582. + rset2.getInt("npc_templateid") + ".");
  583. }
  584. }
  585. rset2.close();
  586. statement2.close();
  587. _magicalMonsters.put(keyNpcId, _magicalSpawns);
  588. }
  589. rset1.close();
  590. statement1.close();
  591. _log.info("FourSepulchersManager: loaded " + loaded
  592. + " Magical type monsters spawns.");
  593. }
  594. catch (Exception e)
  595. {
  596. // problem with initializing spawn, go to next one
  597. _log.warning("FourSepulchersManager.LoadMagicalMonsters: Spawn could not be initialized: "
  598. + e);
  599. }
  600. finally
  601. {
  602. try
  603. {
  604. con.close();
  605. }
  606. catch (Exception e)
  607. {
  608. }
  609. }
  610. }
  611. private void loadDukeMonsters()
  612. {
  613. _dukeFinalMobs.clear();
  614. _archonSpawned.clear();
  615. int loaded = 0;
  616. Connection con = null;
  617. try
  618. {
  619. con = L2DatabaseFactory.getInstance().getConnection();
  620. PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
  621. statement1.setInt(1, 5);
  622. ResultSet rset1 = statement1.executeQuery();
  623. while (rset1.next())
  624. {
  625. int keyNpcId = rset1.getInt("key_npc_id");
  626. PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
  627. statement2.setInt(1, keyNpcId);
  628. statement2.setInt(2, 5);
  629. ResultSet rset2 = statement2.executeQuery();
  630. L2Spawn spawnDat;
  631. L2NpcTemplate template1;
  632. _dukeFinalSpawns = new FastList<L2Spawn>();
  633. while (rset2.next())
  634. {
  635. template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
  636. if (template1 != null)
  637. {
  638. spawnDat = new L2Spawn(template1);
  639. spawnDat.setAmount(rset2.getInt("count"));
  640. spawnDat.setLocx(rset2.getInt("locx"));
  641. spawnDat.setLocy(rset2.getInt("locy"));
  642. spawnDat.setLocz(rset2.getInt("locz"));
  643. spawnDat.setHeading(rset2.getInt("heading"));
  644. spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
  645. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  646. _dukeFinalSpawns.add(spawnDat);
  647. loaded++;
  648. }
  649. else
  650. {
  651. _log.warning("FourSepulchersManager.LoadDukeMonsters: Data missing in NPC table for ID: "
  652. + rset2.getInt("npc_templateid") + ".");
  653. }
  654. }
  655. rset2.close();
  656. statement2.close();
  657. _dukeFinalMobs.put(keyNpcId, _dukeFinalSpawns);
  658. _archonSpawned.put(keyNpcId, false);
  659. }
  660. rset1.close();
  661. statement1.close();
  662. _log.info("FourSepulchersManager: loaded " + loaded
  663. + " Church of duke monsters spawns.");
  664. }
  665. catch (Exception e)
  666. {
  667. // problem with initializing spawn, go to next one
  668. _log.warning("FourSepulchersManager.LoadDukeMonsters: Spawn could not be initialized: "
  669. + e);
  670. }
  671. finally
  672. {
  673. try
  674. {
  675. con.close();
  676. }
  677. catch (Exception e)
  678. {
  679. }
  680. }
  681. }
  682. private void loadEmperorsGraveMonsters()
  683. {
  684. _emperorsGraveNpcs.clear();
  685. int loaded = 0;
  686. Connection con = null;
  687. try
  688. {
  689. con = L2DatabaseFactory.getInstance().getConnection();
  690. PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
  691. statement1.setInt(1, 6);
  692. ResultSet rset1 = statement1.executeQuery();
  693. while (rset1.next())
  694. {
  695. int keyNpcId = rset1.getInt("key_npc_id");
  696. PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
  697. statement2.setInt(1, keyNpcId);
  698. statement2.setInt(2, 6);
  699. ResultSet rset2 = statement2.executeQuery();
  700. L2Spawn spawnDat;
  701. L2NpcTemplate template1;
  702. _emperorsGraveSpawns = new FastList<L2Spawn>();
  703. while (rset2.next())
  704. {
  705. template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
  706. if (template1 != null)
  707. {
  708. spawnDat = new L2Spawn(template1);
  709. spawnDat.setAmount(rset2.getInt("count"));
  710. spawnDat.setLocx(rset2.getInt("locx"));
  711. spawnDat.setLocy(rset2.getInt("locy"));
  712. spawnDat.setLocz(rset2.getInt("locz"));
  713. spawnDat.setHeading(rset2.getInt("heading"));
  714. spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
  715. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  716. _emperorsGraveSpawns.add(spawnDat);
  717. loaded++;
  718. }
  719. else
  720. {
  721. _log.warning("FourSepulchersManager.LoadEmperorsGraveMonsters: Data missing in NPC table for ID: "
  722. + rset2.getInt("npc_templateid") + ".");
  723. }
  724. }
  725. rset2.close();
  726. statement2.close();
  727. _emperorsGraveNpcs.put(keyNpcId, _emperorsGraveSpawns);
  728. }
  729. rset1.close();
  730. statement1.close();
  731. _log.info("FourSepulchersManager: loaded " + loaded
  732. + " Emperor's grave NPC spawns.");
  733. }
  734. catch (Exception e)
  735. {
  736. // problem with initializing spawn, go to next one
  737. _log.warning("FourSepulchersManager.LoadEmperorsGraveMonsters: Spawn could not be initialized: "
  738. + e);
  739. }
  740. finally
  741. {
  742. try
  743. {
  744. con.close();
  745. }
  746. catch (Exception e)
  747. {
  748. }
  749. }
  750. }
  751. protected void initLocationShadowSpawns()
  752. {
  753. int locNo = Rnd.get(4);
  754. final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
  755. L2Spawn spawnDat;
  756. L2NpcTemplate template;
  757. _shadowSpawns.clear();
  758. for (int i = 0; i <= 3; i++)
  759. {
  760. template = NpcTable.getInstance().getTemplate(_shadowSpawnLoc[locNo][i][0]);
  761. if (template != null)
  762. {
  763. try
  764. {
  765. spawnDat = new L2Spawn(template);
  766. spawnDat.setAmount(1);
  767. spawnDat.setLocx(_shadowSpawnLoc[locNo][i][1]);
  768. spawnDat.setLocy(_shadowSpawnLoc[locNo][i][2]);
  769. spawnDat.setLocz(_shadowSpawnLoc[locNo][i][3]);
  770. spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
  771. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  772. int keyNpcId = gateKeeper[i];
  773. _shadowSpawns.put(keyNpcId, spawnDat);
  774. }
  775. catch (Exception e)
  776. {
  777. _log.warning(e.getMessage());
  778. }
  779. }
  780. else
  781. {
  782. _log.warning("FourSepulchersManager.InitLocationShadowSpawns: Data missing in NPC table for ID: "
  783. + _shadowSpawnLoc[locNo][i][0] + ".");
  784. }
  785. }
  786. }
  787. protected void initExecutionerSpawns()
  788. {
  789. L2Spawn spawnDat;
  790. L2NpcTemplate template;
  791. for (int keyNpcId : _victim.keySet())
  792. {
  793. try
  794. {
  795. template = NpcTable.getInstance().getTemplate(_victim.get(keyNpcId));
  796. if (template != null)
  797. {
  798. spawnDat = new L2Spawn(template);
  799. spawnDat.setAmount(1);
  800. spawnDat.setLocx(0);
  801. spawnDat.setLocy(0);
  802. spawnDat.setLocz(0);
  803. spawnDat.setHeading(0);
  804. spawnDat.setRespawnDelay(3600);
  805. SpawnTable.getInstance().addNewSpawn(spawnDat, false);
  806. _executionerSpawns.put(keyNpcId, spawnDat);
  807. }
  808. else
  809. {
  810. _log.warning("FourSepulchersManager.InitExecutionerSpawns: Data missing in NPC table for ID: "
  811. + _victim.get(keyNpcId) + ".");
  812. }
  813. }
  814. catch (Exception e)
  815. {
  816. _log.warning("FourSepulchersManager.InitExecutionerSpawns: Spawn could not be initialized: "
  817. + e);
  818. }
  819. }
  820. }
  821. public boolean isEntryTime()
  822. {
  823. return _inEntryTime;
  824. }
  825. public boolean isAttackTime()
  826. {
  827. return _inAttackTime;
  828. }
  829. public synchronized void tryEntry(L2NpcInstance npc, L2PcInstance player)
  830. {
  831. int npcId = npc.getNpcId();
  832. switch (npcId)
  833. {
  834. // ID ok
  835. case 31921:
  836. case 31922:
  837. case 31923:
  838. case 31924:
  839. break;
  840. // ID not ok
  841. default:
  842. if (!player.isGM())
  843. {
  844. _log.warning("Player " + player.getName() + "("
  845. + player.getObjectId()
  846. + ") tried to cheat in four sepulchers.");
  847. Util.handleIllegalPlayerAction(player, "Warning!! Character "
  848. + player.getName()
  849. + " tried to enter four sepulchers with invalid npc id.", Config.DEFAULT_PUNISH);
  850. }
  851. return;
  852. }
  853. if (_hallInUse.get(npcId).booleanValue())
  854. {
  855. showHtmlFile(player, npcId + "-FULL.htm", npc, null);
  856. return;
  857. }
  858. if (Config.FS_PARTY_MEMBER_COUNT > 1)
  859. {
  860. if (!player.isInParty()
  861. || player.getParty().getMemberCount() < Config.FS_PARTY_MEMBER_COUNT)
  862. {
  863. showHtmlFile(player, npcId + "-SP.htm", npc, null);
  864. return;
  865. }
  866. if (!player.getParty().isLeader(player))
  867. {
  868. showHtmlFile(player, npcId + "-NL.htm", npc, null);
  869. return;
  870. }
  871. for (L2PcInstance mem : player.getParty().getPartyMembers())
  872. {
  873. QuestState qs = mem.getQuestState(QUEST_ID);
  874. if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
  875. {
  876. showHtmlFile(player, npcId + "-NS.htm", npc, mem);
  877. return;
  878. }
  879. if (mem.getInventory().getItemByItemId(ENTRANCE_PASS) == null)
  880. {
  881. showHtmlFile(player, npcId + "-SE.htm", npc, mem);
  882. return;
  883. }
  884. if (player.getWeightPenalty() >= 3)
  885. {
  886. mem.sendPacket(new SystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
  887. return;
  888. }
  889. }
  890. }
  891. else if (Config.FS_PARTY_MEMBER_COUNT <= 1 && player.isInParty())
  892. {
  893. if (!player.getParty().isLeader(player))
  894. {
  895. showHtmlFile(player, npcId + "-NL.htm", npc, null);
  896. return;
  897. }
  898. for (L2PcInstance mem : player.getParty().getPartyMembers())
  899. {
  900. QuestState qs = mem.getQuestState(QUEST_ID);
  901. if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
  902. {
  903. showHtmlFile(player, npcId + "-NS.htm", npc, mem);
  904. return;
  905. }
  906. if (mem.getInventory().getItemByItemId(ENTRANCE_PASS) == null)
  907. {
  908. showHtmlFile(player, npcId + "-SE.htm", npc, mem);
  909. return;
  910. }
  911. if (player.getWeightPenalty() >= 3)
  912. {
  913. mem.sendPacket(new SystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
  914. return;
  915. }
  916. }
  917. }
  918. else
  919. {
  920. QuestState qs = player.getQuestState(QUEST_ID);
  921. if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
  922. {
  923. showHtmlFile(player, npcId + "-NS.htm", npc, player);
  924. return;
  925. }
  926. if (player.getInventory().getItemByItemId(ENTRANCE_PASS) == null)
  927. {
  928. showHtmlFile(player, npcId + "-SE.htm", npc, player);
  929. return;
  930. }
  931. if (player.getWeightPenalty() >= 3)
  932. {
  933. player.sendPacket(new SystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
  934. return;
  935. }
  936. }
  937. if (!isEntryTime())
  938. {
  939. showHtmlFile(player, npcId + "-NE.htm", npc, null);
  940. return;
  941. }
  942. showHtmlFile(player, npcId + "-OK.htm", npc, null);
  943. entry(npcId, player);
  944. }
  945. private void entry(int npcId, L2PcInstance player)
  946. {
  947. int[] Location = _startHallSpawns.get(npcId);
  948. int driftx;
  949. int drifty;
  950. if (Config.FS_PARTY_MEMBER_COUNT > 1)
  951. {
  952. List<L2PcInstance> members = new FastList<L2PcInstance>();
  953. for (L2PcInstance mem : player.getParty().getPartyMembers())
  954. {
  955. if (!mem.isDead()
  956. && Util.checkIfInRange(700, player, mem, true))
  957. {
  958. members.add(mem);
  959. }
  960. }
  961. for (L2PcInstance mem : members)
  962. {
  963. GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).allowPlayerEntry(mem, 30);
  964. driftx = Rnd.get(-80, 80);
  965. drifty = Rnd.get(-80, 80);
  966. mem.teleToLocation(Location[0] + driftx, Location[1] + drifty, Location[2]);
  967. mem.destroyItemByItemId("Quest", ENTRANCE_PASS, 1, mem, true);
  968. if (mem.getInventory().getItemByItemId(ANTIQUE_BROOCH) == null)
  969. {
  970. mem.addItem("Quest", USED_PASS, 1, mem, true);
  971. }
  972. L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
  973. if (hallsKey != null)
  974. {
  975. mem.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), mem, true);
  976. }
  977. }
  978. _challengers.remove(npcId);
  979. _challengers.put(npcId, player);
  980. _hallInUse.remove(npcId);
  981. _hallInUse.put(npcId, true);
  982. }
  983. if (Config.FS_PARTY_MEMBER_COUNT <= 1 && player.isInParty())
  984. {
  985. List<L2PcInstance> members = new FastList<L2PcInstance>();
  986. for (L2PcInstance mem : player.getParty().getPartyMembers())
  987. {
  988. if (!mem.isDead()
  989. && Util.checkIfInRange(700, player, mem, true))
  990. {
  991. members.add(mem);
  992. }
  993. }
  994. for (L2PcInstance mem : members)
  995. {
  996. GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).allowPlayerEntry(mem, 30);
  997. driftx = Rnd.get(-80, 80);
  998. drifty = Rnd.get(-80, 80);
  999. mem.teleToLocation(Location[0] + driftx, Location[1] + drifty, Location[2]);
  1000. mem.destroyItemByItemId("Quest", ENTRANCE_PASS, 1, mem, true);
  1001. if (mem.getInventory().getItemByItemId(ANTIQUE_BROOCH) == null)
  1002. {
  1003. mem.addItem("Quest", USED_PASS, 1, mem, true);
  1004. }
  1005. L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
  1006. if (hallsKey != null)
  1007. {
  1008. mem.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), mem, true);
  1009. }
  1010. }
  1011. _challengers.remove(npcId);
  1012. _challengers.put(npcId, player);
  1013. _hallInUse.remove(npcId);
  1014. _hallInUse.put(npcId, true);
  1015. }
  1016. else
  1017. {
  1018. GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).allowPlayerEntry(player, 30);
  1019. driftx = Rnd.get(-80, 80);
  1020. drifty = Rnd.get(-80, 80);
  1021. player.teleToLocation(Location[0] + driftx, Location[1] + drifty, Location[2]);
  1022. player.destroyItemByItemId("Quest", ENTRANCE_PASS, 1, player, true);
  1023. if (player.getInventory().getItemByItemId(ANTIQUE_BROOCH) == null)
  1024. {
  1025. player.addItem("Quest", USED_PASS, 1, player, true);
  1026. }
  1027. L2ItemInstance hallsKey = player.getInventory().getItemByItemId(CHAPEL_KEY);
  1028. if (hallsKey != null)
  1029. {
  1030. player.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), player, true);
  1031. }
  1032. _challengers.remove(npcId);
  1033. _challengers.put(npcId, player);
  1034. _hallInUse.remove(npcId);
  1035. _hallInUse.put(npcId, true);
  1036. }
  1037. }
  1038. public void spawnMysteriousBox(int npcId)
  1039. {
  1040. if (!isAttackTime())
  1041. return;
  1042. L2Spawn spawnDat = _mysteriousBoxSpawns.get(npcId);
  1043. if (spawnDat != null)
  1044. {
  1045. _allMobs.add(spawnDat.doSpawn());
  1046. spawnDat.stopRespawn();
  1047. }
  1048. }
  1049. public void spawnMonster(int npcId)
  1050. {
  1051. if (!isAttackTime())
  1052. return;
  1053. FastList<L2Spawn> monsterList;
  1054. FastList<L2SepulcherMonsterInstance> mobs = new FastList<L2SepulcherMonsterInstance>();
  1055. L2Spawn keyBoxMobSpawn;
  1056. if (Rnd.get(2) == 0)
  1057. {
  1058. monsterList = _physicalMonsters.get(npcId);
  1059. }
  1060. else
  1061. {
  1062. monsterList = _magicalMonsters.get(npcId);
  1063. }
  1064. if (monsterList != null)
  1065. {
  1066. boolean spawnKeyBoxMob = false;
  1067. boolean spawnedKeyBoxMob = false;
  1068. for (L2Spawn spawnDat : monsterList)
  1069. {
  1070. if (spawnedKeyBoxMob)
  1071. {
  1072. spawnKeyBoxMob = false;
  1073. }
  1074. else
  1075. {
  1076. switch (npcId)
  1077. {
  1078. case 31469:
  1079. case 31474:
  1080. case 31479:
  1081. case 31484:
  1082. if (Rnd.get(48) == 0)
  1083. {
  1084. spawnKeyBoxMob = true;
  1085. // _log.info("FourSepulchersManager.SpawnMonster:
  1086. // Set to spawn Church of Viscount Key Mob.");
  1087. }
  1088. break;
  1089. default:
  1090. spawnKeyBoxMob = false;
  1091. }
  1092. }
  1093. L2SepulcherMonsterInstance mob = null;
  1094. if (spawnKeyBoxMob)
  1095. {
  1096. try
  1097. {
  1098. L2NpcTemplate template = NpcTable.getInstance().getTemplate(18149);
  1099. if (template != null)
  1100. {
  1101. keyBoxMobSpawn = new L2Spawn(template);
  1102. keyBoxMobSpawn.setAmount(1);
  1103. keyBoxMobSpawn.setLocx(spawnDat.getLocx());
  1104. keyBoxMobSpawn.setLocy(spawnDat.getLocy());
  1105. keyBoxMobSpawn.setLocz(spawnDat.getLocz());
  1106. keyBoxMobSpawn.setHeading(spawnDat.getHeading());
  1107. keyBoxMobSpawn.setRespawnDelay(3600);
  1108. SpawnTable.getInstance().addNewSpawn(keyBoxMobSpawn, false);
  1109. mob = (L2SepulcherMonsterInstance) keyBoxMobSpawn.doSpawn();
  1110. keyBoxMobSpawn.stopRespawn();
  1111. }
  1112. else
  1113. {
  1114. _log.warning("FourSepulchersManager.SpawnMonster: Data missing in NPC table for ID: 18149");
  1115. }
  1116. }
  1117. catch (Exception e)
  1118. {
  1119. _log.warning("FourSepulchersManager.SpawnMonster: Spawn could not be initialized: "
  1120. + e);
  1121. }
  1122. spawnedKeyBoxMob = true;
  1123. }
  1124. else
  1125. {
  1126. mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
  1127. spawnDat.stopRespawn();
  1128. }
  1129. if (mob != null)
  1130. {
  1131. mob.mysteriousBoxId = npcId;
  1132. switch (npcId)
  1133. {
  1134. case 31469:
  1135. case 31474:
  1136. case 31479:
  1137. case 31484:
  1138. case 31472:
  1139. case 31477:
  1140. case 31482:
  1141. case 31487:
  1142. mobs.add(mob);
  1143. }
  1144. _allMobs.add(mob);
  1145. }
  1146. }
  1147. switch (npcId)
  1148. {
  1149. case 31469:
  1150. case 31474:
  1151. case 31479:
  1152. case 31484:
  1153. _viscountMobs.put(npcId, mobs);
  1154. break;
  1155. case 31472:
  1156. case 31477:
  1157. case 31482:
  1158. case 31487:
  1159. _dukeMobs.put(npcId, mobs);
  1160. break;
  1161. }
  1162. }
  1163. }
  1164. public synchronized boolean isViscountMobsAnnihilated(int npcId)
  1165. {
  1166. FastList<L2SepulcherMonsterInstance> mobs = _viscountMobs.get(npcId);
  1167. if (mobs == null)
  1168. return true;
  1169. for (L2SepulcherMonsterInstance mob : mobs)
  1170. {
  1171. if (!mob.isDead())
  1172. return false;
  1173. }
  1174. return true;
  1175. }
  1176. public synchronized boolean isDukeMobsAnnihilated(int npcId)
  1177. {
  1178. FastList<L2SepulcherMonsterInstance> mobs = _dukeMobs.get(npcId);
  1179. if (mobs == null)
  1180. return true;
  1181. for (L2SepulcherMonsterInstance mob : mobs)
  1182. {
  1183. if (!mob.isDead())
  1184. return false;
  1185. }
  1186. return true;
  1187. }
  1188. public void spawnKeyBox(L2NpcInstance activeChar)
  1189. {
  1190. if (!isAttackTime())
  1191. return;
  1192. L2Spawn spawnDat = _keyBoxSpawns.get(activeChar.getNpcId());
  1193. if (spawnDat != null)
  1194. {
  1195. spawnDat.setAmount(1);
  1196. spawnDat.setLocx(activeChar.getX());
  1197. spawnDat.setLocy(activeChar.getY());
  1198. spawnDat.setLocz(activeChar.getZ());
  1199. spawnDat.setHeading(activeChar.getHeading());
  1200. spawnDat.setRespawnDelay(3600);
  1201. _allMobs.add(spawnDat.doSpawn());
  1202. spawnDat.stopRespawn();
  1203. }
  1204. }
  1205. public void spawnExecutionerOfHalisha(L2NpcInstance activeChar)
  1206. {
  1207. if (!isAttackTime())
  1208. return;
  1209. L2Spawn spawnDat = _executionerSpawns.get(activeChar.getNpcId());
  1210. if (spawnDat != null)
  1211. {
  1212. spawnDat.setAmount(1);
  1213. spawnDat.setLocx(activeChar.getX());
  1214. spawnDat.setLocy(activeChar.getY());
  1215. spawnDat.setLocz(activeChar.getZ());
  1216. spawnDat.setHeading(activeChar.getHeading());
  1217. spawnDat.setRespawnDelay(3600);
  1218. _allMobs.add(spawnDat.doSpawn());
  1219. spawnDat.stopRespawn();
  1220. }
  1221. }
  1222. public void spawnArchonOfHalisha(int npcId)
  1223. {
  1224. if (!isAttackTime())
  1225. return;
  1226. if (_archonSpawned.get(npcId))
  1227. return;
  1228. FastList<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
  1229. if (monsterList != null)
  1230. {
  1231. for (L2Spawn spawnDat : monsterList)
  1232. {
  1233. L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
  1234. spawnDat.stopRespawn();
  1235. if (mob != null)
  1236. {
  1237. mob.mysteriousBoxId = npcId;
  1238. _allMobs.add(mob);
  1239. }
  1240. }
  1241. _archonSpawned.put(npcId, true);
  1242. }
  1243. }
  1244. public void spawnEmperorsGraveNpc(int npcId)
  1245. {
  1246. if (!isAttackTime())
  1247. return;
  1248. FastList<L2Spawn> monsterList = _emperorsGraveNpcs.get(npcId);
  1249. if (monsterList != null)
  1250. {
  1251. for (L2Spawn spawnDat : monsterList)
  1252. {
  1253. _allMobs.add(spawnDat.doSpawn());
  1254. spawnDat.stopRespawn();
  1255. }
  1256. }
  1257. }
  1258. protected void locationShadowSpawns()
  1259. {
  1260. int locNo = Rnd.get(4);
  1261. // _log.info("FourSepulchersManager.LocationShadowSpawns: Location index
  1262. // is " + locNo + ".");
  1263. final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
  1264. L2Spawn spawnDat;
  1265. for (int i = 0; i <= 3; i++)
  1266. {
  1267. int keyNpcId = gateKeeper[i];
  1268. spawnDat = _shadowSpawns.get(keyNpcId);
  1269. spawnDat.setLocx(_shadowSpawnLoc[locNo][i][1]);
  1270. spawnDat.setLocy(_shadowSpawnLoc[locNo][i][2]);
  1271. spawnDat.setLocz(_shadowSpawnLoc[locNo][i][3]);
  1272. spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
  1273. _shadowSpawns.put(keyNpcId, spawnDat);
  1274. }
  1275. }
  1276. public void spawnShadow(int npcId)
  1277. {
  1278. if (!isAttackTime())
  1279. return;
  1280. L2Spawn spawnDat = _shadowSpawns.get(npcId);
  1281. if (spawnDat != null)
  1282. {
  1283. L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
  1284. spawnDat.stopRespawn();
  1285. if (mob != null)
  1286. {
  1287. mob.mysteriousBoxId = npcId;
  1288. _allMobs.add(mob);
  1289. }
  1290. }
  1291. }
  1292. public void deleteAllMobs()
  1293. {
  1294. // _log.info("FourSepulchersManager.DeleteAllMobs: Try to delete " +
  1295. // _allMobs.size() + " monsters.");
  1296. int delCnt = 0;
  1297. for (L2NpcInstance mob : _allMobs)
  1298. {
  1299. try
  1300. {
  1301. mob.getSpawn().stopRespawn();
  1302. mob.deleteMe();
  1303. delCnt++;
  1304. }
  1305. catch (Exception e)
  1306. {
  1307. _log.warning(e.getMessage());
  1308. }
  1309. }
  1310. _allMobs.clear();
  1311. // _log.info("FourSepulchersManager.DeleteAllMobs: Deleted " + delCnt +
  1312. // " monsters.");
  1313. }
  1314. protected void closeAllDoors()
  1315. {
  1316. for (int doorId : _hallGateKeepers.values())
  1317. {
  1318. try
  1319. {
  1320. DoorTable.getInstance().getDoor(doorId).closeMe();
  1321. }
  1322. catch (Exception e)
  1323. {
  1324. _log.warning(e.getMessage());
  1325. }
  1326. }
  1327. }
  1328. protected byte minuteSelect(byte min)
  1329. {
  1330. if ((double) min % 5 != 0)// if doesn't divides on 5 fully
  1331. {
  1332. // mad table for selecting proper minutes...
  1333. // may be there is a better way to do this
  1334. switch (min)
  1335. {
  1336. case 6:
  1337. case 7:
  1338. min = 5;
  1339. break;
  1340. case 8:
  1341. case 9:
  1342. case 11:
  1343. case 12:
  1344. min = 10;
  1345. break;
  1346. case 13:
  1347. case 14:
  1348. case 16:
  1349. case 17:
  1350. min = 15;
  1351. break;
  1352. case 18:
  1353. case 19:
  1354. case 21:
  1355. case 22:
  1356. min = 20;
  1357. break;
  1358. case 23:
  1359. case 24:
  1360. case 26:
  1361. case 27:
  1362. min = 25;
  1363. break;
  1364. case 28:
  1365. case 29:
  1366. case 31:
  1367. case 32:
  1368. min = 30;
  1369. break;
  1370. case 33:
  1371. case 34:
  1372. case 36:
  1373. case 37:
  1374. min = 35;
  1375. break;
  1376. case 38:
  1377. case 39:
  1378. case 41:
  1379. case 42:
  1380. min = 40;
  1381. break;
  1382. case 43:
  1383. case 44:
  1384. case 46:
  1385. case 47:
  1386. min = 45;
  1387. break;
  1388. case 48:
  1389. case 49:
  1390. case 51:
  1391. case 52:
  1392. min = 50;
  1393. break;
  1394. case 53:
  1395. case 54:
  1396. case 56:
  1397. case 57:
  1398. min = 55;
  1399. break;
  1400. }
  1401. }
  1402. return min;
  1403. }
  1404. public void managerSay(byte min)
  1405. {
  1406. // for attack phase, sending message every 5 minutes
  1407. if (_inAttackTime)
  1408. {
  1409. if (min < 5)
  1410. return; // do not shout when < 5 minutes
  1411. min = minuteSelect(min);
  1412. String msg = min + " minute(s) have passed."; // now this is a
  1413. // proper message^^
  1414. if (min == 90)
  1415. msg = "Game over. The teleport will appear momentarily";
  1416. int i = 0;
  1417. for (int k = _managers.size(); i < k; i++)
  1418. {
  1419. if (_managers.get(i) == null)
  1420. {
  1421. _log.warning("FourSepulchersManager: managerSay(): manager is null");
  1422. continue;
  1423. }
  1424. if (!(_managers.get(i).getLastSpawn() instanceof L2SepulcherNpcInstance))
  1425. {
  1426. _log.warning("FourSepulchersManager: managerSay(): manager is not Sepulcher instance");
  1427. continue;
  1428. }
  1429. // hall not used right now, so its manager will not tell you
  1430. // anything :)
  1431. // if you don't need this - delete next two lines.
  1432. if (!_hallInUse.get(_managers.get(i).getNpcid()).booleanValue())
  1433. continue;
  1434. ((L2SepulcherNpcInstance) _managers.get(i).getLastSpawn()).sayInShout(msg);
  1435. }
  1436. }
  1437. else if (_inEntryTime)
  1438. {
  1439. String msg1 = "You may now enter the Sepulcher";
  1440. String msg2 = "If you place your hand on the stone statue in front of each sepulcher,"
  1441. + " you will be able to enter";
  1442. int i = 0;
  1443. for (int k = _managers.size(); i < k; i++)
  1444. {
  1445. if (_managers.get(i) == null)
  1446. {
  1447. _log.warning("FourSepulchersManager: Something goes wrong in managerSay()...");
  1448. continue;
  1449. }
  1450. if (!(_managers.get(i).getLastSpawn() instanceof L2SepulcherNpcInstance))
  1451. {
  1452. _log.warning("FourSepulchersManager: Something goes wrong in managerSay()...");
  1453. continue;
  1454. }
  1455. ((L2SepulcherNpcInstance) _managers.get(i).getLastSpawn()).sayInShout(msg1);
  1456. ((L2SepulcherNpcInstance) _managers.get(i).getLastSpawn()).sayInShout(msg2);
  1457. }
  1458. }
  1459. }
  1460. protected class ManagerSay implements Runnable
  1461. {
  1462. public void run()
  1463. {
  1464. if (_inAttackTime)
  1465. {
  1466. Calendar tmp = Calendar.getInstance();
  1467. tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis()
  1468. - _warmUpTimeEnd);
  1469. if (tmp.get(Calendar.MINUTE) + 5 < Config.FS_TIME_ATTACK)
  1470. {
  1471. managerSay((byte) tmp.get(Calendar.MINUTE)); // byte
  1472. // because
  1473. // minute
  1474. // cannot be
  1475. // more than
  1476. // 59
  1477. ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60000);
  1478. }
  1479. // attack time ending chat
  1480. else if (tmp.get(Calendar.MINUTE) + 5 >= Config.FS_TIME_ATTACK)
  1481. {
  1482. managerSay((byte) 90); // sending a unique id :D
  1483. }
  1484. }
  1485. else if (_inEntryTime)
  1486. managerSay((byte) 0);
  1487. }
  1488. }
  1489. protected class ChangeEntryTime implements Runnable
  1490. {
  1491. public void run()
  1492. {
  1493. // _log.info("FourSepulchersManager:In Entry Time");
  1494. _inEntryTime = true;
  1495. _inWarmUpTime = false;
  1496. _inAttackTime = false;
  1497. _inCoolDownTime = false;
  1498. long interval = 0;
  1499. // if this is first launch - search time when entry time will be
  1500. // ended:
  1501. // counting difference between time when entry time ends and current
  1502. // time
  1503. // and then launching change time task
  1504. if (_firstTimeRun)
  1505. interval = _entryTimeEnd
  1506. - Calendar.getInstance().getTimeInMillis();
  1507. else
  1508. interval = Config.FS_TIME_ENTRY * 60000; // else use stupid
  1509. // method
  1510. // launching saying process...
  1511. ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 0);
  1512. _changeWarmUpTimeTask = ThreadPoolManager.getInstance().scheduleEffect(new ChangeWarmUpTime(),interval);
  1513. if (_changeEntryTimeTask != null)
  1514. {
  1515. _changeEntryTimeTask.cancel(true);
  1516. _changeEntryTimeTask = null;
  1517. }
  1518. }
  1519. }
  1520. protected class ChangeWarmUpTime implements Runnable
  1521. {
  1522. public void run()
  1523. {
  1524. // _log.info("FourSepulchersManager:In Warm-Up Time");
  1525. _inEntryTime = true;
  1526. _inWarmUpTime = false;
  1527. _inAttackTime = false;
  1528. _inCoolDownTime = false;
  1529. long interval = 0;
  1530. // searching time when warmup time will be ended:
  1531. // counting difference between time when warmup time ends and
  1532. // current time
  1533. // and then launching change time task
  1534. if (_firstTimeRun)
  1535. interval = _warmUpTimeEnd
  1536. - Calendar.getInstance().getTimeInMillis();
  1537. else
  1538. interval = Config.FS_TIME_WARMUP * 60000;
  1539. _changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), interval);
  1540. if (_changeWarmUpTimeTask != null)
  1541. {
  1542. _changeWarmUpTimeTask.cancel(true);
  1543. _changeWarmUpTimeTask = null;
  1544. }
  1545. }
  1546. }
  1547. protected class ChangeAttackTime implements Runnable
  1548. {
  1549. public void run()
  1550. {
  1551. // _log.info("FourSepulchersManager:In Attack Time");
  1552. _inEntryTime = false;
  1553. _inWarmUpTime = false;
  1554. _inAttackTime = true;
  1555. _inCoolDownTime = false;
  1556. locationShadowSpawns();
  1557. spawnMysteriousBox(31921);
  1558. spawnMysteriousBox(31922);
  1559. spawnMysteriousBox(31923);
  1560. spawnMysteriousBox(31924);
  1561. if (!_firstTimeRun)
  1562. {
  1563. _warmUpTimeEnd = Calendar.getInstance().getTimeInMillis();
  1564. }
  1565. long interval = 0;
  1566. // say task
  1567. if (_firstTimeRun)
  1568. {
  1569. for (double min = Calendar.getInstance().get(Calendar.MINUTE); min < _newCycleMin; min++)
  1570. {
  1571. // looking for next shout time....
  1572. if (min % 5 == 0)// check if min can be divided by 5
  1573. {
  1574. _log.info(Calendar.getInstance().getTime()
  1575. + " Atk announce scheduled to " + min
  1576. + " minute of this hour.");
  1577. Calendar inter = Calendar.getInstance();
  1578. inter.set(Calendar.MINUTE, (int) min);
  1579. ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), inter.getTimeInMillis()
  1580. - Calendar.getInstance().getTimeInMillis());
  1581. break;
  1582. }
  1583. }
  1584. }
  1585. else
  1586. ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60400);
  1587. // searching time when attack time will be ended:
  1588. // counting difference between time when attack time ends and
  1589. // current time
  1590. // and then launching change time task
  1591. if (_firstTimeRun)
  1592. interval = _attackTimeEnd
  1593. - Calendar.getInstance().getTimeInMillis();
  1594. else
  1595. interval = Config.FS_TIME_ATTACK * 60000;
  1596. _changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), interval);
  1597. if (_changeAttackTimeTask != null)
  1598. {
  1599. _changeAttackTimeTask.cancel(true);
  1600. _changeAttackTimeTask = null;
  1601. }
  1602. }
  1603. }
  1604. protected class ChangeCoolDownTime implements Runnable
  1605. {
  1606. public void run()
  1607. {
  1608. // _log.info("FourSepulchersManager:In Cool-Down Time");
  1609. _inEntryTime = false;
  1610. _inWarmUpTime = false;
  1611. _inAttackTime = false;
  1612. _inCoolDownTime = true;
  1613. clean();
  1614. Calendar time = Calendar.getInstance();
  1615. // one hour = 55th min to 55 min of next hour, so we check for this,
  1616. // also check for first launch
  1617. if (Calendar.getInstance().get(Calendar.MINUTE) > _newCycleMin
  1618. && !_firstTimeRun)
  1619. time.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) + 1);
  1620. time.set(Calendar.MINUTE, _newCycleMin);
  1621. _log.info("FourSepulchersManager: Entry time: " + time.getTime());
  1622. if (_firstTimeRun)
  1623. _firstTimeRun = false; // cooldown phase ends event hour, so it
  1624. // will be not first run
  1625. long interval = time.getTimeInMillis()
  1626. - Calendar.getInstance().getTimeInMillis();
  1627. _changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), interval);
  1628. if (_changeCoolDownTimeTask != null)
  1629. {
  1630. _changeCoolDownTimeTask.cancel(true);
  1631. _changeCoolDownTimeTask = null;
  1632. }
  1633. }
  1634. }
  1635. public Map<Integer, Integer> getHallGateKeepers()
  1636. {
  1637. return _hallGateKeepers;
  1638. }
  1639. public void showHtmlFile(L2PcInstance player, String file,
  1640. L2NpcInstance npc, L2PcInstance member)
  1641. {
  1642. NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
  1643. html.setFile("data/html/SepulcherNpc/" + file);
  1644. if (member != null)
  1645. html.replace("%member%", member.getName());
  1646. player.sendPacket(html);
  1647. }
  1648. }