Jump to content
  • 0

Custom Item With Stats


Alex13xD

Question

Hello, I'm trying to make an item that when you own it or activate it, like you activate your soulshots (if it's posible) to give some stats on the player.

Here is what I have done so far and still not working:

 

Item xml:

<item id="60000" type="EtcItem" name="Pandora's Item">
		<set name="icon" val="icon.etc_armor_soul_i00" />
		<set name="immediate_effect" val="1" />
		<set name="default_action" val="soulshot" />
		<set name="material" val="paper" />
		<set name="price" val="0" />
		<set name="is_tradable" val="false" />
		<set name="is_dropable" val="false" />
		<set name="is_sellable" val="false" />
		<set name="time" val="1440" />
		<set name="handler" val="Cactive" />
		<set name="item_skill" val="30412-1" />
	</item>

Skill xml:

<skill id="30412" levels="1" name="Pandora's Item">
		<set name="target" val="TARGET_SELF" />
		<set name="skillType" val="SOULSHOT" />
		<set name="operateType" val="OP_ACTIVE" />
		<for>
			<mul order="0x40" stat="rExp" val="2" />
			<mul order="0x30" stat="regMp" val="1.20" />
			<mul order="0x30" stat="runSpd" val="1.05" />
			<add order="0x40" stat="maxHp" val="1000" />
		</for>
	</skill>

Cactive handler (toke it from L2J_DataPack/dist/game/data/scripts/handlers/itemhandlers/SoulShot.java:

I wanted to make the item active with right-click and shine like soulshot and get the stats

package handlers.itemhandlers;

import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;



public class Cactive implements IItemHandler
{
	/**
	 * 
	 * @see com.l2jserver.gameserver.handler.IItemHandler#useItem(com.l2jserver.gameserver.model.actor.L2Playable, com.l2jserver.gameserver.model.L2ItemInstance, boolean)
	 */
	public void useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
	{
		if (!(playable instanceof L2PcInstance))
			return;
		
		L2PcInstance activeChar = (L2PcInstance) playable;
		
		
		int itemId = item.getItemId();
			
		
		activeChar.soulShotLock.lock();
		try
		{
		}
		finally
		{
			activeChar.soulShotLock.unlock();
		}
		@SuppressWarnings("unused")
		int skillId = 0;
		switch (itemId)
		{
			case 60000:
				skillId=30412;
				break;
			case 60001:
				skillId=30413;
				break;
				
		}
	}
}

What I have done wrong and how to fix it or if it's a way to get the stats just the item to be inside inventory or something like that.

Thanks for your time :) 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...