Jump to content
  • 0

Enchanting over max enchant


Question

Posted

Hello guys, i am using l2j interlude client and the problem is that for example if max enchant is +25 and player tries by mistake to enchant to +26 the item brakes.. i want it not to brake, how can i do that?

13 answers to this question

Recommended Posts

  • 0
Posted

add this

if (item.getEnchantLevel() >= maxEnchantLevel && maxEnchantLevel != 0)
        {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            return;
        }

  • 0
Posted

add this

if (item.getEnchantLevel() >= maxEnchantLevel && maxEnchantLevel != 0)
        {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            return;
        }

where? what file?

  • 0
Posted

RequestEnchantItem.java

 

find this:

else // its an armor 
        {
            maxEnchantLevel = Config.ENCHANT_MAX_ARMOR;
            
            for (int scrollId : ENCHANT_SCROLLS)
                if(scroll.getItemId() == scrollId)
                {
                    chance = Config.ENCHANT_CHANCE_ARMOR;
                    enchantBreak = Config.ENCHANT_BREAK_ARMOR;
                    break;
                }
            for (int scrollId : CRYSTAL_SCROLLS)
                if(scroll.getItemId() == scrollId)
                {
                    chance = Config.ENCHANT_CHANCE_ARMOR_CRYSTAL;
                    enchantBreak = Config.ENCHANT_BREAK_ARMOR_CRYSTAL;
                    break;
                }
            for (int scrollId : BLESSED_SCROLLS)
                if(scroll.getItemId() == scrollId)
                {
                    chance = Config.ENCHANT_CHANCE_ARMOR_BLESSED;
                    enchantBreak = Config.ENCHANT_BREAK_ARMOR_BLESSED;
                    break;
                }
        }

and paste the code below

  • 0
Posted

what pack/chronicle u use?

Hello guys, i am using l2j interlude client and the problem is that for example if max enchant is +25 and player tries by mistake to enchant to +26 the item brakes.. i want it not to brake, how can i do that?

interlude l2j server..

  • 0
Posted

Im not sure dude, but i think that problem is here

if (Rnd.get(100) < chance)
        {
            synchronized(item)
            {
            	if (item.getOwnerId() != activeChar.getObjectId() // has just lost the item
            	    || (item.getEnchantLevel() >= maxEnchantLevel && maxEnchantLevel != 0))
            	{
            		activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            		return;
            	}

 

Since u got a check for max enchant on a wep/armor for a successful enchant, but not if wasn't successful.

So try to delete check from there and put it above. as i have said before..

 

if (item.getEnchantLevel() >= maxEnchantLevel && maxEnchantLevel != 0)
        {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            return;
        }

if (Rnd.get(100) < chance)
        {
            synchronized(item)
            {
            	if (item.getOwnerId() != activeChar.getObjectId() // has just lost the item)
            	{
            		activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            		return;
            	}

  • 0
Posted

Im not sure dude, but i think that problem is here

if (Rnd.get(100) < chance)
        {
            synchronized(item)
            {
            	if (item.getOwnerId() != activeChar.getObjectId() // has just lost the item
            	    || (item.getEnchantLevel() >= maxEnchantLevel && maxEnchantLevel != 0))
            	{
            		activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            		return;
            	}

 

Since u got a check for max enchant on a wep/armor for a successful enchant, but not if wasn't successful.

So try to delete check from there and put it above. as i have said before..

 

if (item.getEnchantLevel() >= maxEnchantLevel && maxEnchantLevel != 0)
        {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            return;
        }

if (Rnd.get(100) < chance)
        {
            synchronized(item)
            {
            	if (item.getOwnerId() != activeChar.getObjectId() // has just lost the item)
            	{
            		activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
            		return;
            	}

not working, someone else can help me pls? its serious problem fast pls

  • 0
Posted

Yes,you have the code wrong.That's why it brokes.

this code ban a player that enchant over the max enchant, what i want is when you try to overenchant with SCROLLS to say innapopriate enchant condition or whatever

Guest
This topic is now closed to further replies.


×
×
  • 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