How to work with Extractable Items aka Capsule Items

Deazer

Head Developer
Staff member
Path: gameserver/data/capsule_items.xml

Format:
<capsule itemId="8534"> The id of the box from which will be the extract of items
<item id="853" The item that will drop
min="1" Minimal amount
max="1" Maximum amount
chance="34." /> The chance to get an item
The total chance should not exceed 100%, if it is below 100%, then there is a chance that nothing will drop out of the box.

Code:
<capsule itemId="8534">
  <item id="853" min="1" max="1" chance="34." />
  <item id="916" min="1" max="1" chance="33." />
  <item id="884" min="1" max="1" chance="33." />
</capsule>

You can also add additional items to open chest.
Example:
<capsule itemId="8534" requiredItemId="4037" requiredItemAmount="1">
<item id="853" min="1" max="1" chance="34." />
<item id="916" min="1" max="1" chance="33." />
<item id="884" min="1" max="1" chance="33." />
</capsule>
Where:
requiredItemId - the id item needed to open the chest
requiredItemAmount - the number of items from the requiredItemId to open the chest


Also, we can specify the sharpening of objects with the extract from the box
Example:
<capsule itemId="9000">
<item id="6656" min="1" max="1" chance="34." enchant_min="6" enchant_max="6"/>
<item id="6657" min="1" max="1" chance="33." enchant_min="1" enchant_max="2"/>
<item id="6658" min="1" max="1" chance="33." enchant_min="6" enchant_max="10"/>
</capsule>
Where:
Enchant_min - minimum value of enchant
Enchant_max - maximum value of enchant
 
Last edited:
It is possible to add multiple items drop from 1 capsule?
For example open capsule item id=70000
and after open capsure drop
item id=9990 chance 100%
item id=9991 chance 100%
item id=9992 chance 100%
item id=9993 chance 100%
 
you can add inside one more capsule, capsule cannot be opened automatically.
 
In high five and some other chronicles i've seen for example:
Newbie gift (item)
double click this item and recive full no grade equipment, and some consumables
is possible?
 
In high five and some other chronicles i've seen for example:
Newbie gift (item)
double click this item and recive full no grade equipment, and some consumables
is possible?
Of course, mother of god
Example:
<capsule itemId="capsule_id">
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="consumable_id" min="1" max="1" chance="100." />
<item id="consumable_id" min="1" max="1" chance="100." />
<item id="consumable_id" min="1" max="1" chance="100." />
</capsule>
 
Is there a way to make a capsule open with a certain level?

If not, could you add that option please?
 
Is it possible to spawn a mob with capsule?
Like
<capsule itemId="8534">
<npcid="20004" min="1" max="1" chance="100." />
</capsule>
no is not, you can write extension for spawn NPC from item.
For example:

Spawn NpcId 20001 on Use item 100500 and spawn 20002 on use item 100501
also you can add check zones and etc etc etc.
Code:
package handler.items;

import l2.gameserver.model.Player;
import l2.gameserver.model.items.ItemInstance;
import l2.gameserver.utils.NpcUtils;

public class SpawnNpcItem extends SimpleItemHandler
{
    private static final int[] ITEM_IDS = new int[] { 100500, 100501 };

    @Override
    public int[] getItemIds()
    {
        return ITEM_IDS;
    }

    @Override
    protected boolean useItemImpl(Player player, ItemInstance item, boolean ctrl)
    {
        int itemId = item.getItemId();
      
        if(!useItem(player, item, 1))
            return false;
      
        switch(itemId)
        {
            case 100500:
                NpcUtils.spawnSingle(20001, player.getLoc(), 120000L);
                break;
            case 100501:
                NpcUtils.spawnSingle(20002, player.getLoc(), 120000L);
                break;
            default:
                return false;
        }

        return true;
    }
}
 
Last edited:
Of course, mother of god
Example:
<capsule itemId="capsule_id">
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="equip_id" min="1" max="1" chance="100." />
<item id="consumable_id" min="1" max="1" chance="100." />
<item id="consumable_id" min="1" max="1" chance="100." />
<item id="consumable_id" min="1" max="1" chance="100." />
</capsule>
Hola estoy recien empezando, como seria para frozen ya que la mayoría esta así
8483;6912,18,30;6914,4,22;8351,7,17;8375,1,5;8378,1,24;-1,0,2
 
Back
Top