Axelut

Rebirth Manager aCis 398

Nov 15th, 2024
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. diff --git java/net/sf/l2j/gameserver/model/actor/instance/NoblesseNpc.java
  4. new file mode 100644
  5. index 0000000..0aa51ef
  6. --- /dev/null
  7. +++ java/net/sf/l2j/gameserver/model/actor/instance/NoblesseNpc.java
  8. @@ -0,0 +1,88 @@
  9. +package net.sf.l2j.gameserver.model.actor.instance;
  10. +
  11. +import net.sf.l2j.gameserver.model.actor.Player;
  12. +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  13. +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
  14. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  15. +
  16. +public final class NoblesseNpc extends Folk
  17. +{
  18. + private static final int BLACK_CROWN = 9210;
  19. + private static final int GOLD_CROWN = 9211;
  20. + private static final int RED_CROWN = 9212;
  21. + private static final int SILVER_CROWN = 9213;
  22. + private static final int NOBLESSE_TIARA = 7694;
  23. +
  24. + public NoblesseNpc(int objectId, NpcTemplate template)
  25. + {
  26. + super(objectId, template);
  27. + }
  28. +
  29. + @Override
  30. + public void onBypassFeedback(Player player, String command)
  31. + {
  32. + if (command.startsWith("becomeNoblesse"))
  33. + {
  34. + if (player.isNoble())
  35. + {
  36. + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  37. + html.setFile("data/html/l2jmods/noblessmanager/noblesse-already.htm");
  38. +
  39. + player.sendPacket(html);
  40. + return;
  41. + }
  42. + else if (player.getStatus().getLevel() < 78)
  43. + {
  44. + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  45. + html.setFile("data/html/l2jmods/noblessmanager/noblesse-level.htm");
  46. + player.sendPacket(html);
  47. + return;
  48. + }
  49. + else if (player.getInventory().getItemByItemId(BLACK_CROWN) == null || player.getInventory().getItemByItemId(GOLD_CROWN) == null || player.getInventory().getItemByItemId(RED_CROWN) == null || player.getInventory().getItemByItemId(SILVER_CROWN) == null)
  50. + {
  51. + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  52. + html.setFile("data/html/l2jmods/noblessmanager/noblesse-crowns.htm");
  53. + player.sendPacket(html);
  54. + return;
  55. + }
  56. + else if (player.getPvpKills() < 50)
  57. + {
  58. + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  59. + html.setFile("data/html/l2jmods/noblessmanager/noblesse-pvpkills.htm");
  60. + player.sendPacket(html);
  61. + return;
  62. + }
  63. + else
  64. + {
  65. + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  66. + html.setFile("data/html/l2jmods/noblessmanager/noblesse-successfully.htm");
  67. +
  68. + player.destroyItemByItemId("Consume", BLACK_CROWN, 1, player, true);
  69. + player.destroyItemByItemId("Consume", GOLD_CROWN, 1, player, true);
  70. + player.destroyItemByItemId("Consume", RED_CROWN, 1, player, true);
  71. + player.destroyItemByItemId("Consume", SILVER_CROWN, 1, player, true);
  72. + player.addItem("Loot", NOBLESSE_TIARA, 1, player, true);
  73. + player.setNoble(true, true);
  74. + player.sendPacket(html);
  75. + player.sendPacket(new ExShowScreenMessage("Parabens! Voce virou Nobless!", 6000));
  76. + }
  77. + }
  78. + else
  79. + super.onBypassFeedback(player, command);
  80. + }
  81. +
  82. + @Override
  83. + public void showChatWindow(Player player)
  84. + {
  85. + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  86. + html.setFile("data/html/l2jmods/noblessmanager/noblesse.htm");
  87. + html.replace("%objectId%", String.valueOf(player.getTargetId()));
  88. + html.replace("%blackcrown%", player.getInventory().getItemByItemId(BLACK_CROWN) == null ? "l2ui.CheckBox" : "l2ui.CheckBox_checked");
  89. + html.replace("%goldcrown%", player.getInventory().getItemByItemId(GOLD_CROWN) == null ? "l2ui.CheckBox" : "l2ui.CheckBox_checked");
  90. + html.replace("%redcrown%", player.getInventory().getItemByItemId(RED_CROWN) == null ? "l2ui.CheckBox" : "l2ui.CheckBox_checked");
  91. + html.replace("%silvercrown%", player.getInventory().getItemByItemId(SILVER_CROWN) == null ? "l2ui.CheckBox" : "l2ui.CheckBox_checked");
  92. + html.replace("%level%", player.getStatus().getLevel() < 78 ? "l2ui.CheckBox" : "l2ui.CheckBox_checked");
  93. + html.replace("%pvptonobles%", player.getPvpKills() < 50 ? "l2ui.CheckBox" : "l2ui.CheckBox_checked");
  94. + player.sendPacket(html);
  95. + }
  96. +}
  97. \ No newline at end of file
  98.  
Add Comment
Please, Sign In to add comment