Advertisement
Guest User

Nobless Manager

a guest
Jul 19th, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1.  
  2. /*
  3. * This program is free software: you can redistribute it and/or modify it under
  4. * the terms of the GNU General Public License as published by the Free Software
  5. * Foundation, either version 3 of the License, or (at your option) any later
  6. * version.
  7. *
  8. * This program is distributed in the hope that it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  11. * details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. package custom.NoblesseManager;
  17.  
  18. import com.l2jserver.gameserver.model.actor.L2Npc;
  19. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  20. import com.l2jserver.gameserver.model.quest.Quest;
  21. import com.l2jserver.gameserver.model.quest.QuestState;
  22. import com.l2jserver.gameserver.instancemanager.QuestManager;
  23. import com.l2jserver.gameserver.network.serverpackets.UserInfo;
  24.  
  25. /*********************************
  26. * @author Gladicek *
  27. * Custom Npc 'Noblesse Manager' *
  28. ********************************/
  29.  
  30. public class NoblesseManager extends Quest
  31. {
  32. // Npc
  33. private static final int NpcId = 49296; // Custom Npc
  34. // Item
  35. private static final int ItemId = 6673; // Festival Adena
  36. private static final int NOBLESS_TIARA = 7694;
  37. // Level check
  38. private static final int LEVEL = 75;
  39.  
  40. public NoblesseManager(int questId, String name, String descr)
  41. {
  42. super(questId, name, descr);
  43. addStartNpc(NpcId);
  44. addFirstTalkId(NpcId);
  45. addTalkId(NpcId);
  46. }
  47.  
  48. @Override
  49. public String onFirstTalk(L2Npc npc, L2PcInstance player)
  50. {
  51. QuestState st = player.getQuestState(getName());
  52. if (st == null)
  53. {
  54. Quest q = QuestManager.getInstance().getQuest(getName());
  55. st = q.newQuestState(player);
  56. }
  57. return "49296.htm";
  58. }
  59.  
  60. @Override
  61. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  62. {
  63. String htmltext = event;
  64. final QuestState st = player.getQuestState(getName());
  65.  
  66. if (event.equalsIgnoreCase("noblesse"))
  67. {
  68. if (st.getQuestItemsCount(ItemId) >= 10 && player.getLevel() >= LEVEL) // 10x Festival Adena and "LEVEL" check
  69. {
  70. st.takeItems(ItemId,10);
  71. player.setNoble(!player.isNoble());
  72. st.giveItems(NOBLESS_TIARA,1);
  73. player.sendPacket(new UserInfo(player));
  74. player.sendMessage("Congratulations! You are now Noblesse!");
  75. return null;
  76. }
  77. else
  78. return "49296-no.htm";
  79. }
  80. else if (event.equalsIgnoreCase("49296-1.htm"))
  81. {
  82. if (player.isNoble())
  83. {
  84. return "49296-already.htm";
  85. }
  86. }
  87. return htmltext;
  88. }
  89.  
  90. public static void main(String[] args)
  91. {
  92. new NoblesseManager(-1, "NoblesseManager", "custom");
  93. _log.info("NoblesseManager: Loaded successfully.");
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement