HallOfSuffering.java 21 KB

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