Advertisement
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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
- */
- package net.sf.l2j.gameserver.handler.itemhandlers;
- import net.sf.l2j.gameserver.data.SkillTable;
- import net.sf.l2j.gameserver.handler.IItemHandler;
- import net.sf.l2j.gameserver.model.actor.Playable;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- import net.sf.l2j.gameserver.model.pledge.Clan;
- import net.sf.l2j.gameserver.model.pledge.ClanMember;
- public class ClanFullCrystal implements IItemHandler {
- @Override
- public void useItem(Playable playable, ItemInstance item, boolean forceUse) {
- if (!(playable instanceof Player))
- return;
- Player activeChar = (Player) playable;
- Clan clan = activeChar.getClan();
- if (clan == null) {
- activeChar.sendMessage("You do not have clan!");
- return;
- }
- if (clan.getLeader().getPlayerInstance() != activeChar) {
- activeChar.sendMessage("You are not leader of this clan!");
- return;
- }
- if (activeChar.getClan().getClanSkills().values().size() == 22) {
- activeChar.sendMessage("You already have full clan skills!");
- return;
- }
- if (clan.getLevel() < 8)
- clan.changeLevel(8);
- for (Player player : clan.getOnlineMembers())
- player.setPledgeClass(ClanMember.calculatePledgeClass(player));
- //clan doesnt have any skills or not all of the skills
- if (activeChar.getClan().getClanSkills().values().size() == 0 || activeChar.getClan().getClanSkills().values().size() < 22) {
- //so lets give the clan all fucking skills
- for (int i = 370; i <= 391; i++) {
- clan.addNewSkill(SkillTable.getInstance().getInfo(i, SkillTable.getInstance().getMaxLevel(i)));
- clan.updateClanInDB();
- activeChar.getClan().broadcastClanStatus();
- }
- activeChar.destroyItem("Consume", item.getObjectId(), 1, null, true);
- activeChar.sendMessage("Your clan is now level 8 and has full skills!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement