ElcadiasTent.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package instances.ElcadiasTent;
  20. import instances.AbstractInstance;
  21. import quests.Q10292_SevenSignsGirlOfDoubt.Q10292_SevenSignsGirlOfDoubt;
  22. import quests.Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom;
  23. import quests.Q10294_SevenSignsToTheMonasteryOfSilence.Q10294_SevenSignsToTheMonasteryOfSilence;
  24. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  25. import com.l2jserver.gameserver.model.Location;
  26. import com.l2jserver.gameserver.model.actor.L2Npc;
  27. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  28. import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
  29. import com.l2jserver.gameserver.model.quest.QuestState;
  30. /**
  31. * Elcadia's Tent instance zone.
  32. * @author Adry_85
  33. */
  34. public final class ElcadiasTent extends AbstractInstance
  35. {
  36. protected class ETWorld extends InstanceWorld
  37. {
  38. }
  39. // NPCs
  40. private static final int ELCADIA = 32784;
  41. private static final int GRUFF_LOOKING_MAN = 32862;
  42. // Locations
  43. private static final Location START_LOC = new Location(89706, -238074, -9632, 0, 0);
  44. private static final Location EXIT_LOC = new Location(43316, -87986, -2832, 0, 0);
  45. // Misc
  46. private static final int TEMPLATE_ID = 158;
  47. public ElcadiasTent()
  48. {
  49. super(ElcadiasTent.class.getSimpleName());
  50. addFirstTalkId(GRUFF_LOOKING_MAN, ELCADIA);
  51. addStartNpc(GRUFF_LOOKING_MAN, ELCADIA);
  52. addTalkId(GRUFF_LOOKING_MAN, ELCADIA);
  53. }
  54. @Override
  55. public String onTalk(L2Npc npc, L2PcInstance talker)
  56. {
  57. if (npc.getId() == GRUFF_LOOKING_MAN)
  58. {
  59. final QuestState GirlOfDoubt = talker.getQuestState(Q10292_SevenSignsGirlOfDoubt.class.getSimpleName());
  60. final QuestState ForbiddenBook = talker.getQuestState(Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.class.getSimpleName());
  61. final QuestState Monastery = talker.getQuestState(Q10294_SevenSignsToTheMonasteryOfSilence.class.getSimpleName());
  62. if (((GirlOfDoubt != null) && GirlOfDoubt.isStarted()) //
  63. || ((GirlOfDoubt != null) && GirlOfDoubt.isCompleted() && (ForbiddenBook == null)) //
  64. || ((ForbiddenBook != null) && ForbiddenBook.isStarted()) //
  65. || ((ForbiddenBook != null) && ForbiddenBook.isCompleted() && (Monastery == null)))
  66. {
  67. enterInstance(talker, new ETWorld(), "ElcadiasTent.xml", TEMPLATE_ID);
  68. }
  69. else
  70. {
  71. return "32862-01.html";
  72. }
  73. }
  74. else
  75. {
  76. final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker);
  77. world.removeAllowed(talker.getObjectId());
  78. talker.setInstanceId(0);
  79. talker.teleToLocation(EXIT_LOC);
  80. }
  81. return super.onTalk(npc, talker);
  82. }
  83. @Override
  84. public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
  85. {
  86. if (firstEntrance)
  87. {
  88. world.addAllowed(player.getObjectId());
  89. }
  90. teleportPlayer(player, START_LOC, world.getInstanceId(), false);
  91. }
  92. }