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