Jump to content

Recommended Posts

Posted

This is based on Interlude L2J, but it is adapted to other Chronicles too.

 

It protects the server from some kind of Enchant exploits ( Is not already shared )

 

Here is the Diff file:

Index: /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java
===================================================================
--- /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java (revision 12)
+++ /trunk/Eclipse-Game/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java (revision 164)
@@ -61,8 +61,20 @@
         L2PcInstance activeChar = getClient().getActiveChar();
         if (activeChar == null || _objectId == 0) return;
+        
+        if (activeChar.isProcessingTransaction())
+        {
+        	activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+        	activeChar.setActiveEnchantItem(null);
+        	return;
+        }

         L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
         L2ItemInstance scroll = activeChar.getActiveEnchantItem();
-        activeChar.setActiveEnchantItem(null);
+        if (item == null || scroll == null)
+        {
+        	activeChar.setActiveEnchantItem(null);
+        	return;
+        }
+        
         if (item == null || scroll == null) return;
         
@@ -74,5 +86,6 @@
         {
         	activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
-            return;
+        	activeChar.setActiveEnchantItem(null);
+        	return;
         }
     	
@@ -89,4 +102,26 @@
             return;
         }
+        
+        switch (item.getLocation())
+        {
+        case INVENTORY:
+        case PAPERDOLL:
+        {
+        	if (item.getOwnerId() != activeChar.getObjectId())
+        	{
+        		activeChar.setActiveEnchantItem(null);
+        		return;
+        	}
+        	break;
+        }
+        default:
+        {
+        	Util.handleIllegalPlayerAction(activeChar,"Player "
+        			+activeChar.getName()
+        			+" tried to use enchant Exploit!", IllegalPlayerAction.PUNISH_KICKBAN);
+        	return;
+        }
+        }
+        
         int itemType2 = item.getItem().getType2();
         boolean enchantItem = false;

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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