Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +/*
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2, or (at your option)
- +* any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- +* 02111-1307, USA.
- +*
- +* http://www.gnu.org/copyleft/gpl.html
- +*/
- +package net.sf.l2j.gameserver.handler.itemhandlers;
- +
- +/**
- +*
- +*
- +* @author Coyote
- +* Adapted by Strike
- +* Re-Adapted by Hann1bal
- +*/
- +
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.handler.IItemHandler;
- +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- +import net.sf.l2j.gameserver.model.actor.Playable;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- +
- +public class ClanRepsItem implements IItemHandler
- +{
- + private static final int ITEM_IDS[] =
- + {
- + Config.CR_ITEM_REPS_ITEM_ID
- + };
- + @Override
- + public void useItem(Playable playable, ItemInstance item, boolean forceUse)
- + {
- + if (!(playable instanceof Player))
- + {
- + return;
- + }
- +
- + Player activeChar = (Player)playable;
- +
- + if (!activeChar.isClanLeader())
- + {
- + activeChar.sendMessage("This can be used only by Clan Leaders!");
- + return;
- + }
- +
- + else if (!(activeChar.getClan().getLevel() >= Config.CR_ITEM_MIN_CLAN_LVL))
- + {
- + activeChar.sendMessage("Your Clan Level is not big enough to use this item!");
- + return;
- + }
- + else
- + {
- + activeChar.getClan().addReputationScore(Config.CR_ITEM_REPS_TO_BE_AWARDED);
- + activeChar.sendMessage("Your clan has earned "+ Config.CR_ITEM_REPS_TO_BE_AWARDED +" rep points!");
- + MagicSkillUse MSU = new MagicSkillUse(activeChar, activeChar, 2024, 1, 1, 0);
- + activeChar.broadcastPacket(MSU);
- + playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
- + }
- + }
- +
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- +}
Add Comment
Please, Sign In to add comment