MonumentOfHeroes.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 ai.npc.MonumentOfHeroes;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.util.Util;
  24. /**
  25. * Monument of Heroes AI.
  26. * @author Adry_85
  27. */
  28. public final class MonumentOfHeroes extends AbstractNpcAI
  29. {
  30. // NPCs
  31. private static final int[] MONUMENTS =
  32. {
  33. 31690,
  34. 31769,
  35. 31770,
  36. 31771,
  37. 31772
  38. };
  39. // Items
  40. private static final int WINGS_OF_DESTINY_CIRCLET = 6842;
  41. private static final int[] WEAPONS =
  42. {
  43. 6611, // Infinity Blade
  44. 6612, // Infinity Cleaver
  45. 6613, // Infinity Axe
  46. 6614, // Infinity Rod
  47. 6615, // Infinity Crusher
  48. 6616, // Infinity Scepter
  49. 6617, // Infinity Stinger
  50. 6618, // Infinity Fang
  51. 6619, // Infinity Bow
  52. 6620, // Infinity Wing
  53. 6621, // Infinity Spear
  54. 9388, // Infinity Rapier
  55. 9389, // Infinity Sword
  56. 9390, // Infinity Shooter
  57. };
  58. private MonumentOfHeroes()
  59. {
  60. super(MonumentOfHeroes.class.getSimpleName(), "ai/npc");
  61. addStartNpc(MONUMENTS);
  62. addTalkId(MONUMENTS);
  63. }
  64. @Override
  65. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  66. {
  67. switch (event)
  68. {
  69. case "HeroWeapon":
  70. {
  71. if (player.isHero())
  72. {
  73. return hasAtLeastOneQuestItem(player, WEAPONS) ? "already_have_weapon.htm" : "weapon_list.htm";
  74. }
  75. return "no_hero_weapon.htm";
  76. }
  77. case "HeroCirclet":
  78. {
  79. if (player.isHero())
  80. {
  81. if (!hasQuestItems(player, WINGS_OF_DESTINY_CIRCLET))
  82. {
  83. giveItems(player, WINGS_OF_DESTINY_CIRCLET, 1);
  84. }
  85. else
  86. {
  87. return "already_have_circlet.htm";
  88. }
  89. }
  90. else
  91. {
  92. return "no_hero_circlet.htm";
  93. }
  94. break;
  95. }
  96. default:
  97. {
  98. int weaponId = Integer.parseInt(event);
  99. if (Util.contains(WEAPONS, weaponId))
  100. {
  101. giveItems(player, weaponId, 1);
  102. }
  103. break;
  104. }
  105. }
  106. return super.onAdvEvent(event, npc, player);
  107. }
  108. public static void main(String[] args)
  109. {
  110. new MonumentOfHeroes();
  111. }
  112. }