Advertisement
VANPER

Clan Item Full

Feb 11th, 2020
1,429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.08 KB | None | 0 0
  1. Index: net.sf.l2j.gameserver.handler.itemhandlers;ClanItem.java
  2. ===================================================================
  3. --- net.sf.l2j.gameserver.handler.itemhandlers;ClanItem.java (revision 84)
  4. +++ net.sf.l2j.gameserver.handler.itemhandlers;ClanItem.java (working copy)
  5.  
  6. +   package net.sf.l2j.gameserver.handler.itemhandlers;
  7. +  
  8. +   import net.sf.l2j.gameserver.data.SkillTable;
  9. +   import net.sf.l2j.gameserver.handler.IItemHandler;
  10. +   import net.sf.l2j.gameserver.model.L2Skill;
  11. +   import net.sf.l2j.gameserver.model.actor.Playable;
  12. +   import net.sf.l2j.gameserver.model.actor.instance.Player;
  13. +   import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  14. +  
  15. +   public class ClanItem implements IItemHandler
  16. +   {
  17. +       private final int reputation = 150000;
  18. +       private final byte level = 8;
  19. +  
  20. +       // id skills
  21. +       private final int[] clanSkills =
  22. +       {
  23. +           370,
  24. +           371,
  25. +           372,
  26. +           373,
  27. +           374,
  28. +           375,
  29. +           376,
  30. +           377,
  31. +           378,
  32. +           379,
  33. +           380,
  34. +           381,
  35. +           382,
  36. +           383,
  37. +           384,
  38. +           385,
  39. +           386,
  40. +           387,
  41. +           388,
  42. +           389,
  43. +           390,
  44. +           391
  45. +       };
  46. +  
  47. +       @Override
  48. +       public void useItem(Playable playable, ItemInstance item, boolean forceUse)
  49. +       {
  50. +           if (!(playable instanceof Player))
  51. +               return;
  52. +  
  53. +           Player activeChar = (Player) playable;
  54. +  
  55. +           if (activeChar.isClanLeader())
  56. +           {
  57. +               if (activeChar.getClan().getLevel() == 8)
  58. +               {
  59. +                   activeChar.sendMessage("Your clan is already maximum level!");
  60. +                   return;
  61. +               }
  62. +  
  63. +               activeChar.getClan().changeLevel(level);
  64. +               activeChar.getClan().addReputationScore(reputation);
  65. +  
  66. +               for (int s : clanSkills)
  67. +               {
  68. +                   L2Skill clanSkill = SkillTable.getInstance().getInfo(s, SkillTable.getInstance().getMaxLevel(s));
  69. +                   activeChar.getClan().addNewSkill(clanSkill);
  70. +               }
  71. +  
  72. +               activeChar.sendSkillList();
  73. +               activeChar.getClan().updateClanInDB();
  74. +               activeChar.sendMessage("Your clan Level/Skills/Reputation has been updated!");
  75. +               playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
  76. +               activeChar.broadcastUserInfo();
  77. +           }
  78. +           else
  79. +               activeChar.sendMessage("You are not the clan leader.");
  80. +  
  81. +           return;
  82. +       }
  83. +   }
  84. +  
  85.  
  86. Index: net.sf.l2j.gameserver.handler;ItemHandler.java
  87. ===================================================================
  88. --- net.sf.l2j.gameserver.handler;ItemHandler.java (revision 84)
  89. +++ net.sf.l2j.gameserver.handler;ItemHandler.java (working copy)
  90.  
  91. +   import net.sf.l2j.gameserver.handler.itemhandlers.ClanItem;
  92.  
  93.  
  94. +   registerItemHandler(new ClanItem());
  95.  
  96. Index: data/xml/ItemClan.xml
  97. ===================================================================
  98. --- data/xml/ItemClan.xml (revision 84)
  99. +++ data/xml/ItemClan.xml (working copy)
  100.  
  101. +   <?xml version="1.0" encoding="UTF-8"?>
  102. +   <list>
  103. +       <item id="9505" type="EtcItem" name="Clan Full">
  104. +       <set name="material" val="STEEL" />
  105. +       <set name="is_destroyable" val="false" />
  106. +       <set name="is_dropable" val="false" />
  107. +       <set name="is_sellable" val="false" />
  108. +       <set name="is_stackable" val="true" />
  109. +       <set name="handler" val="ClanItem" />
  110. +       </item>
  111. +   </list>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement