Buron.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package hellbound.Buron;
  16. import com.l2jserver.gameserver.instancemanager.HellboundManager;
  17. import com.l2jserver.gameserver.model.actor.L2Npc;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.model.quest.Quest;
  20. import com.l2jserver.gameserver.model.quest.QuestState;
  21. /**
  22. * @author DS
  23. */
  24. public class Buron extends Quest
  25. {
  26. private static final int BURON = 32345;
  27. private static final int HELMET = 9669;
  28. private static final int TUNIC = 9670;
  29. private static final int PANTS = 9671;
  30. private static final int DARION_BADGE = 9674;
  31. @Override
  32. public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  33. {
  34. String htmltext = event;
  35. if ("Rumor".equalsIgnoreCase(event))
  36. {
  37. htmltext = "32345-" + HellboundManager.getInstance().getLevel() + "r.htm";
  38. }
  39. else
  40. {
  41. if (HellboundManager.getInstance().getLevel() < 2)
  42. {
  43. htmltext = "32345-lowlvl.htm";
  44. }
  45. else
  46. {
  47. QuestState qs = player.getQuestState(getName());
  48. if (qs == null)
  49. {
  50. qs = newQuestState(player);
  51. }
  52. if (qs.getQuestItemsCount(DARION_BADGE) >= 10)
  53. {
  54. qs.takeItems(DARION_BADGE, 10);
  55. if (event.equalsIgnoreCase("Tunic"))
  56. {
  57. player.addItem("Quest", TUNIC, 1, npc, true);
  58. }
  59. else if (event.equalsIgnoreCase("Helmet"))
  60. {
  61. player.addItem("Quest", HELMET, 1, npc, true);
  62. }
  63. else if (event.equalsIgnoreCase("Pants"))
  64. {
  65. player.addItem("Quest", PANTS, 1, npc, true);
  66. }
  67. htmltext = null;
  68. }
  69. else
  70. {
  71. htmltext = "32345-noitems.htm";
  72. }
  73. }
  74. }
  75. return htmltext;
  76. }
  77. @Override
  78. public final String onFirstTalk(L2Npc npc, L2PcInstance player)
  79. {
  80. if (player.getQuestState(getName()) == null)
  81. {
  82. newQuestState(player);
  83. }
  84. switch (HellboundManager.getInstance().getLevel())
  85. {
  86. case 1:
  87. return "32345-01.htm";
  88. case 2:
  89. case 3:
  90. case 4:
  91. return "32345-02.htm";
  92. default:
  93. return "32345-01a.htm";
  94. }
  95. }
  96. public Buron(int questId, String name, String descr)
  97. {
  98. super(questId, name, descr);
  99. addFirstTalkId(BURON);
  100. addStartNpc(BURON);
  101. addTalkId(BURON);
  102. }
  103. public static void main(String[] args)
  104. {
  105. new Buron(-1, "Buron", "hellbound");
  106. }
  107. }