Advertisement
Guest User

ClanFullCrystal_v2.java

a guest
Nov 18th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  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 net.sf.l2j.gameserver.handler.itemhandlers;
  16.  
  17. import net.sf.l2j.gameserver.data.SkillTable;
  18. import net.sf.l2j.gameserver.handler.IItemHandler;
  19. import net.sf.l2j.gameserver.model.actor.Playable;
  20. import net.sf.l2j.gameserver.model.actor.Player;
  21. import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  22. import net.sf.l2j.gameserver.model.pledge.Clan;
  23. import net.sf.l2j.gameserver.model.pledge.ClanMember;
  24. public class ClanFullCrystal implements IItemHandler {
  25.  
  26. @Override
  27. public void useItem(Playable playable, ItemInstance item, boolean forceUse) {
  28. if (!(playable instanceof Player))
  29. return;
  30.  
  31. Player activeChar = (Player) playable;
  32.  
  33. Clan clan = activeChar.getClan();
  34.  
  35. if (clan == null) {
  36. activeChar.sendMessage("You do not have clan!");
  37. return;
  38. }
  39.  
  40. if (clan.getLeader().getPlayerInstance() != activeChar) {
  41. activeChar.sendMessage("You are not leader of this clan!");
  42. return;
  43. }
  44.  
  45. if (activeChar.getClan().getClanSkills().values().size() == 22) {
  46. activeChar.sendMessage("You already have full clan skills!");
  47. return;
  48. }
  49.  
  50. if (clan.getLevel() < 8)
  51. clan.changeLevel(8);
  52.  
  53. for (Player player : clan.getOnlineMembers())
  54. player.setPledgeClass(ClanMember.calculatePledgeClass(player));
  55.  
  56. //clan doesnt have any skills or not all of the skills
  57. if (activeChar.getClan().getClanSkills().values().size() == 0 || activeChar.getClan().getClanSkills().values().size() < 22) {
  58.  
  59. //so lets give the clan all fucking skills
  60. for (int i = 370; i <= 391; i++) {
  61. clan.addNewSkill(SkillTable.getInstance().getInfo(i, SkillTable.getInstance().getMaxLevel(i)));
  62. clan.updateClanInDB();
  63. activeChar.getClan().broadcastClanStatus();
  64. }
  65.  
  66. activeChar.destroyItem("Consume", item.getObjectId(), 1, null, true);
  67. activeChar.sendMessage("Your clan is now level 8 and has full skills!");
  68.  
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement