CatsEyeBandit.java 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.L2PcInstance;
  23. import com.l2jserver.gameserver.model.itemcontainer.Inventory;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.network.NpcStringId;
  26. import com.l2jserver.gameserver.network.clientpackets.Say2;
  27. /**
  28. * Cat's Eye Bandit (Quest Monster) AI.
  29. * @author Gladicek
  30. */
  31. public final class CatsEyeBandit extends AbstractNpcAI
  32. {
  33. // NPC ID
  34. private static final int MOB_ID = 27038;
  35. // Weapons
  36. private static final int BOW = 1181;
  37. private static final int DAGGER = 1182;
  38. private CatsEyeBandit()
  39. {
  40. super(CatsEyeBandit.class.getSimpleName(), "ai/individual");
  41. addAttackId(MOB_ID);
  42. addKillId(MOB_ID);
  43. }
  44. @Override
  45. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
  46. {
  47. final QuestState qs = attacker.getQuestState("403_PathToRogue"); // TODO: Replace with class name.
  48. if (npc.isScriptValue(0) && (qs != null) && ((qs.getItemEquipped(Inventory.PAPERDOLL_RHAND) == BOW) || (qs.getItemEquipped(Inventory.PAPERDOLL_RHAND) == DAGGER)))
  49. {
  50. broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.YOU_CHILDISH_FOOL_DO_YOU_THINK_YOU_CAN_CATCH_ME);
  51. npc.setScriptValue(1);
  52. }
  53. return super.onAttack(npc, attacker, damage, isSummon);
  54. }
  55. @Override
  56. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  57. {
  58. final QuestState qs = killer.getQuestState("403_PathToRogue"); // TODO: Replace with class name.
  59. if (qs != null)
  60. {
  61. broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.I_MUST_DO_SOMETHING_ABOUT_THIS_SHAMEFUL_INCIDENT);
  62. }
  63. return super.onKill(npc, killer, isSummon);
  64. }
  65. public static void main(String[] args)
  66. {
  67. new CatsEyeBandit();
  68. }
  69. }