FortuneTelling.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 custom.FortuneTelling;
  16. import com.l2jserver.gameserver.model.actor.L2Npc;
  17. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  18. import com.l2jserver.gameserver.model.quest.Quest;
  19. import com.l2jserver.gameserver.model.quest.QuestState;
  20. import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  21. /**
  22. * @authors Kerberos (python), Nyaran (java)
  23. */
  24. public class FortuneTelling extends Quest
  25. {
  26. private static final String qn = "FortuneTelling";
  27. private static final int ADENA = 57;
  28. private static final int COST = 1000;
  29. private static final int NPC = 32616;
  30. private static final String[] FORTUNE =
  31. {
  32. "What you\'ve endured will return as a benefit.",
  33. "The dragon now acquires an eagle\'s wings.",
  34. "Be warned as you may be overwhelmed by surroundings if you lack a clear opinion.",
  35. "A new trial or start may be successful as luck shadows changes.",
  36. "You may feel nervous and anxious because of unfavorable situations.",
  37. "You may meet the person you\'ve longed to see.",
  38. "You may meet many new people but it will be difficult to find a perfect person who wins your heart.",
  39. "Good fortune and opportunity may lie ahead as if one's born in a golden spoon.",
  40. "Be confident and act tenaciously at all times. You may be able to accomplish to perfection during somewhat unstable situations.",
  41. "There may be an occasion where you are consoled by people.",
  42. "Be independent at all times.",
  43. "Do not loosen up with your precautions.",
  44. "Closely observe people who pass by since you may meet a precious person who can help you.",
  45. "Listen to the advice that's given to you with a humble attitude.",
  46. "Focus on networking with like-minded people. They may join you for a big mission in the future.",
  47. "Staying busy rather than being stationary will help.",
  48. "You may lose your drive and feel lost.",
  49. "People around you will encourage your every task in the future.",
  50. "Be kind to and care for those close to you, they may help in the future.",
  51. "Your ambition and dream will come true.",
  52. "Your value will shine as your potential is finally realized.",
  53. "If you keep smiling without despair, people will come to trust you and offer help.",
  54. "There may be a little loss, but think of it as an investment for yourself.",
  55. "The difficult situations will turn to hope with unforeseen help.",
  56. "Impatience may lie ahead as the situation is unfavorable.",
  57. "Be responsible with your tasks but do not hesitate to ask for colleagues\' help.",
  58. "You may fall in danger each time when acting upon improvisation.",
  59. "A determined act after prepared research will attract people.",
  60. "A rest will promise a bigger development.",
  61. "You will be rewarded for your efforts and accomplishments.",
  62. "There are many things to consider after encountering hindrances.",
  63. "Consider other\'s situations and treat them sincerely at all times.",
  64. "A comparison to others may be helpful.",
  65. "Be cautious to control emotions as temptations are nearby.",
  66. "Momentarily delay an important decision.",
  67. "Be confident and act tenaciously at all times. You may be able to accomplish to perfection during somewhat unstable situations.",
  68. "Visiting a place you\'ve never been before may bring luck.",
  69. "What used to be well managed may stumble one after another.",
  70. "Your steady pursuit of new information and staying ahead of others will raise your value.",
  71. "Being neutral is a good way to go, but clarity may be helpful contrary to your hesitance.",
  72. "Skillful evasion is needed when dealing with people who pick fights as a disaster may arise from it.",
  73. "Small things make up big things so even value trivial matters.",
  74. "Bigger mistakes will be on the road if you fail to correct a small mistake.",
  75. "Momentarily delay an important decision.",
  76. "A remedy is on its way for a serious illness."
  77. };
  78. public FortuneTelling(int questId, String name, String descr)
  79. {
  80. super(questId, name, descr);
  81. addStartNpc(NPC);
  82. addTalkId(NPC);
  83. }
  84. @Override
  85. public String onTalk(L2Npc npc, L2PcInstance player)
  86. {
  87. QuestState st = player.getQuestState(qn);
  88. NpcHtmlMessage html = new NpcHtmlMessage(1);
  89. String PARENT_DIR = "data/scripts/custom/FortuneTelling/";
  90. if (st == null)
  91. return null;
  92. if (st.getQuestItemsCount(ADENA) < COST)
  93. html.setFile(player.getHtmlPrefix(), PARENT_DIR + "lowadena.htm");
  94. else
  95. {
  96. st.takeItems(ADENA, COST);
  97. html.setFile(player.getHtmlPrefix(), PARENT_DIR + "fortune.htm");
  98. html.replace("%fortune%", FORTUNE[st.getRandom(FORTUNE.length)]);
  99. }
  100. st.exitQuest(true);
  101. player.sendPacket(html);
  102. return null;
  103. }
  104. public static void main(String args[])
  105. {
  106. new FortuneTelling(-1, qn, "custom");
  107. }
  108. }