Example of code:
Thus, we can set the removal of the rollback to the instance to which the group belongs.
As example items 13011, 13299, 20028 remove reuse of instances in group 3 - player.removeInstanceReusesByGroupId(3);
The group of instances itself must be specified in the XML file - the path gameserver\data\instances. Parameter sharedReuseGroup="3"
Also you can remove reuse of Instance by ID. Example:
Where param player.removeInstanceReuse(24);
this way we can rollback to a specific instance, not a group
How to compile you own code - https://lucera2.com/threads/how-to-add-your-quests-or-subsystems-to-an-assembly.1406/
Code:
package handler.items;
import l2.gameserver.model.Player;
import l2.gameserver.model.items.ItemInstance;
import l2.gameserver.network.l2.s2c.SystemMessage;
public class Kamaloka extends SimpleItemHandler
{
private static final int[] ITEM_IDS = new int[] { 13010, 13297, 20026, 13011, 13298, 20027, 13012, 13299, 20028 };
@Override
public int[] getItemIds()
{
return ITEM_IDS;
}
@Override
protected boolean useItemImpl(Player player, ItemInstance item, boolean ctrl)
{
int itemId = item.getItemId();
switch(itemId)
{
case 13010:
case 13297:
case 20026:
useItem(player, item, 1);
player.removeInstanceReusesByGroupId(1);
break;
case 13011:
case 13298:
case 20027:
useItem(player, item, 1);
player.removeInstanceReusesByGroupId(2);
break;
case 13012:
case 13299:
case 20028:
useItem(player, item, 1);
player.removeInstanceReusesByGroupId(3);
break;
}
player.sendPacket(new SystemMessage(SystemMessage.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS).addItemName(itemId));
return false;
}
}
Thus, we can set the removal of the rollback to the instance to which the group belongs.
As example items 13011, 13299, 20028 remove reuse of instances in group 3 - player.removeInstanceReusesByGroupId(3);
The group of instances itself must be specified in the XML file - the path gameserver\data\instances. Parameter sharedReuseGroup="3"
Also you can remove reuse of Instance by ID. Example:
Code:
package handler.items;
import l2.gameserver.model.Player;
import l2.gameserver.model.items.ItemInstance;
import l2.gameserver.network.l2.s2c.SystemMessage;
public class Kamaloka extends SimpleItemHandler
{
private static final int[] ITEM_IDS = new int[] { 13010, 13297, 20026, 13011, 13298, 20027, 13012, 13299, 20028 };
@Override
public int[] getItemIds()
{
return ITEM_IDS;
}
@Override
protected boolean useItemImpl(Player player, ItemInstance item, boolean ctrl)
{
int itemId = item.getItemId();
switch(itemId)
{
case 13010:
case 13297:
case 20026:
useItem(player, item, 1);
player.removeInstanceReuse(22);
break;
case 13011:
case 13298:
case 20027:
useItem(player, item, 1);
player.removeInstanceReuse(23);
break;
case 13012:
case 13299:
case 20028:
useItem(player, item, 1);
player.removeInstanceReuse(24);
break;
}
player.sendPacket(new SystemMessage(SystemMessage.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS).addItemName(itemId));
return false;
}
}
Where param player.removeInstanceReuse(24);
this way we can rollback to a specific instance, not a group
How to compile you own code - https://lucera2.com/threads/how-to-add-your-quests-or-subsystems-to-an-assembly.1406/
Last edited: