FourSepulchersManager.java 51 KB

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