All pastes #36945 Raw Edit

Someone

public text v1 · immutable
#36945 ·published 2006-01-16 04:05 UTC
rendered paste body
/*
 * 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.skillhandlers;

import net.sf.l2j.gameserver.handler.ISkillHandler;
import net.sf.l2j.gameserver.handler.SkillHandler;
import net.sf.l2j.gameserver.model.L2Character;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2PcInstance;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.L2Skill.SkillType;
import net.sf.l2j.gameserver.serverpackets.StatusUpdate;
import net.sf.l2j.gameserver.serverpackets.SystemMessage;
/**
 * This class ...
 * 
 * @version $Revision: 1.1.2.2.2.4 $ $Date: 2005/04/06 16:13:48 $
 */

public class Craft implements ISkillHandler
{
	// all the items ids that this handler knowns
	//private static Logger _log = Logger.getLogger(Heal.class.getName());
	
	/* (non-Javadoc)
	 * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
	 */
	private static SkillType[] _skillIds = {SkillType.CRAFT};
	
	/* (non-Javadoc)
	 * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
	 */
	public void useSkill(L2Character actChar, L2Skill skill, L2Object[] targets)
	{
	    //L2Character activeChar = actChar;
		//check for other effects
	    try {
		ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(SkillType.CRAFT);
		if (handler != null)
		    handler.useSkill(actChar, skill, targets);
	    } catch (Exception e) {}

        L2Character target = null; // sets target to null
		
		L2ItemInstance weaponInst = actChar.getActiveWeaponInstance(); // get weapon in hand ?useless?
		
        for(int index = 0;index < targets.length;index++)
        {
            target = (L2Character)targets[index];
			            
            //We should not craft if character is dead
            if(target == null || target.isDead())
            {
                continue;
            }
            
			double power = skill.getPower();
            
           	if (target instanceof L2PcInstance)
			{
				SystemMessage sm2 = new SystemMessage(614);
				sm2.addString("Recipe book has been open.");
				target.sendPacket(sm2);
			}
		}
	    
	}
	
	
	public SkillType[] getSkillIds()
	{
		return _skillIds;
	}
}