Axelut

Noble Item

May 10th, 2023
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: net.sf.l2j.gameserver.handler.itemhandlers;NobleItem.java
  2. ===================================================================
  3. --- net.sf.l2j.gameserver.handler.itemhandlers;NobleItem.java (revision 84)
  4. +++ net.sf.l2j.gameserver.handler.itemhandlers;NobleItem.java (working copy)
  5.  
  6. +   package net.sf.l2j.gameserver.handler.itemhandlers;
  7. +  
  8. +   import net.sf.l2j.gameserver.handler.IItemHandler;
  9. +   import net.sf.l2j.gameserver.model.actor.Playable;
  10. +   import net.sf.l2j.gameserver.model.actor.instance.Player;
  11. +   import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  12. +   import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
  13. +  
  14. +   public class NobleItem implements IItemHandler
  15. +   {
  16. +       @Override
  17. +       public void useItem(Playable playable, ItemInstance item, boolean forceUse)
  18. +       {
  19. +           if (!(playable instanceof Player))
  20. +               return;
  21. +          
  22. +           Player activeChar = (Player) playable;
  23. +           if (activeChar.isNoble())
  24. +           {
  25. +               activeChar.sendMessage("You Are Already A Noblesse!");
  26. +               return;
  27. +           }
  28. +          
  29. +           activeChar.broadcastPacket(new SocialAction(activeChar, 16));
  30. +           activeChar.setNoble(true, true);
  31. +           activeChar.sendMessage("You Are Now a Noble! Check your skills.");
  32. +           activeChar.broadcastUserInfo();
  33. +           playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
  34. +       }
  35. +   }
  36. +  
  37.  
  38. Index: net.sf.l2j.gameserver.handler;ItemHandler.java
  39. ===================================================================
  40. --- net.sf.l2j.gameserver.handler;ItemHandler.java (revision 84)
  41. +++ net.sf.l2j.gameserver.handler;ItemHandler.java (working copy)
  42.  
  43. +   import net.sf.l2j.gameserver.handler.itemhandlers.NobleItem;
  44.  
  45.  
  46. +   registerItemHandler(new NobleItem());
  47.  
  48. Index: data/xml/ItemClan.xml
  49. ===================================================================
  50. --- data/xml/ItemClan.xml (revision 84)
  51. +++ data/xml/ItemClan.xml (working copy)
  52.  
  53. +   <?xml version="1.0" encoding="UTF-8"?>
  54. +   <list>
  55. +       <item id="9506" type="EtcItem" name="Clan Full">
  56. +       <set name="material" val="STEEL" />
  57. +       <set name="is_destroyable" val="false" />
  58. +       <set name="is_dropable" val="false" />
  59. +       <set name="is_sellable" val="false" />
  60. +       <set name="is_stackable" val="true" />
  61. +       <set name="handler" val="NobleItem" />
  62. +       </item>
  63. +   </list>
Add Comment
Please, Sign In to add comment