Rignos.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.Rignos;
  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.holders.SkillHolder;
  24. /**
  25. * Rignos AI.
  26. * @author St3eT
  27. */
  28. public class Rignos extends AbstractNpcAI
  29. {
  30. // NPC
  31. private static final int RIGNOS = 32349; // Rignos
  32. // Item
  33. private static final int STAMP = 10013; // Race Stamp
  34. private static final int KEY = 9694; // Secret Key
  35. // Skill
  36. private static final SkillHolder TIMER = new SkillHolder(5239, 5); // Event Timer
  37. // Misc
  38. private static final int MIN_LV = 78;
  39. private Rignos()
  40. {
  41. super(Rignos.class.getSimpleName(), "ai/npc");
  42. addStartNpc(RIGNOS);
  43. addTalkId(RIGNOS);
  44. addFirstTalkId(RIGNOS);
  45. }
  46. @Override
  47. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  48. {
  49. switch (event)
  50. {
  51. case "32349-03.html":
  52. {
  53. return event;
  54. }
  55. case "startRace":
  56. {
  57. if (npc.isScriptValue(0))
  58. {
  59. npc.setScriptValue(1);
  60. startQuestTimer("TIME_OUT", 1800000, npc, null);
  61. TIMER.getSkill().applyEffects(player, player);
  62. if (player.hasSummon())
  63. {
  64. TIMER.getSkill().applyEffects(player.getSummon(), player.getSummon());
  65. }
  66. if (hasQuestItems(player, STAMP))
  67. {
  68. takeItems(player, STAMP, -1);
  69. }
  70. }
  71. break;
  72. }
  73. case "exchange":
  74. {
  75. if (getQuestItemsCount(player, STAMP) >= 4)
  76. {
  77. giveItems(player, KEY, 3);
  78. takeItems(player, STAMP, -1);
  79. }
  80. break;
  81. }
  82. case "TIME_OUT":
  83. {
  84. npc.setScriptValue(0);
  85. break;
  86. }
  87. }
  88. return super.onAdvEvent(event, npc, player);
  89. }
  90. @Override
  91. public String onFirstTalk(L2Npc npc, L2PcInstance player)
  92. {
  93. String htmltext = (npc.isScriptValue(0) && (player.getLevel() >= MIN_LV)) ? "32349.html" : "32349-02.html";
  94. if (getQuestItemsCount(player, STAMP) >= 4)
  95. {
  96. htmltext = "32349-01.html";
  97. }
  98. return htmltext;
  99. }
  100. public static void main(String[] args)
  101. {
  102. new Rignos();
  103. }
  104. }