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.


  • Posts

    • Still looking for adaption on Vanganth GF extender adapted for modern client.
    • Why the fuck would u implement russian / polak memes into a codebase a customer uses..   Jesus christ grow up
    • ➡ Discount for your purchase: APRIL (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • ➡ Discount for your purchase: APRIL (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • Okay, I understand. First, to get started by contributing to open projects and learning along the way. Then, when you mention starting my own project privately, do you mean taking a free datapack like L2jMobius and trying to make it functional for an online server? Great, thank you very much — all this information is really helpful. I’ve been reaching out to several server admins here in Argentina, but it seems like none of them have the time or interest to take on an intern or assistant. xd   P.S.: Are you the creator of Hopzone? Brings back memories of when I was a kid, downloading servers at the cyber café. For two dollars, I could spend the whole day playing and eating candy like crazy.   Another question: between L2jMobius, L2jServer, and aCis, which one has ALL of its code free? As you probably noticed, I'm using ChatGPT to help me translate things, lol, and it suggested the following: Project Status Open Source Accepts Juniors? Difficulty L2JMobius Very active Semi-closed Partially (with patches) Medium-High L2JServer Active Fully open Yes (directly on GitHub) Medium aCis Semi-active Unofficial Not very clear Low
  • Topics

×
×
  • Create New...