TowerOfInfinitum.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. * Copyright (C) 2004-2014 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 hellbound.TowerOfInfinitum;
  20. import java.util.HashMap;
  21. import java.util.Map;
  22. import com.l2jserver.gameserver.instancemanager.HellboundManager;
  23. import com.l2jserver.gameserver.model.L2Party;
  24. import com.l2jserver.gameserver.model.Location;
  25. import com.l2jserver.gameserver.model.actor.L2Npc;
  26. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  27. import com.l2jserver.gameserver.model.quest.Quest;
  28. import com.l2jserver.gameserver.util.Util;
  29. /**
  30. * @author GKR
  31. */
  32. public class TowerOfInfinitum extends Quest
  33. {
  34. private static final int JERIAN = 32302;
  35. private static final int GK_FIRST = 32745;
  36. private static final int GK_LAST = 32752;
  37. private static final int PASS_SKILL = 2357;
  38. private static final Map<Integer, Location[]> TELE_COORDS = new HashMap<>();
  39. public TowerOfInfinitum(int questId, String name, String descr)
  40. {
  41. super(questId, name, descr);
  42. addStartNpc(JERIAN);
  43. addTalkId(JERIAN);
  44. for (int i = GK_FIRST; i <= GK_LAST; i++)
  45. {
  46. addStartNpc(i);
  47. addTalkId(i);
  48. }
  49. TELE_COORDS.put(32745, new Location[]
  50. {
  51. new Location(-22208, 277122, -13376),
  52. null
  53. });
  54. TELE_COORDS.put(32746, new Location[]
  55. {
  56. new Location(-22208, 277106, -11648),
  57. new Location(-22208, 277074, -15040)
  58. });
  59. TELE_COORDS.put(32747, new Location[]
  60. {
  61. new Location(-22208, 277120, -9920),
  62. new Location(-22208, 277120, -13376)
  63. });
  64. TELE_COORDS.put(32748, new Location[]
  65. {
  66. new Location(-19024, 277126, -8256),
  67. new Location(-22208, 277106, -11648)
  68. });
  69. TELE_COORDS.put(32749, new Location[]
  70. {
  71. new Location(-19024, 277106, -9920),
  72. new Location(-22208, 277122, -9920)
  73. });
  74. TELE_COORDS.put(32750, new Location[]
  75. {
  76. new Location(-19008, 277100, -11648),
  77. new Location(-19024, 277122, -8256)
  78. });
  79. TELE_COORDS.put(32751, new Location[]
  80. {
  81. new Location(-19008, 277100, -13376),
  82. new Location(-19008, 277106, -9920)
  83. });
  84. TELE_COORDS.put(32752, new Location[]
  85. {
  86. new Location(14602, 283179, -7500),
  87. new Location(-19008, 277100, -11648)
  88. });
  89. }
  90. private static final Location ENTER_LOCATION = new Location(-22204, 277056, -15023);
  91. @Override
  92. public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  93. {
  94. String htmltext = event;
  95. int npcId = npc.getId();
  96. if (event.equalsIgnoreCase("enter") && (npcId == JERIAN))
  97. {
  98. if (HellboundManager.getInstance().getLevel() >= 11)
  99. {
  100. L2Party party = player.getParty();
  101. if ((party != null) && (party.getLeaderObjectId() == player.getObjectId()))
  102. {
  103. for (L2PcInstance partyMember : party.getMembers())
  104. {
  105. if (!Util.checkIfInRange(300, partyMember, npc, true) || !partyMember.isAffectedBySkill(PASS_SKILL))
  106. {
  107. return "32302-02.htm";
  108. }
  109. }
  110. for (L2PcInstance partyMember : party.getMembers())
  111. {
  112. partyMember.teleToLocation(ENTER_LOCATION, true);
  113. }
  114. htmltext = null;
  115. }
  116. else
  117. {
  118. htmltext = "32302-02a.htm";
  119. }
  120. }
  121. else
  122. {
  123. htmltext = "32302-02b.htm";
  124. }
  125. }
  126. else if ((event.equalsIgnoreCase("up") || event.equalsIgnoreCase("down")) && (npcId >= GK_FIRST) && (npcId <= GK_LAST))
  127. {
  128. int direction = event.equalsIgnoreCase("up") ? 0 : 1;
  129. L2Party party = player.getParty();
  130. if (party == null)
  131. {
  132. htmltext = "gk-noparty.htm";
  133. }
  134. else if (party.getLeaderObjectId() != player.getObjectId())
  135. {
  136. htmltext = "gk-noreq.htm";
  137. }
  138. else
  139. {
  140. for (L2PcInstance partyMember : party.getMembers())
  141. {
  142. if (!Util.checkIfInRange(1000, partyMember, npc, false) || (Math.abs(partyMember.getZ() - npc.getZ()) > 100))
  143. {
  144. return "gk-noreq.htm";
  145. }
  146. }
  147. final Location tele = TELE_COORDS.get(npcId)[direction];
  148. if (tele != null)
  149. {
  150. for (L2PcInstance partyMember : party.getMembers())
  151. {
  152. partyMember.teleToLocation(tele, true);
  153. }
  154. }
  155. htmltext = null;
  156. }
  157. }
  158. return htmltext;
  159. }
  160. public static void main(String[] args)
  161. {
  162. new TowerOfInfinitum(-1, TowerOfInfinitum.class.getSimpleName(), "hellbound");
  163. }
  164. }