GeneralDilios.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 java.util.Set;
  21. import ai.npc.AbstractNpcAI;
  22. import com.l2jserver.gameserver.datatables.SpawnTable;
  23. import com.l2jserver.gameserver.model.L2Spawn;
  24. import com.l2jserver.gameserver.model.actor.L2Npc;
  25. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  26. import com.l2jserver.gameserver.network.NpcStringId;
  27. import com.l2jserver.gameserver.network.clientpackets.Say2;
  28. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  29. /**
  30. * Dilios AI
  31. * @author JIV, Sephiroth, Apocalipce
  32. */
  33. public final class GeneralDilios extends AbstractNpcAI
  34. {
  35. private static final int GENERAL_ID = 32549;
  36. private static final int GUARD_ID = 32619;
  37. private L2Npc _general;
  38. private final Set<L2Spawn> _guards;
  39. private static final NpcStringId[] diliosText =
  40. {
  41. NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_WERE_GATHERING_BRAVE_ADVENTURERS_TO_ATTACK_TIATS_MOUNTED_TROOP_THATS_ROOTED_IN_THE_SEED_OF_DESTRUCTION,
  42. // NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_DESTRUCTION_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE,
  43. // NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_TIATS_MOUNTED_TROOP_IS_CURRENTLY_TRYING_TO_RETAKE_SEED_OF_DESTRUCTION_COMMIT_ALL_THE_AVAILABLE_REINFORCEMENTS_INTO_SEED_OF_DESTRUCTION,
  44. NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_BRAVE_ADVENTURERS_WHO_HAVE_CHALLENGED_THE_SEED_OF_INFINITY_ARE_CURRENTLY_INFILTRATING_THE_HALL_OF_EROSION_THROUGH_THE_DEFENSIVELY_WEAK_HALL_OF_SUFFERING,
  45. // NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_SWEEPING_THE_SEED_OF_INFINITY_IS_CURRENTLY_COMPLETE_TO_THE_HEART_OF_THE_SEED_EKIMUS_IS_BEING_DIRECTLY_ATTACKED_AND_THE_UNDEAD_REMAINING_IN_THE_HALL_OF_SUFFERING_ARE_BEING_ERADICATED,
  46. NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_INFINITY_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE
  47. // NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_RESURRECTED_UNDEAD_IN_THE_SEED_OF_INFINITY_ARE_POURING_INTO_THE_HALL_OF_SUFFERING_AND_THE_HALL_OF_EROSION
  48. // NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_EKIMUS_IS_ABOUT_TO_BE_REVIVED_BY_THE_RESURRECTED_UNDEAD_IN_SEED_OF_INFINITY_SEND_ALL_REINFORCEMENTS_TO_THE_HEART_AND_THE_HALL_OF_SUFFERING
  49. };
  50. private GeneralDilios()
  51. {
  52. super(GeneralDilios.class.getSimpleName(), "ai/individual");
  53. _general = SpawnTable.getInstance().getFirstSpawn(GENERAL_ID).getLastSpawn();
  54. _guards = SpawnTable.getInstance().getSpawns(GUARD_ID);
  55. if ((_general == null) || _guards.isEmpty())
  56. {
  57. _log.warning(GeneralDilios.class.getSimpleName() + ": Cannot find NPCs!");
  58. return;
  59. }
  60. startQuestTimer("command_0", 60000, null, null);
  61. }
  62. @Override
  63. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  64. {
  65. if (event.startsWith("command_"))
  66. {
  67. int value = Integer.parseInt(event.substring(8));
  68. if (value < 6)
  69. {
  70. _general.broadcastPacket(new NpcSay(_general.getObjectId(), Say2.NPC_ALL, GENERAL_ID, NpcStringId.STABBING_THREE_TIMES));
  71. startQuestTimer("guard_animation_0", 3400, null, null);
  72. }
  73. else
  74. {
  75. value = -1;
  76. _general.broadcastPacket(new NpcSay(_general.getObjectId(), Say2.NPC_SHOUT, GENERAL_ID, diliosText[getRandom(diliosText.length)]));
  77. }
  78. startQuestTimer("command_" + (value + 1), 60000, null, null);
  79. }
  80. else if (event.startsWith("guard_animation_"))
  81. {
  82. int value = Integer.parseInt(event.substring(16));
  83. for (L2Spawn guard : _guards)
  84. {
  85. guard.getLastSpawn().broadcastSocialAction(4);
  86. }
  87. if (value < 2)
  88. {
  89. startQuestTimer("guard_animation_" + (value + 1), 1500, null, null);
  90. }
  91. }
  92. return super.onAdvEvent(event, npc, player);
  93. }
  94. public static void main(String[] args)
  95. {
  96. new GeneralDilios();
  97. }
  98. }