Jump to content
  • 0

Create a Rune of Drop


Question

6 answers to this question

Recommended Posts

  • 0
Posted
14 hours ago, barao45 said:

Hi People! Does anyone know how I can create an object that increases the percentage of the character's drop?. I'm using L2jSunrise.

Drop chance or quantity? Also what kind of object? java object? ingame object like item/skill?

  • 0
Posted

I made a stat that increased Drop chance/amount, you can add that stat to items, skills, etc. Post your drop related files (all multiplierstrategies.java) to see if its compatible with the one I made (I use l2jmaster files)

 

  • 0
Posted

Not a working code, but maybe can help you out to start. 
 

public class RuneOfDrop extends ItemInstance
{
    private static final int RUNE_OF_DROP_ITEM_ID = 12345; // Replace with your desired item ID
    private static final int DROP_BONUS_PERCENTAGE = 25; // Increase drop by 25%

    public RuneOfDrop(int objectId, Item template)
    {
        super(objectId, template);
    }

    @Override
    public void onEquip(Player player)
    {
        applyDropBonus(player);
    }

    @Override
    public void onUnequip(Player player)
    {
        removeDropBonus(player);
    }

    private void applyDropBonus(Player player)
    {
        double dropBonus = DROP_BONUS_PERCENTAGE / 100.0;
        player.getStat().mergeAdd(ModifierType.DROP, dropBonus);
    }

    private void removeDropBonus(Player player)
    {
        double dropBonus = DROP_BONUS_PERCENTAGE / 100.0;
        player.getStat().mergeRemove(ModifierType.DROP, dropBonus);
    }

    @Override
    public void onLogout(Player player)
    {
        if (!player.getInventory().hasItemId(RUNE_OF_DROP_ITEM_ID))
        {
            removeDropBonus(player);
        }
    }

    public static Item createInstance(int objectId, int count)
    {
        Item template = new Item(RUNE_OF_DROP_ITEM_ID);
        template.setName("Rune of Drop"); // Replace with your desired name
        template.setType2(ItemType.TYPE2_OTHER); // Adjust the item type as needed
        template.setEtcItemType(EtcItemType.RUNE); // Adjust the item type as needed
        template.setWeight(10); // Set the desired weight
        template.setReuseDelay(0); // Set the desired reuse delay
        template.setCrystalType(CrystalGrade.C); // Adjust the crystal grade as needed
        template.setBodyPart(0); // Set the desired body part

        // Set the weapon type if applicable, or remove the line if not a weapon
        template.setWeaponType(WeaponType.SWORD);

        template.setMaterial(ItemMaterialType.MAGIC; // Adjust the material type as needed

        ItemInstance instance = new RuneOfDrop(objectId, template);
        instance.setCount(count); // Set the desired count

        return instance;
    }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock