IsleOfPrayer.java 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.group_template;
  20. import java.util.HashMap;
  21. import java.util.Map;
  22. import ai.npc.AbstractNpcAI;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.holders.ItemChanceHolder;
  26. /**
  27. * Isle of Prayer AI.
  28. * @author Zoey76
  29. */
  30. public final class IsleOfPrayer extends AbstractNpcAI
  31. {
  32. // Items
  33. private static final int YELLOW_SEED_OF_EVIL_SHARD = 9593;
  34. private static final int GREEN_SEED_OF_EVIL_SHARD = 9594;
  35. private static final int BLUE_SEED_OF_EVIL_SHARD = 9595;
  36. private static final int RED_SEED_OF_EVIL_SHARD = 9596;
  37. // Monsters
  38. private static final Map<Integer, ItemChanceHolder> MONSTERS = new HashMap<>();
  39. static
  40. {
  41. MONSTERS.put(22257, new ItemChanceHolder(YELLOW_SEED_OF_EVIL_SHARD, 2087)); // Island Guardian
  42. MONSTERS.put(22258, new ItemChanceHolder(YELLOW_SEED_OF_EVIL_SHARD, 2147)); // White Sand Mirage
  43. MONSTERS.put(22259, new ItemChanceHolder(YELLOW_SEED_OF_EVIL_SHARD, 2642)); // Muddy Coral
  44. MONSTERS.put(22260, new ItemChanceHolder(YELLOW_SEED_OF_EVIL_SHARD, 2292)); // Kleopora
  45. MONSTERS.put(22261, new ItemChanceHolder(GREEN_SEED_OF_EVIL_SHARD, 1171)); // Seychelles
  46. MONSTERS.put(22262, new ItemChanceHolder(GREEN_SEED_OF_EVIL_SHARD, 1173)); // Naiad
  47. MONSTERS.put(22263, new ItemChanceHolder(GREEN_SEED_OF_EVIL_SHARD, 1403)); // Sonneratia
  48. MONSTERS.put(22264, new ItemChanceHolder(GREEN_SEED_OF_EVIL_SHARD, 1207)); // Castalia
  49. MONSTERS.put(22265, new ItemChanceHolder(RED_SEED_OF_EVIL_SHARD, 575)); // Chrysocolla
  50. MONSTERS.put(22266, new ItemChanceHolder(RED_SEED_OF_EVIL_SHARD, 493)); // Pythia
  51. MONSTERS.put(22267, new ItemChanceHolder(RED_SEED_OF_EVIL_SHARD, 770)); // Dark Water Dragon
  52. MONSTERS.put(22268, new ItemChanceHolder(BLUE_SEED_OF_EVIL_SHARD, 987)); // Shade
  53. MONSTERS.put(22269, new ItemChanceHolder(BLUE_SEED_OF_EVIL_SHARD, 995)); // Shade
  54. MONSTERS.put(22270, new ItemChanceHolder(BLUE_SEED_OF_EVIL_SHARD, 1008)); // Water Dragon Detractor
  55. MONSTERS.put(22271, new ItemChanceHolder(BLUE_SEED_OF_EVIL_SHARD, 1008)); // Water Dragon Detractor
  56. }
  57. private IsleOfPrayer()
  58. {
  59. super(IsleOfPrayer.class.getSimpleName(), "ai/group_template");
  60. addKillId(MONSTERS.keySet());
  61. }
  62. @Override
  63. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  64. {
  65. final ItemChanceHolder holder = MONSTERS.get(npc.getId());
  66. if (getRandom(10000) <= holder.getChance())
  67. {
  68. npc.dropItem(killer, holder);
  69. }
  70. return super.onKill(npc, killer, isSummon);
  71. }
  72. public static void main(String[] args)
  73. {
  74. new IsleOfPrayer();
  75. }
  76. }