TowerOfInfinitum.java 4.7 KB

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