TheValentineEvent.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 events.TheValentineEvent;
  16. import com.l2jserver.gameserver.model.Location;
  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. import com.l2jserver.gameserver.model.quest.State;
  22. /**
  23. * Event Code for "The Valentine Event"<br>
  24. * http://www.lineage2.com/archive/2009/01/the_valentine_e.html
  25. * @author Gnacik
  26. */
  27. public class TheValentineEvent extends Quest
  28. {
  29. private static final int _npc = 4301;
  30. private static final int _recipe = 20191;
  31. private static final Location[] _spawns =
  32. {
  33. new Location(87792, -142240, -1343, 44000),
  34. new Location(87616, -140688, -1542, 16500),
  35. new Location(114733, -178691, -821, 0),
  36. new Location(115708, -182362, -1449, 0),
  37. new Location(-44337, -113669, -224, 0),
  38. new Location(-44628, -115409, -240, 22500),
  39. new Location(-13073, 122801, -3117, 0),
  40. new Location(-13949, 121934, -2988, 32768),
  41. new Location(-14822, 123708, -3117, 8192),
  42. new Location(-80762, 151118, -3043, 28672),
  43. new Location(-84049, 150176, -3129, 4096),
  44. new Location(-82623, 151666, -3129, 49152),
  45. new Location(-84516, 242971, -3730, 34000),
  46. new Location(-86003, 243205, -3730, 60000),
  47. new Location(11281, 15652, -4584, 25000),
  48. new Location(11303, 17732, -4574, 57344),
  49. new Location(47151, 49436, -3059, 32000),
  50. new Location(79806, 55570, -1560, 0),
  51. new Location(83328, 55824, -1525, 32768),
  52. new Location(80986, 54504, -1525, 32768),
  53. new Location(18178, 145149, -3054, 7400),
  54. new Location(19208, 144380, -3097, 32768),
  55. new Location(19508, 145775, -3086, 48000),
  56. new Location(17396, 170259, -3507, 30000),
  57. new Location(83332, 149160, -3405, 49152),
  58. new Location(82277, 148598, -3467, 0),
  59. new Location(81621, 148725, -3467, 32768),
  60. new Location(81680, 145656, -3533, 32768),
  61. new Location(117498, 76630, -2695, 38000),
  62. new Location(115914, 76449, -2711, 59000),
  63. new Location(119536, 76988, -2275, 40960),
  64. new Location(147120, 27312, -2192, 40960),
  65. new Location(147920, 25664, -2000, 16384),
  66. new Location(111776, 221104, -3543, 16384),
  67. new Location(107904, 218096, -3675, 0),
  68. new Location(114920, 220020, -3632, 32768),
  69. new Location(147888, -58048, -2979, 49000),
  70. new Location(147285, -56461, -2776, 11500),
  71. new Location(44176, -48732, -800, 33000),
  72. new Location(44294, -47642, -792, 50000),
  73. new Location(-116677, 46824, 360, 34828)
  74. };
  75. public TheValentineEvent(int questId, String name, String descr)
  76. {
  77. super(questId, name, descr);
  78. addStartNpc(_npc);
  79. addFirstTalkId(_npc);
  80. addTalkId(_npc);
  81. for (Location loc : _spawns)
  82. {
  83. addSpawn(_npc, loc, false, 0);
  84. }
  85. }
  86. @Override
  87. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  88. {
  89. final QuestState st = player.getQuestState(getName());
  90. if (st == null)
  91. {
  92. return getNoQuestMsg(player);
  93. }
  94. String htmltext = event;
  95. if (event.equalsIgnoreCase("4301-3.htm"))
  96. {
  97. if (st.isCompleted())
  98. {
  99. htmltext = "4301-4.htm";
  100. }
  101. else
  102. {
  103. st.giveItems(_recipe, 1);
  104. st.playSound("Itemsound.quest_itemget");
  105. st.setState(State.COMPLETED);
  106. }
  107. }
  108. return htmltext;
  109. }
  110. @Override
  111. public String onFirstTalk(L2Npc npc, L2PcInstance player)
  112. {
  113. if (player.getQuestState(getName()) == null)
  114. {
  115. newQuestState(player);
  116. }
  117. return npc.getNpcId() + ".htm";
  118. }
  119. public static void main(String[] args)
  120. {
  121. new TheValentineEvent(-1, "TheValentineEvent", "events");
  122. }
  123. }