Add a handler on Lifestone like Potion (check ex. Mana potions).
And then create a new ItemHandler with name LifeStone.java
and inside you must write the proper code. Do the checks
1. If player's weapon (Base on PaperItemDoll - RHAND) is null
L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (item == null)
{
}
2. If player's weapon is augmented or can be augment
if (item.isAugmented() || item.isHeroItem() || item.getItem().getCrystalType() == 0 || item.getItem().getCrystalType() == 1 || item.getItem().getCrystalType() == 2)
{
return;
}
3. Remove the augment stats.
4. Generate new augment stats and apply them.
L2Augmentation augmentation = new L2Augmentation(attributes, idaugment, levelaugment);
augmentation.applyBonus(player);
item.setAugmentation(augmentation);
L2ItemInstance[] unequipped = player.getInventory().unEquipItemInBodySlotAndRecord(item.getItem().getBodyPart());
InventoryUpdate iu = new InventoryUpdate();
for (L2ItemInstance itm : unequipped)
{
iu.addModifiedItem(itm);
}
player.sendPacket(iu);
5. Destroy the lifestone (Item that pressed)
player.getInventory().destroyItemById("Destroy", item.getItemId(), 1, player, true);
Also don't forget to run this
SQL REPLACE INTO item_attributes VALUES(?,?,?,?)
so it can be saved in Database also.