GraveRobbers.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 ai.individual;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
  23. import com.l2jserver.gameserver.model.holders.MinionHolder;
  24. /**
  25. * Grove Robber's AI.<br>
  26. * <ul>
  27. * <li>Grove Robber Summoner</li>
  28. * <li>Grove Robber Megician</li>
  29. * </ul>
  30. * @author Zealar
  31. */
  32. public final class GraveRobbers extends AbstractNpcAI
  33. {
  34. private static final int GRAVE_ROBBER_SUMMONER = 22678;
  35. private static final int GRAVE_ROBBER_MEGICIAN = 22679;
  36. private GraveRobbers()
  37. {
  38. super(GraveRobbers.class.getSimpleName(), "ai/individual");
  39. addSpawnId(GRAVE_ROBBER_SUMMONER, GRAVE_ROBBER_MEGICIAN);
  40. }
  41. @Override
  42. public String onSpawn(L2Npc npc)
  43. {
  44. if (getRandom(2) == 0)
  45. {
  46. spawnMinions(npc, "Privates1");
  47. }
  48. else
  49. {
  50. spawnMinions(npc, "Privates2");
  51. }
  52. return super.onSpawn(npc);
  53. }
  54. private void spawnMinions(final L2Npc npc, final String spawnName)
  55. {
  56. for (MinionHolder is : npc.getTemplate().getParameters().getMinionList(spawnName))
  57. {
  58. addMinion((L2MonsterInstance) npc, is.getId());
  59. }
  60. }
  61. public static void main(String[] args)
  62. {
  63. new GraveRobbers();
  64. }
  65. }