FourSepulchersManager.java 51 KB

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