HallOfSuffering.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  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 instances.SeedOfInfinity;
  16. import java.util.Calendar;
  17. import java.util.Map;
  18. import javolution.util.FastMap;
  19. import com.l2jserver.gameserver.ai.CtrlEvent;
  20. import com.l2jserver.gameserver.cache.HtmCache;
  21. import com.l2jserver.gameserver.datatables.SkillTable;
  22. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  23. import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
  24. import com.l2jserver.gameserver.model.L2Object;
  25. import com.l2jserver.gameserver.model.L2Party;
  26. import com.l2jserver.gameserver.model.L2Skill;
  27. import com.l2jserver.gameserver.model.L2World;
  28. import com.l2jserver.gameserver.model.actor.L2Attackable;
  29. import com.l2jserver.gameserver.model.actor.L2Character;
  30. import com.l2jserver.gameserver.model.actor.L2Npc;
  31. import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
  32. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  33. import com.l2jserver.gameserver.model.quest.Quest;
  34. import com.l2jserver.gameserver.model.quest.QuestState;
  35. import com.l2jserver.gameserver.network.SystemMessageId;
  36. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  37. import com.l2jserver.gameserver.templates.skills.L2SkillType;
  38. import com.l2jserver.gameserver.util.Util;
  39. import com.l2jserver.util.Rnd;
  40. /**
  41. * TODO:
  42. * - after 15mins mobs are despawned
  43. * - bound instance to quests
  44. *
  45. * Contributing authors: Gigiikun, ZakaX, Didldak
  46. * Please maintain consistency between the Seed scripts.
  47. */
  48. public class HallOfSuffering extends Quest
  49. {
  50. private class HSWorld extends InstanceWorld
  51. {
  52. public Map<L2Npc,Boolean> npcList = new FastMap<L2Npc,Boolean>();
  53. public L2Npc klodekus = null;
  54. public L2Npc klanikus = null;
  55. public boolean isBossesAttacked = false;
  56. public long startTime = 0;
  57. public String ptLeaderName = "";
  58. public int rewardItemId = -1;
  59. public String rewardHtm = "";
  60. public boolean isRewarded = false;
  61. public HSWorld()
  62. {
  63. }
  64. }
  65. private static final String qn = "SeedOfInfinity";
  66. private static final int INSTANCEID = 115; // this is the client number
  67. private static final boolean debug = false;
  68. //Items
  69. //NPCs
  70. private static final int MOUTHOFEKIMUS = 32537;
  71. private static final int TEPIOS = 32530;
  72. // teleports
  73. private static final int[] ENTER_TELEPORT = {-187567,205570,-9538};
  74. //mobs
  75. private static final int KLODEKUS = 25665;
  76. private static final int KLANIKUS = 25666;
  77. private static final int TUMOR_ALIVE = 18704;
  78. private static final int TUMOR_DEAD = 18705;
  79. private static final int[] TUMOR_MOBIDS = {22509,22510,22511,22512,22513,22514,22515};
  80. private static final int[] TWIN_MOBIDS = {22509,22510,22511,22512,22513};
  81. // Doors/Walls/Zones
  82. // Doors/Walls/Zones
  83. private static final int[][] ROOM_1_MOBS = {
  84. {22509, -186296, 208200, -9544}, {22509, -186161, 208345, -9544}, {22509, -186296, 208403, -9544},
  85. {22510, -186107, 208113, -9528}, {22510, -186350, 208200, -9544}
  86. };
  87. private static final int[][] ROOM_2_MOBS = {
  88. {22511, -184433, 210953, -9536}, {22511, -184406, 211301, -9536}, {22509, -184541, 211272, -9544},
  89. {22510, -184244, 211098, -9536}, {22510, -184352, 211243, -9536}, {22510, -184298, 211330, -9528}
  90. };
  91. private static final int[][] ROOM_3_MOBS = {
  92. {22512, -182611, 213984, -9520}, {22512, -182908, 214071, -9520}, {22512, -182962, 213868, -9512},
  93. {22509, -182881, 213955, -9512}, {22511, -182827, 213781, -9504}, {22511, -182530, 213984, -9528},
  94. {22510, -182935, 213723, -9512}, {22510, -182557, 213868, -9520}
  95. };
  96. private static final int[][] ROOM_4_MOBS = {
  97. {22514, -180958, 216860, -9544}, {22514, -181012, 216628, -9536}, {22514, -181120, 216715, -9536},
  98. {22513, -180661, 216599, -9536}, {22513, -181039, 216599, -9536}, {22511, -180715, 216599, -9536},
  99. {22511, -181012, 216889, -9536}, {22512, -180931, 216918, -9536}, {22512, -180742, 216628, -9536}
  100. };
  101. private static final int[][] ROOM_5_MOBS = {
  102. {22512, -177372, 217854, -9536}, {22512, -177237, 218140, -9536}, {22512, -177021, 217647, -9528},
  103. {22513, -177372, 217792, -9544}, {22513, -177372, 218053, -9536}, {22514, -177291, 217734, -9544},
  104. {22514, -177264, 217792, -9544}, {22514, -177264, 218053, -9536}, {22515, -177156, 217792, -9536},
  105. {22515, -177075, 217647, -9528}
  106. };
  107. private static final int[][] TUMOR_SPAWNS = {
  108. {-186327,208286,-9544},{-184429,211155,-9544},{-182811,213871,-9496},
  109. {-181039,216633,-9528},{-177264,217760,-9544}
  110. };
  111. private static final int[][] TWIN_SPAWNS = {{25665,-173727,218169,-9536},{25666,-173727,218049,-9536}};
  112. private static final int[] TEPIOS_SPAWN = {-173727,218109,-9536};
  113. //etc
  114. private static final int BOSS_INVUL_TIME = 30000; // in milisex
  115. private static final int BOSS_MINION_SPAWN_TIME = 60000; // in milisex
  116. private static final int BOSS_RESSURECT_TIME = 20000; // in milisex
  117. // Instance reenter time
  118. // default: 24h
  119. private static final int INSTANCEPENALTY = 24;
  120. private boolean checkConditions(L2PcInstance player)
  121. {
  122. if (debug)
  123. return true;
  124. L2Party party = player.getParty();
  125. if (party == null)
  126. {
  127. player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER));
  128. return false;
  129. }
  130. if (party.getLeader() != player)
  131. {
  132. player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER));
  133. return false;
  134. }
  135. for (L2PcInstance partyMember : party.getPartyMembers())
  136. {
  137. if (partyMember.getLevel() < 75)
  138. {
  139. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT);
  140. sm.addPcName(partyMember);
  141. party.broadcastToPartyMembers(sm);
  142. return false;
  143. }
  144. if (!Util.checkIfInRange(1000, player, partyMember, true))
  145. {
  146. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED);
  147. sm.addPcName(partyMember);
  148. party.broadcastToPartyMembers(sm);
  149. return false;
  150. }
  151. Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
  152. if (System.currentTimeMillis() < reentertime)
  153. {
  154. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
  155. sm.addPcName(partyMember);
  156. party.broadcastToPartyMembers(sm);
  157. return false;
  158. }
  159. }
  160. return true;
  161. }
  162. private void teleportPlayer(L2PcInstance player, int[] coords, int instanceId)
  163. {
  164. player.setInstanceId(instanceId);
  165. player.teleToLocation(coords[0], coords[1], coords[2]);
  166. }
  167. protected int enterInstance(L2PcInstance player, String template, int[] coords)
  168. {
  169. int instanceId = 0;
  170. //check for existing instances for this player
  171. InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  172. //existing instance
  173. if (world != null)
  174. {
  175. if (!(world instanceof HSWorld))
  176. {
  177. player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER));
  178. return 0;
  179. }
  180. teleportPlayer(player, coords, world.instanceId);
  181. return world.instanceId;
  182. }
  183. //New instance
  184. else
  185. {
  186. if (!checkConditions(player))
  187. return 0;
  188. L2Party party = player.getParty();
  189. instanceId = InstanceManager.getInstance().createDynamicInstance(template);
  190. world = new HSWorld();
  191. world.instanceId = instanceId;
  192. world.templateId = INSTANCEID;
  193. world.status = 0;
  194. ((HSWorld)world).startTime = System.currentTimeMillis();
  195. ((HSWorld)world).ptLeaderName = player.getName();
  196. InstanceManager.getInstance().addWorld(world);
  197. _log.info("Hall Of Suffering started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
  198. runTumors((HSWorld)world);
  199. // teleport players
  200. if (player.getParty() == null)
  201. {
  202. teleportPlayer(player, coords, instanceId);
  203. world.allowed.add(player.getObjectId());
  204. }
  205. else
  206. {
  207. for (L2PcInstance partyMember : party.getPartyMembers())
  208. {
  209. teleportPlayer(partyMember, coords, instanceId);
  210. world.allowed.add(partyMember.getObjectId());
  211. if (partyMember.getQuestState(qn) == null)
  212. newQuestState(partyMember);
  213. }
  214. }
  215. return instanceId;
  216. }
  217. }
  218. protected boolean checkKillProgress(L2Npc mob, HSWorld world)
  219. {
  220. if (world.npcList.containsKey(mob))
  221. world.npcList.put(mob, true);
  222. for(boolean isDead: world.npcList.values())
  223. if (!isDead)
  224. return false;
  225. return true;
  226. }
  227. protected int[][] getRoomSpawns(int room)
  228. {
  229. switch(room)
  230. {
  231. case 0:
  232. return ROOM_1_MOBS;
  233. case 1:
  234. return ROOM_2_MOBS;
  235. case 2:
  236. return ROOM_3_MOBS;
  237. case 3:
  238. return ROOM_4_MOBS;
  239. case 4:
  240. return ROOM_5_MOBS;
  241. }
  242. _log.warning("");
  243. return new int[][]{};
  244. }
  245. protected void runTumors(HSWorld world)
  246. {
  247. for (int[] mob : getRoomSpawns(world.status))
  248. {
  249. L2Npc npc = addSpawn(mob[0], mob[1], mob[2], mob[3], 0, false,0,false,world.instanceId);
  250. world.npcList.put(npc, false);
  251. }
  252. L2Npc mob = addSpawn(TUMOR_ALIVE, TUMOR_SPAWNS[world.status][0], TUMOR_SPAWNS[world.status][1], TUMOR_SPAWNS[world.status][2], 0, false,0,false,world.instanceId);
  253. mob.disableCoreAI(true);
  254. mob.setIsImmobilized(true);
  255. mob.setCurrentHp(mob.getMaxHp()*0.5);
  256. world.npcList.put(mob, false);
  257. world.status++;
  258. }
  259. protected void runTwins(HSWorld world)
  260. {
  261. world.status++;
  262. world.klodekus = addSpawn(TWIN_SPAWNS[0][0], TWIN_SPAWNS[0][1], TWIN_SPAWNS[0][2], TWIN_SPAWNS[0][3], 0, false,0,false,world.instanceId);
  263. world.klanikus = addSpawn(TWIN_SPAWNS[1][0], TWIN_SPAWNS[1][1], TWIN_SPAWNS[1][2], TWIN_SPAWNS[1][3], 0, false,0,false,world.instanceId);
  264. world.klanikus.setIsMortal(false);
  265. world.klodekus.setIsMortal(false);
  266. }
  267. protected void bossSimpleDie(L2Npc boss)
  268. {
  269. // killing is only possible one time
  270. synchronized (this)
  271. {
  272. if (boss.isDead()) return;
  273. // now reset currentHp to zero
  274. boss.setCurrentHp(0);
  275. boss.setIsDead(true);
  276. }
  277. // Set target to null and cancel Attack or Cast
  278. boss.setTarget(null);
  279. // Stop movement
  280. boss.stopMove(null);
  281. // Stop HP/MP/CP Regeneration task
  282. boss.getStatus().stopHpMpRegeneration();
  283. boss.stopAllEffectsExceptThoseThatLastThroughDeath();
  284. // Send the Server->Client packet StatusUpdate with current HP and MP to all other L2PcInstance to inform
  285. boss.broadcastStatusUpdate();
  286. // Notify L2Character AI
  287. boss.getAI().notifyEvent(CtrlEvent.EVT_DEAD);
  288. if (boss.getWorldRegion() != null)
  289. boss.getWorldRegion().onDeath(boss);
  290. }
  291. private void calcRewardItemId(HSWorld world)
  292. {
  293. Long finishDiff = System.currentTimeMillis() - world.startTime;
  294. if (finishDiff < 1260000)
  295. {
  296. world.rewardHtm = "32530-00.htm";
  297. world.rewardItemId = 13777;
  298. }
  299. else if (finishDiff < 1380000)
  300. {
  301. world.rewardHtm = "32530-01.htm";
  302. world.rewardItemId = 13778;
  303. }
  304. else if (finishDiff < 1500000)
  305. {
  306. world.rewardHtm = "32530-02.htm";
  307. world.rewardItemId = 13779;
  308. }
  309. else if (finishDiff < 1620000)
  310. {
  311. world.rewardHtm = "32530-03.htm";
  312. world.rewardItemId = 13780;
  313. }
  314. else if (finishDiff < 1740000)
  315. {
  316. world.rewardHtm = "32530-04.htm";
  317. world.rewardItemId = 13781;
  318. }
  319. else if (finishDiff < 1860000)
  320. {
  321. world.rewardHtm = "32530-05.htm";
  322. world.rewardItemId = 13782;
  323. }
  324. else if (finishDiff < 1980000)
  325. {
  326. world.rewardHtm = "32530-06.htm";
  327. world.rewardItemId = 13783;
  328. }
  329. else if (finishDiff < 2100000)
  330. {
  331. world.rewardHtm = "32530-07.htm";
  332. world.rewardItemId = 13784;
  333. }
  334. else if (finishDiff < 2220000)
  335. {
  336. world.rewardHtm = "32530-08.htm";
  337. world.rewardItemId = 13785;
  338. }
  339. else
  340. {
  341. world.rewardHtm = "32530-09.htm";
  342. world.rewardItemId = 13786;
  343. }
  344. }
  345. private String getPtLeaderText(L2PcInstance player, HSWorld world)
  346. {
  347. String htmltext = HtmCache.getInstance().getHtm(player.getHtmlPrefix(),"/data/scripts/instances/SeedOfInfinity/32530-10.htm");
  348. htmltext = htmltext.replaceAll("%ptLeader%", String.valueOf(world.ptLeaderName));
  349. return htmltext;
  350. }
  351. @Override
  352. public String onSkillSee (L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
  353. {
  354. if (skill.getSkillType() == L2SkillType.BALANCE_LIFE || skill.getSkillType() == L2SkillType.HEAL
  355. || skill.getSkillType() == L2SkillType.HEAL_PERCENT || skill.getSkillType() == L2SkillType.HEAL_STATIC)
  356. {
  357. int hate = 2 * skill.getAggroPoints();
  358. if (hate < 2)
  359. hate = 1000;
  360. ((L2Attackable)npc).addDamageHate(caster,0,hate);
  361. }
  362. return super.onSkillSee(npc, caster, skill, targets, isPet);
  363. }
  364. @Override
  365. public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
  366. {
  367. InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  368. if (tmpworld instanceof HSWorld)
  369. {
  370. HSWorld world = (HSWorld) tmpworld;
  371. if (event.equalsIgnoreCase("spawnBossGuards"))
  372. {
  373. if (!world.klanikus.isInCombat() && !world.klodekus.isInCombat())
  374. {
  375. world.isBossesAttacked = false;
  376. return "";
  377. }
  378. L2Npc mob = addSpawn(TWIN_MOBIDS[Rnd.get(TWIN_MOBIDS.length)], TWIN_SPAWNS[0][1], TWIN_SPAWNS[0][2], TWIN_SPAWNS[0][3], 0, false,0,false,npc.getInstanceId());
  379. ((L2Attackable)mob).addDamageHate(((L2Attackable)npc).getMostHated(),0,1);
  380. if (Rnd.get(100) < 33)
  381. {
  382. mob = addSpawn(TWIN_MOBIDS[Rnd.get(TWIN_MOBIDS.length)], TWIN_SPAWNS[1][1], TWIN_SPAWNS[1][2], TWIN_SPAWNS[1][3], 0, false,0,false,npc.getInstanceId());
  383. ((L2Attackable)mob).addDamageHate(((L2Attackable)npc).getMostHated(),0,1);
  384. }
  385. startQuestTimer("spawnBossGuards", BOSS_MINION_SPAWN_TIME, npc, null);
  386. }
  387. else if (event.equalsIgnoreCase("isTwinSeparated"))
  388. {
  389. if (Util.checkIfInRange(500, world.klanikus, world.klodekus, false))
  390. {
  391. world.klanikus.setIsInvul(false);
  392. world.klodekus.setIsInvul(false);
  393. }
  394. else
  395. {
  396. world.klanikus.setIsInvul(true);
  397. world.klodekus.setIsInvul(true);
  398. }
  399. startQuestTimer("isTwinSeparated", 10000, npc, null);
  400. }
  401. else if (event.equalsIgnoreCase("ressurectTwin"))
  402. {
  403. L2Skill skill = SkillTable.getInstance().getInfo(5824, 1);
  404. L2Npc aliveTwin = (world.klanikus == npc ? world.klodekus : world.klanikus);
  405. npc.doRevive();
  406. npc.doCast(skill);
  407. npc.setCurrentHp(aliveTwin.getCurrentHp());
  408. // get most hated of other boss
  409. L2Character hated = ((L2MonsterInstance)aliveTwin).getMostHated();
  410. if(hated != null) //to prevent revived idling
  411. npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, hated, 1000);
  412. aliveTwin.setIsInvul(true); //make other boss invul
  413. startQuestTimer("uninvul", BOSS_INVUL_TIME, aliveTwin, null);
  414. }
  415. else if(event.equals("uninvul"))
  416. npc.setIsInvul(false);
  417. }
  418. return "";
  419. }
  420. @Override
  421. public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet, L2Skill skill)
  422. {
  423. final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  424. if (tmpworld instanceof HSWorld)
  425. {
  426. final HSWorld world = (HSWorld) tmpworld;
  427. if (!world.isBossesAttacked)
  428. {
  429. world.isBossesAttacked = true;
  430. Calendar reenter = Calendar.getInstance();
  431. reenter.add(Calendar.HOUR, INSTANCEPENALTY);
  432. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
  433. sm.addInstanceName(tmpworld.templateId);
  434. // set instance reenter time for all allowed players
  435. for (int objectId : tmpworld.allowed)
  436. {
  437. L2PcInstance player = L2World.getInstance().getPlayer(objectId);
  438. if (player != null && player.isOnline())
  439. {
  440. InstanceManager.getInstance().setInstanceTime(objectId, tmpworld.templateId, reenter.getTimeInMillis());
  441. player.sendPacket(sm);
  442. }
  443. }
  444. startQuestTimer("spawnBossGuards", BOSS_MINION_SPAWN_TIME, npc, null);
  445. startQuestTimer("isTwinSeparated", 10000, npc, null);
  446. }
  447. else if (damage >= npc.getCurrentHp())
  448. {
  449. if (world.klanikus.isDead())
  450. {
  451. world.klanikus.setIsDead(false);
  452. world.klanikus.doDie(attacker);
  453. world.klodekus.doDie(attacker);
  454. }
  455. else if (((HSWorld)tmpworld).klodekus.isDead())
  456. {
  457. world.klodekus.setIsDead(false);
  458. world.klodekus.doDie(attacker);
  459. world.klanikus.doDie(attacker);
  460. }
  461. else
  462. {
  463. bossSimpleDie(npc);
  464. startQuestTimer("ressurectTwin", BOSS_RESSURECT_TIME, npc, null);
  465. }
  466. }
  467. }
  468. return null;
  469. }
  470. @Override
  471. public String onKill( L2Npc npc, L2PcInstance player, boolean isPet)
  472. {
  473. InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  474. if (tmpworld instanceof HSWorld)
  475. {
  476. HSWorld world = (HSWorld) tmpworld;
  477. if (npc.getNpcId() == TUMOR_ALIVE)
  478. addSpawn(TUMOR_DEAD, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, false, npc.getInstanceId());
  479. if (world.status < 5)
  480. {
  481. if (checkKillProgress(npc, world))
  482. runTumors(world);
  483. }
  484. else if (world.status == 5)
  485. {
  486. if (checkKillProgress(npc, world))
  487. runTwins(world);
  488. }
  489. else if (world.status == 6 && (npc.getNpcId() == KLODEKUS || npc.getNpcId() == KLANIKUS))
  490. {
  491. if (world.klanikus.isDead() && world.klodekus.isDead())
  492. {
  493. world.status++;
  494. // instance end
  495. calcRewardItemId(world);
  496. world.klanikus = null;
  497. world.klodekus = null;
  498. this.cancelQuestTimers("ressurectTwin");
  499. this.cancelQuestTimers("spawnBossGuards");
  500. this.cancelQuestTimers("isTwinSeparated");
  501. addSpawn(TEPIOS, TEPIOS_SPAWN[0], TEPIOS_SPAWN[1], TEPIOS_SPAWN[2], 0, false,0,false,world.instanceId);
  502. }
  503. }
  504. }
  505. return "";
  506. }
  507. @Override
  508. public String onFirstTalk (L2Npc npc, L2PcInstance player)
  509. {
  510. if (npc.getNpcId() == TEPIOS)
  511. {
  512. InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  513. if (((HSWorld)world).rewardItemId == -1)
  514. {
  515. _log.warning("Hall of Suffering: " + player.getName() + "(" + player.getObjectId() + ") is try to cheat!");
  516. return getPtLeaderText(player, (HSWorld)world);
  517. }
  518. else if (((HSWorld)world).isRewarded)
  519. return "32530-11.htm";
  520. else if (player.getParty() != null && player.getParty().getPartyLeaderOID() == player.getObjectId())
  521. return ((HSWorld)world).rewardHtm;
  522. return getPtLeaderText(player, (HSWorld)world);
  523. }
  524. return "";
  525. }
  526. @Override
  527. public String onTalk (L2Npc npc, L2PcInstance player)
  528. {
  529. int npcId = npc.getNpcId();
  530. QuestState st = player.getQuestState(qn);
  531. if (st == null)
  532. st = newQuestState(player);
  533. if (npcId == MOUTHOFEKIMUS)
  534. {
  535. enterInstance(player, "HallOfSuffering.xml", ENTER_TELEPORT);
  536. return "";
  537. }
  538. else if (npcId == TEPIOS)
  539. {
  540. InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  541. if (((HSWorld)world).rewardItemId == -1)
  542. {
  543. _log.warning("Hall of Suffering: " + player.getName() + "(" + player.getObjectId() + ") is try to cheat!");
  544. return getPtLeaderText(player, (HSWorld)world);
  545. }
  546. else if (((HSWorld)world).isRewarded)
  547. return "32530-11.htm";
  548. else if (player.getParty() != null && player.getParty().getPartyLeaderOID() == player.getObjectId())
  549. {
  550. ((HSWorld)world).isRewarded = true;
  551. for(L2PcInstance pl : player.getParty().getPartyMembers())
  552. {
  553. st = pl.getQuestState(qn);
  554. st.giveItems(736, 1);
  555. st.giveItems(((HSWorld)world).rewardItemId, 1);
  556. }
  557. return "";
  558. }
  559. return getPtLeaderText(player, (HSWorld)world);
  560. }
  561. return "";
  562. }
  563. public HallOfSuffering(int questId, String name, String descr)
  564. {
  565. super(questId, name, descr);
  566. addStartNpc(MOUTHOFEKIMUS);
  567. addTalkId(MOUTHOFEKIMUS);
  568. addStartNpc(TEPIOS);
  569. addFirstTalkId(TEPIOS);
  570. addTalkId(TEPIOS);
  571. addKillId(TUMOR_ALIVE);
  572. addKillId(KLODEKUS);
  573. addKillId(KLANIKUS);
  574. addAttackId(KLODEKUS);
  575. addAttackId(KLANIKUS);
  576. for(int mobId : TUMOR_MOBIDS)
  577. {
  578. addSkillSeeId(mobId);
  579. addKillId(mobId);
  580. }
  581. }
  582. public static void main(String[] args)
  583. {
  584. // now call the constructor (starts up the)
  585. new HallOfSuffering(-1,qn,"instances");
  586. }
  587. }