DragonVortex.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.DragonVortex;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. /**
  24. * Dragon Vortex AI.
  25. * @author UnAfraid, improved by Adry_85
  26. */
  27. public final class DragonVortex extends AbstractNpcAI
  28. {
  29. // NPC
  30. private static final int VORTEX = 32871;
  31. // Raids
  32. private static final int[] RAIDS =
  33. {
  34. 25718, // Emerald Horn
  35. 25719, // Dust Rider
  36. 25720, // Bleeding Fly
  37. 25721, // Blackdagger Wing
  38. 25722, // Shadow Summoner
  39. 25723, // Spike Slasher
  40. 25724, // Muscle Bomber
  41. };
  42. // Item
  43. private static final int LARGE_DRAGON_BONE = 17248;
  44. // Misc
  45. private static final int DESPAWN_DELAY = 1800000; // 30min
  46. private DragonVortex()
  47. {
  48. super(DragonVortex.class.getSimpleName(), "ai/npc");
  49. addStartNpc(VORTEX);
  50. addFirstTalkId(VORTEX);
  51. addTalkId(VORTEX);
  52. }
  53. @Override
  54. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  55. {
  56. if ("Spawn".equals(event))
  57. {
  58. if (hasQuestItems(player, LARGE_DRAGON_BONE))
  59. {
  60. takeItems(player, LARGE_DRAGON_BONE, 1);
  61. final int random = getRandom(1000);
  62. int raid = 0;
  63. if (random < 292)
  64. {
  65. raid = RAIDS[0]; // Emerald Horn 29.2%
  66. }
  67. else if (random < 516)
  68. {
  69. raid = RAIDS[1]; // Dust Rider 22.4%
  70. }
  71. else if (random < 692)
  72. {
  73. raid = RAIDS[2]; // Bleeding Fly 17.6%
  74. }
  75. else if (random < 808)
  76. {
  77. raid = RAIDS[3]; // Blackdagger Wing 11.6%
  78. }
  79. else if (random < 900)
  80. {
  81. raid = RAIDS[4]; // Spike Slasher 9.2%
  82. }
  83. else if (random < 956)
  84. {
  85. raid = RAIDS[5]; // Shadow Summoner 5.6%
  86. }
  87. else
  88. {
  89. raid = RAIDS[6]; // Muscle Bomber 4.4%
  90. }
  91. addSpawn(raid, npc.getX() + getRandom(-500, 500), npc.getY() + getRandom(-500, 500), npc.getZ() + 10, 0, false, DESPAWN_DELAY, true);
  92. }
  93. else
  94. {
  95. return "32871-no.html";
  96. }
  97. }
  98. return super.onAdvEvent(event, npc, player);
  99. }
  100. public static void main(String[] args)
  101. {
  102. new DragonVortex();
  103. }
  104. }